Teach symstore more duplicated DLLs
[LibreOffice.git] / sw / inc / doc.hxx
blob83651fc8fcb2f979185de3d9efed2c251ddab574
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_DOC_HXX
20 #define INCLUDED_SW_INC_DOC_HXX
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>
48 namespace editeng { class SvxBorderLine; }
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;
61 class SwAutoCorrExceptWord;
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;
80 class SwPagePreviewPrtData;
81 class SwRootFrame;
82 class SwRubyListEntry;
83 class SwSectionFormat;
84 class SwSectionData;
85 class SwSelBoxes;
86 class SwTableAutoFormatTable;
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;
115 class IDocumentSettingAccess;
116 class IDocumentDeviceAccess;
117 class IDocumentDrawModelAccess;
118 class IDocumentChartDataProviderAccess;
119 class IDocumentTimerAccess;
120 class IDocumentLinksAdministration;
121 class IDocumentListItems;
122 class IDocumentListsAccess;
123 class IDocumentOutlineNodes;
124 class IDocumentContentOperations;
125 class IDocumentRedlineAccess;
126 class IDocumentStatistics;
127 class IDocumentState;
128 class IDocumentLayoutAccess;
129 class IDocumentStylePoolAccess;
130 class IDocumentExternalData;
131 class IDocumentMarkAccess;
132 class SetGetExpFields;
133 struct SwInsertTableOptions;
134 enum class SvMacroItemId : sal_uInt16;
135 enum class SvxFrameDirection;
136 enum class RndStdIds;
138 namespace sw { namespace mark {
139 class MarkManager;
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;
165 namespace com { namespace sun { namespace star {
166 namespace container {
167 class XNameContainer; //< for getXForms()/isXForms()/initXForms() methods
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; } }
176 namespace sfx2 {
177 class IXmlIdRegistry;
180 void SetAllScriptItem( SfxItemSet& rSet, const SfxPoolItem& rItem );
182 using SwRubyList = std::vector<std::unique_ptr<SwRubyListEntry>>;
184 // Represents the model of a Writer document.
185 class SW_DLLPUBLIC SwDoc final
187 friend class ::sw::DocumentContentOperationsManager;
189 friend void InitCore();
190 friend void FinitCore();
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
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;
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;
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;
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;
245 std::unique_ptr<SwTOXTypes> mpTOXTypes; //< Tables/indices
246 std::unique_ptr<SwDefTOXBase_Impl> mpDefTOXBases; //< defaults of SwTOXBase's
248 std::unique_ptr<SwDBManager, o3tl::default_delete<SwDBManager>> m_pOwnDBManager; //< own DBManager
249 SwDBManager * m_pDBManager; //< DBManager for evaluation of DB-fields.
251 SwNumRule *mpOutlineRule;
252 std::unique_ptr<SwFootnoteInfo> mpFootnoteInfo;
253 std::unique_ptr<SwEndNoteInfo> mpEndNoteInfo;
254 std::unique_ptr<SwLineNumberInfo> mpLineNumberInfo;
255 std::unique_ptr<SwFootnoteIdxs> mpFootnoteIdxs;
257 SwDocShell *mpDocShell; //< Ptr to SfxDocShell of Doc.
258 SfxObjectShellLock mxTmpDocShell; //< A temporary shell that is used to copy OLE-Nodes
260 std::unique_ptr<SwAutoCorrExceptWord> mpACEWord; /**< For the automated takeover of
261 auto-corrected words that are "re-corrected". */
262 std::unique_ptr<SwURLStateChanged> mpURLStateChgd; //< SfxClient for changes in INetHistory
263 std::atomic<SvNumberFormatter*> mpNumberFormatter; //< NumFormatter for tables / fields
265 mutable std::unique_ptr<SwNumRuleTable> mpNumRuleTable; //< List of all named NumRules.
267 // Hash map to find numrules by name
268 mutable std::unordered_map<OUString, SwNumRule *> maNumRuleMap;
270 std::unique_ptr<SwPagePreviewPrtData> m_pPgPViewPrtData; //< Indenting / spacing for printing of page view.
271 SwExtTextInput *mpExtInputRing;
273 std::unique_ptr<IStyleAccess> mpStyleAccess; //< handling of automatic styles
274 std::unique_ptr<SwLayoutCache> mpLayoutCache; /**< Layout cache to read and save with the
275 document for a faster formatting */
277 std::unique_ptr<IGrammarContact> mpGrammarContact; //< for grammar checking in paragraphs during editing
279 css::uno::Reference< css::script::vba::XVBAEventProcessor > mxVbaEvents;
280 css::uno::Reference<css::container::XNameContainer> m_xTemplateToProjectCache;
282 /// Table styles (autoformats that are applied with table changes).
283 std::unique_ptr<SwTableAutoFormatTable> m_pTableStyles;
284 /// Cell Styles not assigned to a Table Style
285 std::unique_ptr<SwCellStyleTable> mpCellStyles;
286 private:
287 std::unique_ptr< ::sfx2::IXmlIdRegistry > m_pXmlIdRegistry;
289 // other
291 sal_uInt32 mnRsid; //< current session ID of the document
292 sal_uInt32 mnRsidRoot; //< session ID when the document was created
294 oslInterlockedCount mReferenceCount;
296 bool mbDtor : 1; /**< TRUE: is in SwDoc DTOR.
297 and unfortunately temporarily also in
298 SwSwgReader::InLayout() when flawed
299 frames need deletion. */
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 mbInWriterfilterImport : 1; //< TRUE: writerfilter import (DOCX,RTF)
305 bool mbUpdateTOX : 1; //< TRUE: After loading document, update TOX.
306 bool mbInLoadAsynchron : 1; //< TRUE: Document is in the process of being loaded asynchronously.
307 bool mbIsAutoFormatRedline : 1; //< TRUE: Redlines are recorded by Autoformat.
308 bool mbOLEPrtNotifyPending : 1; /**< TRUE: Printer has changed. At creation of View
309 notification of OLE-Objects PrtOLENotify() is required. */
310 bool mbAllOLENotify : 1; //< True: Notification of all objects is required.
311 bool mbInsOnlyTextGlssry : 1; //< True: insert 'only text' glossary into doc
312 bool mbContains_MSVBasic : 1; //< True: MS-VBasic exist is in our storage
313 bool mbClipBoard : 1; //< TRUE: this document represents the clipboard
314 bool mbColumnSelection : 1; //< TRUE: this content has been created by a column selection (clipboard docs only)
315 bool mbIsPrepareSelAll : 1;
317 enum MissingDictionary { False = -1, Undefined = 0, True = 1 };
318 MissingDictionary meDictionaryMissing;
320 // true: Document contains at least one anchored object, which is anchored AT_PAGE with a content position.
321 // Thus, certain adjustment needed during formatting for these kind of anchored objects.
322 bool mbContainsAtPageObjWithContentAnchor : 1;
324 static SwAutoCompleteWord *s_pAutoCompleteWords; //< List of all words for AutoComplete
326 // private methods
327 SwFlyFrameFormat* MakeFlySection_( const SwPosition& rAnchPos,
328 const SwContentNode& rNode, RndStdIds eRequestId,
329 const SfxItemSet* pFlyAttrSet,
330 SwFrameFormat* );
331 sal_Int8 SetFlyFrameAnchor( SwFrameFormat& rFlyFormat, SfxItemSet& rSet, bool bNewFrames );
333 typedef SwFormat* (SwDoc:: *FNCopyFormat)( const OUString&, SwFormat*, bool, bool );
334 SwFormat* CopyFormat( const SwFormat& rFormat, const SwFormatsBase& rFormatArr,
335 FNCopyFormat fnCopyFormat, const SwFormat& rDfltFormat );
336 void CopyFormatArr( const SwFormatsBase& rSourceArr, SwFormatsBase const & rDestArr,
337 FNCopyFormat fnCopyFormat, SwFormat& rDfltFormat );
338 void CopyPageDescHeaderFooterImpl( bool bCpyHeader,
339 const SwFrameFormat& rSrcFormat, SwFrameFormat& rDestFormat );
341 SwDoc( const SwDoc &) = delete;
343 // Database fields:
344 void AddUsedDBToList( std::vector<OUString>& rDBNameList,
345 const std::vector<OUString>& rUsedDBNames );
346 void AddUsedDBToList( std::vector<OUString>& rDBNameList, const OUString& rDBName );
347 static bool IsNameInArray( const std::vector<OUString>& rOldNames, const OUString& rName );
348 void GetAllDBNames( std::vector<OUString>& rAllDBNames );
349 static OUString ReplaceUsedDBs( const std::vector<OUString>& rUsedDBNames,
350 const OUString& rNewName, const OUString& rFormula );
351 static std::vector<OUString>& FindUsedDBs( const std::vector<OUString>& rAllDBNames,
352 const OUString& rFormula,
353 std::vector<OUString>& rUsedDBNames );
355 void EnsureNumberFormatter();
357 bool UnProtectTableCells( SwTable& rTable );
359 /** Create sub-documents according to the given collection.
360 If no collection is given, take chapter style of the 1st level. */
361 bool SplitDoc( sal_uInt16 eDocType, const OUString& rPath, bool bOutline,
362 const SwTextFormatColl* pSplitColl, int nOutlineLevel = 0 );
364 // Update charts of given table.
365 void UpdateCharts_( const SwTable& rTable, SwViewShell const & rVSh ) const;
367 static bool SelectNextRubyChars( SwPaM& rPam, SwRubyListEntry& rRubyEntry );
369 // CharTimer calls this method.
370 void DoUpdateAllCharts();
371 DECL_LINK( DoUpdateModifiedOLE, Timer *, void );
373 public:
374 SwFormat *MakeCharFormat_(const OUString &, SwFormat *, bool, bool );
375 SwFormat *MakeFrameFormat_(const OUString &, SwFormat *, bool, bool );
377 private:
378 SwFormat *MakeTextFormatColl_(const OUString &, SwFormat *, bool, bool );
380 private:
381 OUString msDocAccTitle;
383 void InitTOXTypes();
385 public:
386 enum DocumentType {
387 DOCTYPE_NATIVE,
388 DOCTYPE_MSWORD // This doc model comes from MS Word
390 DocumentType meDocType;
391 DocumentType GetDocumentType() const { return meDocType; }
392 void SetDocumentType( DocumentType eDocType ) { meDocType = eDocType; }
394 // Life cycle
395 SwDoc();
396 ~SwDoc();
398 bool IsInDtor() const { return mbDtor; }
400 /* @@@MAINTAINABILITY-HORROR@@@
401 Implementation details made public.
403 SwNodes & GetNodes() { return *m_pNodes; }
404 SwNodes const& GetNodes() const { return *m_pNodes; }
406 private:
407 friend class ::rtl::Reference<SwDoc>;
409 /** Acquire a reference to an instance. A caller shall release
410 the instance by calling 'release' when it is no longer needed.
411 'acquire' and 'release' calls need to be balanced.
413 @returns
414 the current reference count of the instance for debugging purposes.
416 sal_Int32 acquire();
417 /** Releases a reference to an instance. A caller has to call
418 'release' when a before acquired reference to an instance
419 is no longer needed. 'acquire' and 'release' calls need to
420 be balanced.
422 @returns
423 the current reference count of the instance for debugging purposes.
425 sal_Int32 release();
426 /** Returns the current reference count. This method should be used for
427 debugging purposes. Using it otherwise is a signal of a design flaw.
429 public:
430 sal_Int32 getReferenceCount() const;
432 // IDocumentSettingAccess
433 IDocumentSettingAccess const & getIDocumentSettingAccess() const; //The IDocumentSettingAccess interface
434 IDocumentSettingAccess & getIDocumentSettingAccess();
435 ::sw::DocumentSettingManager & GetDocumentSettingManager(); //The implementation of the interface with some additional methods
436 ::sw::DocumentSettingManager const& GetDocumentSettingManager() const;
437 sal_uInt32 getRsid() const;
438 void setRsid( sal_uInt32 nVal );
439 sal_uInt32 getRsidRoot() const;
440 void setRsidRoot( sal_uInt32 nVal );
442 // IDocumentDeviceAccess
443 IDocumentDeviceAccess const & getIDocumentDeviceAccess() const;
444 IDocumentDeviceAccess & getIDocumentDeviceAccess();
446 // IDocumentMarkAccess
447 IDocumentMarkAccess* getIDocumentMarkAccess();
448 const IDocumentMarkAccess* getIDocumentMarkAccess() const;
450 // IDocumentRedlineAccess
451 IDocumentRedlineAccess const& getIDocumentRedlineAccess() const;
452 IDocumentRedlineAccess& getIDocumentRedlineAccess();
454 ::sw::DocumentRedlineManager const& GetDocumentRedlineManager() const;
455 ::sw::DocumentRedlineManager& GetDocumentRedlineManager();
457 // IDocumentUndoRedo
458 IDocumentUndoRedo & GetIDocumentUndoRedo();
459 IDocumentUndoRedo const& GetIDocumentUndoRedo() const;
461 // IDocumentLinksAdministration
462 IDocumentLinksAdministration const & getIDocumentLinksAdministration() const;
463 IDocumentLinksAdministration & getIDocumentLinksAdministration();
465 ::sw::DocumentLinksAdministrationManager const & GetDocumentLinksAdministrationManager() const;
466 ::sw::DocumentLinksAdministrationManager & GetDocumentLinksAdministrationManager();
468 // IDocumentFieldsAccess
469 IDocumentFieldsAccess const & getIDocumentFieldsAccess() const;
470 IDocumentFieldsAccess & getIDocumentFieldsAccess();
472 ::sw::DocumentFieldsManager & GetDocumentFieldsManager();
474 // Returns 0 if the field cannot hide para, or a positive integer indicating the field type
475 // "weight" when several hiding fields' FieldHidesPara() give conflicting results
476 int FieldCanHideParaWeight(SwFieldIds eFieldId) const;
477 bool FieldHidesPara(const SwField& rField) const;
479 // IDocumentContentOperations
480 IDocumentContentOperations const & getIDocumentContentOperations() const;
481 IDocumentContentOperations & getIDocumentContentOperations();
482 ::sw::DocumentContentOperationsManager const & GetDocumentContentOperationsManager() const;
483 ::sw::DocumentContentOperationsManager & GetDocumentContentOperationsManager();
485 bool UpdateParRsid( SwTextNode *pTextNode, sal_uInt32 nVal = 0 );
486 void UpdateRsid( const SwPaM &rRg, sal_Int32 nLen );
488 // IDocumentStylePoolAccess
489 IDocumentStylePoolAccess const & getIDocumentStylePoolAccess() const;
490 IDocumentStylePoolAccess & getIDocumentStylePoolAccess();
492 // SwLineNumberInfo
493 const SwLineNumberInfo& GetLineNumberInfo() const;
494 void SetLineNumberInfo(const SwLineNumberInfo& rInfo);
496 // IDocumentStatistics
497 IDocumentStatistics const & getIDocumentStatistics() const;
498 IDocumentStatistics & getIDocumentStatistics();
500 ::sw::DocumentStatisticsManager const & GetDocumentStatisticsManager() const;
501 ::sw::DocumentStatisticsManager & GetDocumentStatisticsManager();
503 // IDocumentState
504 IDocumentState const & getIDocumentState() const;
505 IDocumentState & getIDocumentState();
507 // IDocumentDrawModelAccess
508 void AddDrawUndo( std::unique_ptr<SdrUndoAction> );
509 IDocumentDrawModelAccess const & getIDocumentDrawModelAccess() const;
510 IDocumentDrawModelAccess & getIDocumentDrawModelAccess();
512 ::sw::DocumentDrawModelManager const & GetDocumentDrawModelManager() const;
513 ::sw::DocumentDrawModelManager & GetDocumentDrawModelManager();
515 // IDocumentLayoutAccess
516 IDocumentLayoutAccess const & getIDocumentLayoutAccess() const;
517 IDocumentLayoutAccess & getIDocumentLayoutAccess();
519 ::sw::DocumentLayoutManager const & GetDocumentLayoutManager() const;
520 ::sw::DocumentLayoutManager & GetDocumentLayoutManager();
522 // IDocumentTimerAccess
523 // Our own 'IdleTimer' calls the following method
524 IDocumentTimerAccess const & getIDocumentTimerAccess() const;
525 IDocumentTimerAccess & getIDocumentTimerAccess();
527 // IDocumentChartDataProviderAccess
528 IDocumentChartDataProviderAccess const & getIDocumentChartDataProviderAccess() const;
529 IDocumentChartDataProviderAccess & getIDocumentChartDataProviderAccess();
531 // IDocumentListItems
532 IDocumentListItems const & getIDocumentListItems() const;
533 IDocumentListItems & getIDocumentListItems();
535 // IDocumentOutlineNodes
536 IDocumentOutlineNodes const & getIDocumentOutlineNodes() const;
537 IDocumentOutlineNodes & getIDocumentOutlineNodes();
539 // IDocumentListsAccess
540 IDocumentListsAccess const & getIDocumentListsAccess() const;
541 IDocumentListsAccess & getIDocumentListsAccess();
543 //IDocumentExternalData
544 IDocumentExternalData const & getIDocumentExternalData() const;
545 IDocumentExternalData & getIDocumentExternalData();
547 //End of Interfaces
549 void setDocAccTitle( const OUString& rTitle ) { msDocAccTitle = rTitle; }
550 const OUString& getDocAccTitle() const { return msDocAccTitle; }
552 // INextInterface here
553 DECL_LINK(CalcFieldValueHdl, EditFieldInfo*, void);
555 // OLE ???
556 bool IsOLEPrtNotifyPending() const { return mbOLEPrtNotifyPending; }
557 inline void SetOLEPrtNotifyPending( bool bSet = true );
558 void PrtOLENotify( bool bAll ); // All or only marked
560 bool IsPrepareSelAll() const { return mbIsPrepareSelAll; }
561 void SetPrepareSelAll() { mbIsPrepareSelAll = true; }
563 void SetContainsAtPageObjWithContentAnchor( const bool bFlag )
565 mbContainsAtPageObjWithContentAnchor = bFlag;
567 bool DoesContainAtPageObjWithContentAnchor()
569 return mbContainsAtPageObjWithContentAnchor;
572 /** Returns positions of all FlyFrames in the document.
573 If a Pam-Pointer is passed the FlyFrames attached to paragraphs
574 have to be surrounded completely by css::awt::Selection.
575 ( Start < Pos < End ) !!!
576 (Required for Writers.) */
577 SwPosFlyFrames GetAllFlyFormats( const SwPaM*,
578 bool bDrawAlso,
579 bool bAsCharAlso = false ) const;
581 SwFlyFrameFormat *MakeFlyFrameFormat (const OUString &rFormatName, SwFrameFormat *pDerivedFrom);
582 SwDrawFrameFormat *MakeDrawFrameFormat(const OUString &rFormatName, SwFrameFormat *pDerivedFrom);
584 // From now on this interface has to be used for Flys.
585 // pAnchorPos must be set, if they are not attached to pages AND
586 // Anchor is not already set at valid ContentPos
587 // in FlySet/FrameFormat.
588 /* new parameter bCalledFromShell
590 true: An existing adjust item at pAnchorPos is propagated to
591 the content node of the new fly section. That propagation only
592 takes place if there is no adjust item in the paragraph style
593 for the new fly section.
595 false: no propagation
597 SwFlyFrameFormat* MakeFlySection( RndStdIds eAnchorType,
598 const SwPosition* pAnchorPos,
599 const SfxItemSet* pSet = nullptr,
600 SwFrameFormat *pParent = nullptr,
601 bool bCalledFromShell = false );
602 SwFlyFrameFormat* MakeFlyAndMove( const SwPaM& rPam, const SfxItemSet& rSet,
603 const SwSelBoxes* pSelBoxes,
604 SwFrameFormat *pParent );
606 // Helper that checks for unique items for DrawingLayer items of type NameOrIndex
607 // and evtl. corrects that items to ensure unique names for that type. This call may
608 // modify/correct entries inside of the given SfxItemSet, and it will apply a name to
609 // the items in question (what is essential to make the named slots associated with
610 // these items work for the UNO API and thus e.g. for ODF import/export)
611 void CheckForUniqueItemForLineFillNameOrIndex(SfxItemSet& rSet);
613 bool SetFlyFrameAttr( SwFrameFormat& rFlyFormat, SfxItemSet& rSet );
615 bool SetFrameFormatToFly( SwFrameFormat& rFlyFormat, SwFrameFormat& rNewFormat,
616 SfxItemSet* pSet = nullptr, bool bKeepOrient = false );
617 void SetFlyFrameTitle( SwFlyFrameFormat& rFlyFrameFormat,
618 const OUString& sNewTitle );
619 void SetFlyFrameDescription( SwFlyFrameFormat& rFlyFrameFormat,
620 const OUString& sNewDescription );
622 // Footnotes
623 // Footnote information
624 const SwFootnoteInfo& GetFootnoteInfo() const { return *mpFootnoteInfo; }
625 void SetFootnoteInfo(const SwFootnoteInfo& rInfo);
626 const SwEndNoteInfo& GetEndNoteInfo() const { return *mpEndNoteInfo; }
627 void SetEndNoteInfo(const SwEndNoteInfo& rInfo);
628 SwFootnoteIdxs& GetFootnoteIdxs() { return *mpFootnoteIdxs; }
629 const SwFootnoteIdxs& GetFootnoteIdxs() const { return *mpFootnoteIdxs; }
630 /// change footnotes in range
631 bool SetCurFootnote( const SwPaM& rPam, const OUString& rNumStr,
632 bool bIsEndNote );
634 /** Operations on the content of the document e.g.
635 spell-checking/hyphenating/word-counting
637 css::uno::Any
638 Spell( SwPaM&, css::uno::Reference< css::linguistic2::XSpellChecker1 > const &,
639 sal_uInt16* pPageCnt, sal_uInt16* pPageSt, bool bGrammarCheck,
640 SwRootFrame const* pLayout, // for grammar-check
641 SwConversionArgs *pConvArgs = nullptr ) const;
643 css::uno::Reference< css::linguistic2::XHyphenatedWord >
644 Hyphenate( SwPaM *pPam, const Point &rCursorPos,
645 sal_uInt16* pPageCnt, sal_uInt16* pPageSt );
647 // count words in pam
648 static void CountWords( const SwPaM& rPaM, SwDocStat& rStat );
650 // Glossary Document
651 bool IsInsOnlyTextGlossary() const { return mbInsOnlyTextGlssry; }
653 void Summary( SwDoc* pExtDoc, sal_uInt8 nLevel, sal_uInt8 nPara, bool bImpress );
655 void ChangeAuthorityData(const SwAuthEntry* pNewData);
657 bool IsInHeaderFooter( const SwNodeIndex& rIdx ) const;
658 SvxFrameDirection GetTextDirection( const SwPosition& rPos,
659 const Point* pPt = nullptr ) const;
660 bool IsInVerticalText( const SwPosition& rPos ) const;
662 // Database and DB-Manager
663 void SetDBManager( SwDBManager* pNewMgr ) { m_pDBManager = pNewMgr; }
664 SwDBManager* GetDBManager() const { return m_pDBManager; }
665 void ChangeDBFields( const std::vector<OUString>& rOldNames,
666 const OUString& rNewName );
667 void SetInitDBFields(bool b);
669 // Find out which databases are used by fields.
670 void GetAllUsedDB( std::vector<OUString>& rDBNameList,
671 const std::vector<OUString>* pAllDBNames = nullptr );
673 void ChgDBData( const SwDBData& rNewData );
674 SwDBData const & GetDBData();
675 const SwDBData& GetDBDesc();
677 // Some helper functions
678 OUString GetUniqueGrfName() const;
679 OUString GetUniqueOLEName() const;
680 OUString GetUniqueFrameName() const;
681 OUString GetUniqueShapeName() const;
683 std::set<SwRootFrame*> GetAllLayouts();
685 void SetFlyName( SwFlyFrameFormat& rFormat, const OUString& rName );
686 const SwFlyFrameFormat* FindFlyByName( const OUString& rName, SwNodeType nNdTyp = SwNodeType::NONE ) const;
688 static void GetGrfNms( const SwFlyFrameFormat& rFormat, OUString* pGrfName, OUString* pFltName );
690 // Set a valid name for all Flys that have none (Called by Readers after reading).
691 void SetAllUniqueFlyNames();
693 /** Reset attributes. All TextHints and (if completely selected) all hard-
694 formatted stuff (auto-formats) are removed.
695 Introduce new optional parameter <bSendDataChangedEvents> in order to
696 control, if the side effect "send data changed events" is triggered or not. */
697 void ResetAttrs( const SwPaM &rRg,
698 bool bTextAttr = true,
699 const std::set<sal_uInt16> &rAttrs = std::set<sal_uInt16>(),
700 const bool bSendDataChangedEvents = true,
701 SwRootFrame const* pLayout = nullptr);
702 void RstTextAttrs(const SwPaM &rRg, bool bInclRefToxMark = false,
703 bool bExactRange = false, SwRootFrame const* pLayout = nullptr);
705 /** Set attribute in given format.1y
706 * If Undo is enabled, the old values is added to the Undo history. */
707 void SetAttr( const SfxPoolItem&, SwFormat& );
708 /** Set attribute in given format.1y
709 * If Undo is enabled, the old values is added to the Undo history. */
710 void SetAttr( const SfxItemSet&, SwFormat& );
712 // method to reset a certain attribute at the given format
713 void ResetAttrAtFormat( const sal_uInt16 nWhichId,
714 SwFormat& rChangedFormat );
716 /** Set attribute as new default attribute in current document.
717 If Undo is activated, the old one is listed in Undo-History. */
718 void SetDefault( const SfxPoolItem& );
719 void SetDefault( const SfxItemSet& );
721 // Query default attribute in this document.
722 const SfxPoolItem& GetDefault( sal_uInt16 nFormatHint ) const;
723 template<class T> const T& GetDefault( TypedWhichId<T> nWhich ) const
725 return static_cast<const T&>(GetDefault(sal_uInt16(nWhich)));
728 // Do not expand text attributes.
729 bool DontExpandFormat( const SwPosition& rPos, bool bFlag = true );
731 // Formats
732 const SwFrameFormats* GetFrameFormats() const { return mpFrameFormatTable.get(); }
733 SwFrameFormats* GetFrameFormats() { return mpFrameFormatTable.get(); }
734 const SwCharFormats* GetCharFormats() const { return mpCharFormatTable.get();}
735 SwCharFormats* GetCharFormats() { return mpCharFormatTable.get();}
737 // LayoutFormats (frames, DrawObjects), sometimes const sometimes not
738 const SwFrameFormats* GetSpzFrameFormats() const { return mpSpzFrameFormatTable.get(); }
739 SwFrameFormats* GetSpzFrameFormats() { return mpSpzFrameFormatTable.get(); }
741 const SwFrameFormat *GetDfltFrameFormat() const { return mpDfltFrameFormat.get(); }
742 SwFrameFormat *GetDfltFrameFormat() { return mpDfltFrameFormat.get(); }
743 const SwFrameFormat *GetEmptyPageFormat() const { return mpEmptyPageFormat.get(); }
744 SwFrameFormat *GetEmptyPageFormat() { return mpEmptyPageFormat.get(); }
745 const SwFrameFormat *GetColumnContFormat() const{ return mpColumnContFormat.get(); }
746 SwFrameFormat *GetColumnContFormat() { return mpColumnContFormat.get(); }
747 const SwCharFormat *GetDfltCharFormat() const { return mpDfltCharFormat.get();}
748 SwCharFormat *GetDfltCharFormat() { return mpDfltCharFormat.get();}
750 // @return the interface of the management of (auto)styles
751 IStyleAccess& GetIStyleAccess() { return *mpStyleAccess; }
753 // Remove all language dependencies from all existing formats
754 void RemoveAllFormatLanguageDependencies();
756 static SwFormat* FindFormatByName(const SwFormatsBase& rFormatArr, const OUString& rName);
758 SwFrameFormat *MakeFrameFormat(const OUString &rFormatName, SwFrameFormat *pDerivedFrom,
759 bool bBroadcast = false, bool bAuto = true);
760 void DelFrameFormat( SwFrameFormat *pFormat, bool bBroadcast = false );
761 SwFrameFormat* FindFrameFormatByName( const OUString& rName ) const
762 { return static_cast<SwFrameFormat*>(FindFormatByName( static_cast<SwFormatsBase&>(*mpFrameFormatTable), rName )); }
764 SwCharFormat *MakeCharFormat(const OUString &rFormatName, SwCharFormat *pDerivedFrom,
765 bool bBroadcast = false );
766 void DelCharFormat(size_t nFormat, bool bBroadcast = false);
767 void DelCharFormat(SwCharFormat const * pFormat, bool bBroadcast = false);
768 SwCharFormat* FindCharFormatByName( const OUString& rName ) const
769 { return static_cast<SwCharFormat*>(FindFormatByName( *mpCharFormatTable, rName )); }
771 // Formatcollections (styles)
772 // TXT
773 const SwTextFormatColl* GetDfltTextFormatColl() const { return mpDfltTextFormatColl.get(); }
774 SwTextFormatColl* GetDfltTextFormatColl() { return mpDfltTextFormatColl.get(); }
775 const SwTextFormatColls *GetTextFormatColls() const { return mpTextFormatCollTable.get(); }
776 SwTextFormatColls *GetTextFormatColls() { return mpTextFormatCollTable.get(); }
777 SwTextFormatColl *MakeTextFormatColl( const OUString &rFormatName,
778 SwTextFormatColl *pDerivedFrom,
779 bool bBroadcast = false);
780 SwConditionTextFormatColl* MakeCondTextFormatColl( const OUString &rFormatName,
781 SwTextFormatColl *pDerivedFrom,
782 bool bBroadcast = false);
783 void DelTextFormatColl(size_t nFormat, bool bBroadcast = false);
784 void DelTextFormatColl( SwTextFormatColl const * pColl, bool bBroadcast = false );
785 /** Add 4th optional parameter <bResetListAttrs>.
786 'side effect' of <SetTextFormatColl> with <bReset = true> is that the hard
787 attributes of the affected text nodes are cleared, except the break
788 attribute, the page description attribute and the list style attribute.
789 The new parameter <bResetListAttrs> indicates, if the list attributes
790 (list style, restart at and restart with) are cleared as well in case
791 that <bReset = true> and the paragraph style has a list style attribute set. */
792 bool SetTextFormatColl(const SwPaM &rRg, SwTextFormatColl *pFormat,
793 const bool bReset = true,
794 const bool bResetListAttrs = false,
795 SwRootFrame const* pLayout = nullptr);
796 SwTextFormatColl* FindTextFormatCollByName( const OUString& rName ) const
797 { return static_cast<SwTextFormatColl*>(FindFormatByName( *mpTextFormatCollTable, rName )); }
799 void ChkCondColls();
801 const SwGrfFormatColl* GetDfltGrfFormatColl() const { return mpDfltGrfFormatColl.get(); }
802 SwGrfFormatColl* GetDfltGrfFormatColl() { return mpDfltGrfFormatColl.get(); }
803 const SwGrfFormatColls *GetGrfFormatColls() const { return mpGrfFormatCollTable.get(); }
804 SwGrfFormatColl *MakeGrfFormatColl(const OUString &rFormatName,
805 SwGrfFormatColl *pDerivedFrom);
807 // Table formatting
808 const SwFrameFormats* GetTableFrameFormats() const { return mpTableFrameFormatTable.get(); }
809 SwFrameFormats* GetTableFrameFormats() { return mpTableFrameFormatTable.get(); }
810 size_t GetTableFrameFormatCount( bool bUsed ) const;
811 SwFrameFormat& GetTableFrameFormat(size_t nFormat, bool bUsed ) const;
812 SwTableFormat* MakeTableFrameFormat(const OUString &rFormatName, SwFrameFormat *pDerivedFrom);
813 void DelTableFrameFormat( SwTableFormat* pFormat );
814 SwTableFormat* FindTableFormatByName( const OUString& rName, bool bAll = false ) const;
816 /** Access to frames.
817 Iterate over Flys - for Basic-Collections. */
818 size_t GetFlyCount( FlyCntType eType, bool bIgnoreTextBoxes = false ) const;
819 SwFrameFormat* GetFlyNum(size_t nIdx, FlyCntType eType, bool bIgnoreTextBoxes = false );
820 std::vector<SwFrameFormat const*> GetFlyFrameFormats(
821 FlyCntType eType,
822 bool bIgnoreTextBoxes);
824 // Copy formats in own arrays and return them.
825 SwFrameFormat *CopyFrameFormat ( const SwFrameFormat& );
826 SwCharFormat *CopyCharFormat( const SwCharFormat& );
827 SwTextFormatColl* CopyTextColl( const SwTextFormatColl& rColl );
828 SwGrfFormatColl* CopyGrfColl( const SwGrfFormatColl& rColl );
830 // Replace all styles with those from rSource.
831 void ReplaceStyles( const SwDoc& rSource, bool bIncludePageStyles = true );
833 // Replace all property defaults with those from rSource.
834 void ReplaceDefaults( const SwDoc& rSource );
836 // Replace all compatibility options with those from rSource.
837 void ReplaceCompatibilityOptions( const SwDoc& rSource );
839 /** Replace all user defined document properties with xSourceDocProps.
840 Convenience function used by ReplaceDocumentProperties to skip some UNO calls.
842 void ReplaceUserDefinedDocumentProperties( const css::uno::Reference< css::document::XDocumentProperties >& xSourceDocProps );
844 /** Replace document properties with those from rSource.
846 This includes the user defined document properties!
848 void ReplaceDocumentProperties(const SwDoc& rSource, bool mailMerge = false);
850 // Query if style (paragraph- / character- / frame- / page-) is used.
851 bool IsUsed( const SwModify& ) const;
852 /// Query if table style is used.
853 bool IsUsed( const SwTableAutoFormat& ) const;
854 bool IsUsed( const SwNumRule& );
856 // Set name of newly loaded document template.
857 size_t SetDocPattern(const OUString& rPatternName);
859 // @return name of document template. Can be 0!
860 const OUString* GetDocPattern(size_t nPos) const;
862 // travel over PaM Ring
863 bool InsertGlossary( SwTextBlocks& rBlock, const OUString& rEntry,
864 SwPaM& rPaM, SwCursorShell* pShell = nullptr);
866 /** get the set of printable pages for the XRenderable API by
867 evaluating the respective settings (see implementation) */
868 static void CalculatePagesForPrinting( const SwRootFrame& rLayout, SwRenderData &rData, const SwPrintUIOptions &rOptions, bool bIsPDFExport,
869 sal_Int32 nDocPageCount );
870 static void UpdatePagesForPrintingWithPostItData( SwRenderData &rData, const SwPrintUIOptions &rOptions,
871 sal_Int32 nDocPageCount );
872 static void CalculatePagePairsForProspectPrinting( const SwRootFrame& rLayout, SwRenderData &rData, const SwPrintUIOptions &rOptions,
873 sal_Int32 nDocPageCount );
874 static void CalculateNonBlankPages( const SwRootFrame& rLayout, sal_uInt16& nDocPageCount, sal_uInt16& nActualPage );
876 // PageDescriptor interface.
877 size_t GetPageDescCnt() const { return m_PageDescs.size(); }
878 const SwPageDesc& GetPageDesc(const size_t i) const { return *m_PageDescs[i]; }
879 SwPageDesc& GetPageDesc(size_t const i) { return *m_PageDescs[i]; }
880 SwPageDesc* FindPageDesc(const OUString& rName, size_t* pPos = nullptr) const;
881 // Just searches the pointer in the m_PageDescs vector!
882 bool ContainsPageDesc(const SwPageDesc *pDesc, size_t* pPos) const;
884 /** Copy the complete PageDesc - beyond document and "deep"!
885 Optionally copying of PoolFormatId, -HlpId can be prevented. */
886 void CopyPageDesc( const SwPageDesc& rSrcDesc, SwPageDesc& rDstDesc,
887 bool bCopyPoolIds = true );
889 /** Copy header (with contents) from SrcFormat to DestFormat
890 (can also be copied into other document). */
891 void CopyHeader( const SwFrameFormat& rSrcFormat, SwFrameFormat& rDestFormat )
892 { CopyPageDescHeaderFooterImpl( true, rSrcFormat, rDestFormat ); }
894 /** Copy footer (with contents) from SrcFormat to DestFormat.
895 (can also be copied into other document). */
896 void CopyFooter( const SwFrameFormat& rSrcFormat, SwFrameFormat& rDestFormat )
897 { CopyPageDescHeaderFooterImpl( false, rSrcFormat, rDestFormat ); }
899 // For Reader
900 void ChgPageDesc( const OUString & rName, const SwPageDesc& );
901 void ChgPageDesc( size_t i, const SwPageDesc& );
902 void DelPageDesc( const OUString & rName, bool bBroadcast = false);
903 void DelPageDesc( size_t i, bool bBroadcast = false );
904 void PreDelPageDesc(SwPageDesc const * pDel);
905 SwPageDesc* MakePageDesc(const OUString &rName, const SwPageDesc* pCpy = nullptr,
906 bool bRegardLanguage = true,
907 bool bBroadcast = false);
908 void BroadcastStyleOperation(const OUString& rName, SfxStyleFamily eFamily,
909 SfxHintId nOp);
911 /** The html import sometimes overwrites the page sizes set in
912 the page descriptions. This function is used to correct this. */
913 void CheckDefaultPageFormat();
915 // Methods for tables/indices
916 static sal_uInt16 GetCurTOXMark( const SwPosition& rPos, SwTOXMarks& );
917 void DeleteTOXMark( const SwTOXMark* pTOXMark );
918 const SwTOXMark& GotoTOXMark( const SwTOXMark& rCurTOXMark,
919 SwTOXSearch eDir, bool bInReadOnly );
921 // Insert/Renew table/index
922 SwTOXBaseSection* InsertTableOf( const SwPosition& rPos,
923 const SwTOXBase& rTOX,
924 const SfxItemSet* pSet = nullptr,
925 bool bExpand = false,
926 SwRootFrame const* pLayout = nullptr);
927 SwTOXBaseSection* InsertTableOf( const SwPaM& aPam,
928 const SwTOXBase& rTOX,
929 const SfxItemSet* pSet = nullptr,
930 bool bExpand = false,
931 SwRootFrame const* pLayout = nullptr );
932 void InsertTableOf( sal_uLong nSttNd, sal_uLong nEndNd,
933 const SwTOXBase& rTOX,
934 const SfxItemSet* pSet );
935 static SwTOXBase* GetCurTOX( const SwPosition& rPos );
936 static const SwAttrSet& GetTOXBaseAttrSet(const SwTOXBase& rTOX);
938 bool DeleteTOX( const SwTOXBase& rTOXBase, bool bDelNodes );
939 OUString GetUniqueTOXBaseName( const SwTOXType& rType,
940 const OUString& sChkStr ) const;
942 bool SetTOXBaseName(const SwTOXBase& rTOXBase, const OUString& rName);
944 // After reading file update all tables/indices
945 void SetUpdateTOX( bool bFlag ) { mbUpdateTOX = bFlag; }
946 bool IsUpdateTOX() const { return mbUpdateTOX; }
948 const OUString& GetTOIAutoMarkURL() const {return msTOIAutoMarkURL;}
949 void SetTOIAutoMarkURL(const OUString& rSet) {msTOIAutoMarkURL = rSet;}
951 bool IsInReading() const { return mbInReading; }
952 void SetInReading( bool bNew ) { mbInReading = bNew; }
954 bool IsInMailMerge() const { return mbInMailMerge; }
955 void SetInMailMerge( bool bNew ) { mbInMailMerge = bNew; }
957 bool IsClipBoard() const { return mbClipBoard; }
958 // N.B.: must be called right after constructor! (@see GetXmlIdRegistry)
959 void SetClipBoard( bool bNew ) { mbClipBoard = bNew; }
961 bool IsColumnSelection() const { return mbColumnSelection; }
962 void SetColumnSelection( bool bNew ) { mbColumnSelection = bNew; }
964 bool IsInXMLImport() const { return mbInXMLImport; }
965 void SetInXMLImport( bool bNew ) { mbInXMLImport = bNew; }
966 bool IsInWriterfilterImport() const { return mbInWriterfilterImport; }
967 void SetInWriterfilterImport(bool const b) { mbInWriterfilterImport = b; }
969 // Manage types of tables/indices
970 sal_uInt16 GetTOXTypeCount( TOXTypes eTyp ) const;
971 const SwTOXType* GetTOXType( TOXTypes eTyp, sal_uInt16 nId ) const;
972 const SwTOXType* InsertTOXType( const SwTOXType& rTyp );
973 const SwTOXTypes& GetTOXTypes() const { return *mpTOXTypes; }
975 const SwTOXBase* GetDefaultTOXBase( TOXTypes eTyp, bool bCreate );
976 void SetDefaultTOXBase(const SwTOXBase& rBase);
978 // Key for management of index.
979 void GetTOIKeys(SwTOIKeyType eTyp, std::vector<OUString>& rArr,
980 SwRootFrame const& rLayout) const;
982 // Sort table text.
983 bool SortTable(const SwSelBoxes& rBoxes, const SwSortOptions&);
984 bool SortText(const SwPaM&, const SwSortOptions&);
986 // Correct the SwPosition-Objects that are registered with the document
987 // e. g. Bookmarks or tables/indices.
988 // If bMoveCursor is set move Cursor too.
990 // Set everything in rOldNode on rNewPos + Offset.
991 void CorrAbs(
992 const SwNodeIndex& rOldNode,
993 const SwPosition& rNewPos,
994 const sal_Int32 nOffset = 0,
995 bool bMoveCursor = false );
997 // Set everything in the range of [rStartNode, rEndNode] to rNewPos.
998 static void CorrAbs(
999 const SwNodeIndex& rStartNode,
1000 const SwNodeIndex& rEndNode,
1001 const SwPosition& rNewPos,
1002 bool bMoveCursor = false );
1004 // Set everything in this range from rRange to rNewPos.
1005 static void CorrAbs(
1006 const SwPaM& rRange,
1007 const SwPosition& rNewPos,
1008 bool bMoveCursor = false );
1010 // Set everything in rOldNode to relative Pos.
1011 void CorrRel(
1012 const SwNodeIndex& rOldNode,
1013 const SwPosition& rNewPos,
1014 const sal_Int32 nOffset = 0,
1015 bool bMoveCursor = false );
1017 // Query / set rules for Outline.
1018 SwNumRule* GetOutlineNumRule() const
1020 return mpOutlineRule;
1022 void SetOutlineNumRule( const SwNumRule& rRule );
1023 void PropagateOutlineRule();
1025 // Outline - promote / demote.
1026 bool OutlineUpDown(const SwPaM& rPam, short nOffset, SwRootFrame const* pLayout = nullptr);
1028 /// Outline - move up / move down.
1029 bool MoveOutlinePara( const SwPaM& rPam, SwOutlineNodes::difference_type nOffset);
1031 bool GotoOutline(SwPosition& rPos, const OUString& rName, SwRootFrame const* = nullptr) const;
1033 /** Accept changes of outline styles for OutlineRule.
1034 @param bResetIndentAttrs Optional parameter - default value false:
1035 If <bResetIndentAttrs> equals true, the indent attributes "before text"
1036 and "first line indent" are additionally reset at the provided PaM, if
1037 the list style makes use of the new list level attributes.
1038 @param bCreateNewList indicates if a new list is created by applying the given list style.
1039 @param sContinuedListId If bCreateNewList is false, may contain the
1040 list Id of a list which has to be continued by applying the given list style
1042 @return the set ListId if bSetItem is true */
1043 OUString SetNumRule( const SwPaM&,
1044 const SwNumRule&,
1045 bool bCreateNewList,
1046 SwRootFrame const* pLayout = nullptr,
1047 const OUString& sContinuedListId = OUString(),
1048 bool bSetItem = true,
1049 const bool bResetIndentAttrs = false );
1050 void SetCounted(const SwPaM&, bool bCounted, SwRootFrame const* pLayout);
1052 void MakeUniqueNumRules(const SwPaM & rPaM);
1054 void SetNumRuleStart( const SwPosition& rPos, bool bFlag = true );
1055 void SetNodeNumStart( const SwPosition& rPos, sal_uInt16 nStt );
1057 // sw_redlinehide: may set rPos to different node (the one with the NumRule)
1058 static SwNumRule* GetNumRuleAtPos(SwPosition& rPos, SwRootFrame const* pLayout = nullptr);
1060 const SwNumRuleTable& GetNumRuleTable() const { return *mpNumRuleTable; }
1063 Add numbering rule to document.
1065 @param pRule rule to add
1067 void AddNumRule(SwNumRule * pRule);
1069 // add optional parameter <eDefaultNumberFormatPositionAndSpaceMode>
1070 sal_uInt16 MakeNumRule( const OUString &rName,
1071 const SwNumRule* pCpy = nullptr,
1072 bool bBroadcast = false,
1073 const SvxNumberFormat::SvxNumPositionAndSpaceMode eDefaultNumberFormatPositionAndSpaceMode =
1074 SvxNumberFormat::LABEL_WIDTH_AND_POSITION );
1075 sal_uInt16 FindNumRule( const OUString& rName ) const;
1076 SwNumRule* FindNumRulePtr( const OUString& rName ) const;
1078 // Deletion only possible if Rule is not used!
1079 bool RenameNumRule(const OUString & aOldName, const OUString & aNewName,
1080 bool bBroadcast = false);
1081 bool DelNumRule( const OUString& rName, bool bBroadCast = false );
1082 OUString GetUniqueNumRuleName( const OUString* pChkStr = nullptr, bool bAutoNum = true ) const;
1084 void UpdateNumRule(); // Update all invalids.
1085 void ChgNumRuleFormats( const SwNumRule& rRule );
1086 bool ReplaceNumRule( const SwPosition& rPos, const OUString& rOldRule,
1087 const OUString& rNewRule );
1089 // Goto next/previous on same level.
1090 static bool GotoNextNum( SwPosition&, SwRootFrame const* pLayout,
1091 bool bOverUpper = true,
1092 sal_uInt8* pUpper = nullptr, sal_uInt8* pLower = nullptr );
1093 static bool GotoPrevNum( SwPosition&, SwRootFrame const* pLayout,
1094 bool bOverUpper = true );
1096 /** Searches for a text node with a numbering rule.
1098 add optional parameter <bInvestigateStartNode>
1099 add output parameter <sListId>
1101 \param rPos position to start search
1102 \param bForward - true: search forward
1103 - false: search backward
1104 \param bNum - true: search for enumeration
1105 - false: search for itemize
1106 \param bOutline - true: search for outline numbering rule
1107 - false: search for non-outline numbering rule
1108 \param nNonEmptyAllowed number of non-empty paragraphs allowed between
1109 rPos and found paragraph
1111 @param sListId
1112 output parameter - in case a list style is found, <sListId> holds the
1113 list id, to which the text node belongs, which applies the found list style.
1115 @param bInvestigateStartNode
1116 input parameter - boolean, indicating, if start node, determined by given
1117 start position has to be investigated or not.
1119 const SwNumRule * SearchNumRule(const SwPosition & rPos,
1120 const bool bForward,
1121 const bool bNum,
1122 const bool bOutline,
1123 int nNonEmptyAllowed,
1124 OUString& sListId,
1125 SwRootFrame const* pLayout,
1126 const bool bInvestigateStartNode = false );
1128 // Paragraphs without numbering but with indents.
1129 bool NoNum( const SwPaM& );
1131 // Delete, splitting of numbering list.
1132 void DelNumRules(const SwPaM&, SwRootFrame const* pLayout = nullptr);
1134 // Invalidates all numrules
1135 void InvalidateNumRules();
1137 bool NumUpDown(const SwPaM&, bool bDown, SwRootFrame const* pLayout = nullptr);
1139 /** Move selected paragraphs (not only numberings)
1140 according to offsets. (if negative: go to doc start). */
1141 bool MoveParagraph(SwPaM&, long nOffset, bool bIsOutlMv = false);
1142 bool MoveParagraphImpl(SwPaM&, long nOffset, bool bIsOutlMv, SwRootFrame const*);
1144 bool NumOrNoNum( const SwNodeIndex& rIdx, bool bDel = false);
1146 void StopNumRuleAnimations( OutputDevice* );
1148 /** Insert new table at position @param rPos (will be inserted before Node!).
1149 For AutoFormat at input: columns have to be set at predefined width.
1150 The array holds the positions of the columns (not their widths).
1151 new @param bCalledFromShell:
1152 true: called from shell -> propagate existing adjust item at
1153 rPos to every new cell. A existing adjust item in the table
1154 heading or table contents paragraph style prevent that
1155 propagation.
1156 false: do not propagate
1158 const SwTable* InsertTable( const SwInsertTableOptions& rInsTableOpts, // HeadlineNoBorder
1159 const SwPosition& rPos, sal_uInt16 nRows,
1160 sal_uInt16 nCols, sal_Int16 eAdjust,
1161 const SwTableAutoFormat* pTAFormat = nullptr,
1162 const std::vector<sal_uInt16> *pColArr = nullptr,
1163 bool bCalledFromShell = false,
1164 bool bNewModel = true );
1166 // If index is in a table, return TableNode, else 0.
1167 SwTableNode* IsIdxInTable( const SwNodeIndex& rIdx );
1168 inline const SwTableNode* IsIdxInTable( const SwNodeIndex& rIdx ) const;
1170 // Create a balanced table out of the selected range.
1171 const SwTable* TextToTable( const SwInsertTableOptions& rInsTableOpts, // HeadlineNoBorder,
1172 const SwPaM& rRange, sal_Unicode cCh,
1173 sal_Int16 eAdjust,
1174 const SwTableAutoFormat* );
1176 // text to table conversion - API support
1177 const SwTable* TextToTable( const std::vector< std::vector<SwNodeRange> >& rTableNodes );
1179 bool TableToText( const SwTableNode* pTableNd, sal_Unicode cCh );
1181 // Create columns / rows in table.
1182 void InsertCol( const SwCursor& rCursor,
1183 sal_uInt16 nCnt = 1, bool bBehind = true );
1184 bool InsertCol( const SwSelBoxes& rBoxes,
1185 sal_uInt16 nCnt = 1, bool bBehind = true );
1186 void InsertRow( const SwCursor& rCursor,
1187 sal_uInt16 nCnt = 1, bool bBehind = true );
1188 bool InsertRow( const SwSelBoxes& rBoxes,
1189 sal_uInt16 nCnt = 1, bool bBehind = true );
1191 // Delete Columns/Rows in table.
1192 bool DeleteRowCol( const SwSelBoxes& rBoxes, bool bColumn = false );
1193 void DeleteRow( const SwCursor& rCursor );
1194 void DeleteCol( const SwCursor& rCursor );
1196 // Split / concatenate boxes in table.
1197 bool SplitTable( const SwSelBoxes& rBoxes, bool bVert,
1198 sal_uInt16 nCnt, bool bSameHeight = false );
1200 TableMergeErr MergeTable( SwPaM& rPam );
1201 OUString GetUniqueTableName() const;
1202 bool IsInsTableFormatNum() const;
1203 bool IsInsTableChangeNumFormat() const;
1204 bool IsInsTableAlignNum() const;
1205 bool IsSplitVerticalByDefault() const;
1206 void SetSplitVerticalByDefault(bool value);
1208 // From FEShell (for Undo and BModified).
1209 static void GetTabCols( SwTabCols &rFill, const SwCellFrame* pBoxFrame );
1210 void SetTabCols( const SwTabCols &rNew, bool bCurRowOnly,
1211 const SwCellFrame* pBoxFrame );
1212 static void GetTabRows( SwTabCols &rFill, const SwCellFrame* pBoxFrame );
1213 void SetTabRows( const SwTabCols &rNew, bool bCurColOnly,
1214 const SwCellFrame* pBoxFrame );
1216 // Direct access for UNO.
1217 void SetTabCols(SwTable& rTab, const SwTabCols &rNew, const SwTabCols &rOld,
1218 const SwTableBox *pStart, bool bCurRowOnly);
1220 void SetRowsToRepeat( SwTable &rTable, sal_uInt16 nSet );
1222 /// AutoFormat for table/table selection.
1223 /// @param bResetDirect Reset direct formatting that might be applied to the cells.
1224 bool SetTableAutoFormat(const SwSelBoxes& rBoxes, const SwTableAutoFormat& rNew, bool bResetDirect = false, bool isSetStyleName = false);
1226 // Query attributes.
1227 bool GetTableAutoFormat( const SwSelBoxes& rBoxes, SwTableAutoFormat& rGet );
1229 /// Return the available table styles.
1230 SwTableAutoFormatTable& GetTableStyles();
1231 const SwTableAutoFormatTable& GetTableStyles() const
1233 return const_cast<SwDoc*>(this)->GetTableStyles();
1235 /// Counts table styles without triggering lazy-load of them.
1236 bool HasTableStyles() const { return m_pTableStyles != nullptr; }
1237 // Create a new table style. Tracked by Undo.
1238 SwTableAutoFormat* MakeTableStyle(const OUString& rName, bool bBroadcast = false);
1239 // Delete table style named rName. Tracked by undo.
1240 std::unique_ptr<SwTableAutoFormat> DelTableStyle(const OUString& rName, bool bBroadcast = false);
1241 // Change (replace) a table style named rName. Tracked by undo.
1242 void ChgTableStyle(const OUString& rName, const SwTableAutoFormat& rNewFormat);
1244 const SwCellStyleTable& GetCellStyles() const { return *mpCellStyles; }
1245 SwCellStyleTable& GetCellStyles() { return *mpCellStyles; }
1247 void AppendUndoForInsertFromDB( const SwPaM& rPam, bool bIsTable );
1249 bool SetColRowWidthHeight( SwTableBox& rCurrentBox, TableChgWidthHeightType eType,
1250 SwTwips nAbsDiff, SwTwips nRelDiff );
1251 SwTableBoxFormat* MakeTableBoxFormat();
1252 SwTableLineFormat* MakeTableLineFormat();
1254 // helper function: cleanup before checking number value
1255 bool IsNumberFormat( const OUString& rString, sal_uInt32& F_Index, double& fOutNumber);
1256 // Check if box has numerical value. Change format of box if required.
1257 void ChkBoxNumFormat( SwTableBox& rCurrentBox, bool bCallUpdate );
1258 void SetTableBoxFormulaAttrs( SwTableBox& rBox, const SfxItemSet& rSet );
1259 void ClearBoxNumAttrs( const SwNodeIndex& rNode );
1260 void ClearLineNumAttrs( SwPosition const & rPos );
1262 bool InsCopyOfTable( SwPosition& rInsPos, const SwSelBoxes& rBoxes,
1263 const SwTable* pCpyTable, bool bCpyName = false,
1264 bool bCorrPos = false );
1266 void UnProtectCells( const OUString& rTableName );
1267 bool UnProtectCells( const SwSelBoxes& rBoxes );
1268 void UnProtectTables( const SwPaM& rPam );
1269 bool HasTableAnyProtection( const SwPosition* pPos,
1270 const OUString* pTableName,
1271 bool* pFullTableProtection );
1273 // Split table at baseline position, i.e. create a new table.
1274 bool SplitTable( const SwPosition& rPos, SplitTable_HeadlineOption eMode,
1275 bool bCalcNewSize );
1277 /** And vice versa: rPos must be in the table that remains. The flag indicates
1278 whether the current table is merged with the one before or behind it. */
1279 bool MergeTable( const SwPosition& rPos, bool bWithPrev,
1280 sal_uInt16 nMode = 0 );
1282 // Make charts of given table update.
1283 void UpdateCharts( const OUString &rName ) const;
1285 // Update all charts, for that exists any table.
1286 void UpdateAllCharts() { DoUpdateAllCharts(); }
1288 // Table is renamed and refreshes charts.
1289 void SetTableName( SwFrameFormat& rTableFormat, const OUString &rNewName );
1291 // @return the reference in document that is set for name.
1292 const SwFormatRefMark* GetRefMark( const OUString& rName ) const;
1294 // @return RefMark via index - for UNO.
1295 const SwFormatRefMark* GetRefMark( sal_uInt16 nIndex ) const;
1297 /** @return names of all references that are set in document.
1298 If array pointer is 0 return only whether a RefMark is set in document. */
1299 sal_uInt16 GetRefMarks( std::vector<OUString>* = nullptr ) const;
1301 // Insert label. If a FlyFormat is created, return it.
1302 SwFlyFrameFormat* InsertLabel( const SwLabelType eType, const OUString &rText, const OUString& rSeparator,
1303 const OUString& rNumberingSeparator,
1304 const bool bBefore, const sal_uInt16 nId, const sal_uLong nIdx,
1305 const OUString& rCharacterStyle,
1306 const bool bCpyBrd );
1307 SwFlyFrameFormat* InsertDrawLabel(
1308 const OUString &rText, const OUString& rSeparator, const OUString& rNumberSeparator,
1309 const sal_uInt16 nId, const OUString& rCharacterStyle, SdrObject& rObj );
1311 // Query attribute pool.
1312 const SwAttrPool& GetAttrPool() const { return *mpAttrPool; }
1313 SwAttrPool& GetAttrPool() { return *mpAttrPool; }
1315 // Search for an EditShell.
1316 SwEditShell const * GetEditShell() const;
1317 SwEditShell* GetEditShell();
1318 ::sw::IShellCursorSupplier * GetIShellCursorSupplier();
1320 // OLE 2.0-notification.
1321 void SetOle2Link(const Link<bool,void>& rLink) {maOle2Link = rLink;}
1322 const Link<bool,void>& GetOle2Link() const {return maOle2Link;}
1324 // insert section (the ODF kind of section, not the nodesarray kind)
1325 SwSection * InsertSwSection(SwPaM const& rRange, SwSectionData &,
1326 std::pair<SwTOXBase const*, sw::RedlineMode> const* pTOXBase,
1327 SfxItemSet const*const pAttr, bool const bUpdate = true);
1328 static sal_uInt16 IsInsRegionAvailable( const SwPaM& rRange,
1329 const SwNode** ppSttNd = nullptr );
1330 static SwSection* GetCurrSection( const SwPosition& rPos );
1331 SwSectionFormats& GetSections() { return *mpSectionFormatTable; }
1332 const SwSectionFormats& GetSections() const { return *mpSectionFormatTable; }
1333 SwSectionFormat *MakeSectionFormat();
1334 void DelSectionFormat( SwSectionFormat *pFormat, bool bDelNodes = false );
1335 void UpdateSection(size_t const nSect, SwSectionData &,
1336 SfxItemSet const*const = nullptr, bool const bPreventLinkUpdate = false);
1337 OUString GetUniqueSectionName( const OUString* pChkStr = nullptr ) const;
1339 /* @@@MAINTAINABILITY-HORROR@@@
1340 The model should not have anything to do with a shell.
1341 Unnecessary compile/link time dependency.
1344 // Pointer to SfxDocShell from Doc. Can be 0!!
1345 SwDocShell* GetDocShell() { return mpDocShell; }
1346 const SwDocShell* GetDocShell() const { return mpDocShell; }
1347 void SetDocShell( SwDocShell* pDSh );
1349 /** in case during copying of embedded object a new shell is created,
1350 it should be set here and cleaned later */
1351 void SetTmpDocShell( SfxObjectShellLock rLock ) { mxTmpDocShell = rLock; }
1352 const SfxObjectShellLock& GetTmpDocShell() const { return mxTmpDocShell; }
1354 // For Autotexts? (text modules) They have only one SVPersist at their disposal.
1355 SfxObjectShell* GetPersist() const;
1357 // Pointer to storage of SfxDocShells. Can be 0!!!
1358 css::uno::Reference< css::embed::XStorage > GetDocStorage();
1360 // Query / set flag indicating if document is loaded asynchronously at this moment.
1361 bool IsInLoadAsynchron() const { return mbInLoadAsynchron; }
1362 void SetInLoadAsynchron( bool bFlag ) { mbInLoadAsynchron = bFlag; }
1364 // For Drag&Move: (e.g. allow "moving" of RefMarks)
1365 bool IsCopyIsMove() const { return mbCopyIsMove; }
1366 void SetCopyIsMove( bool bFlag ) { mbCopyIsMove = bFlag; }
1368 SwDrawContact* GroupSelection( SdrView& );
1369 void UnGroupSelection( SdrView& );
1370 bool DeleteSelection( SwDrawView& );
1372 // Invalidates OnlineSpell-WrongLists.
1373 void SpellItAgainSam( bool bInvalid, bool bOnlyWrong, bool bSmartTags );
1374 void InvalidateAutoCompleteFlag();
1376 void SetCalcFieldValueHdl(Outliner* pOutliner);
1378 // Query if URL was visited.
1379 // Query via Doc, if only a Bookmark has been given.
1380 // In this case the document name has to be set in front.
1381 bool IsVisitedURL( const OUString& rURL );
1383 // Save current values for automatic registration of exceptions in Autocorrection.
1384 void SetAutoCorrExceptWord( std::unique_ptr<SwAutoCorrExceptWord> pNew );
1385 SwAutoCorrExceptWord* GetAutoCorrExceptWord() { return mpACEWord.get(); }
1386 void DeleteAutoCorrExceptWord();
1388 const SwFormatINetFormat* FindINetAttr( const OUString& rName ) const;
1390 // Call into intransparent Basic; expect possible Return String.
1391 void ExecMacro( const SvxMacro& rMacro, OUString* pRet, SbxArray* pArgs );
1393 // Call into intransparent Basic / JavaScript.
1394 sal_uInt16 CallEvent( SvMacroItemId nEvent, const SwCallMouseEvent& rCallEvent,
1395 bool bChkPtr = false );
1397 /** Adjust left margin via object bar (similar to adjustment of numerations).
1398 One can either change the margin "by" adding or subtracting a given
1399 offset or set it "to" this position (bModulus = true). */
1400 void MoveLeftMargin(const SwPaM& rPam, bool bRight, bool bModulus,
1401 SwRootFrame const* pLayout = nullptr);
1403 // Query NumberFormatter.
1404 SvNumberFormatter* GetNumberFormatter(bool bCreate = true)
1406 if (bCreate)
1407 EnsureNumberFormatter();
1408 return mpNumberFormatter;
1411 const SvNumberFormatter* GetNumberFormatter(bool bCreate = true) const
1413 return const_cast<SwDoc*>(this)->GetNumberFormatter(bCreate);
1416 bool HasInvisibleContent() const;
1417 // delete invisible content, like hidden sections and paragraphs
1418 bool RemoveInvisibleContent();
1419 // restore the invisible content if it's available on the undo stack
1420 bool RestoreInvisibleContent();
1422 bool ConvertFieldsToText(SwRootFrame const& rLayout);
1424 // Create sub-documents according to given collection.
1425 // If no collection is given, use chapter styles for 1st level.
1426 bool GenerateGlobalDoc( const OUString& rPath,
1427 const SwTextFormatColl* pSplitColl );
1428 bool GenerateGlobalDoc( const OUString& rPath, int nOutlineLevel );
1429 bool GenerateHTMLDoc( const OUString& rPath,
1430 const SwTextFormatColl* pSplitColl );
1431 bool GenerateHTMLDoc( const OUString& rPath, int nOutlineLevel );
1433 // Compare two documents.
1434 long CompareDoc( const SwDoc& rDoc );
1436 // Merge two documents.
1437 long MergeDoc( const SwDoc& rDoc );
1439 bool IsAutoFormatRedline() const { return mbIsAutoFormatRedline; }
1440 void SetAutoFormatRedline( bool bFlag ) { mbIsAutoFormatRedline = bFlag; }
1442 // For AutoFormat: with Undo/Redlining.
1443 void SetTextFormatCollByAutoFormat( const SwPosition& rPos, sal_uInt16 nPoolId,
1444 const SfxItemSet* pSet );
1445 void SetFormatItemByAutoFormat( const SwPaM& rPam, const SfxItemSet& );
1447 // Only for SW-textbloxks! Does not pay any attention to layout!
1448 void ClearDoc(); // Deletes all content!
1450 // Query /set data for PagePreview.
1451 const SwPagePreviewPrtData* GetPreviewPrtData() const { return m_pPgPViewPrtData.get(); }
1453 // If pointer == 0 destroy pointer in document.
1454 // Else copy object.
1455 // Pointer is not transferred to ownership by document!
1456 void SetPreviewPrtData( const SwPagePreviewPrtData* pData );
1458 /** update all modified OLE-Objects. The modification is called over the
1459 StarOne - Interface */
1460 void SetOLEObjModified();
1462 // Uno - Interfaces
1463 std::shared_ptr<SwUnoCursor> CreateUnoCursor( const SwPosition& rPos, bool bTableCursor = false );
1465 // FeShell - Interfaces
1466 // !!! These assume always an existing layout !!!
1467 bool ChgAnchor( const SdrMarkList& _rMrkList,
1468 RndStdIds _eAnchorType,
1469 const bool _bSameOnly,
1470 const bool _bPosCorr );
1472 void SetRowHeight( const SwCursor& rCursor, const SwFormatFrameSize &rNew );
1473 static std::unique_ptr<SwFormatFrameSize> GetRowHeight( const SwCursor& rCursor );
1474 void SetRowSplit( const SwCursor& rCursor, const SwFormatRowSplit &rNew );
1475 static std::unique_ptr<SwFormatRowSplit> GetRowSplit( const SwCursor& rCursor );
1477 /// Adjustment of Rowheights. Determine via bTstOnly if more than one row is selected.
1478 /// bOptimize: distribute current table height, instead of using the largest row.
1479 /// Call again without bOptimize to ensure equal height in case some row's content didn't fit.
1480 bool BalanceRowHeight( const SwCursor& rCursor, bool bTstOnly, const bool bOptimize );
1481 void SetRowBackground( const SwCursor& rCursor, const SvxBrushItem &rNew );
1482 static bool GetRowBackground( const SwCursor& rCursor, std::shared_ptr<SvxBrushItem>& rToFill );
1483 void SetTabBorders( const SwCursor& rCursor, const SfxItemSet& rSet );
1484 void SetTabLineStyle( const SwCursor& rCursor,
1485 const Color* pColor, bool bSetLine,
1486 const editeng::SvxBorderLine* pBorderLine );
1487 static void GetTabBorders( const SwCursor& rCursor, SfxItemSet& rSet );
1488 void SetBoxAttr( const SwCursor& rCursor, const SfxPoolItem &rNew );
1490 Retrieves a box attribute from the given cursor.
1492 @return Whether the property is set over the current box selection.
1494 @remarks A property is 'set' if it's set to the same value over all boxes in the current selection.
1495 The property value is retrieved from the first box in the current selection. It is then compared to
1496 the values of the same property over any other boxes in the selection; if any value is different from
1497 that of the first box, the property is unset (and false is returned).
1499 static bool GetBoxAttr( const SwCursor& rCursor, std::shared_ptr<SfxPoolItem>& rToFill );
1500 void SetBoxAlign( const SwCursor& rCursor, sal_uInt16 nAlign );
1501 static sal_uInt16 GetBoxAlign( const SwCursor& rCursor );
1502 /// Adjusts selected cell widths in such a way, that their content does not need to be wrapped (if possible).
1503 /// bBalance evenly re-distributes the available space regardless of content or wrapping.
1504 /// bNoShrink keeps table size the same by distributing excess space proportionately.
1505 void AdjustCellWidth( const SwCursor& rCursor, const bool bBalance, const bool bNoShrink );
1507 SwChainRet Chainable( const SwFrameFormat &rSource, const SwFrameFormat &rDest );
1508 SwChainRet Chain( SwFrameFormat &rSource, const SwFrameFormat &rDest );
1509 void Unchain( SwFrameFormat &rFormat );
1511 // For Copy/Move from FrameShell.
1512 SdrObject* CloneSdrObj( const SdrObject&, bool bMoveWithinDoc = false,
1513 bool bInsInPage = true );
1515 // FeShell - Interface end
1517 // Interface for TextInputData - for text input of Chinese and Japanese.
1518 SwExtTextInput* CreateExtTextInput( const SwPaM& rPam );
1519 void DeleteExtTextInput( SwExtTextInput* pDel );
1520 SwExtTextInput* GetExtTextInput( const SwNode& rNd,
1521 sal_Int32 nContentPos = -1) const;
1522 SwExtTextInput* GetExtTextInput() const;
1524 // Interface for access to AutoComplete-List.
1525 static SwAutoCompleteWord& GetAutoCompleteWords() { return *s_pAutoCompleteWords; }
1527 bool ContainsMSVBasic() const { return mbContains_MSVBasic; }
1528 void SetContainsMSVBasic( bool bFlag ) { mbContains_MSVBasic = bFlag; }
1530 // Interface for the list of Ruby - texts/attributes
1531 static sal_uInt16 FillRubyList( const SwPaM& rPam, SwRubyList& rList );
1532 void SetRubyList( const SwPaM& rPam, const SwRubyList& rList );
1534 void ReadLayoutCache( SvStream& rStream );
1535 void WriteLayoutCache( SvStream& rStream );
1536 SwLayoutCache* GetLayoutCache() const { return mpLayoutCache.get(); }
1538 /** Checks if any of the text node contains hidden characters.
1539 Used for optimization. Changing the view option 'view hidden text'
1540 has to trigger a reformatting only if some of the text is hidden.
1542 bool ContainsHiddenChars() const;
1544 IGrammarContact* getGrammarContact() const { return mpGrammarContact.get(); }
1546 /** Marks/Unmarks a list level of a certain list
1548 levels of a certain lists are marked now
1550 @param sListId list Id of the list whose level has to be marked/unmarked
1551 @param nListLevel level to mark
1552 @param bValue - true mark the level
1553 - false unmark the level
1555 void MarkListLevel( const OUString& sListId,
1556 const int nListLevel,
1557 const bool bValue );
1559 // Change a format undoable.
1560 void ChgFormat(SwFormat & rFormat, const SfxItemSet & rSet);
1562 void RenameFormat(SwFormat & rFormat, const OUString & sNewName,
1563 bool bBroadcast = false);
1565 // Change a TOX undoable.
1566 void ChangeTOX(SwTOXBase & rTOX, const SwTOXBase & rNew);
1569 Returns a textual description of a PaM.
1571 @param rPaM the PaM to describe
1573 If rPaM only spans one paragraph the result is:
1575 '<text in the PaM>'
1577 <text in the PaM> is shortened to nUndoStringLength characters.
1579 If rPaM spans more than one paragraph the result is:
1581 paragraphs (STR_PARAGRAPHS)
1583 @return the textual description of rPaM
1585 static OUString GetPaMDescr(const SwPaM & rPaM);
1587 static bool IsFirstOfNumRuleAtPos(const SwPosition & rPos, SwRootFrame const& rLayout);
1589 // access methods for XForms model(s)
1591 // access container for XForms model; will be NULL if !isXForms()
1592 const css::uno::Reference<css::container::XNameContainer>&
1593 getXForms() const { return mxXForms;}
1595 css::uno::Reference< css::linguistic2::XProofreadingIterator > const & GetGCIterator() const;
1597 // #i31958# is this an XForms document?
1598 bool isXForms() const;
1600 // #i31958# initialize XForms models; turn this into an XForms document
1601 void initXForms( bool bCreateDefaultModel );
1603 // #i113606# for disposing XForms
1604 void disposeXForms( );
1606 //Update all the page masters
1607 void SetDefaultPageMode(bool bSquaredPageMode);
1608 bool IsSquaredPageMode() const;
1610 css::uno::Reference< css::script::vba::XVBAEventProcessor > const & GetVbaEventProcessor();
1611 void SetVBATemplateToProjectCache( css::uno::Reference< css::container::XNameContainer > const & xCache ) { m_xTemplateToProjectCache = xCache; };
1612 const css::uno::Reference< css::container::XNameContainer >& GetVBATemplateToProjectCache() const { return m_xTemplateToProjectCache; };
1613 ::sfx2::IXmlIdRegistry& GetXmlIdRegistry();
1614 ::sw::MetaFieldManager & GetMetaFieldManager();
1615 ::sw::UndoManager & GetUndoManager();
1616 ::sw::UndoManager const& GetUndoManager() const;
1618 SfxObjectShell* CreateCopy(bool bCallInitNew, bool bEmpty) const;
1619 SwNodeIndex AppendDoc(const SwDoc& rSource, sal_uInt16 nStartPageNumber,
1620 bool bDeletePrevious, int physicalPageOffset,
1621 const sal_uLong nDocNo);
1624 * Dumps the entire nodes structure to the given destination (file nodes.xml in the current directory by default)
1626 void dumpAsXml(xmlTextWriterPtr = nullptr) const;
1628 std::set<Color> GetDocColors();
1629 std::vector< std::weak_ptr<SwUnoCursor> > mvUnoCursorTable;
1631 // Remove expired UnoCursor weak pointers the document keeps to notify about document death.
1632 void cleanupUnoCursorTable() const
1634 auto & rTable = const_cast<SwDoc*>(this)->mvUnoCursorTable;
1635 // In most cases we'll remove most of the elements.
1636 rTable.erase( std::remove_if(rTable.begin(),
1637 rTable.end(),
1638 [] (std::weak_ptr<SwUnoCursor> const & x) { return x.expired(); }),
1639 rTable.end());
1643 * @param bSkipStart don't actually start the jobs, just check
1644 * @returns true if new background checking jobs were started
1646 bool StartGrammarChecking( bool bSkipStart = false );
1648 /// Use to notify if the dictionary can be found for a single content portion (has to be called for all portions)
1649 void SetMissingDictionaries( bool bIsMissing );
1650 /// Returns true if no dictionary can be found for any content
1651 bool IsDictionaryMissing() const { return meDictionaryMissing == MissingDictionary::True; }
1653 private:
1654 // Copies master header to left / first one, if necessary - used by ChgPageDesc().
1655 void CopyMasterHeader(const SwPageDesc &rChged, const SwFormatHeader &rHead, SwPageDesc &pDesc, bool bLeft, bool bFirst);
1656 // Copies master footer to left / first one, if necessary - used by ChgPageDesc().
1657 void CopyMasterFooter(const SwPageDesc &rChged, const SwFormatFooter &rFoot, SwPageDesc &pDesc, bool bLeft, bool bFirst);
1661 // This method is called in Dtor of SwDoc and deletes cache of ContourObjects.
1662 void ClrContourCache();
1664 inline const SwTableNode* SwDoc::IsIdxInTable( const SwNodeIndex& rIdx ) const
1666 return const_cast<SwDoc*>(this)->IsIdxInTable( rIdx );
1669 inline void SwDoc::SetOLEPrtNotifyPending( bool bSet )
1671 mbOLEPrtNotifyPending = bSet;
1672 if( !bSet )
1673 mbAllOLENotify = false;
1676 bool sw_GetPostIts( IDocumentFieldsAccess const * pIDFA, SetGetExpFields * pSrtLst );
1678 #endif //_DOC_HXX
1680 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */