Bump version to 21.06.18.1
[LibreOffice.git] / sw / inc / view.hxx
blob0f062d3bedf3b83d420e7a726c48f0110bd05caf
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 m_bForceChangesToolbar : 1; // on load of documents with change tracking
250 bool m_bInitOnceCompleted = false;
252 /// LibreOfficeKit has to force the page size for PgUp/PgDown
253 /// functionality based on the user's view, instead of using the m_aVisArea.
254 SwTwips m_nLOKPageUpDownOffset;
256 // methods for searching
257 // set search context
258 SAL_DLLPRIVATE bool SearchAndWrap(bool bApi);
259 SAL_DLLPRIVATE bool SearchAll();
260 SAL_DLLPRIVATE sal_uLong FUNC_Search( const SwSearchOptions& rOptions );
261 SAL_DLLPRIVATE void Replace();
263 bool IsDocumentBorder();
265 SAL_DLLPRIVATE bool IsTextTool() const;
267 DECL_DLLPRIVATE_LINK( TimeoutHdl, Timer*, void );
269 inline tools::Long GetXScroll() const;
270 inline tools::Long GetYScroll() const;
271 SAL_DLLPRIVATE Point AlignToPixel(const Point& rPt) const;
272 SAL_DLLPRIVATE void CalcPt( Point* pPt,const tools::Rectangle& rRect,
273 sal_uInt16 nRangeX,
274 sal_uInt16 nRangeY);
276 SAL_DLLPRIVATE bool GetPageScrollUpOffset(SwTwips& rOff) const;
277 SAL_DLLPRIVATE bool GetPageScrollDownOffset(SwTwips& rOff) const;
279 // scrollbar movements
280 SAL_DLLPRIVATE bool PageUp();
281 SAL_DLLPRIVATE bool PageDown();
282 SAL_DLLPRIVATE bool PageUpCursor(bool bSelect);
283 SAL_DLLPRIVATE bool PageDownCursor(bool bSelect);
284 SAL_DLLPRIVATE void PhyPageUp();
285 SAL_DLLPRIVATE void PhyPageDown();
287 SAL_DLLPRIVATE void CreateScrollbar( bool bHori );
288 DECL_DLLPRIVATE_LINK( ScrollHdl, ScrollBar*, void );
289 DECL_DLLPRIVATE_LINK( EndScrollHdl, ScrollBar*, void );
290 SAL_DLLPRIVATE bool UpdateScrollbars();
291 DECL_DLLPRIVATE_LINK( WindowChildEventListener, VclWindowEvent&, void );
292 SAL_DLLPRIVATE void CalcVisArea( const Size &rPixelSz );
294 // linguistics functions
295 SAL_DLLPRIVATE void HyphenateDocument();
296 SAL_DLLPRIVATE bool IsDrawTextHyphenate();
297 SAL_DLLPRIVATE void HyphenateDrawText();
298 SAL_DLLPRIVATE void StartThesaurus();
300 // text conversion
301 SAL_DLLPRIVATE void StartTextConversion( LanguageType nSourceLang, LanguageType nTargetLang, const vcl::Font *pTargetFont, sal_Int32 nOptions, bool bIsInteractive );
303 // used for spell checking and text conversion
304 SAL_DLLPRIVATE void SpellStart( SvxSpellArea eSpell, bool bStartDone,
305 bool bEndDone, SwConversionArgs *pConvArgs );
306 SAL_DLLPRIVATE void SpellEnd( SwConversionArgs const *pConvArgs );
308 SAL_DLLPRIVATE void HyphStart( SvxSpellArea eSpell );
309 SAL_DLLPRIVATE void SpellContext(bool bOn = true)
310 { m_bCenterCursor = bOn; }
312 // for readonly switching
313 SAL_DLLPRIVATE virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override;
314 SAL_DLLPRIVATE void CheckReadonlyState();
315 SAL_DLLPRIVATE void CheckReadonlySelection();
317 // method for rotating PageDesc
318 SAL_DLLPRIVATE void SwapPageMargin(const SwPageDesc&, SvxLRSpaceItem& rLR);
320 SAL_DLLPRIVATE void SetZoom_( const Size &rEditSz,
321 SvxZoomType eZoomType,
322 short nFactor,
323 bool bViewOnly);
324 SAL_DLLPRIVATE void CalcAndSetBorderPixel( SvBorder &rToFill );
326 SAL_DLLPRIVATE void ShowAtResize();
328 SAL_DLLPRIVATE virtual void Move() override;
330 public: // #i123922# Needs to be called from a 2nd place now as a helper method
331 SAL_DLLPRIVATE bool InsertGraphicDlg( SfxRequest& );
333 protected:
335 SwView_Impl* GetViewImpl() {return m_pViewImpl.get();}
337 void ImpSetVerb( SelectionType nSelType );
339 SelectionType GetSelectionType() const { return m_nSelectionType; }
340 void SetSelectionType(SelectionType nSet) { m_nSelectionType = nSet;}
342 // for SwWebView
343 void SetShell( SfxShell* pS ) { m_pShell = pS; }
344 void SetFormShell( FmFormShell* pSh ) { m_pFormShell = pSh; }
346 virtual void SelectShell();
348 virtual void Activate(bool) override;
349 virtual void Deactivate(bool) override;
350 virtual void InnerResizePixel( const Point &rOfs, const Size &rSize, bool inplaceEditModeChange ) override;
351 virtual void OuterResizePixel( const Point &rOfs, const Size &rSize ) override;
353 const SwFrameFormat* GetLastTableFrameFormat() const {return m_pLastTableFormat;}
354 void SetLastTableFrameFormat(const SwFrameFormat* pSet) {m_pLastTableFormat = pSet;}
356 // form letter execution
357 void GenerateFormLetter(bool bUseCurrentDocument);
359 using SfxShell::GetDispatcher;
361 public:
362 SFX_DECL_VIEWFACTORY(SwView);
363 SFX_DECL_INTERFACE(SW_VIEWSHELL)
365 private:
366 /// SfxInterface initializer.
367 static void InitInterface_Impl();
369 public:
370 SfxDispatcher &GetDispatcher();
372 void GotFocus() const;
373 virtual SdrView* GetDrawView() const override;
374 virtual bool HasUIFeature(SfxShellFeature nFeature) const override;
375 virtual void ShowCursor( bool bOn = true ) override;
376 virtual ErrCode DoVerb( tools::Long nVerb ) override;
378 virtual sal_uInt16 SetPrinter( SfxPrinter* pNew,
379 SfxPrinterChangeFlags nDiff = SFX_PRINTER_ALL) override;
380 ShellMode GetShellMode() const;
382 css::view::XSelectionSupplier* GetUNOObject();
384 OUString GetSelectionTextParam( bool bCompleteWords,
385 bool bEraseTrail );
386 virtual bool HasSelection( bool bText = true ) const override;
387 virtual OUString GetSelectionText( bool bCompleteWords = false ) override;
388 virtual bool PrepareClose( bool bUI = true ) override;
389 virtual void MarginChanged() override;
391 // replace word/selection with text from the thesaurus
392 // (this code has special handling for "in word" character)
393 void InsertThesaurusSynonym( const OUString &rSynonmText, const OUString &rLookUpText, bool bValidSelection );
394 bool IsValidSelectionForThesaurus() const;
395 OUString GetThesaurusLookUpText( bool bSelection ) const;
397 // immediately switch shell -> for GetSelectionObject
398 void StopShellTimer();
400 SwWrtShell& GetWrtShell () const { return *m_pWrtShell; }
401 SwWrtShell* GetWrtShellPtr() const { return m_pWrtShell.get(); }
403 SwEditWin &GetEditWin() { return *m_pEditWin; }
404 const SwEditWin &GetEditWin () const { return *m_pEditWin; }
406 #if defined(_WIN32) || defined UNX
407 void ScannerEventHdl();
408 #endif
410 // hand the handler for text blocks to the shell; create if applicable
411 SwGlossaryHdl* GetGlosHdl();
413 const tools::Rectangle& GetVisArea() const { return m_aVisArea; }
415 bool IsScroll(const tools::Rectangle& rRect) const;
416 void Scroll( const tools::Rectangle& rRect,
417 sal_uInt16 nRangeX = USHRT_MAX,
418 sal_uInt16 nRangeY = USHRT_MAX);
420 tools::Long SetVScrollMax(tools::Long lMax);
421 tools::Long SetHScrollMax(tools::Long lMax);
423 void SpellError(LanguageType eLang);
424 bool ExecSpellPopup( const Point& rPt );
425 void ExecSmartTagPopup( const Point& rPt );
427 DECL_LINK( OnlineSpellCallback, SpellCallbackInfo&, void );
428 bool ExecDrwTextSpellPopup(const Point& rPt);
430 void SetTabColFromDocPos( const Point &rPt ) { m_aTabColFromDocPos = rPt; }
431 void SetTabColFromDoc( bool b ) { m_bTabColFromDoc = b; }
432 bool IsTabColFromDoc() const { return m_bTabColFromDoc; }
433 void SetTabRowFromDoc( bool b ) { m_bTabRowFromDoc = b; }
434 bool IsTabRowFromDoc() const { return m_bTabRowFromDoc; }
436 void SetNumRuleNodeFromDoc( SwTextNode * pNumRuleNode )
437 { m_pNumRuleNodeFromDoc = pNumRuleNode; }
439 void DocSzChgd( const Size& rNewSize );
440 const Size& GetDocSz() const { return m_aDocSz; }
441 void SetVisArea( const tools::Rectangle&, bool bUpdateScrollbar = true);
442 void SetVisArea( const Point&, bool bUpdateScrollbar = true);
443 void CheckVisArea();
445 void RecheckBrowseMode();
446 static SvxSearchDialog* GetSearchDialog();
448 static sal_uInt16 GetMoveType();
449 static void SetMoveType(sal_uInt16 nSet);
450 DECL_LINK( MoveNavigationHdl, void*, void );
451 static void SetActMark(sal_Int32 nSet);
453 bool HandleWheelCommands( const CommandEvent& );
455 // insert frames
456 void InsFrameMode(sal_uInt16 nCols);
458 void SetZoom( SvxZoomType eZoomType, short nFactor = 100, bool bViewOnly = false);
459 virtual void SetZoomFactor( const Fraction &rX, const Fraction & ) override;
461 void SetViewLayout( sal_uInt16 nColumns, bool bBookMode, bool bViewOnly = false );
463 void ShowHScrollbar(bool bShow);
464 bool IsHScrollbarVisible()const;
466 void ShowVScrollbar(bool bShow);
467 bool IsVScrollbarVisible()const;
469 void EnableHScrollbar(bool bEnable);
470 void EnableVScrollbar(bool bEnable);
472 void CreateVRuler();
473 void KillVRuler();
474 void CreateTab();
475 void KillTab();
477 bool StatVRuler() const { return m_pVRuler->IsVisible(); }
478 void ChangeVRulerMetric(FieldUnit eUnit);
479 void GetVRulerMetric(FieldUnit& rToFill) const;
481 SvxRuler& GetHRuler() { return *m_pHRuler; }
482 SvxRuler& GetVRuler() { return *m_pVRuler; }
483 void InvalidateRulerPos();
484 void ChangeTabMetric(FieldUnit eUnit);
485 void GetHRulerMetric(FieldUnit& rToFill) const;
487 // Handler
488 void Execute(SfxRequest&);
489 void ExecLingu(SfxRequest&);
490 void ExecDlg(SfxRequest const &);
491 void ExecDlgExt(SfxRequest const &);
492 void ExecColl(SfxRequest const &);
493 void ExecutePrint(SfxRequest&);
494 void ExecDraw(SfxRequest&);
495 void ExecTabWin(SfxRequest const &);
496 void ExecuteStatusLine(SfxRequest&);
497 DECL_LINK( ExecRulerClick, Ruler *, void );
498 void ExecSearch(SfxRequest&);
499 void ExecViewOptions(SfxRequest &);
501 virtual bool IsConditionalFastCall( const SfxRequest &rReq ) override;
503 void StateViewOptions(SfxItemSet &);
504 void StateSearch(SfxItemSet &);
505 void GetState(SfxItemSet&);
506 void StateStatusLine(SfxItemSet&);
507 void UpdateWordCount(SfxShell*, sal_uInt16);
508 void ExecFormatFootnote();
509 void ExecNumberingOutline(SfxItemPool &);
511 // functions for drawing
512 void SetDrawFuncPtr(std::unique_ptr<SwDrawBase> pFuncPtr);
513 SwDrawBase* GetDrawFuncPtr() const { return m_pDrawActual.get(); }
514 void GetDrawState(SfxItemSet &rSet);
515 void ExitDraw();
516 bool IsDrawRotate() const { return m_bDrawRotate; }
517 void FlipDrawRotate() { m_bDrawRotate = !m_bDrawRotate; }
518 bool IsDrawSelMode() const { return m_bDrawSelMode; }
519 void SetSelDrawSlot();
520 void FlipDrawSelMode() { m_bDrawSelMode = !m_bDrawSelMode; }
521 void NoRotate(); // turn off rotate mode
522 bool EnterDrawTextMode(const Point& aDocPos);
523 /// Same as EnterDrawTextMode(), but takes an SdrObject instead of guessing it by document position.
524 bool EnterShapeDrawTextMode(SdrObject* pObject);
525 void LeaveDrawCreate() { m_nDrawSfxId = m_nFormSfxId = USHRT_MAX; m_sDrawCustom.clear(); m_eFormObjKind = OBJ_NONE; }
526 bool IsDrawMode() const { return (m_nDrawSfxId != USHRT_MAX || m_nFormSfxId != USHRT_MAX); }
527 bool IsFormMode() const;
528 bool IsBezierEditMode() const;
529 bool AreOnlyFormsSelected() const;
530 bool HasOnlyObj(SdrObject const *pSdrObj, SdrInventor eObjInventor) const;
531 bool BeginTextEdit( SdrObject* pObj, SdrPageView* pPV=nullptr,
532 vcl::Window* pWin=nullptr, bool bIsNewObj=false, bool bSetSelectionToStart=false );
533 bool isSignatureLineSelected() const;
534 bool isSignatureLineSigned() const;
535 bool isQRCodeSelected() const;
537 void StateTabWin(SfxItemSet&);
539 // attributes have changed
540 DECL_LINK( AttrChangedNotify, LinkParamNone*, void );
542 // form control has been activated
543 DECL_LINK( FormControlActivated, LinkParamNone*, void );
545 // edit links
546 void EditLinkDlg();
547 void AutoCaption(const sal_uInt16 nType, const SvGlobalName *pOleId = nullptr);
548 void InsertCaption(const InsCaptionOpt *pOpt);
550 // Async call by Core
551 void UpdatePageNums();
553 OUString GetPageStr(sal_uInt16 nPhyNum, sal_uInt16 nVirtNum, const OUString& rPgStr);
555 /// Force page size for PgUp/PgDown to overwrite the computation based on m_aVisArea.
556 void ForcePageUpDownOffset(SwTwips nTwips)
558 m_nLOKPageUpDownOffset = nTwips;
561 // hand over Shell
562 SfxShell *GetCurShell() { return m_pShell; }
563 SwDocShell *GetDocShell();
564 inline const SwDocShell *GetDocShell() const;
565 virtual FmFormShell *GetFormShell() override { return m_pFormShell; }
566 virtual const FmFormShell *GetFormShell() const override { return m_pFormShell; }
568 // so that in the SubShells' DTors m_pShell can be reset if applicable
569 void ResetSubShell() { m_pShell = nullptr; }
571 virtual void WriteUserData(OUString &, bool bBrowse = false) override;
572 virtual void ReadUserData(const OUString &, bool bBrowse = false) override;
573 virtual void ReadUserDataSequence ( const css::uno::Sequence < css::beans::PropertyValue >& ) override;
574 virtual void WriteUserDataSequence ( css::uno::Sequence < css::beans::PropertyValue >& ) override;
576 void SetCursorAtTop( bool bFlag, bool bCenter = false )
577 { m_bTopCursor = bFlag; m_bCenterCursor = bCenter; }
579 bool JumpToSwMark( const OUString& rMark );
581 tools::Long InsertDoc( sal_uInt16 nSlotId, const OUString& rFileName,
582 const OUString& rFilterName, sal_Int16 nVersion = 0 );
584 void ExecuteInsertDoc( SfxRequest& rRequest, const SfxPoolItem* pItem );
585 tools::Long InsertMedium( sal_uInt16 nSlotId, std::unique_ptr<SfxMedium> pMedium, sal_Int16 nVersion );
586 DECL_LINK( DialogClosedHdl, sfx2::FileDialogHelper *, void );
588 // status methods for clipboard.
589 // Status changes now notified from the clipboard.
590 bool IsPasteAllowed();
591 bool IsPasteSpecialAllowed();
592 bool IsPasteSpreadsheet(bool bHasOwnTableCopied);
594 // Enable mail merge - mail merge field dialog enabled
595 void EnableMailMerge();
596 //apply Accessibility options
597 void ApplyAccessibilityOptions(SvtAccessibilityOptions const & rAccessibilityOptions);
599 SwView(SfxViewFrame* pFrame, SfxViewShell*);
600 virtual ~SwView() override;
602 void NotifyDBChanged();
604 SfxObjectShellLock CreateTmpSelectionDoc();
606 void AddTransferable(SwTransferable& rTransferable);
608 // store MailMerge data while "Back to Mail Merge Wizard" FloatingWindow is active
609 // or to support printing
610 void SetMailMergeConfigItem(std::shared_ptr<SwMailMergeConfigItem> const & rConfigItem);
611 std::shared_ptr<SwMailMergeConfigItem> const & GetMailMergeConfigItem() const;
612 std::shared_ptr<SwMailMergeConfigItem> EnsureMailMergeConfigItem(const SfxItemSet* pArgs = nullptr);
614 OUString GetDataSourceName() const;
615 static bool IsDataSourceAvailable(const OUString sDataSourceName);
617 void ExecFormatPaintbrush(SfxRequest const &);
618 void StateFormatPaintbrush(SfxItemSet &);
620 // public for D&D
621 ErrCode InsertGraphic( const OUString &rPath, const OUString &rFilter,
622 bool bLink, GraphicFilter *pFlt );
624 void ExecuteScan( SfxRequest& rReq );
626 SwPostItMgr* GetPostItMgr() { return m_pPostItMgr.get();}
627 const SwPostItMgr* GetPostItMgr() const { return m_pPostItMgr.get();}
629 // exhibition hack (MA,MBA)
630 void SelectShellForDrop();
632 void UpdateDocStats();
634 // methods for printing
635 SAL_DLLPRIVATE virtual SfxPrinter* GetPrinter( bool bCreate = false ) override;
636 SAL_DLLPRIVATE virtual bool HasPrintOptionsPage() const override;
637 SAL_DLLPRIVATE virtual std::unique_ptr<SfxTabPage> CreatePrintOptionsPage(weld::Container* pPage, weld::DialogController* pController,
638 const SfxItemSet& rSet) override;
639 static SvxSearchItem* GetSearchItem() { return s_pSrchItem; }
640 /// See SfxViewShell::getPart().
641 int getPart() const override;
642 /// See SfxViewShell::dumpAsXml().
643 void dumpAsXml(xmlTextWriterPtr pWriter) const override;
644 void SetRedlineAuthor(const OUString& rAuthor);
645 const OUString& GetRedlineAuthor() const;
646 /// See SfxViewShell::NotifyCursor().
647 void NotifyCursor(SfxViewShell* pViewShell) const override;
648 void ShowUIElement(const OUString& sElementURL) const;
651 enum CachedStringID
653 OldGrfCat,
654 OldTabCat,
655 OldFrameCat,
656 OldDrwCat,
657 CachedStrings
660 OUString m_StringCache[CachedStrings];
662 const OUString& GetCachedString(CachedStringID id)
664 return m_StringCache[id];
667 void SetCachedString(CachedStringID id, const OUString& sStr)
669 m_StringCache[id] = sStr;
672 const OUString& GetOldGrfCat();
673 void SetOldGrfCat(const OUString& sStr);
674 const OUString& GetOldTabCat();
675 void SetOldTabCat(const OUString& sStr);
676 const OUString& GetOldFrameCat();
677 void SetOldFrameCat(const OUString& sStr);
678 const OUString& GetOldDrwCat();
679 void SetOldDrwCat(const OUString& sStr);
681 virtual tools::Rectangle getLOKVisibleArea() const override;
682 virtual void flushPendingLOKInvalidateTiles() override;
683 virtual OString getLOKPayload(int nType, int nViewId, bool* ignore) const override;
686 inline tools::Long SwView::GetXScroll() const
688 return (m_aVisArea.GetWidth() * nScrollX) / 100;
691 inline tools::Long SwView::GetYScroll() const
693 return (m_aVisArea.GetHeight() * nScrollY) / 100;
696 inline const SwDocShell *SwView::GetDocShell() const
698 return const_cast<SwView*>(this)->GetDocShell();
701 std::unique_ptr<SfxTabPage> CreatePrintOptionsPage(weld::Container* pPage, weld::DialogController* pController,
702 const SfxItemSet &rOptions,
703 bool bPreview);
705 extern bool bDocSzUpdated;
707 #endif
709 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */