LibreOffice Module sw (master)  1
doc.hxx
Go to the documentation of this file.
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_DOC_HXX
20 #define INCLUDED_SW_INC_DOC_HXX
21 
22 // SwDoc interfaces
23 #include <o3tl/deleter.hxx>
24 #include <vcl/idle.hxx>
25 #include "swdllapi.h"
26 #include "swtypes.hxx"
27 #include "toxe.hxx"
28 #include "flyenum.hxx"
29 #include "flypos.hxx"
30 #include "swdbdata.hxx"
31 #include <sfx2/objsh.hxx>
32 #include <svl/style.hxx>
33 #include <editeng/numitem.hxx>
34 #include "tox.hxx"
35 #include "frmfmt.hxx"
36 #include "charfmt.hxx"
37 #include "docary.hxx"
38 #include "pagedesc.hxx"
39 #include "tblenum.hxx"
40 #include "ndarr.hxx"
41 #include "ndtyp.hxx"
42 #include <atomic>
43 #include <memory>
44 #include <set>
45 #include <unordered_map>
46 #include <vector>
47 
48 namespace editeng { class SvxBorderLine; }
49 
50 class SwExtTextInput;
51 class EditFieldInfo;
52 class Outliner;
53 class OutputDevice;
54 class Point;
55 class SbxArray;
56 class SdrObject;
57 class SdrUndoAction;
58 class SvNumberFormatter;
59 class SvxMacro;
60 class SwAutoCompleteWord;
62 class SwCellFrame;
63 class SwCellStyleTable;
64 class SwCursorShell;
65 class SwCursor;
66 class SwDocShell;
67 class SwDrawView;
68 class SwEditShell;
69 class SwFormat;
70 class SwFormatINetFormat;
71 class SwFormatRefMark;
72 class SwFootnoteIdxs;
73 class SwFootnoteInfo;
74 class SwEndNoteInfo;
75 class SwLineNumberInfo;
76 class SwDBManager;
77 class SwNodeIndex;
78 class SwNodeRange;
79 class SwNumRule;
81 class SwRootFrame;
82 class SwRubyListEntry;
83 class SwSectionFormat;
84 class SwSectionData;
85 class SwSelBoxes;
87 class SwTOXBaseSection;
88 class SwTabCols;
89 class SwTable;
90 class SwTableAutoFormat;
91 class SwTableBox;
92 class SwTableBoxFormat;
93 class SwTableFormat;
94 class SwTableLineFormat;
95 class SwTableNode;
96 class SwTextBlocks;
97 class SwURLStateChanged;
98 class SwUnoCursor;
99 class SwViewShell;
100 class SwDrawContact;
101 class SdrView;
102 class SdrMarkList;
103 class SwAuthEntry;
104 class SwLayoutCache;
105 class IStyleAccess;
106 struct SwCallMouseEvent;
107 struct SwDocStat;
108 struct SwSortOptions;
109 struct SwDefTOXBase_Impl;
110 class SwPrintUIOptions;
111 struct SwConversionArgs;
112 class IGrammarContact;
113 class SwRenderData;
114 class IDocumentUndoRedo;
121 class IDocumentListItems;
126 class IDocumentStatistics;
127 class IDocumentState;
131 class IDocumentMarkAccess;
132 class SetGetExpFields;
133 struct SwInsertTableOptions;
134 enum class SvMacroItemId : sal_uInt16;
135 enum class SvxFrameDirection;
136 enum class RndStdIds;
137 
138 namespace sw { namespace mark {
139  class MarkManager;
140 }}
141 namespace sw {
142  enum class RedlineMode;
143  class MetaFieldManager;
144  class UndoManager;
145  class IShellCursorSupplier;
146  class DocumentSettingManager;
147  class DocumentDeviceManager;
148  class DocumentDrawModelManager;
149  class DocumentChartDataProviderManager;
150  class DocumentTimerManager;
151  class DocumentLinksAdministrationManager;
152  class DocumentListItemsManager;
153  class DocumentListsManager;
154  class DocumentOutlineNodesManager;
155  class DocumentContentOperationsManager;
156  class DocumentRedlineManager;
157  class DocumentFieldsManager;
158  class DocumentStatisticsManager;
159  class DocumentStateManager;
160  class DocumentLayoutManager;
161  class DocumentStylePoolManager;
162  class DocumentExternalDataManager;
163 }
164 
165 namespace com { namespace sun { namespace star {
166 namespace container {
167  class XNameContainer; //< for getXForms()/isXForms()/initXForms() methods
168 }
169 namespace embed { class XStorage; }
170 namespace linguistic2 { class XHyphenatedWord; }
171 namespace linguistic2 { class XProofreadingIterator; }
172 namespace linguistic2 { class XSpellChecker1; }
173 namespace script { namespace vba { class XVBAEventProcessor; } }
174 }}}
175 
176 namespace sfx2 {
177  class IXmlIdRegistry;
178 }
179 
180 void SetAllScriptItem( SfxItemSet& rSet, const SfxPoolItem& rItem );
181 
182 using SwRubyList = std::vector<std::unique_ptr<SwRubyListEntry>>;
183 
184 // Represents the model of a Writer document.
185 class SW_DLLPUBLIC SwDoc final
186 {
187  friend class ::sw::DocumentContentOperationsManager;
188 
189  friend void InitCore();
190  friend void FinitCore();
191 
192  // private Member
193  std::unique_ptr<SwNodes> m_pNodes; //< document content (Nodes Array)
194  SwAttrPool* mpAttrPool; //< the attribute pool
195  SwPageDescs m_PageDescs; //< PageDescriptors
196  Link<bool,void> maOle2Link; //< OLE 2.0-notification
197  /* @@@MAINTAINABILITY-HORROR@@@
198  Timer should not be members of the model
199  */
200  Idle maOLEModifiedIdle; //< Timer for update modified OLE-Objects
201  SwDBData maDBData; //< database descriptor
202  OUString msTOIAutoMarkURL; //< URL of table of index AutoMark file
203  std::vector<OUString> m_PatternNames; //< Array for names of document-templates
204  css::uno::Reference<css::container::XNameContainer>
205  mxXForms; //< container with XForms models
206  mutable css::uno::Reference< css::linguistic2::XProofreadingIterator > m_xGCIterator;
207 
208  const std::unique_ptr< ::sw::mark::MarkManager> mpMarkManager;
209  const std::unique_ptr< ::sw::MetaFieldManager > m_pMetaFieldManager;
210  const std::unique_ptr< ::sw::DocumentDrawModelManager > m_pDocumentDrawModelManager;
211  const std::unique_ptr< ::sw::DocumentRedlineManager > m_pDocumentRedlineManager;
212  const std::unique_ptr< ::sw::DocumentStateManager > m_pDocumentStateManager;
213  const std::unique_ptr< ::sw::UndoManager > m_pUndoManager;
214  const std::unique_ptr< ::sw::DocumentSettingManager > m_pDocumentSettingManager;
215  const std::unique_ptr< ::sw::DocumentChartDataProviderManager > m_pDocumentChartDataProviderManager;
216  std::unique_ptr< ::sw::DocumentDeviceManager > m_pDeviceAccess;
217  const std::unique_ptr< ::sw::DocumentTimerManager > m_pDocumentTimerManager;
218  const std::unique_ptr< ::sw::DocumentLinksAdministrationManager > m_pDocumentLinksAdministrationManager;
219  const std::unique_ptr< ::sw::DocumentListItemsManager > m_pDocumentListItemsManager;
220  const std::unique_ptr< ::sw::DocumentListsManager > m_pDocumentListsManager;
221  const std::unique_ptr< ::sw::DocumentOutlineNodesManager > m_pDocumentOutlineNodesManager;
222  const std::unique_ptr< ::sw::DocumentContentOperationsManager > m_pDocumentContentOperationsManager;
223  const std::unique_ptr< ::sw::DocumentFieldsManager > m_pDocumentFieldsManager;
224  const std::unique_ptr< ::sw::DocumentStatisticsManager > m_pDocumentStatisticsManager;
225  const std::unique_ptr< ::sw::DocumentLayoutManager > m_pDocumentLayoutManager;
226  const std::unique_ptr< ::sw::DocumentStylePoolManager > m_pDocumentStylePoolManager;
227  const std::unique_ptr< ::sw::DocumentExternalDataManager > m_pDocumentExternalDataManager;
228 
229  // Pointer
230  std::unique_ptr<SwFrameFormat> mpDfltFrameFormat; //< Default formats.
231  std::unique_ptr<SwFrameFormat> mpEmptyPageFormat; //< Format for the default empty page
232  std::unique_ptr<SwFrameFormat> mpColumnContFormat; //< Format for column container
233  std::unique_ptr<SwCharFormat> mpDfltCharFormat;
234  std::unique_ptr<SwTextFormatColl> mpDfltTextFormatColl; //< Defaultformatcollections
235  std::unique_ptr<SwGrfFormatColl> mpDfltGrfFormatColl;
236 
237  std::unique_ptr<SwFrameFormats> mpFrameFormatTable; //< Format table
238  std::unique_ptr<SwCharFormats> mpCharFormatTable;
239  std::unique_ptr<SwFrameFormats> mpSpzFrameFormatTable;
240  std::unique_ptr<SwSectionFormats> mpSectionFormatTable;
241  std::unique_ptr<SwFrameFormats> mpTableFrameFormatTable; //< For tables
242  std::unique_ptr<SwTextFormatColls> mpTextFormatCollTable; //< FormatCollections
243  std::unique_ptr<SwGrfFormatColls> mpGrfFormatCollTable;
244 
245  std::unique_ptr<SwTOXTypes> mpTOXTypes; //< Tables/indices
246  std::unique_ptr<SwDefTOXBase_Impl> mpDefTOXBases; //< defaults of SwTOXBase's
247 
248  std::unique_ptr<SwDBManager, o3tl::default_delete<SwDBManager>> m_pOwnDBManager; //< own DBManager
249  SwDBManager * m_pDBManager; //< DBManager for evaluation of DB-fields.
250 
252  std::unique_ptr<SwFootnoteInfo> mpFootnoteInfo;
253  std::unique_ptr<SwEndNoteInfo> mpEndNoteInfo;
254  std::unique_ptr<SwLineNumberInfo> mpLineNumberInfo;
255  std::unique_ptr<SwFootnoteIdxs> mpFootnoteIdxs;
256 
257  SwDocShell *mpDocShell; //< Ptr to SfxDocShell of Doc.
258  SfxObjectShellLock mxTmpDocShell; //< A temporary shell that is used to copy OLE-Nodes
259 
260  std::unique_ptr<SwAutoCorrExceptWord> mpACEWord;
262  std::unique_ptr<SwURLStateChanged> mpURLStateChgd; //< SfxClient for changes in INetHistory
263  std::atomic<SvNumberFormatter*> mpNumberFormatter; //< NumFormatter for tables / fields
264 
265  mutable std::unique_ptr<SwNumRuleTable> mpNumRuleTable; //< List of all named NumRules.
266 
267  // Hash map to find numrules by name
268  mutable std::unordered_map<OUString, SwNumRule *> maNumRuleMap;
269 
270  std::unique_ptr<SwPagePreviewPrtData> m_pPgPViewPrtData; //< Indenting / spacing for printing of page view.
272 
273  std::unique_ptr<IStyleAccess> mpStyleAccess; //< handling of automatic styles
274  std::unique_ptr<SwLayoutCache> mpLayoutCache;
277  std::unique_ptr<IGrammarContact> mpGrammarContact; //< for grammar checking in paragraphs during editing
278 
279  css::uno::Reference< css::script::vba::XVBAEventProcessor > mxVbaEvents;
280  css::uno::Reference<css::container::XNameContainer> m_xTemplateToProjectCache;
281 
283  std::unique_ptr<SwTableAutoFormatTable> m_pTableStyles;
285  std::unique_ptr<SwCellStyleTable> mpCellStyles;
286 private:
287  std::unique_ptr< ::sfx2::IXmlIdRegistry > m_pXmlIdRegistry;
288 
289  // other
290 
291  sal_uInt32 mnRsid; //< current session ID of the document
292  sal_uInt32 mnRsidRoot; //< session ID when the document was created
293 
294  oslInterlockedCount mReferenceCount;
295 
296  bool mbDtor : 1;
300  bool mbCopyIsMove : 1; //< TRUE: Copy is a hidden Move.
301  bool mbInReading : 1; //< TRUE: Document is in the process of being read.
302  bool mbInMailMerge : 1; //< TRUE: Document is in the process of being written by mail merge.
303  bool mbInXMLImport : 1; //< TRUE: During xml import, attribute portion building is not necessary.
304  bool mbUpdateTOX : 1; //< TRUE: After loading document, update TOX.
305  bool mbInLoadAsynchron : 1; //< TRUE: Document is in the process of being loaded asynchronously.
306  bool mbIsAutoFormatRedline : 1; //< TRUE: Redlines are recorded by Autoformat.
307  bool mbOLEPrtNotifyPending : 1;
309  bool mbAllOLENotify : 1; //< True: Notification of all objects is required.
310  bool mbInsOnlyTextGlssry : 1; //< True: insert 'only text' glossary into doc
311  bool mbContains_MSVBasic : 1; //< True: MS-VBasic exist is in our storage
312  bool mbClipBoard : 1; //< TRUE: this document represents the clipboard
313  bool mbColumnSelection : 1; //< TRUE: this content has been created by a column selection (clipboard docs only)
314  bool mbIsPrepareSelAll : 1;
315 
316  enum MissingDictionary { False = -1, Undefined = 0, True = 1 };
318 
319  // true: Document contains at least one anchored object, which is anchored AT_PAGE with a content position.
320  // Thus, certain adjustment needed during formatting for these kind of anchored objects.
321  bool mbContainsAtPageObjWithContentAnchor : 1;
322 
323  static SwAutoCompleteWord *s_pAutoCompleteWords; //< List of all words for AutoComplete
324 
325  // private methods
326  SwFlyFrameFormat* MakeFlySection_( const SwPosition& rAnchPos,
327  const SwContentNode& rNode, RndStdIds eRequestId,
328  const SfxItemSet* pFlyAttrSet,
329  SwFrameFormat* );
330  sal_Int8 SetFlyFrameAnchor( SwFrameFormat& rFlyFormat, SfxItemSet& rSet, bool bNewFrames );
331 
332  typedef SwFormat* (SwDoc:: *FNCopyFormat)( const OUString&, SwFormat*, bool, bool );
333  SwFormat* CopyFormat( const SwFormat& rFormat, const SwFormatsBase& rFormatArr,
334  FNCopyFormat fnCopyFormat, const SwFormat& rDfltFormat );
335  void CopyFormatArr( const SwFormatsBase& rSourceArr, SwFormatsBase const & rDestArr,
336  FNCopyFormat fnCopyFormat, SwFormat& rDfltFormat );
337  void CopyPageDescHeaderFooterImpl( bool bCpyHeader,
338  const SwFrameFormat& rSrcFormat, SwFrameFormat& rDestFormat );
339 
340  SwDoc( const SwDoc &) = delete;
341 
342  // Database fields:
343  void AddUsedDBToList( std::vector<OUString>& rDBNameList,
344  const std::vector<OUString>& rUsedDBNames );
345  void AddUsedDBToList( std::vector<OUString>& rDBNameList, const OUString& rDBName );
346  static bool IsNameInArray( const std::vector<OUString>& rOldNames, const OUString& rName );
347  void GetAllDBNames( std::vector<OUString>& rAllDBNames );
348  static OUString ReplaceUsedDBs( const std::vector<OUString>& rUsedDBNames,
349  const OUString& rNewName, const OUString& rFormula );
350  static std::vector<OUString>& FindUsedDBs( const std::vector<OUString>& rAllDBNames,
351  const OUString& rFormula,
352  std::vector<OUString>& rUsedDBNames );
353 
354  void EnsureNumberFormatter();
355 
356  bool UnProtectTableCells( SwTable& rTable );
357 
360  bool SplitDoc( sal_uInt16 eDocType, const OUString& rPath, bool bOutline,
361  const SwTextFormatColl* pSplitColl, int nOutlineLevel = 0 );
362 
363  // Update charts of given table.
364  void UpdateCharts_( const SwTable& rTable, SwViewShell const & rVSh ) const;
365 
366  static bool SelectNextRubyChars( SwPaM& rPam, SwRubyListEntry& rRubyEntry );
367 
368  // CharTimer calls this method.
369  void DoUpdateAllCharts();
370  DECL_LINK( DoUpdateModifiedOLE, Timer *, void );
371 
372 public:
373  SwFormat *MakeCharFormat_(const OUString &, SwFormat *, bool, bool );
374  SwFormat *MakeFrameFormat_(const OUString &, SwFormat *, bool, bool );
375 
376 private:
377  SwFormat *MakeTextFormatColl_(const OUString &, SwFormat *, bool, bool );
378 
379 private:
380  OUString msDocAccTitle;
381 
382  void InitTOXTypes();
383 
384 public:
387  DOCTYPE_MSWORD // This doc model comes from MS Word
388  };
390  DocumentType GetDocumentType() const { return meDocType; }
391  void SetDocumentType( DocumentType eDocType ) { meDocType = eDocType; }
392 
393  // Life cycle
394  SwDoc();
395  ~SwDoc();
396 
397  bool IsInDtor() const { return mbDtor; }
398 
399  /* @@@MAINTAINABILITY-HORROR@@@
400  Implementation details made public.
401  */
402  SwNodes & GetNodes() { return *m_pNodes; }
403  SwNodes const& GetNodes() const { return *m_pNodes; }
404 
405 private:
406  friend class ::rtl::Reference<SwDoc>;
407 
415  sal_Int32 acquire();
424  sal_Int32 release();
428 public:
429  sal_Int32 getReferenceCount() const;
430 
431  // IDocumentSettingAccess
432  IDocumentSettingAccess const & getIDocumentSettingAccess() const; //The IDocumentSettingAccess interface
433  IDocumentSettingAccess & getIDocumentSettingAccess();
434  ::sw::DocumentSettingManager & GetDocumentSettingManager(); //The implementation of the interface with some additional methods
435  ::sw::DocumentSettingManager const& GetDocumentSettingManager() const;
436  sal_uInt32 getRsid() const;
437  void setRsid( sal_uInt32 nVal );
438  sal_uInt32 getRsidRoot() const;
439  void setRsidRoot( sal_uInt32 nVal );
440 
441  // IDocumentDeviceAccess
442  IDocumentDeviceAccess const & getIDocumentDeviceAccess() const;
443  IDocumentDeviceAccess & getIDocumentDeviceAccess();
444 
445  // IDocumentMarkAccess
446  IDocumentMarkAccess* getIDocumentMarkAccess();
447  const IDocumentMarkAccess* getIDocumentMarkAccess() const;
448 
449  // IDocumentRedlineAccess
450  IDocumentRedlineAccess const& getIDocumentRedlineAccess() const;
451  IDocumentRedlineAccess& getIDocumentRedlineAccess();
452 
453  ::sw::DocumentRedlineManager const& GetDocumentRedlineManager() const;
454  ::sw::DocumentRedlineManager& GetDocumentRedlineManager();
455 
456  // IDocumentUndoRedo
457  IDocumentUndoRedo & GetIDocumentUndoRedo();
458  IDocumentUndoRedo const& GetIDocumentUndoRedo() const;
459 
460  // IDocumentLinksAdministration
461  IDocumentLinksAdministration const & getIDocumentLinksAdministration() const;
462  IDocumentLinksAdministration & getIDocumentLinksAdministration();
463 
464  ::sw::DocumentLinksAdministrationManager const & GetDocumentLinksAdministrationManager() const;
465  ::sw::DocumentLinksAdministrationManager & GetDocumentLinksAdministrationManager();
466 
467  // IDocumentFieldsAccess
468  IDocumentFieldsAccess const & getIDocumentFieldsAccess() const;
469  IDocumentFieldsAccess & getIDocumentFieldsAccess();
470 
471  ::sw::DocumentFieldsManager & GetDocumentFieldsManager();
472 
473  // Returns 0 if the field cannot hide para, or a positive integer indicating the field type
474  // "weight" when several hiding fields' FieldHidesPara() give conflicting results
475  int FieldCanHideParaWeight(SwFieldIds eFieldId) const;
476  bool FieldHidesPara(const SwField& rField) const;
477 
478  // IDocumentContentOperations
479  IDocumentContentOperations const & getIDocumentContentOperations() const;
480  IDocumentContentOperations & getIDocumentContentOperations();
481  ::sw::DocumentContentOperationsManager const & GetDocumentContentOperationsManager() const;
482  ::sw::DocumentContentOperationsManager & GetDocumentContentOperationsManager();
483 
484  bool UpdateParRsid( SwTextNode *pTextNode, sal_uInt32 nVal = 0 );
485  void UpdateRsid( const SwPaM &rRg, sal_Int32 nLen );
486 
487  // IDocumentStylePoolAccess
488  IDocumentStylePoolAccess const & getIDocumentStylePoolAccess() const;
489  IDocumentStylePoolAccess & getIDocumentStylePoolAccess();
490 
491  // SwLineNumberInfo
492  const SwLineNumberInfo& GetLineNumberInfo() const;
493  void SetLineNumberInfo(const SwLineNumberInfo& rInfo);
494 
495  // IDocumentStatistics
496  IDocumentStatistics const & getIDocumentStatistics() const;
497  IDocumentStatistics & getIDocumentStatistics();
498 
499  ::sw::DocumentStatisticsManager const & GetDocumentStatisticsManager() const;
500  ::sw::DocumentStatisticsManager & GetDocumentStatisticsManager();
501 
502  // IDocumentState
503  IDocumentState const & getIDocumentState() const;
504  IDocumentState & getIDocumentState();
505 
506  // IDocumentDrawModelAccess
507  void AddDrawUndo( std::unique_ptr<SdrUndoAction> );
508  IDocumentDrawModelAccess const & getIDocumentDrawModelAccess() const;
509  IDocumentDrawModelAccess & getIDocumentDrawModelAccess();
510 
511  ::sw::DocumentDrawModelManager const & GetDocumentDrawModelManager() const;
512  ::sw::DocumentDrawModelManager & GetDocumentDrawModelManager();
513 
514  // IDocumentLayoutAccess
515  IDocumentLayoutAccess const & getIDocumentLayoutAccess() const;
516  IDocumentLayoutAccess & getIDocumentLayoutAccess();
517 
518  ::sw::DocumentLayoutManager const & GetDocumentLayoutManager() const;
519  ::sw::DocumentLayoutManager & GetDocumentLayoutManager();
520 
521  // IDocumentTimerAccess
522  // Our own 'IdleTimer' calls the following method
523  IDocumentTimerAccess const & getIDocumentTimerAccess() const;
524  IDocumentTimerAccess & getIDocumentTimerAccess();
525 
526  // IDocumentChartDataProviderAccess
527  IDocumentChartDataProviderAccess const & getIDocumentChartDataProviderAccess() const;
528  IDocumentChartDataProviderAccess & getIDocumentChartDataProviderAccess();
529 
530  // IDocumentListItems
531  IDocumentListItems const & getIDocumentListItems() const;
532  IDocumentListItems & getIDocumentListItems();
533 
534  // IDocumentOutlineNodes
535  IDocumentOutlineNodes const & getIDocumentOutlineNodes() const;
536  IDocumentOutlineNodes & getIDocumentOutlineNodes();
537 
538  // IDocumentListsAccess
539  IDocumentListsAccess const & getIDocumentListsAccess() const;
540  IDocumentListsAccess & getIDocumentListsAccess();
541 
542  //IDocumentExternalData
543  IDocumentExternalData const & getIDocumentExternalData() const;
544  IDocumentExternalData & getIDocumentExternalData();
545 
546  //End of Interfaces
547 
548  void setDocAccTitle( const OUString& rTitle ) { msDocAccTitle = rTitle; }
549  const OUString& getDocAccTitle() const { return msDocAccTitle; }
550 
551  // INextInterface here
552  DECL_LINK(CalcFieldValueHdl, EditFieldInfo*, void);
553 
554  // OLE ???
555  bool IsOLEPrtNotifyPending() const { return mbOLEPrtNotifyPending; }
556  inline void SetOLEPrtNotifyPending( bool bSet = true );
557  void PrtOLENotify( bool bAll ); // All or only marked
558 
559  bool IsPrepareSelAll() const { return mbIsPrepareSelAll; }
560  void SetPrepareSelAll() { mbIsPrepareSelAll = true; }
561 
562  void SetContainsAtPageObjWithContentAnchor( const bool bFlag )
563  {
564  mbContainsAtPageObjWithContentAnchor = bFlag;
565  }
567  {
568  return mbContainsAtPageObjWithContentAnchor;
569  }
570 
576  SwPosFlyFrames GetAllFlyFormats( const SwPaM*,
577  bool bDrawAlso,
578  bool bAsCharAlso = false ) const;
579 
580  SwFlyFrameFormat *MakeFlyFrameFormat (const OUString &rFormatName, SwFrameFormat *pDerivedFrom);
581  SwDrawFrameFormat *MakeDrawFrameFormat(const OUString &rFormatName, SwFrameFormat *pDerivedFrom);
582 
583  // From now on this interface has to be used for Flys.
584  // pAnchorPos must be set, if they are not attached to pages AND
585  // Anchor is not already set at valid ContentPos
586  // in FlySet/FrameFormat.
587  /* new parameter bCalledFromShell
588 
589  true: An existing adjust item at pAnchorPos is propagated to
590  the content node of the new fly section. That propagation only
591  takes place if there is no adjust item in the paragraph style
592  for the new fly section.
593 
594  false: no propagation
595  */
596  SwFlyFrameFormat* MakeFlySection( RndStdIds eAnchorType,
597  const SwPosition* pAnchorPos,
598  const SfxItemSet* pSet = nullptr,
599  SwFrameFormat *pParent = nullptr,
600  bool bCalledFromShell = false );
601  SwFlyFrameFormat* MakeFlyAndMove( const SwPaM& rPam, const SfxItemSet& rSet,
602  const SwSelBoxes* pSelBoxes,
603  SwFrameFormat *pParent );
604 
605  // Helper that checks for unique items for DrawingLayer items of type NameOrIndex
606  // and evtl. corrects that items to ensure unique names for that type. This call may
607  // modify/correct entries inside of the given SfxItemSet, and it will apply a name to
608  // the items in question (what is essential to make the named slots associated with
609  // these items work for the UNO API and thus e.g. for ODF import/export)
610  void CheckForUniqueItemForLineFillNameOrIndex(SfxItemSet& rSet);
611 
612  bool SetFlyFrameAttr( SwFrameFormat& rFlyFormat, SfxItemSet& rSet );
613 
614  bool SetFrameFormatToFly( SwFrameFormat& rFlyFormat, SwFrameFormat& rNewFormat,
615  SfxItemSet* pSet = nullptr, bool bKeepOrient = false );
616  void SetFlyFrameTitle( SwFlyFrameFormat& rFlyFrameFormat,
617  const OUString& sNewTitle );
618  void SetFlyFrameDescription( SwFlyFrameFormat& rFlyFrameFormat,
619  const OUString& sNewDescription );
620 
621  // Footnotes
622  // Footnote information
623  const SwFootnoteInfo& GetFootnoteInfo() const { return *mpFootnoteInfo; }
624  void SetFootnoteInfo(const SwFootnoteInfo& rInfo);
625  const SwEndNoteInfo& GetEndNoteInfo() const { return *mpEndNoteInfo; }
626  void SetEndNoteInfo(const SwEndNoteInfo& rInfo);
627  SwFootnoteIdxs& GetFootnoteIdxs() { return *mpFootnoteIdxs; }
628  const SwFootnoteIdxs& GetFootnoteIdxs() const { return *mpFootnoteIdxs; }
630  bool SetCurFootnote( const SwPaM& rPam, const OUString& rNumStr,
631  bool bIsEndNote );
632 
636  css::uno::Any
637  Spell( SwPaM&, css::uno::Reference< css::linguistic2::XSpellChecker1 > const &,
638  sal_uInt16* pPageCnt, sal_uInt16* pPageSt, bool bGrammarCheck,
639  SwRootFrame const* pLayout, // for grammar-check
640  SwConversionArgs *pConvArgs = nullptr ) const;
641 
642  css::uno::Reference< css::linguistic2::XHyphenatedWord >
643  Hyphenate( SwPaM *pPam, const Point &rCursorPos,
644  sal_uInt16* pPageCnt, sal_uInt16* pPageSt );
645 
646  // count words in pam
647  static void CountWords( const SwPaM& rPaM, SwDocStat& rStat );
648 
649  // Glossary Document
650  bool IsInsOnlyTextGlossary() const { return mbInsOnlyTextGlssry; }
651 
652  void Summary( SwDoc* pExtDoc, sal_uInt8 nLevel, sal_uInt8 nPara, bool bImpress );
653 
654  void ChangeAuthorityData(const SwAuthEntry* pNewData);
655 
656  bool IsInHeaderFooter( const SwNodeIndex& rIdx ) const;
657  SvxFrameDirection GetTextDirection( const SwPosition& rPos,
658  const Point* pPt = nullptr ) const;
659  bool IsInVerticalText( const SwPosition& rPos ) const;
660 
661  // Database and DB-Manager
662  void SetDBManager( SwDBManager* pNewMgr ) { m_pDBManager = pNewMgr; }
663  SwDBManager* GetDBManager() const { return m_pDBManager; }
664  void ChangeDBFields( const std::vector<OUString>& rOldNames,
665  const OUString& rNewName );
666  void SetInitDBFields(bool b);
667 
668  // Find out which databases are used by fields.
669  void GetAllUsedDB( std::vector<OUString>& rDBNameList,
670  const std::vector<OUString>* pAllDBNames = nullptr );
671 
672  void ChgDBData( const SwDBData& rNewData );
673  SwDBData const & GetDBData();
674  const SwDBData& GetDBDesc();
675 
676  // Some helper functions
677  OUString GetUniqueGrfName() const;
678  OUString GetUniqueOLEName() const;
679  OUString GetUniqueFrameName() const;
680  OUString GetUniqueShapeName() const;
681 
682  std::set<SwRootFrame*> GetAllLayouts();
683 
684  void SetFlyName( SwFlyFrameFormat& rFormat, const OUString& rName );
685  const SwFlyFrameFormat* FindFlyByName( const OUString& rName, SwNodeType nNdTyp = SwNodeType::NONE ) const;
686 
687  static void GetGrfNms( const SwFlyFrameFormat& rFormat, OUString* pGrfName, OUString* pFltName );
688 
689  // Set a valid name for all Flys that have none (Called by Readers after reading).
690  void SetAllUniqueFlyNames();
691 
696  void ResetAttrs( const SwPaM &rRg,
697  bool bTextAttr = true,
698  const std::set<sal_uInt16> &rAttrs = std::set<sal_uInt16>(),
699  const bool bSendDataChangedEvents = true,
700  SwRootFrame const* pLayout = nullptr);
701  void RstTextAttrs(const SwPaM &rRg, bool bInclRefToxMark = false,
702  bool bExactRange = false, SwRootFrame const* pLayout = nullptr);
703 
706  void SetAttr( const SfxPoolItem&, SwFormat& );
709  void SetAttr( const SfxItemSet&, SwFormat& );
710 
711  // method to reset a certain attribute at the given format
712  void ResetAttrAtFormat( const sal_uInt16 nWhichId,
713  SwFormat& rChangedFormat );
714 
717  void SetDefault( const SfxPoolItem& );
718  void SetDefault( const SfxItemSet& );
719 
720  // Query default attribute in this document.
721  const SfxPoolItem& GetDefault( sal_uInt16 nFormatHint ) const;
722  template<class T> const T& GetDefault( TypedWhichId<T> nWhich ) const
723  {
724  return static_cast<const T&>(GetDefault(sal_uInt16(nWhich)));
725  }
726 
727  // Do not expand text attributes.
728  bool DontExpandFormat( const SwPosition& rPos, bool bFlag = true );
729 
730  // Formats
731  const SwFrameFormats* GetFrameFormats() const { return mpFrameFormatTable.get(); }
732  SwFrameFormats* GetFrameFormats() { return mpFrameFormatTable.get(); }
733  const SwCharFormats* GetCharFormats() const { return mpCharFormatTable.get();}
734  SwCharFormats* GetCharFormats() { return mpCharFormatTable.get();}
735 
736  // LayoutFormats (frames, DrawObjects), sometimes const sometimes not
737  const SwFrameFormats* GetSpzFrameFormats() const { return mpSpzFrameFormatTable.get(); }
738  SwFrameFormats* GetSpzFrameFormats() { return mpSpzFrameFormatTable.get(); }
739 
740  const SwFrameFormat *GetDfltFrameFormat() const { return mpDfltFrameFormat.get(); }
741  SwFrameFormat *GetDfltFrameFormat() { return mpDfltFrameFormat.get(); }
742  const SwFrameFormat *GetEmptyPageFormat() const { return mpEmptyPageFormat.get(); }
743  SwFrameFormat *GetEmptyPageFormat() { return mpEmptyPageFormat.get(); }
744  const SwFrameFormat *GetColumnContFormat() const{ return mpColumnContFormat.get(); }
745  SwFrameFormat *GetColumnContFormat() { return mpColumnContFormat.get(); }
746  const SwCharFormat *GetDfltCharFormat() const { return mpDfltCharFormat.get();}
747  SwCharFormat *GetDfltCharFormat() { return mpDfltCharFormat.get();}
748 
749  // @return the interface of the management of (auto)styles
750  IStyleAccess& GetIStyleAccess() { return *mpStyleAccess; }
751 
752  // Remove all language dependencies from all existing formats
753  void RemoveAllFormatLanguageDependencies();
754 
755  static SwFormat* FindFormatByName(const SwFormatsBase& rFormatArr, const OUString& rName);
756 
757  SwFrameFormat *MakeFrameFormat(const OUString &rFormatName, SwFrameFormat *pDerivedFrom,
758  bool bBroadcast = false, bool bAuto = true);
759  void DelFrameFormat( SwFrameFormat *pFormat, bool bBroadcast = false );
760  SwFrameFormat* FindFrameFormatByName( const OUString& rName ) const
761  { return static_cast<SwFrameFormat*>(FindFormatByName( static_cast<SwFormatsBase&>(*mpFrameFormatTable), rName )); }
762 
763  SwCharFormat *MakeCharFormat(const OUString &rFormatName, SwCharFormat *pDerivedFrom,
764  bool bBroadcast = false );
765  void DelCharFormat(size_t nFormat, bool bBroadcast = false);
766  void DelCharFormat(SwCharFormat const * pFormat, bool bBroadcast = false);
767  SwCharFormat* FindCharFormatByName( const OUString& rName ) const
768  { return static_cast<SwCharFormat*>(FindFormatByName( *mpCharFormatTable, rName )); }
769 
770  // Formatcollections (styles)
771  // TXT
772  const SwTextFormatColl* GetDfltTextFormatColl() const { return mpDfltTextFormatColl.get(); }
773  SwTextFormatColl* GetDfltTextFormatColl() { return mpDfltTextFormatColl.get(); }
774  const SwTextFormatColls *GetTextFormatColls() const { return mpTextFormatCollTable.get(); }
775  SwTextFormatColls *GetTextFormatColls() { return mpTextFormatCollTable.get(); }
776  SwTextFormatColl *MakeTextFormatColl( const OUString &rFormatName,
777  SwTextFormatColl *pDerivedFrom,
778  bool bBroadcast = false);
779  SwConditionTextFormatColl* MakeCondTextFormatColl( const OUString &rFormatName,
780  SwTextFormatColl *pDerivedFrom,
781  bool bBroadcast = false);
782  void DelTextFormatColl(size_t nFormat, bool bBroadcast = false);
783  void DelTextFormatColl( SwTextFormatColl const * pColl, bool bBroadcast = false );
791  bool SetTextFormatColl(const SwPaM &rRg, SwTextFormatColl *pFormat,
792  const bool bReset = true,
793  const bool bResetListAttrs = false,
794  SwRootFrame const* pLayout = nullptr);
795  SwTextFormatColl* FindTextFormatCollByName( const OUString& rName ) const
796  { return static_cast<SwTextFormatColl*>(FindFormatByName( *mpTextFormatCollTable, rName )); }
797 
798  void ChkCondColls();
799 
800  const SwGrfFormatColl* GetDfltGrfFormatColl() const { return mpDfltGrfFormatColl.get(); }
801  SwGrfFormatColl* GetDfltGrfFormatColl() { return mpDfltGrfFormatColl.get(); }
802  const SwGrfFormatColls *GetGrfFormatColls() const { return mpGrfFormatCollTable.get(); }
803  SwGrfFormatColl *MakeGrfFormatColl(const OUString &rFormatName,
804  SwGrfFormatColl *pDerivedFrom);
805 
806  // Table formatting
807  const SwFrameFormats* GetTableFrameFormats() const { return mpTableFrameFormatTable.get(); }
808  SwFrameFormats* GetTableFrameFormats() { return mpTableFrameFormatTable.get(); }
809  size_t GetTableFrameFormatCount( bool bUsed ) const;
810  SwFrameFormat& GetTableFrameFormat(size_t nFormat, bool bUsed ) const;
811  SwTableFormat* MakeTableFrameFormat(const OUString &rFormatName, SwFrameFormat *pDerivedFrom);
812  void DelTableFrameFormat( SwTableFormat* pFormat );
813  SwTableFormat* FindTableFormatByName( const OUString& rName, bool bAll = false ) const;
814 
817  size_t GetFlyCount( FlyCntType eType, bool bIgnoreTextBoxes = false ) const;
818  SwFrameFormat* GetFlyNum(size_t nIdx, FlyCntType eType, bool bIgnoreTextBoxes = false );
819  std::vector<SwFrameFormat const*> GetFlyFrameFormats(
820  FlyCntType eType,
821  bool bIgnoreTextBoxes);
822 
823  // Copy formats in own arrays and return them.
824  SwFrameFormat *CopyFrameFormat ( const SwFrameFormat& );
825  SwCharFormat *CopyCharFormat( const SwCharFormat& );
826  SwTextFormatColl* CopyTextColl( const SwTextFormatColl& rColl );
827  SwGrfFormatColl* CopyGrfColl( const SwGrfFormatColl& rColl );
828 
829  // Replace all styles with those from rSource.
830  void ReplaceStyles( const SwDoc& rSource, bool bIncludePageStyles = true );
831 
832  // Replace all property defaults with those from rSource.
833  void ReplaceDefaults( const SwDoc& rSource );
834 
835  // Replace all compatibility options with those from rSource.
836  void ReplaceCompatibilityOptions( const SwDoc& rSource );
837 
841  void ReplaceUserDefinedDocumentProperties( const css::uno::Reference< css::document::XDocumentProperties >& xSourceDocProps );
842 
847  void ReplaceDocumentProperties(const SwDoc& rSource, bool mailMerge = false);
848 
849  // Query if style (paragraph- / character- / frame- / page-) is used.
850  bool IsUsed( const SwModify& ) const;
852  bool IsUsed( const SwTableAutoFormat& ) const;
853  static bool IsUsed( const SwNumRule& );
854 
855  // Set name of newly loaded document template.
856  size_t SetDocPattern(const OUString& rPatternName);
857 
858  // @return name of document template. Can be 0!
859  const OUString* GetDocPattern(size_t nPos) const;
860 
861  // travel over PaM Ring
862  bool InsertGlossary( SwTextBlocks& rBlock, const OUString& rEntry,
863  SwPaM& rPaM, SwCursorShell* pShell = nullptr);
864 
867  static void CalculatePagesForPrinting( const SwRootFrame& rLayout, SwRenderData &rData, const SwPrintUIOptions &rOptions, bool bIsPDFExport,
868  sal_Int32 nDocPageCount );
869  static void UpdatePagesForPrintingWithPostItData( SwRenderData &rData, const SwPrintUIOptions &rOptions,
870  sal_Int32 nDocPageCount );
871  static void CalculatePagePairsForProspectPrinting( const SwRootFrame& rLayout, SwRenderData &rData, const SwPrintUIOptions &rOptions,
872  sal_Int32 nDocPageCount );
873  static void CalculateNonBlankPages( const SwRootFrame& rLayout, sal_uInt16& nDocPageCount, sal_uInt16& nActualPage );
874 
875  // PageDescriptor interface.
876  size_t GetPageDescCnt() const { return m_PageDescs.size(); }
877  const SwPageDesc& GetPageDesc(const size_t i) const { return *m_PageDescs[i]; }
878  SwPageDesc& GetPageDesc(size_t const i) { return *m_PageDescs[i]; }
879  SwPageDesc* FindPageDesc(const OUString& rName, size_t* pPos = nullptr) const;
880  // Just searches the pointer in the m_PageDescs vector!
881  bool ContainsPageDesc(const SwPageDesc *pDesc, size_t* pPos) const;
882 
885  void CopyPageDesc( const SwPageDesc& rSrcDesc, SwPageDesc& rDstDesc,
886  bool bCopyPoolIds = true );
887 
890  void CopyHeader( const SwFrameFormat& rSrcFormat, SwFrameFormat& rDestFormat )
891  { CopyPageDescHeaderFooterImpl( true, rSrcFormat, rDestFormat ); }
892 
895  void CopyFooter( const SwFrameFormat& rSrcFormat, SwFrameFormat& rDestFormat )
896  { CopyPageDescHeaderFooterImpl( false, rSrcFormat, rDestFormat ); }
897 
898  // For Reader
899  void ChgPageDesc( const OUString & rName, const SwPageDesc& );
900  void ChgPageDesc( size_t i, const SwPageDesc& );
901  void DelPageDesc( const OUString & rName, bool bBroadcast = false);
902  void DelPageDesc( size_t i, bool bBroadcast = false );
903  void PreDelPageDesc(SwPageDesc const * pDel);
904  SwPageDesc* MakePageDesc(const OUString &rName, const SwPageDesc* pCpy = nullptr,
905  bool bRegardLanguage = true,
906  bool bBroadcast = false);
907  void BroadcastStyleOperation(const OUString& rName, SfxStyleFamily eFamily,
908  SfxHintId nOp);
909 
912  void CheckDefaultPageFormat();
913 
914  // Methods for tables/indices
915  static sal_uInt16 GetCurTOXMark( const SwPosition& rPos, SwTOXMarks& );
916  void DeleteTOXMark( const SwTOXMark* pTOXMark );
917  const SwTOXMark& GotoTOXMark( const SwTOXMark& rCurTOXMark,
918  SwTOXSearch eDir, bool bInReadOnly );
919 
920  // Insert/Renew table/index
921  SwTOXBaseSection* InsertTableOf( const SwPosition& rPos,
922  const SwTOXBase& rTOX,
923  const SfxItemSet* pSet = nullptr,
924  bool bExpand = false,
925  SwRootFrame const* pLayout = nullptr);
926  SwTOXBaseSection* InsertTableOf( const SwPaM& aPam,
927  const SwTOXBase& rTOX,
928  const SfxItemSet* pSet = nullptr,
929  bool bExpand = false,
930  SwRootFrame const* pLayout = nullptr );
931  void InsertTableOf( sal_uLong nSttNd, sal_uLong nEndNd,
932  const SwTOXBase& rTOX,
933  const SfxItemSet* pSet );
934  static SwTOXBase* GetCurTOX( const SwPosition& rPos );
935  static const SwAttrSet& GetTOXBaseAttrSet(const SwTOXBase& rTOX);
936 
937  bool DeleteTOX( const SwTOXBase& rTOXBase, bool bDelNodes );
938  OUString GetUniqueTOXBaseName( const SwTOXType& rType,
939  const OUString& sChkStr ) const;
940 
941  bool SetTOXBaseName(const SwTOXBase& rTOXBase, const OUString& rName);
942 
943  // After reading file update all tables/indices
944  void SetUpdateTOX( bool bFlag ) { mbUpdateTOX = bFlag; }
945  bool IsUpdateTOX() const { return mbUpdateTOX; }
946 
947  const OUString& GetTOIAutoMarkURL() const {return msTOIAutoMarkURL;}
948  void SetTOIAutoMarkURL(const OUString& rSet) {msTOIAutoMarkURL = rSet;}
949 
950  bool IsInReading() const { return mbInReading; }
951  void SetInReading( bool bNew ) { mbInReading = bNew; }
952 
953  bool IsInMailMerge() const { return mbInMailMerge; }
954  void SetInMailMerge( bool bNew ) { mbInMailMerge = bNew; }
955 
956  bool IsClipBoard() const { return mbClipBoard; }
957  // N.B.: must be called right after constructor! (@see GetXmlIdRegistry)
958  void SetClipBoard( bool bNew ) { mbClipBoard = bNew; }
959 
960  bool IsColumnSelection() const { return mbColumnSelection; }
961  void SetColumnSelection( bool bNew ) { mbColumnSelection = bNew; }
962 
963  bool IsInXMLImport() const { return mbInXMLImport; }
964  void SetInXMLImport( bool bNew ) { mbInXMLImport = bNew; }
965 
966  // Manage types of tables/indices
967  sal_uInt16 GetTOXTypeCount( TOXTypes eTyp ) const;
968  const SwTOXType* GetTOXType( TOXTypes eTyp, sal_uInt16 nId ) const;
969  const SwTOXType* InsertTOXType( const SwTOXType& rTyp );
970  const SwTOXTypes& GetTOXTypes() const { return *mpTOXTypes; }
971 
972  const SwTOXBase* GetDefaultTOXBase( TOXTypes eTyp, bool bCreate );
973  void SetDefaultTOXBase(const SwTOXBase& rBase);
974 
975  // Key for management of index.
976  void GetTOIKeys(SwTOIKeyType eTyp, std::vector<OUString>& rArr,
977  SwRootFrame const& rLayout) const;
978 
979  // Sort table text.
980  bool SortTable(const SwSelBoxes& rBoxes, const SwSortOptions&);
981  bool SortText(const SwPaM&, const SwSortOptions&);
982 
983  // Correct the SwPosition-Objects that are registered with the document
984  // e. g. Bookmarks or tables/indices.
985  // If bMoveCursor is set move Cursor too.
986 
987  // Set everything in rOldNode on rNewPos + Offset.
988  void CorrAbs(
989  const SwNodeIndex& rOldNode,
990  const SwPosition& rNewPos,
991  const sal_Int32 nOffset = 0,
992  bool bMoveCursor = false );
993 
994  // Set everything in the range of [rStartNode, rEndNode] to rNewPos.
995  static void CorrAbs(
996  const SwNodeIndex& rStartNode,
997  const SwNodeIndex& rEndNode,
998  const SwPosition& rNewPos,
999  bool bMoveCursor = false );
1000 
1001  // Set everything in this range from rRange to rNewPos.
1002  static void CorrAbs(
1003  const SwPaM& rRange,
1004  const SwPosition& rNewPos,
1005  bool bMoveCursor = false );
1006 
1007  // Set everything in rOldNode to relative Pos.
1008  void CorrRel(
1009  const SwNodeIndex& rOldNode,
1010  const SwPosition& rNewPos,
1011  const sal_Int32 nOffset = 0,
1012  bool bMoveCursor = false );
1013 
1014  // Query / set rules for Outline.
1016  {
1017  return mpOutlineRule;
1018  }
1019  void SetOutlineNumRule( const SwNumRule& rRule );
1020  void PropagateOutlineRule();
1021 
1022  // Outline - promote / demote.
1023  bool OutlineUpDown(const SwPaM& rPam, short nOffset, SwRootFrame const* pLayout = nullptr);
1024 
1026  bool MoveOutlinePara( const SwPaM& rPam, SwOutlineNodes::difference_type nOffset);
1027 
1028  bool GotoOutline(SwPosition& rPos, const OUString& rName, SwRootFrame const* = nullptr) const;
1029 
1040  OUString SetNumRule( const SwPaM&,
1041  const SwNumRule&,
1042  bool bCreateNewList,
1043  SwRootFrame const* pLayout = nullptr,
1044  const OUString& sContinuedListId = OUString(),
1045  bool bSetItem = true,
1046  const bool bResetIndentAttrs = false );
1047  void SetCounted(const SwPaM&, bool bCounted, SwRootFrame const* pLayout);
1048 
1049  void MakeUniqueNumRules(const SwPaM & rPaM);
1050 
1051  void SetNumRuleStart( const SwPosition& rPos, bool bFlag = true );
1052  void SetNodeNumStart( const SwPosition& rPos, sal_uInt16 nStt );
1053 
1054  // sw_redlinehide: may set rPos to different node (the one with the NumRule)
1055  static SwNumRule* GetNumRuleAtPos(SwPosition& rPos, SwRootFrame const* pLayout = nullptr);
1056 
1057  const SwNumRuleTable& GetNumRuleTable() const { return *mpNumRuleTable; }
1058 
1064  void AddNumRule(SwNumRule * pRule);
1065 
1066  // add optional parameter <eDefaultNumberFormatPositionAndSpaceMode>
1067  sal_uInt16 MakeNumRule( const OUString &rName,
1068  const SwNumRule* pCpy = nullptr,
1069  bool bBroadcast = false,
1070  const SvxNumberFormat::SvxNumPositionAndSpaceMode eDefaultNumberFormatPositionAndSpaceMode =
1072  sal_uInt16 FindNumRule( const OUString& rName ) const;
1073  SwNumRule* FindNumRulePtr( const OUString& rName ) const;
1074 
1075  // Deletion only possible if Rule is not used!
1076  bool RenameNumRule(const OUString & aOldName, const OUString & aNewName,
1077  bool bBroadcast = false);
1078  bool DelNumRule( const OUString& rName, bool bBroadCast = false );
1079  OUString GetUniqueNumRuleName( const OUString* pChkStr = nullptr, bool bAutoNum = true ) const;
1080 
1081  void UpdateNumRule(); // Update all invalids.
1082  void ChgNumRuleFormats( const SwNumRule& rRule );
1083  bool ReplaceNumRule( const SwPosition& rPos, const OUString& rOldRule,
1084  const OUString& rNewRule );
1085 
1086  // Goto next/previous on same level.
1087  static bool GotoNextNum( SwPosition&, SwRootFrame const* pLayout,
1088  bool bOverUpper = true,
1089  sal_uInt8* pUpper = nullptr, sal_uInt8* pLower = nullptr );
1090  static bool GotoPrevNum( SwPosition&, SwRootFrame const* pLayout,
1091  bool bOverUpper = true );
1092 
1116  const SwNumRule * SearchNumRule(const SwPosition & rPos,
1117  const bool bForward,
1118  const bool bNum,
1119  const bool bOutline,
1120  int nNonEmptyAllowed,
1121  OUString& sListId,
1122  SwRootFrame const* pLayout,
1123  const bool bInvestigateStartNode = false );
1124 
1125  // Paragraphs without numbering but with indents.
1126  bool NoNum( const SwPaM& );
1127 
1128  // Delete, splitting of numbering list.
1129  void DelNumRules(const SwPaM&, SwRootFrame const* pLayout = nullptr);
1130 
1131  // Invalidates all numrules
1132  void InvalidateNumRules();
1133 
1134  bool NumUpDown(const SwPaM&, bool bDown, SwRootFrame const* pLayout = nullptr);
1135 
1138  bool MoveParagraph(SwPaM&, long nOffset, bool bIsOutlMv = false);
1139  bool MoveParagraphImpl(SwPaM&, long nOffset, bool bIsOutlMv, SwRootFrame const*);
1140 
1141  bool NumOrNoNum( const SwNodeIndex& rIdx, bool bDel = false);
1142 
1143  void StopNumRuleAnimations( OutputDevice* );
1144 
1155  const SwTable* InsertTable( const SwInsertTableOptions& rInsTableOpts, // HeadlineNoBorder
1156  const SwPosition& rPos, sal_uInt16 nRows,
1157  sal_uInt16 nCols, sal_Int16 eAdjust,
1158  const SwTableAutoFormat* pTAFormat = nullptr,
1159  const std::vector<sal_uInt16> *pColArr = nullptr,
1160  bool bCalledFromShell = false,
1161  bool bNewModel = true );
1162 
1163  // If index is in a table, return TableNode, else 0.
1164  SwTableNode* IsIdxInTable( const SwNodeIndex& rIdx );
1165  inline const SwTableNode* IsIdxInTable( const SwNodeIndex& rIdx ) const;
1166 
1167  // Create a balanced table out of the selected range.
1168  const SwTable* TextToTable( const SwInsertTableOptions& rInsTableOpts, // HeadlineNoBorder,
1169  const SwPaM& rRange, sal_Unicode cCh,
1170  sal_Int16 eAdjust,
1171  const SwTableAutoFormat* );
1172 
1173  // text to table conversion - API support
1174  const SwTable* TextToTable( const std::vector< std::vector<SwNodeRange> >& rTableNodes );
1175 
1176  bool TableToText( const SwTableNode* pTableNd, sal_Unicode cCh );
1177 
1178  // Create columns / rows in table.
1179  void InsertCol( const SwCursor& rCursor,
1180  sal_uInt16 nCnt = 1, bool bBehind = true );
1181  bool InsertCol( const SwSelBoxes& rBoxes,
1182  sal_uInt16 nCnt = 1, bool bBehind = true );
1183  void InsertRow( const SwCursor& rCursor,
1184  sal_uInt16 nCnt = 1, bool bBehind = true );
1185  bool InsertRow( const SwSelBoxes& rBoxes,
1186  sal_uInt16 nCnt = 1, bool bBehind = true );
1187 
1188  // Delete Columns/Rows in table.
1189  bool DeleteRowCol( const SwSelBoxes& rBoxes, bool bColumn = false );
1190  void DeleteRow( const SwCursor& rCursor );
1191  void DeleteCol( const SwCursor& rCursor );
1192 
1193  // Split / concatenate boxes in table.
1194  bool SplitTable( const SwSelBoxes& rBoxes, bool bVert,
1195  sal_uInt16 nCnt, bool bSameHeight = false );
1196 
1197  TableMergeErr MergeTable( SwPaM& rPam );
1198  OUString GetUniqueTableName() const;
1199  bool IsInsTableFormatNum() const;
1200  bool IsInsTableChangeNumFormat() const;
1201  bool IsInsTableAlignNum() const;
1202  bool IsSplitVerticalByDefault() const;
1203  void SetSplitVerticalByDefault(bool value);
1204 
1205  // From FEShell (for Undo and BModified).
1206  static void GetTabCols( SwTabCols &rFill, const SwCellFrame* pBoxFrame );
1207  void SetTabCols( const SwTabCols &rNew, bool bCurRowOnly,
1208  const SwCellFrame* pBoxFrame );
1209  static void GetTabRows( SwTabCols &rFill, const SwCellFrame* pBoxFrame );
1210  void SetTabRows( const SwTabCols &rNew, bool bCurColOnly,
1211  const SwCellFrame* pBoxFrame );
1212 
1213  // Direct access for UNO.
1214  void SetTabCols(SwTable& rTab, const SwTabCols &rNew, const SwTabCols &rOld,
1215  const SwTableBox *pStart, bool bCurRowOnly);
1216 
1217  void SetRowsToRepeat( SwTable &rTable, sal_uInt16 nSet );
1218 
1221  bool SetTableAutoFormat(const SwSelBoxes& rBoxes, const SwTableAutoFormat& rNew, bool bResetDirect = false, bool isSetStyleName = false);
1222 
1223  // Query attributes.
1224  bool GetTableAutoFormat( const SwSelBoxes& rBoxes, SwTableAutoFormat& rGet );
1225 
1227  SwTableAutoFormatTable& GetTableStyles();
1229  {
1230  return const_cast<SwDoc*>(this)->GetTableStyles();
1231  }
1233  bool HasTableStyles() const { return m_pTableStyles != nullptr; }
1234  // Create a new table style. Tracked by Undo.
1235  SwTableAutoFormat* MakeTableStyle(const OUString& rName, bool bBroadcast = false);
1236  // Delete table style named rName. Tracked by undo.
1237  std::unique_ptr<SwTableAutoFormat> DelTableStyle(const OUString& rName, bool bBroadcast = false);
1238  // Change (replace) a table style named rName. Tracked by undo.
1239  void ChgTableStyle(const OUString& rName, const SwTableAutoFormat& rNewFormat);
1240 
1241  const SwCellStyleTable& GetCellStyles() const { return *mpCellStyles; }
1242  SwCellStyleTable& GetCellStyles() { return *mpCellStyles; }
1243 
1244  void AppendUndoForInsertFromDB( const SwPaM& rPam, bool bIsTable );
1245 
1246  bool SetColRowWidthHeight( SwTableBox& rCurrentBox, TableChgWidthHeightType eType,
1247  SwTwips nAbsDiff, SwTwips nRelDiff );
1248  SwTableBoxFormat* MakeTableBoxFormat();
1249  SwTableLineFormat* MakeTableLineFormat();
1250 
1251  // helper function: cleanup before checking number value
1252  bool IsNumberFormat( const OUString& rString, sal_uInt32& F_Index, double& fOutNumber);
1253  // Check if box has numerical value. Change format of box if required.
1254  void ChkBoxNumFormat( SwTableBox& rCurrentBox, bool bCallUpdate );
1255  void SetTableBoxFormulaAttrs( SwTableBox& rBox, const SfxItemSet& rSet );
1256  void ClearBoxNumAttrs( const SwNodeIndex& rNode );
1257  void ClearLineNumAttrs( SwPosition const & rPos );
1258 
1259  bool InsCopyOfTable( SwPosition& rInsPos, const SwSelBoxes& rBoxes,
1260  const SwTable* pCpyTable, bool bCpyName = false,
1261  bool bCorrPos = false );
1262 
1263  void UnProtectCells( const OUString& rTableName );
1264  bool UnProtectCells( const SwSelBoxes& rBoxes );
1265  void UnProtectTables( const SwPaM& rPam );
1266  bool HasTableAnyProtection( const SwPosition* pPos,
1267  const OUString* pTableName,
1268  bool* pFullTableProtection );
1269 
1270  // Split table at baseline position, i.e. create a new table.
1271  bool SplitTable( const SwPosition& rPos, SplitTable_HeadlineOption eMode,
1272  bool bCalcNewSize );
1273 
1276  bool MergeTable( const SwPosition& rPos, bool bWithPrev,
1277  sal_uInt16 nMode = 0 );
1278 
1279  // Make charts of given table update.
1280  void UpdateCharts( const OUString &rName ) const;
1281 
1282  // Update all charts, for that exists any table.
1283  void UpdateAllCharts() { DoUpdateAllCharts(); }
1284 
1285  // Table is renamed and refreshes charts.
1286  void SetTableName( SwFrameFormat& rTableFormat, const OUString &rNewName );
1287 
1288  // @return the reference in document that is set for name.
1289  const SwFormatRefMark* GetRefMark( const OUString& rName ) const;
1290 
1291  // @return RefMark via index - for UNO.
1292  const SwFormatRefMark* GetRefMark( sal_uInt16 nIndex ) const;
1293 
1296  sal_uInt16 GetRefMarks( std::vector<OUString>* = nullptr ) const;
1297 
1298  // Insert label. If a FlyFormat is created, return it.
1299  SwFlyFrameFormat* InsertLabel( const SwLabelType eType, const OUString &rText, const OUString& rSeparator,
1300  const OUString& rNumberingSeparator,
1301  const bool bBefore, const sal_uInt16 nId, const sal_uLong nIdx,
1302  const OUString& rCharacterStyle,
1303  const bool bCpyBrd );
1304  SwFlyFrameFormat* InsertDrawLabel(
1305  const OUString &rText, const OUString& rSeparator, const OUString& rNumberSeparator,
1306  const sal_uInt16 nId, const OUString& rCharacterStyle, SdrObject& rObj );
1307 
1308  // Query attribute pool.
1309  const SwAttrPool& GetAttrPool() const { return *mpAttrPool; }
1310  SwAttrPool& GetAttrPool() { return *mpAttrPool; }
1311 
1312  // Search for an EditShell.
1313  SwEditShell const * GetEditShell() const;
1314  SwEditShell* GetEditShell();
1315  ::sw::IShellCursorSupplier * GetIShellCursorSupplier();
1316 
1317  // OLE 2.0-notification.
1318  void SetOle2Link(const Link<bool,void>& rLink) {maOle2Link = rLink;}
1319  const Link<bool,void>& GetOle2Link() const {return maOle2Link;}
1320 
1321  // insert section (the ODF kind of section, not the nodesarray kind)
1322  SwSection * InsertSwSection(SwPaM const& rRange, SwSectionData &,
1323  std::pair<SwTOXBase const*, sw::RedlineMode> const* pTOXBase,
1324  SfxItemSet const*const pAttr, bool const bUpdate = true);
1325  static sal_uInt16 IsInsRegionAvailable( const SwPaM& rRange,
1326  const SwNode** ppSttNd = nullptr );
1327  static SwSection* GetCurrSection( const SwPosition& rPos );
1328  SwSectionFormats& GetSections() { return *mpSectionFormatTable; }
1329  const SwSectionFormats& GetSections() const { return *mpSectionFormatTable; }
1330  SwSectionFormat *MakeSectionFormat();
1331  void DelSectionFormat( SwSectionFormat *pFormat, bool bDelNodes = false );
1332  void UpdateSection(size_t const nSect, SwSectionData &,
1333  SfxItemSet const*const = nullptr, bool const bPreventLinkUpdate = false);
1334  OUString GetUniqueSectionName( const OUString* pChkStr = nullptr ) const;
1335 
1336  /* @@@MAINTAINABILITY-HORROR@@@
1337  The model should not have anything to do with a shell.
1338  Unnecessary compile/link time dependency.
1339  */
1340 
1341  // Pointer to SfxDocShell from Doc. Can be 0!!
1342  SwDocShell* GetDocShell() { return mpDocShell; }
1343  const SwDocShell* GetDocShell() const { return mpDocShell; }
1344  void SetDocShell( SwDocShell* pDSh );
1345 
1348  void SetTmpDocShell( SfxObjectShellLock rLock ) { mxTmpDocShell = rLock; }
1349  const SfxObjectShellLock& GetTmpDocShell() const { return mxTmpDocShell; }
1350 
1351  // For Autotexts? (text modules) They have only one SVPersist at their disposal.
1352  SfxObjectShell* GetPersist() const;
1353 
1354  // Pointer to storage of SfxDocShells. Can be 0!!!
1355  css::uno::Reference< css::embed::XStorage > GetDocStorage();
1356 
1357  // Query / set flag indicating if document is loaded asynchronously at this moment.
1358  bool IsInLoadAsynchron() const { return mbInLoadAsynchron; }
1359  void SetInLoadAsynchron( bool bFlag ) { mbInLoadAsynchron = bFlag; }
1360 
1361  // For Drag&Move: (e.g. allow "moving" of RefMarks)
1362  bool IsCopyIsMove() const { return mbCopyIsMove; }
1363  void SetCopyIsMove( bool bFlag ) { mbCopyIsMove = bFlag; }
1364 
1365  SwDrawContact* GroupSelection( SdrView& );
1366  void UnGroupSelection( SdrView& );
1367  bool DeleteSelection( SwDrawView& );
1368 
1369  // Invalidates OnlineSpell-WrongLists.
1370  void SpellItAgainSam( bool bInvalid, bool bOnlyWrong, bool bSmartTags );
1371  void InvalidateAutoCompleteFlag();
1372 
1373  void SetCalcFieldValueHdl(Outliner* pOutliner);
1374 
1375  // Query if URL was visited.
1376  // Query via Doc, if only a Bookmark has been given.
1377  // In this case the document name has to be set in front.
1378  bool IsVisitedURL( const OUString& rURL );
1379 
1380  // Save current values for automatic registration of exceptions in Autocorrection.
1381  void SetAutoCorrExceptWord( std::unique_ptr<SwAutoCorrExceptWord> pNew );
1382  SwAutoCorrExceptWord* GetAutoCorrExceptWord() { return mpACEWord.get(); }
1383  void DeleteAutoCorrExceptWord();
1384 
1385  const SwFormatINetFormat* FindINetAttr( const OUString& rName ) const;
1386 
1387  // Call into intransparent Basic; expect possible Return String.
1388  void ExecMacro( const SvxMacro& rMacro, OUString* pRet, SbxArray* pArgs );
1389 
1390  // Call into intransparent Basic / JavaScript.
1391  sal_uInt16 CallEvent( SvMacroItemId nEvent, const SwCallMouseEvent& rCallEvent,
1392  bool bChkPtr = false );
1393 
1397  void MoveLeftMargin(const SwPaM& rPam, bool bRight, bool bModulus,
1398  SwRootFrame const* pLayout = nullptr);
1399 
1400  // Query NumberFormatter.
1402  {
1403  if (bCreate)
1404  EnsureNumberFormatter();
1405  return mpNumberFormatter;
1406  }
1407 
1408  const SvNumberFormatter* GetNumberFormatter(bool bCreate = true) const
1409  {
1410  return const_cast<SwDoc*>(this)->GetNumberFormatter(bCreate);
1411  }
1412 
1413  bool HasInvisibleContent() const;
1414  // delete invisible content, like hidden sections and paragraphs
1415  bool RemoveInvisibleContent();
1416  // restore the invisible content if it's available on the undo stack
1417  bool RestoreInvisibleContent();
1418 
1419  bool ConvertFieldsToText(SwRootFrame const& rLayout);
1420 
1421  // Create sub-documents according to given collection.
1422  // If no collection is given, use chapter styles for 1st level.
1423  bool GenerateGlobalDoc( const OUString& rPath,
1424  const SwTextFormatColl* pSplitColl );
1425  bool GenerateGlobalDoc( const OUString& rPath, int nOutlineLevel );
1426  bool GenerateHTMLDoc( const OUString& rPath,
1427  const SwTextFormatColl* pSplitColl );
1428  bool GenerateHTMLDoc( const OUString& rPath, int nOutlineLevel );
1429 
1430  // Compare two documents.
1431  long CompareDoc( const SwDoc& rDoc );
1432 
1433  // Merge two documents.
1434  long MergeDoc( const SwDoc& rDoc );
1435 
1436  bool IsAutoFormatRedline() const { return mbIsAutoFormatRedline; }
1437  void SetAutoFormatRedline( bool bFlag ) { mbIsAutoFormatRedline = bFlag; }
1438 
1439  // For AutoFormat: with Undo/Redlining.
1440  void SetTextFormatCollByAutoFormat( const SwPosition& rPos, sal_uInt16 nPoolId,
1441  const SfxItemSet* pSet );
1442  void SetFormatItemByAutoFormat( const SwPaM& rPam, const SfxItemSet& );
1443 
1444  // Only for SW-textbloxks! Does not pay any attention to layout!
1445  void ClearDoc(); // Deletes all content!
1446 
1447  // Query /set data for PagePreview.
1448  const SwPagePreviewPrtData* GetPreviewPrtData() const { return m_pPgPViewPrtData.get(); }
1449 
1450  // If pointer == 0 destroy pointer in document.
1451  // Else copy object.
1452  // Pointer is not transferred to ownership by document!
1453  void SetPreviewPrtData( const SwPagePreviewPrtData* pData );
1454 
1457  void SetOLEObjModified();
1458 
1459  // Uno - Interfaces
1460  std::shared_ptr<SwUnoCursor> CreateUnoCursor( const SwPosition& rPos, bool bTableCursor = false );
1461 
1462  // FeShell - Interfaces
1463  // !!! These assume always an existing layout !!!
1464  bool ChgAnchor( const SdrMarkList& _rMrkList,
1465  RndStdIds _eAnchorType,
1466  const bool _bSameOnly,
1467  const bool _bPosCorr );
1468 
1469  void SetRowHeight( const SwCursor& rCursor, const SwFormatFrameSize &rNew );
1470  static std::unique_ptr<SwFormatFrameSize> GetRowHeight( const SwCursor& rCursor );
1471  void SetRowSplit( const SwCursor& rCursor, const SwFormatRowSplit &rNew );
1472  static std::unique_ptr<SwFormatRowSplit> GetRowSplit( const SwCursor& rCursor );
1473 
1477  bool BalanceRowHeight( const SwCursor& rCursor, bool bTstOnly, const bool bOptimize );
1478  void SetRowBackground( const SwCursor& rCursor, const SvxBrushItem &rNew );
1479  static bool GetRowBackground( const SwCursor& rCursor, std::shared_ptr<SvxBrushItem>& rToFill );
1480  void SetTabBorders( const SwCursor& rCursor, const SfxItemSet& rSet );
1481  void SetTabLineStyle( const SwCursor& rCursor,
1482  const Color* pColor, bool bSetLine,
1483  const editeng::SvxBorderLine* pBorderLine );
1484  static void GetTabBorders( const SwCursor& rCursor, SfxItemSet& rSet );
1485  void SetBoxAttr( const SwCursor& rCursor, const SfxPoolItem &rNew );
1496  static bool GetBoxAttr( const SwCursor& rCursor, std::shared_ptr<SfxPoolItem>& rToFill );
1497  void SetBoxAlign( const SwCursor& rCursor, sal_uInt16 nAlign );
1498  static sal_uInt16 GetBoxAlign( const SwCursor& rCursor );
1502  void AdjustCellWidth( const SwCursor& rCursor, const bool bBalance, const bool bNoShrink );
1503 
1504  SwChainRet Chainable( const SwFrameFormat &rSource, const SwFrameFormat &rDest );
1505  SwChainRet Chain( SwFrameFormat &rSource, const SwFrameFormat &rDest );
1506  void Unchain( SwFrameFormat &rFormat );
1507 
1508  // For Copy/Move from FrameShell.
1509  SdrObject* CloneSdrObj( const SdrObject&, bool bMoveWithinDoc = false,
1510  bool bInsInPage = true );
1511 
1512  // FeShell - Interface end
1513 
1514  // Interface for TextInputData - for text input of Chinese and Japanese.
1515  SwExtTextInput* CreateExtTextInput( const SwPaM& rPam );
1516  void DeleteExtTextInput( SwExtTextInput* pDel );
1517  SwExtTextInput* GetExtTextInput( const SwNode& rNd,
1518  sal_Int32 nContentPos = -1) const;
1519  SwExtTextInput* GetExtTextInput() const;
1520 
1521  // Interface for access to AutoComplete-List.
1522  static SwAutoCompleteWord& GetAutoCompleteWords() { return *s_pAutoCompleteWords; }
1523 
1524  bool ContainsMSVBasic() const { return mbContains_MSVBasic; }
1525  void SetContainsMSVBasic( bool bFlag ) { mbContains_MSVBasic = bFlag; }
1526 
1527  // Interface for the list of Ruby - texts/attributes
1528  static sal_uInt16 FillRubyList( const SwPaM& rPam, SwRubyList& rList );
1529  void SetRubyList( const SwPaM& rPam, const SwRubyList& rList );
1530 
1531  void ReadLayoutCache( SvStream& rStream );
1532  void WriteLayoutCache( SvStream& rStream );
1533  SwLayoutCache* GetLayoutCache() const { return mpLayoutCache.get(); }
1534 
1539  bool ContainsHiddenChars() const;
1540 
1541  IGrammarContact* getGrammarContact() const { return mpGrammarContact.get(); }
1542 
1552  void MarkListLevel( const OUString& sListId,
1553  const int nListLevel,
1554  const bool bValue );
1555 
1556  // Change a format undoable.
1557  void ChgFormat(SwFormat & rFormat, const SfxItemSet & rSet);
1558 
1559  void RenameFormat(SwFormat & rFormat, const OUString & sNewName,
1560  bool bBroadcast = false);
1561 
1562  // Change a TOX undoable.
1563  void ChangeTOX(SwTOXBase & rTOX, const SwTOXBase & rNew);
1564 
1582  static OUString GetPaMDescr(const SwPaM & rPaM);
1583 
1584  static bool IsFirstOfNumRuleAtPos(const SwPosition & rPos, SwRootFrame const& rLayout);
1585 
1586  // access methods for XForms model(s)
1587 
1588  // access container for XForms model; will be NULL if !isXForms()
1589  const css::uno::Reference<css::container::XNameContainer>&
1590  getXForms() const { return mxXForms;}
1591 
1592  css::uno::Reference< css::linguistic2::XProofreadingIterator > const & GetGCIterator() const;
1593 
1594  // #i31958# is this an XForms document?
1595  bool isXForms() const;
1596 
1597  // #i31958# initialize XForms models; turn this into an XForms document
1598  void initXForms( bool bCreateDefaultModel );
1599 
1600  // #i113606# for disposing XForms
1601  void disposeXForms( );
1602 
1603  //Update all the page masters
1604  void SetDefaultPageMode(bool bSquaredPageMode);
1605  bool IsSquaredPageMode() const;
1606 
1607  css::uno::Reference< css::script::vba::XVBAEventProcessor > const & GetVbaEventProcessor();
1608  void SetVBATemplateToProjectCache( css::uno::Reference< css::container::XNameContainer > const & xCache ) { m_xTemplateToProjectCache = xCache; };
1609  const css::uno::Reference< css::container::XNameContainer >& GetVBATemplateToProjectCache() const { return m_xTemplateToProjectCache; };
1610  ::sfx2::IXmlIdRegistry& GetXmlIdRegistry();
1611  ::sw::MetaFieldManager & GetMetaFieldManager();
1612  ::sw::UndoManager & GetUndoManager();
1613  ::sw::UndoManager const& GetUndoManager() const;
1614 
1615  SfxObjectShell* CreateCopy(bool bCallInitNew, bool bEmpty) const;
1616  SwNodeIndex AppendDoc(const SwDoc& rSource, sal_uInt16 nStartPageNumber,
1617  bool bDeletePrevious, int physicalPageOffset,
1618  const sal_uLong nDocNo);
1619 
1623  void dumpAsXml(xmlTextWriterPtr = nullptr) const;
1624 
1625  std::set<Color> GetDocColors();
1626  std::vector< std::weak_ptr<SwUnoCursor> > mvUnoCursorTable;
1627 
1628  // Remove expired UnoCursor weak pointers the document keeps to notify about document death.
1630  {
1631  auto & rTable = const_cast<SwDoc*>(this)->mvUnoCursorTable;
1632  // In most cases we'll remove most of the elements.
1633  rTable.erase( std::remove_if(rTable.begin(),
1634  rTable.end(),
1635  [] (std::weak_ptr<SwUnoCursor> const & x) { return x.expired(); }),
1636  rTable.end());
1637  }
1638 
1643  bool StartGrammarChecking( bool bSkipStart = false );
1644 
1646  void SetMissingDictionaries( bool bIsMissing );
1648  bool IsDictionaryMissing() const { return meDictionaryMissing == MissingDictionary::True; }
1649 
1650 private:
1651  // Copies master header to left / first one, if necessary - used by ChgPageDesc().
1652  void CopyMasterHeader(const SwPageDesc &rChged, const SwFormatHeader &rHead, SwPageDesc &pDesc, bool bLeft, bool bFirst);
1653  // Copies master footer to left / first one, if necessary - used by ChgPageDesc().
1654  void CopyMasterFooter(const SwPageDesc &rChged, const SwFormatFooter &rFoot, SwPageDesc &pDesc, bool bLeft, bool bFirst);
1655 
1656 };
1657 
1658 // This method is called in Dtor of SwDoc and deletes cache of ContourObjects.
1659 void ClrContourCache();
1660 
1661 inline const SwTableNode* SwDoc::IsIdxInTable( const SwNodeIndex& rIdx ) const
1662 {
1663  return const_cast<SwDoc*>(this)->IsIdxInTable( rIdx );
1664 }
1665 
1666 inline void SwDoc::SetOLEPrtNotifyPending( bool bSet )
1667 {
1668  mbOLEPrtNotifyPending = bSet;
1669  if( !bSet )
1670  mbAllOLENotify = false;
1671 }
1672 
1673 bool sw_GetPostIts( IDocumentFieldsAccess const * pIDFA, SetGetExpFields * pSrtLst );
1674 
1675 #endif //_DOC_HXX
1676 
1677 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SwFrameFormats * GetSpzFrameFormats()
Definition: doc.hxx:738
SwPageDesc & GetPageDesc(size_t const i)
Definition: doc.hxx:878
void SetCopyIsMove(bool bFlag)
Definition: doc.hxx:1363
OUString msDocAccTitle
Definition: doc.hxx:380
const std::unique_ptr< ::sw::UndoManager > m_pUndoManager
Definition: doc.hxx:213
sal_uInt32 mnRsidRoot
Definition: doc.hxx:292
const SwGrfFormatColls * GetGrfFormatColls() const
Definition: doc.hxx:802
std::set< SwPosFlyFramePtr, SwPosFlyFrameCmp > SwPosFlyFrames
Definition: flypos.hxx:51
TOXTypes
Definition: toxe.hxx:39
SwPageDescs m_PageDescs
Definition: doc.hxx:195
bool IsInMailMerge() const
Definition: doc.hxx:953
SwCellStyleTable & GetCellStyles()
Definition: doc.hxx:1242
SfxHintId
SwAutoCorrExceptWord * GetAutoCorrExceptWord()
Definition: doc.hxx:1382
const T & GetDefault(TypedWhichId< T > nWhich) const
Definition: doc.hxx:722
SwLabelType
Definition: swtypes.hxx:87
Represents the style of a paragraph.
Definition: fmtcol.hxx:55
std::unique_ptr< SwDefTOXBase_Impl > mpDefTOXBases
Definition: doc.hxx:246
std::atomic< SvNumberFormatter * > mpNumberFormatter
Definition: doc.hxx:263
Marks a position in the document model.
Definition: pam.hxx:35
const OUString & GetTOIAutoMarkURL() const
Definition: doc.hxx:947
size_t size() const
Definition: pagedesc.hxx:419
const std::unique_ptr< ::sw::DocumentOutlineNodesManager > m_pDocumentOutlineNodesManager
Definition: doc.hxx:221
void SetPrepareSelAll()
Definition: doc.hxx:560
const std::unique_ptr< ::sw::DocumentListItemsManager > m_pDocumentListItemsManager
Definition: doc.hxx:219
IGrammarContact * getGrammarContact() const
Definition: doc.hxx:1541
static SwAutoCompleteWord & GetAutoCompleteWords()
Definition: doc.hxx:1522
oslInterlockedCount mReferenceCount
Definition: doc.hxx:294
SwDocShell * GetDocShell()
Definition: doc.hxx:1342
SfxObjectShellLock mxTmpDocShell
Definition: doc.hxx:258
SvNumberFormatter * GetNumberFormatter(bool bCreate=true)
Definition: doc.hxx:1401
const SwFrameFormats * GetTableFrameFormats() const
Definition: doc.hxx:807
signed char sal_Int8
const std::unique_ptr< ::sw::DocumentLayoutManager > m_pDocumentLayoutManager
Definition: doc.hxx:225
const std::unique_ptr< ::sw::DocumentContentOperationsManager > m_pDocumentContentOperationsManager
Definition: doc.hxx:222
std::vector< OUString > m_PatternNames
Definition: doc.hxx:203
std::vector< SwNode * >::difference_type difference_type
SwDBManager * m_pDBManager
Definition: doc.hxx:249
Idle maOLEModifiedIdle
Definition: doc.hxx:200
SwTextFormatColl * FindTextFormatCollByName(const OUString &rName) const
Definition: doc.hxx:795
std::unique_ptr< SwNodes > m_pNodes
Definition: doc.hxx:193
SwAttrPool & GetAttrPool()
Definition: doc.hxx:1310
sal_uIntPtr sal_uLong
std::vector< SwTOXMark * > SwTOXMarks
Definition: tox.hxx:44
Provides numbered items of a document.
SwTextFormatColl * GetDfltTextFormatColl()
Definition: doc.hxx:773
std::vector< std::unique_ptr< SwRubyListEntry >> SwRubyList
Definition: doc.hxx:182
Base class of all fields.
Definition: fldbas.hxx:280
Handle the background jobs of a Writer document.
DocumentType meDocType
Definition: doc.hxx:389
knows all meta-fields in the document.
Definition: fmtmeta.hxx:198
Provides access to the marks of a document.
Definition: doc.hxx:185
SwAttrPool * mpAttrPool
Definition: doc.hxx:194
void SetOle2Link(const Link< bool, void > &rLink)
Definition: doc.hxx:1318
sal_Int16 script
sal_uInt16 sal_Char sal_Char * pDesc
TableChgWidthHeightType
Definition: tblenum.hxx:25
bool IsColumnSelection() const
Definition: doc.hxx:960
bool IsUpdateTOX() const
Definition: doc.hxx:945
const SwTableAutoFormatTable & GetTableStyles() const
Definition: doc.hxx:1228
SvMacroItemId
void SetTmpDocShell(SfxObjectShellLock rLock)
in case during copying of embedded object a new shell is created, it should be set here and cleaned l...
Definition: doc.hxx:1348
long SwTwips
Definition: swtypes.hxx:49
SvxFrameDirection
Dialog to specify the properties of date form field.
std::unordered_map< OUString, SwNumRule * > maNumRuleMap
Definition: doc.hxx:268
std::unique_ptr< IStyleAccess > mpStyleAccess
Definition: doc.hxx:273
void SetClipBoard(bool bNew)
Definition: doc.hxx:958
const SwCellStyleTable & GetCellStyles() const
Definition: doc.hxx:1241
float x
The root element of a Writer document layout.
Definition: rootfrm.hxx:79
bool IsInsOnlyTextGlossary() const
Definition: doc.hxx:650
const SwFrameFormats * GetSpzFrameFormats() const
Definition: doc.hxx:737
Array of Undo-history.
Definition: docary.hxx:299
SwFormat *(SwDoc::* FNCopyFormat)(const OUString &, SwFormat *, bool, bool)
Definition: doc.hxx:332
std::unique_ptr< SwURLStateChanged > mpURLStateChgd
Definition: doc.hxx:262
const SwSectionFormats & GetSections() const
Definition: doc.hxx:1329
TableMergeErr
Definition: tblenum.hxx:62
sal_uInt16 sal_Unicode
bool DoesContainAtPageObjWithContentAnchor()
Definition: doc.hxx:566
const SwCharFormat * GetDfltCharFormat() const
Definition: doc.hxx:746
A class that stores temporary data that is needed for rendering the document.
Definition: printdata.hxx:203
provides some methods for generic operations on lists that contain SwFormat* subclasses.
Definition: docary.hxx:50
static SwAutoCompleteWord * s_pAutoCompleteWords
Definition: doc.hxx:323
std::unique_ptr< SwFrameFormats > mpTableFrameFormatTable
Definition: doc.hxx:241
void cleanupUnoCursorTable() const
Definition: doc.hxx:1629
const std::unique_ptr< ::sw::DocumentRedlineManager > m_pDocumentRedlineManager
Definition: doc.hxx:211
const SwTextFormatColl * GetDfltTextFormatColl() const
Definition: doc.hxx:772
SwTOXSearch
Definition: toxe.hxx:22
const Link< bool, void > & GetOle2Link() const
Definition: doc.hxx:1319
std::unique_ptr< SwNumRuleTable > mpNumRuleTable
Definition: doc.hxx:265
Footer, for pageformats Client of FrameFormat describing the footer.
Definition: fmthdft.hxx:64
SwTOIKeyType
Definition: toxe.hxx:30
std::unique_ptr< IGrammarContact > mpGrammarContact
Definition: doc.hxx:277
void SetTOIAutoMarkURL(const OUString &rSet)
Definition: doc.hxx:948
std::unique_ptr< ::sw::DocumentDeviceManager > m_pDeviceAccess
Definition: doc.hxx:216
css::uno::Reference< css::container::XNameContainer > mxXForms
Definition: doc.hxx:205
sal_uInt32 mnRsid
Definition: doc.hxx:291
std::unique_ptr< SwFrameFormats > mpSpzFrameFormatTable
Definition: doc.hxx:239
void SetInXMLImport(bool bNew)
Definition: doc.hxx:964
SwDocShell * mpDocShell
Definition: doc.hxx:257
const std::unique_ptr< ::sw::DocumentListsManager > m_pDocumentListsManager
Definition: doc.hxx:220
SfxStyleFamily
SwFrameFormats * GetTableFrameFormats()
Definition: doc.hxx:808
SwCharFormat * GetDfltCharFormat()
Definition: doc.hxx:747
const std::unique_ptr< ::sw::DocumentStateManager > m_pDocumentStateManager
Definition: doc.hxx:212
void SetDocumentType(DocumentType eDocType)
Definition: doc.hxx:391
Specific frame formats (frames, DrawObjects).
Definition: docary.hxx:201
SwLayoutCache * GetLayoutCache() const
Definition: doc.hxx:1533
void SetContainsAtPageObjWithContentAnchor(const bool bFlag)
Definition: doc.hxx:562
SwFrameFormat * FindFrameFormatByName(const OUString &rName) const
Definition: doc.hxx:760
Base class for various Writer styles.
Definition: format.hxx:43
SwDBData maDBData
Definition: doc.hxx:201
const std::unique_ptr< ::sw::DocumentChartDataProviderManager > m_pDocumentChartDataProviderManager
Definition: doc.hxx:215
const SwPagePreviewPrtData * GetPreviewPrtData() const
Definition: doc.hxx:1448
PaM is Point and Mark: a selection of the document model.
Definition: pam.hxx:136
struct _xmlTextWriter * xmlTextWriterPtr
std::unique_ptr< SwTableAutoFormatTable > m_pTableStyles
Table styles (autoformats that are applied with table changes).
Definition: doc.hxx:283
void SetOLEPrtNotifyPending(bool bSet=true)
Definition: doc.hxx:1666
std::unique_ptr< SwTextFormatColls > mpTextFormatCollTable
Definition: doc.hxx:242
const OUString & getDocAccTitle() const
Definition: doc.hxx:549
Style of a layout element.
Definition: frmfmt.hxx:57
bool IsPrepareSelAll() const
Definition: doc.hxx:559
bool IsOLEPrtNotifyPending() const
Definition: doc.hxx:555
SwNodeType
Definition: ndtyp.hxx:28
MissingDictionary meDictionaryMissing
Definition: doc.hxx:317
std::unique_ptr< SwTOXTypes > mpTOXTypes
Definition: doc.hxx:245
const SfxObjectShellLock & GetTmpDocShell() const
Definition: doc.hxx:1349
void SetDBManager(SwDBManager *pNewMgr)
Definition: doc.hxx:662
void SetAllScriptItem(SfxItemSet &rSet, const SfxPoolItem &rItem)
Definition: poolfmt.cxx:39
std::unique_ptr< SwLayoutCache > mpLayoutCache
Layout cache to read and save with the document for a faster formatting.
Definition: doc.hxx:274
Document statistics information.
const SwPageDesc & GetPageDesc(const size_t i) const
Definition: doc.hxx:877
std::vector< std::weak_ptr< SwUnoCursor > > mvUnoCursorTable
Definition: doc.hxx:1626
std::unique_ptr< SwEndNoteInfo > mpEndNoteInfo
Definition: doc.hxx:253
FlyCntType
Definition: flyenum.hxx:23
const std::unique_ptr< ::sw::mark::MarkManager > mpMarkManager
Definition: doc.hxx:208
const SwDocShell * GetDocShell() const
Definition: doc.hxx:1343
Document fields related interfaces.
void FinitCore()
Definition: init.cxx:672
SplitTable_HeadlineOption
Definition: tblenum.hxx:53
SwFieldIds
Definition: fldbas.hxx:38
void SetTextFormatColl(const css::uno::Any &rAny, SwPaM &rPaM)
const SwFrameFormat * GetEmptyPageFormat() const
Definition: doc.hxx:742
void SetUpdateTOX(bool bFlag)
Definition: doc.hxx:944
std::unique_ptr< SwTextFormatColl > mpDfltTextFormatColl
Definition: doc.hxx:234
std::unique_ptr< SwFrameFormat > mpColumnContFormat
Definition: doc.hxx:232
size_t GetPageDescCnt() const
Definition: doc.hxx:876
void setDocAccTitle(const OUString &rTitle)
Definition: doc.hxx:548
void UpdateAllCharts()
Definition: doc.hxx:1283
const SwFrameFormat * GetColumnContFormat() const
Definition: doc.hxx:744
void SetInLoadAsynchron(bool bFlag)
Definition: doc.hxx:1359
css::uno::Reference< css::linguistic2::XProofreadingIterator > m_xGCIterator
Definition: doc.hxx:206
Provides access to settings of a document.
SwNumRule * mpOutlineRule
Definition: doc.hxx:251
std::unique_ptr< SwPagePreviewPrtData > m_pPgPViewPrtData
Definition: doc.hxx:270
Link< bool, void > maOle2Link
Definition: doc.hxx:196
Marks a node in the document model.
Definition: ndindex.hxx:31
DocumentType
Definition: doc.hxx:385
Document links administration interface.
Text operation/manipulation interface.
void SetInReading(bool bNew)
Definition: doc.hxx:951
std::unique_ptr< SwGrfFormatColls > mpGrfFormatCollTable
Definition: doc.hxx:243
SwNodes const & GetNodes() const
Definition: doc.hxx:403
#define SW_DLLPUBLIC
Definition: swdllapi.h:28
void CopyHeader(const SwFrameFormat &rSrcFormat, SwFrameFormat &rDestFormat)
Copy header (with contents) from SrcFormat to DestFormat (can also be copied into other document)...
Definition: doc.hxx:890
std::unique_ptr< SwFrameFormat > mpEmptyPageFormat
Definition: doc.hxx:231
bool IsInReading() const
Definition: doc.hxx:950
const std::unique_ptr< ::sw::DocumentDrawModelManager > m_pDocumentDrawModelManager
Definition: doc.hxx:210
SwTable is one table in the document model, containing rows (which contain cells).
Definition: swtable.hxx:110
SwFrameFormats * GetFrameFormats()
Definition: doc.hxx:732
RedlineMode
Definition: rootfrm.hxx:44
const SwTOXTypes & GetTOXTypes() const
Definition: doc.hxx:970
Provides access to the lists of a document.
< purpose of derivation from SwClient: character style for displaying the numbers.
Definition: lineinfo.hxx:37
The Undo actions need to create new Shell cursors.
const SwFrameFormat * GetDfltFrameFormat() const
Definition: doc.hxx:740
std::unique_ptr< SwSectionFormats > mpSectionFormatTable
Definition: doc.hxx:240
std::unique_ptr< ::sfx2::IXmlIdRegistry > m_pXmlIdRegistry
Definition: doc.hxx:287
bool IsDictionaryMissing() const
Returns true if no dictionary can be found for any content.
Definition: doc.hxx:1648
Provides access to the formatting devices of a document.
const css::uno::Reference< css::container::XNameContainer > & getXForms() const
Definition: doc.hxx:1590
void ClrContourCache()
Definition: txtfly.cxx:151
OUString msTOIAutoMarkURL
Definition: doc.hxx:202
SwCharFormat * FindCharFormatByName(const OUString &rName) const
Definition: doc.hxx:767
bool mbOLEPrtNotifyPending
TRUE: Printer has changed.
Definition: doc.hxx:307
const SvNumberFormatter * GetNumberFormatter(bool bCreate=true) const
Definition: doc.hxx:1408
const std::unique_ptr< ::sw::DocumentTimerManager > m_pDocumentTimerManager
Definition: doc.hxx:217
SwTextNode is a paragraph in the document model.
Definition: ndtxt.hxx:79
void InitCore()
Definition: init.cxx:455
const SwFootnoteIdxs & GetFootnoteIdxs() const
Definition: doc.hxx:628
const std::unique_ptr< ::sw::MetaFieldManager > m_pMetaFieldManager
Definition: doc.hxx:209
std::unique_ptr< SwAutoCorrExceptWord > mpACEWord
For the automated takeover of auto-corrected words that are "re-corrected".
Definition: doc.hxx:260
const SwCharFormats * GetCharFormats() const
Definition: doc.hxx:733
const std::unique_ptr< ::sw::DocumentStatisticsManager > m_pDocumentStatisticsManager
Definition: doc.hxx:224
void CopyFooter(const SwFrameFormat &rSrcFormat, SwFrameFormat &rDestFormat)
Copy footer (with contents) from SrcFormat to DestFormat.
Definition: doc.hxx:895
SwTableNode * IsIdxInTable(const SwNodeIndex &rIdx)
Definition: ndtbl.cxx:209
const SwTextFormatColls * GetTextFormatColls() const
Definition: doc.hxx:774
std::unique_ptr< SwCharFormat > mpDfltCharFormat
Definition: doc.hxx:233
bool IsInLoadAsynchron() const
Definition: doc.hxx:1358
unsigned char sal_uInt8
Provides outline nodes of a document.
css::uno::Reference< css::container::XNameContainer > m_xTemplateToProjectCache
Definition: doc.hxx:280
bool IsCopyIsMove() const
Definition: doc.hxx:1362
const SwNumRuleTable & GetNumRuleTable() const
Definition: doc.hxx:1057
void SetColumnSelection(bool bNew)
Definition: doc.hxx:961
const css::uno::Reference< css::container::XNameContainer > & GetVBATemplateToProjectCache() const
Definition: doc.hxx:1609
std::unique_ptr< SwCharFormats > mpCharFormatTable
Definition: doc.hxx:238
bool IsClipBoard() const
Definition: doc.hxx:956
SwNodes & GetNodes()
Definition: doc.hxx:402
SwFrameFormat * GetColumnContFormat()
Definition: doc.hxx:745
const std::unique_ptr< ::sw::DocumentExternalDataManager > m_pDocumentExternalDataManager
Definition: doc.hxx:227
SwFrameFormat * GetEmptyPageFormat()
Definition: doc.hxx:743
std::unique_ptr< SwFrameFormats > mpFrameFormatTable
Definition: doc.hxx:237
bool sw_GetPostIts(IDocumentFieldsAccess const *pIDFA, SetGetExpFields *pSrtLst)
Definition: doc.cxx:510
SwTableBox is one table cell in the document model.
Definition: swtable.hxx:386
Get information about the current document state.
Organizer of the contact between SwTextNodes and grammar checker.
std::unique_ptr< SwFootnoteIdxs > mpFootnoteIdxs
Definition: doc.hxx:255
SwTextFormatColls * GetTextFormatColls()
Definition: doc.hxx:775
const std::unique_ptr< ::sw::DocumentFieldsManager > m_pDocumentFieldsManager
Definition: doc.hxx:223
Header, for PageFormats Client of FrameFormat describing the header.
Definition: fmthdft.hxx:33
bool IsAutoFormatRedline() const
Definition: doc.hxx:1436
std::unique_ptr< SwCellStyleTable > mpCellStyles
Cell Styles not assigned to a Table Style.
Definition: doc.hxx:285
const std::unique_ptr< ::sw::DocumentStylePoolManager > m_pDocumentStylePoolManager
Definition: doc.hxx:226
std::unique_ptr< SwDBManager, o3tl::default_delete< SwDBManager > > m_pOwnDBManager
Definition: doc.hxx:248
bool IsInDtor() const
Definition: doc.hxx:397
Provides access to the layout of a document.
SwFootnoteIdxs & GetFootnoteIdxs()
Definition: doc.hxx:627
Access to the style pool.
bool HasTableStyles() const
Counts table styles without triggering lazy-load of them.
Definition: doc.hxx:1233
RndStdIds
std::unique_ptr< SwFrameFormat > mpDfltFrameFormat
Definition: doc.hxx:230
std::unique_ptr< SwLineNumberInfo > mpLineNumberInfo
Definition: doc.hxx:254
Give access to the data-provider for chart.
css::uno::Reference< css::script::vba::XVBAEventProcessor > mxVbaEvents
Definition: doc.hxx:279
const std::unique_ptr< ::sw::DocumentSettingManager > m_pDocumentSettingManager
Definition: doc.hxx:214
void SetInMailMerge(bool bNew)
Definition: doc.hxx:954
const SwFrameFormats * GetFrameFormats() const
Definition: doc.hxx:731
bool ContainsMSVBasic() const
Definition: doc.hxx:1524
const std::unique_ptr< ::sw::DocumentLinksAdministrationManager > m_pDocumentLinksAdministrationManager
Definition: doc.hxx:218
const SwGrfFormatColl * GetDfltGrfFormatColl() const
Definition: doc.hxx:800
IStyleAccess & GetIStyleAccess()
Definition: doc.hxx:750
std::unique_ptr< SwFootnoteInfo > mpFootnoteInfo
Definition: doc.hxx:252
SwFrameFormat * GetDfltFrameFormat()
Definition: doc.hxx:741
SwSectionFormats & GetSections()
Definition: doc.hxx:1328
void SetContainsMSVBasic(bool bFlag)
Definition: doc.hxx:1525
bool mbAllOLENotify
Definition: doc.hxx:309
SwChainRet
Definition: flyenum.hxx:33
const SwFootnoteInfo & GetFootnoteInfo() const
Definition: doc.hxx:623
SwGrfFormatColl * GetDfltGrfFormatColl()
Definition: doc.hxx:801
DocumentType GetDocumentType() const
Definition: doc.hxx:390
const SwEndNoteInfo & GetEndNoteInfo() const
Definition: doc.hxx:625
SwCellFrame is one table cell in the document layout.
Definition: cellfrm.hxx:30
SwExtTextInput * mpExtInputRing
Definition: doc.hxx:271
SwDBManager * GetDBManager() const
Definition: doc.hxx:663
static SwPageDesc * FindPageDesc(SwDoc *pDoc, sal_uInt16 nPoolId)
Definition: htmlcss1.cxx:1328
bool IsInXMLImport() const
Definition: doc.hxx:963
const SwAttrPool & GetAttrPool() const
Definition: doc.hxx:1309
std::unique_ptr< SwGrfFormatColl > mpDfltGrfFormatColl
Definition: doc.hxx:235
SwNumRule * GetOutlineNumRule() const
Definition: doc.hxx:1015
void SetVBATemplateToProjectCache(css::uno::Reference< css::container::XNameContainer > const &xCache)
Definition: doc.hxx:1608
MissingDictionary
Definition: doc.hxx:316
void SetAutoFormatRedline(bool bFlag)
Definition: doc.hxx:1437
SwCharFormats * GetCharFormats()
Definition: doc.hxx:734
Base class of the Writer document model elements.
Definition: node.hxx:79