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