Bump version to 21.06.18.1
[LibreOffice.git] / sw / inc / doc.hxx
blob6d1fb3a0012511ec6401597fa3c794bf8adb8dc2
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 <o3tl/sorted_vector.hxx>
25 #include <vcl/idle.hxx>
26 #include "swdllapi.h"
27 #include "swtypes.hxx"
28 #include "toxe.hxx"
29 #include "flyenum.hxx"
30 #include "flypos.hxx"
31 #include "swdbdata.hxx"
32 #include <sfx2/objsh.hxx>
33 #include <svl/style.hxx>
34 #include <editeng/numitem.hxx>
35 #include "tox.hxx"
36 #include "frmfmt.hxx"
37 #include "charfmt.hxx"
38 #include "docary.hxx"
39 #include "pagedesc.hxx"
40 #include "tblenum.hxx"
41 #include "ndarr.hxx"
42 #include "ndtyp.hxx"
43 #include <atomic>
44 #include <memory>
45 #include <set>
46 #include <tuple>
47 #include <unordered_map>
48 #include <vector>
50 namespace editeng { class SvxBorderLine; }
52 class SwExtTextInput;
53 class EditFieldInfo;
54 class Outliner;
55 class OutputDevice;
56 class Point;
57 class SbxArray;
58 class SdrObject;
59 class SdrUndoAction;
60 class SvNumberFormatter;
61 class SvxMacro;
62 class SwAutoCompleteWord;
63 class SwAutoCorrExceptWord;
64 class SwCellFrame;
65 class SwCellStyleTable;
66 class SwCursorShell;
67 class SwCursor;
68 class SwDocShell;
69 class SwDrawView;
70 class SwEditShell;
71 class SwFormat;
72 class SwFormatINetFormat;
73 class SwFormatRefMark;
74 class SwFootnoteIdxs;
75 class SwFootnoteInfo;
76 class SwEndNoteInfo;
77 class SwLineNumberInfo;
78 class SwDBManager;
79 class SwNodeIndex;
80 class SwNodeRange;
81 class SwNumRule;
82 class SwPagePreviewPrtData;
83 class SwRootFrame;
84 class SwRubyListEntry;
85 class SwSectionFormat;
86 class SwSectionData;
87 class SwSelBoxes;
88 class SwTableAutoFormatTable;
89 class SwTOXBaseSection;
90 class SwTabCols;
91 class SwTable;
92 class SwTableAutoFormat;
93 class SwTableBox;
94 class SwTableBoxFormat;
95 class SwTableFormat;
96 class SwTableLineFormat;
97 class SwTableNode;
98 class SwTextBlocks;
99 class SwURLStateChanged;
100 class SwUnoCursor;
101 class SwViewShell;
102 class SwDrawContact;
103 class SdrView;
104 class SdrMarkList;
105 class SwAuthEntry;
106 class SwLayoutCache;
107 class IStyleAccess;
108 struct SwCallMouseEvent;
109 struct SwDocStat;
110 struct SwSortOptions;
111 struct SwDefTOXBase_Impl;
112 class SwPrintUIOptions;
113 struct SwConversionArgs;
114 class IGrammarContact;
115 class SwRenderData;
116 class IDocumentUndoRedo;
117 class IDocumentSettingAccess;
118 class IDocumentDeviceAccess;
119 class IDocumentDrawModelAccess;
120 class IDocumentChartDataProviderAccess;
121 class IDocumentTimerAccess;
122 class IDocumentLinksAdministration;
123 class IDocumentListItems;
124 class IDocumentListsAccess;
125 class IDocumentOutlineNodes;
126 class IDocumentContentOperations;
127 class IDocumentRedlineAccess;
128 class IDocumentStatistics;
129 class IDocumentState;
130 class IDocumentLayoutAccess;
131 class IDocumentStylePoolAccess;
132 class IDocumentExternalData;
133 class IDocumentMarkAccess;
134 class SetGetExpFields;
135 struct SwInsertTableOptions;
136 enum class SvMacroItemId : sal_uInt16;
137 enum class SvxFrameDirection;
138 enum class RndStdIds;
140 namespace sw::mark { class MarkManager; }
141 namespace sw {
142 enum class RedlineMode;
143 enum class FieldmarkMode;
144 class MetaFieldManager;
145 class UndoManager;
146 class IShellCursorSupplier;
147 class DocumentSettingManager;
148 class DocumentDeviceManager;
149 class DocumentDrawModelManager;
150 class DocumentChartDataProviderManager;
151 class DocumentTimerManager;
152 class DocumentLinksAdministrationManager;
153 class DocumentListItemsManager;
154 class DocumentListsManager;
155 class DocumentOutlineNodesManager;
156 class DocumentContentOperationsManager;
157 class DocumentRedlineManager;
158 class DocumentFieldsManager;
159 class DocumentStatisticsManager;
160 class DocumentStateManager;
161 class DocumentLayoutManager;
162 class DocumentStylePoolManager;
163 class DocumentExternalDataManager;
166 namespace com::sun::star {
167 namespace container {
168 class XNameContainer; //< for getXForms()/isXForms()/initXForms() methods
170 namespace embed { class XStorage; }
171 namespace linguistic2 { class XHyphenatedWord; }
172 namespace linguistic2 { class XProofreadingIterator; }
173 namespace linguistic2 { class XSpellChecker1; }
174 namespace script::vba { class XVBAEventProcessor; }
177 namespace sfx2 {
178 class IXmlIdRegistry;
181 void SetAllScriptItem( SfxItemSet& rSet, const SfxPoolItem& rItem );
183 using SwRubyList = std::vector<std::unique_ptr<SwRubyListEntry>>;
185 // Represents the model of a Writer document.
186 class SW_DLLPUBLIC SwDoc final
188 friend class ::sw::DocumentContentOperationsManager;
190 friend void InitCore();
191 friend void FinitCore();
193 // private Member
194 std::unique_ptr<SwNodes> m_pNodes; //< document content (Nodes Array)
195 SwAttrPool* mpAttrPool; //< the attribute pool
196 SwPageDescs m_PageDescs; //< PageDescriptors
197 Link<bool,void> maOle2Link; //< OLE 2.0-notification
198 /* @@@MAINTAINABILITY-HORROR@@@
199 Timer should not be members of the model
201 Idle maOLEModifiedIdle; //< Timer for update modified OLE-Objects
202 SwDBData maDBData; //< database descriptor
203 OUString msTOIAutoMarkURL; //< URL of table of index AutoMark file
204 std::vector<OUString> m_PatternNames; //< Array for names of document-templates
205 css::uno::Reference<css::container::XNameContainer>
206 mxXForms; //< container with XForms models
207 mutable css::uno::Reference< css::linguistic2::XProofreadingIterator > m_xGCIterator;
209 const std::unique_ptr< ::sw::mark::MarkManager> mpMarkManager;
210 const std::unique_ptr< ::sw::MetaFieldManager > m_pMetaFieldManager;
211 const std::unique_ptr< ::sw::DocumentDrawModelManager > m_pDocumentDrawModelManager;
212 const std::unique_ptr< ::sw::DocumentRedlineManager > m_pDocumentRedlineManager;
213 const std::unique_ptr< ::sw::DocumentStateManager > m_pDocumentStateManager;
214 const std::unique_ptr< ::sw::UndoManager > m_pUndoManager;
215 const std::unique_ptr< ::sw::DocumentSettingManager > m_pDocumentSettingManager;
216 const std::unique_ptr< ::sw::DocumentChartDataProviderManager > m_pDocumentChartDataProviderManager;
217 std::unique_ptr< ::sw::DocumentDeviceManager > m_pDeviceAccess;
218 const std::unique_ptr< ::sw::DocumentTimerManager > m_pDocumentTimerManager;
219 const std::unique_ptr< ::sw::DocumentLinksAdministrationManager > m_pDocumentLinksAdministrationManager;
220 const std::unique_ptr< ::sw::DocumentListItemsManager > m_pDocumentListItemsManager;
221 const std::unique_ptr< ::sw::DocumentListsManager > m_pDocumentListsManager;
222 const std::unique_ptr< ::sw::DocumentOutlineNodesManager > m_pDocumentOutlineNodesManager;
223 const std::unique_ptr< ::sw::DocumentContentOperationsManager > m_pDocumentContentOperationsManager;
224 const std::unique_ptr< ::sw::DocumentFieldsManager > m_pDocumentFieldsManager;
225 const std::unique_ptr< ::sw::DocumentStatisticsManager > m_pDocumentStatisticsManager;
226 const std::unique_ptr< ::sw::DocumentLayoutManager > m_pDocumentLayoutManager;
227 const std::unique_ptr< ::sw::DocumentStylePoolManager > m_pDocumentStylePoolManager;
228 const std::unique_ptr< ::sw::DocumentExternalDataManager > m_pDocumentExternalDataManager;
230 // Pointer
231 std::unique_ptr<SwFrameFormat> mpDfltFrameFormat; //< Default formats.
232 std::unique_ptr<SwFrameFormat> mpEmptyPageFormat; //< Format for the default empty page
233 std::unique_ptr<SwFrameFormat> mpColumnContFormat; //< Format for column container
234 std::unique_ptr<SwCharFormat> mpDfltCharFormat;
235 std::unique_ptr<SwTextFormatColl> mpDfltTextFormatColl; //< Defaultformatcollections
236 std::unique_ptr<SwGrfFormatColl> mpDfltGrfFormatColl;
238 std::unique_ptr<SwFrameFormats> mpFrameFormatTable; //< Format table
239 std::unique_ptr<SwCharFormats> mpCharFormatTable;
240 std::unique_ptr<SwFrameFormats> mpSpzFrameFormatTable;
241 std::unique_ptr<SwSectionFormats> mpSectionFormatTable;
242 std::unique_ptr<SwFrameFormats> mpTableFrameFormatTable; //< For tables
243 std::unique_ptr<SwTextFormatColls> mpTextFormatCollTable; //< FormatCollections
244 std::unique_ptr<SwGrfFormatColls> mpGrfFormatCollTable;
246 std::unique_ptr<SwTOXTypes> mpTOXTypes; //< Tables/indices
247 std::unique_ptr<SwDefTOXBase_Impl> mpDefTOXBases; //< defaults of SwTOXBase's
249 std::unique_ptr<SwDBManager, o3tl::default_delete<SwDBManager>> m_pOwnDBManager; //< own DBManager
250 SwDBManager * m_pDBManager; //< DBManager for evaluation of DB-fields.
252 SwNumRule *mpOutlineRule;
253 std::unique_ptr<SwFootnoteInfo> mpFootnoteInfo;
254 std::unique_ptr<SwEndNoteInfo> mpEndNoteInfo;
255 std::unique_ptr<SwLineNumberInfo> mpLineNumberInfo;
256 std::unique_ptr<SwFootnoteIdxs> mpFootnoteIdxs;
258 SwDocShell *mpDocShell; //< Ptr to SfxDocShell of Doc.
259 SfxObjectShellLock mxTmpDocShell; //< A temporary shell that is used to copy OLE-Nodes
261 std::unique_ptr<SwAutoCorrExceptWord> mpACEWord; /**< For the automated takeover of
262 auto-corrected words that are "re-corrected". */
263 std::unique_ptr<SwURLStateChanged> mpURLStateChgd; //< SfxClient for changes in INetHistory
264 std::atomic<SvNumberFormatter*> mpNumberFormatter; //< NumFormatter for tables / fields
266 mutable std::unique_ptr<SwNumRuleTable> mpNumRuleTable; //< List of all named NumRules.
268 // Hash map to find numrules by name
269 mutable std::unordered_map<OUString, SwNumRule *> maNumRuleMap;
271 std::unique_ptr<SwPagePreviewPrtData> m_pPgPViewPrtData; //< Indenting / spacing for printing of page view.
272 SwExtTextInput *mpExtInputRing;
274 std::unique_ptr<IStyleAccess> mpStyleAccess; //< handling of automatic styles
275 std::unique_ptr<SwLayoutCache> mpLayoutCache; /**< Layout cache to read and save with the
276 document for a faster formatting */
278 std::unique_ptr<IGrammarContact> mpGrammarContact; //< for grammar checking in paragraphs during editing
280 css::uno::Reference< css::script::vba::XVBAEventProcessor > mxVbaEvents;
281 css::uno::Reference<css::container::XNameContainer> m_xTemplateToProjectCache;
283 /// Table styles (autoformats that are applied with table changes).
284 std::unique_ptr<SwTableAutoFormatTable> m_pTableStyles;
285 /// Cell Styles not assigned to a Table Style
286 std::unique_ptr<SwCellStyleTable> mpCellStyles;
287 private:
288 std::unique_ptr< ::sfx2::IXmlIdRegistry > m_pXmlIdRegistry;
290 // other
292 sal_uInt32 mnRsid; //< current session ID of the document
293 sal_uInt32 mnRsidRoot; //< session ID when the document was created
295 oslInterlockedCount mReferenceCount;
297 bool mbDtor : 1; /**< TRUE: is in SwDoc DTOR.
298 and unfortunately temporarily also in
299 SwSwgReader::InLayout() when flawed
300 frames need deletion. */
301 bool mbCopyIsMove : 1; //< TRUE: Copy is a hidden Move.
302 bool mbInReading : 1; //< TRUE: Document is in the process of being read.
303 bool mbInWriting : 1; //< TRUE: Document is in the process of being written.
304 bool mbInMailMerge : 1; //< TRUE: Document is in the process of being written by mail merge.
305 bool mbInXMLImport : 1; //< TRUE: During xml import, attribute portion building is not necessary.
306 bool mbInWriterfilterImport : 1; //< TRUE: writerfilter import (DOCX,RTF)
307 bool mbUpdateTOX : 1; //< TRUE: After loading document, update TOX.
308 bool mbInLoadAsynchron : 1; //< TRUE: Document is in the process of being loaded asynchronously.
309 bool mbIsAutoFormatRedline : 1; //< TRUE: Redlines are recorded by Autoformat.
310 bool mbOLEPrtNotifyPending : 1; /**< TRUE: Printer has changed. At creation of View
311 notification of OLE-Objects PrtOLENotify() is required. */
312 bool mbAllOLENotify : 1; //< True: Notification of all objects is required.
313 bool mbInsOnlyTextGlssry : 1; //< True: insert 'only text' glossary into doc
314 bool mbContains_MSVBasic : 1; //< True: MS-VBasic exist is in our storage
315 bool mbClipBoard : 1; //< TRUE: this document represents the clipboard
316 bool mbColumnSelection : 1; //< TRUE: this content has been created by a column selection (clipboard docs only)
317 bool mbIsPrepareSelAll : 1;
319 enum MissingDictionary { False = -1, Undefined = 0, True = 1 };
320 MissingDictionary meDictionaryMissing;
322 // true: Document contains at least one anchored object, which is anchored AT_PAGE with a content position.
323 // Thus, certain adjustment needed during formatting for these kind of anchored objects.
324 bool mbContainsAtPageObjWithContentAnchor : 1;
326 static SwAutoCompleteWord *s_pAutoCompleteWords; //< List of all words for AutoComplete
328 // private methods
329 SwFlyFrameFormat* MakeFlySection_( const SwPosition& rAnchPos,
330 const SwContentNode& rNode, RndStdIds eRequestId,
331 const SfxItemSet* pFlyAttrSet,
332 SwFrameFormat* );
333 sal_Int8 SetFlyFrameAnchor( SwFrameFormat& rFlyFormat, SfxItemSet& rSet, bool bNewFrames );
335 typedef SwFormat* (SwDoc::*FNCopyFormat)( const OUString&, SwFormat*, bool, bool );
336 SwFormat* CopyFormat( const SwFormat& rFormat, const SwFormatsBase& rFormatArr,
337 FNCopyFormat fnCopyFormat, const SwFormat& rDfltFormat );
338 void CopyFormatArr( const SwFormatsBase& rSourceArr, SwFormatsBase const & rDestArr,
339 FNCopyFormat fnCopyFormat, SwFormat& rDfltFormat );
340 void CopyPageDescHeaderFooterImpl( bool bCpyHeader,
341 const SwFrameFormat& rSrcFormat, SwFrameFormat& rDestFormat );
343 SwDoc( const SwDoc &) = delete;
345 // Database fields:
346 void AddUsedDBToList( std::vector<OUString>& rDBNameList,
347 const std::vector<OUString>& rUsedDBNames );
348 void AddUsedDBToList( std::vector<OUString>& rDBNameList, const OUString& rDBName );
349 static bool IsNameInArray( const std::vector<OUString>& rOldNames, const OUString& rName );
350 void GetAllDBNames( std::vector<OUString>& rAllDBNames );
351 static OUString ReplaceUsedDBs( const std::vector<OUString>& rUsedDBNames,
352 const OUString& rNewName, const OUString& rFormula );
353 static std::vector<OUString>& FindUsedDBs( const std::vector<OUString>& rAllDBNames,
354 const OUString& rFormula,
355 std::vector<OUString>& rUsedDBNames );
357 void EnsureNumberFormatter();
359 bool UnProtectTableCells( SwTable& rTable );
361 /** Create sub-documents according to the given collection.
362 If no collection is given, take chapter style of the 1st level. */
363 bool SplitDoc( sal_uInt16 eDocType, const OUString& rPath, bool bOutline,
364 const SwTextFormatColl* pSplitColl, int nOutlineLevel = 0 );
366 // Update charts of given table.
367 void UpdateCharts_( const SwTable& rTable, SwViewShell const & rVSh ) const;
369 static bool SelectNextRubyChars( SwPaM& rPam, SwRubyListEntry& rRubyEntry );
371 // CharTimer calls this method.
372 void DoUpdateAllCharts();
373 DECL_LINK( DoUpdateModifiedOLE, Timer *, void );
375 public:
376 SwFormat *MakeCharFormat_(const OUString &, SwFormat *, bool, bool );
377 SwFormat *MakeFrameFormat_(const OUString &, SwFormat *, bool, bool );
379 private:
380 SwFormat *MakeTextFormatColl_(const OUString &, SwFormat *, bool, bool );
382 private:
383 OUString msDocAccTitle;
385 void InitTOXTypes();
387 public:
388 enum DocumentType {
389 DOCTYPE_NATIVE,
390 DOCTYPE_MSWORD // This doc model comes from MS Word
392 DocumentType meDocType;
393 DocumentType GetDocumentType() const { return meDocType; }
394 void SetDocumentType( DocumentType eDocType ) { meDocType = eDocType; }
396 // Life cycle
397 SwDoc();
398 ~SwDoc();
400 bool IsInDtor() const { return mbDtor; }
402 /* @@@MAINTAINABILITY-HORROR@@@
403 Implementation details made public.
405 SwNodes & GetNodes() { return *m_pNodes; }
406 SwNodes const& GetNodes() const { return *m_pNodes; }
408 private:
409 friend class ::rtl::Reference<SwDoc>;
411 /** Acquire a reference to an instance. A caller shall release
412 the instance by calling 'release' when it is no longer needed.
413 'acquire' and 'release' calls need to be balanced.
415 @returns
416 the current reference count of the instance for debugging purposes.
418 sal_Int32 acquire();
419 /** Releases a reference to an instance. A caller has to call
420 'release' when a before acquired reference to an instance
421 is no longer needed. 'acquire' and 'release' calls need to
422 be balanced.
424 @returns
425 the current reference count of the instance for debugging purposes.
427 sal_Int32 release();
428 /** Returns the current reference count. This method should be used for
429 debugging purposes. Using it otherwise is a signal of a design flaw.
431 public:
432 sal_Int32 getReferenceCount() const;
434 // IDocumentSettingAccess
435 IDocumentSettingAccess const & getIDocumentSettingAccess() const; //The IDocumentSettingAccess interface
436 IDocumentSettingAccess & getIDocumentSettingAccess();
437 ::sw::DocumentSettingManager & GetDocumentSettingManager(); //The implementation of the interface with some additional methods
438 ::sw::DocumentSettingManager const& GetDocumentSettingManager() const;
439 sal_uInt32 getRsid() const;
440 void setRsid( sal_uInt32 nVal );
441 sal_uInt32 getRsidRoot() const;
442 void setRsidRoot( sal_uInt32 nVal );
444 // IDocumentDeviceAccess
445 IDocumentDeviceAccess const & getIDocumentDeviceAccess() const;
446 IDocumentDeviceAccess & getIDocumentDeviceAccess();
448 // IDocumentMarkAccess
449 IDocumentMarkAccess* getIDocumentMarkAccess();
450 const IDocumentMarkAccess* getIDocumentMarkAccess() const;
452 // IDocumentRedlineAccess
453 IDocumentRedlineAccess const& getIDocumentRedlineAccess() const;
454 IDocumentRedlineAccess& getIDocumentRedlineAccess();
456 ::sw::DocumentRedlineManager const& GetDocumentRedlineManager() const;
457 ::sw::DocumentRedlineManager& GetDocumentRedlineManager();
459 // IDocumentUndoRedo
460 IDocumentUndoRedo & GetIDocumentUndoRedo();
461 IDocumentUndoRedo const& GetIDocumentUndoRedo() const;
463 // IDocumentLinksAdministration
464 IDocumentLinksAdministration const & getIDocumentLinksAdministration() const;
465 IDocumentLinksAdministration & getIDocumentLinksAdministration();
467 ::sw::DocumentLinksAdministrationManager const & GetDocumentLinksAdministrationManager() const;
468 ::sw::DocumentLinksAdministrationManager & GetDocumentLinksAdministrationManager();
470 // IDocumentFieldsAccess
471 IDocumentFieldsAccess const & getIDocumentFieldsAccess() const;
472 IDocumentFieldsAccess & getIDocumentFieldsAccess();
474 ::sw::DocumentFieldsManager & GetDocumentFieldsManager();
476 // Returns 0 if the field cannot hide para, or a positive integer indicating the field type
477 // "weight" when several hiding fields' FieldHidesPara() give conflicting results
478 int FieldCanHideParaWeight(SwFieldIds eFieldId) const;
479 bool FieldHidesPara(const SwField& rField) const;
481 // IDocumentContentOperations
482 IDocumentContentOperations const & getIDocumentContentOperations() const;
483 IDocumentContentOperations & getIDocumentContentOperations();
484 ::sw::DocumentContentOperationsManager const & GetDocumentContentOperationsManager() const;
485 ::sw::DocumentContentOperationsManager & GetDocumentContentOperationsManager();
487 bool UpdateParRsid( SwTextNode *pTextNode, sal_uInt32 nVal = 0 );
488 void UpdateRsid( const SwPaM &rRg, sal_Int32 nLen );
490 // IDocumentStylePoolAccess
491 IDocumentStylePoolAccess const & getIDocumentStylePoolAccess() const;
492 IDocumentStylePoolAccess & getIDocumentStylePoolAccess();
494 // SwLineNumberInfo
495 const SwLineNumberInfo& GetLineNumberInfo() const;
496 void SetLineNumberInfo(const SwLineNumberInfo& rInfo);
498 // IDocumentStatistics
499 IDocumentStatistics const & getIDocumentStatistics() const;
500 IDocumentStatistics & getIDocumentStatistics();
502 ::sw::DocumentStatisticsManager const & GetDocumentStatisticsManager() const;
503 ::sw::DocumentStatisticsManager & GetDocumentStatisticsManager();
505 // IDocumentState
506 IDocumentState const & getIDocumentState() const;
507 IDocumentState & getIDocumentState();
509 // IDocumentDrawModelAccess
510 void AddDrawUndo( std::unique_ptr<SdrUndoAction> );
511 IDocumentDrawModelAccess const & getIDocumentDrawModelAccess() const;
512 IDocumentDrawModelAccess & getIDocumentDrawModelAccess();
514 ::sw::DocumentDrawModelManager const & GetDocumentDrawModelManager() const;
515 ::sw::DocumentDrawModelManager & GetDocumentDrawModelManager();
517 // IDocumentLayoutAccess
518 IDocumentLayoutAccess const & getIDocumentLayoutAccess() const;
519 IDocumentLayoutAccess & getIDocumentLayoutAccess();
521 ::sw::DocumentLayoutManager const & GetDocumentLayoutManager() const;
522 ::sw::DocumentLayoutManager & GetDocumentLayoutManager();
524 // IDocumentTimerAccess
525 // Our own 'IdleTimer' calls the following method
526 IDocumentTimerAccess const & getIDocumentTimerAccess() const;
527 IDocumentTimerAccess & getIDocumentTimerAccess();
529 // IDocumentChartDataProviderAccess
530 IDocumentChartDataProviderAccess const & getIDocumentChartDataProviderAccess() const;
531 IDocumentChartDataProviderAccess & getIDocumentChartDataProviderAccess();
533 // IDocumentListItems
534 IDocumentListItems const & getIDocumentListItems() const;
535 IDocumentListItems & getIDocumentListItems();
537 // IDocumentOutlineNodes
538 IDocumentOutlineNodes const & getIDocumentOutlineNodes() const;
539 IDocumentOutlineNodes & getIDocumentOutlineNodes();
541 // IDocumentListsAccess
542 IDocumentListsAccess const & getIDocumentListsAccess() const;
543 IDocumentListsAccess & getIDocumentListsAccess();
545 //IDocumentExternalData
546 IDocumentExternalData const & getIDocumentExternalData() const;
547 IDocumentExternalData & getIDocumentExternalData();
549 //End of Interfaces
551 void setDocAccTitle( const OUString& rTitle ) { msDocAccTitle = rTitle; }
552 const OUString& getDocAccTitle() const { return msDocAccTitle; }
554 // INextInterface here
555 DECL_LINK(CalcFieldValueHdl, EditFieldInfo*, void);
557 // OLE ???
558 bool IsOLEPrtNotifyPending() const { return mbOLEPrtNotifyPending; }
559 inline void SetOLEPrtNotifyPending( bool bSet = true );
560 void PrtOLENotify( bool bAll ); // All or only marked
562 bool IsPrepareSelAll() const { return mbIsPrepareSelAll; }
563 void SetPrepareSelAll() { mbIsPrepareSelAll = true; }
565 void SetContainsAtPageObjWithContentAnchor( const bool bFlag )
567 mbContainsAtPageObjWithContentAnchor = bFlag;
569 bool DoesContainAtPageObjWithContentAnchor()
571 return mbContainsAtPageObjWithContentAnchor;
574 /** Returns positions of all FlyFrames in the document.
575 If a Pam-Pointer is passed the FlyFrames attached to paragraphs
576 have to be surrounded completely by css::awt::Selection.
577 ( Start < Pos < End ) !!!
578 (Required for Writers.) */
579 SwPosFlyFrames GetAllFlyFormats( const SwPaM*,
580 bool bDrawAlso,
581 bool bAsCharAlso = false ) const;
583 SwFlyFrameFormat *MakeFlyFrameFormat (const OUString &rFormatName, SwFrameFormat *pDerivedFrom);
584 SwDrawFrameFormat *MakeDrawFrameFormat(const OUString &rFormatName, SwFrameFormat *pDerivedFrom);
586 // From now on this interface has to be used for Flys.
587 // pAnchorPos must be set, if they are not attached to pages AND
588 // Anchor is not already set at valid ContentPos
589 // in FlySet/FrameFormat.
590 /* new parameter bCalledFromShell
592 true: An existing adjust item at pAnchorPos is propagated to
593 the content node of the new fly section. That propagation only
594 takes place if there is no adjust item in the paragraph style
595 for the new fly section.
597 false: no propagation
599 SwFlyFrameFormat* MakeFlySection( RndStdIds eAnchorType,
600 const SwPosition* pAnchorPos,
601 const SfxItemSet* pSet = nullptr,
602 SwFrameFormat *pParent = nullptr,
603 bool bCalledFromShell = false );
604 SwFlyFrameFormat* MakeFlyAndMove( const SwPaM& rPam, const SfxItemSet& rSet,
605 const SwSelBoxes* pSelBoxes,
606 SwFrameFormat *pParent );
608 // Helper that checks for unique items for DrawingLayer items of type NameOrIndex
609 // and evtl. corrects that items to ensure unique names for that type. This call may
610 // modify/correct entries inside of the given SfxItemSet, and it will apply a name to
611 // the items in question (what is essential to make the named slots associated with
612 // these items work for the UNO API and thus e.g. for ODF import/export)
613 void CheckForUniqueItemForLineFillNameOrIndex(SfxItemSet& rSet);
615 bool SetFlyFrameAttr( SwFrameFormat& rFlyFormat, SfxItemSet& rSet );
617 bool SetFrameFormatToFly( SwFrameFormat& rFlyFormat, SwFrameFormat& rNewFormat,
618 SfxItemSet* pSet = nullptr, bool bKeepOrient = false );
619 void SetFlyFrameTitle( SwFlyFrameFormat& rFlyFrameFormat,
620 const OUString& sNewTitle );
621 void SetFlyFrameDescription( SwFlyFrameFormat& rFlyFrameFormat,
622 const OUString& sNewDescription );
624 // Footnotes
625 // Footnote information
626 const SwFootnoteInfo& GetFootnoteInfo() const { return *mpFootnoteInfo; }
627 void SetFootnoteInfo(const SwFootnoteInfo& rInfo);
628 const SwEndNoteInfo& GetEndNoteInfo() const { return *mpEndNoteInfo; }
629 void SetEndNoteInfo(const SwEndNoteInfo& rInfo);
630 SwFootnoteIdxs& GetFootnoteIdxs() { return *mpFootnoteIdxs; }
631 const SwFootnoteIdxs& GetFootnoteIdxs() const { return *mpFootnoteIdxs; }
632 /// change footnotes in range
633 bool SetCurFootnote( const SwPaM& rPam, const OUString& rNumStr,
634 bool bIsEndNote );
636 /** Operations on the content of the document e.g.
637 spell-checking/hyphenating/word-counting
639 css::uno::Any
640 Spell( SwPaM&, css::uno::Reference< css::linguistic2::XSpellChecker1 > const &,
641 sal_uInt16* pPageCnt, sal_uInt16* pPageSt, bool bGrammarCheck,
642 SwRootFrame const* pLayout, // for grammar-check
643 SwConversionArgs *pConvArgs = nullptr ) const;
645 css::uno::Reference< css::linguistic2::XHyphenatedWord >
646 Hyphenate( SwPaM *pPam, const Point &rCursorPos,
647 sal_uInt16* pPageCnt, sal_uInt16* pPageSt );
649 // count words in pam
650 static void CountWords( const SwPaM& rPaM, SwDocStat& rStat );
652 // Glossary Document
653 bool IsInsOnlyTextGlossary() const { return mbInsOnlyTextGlssry; }
655 void Summary(SwDoc& rExtDoc, sal_uInt8 nLevel, sal_uInt8 nPara, bool bImpress);
657 void ChangeAuthorityData(const SwAuthEntry* pNewData);
659 bool IsInHeaderFooter( const SwNodeIndex& rIdx ) const;
660 SvxFrameDirection GetTextDirection( const SwPosition& rPos,
661 const Point* pPt = nullptr ) const;
662 bool IsInVerticalText( const SwPosition& rPos ) const;
664 // Database and DB-Manager
665 void SetDBManager( SwDBManager* pNewMgr ) { m_pDBManager = pNewMgr; }
666 SwDBManager* GetDBManager() const { return m_pDBManager; }
667 void ChangeDBFields( const std::vector<OUString>& rOldNames,
668 const OUString& rNewName );
669 void SetInitDBFields(bool b);
671 // Find out which databases are used by fields.
672 void GetAllUsedDB( std::vector<OUString>& rDBNameList,
673 const std::vector<OUString>* pAllDBNames = nullptr );
675 void ChgDBData( const SwDBData& rNewData );
676 SwDBData const & GetDBData();
677 const SwDBData& GetDBDesc();
679 // Some helper functions
680 OUString GetUniqueGrfName() const;
681 OUString GetUniqueOLEName() const;
682 OUString GetUniqueFrameName() const;
683 OUString GetUniqueShapeName() const;
684 OUString GetUniqueDrawObjectName() const;
686 o3tl::sorted_vector<SwRootFrame*> GetAllLayouts();
688 void SetFlyName( SwFlyFrameFormat& rFormat, const OUString& rName );
689 const SwFlyFrameFormat* FindFlyByName( const OUString& rName, SwNodeType nNdTyp = SwNodeType::NONE ) const;
691 static void GetGrfNms( const SwFlyFrameFormat& rFormat, OUString* pGrfName, OUString* pFltName );
693 // Set a valid name for all Flys that have none (Called by Readers after reading).
694 void SetAllUniqueFlyNames();
696 /** Reset attributes. All TextHints and (if completely selected) all hard-
697 formatted stuff (auto-formats) are removed.
698 Introduce new optional parameter <bSendDataChangedEvents> in order to
699 control, if the side effect "send data changed events" is triggered or not. */
700 void ResetAttrs( const SwPaM &rRg,
701 bool bTextAttr = true,
702 const o3tl::sorted_vector<sal_uInt16> &rAttrs = o3tl::sorted_vector<sal_uInt16>(),
703 const bool bSendDataChangedEvents = true,
704 SwRootFrame const* pLayout = nullptr);
705 void RstTextAttrs(const SwPaM &rRg, bool bInclRefToxMark = false,
706 bool bExactRange = false, SwRootFrame const* pLayout = nullptr);
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 SfxPoolItem&, SwFormat& );
711 /** Set attribute in given format.1y
712 * If Undo is enabled, the old values is added to the Undo history. */
713 void SetAttr( const SfxItemSet&, SwFormat& );
715 // method to reset a certain attribute at the given format
716 void ResetAttrAtFormat( const sal_uInt16 nWhichId,
717 SwFormat& rChangedFormat );
719 /** Set attribute as new default attribute in current document.
720 If Undo is activated, the old one is listed in Undo-History. */
721 void SetDefault( const SfxPoolItem& );
722 void SetDefault( const SfxItemSet& );
724 // Query default attribute in this document.
725 const SfxPoolItem& GetDefault( sal_uInt16 nFormatHint ) const;
726 template<class T> const T& GetDefault( TypedWhichId<T> nWhich ) const
728 return static_cast<const T&>(GetDefault(sal_uInt16(nWhich)));
731 // Do not expand text attributes.
732 bool DontExpandFormat( const SwPosition& rPos, bool bFlag = true );
734 // Formats
735 const SwFrameFormats* GetFrameFormats() const { return mpFrameFormatTable.get(); }
736 SwFrameFormats* GetFrameFormats() { return mpFrameFormatTable.get(); }
737 const SwCharFormats* GetCharFormats() const { return mpCharFormatTable.get();}
738 SwCharFormats* GetCharFormats() { return mpCharFormatTable.get();}
740 // LayoutFormats (frames, DrawObjects), sometimes const sometimes not
741 const SwFrameFormats* GetSpzFrameFormats() const { return mpSpzFrameFormatTable.get(); }
742 SwFrameFormats* GetSpzFrameFormats() { return mpSpzFrameFormatTable.get(); }
744 const SwFrameFormat *GetDfltFrameFormat() const { return mpDfltFrameFormat.get(); }
745 SwFrameFormat *GetDfltFrameFormat() { return mpDfltFrameFormat.get(); }
746 const SwFrameFormat *GetEmptyPageFormat() const { return mpEmptyPageFormat.get(); }
747 SwFrameFormat *GetEmptyPageFormat() { return mpEmptyPageFormat.get(); }
748 const SwFrameFormat *GetColumnContFormat() const{ return mpColumnContFormat.get(); }
749 SwFrameFormat *GetColumnContFormat() { return mpColumnContFormat.get(); }
750 const SwCharFormat *GetDfltCharFormat() const { return mpDfltCharFormat.get();}
751 SwCharFormat *GetDfltCharFormat() { return mpDfltCharFormat.get();}
753 // @return the interface of the management of (auto)styles
754 IStyleAccess& GetIStyleAccess() { return *mpStyleAccess; }
756 // Remove all language dependencies from all existing formats
757 void RemoveAllFormatLanguageDependencies();
759 static SwFormat* FindFormatByName(const SwFormatsBase& rFormatArr, const OUString& rName);
761 SwFrameFormat *MakeFrameFormat(const OUString &rFormatName, SwFrameFormat *pDerivedFrom,
762 bool bBroadcast = false, bool bAuto = true);
763 void DelFrameFormat( SwFrameFormat *pFormat, bool bBroadcast = false );
764 SwFrameFormat* FindFrameFormatByName( const OUString& rName ) const;
766 SwCharFormat *MakeCharFormat(const OUString &rFormatName, SwCharFormat *pDerivedFrom,
767 bool bBroadcast = false );
768 void DelCharFormat(size_t nFormat, bool bBroadcast = false);
769 void DelCharFormat(SwCharFormat const * pFormat, bool bBroadcast = false);
770 SwCharFormat* FindCharFormatByName( const OUString& rName ) const
771 { return static_cast<SwCharFormat*>(FindFormatByName( *mpCharFormatTable, rName )); }
773 // Formatcollections (styles)
774 // TXT
775 const SwTextFormatColl* GetDfltTextFormatColl() const { return mpDfltTextFormatColl.get(); }
776 SwTextFormatColl* GetDfltTextFormatColl() { return mpDfltTextFormatColl.get(); }
777 const SwTextFormatColls *GetTextFormatColls() const { return mpTextFormatCollTable.get(); }
778 SwTextFormatColls *GetTextFormatColls() { return mpTextFormatCollTable.get(); }
779 SwTextFormatColl *MakeTextFormatColl( const OUString &rFormatName,
780 SwTextFormatColl *pDerivedFrom,
781 bool bBroadcast = false);
782 SwConditionTextFormatColl* MakeCondTextFormatColl( const OUString &rFormatName,
783 SwTextFormatColl *pDerivedFrom,
784 bool bBroadcast = false);
785 void DelTextFormatColl(size_t nFormat, bool bBroadcast = false);
786 void DelTextFormatColl( SwTextFormatColl const * pColl, bool bBroadcast = false );
787 /** Add 4th optional parameter <bResetListAttrs>.
788 'side effect' of <SetTextFormatColl> with <bReset = true> is that the hard
789 attributes of the affected text nodes are cleared, except the break
790 attribute, the page description attribute and the list style attribute.
791 The new parameter <bResetListAttrs> indicates, if the list attributes
792 (list style, restart at and restart with) are cleared as well in case
793 that <bReset = true> and the paragraph style has a list style attribute set. */
794 bool SetTextFormatColl(const SwPaM &rRg, SwTextFormatColl *pFormat,
795 const bool bReset = true,
796 const bool bResetListAttrs = false,
797 SwRootFrame const* pLayout = nullptr);
798 SwTextFormatColl* FindTextFormatCollByName( const OUString& rName ) const
799 { return static_cast<SwTextFormatColl*>(FindFormatByName( *mpTextFormatCollTable, rName )); }
801 void ChkCondColls();
803 const SwGrfFormatColl* GetDfltGrfFormatColl() const { return mpDfltGrfFormatColl.get(); }
804 SwGrfFormatColl* GetDfltGrfFormatColl() { return mpDfltGrfFormatColl.get(); }
805 const SwGrfFormatColls *GetGrfFormatColls() const { return mpGrfFormatCollTable.get(); }
806 SwGrfFormatColl *MakeGrfFormatColl(const OUString &rFormatName,
807 SwGrfFormatColl *pDerivedFrom);
809 // Table formatting
810 const SwFrameFormats* GetTableFrameFormats() const { return mpTableFrameFormatTable.get(); }
811 SwFrameFormats* GetTableFrameFormats() { return mpTableFrameFormatTable.get(); }
812 size_t GetTableFrameFormatCount( bool bUsed ) const;
813 SwFrameFormat& GetTableFrameFormat(size_t nFormat, bool bUsed ) const;
814 SwTableFormat* MakeTableFrameFormat(const OUString &rFormatName, SwFrameFormat *pDerivedFrom);
815 void DelTableFrameFormat( SwTableFormat* pFormat );
816 SwTableFormat* FindTableFormatByName( const OUString& rName, bool bAll = false ) const;
818 /** Access to frames.
819 Iterate over Flys - for Basic-Collections. */
820 size_t GetFlyCount( FlyCntType eType, bool bIgnoreTextBoxes = false ) const;
821 SwFrameFormat* GetFlyNum(size_t nIdx, FlyCntType eType, bool bIgnoreTextBoxes = false );
822 std::vector<SwFrameFormat const*> GetFlyFrameFormats(
823 FlyCntType eType,
824 bool bIgnoreTextBoxes);
826 // Copy formats in own arrays and return them.
827 SwFrameFormat *CopyFrameFormat ( const SwFrameFormat& );
828 SwCharFormat *CopyCharFormat( const SwCharFormat& );
829 SwTextFormatColl* CopyTextColl( const SwTextFormatColl& rColl );
830 SwGrfFormatColl* CopyGrfColl( const SwGrfFormatColl& rColl );
832 // Replace all styles with those from rSource.
833 void ReplaceStyles( const SwDoc& rSource, bool bIncludePageStyles = true );
835 // Replace all property defaults with those from rSource.
836 void ReplaceDefaults( const SwDoc& rSource );
838 // Replace all compatibility options with those from rSource.
839 void ReplaceCompatibilityOptions( const SwDoc& rSource );
841 /** Replace all user defined document properties with xSourceDocProps.
842 Convenience function used by ReplaceDocumentProperties to skip some UNO calls.
844 void ReplaceUserDefinedDocumentProperties( const css::uno::Reference< css::document::XDocumentProperties >& xSourceDocProps );
846 /** Replace document properties with those from rSource.
848 This includes the user defined document properties!
850 void ReplaceDocumentProperties(const SwDoc& rSource, bool mailMerge = false);
852 // Query if style (paragraph- / character- / frame- / page-) is used.
853 bool IsUsed( const sw::BroadcastingModify& ) const;
854 /// Query if table style is used.
855 bool IsUsed( const SwTableAutoFormat& ) const;
856 bool IsUsed( const SwNumRule& );
858 // Set name of newly loaded document template.
859 size_t SetDocPattern(const OUString& rPatternName);
861 // @return name of document template. Can be 0!
862 const OUString* GetDocPattern(size_t nPos) const;
864 // travel over PaM Ring
865 bool InsertGlossary( SwTextBlocks& rBlock, const OUString& rEntry,
866 SwPaM& rPaM, SwCursorShell* pShell = nullptr);
868 /** get the set of printable pages for the XRenderable API by
869 evaluating the respective settings (see implementation) */
870 static void CalculatePagesForPrinting( const SwRootFrame& rLayout, SwRenderData &rData, const SwPrintUIOptions &rOptions, bool bIsPDFExport,
871 sal_Int32 nDocPageCount );
872 static void UpdatePagesForPrintingWithPostItData( SwRenderData &rData, const SwPrintUIOptions &rOptions,
873 sal_Int32 nDocPageCount );
874 static void CalculatePagePairsForProspectPrinting( const SwRootFrame& rLayout, SwRenderData &rData, const SwPrintUIOptions &rOptions,
875 sal_Int32 nDocPageCount );
876 static void CalculateNonBlankPages( const SwRootFrame& rLayout, sal_uInt16& nDocPageCount, sal_uInt16& nActualPage );
878 // PageDescriptor interface.
879 size_t GetPageDescCnt() const { return m_PageDescs.size(); }
880 const SwPageDesc& GetPageDesc(const size_t i) const { return *m_PageDescs[i]; }
881 SwPageDesc& GetPageDesc(size_t const i) { return *m_PageDescs[i]; }
882 SwPageDesc* FindPageDesc(const OUString& rName, size_t* pPos = nullptr) const;
883 // Just searches the pointer in the m_PageDescs vector!
884 bool ContainsPageDesc(const SwPageDesc *pDesc, size_t* pPos) const;
886 /** Copy the complete PageDesc - beyond document and "deep"!
887 Optionally copying of PoolFormatId, -HlpId can be prevented. */
888 void CopyPageDesc( const SwPageDesc& rSrcDesc, SwPageDesc& rDstDesc,
889 bool bCopyPoolIds = true );
891 /** Copy header (with contents) from SrcFormat to DestFormat
892 (can also be copied into other document). */
893 void CopyHeader( const SwFrameFormat& rSrcFormat, SwFrameFormat& rDestFormat )
894 { CopyPageDescHeaderFooterImpl( true, rSrcFormat, rDestFormat ); }
896 /** Copy footer (with contents) from SrcFormat to DestFormat.
897 (can also be copied into other document). */
898 void CopyFooter( const SwFrameFormat& rSrcFormat, SwFrameFormat& rDestFormat )
899 { CopyPageDescHeaderFooterImpl( false, rSrcFormat, rDestFormat ); }
901 // For Reader
902 void ChgPageDesc( const OUString & rName, const SwPageDesc& );
903 void ChgPageDesc( size_t i, const SwPageDesc& );
904 void DelPageDesc( const OUString & rName, bool bBroadcast = false);
905 void DelPageDesc( size_t i, bool bBroadcast = false );
906 void PreDelPageDesc(SwPageDesc const * pDel);
907 SwPageDesc* MakePageDesc(const OUString &rName, const SwPageDesc* pCpy = nullptr,
908 bool bRegardLanguage = true,
909 bool bBroadcast = false);
910 void BroadcastStyleOperation(const OUString& rName, SfxStyleFamily eFamily,
911 SfxHintId nOp);
913 /** The html import sometimes overwrites the page sizes set in
914 the page descriptions. This function is used to correct this. */
915 void CheckDefaultPageFormat();
917 // Methods for tables/indices
918 static sal_uInt16 GetCurTOXMark( const SwPosition& rPos, SwTOXMarks& );
919 void DeleteTOXMark( const SwTOXMark* pTOXMark );
920 const SwTOXMark& GotoTOXMark( const SwTOXMark& rCurTOXMark,
921 SwTOXSearch eDir, bool bInReadOnly );
923 // Insert/Renew table/index
924 SwTOXBaseSection* InsertTableOf( const SwPosition& rPos,
925 const SwTOXBase& rTOX,
926 const SfxItemSet* pSet = nullptr,
927 bool bExpand = false,
928 SwRootFrame const* pLayout = nullptr);
929 SwTOXBaseSection* InsertTableOf( const SwPaM& aPam,
930 const SwTOXBase& rTOX,
931 const SfxItemSet* pSet = nullptr,
932 bool bExpand = false,
933 SwRootFrame const* pLayout = nullptr );
934 void InsertTableOf( sal_uLong nSttNd, sal_uLong nEndNd,
935 const SwTOXBase& rTOX,
936 const SfxItemSet* pSet );
937 static SwTOXBase* GetCurTOX( const SwPosition& rPos );
938 static const SwAttrSet& GetTOXBaseAttrSet(const SwTOXBase& rTOX);
940 bool DeleteTOX( const SwTOXBase& rTOXBase, bool bDelNodes );
941 OUString GetUniqueTOXBaseName( const SwTOXType& rType,
942 const OUString& sChkStr ) const;
944 bool SetTOXBaseName(const SwTOXBase& rTOXBase, const OUString& rName);
946 // After reading file update all tables/indices
947 void SetUpdateTOX( bool bFlag ) { mbUpdateTOX = bFlag; }
948 bool IsUpdateTOX() const { return mbUpdateTOX; }
950 const OUString& GetTOIAutoMarkURL() const {return msTOIAutoMarkURL;}
951 void SetTOIAutoMarkURL(const OUString& rSet) {msTOIAutoMarkURL = rSet;}
953 bool IsInReading() const { return mbInReading; }
954 void SetInReading( bool bNew ) { mbInReading = bNew; }
956 bool IsInWriting() const { return mbInWriting; }
957 void SetInWriting(bool bNew) { mbInWriting = bNew; }
959 bool IsInMailMerge() const { return mbInMailMerge; }
960 void SetInMailMerge( bool bNew ) { mbInMailMerge = bNew; }
962 bool IsClipBoard() const { return mbClipBoard; }
963 // N.B.: must be called right after constructor! (@see GetXmlIdRegistry)
964 void SetClipBoard( bool bNew ) { mbClipBoard = bNew; }
966 bool IsColumnSelection() const { return mbColumnSelection; }
967 void SetColumnSelection( bool bNew ) { mbColumnSelection = bNew; }
969 bool IsInXMLImport() const { return mbInXMLImport; }
970 void SetInXMLImport( bool bNew ) { mbInXMLImport = bNew; }
971 bool IsInWriterfilterImport() const { return mbInWriterfilterImport; }
972 void SetInWriterfilterImport(bool const b) { mbInWriterfilterImport = b; }
974 // Manage types of tables/indices
975 sal_uInt16 GetTOXTypeCount( TOXTypes eTyp ) const;
976 const SwTOXType* GetTOXType( TOXTypes eTyp, sal_uInt16 nId ) const;
977 const SwTOXType* InsertTOXType( const SwTOXType& rTyp );
978 const SwTOXTypes& GetTOXTypes() const { return *mpTOXTypes; }
980 const SwTOXBase* GetDefaultTOXBase( TOXTypes eTyp, bool bCreate );
981 void SetDefaultTOXBase(const SwTOXBase& rBase);
983 // Key for management of index.
984 void GetTOIKeys(SwTOIKeyType eTyp, std::vector<OUString>& rArr,
985 SwRootFrame const& rLayout) const;
987 // Sort table text.
988 bool SortTable(const SwSelBoxes& rBoxes, const SwSortOptions&);
989 bool SortText(const SwPaM&, const SwSortOptions&);
991 // Correct the SwPosition-Objects that are registered with the document
992 // e. g. Bookmarks or tables/indices.
993 // If bMoveCursor is set move Cursor too.
995 // Set everything in rOldNode on rNewPos + Offset.
996 void CorrAbs(
997 const SwNodeIndex& rOldNode,
998 const SwPosition& rNewPos,
999 const sal_Int32 nOffset = 0,
1000 bool bMoveCursor = false );
1002 // Set everything in the range of [rStartNode, rEndNode] to rNewPos.
1003 static void CorrAbs(
1004 const SwNodeIndex& rStartNode,
1005 const SwNodeIndex& rEndNode,
1006 const SwPosition& rNewPos,
1007 bool bMoveCursor = false );
1009 // Set everything in this range from rRange to rNewPos.
1010 static void CorrAbs(
1011 const SwPaM& rRange,
1012 const SwPosition& rNewPos,
1013 bool bMoveCursor = false );
1015 // Set everything in rOldNode to relative Pos.
1016 void CorrRel(
1017 const SwNodeIndex& rOldNode,
1018 const SwPosition& rNewPos,
1019 const sal_Int32 nOffset = 0,
1020 bool bMoveCursor = false );
1022 // Query / set rules for Outline.
1023 SwNumRule* GetOutlineNumRule() const
1025 return mpOutlineRule;
1027 void SetOutlineNumRule( const SwNumRule& rRule );
1028 void PropagateOutlineRule();
1030 // Outline - promote / demote.
1031 bool OutlineUpDown(const SwPaM& rPam, short nOffset, SwRootFrame const* pLayout = nullptr);
1033 /// Outline - move up / move down.
1034 bool MoveOutlinePara( const SwPaM& rPam, SwOutlineNodes::difference_type nOffset);
1036 bool GotoOutline(SwPosition& rPos, const OUString& rName, SwRootFrame const* = nullptr) const;
1038 /** Accept changes of outline styles for OutlineRule.
1039 @param bResetIndentAttrs Optional parameter - default value false:
1040 If <bResetIndentAttrs> equals true, the indent attributes "before text"
1041 and "first line indent" are additionally reset at the provided PaM, if
1042 the list style makes use of the new list level attributes.
1043 @param bCreateNewList indicates if a new list is created by applying the given list style.
1044 @param sContinuedListId If bCreateNewList is false, may contain the
1045 list Id of a list which has to be continued by applying the given list style
1047 @return the set ListId if bSetItem is true */
1048 OUString SetNumRule( const SwPaM&,
1049 const SwNumRule&,
1050 bool bCreateNewList,
1051 SwRootFrame const* pLayout = nullptr,
1052 const OUString& sContinuedListId = OUString(),
1053 bool bSetItem = true,
1054 const bool bResetIndentAttrs = false );
1055 void SetCounted(const SwPaM&, bool bCounted, SwRootFrame const* pLayout);
1057 void MakeUniqueNumRules(const SwPaM & rPaM);
1059 void SetNumRuleStart( const SwPosition& rPos, bool bFlag = true );
1060 void SetNodeNumStart( const SwPosition& rPos, sal_uInt16 nStt );
1062 // sw_redlinehide: may set rPos to different node (the one with the NumRule)
1063 static SwNumRule* GetNumRuleAtPos(SwPosition& rPos, SwRootFrame const* pLayout = nullptr);
1065 const SwNumRuleTable& GetNumRuleTable() const { return *mpNumRuleTable; }
1068 Add numbering rule to document.
1070 @param pRule rule to add
1072 void AddNumRule(SwNumRule * pRule);
1074 // add optional parameter <eDefaultNumberFormatPositionAndSpaceMode>
1075 sal_uInt16 MakeNumRule( const OUString &rName,
1076 const SwNumRule* pCpy = nullptr,
1077 bool bBroadcast = false,
1078 const SvxNumberFormat::SvxNumPositionAndSpaceMode eDefaultNumberFormatPositionAndSpaceMode =
1079 SvxNumberFormat::LABEL_WIDTH_AND_POSITION );
1080 sal_uInt16 FindNumRule( const OUString& rName ) const;
1081 SwNumRule* FindNumRulePtr( const OUString& rName ) const;
1083 // Deletion only possible if Rule is not used!
1084 bool RenameNumRule(const OUString & aOldName, const OUString & aNewName,
1085 bool bBroadcast = false);
1086 bool DelNumRule( const OUString& rName, bool bBroadCast = false );
1087 OUString GetUniqueNumRuleName( const OUString* pChkStr = nullptr, bool bAutoNum = true ) const;
1089 void UpdateNumRule(); // Update all invalids.
1090 void ChgNumRuleFormats( const SwNumRule& rRule );
1091 bool ReplaceNumRule( const SwPosition& rPos, const OUString& rOldRule,
1092 const OUString& rNewRule );
1094 // Goto next/previous on same level.
1095 static bool GotoNextNum( SwPosition&, SwRootFrame const* pLayout,
1096 bool bOverUpper = true,
1097 sal_uInt8* pUpper = nullptr, sal_uInt8* pLower = nullptr );
1098 static bool GotoPrevNum( SwPosition&, SwRootFrame const* pLayout,
1099 bool bOverUpper = true );
1101 /** Searches for a text node with a numbering rule.
1103 add optional parameter <bInvestigateStartNode>
1104 add output parameter <sListId>
1106 \param rPos position to start search
1107 \param bForward - true: search forward
1108 - false: search backward
1109 \param bNum - true: search for enumeration
1110 - false: search for itemize
1111 \param bOutline - true: search for outline numbering rule
1112 - false: search for non-outline numbering rule
1113 \param nNonEmptyAllowed number of non-empty paragraphs allowed between
1114 rPos and found paragraph
1116 @param sListId
1117 output parameter - in case a list style is found, <sListId> holds the
1118 list id, to which the text node belongs, which applies the found list style.
1120 @param bInvestigateStartNode
1121 input parameter - boolean, indicating, if start node, determined by given
1122 start position has to be investigated or not.
1124 const SwNumRule * SearchNumRule(const SwPosition & rPos,
1125 const bool bForward,
1126 const bool bNum,
1127 const bool bOutline,
1128 int nNonEmptyAllowed,
1129 OUString& sListId,
1130 SwRootFrame const* pLayout,
1131 const bool bInvestigateStartNode = false );
1133 // Paragraphs without numbering but with indents.
1134 bool NoNum( const SwPaM& );
1136 // Delete, splitting of numbering list.
1137 void DelNumRules(const SwPaM&, SwRootFrame const* pLayout = nullptr);
1139 // Invalidates all numrules
1140 void InvalidateNumRules();
1142 bool NumUpDown(const SwPaM&, bool bDown, SwRootFrame const* pLayout = nullptr);
1144 /** Move selected paragraphs (not only numberings)
1145 according to offsets. (if negative: go to doc start). */
1146 bool MoveParagraph(SwPaM&, tools::Long nOffset, bool bIsOutlMv = false);
1147 bool MoveParagraphImpl(SwPaM&, tools::Long nOffset, bool bIsOutlMv, SwRootFrame const*);
1149 bool NumOrNoNum( const SwNodeIndex& rIdx, bool bDel = false);
1151 void StopNumRuleAnimations( const OutputDevice* );
1153 /** Insert new table at position @param rPos (will be inserted before Node!).
1154 For AutoFormat at input: columns have to be set at predefined width.
1155 The array holds the positions of the columns (not their widths).
1156 new @param bCalledFromShell:
1157 true: called from shell -> propagate existing adjust item at
1158 rPos to every new cell. A existing adjust item in the table
1159 heading or table contents paragraph style prevent that
1160 propagation.
1161 false: do not propagate
1163 const SwTable* InsertTable( const SwInsertTableOptions& rInsTableOpts, // HeadlineNoBorder
1164 const SwPosition& rPos, sal_uInt16 nRows,
1165 sal_uInt16 nCols, sal_Int16 eAdjust,
1166 const SwTableAutoFormat* pTAFormat = nullptr,
1167 const std::vector<sal_uInt16> *pColArr = nullptr,
1168 bool bCalledFromShell = false,
1169 bool bNewModel = true );
1171 // If index is in a table, return TableNode, else 0.
1172 SwTableNode* IsIdxInTable( const SwNodeIndex& rIdx );
1173 inline const SwTableNode* IsIdxInTable( const SwNodeIndex& rIdx ) const;
1175 // Create a balanced table out of the selected range.
1176 const SwTable* TextToTable( const SwInsertTableOptions& rInsTableOpts, // HeadlineNoBorder,
1177 const SwPaM& rRange, sal_Unicode cCh,
1178 sal_Int16 eAdjust,
1179 const SwTableAutoFormat* );
1181 // text to table conversion - API support
1182 const SwTable* TextToTable( const std::vector< std::vector<SwNodeRange> >& rTableNodes );
1184 bool TableToText( const SwTableNode* pTableNd, sal_Unicode cCh );
1186 // Create columns / rows in table.
1187 void InsertCol( const SwCursor& rCursor,
1188 sal_uInt16 nCnt = 1, bool bBehind = true );
1189 bool InsertCol( const SwSelBoxes& rBoxes,
1190 sal_uInt16 nCnt = 1, bool bBehind = true );
1191 void InsertRow( const SwCursor& rCursor,
1192 sal_uInt16 nCnt = 1, bool bBehind = true );
1193 bool InsertRow( const SwSelBoxes& rBoxes,
1194 sal_uInt16 nCnt = 1, bool bBehind = true );
1196 // Delete Columns/Rows in table.
1197 bool DeleteRowCol( const SwSelBoxes& rBoxes, bool bColumn = false );
1198 void DeleteRow( const SwCursor& rCursor );
1199 void DeleteCol( const SwCursor& rCursor );
1201 // Split / concatenate boxes in table.
1202 bool SplitTable( const SwSelBoxes& rBoxes, bool bVert,
1203 sal_uInt16 nCnt, bool bSameHeight = false );
1205 TableMergeErr MergeTable( SwPaM& rPam );
1206 OUString GetUniqueTableName() const;
1207 bool IsInsTableFormatNum() const;
1208 bool IsInsTableChangeNumFormat() const;
1209 bool IsInsTableAlignNum() const;
1210 bool IsSplitVerticalByDefault() const;
1211 void SetSplitVerticalByDefault(bool value);
1213 // From FEShell (for Undo and BModified).
1214 static void GetTabCols( SwTabCols &rFill, const SwCellFrame* pBoxFrame );
1215 void SetTabCols( const SwTabCols &rNew, bool bCurRowOnly,
1216 const SwCellFrame* pBoxFrame );
1217 static void GetTabRows( SwTabCols &rFill, const SwCellFrame* pBoxFrame );
1218 void SetTabRows( const SwTabCols &rNew, bool bCurColOnly,
1219 const SwCellFrame* pBoxFrame );
1221 // Direct access for UNO.
1222 void SetTabCols(SwTable& rTab, const SwTabCols &rNew, const SwTabCols &rOld,
1223 const SwTableBox *pStart, bool bCurRowOnly);
1225 void SetRowsToRepeat( SwTable &rTable, sal_uInt16 nSet );
1227 /// AutoFormat for table/table selection.
1228 /// @param bResetDirect Reset direct formatting that might be applied to the cells.
1229 bool SetTableAutoFormat(const SwSelBoxes& rBoxes, const SwTableAutoFormat& rNew, bool bResetDirect = false, bool isSetStyleName = false);
1231 // Query attributes.
1232 bool GetTableAutoFormat( const SwSelBoxes& rBoxes, SwTableAutoFormat& rGet );
1234 /// Return the available table styles.
1235 SwTableAutoFormatTable& GetTableStyles();
1236 const SwTableAutoFormatTable& GetTableStyles() const
1238 return const_cast<SwDoc*>(this)->GetTableStyles();
1240 /// Counts table styles without triggering lazy-load of them.
1241 bool HasTableStyles() const { return m_pTableStyles != nullptr; }
1242 // Create a new table style. Tracked by Undo.
1243 SwTableAutoFormat* MakeTableStyle(const OUString& rName, bool bBroadcast = false);
1244 // Delete table style named rName. Tracked by undo.
1245 std::unique_ptr<SwTableAutoFormat> DelTableStyle(const OUString& rName, bool bBroadcast = false);
1246 // Change (replace) a table style named rName. Tracked by undo.
1247 void ChgTableStyle(const OUString& rName, const SwTableAutoFormat& rNewFormat);
1249 const SwCellStyleTable& GetCellStyles() const { return *mpCellStyles; }
1250 SwCellStyleTable& GetCellStyles() { return *mpCellStyles; }
1252 void AppendUndoForInsertFromDB( const SwPaM& rPam, bool bIsTable );
1254 bool SetColRowWidthHeight( SwTableBox& rCurrentBox, TableChgWidthHeightType eType,
1255 SwTwips nAbsDiff, SwTwips nRelDiff );
1256 SwTableBoxFormat* MakeTableBoxFormat();
1257 SwTableLineFormat* MakeTableLineFormat();
1259 // helper function: cleanup before checking number value
1260 bool IsNumberFormat( const OUString& rString, sal_uInt32& F_Index, double& fOutNumber);
1261 // Check if box has numerical value. Change format of box if required.
1262 void ChkBoxNumFormat( SwTableBox& rCurrentBox, bool bCallUpdate );
1263 void SetTableBoxFormulaAttrs( SwTableBox& rBox, const SfxItemSet& rSet );
1264 void ClearBoxNumAttrs( const SwNodeIndex& rNode );
1265 void ClearLineNumAttrs( SwPosition const & rPos );
1267 bool InsCopyOfTable( SwPosition& rInsPos, const SwSelBoxes& rBoxes,
1268 const SwTable* pCpyTable, bool bCpyName = false,
1269 bool bCorrPos = false );
1271 void UnProtectCells( const OUString& rTableName );
1272 bool UnProtectCells( const SwSelBoxes& rBoxes );
1273 void UnProtectTables( const SwPaM& rPam );
1274 bool HasTableAnyProtection( const SwPosition* pPos,
1275 const OUString* pTableName,
1276 bool* pFullTableProtection );
1278 // Split table at baseline position, i.e. create a new table.
1279 bool SplitTable( const SwPosition& rPos, SplitTable_HeadlineOption eMode,
1280 bool bCalcNewSize );
1282 /** And vice versa: rPos must be in the table that remains. The flag indicates
1283 whether the current table is merged with the one before or behind it. */
1284 bool MergeTable( const SwPosition& rPos, bool bWithPrev,
1285 sal_uInt16 nMode = 0 );
1287 // Make charts of given table update.
1288 void UpdateCharts( const OUString &rName ) const;
1290 // Update all charts, for that exists any table.
1291 void UpdateAllCharts() { DoUpdateAllCharts(); }
1293 // Table is renamed and refreshes charts.
1294 void SetTableName( SwFrameFormat& rTableFormat, const OUString &rNewName );
1296 // @return the reference in document that is set for name.
1297 const SwFormatRefMark* GetRefMark( const OUString& rName ) const;
1299 // @return RefMark via index - for UNO.
1300 const SwFormatRefMark* GetRefMark( sal_uInt16 nIndex ) const;
1302 /** @return names of all references that are set in document.
1303 If array pointer is 0 return only whether a RefMark is set in document. */
1304 sal_uInt16 GetRefMarks( std::vector<OUString>* = nullptr ) const;
1306 // Insert label. If a FlyFormat is created, return it.
1307 SwFlyFrameFormat* InsertLabel( const SwLabelType eType, const OUString &rText, const OUString& rSeparator,
1308 const OUString& rNumberingSeparator,
1309 const bool bBefore, const sal_uInt16 nId, const sal_uLong nIdx,
1310 const OUString& rCharacterStyle,
1311 const bool bCpyBrd );
1312 SwFlyFrameFormat* InsertDrawLabel(
1313 const OUString &rText, const OUString& rSeparator, const OUString& rNumberSeparator,
1314 const sal_uInt16 nId, const OUString& rCharacterStyle, SdrObject& rObj );
1316 // Query attribute pool.
1317 const SwAttrPool& GetAttrPool() const { return *mpAttrPool; }
1318 SwAttrPool& GetAttrPool() { return *mpAttrPool; }
1320 // Search for an EditShell.
1321 SwEditShell const * GetEditShell() const;
1322 SwEditShell* GetEditShell();
1323 ::sw::IShellCursorSupplier * GetIShellCursorSupplier();
1325 // OLE 2.0-notification.
1326 void SetOle2Link(const Link<bool,void>& rLink) {maOle2Link = rLink;}
1327 const Link<bool,void>& GetOle2Link() const {return maOle2Link;}
1329 // insert section (the ODF kind of section, not the nodesarray kind)
1330 SwSection * InsertSwSection(SwPaM const& rRange, SwSectionData &,
1331 std::tuple<SwTOXBase const*, sw::RedlineMode, sw::FieldmarkMode> const* pTOXBase,
1332 SfxItemSet const*const pAttr, bool const bUpdate = true);
1333 static sal_uInt16 IsInsRegionAvailable( const SwPaM& rRange,
1334 const SwNode** ppSttNd = nullptr );
1335 static SwSection* GetCurrSection( const SwPosition& rPos );
1336 SwSectionFormats& GetSections() { return *mpSectionFormatTable; }
1337 const SwSectionFormats& GetSections() const { return *mpSectionFormatTable; }
1338 SwSectionFormat *MakeSectionFormat();
1339 void DelSectionFormat( SwSectionFormat *pFormat, bool bDelNodes = false );
1340 void UpdateSection(size_t const nSect, SwSectionData &,
1341 SfxItemSet const*const = nullptr, bool const bPreventLinkUpdate = false);
1342 OUString GetUniqueSectionName( const OUString* pChkStr = nullptr ) const;
1344 /* @@@MAINTAINABILITY-HORROR@@@
1345 The model should not have anything to do with a shell.
1346 Unnecessary compile/link time dependency.
1349 // Pointer to SfxDocShell from Doc. Can be 0!!
1350 SwDocShell* GetDocShell() { return mpDocShell; }
1351 const SwDocShell* GetDocShell() const { return mpDocShell; }
1352 void SetDocShell( SwDocShell* pDSh );
1354 /** in case during copying of embedded object a new shell is created,
1355 it should be set here and cleaned later */
1356 void SetTmpDocShell( SfxObjectShellLock rLock ) { mxTmpDocShell = rLock; }
1357 const SfxObjectShellLock& GetTmpDocShell() const { return mxTmpDocShell; }
1359 // For Autotexts? (text modules) They have only one SVPersist at their disposal.
1360 SfxObjectShell* GetPersist() const;
1362 // Pointer to storage of SfxDocShells. Can be 0!!!
1363 css::uno::Reference< css::embed::XStorage > GetDocStorage();
1365 // Query / set flag indicating if document is loaded asynchronously at this moment.
1366 bool IsInLoadAsynchron() const { return mbInLoadAsynchron; }
1367 void SetInLoadAsynchron( bool bFlag ) { mbInLoadAsynchron = bFlag; }
1369 // For Drag&Move: (e.g. allow "moving" of RefMarks)
1370 bool IsCopyIsMove() const { return mbCopyIsMove; }
1371 void SetCopyIsMove( bool bFlag ) { mbCopyIsMove = bFlag; }
1373 SwDrawContact* GroupSelection( SdrView& );
1374 void UnGroupSelection( SdrView& );
1375 bool DeleteSelection( SwDrawView& );
1377 // Invalidates OnlineSpell-WrongLists.
1378 void SpellItAgainSam( bool bInvalid, bool bOnlyWrong, bool bSmartTags );
1379 void InvalidateAutoCompleteFlag();
1381 void SetCalcFieldValueHdl(Outliner* pOutliner);
1383 // Query if URL was visited.
1384 // Query via Doc, if only a Bookmark has been given.
1385 // In this case the document name has to be set in front.
1386 bool IsVisitedURL( const OUString& rURL );
1388 // Save current values for automatic registration of exceptions in Autocorrection.
1389 void SetAutoCorrExceptWord( std::unique_ptr<SwAutoCorrExceptWord> pNew );
1390 SwAutoCorrExceptWord* GetAutoCorrExceptWord() { return mpACEWord.get(); }
1391 void DeleteAutoCorrExceptWord();
1393 const SwFormatINetFormat* FindINetAttr( const OUString& rName ) const;
1395 // Call into intransparent Basic; expect possible Return String.
1396 void ExecMacro( const SvxMacro& rMacro, OUString* pRet, SbxArray* pArgs );
1398 // Call into intransparent Basic / JavaScript.
1399 sal_uInt16 CallEvent( SvMacroItemId nEvent, const SwCallMouseEvent& rCallEvent,
1400 bool bChkPtr = false );
1402 /** Adjust left margin via object bar (similar to adjustment of numerations).
1403 One can either change the margin "by" adding or subtracting a given
1404 offset or set it "to" this position (bModulus = true). */
1405 void MoveLeftMargin(const SwPaM& rPam, bool bRight, bool bModulus,
1406 SwRootFrame const* pLayout = nullptr);
1408 // Query NumberFormatter.
1409 SvNumberFormatter* GetNumberFormatter(bool bCreate = true)
1411 if (bCreate)
1412 EnsureNumberFormatter();
1413 return mpNumberFormatter;
1416 const SvNumberFormatter* GetNumberFormatter(bool bCreate = true) const
1418 return const_cast<SwDoc*>(this)->GetNumberFormatter(bCreate);
1421 bool HasInvisibleContent() const;
1422 // delete invisible content, like hidden sections and paragraphs
1423 bool RemoveInvisibleContent();
1424 // restore the invisible content if it's available on the undo stack
1425 bool RestoreInvisibleContent();
1427 bool ConvertFieldsToText(SwRootFrame const& rLayout);
1429 // Create sub-documents according to given collection.
1430 // If no collection is given, use chapter styles for 1st level.
1431 bool GenerateGlobalDoc( const OUString& rPath,
1432 const SwTextFormatColl* pSplitColl );
1433 bool GenerateGlobalDoc( const OUString& rPath, int nOutlineLevel );
1434 bool GenerateHTMLDoc( const OUString& rPath,
1435 const SwTextFormatColl* pSplitColl );
1436 bool GenerateHTMLDoc( const OUString& rPath, int nOutlineLevel );
1438 // Compare two documents.
1439 tools::Long CompareDoc( const SwDoc& rDoc );
1441 // Merge two documents.
1442 tools::Long MergeDoc( const SwDoc& rDoc );
1444 bool IsAutoFormatRedline() const { return mbIsAutoFormatRedline; }
1445 void SetAutoFormatRedline( bool bFlag ) { mbIsAutoFormatRedline = bFlag; }
1447 // For AutoFormat: with Undo/Redlining.
1448 void SetTextFormatCollByAutoFormat( const SwPosition& rPos, sal_uInt16 nPoolId,
1449 const SfxItemSet* pSet );
1450 void SetFormatItemByAutoFormat( const SwPaM& rPam, const SfxItemSet& );
1452 // Only for SW-textbloxks! Does not pay any attention to layout!
1453 void ClearDoc(); // Deletes all content!
1455 // Query /set data for PagePreview.
1456 const SwPagePreviewPrtData* GetPreviewPrtData() const { return m_pPgPViewPrtData.get(); }
1458 // If pointer == 0 destroy pointer in document.
1459 // Else copy object.
1460 // Pointer is not transferred to ownership by document!
1461 void SetPreviewPrtData( const SwPagePreviewPrtData* pData );
1463 /** update all modified OLE-Objects. The modification is called over the
1464 StarOne - Interface */
1465 void SetOLEObjModified();
1467 // Uno - Interfaces
1468 std::shared_ptr<SwUnoCursor> CreateUnoCursor( const SwPosition& rPos, bool bTableCursor = false );
1470 // FeShell - Interfaces
1471 // !!! These assume always an existing layout !!!
1472 bool ChgAnchor( const SdrMarkList& _rMrkList,
1473 RndStdIds _eAnchorType,
1474 const bool _bSameOnly,
1475 const bool _bPosCorr );
1477 void SetRowHeight( const SwCursor& rCursor, const SwFormatFrameSize &rNew );
1478 static std::unique_ptr<SwFormatFrameSize> GetRowHeight( const SwCursor& rCursor );
1479 void SetRowSplit( const SwCursor& rCursor, const SwFormatRowSplit &rNew );
1480 static std::unique_ptr<SwFormatRowSplit> GetRowSplit( const SwCursor& rCursor );
1482 /// Adjustment of Rowheights. Determine via bTstOnly if more than one row is selected.
1483 /// bOptimize: distribute current table height, instead of using the largest row.
1484 /// Call again without bOptimize to ensure equal height in case some row's content didn't fit.
1485 bool BalanceRowHeight( const SwCursor& rCursor, bool bTstOnly, const bool bOptimize );
1486 void SetRowBackground( const SwCursor& rCursor, const SvxBrushItem &rNew );
1487 static bool GetRowBackground( const SwCursor& rCursor, std::unique_ptr<SvxBrushItem>& rToFill );
1488 void SetTabBorders( const SwCursor& rCursor, const SfxItemSet& rSet );
1489 void SetTabLineStyle( const SwCursor& rCursor,
1490 const Color* pColor, bool bSetLine,
1491 const editeng::SvxBorderLine* pBorderLine );
1492 static void GetTabBorders( const SwCursor& rCursor, SfxItemSet& rSet );
1493 void SetBoxAttr( const SwCursor& rCursor, const SfxPoolItem &rNew );
1495 Retrieves a box attribute from the given cursor.
1497 @return Whether the property is set over the current box selection.
1499 @remarks A property is 'set' if it's set to the same value over all boxes in the current selection.
1500 The property value is retrieved from the first box in the current selection. It is then compared to
1501 the values of the same property over any other boxes in the selection; if any value is different from
1502 that of the first box, the property is unset (and false is returned).
1504 static bool GetBoxAttr( const SwCursor& rCursor, std::unique_ptr<SfxPoolItem>& rToFill );
1505 void SetBoxAlign( const SwCursor& rCursor, sal_uInt16 nAlign );
1506 static sal_uInt16 GetBoxAlign( const SwCursor& rCursor );
1507 /// Adjusts selected cell widths in such a way, that their content does not need to be wrapped (if possible).
1508 /// bBalance evenly re-distributes the available space regardless of content or wrapping.
1509 /// bNoShrink keeps table size the same by distributing excess space proportionately.
1510 void AdjustCellWidth( const SwCursor& rCursor, const bool bBalance, const bool bNoShrink );
1512 SwChainRet Chainable( const SwFrameFormat &rSource, const SwFrameFormat &rDest );
1513 SwChainRet Chain( SwFrameFormat &rSource, const SwFrameFormat &rDest );
1514 void Unchain( SwFrameFormat &rFormat );
1516 // For Copy/Move from FrameShell.
1517 SdrObject* CloneSdrObj( const SdrObject&, bool bMoveWithinDoc = false,
1518 bool bInsInPage = true );
1520 // FeShell - Interface end
1522 // Interface for TextInputData - for text input of Chinese and Japanese.
1523 SwExtTextInput* CreateExtTextInput( const SwPaM& rPam );
1524 void DeleteExtTextInput( SwExtTextInput* pDel );
1525 SwExtTextInput* GetExtTextInput( const SwNode& rNd,
1526 sal_Int32 nContentPos = -1) const;
1527 SwExtTextInput* GetExtTextInput() const;
1529 // Interface for access to AutoComplete-List.
1530 static SwAutoCompleteWord& GetAutoCompleteWords() { return *s_pAutoCompleteWords; }
1532 bool ContainsMSVBasic() const { return mbContains_MSVBasic; }
1533 void SetContainsMSVBasic( bool bFlag ) { mbContains_MSVBasic = bFlag; }
1535 // Interface for the list of Ruby - texts/attributes
1536 static sal_uInt16 FillRubyList( const SwPaM& rPam, SwRubyList& rList );
1537 void SetRubyList( const SwPaM& rPam, const SwRubyList& rList );
1539 void ReadLayoutCache( SvStream& rStream );
1540 void WriteLayoutCache( SvStream& rStream );
1541 SwLayoutCache* GetLayoutCache() const { return mpLayoutCache.get(); }
1543 /** Checks if any of the text node contains hidden characters.
1544 Used for optimization. Changing the view option 'view hidden text'
1545 has to trigger a reformatting only if some of the text is hidden.
1547 bool ContainsHiddenChars() const;
1549 IGrammarContact* getGrammarContact() const { return mpGrammarContact.get(); }
1551 /** Marks/Unmarks a list level of a certain list
1553 levels of a certain lists are marked now
1555 @param sListId list Id of the list whose level has to be marked/unmarked
1556 @param nListLevel level to mark
1557 @param bValue - true mark the level
1558 - false unmark the level
1560 void MarkListLevel( const OUString& sListId,
1561 const int nListLevel,
1562 const bool bValue );
1564 // Change a format undoable.
1565 void ChgFormat(SwFormat & rFormat, const SfxItemSet & rSet);
1567 void RenameFormat(SwFormat & rFormat, const OUString & sNewName,
1568 bool bBroadcast = false);
1570 // Change a TOX undoable.
1571 void ChangeTOX(SwTOXBase & rTOX, const SwTOXBase & rNew);
1574 Returns a textual description of a PaM.
1576 @param rPaM the PaM to describe
1578 If rPaM only spans one paragraph the result is:
1580 '<text in the PaM>'
1582 <text in the PaM> is shortened to nUndoStringLength characters.
1584 If rPaM spans more than one paragraph the result is:
1586 paragraphs (STR_PARAGRAPHS)
1588 @return the textual description of rPaM
1590 static OUString GetPaMDescr(const SwPaM & rPaM);
1592 static bool IsFirstOfNumRuleAtPos(const SwPosition & rPos, SwRootFrame const& rLayout);
1594 // access methods for XForms model(s)
1596 // access container for XForms model; will be NULL if !isXForms()
1597 const css::uno::Reference<css::container::XNameContainer>&
1598 getXForms() const { return mxXForms;}
1600 css::uno::Reference< css::linguistic2::XProofreadingIterator > const & GetGCIterator() const;
1602 // #i31958# is this an XForms document?
1603 bool isXForms() const;
1605 // #i31958# initialize XForms models; turn this into an XForms document
1606 void initXForms( bool bCreateDefaultModel );
1608 // #i113606# for disposing XForms
1609 void disposeXForms( );
1611 //Update all the page masters
1612 void SetDefaultPageMode(bool bSquaredPageMode);
1613 bool IsSquaredPageMode() const;
1615 css::uno::Reference< css::script::vba::XVBAEventProcessor > const & GetVbaEventProcessor();
1616 void SetVBATemplateToProjectCache( css::uno::Reference< css::container::XNameContainer > const & xCache ) { m_xTemplateToProjectCache = xCache; };
1617 const css::uno::Reference< css::container::XNameContainer >& GetVBATemplateToProjectCache() const { return m_xTemplateToProjectCache; };
1618 ::sfx2::IXmlIdRegistry& GetXmlIdRegistry();
1619 ::sw::MetaFieldManager & GetMetaFieldManager();
1620 ::sw::UndoManager & GetUndoManager();
1621 ::sw::UndoManager const& GetUndoManager() const;
1623 SfxObjectShell* CreateCopy(bool bCallInitNew, bool bEmpty) const;
1624 SwNodeIndex AppendDoc(const SwDoc& rSource, sal_uInt16 nStartPageNumber,
1625 bool bDeletePrevious, int physicalPageOffset,
1626 const sal_uLong nDocNo);
1629 * Dumps the entire nodes structure to the given destination (file nodes.xml in the current directory by default)
1631 void dumpAsXml(xmlTextWriterPtr = nullptr) const;
1633 std::set<Color> GetDocColors();
1634 std::vector< std::weak_ptr<SwUnoCursor> > mvUnoCursorTable;
1636 // Remove expired UnoCursor weak pointers the document keeps to notify about document death.
1637 void cleanupUnoCursorTable() const
1639 auto & rTable = const_cast<SwDoc*>(this)->mvUnoCursorTable;
1640 // In most cases we'll remove most of the elements.
1641 rTable.erase( std::remove_if(rTable.begin(),
1642 rTable.end(),
1643 [] (std::weak_ptr<SwUnoCursor> const & x) { return x.expired(); }),
1644 rTable.end());
1648 * @param bSkipStart don't actually start the jobs, just check
1649 * @returns true if new background checking jobs were started
1651 bool StartGrammarChecking( bool bSkipStart = false );
1653 /// Use to notify if the dictionary can be found for a single content portion (has to be called for all portions)
1654 void SetMissingDictionaries( bool bIsMissing );
1655 /// Returns true if no dictionary can be found for any content
1656 bool IsDictionaryMissing() const { return meDictionaryMissing == MissingDictionary::True; }
1658 void SetLanguage(const LanguageType eLang, const sal_uInt16 nId);
1660 private:
1661 // Copies master header to left / first one, if necessary - used by ChgPageDesc().
1662 void CopyMasterHeader(const SwPageDesc &rChged, const SwFormatHeader &rHead, SwPageDesc &pDesc, bool bLeft, bool bFirst);
1663 // Copies master footer to left / first one, if necessary - used by ChgPageDesc().
1664 void CopyMasterFooter(const SwPageDesc &rChged, const SwFormatFooter &rFoot, SwPageDesc &pDesc, bool bLeft, bool bFirst);
1668 // This method is called in Dtor of SwDoc and deletes cache of ContourObjects.
1669 void ClrContourCache();
1671 inline const SwTableNode* SwDoc::IsIdxInTable( const SwNodeIndex& rIdx ) const
1673 return const_cast<SwDoc*>(this)->IsIdxInTable( rIdx );
1676 inline void SwDoc::SetOLEPrtNotifyPending( bool bSet )
1678 mbOLEPrtNotifyPending = bSet;
1679 if( !bSet )
1680 mbAllOLENotify = false;
1683 bool sw_GetPostIts(const IDocumentFieldsAccess& rIDFA, SetGetExpFields * pSrtLst);
1685 #endif //_DOC_HXX
1687 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */