lok: avoid expensive fetching of a property.
[LibreOffice.git] / sw / inc / view.hxx
blobabdba739c3b7afa1f493f81c51adcdc517e48256
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 class SwTextFormatColl;
36 class SwPageDesc;
37 class SwFrameFormat;
38 class SwCharFormat;
39 class SwNumRule;
40 class SwGlossaryHdl;
41 class SwDrawBase;
42 class SvxLRSpaceItem;
43 class SwDocShell;
44 class SwScrollbar;
45 class SvBorder;
46 class Ruler;
47 class SvxSearchItem;
48 class SearchAttrItemList;
49 class SvxSearchDialog;
50 class SdrView;
51 class SdrPageView;
52 class SwEditWin;
53 class SwWrtShell;
54 class SwView_Impl;
55 struct SwSearchOptions;
56 class CommandEvent;
57 class InsCaptionOpt;
58 class SvGlobalName;
59 class SvtAccessibilityOptions;
60 class SwTransferable;
61 class SwMailMergeConfigItem;
62 class SwTextNode; // #i23726#
63 class SwFormatClipboard;
64 struct SwConversionArgs;
65 class GraphicFilter;
66 class SwPostItMgr;
67 enum class SotExchangeDest;
68 class SwCursorShell;
69 enum class SvxSearchCmd;
70 enum class SelectionType : sal_Int32;
72 namespace com::sun::star::view { class XSelectionSupplier; }
73 namespace sfx2 { class FileDialogHelper; }
74 namespace sw::mark { class IFieldmark; }
76 const tools::Long nLeftOfst = -370;
77 const tools::Long nScrollX = 30;
78 const tools::Long nScrollY = 30;
80 #define MINZOOM 20
81 #define MAXZOOM 600
83 #define MAX_MARKS 5
85 enum class ShellMode
87 Text,
88 Frame,
89 Graphic,
90 Object,
91 Draw,
92 DrawForm,
93 DrawText,
94 Bezier,
95 ListText,
96 TableText,
97 TableListText,
98 Media,
99 ExtrudedCustomShape,
100 FontWork,
101 PostIt
104 // apply a template
105 struct SwApplyTemplate
107 union
109 SwTextFormatColl* pTextColl;
110 SwPageDesc* pPageDesc;
111 SwFrameFormat* pFrameFormat;
112 SwCharFormat* pCharFormat;
113 SwNumRule* pNumRule;
114 } aColl;
116 SfxStyleFamily eType;
117 sal_uInt16 nColor;
118 SwFormatClipboard* m_pFormatClipboard;
119 size_t nUndo; //< The initial undo stack depth.
121 SwApplyTemplate() :
122 eType(SfxStyleFamily::None),
123 nColor(0),
124 m_pFormatClipboard(nullptr),
125 nUndo(0)
127 aColl.pTextColl = nullptr;
131 class SwView;
133 // manage connection and disconnection of SwView and SwDocShell
134 class SwViewGlueDocShell
136 private:
137 SwView& m_rView;
138 public:
139 SwViewGlueDocShell(SwView& rView, SwDocShell& rDocSh);
140 ~SwViewGlueDocShell();
143 // view of a document
144 class SW_DLLPUBLIC SwView: public SfxViewShell
146 friend class SwHHCWrapper;
147 friend class SwHyphWrapper;
148 friend class SwView_Impl;
149 friend class SwClipboardChangeListener;
151 // search & replace
152 static SvxSearchItem *s_pSrchItem;
154 static sal_uInt16 m_nMoveType; // for buttons below the scrollbar (viewmdi)
155 static sal_Int32 m_nActMark; // current jump mark for unknown mark
157 static bool s_bExtra;
158 static bool s_bFound;
159 static bool s_bJustOpened;
161 static std::unique_ptr<SearchAttrItemList> s_xSearchList;
162 static std::unique_ptr<SearchAttrItemList> s_xReplaceList;
164 Timer m_aTimer; // for delayed ChgLnks during an action
165 OUString m_sSwViewData,
166 //and the new cursor position if the user double click in the PagePreview
167 m_sNewCursorPos;
168 // to support keyboard the number of the page to go to can be set too
169 sal_uInt16 m_nNewPage;
171 sal_uInt16 m_nOldPageNum;
172 OUString m_sOldSectionName;
174 Point m_aTabColFromDocPos; // moving table columns out of the document
175 SwTextNode * m_pNumRuleNodeFromDoc; // Moving indent of numrule #i23726#
177 Size m_aDocSz; // current document size
178 tools::Rectangle m_aVisArea; // visible region
180 VclPtr<SwEditWin> m_pEditWin;
181 std::unique_ptr<SwWrtShell> m_pWrtShell;
182 std::unique_ptr<SwViewGlueDocShell> m_xGlueDocShell;
184 SfxShell *m_pShell; // current SubShell at the dispatcher
185 FmFormShell *m_pFormShell; // DB-FormShell
187 std::unique_ptr<SwView_Impl> m_pViewImpl; // Impl-data for UNO + Basic
189 VclPtr<SwScrollbar> m_pHScrollbar, // MDI control elements
190 m_pVScrollbar;
192 bool m_bHScrollbarEnabled;
193 bool m_bVScrollbarEnabled;
195 VclPtr<vcl::Window> m_pScrollFill; // dummy window for filling the lower right edge
196 // when both scrollbars are active
198 VclPtr<SvxRuler> m_pHRuler,
199 m_pVRuler;
201 std::unique_ptr<SwGlossaryHdl> m_pGlosHdl; // handle text block
202 std::unique_ptr<SwDrawBase> m_pDrawActual;
204 const SwFrameFormat *m_pLastTableFormat;
206 std::unique_ptr<SwFormatClipboard> m_pFormatClipboard; //holds data for format paintbrush
208 std::unique_ptr<SwPostItMgr> m_pPostItMgr;
210 SelectionType m_nSelectionType;
211 sal_uInt16 m_nPageCnt;
213 // current draw mode
214 sal_uInt16 m_nDrawSfxId;
215 OUString m_sDrawCustom; //some drawing types are marked with strings!
216 sal_uInt16 m_nFormSfxId;
217 SdrObjKind m_eFormObjKind;
218 SotExchangeDest m_nLastPasteDestination;
220 // save the border distance status from SwView::StateTabWin to re-use it in SwView::ExecTabWin()
221 sal_uInt16 m_nLeftBorderDistance;
222 sal_uInt16 m_nRightBorderDistance;
224 SvxSearchCmd m_eLastSearchCommand;
226 bool m_bWheelScrollInProgress;
228 bool m_bCenterCursor : 1,
229 m_bTopCursor : 1,
230 m_bTabColFromDoc : 1,
231 m_bTabRowFromDoc : 1,
232 m_bSetTabColFromDoc : 1 ,
233 m_bSetTabRowFromDoc : 1,
234 m_bAttrChgNotified : 1,
235 m_bAttrChgNotifiedWithRegistrations : 1,
236 m_bVerbsActive : 1,
237 m_bDrawRotate : 1,
238 m_bDrawSelMode : 1,
239 m_bShowAtResize : 1,
240 m_bInOuterResizePixel : 1,
241 m_bInInnerResizePixel : 1,
242 m_bPasteState : 1,
243 m_bPasteSpecialState : 1,
244 m_bInMailMerge : 1,
245 m_bInDtor : 1, //detect destructor to prevent creating of sub shells while closing
246 m_bOldShellWasPagePreview : 1,
247 m_bIsPreviewDoubleClick : 1, // #i114045#
248 m_bMakeSelectionVisible : 1; // transport the bookmark selection
249 bool m_bInitOnceCompleted = false;
251 /// LibreOfficeKit has to force the page size for PgUp/PgDown
252 /// functionality based on the user's view, instead of using the m_aVisArea.
253 SwTwips m_nLOKPageUpDownOffset;
255 // methods for searching
256 // set search context
257 SAL_DLLPRIVATE bool SearchAndWrap(bool bApi);
258 SAL_DLLPRIVATE bool SearchAll();
259 SAL_DLLPRIVATE sal_uLong FUNC_Search( const SwSearchOptions& rOptions );
260 SAL_DLLPRIVATE void Replace();
262 bool IsDocumentBorder();
264 SAL_DLLPRIVATE bool IsTextTool() const;
266 DECL_DLLPRIVATE_LINK( TimeoutHdl, Timer*, void );
268 inline tools::Long GetXScroll() const;
269 inline tools::Long GetYScroll() const;
270 SAL_DLLPRIVATE Point AlignToPixel(const Point& rPt) const;
271 SAL_DLLPRIVATE void CalcPt( Point* pPt,const tools::Rectangle& rRect,
272 sal_uInt16 nRangeX,
273 sal_uInt16 nRangeY);
275 SAL_DLLPRIVATE bool GetPageScrollUpOffset(SwTwips& rOff) const;
276 SAL_DLLPRIVATE bool GetPageScrollDownOffset(SwTwips& rOff) const;
278 // scrollbar movements
279 SAL_DLLPRIVATE bool PageUp();
280 SAL_DLLPRIVATE bool PageDown();
281 SAL_DLLPRIVATE bool PageUpCursor(bool bSelect);
282 SAL_DLLPRIVATE bool PageDownCursor(bool bSelect);
283 SAL_DLLPRIVATE void PhyPageUp();
284 SAL_DLLPRIVATE void PhyPageDown();
286 SAL_DLLPRIVATE void CreateScrollbar( bool bHori );
287 DECL_DLLPRIVATE_LINK( ScrollHdl, ScrollBar*, void );
288 DECL_DLLPRIVATE_LINK( EndScrollHdl, ScrollBar*, void );
289 SAL_DLLPRIVATE bool UpdateScrollbars();
290 DECL_DLLPRIVATE_LINK( WindowChildEventListener, VclWindowEvent&, void );
291 SAL_DLLPRIVATE void CalcVisArea( const Size &rPixelSz );
293 // linguistics functions
294 SAL_DLLPRIVATE void HyphenateDocument();
295 SAL_DLLPRIVATE bool IsDrawTextHyphenate();
296 SAL_DLLPRIVATE void HyphenateDrawText();
297 SAL_DLLPRIVATE void StartThesaurus();
299 // text conversion
300 SAL_DLLPRIVATE void StartTextConversion( LanguageType nSourceLang, LanguageType nTargetLang, const vcl::Font *pTargetFont, sal_Int32 nOptions, bool bIsInteractive );
302 // used for spell checking and text conversion
303 SAL_DLLPRIVATE void SpellStart( SvxSpellArea eSpell, bool bStartDone,
304 bool bEndDone, SwConversionArgs *pConvArgs );
305 SAL_DLLPRIVATE void SpellEnd( SwConversionArgs const *pConvArgs );
307 SAL_DLLPRIVATE void HyphStart( SvxSpellArea eSpell );
308 SAL_DLLPRIVATE void SpellContext(bool bOn = true)
309 { m_bCenterCursor = bOn; }
311 // for readonly switching
312 SAL_DLLPRIVATE virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override;
313 SAL_DLLPRIVATE void CheckReadonlyState();
314 SAL_DLLPRIVATE void CheckReadonlySelection();
316 // method for rotating PageDesc
317 SAL_DLLPRIVATE void SwapPageMargin(const SwPageDesc&, SvxLRSpaceItem& rLR);
319 SAL_DLLPRIVATE void SetZoom_( const Size &rEditSz,
320 SvxZoomType eZoomType,
321 short nFactor,
322 bool bViewOnly);
323 SAL_DLLPRIVATE void CalcAndSetBorderPixel( SvBorder &rToFill );
325 SAL_DLLPRIVATE void ShowAtResize();
327 SAL_DLLPRIVATE virtual void Move() override;
329 public: // #i123922# Needs to be called from a 2nd place now as a helper method
330 SAL_DLLPRIVATE bool InsertGraphicDlg( SfxRequest& );
332 protected:
334 SwView_Impl* GetViewImpl() {return m_pViewImpl.get();}
336 void ImpSetVerb( SelectionType nSelType );
338 SelectionType GetSelectionType() const { return m_nSelectionType; }
339 void SetSelectionType(SelectionType nSet) { m_nSelectionType = nSet;}
341 // for SwWebView
342 void SetShell( SfxShell* pS ) { m_pShell = pS; }
343 void SetFormShell( FmFormShell* pSh ) { m_pFormShell = pSh; }
345 virtual void SelectShell();
347 virtual void Activate(bool) override;
348 virtual void Deactivate(bool) override;
349 virtual void InnerResizePixel( const Point &rOfs, const Size &rSize, bool inplaceEditModeChange ) override;
350 virtual void OuterResizePixel( const Point &rOfs, const Size &rSize ) override;
352 const SwFrameFormat* GetLastTableFrameFormat() const {return m_pLastTableFormat;}
353 void SetLastTableFrameFormat(const SwFrameFormat* pSet) {m_pLastTableFormat = pSet;}
355 // form letter execution
356 void GenerateFormLetter(bool bUseCurrentDocument);
358 using SfxShell::GetDispatcher;
360 public:
361 SFX_DECL_VIEWFACTORY(SwView);
362 SFX_DECL_INTERFACE(SW_VIEWSHELL)
364 private:
365 /// SfxInterface initializer.
366 static void InitInterface_Impl();
368 public:
369 SfxDispatcher &GetDispatcher();
371 void GotFocus() const;
372 virtual SdrView* GetDrawView() const override;
373 virtual bool HasUIFeature(SfxShellFeature nFeature) const override;
374 virtual void ShowCursor( bool bOn = true ) override;
375 virtual ErrCode DoVerb( tools::Long nVerb ) override;
377 virtual sal_uInt16 SetPrinter( SfxPrinter* pNew,
378 SfxPrinterChangeFlags nDiff = SFX_PRINTER_ALL) override;
379 ShellMode GetShellMode() const;
381 css::view::XSelectionSupplier* GetUNOObject();
383 OUString GetSelectionTextParam( bool bCompleteWords,
384 bool bEraseTrail );
385 virtual bool HasSelection( bool bText = true ) const override;
386 virtual OUString GetSelectionText( bool bCompleteWords = false ) override;
387 virtual bool PrepareClose( bool bUI = true ) override;
388 virtual void MarginChanged() override;
390 // replace word/selection with text from the thesaurus
391 // (this code has special handling for "in word" character)
392 void InsertThesaurusSynonym( const OUString &rSynonmText, const OUString &rLookUpText, bool bValidSelection );
393 bool IsValidSelectionForThesaurus() const;
394 OUString GetThesaurusLookUpText( bool bSelection ) const;
396 // immediately switch shell -> for GetSelectionObject
397 void StopShellTimer();
399 SwWrtShell& GetWrtShell () const { return *m_pWrtShell; }
400 SwWrtShell* GetWrtShellPtr() const { return m_pWrtShell.get(); }
402 SwEditWin &GetEditWin() { return *m_pEditWin; }
403 const SwEditWin &GetEditWin () const { return *m_pEditWin; }
405 #if defined(_WIN32) || defined UNX
406 void ScannerEventHdl();
407 #endif
409 // hand the handler for text blocks to the shell; create if applicable
410 SwGlossaryHdl* GetGlosHdl();
412 const tools::Rectangle& GetVisArea() const { return m_aVisArea; }
414 bool IsScroll(const tools::Rectangle& rRect) const;
415 void Scroll( const tools::Rectangle& rRect,
416 sal_uInt16 nRangeX = USHRT_MAX,
417 sal_uInt16 nRangeY = USHRT_MAX);
419 tools::Long SetVScrollMax(tools::Long lMax);
420 tools::Long SetHScrollMax(tools::Long lMax);
422 void SpellError(LanguageType eLang);
423 bool ExecSpellPopup( const Point& rPt );
424 void ExecSmartTagPopup( const Point& rPt );
426 DECL_LINK( OnlineSpellCallback, SpellCallbackInfo&, void );
427 bool ExecDrwTextSpellPopup(const Point& rPt);
429 void SetTabColFromDocPos( const Point &rPt ) { m_aTabColFromDocPos = rPt; }
430 void SetTabColFromDoc( bool b ) { m_bTabColFromDoc = b; }
431 bool IsTabColFromDoc() const { return m_bTabColFromDoc; }
432 void SetTabRowFromDoc( bool b ) { m_bTabRowFromDoc = b; }
433 bool IsTabRowFromDoc() const { return m_bTabRowFromDoc; }
435 void SetNumRuleNodeFromDoc( SwTextNode * pNumRuleNode )
436 { m_pNumRuleNodeFromDoc = pNumRuleNode; }
438 void DocSzChgd( const Size& rNewSize );
439 const Size& GetDocSz() const { return m_aDocSz; }
440 void SetVisArea( const tools::Rectangle&, bool bUpdateScrollbar = true);
441 void SetVisArea( const Point&, bool bUpdateScrollbar = true);
442 void CheckVisArea();
444 void RecheckBrowseMode();
445 static SvxSearchDialog* GetSearchDialog();
447 static sal_uInt16 GetMoveType();
448 static void SetMoveType(sal_uInt16 nSet);
449 DECL_LINK( MoveNavigationHdl, void*, void );
450 static void SetActMark(sal_Int32 nSet);
452 bool HandleWheelCommands( const CommandEvent& );
454 // insert frames
455 void InsFrameMode(sal_uInt16 nCols);
457 void SetZoom( SvxZoomType eZoomType, short nFactor = 100, bool bViewOnly = false);
458 virtual void SetZoomFactor( const Fraction &rX, const Fraction & ) override;
460 void SetViewLayout( sal_uInt16 nColumns, bool bBookMode, bool bViewOnly = false );
462 void ShowHScrollbar(bool bShow);
463 bool IsHScrollbarVisible()const;
465 void ShowVScrollbar(bool bShow);
466 bool IsVScrollbarVisible()const;
468 void EnableHScrollbar(bool bEnable);
469 void EnableVScrollbar(bool bEnable);
471 void CreateVRuler();
472 void KillVRuler();
473 void CreateTab();
474 void KillTab();
476 bool StatVRuler() const { return m_pVRuler->IsVisible(); }
477 void ChangeVRulerMetric(FieldUnit eUnit);
478 void GetVRulerMetric(FieldUnit& rToFill) const;
480 SvxRuler& GetHRuler() { return *m_pHRuler; }
481 SvxRuler& GetVRuler() { return *m_pVRuler; }
482 void InvalidateRulerPos();
483 void ChangeTabMetric(FieldUnit eUnit);
484 void GetHRulerMetric(FieldUnit& rToFill) const;
486 // Handler
487 void Execute(SfxRequest&);
488 void ExecLingu(SfxRequest&);
489 void ExecDlg(SfxRequest const &);
490 void ExecDlgExt(SfxRequest const &);
491 void ExecColl(SfxRequest const &);
492 void ExecutePrint(SfxRequest&);
493 void ExecDraw(SfxRequest&);
494 void ExecTabWin(SfxRequest const &);
495 void ExecuteStatusLine(SfxRequest&);
496 DECL_LINK( ExecRulerClick, Ruler *, void );
497 void ExecSearch(SfxRequest&);
498 void ExecViewOptions(SfxRequest &);
500 virtual bool IsConditionalFastCall( const SfxRequest &rReq ) override;
502 void StateViewOptions(SfxItemSet &);
503 void StateSearch(SfxItemSet &);
504 void GetState(SfxItemSet&);
505 void StateStatusLine(SfxItemSet&);
506 void UpdateWordCount(SfxShell*, sal_uInt16);
507 void ExecFormatFootnote();
508 void ExecNumberingOutline(SfxItemPool &);
510 // functions for drawing
511 void SetDrawFuncPtr(std::unique_ptr<SwDrawBase> pFuncPtr);
512 SwDrawBase* GetDrawFuncPtr() const { return m_pDrawActual.get(); }
513 void GetDrawState(SfxItemSet &rSet);
514 void ExitDraw();
515 bool IsDrawRotate() const { return m_bDrawRotate; }
516 void FlipDrawRotate() { m_bDrawRotate = !m_bDrawRotate; }
517 bool IsDrawSelMode() const { return m_bDrawSelMode; }
518 void SetSelDrawSlot();
519 void FlipDrawSelMode() { m_bDrawSelMode = !m_bDrawSelMode; }
520 void NoRotate(); // turn off rotate mode
521 bool EnterDrawTextMode(const Point& aDocPos);
522 /// Same as EnterDrawTextMode(), but takes an SdrObject instead of guessing it by document position.
523 bool EnterShapeDrawTextMode(SdrObject* pObject);
524 void LeaveDrawCreate() { m_nDrawSfxId = m_nFormSfxId = USHRT_MAX; m_sDrawCustom.clear(); m_eFormObjKind = OBJ_NONE; }
525 bool IsDrawMode() const { return (m_nDrawSfxId != USHRT_MAX || m_nFormSfxId != USHRT_MAX); }
526 bool IsFormMode() const;
527 bool IsBezierEditMode() const;
528 bool AreOnlyFormsSelected() const;
529 bool HasOnlyObj(SdrObject const *pSdrObj, SdrInventor eObjInventor) const;
530 bool BeginTextEdit( SdrObject* pObj, SdrPageView* pPV=nullptr,
531 vcl::Window* pWin=nullptr, bool bIsNewObj=false, bool bSetSelectionToStart=false );
532 bool isSignatureLineSelected() const;
533 bool isSignatureLineSigned() const;
534 bool isQRCodeSelected() const;
536 void StateTabWin(SfxItemSet&);
538 // attributes have changed
539 DECL_LINK( AttrChangedNotify, LinkParamNone*, void );
541 // form control has been activated
542 DECL_LINK( FormControlActivated, LinkParamNone*, void );
544 // edit links
545 void EditLinkDlg();
546 void AutoCaption(const sal_uInt16 nType, const SvGlobalName *pOleId = nullptr);
547 void InsertCaption(const InsCaptionOpt *pOpt);
549 // Async call by Core
550 void UpdatePageNums();
552 OUString GetPageStr(sal_uInt16 nPhyNum, sal_uInt16 nVirtNum, const OUString& rPgStr);
554 /// Force page size for PgUp/PgDown to overwrite the computation based on m_aVisArea.
555 void ForcePageUpDownOffset(SwTwips nTwips)
557 m_nLOKPageUpDownOffset = nTwips;
560 // hand over Shell
561 SfxShell *GetCurShell() { return m_pShell; }
562 SwDocShell *GetDocShell();
563 inline const SwDocShell *GetDocShell() const;
564 virtual FmFormShell *GetFormShell() override { return m_pFormShell; }
565 virtual const FmFormShell *GetFormShell() const override { return m_pFormShell; }
567 // so that in the SubShells' DTors m_pShell can be reset if applicable
568 void ResetSubShell() { m_pShell = nullptr; }
570 virtual void WriteUserData(OUString &, bool bBrowse = false) override;
571 virtual void ReadUserData(const OUString &, bool bBrowse = false) override;
572 virtual void ReadUserDataSequence ( const css::uno::Sequence < css::beans::PropertyValue >& ) override;
573 virtual void WriteUserDataSequence ( css::uno::Sequence < css::beans::PropertyValue >& ) override;
575 void SetCursorAtTop( bool bFlag, bool bCenter = false )
576 { m_bTopCursor = bFlag; m_bCenterCursor = bCenter; }
578 bool JumpToSwMark( const OUString& rMark );
580 tools::Long InsertDoc( sal_uInt16 nSlotId, const OUString& rFileName,
581 const OUString& rFilterName, sal_Int16 nVersion = 0 );
583 void ExecuteInsertDoc( SfxRequest& rRequest, const SfxPoolItem* pItem );
584 tools::Long InsertMedium( sal_uInt16 nSlotId, std::unique_ptr<SfxMedium> pMedium, sal_Int16 nVersion );
585 DECL_LINK( DialogClosedHdl, sfx2::FileDialogHelper *, void );
587 // status methods for clipboard.
588 // Status changes now notified from the clipboard.
589 bool IsPasteAllowed();
590 bool IsPasteSpecialAllowed();
591 bool IsPasteSpreadsheet(bool bHasOwnTableCopied);
593 // Enable mail merge - mail merge field dialog enabled
594 void EnableMailMerge();
595 //apply Accessibility options
596 void ApplyAccessibilityOptions(SvtAccessibilityOptions const & rAccessibilityOptions);
598 SwView(SfxViewFrame* pFrame, SfxViewShell*);
599 virtual ~SwView() override;
601 void NotifyDBChanged();
603 SfxObjectShellLock CreateTmpSelectionDoc();
605 void AddTransferable(SwTransferable& rTransferable);
607 // store MailMerge data while "Back to Mail Merge Wizard" FloatingWindow is active
608 // or to support printing
609 void SetMailMergeConfigItem(std::shared_ptr<SwMailMergeConfigItem> const & rConfigItem);
610 std::shared_ptr<SwMailMergeConfigItem> const & GetMailMergeConfigItem() const;
611 std::shared_ptr<SwMailMergeConfigItem> EnsureMailMergeConfigItem(const SfxItemSet* pArgs = nullptr);
613 void ExecFormatPaintbrush(SfxRequest const &);
614 void StateFormatPaintbrush(SfxItemSet &);
616 // public for D&D
617 ErrCode InsertGraphic( const OUString &rPath, const OUString &rFilter,
618 bool bLink, GraphicFilter *pFlt );
620 void ExecuteScan( SfxRequest& rReq );
622 SwPostItMgr* GetPostItMgr() { return m_pPostItMgr.get();}
623 const SwPostItMgr* GetPostItMgr() const { return m_pPostItMgr.get();}
625 // exhibition hack (MA,MBA)
626 void SelectShellForDrop();
628 void UpdateDocStats();
630 // methods for printing
631 SAL_DLLPRIVATE virtual SfxPrinter* GetPrinter( bool bCreate = false ) override;
632 SAL_DLLPRIVATE virtual bool HasPrintOptionsPage() const override;
633 SAL_DLLPRIVATE virtual std::unique_ptr<SfxTabPage> CreatePrintOptionsPage(weld::Container* pPage, weld::DialogController* pController,
634 const SfxItemSet& rSet) override;
635 static SvxSearchItem* GetSearchItem() { return s_pSrchItem; }
636 /// See SfxViewShell::getPart().
637 int getPart() const override;
638 /// See SfxViewShell::dumpAsXml().
639 void dumpAsXml(xmlTextWriterPtr pWriter) const override;
640 void SetRedlineAuthor(const OUString& rAuthor);
641 const OUString& GetRedlineAuthor() const;
642 /// See SfxViewShell::NotifyCursor().
643 void NotifyCursor(SfxViewShell* pViewShell) const override;
644 void ShowUIElement(const OUString& sElementURL) const;
647 enum CachedStringID
649 OldGrfCat,
650 OldTabCat,
651 OldFrameCat,
652 OldDrwCat,
653 CachedStrings
656 OUString m_StringCache[CachedStrings];
658 const OUString& GetCachedString(CachedStringID id)
660 return m_StringCache[id];
663 void SetCachedString(CachedStringID id, const OUString& sStr)
665 m_StringCache[id] = sStr;
668 const OUString& GetOldGrfCat();
669 void SetOldGrfCat(const OUString& sStr);
670 const OUString& GetOldTabCat();
671 void SetOldTabCat(const OUString& sStr);
672 const OUString& GetOldFrameCat();
673 void SetOldFrameCat(const OUString& sStr);
674 const OUString& GetOldDrwCat();
675 void SetOldDrwCat(const OUString& sStr);
678 inline tools::Long SwView::GetXScroll() const
680 return (m_aVisArea.GetWidth() * nScrollX) / 100;
683 inline tools::Long SwView::GetYScroll() const
685 return (m_aVisArea.GetHeight() * nScrollY) / 100;
688 inline const SwDocShell *SwView::GetDocShell() const
690 return const_cast<SwView*>(this)->GetDocShell();
693 std::unique_ptr<SfxTabPage> CreatePrintOptionsPage(weld::Container* pPage, weld::DialogController* pController,
694 const SfxItemSet &rOptions,
695 bool bPreview);
697 extern bool bDocSzUpdated;
699 #endif
701 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */