Coverage Report

Created: 2026-04-09 11:41

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/sw/inc/view.hxx
Line
Count
Source
1
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
/*
3
 * This file is part of the LibreOffice project.
4
 *
5
 * This Source Code Form is subject to the terms of the Mozilla Public
6
 * License, v. 2.0. If a copy of the MPL was not distributed with this
7
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8
 *
9
 * This file incorporates work covered by the following license notice:
10
 *
11
 *   Licensed to the Apache Software Foundation (ASF) under one or more
12
 *   contributor license agreements. See the NOTICE file distributed
13
 *   with this work for additional information regarding copyright
14
 *   ownership. The ASF licenses this file to you under the Apache
15
 *   License, Version 2.0 (the "License"); you may not use this file
16
 *   except in compliance with the License. You may obtain a copy of
17
 *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
18
 */
19
#ifndef INCLUDED_SW_INC_VIEW_HXX
20
#define INCLUDED_SW_INC_VIEW_HXX
21
22
#include <vcl/timer.hxx>
23
#include <sfx2/viewsh.hxx>
24
#include <sfx2/objsh.hxx>
25
#include <editeng/svxenum.hxx>
26
#include <sfx2/zoomitem.hxx>
27
#include <svx/ruler.hxx>
28
#include <svx/fmshell.hxx>
29
#include <svx/svdobj.hxx>
30
#include <svl/style.hxx>
31
#include "swdllapi.h"
32
#include "swtypes.hxx"
33
#include "shellid.hxx"
34
#include "viewsh.hxx"
35
#include "names.hxx"
36
37
#include <svx/sdr/overlay/overlayobject.hxx>
38
39
class SwTextFormatColl;
40
class SwPageDesc;
41
class SwFrameFormat;
42
class SwCharFormat;
43
class SwNumRule;
44
class SwGlossaryHdl;
45
class SwDrawBase;
46
class SvxLRSpaceItem;
47
class SwDocShell;
48
class SwScrollbar;
49
class SvBorder;
50
class Ruler;
51
class SvxSearchItem;
52
class SearchAttrItemList;
53
class SvxSearchDialog;
54
class SdrPageView;
55
class SwEditWin;
56
class SwWrtShell;
57
class SwView_Impl;
58
struct SwSearchOptions;
59
class CommandEvent;
60
class InsCaptionOpt;
61
class SvGlobalName;
62
class SwTransferable;
63
class SwMailMergeConfigItem;
64
class SwTextNode; // #i23726#
65
class SwFormatClipboard;
66
struct SwConversionArgs;
67
class GraphicFilter;
68
class SwPostItMgr;
69
enum class SotExchangeDest;
70
enum class SvxSearchCmd;
71
enum class SelectionType : sal_Int32;
72
class SwNode;
73
class SwMarkName;
74
75
namespace com::sun::star::view { class XSelectionSupplier; }
76
namespace sfx2 { class FileDialogHelper; }
77
namespace weld { class Scrollbar; }
78
79
const tools::Long nLeftOfst = -370;
80
const tools::Long nScrollX  =   30;
81
const tools::Long nScrollY  =   30;
82
83
312
#define MINZOOM 20
84
0
#define MAXZOOM 600
85
86
0
#define MAX_MARKS 5
87
88
enum class ShellMode
89
{
90
    Text,
91
    Frame,
92
    Graphic,
93
    Object,
94
    Draw,
95
    DrawForm,
96
    DrawText,
97
    Bezier,
98
    ListText,
99
    TableText,
100
    TableListText,
101
    Media,
102
    ExtrudedCustomShape,
103
    FontWork,
104
    PostIt
105
};
106
107
// apply a template
108
struct SwApplyTemplate
109
{
110
    union
111
    {
112
        SwTextFormatColl* pTextColl;
113
        SwPageDesc*   pPageDesc;
114
        SwFrameFormat*     pFrameFormat;
115
        SwCharFormat*    pCharFormat;
116
        SwNumRule*    pNumRule;
117
    } aColl;
118
119
    SfxStyleFamily eType;
120
    sal_uInt16 nColor;
121
    SwFormatClipboard* m_pFormatClipboard;
122
    size_t nUndo;     //< The initial undo stack depth.
123
124
    SwApplyTemplate() :
125
0
        eType(SfxStyleFamily::None),
126
0
        nColor(0),
127
0
        m_pFormatClipboard(nullptr),
128
0
        nUndo(0)
129
0
    {
130
0
        aColl.pTextColl = nullptr;
131
0
    }
132
};
133
134
class SwView;
135
136
// manage connection and disconnection of SwView and SwDocShell
137
class SwViewGlueDocShell
138
{
139
private:
140
    SwView& m_rView;
141
public:
142
    SwViewGlueDocShell(SwView& rView, SwDocShell& rDocSh);
143
    ~SwViewGlueDocShell();
144
};
145
146
// view of a document
147
class SW_DLLPUBLIC SwView: public SfxViewShell
148
{
149
    friend class SwHHCWrapper;
150
    friend class SwHyphWrapper;
151
    friend class SwView_Impl;
152
    friend class SwClipboardChangeListener;
153
154
    // selection cycle
155
    struct SelectCycle
156
    {
157
        Point m_pInitialCursor;
158
        Point m_MarkPt;
159
        Point m_PointPt;
160
        sal_uInt16 nStep;
161
162
        SelectCycle() :
163
3.93k
            nStep(0) {}
164
    };
165
166
    // search & replace
167
    static SvxSearchItem           *s_pSrchItem;
168
169
    static sal_uInt16       s_nMoveType; // for buttons below the scrollbar (viewmdi)
170
    static sal_Int32        s_nActMark; // current jump mark for unknown mark
171
172
    static bool             s_bExtra;
173
    static bool             s_bFound;
174
    static bool             s_bJustOpened;
175
176
    static std::unique_ptr<SearchAttrItemList> s_xSearchList;
177
    static std::unique_ptr<SearchAttrItemList> s_xReplaceList;
178
179
    Timer               m_aTimer;         // for delayed ChgLnks during an action
180
    OUString            m_sSwViewData,
181
    //and the new cursor position if the user double click in the PagePreview
182
                        m_sNewCursorPos;
183
    // to support keyboard the number of the page to go to can be set too
184
    sal_uInt16              m_nNewPage;
185
186
    sal_uInt16          m_nOldPageNum;
187
    UIName              m_sOldSectionName;
188
189
    Point               m_aTabColFromDocPos;  // moving table columns out of the document
190
    SwTextNode           * m_pNumRuleNodeFromDoc; // Moving indent of numrule #i23726#
191
192
    Size                m_aDocSz;         // current document size
193
    tools::Rectangle           m_aVisArea;       // visible region
194
195
    VclPtr<SwEditWin>    m_pEditWin;
196
    std::unique_ptr<SwWrtShell> m_pWrtShell;
197
    std::unique_ptr<SwViewGlueDocShell> m_xGlueDocShell;
198
199
    SfxShell            *m_pShell;        // current SubShell at the dispatcher
200
    FmFormShell         *m_pFormShell;    // DB-FormShell
201
202
    std::unique_ptr<SwView_Impl> m_pViewImpl;     // Impl-data for UNO + Basic
203
204
    VclPtr<SwScrollbar>  m_pHScrollbar,   // MDI control elements
205
                         m_pVScrollbar;
206
207
    bool                m_bHScrollbarEnabled;
208
    bool                m_bVScrollbarEnabled;
209
210
    VclPtr<SvxRuler>    m_pHRuler,
211
                        m_pVRuler;
212
213
    std::unique_ptr<SwGlossaryHdl> m_pGlosHdl;          // handle text block
214
    std::unique_ptr<SwDrawBase>    m_pDrawActual;
215
216
    const SwFrameFormat      *m_pLastTableFormat;
217
    const SwFrameFormat* m_pLastFlyFormat;
218
219
    std::unique_ptr<SwFormatClipboard> m_pFormatClipboard; //holds data for format paintbrush
220
221
    std::unique_ptr<SwPostItMgr> m_pPostItMgr;
222
223
    SelectionType       m_nSelectionType;
224
    sal_uInt16          m_nPageCnt;
225
226
    // current draw mode
227
    sal_uInt16          m_nDrawSfxId;
228
    OUString            m_sDrawCustom; //some drawing types are marked with strings!
229
    sal_uInt16          m_nFormSfxId;
230
    SdrObjKind          m_eFormObjKind;
231
    SotExchangeDest     m_nLastPasteDestination;
232
233
    // save the border distance status from SwView::StateTabWin to re-use it in SwView::ExecTabWin()
234
    sal_uInt16          m_nLeftBorderDistance;
235
    sal_uInt16          m_nRightBorderDistance;
236
237
    SvxSearchCmd        m_eLastSearchCommand;
238
239
    bool m_bWheelScrollInProgress;
240
    double          m_fLastZoomScale = 0;
241
    double          m_fAccumulatedZoom = 0;
242
243
    bool            m_bCenterCursor : 1,
244
                    m_bTopCursor : 1,
245
                    m_bTabColFromDoc : 1,
246
                    m_bTabRowFromDoc : 1,
247
                    m_bSetTabColFromDoc : 1 ,
248
                    m_bSetTabRowFromDoc : 1,
249
                    m_bAttrChgNotified : 1,
250
                    m_bAttrChgNotifiedWithRegistrations : 1,
251
                    m_bVerbsActive : 1,
252
                    m_bDrawRotate : 1,
253
                    m_bDrawSelMode : 1,
254
                    m_bShowAtResize : 1,
255
                    m_bInOuterResizePixel : 1,
256
                    m_bInInnerResizePixel : 1,
257
                    m_bPasteState : 1,
258
                    m_bPasteSpecialState : 1,
259
                    m_bInMailMerge : 1,
260
                    m_bInDtor : 1, //detect destructor to prevent creating of sub shells while closing
261
                    m_bOldShellWasPagePreview : 1,
262
                    m_bIsPreviewDoubleClick : 1, // #i114045#
263
                    m_bMakeSelectionVisible : 1, // transport the bookmark selection
264
                    m_bForceChangesToolbar : 1;  // on load of documents with change tracking
265
    bool m_bInitOnceCompleted = false;
266
267
    /// LibreOfficeKit has to force the page size for PgUp/PgDown
268
    /// functionality based on the user's view, instead of using the m_aVisArea.
269
    SwTwips         m_nLOKPageUpDownOffset;
270
271
    SelectCycle m_aSelectCycle;
272
273
    int m_nMaxOutlineLevelShown = 10;
274
275
    bool m_bIsSpotlightCharDF = false;
276
    bool m_bIsSpotlightParaStyles = false;
277
    bool m_bIsSpotlightCharStyles = false;
278
279
    bool m_bDying = false;
280
281
    static constexpr sal_uInt16 MAX_ZOOM_PERCENT = 600;
282
    static constexpr sal_uInt16 MIN_ZOOM_PERCENT = 20;
283
284
    // methods for searching
285
    // set search context
286
    SAL_DLLPRIVATE bool          SearchAndWrap(bool bApi);
287
    SAL_DLLPRIVATE sal_Int32 SearchAll();
288
    SAL_DLLPRIVATE sal_Int32     FUNC_Search( const SwSearchOptions& rOptions );
289
    SAL_DLLPRIVATE void          Replace();
290
291
    bool                        IsDocumentBorder();
292
293
    SAL_DLLPRIVATE bool          IsTextTool() const;
294
295
    DECL_DLLPRIVATE_LINK( TimeoutHdl, Timer*, void );
296
297
170
    tools::Long GetXScroll() const { return (m_aVisArea.GetWidth() * nScrollX) / 100; }
298
170
    tools::Long GetYScroll() const { return (m_aVisArea.GetHeight() * nScrollY) / 100; }
299
300
    SAL_DLLPRIVATE Point         AlignToPixel(const Point& rPt) const;
301
    SAL_DLLPRIVATE void          CalcPt( Point* pPt,const tools::Rectangle& rRect,
302
                                    sal_uInt16 nRangeX,
303
                                    sal_uInt16 nRangeY,
304
                                    ScrollSizeMode eScrollSizeMode);
305
306
    SAL_DLLPRIVATE bool          GetPageScrollUpOffset(SwTwips& rOff) const;
307
    SAL_DLLPRIVATE bool          GetPageScrollDownOffset(SwTwips& rOff) const;
308
309
    // scrollbar movements
310
    SAL_DLLPRIVATE bool          PageUp();
311
    SAL_DLLPRIVATE bool          PageDown();
312
    SAL_DLLPRIVATE bool          PageUpCursor(bool bSelect);
313
    SAL_DLLPRIVATE bool          PageDownCursor(bool bSelect);
314
    SAL_DLLPRIVATE void          PhyPageUp();
315
    SAL_DLLPRIVATE void          PhyPageDown();
316
317
    SAL_DLLPRIVATE void           CreateScrollbar( bool bHori );
318
    DECL_DLLPRIVATE_LINK(HoriScrollHdl, weld::Scrollbar&, void);
319
    DECL_DLLPRIVATE_LINK(VertScrollHdl, weld::Scrollbar&, void);
320
    SAL_DLLPRIVATE void EndScrollHdl(const weld::Scrollbar& rScrollbar, bool bHorizontal);
321
    SAL_DLLPRIVATE bool          UpdateScrollbars();
322
    DECL_DLLPRIVATE_LINK( WindowChildEventListener, VclWindowEvent&, void );
323
    SAL_DLLPRIVATE void          CalcVisArea( const Size &rPixelSz );
324
325
    // linguistics functions
326
    SAL_DLLPRIVATE void          HyphenateDocument();
327
    SAL_DLLPRIVATE bool          IsDrawTextHyphenate();
328
    SAL_DLLPRIVATE void          HyphenateDrawText();
329
    SAL_DLLPRIVATE void          StartThesaurus();
330
331
    // text conversion
332
    SAL_DLLPRIVATE void          StartTextConversion( LanguageType nSourceLang, LanguageType nTargetLang, const vcl::Font *pTargetFont, sal_Int32 nOptions, bool bIsInteractive );
333
334
    // used for spell checking and text conversion
335
    SAL_DLLPRIVATE void          SpellStart( SvxSpellArea eSpell, bool bStartDone,
336
                                        bool bEndDone, SwConversionArgs *pConvArgs );
337
    SAL_DLLPRIVATE void          SpellEnd( SwConversionArgs const *pConvArgs );
338
339
    SAL_DLLPRIVATE void          HyphStart( SvxSpellArea eSpell );
340
    SAL_DLLPRIVATE void          SpellContext(bool bOn = true)
341
0
                                 { m_bCenterCursor = bOn; }
342
343
    // for readonly switching
344
    SAL_DLLPRIVATE virtual void  Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override;
345
    SAL_DLLPRIVATE void          CheckReadonlyState();
346
    SAL_DLLPRIVATE void          CheckReadonlySelection();
347
348
    // method for rotating PageDesc
349
    SAL_DLLPRIVATE void          SwapPageMargin(const SwPageDesc&, SvxLRSpaceItem& rLR);
350
351
    SAL_DLLPRIVATE void          SetZoom_( const Size &rEditSz,
352
                                      SvxZoomType eZoomType,
353
                                      short nFactor,
354
                                      bool bViewOnly);
355
    SAL_DLLPRIVATE void          CalcAndSetBorderPixel( SvBorder &rToFill );
356
357
    SAL_DLLPRIVATE void          ShowAtResize();
358
359
    // XForms mode: change XForms mode, based on design mode
360
    SAL_DLLPRIVATE void          UpdateXformsViewOption(bool bDesignMode);
361
362
    SAL_DLLPRIVATE virtual void  Move() override;
363
364
public: // #i123922# Needs to be called from a 2nd place now as a helper method
365
    SAL_DLLPRIVATE bool          InsertGraphicDlg( SfxRequest& );
366
    sal_Int32 m_nNaviExpandedStatus = -1;
367
0
    void            SetFormShell( FmFormShell* pSh )    { m_pFormShell = pSh; }
368
    virtual void    SelectShell();
369
370
protected:
371
372
14.3k
    SwView_Impl*    GetViewImpl() {return m_pViewImpl.get();}
373
374
    void ImpSetVerb( SelectionType nSelType );
375
376
0
    SelectionType   GetSelectionType() const { return m_nSelectionType; }
377
0
    void            SetSelectionType(SelectionType nSet) { m_nSelectionType = nSet;}
378
379
    // for SwWebView
380
0
    void            SetShell( SfxShell* pS )            { m_pShell = pS; }
381
382
    virtual void    Activate(bool) override;
383
    virtual void    Deactivate(bool) override;
384
    virtual void    InnerResizePixel( const Point &rOfs, const Size &rSize, bool inplaceEditModeChange ) override;
385
    virtual void    OuterResizePixel( const Point &rOfs, const Size &rSize ) override;
386
387
0
    const SwFrameFormat* GetLastTableFrameFormat() const {return m_pLastTableFormat;}
388
0
    void            SetLastTableFrameFormat(const SwFrameFormat* pSet) {m_pLastTableFormat = pSet;}
389
390
    void MoveNavigation(bool bNext);
391
392
    // form letter execution
393
    void    GenerateFormLetter(bool bUseCurrentDocument);
394
395
    using SfxShell::GetDispatcher;
396
397
public:
398
    SFX_DECL_VIEWFACTORY(SwView);
399
    SFX_DECL_INTERFACE(SW_VIEWSHELL)
400
401
private:
402
    /// SfxInterface initializer.
403
    static void InitInterface_Impl();
404
405
public:
406
    SfxDispatcher   &GetDispatcher();
407
408
    void                    GotFocus() const;
409
    virtual SdrView*        GetDrawView() const override;
410
    virtual bool            HasUIFeature(SfxShellFeature nFeature) const override;
411
    virtual void            ShowCursor( bool bOn = true ) override;
412
    virtual ErrCode         DoVerb(sal_Int32 nVerb) override;
413
414
    virtual sal_uInt16      SetPrinter( SfxPrinter* pNew,
415
                                        SfxPrinterChangeFlags nDiff = SFX_PRINTER_ALL) override;
416
    ShellMode               GetShellMode() const;
417
418
    css::view::XSelectionSupplier*       GetUNOObject();
419
420
    OUString                GetSelectionTextParam( bool bCompleteWords,
421
                                                   bool bEraseTrail );
422
    virtual bool            HasSelection( bool bText = true ) const override;
423
    virtual OUString        GetSelectionText( bool bCompleteWords = false, bool bOnlyASample = false ) override;
424
    virtual bool            PrepareClose( bool bUI = true ) override;
425
    virtual void            MarginChanged() override;
426
427
    // replace word/selection with text from the thesaurus
428
    // (this code has special handling for "in word" character)
429
    void                    InsertThesaurusSynonym( const OUString &rSynonmText, const OUString &rLookUpText, bool bValidSelection );
430
    bool                    IsValidSelectionForThesaurus() const;
431
    OUString                GetThesaurusLookUpText( bool bSelection ) const;
432
433
    // immediately switch shell -> for GetSelectionObject
434
    void                    StopShellTimer();
435
436
258k
    SwWrtShell&      GetWrtShell   () const { return *m_pWrtShell; }
437
168k
    SwWrtShell*      GetWrtShellPtr() const { return  m_pWrtShell.get(); }
438
439
118k
    SwEditWin &GetEditWin()        { return *m_pEditWin; }
440
0
    const SwEditWin &GetEditWin () const { return *m_pEditWin; }
441
442
#if defined(_WIN32) || defined UNX
443
    void ScannerEventHdl();
444
#endif
445
446
    // hand the handler for text blocks to the shell; create if applicable
447
    SwGlossaryHdl*          GetGlosHdl();
448
449
7.54k
    const tools::Rectangle& GetVisArea() const { return m_aVisArea; }
450
451
    bool            IsScroll(const tools::Rectangle& rRect) const;
452
    void            Scroll( const tools::Rectangle& rRect,
453
                            sal_uInt16 nRangeX = USHRT_MAX,
454
                            sal_uInt16 nRangeY = USHRT_MAX,
455
                            ScrollSizeMode eScrollSizeMode = ScrollSizeMode::ScrollSizeDefault);
456
457
    tools::Long            SetVScrollMax(tools::Long lMax);
458
    tools::Long            SetHScrollMax(tools::Long lMax);
459
460
    void            SpellError(LanguageType eLang);
461
    bool            ExecSpellPopup(const Point& rPt, bool bIsMouseEvent);
462
    void            ExecSmartTagPopup( const Point& rPt );
463
464
    DECL_DLLPRIVATE_LINK( OnlineSpellCallback, SpellCallbackInfo&, void );
465
    bool            ExecDrwTextSpellPopup(const Point& rPt);
466
467
0
    void            SetTabColFromDocPos( const Point &rPt ) { m_aTabColFromDocPos = rPt; }
468
0
    void            SetTabColFromDoc( bool b ) { m_bTabColFromDoc = b; }
469
0
    bool            IsTabColFromDoc() const    { return m_bTabColFromDoc; }
470
0
    void            SetTabRowFromDoc( bool b ) { m_bTabRowFromDoc = b; }
471
0
    bool            IsTabRowFromDoc() const    { return m_bTabRowFromDoc; }
472
473
    void            SetNumRuleNodeFromDoc( SwTextNode * pNumRuleNode )
474
0
                    { m_pNumRuleNodeFromDoc = pNumRuleNode; }
475
476
    void    DocSzChgd( const Size& rNewSize );
477
169
    const   Size&   GetDocSz() const { return m_aDocSz; }
478
    void    SetVisArea( const tools::Rectangle&, bool bUpdateScrollbar = true);
479
            void    SetVisArea( const Point&, bool bUpdateScrollbar = true);
480
            void    CheckVisArea();
481
482
    void RecheckBrowseMode();
483
    static SvxSearchDialog* GetSearchDialog();
484
485
    static sal_uInt16   GetMoveType();
486
    static void     SetMoveType(sal_uInt16 nSet);
487
    static void     SetActMark(sal_Int32 nSet);
488
489
    bool            HandleWheelCommands( const CommandEvent& );
490
    bool            HandleGestureZoomCommand(const CommandEvent&);
491
    bool            HandleGesturePanCommand(const CommandEvent&);
492
493
    // insert frames
494
    void            InsFrameMode(sal_uInt16 nCols);
495
496
    void            SetZoom( SvxZoomType eZoomType, short nFactor = 100, bool bViewOnly = false);
497
    virtual void    SetZoomFactor( double fX, double ) override;
498
499
    void            SetViewLayout( sal_uInt16 nColumns, bool bBookMode, bool bViewOnly = false );
500
501
    void            ShowHScrollbar(bool bShow);
502
    bool            IsHScrollbarVisible()const;
503
504
    void            ShowVScrollbar(bool bShow);
505
    bool            IsVScrollbarVisible()const;
506
507
    void            EnableHScrollbar(bool bEnable);
508
    void            EnableVScrollbar(bool bEnable);
509
510
    void            CreateVRuler();
511
    void            KillVRuler();
512
    void            CreateTab();
513
    void            KillTab();
514
515
0
    bool            StatVRuler() const { return m_pVRuler->IsVisible(); }
516
    void            ChangeVRulerMetric(FieldUnit eUnit);
517
    void            GetVRulerMetric(FieldUnit& rToFill) const;
518
519
0
    SvxRuler&       GetHRuler()    { return *m_pHRuler; }
520
0
    SvxRuler&       GetVRuler()    { return *m_pVRuler; }
521
    void            InvalidateRulerPos();
522
    void            ChangeTabMetric(FieldUnit eUnit);
523
    void            GetHRulerMetric(FieldUnit& rToFill) const;
524
525
    // Handler
526
    void            Execute(SfxRequest&);
527
    void            ExecLingu(SfxRequest&);
528
    void            ExecDlg(SfxRequest const &);
529
    void            ExecDlgExt(SfxRequest&);
530
    void            ExecColl(SfxRequest const &);
531
    void            ExecutePrint(SfxRequest&);
532
    void            ExecDraw(const SfxRequest&);
533
    void            ExecTabWin(SfxRequest const &);
534
    void            ExecuteStatusLine(SfxRequest&);
535
    DECL_DLLPRIVATE_LINK( ExecRulerClick, Ruler *, void );
536
    void            ExecSearch(SfxRequest&);
537
    void            ExecViewOptions(SfxRequest &);
538
    void            ExecNavigatorWin(const SfxRequest &);
539
540
    virtual bool    IsConditionalFastCall( const SfxRequest &rReq ) override;
541
542
    void            StateViewOptions(SfxItemSet &);
543
    void            StateSearch(SfxItemSet &);
544
    void            GetState(SfxItemSet&);
545
    void            StateStatusLine(SfxItemSet&);
546
    void            UpdateWordCount(SfxShell*, sal_uInt16);
547
    void            ExecFormatFootnote();
548
    void            ExecNumberingOutline(SfxItemPool &);
549
550
    // functions for drawing
551
    void            SetDrawFuncPtr(std::unique_ptr<SwDrawBase> pFuncPtr);
552
24
    SwDrawBase*     GetDrawFuncPtr() const  { return m_pDrawActual.get(); }
553
    void            GetDrawState(SfxItemSet &rSet);
554
    void            ExitDraw();
555
0
    bool     IsDrawRotate() const      { return m_bDrawRotate; }
556
0
    void     FlipDrawRotate()    { m_bDrawRotate = !m_bDrawRotate; }
557
0
    bool     IsDrawSelMode() const     { return m_bDrawSelMode; }
558
    void            SetSelDrawSlot();
559
0
    void     FlipDrawSelMode()   { m_bDrawSelMode = !m_bDrawSelMode; }
560
    void            NoRotate();     // turn off rotate mode
561
    void            ToggleRotate();     // switch between move and rotate mode
562
563
    bool            EnterDrawTextMode(const Point& aDocPos);
564
    /// Same as EnterDrawTextMode(), but takes an SdrObject instead of guessing it by document position.
565
    bool EnterShapeDrawTextMode(SdrObject* pObject);
566
0
    void            LeaveDrawCreate()   { m_nDrawSfxId = m_nFormSfxId = USHRT_MAX; m_sDrawCustom.clear(); m_eFormObjKind = SdrObjKind::NONE; }
567
14.3k
    bool            IsDrawMode() const  { return (m_nDrawSfxId != USHRT_MAX || m_nFormSfxId != USHRT_MAX); }
568
    bool            IsFormMode() const;
569
    bool            IsBezierEditMode() const;
570
    bool            AreOnlyFormsSelected() const;
571
    bool            HasOnlyObj(SdrObject const *pSdrObj, SdrInventor eObjInventor) const;
572
    bool            BeginTextEdit(  SdrObject* pObj, SdrPageView* pPV=nullptr,
573
                                    vcl::Window* pWin=nullptr, bool bIsNewObj=false, bool bSetSelectionToStart=false );
574
    bool isSignatureLineSelected() const;
575
    bool isSignatureLineSigned() const;
576
    bool isQRCodeSelected() const;
577
578
    void            StateTabWin(SfxItemSet&);
579
580
    // attributes have changed
581
    DECL_LINK( AttrChangedNotify, LinkParamNone*, void );
582
583
    // form control has been activated
584
    DECL_DLLPRIVATE_LINK( FormControlActivated, LinkParamNone*, void );
585
586
    // edit links
587
    void            EditLinkDlg();
588
    void            AutoCaption(const sal_uInt16 nType, const SvGlobalName *pOleId = nullptr);
589
    void            InsertCaption(const InsCaptionOpt *pOpt);
590
591
    // Async call by Core
592
    void UpdatePageNums();
593
594
    OUString    GetPageStr(sal_uInt16 nPhyNum, sal_uInt16 nVirtNum, const OUString& rPgStr);
595
596
    /// Force page size for PgUp/PgDown to overwrite the computation based on m_aVisArea.
597
    void ForcePageUpDownOffset(SwTwips nTwips)
598
0
    {
599
0
        m_nLOKPageUpDownOffset = nTwips;
600
0
    }
601
602
    // hand over Shell
603
34.6k
    SfxShell       *GetCurShell()  { return m_pShell; }
604
    SwDocShell     *GetDocShell();
605
0
    const SwDocShell *GetDocShell() const { return const_cast<SwView*>(this)->GetDocShell(); }
606
607
0
    virtual       FmFormShell    *GetFormShell()       override { return m_pFormShell; }
608
0
    virtual const FmFormShell    *GetFormShell() const override { return m_pFormShell; }
609
610
    // so that in the SubShells' DTors m_pShell can be reset if applicable
611
3.93k
    void ResetSubShell()    { m_pShell = nullptr; }
612
613
    virtual void    WriteUserData(OUString &, bool bBrowse = false) override;
614
    virtual void    ReadUserData(const OUString &, bool bBrowse = false) override;
615
    virtual void    ReadUserDataSequence ( const css::uno::Sequence < css::beans::PropertyValue >& ) override;
616
    virtual void    WriteUserDataSequence ( css::uno::Sequence < css::beans::PropertyValue >& ) override;
617
618
    void SetCursorAtTop( bool bFlag, bool bCenter = false )
619
2
        { m_bTopCursor = bFlag; m_bCenterCursor = bCenter; }
620
621
    bool JumpToSwMark( const SwMarkName& rMark );
622
623
    tools::Long InsertDoc( sal_uInt16 nSlotId, const OUString& rFileName,
624
                    const OUString& rFilterName, sal_Int16 nVersion = 0 );
625
626
    void ExecuteInsertDoc( SfxRequest& rRequest, const SfxPoolItem* pItem );
627
    tools::Long InsertMedium( sal_uInt16 nSlotId, std::unique_ptr<SfxMedium> pMedium, sal_Int16 nVersion );
628
    DECL_DLLPRIVATE_LINK( DialogClosedHdl, sfx2::FileDialogHelper *, void );
629
630
    // status methods for clipboard.
631
    // Status changes now notified from the clipboard.
632
    bool IsPasteAllowed();
633
    bool IsPasteSpecialAllowed();
634
    bool IsPasteSpreadsheet(bool bHasOwnTableCopied);
635
636
    // Enable mail merge - mail merge field dialog enabled
637
    void EnableMailMerge();
638
639
    SwView(SfxViewFrame& rFrame, SfxViewShell*);
640
    virtual ~SwView() override;
641
642
    void SetDying() override;
643
644
    void NotifyDBChanged();
645
646
    SfxObjectShellLock CreateTmpSelectionDoc();
647
648
    void        AddTransferable(SwTransferable& rTransferable);
649
650
    // store MailMerge data while "Back to Mail Merge Wizard" FloatingWindow is active
651
    // or to support printing
652
    void SetMailMergeConfigItem(std::shared_ptr<SwMailMergeConfigItem> const & rConfigItem);
653
    std::shared_ptr<SwMailMergeConfigItem> const & GetMailMergeConfigItem() const;
654
    std::shared_ptr<SwMailMergeConfigItem> EnsureMailMergeConfigItem(const SfxItemSet* pArgs = nullptr);
655
656
    OUString GetDataSourceName() const;
657
    static bool IsDataSourceAvailable(const OUString& sDataSourceName);
658
659
    void ExecFormatPaintbrush(SfxRequest const &);
660
    void StateFormatPaintbrush(SfxItemSet &);
661
662
    // public for D&D
663
    ErrCode     InsertGraphic( const OUString &rPath, const OUString &rFilter,
664
                            bool bLink, GraphicFilter *pFlt );
665
666
    void ExecuteScan( SfxRequest& rReq );
667
668
3.92M
    SwPostItMgr* GetPostItMgr() { return m_pPostItMgr.get();}
669
0
    const SwPostItMgr* GetPostItMgr() const { return m_pPostItMgr.get();}
670
671
    // exhibition hack (MA,MBA)
672
    void SelectShellForDrop();
673
674
    void UpdateDocStats();
675
676
0
    void SetMaxOutlineLevelShown(int nLevel) {m_nMaxOutlineLevelShown = nLevel;}
677
0
    int GetMaxOutlineLevelShown() const {return m_nMaxOutlineLevelShown;}
678
679
    // methods for printing
680
    SAL_DLLPRIVATE virtual   SfxPrinter*     GetPrinter( bool bCreate = false ) override;
681
    SAL_DLLPRIVATE virtual bool  HasPrintOptionsPage() const override;
682
    SAL_DLLPRIVATE virtual std::unique_ptr<SfxTabPage> CreatePrintOptionsPage(weld::Container* pPage, weld::DialogController* pController,
683
                                                    const SfxItemSet& rSet) override;
684
0
    static SvxSearchItem* GetSearchItem() { return s_pSrchItem; }
685
686
    /// See SfxViewShell::getPart().
687
    int getPart() const override;
688
    /// See SfxViewShell::dumpAsXml().
689
    void dumpAsXml(xmlTextWriterPtr pWriter) const override;
690
    void SetRedlineAuthor(const OUString& rAuthor);
691
    const OUString& GetRedlineAuthor() const;
692
    /// See SfxViewShell::afterCallbackRegistered().
693
    void afterCallbackRegistered() override;
694
    /// See SfxViewShell::NotifyCursor().
695
    void NotifyCursor(SfxViewShell* pViewShell) const override;
696
    /// See SfxViewShell::GetColorConfigColor().
697
    ::Color GetColorConfigColor(svtools::ColorConfigEntry nColorType) const override;
698
699
    void SetUIElementVisibility(const OUString& sElementURL, bool bShow) const;
700
    void ShowUIElement(const OUString& sElementURL) const;
701
    void HideUIElement(const OUString& sElementURL) const;
702
703
    enum CachedStringID
704
    {
705
        OldGrfCat,
706
        OldTabCat,
707
        OldFrameCat,
708
        OldDrwCat,
709
        CachedStrings
710
    };
711
712
    OUString m_StringCache[CachedStrings];
713
714
    const OUString& GetCachedString(CachedStringID id)
715
0
    {
716
0
        return m_StringCache[id];
717
0
    }
718
719
    void SetCachedString(CachedStringID id, const OUString& sStr)
720
0
    {
721
0
        m_StringCache[id] = sStr;
722
0
    }
723
724
    const OUString& GetOldGrfCat();
725
    void SetOldGrfCat(const OUString& sStr);
726
    const OUString& GetOldTabCat();
727
    void SetOldTabCat(const OUString& sStr);
728
    const OUString& GetOldFrameCat();
729
    void SetOldFrameCat(const OUString& sStr);
730
    const OUString& GetOldDrwCat();
731
    void SetOldDrwCat(const OUString& sStr);
732
733
    virtual tools::Rectangle getLOKVisibleArea() const override;
734
    virtual void flushPendingLOKInvalidateTiles() override;
735
    virtual std::optional<OString> getLOKPayload(int nType, int nViewId) const override;
736
    /// See SfxViewShell::getEditMode().
737
    int getEditMode() const override;
738
739
0
    bool IsSpotlightCharDF() const { return m_bIsSpotlightCharDF; }
740
8.23k
    bool IsSpotlightParaStyles() const { return m_bIsSpotlightParaStyles; }
741
8.23k
    bool IsSpotlightCharStyles() const { return m_bIsSpotlightCharStyles; }
742
743
private:
744
    AutoTimer m_aBringToAttentionBlinkTimer;
745
    size_t m_nBringToAttentionBlinkTimeOutsRemaining;
746
747
    std::unique_ptr<sdr::overlay::OverlayObject> m_xBringToAttentionOverlayObject;
748
749
    DECL_LINK(BringToAttentionBlinkTimerHdl, Timer*, void);
750
751
public:
752
    void BringToAttention(std::vector<basegfx::B2DRange>&& aRanges = {});
753
    void BringToAttention(const tools::Rectangle& rRect);
754
    void BringToAttention(const SwNode* pNode);
755
756
    /// See SfxViewShell::libreOfficeKitViewInvalidateTilesCallback().
757
    void libreOfficeKitViewInvalidateTilesCallback(const tools::Rectangle* pRect, int nPart,
758
                                                   int nMode) const override;
759
};
760
761
std::unique_ptr<SfxTabPage> CreatePrintOptionsPage(weld::Container* pPage, weld::DialogController* pController,
762
                                          const SfxItemSet &rOptions,
763
                                          bool bPreview);
764
765
extern bool bDocSzUpdated;
766
767
#endif
768
769
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */