tdf#164393 Change themes UI as per UX feedback
[LibreOffice.git] / sw / inc / view.hxx
blob3eba3163d33307ebcaf97080ac05798a73f0a4b1
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
19 #ifndef INCLUDED_SW_INC_VIEW_HXX
20 #define INCLUDED_SW_INC_VIEW_HXX
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"
35 #include <svx/sdr/overlay/overlayobject.hxx>
37 class SwTextFormatColl;
38 class SwPageDesc;
39 class SwFrameFormat;
40 class SwCharFormat;
41 class SwNumRule;
42 class SwGlossaryHdl;
43 class SwDrawBase;
44 class SvxLRSpaceItem;
45 class SwDocShell;
46 class SwScrollbar;
47 class SvBorder;
48 class Ruler;
49 class SvxSearchItem;
50 class SearchAttrItemList;
51 class SvxSearchDialog;
52 class SdrView;
53 class SdrPageView;
54 class SwEditWin;
55 class SwWrtShell;
56 class SwView_Impl;
57 struct SwSearchOptions;
58 class CommandEvent;
59 class InsCaptionOpt;
60 class SvGlobalName;
61 class SwTransferable;
62 class SwMailMergeConfigItem;
63 class SwTextNode; // #i23726#
64 class SwFormatClipboard;
65 struct SwConversionArgs;
66 class GraphicFilter;
67 class SwPostItMgr;
68 enum class SotExchangeDest;
69 class SwCursorShell;
70 enum class SvxSearchCmd;
71 enum class SelectionType : sal_Int32;
72 class SwNode;
74 namespace com::sun::star::view { class XSelectionSupplier; }
75 namespace sfx2 { class FileDialogHelper; }
76 namespace sw::mark { class Fieldmark; }
77 namespace weld { class Scrollbar; }
79 const tools::Long nLeftOfst = -370;
80 const tools::Long nScrollX = 30;
81 const tools::Long nScrollY = 30;
83 #define MINZOOM 20
84 #define MAXZOOM 600
86 #define MAX_MARKS 5
88 enum class ShellMode
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
107 // apply a template
108 struct SwApplyTemplate
110 union
112 SwTextFormatColl* pTextColl;
113 SwPageDesc* pPageDesc;
114 SwFrameFormat* pFrameFormat;
115 SwCharFormat* pCharFormat;
116 SwNumRule* pNumRule;
117 } aColl;
119 SfxStyleFamily eType;
120 sal_uInt16 nColor;
121 SwFormatClipboard* m_pFormatClipboard;
122 size_t nUndo; //< The initial undo stack depth.
124 SwApplyTemplate() :
125 eType(SfxStyleFamily::None),
126 nColor(0),
127 m_pFormatClipboard(nullptr),
128 nUndo(0)
130 aColl.pTextColl = nullptr;
134 class SwView;
136 // manage connection and disconnection of SwView and SwDocShell
137 class SwViewGlueDocShell
139 private:
140 SwView& m_rView;
141 public:
142 SwViewGlueDocShell(SwView& rView, SwDocShell& rDocSh);
143 ~SwViewGlueDocShell();
146 // view of a document
147 class SW_DLLPUBLIC SwView: public SfxViewShell
149 friend class SwHHCWrapper;
150 friend class SwHyphWrapper;
151 friend class SwView_Impl;
152 friend class SwClipboardChangeListener;
154 // selection cycle
155 struct SelectCycle
157 Point m_pInitialCursor;
158 Point m_MarkPt;
159 Point m_PointPt;
160 sal_uInt16 nStep;
162 SelectCycle() :
163 nStep(0) {}
166 // search & replace
167 static SvxSearchItem *s_pSrchItem;
169 static sal_uInt16 s_nMoveType; // for buttons below the scrollbar (viewmdi)
170 static sal_Int32 s_nActMark; // current jump mark for unknown mark
172 static bool s_bExtra;
173 static bool s_bFound;
174 static bool s_bJustOpened;
176 static std::unique_ptr<SearchAttrItemList> s_xSearchList;
177 static std::unique_ptr<SearchAttrItemList> s_xReplaceList;
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;
186 sal_uInt16 m_nOldPageNum;
187 OUString m_sOldSectionName;
189 Point m_aTabColFromDocPos; // moving table columns out of the document
190 SwTextNode * m_pNumRuleNodeFromDoc; // Moving indent of numrule #i23726#
192 Size m_aDocSz; // current document size
193 tools::Rectangle m_aVisArea; // visible region
195 VclPtr<SwEditWin> m_pEditWin;
196 std::unique_ptr<SwWrtShell> m_pWrtShell;
197 std::unique_ptr<SwViewGlueDocShell> m_xGlueDocShell;
199 SfxShell *m_pShell; // current SubShell at the dispatcher
200 FmFormShell *m_pFormShell; // DB-FormShell
202 std::unique_ptr<SwView_Impl> m_pViewImpl; // Impl-data for UNO + Basic
204 VclPtr<SwScrollbar> m_pHScrollbar, // MDI control elements
205 m_pVScrollbar;
207 bool m_bHScrollbarEnabled;
208 bool m_bVScrollbarEnabled;
210 VclPtr<SvxRuler> m_pHRuler,
211 m_pVRuler;
213 std::unique_ptr<SwGlossaryHdl> m_pGlosHdl; // handle text block
214 std::unique_ptr<SwDrawBase> m_pDrawActual;
216 const SwFrameFormat *m_pLastTableFormat;
217 const SwFrameFormat* m_pLastFlyFormat;
219 std::unique_ptr<SwFormatClipboard> m_pFormatClipboard; //holds data for format paintbrush
221 std::unique_ptr<SwPostItMgr> m_pPostItMgr;
223 SelectionType m_nSelectionType;
224 sal_uInt16 m_nPageCnt;
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;
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;
237 SvxSearchCmd m_eLastSearchCommand;
239 bool m_bWheelScrollInProgress;
240 double m_fLastZoomScale = 0;
241 double m_fAccumulatedZoom = 0;
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;
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;
271 SelectCycle m_aSelectCycle;
273 int m_nMaxOutlineLevelShown = 10;
275 bool m_bIsHighlightCharDF = false;
276 bool m_bIsSpotlightParaStyles = false;
277 bool m_bIsSpotlightCharStyles = false;
279 bool m_bDying = false;
281 static constexpr sal_uInt16 MAX_ZOOM_PERCENT = 600;
282 static constexpr sal_uInt16 MIN_ZOOM_PERCENT = 20;
284 // methods for searching
285 // set search context
286 SAL_DLLPRIVATE bool SearchAndWrap(bool bApi);
287 SAL_DLLPRIVATE sal_uInt16 SearchAll();
288 SAL_DLLPRIVATE sal_uLong FUNC_Search( const SwSearchOptions& rOptions );
289 SAL_DLLPRIVATE void Replace();
291 bool IsDocumentBorder();
293 SAL_DLLPRIVATE bool IsTextTool() const;
295 DECL_DLLPRIVATE_LINK( TimeoutHdl, Timer*, void );
297 // coverity[ tainted_data_return : FALSE ] version 2023.12.2
298 tools::Long GetXScroll() const { return (m_aVisArea.GetWidth() * nScrollX) / 100; }
299 // coverity[ tainted_data_return : FALSE ] version 2023.12.2
300 tools::Long GetYScroll() const { return (m_aVisArea.GetHeight() * nScrollY) / 100; }
302 SAL_DLLPRIVATE Point AlignToPixel(const Point& rPt) const;
303 SAL_DLLPRIVATE void CalcPt( Point* pPt,const tools::Rectangle& rRect,
304 sal_uInt16 nRangeX,
305 sal_uInt16 nRangeY);
307 SAL_DLLPRIVATE bool GetPageScrollUpOffset(SwTwips& rOff) const;
308 SAL_DLLPRIVATE bool GetPageScrollDownOffset(SwTwips& rOff) const;
310 // scrollbar movements
311 SAL_DLLPRIVATE bool PageUp();
312 SAL_DLLPRIVATE bool PageDown();
313 SAL_DLLPRIVATE bool PageUpCursor(bool bSelect);
314 SAL_DLLPRIVATE bool PageDownCursor(bool bSelect);
315 SAL_DLLPRIVATE void PhyPageUp();
316 SAL_DLLPRIVATE void PhyPageDown();
318 SAL_DLLPRIVATE void CreateScrollbar( bool bHori );
319 DECL_DLLPRIVATE_LINK(HoriScrollHdl, weld::Scrollbar&, void);
320 DECL_DLLPRIVATE_LINK(VertScrollHdl, weld::Scrollbar&, void);
321 SAL_DLLPRIVATE void EndScrollHdl(weld::Scrollbar& rScrollbar, bool bHorizontal);
322 SAL_DLLPRIVATE bool UpdateScrollbars();
323 DECL_DLLPRIVATE_LINK( WindowChildEventListener, VclWindowEvent&, void );
324 SAL_DLLPRIVATE void CalcVisArea( const Size &rPixelSz );
326 // linguistics functions
327 SAL_DLLPRIVATE void HyphenateDocument();
328 SAL_DLLPRIVATE bool IsDrawTextHyphenate();
329 SAL_DLLPRIVATE void HyphenateDrawText();
330 SAL_DLLPRIVATE void StartThesaurus();
332 // text conversion
333 SAL_DLLPRIVATE void StartTextConversion( LanguageType nSourceLang, LanguageType nTargetLang, const vcl::Font *pTargetFont, sal_Int32 nOptions, bool bIsInteractive );
335 // used for spell checking and text conversion
336 SAL_DLLPRIVATE void SpellStart( SvxSpellArea eSpell, bool bStartDone,
337 bool bEndDone, SwConversionArgs *pConvArgs );
338 SAL_DLLPRIVATE void SpellEnd( SwConversionArgs const *pConvArgs );
340 SAL_DLLPRIVATE void HyphStart( SvxSpellArea eSpell );
341 SAL_DLLPRIVATE void SpellContext(bool bOn = true)
342 { m_bCenterCursor = bOn; }
344 // for readonly switching
345 SAL_DLLPRIVATE virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override;
346 SAL_DLLPRIVATE void CheckReadonlyState();
347 SAL_DLLPRIVATE void CheckReadonlySelection();
349 // method for rotating PageDesc
350 SAL_DLLPRIVATE void SwapPageMargin(const SwPageDesc&, SvxLRSpaceItem& rLR);
352 SAL_DLLPRIVATE void SetZoom_( const Size &rEditSz,
353 SvxZoomType eZoomType,
354 short nFactor,
355 bool bViewOnly);
356 SAL_DLLPRIVATE void CalcAndSetBorderPixel( SvBorder &rToFill );
358 SAL_DLLPRIVATE void ShowAtResize();
360 SAL_DLLPRIVATE virtual void Move() override;
362 public: // #i123922# Needs to be called from a 2nd place now as a helper method
363 SAL_DLLPRIVATE bool InsertGraphicDlg( SfxRequest& );
364 sal_Int32 m_nNaviExpandedStatus = -1;
365 void SetFormShell( FmFormShell* pSh ) { m_pFormShell = pSh; }
366 virtual void SelectShell();
368 protected:
370 SwView_Impl* GetViewImpl() {return m_pViewImpl.get();}
372 void ImpSetVerb( SelectionType nSelType );
374 SelectionType GetSelectionType() const { return m_nSelectionType; }
375 void SetSelectionType(SelectionType nSet) { m_nSelectionType = nSet;}
377 // for SwWebView
378 void SetShell( SfxShell* pS ) { m_pShell = pS; }
380 virtual void Activate(bool) override;
381 virtual void Deactivate(bool) override;
382 virtual void InnerResizePixel( const Point &rOfs, const Size &rSize, bool inplaceEditModeChange ) override;
383 virtual void OuterResizePixel( const Point &rOfs, const Size &rSize ) override;
385 const SwFrameFormat* GetLastTableFrameFormat() const {return m_pLastTableFormat;}
386 void SetLastTableFrameFormat(const SwFrameFormat* pSet) {m_pLastTableFormat = pSet;}
388 // form letter execution
389 void GenerateFormLetter(bool bUseCurrentDocument);
391 using SfxShell::GetDispatcher;
393 public:
394 SFX_DECL_VIEWFACTORY(SwView);
395 SFX_DECL_INTERFACE(SW_VIEWSHELL)
397 private:
398 /// SfxInterface initializer.
399 static void InitInterface_Impl();
401 public:
402 SfxDispatcher &GetDispatcher();
404 void GotFocus() const;
405 virtual SdrView* GetDrawView() const override;
406 virtual bool HasUIFeature(SfxShellFeature nFeature) const override;
407 virtual void ShowCursor( bool bOn = true ) override;
408 virtual ErrCode DoVerb(sal_Int32 nVerb) override;
410 virtual sal_uInt16 SetPrinter( SfxPrinter* pNew,
411 SfxPrinterChangeFlags nDiff = SFX_PRINTER_ALL) override;
412 ShellMode GetShellMode() const;
414 css::view::XSelectionSupplier* GetUNOObject();
416 OUString GetSelectionTextParam( bool bCompleteWords,
417 bool bEraseTrail );
418 virtual bool HasSelection( bool bText = true ) const override;
419 virtual OUString GetSelectionText( bool bCompleteWords = false, bool bOnlyASample = false ) override;
420 virtual bool PrepareClose( bool bUI = true ) override;
421 virtual void MarginChanged() override;
423 // replace word/selection with text from the thesaurus
424 // (this code has special handling for "in word" character)
425 void InsertThesaurusSynonym( const OUString &rSynonmText, const OUString &rLookUpText, bool bValidSelection );
426 bool IsValidSelectionForThesaurus() const;
427 OUString GetThesaurusLookUpText( bool bSelection ) const;
429 // immediately switch shell -> for GetSelectionObject
430 void StopShellTimer();
432 SwWrtShell& GetWrtShell () const { return *m_pWrtShell; }
433 SwWrtShell* GetWrtShellPtr() const { return m_pWrtShell.get(); }
435 SwEditWin &GetEditWin() { return *m_pEditWin; }
436 const SwEditWin &GetEditWin () const { return *m_pEditWin; }
438 #if defined(_WIN32) || defined UNX
439 void ScannerEventHdl();
440 #endif
442 // hand the handler for text blocks to the shell; create if applicable
443 SwGlossaryHdl* GetGlosHdl();
445 const tools::Rectangle& GetVisArea() const { return m_aVisArea; }
447 bool IsScroll(const tools::Rectangle& rRect) const;
448 void Scroll( const tools::Rectangle& rRect,
449 sal_uInt16 nRangeX = USHRT_MAX,
450 sal_uInt16 nRangeY = USHRT_MAX);
452 tools::Long SetVScrollMax(tools::Long lMax);
453 tools::Long SetHScrollMax(tools::Long lMax);
455 void SpellError(LanguageType eLang);
456 bool ExecSpellPopup( const Point& rPt );
457 void ExecSmartTagPopup( const Point& rPt );
459 DECL_DLLPRIVATE_LINK( OnlineSpellCallback, SpellCallbackInfo&, void );
460 bool ExecDrwTextSpellPopup(const Point& rPt);
462 void SetTabColFromDocPos( const Point &rPt ) { m_aTabColFromDocPos = rPt; }
463 void SetTabColFromDoc( bool b ) { m_bTabColFromDoc = b; }
464 bool IsTabColFromDoc() const { return m_bTabColFromDoc; }
465 void SetTabRowFromDoc( bool b ) { m_bTabRowFromDoc = b; }
466 bool IsTabRowFromDoc() const { return m_bTabRowFromDoc; }
468 void SetNumRuleNodeFromDoc( SwTextNode * pNumRuleNode )
469 { m_pNumRuleNodeFromDoc = pNumRuleNode; }
471 void DocSzChgd( const Size& rNewSize );
472 const Size& GetDocSz() const { return m_aDocSz; }
473 void SetVisArea( const tools::Rectangle&, bool bUpdateScrollbar = true);
474 void SetVisArea( const Point&, bool bUpdateScrollbar = true);
475 void CheckVisArea();
477 void RecheckBrowseMode();
478 static SvxSearchDialog* GetSearchDialog();
480 static sal_uInt16 GetMoveType();
481 static void SetMoveType(sal_uInt16 nSet);
482 DECL_DLLPRIVATE_LINK( MoveNavigationHdl, void*, void );
483 static void SetActMark(sal_Int32 nSet);
485 bool HandleWheelCommands( const CommandEvent& );
486 bool HandleGestureZoomCommand(const CommandEvent&);
487 bool HandleGesturePanCommand(const CommandEvent&);
489 // insert frames
490 void InsFrameMode(sal_uInt16 nCols);
492 void SetZoom( SvxZoomType eZoomType, short nFactor = 100, bool bViewOnly = false);
493 virtual void SetZoomFactor( const Fraction &rX, const Fraction & ) override;
495 void SetViewLayout( sal_uInt16 nColumns, bool bBookMode, bool bViewOnly = false );
497 void ShowHScrollbar(bool bShow);
498 bool IsHScrollbarVisible()const;
500 void ShowVScrollbar(bool bShow);
501 bool IsVScrollbarVisible()const;
503 void EnableHScrollbar(bool bEnable);
504 void EnableVScrollbar(bool bEnable);
506 void CreateVRuler();
507 void KillVRuler();
508 void CreateTab();
509 void KillTab();
511 bool StatVRuler() const { return m_pVRuler->IsVisible(); }
512 void ChangeVRulerMetric(FieldUnit eUnit);
513 void GetVRulerMetric(FieldUnit& rToFill) const;
515 SvxRuler& GetHRuler() { return *m_pHRuler; }
516 SvxRuler& GetVRuler() { return *m_pVRuler; }
517 void InvalidateRulerPos();
518 void ChangeTabMetric(FieldUnit eUnit);
519 void GetHRulerMetric(FieldUnit& rToFill) const;
521 // Handler
522 void Execute(SfxRequest&);
523 void ExecLingu(SfxRequest&);
524 void ExecDlg(SfxRequest const &);
525 void ExecDlgExt(SfxRequest&);
526 void ExecColl(SfxRequest const &);
527 void ExecutePrint(SfxRequest&);
528 void ExecDraw(const SfxRequest&);
529 void ExecTabWin(SfxRequest const &);
530 void ExecuteStatusLine(SfxRequest&);
531 DECL_DLLPRIVATE_LINK( ExecRulerClick, Ruler *, void );
532 void ExecSearch(SfxRequest&);
533 void ExecViewOptions(SfxRequest &);
535 virtual bool IsConditionalFastCall( const SfxRequest &rReq ) override;
537 void StateViewOptions(SfxItemSet &);
538 void StateSearch(SfxItemSet &);
539 void GetState(SfxItemSet&);
540 void StateStatusLine(SfxItemSet&);
541 void UpdateWordCount(SfxShell*, sal_uInt16);
542 void ExecFormatFootnote();
543 void ExecNumberingOutline(SfxItemPool &);
545 // functions for drawing
546 void SetDrawFuncPtr(std::unique_ptr<SwDrawBase> pFuncPtr);
547 SwDrawBase* GetDrawFuncPtr() const { return m_pDrawActual.get(); }
548 void GetDrawState(SfxItemSet &rSet);
549 void ExitDraw();
550 bool IsDrawRotate() const { return m_bDrawRotate; }
551 void FlipDrawRotate() { m_bDrawRotate = !m_bDrawRotate; }
552 bool IsDrawSelMode() const { return m_bDrawSelMode; }
553 void SetSelDrawSlot();
554 void FlipDrawSelMode() { m_bDrawSelMode = !m_bDrawSelMode; }
555 void NoRotate(); // turn off rotate mode
556 bool EnterDrawTextMode(const Point& aDocPos);
557 /// Same as EnterDrawTextMode(), but takes an SdrObject instead of guessing it by document position.
558 bool EnterShapeDrawTextMode(SdrObject* pObject);
559 void LeaveDrawCreate() { m_nDrawSfxId = m_nFormSfxId = USHRT_MAX; m_sDrawCustom.clear(); m_eFormObjKind = SdrObjKind::NONE; }
560 bool IsDrawMode() const { return (m_nDrawSfxId != USHRT_MAX || m_nFormSfxId != USHRT_MAX); }
561 bool IsFormMode() const;
562 bool IsBezierEditMode() const;
563 bool AreOnlyFormsSelected() const;
564 bool HasOnlyObj(SdrObject const *pSdrObj, SdrInventor eObjInventor) const;
565 bool BeginTextEdit( SdrObject* pObj, SdrPageView* pPV=nullptr,
566 vcl::Window* pWin=nullptr, bool bIsNewObj=false, bool bSetSelectionToStart=false );
567 bool isSignatureLineSelected() const;
568 bool isSignatureLineSigned() const;
569 bool isQRCodeSelected() const;
571 void StateTabWin(SfxItemSet&);
573 // attributes have changed
574 DECL_LINK( AttrChangedNotify, LinkParamNone*, void );
576 // form control has been activated
577 DECL_DLLPRIVATE_LINK( FormControlActivated, LinkParamNone*, void );
579 // edit links
580 void EditLinkDlg();
581 void AutoCaption(const sal_uInt16 nType, const SvGlobalName *pOleId = nullptr);
582 void InsertCaption(const InsCaptionOpt *pOpt);
584 // Async call by Core
585 void UpdatePageNums();
587 OUString GetPageStr(sal_uInt16 nPhyNum, sal_uInt16 nVirtNum, const OUString& rPgStr);
589 /// Force page size for PgUp/PgDown to overwrite the computation based on m_aVisArea.
590 void ForcePageUpDownOffset(SwTwips nTwips)
592 m_nLOKPageUpDownOffset = nTwips;
595 // hand over Shell
596 SfxShell *GetCurShell() { return m_pShell; }
597 SwDocShell *GetDocShell();
598 const SwDocShell *GetDocShell() const { return const_cast<SwView*>(this)->GetDocShell(); }
600 virtual FmFormShell *GetFormShell() override { return m_pFormShell; }
601 virtual const FmFormShell *GetFormShell() const override { return m_pFormShell; }
603 // so that in the SubShells' DTors m_pShell can be reset if applicable
604 void ResetSubShell() { m_pShell = nullptr; }
606 virtual void WriteUserData(OUString &, bool bBrowse = false) override;
607 virtual void ReadUserData(const OUString &, bool bBrowse = false) override;
608 virtual void ReadUserDataSequence ( const css::uno::Sequence < css::beans::PropertyValue >& ) override;
609 virtual void WriteUserDataSequence ( css::uno::Sequence < css::beans::PropertyValue >& ) override;
611 void SetCursorAtTop( bool bFlag, bool bCenter = false )
612 { m_bTopCursor = bFlag; m_bCenterCursor = bCenter; }
614 bool JumpToSwMark( std::u16string_view rMark );
616 tools::Long InsertDoc( sal_uInt16 nSlotId, const OUString& rFileName,
617 const OUString& rFilterName, sal_Int16 nVersion = 0 );
619 void ExecuteInsertDoc( SfxRequest& rRequest, const SfxPoolItem* pItem );
620 tools::Long InsertMedium( sal_uInt16 nSlotId, std::unique_ptr<SfxMedium> pMedium, sal_Int16 nVersion );
621 DECL_DLLPRIVATE_LINK( DialogClosedHdl, sfx2::FileDialogHelper *, void );
623 // status methods for clipboard.
624 // Status changes now notified from the clipboard.
625 bool IsPasteAllowed();
626 bool IsPasteSpecialAllowed();
627 bool IsPasteSpreadsheet(bool bHasOwnTableCopied);
629 // Enable mail merge - mail merge field dialog enabled
630 void EnableMailMerge();
632 SwView(SfxViewFrame& rFrame, SfxViewShell*);
633 virtual ~SwView() override;
635 void SetDying() override;
637 void NotifyDBChanged();
639 SfxObjectShellLock CreateTmpSelectionDoc();
641 void AddTransferable(SwTransferable& rTransferable);
643 // store MailMerge data while "Back to Mail Merge Wizard" FloatingWindow is active
644 // or to support printing
645 void SetMailMergeConfigItem(std::shared_ptr<SwMailMergeConfigItem> const & rConfigItem);
646 std::shared_ptr<SwMailMergeConfigItem> const & GetMailMergeConfigItem() const;
647 std::shared_ptr<SwMailMergeConfigItem> EnsureMailMergeConfigItem(const SfxItemSet* pArgs = nullptr);
649 OUString GetDataSourceName() const;
650 static bool IsDataSourceAvailable(const OUString& sDataSourceName);
652 void ExecFormatPaintbrush(SfxRequest const &);
653 void StateFormatPaintbrush(SfxItemSet &);
655 // public for D&D
656 ErrCode InsertGraphic( const OUString &rPath, const OUString &rFilter,
657 bool bLink, GraphicFilter *pFlt );
659 void ExecuteScan( SfxRequest& rReq );
661 SwPostItMgr* GetPostItMgr() { return m_pPostItMgr.get();}
662 const SwPostItMgr* GetPostItMgr() const { return m_pPostItMgr.get();}
664 // exhibition hack (MA,MBA)
665 void SelectShellForDrop();
667 void UpdateDocStats();
669 void SetMaxOutlineLevelShown(int nLevel) {m_nMaxOutlineLevelShown = nLevel;}
670 int GetMaxOutlineLevelShown() const {return m_nMaxOutlineLevelShown;}
672 // methods for printing
673 SAL_DLLPRIVATE virtual SfxPrinter* GetPrinter( bool bCreate = false ) override;
674 SAL_DLLPRIVATE virtual bool HasPrintOptionsPage() const override;
675 SAL_DLLPRIVATE virtual std::unique_ptr<SfxTabPage> CreatePrintOptionsPage(weld::Container* pPage, weld::DialogController* pController,
676 const SfxItemSet& rSet) override;
677 static SvxSearchItem* GetSearchItem() { return s_pSrchItem; }
678 static void SetSearchItem(SvxSearchItem* pSearchItem) { s_pSrchItem = pSearchItem; }
680 /// See SfxViewShell::getPart().
681 int getPart() const override;
682 /// See SfxViewShell::dumpAsXml().
683 void dumpAsXml(xmlTextWriterPtr pWriter) const override;
684 void SetRedlineAuthor(const OUString& rAuthor);
685 const OUString& GetRedlineAuthor() const;
686 /// See SfxViewShell::afterCallbackRegistered().
687 void afterCallbackRegistered() override;
688 /// See SfxViewShell::NotifyCursor().
689 void NotifyCursor(SfxViewShell* pViewShell) const override;
690 /// See SfxViewShell::GetColorConfigColor().
691 ::Color GetColorConfigColor(svtools::ColorConfigEntry nColorType) const override;
692 void ShowUIElement(const OUString& sElementURL) const;
695 enum CachedStringID
697 OldGrfCat,
698 OldTabCat,
699 OldFrameCat,
700 OldDrwCat,
701 CachedStrings
704 OUString m_StringCache[CachedStrings];
706 const OUString& GetCachedString(CachedStringID id)
708 return m_StringCache[id];
711 void SetCachedString(CachedStringID id, const OUString& sStr)
713 m_StringCache[id] = sStr;
716 const OUString& GetOldGrfCat();
717 void SetOldGrfCat(const OUString& sStr);
718 const OUString& GetOldTabCat();
719 void SetOldTabCat(const OUString& sStr);
720 const OUString& GetOldFrameCat();
721 void SetOldFrameCat(const OUString& sStr);
722 const OUString& GetOldDrwCat();
723 void SetOldDrwCat(const OUString& sStr);
725 virtual tools::Rectangle getLOKVisibleArea() const override;
726 virtual void flushPendingLOKInvalidateTiles() override;
727 virtual std::optional<OString> getLOKPayload(int nType, int nViewId) const override;
729 bool IsHighlightCharDF() { return m_bIsHighlightCharDF; }
731 private:
732 AutoTimer m_aBringToAttentionBlinkTimer;
733 size_t m_nBringToAttentionBlinkTimeOutsRemaining;
735 std::unique_ptr<sdr::overlay::OverlayObject> m_xBringToAttentionOverlayObject;
737 DECL_LINK(BringToAttentionBlinkTimerHdl, Timer*, void);
739 public:
740 void BringToAttention(std::vector<basegfx::B2DRange>&& aRanges = {});
741 void BringToAttention(const tools::Rectangle& rRect);
742 void BringToAttention(const SwNode* pNode);
745 std::unique_ptr<SfxTabPage> CreatePrintOptionsPage(weld::Container* pPage, weld::DialogController* pController,
746 const SfxItemSet &rOptions,
747 bool bPreview);
749 extern bool bDocSzUpdated;
751 #endif
753 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */