Coverage Report

Created: 2026-07-10 11:04

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/sw/inc/doc.hxx
Line
Count
Source
1
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
/*
3
 * This file is part of the LibreOffice project.
4
 *
5
 * This Source Code Form is subject to the terms of the Mozilla Public
6
 * License, v. 2.0. If a copy of the MPL was not distributed with this
7
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8
 *
9
 * This file incorporates work covered by the following license notice:
10
 *
11
 *   Licensed to the Apache Software Foundation (ASF) under one or more
12
 *   contributor license agreements. See the NOTICE file distributed
13
 *   with this work for additional information regarding copyright
14
 *   ownership. The ASF licenses this file to you under the Apache
15
 *   License, Version 2.0 (the "License"); you may not use this file
16
 *   except in compliance with the License. You may obtain a copy of
17
 *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
18
 */
19
#pragma once
20
21
// SwDoc interfaces
22
#include <o3tl/typed_flags_set.hxx>
23
#include <o3tl/sorted_vector.hxx>
24
#include <string_view>
25
#include <vcl/idle.hxx>
26
#include "swdllapi.h"
27
#include "swtypes.hxx"
28
#include "tblafmt.hxx"
29
#include "toxe.hxx"
30
#include "flyenum.hxx"
31
#include "flypos.hxx"
32
#include "swdbdata.hxx"
33
#include <sfx2/objsh.hxx>
34
#include <svl/style.hxx>
35
#include <editeng/numitem.hxx>
36
#include "tox.hxx"
37
#include "frmfmt.hxx"
38
#include "frameformats.hxx"
39
#include "charfmt.hxx"
40
#include "docary.hxx"
41
#include "charformats.hxx"
42
#include "pagedesc.hxx"
43
#include "tblenum.hxx"
44
#include "ndarr.hxx"
45
#include "ndtyp.hxx"
46
#include <memory>
47
#include <mutex>
48
#include <set>
49
#include <tuple>
50
#include <unordered_map>
51
#include <utility>
52
#include <vector>
53
54
namespace editeng { class SvxBorderLine; }
55
56
class SwExtTextInput;
57
class EditFieldInfo;
58
class Outliner;
59
class OutputDevice;
60
class Point;
61
class SbxArray;
62
class SdrObject;
63
class SdrUndoAction;
64
class SvNumberFormatter;
65
class SvxMacro;
66
class SwAutoCompleteWord;
67
class SwAutoCorrExceptWord;
68
class SwCellFrame;
69
class SwCellStyleTable;
70
class SwCursorShell;
71
class SwCursor;
72
class SwDocShell;
73
class SwDrawView;
74
class SwEditShell;
75
class SwFormat;
76
class SwFormatINetFormat;
77
class SwFormatRefMark;
78
class SwFootnoteIdxs;
79
class SwFootnoteInfo;
80
class SwEndNoteInfo;
81
class SwLineNumberInfo;
82
class SwDBManager;
83
class SwNodeIndex;
84
class SwNodeRange;
85
class SwNumRule;
86
class SwPagePreviewPrtData;
87
class SwRootFrame;
88
class SwRubyListEntry;
89
class SwSectionFormat;
90
class SwSectionData;
91
class SwSelBoxes;
92
class SwTableAutoFormatTable;
93
class SwTOXBaseSection;
94
class SwTabCols;
95
class SwTable;
96
class SwTableAutoFormat;
97
class SwTableBox;
98
class SwTableBoxFormat;
99
class SwTableFormat;
100
class SwTableLineFormat;
101
class SwTableNode;
102
class SwTextBlocks;
103
class SwURLStateChanged;
104
class SwUnoCursor;
105
class SwViewShell;
106
class SwDrawContact;
107
class SdrView;
108
class SdrMarkList;
109
class SwAuthEntry;
110
class SwLayoutCache;
111
class IStyleAccess;
112
struct SwCallMouseEvent;
113
struct SwDocStat;
114
struct SwSortOptions;
115
struct SwDefTOXBase_Impl;
116
class SwPrintUIOptions;
117
struct SwConversionArgs;
118
class SwRenderData;
119
class IDocumentUndoRedo;
120
class IDocumentSettingAccess;
121
class IDocumentDeviceAccess;
122
class IDocumentDrawModelAccess;
123
class IDocumentChartDataProviderAccess;
124
class IDocumentTimerAccess;
125
class IDocumentLinksAdministration;
126
class IDocumentListItems;
127
class IDocumentListsAccess;
128
class IDocumentOutlineNodes;
129
class IDocumentContentOperations;
130
class IDocumentRedlineAccess;
131
class IDocumentStatistics;
132
class IDocumentState;
133
class IDocumentLayoutAccess;
134
class IDocumentStylePoolAccess;
135
class IDocumentExternalData;
136
class IDocumentMarkAccess;
137
class SetGetExpFields;
138
struct SwInsertTableOptions;
139
class SwContentControlManager;
140
enum class SvMacroItemId : sal_uInt16;
141
enum class SvxFrameDirection;
142
enum class RndStdIds;
143
class SwMarkName;
144
145
namespace sw::mark { class MarkManager; }
146
namespace sw {
147
    enum class RedlineMode;
148
    enum class FieldmarkMode;
149
    enum class ParagraphBreakMode;
150
    class MetaFieldManager;
151
    class UndoManager;
152
    class IShellCursorSupplier;
153
    class DocumentSettingManager;
154
    class DocumentDeviceManager;
155
    class DocumentDrawModelManager;
156
    class DocumentChartDataProviderManager;
157
    class DocumentTimerManager;
158
    class DocumentLinksAdministrationManager;
159
    class DocumentListItemsManager;
160
    class DocumentListsManager;
161
    class DocumentOutlineNodesManager;
162
    class DocumentContentOperationsManager;
163
    class DocumentRedlineManager;
164
    class DocumentFieldsManager;
165
    class DocumentStatisticsManager;
166
    class DocumentStateManager;
167
    class DocumentLayoutManager;
168
    class DocumentStylePoolManager;
169
    class DocumentExternalDataManager;
170
    class GrammarContact;
171
    class OnlineAccessibilityCheck;
172
}
173
174
namespace com::sun::star {
175
    namespace container {
176
        class XNameContainer; //< for getXForms()/isXForms()/initXForms() methods
177
    }
178
    namespace embed { class XStorage; }
179
    namespace linguistic2 { class XHyphenatedWord; }
180
    namespace linguistic2 { class XProofreadingIterator; }
181
    namespace linguistic2 { class XSpellChecker1; }
182
    namespace script::vba { class XVBAEventProcessor; }
183
}
184
185
namespace ooo::vba::word {
186
    class XFind;
187
}
188
189
namespace sfx2 {
190
    class IXmlIdRegistry;
191
}
192
193
namespace {
194
    enum SwSplitDocType
195
    {
196
        SPLITDOC_TO_GLOBALDOC,
197
        SPLITDOC_TO_HTML
198
    };
199
}
200
201
void SetAllScriptItem( SfxItemSet& rSet, const SfxPoolItem& rItem );
202
203
using SwRubyList = std::vector<std::unique_ptr<SwRubyListEntry>>;
204
205
// Represents the model of a Writer document.
206
class SwDoc final
207
{
208
    friend class ::sw::DocumentContentOperationsManager;
209
210
    friend void InitCore();
211
    friend void FinitCore();
212
213
    // private Member
214
    std::unique_ptr<SwNodes> m_pNodes;    //< document content (Nodes Array)
215
    rtl::Reference<SwAttrPool> mpAttrPool;  //< the attribute pool
216
    SwPageDescs              m_PageDescs; //< PageDescriptors
217
    Link<bool,void>          maOle2Link;  //< OLE 2.0-notification
218
    /* @@@MAINTAINABILITY-HORROR@@@
219
       Timer should not be members of the model
220
    */
221
    Idle       maOLEModifiedIdle;        //< Timer for update modified OLE-Objects
222
    SwDBData    maDBData;                //< database descriptor
223
    OUString    msTOIAutoMarkURL;        //< URL of table of index AutoMark file
224
    std::vector<OUString> m_PatternNames; //< Array for names of document-templates
225
    css::uno::Reference<css::container::XNameContainer>
226
        mxXForms;                        //< container with XForms models
227
    mutable css::uno::Reference< css::linguistic2::XProofreadingIterator > m_xGCIterator;
228
229
    const std::unique_ptr< ::sw::mark::MarkManager> mpMarkManager;
230
    const std::unique_ptr< ::sw::MetaFieldManager > m_pMetaFieldManager;
231
    const std::unique_ptr< ::SwContentControlManager > m_pContentControlManager;
232
    const std::unique_ptr< ::sw::DocumentDrawModelManager > m_pDocumentDrawModelManager;
233
    const std::unique_ptr< ::sw::DocumentRedlineManager > m_pDocumentRedlineManager;
234
    const std::unique_ptr< ::sw::DocumentStateManager > m_pDocumentStateManager;
235
    const std::unique_ptr< ::sw::UndoManager > m_pUndoManager;
236
    const std::unique_ptr< ::sw::DocumentSettingManager > m_pDocumentSettingManager;
237
    const std::unique_ptr< ::sw::DocumentChartDataProviderManager > m_pDocumentChartDataProviderManager;
238
    std::unique_ptr< ::sw::DocumentDeviceManager > m_pDeviceAccess;
239
    const std::unique_ptr< ::sw::DocumentTimerManager > m_pDocumentTimerManager;
240
    const std::unique_ptr< ::sw::DocumentLinksAdministrationManager > m_pDocumentLinksAdministrationManager;
241
    const std::unique_ptr< ::sw::DocumentListItemsManager > m_pDocumentListItemsManager;
242
    const std::unique_ptr< ::sw::DocumentListsManager > m_pDocumentListsManager;
243
    const std::unique_ptr< ::sw::DocumentOutlineNodesManager > m_pDocumentOutlineNodesManager;
244
    const std::unique_ptr< ::sw::DocumentContentOperationsManager > m_pDocumentContentOperationsManager;
245
    const std::unique_ptr< ::sw::DocumentFieldsManager > m_pDocumentFieldsManager;
246
    const std::unique_ptr< ::sw::DocumentStatisticsManager > m_pDocumentStatisticsManager;
247
    const std::unique_ptr< ::sw::DocumentLayoutManager > m_pDocumentLayoutManager;
248
    const std::unique_ptr< ::sw::DocumentStylePoolManager > m_pDocumentStylePoolManager;
249
    const std::unique_ptr< ::sw::DocumentExternalDataManager > m_pDocumentExternalDataManager;
250
251
    // Pointer
252
    std::unique_ptr<SwFrameFormat>     mpDfltFrameFormat;     //< Default formats.
253
    std::unique_ptr<SwFrameFormat>     mpEmptyPageFormat;     //< Format for the default empty page
254
    std::unique_ptr<SwFrameFormat>     mpColumnContFormat;    //< Format for column container
255
    std::unique_ptr<SwCharFormat>      mpDfltCharFormat;
256
    std::unique_ptr<SwTextFormatColl>  mpDfltTextFormatColl;  //< Defaultformatcollections
257
    std::unique_ptr<SwGrfFormatColl>   mpDfltGrfFormatColl;
258
259
    std::unique_ptr<sw::FrameFormats<SwFrameFormat*>>    mpFrameFormatTable;    //< Format table
260
    std::unique_ptr<SwCharFormats>     mpCharFormatTable;
261
    std::unique_ptr<SwCharFormats>     mpCharFormatDeletionTable;
262
    std::unique_ptr<sw::FrameFormats<sw::SpzFrameFormat*>>    mpSpzFrameFormatTable;
263
    std::unique_ptr<SwSectionFormats>  mpSectionFormatTable;
264
    std::unique_ptr<sw::TableFrameFormats>    mpTableFrameFormatTable; //< For tables
265
    std::unique_ptr<SwTextFormatColls> mpTextFormatCollTable;   //< FormatCollections
266
    std::unique_ptr<SwGrfFormatColls>  mpGrfFormatCollTable;
267
268
    std::unique_ptr<SwTOXTypes>        mpTOXTypes;              //< Tables/indices
269
    std::unique_ptr<SwDefTOXBase_Impl> mpDefTOXBases;           //< defaults of SwTOXBase's
270
271
    std::unique_ptr<SwDBManager> m_pOwnDBManager; //< own DBManager
272
    SwDBManager * m_pDBManager; //< DBManager for evaluation of DB-fields.
273
274
    SwNumRule       *mpOutlineRule;
275
    std::unique_ptr<SwFootnoteInfo>   mpFootnoteInfo;
276
    std::unique_ptr<SwEndNoteInfo>    mpEndNoteInfo;
277
    std::unique_ptr<SwLineNumberInfo> mpLineNumberInfo;
278
    std::unique_ptr<SwFootnoteIdxs>   mpFootnoteIdxs;
279
280
    SwDocShell      *mpDocShell;                   //< Ptr to SfxDocShell of Doc.
281
    SfxObjectShellLock mxTmpDocShell;              //< A temporary shell that is used to copy OLE-Nodes
282
283
    std::unique_ptr<SwAutoCorrExceptWord> mpACEWord;               /**< For the automated takeover of
284
                                                   auto-corrected words that are "re-corrected". */
285
    std::unique_ptr<SwURLStateChanged> mpURLStateChgd;             //< SfxClient for changes in INetHistory
286
287
    std::mutex mNumberFormatterMutex;
288
    SvNumberFormatter* mpNumberFormatter;             //< NumFormatter for tables / fields
289
290
    mutable std::unique_ptr<SwNumRuleTable> mpNumRuleTable;     //< List of all named NumRules.
291
292
    // Hash map to find numrules by name
293
    mutable std::unordered_map<UIName, SwNumRule *> maNumRuleMap;
294
295
    std::unique_ptr<SwPagePreviewPrtData> m_pPgPViewPrtData; //< Indenting / spacing for printing of page view.
296
    SwExtTextInput  *mpExtInputRing;
297
298
    std::unique_ptr<IStyleAccess>  mpStyleAccess;                //< handling of automatic styles
299
    std::unique_ptr<SwLayoutCache> mpLayoutCache;                /**< Layout cache to read and save with the
300
                                                                    document for a faster formatting */
301
302
    std::unique_ptr<sw::GrammarContact> mpGrammarContact; //< for grammar checking in paragraphs during editing
303
    std::unique_ptr<sw::OnlineAccessibilityCheck> mpOnlineAccessibilityCheck;
304
305
    css::uno::Reference< css::script::vba::XVBAEventProcessor > mxVbaEvents;
306
    css::uno::Reference< ooo::vba::word::XFind > mxVbaFind;
307
    css::uno::Reference<css::container::XNameContainer> m_xTemplateToProjectCache;
308
309
    /// Table styles (autoformats that are applied with table changes).
310
    std::unique_ptr<SwTableAutoFormatTable> m_pTableStyles;
311
    /// Cell Styles not assigned to a Table Style
312
    std::unique_ptr<SwCellStyleTable> mpCellStyles;
313
private:
314
    std::unique_ptr< ::sfx2::IXmlIdRegistry > m_pXmlIdRegistry;
315
316
    // other
317
318
    sal_uInt32  mnRsid;              //< current session ID of the document
319
    sal_uInt32  mnRsidRoot;          //< session ID when the document was created
320
321
    oslInterlockedCount  mReferenceCount;
322
323
    bool mbDtor                  : 1;    /**< TRUE: is in SwDoc DTOR.
324
                                               and unfortunately temporarily also in
325
                                               SwSwgReader::InLayout() when flawed
326
                                               frames need deletion. */
327
    bool mbCopyIsMove            : 1;    //< TRUE: Copy is a hidden Move.
328
    bool mbInReading             : 1;    //< TRUE: Document is in the process of being read.
329
    bool mbInWriting : 1; //< TRUE: Document is in the process of being written.
330
    bool mbInMailMerge           : 1;    //< TRUE: Document is in the process of being written by mail merge.
331
    bool mbInXMLImport           : 1;    //< TRUE: During xml import, attribute portion building is not necessary.
332
    bool mbInXMLImport242        : 1 = false; //< TRUE: During xml import, apply workaround for style-ref field
333
    bool mbInWriterfilterImport  : 1;    //< TRUE: writerfilter import (DOCX,RTF)
334
    bool mbUpdateTOX             : 1;    //< TRUE: After loading document, update TOX.
335
    bool mbInLoadAsynchron       : 1;    //< TRUE: Document is in the process of being loaded asynchronously.
336
    bool mbIsAutoFormatRedline   : 1;    //< TRUE: Redlines are recorded by Autoformat.
337
    bool mbOLEPrtNotifyPending   : 1;    /**< TRUE: Printer has changed. At creation of View
338
                                                notification of OLE-Objects PrtOLENotify() is required. */
339
    bool mbAllOLENotify          : 1;    //< True: Notification of all objects is required.
340
    bool mbInsOnlyTextGlssry     : 1;    //< True: insert 'only text' glossary into doc
341
    bool mbContains_MSVBasic     : 1;    //< True: MS-VBasic exist is in our storage
342
    bool mbClipBoard             : 1;    //< TRUE: this document represents the clipboard
343
    bool mbColumnSelection       : 1;    //< TRUE: this content has been created by a column selection (clipboard docs only)
344
    bool mbIsPrepareSelAll       : 1;
345
    bool mbDontCorrectBookmarks = false;
346
347
    enum MissingDictionary { False = -1, Undefined = 0, True = 1 };
348
    MissingDictionary meDictionaryMissing;
349
350
    // true: Document contains at least one anchored object, which is anchored AT_PAGE with a content position.
351
    //       Thus, certain adjustment needed during formatting for these kind of anchored objects.
352
    bool mbContainsAtPageObjWithContentAnchor : 1;
353
354
    static SwAutoCompleteWord *s_pAutoCompleteWords;  //< List of all words for AutoComplete
355
    /// The last, still alive SwDoc instance, for debugging.
356
    static SwDoc* s_pLast;
357
358
    // private methods
359
    SwFlyFrameFormat* MakeFlySection_( const SwPosition& rAnchPos,
360
                                const SwContentNode& rNode, RndStdIds eRequestId,
361
                                const SfxItemSet* pFlyAttrSet,
362
                                SwFrameFormat* );
363
    sal_Int8 SetFlyFrameAnchor( SwFrameFormat& rFlyFormat, SfxItemSet& rSet, bool bNewFrames );
364
365
    typedef SwFormat* (SwDoc::*FNCopyFormat)( const UIName&, SwFormat*, bool );
366
    SwFormat* CopyFormat( const SwFormat& rFormat, const SwFormatsBase& rFormatArr,
367
                        FNCopyFormat fnCopyFormat, const SwFormat& rDfltFormat );
368
    void CopyFormatArr( const SwFormatsBase& rSourceArr, SwFormatsBase const & rDestArr,
369
                        FNCopyFormat fnCopyFormat, SwFormat& rDfltFormat );
370
    SW_DLLPUBLIC void CopyPageDescHeaderFooterImpl( bool bCpyHeader,
371
                                const SwFrameFormat& rSrcFormat, SwFrameFormat& rDestFormat );
372
373
    SwDoc( const SwDoc &) = delete;
374
375
    // Database fields:
376
    void AddUsedDBToList( std::vector<OUString>& rDBNameList,
377
                          const std::vector<OUString>& rUsedDBNames );
378
    void AddUsedDBToList( std::vector<OUString>& rDBNameList, const OUString& rDBName );
379
    static bool IsNameInArray( const std::vector<OUString>& rOldNames, const OUString& rName );
380
    void GetAllDBNames( std::vector<OUString>& rAllDBNames );
381
    static OUString ReplaceUsedDBs( const std::vector<OUString>& rUsedDBNames,
382
                             const OUString& rNewName, const OUString& rFormula );
383
    static std::vector<OUString>& FindUsedDBs( const std::vector<OUString>& rAllDBNames,
384
                                const OUString& rFormula,
385
                                std::vector<OUString>& rUsedDBNames );
386
387
    SW_DLLPUBLIC void EnsureNumberFormatter(); // must be called with mNumberFormatterMutex locked
388
389
    bool UnProtectTableCells( SwTable& rTable );
390
391
    /**
392
       Create sub-documents according to the given collection.
393
       If no collection is given, take chapter style of the 1st level.
394
395
       @param eDocType Enumeration value representing doctype to be generated
396
       @param rPath String representing parent directories of file to be generated
397
       @param rConcatFunc Function representing how token is concatenated to the filename
398
    */
399
    bool SplitDoc(sal_uInt16 eDocType, const OUString& rPath, bool bOutline,
400
                  const SwTextFormatColl* pSplitColl, int nOutlineLevel = 0,
401
                  const std::function<OUString(OUString, OUString)>& rConcatFunc =
402
                  [](OUString aName, OUString token) -> OUString { return aName + token; });
403
404
    // Update charts of given table.
405
    void UpdateCharts_( const SwTable& rTable, SwViewShell const & rVSh ) const;
406
407
    static bool SelectNextRubyChars( SwPaM& rPam, SwRubyListEntry& rRubyEntry );
408
409
    // CharTimer calls this method.
410
    void DoUpdateAllCharts();
411
    DECL_LINK( DoUpdateModifiedOLE, Timer *, void );
412
413
public:
414
    SW_DLLPUBLIC SwFormat *MakeCharFormat_(const UIName &, SwFormat *, bool );
415
    SwFormat *MakeFrameFormat_(const UIName &, SwFormat *, bool );
416
417
private:
418
    SwFormat *MakeTextFormatColl_(const UIName &, SwFormat *, bool );
419
420
private:
421
    OUString msDocAccTitle;
422
423
    void InitTOXTypes();
424
425
public:
426
    enum DocumentType {
427
        DOCTYPE_NATIVE,
428
        DOCTYPE_MSWORD              // This doc model comes from MS Word
429
        };
430
    DocumentType    meDocType;
431
0
    DocumentType    GetDocumentType() const { return meDocType; }
432
18.2k
    void            SetDocumentType( DocumentType eDocType ) { meDocType = eDocType; }
433
434
    // Life cycle
435
    SW_DLLPUBLIC SwDoc();
436
    SW_DLLPUBLIC ~SwDoc();
437
438
29.5M
    bool IsInDtor() const { return mbDtor; }
439
440
    /* @@@MAINTAINABILITY-HORROR@@@
441
       Implementation details made public.
442
    */
443
75.9M
    SwNodes      & GetNodes()       { return *m_pNodes; }
444
15.4M
    SwNodes const& GetNodes() const { return *m_pNodes; }
445
446
private:
447
    friend class ::rtl::Reference<SwDoc>;
448
449
    /** Acquire a reference to an instance. A caller shall release
450
        the instance by calling 'release' when it is no longer needed.
451
        'acquire' and 'release' calls need to be balanced.
452
453
        @returns
454
        the current reference count of the instance for debugging purposes.
455
    */
456
    SW_DLLPUBLIC sal_Int32 acquire();
457
    /** Releases a reference to an instance. A caller has to call
458
        'release' when a before acquired reference to an instance
459
        is no longer needed. 'acquire' and 'release' calls need to
460
        be balanced.
461
462
    @returns
463
        the current reference count of the instance for debugging purposes.
464
    */
465
    SW_DLLPUBLIC sal_Int32 release();
466
    /** Returns the current reference count. This method should be used for
467
        debugging purposes. Using it otherwise is a signal of a design flaw.
468
    */
469
public:
470
    sal_Int32 getReferenceCount() const;
471
472
    //MarkManager
473
    SW_DLLPUBLIC ::sw::mark::MarkManager& GetMarkManager();
474
475
    // IDocumentSettingAccess
476
    SW_DLLPUBLIC IDocumentSettingAccess const & getIDocumentSettingAccess() const; //The IDocumentSettingAccess interface
477
    SW_DLLPUBLIC IDocumentSettingAccess & getIDocumentSettingAccess();
478
    ::sw::DocumentSettingManager      & GetDocumentSettingManager(); //The implementation of the interface with some additional methods
479
    ::sw::DocumentSettingManager const& GetDocumentSettingManager() const;
480
    sal_uInt32 getRsid() const;
481
    void setRsid( sal_uInt32 nVal );
482
    sal_uInt32 getRsidRoot() const;
483
    void setRsidRoot( sal_uInt32 nVal );
484
485
    // IDocumentDeviceAccess
486
    IDocumentDeviceAccess const & getIDocumentDeviceAccess() const;
487
    SW_DLLPUBLIC IDocumentDeviceAccess & getIDocumentDeviceAccess();
488
489
    // IDocumentMarkAccess
490
    SW_DLLPUBLIC IDocumentMarkAccess* getIDocumentMarkAccess();
491
    SW_DLLPUBLIC const IDocumentMarkAccess* getIDocumentMarkAccess() const;
492
493
    // IDocumentRedlineAccess
494
    IDocumentRedlineAccess const& getIDocumentRedlineAccess() const;
495
    SW_DLLPUBLIC IDocumentRedlineAccess& getIDocumentRedlineAccess();
496
497
    ::sw::DocumentRedlineManager const& GetDocumentRedlineManager() const;
498
    SW_DLLPUBLIC ::sw::DocumentRedlineManager& GetDocumentRedlineManager();
499
500
    // IDocumentUndoRedo
501
    SW_DLLPUBLIC IDocumentUndoRedo      & GetIDocumentUndoRedo();
502
    IDocumentUndoRedo const& GetIDocumentUndoRedo() const;
503
504
    // IDocumentLinksAdministration
505
    IDocumentLinksAdministration const & getIDocumentLinksAdministration() const;
506
    SW_DLLPUBLIC IDocumentLinksAdministration & getIDocumentLinksAdministration();
507
508
    ::sw::DocumentLinksAdministrationManager const & GetDocumentLinksAdministrationManager() const;
509
    ::sw::DocumentLinksAdministrationManager & GetDocumentLinksAdministrationManager();
510
511
    // IDocumentFieldsAccess
512
    IDocumentFieldsAccess const & getIDocumentFieldsAccess() const;
513
    SW_DLLPUBLIC IDocumentFieldsAccess & getIDocumentFieldsAccess();
514
515
    ::sw::DocumentFieldsManager & GetDocumentFieldsManager();
516
517
    // Returns 0 if the field cannot hide para, or a positive integer indicating the field type
518
    // "weight" when several hiding fields' FieldHidesPara() give conflicting results
519
    int FieldCanHideParaWeight(SwFieldIds eFieldId) const;
520
    bool FieldHidesPara(const SwField& rField) const;
521
522
    // IDocumentContentOperations
523
    IDocumentContentOperations const & getIDocumentContentOperations() const;
524
    SW_DLLPUBLIC IDocumentContentOperations & getIDocumentContentOperations();
525
    ::sw::DocumentContentOperationsManager const & GetDocumentContentOperationsManager() const;
526
    ::sw::DocumentContentOperationsManager & GetDocumentContentOperationsManager();
527
528
    bool UpdateParRsid( SwTextNode *pTextNode, sal_uInt32 nVal = 0 );
529
    void UpdateRsid( const SwPaM &rRg, sal_Int32 nLen );
530
531
    // IDocumentStylePoolAccess
532
    IDocumentStylePoolAccess const & getIDocumentStylePoolAccess() const;
533
    SW_DLLPUBLIC IDocumentStylePoolAccess & getIDocumentStylePoolAccess();
534
535
    // SwLineNumberInfo
536
    SW_DLLPUBLIC const SwLineNumberInfo& GetLineNumberInfo() const;
537
    SW_DLLPUBLIC void SetLineNumberInfo(const SwLineNumberInfo& rInfo);
538
539
    // IDocumentStatistics
540
    IDocumentStatistics const & getIDocumentStatistics() const;
541
    SW_DLLPUBLIC IDocumentStatistics & getIDocumentStatistics();
542
543
    ::sw::DocumentStatisticsManager const & GetDocumentStatisticsManager() const;
544
    ::sw::DocumentStatisticsManager & GetDocumentStatisticsManager();
545
546
    // IDocumentState
547
    IDocumentState const & getIDocumentState() const;
548
    SW_DLLPUBLIC IDocumentState & getIDocumentState();
549
550
    // IDocumentDrawModelAccess
551
    void AddDrawUndo( std::unique_ptr<SdrUndoAction> );
552
    SW_DLLPUBLIC IDocumentDrawModelAccess const & getIDocumentDrawModelAccess() const;
553
    SW_DLLPUBLIC IDocumentDrawModelAccess & getIDocumentDrawModelAccess();
554
555
    ::sw::DocumentDrawModelManager const & GetDocumentDrawModelManager() const;
556
    ::sw::DocumentDrawModelManager & GetDocumentDrawModelManager();
557
558
    // IDocumentLayoutAccess
559
    SW_DLLPUBLIC IDocumentLayoutAccess const & getIDocumentLayoutAccess() const;
560
    SW_DLLPUBLIC IDocumentLayoutAccess & getIDocumentLayoutAccess();
561
562
    ::sw::DocumentLayoutManager const & GetDocumentLayoutManager() const;
563
    ::sw::DocumentLayoutManager & GetDocumentLayoutManager();
564
565
    // IDocumentTimerAccess
566
    // Our own 'IdleTimer' calls the following method
567
    IDocumentTimerAccess const & getIDocumentTimerAccess() const;
568
    IDocumentTimerAccess & getIDocumentTimerAccess();
569
570
    // IDocumentChartDataProviderAccess
571
    IDocumentChartDataProviderAccess const & getIDocumentChartDataProviderAccess() const;
572
    IDocumentChartDataProviderAccess & getIDocumentChartDataProviderAccess();
573
574
    // IDocumentListItems
575
    IDocumentListItems const & getIDocumentListItems() const;
576
    IDocumentListItems & getIDocumentListItems();
577
578
    // IDocumentOutlineNodes
579
    IDocumentOutlineNodes const & getIDocumentOutlineNodes() const;
580
    IDocumentOutlineNodes & getIDocumentOutlineNodes();
581
582
    // IDocumentListsAccess
583
    IDocumentListsAccess const & getIDocumentListsAccess() const;
584
    SW_DLLPUBLIC IDocumentListsAccess & getIDocumentListsAccess();
585
586
    //IDocumentExternalData
587
    IDocumentExternalData const & getIDocumentExternalData() const;
588
    SW_DLLPUBLIC IDocumentExternalData & getIDocumentExternalData();
589
590
    //End of Interfaces
591
592
0
    void setDocAccTitle( const OUString& rTitle ) { msDocAccTitle = rTitle; }
593
0
    const OUString& getDocAccTitle() const { return msDocAccTitle; }
594
595
    // INextInterface here
596
    DECL_LINK(CalcFieldValueHdl, EditFieldInfo*, void);
597
598
    // OLE ???
599
19.2k
    bool IsOLEPrtNotifyPending() const  { return mbOLEPrtNotifyPending; }
600
    inline void SetOLEPrtNotifyPending( bool bSet = true );
601
    void PrtOLENotify( bool bAll ); // All or only marked
602
603
0
    bool IsPrepareSelAll() const { return mbIsPrepareSelAll; }
604
0
    void SetPrepareSelAll() { mbIsPrepareSelAll = true; }
605
606
    void SetContainsAtPageObjWithContentAnchor( const bool bFlag )
607
0
    {
608
0
        mbContainsAtPageObjWithContentAnchor = bFlag;
609
0
    }
610
    bool DoesContainAtPageObjWithContentAnchor()
611
21.4k
    {
612
21.4k
        return mbContainsAtPageObjWithContentAnchor;
613
21.4k
    }
614
615
    /** Returns positions of all FlyFrames in the document.
616
     If a Pam-Pointer is passed the FlyFrames attached to paragraphs
617
     have to be surrounded completely by css::awt::Selection.
618
     ( Start < Pos < End ) !!!
619
     (Required for Writers.) */
620
    SW_DLLPUBLIC SwPosFlyFrames GetAllFlyFormats( const SwPaM*,
621
                        bool bDrawAlso,
622
                        bool bAsCharAlso = false ) const;
623
624
    SwFlyFrameFormat  *MakeFlyFrameFormat (const UIName &rFormatName, SwFrameFormat *pDerivedFrom);
625
    SwDrawFrameFormat *MakeDrawFrameFormat(const UIName &rFormatName, SwFrameFormat *pDerivedFrom);
626
627
    // From now on this interface has to be used for Flys.
628
    // pAnchorPos must be set, if they are not attached to pages AND
629
    // Anchor is not already set at valid ContentPos
630
    // in FlySet/FrameFormat.
631
    /* new parameter bCalledFromShell
632
633
       true: An existing adjust item at pAnchorPos is propagated to
634
       the content node of the new fly section. That propagation only
635
       takes place if there is no adjust item in the paragraph style
636
       for the new fly section.
637
638
       false: no propagation
639
    */
640
    SW_DLLPUBLIC SwFlyFrameFormat* MakeFlySection( RndStdIds eAnchorType,
641
                                 const SwPosition* pAnchorPos,
642
                                 const SfxItemSet* pSet = nullptr,
643
                                 SwFrameFormat *pParent = nullptr,
644
                                 bool bCalledFromShell = false );
645
    SwFlyFrameFormat* MakeFlyAndMove( const SwPaM& rPam, const SfxItemSet& rSet,
646
                                const SwSelBoxes* pSelBoxes,
647
                                SwFrameFormat *pParent );
648
649
    // Helper that checks for unique items for DrawingLayer items of type NameOrIndex
650
    // and evtl. corrects that items to ensure unique names for that type. This call may
651
    // modify/correct entries inside of the given SfxItemSet, and it will apply a name to
652
    // the items in question (what is essential to make the named slots associated with
653
    // these items work for the UNO API and thus e.g. for ODF import/export)
654
    void CheckForUniqueItemForLineFillNameOrIndex(SfxItemSet& rSet);
655
656
    SW_DLLPUBLIC bool SetFlyFrameAttr( SwFrameFormat& rFlyFormat, SfxItemSet& rSet );
657
658
    bool SetFrameFormatToFly( SwFrameFormat& rFlyFormat, SwFrameFormat& rNewFormat,
659
                        SfxItemSet* pSet = nullptr, bool bKeepOrient = false );
660
    void SetFlyFrameTitle( SwFlyFrameFormat& rFlyFrameFormat,
661
                         const OUString& sNewTitle );
662
    void SetFlyFrameDescription( SwFlyFrameFormat& rFlyFrameFormat,
663
                               const OUString& sNewDescription );
664
    void SetFlyFrameDecorative(SwFlyFrameFormat& rFlyFrameFormat,
665
                               bool isDecorative);
666
667
    // Footnotes
668
    // Footnote information
669
233k
    const SwFootnoteInfo& GetFootnoteInfo() const         { return *mpFootnoteInfo; }
670
    SW_DLLPUBLIC void SetFootnoteInfo(const SwFootnoteInfo& rInfo);
671
50.9k
    const SwEndNoteInfo& GetEndNoteInfo() const { return *mpEndNoteInfo; }
672
    SW_DLLPUBLIC void SetEndNoteInfo(const SwEndNoteInfo& rInfo);
673
1.13M
          SwFootnoteIdxs& GetFootnoteIdxs()       { return *mpFootnoteIdxs; }
674
3.19k
    const SwFootnoteIdxs& GetFootnoteIdxs() const { return *mpFootnoteIdxs; }
675
    /// change footnotes in range
676
    bool SetCurFootnote( const SwPaM& rPam, const OUString& rNumStr,
677
                    bool bIsEndNote );
678
679
    /** Operations on the content of the document e.g.
680
        spell-checking/hyphenating/word-counting
681
    */
682
    css::uno::Any
683
            Spell( SwPaM&, css::uno::Reference< css::linguistic2::XSpellChecker1 > const &,
684
                   sal_uInt16* pPageCnt, sal_uInt16* pPageSt, bool bGrammarCheck,
685
                   SwRootFrame const* pLayout, // for grammar-check
686
                   SwConversionArgs *pConvArgs = nullptr ) const;
687
688
    css::uno::Reference< css::linguistic2::XHyphenatedWord >
689
            Hyphenate( SwPaM *pPam, const Point &rCursorPos,
690
                         sal_uInt16* pPageCnt, sal_uInt16* pPageSt );
691
692
    // count words in pam
693
    static void CountWords( const SwPaM& rPaM, SwDocStat& rStat );
694
695
    // Glossary Document
696
1.33M
    bool IsInsOnlyTextGlossary() const      { return mbInsOnlyTextGlssry; }
697
698
    void Summary(SwDoc& rExtDoc, sal_uInt8 nLevel, sal_uInt8 nPara, bool bImpress);
699
700
    void ChangeAuthorityData(const SwAuthEntry* pNewData);
701
702
    bool IsInHeaderFooter( const SwNode& ) const;
703
    SW_DLLPUBLIC SvxFrameDirection GetTextDirection( const SwPosition& rPos,
704
                            const Point* pPt = nullptr ) const;
705
    SW_DLLPUBLIC bool IsInVerticalText( const SwPosition& rPos ) const;
706
707
    // Database  and DB-Manager
708
0
    void SetDBManager( SwDBManager* pNewMgr )     { m_pDBManager = pNewMgr; }
709
0
    SwDBManager* GetDBManager() const             { return m_pDBManager; }
710
    void ChangeDBFields( const std::vector<OUString>& rOldNames,
711
                        const OUString& rNewName );
712
    SW_DLLPUBLIC void SetInitDBFields(bool b);
713
714
    // Find out which databases are used by fields.
715
    void GetAllUsedDB( std::vector<OUString>& rDBNameList,
716
                       const std::vector<OUString>* pAllDBNames = nullptr );
717
718
    void ChgDBData( const SwDBData& rNewData );
719
    SW_DLLPUBLIC SwDBData const & GetDBData();
720
721
    // Some helper functions
722
    UIName GetUniqueGrfName(UIName rPrefix = UIName()) const;
723
    UIName GetUniqueOLEName() const;
724
    SW_DLLPUBLIC UIName GetUniqueFrameName() const;
725
    UIName GetUniqueShapeName() const;
726
    SW_DLLPUBLIC UIName GetUniqueDrawObjectName() const;
727
728
    SW_DLLPUBLIC o3tl::sorted_vector<SwRootFrame*> GetAllLayouts();
729
730
    void SetFlyName( SwFlyFrameFormat& rFormat, const UIName& rName );
731
    SW_DLLPUBLIC const SwFlyFrameFormat* FindFlyByName( const UIName& rName, SwNodeType nNdTyp = SwNodeType::NONE ) const;
732
733
    static void GetGrfNms( const SwFlyFrameFormat& rFormat, OUString* pGrfName, OUString* pFltName );
734
735
    // Set a valid name for all Flys that have none (Called by Readers after reading).
736
    void SetAllUniqueFlyNames();
737
738
    /** Reset attributes. All TextHints and (if completely selected) all hard-
739
     formatted stuff (auto-formats) are removed.
740
     Introduce new optional parameter <bSendDataChangedEvents> in order to
741
     control, if the side effect "send data changed events" is triggered or not. */
742
    void ResetAttrs( const SwPaM &rRg,
743
                     bool bTextAttr = true,
744
                     const o3tl::sorted_vector<sal_uInt16> &rAttrs = o3tl::sorted_vector<sal_uInt16>(),
745
                     const bool bSendDataChangedEvents = true,
746
                     SwRootFrame const* pLayout = nullptr);
747
    void RstTextAttrs(const SwPaM &rRg, bool bInclRefToxMark = false,
748
            bool bExactRange = false, SwRootFrame const* pLayout = nullptr);
749
750
    /** Set attribute in given format.1y
751
     *  If Undo is enabled, the old values is added to the Undo history. */
752
    SW_DLLPUBLIC void SetAttr( const SfxPoolItem&, SwFormat& );
753
    /** Set attribute in given format.1y
754
     *  If Undo is enabled, the old values is added to the Undo history. */
755
    SW_DLLPUBLIC void SetAttr( const SfxItemSet&, SwFormat& );
756
757
    // method to reset a certain attribute at the given format
758
    void ResetAttrAtFormat( const std::vector<sal_uInt16>& rIds,
759
                            SwFormat& rChangedFormat );
760
761
    /** Set attribute as new default attribute in current document.
762
     If Undo is activated, the old one is listed in Undo-History. */
763
    void SetDefault( const SfxPoolItem& );
764
    void SetDefault( const SfxItemSet& );
765
766
    // Query default attribute in this document.
767
    SW_DLLPUBLIC const SfxPoolItem& GetDefault( sal_uInt16 nFormatHint ) const;
768
    template<class T> const T&  GetDefault( TypedWhichId<T> nWhich ) const
769
617k
    {
770
617k
        return static_cast<const T&>(GetDefault(sal_uInt16(nWhich)));
771
617k
    }
Unexecuted instantiation: SvxTabStopItem const& SwDoc::GetDefault<SvxTabStopItem>(TypedWhichId<SvxTabStopItem>) const
SvxLanguageItem const& SwDoc::GetDefault<SvxLanguageItem>(TypedWhichId<SvxLanguageItem>) const
Line
Count
Source
769
216k
    {
770
216k
        return static_cast<const T&>(GetDefault(sal_uInt16(nWhich)));
771
216k
    }
Unexecuted instantiation: SvxFontItem const& SwDoc::GetDefault<SvxFontItem>(TypedWhichId<SvxFontItem>) const
SvxHyphenZoneItem const& SwDoc::GetDefault<SvxHyphenZoneItem>(TypedWhichId<SvxHyphenZoneItem>) const
Line
Count
Source
769
68.9k
    {
770
68.9k
        return static_cast<const T&>(GetDefault(sal_uInt16(nWhich)));
771
68.9k
    }
SwTextGridItem const& SwDoc::GetDefault<SwTextGridItem>(TypedWhichId<SwTextGridItem>) const
Line
Count
Source
769
332k
    {
770
332k
        return static_cast<const T&>(GetDefault(sal_uInt16(nWhich)));
771
332k
    }
SvxColorItem const& SwDoc::GetDefault<SvxColorItem>(TypedWhichId<SvxColorItem>) const
Line
Count
Source
769
62
    {
770
62
        return static_cast<const T&>(GetDefault(sal_uInt16(nWhich)));
771
62
    }
772
773
    // Do not expand text attributes.
774
    bool DontExpandFormat( const SwPosition& rPos, bool bFlag = true );
775
776
    // Formats
777
0
    const sw::FrameFormats<SwFrameFormat*>* GetFrameFormats() const     { return mpFrameFormatTable.get(); }
778
331k
          sw::FrameFormats<SwFrameFormat*>* GetFrameFormats()           { return mpFrameFormatTable.get(); }
779
7.84k
    const SwCharFormats* GetCharFormats() const   { return mpCharFormatTable.get();}
780
534k
          SwCharFormats* GetCharFormats()         { return mpCharFormatTable.get();}
781
782
    // LayoutFormats (frames, DrawObjects), sometimes const sometimes not
783
13.4M
    const sw::FrameFormats<sw::SpzFrameFormat*>* GetSpzFrameFormats() const   { return mpSpzFrameFormatTable.get(); }
784
6.80M
          sw::FrameFormats<sw::SpzFrameFormat*>* GetSpzFrameFormats()         { return mpSpzFrameFormatTable.get(); }
785
786
73.9k
    const SwFrameFormat *GetDfltFrameFormat() const   { return mpDfltFrameFormat.get(); }
787
1.76M
          SwFrameFormat *GetDfltFrameFormat()         { return mpDfltFrameFormat.get(); }
788
0
    const SwFrameFormat *GetEmptyPageFormat() const { return mpEmptyPageFormat.get(); }
789
69.0k
          SwFrameFormat *GetEmptyPageFormat()       { return mpEmptyPageFormat.get(); }
790
0
    const SwFrameFormat *GetColumnContFormat() const{ return mpColumnContFormat.get(); }
791
6
          SwFrameFormat *GetColumnContFormat()      { return mpColumnContFormat.get(); }
792
11.7k
    const SwCharFormat *GetDfltCharFormat() const { return mpDfltCharFormat.get();}
793
3.11M
          SwCharFormat *GetDfltCharFormat()       { return mpDfltCharFormat.get();}
794
795
    // @return the interface of the management of (auto)styles
796
19.2M
    IStyleAccess& GetIStyleAccess() { return *mpStyleAccess; }
797
798
    // Remove all language dependencies from all existing formats
799
    void RemoveAllFormatLanguageDependencies();
800
801
    SW_DLLPUBLIC SwFrameFormat* MakeFrameFormat(const UIName &rFormatName, SwFrameFormat *pDerivedFrom,
802
                          bool bAuto = true);
803
    SW_DLLPUBLIC void DelFrameFormat( SwFrameFormat *pFormat, bool bBroadcast = false );
804
    SwFrameFormat* FindFrameFormatByName( const UIName& rName ) const;
805
806
    SW_DLLPUBLIC SwCharFormat *MakeCharFormat(const UIName &rFormatName, SwCharFormat *pDerivedFrom);
807
    void       DelCharFormat(size_t nFormat, bool bBroadcast = false);
808
    void       DelCharFormat(SwCharFormat const * pFormat, bool bBroadcast = false);
809
    SwCharFormat* FindCharFormatByName( const UIName& rName ) const
810
483k
        {   return mpCharFormatTable->FindFormatByName(rName); }
811
812
    // Formatcollections (styles)
813
    // TXT
814
0
    const SwTextFormatColl* GetDfltTextFormatColl() const { return mpDfltTextFormatColl.get(); }
815
842k
    SwTextFormatColl* GetDfltTextFormatColl() { return mpDfltTextFormatColl.get(); }
816
0
    const SwTextFormatColls *GetTextFormatColls() const { return mpTextFormatCollTable.get(); }
817
39.2M
    SwTextFormatColls *GetTextFormatColls() { return mpTextFormatCollTable.get(); }
818
    SW_DLLPUBLIC SwTextFormatColl *MakeTextFormatColl( const UIName &rFormatName,
819
                                  SwTextFormatColl *pDerivedFrom);
820
    SwConditionTextFormatColl* MakeCondTextFormatColl( const UIName &rFormatName,
821
                                               SwTextFormatColl *pDerivedFrom);
822
    void DelTextFormatColl(size_t nFormat, bool bBroadcast = false);
823
    void DelTextFormatColl( SwTextFormatColl const * pColl, bool bBroadcast = false );
824
    /** Add 4th optional parameter <bResetListAttrs>.
825
     'side effect' of <SetTextFormatColl> with <bReset = true> is that the hard
826
     attributes of the affected text nodes are cleared, except the break
827
     attribute, the page description attribute and the list style attribute.
828
     The new parameter <bResetListAttrs> indicates, if the list attributes
829
     (list style, restart at and restart with) are cleared as well in case
830
     that <bReset = true> and the paragraph style has a list style attribute set. */
831
    SW_DLLPUBLIC bool SetTextFormatColl(const SwPaM &rRg, SwTextFormatColl *pFormat,
832
                       const bool bReset = true,
833
                       const bool bResetListAttrs = false,
834
                       const bool bResetAllCharAttrs = false,
835
                       SwRootFrame const* pLayout = nullptr);
836
    SwTextFormatColl* FindTextFormatCollByName( const UIName& rName ) const
837
3.80M
        {   return mpTextFormatCollTable->FindFormatByName(rName); }
838
839
    void ChkCondColls();
840
841
0
    const SwGrfFormatColl* GetDfltGrfFormatColl() const   { return mpDfltGrfFormatColl.get(); }
842
128k
    SwGrfFormatColl* GetDfltGrfFormatColl()  { return mpDfltGrfFormatColl.get(); }
843
0
    const SwGrfFormatColls *GetGrfFormatColls() const     { return mpGrfFormatCollTable.get(); }
844
    SwGrfFormatColl *MakeGrfFormatColl(const UIName &rFormatName,
845
                                    SwGrfFormatColl *pDerivedFrom);
846
847
    // Table formatting
848
8.36k
    const sw::TableFrameFormats* GetTableFrameFormats() const  { return mpTableFrameFormatTable.get(); }
849
5.45k
          sw::TableFrameFormats* GetTableFrameFormats()        { return mpTableFrameFormatTable.get(); }
850
    SW_DLLPUBLIC size_t GetTableFrameFormatCount( bool bUsed ) const;
851
    SwTableFormat& GetTableFrameFormat(size_t nFormat, bool bUsed ) const;
852
    SwTableFormat* MakeTableFrameFormat(const UIName &rFormatName, SwFrameFormat *pDerivedFrom);
853
    void        DelTableFrameFormat( SwTableFormat* pFormat );
854
    SW_DLLPUBLIC SwTableFormat* FindTableFormatByName( const UIName& rName, bool bAll = false ) const;
855
856
    /** Access to frames.
857
    Iterate over Flys - for Basic-Collections. */
858
    SW_DLLPUBLIC size_t GetFlyCount( FlyCntType eType, bool bIgnoreTextBoxes = false ) const;
859
    SwFrameFormat* GetFlyNum(size_t nIdx, FlyCntType eType, bool bIgnoreTextBoxes = false );
860
    SW_DLLPUBLIC std::vector<SwFrameFormat const*> GetFlyFrameFormats(
861
            FlyCntType eType,
862
            bool bIgnoreTextBoxes);
863
    SwFrameFormat* GetFlyFrameFormatByName( const UIName& sFrameFormatName );
864
865
    // Copy formats in own arrays and return them.
866
    SwFrameFormat  *CopyFrameFormat ( const SwFrameFormat& );
867
    SwCharFormat *CopyCharFormat( const SwCharFormat& );
868
    SwTextFormatColl* CopyTextColl( const SwTextFormatColl& rColl );
869
    SwGrfFormatColl* CopyGrfColl( const SwGrfFormatColl& rColl );
870
871
    // Replace all styles with those from rSource.
872
    void ReplaceStyles( const SwDoc& rSource, bool bIncludePageStyles = true );
873
874
    // Replace all property defaults with those from rSource.
875
    SW_DLLPUBLIC void ReplaceDefaults( const SwDoc& rSource );
876
877
    // Replace all compatibility options with those from rSource.
878
    SW_DLLPUBLIC void ReplaceCompatibilityOptions( const SwDoc& rSource );
879
880
    /** Replace all user defined document properties with xSourceDocProps.
881
        Convenience function used by ReplaceDocumentProperties to skip some UNO calls.
882
     */
883
    void ReplaceUserDefinedDocumentProperties( const css::uno::Reference< css::document::XDocumentProperties >& xSourceDocProps );
884
885
    /** Replace document properties with those from rSource.
886
887
        This includes the user defined document properties!
888
     */
889
    SW_DLLPUBLIC void ReplaceDocumentProperties(const SwDoc& rSource, bool mailMerge = false);
890
891
    // Query if style (paragraph- / character- / frame- / page-) is used.
892
    bool IsUsed( const sw::BroadcastingModify& ) const;
893
    /// Query if table style is used.
894
    bool IsUsed( const SwTableAutoFormat& ) const;
895
    SW_DLLPUBLIC bool IsUsed( const SwNumRule& ) const;
896
897
    // Set name of newly loaded document template.
898
    size_t SetDocPattern(const OUString& rPatternName);
899
900
    // @return name of document template. Can be 0!
901
    const OUString* GetDocPattern(size_t nPos) const;
902
903
    // travel over PaM Ring
904
    bool InsertGlossary( SwTextBlocks& rBlock, const OUString& rEntry,
905
                        SwPaM& rPaM, SwCursorShell* pShell = nullptr);
906
907
    /** get the set of printable pages for the XRenderable API by
908
     evaluating the respective settings (see implementation) */
909
    static void CalculatePagesForPrinting( const SwRootFrame& rLayout, SwRenderData &rData, const SwPrintUIOptions &rOptions, bool bIsPDFExport,
910
            sal_Int32 nDocPageCount );
911
    static void UpdatePagesForPrintingWithPostItData( SwRenderData &rData, const SwPrintUIOptions &rOptions,
912
            sal_Int32 nDocPageCount );
913
    static void CalculatePagePairsForProspectPrinting( const SwRootFrame& rLayout, SwRenderData &rData, const SwPrintUIOptions &rOptions,
914
            sal_Int32 nDocPageCount );
915
    static void CalculateNonBlankPages( const SwRootFrame& rLayout, sal_uInt16& nDocPageCount, sal_uInt16& nActualPage );
916
917
    // PageDescriptor interface.
918
949k
    size_t GetPageDescCnt() const { return m_PageDescs.size(); }
919
3.57k
    const SwPageDesc& GetPageDesc(const size_t i) const { return *m_PageDescs[i]; }
920
1.33M
    SwPageDesc& GetPageDesc(size_t const i) { return *m_PageDescs[i]; }
921
    SW_DLLPUBLIC SwPageDesc* FindPageDesc(const UIName& rName, size_t* pPos = nullptr) const;
922
    // Just searches the pointer in the m_PageDescs vector!
923
    bool        ContainsPageDesc(const SwPageDesc *pDesc, size_t* pPos) const;
924
925
    /** Copy the complete PageDesc - beyond document and "deep"!
926
     Optionally copying of PoolFormatId, -HlpId can be prevented. */
927
    SW_DLLPUBLIC void CopyPageDesc( const SwPageDesc& rSrcDesc, SwPageDesc& rDstDesc,
928
                        bool bCopyPoolIds = true );
929
930
    /** Copy header (with contents) from SrcFormat to DestFormat
931
     (can also be copied into other document). */
932
    void CopyHeader( const SwFrameFormat& rSrcFormat, SwFrameFormat& rDestFormat )
933
161k
        { CopyPageDescHeaderFooterImpl( true, rSrcFormat, rDestFormat ); }
934
935
    /** Copy footer (with contents) from SrcFormat to DestFormat.
936
     (can also be copied into other document). */
937
    void CopyFooter( const SwFrameFormat& rSrcFormat, SwFrameFormat& rDestFormat )
938
150k
        { CopyPageDescHeaderFooterImpl( false, rSrcFormat, rDestFormat ); }
939
940
    // For Reader
941
    SW_DLLPUBLIC void ChgPageDesc( const UIName & rName, const SwPageDesc& );
942
    SW_DLLPUBLIC void ChgPageDesc( size_t i, const SwPageDesc& );
943
    SW_DLLPUBLIC void DelPageDesc( const UIName & rName, bool bBroadcast = false );
944
    SW_DLLPUBLIC void DelPageDesc( size_t i, bool bBroadcast = false );
945
    void PreDelPageDesc(SwPageDesc const * pDel);
946
    SW_DLLPUBLIC SwPageDesc* MakePageDesc(const UIName &rName, const SwPageDesc* pCpy = nullptr,
947
                             bool bRegardLanguage = true);
948
    void BroadcastStyleOperation(const UIName& rName, SfxStyleFamily eFamily,
949
                                 SfxHintId nOp);
950
951
    /** The html import sometimes overwrites the page sizes set in
952
     the page descriptions. This function is used to correct this. */
953
    void CheckDefaultPageFormat();
954
955
    // Methods for tables/indices
956
    static sal_uInt16 GetCurTOXMark( const SwPosition& rPos, SwTOXMarks& );
957
    void DeleteTOXMark( const SwTOXMark* pTOXMark );
958
    SW_DLLPUBLIC const SwTOXMark& GotoTOXMark( const SwTOXMark& rCurTOXMark,
959
                                SwTOXSearch eDir, bool bInReadOnly );
960
    /// Iterate over all SwTOXMark, if the function returns false, iteration is stopped
961
    SW_DLLPUBLIC void ForEachTOXMark( const std::function<bool(const SwTOXMark&)>&  ) const;
962
963
    // Insert/Renew table/index
964
    SW_DLLPUBLIC SwTOXBaseSection* InsertTableOf( const SwPosition& rPos,
965
                                            const SwTOXBase& rTOX,
966
                                            const SfxItemSet* pSet = nullptr,
967
                                            bool bExpand = false,
968
                                    SwRootFrame const* pLayout = nullptr);
969
    SwTOXBaseSection* InsertTableOf( const SwPaM& aPam,
970
                                            const SwTOXBase& rTOX,
971
                                            const SfxItemSet* pSet = nullptr,
972
                                            bool bExpand = false,
973
                                    SwRootFrame const* pLayout = nullptr );
974
    void              InsertTableOf( SwNodeOffset nSttNd, SwNodeOffset nEndNd,
975
                                            const SwTOXBase& rTOX,
976
                                            const SfxItemSet* pSet );
977
    SW_DLLPUBLIC static SwTOXBase* GetCurTOX( const SwPosition& rPos );
978
    static const SwAttrSet* GetTOXBaseAttrSet(const SwTOXBase& rTOX);
979
980
    bool DeleteTOX( const SwTOXBase& rTOXBase, bool bDelNodes );
981
    OUString GetUniqueTOXBaseName( const SwTOXType& rType,
982
                                   const OUString& sChkStr ) const;
983
984
    bool SetTOXBaseName(const SwTOXBase& rTOXBase, const UIName& rName);
985
986
    // After reading file update all tables/indices
987
0
    void SetUpdateTOX( bool bFlag )            { mbUpdateTOX = bFlag; }
988
4.16k
    bool IsUpdateTOX() const                   { return mbUpdateTOX; }
989
990
0
    const OUString& GetTOIAutoMarkURL() const {return msTOIAutoMarkURL;}
991
0
    void            SetTOIAutoMarkURL(const OUString& rSet) {msTOIAutoMarkURL = rSet;}
992
993
9.30M
    bool IsInReading() const                    { return mbInReading; }
994
95.1k
    void SetInReading( bool bNew )              { mbInReading = bNew; }
995
996
0
    bool IsInWriting() const { return mbInWriting; }
997
66.7k
    void SetInWriting(bool bNew) { mbInWriting = bNew; }
998
999
1.10M
    bool IsInMailMerge() const                  { return mbInMailMerge; }
1000
0
    void SetInMailMerge( bool bNew )            { mbInMailMerge = bNew; }
1001
1002
1.62M
    bool IsClipBoard() const                    { return mbClipBoard; }
1003
    // N.B.: must be called right after constructor! (@see GetXmlIdRegistry)
1004
0
    void SetClipBoard( bool bNew )              { mbClipBoard = bNew; }
1005
1006
0
    bool IsColumnSelection() const              { return mbColumnSelection; }
1007
0
    void SetColumnSelection( bool bNew )        { mbColumnSelection = bNew; }
1008
1009
1.64M
    bool IsInXMLImport() const { return mbInXMLImport; }
1010
58.3k
    void SetInXMLImport( bool bNew ) { mbInXMLImport = bNew; }
1011
0
    bool IsInXMLImport242() const { return mbInXMLImport242; }
1012
3.26k
    void SetInXMLImport242(bool const bNew) { mbInXMLImport242 = bNew; }
1013
151k
    bool IsInWriterfilterImport() const { return mbInWriterfilterImport; }
1014
17.0k
    void SetInWriterfilterImport(bool const b) { mbInWriterfilterImport = b; }
1015
1016
    // Manage types of tables/indices
1017
    SW_DLLPUBLIC sal_uInt16 GetTOXTypeCount( TOXTypes eTyp ) const;
1018
    SW_DLLPUBLIC const SwTOXType* GetTOXType( TOXTypes eTyp, sal_uInt16 nId ) const;
1019
    const SwTOXType* InsertTOXType( const SwTOXType& rTyp );
1020
0
    const SwTOXTypes& GetTOXTypes() const { return *mpTOXTypes; }
1021
1022
    const SwTOXBase*    GetDefaultTOXBase( TOXTypes eTyp, bool bCreate );
1023
    void                SetDefaultTOXBase(const SwTOXBase& rBase);
1024
1025
    // Key for management of index.
1026
    void GetTOIKeys(SwTOIKeyType eTyp, std::vector<OUString>& rArr,
1027
            SwRootFrame const& rLayout) const;
1028
1029
    // Sort table text.
1030
    bool SortTable(const SwSelBoxes& rBoxes, const SwSortOptions&);
1031
    bool SortText(const SwPaM&, const SwSortOptions&);
1032
1033
    // Correct the SwPosition-Objects that are registered with the document
1034
    // e. g. Bookmarks or tables/indices.
1035
    // If bMoveCursor is set move Cursor too.
1036
1037
    // Set everything in rOldNode on rNewPos + Offset.
1038
    void CorrAbs(
1039
        const SwNode& rOldNode,
1040
        const SwPosition& rNewPos,
1041
        const sal_Int32 nOffset = 0,
1042
        bool bMoveCursor = false );
1043
1044
    // Set everything in the range of [rStartNode, rEndNode] to rNewPos.
1045
    static void CorrAbs(
1046
        const SwNodeIndex& rStartNode,
1047
        const SwNodeIndex& rEndNode,
1048
        const SwPosition& rNewPos,
1049
        bool bMoveCursor = false );
1050
1051
    // Set everything in this range from rRange to rNewPos.
1052
    static void CorrAbs(
1053
        const SwPaM& rRange,
1054
        const SwPosition& rNewPos,
1055
        bool bMoveCursor = false );
1056
1057
    // Set everything in rOldNode to relative Pos.
1058
    void CorrRel(
1059
        const SwNode& rOldNode,
1060
        const SwPosition& rNewPos,
1061
        const sal_Int32 nOffset = 0,
1062
        bool bMoveCursor = false );
1063
1064
    // Query / set rules for Outline.
1065
    SwNumRule* GetOutlineNumRule() const
1066
12.0M
    {
1067
12.0M
        return mpOutlineRule;
1068
12.0M
    }
1069
    SW_DLLPUBLIC void SetOutlineNumRule( const SwNumRule& rRule );
1070
    SW_DLLPUBLIC void PropagateOutlineRule();
1071
1072
    // Outline - promote / demote.
1073
    bool OutlineUpDown(const SwPaM& rPam, short nOffset, SwRootFrame const* pLayout = nullptr);
1074
1075
    /// Outline - move up / move down.
1076
    bool MoveOutlinePara( const SwPaM& rPam,
1077
                    SwOutlineNodes::difference_type nOffset,
1078
                    const SwOutlineNodesInline* pOutlNdsInline = nullptr);
1079
1080
    SW_DLLPUBLIC bool GotoOutline(SwPosition& rPos, const OUString& rName, SwRootFrame const* = nullptr) const;
1081
1082
    enum class SetNumRuleMode {
1083
        Default = 0,
1084
        /// indicates if a new list is created by applying the given list style.
1085
        CreateNewList = 1,
1086
        DontSetItem = 2,
1087
        /** If enabled, the indent attributes "before text" and
1088
          "first line indent" are additionally reset at the provided PaM,
1089
          if the list style makes use of the new list level attributes. */
1090
        ResetIndentAttrs = 4,
1091
        DontSetIfAlreadyApplied = 8
1092
    };
1093
1094
    /** Set or change numbering rule on text nodes, as direct formatting.
1095
     @param sContinuedListId If bCreateNewList is false, may contain the
1096
      list Id of a list which has to be continued by applying the given list style
1097
1098
     @return the set ListId if bSetItem is true */
1099
    OUString SetNumRule( const SwPaM&,
1100
                     const SwNumRule&,
1101
                     SetNumRuleMode mode,
1102
                     SwRootFrame const* pLayout = nullptr,
1103
                     const OUString& sContinuedListId = OUString(),
1104
                     SvxTextLeftMarginItem const* pTextLeftMarginToPropagate = nullptr,
1105
                     SvxFirstLineIndentItem const* pFirstLineIndentToPropagate = nullptr);
1106
    void SetCounted(const SwPaM&, bool bCounted, SwRootFrame const* pLayout);
1107
1108
    void MakeUniqueNumRules(const SwPaM & rPaM);
1109
1110
    void SetNumRuleStart( const SwPosition& rPos, bool bFlag = true );
1111
    void SetNodeNumStart( const SwPosition& rPos, sal_uInt16 nStt );
1112
1113
    // sw_redlinehide: may set rPos to different node (the one with the NumRule)
1114
    static SwNumRule* GetNumRuleAtPos(SwPosition& rPos, SwRootFrame const* pLayout = nullptr);
1115
1116
251k
    const SwNumRuleTable& GetNumRuleTable() const { return *mpNumRuleTable; }
1117
1118
    /**
1119
       Add numbering rule to document.
1120
1121
       @param pRule    rule to add
1122
    */
1123
    void AddNumRule(SwNumRule * pRule);
1124
1125
    // add optional parameter <eDefaultNumberFormatPositionAndSpaceMode>
1126
    SW_DLLPUBLIC sal_uInt16 MakeNumRule( const UIName &rName,
1127
        const SwNumRule* pCpy = nullptr,
1128
        const SvxNumberFormat::SvxNumPositionAndSpaceMode eDefaultNumberFormatPositionAndSpaceMode =
1129
            SvxNumberFormat::LABEL_WIDTH_AND_POSITION );
1130
    sal_uInt16 FindNumRule( const UIName& rName ) const;
1131
    std::set<OUString> GetUsedBullets();
1132
    SW_DLLPUBLIC SwNumRule* FindNumRulePtr( const UIName& rName ) const;
1133
1134
    // Deletion only possible if Rule is not used!
1135
    bool RenameNumRule(const UIName & aOldName, const UIName & aNewName,
1136
                           bool bBroadcast = false);
1137
    SW_DLLPUBLIC bool DelNumRule( const UIName& rName, bool bBroadCast = false );
1138
    SW_DLLPUBLIC UIName GetUniqueNumRuleName( const UIName* pChkStr = nullptr, bool bAutoNum = true ) const;
1139
1140
    void UpdateNumRule();   // Update all invalids.
1141
    void ChgNumRuleFormats( const SwNumRule& rRule );
1142
    void ReplaceNumRule( const SwPosition& rPos, const UIName& rOldRule,
1143
                        const UIName& rNewRule );
1144
1145
    // Goto next/previous on same level.
1146
    static bool GotoNextNum( SwPosition&, SwRootFrame const* pLayout,
1147
                        bool bOverUpper = true,
1148
                        sal_uInt8* pUpper = nullptr, sal_uInt8* pLower = nullptr );
1149
    static bool GotoPrevNum( SwPosition&, SwRootFrame const* pLayout,
1150
                        bool bOverUpper = true );
1151
1152
    /** Searches for a text node with a numbering rule.
1153
1154
       add optional parameter <bInvestigateStartNode>
1155
       add output parameter <sListId>
1156
1157
       \param rPos         position to start search
1158
       \param bForward     - true:  search forward
1159
                           - false: search backward
1160
       \param bNum         - true:  search for enumeration
1161
                           - false: search for itemize
1162
       \param bOutline     - true:  search for outline numbering rule
1163
                           - false: search for non-outline numbering rule
1164
       \param nNonEmptyAllowed   number of non-empty paragraphs allowed between
1165
                                 rPos and found paragraph
1166
1167
        @param sListId
1168
        output parameter - in case a list style is found, <sListId> holds the
1169
        list id, to which the text node belongs, which applies the found list style.
1170
1171
        @param bInvestigateStartNode
1172
        input parameter - boolean, indicating, if start node, determined by given
1173
        start position has to be investigated or not.
1174
     */
1175
    const SwNumRule * SearchNumRule(const SwPosition & rPos,
1176
                                    const bool bForward,
1177
                                    const bool bNum,
1178
                                    const bool bOutline,
1179
                                    int nNonEmptyAllowed,
1180
                                    OUString& sListId,
1181
                                    SwRootFrame const* pLayout,
1182
                                    const bool bInvestigateStartNode = false,
1183
                                    SvxTextLeftMarginItem const** o_ppTextLeftMargin = nullptr,
1184
                                    SvxFirstLineIndentItem const** o_ppFirstLineIndent = nullptr);
1185
1186
    // Paragraphs without numbering but with indents.
1187
    bool NoNum( const SwPaM& );
1188
1189
    // Delete, splitting of numbering list.
1190
    void DelNumRules(const SwPaM&, SwRootFrame const* pLayout = nullptr);
1191
1192
    // Invalidates all numrules
1193
    void InvalidateNumRules();
1194
1195
    bool NumUpDown(const SwPaM&, bool bDown, SwRootFrame const* pLayout = nullptr);
1196
1197
    /** Move selected paragraphs (not only numberings)
1198
     according to offsets. (if negative: go to doc start). */
1199
    bool MoveParagraph(SwPaM&, SwNodeOffset nOffset, bool bIsOutlMv = false);
1200
    bool MoveParagraphImpl(SwPaM&, SwNodeOffset nOffset, bool bIsOutlMv, SwRootFrame const*);
1201
1202
    bool NumOrNoNum( SwNode& rIdx, bool bDel = false);
1203
1204
    void StopNumRuleAnimations( const OutputDevice* );
1205
1206
    /** Insert new table at position @param rPos (will be inserted before Node!).
1207
     For AutoFormat at input: columns have to be set at predefined width.
1208
     The array holds the positions of the columns (not their widths).
1209
     new @param bCalledFromShell:
1210
       true: called from shell -> propagate existing adjust item at
1211
       rPos to every new cell. A existing adjust item in the table
1212
       heading or table contents paragraph style prevent that
1213
       propagation.
1214
       false: do not propagate
1215
    */
1216
    SW_DLLPUBLIC const SwTable* InsertTable( const SwInsertTableOptions& rInsTableOpts,  // HeadlineNoBorder
1217
                                const SwPosition& rPos, sal_uInt16 nRows,
1218
                                sal_uInt16 nCols, sal_Int16 eAdjust,
1219
                                const SwTableAutoFormat* pTAFormat = nullptr,
1220
                                const std::vector<sal_uInt16> *pColArr = nullptr,
1221
                                bool bCalledFromShell = false,
1222
                                bool bNewModel = true,
1223
                                const OUString& rTableName = {} );
1224
1225
    // If index is in a table, return TableNode, else 0.
1226
    static SwTableNode* IsIdxInTable( const SwNodeIndex& rIdx );
1227
    static SwTableNode* IsInTable( const SwNode& );
1228
1229
    // Create a balanced table out of the selected range.
1230
    const SwTable* TextToTable( const SwInsertTableOptions& rInsTableOpts, // HeadlineNoBorder,
1231
                                const SwPaM& rRange, sal_Unicode cCh,
1232
                                sal_Int16 eAdjust,
1233
                                const SwTableAutoFormat* );
1234
1235
    // text to table conversion - API support
1236
    const SwTable* TextToTable( const std::vector< std::vector<SwNodeRange> >& rTableNodes );
1237
1238
    bool TableToText( const SwTableNode* pTableNd, sal_Unicode cCh );
1239
1240
    // Create columns / rows in table.
1241
    void InsertCol( const SwCursor& rCursor,
1242
                    sal_uInt16 nCnt = 1, bool bBehind = true );
1243
    bool InsertCol( const SwSelBoxes& rBoxes,
1244
                    sal_uInt16 nCnt = 1, bool bBehind = true, bool bInsertDummy = true );
1245
    void InsertRow( const SwCursor& rCursor,
1246
                    sal_uInt16 nCnt = 1, bool bBehind = true );
1247
    SW_DLLPUBLIC bool InsertRow( const SwSelBoxes& rBoxes,
1248
                    sal_uInt16 nCnt = 1, bool bBehind = true, bool bInsertDummy = true );
1249
1250
    // Delete Columns/Rows in table.
1251
    enum class RowColMode { DeleteRow = 0, DeleteColumn = 1, DeleteProtected = 2 };
1252
    void DelTable(SwTableNode * pTable);
1253
    bool DeleteRowCol(const SwSelBoxes& rBoxes, RowColMode eMode = RowColMode::DeleteRow);
1254
    void DeleteRow( const SwCursor& rCursor );
1255
    void DeleteCol( const SwCursor& rCursor );
1256
1257
    // Split / concatenate boxes in table.
1258
    bool SplitTable( const SwSelBoxes& rBoxes, bool bVert,
1259
                       sal_uInt16 nCnt, bool bSameHeight = false );
1260
1261
    TableMergeErr MergeTable( SwPaM& rPam );
1262
    UIName GetUniqueTableName() const;
1263
    bool IsInsTableFormatNum() const;
1264
    bool IsInsTableChangeNumFormat() const;
1265
    bool IsInsTableAlignNum() const;
1266
    bool IsSplitVerticalByDefault() const;
1267
    void SetSplitVerticalByDefault(bool value);
1268
1269
    // From FEShell (for Undo and BModified).
1270
    static void GetTabCols( SwTabCols &rFill, const SwCellFrame* pBoxFrame );
1271
    void SetTabCols( const SwTabCols &rNew, bool bCurRowOnly,
1272
                    const SwCellFrame* pBoxFrame );
1273
    static void GetTabRows( SwTabCols &rFill, const SwCellFrame* pBoxFrame );
1274
    void SetTabRows( const SwTabCols &rNew, bool bCurColOnly,
1275
                    const SwCellFrame* pBoxFrame );
1276
1277
    // Direct access for UNO.
1278
    void SetTabCols(SwTable& rTab, const SwTabCols &rNew, const SwTabCols &rOld,
1279
                                    const SwTableBox *pStart, bool bCurRowOnly);
1280
1281
    void SetRowsToRepeat( SwTable &rTable, sal_uInt16 nSet );
1282
1283
    /// AutoFormat for table/table selection.
1284
    /// @param bResetDirect Reset direct formatting that might be applied to the cells.
1285
    bool SetTableAutoFormat(const SwSelBoxes& rBoxes, const SwTableAutoFormat& rNew, bool bResetDirect = false, TableStyleName const* pStyleNameToSet = nullptr);
1286
1287
    // Query attributes.
1288
    bool GetTableAutoFormat( const SwSelBoxes& rBoxes, SwTableAutoFormat& rGet );
1289
1290
    /// Return the available table styles.
1291
    SW_DLLPUBLIC SwTableAutoFormatTable& GetTableStyles();
1292
    const SwTableAutoFormatTable& GetTableStyles() const
1293
0
    {
1294
0
        return const_cast<SwDoc*>(this)->GetTableStyles();
1295
0
    }
1296
1297
    // Reapply styles to tables in the doc
1298
    void ResetTableStyles(const OUString& sTableStyle, std::u16string_view sOldName);
1299
    /// Counts table styles without triggering lazy-load of them.
1300
0
    bool HasTableStyles() const { return m_pTableStyles != nullptr; }
1301
    // Create a new table style. Tracked by Undo.
1302
    SW_DLLPUBLIC SwTableAutoFormat* MakeTableStyle(const TableStyleName& rName);
1303
    // Delete table style named rName. Tracked by undo.
1304
    SW_DLLPUBLIC std::unique_ptr<SwTableAutoFormat> DelTableStyle(const TableStyleName& rName, bool bBroadcast = false);
1305
    // Change (replace) a table style named rName. Tracked by undo.
1306
    SW_DLLPUBLIC void ChgTableStyle(const TableStyleName& rName, const SwTableAutoFormat& rNewFormat);
1307
1308
0
    const SwCellStyleTable& GetCellStyles() const  { return *mpCellStyles; }
1309
20.2k
          SwCellStyleTable& GetCellStyles()        { return *mpCellStyles; }
1310
1311
    void AppendUndoForInsertFromDB( const SwPaM& rPam, bool bIsTable );
1312
1313
    void SetColRowWidthHeight( SwTableBox& rCurrentBox, TableChgWidthHeightType eType,
1314
                                SwTwips nAbsDiff, SwTwips nRelDiff );
1315
    SwTableBoxFormat* MakeTableBoxFormat();
1316
    SwTableLineFormat* MakeTableLineFormat();
1317
1318
    // helper function: cleanup before checking number value
1319
    bool IsNumberFormat( const OUString& aString, sal_uInt32& F_Index, double& fOutNumber);
1320
    // Check if box has numerical value. Change format of box if required.
1321
    void ChkBoxNumFormat( SwTableBox& rCurrentBox, bool bCallUpdate );
1322
    void SetTableBoxFormulaAttrs( SwTableBox& rBox, const SfxItemSet& rSet );
1323
    void ClearBoxNumAttrs( SwNode& rNode );
1324
    void ClearLineNumAttrs( SwPosition const & rPos );
1325
1326
    bool InsCopyOfTable( SwPosition& rInsPos, const SwSelBoxes& rBoxes,
1327
                        const SwTable* pCpyTable, bool bCpyName = false,
1328
                        bool bCorrPos = false, const TableStyleName& rStyleName = TableStyleName() );
1329
1330
    void UnProtectCells( const UIName& rTableName );
1331
    bool UnProtectCells( const SwSelBoxes& rBoxes );
1332
    void UnProtectTables( const SwPaM& rPam );
1333
    bool HasTableAnyProtection( const SwPosition* pPos,
1334
                              const UIName* pTableName,
1335
                              bool* pFullTableProtection );
1336
1337
    // Split table at baseline position, i.e. create a new table.
1338
    void SplitTable( const SwPosition& rPos, SplitTable_HeadlineOption eMode,
1339
                        bool bCalcNewSize );
1340
1341
    /** And vice versa: rPos must be in the table that remains. The flag indicates
1342
     whether the current table is merged with the one before or behind it. */
1343
    bool MergeTable( const SwPosition& rPos, bool bWithPrev );
1344
1345
    // Make charts of given table update.
1346
    void UpdateCharts( const UIName& rName ) const;
1347
1348
    // Update all charts, for that exists any table.
1349
0
    void UpdateAllCharts()          { DoUpdateAllCharts(); }
1350
1351
    // Table is renamed and refreshes charts.
1352
    void SetTableName( SwFrameFormat& rTableFormat, const UIName &rNewName );
1353
1354
    // @return the reference in document that is set for name.
1355
    const SwFormatRefMark* GetRefMark( const SwMarkName& rName ) const;
1356
1357
    // @return RefMark via index - for UNO.
1358
    const SwFormatRefMark* GetRefMark( sal_uInt16 nIndex ) const;
1359
1360
    /** @return names of all references that are set in document.
1361
     If array pointer is 0 return only whether a RefMark is set in document. */
1362
    SW_DLLPUBLIC sal_uInt16 GetRefMarks( std::vector<OUString>* = nullptr ) const;
1363
    SW_DLLPUBLIC void GetRefMarks( std::vector<const SwFormatRefMark*>& ) const;
1364
    /// Iterate over all SwFormatRefMark, if the function returns false, iteration is stopped
1365
    SW_DLLPUBLIC void ForEachRefMark( const std::function<bool(const SwFormatRefMark&)>&  ) const;
1366
1367
    void DeleteFormatRefMark(const SwFormatRefMark* pFormatRefMark);
1368
1369
    // Insert label. If a FlyFormat is created, return it.
1370
    SwFlyFrameFormat* InsertLabel( const SwLabelType eType, const OUString &rText, const OUString& rSeparator,
1371
                    const OUString& rNumberingSeparator,
1372
                    const bool bBefore, const sal_uInt16 nId, const SwNodeOffset nIdx,
1373
                    const UIName& rCharacterStyle,
1374
                    const bool bCpyBrd );
1375
    SwFlyFrameFormat* InsertDrawLabel(
1376
        const OUString &rText, const OUString& rSeparator, const OUString& rNumberSeparator,
1377
        const sal_uInt16 nId, const UIName& rCharacterStyle, SdrObject& rObj );
1378
1379
    // Query attribute pool.
1380
1.14M
    const SwAttrPool& GetAttrPool() const   { return *mpAttrPool; }
1381
95.2M
          SwAttrPool& GetAttrPool()         { return *mpAttrPool; }
1382
1383
    // Search for an EditShell.
1384
    SAL_RET_MAYBENULL SwEditShell const * GetEditShell() const;
1385
    SAL_RET_MAYBENULL SW_DLLPUBLIC SwEditShell* GetEditShell();
1386
    SAL_RET_MAYBENULL ::sw::IShellCursorSupplier * GetIShellCursorSupplier();
1387
1388
    // OLE 2.0-notification.
1389
167k
    void  SetOle2Link(const Link<bool,void>& rLink) {maOle2Link = rLink;}
1390
77.0M
    const Link<bool,void>& GetOle2Link() const {return maOle2Link;}
1391
1392
    // insert section (the ODF kind of section, not the nodesarray kind)
1393
    SW_DLLPUBLIC SwSection * InsertSwSection(SwPaM const& rRange, SwSectionData &,
1394
            std::tuple<SwTOXBase const*, sw::RedlineMode, sw::FieldmarkMode, sw::ParagraphBreakMode> const* pTOXBase,
1395
            SfxItemSet const*const pAttr, bool const bUpdate = true);
1396
    static sal_uInt16 IsInsRegionAvailable( const SwPaM& rRange,
1397
                                const SwNode** ppSttNd = nullptr );
1398
    SW_DLLPUBLIC static SwSection* GetCurrSection( const SwPosition& rPos );
1399
16.6k
    SwSectionFormats& GetSections() { return *mpSectionFormatTable; }
1400
0
    const SwSectionFormats& GetSections() const { return *mpSectionFormatTable; }
1401
    SwSectionFormat *MakeSectionFormat();
1402
    void DelSectionFormat( SwSectionFormat *pFormat, bool bDelNodes = false );
1403
    void UpdateSection(size_t const nSect, SwSectionData &,
1404
            SfxItemSet const*const = nullptr, bool const bPreventLinkUpdate = false);
1405
    SW_DLLPUBLIC OUString GetUniqueSectionName( const OUString* pChkStr = nullptr ) const;
1406
1407
    /* @@@MAINTAINABILITY-HORROR@@@
1408
       The model should not have anything to do with a shell.
1409
       Unnecessary compile/link time dependency.
1410
    */
1411
1412
    // Pointer to SfxDocShell from Doc. Can be 0!!
1413
145M
    SAL_RET_MAYBENULL SwDocShell* GetDocShell()         { return mpDocShell; }
1414
239k
    SAL_RET_MAYBENULL const SwDocShell* GetDocShell() const   { return mpDocShell; }
1415
    void SetDocShell( SwDocShell* pDSh );
1416
1417
    /** in case during copying of embedded object a new shell is created,
1418
     it should be set here and cleaned later */
1419
0
    void SetTmpDocShell(const SfxObjectShellLock& rLock) { mxTmpDocShell = rLock; }
1420
0
    const SfxObjectShellLock& GetTmpDocShell() const   { return mxTmpDocShell; }
1421
1422
    // For Autotexts? (text modules) They have only one SVPersist at their disposal.
1423
    SW_DLLPUBLIC SfxObjectShell* GetPersist() const;
1424
1425
    // Pointer to storage of SfxDocShells. Can be 0!!!
1426
    SW_DLLPUBLIC css::uno::Reference< css::embed::XStorage > GetDocStorage();
1427
1428
    // Query / set flag indicating if document is loaded asynchronously at this moment.
1429
14.6k
    bool IsInLoadAsynchron() const             { return mbInLoadAsynchron; }
1430
14.6k
    void SetInLoadAsynchron( bool bFlag )       { mbInLoadAsynchron = bFlag; }
1431
1432
    // For Drag&Move: (e.g. allow "moving" of RefMarks)
1433
37.6k
    bool IsCopyIsMove() const              { return mbCopyIsMove; }
1434
0
    void SetCopyIsMove( bool bFlag )        { mbCopyIsMove = bFlag; }
1435
1436
    SwDrawContact* GroupSelection( SdrView& );
1437
    void UnGroupSelection( SdrView& );
1438
    bool DeleteSelection( SwDrawView& );
1439
1440
    // Invalidates OnlineSpell-WrongLists.
1441
    void SpellItAgainSam( bool bInvalid, bool bOnlyWrong, bool bSmartTags );
1442
    void InvalidateAutoCompleteFlag();
1443
1444
    void SetCalcFieldValueHdl(Outliner* pOutliner);
1445
1446
    // Query if URL was visited.
1447
    // Query via Doc, if only a Bookmark has been given.
1448
    // In this case the document name has to be set in front.
1449
    bool IsVisitedURL( std::u16string_view rURL );
1450
1451
    // Save current values for automatic registration of exceptions in Autocorrection.
1452
    void SetAutoCorrExceptWord( std::unique_ptr<SwAutoCorrExceptWord> pNew );
1453
68.9M
    SwAutoCorrExceptWord* GetAutoCorrExceptWord()       { return mpACEWord.get(); }
1454
    void DeleteAutoCorrExceptWord();
1455
1456
    const SwFormatINetFormat* FindINetAttr( std::u16string_view rName ) const;
1457
    /// Iterate over all SwFormatINetFormat, if the function returns false, iteration is stopped
1458
    SW_DLLPUBLIC void ForEachINetFormat( const std::function<bool(const SwFormatINetFormat&)>&  ) const;
1459
1460
    /// Iterate over all SwFormatURL, if the function returns false, iteration is stopped
1461
    SW_DLLPUBLIC void ForEachFormatURL( const std::function<bool(const SwFormatURL&)>&  ) const;
1462
1463
    /// Iterate over all SvxOverlineItem, if the function returns false, iteration is stopped
1464
    SW_DLLPUBLIC void ForEachOverlineItem( const std::function<bool(const SvxOverlineItem&)>&  ) const;
1465
1466
    /// Iterate over all SwFormatField, if the function returns false, iteration is stopped
1467
    void ForEachFormatField( TypedWhichId<SwFormatField> nWhich, const std::function<bool(const SwFormatField&)>&  ) const;
1468
1469
    /// Iterate over all RES_CHRATR_BOX SvxBoxItem, if the function returns false, iteration is stopped
1470
    SW_DLLPUBLIC void ForEachCharacterBoxItem(const std::function<bool(const SvxBoxItem&)>&  ) const;
1471
1472
    /// Iterate over all RES_CHRATR_COLOR SvxColorItem, if the function returns false, iteration is stopped
1473
    SW_DLLPUBLIC void ForEachCharacterColorItem(const std::function<bool(const SvxColorItem&)>&  ) const;
1474
1475
    /// Iterate over all RES_CHRATR_UNDERLINE SvxUnderlineItem, if the function returns false, iteration is stopped
1476
    SW_DLLPUBLIC void ForEachCharacterUnderlineItem(const std::function<bool(const SvxUnderlineItem&)>&  ) const;
1477
1478
    /// Iterate over all RES_CHRATR_BACKGROUND SvxBrushItem, if the function returns false, iteration is stopped
1479
    SW_DLLPUBLIC void ForEachCharacterBackgroundBrushItem(const std::function<bool(const SvxBrushItem&)>&  ) const;
1480
1481
    /// Iterate over all RES_CHRATR_FONT/RES_CHRATR_CJK_FONT/RES_CHRATR_CTL_FONT SvxFontItem, if the function returns false, iteration is stopped
1482
    SW_DLLPUBLIC void ForEachCharacterFontItem(TypedWhichId<SvxFontItem> nWhich, bool bIgnoreAutoStyles, const std::function<bool(const SvxFontItem&)>&  );
1483
1484
    /// Iterate over all RES_TXTATR_UNKNOWN_CONTAINER SvXMLAttrContainerItem, if the function returns false, iteration is stopped
1485
    SW_DLLPUBLIC void ForEachTxtAtrContainerItem(const std::function<bool(const SvXMLAttrContainerItem&)>&  ) const;
1486
1487
    /// Iterate over all RES_PARATR_TABSTOP SvxTabStopItem, if the function returns false, iteration is stopped
1488
    SW_DLLPUBLIC void ForEachParaAtrTabStopItem(const std::function<bool(const SvxTabStopItem&)>&  );
1489
1490
    /// Iterate over all RES_UNKNOWNATR_CONTAINER SvXMLAttrContainerItem, if the function returns false, iteration is stopped
1491
    SW_DLLPUBLIC void ForEachUnknownAtrContainerItem(const std::function<bool(const SvXMLAttrContainerItem&)>&  ) const;
1492
1493
    /// Iterate over all RES_BOX SvxBoxItem, if the function returns false, iteration is stopped
1494
    SW_DLLPUBLIC void ForEachBoxItem(const std::function<bool(const SvxBoxItem&)>&  ) const;
1495
1496
    /// Iterate over all RES_SHADOW SvxShadowItem, if the function returns false, iteration is stopped
1497
    SW_DLLPUBLIC void ForEachShadowItem(const std::function<bool(const SvxShadowItem&)>&  ) const;
1498
1499
    /// Iterate over all RES_BACKGROUND SvxBrushItem, if the function returns false, iteration is stopped
1500
    SW_DLLPUBLIC void ForEachBackgroundBrushItem(const std::function<bool(const SvxBrushItem&)>&  ) const;
1501
1502
    /// Iterate over all RES_CHRATR_HIGHLIGHT SvxBrushItem, if the function returns false, iteration is stopped
1503
    SW_DLLPUBLIC void ForEachCharacterHighlightBrushItem(const std::function<bool(const SvxBrushItem&)>&  ) const;
1504
1505
    // Call into intransparent Basic; expect possible Return String.
1506
    void ExecMacro( const SvxMacro& rMacro, OUString* pRet, SbxArray* pArgs );
1507
1508
    // Call into intransparent Basic / JavaScript.
1509
    sal_uInt16 CallEvent( SvMacroItemId nEvent, const SwCallMouseEvent& rCallEvent,
1510
                        bool bChkPtr = false );
1511
1512
    /** Adjust left margin via object bar (similar to adjustment of numerations).
1513
     One can either change the margin "by" adding or subtracting a given
1514
     offset or set it "to" this position (bModulus = true). */
1515
    void MoveLeftMargin(const SwPaM& rPam, bool bRight, bool bModulus,
1516
            SwRootFrame const* pLayout = nullptr);
1517
1518
    // Query NumberFormatter.
1519
    SvNumberFormatter* GetNumberFormatter(bool bCreate = true)
1520
274k
    {
1521
274k
        std::scoped_lock lock(mNumberFormatterMutex);
1522
274k
        if (bCreate)
1523
270k
            EnsureNumberFormatter();
1524
274k
        return mpNumberFormatter;
1525
274k
    }
1526
1527
    const SvNumberFormatter* GetNumberFormatter(bool bCreate = true) const
1528
11
    {
1529
11
        return const_cast<SwDoc*>(this)->GetNumberFormatter(bCreate);
1530
11
    }
1531
1532
    bool HasInvisibleContent() const;
1533
    // delete invisible content, like hidden sections and paragraphs
1534
    SW_DLLPUBLIC bool RemoveInvisibleContent();
1535
    // restore the invisible content if it's available on the undo stack
1536
    bool RestoreInvisibleContent();
1537
1538
    // Replace fields by text - mailmerge support
1539
    bool ConvertFieldsToText(SwRootFrame const& rLayout);
1540
    bool ConvertFieldToText(const SwField& rField, SwRootFrame const& rLayout);
1541
1542
    // Create sub-documents according to given collection.
1543
    // If no collection is given, use chapter styles for 1st level.
1544
    bool GenerateGlobalDoc(
1545
        const OUString& rPath, const SwTextFormatColl* pSplitColl,
1546
        const std::function<OUString(OUString, OUString)>& rConcatFunc)
1547
0
    {
1548
0
        return SplitDoc(SPLITDOC_TO_GLOBALDOC, rPath, false, pSplitColl, 0, rConcatFunc);
1549
0
    }
1550
1551
    bool GenerateGlobalDoc(
1552
        const OUString& rPath, int nOutlineLevel,
1553
        const std::function<OUString(OUString, OUString)>& rConcatFunc)
1554
0
    {
1555
0
        return SplitDoc(SPLITDOC_TO_GLOBALDOC, rPath, true, nullptr, nOutlineLevel, rConcatFunc);
1556
0
    }
1557
1558
    bool GenerateHTMLDoc(
1559
        const OUString& rPath, const SwTextFormatColl* pSplitColl,
1560
        const std::function<OUString(OUString, OUString)>& rConcatFunc)
1561
0
    {
1562
0
        return SplitDoc(SPLITDOC_TO_HTML, rPath, false, pSplitColl, 0, rConcatFunc);
1563
0
    }
1564
1565
    bool GenerateHTMLDoc(
1566
        const OUString& rPath, int nOutlineLevel,
1567
        const std::function<OUString(OUString, OUString)>& rConcatFunc)
1568
0
    {
1569
0
        return SplitDoc(SPLITDOC_TO_HTML, rPath, true, nullptr, nOutlineLevel, rConcatFunc);
1570
0
    }
1571
1572
    //  Compare two documents.
1573
    tools::Long CompareDoc( const SwDoc& rDoc );
1574
1575
    // Merge two documents.
1576
    tools::Long MergeDoc( const SwDoc& rDoc );
1577
1578
147k
    bool IsAutoFormatRedline() const           { return mbIsAutoFormatRedline; }
1579
0
    void SetAutoFormatRedline( bool bFlag )    { mbIsAutoFormatRedline = bFlag; }
1580
1581
    // For AutoFormat: with Undo/Redlining.
1582
    void SetTextFormatCollByAutoFormat( const SwPosition& rPos, SwPoolFormatId nPoolId,
1583
                                const SfxItemSet* pSet );
1584
    void SetFormatItemByAutoFormat( const SwPaM& rPam, const SfxItemSet& );
1585
1586
    // Only for SW-textbloxks! Does not pay any attention to layout!
1587
    void ClearDoc();        // Deletes all content!
1588
1589
    // Query /set data for PagePreview.
1590
0
    const SwPagePreviewPrtData* GetPreviewPrtData() const { return m_pPgPViewPrtData.get(); }
1591
1592
    // If pointer == 0 destroy pointer in document.
1593
    // Else copy object.
1594
    // Pointer is not transferred to ownership by document!
1595
    void SetPreviewPrtData( const SwPagePreviewPrtData* pData );
1596
1597
    /** update all modified OLE-Objects. The modification is called over the
1598
     StarOne - Interface */
1599
    void SetOLEObjModified();
1600
1601
    // Uno - Interfaces
1602
    SW_DLLPUBLIC std::shared_ptr<SwUnoCursor> CreateUnoCursor( const SwPosition& rPos, bool bTableCursor = false );
1603
1604
    // FeShell - Interfaces
1605
    // !!! These assume always an existing layout !!!
1606
    bool ChgAnchor( const SdrMarkList& _rMrkList,
1607
                        RndStdIds _eAnchorType,
1608
                        const bool _bSameOnly,
1609
                        const bool _bPosCorr );
1610
1611
    void SetRowHeight( const SwCursor& rCursor, const SwFormatFrameSize &rNew );
1612
    static std::unique_ptr<SwFormatFrameSize> GetRowHeight( const SwCursor& rCursor );
1613
    void SetRowSplit( const SwCursor& rCursor, const SwFormatRowSplit &rNew );
1614
    static std::unique_ptr<SwFormatRowSplit> GetRowSplit( const SwCursor& rCursor );
1615
1616
    /// Adjustment of Rowheights. Determine via bTstOnly if more than one row is selected.
1617
    /// bOptimize: distribute current table height, instead of using the largest row.
1618
    ///   Call again without bOptimize to ensure equal height in case some row's content didn't fit.
1619
    bool BalanceRowHeight( const SwCursor& rCursor, bool bTstOnly, const bool bOptimize );
1620
    void SetRowBackground( const SwCursor& rCursor, const SvxBrushItem &rNew );
1621
    static bool GetRowBackground( const SwCursor& rCursor, std::unique_ptr<SvxBrushItem>& rToFill );
1622
    /// rNotTracked = false means that the row was deleted or inserted with its tracked cell content
1623
    /// bAll: delete all table rows without selection
1624
    /// bIns: insert table row
1625
    void SetRowNotTracked( const SwCursor& rCursor,
1626
                        const SvxPrintItem &rNotTracked, bool bAll = false, bool bIns = false );
1627
    /// don't call SetRowNotTracked() for rows with tracked row change
1628
    static bool HasRowNotTracked( const SwCursor& rCursor );
1629
    void SetTabBorders( const SwCursor& rCursor, const SfxItemSet& rSet );
1630
    void SetTabLineStyle( const SwCursor& rCursor,
1631
                          const Color* pColor, bool bSetLine,
1632
                          const editeng::SvxBorderLine* pBorderLine );
1633
    static void GetTabBorders( const SwCursor& rCursor, SfxItemSet& rSet );
1634
    void SetBoxAttr( const SwCursor& rCursor, const SfxPoolItem &rNew );
1635
    /**
1636
    Retrieves a box attribute from the given cursor.
1637
1638
    @return Whether the property is set over the current box selection.
1639
1640
    @remarks A property is 'set' if it's set to the same value over all boxes in the current selection.
1641
    The property value is retrieved from the first box in the current selection. It is then compared to
1642
    the values of the same property over any other boxes in the selection; if any value is different from
1643
    that of the first box, the property is unset (and false is returned).
1644
    */
1645
    static bool GetBoxAttr( const SwCursor& rCursor, std::unique_ptr<SfxPoolItem>& rToFill );
1646
    void SetBoxAlign( const SwCursor& rCursor, sal_uInt16 nAlign );
1647
    static sal_uInt16 GetBoxAlign( const SwCursor& rCursor );
1648
    /// Adjusts selected cell widths in such a way, that their content does not need to be wrapped (if possible).
1649
    /// bBalance evenly re-distributes the available space regardless of content or wrapping.
1650
    /// bNoShrink keeps table size the same by distributing excess space proportionately.
1651
    void AdjustCellWidth( const SwCursor& rCursor, const bool bBalance, const bool bNoShrink );
1652
1653
    SW_DLLPUBLIC SwChainRet Chainable( const SwFrameFormat &rSource, const SwFrameFormat &rDest );
1654
    SwChainRet Chain( SwFrameFormat &rSource, const SwFrameFormat &rDest );
1655
    void Unchain( SwFrameFormat &rFormat );
1656
1657
    // For Copy/Move from FrameShell.
1658
    rtl::Reference<SdrObject> CloneSdrObj( const SdrObject&, bool bMoveWithinDoc = false,
1659
                            bool bInsInPage = true );
1660
1661
    // FeShell - Interface end
1662
1663
    // Interface for TextInputData - for text input of Chinese and Japanese.
1664
    SwExtTextInput* CreateExtTextInput( const SwPaM& rPam );
1665
    void DeleteExtTextInput( SwExtTextInput* pDel );
1666
    SwExtTextInput* GetExtTextInput( const SwNode& rNd,
1667
                                sal_Int32 nContentPos = -1) const;
1668
    SwExtTextInput* GetExtTextInput() const;
1669
1670
    // Interface for access to AutoComplete-List.
1671
0
    static SwAutoCompleteWord& GetAutoCompleteWords() { return *s_pAutoCompleteWords; }
1672
1673
0
    bool ContainsMSVBasic() const          { return mbContains_MSVBasic; }
1674
0
    void SetContainsMSVBasic( bool bFlag )  { mbContains_MSVBasic = bFlag; }
1675
1676
    // Interface for the list of Ruby - texts/attributes
1677
    static sal_uInt16 FillRubyList( const SwPaM& rPam, SwRubyList& rList );
1678
    void SetRubyList( SwPaM& rPam, const SwRubyList& rList );
1679
1680
    void ReadLayoutCache( SvStream& rStream );
1681
    void WriteLayoutCache( SvStream& rStream );
1682
12.4k
    SwLayoutCache* GetLayoutCache() const { return mpLayoutCache.get(); }
1683
1684
    /** Checks if any of the text node contains hidden characters.
1685
        Used for optimization. Changing the view option 'view hidden text'
1686
        has to trigger a reformatting only if some of the text is hidden.
1687
    */
1688
    bool ContainsHiddenChars() const;
1689
1690
41.1k
    std::unique_ptr<sw::GrammarContact> const& getGrammarContact() const { return mpGrammarContact; }
1691
    std::unique_ptr<sw::OnlineAccessibilityCheck> const& getOnlineAccessibilityCheck() const
1692
90.0k
    {
1693
90.0k
        return mpOnlineAccessibilityCheck;
1694
90.0k
    }
1695
1696
    /** Marks/Unmarks a list level of a certain list
1697
1698
        levels of a certain lists are marked now
1699
1700
        @param sListId    list Id of the list whose level has to be marked/unmarked
1701
        @param nListLevel level to mark
1702
        @param bValue     - true  mark the level
1703
                          - false unmark the level
1704
    */
1705
    void MarkListLevel( const OUString& sListId,
1706
                        const int nListLevel,
1707
                        const bool bValue );
1708
1709
    // Change a format undoable.
1710
    SW_DLLPUBLIC void ChgFormat(SwFormat & rFormat, const SfxItemSet & rSet);
1711
1712
    void RenameFormat(SwFormat & rFormat, const UIName & sNewName,
1713
                   bool bBroadcast = false);
1714
1715
    // Change a TOX undoable.
1716
    void ChangeTOX(SwTOXBase & rTOX, const SwTOXBase & rNew);
1717
1718
    /**
1719
       Returns a textual description of a PaM.
1720
1721
       @param rPaM     the PaM to describe
1722
1723
       If rPaM only spans one paragraph the result is:
1724
1725
            '<text in the PaM>'
1726
1727
       <text in the PaM> is shortened to nUndoStringLength characters.
1728
1729
       If rPaM spans more than one paragraph the result is:
1730
1731
            paragraphs                               (STR_PARAGRAPHS)
1732
1733
       @return the textual description of rPaM
1734
     */
1735
    static OUString GetPaMDescr(const SwPaM & rPaM);
1736
1737
    static bool IsFirstOfNumRuleAtPos(const SwPosition & rPos, SwRootFrame const& rLayout);
1738
1739
    // access methods for XForms model(s)
1740
1741
    // access container for XForms model; will be NULL if !isXForms()
1742
    const css::uno::Reference<css::container::XNameContainer>&
1743
0
        getXForms() const { return mxXForms;}
1744
1745
    css::uno::Reference< css::linguistic2::XProofreadingIterator > const & GetGCIterator() const;
1746
1747
    // #i31958# is this an XForms document?
1748
    bool isXForms() const;
1749
1750
    // #i31958# initialize XForms models; turn this into an XForms document
1751
    void initXForms( bool bCreateDefaultModel );
1752
1753
    // #i113606# for disposing XForms
1754
    void disposeXForms( );
1755
1756
    //Update all the page masters
1757
    SW_DLLPUBLIC void SetDefaultPageMode(bool bSquaredPageMode);
1758
    SW_DLLPUBLIC bool IsSquaredPageMode() const;
1759
1760
0
    const css::uno::Reference< ooo::vba::word::XFind >& getVbaFind() const { return mxVbaFind; }
1761
0
    void setVbaFind( const css::uno::Reference< ooo::vba::word::XFind > &xFind) { mxVbaFind = xFind; }
1762
    css::uno::Reference< css::script::vba::XVBAEventProcessor > const & GetVbaEventProcessor();
1763
    SW_DLLPUBLIC void SetVbaEventProcessor();
1764
0
    void SetVBATemplateToProjectCache( css::uno::Reference< css::container::XNameContainer > const & xCache ) { m_xTemplateToProjectCache = xCache; };
1765
0
    const css::uno::Reference< css::container::XNameContainer >& GetVBATemplateToProjectCache() const { return m_xTemplateToProjectCache; };
1766
    ::sfx2::IXmlIdRegistry& GetXmlIdRegistry();
1767
    SW_DLLPUBLIC ::sw::MetaFieldManager & GetMetaFieldManager();
1768
    SW_DLLPUBLIC ::SwContentControlManager& GetContentControlManager();
1769
    SW_DLLPUBLIC ::sw::UndoManager      & GetUndoManager();
1770
    ::sw::UndoManager const& GetUndoManager() const;
1771
1772
    rtl::Reference<SfxObjectShell> CreateCopy(bool bCallInitNew, bool bEmpty) const;
1773
    SwNodeIndex AppendDoc(const SwDoc& rSource, sal_uInt16 nStartPageNumber,
1774
                 bool bDeletePrevious, int physicalPageOffset,
1775
                 const sal_uLong nDocNo);
1776
1777
    /**
1778
     * Dumps the entire nodes structure to the given destination (file nodes.xml in the current directory by default)
1779
     */
1780
    void dumpAsXml(xmlTextWriterPtr = nullptr) const;
1781
1782
    std::set<Color> GetDocColors();
1783
    std::vector< std::weak_ptr<SwUnoCursor> > mvUnoCursorTable;
1784
1785
    // Remove expired UnoCursor weak pointers the document keeps to notify about document death.
1786
    void cleanupUnoCursorTable() const
1787
440k
    {
1788
440k
        auto & rTable = const_cast<SwDoc*>(this)->mvUnoCursorTable;
1789
        // In most cases we'll remove most of the elements.
1790
2.04M
        std::erase_if(rTable, [] (std::weak_ptr<SwUnoCursor> const & x) { return x.expired(); });
1791
440k
    }
1792
1793
    /**
1794
     * @param bSkipStart don't actually start the jobs, just check
1795
     * @returns true if new background checking jobs were started
1796
     */
1797
    bool StartGrammarChecking( bool bSkipStart = false );
1798
1799
    /// Use to notify if the dictionary can be found for a single content portion (has to be called for all portions)
1800
    void SetMissingDictionaries( bool bIsMissing );
1801
    /// Returns true if no dictionary can be found for any content
1802
0
    bool IsDictionaryMissing() const { return meDictionaryMissing == MissingDictionary::True; }
1803
1804
    void SetLanguage(const LanguageType eLang, const sal_uInt16 nId);
1805
1806
    static bool HasParagraphDirectFormatting(const SwPosition& rPos);
1807
1808
91.9k
    bool SetDontCorrectBookmarks(bool val) { return std::exchange(mbDontCorrectBookmarks, val); }
1809
1810
private:
1811
    // Copies master header to left / first one, if necessary - used by ChgPageDesc().
1812
    void CopyMasterHeader(const SwPageDesc &rChged, const SwFormatHeader &rHead, SwPageDesc &pDesc, bool bLeft, bool bFirst);
1813
    // Copies master footer to left / first one, if necessary - used by ChgPageDesc().
1814
    void CopyMasterFooter(const SwPageDesc &rChged, const SwFormatFooter &rFoot, SwPageDesc &pDesc, bool bLeft, bool bFirst);
1815
1816
};
1817
1818
namespace o3tl {
1819
    template<> struct typed_flags<SwDoc::RowColMode> : is_typed_flags<SwDoc::RowColMode, 3> {};
1820
    template<> struct typed_flags<SwDoc::SetNumRuleMode> : is_typed_flags<SwDoc::SetNumRuleMode, 0x0f> {};
1821
}
1822
1823
// This method is called in Dtor of SwDoc and deletes cache of ContourObjects.
1824
void ClrContourCache();
1825
1826
inline void SwDoc::SetOLEPrtNotifyPending( bool bSet )
1827
799
{
1828
799
    mbOLEPrtNotifyPending = bSet;
1829
799
    if( !bSet )
1830
121
        mbAllOLENotify = false;
1831
799
}
1832
1833
bool sw_GetPostIts(const IDocumentFieldsAccess& rIDFA, SetGetExpFields * pSrtLst);
1834
1835
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */