1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
19 #ifndef INCLUDED_SW_INC_DOC_HXX
20 #define INCLUDED_SW_INC_DOC_HXX
23 #include <o3tl/deleter.hxx>
24 #include <vcl/idle.hxx>
26 #include "swtypes.hxx"
28 #include "flyenum.hxx"
30 #include "swdbdata.hxx"
31 #include <sfx2/objsh.hxx>
32 #include <svl/style.hxx>
33 #include <editeng/numitem.hxx>
36 #include "charfmt.hxx"
38 #include "pagedesc.hxx"
39 #include "tblenum.hxx"
45 #include <unordered_map>
48 namespace editeng
{ class SvxBorderLine
; }
58 class SvNumberFormatter
;
60 class SwAutoCompleteWord
;
61 class SwAutoCorrExceptWord
;
63 class SwCellStyleTable
;
70 class SwFormatINetFormat
;
71 class SwFormatRefMark
;
75 class SwLineNumberInfo
;
80 class SwPagePreviewPrtData
;
82 class SwRubyListEntry
;
83 class SwSectionFormat
;
86 class SwTableAutoFormatTable
;
87 class SwTOXBaseSection
;
90 class SwTableAutoFormat
;
92 class SwTableBoxFormat
;
94 class SwTableLineFormat
;
97 class SwURLStateChanged
;
106 struct SwCallMouseEvent
;
108 struct SwSortOptions
;
109 struct SwDefTOXBase_Impl
;
110 class SwPrintUIOptions
;
111 struct SwConversionArgs
;
112 class IGrammarContact
;
114 class IDocumentUndoRedo
;
115 class IDocumentSettingAccess
;
116 class IDocumentDeviceAccess
;
117 class IDocumentDrawModelAccess
;
118 class IDocumentChartDataProviderAccess
;
119 class IDocumentTimerAccess
;
120 class IDocumentLinksAdministration
;
121 class IDocumentListItems
;
122 class IDocumentListsAccess
;
123 class IDocumentOutlineNodes
;
124 class IDocumentContentOperations
;
125 class IDocumentRedlineAccess
;
126 class IDocumentStatistics
;
127 class IDocumentState
;
128 class IDocumentLayoutAccess
;
129 class IDocumentStylePoolAccess
;
130 class IDocumentExternalData
;
131 class IDocumentMarkAccess
;
132 class SetGetExpFields
;
133 struct SwInsertTableOptions
;
134 enum class SvMacroItemId
: sal_uInt16
;
135 enum class SvxFrameDirection
;
136 enum class RndStdIds
;
138 namespace sw
{ namespace mark
{
142 enum class RedlineMode
;
143 class MetaFieldManager
;
145 class IShellCursorSupplier
;
146 class DocumentSettingManager
;
147 class DocumentDeviceManager
;
148 class DocumentDrawModelManager
;
149 class DocumentChartDataProviderManager
;
150 class DocumentTimerManager
;
151 class DocumentLinksAdministrationManager
;
152 class DocumentListItemsManager
;
153 class DocumentListsManager
;
154 class DocumentOutlineNodesManager
;
155 class DocumentContentOperationsManager
;
156 class DocumentRedlineManager
;
157 class DocumentFieldsManager
;
158 class DocumentStatisticsManager
;
159 class DocumentStateManager
;
160 class DocumentLayoutManager
;
161 class DocumentStylePoolManager
;
162 class DocumentExternalDataManager
;
165 namespace com
{ namespace sun
{ namespace star
{
166 namespace container
{
167 class XNameContainer
; //< for getXForms()/isXForms()/initXForms() methods
169 namespace embed
{ class XStorage
; }
170 namespace linguistic2
{ class XHyphenatedWord
; }
171 namespace linguistic2
{ class XProofreadingIterator
; }
172 namespace linguistic2
{ class XSpellChecker1
; }
173 namespace script
{ namespace vba
{ class XVBAEventProcessor
; } }
177 class IXmlIdRegistry
;
180 void SetAllScriptItem( SfxItemSet
& rSet
, const SfxPoolItem
& rItem
);
182 using SwRubyList
= std::vector
<std::unique_ptr
<SwRubyListEntry
>>;
184 // Represents the model of a Writer document.
185 class SW_DLLPUBLIC SwDoc final
187 friend class ::sw::DocumentContentOperationsManager
;
189 friend void InitCore();
190 friend void FinitCore();
193 std::unique_ptr
<SwNodes
> m_pNodes
; //< document content (Nodes Array)
194 SwAttrPool
* mpAttrPool
; //< the attribute pool
195 SwPageDescs m_PageDescs
; //< PageDescriptors
196 Link
<bool,void> maOle2Link
; //< OLE 2.0-notification
197 /* @@@MAINTAINABILITY-HORROR@@@
198 Timer should not be members of the model
200 Idle maOLEModifiedIdle
; //< Timer for update modified OLE-Objects
201 SwDBData maDBData
; //< database descriptor
202 OUString msTOIAutoMarkURL
; //< URL of table of index AutoMark file
203 std::vector
<OUString
> m_PatternNames
; //< Array for names of document-templates
204 css::uno::Reference
<css::container::XNameContainer
>
205 mxXForms
; //< container with XForms models
206 mutable css::uno::Reference
< css::linguistic2::XProofreadingIterator
> m_xGCIterator
;
208 const std::unique_ptr
< ::sw::mark::MarkManager
> mpMarkManager
;
209 const std::unique_ptr
< ::sw::MetaFieldManager
> m_pMetaFieldManager
;
210 const std::unique_ptr
< ::sw::DocumentDrawModelManager
> m_pDocumentDrawModelManager
;
211 const std::unique_ptr
< ::sw::DocumentRedlineManager
> m_pDocumentRedlineManager
;
212 const std::unique_ptr
< ::sw::DocumentStateManager
> m_pDocumentStateManager
;
213 const std::unique_ptr
< ::sw::UndoManager
> m_pUndoManager
;
214 const std::unique_ptr
< ::sw::DocumentSettingManager
> m_pDocumentSettingManager
;
215 const std::unique_ptr
< ::sw::DocumentChartDataProviderManager
> m_pDocumentChartDataProviderManager
;
216 std::unique_ptr
< ::sw::DocumentDeviceManager
> m_pDeviceAccess
;
217 const std::unique_ptr
< ::sw::DocumentTimerManager
> m_pDocumentTimerManager
;
218 const std::unique_ptr
< ::sw::DocumentLinksAdministrationManager
> m_pDocumentLinksAdministrationManager
;
219 const std::unique_ptr
< ::sw::DocumentListItemsManager
> m_pDocumentListItemsManager
;
220 const std::unique_ptr
< ::sw::DocumentListsManager
> m_pDocumentListsManager
;
221 const std::unique_ptr
< ::sw::DocumentOutlineNodesManager
> m_pDocumentOutlineNodesManager
;
222 const std::unique_ptr
< ::sw::DocumentContentOperationsManager
> m_pDocumentContentOperationsManager
;
223 const std::unique_ptr
< ::sw::DocumentFieldsManager
> m_pDocumentFieldsManager
;
224 const std::unique_ptr
< ::sw::DocumentStatisticsManager
> m_pDocumentStatisticsManager
;
225 const std::unique_ptr
< ::sw::DocumentLayoutManager
> m_pDocumentLayoutManager
;
226 const std::unique_ptr
< ::sw::DocumentStylePoolManager
> m_pDocumentStylePoolManager
;
227 const std::unique_ptr
< ::sw::DocumentExternalDataManager
> m_pDocumentExternalDataManager
;
230 std::unique_ptr
<SwFrameFormat
> mpDfltFrameFormat
; //< Default formats.
231 std::unique_ptr
<SwFrameFormat
> mpEmptyPageFormat
; //< Format for the default empty page
232 std::unique_ptr
<SwFrameFormat
> mpColumnContFormat
; //< Format for column container
233 std::unique_ptr
<SwCharFormat
> mpDfltCharFormat
;
234 std::unique_ptr
<SwTextFormatColl
> mpDfltTextFormatColl
; //< Defaultformatcollections
235 std::unique_ptr
<SwGrfFormatColl
> mpDfltGrfFormatColl
;
237 std::unique_ptr
<SwFrameFormats
> mpFrameFormatTable
; //< Format table
238 std::unique_ptr
<SwCharFormats
> mpCharFormatTable
;
239 std::unique_ptr
<SwFrameFormats
> mpSpzFrameFormatTable
;
240 std::unique_ptr
<SwSectionFormats
> mpSectionFormatTable
;
241 std::unique_ptr
<SwFrameFormats
> mpTableFrameFormatTable
; //< For tables
242 std::unique_ptr
<SwTextFormatColls
> mpTextFormatCollTable
; //< FormatCollections
243 std::unique_ptr
<SwGrfFormatColls
> mpGrfFormatCollTable
;
245 std::unique_ptr
<SwTOXTypes
> mpTOXTypes
; //< Tables/indices
246 std::unique_ptr
<SwDefTOXBase_Impl
> mpDefTOXBases
; //< defaults of SwTOXBase's
248 std::unique_ptr
<SwDBManager
, o3tl::default_delete
<SwDBManager
>> m_pOwnDBManager
; //< own DBManager
249 SwDBManager
* m_pDBManager
; //< DBManager for evaluation of DB-fields.
251 SwNumRule
*mpOutlineRule
;
252 std::unique_ptr
<SwFootnoteInfo
> mpFootnoteInfo
;
253 std::unique_ptr
<SwEndNoteInfo
> mpEndNoteInfo
;
254 std::unique_ptr
<SwLineNumberInfo
> mpLineNumberInfo
;
255 std::unique_ptr
<SwFootnoteIdxs
> mpFootnoteIdxs
;
257 SwDocShell
*mpDocShell
; //< Ptr to SfxDocShell of Doc.
258 SfxObjectShellLock mxTmpDocShell
; //< A temporary shell that is used to copy OLE-Nodes
260 std::unique_ptr
<SwAutoCorrExceptWord
> mpACEWord
; /**< For the automated takeover of
261 auto-corrected words that are "re-corrected". */
262 std::unique_ptr
<SwURLStateChanged
> mpURLStateChgd
; //< SfxClient for changes in INetHistory
263 std::atomic
<SvNumberFormatter
*> mpNumberFormatter
; //< NumFormatter for tables / fields
265 mutable std::unique_ptr
<SwNumRuleTable
> mpNumRuleTable
; //< List of all named NumRules.
267 // Hash map to find numrules by name
268 mutable std::unordered_map
<OUString
, SwNumRule
*> maNumRuleMap
;
270 std::unique_ptr
<SwPagePreviewPrtData
> m_pPgPViewPrtData
; //< Indenting / spacing for printing of page view.
271 SwExtTextInput
*mpExtInputRing
;
273 std::unique_ptr
<IStyleAccess
> mpStyleAccess
; //< handling of automatic styles
274 std::unique_ptr
<SwLayoutCache
> mpLayoutCache
; /**< Layout cache to read and save with the
275 document for a faster formatting */
277 std::unique_ptr
<IGrammarContact
> mpGrammarContact
; //< for grammar checking in paragraphs during editing
279 css::uno::Reference
< css::script::vba::XVBAEventProcessor
> mxVbaEvents
;
280 css::uno::Reference
<css::container::XNameContainer
> m_xTemplateToProjectCache
;
282 /// Table styles (autoformats that are applied with table changes).
283 std::unique_ptr
<SwTableAutoFormatTable
> m_pTableStyles
;
284 /// Cell Styles not assigned to a Table Style
285 std::unique_ptr
<SwCellStyleTable
> mpCellStyles
;
287 std::unique_ptr
< ::sfx2::IXmlIdRegistry
> m_pXmlIdRegistry
;
291 sal_uInt32 mnRsid
; //< current session ID of the document
292 sal_uInt32 mnRsidRoot
; //< session ID when the document was created
294 oslInterlockedCount mReferenceCount
;
296 bool mbDtor
: 1; /**< TRUE: is in SwDoc DTOR.
297 and unfortunately temporarily also in
298 SwSwgReader::InLayout() when flawed
299 frames need deletion. */
300 bool mbCopyIsMove
: 1; //< TRUE: Copy is a hidden Move.
301 bool mbInReading
: 1; //< TRUE: Document is in the process of being read.
302 bool mbInWriting
: 1; //< TRUE: Document is in the process of being written.
303 bool mbInMailMerge
: 1; //< TRUE: Document is in the process of being written by mail merge.
304 bool mbInXMLImport
: 1; //< TRUE: During xml import, attribute portion building is not necessary.
305 bool mbInWriterfilterImport
: 1; //< TRUE: writerfilter import (DOCX,RTF)
306 bool mbUpdateTOX
: 1; //< TRUE: After loading document, update TOX.
307 bool mbInLoadAsynchron
: 1; //< TRUE: Document is in the process of being loaded asynchronously.
308 bool mbIsAutoFormatRedline
: 1; //< TRUE: Redlines are recorded by Autoformat.
309 bool mbOLEPrtNotifyPending
: 1; /**< TRUE: Printer has changed. At creation of View
310 notification of OLE-Objects PrtOLENotify() is required. */
311 bool mbAllOLENotify
: 1; //< True: Notification of all objects is required.
312 bool mbInsOnlyTextGlssry
: 1; //< True: insert 'only text' glossary into doc
313 bool mbContains_MSVBasic
: 1; //< True: MS-VBasic exist is in our storage
314 bool mbClipBoard
: 1; //< TRUE: this document represents the clipboard
315 bool mbColumnSelection
: 1; //< TRUE: this content has been created by a column selection (clipboard docs only)
316 bool mbIsPrepareSelAll
: 1;
318 enum MissingDictionary
{ False
= -1, Undefined
= 0, True
= 1 };
319 MissingDictionary meDictionaryMissing
;
321 // true: Document contains at least one anchored object, which is anchored AT_PAGE with a content position.
322 // Thus, certain adjustment needed during formatting for these kind of anchored objects.
323 bool mbContainsAtPageObjWithContentAnchor
: 1;
325 static SwAutoCompleteWord
*s_pAutoCompleteWords
; //< List of all words for AutoComplete
328 SwFlyFrameFormat
* MakeFlySection_( const SwPosition
& rAnchPos
,
329 const SwContentNode
& rNode
, RndStdIds eRequestId
,
330 const SfxItemSet
* pFlyAttrSet
,
332 sal_Int8
SetFlyFrameAnchor( SwFrameFormat
& rFlyFormat
, SfxItemSet
& rSet
, bool bNewFrames
);
334 typedef SwFormat
* (SwDoc:: *FNCopyFormat
)( const OUString
&, SwFormat
*, bool, bool );
335 SwFormat
* CopyFormat( const SwFormat
& rFormat
, const SwFormatsBase
& rFormatArr
,
336 FNCopyFormat fnCopyFormat
, const SwFormat
& rDfltFormat
);
337 void CopyFormatArr( const SwFormatsBase
& rSourceArr
, SwFormatsBase
const & rDestArr
,
338 FNCopyFormat fnCopyFormat
, SwFormat
& rDfltFormat
);
339 void CopyPageDescHeaderFooterImpl( bool bCpyHeader
,
340 const SwFrameFormat
& rSrcFormat
, SwFrameFormat
& rDestFormat
);
342 SwDoc( const SwDoc
&) = delete;
345 void AddUsedDBToList( std::vector
<OUString
>& rDBNameList
,
346 const std::vector
<OUString
>& rUsedDBNames
);
347 void AddUsedDBToList( std::vector
<OUString
>& rDBNameList
, const OUString
& rDBName
);
348 static bool IsNameInArray( const std::vector
<OUString
>& rOldNames
, const OUString
& rName
);
349 void GetAllDBNames( std::vector
<OUString
>& rAllDBNames
);
350 static OUString
ReplaceUsedDBs( const std::vector
<OUString
>& rUsedDBNames
,
351 const OUString
& rNewName
, const OUString
& rFormula
);
352 static std::vector
<OUString
>& FindUsedDBs( const std::vector
<OUString
>& rAllDBNames
,
353 const OUString
& rFormula
,
354 std::vector
<OUString
>& rUsedDBNames
);
356 void EnsureNumberFormatter();
358 bool UnProtectTableCells( SwTable
& rTable
);
360 /** Create sub-documents according to the given collection.
361 If no collection is given, take chapter style of the 1st level. */
362 bool SplitDoc( sal_uInt16 eDocType
, const OUString
& rPath
, bool bOutline
,
363 const SwTextFormatColl
* pSplitColl
, int nOutlineLevel
= 0 );
365 // Update charts of given table.
366 void UpdateCharts_( const SwTable
& rTable
, SwViewShell
const & rVSh
) const;
368 static bool SelectNextRubyChars( SwPaM
& rPam
, SwRubyListEntry
& rRubyEntry
);
370 // CharTimer calls this method.
371 void DoUpdateAllCharts();
372 DECL_LINK( DoUpdateModifiedOLE
, Timer
*, void );
375 SwFormat
*MakeCharFormat_(const OUString
&, SwFormat
*, bool, bool );
376 SwFormat
*MakeFrameFormat_(const OUString
&, SwFormat
*, bool, bool );
379 SwFormat
*MakeTextFormatColl_(const OUString
&, SwFormat
*, bool, bool );
382 OUString msDocAccTitle
;
389 DOCTYPE_MSWORD
// This doc model comes from MS Word
391 DocumentType meDocType
;
392 DocumentType
GetDocumentType() const { return meDocType
; }
393 void SetDocumentType( DocumentType eDocType
) { meDocType
= eDocType
; }
399 bool IsInDtor() const { return mbDtor
; }
401 /* @@@MAINTAINABILITY-HORROR@@@
402 Implementation details made public.
404 SwNodes
& GetNodes() { return *m_pNodes
; }
405 SwNodes
const& GetNodes() const { return *m_pNodes
; }
408 friend class ::rtl::Reference
<SwDoc
>;
410 /** Acquire a reference to an instance. A caller shall release
411 the instance by calling 'release' when it is no longer needed.
412 'acquire' and 'release' calls need to be balanced.
415 the current reference count of the instance for debugging purposes.
418 /** Releases a reference to an instance. A caller has to call
419 'release' when a before acquired reference to an instance
420 is no longer needed. 'acquire' and 'release' calls need to
424 the current reference count of the instance for debugging purposes.
427 /** Returns the current reference count. This method should be used for
428 debugging purposes. Using it otherwise is a signal of a design flaw.
431 sal_Int32
getReferenceCount() const;
433 // IDocumentSettingAccess
434 IDocumentSettingAccess
const & getIDocumentSettingAccess() const; //The IDocumentSettingAccess interface
435 IDocumentSettingAccess
& getIDocumentSettingAccess();
436 ::sw::DocumentSettingManager
& GetDocumentSettingManager(); //The implementation of the interface with some additional methods
437 ::sw::DocumentSettingManager
const& GetDocumentSettingManager() const;
438 sal_uInt32
getRsid() const;
439 void setRsid( sal_uInt32 nVal
);
440 sal_uInt32
getRsidRoot() const;
441 void setRsidRoot( sal_uInt32 nVal
);
443 // IDocumentDeviceAccess
444 IDocumentDeviceAccess
const & getIDocumentDeviceAccess() const;
445 IDocumentDeviceAccess
& getIDocumentDeviceAccess();
447 // IDocumentMarkAccess
448 IDocumentMarkAccess
* getIDocumentMarkAccess();
449 const IDocumentMarkAccess
* getIDocumentMarkAccess() const;
451 // IDocumentRedlineAccess
452 IDocumentRedlineAccess
const& getIDocumentRedlineAccess() const;
453 IDocumentRedlineAccess
& getIDocumentRedlineAccess();
455 ::sw::DocumentRedlineManager
const& GetDocumentRedlineManager() const;
456 ::sw::DocumentRedlineManager
& GetDocumentRedlineManager();
459 IDocumentUndoRedo
& GetIDocumentUndoRedo();
460 IDocumentUndoRedo
const& GetIDocumentUndoRedo() const;
462 // IDocumentLinksAdministration
463 IDocumentLinksAdministration
const & getIDocumentLinksAdministration() const;
464 IDocumentLinksAdministration
& getIDocumentLinksAdministration();
466 ::sw::DocumentLinksAdministrationManager
const & GetDocumentLinksAdministrationManager() const;
467 ::sw::DocumentLinksAdministrationManager
& GetDocumentLinksAdministrationManager();
469 // IDocumentFieldsAccess
470 IDocumentFieldsAccess
const & getIDocumentFieldsAccess() const;
471 IDocumentFieldsAccess
& getIDocumentFieldsAccess();
473 ::sw::DocumentFieldsManager
& GetDocumentFieldsManager();
475 // Returns 0 if the field cannot hide para, or a positive integer indicating the field type
476 // "weight" when several hiding fields' FieldHidesPara() give conflicting results
477 int FieldCanHideParaWeight(SwFieldIds eFieldId
) const;
478 bool FieldHidesPara(const SwField
& rField
) const;
480 // IDocumentContentOperations
481 IDocumentContentOperations
const & getIDocumentContentOperations() const;
482 IDocumentContentOperations
& getIDocumentContentOperations();
483 ::sw::DocumentContentOperationsManager
const & GetDocumentContentOperationsManager() const;
484 ::sw::DocumentContentOperationsManager
& GetDocumentContentOperationsManager();
486 bool UpdateParRsid( SwTextNode
*pTextNode
, sal_uInt32 nVal
= 0 );
487 void UpdateRsid( const SwPaM
&rRg
, sal_Int32 nLen
);
489 // IDocumentStylePoolAccess
490 IDocumentStylePoolAccess
const & getIDocumentStylePoolAccess() const;
491 IDocumentStylePoolAccess
& getIDocumentStylePoolAccess();
494 const SwLineNumberInfo
& GetLineNumberInfo() const;
495 void SetLineNumberInfo(const SwLineNumberInfo
& rInfo
);
497 // IDocumentStatistics
498 IDocumentStatistics
const & getIDocumentStatistics() const;
499 IDocumentStatistics
& getIDocumentStatistics();
501 ::sw::DocumentStatisticsManager
const & GetDocumentStatisticsManager() const;
502 ::sw::DocumentStatisticsManager
& GetDocumentStatisticsManager();
505 IDocumentState
const & getIDocumentState() const;
506 IDocumentState
& getIDocumentState();
508 // IDocumentDrawModelAccess
509 void AddDrawUndo( std::unique_ptr
<SdrUndoAction
> );
510 IDocumentDrawModelAccess
const & getIDocumentDrawModelAccess() const;
511 IDocumentDrawModelAccess
& getIDocumentDrawModelAccess();
513 ::sw::DocumentDrawModelManager
const & GetDocumentDrawModelManager() const;
514 ::sw::DocumentDrawModelManager
& GetDocumentDrawModelManager();
516 // IDocumentLayoutAccess
517 IDocumentLayoutAccess
const & getIDocumentLayoutAccess() const;
518 IDocumentLayoutAccess
& getIDocumentLayoutAccess();
520 ::sw::DocumentLayoutManager
const & GetDocumentLayoutManager() const;
521 ::sw::DocumentLayoutManager
& GetDocumentLayoutManager();
523 // IDocumentTimerAccess
524 // Our own 'IdleTimer' calls the following method
525 IDocumentTimerAccess
const & getIDocumentTimerAccess() const;
526 IDocumentTimerAccess
& getIDocumentTimerAccess();
528 // IDocumentChartDataProviderAccess
529 IDocumentChartDataProviderAccess
const & getIDocumentChartDataProviderAccess() const;
530 IDocumentChartDataProviderAccess
& getIDocumentChartDataProviderAccess();
532 // IDocumentListItems
533 IDocumentListItems
const & getIDocumentListItems() const;
534 IDocumentListItems
& getIDocumentListItems();
536 // IDocumentOutlineNodes
537 IDocumentOutlineNodes
const & getIDocumentOutlineNodes() const;
538 IDocumentOutlineNodes
& getIDocumentOutlineNodes();
540 // IDocumentListsAccess
541 IDocumentListsAccess
const & getIDocumentListsAccess() const;
542 IDocumentListsAccess
& getIDocumentListsAccess();
544 //IDocumentExternalData
545 IDocumentExternalData
const & getIDocumentExternalData() const;
546 IDocumentExternalData
& getIDocumentExternalData();
550 void setDocAccTitle( const OUString
& rTitle
) { msDocAccTitle
= rTitle
; }
551 const OUString
& getDocAccTitle() const { return msDocAccTitle
; }
553 // INextInterface here
554 DECL_LINK(CalcFieldValueHdl
, EditFieldInfo
*, void);
557 bool IsOLEPrtNotifyPending() const { return mbOLEPrtNotifyPending
; }
558 inline void SetOLEPrtNotifyPending( bool bSet
= true );
559 void PrtOLENotify( bool bAll
); // All or only marked
561 bool IsPrepareSelAll() const { return mbIsPrepareSelAll
; }
562 void SetPrepareSelAll() { mbIsPrepareSelAll
= true; }
564 void SetContainsAtPageObjWithContentAnchor( const bool bFlag
)
566 mbContainsAtPageObjWithContentAnchor
= bFlag
;
568 bool DoesContainAtPageObjWithContentAnchor()
570 return mbContainsAtPageObjWithContentAnchor
;
573 /** Returns positions of all FlyFrames in the document.
574 If a Pam-Pointer is passed the FlyFrames attached to paragraphs
575 have to be surrounded completely by css::awt::Selection.
576 ( Start < Pos < End ) !!!
577 (Required for Writers.) */
578 SwPosFlyFrames
GetAllFlyFormats( const SwPaM
*,
580 bool bAsCharAlso
= false ) const;
582 SwFlyFrameFormat
*MakeFlyFrameFormat (const OUString
&rFormatName
, SwFrameFormat
*pDerivedFrom
);
583 SwDrawFrameFormat
*MakeDrawFrameFormat(const OUString
&rFormatName
, SwFrameFormat
*pDerivedFrom
);
585 // From now on this interface has to be used for Flys.
586 // pAnchorPos must be set, if they are not attached to pages AND
587 // Anchor is not already set at valid ContentPos
588 // in FlySet/FrameFormat.
589 /* new parameter bCalledFromShell
591 true: An existing adjust item at pAnchorPos is propagated to
592 the content node of the new fly section. That propagation only
593 takes place if there is no adjust item in the paragraph style
594 for the new fly section.
596 false: no propagation
598 SwFlyFrameFormat
* MakeFlySection( RndStdIds eAnchorType
,
599 const SwPosition
* pAnchorPos
,
600 const SfxItemSet
* pSet
= nullptr,
601 SwFrameFormat
*pParent
= nullptr,
602 bool bCalledFromShell
= false );
603 SwFlyFrameFormat
* MakeFlyAndMove( const SwPaM
& rPam
, const SfxItemSet
& rSet
,
604 const SwSelBoxes
* pSelBoxes
,
605 SwFrameFormat
*pParent
);
607 // Helper that checks for unique items for DrawingLayer items of type NameOrIndex
608 // and evtl. corrects that items to ensure unique names for that type. This call may
609 // modify/correct entries inside of the given SfxItemSet, and it will apply a name to
610 // the items in question (what is essential to make the named slots associated with
611 // these items work for the UNO API and thus e.g. for ODF import/export)
612 void CheckForUniqueItemForLineFillNameOrIndex(SfxItemSet
& rSet
);
614 bool SetFlyFrameAttr( SwFrameFormat
& rFlyFormat
, SfxItemSet
& rSet
);
616 bool SetFrameFormatToFly( SwFrameFormat
& rFlyFormat
, SwFrameFormat
& rNewFormat
,
617 SfxItemSet
* pSet
= nullptr, bool bKeepOrient
= false );
618 void SetFlyFrameTitle( SwFlyFrameFormat
& rFlyFrameFormat
,
619 const OUString
& sNewTitle
);
620 void SetFlyFrameDescription( SwFlyFrameFormat
& rFlyFrameFormat
,
621 const OUString
& sNewDescription
);
624 // Footnote information
625 const SwFootnoteInfo
& GetFootnoteInfo() const { return *mpFootnoteInfo
; }
626 void SetFootnoteInfo(const SwFootnoteInfo
& rInfo
);
627 const SwEndNoteInfo
& GetEndNoteInfo() const { return *mpEndNoteInfo
; }
628 void SetEndNoteInfo(const SwEndNoteInfo
& rInfo
);
629 SwFootnoteIdxs
& GetFootnoteIdxs() { return *mpFootnoteIdxs
; }
630 const SwFootnoteIdxs
& GetFootnoteIdxs() const { return *mpFootnoteIdxs
; }
631 /// change footnotes in range
632 bool SetCurFootnote( const SwPaM
& rPam
, const OUString
& rNumStr
,
635 /** Operations on the content of the document e.g.
636 spell-checking/hyphenating/word-counting
639 Spell( SwPaM
&, css::uno::Reference
< css::linguistic2::XSpellChecker1
> const &,
640 sal_uInt16
* pPageCnt
, sal_uInt16
* pPageSt
, bool bGrammarCheck
,
641 SwRootFrame
const* pLayout
, // for grammar-check
642 SwConversionArgs
*pConvArgs
= nullptr ) const;
644 css::uno::Reference
< css::linguistic2::XHyphenatedWord
>
645 Hyphenate( SwPaM
*pPam
, const Point
&rCursorPos
,
646 sal_uInt16
* pPageCnt
, sal_uInt16
* pPageSt
);
648 // count words in pam
649 static void CountWords( const SwPaM
& rPaM
, SwDocStat
& rStat
);
652 bool IsInsOnlyTextGlossary() const { return mbInsOnlyTextGlssry
; }
654 void Summary( SwDoc
* pExtDoc
, sal_uInt8 nLevel
, sal_uInt8 nPara
, bool bImpress
);
656 void ChangeAuthorityData(const SwAuthEntry
* pNewData
);
658 bool IsInHeaderFooter( const SwNodeIndex
& rIdx
) const;
659 SvxFrameDirection
GetTextDirection( const SwPosition
& rPos
,
660 const Point
* pPt
= nullptr ) const;
661 bool IsInVerticalText( const SwPosition
& rPos
) const;
663 // Database and DB-Manager
664 void SetDBManager( SwDBManager
* pNewMgr
) { m_pDBManager
= pNewMgr
; }
665 SwDBManager
* GetDBManager() const { return m_pDBManager
; }
666 void ChangeDBFields( const std::vector
<OUString
>& rOldNames
,
667 const OUString
& rNewName
);
668 void SetInitDBFields(bool b
);
670 // Find out which databases are used by fields.
671 void GetAllUsedDB( std::vector
<OUString
>& rDBNameList
,
672 const std::vector
<OUString
>* pAllDBNames
= nullptr );
674 void ChgDBData( const SwDBData
& rNewData
);
675 SwDBData
const & GetDBData();
676 const SwDBData
& GetDBDesc();
678 // Some helper functions
679 OUString
GetUniqueGrfName() const;
680 OUString
GetUniqueOLEName() const;
681 OUString
GetUniqueFrameName() const;
682 OUString
GetUniqueShapeName() const;
684 std::set
<SwRootFrame
*> GetAllLayouts();
686 void SetFlyName( SwFlyFrameFormat
& rFormat
, const OUString
& rName
);
687 const SwFlyFrameFormat
* FindFlyByName( const OUString
& rName
, SwNodeType nNdTyp
= SwNodeType::NONE
) const;
689 static void GetGrfNms( const SwFlyFrameFormat
& rFormat
, OUString
* pGrfName
, OUString
* pFltName
);
691 // Set a valid name for all Flys that have none (Called by Readers after reading).
692 void SetAllUniqueFlyNames();
694 /** Reset attributes. All TextHints and (if completely selected) all hard-
695 formatted stuff (auto-formats) are removed.
696 Introduce new optional parameter <bSendDataChangedEvents> in order to
697 control, if the side effect "send data changed events" is triggered or not. */
698 void ResetAttrs( const SwPaM
&rRg
,
699 bool bTextAttr
= true,
700 const std::set
<sal_uInt16
> &rAttrs
= std::set
<sal_uInt16
>(),
701 const bool bSendDataChangedEvents
= true,
702 SwRootFrame
const* pLayout
= nullptr);
703 void RstTextAttrs(const SwPaM
&rRg
, bool bInclRefToxMark
= false,
704 bool bExactRange
= false, SwRootFrame
const* pLayout
= nullptr);
706 /** Set attribute in given format.1y
707 * If Undo is enabled, the old values is added to the Undo history. */
708 void SetAttr( const SfxPoolItem
&, SwFormat
& );
709 /** Set attribute in given format.1y
710 * If Undo is enabled, the old values is added to the Undo history. */
711 void SetAttr( const SfxItemSet
&, SwFormat
& );
713 // method to reset a certain attribute at the given format
714 void ResetAttrAtFormat( const sal_uInt16 nWhichId
,
715 SwFormat
& rChangedFormat
);
717 /** Set attribute as new default attribute in current document.
718 If Undo is activated, the old one is listed in Undo-History. */
719 void SetDefault( const SfxPoolItem
& );
720 void SetDefault( const SfxItemSet
& );
722 // Query default attribute in this document.
723 const SfxPoolItem
& GetDefault( sal_uInt16 nFormatHint
) const;
724 template<class T
> const T
& GetDefault( TypedWhichId
<T
> nWhich
) const
726 return static_cast<const T
&>(GetDefault(sal_uInt16(nWhich
)));
729 // Do not expand text attributes.
730 bool DontExpandFormat( const SwPosition
& rPos
, bool bFlag
= true );
733 const SwFrameFormats
* GetFrameFormats() const { return mpFrameFormatTable
.get(); }
734 SwFrameFormats
* GetFrameFormats() { return mpFrameFormatTable
.get(); }
735 const SwCharFormats
* GetCharFormats() const { return mpCharFormatTable
.get();}
736 SwCharFormats
* GetCharFormats() { return mpCharFormatTable
.get();}
738 // LayoutFormats (frames, DrawObjects), sometimes const sometimes not
739 const SwFrameFormats
* GetSpzFrameFormats() const { return mpSpzFrameFormatTable
.get(); }
740 SwFrameFormats
* GetSpzFrameFormats() { return mpSpzFrameFormatTable
.get(); }
742 const SwFrameFormat
*GetDfltFrameFormat() const { return mpDfltFrameFormat
.get(); }
743 SwFrameFormat
*GetDfltFrameFormat() { return mpDfltFrameFormat
.get(); }
744 const SwFrameFormat
*GetEmptyPageFormat() const { return mpEmptyPageFormat
.get(); }
745 SwFrameFormat
*GetEmptyPageFormat() { return mpEmptyPageFormat
.get(); }
746 const SwFrameFormat
*GetColumnContFormat() const{ return mpColumnContFormat
.get(); }
747 SwFrameFormat
*GetColumnContFormat() { return mpColumnContFormat
.get(); }
748 const SwCharFormat
*GetDfltCharFormat() const { return mpDfltCharFormat
.get();}
749 SwCharFormat
*GetDfltCharFormat() { return mpDfltCharFormat
.get();}
751 // @return the interface of the management of (auto)styles
752 IStyleAccess
& GetIStyleAccess() { return *mpStyleAccess
; }
754 // Remove all language dependencies from all existing formats
755 void RemoveAllFormatLanguageDependencies();
757 static SwFormat
* FindFormatByName(const SwFormatsBase
& rFormatArr
, const OUString
& rName
);
759 SwFrameFormat
*MakeFrameFormat(const OUString
&rFormatName
, SwFrameFormat
*pDerivedFrom
,
760 bool bBroadcast
= false, bool bAuto
= true);
761 void DelFrameFormat( SwFrameFormat
*pFormat
, bool bBroadcast
= false );
762 SwFrameFormat
* FindFrameFormatByName( const OUString
& rName
) const
763 { return static_cast<SwFrameFormat
*>(FindFormatByName( static_cast<SwFormatsBase
&>(*mpFrameFormatTable
), rName
)); }
765 SwCharFormat
*MakeCharFormat(const OUString
&rFormatName
, SwCharFormat
*pDerivedFrom
,
766 bool bBroadcast
= false );
767 void DelCharFormat(size_t nFormat
, bool bBroadcast
= false);
768 void DelCharFormat(SwCharFormat
const * pFormat
, bool bBroadcast
= false);
769 SwCharFormat
* FindCharFormatByName( const OUString
& rName
) const
770 { return static_cast<SwCharFormat
*>(FindFormatByName( *mpCharFormatTable
, rName
)); }
772 // Formatcollections (styles)
774 const SwTextFormatColl
* GetDfltTextFormatColl() const { return mpDfltTextFormatColl
.get(); }
775 SwTextFormatColl
* GetDfltTextFormatColl() { return mpDfltTextFormatColl
.get(); }
776 const SwTextFormatColls
*GetTextFormatColls() const { return mpTextFormatCollTable
.get(); }
777 SwTextFormatColls
*GetTextFormatColls() { return mpTextFormatCollTable
.get(); }
778 SwTextFormatColl
*MakeTextFormatColl( const OUString
&rFormatName
,
779 SwTextFormatColl
*pDerivedFrom
,
780 bool bBroadcast
= false);
781 SwConditionTextFormatColl
* MakeCondTextFormatColl( const OUString
&rFormatName
,
782 SwTextFormatColl
*pDerivedFrom
,
783 bool bBroadcast
= false);
784 void DelTextFormatColl(size_t nFormat
, bool bBroadcast
= false);
785 void DelTextFormatColl( SwTextFormatColl
const * pColl
, bool bBroadcast
= false );
786 /** Add 4th optional parameter <bResetListAttrs>.
787 'side effect' of <SetTextFormatColl> with <bReset = true> is that the hard
788 attributes of the affected text nodes are cleared, except the break
789 attribute, the page description attribute and the list style attribute.
790 The new parameter <bResetListAttrs> indicates, if the list attributes
791 (list style, restart at and restart with) are cleared as well in case
792 that <bReset = true> and the paragraph style has a list style attribute set. */
793 bool SetTextFormatColl(const SwPaM
&rRg
, SwTextFormatColl
*pFormat
,
794 const bool bReset
= true,
795 const bool bResetListAttrs
= false,
796 SwRootFrame
const* pLayout
= nullptr);
797 SwTextFormatColl
* FindTextFormatCollByName( const OUString
& rName
) const
798 { return static_cast<SwTextFormatColl
*>(FindFormatByName( *mpTextFormatCollTable
, rName
)); }
802 const SwGrfFormatColl
* GetDfltGrfFormatColl() const { return mpDfltGrfFormatColl
.get(); }
803 SwGrfFormatColl
* GetDfltGrfFormatColl() { return mpDfltGrfFormatColl
.get(); }
804 const SwGrfFormatColls
*GetGrfFormatColls() const { return mpGrfFormatCollTable
.get(); }
805 SwGrfFormatColl
*MakeGrfFormatColl(const OUString
&rFormatName
,
806 SwGrfFormatColl
*pDerivedFrom
);
809 const SwFrameFormats
* GetTableFrameFormats() const { return mpTableFrameFormatTable
.get(); }
810 SwFrameFormats
* GetTableFrameFormats() { return mpTableFrameFormatTable
.get(); }
811 size_t GetTableFrameFormatCount( bool bUsed
) const;
812 SwFrameFormat
& GetTableFrameFormat(size_t nFormat
, bool bUsed
) const;
813 SwTableFormat
* MakeTableFrameFormat(const OUString
&rFormatName
, SwFrameFormat
*pDerivedFrom
);
814 void DelTableFrameFormat( SwTableFormat
* pFormat
);
815 SwTableFormat
* FindTableFormatByName( const OUString
& rName
, bool bAll
= false ) const;
817 /** Access to frames.
818 Iterate over Flys - for Basic-Collections. */
819 size_t GetFlyCount( FlyCntType eType
, bool bIgnoreTextBoxes
= false ) const;
820 SwFrameFormat
* GetFlyNum(size_t nIdx
, FlyCntType eType
, bool bIgnoreTextBoxes
= false );
821 std::vector
<SwFrameFormat
const*> GetFlyFrameFormats(
823 bool bIgnoreTextBoxes
);
825 // Copy formats in own arrays and return them.
826 SwFrameFormat
*CopyFrameFormat ( const SwFrameFormat
& );
827 SwCharFormat
*CopyCharFormat( const SwCharFormat
& );
828 SwTextFormatColl
* CopyTextColl( const SwTextFormatColl
& rColl
);
829 SwGrfFormatColl
* CopyGrfColl( const SwGrfFormatColl
& rColl
);
831 // Replace all styles with those from rSource.
832 void ReplaceStyles( const SwDoc
& rSource
, bool bIncludePageStyles
= true );
834 // Replace all property defaults with those from rSource.
835 void ReplaceDefaults( const SwDoc
& rSource
);
837 // Replace all compatibility options with those from rSource.
838 void ReplaceCompatibilityOptions( const SwDoc
& rSource
);
840 /** Replace all user defined document properties with xSourceDocProps.
841 Convenience function used by ReplaceDocumentProperties to skip some UNO calls.
843 void ReplaceUserDefinedDocumentProperties( const css::uno::Reference
< css::document::XDocumentProperties
>& xSourceDocProps
);
845 /** Replace document properties with those from rSource.
847 This includes the user defined document properties!
849 void ReplaceDocumentProperties(const SwDoc
& rSource
, bool mailMerge
= false);
851 // Query if style (paragraph- / character- / frame- / page-) is used.
852 bool IsUsed( const SwModify
& ) const;
853 /// Query if table style is used.
854 bool IsUsed( const SwTableAutoFormat
& ) const;
855 static bool IsUsed( const SwNumRule
& );
857 // Set name of newly loaded document template.
858 size_t SetDocPattern(const OUString
& rPatternName
);
860 // @return name of document template. Can be 0!
861 const OUString
* GetDocPattern(size_t nPos
) const;
863 // travel over PaM Ring
864 bool InsertGlossary( SwTextBlocks
& rBlock
, const OUString
& rEntry
,
865 SwPaM
& rPaM
, SwCursorShell
* pShell
= nullptr);
867 /** get the set of printable pages for the XRenderable API by
868 evaluating the respective settings (see implementation) */
869 static void CalculatePagesForPrinting( const SwRootFrame
& rLayout
, SwRenderData
&rData
, const SwPrintUIOptions
&rOptions
, bool bIsPDFExport
,
870 sal_Int32 nDocPageCount
);
871 static void UpdatePagesForPrintingWithPostItData( SwRenderData
&rData
, const SwPrintUIOptions
&rOptions
,
872 sal_Int32 nDocPageCount
);
873 static void CalculatePagePairsForProspectPrinting( const SwRootFrame
& rLayout
, SwRenderData
&rData
, const SwPrintUIOptions
&rOptions
,
874 sal_Int32 nDocPageCount
);
875 static void CalculateNonBlankPages( const SwRootFrame
& rLayout
, sal_uInt16
& nDocPageCount
, sal_uInt16
& nActualPage
);
877 // PageDescriptor interface.
878 size_t GetPageDescCnt() const { return m_PageDescs
.size(); }
879 const SwPageDesc
& GetPageDesc(const size_t i
) const { return *m_PageDescs
[i
]; }
880 SwPageDesc
& GetPageDesc(size_t const i
) { return *m_PageDescs
[i
]; }
881 SwPageDesc
* FindPageDesc(const OUString
& rName
, size_t* pPos
= nullptr) const;
882 // Just searches the pointer in the m_PageDescs vector!
883 bool ContainsPageDesc(const SwPageDesc
*pDesc
, size_t* pPos
) const;
885 /** Copy the complete PageDesc - beyond document and "deep"!
886 Optionally copying of PoolFormatId, -HlpId can be prevented. */
887 void CopyPageDesc( const SwPageDesc
& rSrcDesc
, SwPageDesc
& rDstDesc
,
888 bool bCopyPoolIds
= true );
890 /** Copy header (with contents) from SrcFormat to DestFormat
891 (can also be copied into other document). */
892 void CopyHeader( const SwFrameFormat
& rSrcFormat
, SwFrameFormat
& rDestFormat
)
893 { CopyPageDescHeaderFooterImpl( true, rSrcFormat
, rDestFormat
); }
895 /** Copy footer (with contents) from SrcFormat to DestFormat.
896 (can also be copied into other document). */
897 void CopyFooter( const SwFrameFormat
& rSrcFormat
, SwFrameFormat
& rDestFormat
)
898 { CopyPageDescHeaderFooterImpl( false, rSrcFormat
, rDestFormat
); }
901 void ChgPageDesc( const OUString
& rName
, const SwPageDesc
& );
902 void ChgPageDesc( size_t i
, const SwPageDesc
& );
903 void DelPageDesc( const OUString
& rName
, bool bBroadcast
= false);
904 void DelPageDesc( size_t i
, bool bBroadcast
= false );
905 void PreDelPageDesc(SwPageDesc
const * pDel
);
906 SwPageDesc
* MakePageDesc(const OUString
&rName
, const SwPageDesc
* pCpy
= nullptr,
907 bool bRegardLanguage
= true,
908 bool bBroadcast
= false);
909 void BroadcastStyleOperation(const OUString
& rName
, SfxStyleFamily eFamily
,
912 /** The html import sometimes overwrites the page sizes set in
913 the page descriptions. This function is used to correct this. */
914 void CheckDefaultPageFormat();
916 // Methods for tables/indices
917 static sal_uInt16
GetCurTOXMark( const SwPosition
& rPos
, SwTOXMarks
& );
918 void DeleteTOXMark( const SwTOXMark
* pTOXMark
);
919 const SwTOXMark
& GotoTOXMark( const SwTOXMark
& rCurTOXMark
,
920 SwTOXSearch eDir
, bool bInReadOnly
);
922 // Insert/Renew table/index
923 SwTOXBaseSection
* InsertTableOf( const SwPosition
& rPos
,
924 const SwTOXBase
& rTOX
,
925 const SfxItemSet
* pSet
= nullptr,
926 bool bExpand
= false,
927 SwRootFrame
const* pLayout
= nullptr);
928 SwTOXBaseSection
* InsertTableOf( const SwPaM
& aPam
,
929 const SwTOXBase
& rTOX
,
930 const SfxItemSet
* pSet
= nullptr,
931 bool bExpand
= false,
932 SwRootFrame
const* pLayout
= nullptr );
933 void InsertTableOf( sal_uLong nSttNd
, sal_uLong nEndNd
,
934 const SwTOXBase
& rTOX
,
935 const SfxItemSet
* pSet
);
936 static SwTOXBase
* GetCurTOX( const SwPosition
& rPos
);
937 static const SwAttrSet
& GetTOXBaseAttrSet(const SwTOXBase
& rTOX
);
939 bool DeleteTOX( const SwTOXBase
& rTOXBase
, bool bDelNodes
);
940 OUString
GetUniqueTOXBaseName( const SwTOXType
& rType
,
941 const OUString
& sChkStr
) const;
943 bool SetTOXBaseName(const SwTOXBase
& rTOXBase
, const OUString
& rName
);
945 // After reading file update all tables/indices
946 void SetUpdateTOX( bool bFlag
) { mbUpdateTOX
= bFlag
; }
947 bool IsUpdateTOX() const { return mbUpdateTOX
; }
949 const OUString
& GetTOIAutoMarkURL() const {return msTOIAutoMarkURL
;}
950 void SetTOIAutoMarkURL(const OUString
& rSet
) {msTOIAutoMarkURL
= rSet
;}
952 bool IsInReading() const { return mbInReading
; }
953 void SetInReading( bool bNew
) { mbInReading
= bNew
; }
955 bool IsInWriting() const { return mbInWriting
; }
956 void SetInWriting(bool bNew
) { mbInWriting
= bNew
; }
958 bool IsInMailMerge() const { return mbInMailMerge
; }
959 void SetInMailMerge( bool bNew
) { mbInMailMerge
= bNew
; }
961 bool IsClipBoard() const { return mbClipBoard
; }
962 // N.B.: must be called right after constructor! (@see GetXmlIdRegistry)
963 void SetClipBoard( bool bNew
) { mbClipBoard
= bNew
; }
965 bool IsColumnSelection() const { return mbColumnSelection
; }
966 void SetColumnSelection( bool bNew
) { mbColumnSelection
= bNew
; }
968 bool IsInXMLImport() const { return mbInXMLImport
; }
969 void SetInXMLImport( bool bNew
) { mbInXMLImport
= bNew
; }
970 bool IsInWriterfilterImport() const { return mbInWriterfilterImport
; }
971 void SetInWriterfilterImport(bool const b
) { mbInWriterfilterImport
= b
; }
973 // Manage types of tables/indices
974 sal_uInt16
GetTOXTypeCount( TOXTypes eTyp
) const;
975 const SwTOXType
* GetTOXType( TOXTypes eTyp
, sal_uInt16 nId
) const;
976 const SwTOXType
* InsertTOXType( const SwTOXType
& rTyp
);
977 const SwTOXTypes
& GetTOXTypes() const { return *mpTOXTypes
; }
979 const SwTOXBase
* GetDefaultTOXBase( TOXTypes eTyp
, bool bCreate
);
980 void SetDefaultTOXBase(const SwTOXBase
& rBase
);
982 // Key for management of index.
983 void GetTOIKeys(SwTOIKeyType eTyp
, std::vector
<OUString
>& rArr
,
984 SwRootFrame
const& rLayout
) const;
987 bool SortTable(const SwSelBoxes
& rBoxes
, const SwSortOptions
&);
988 bool SortText(const SwPaM
&, const SwSortOptions
&);
990 // Correct the SwPosition-Objects that are registered with the document
991 // e. g. Bookmarks or tables/indices.
992 // If bMoveCursor is set move Cursor too.
994 // Set everything in rOldNode on rNewPos + Offset.
996 const SwNodeIndex
& rOldNode
,
997 const SwPosition
& rNewPos
,
998 const sal_Int32 nOffset
= 0,
999 bool bMoveCursor
= false );
1001 // Set everything in the range of [rStartNode, rEndNode] to rNewPos.
1002 static void CorrAbs(
1003 const SwNodeIndex
& rStartNode
,
1004 const SwNodeIndex
& rEndNode
,
1005 const SwPosition
& rNewPos
,
1006 bool bMoveCursor
= false );
1008 // Set everything in this range from rRange to rNewPos.
1009 static void CorrAbs(
1010 const SwPaM
& rRange
,
1011 const SwPosition
& rNewPos
,
1012 bool bMoveCursor
= false );
1014 // Set everything in rOldNode to relative Pos.
1016 const SwNodeIndex
& rOldNode
,
1017 const SwPosition
& rNewPos
,
1018 const sal_Int32 nOffset
= 0,
1019 bool bMoveCursor
= false );
1021 // Query / set rules for Outline.
1022 SwNumRule
* GetOutlineNumRule() const
1024 return mpOutlineRule
;
1026 void SetOutlineNumRule( const SwNumRule
& rRule
);
1027 void PropagateOutlineRule();
1029 // Outline - promote / demote.
1030 bool OutlineUpDown(const SwPaM
& rPam
, short nOffset
, SwRootFrame
const* pLayout
= nullptr);
1032 /// Outline - move up / move down.
1033 bool MoveOutlinePara( const SwPaM
& rPam
, SwOutlineNodes::difference_type nOffset
);
1035 bool GotoOutline(SwPosition
& rPos
, const OUString
& rName
, SwRootFrame
const* = nullptr) const;
1037 /** Accept changes of outline styles for OutlineRule.
1038 @param bResetIndentAttrs Optional parameter - default value false:
1039 If <bResetIndentAttrs> equals true, the indent attributes "before text"
1040 and "first line indent" are additionally reset at the provided PaM, if
1041 the list style makes use of the new list level attributes.
1042 @param bCreateNewList indicates if a new list is created by applying the given list style.
1043 @param sContinuedListId If bCreateNewList is false, may contain the
1044 list Id of a list which has to be continued by applying the given list style
1046 @return the set ListId if bSetItem is true */
1047 OUString
SetNumRule( const SwPaM
&,
1049 bool bCreateNewList
,
1050 SwRootFrame
const* pLayout
= nullptr,
1051 const OUString
& sContinuedListId
= OUString(),
1052 bool bSetItem
= true,
1053 const bool bResetIndentAttrs
= false );
1054 void SetCounted(const SwPaM
&, bool bCounted
, SwRootFrame
const* pLayout
);
1056 void MakeUniqueNumRules(const SwPaM
& rPaM
);
1058 void SetNumRuleStart( const SwPosition
& rPos
, bool bFlag
= true );
1059 void SetNodeNumStart( const SwPosition
& rPos
, sal_uInt16 nStt
);
1061 // sw_redlinehide: may set rPos to different node (the one with the NumRule)
1062 static SwNumRule
* GetNumRuleAtPos(SwPosition
& rPos
, SwRootFrame
const* pLayout
= nullptr);
1064 const SwNumRuleTable
& GetNumRuleTable() const { return *mpNumRuleTable
; }
1067 Add numbering rule to document.
1069 @param pRule rule to add
1071 void AddNumRule(SwNumRule
* pRule
);
1073 // add optional parameter <eDefaultNumberFormatPositionAndSpaceMode>
1074 sal_uInt16
MakeNumRule( const OUString
&rName
,
1075 const SwNumRule
* pCpy
= nullptr,
1076 bool bBroadcast
= false,
1077 const SvxNumberFormat::SvxNumPositionAndSpaceMode eDefaultNumberFormatPositionAndSpaceMode
=
1078 SvxNumberFormat::LABEL_WIDTH_AND_POSITION
);
1079 sal_uInt16
FindNumRule( const OUString
& rName
) const;
1080 SwNumRule
* FindNumRulePtr( const OUString
& rName
) const;
1082 // Deletion only possible if Rule is not used!
1083 bool RenameNumRule(const OUString
& aOldName
, const OUString
& aNewName
,
1084 bool bBroadcast
= false);
1085 bool DelNumRule( const OUString
& rName
, bool bBroadCast
= false );
1086 OUString
GetUniqueNumRuleName( const OUString
* pChkStr
= nullptr, bool bAutoNum
= true ) const;
1088 void UpdateNumRule(); // Update all invalids.
1089 void ChgNumRuleFormats( const SwNumRule
& rRule
);
1090 bool ReplaceNumRule( const SwPosition
& rPos
, const OUString
& rOldRule
,
1091 const OUString
& rNewRule
);
1093 // Goto next/previous on same level.
1094 static bool GotoNextNum( SwPosition
&, SwRootFrame
const* pLayout
,
1095 bool bOverUpper
= true,
1096 sal_uInt8
* pUpper
= nullptr, sal_uInt8
* pLower
= nullptr );
1097 static bool GotoPrevNum( SwPosition
&, SwRootFrame
const* pLayout
,
1098 bool bOverUpper
= true );
1100 /** Searches for a text node with a numbering rule.
1102 add optional parameter <bInvestigateStartNode>
1103 add output parameter <sListId>
1105 \param rPos position to start search
1106 \param bForward - true: search forward
1107 - false: search backward
1108 \param bNum - true: search for enumeration
1109 - false: search for itemize
1110 \param bOutline - true: search for outline numbering rule
1111 - false: search for non-outline numbering rule
1112 \param nNonEmptyAllowed number of non-empty paragraphs allowed between
1113 rPos and found paragraph
1116 output parameter - in case a list style is found, <sListId> holds the
1117 list id, to which the text node belongs, which applies the found list style.
1119 @param bInvestigateStartNode
1120 input parameter - boolean, indicating, if start node, determined by given
1121 start position has to be investigated or not.
1123 const SwNumRule
* SearchNumRule(const SwPosition
& rPos
,
1124 const bool bForward
,
1126 const bool bOutline
,
1127 int nNonEmptyAllowed
,
1129 SwRootFrame
const* pLayout
,
1130 const bool bInvestigateStartNode
= false );
1132 // Paragraphs without numbering but with indents.
1133 bool NoNum( const SwPaM
& );
1135 // Delete, splitting of numbering list.
1136 void DelNumRules(const SwPaM
&, SwRootFrame
const* pLayout
= nullptr);
1138 // Invalidates all numrules
1139 void InvalidateNumRules();
1141 bool NumUpDown(const SwPaM
&, bool bDown
, SwRootFrame
const* pLayout
= nullptr);
1143 /** Move selected paragraphs (not only numberings)
1144 according to offsets. (if negative: go to doc start). */
1145 bool MoveParagraph(SwPaM
&, long nOffset
, bool bIsOutlMv
= false);
1146 bool MoveParagraphImpl(SwPaM
&, long nOffset
, bool bIsOutlMv
, SwRootFrame
const*);
1148 bool NumOrNoNum( const SwNodeIndex
& rIdx
, bool bDel
= false);
1150 void StopNumRuleAnimations( OutputDevice
* );
1152 /** Insert new table at position @param rPos (will be inserted before Node!).
1153 For AutoFormat at input: columns have to be set at predefined width.
1154 The array holds the positions of the columns (not their widths).
1155 new @param bCalledFromShell:
1156 true: called from shell -> propagate existing adjust item at
1157 rPos to every new cell. A existing adjust item in the table
1158 heading or table contents paragraph style prevent that
1160 false: do not propagate
1162 const SwTable
* InsertTable( const SwInsertTableOptions
& rInsTableOpts
, // HeadlineNoBorder
1163 const SwPosition
& rPos
, sal_uInt16 nRows
,
1164 sal_uInt16 nCols
, sal_Int16 eAdjust
,
1165 const SwTableAutoFormat
* pTAFormat
= nullptr,
1166 const std::vector
<sal_uInt16
> *pColArr
= nullptr,
1167 bool bCalledFromShell
= false,
1168 bool bNewModel
= true );
1170 // If index is in a table, return TableNode, else 0.
1171 SwTableNode
* IsIdxInTable( const SwNodeIndex
& rIdx
);
1172 inline const SwTableNode
* IsIdxInTable( const SwNodeIndex
& rIdx
) const;
1174 // Create a balanced table out of the selected range.
1175 const SwTable
* TextToTable( const SwInsertTableOptions
& rInsTableOpts
, // HeadlineNoBorder,
1176 const SwPaM
& rRange
, sal_Unicode cCh
,
1178 const SwTableAutoFormat
* );
1180 // text to table conversion - API support
1181 const SwTable
* TextToTable( const std::vector
< std::vector
<SwNodeRange
> >& rTableNodes
);
1183 bool TableToText( const SwTableNode
* pTableNd
, sal_Unicode cCh
);
1185 // Create columns / rows in table.
1186 void InsertCol( const SwCursor
& rCursor
,
1187 sal_uInt16 nCnt
= 1, bool bBehind
= true );
1188 bool InsertCol( const SwSelBoxes
& rBoxes
,
1189 sal_uInt16 nCnt
= 1, bool bBehind
= true );
1190 void InsertRow( const SwCursor
& rCursor
,
1191 sal_uInt16 nCnt
= 1, bool bBehind
= true );
1192 bool InsertRow( const SwSelBoxes
& rBoxes
,
1193 sal_uInt16 nCnt
= 1, bool bBehind
= true );
1195 // Delete Columns/Rows in table.
1196 bool DeleteRowCol( const SwSelBoxes
& rBoxes
, bool bColumn
= false );
1197 void DeleteRow( const SwCursor
& rCursor
);
1198 void DeleteCol( const SwCursor
& rCursor
);
1200 // Split / concatenate boxes in table.
1201 bool SplitTable( const SwSelBoxes
& rBoxes
, bool bVert
,
1202 sal_uInt16 nCnt
, bool bSameHeight
= false );
1204 TableMergeErr
MergeTable( SwPaM
& rPam
);
1205 OUString
GetUniqueTableName() const;
1206 bool IsInsTableFormatNum() const;
1207 bool IsInsTableChangeNumFormat() const;
1208 bool IsInsTableAlignNum() const;
1209 bool IsSplitVerticalByDefault() const;
1210 void SetSplitVerticalByDefault(bool value
);
1212 // From FEShell (for Undo and BModified).
1213 static void GetTabCols( SwTabCols
&rFill
, const SwCellFrame
* pBoxFrame
);
1214 void SetTabCols( const SwTabCols
&rNew
, bool bCurRowOnly
,
1215 const SwCellFrame
* pBoxFrame
);
1216 static void GetTabRows( SwTabCols
&rFill
, const SwCellFrame
* pBoxFrame
);
1217 void SetTabRows( const SwTabCols
&rNew
, bool bCurColOnly
,
1218 const SwCellFrame
* pBoxFrame
);
1220 // Direct access for UNO.
1221 void SetTabCols(SwTable
& rTab
, const SwTabCols
&rNew
, const SwTabCols
&rOld
,
1222 const SwTableBox
*pStart
, bool bCurRowOnly
);
1224 void SetRowsToRepeat( SwTable
&rTable
, sal_uInt16 nSet
);
1226 /// AutoFormat for table/table selection.
1227 /// @param bResetDirect Reset direct formatting that might be applied to the cells.
1228 bool SetTableAutoFormat(const SwSelBoxes
& rBoxes
, const SwTableAutoFormat
& rNew
, bool bResetDirect
= false, bool isSetStyleName
= false);
1230 // Query attributes.
1231 bool GetTableAutoFormat( const SwSelBoxes
& rBoxes
, SwTableAutoFormat
& rGet
);
1233 /// Return the available table styles.
1234 SwTableAutoFormatTable
& GetTableStyles();
1235 const SwTableAutoFormatTable
& GetTableStyles() const
1237 return const_cast<SwDoc
*>(this)->GetTableStyles();
1239 /// Counts table styles without triggering lazy-load of them.
1240 bool HasTableStyles() const { return m_pTableStyles
!= nullptr; }
1241 // Create a new table style. Tracked by Undo.
1242 SwTableAutoFormat
* MakeTableStyle(const OUString
& rName
, bool bBroadcast
= false);
1243 // Delete table style named rName. Tracked by undo.
1244 std::unique_ptr
<SwTableAutoFormat
> DelTableStyle(const OUString
& rName
, bool bBroadcast
= false);
1245 // Change (replace) a table style named rName. Tracked by undo.
1246 void ChgTableStyle(const OUString
& rName
, const SwTableAutoFormat
& rNewFormat
);
1248 const SwCellStyleTable
& GetCellStyles() const { return *mpCellStyles
; }
1249 SwCellStyleTable
& GetCellStyles() { return *mpCellStyles
; }
1251 void AppendUndoForInsertFromDB( const SwPaM
& rPam
, bool bIsTable
);
1253 bool SetColRowWidthHeight( SwTableBox
& rCurrentBox
, TableChgWidthHeightType eType
,
1254 SwTwips nAbsDiff
, SwTwips nRelDiff
);
1255 SwTableBoxFormat
* MakeTableBoxFormat();
1256 SwTableLineFormat
* MakeTableLineFormat();
1258 // helper function: cleanup before checking number value
1259 bool IsNumberFormat( const OUString
& rString
, sal_uInt32
& F_Index
, double& fOutNumber
);
1260 // Check if box has numerical value. Change format of box if required.
1261 void ChkBoxNumFormat( SwTableBox
& rCurrentBox
, bool bCallUpdate
);
1262 void SetTableBoxFormulaAttrs( SwTableBox
& rBox
, const SfxItemSet
& rSet
);
1263 void ClearBoxNumAttrs( const SwNodeIndex
& rNode
);
1264 void ClearLineNumAttrs( SwPosition
const & rPos
);
1266 bool InsCopyOfTable( SwPosition
& rInsPos
, const SwSelBoxes
& rBoxes
,
1267 const SwTable
* pCpyTable
, bool bCpyName
= false,
1268 bool bCorrPos
= false );
1270 void UnProtectCells( const OUString
& rTableName
);
1271 bool UnProtectCells( const SwSelBoxes
& rBoxes
);
1272 void UnProtectTables( const SwPaM
& rPam
);
1273 bool HasTableAnyProtection( const SwPosition
* pPos
,
1274 const OUString
* pTableName
,
1275 bool* pFullTableProtection
);
1277 // Split table at baseline position, i.e. create a new table.
1278 bool SplitTable( const SwPosition
& rPos
, SplitTable_HeadlineOption eMode
,
1279 bool bCalcNewSize
);
1281 /** And vice versa: rPos must be in the table that remains. The flag indicates
1282 whether the current table is merged with the one before or behind it. */
1283 bool MergeTable( const SwPosition
& rPos
, bool bWithPrev
,
1284 sal_uInt16 nMode
= 0 );
1286 // Make charts of given table update.
1287 void UpdateCharts( const OUString
&rName
) const;
1289 // Update all charts, for that exists any table.
1290 void UpdateAllCharts() { DoUpdateAllCharts(); }
1292 // Table is renamed and refreshes charts.
1293 void SetTableName( SwFrameFormat
& rTableFormat
, const OUString
&rNewName
);
1295 // @return the reference in document that is set for name.
1296 const SwFormatRefMark
* GetRefMark( const OUString
& rName
) const;
1298 // @return RefMark via index - for UNO.
1299 const SwFormatRefMark
* GetRefMark( sal_uInt16 nIndex
) const;
1301 /** @return names of all references that are set in document.
1302 If array pointer is 0 return only whether a RefMark is set in document. */
1303 sal_uInt16
GetRefMarks( std::vector
<OUString
>* = nullptr ) const;
1305 // Insert label. If a FlyFormat is created, return it.
1306 SwFlyFrameFormat
* InsertLabel( const SwLabelType eType
, const OUString
&rText
, const OUString
& rSeparator
,
1307 const OUString
& rNumberingSeparator
,
1308 const bool bBefore
, const sal_uInt16 nId
, const sal_uLong nIdx
,
1309 const OUString
& rCharacterStyle
,
1310 const bool bCpyBrd
);
1311 SwFlyFrameFormat
* InsertDrawLabel(
1312 const OUString
&rText
, const OUString
& rSeparator
, const OUString
& rNumberSeparator
,
1313 const sal_uInt16 nId
, const OUString
& rCharacterStyle
, SdrObject
& rObj
);
1315 // Query attribute pool.
1316 const SwAttrPool
& GetAttrPool() const { return *mpAttrPool
; }
1317 SwAttrPool
& GetAttrPool() { return *mpAttrPool
; }
1319 // Search for an EditShell.
1320 SwEditShell
const * GetEditShell() const;
1321 SwEditShell
* GetEditShell();
1322 ::sw::IShellCursorSupplier
* GetIShellCursorSupplier();
1324 // OLE 2.0-notification.
1325 void SetOle2Link(const Link
<bool,void>& rLink
) {maOle2Link
= rLink
;}
1326 const Link
<bool,void>& GetOle2Link() const {return maOle2Link
;}
1328 // insert section (the ODF kind of section, not the nodesarray kind)
1329 SwSection
* InsertSwSection(SwPaM
const& rRange
, SwSectionData
&,
1330 std::pair
<SwTOXBase
const*, sw::RedlineMode
> const* pTOXBase
,
1331 SfxItemSet
const*const pAttr
, bool const bUpdate
= true);
1332 static sal_uInt16
IsInsRegionAvailable( const SwPaM
& rRange
,
1333 const SwNode
** ppSttNd
= nullptr );
1334 static SwSection
* GetCurrSection( const SwPosition
& rPos
);
1335 SwSectionFormats
& GetSections() { return *mpSectionFormatTable
; }
1336 const SwSectionFormats
& GetSections() const { return *mpSectionFormatTable
; }
1337 SwSectionFormat
*MakeSectionFormat();
1338 void DelSectionFormat( SwSectionFormat
*pFormat
, bool bDelNodes
= false );
1339 void UpdateSection(size_t const nSect
, SwSectionData
&,
1340 SfxItemSet
const*const = nullptr, bool const bPreventLinkUpdate
= false);
1341 OUString
GetUniqueSectionName( const OUString
* pChkStr
= nullptr ) const;
1343 /* @@@MAINTAINABILITY-HORROR@@@
1344 The model should not have anything to do with a shell.
1345 Unnecessary compile/link time dependency.
1348 // Pointer to SfxDocShell from Doc. Can be 0!!
1349 SwDocShell
* GetDocShell() { return mpDocShell
; }
1350 const SwDocShell
* GetDocShell() const { return mpDocShell
; }
1351 void SetDocShell( SwDocShell
* pDSh
);
1353 /** in case during copying of embedded object a new shell is created,
1354 it should be set here and cleaned later */
1355 void SetTmpDocShell( SfxObjectShellLock rLock
) { mxTmpDocShell
= rLock
; }
1356 const SfxObjectShellLock
& GetTmpDocShell() const { return mxTmpDocShell
; }
1358 // For Autotexts? (text modules) They have only one SVPersist at their disposal.
1359 SfxObjectShell
* GetPersist() const;
1361 // Pointer to storage of SfxDocShells. Can be 0!!!
1362 css::uno::Reference
< css::embed::XStorage
> GetDocStorage();
1364 // Query / set flag indicating if document is loaded asynchronously at this moment.
1365 bool IsInLoadAsynchron() const { return mbInLoadAsynchron
; }
1366 void SetInLoadAsynchron( bool bFlag
) { mbInLoadAsynchron
= bFlag
; }
1368 // For Drag&Move: (e.g. allow "moving" of RefMarks)
1369 bool IsCopyIsMove() const { return mbCopyIsMove
; }
1370 void SetCopyIsMove( bool bFlag
) { mbCopyIsMove
= bFlag
; }
1372 SwDrawContact
* GroupSelection( SdrView
& );
1373 void UnGroupSelection( SdrView
& );
1374 bool DeleteSelection( SwDrawView
& );
1376 // Invalidates OnlineSpell-WrongLists.
1377 void SpellItAgainSam( bool bInvalid
, bool bOnlyWrong
, bool bSmartTags
);
1378 void InvalidateAutoCompleteFlag();
1380 void SetCalcFieldValueHdl(Outliner
* pOutliner
);
1382 // Query if URL was visited.
1383 // Query via Doc, if only a Bookmark has been given.
1384 // In this case the document name has to be set in front.
1385 bool IsVisitedURL( const OUString
& rURL
);
1387 // Save current values for automatic registration of exceptions in Autocorrection.
1388 void SetAutoCorrExceptWord( std::unique_ptr
<SwAutoCorrExceptWord
> pNew
);
1389 SwAutoCorrExceptWord
* GetAutoCorrExceptWord() { return mpACEWord
.get(); }
1390 void DeleteAutoCorrExceptWord();
1392 const SwFormatINetFormat
* FindINetAttr( const OUString
& rName
) const;
1394 // Call into intransparent Basic; expect possible Return String.
1395 void ExecMacro( const SvxMacro
& rMacro
, OUString
* pRet
, SbxArray
* pArgs
);
1397 // Call into intransparent Basic / JavaScript.
1398 sal_uInt16
CallEvent( SvMacroItemId nEvent
, const SwCallMouseEvent
& rCallEvent
,
1399 bool bChkPtr
= false );
1401 /** Adjust left margin via object bar (similar to adjustment of numerations).
1402 One can either change the margin "by" adding or subtracting a given
1403 offset or set it "to" this position (bModulus = true). */
1404 void MoveLeftMargin(const SwPaM
& rPam
, bool bRight
, bool bModulus
,
1405 SwRootFrame
const* pLayout
= nullptr);
1407 // Query NumberFormatter.
1408 SvNumberFormatter
* GetNumberFormatter(bool bCreate
= true)
1411 EnsureNumberFormatter();
1412 return mpNumberFormatter
;
1415 const SvNumberFormatter
* GetNumberFormatter(bool bCreate
= true) const
1417 return const_cast<SwDoc
*>(this)->GetNumberFormatter(bCreate
);
1420 bool HasInvisibleContent() const;
1421 // delete invisible content, like hidden sections and paragraphs
1422 bool RemoveInvisibleContent();
1423 // restore the invisible content if it's available on the undo stack
1424 bool RestoreInvisibleContent();
1426 bool ConvertFieldsToText(SwRootFrame
const& rLayout
);
1428 // Create sub-documents according to given collection.
1429 // If no collection is given, use chapter styles for 1st level.
1430 bool GenerateGlobalDoc( const OUString
& rPath
,
1431 const SwTextFormatColl
* pSplitColl
);
1432 bool GenerateGlobalDoc( const OUString
& rPath
, int nOutlineLevel
);
1433 bool GenerateHTMLDoc( const OUString
& rPath
,
1434 const SwTextFormatColl
* pSplitColl
);
1435 bool GenerateHTMLDoc( const OUString
& rPath
, int nOutlineLevel
);
1437 // Compare two documents.
1438 long CompareDoc( const SwDoc
& rDoc
);
1440 // Merge two documents.
1441 long MergeDoc( const SwDoc
& rDoc
);
1443 bool IsAutoFormatRedline() const { return mbIsAutoFormatRedline
; }
1444 void SetAutoFormatRedline( bool bFlag
) { mbIsAutoFormatRedline
= bFlag
; }
1446 // For AutoFormat: with Undo/Redlining.
1447 void SetTextFormatCollByAutoFormat( const SwPosition
& rPos
, sal_uInt16 nPoolId
,
1448 const SfxItemSet
* pSet
);
1449 void SetFormatItemByAutoFormat( const SwPaM
& rPam
, const SfxItemSet
& );
1451 // Only for SW-textbloxks! Does not pay any attention to layout!
1452 void ClearDoc(); // Deletes all content!
1454 // Query /set data for PagePreview.
1455 const SwPagePreviewPrtData
* GetPreviewPrtData() const { return m_pPgPViewPrtData
.get(); }
1457 // If pointer == 0 destroy pointer in document.
1458 // Else copy object.
1459 // Pointer is not transferred to ownership by document!
1460 void SetPreviewPrtData( const SwPagePreviewPrtData
* pData
);
1462 /** update all modified OLE-Objects. The modification is called over the
1463 StarOne - Interface */
1464 void SetOLEObjModified();
1467 std::shared_ptr
<SwUnoCursor
> CreateUnoCursor( const SwPosition
& rPos
, bool bTableCursor
= false );
1469 // FeShell - Interfaces
1470 // !!! These assume always an existing layout !!!
1471 bool ChgAnchor( const SdrMarkList
& _rMrkList
,
1472 RndStdIds _eAnchorType
,
1473 const bool _bSameOnly
,
1474 const bool _bPosCorr
);
1476 void SetRowHeight( const SwCursor
& rCursor
, const SwFormatFrameSize
&rNew
);
1477 static std::unique_ptr
<SwFormatFrameSize
> GetRowHeight( const SwCursor
& rCursor
);
1478 void SetRowSplit( const SwCursor
& rCursor
, const SwFormatRowSplit
&rNew
);
1479 static std::unique_ptr
<SwFormatRowSplit
> GetRowSplit( const SwCursor
& rCursor
);
1481 /// Adjustment of Rowheights. Determine via bTstOnly if more than one row is selected.
1482 /// bOptimize: distribute current table height, instead of using the largest row.
1483 /// Call again without bOptimize to ensure equal height in case some row's content didn't fit.
1484 bool BalanceRowHeight( const SwCursor
& rCursor
, bool bTstOnly
, const bool bOptimize
);
1485 void SetRowBackground( const SwCursor
& rCursor
, const SvxBrushItem
&rNew
);
1486 static bool GetRowBackground( const SwCursor
& rCursor
, std::shared_ptr
<SvxBrushItem
>& rToFill
);
1487 void SetTabBorders( const SwCursor
& rCursor
, const SfxItemSet
& rSet
);
1488 void SetTabLineStyle( const SwCursor
& rCursor
,
1489 const Color
* pColor
, bool bSetLine
,
1490 const editeng::SvxBorderLine
* pBorderLine
);
1491 static void GetTabBorders( const SwCursor
& rCursor
, SfxItemSet
& rSet
);
1492 void SetBoxAttr( const SwCursor
& rCursor
, const SfxPoolItem
&rNew
);
1494 Retrieves a box attribute from the given cursor.
1496 @return Whether the property is set over the current box selection.
1498 @remarks A property is 'set' if it's set to the same value over all boxes in the current selection.
1499 The property value is retrieved from the first box in the current selection. It is then compared to
1500 the values of the same property over any other boxes in the selection; if any value is different from
1501 that of the first box, the property is unset (and false is returned).
1503 static bool GetBoxAttr( const SwCursor
& rCursor
, std::shared_ptr
<SfxPoolItem
>& rToFill
);
1504 void SetBoxAlign( const SwCursor
& rCursor
, sal_uInt16 nAlign
);
1505 static sal_uInt16
GetBoxAlign( const SwCursor
& rCursor
);
1506 /// Adjusts selected cell widths in such a way, that their content does not need to be wrapped (if possible).
1507 /// bBalance evenly re-distributes the available space regardless of content or wrapping.
1508 /// bNoShrink keeps table size the same by distributing excess space proportionately.
1509 void AdjustCellWidth( const SwCursor
& rCursor
, const bool bBalance
, const bool bNoShrink
);
1511 SwChainRet
Chainable( const SwFrameFormat
&rSource
, const SwFrameFormat
&rDest
);
1512 SwChainRet
Chain( SwFrameFormat
&rSource
, const SwFrameFormat
&rDest
);
1513 void Unchain( SwFrameFormat
&rFormat
);
1515 // For Copy/Move from FrameShell.
1516 SdrObject
* CloneSdrObj( const SdrObject
&, bool bMoveWithinDoc
= false,
1517 bool bInsInPage
= true );
1519 // FeShell - Interface end
1521 // Interface for TextInputData - for text input of Chinese and Japanese.
1522 SwExtTextInput
* CreateExtTextInput( const SwPaM
& rPam
);
1523 void DeleteExtTextInput( SwExtTextInput
* pDel
);
1524 SwExtTextInput
* GetExtTextInput( const SwNode
& rNd
,
1525 sal_Int32 nContentPos
= -1) const;
1526 SwExtTextInput
* GetExtTextInput() const;
1528 // Interface for access to AutoComplete-List.
1529 static SwAutoCompleteWord
& GetAutoCompleteWords() { return *s_pAutoCompleteWords
; }
1531 bool ContainsMSVBasic() const { return mbContains_MSVBasic
; }
1532 void SetContainsMSVBasic( bool bFlag
) { mbContains_MSVBasic
= bFlag
; }
1534 // Interface for the list of Ruby - texts/attributes
1535 static sal_uInt16
FillRubyList( const SwPaM
& rPam
, SwRubyList
& rList
);
1536 void SetRubyList( const SwPaM
& rPam
, const SwRubyList
& rList
);
1538 void ReadLayoutCache( SvStream
& rStream
);
1539 void WriteLayoutCache( SvStream
& rStream
);
1540 SwLayoutCache
* GetLayoutCache() const { return mpLayoutCache
.get(); }
1542 /** Checks if any of the text node contains hidden characters.
1543 Used for optimization. Changing the view option 'view hidden text'
1544 has to trigger a reformatting only if some of the text is hidden.
1546 bool ContainsHiddenChars() const;
1548 IGrammarContact
* getGrammarContact() const { return mpGrammarContact
.get(); }
1550 /** Marks/Unmarks a list level of a certain list
1552 levels of a certain lists are marked now
1554 @param sListId list Id of the list whose level has to be marked/unmarked
1555 @param nListLevel level to mark
1556 @param bValue - true mark the level
1557 - false unmark the level
1559 void MarkListLevel( const OUString
& sListId
,
1560 const int nListLevel
,
1561 const bool bValue
);
1563 // Change a format undoable.
1564 void ChgFormat(SwFormat
& rFormat
, const SfxItemSet
& rSet
);
1566 void RenameFormat(SwFormat
& rFormat
, const OUString
& sNewName
,
1567 bool bBroadcast
= false);
1569 // Change a TOX undoable.
1570 void ChangeTOX(SwTOXBase
& rTOX
, const SwTOXBase
& rNew
);
1573 Returns a textual description of a PaM.
1575 @param rPaM the PaM to describe
1577 If rPaM only spans one paragraph the result is:
1581 <text in the PaM> is shortened to nUndoStringLength characters.
1583 If rPaM spans more than one paragraph the result is:
1585 paragraphs (STR_PARAGRAPHS)
1587 @return the textual description of rPaM
1589 static OUString
GetPaMDescr(const SwPaM
& rPaM
);
1591 static bool IsFirstOfNumRuleAtPos(const SwPosition
& rPos
, SwRootFrame
const& rLayout
);
1593 // access methods for XForms model(s)
1595 // access container for XForms model; will be NULL if !isXForms()
1596 const css::uno::Reference
<css::container::XNameContainer
>&
1597 getXForms() const { return mxXForms
;}
1599 css::uno::Reference
< css::linguistic2::XProofreadingIterator
> const & GetGCIterator() const;
1601 // #i31958# is this an XForms document?
1602 bool isXForms() const;
1604 // #i31958# initialize XForms models; turn this into an XForms document
1605 void initXForms( bool bCreateDefaultModel
);
1607 // #i113606# for disposing XForms
1608 void disposeXForms( );
1610 //Update all the page masters
1611 void SetDefaultPageMode(bool bSquaredPageMode
);
1612 bool IsSquaredPageMode() const;
1614 css::uno::Reference
< css::script::vba::XVBAEventProcessor
> const & GetVbaEventProcessor();
1615 void SetVBATemplateToProjectCache( css::uno::Reference
< css::container::XNameContainer
> const & xCache
) { m_xTemplateToProjectCache
= xCache
; };
1616 const css::uno::Reference
< css::container::XNameContainer
>& GetVBATemplateToProjectCache() const { return m_xTemplateToProjectCache
; };
1617 ::sfx2::IXmlIdRegistry
& GetXmlIdRegistry();
1618 ::sw::MetaFieldManager
& GetMetaFieldManager();
1619 ::sw::UndoManager
& GetUndoManager();
1620 ::sw::UndoManager
const& GetUndoManager() const;
1622 SfxObjectShell
* CreateCopy(bool bCallInitNew
, bool bEmpty
) const;
1623 SwNodeIndex
AppendDoc(const SwDoc
& rSource
, sal_uInt16 nStartPageNumber
,
1624 bool bDeletePrevious
, int physicalPageOffset
,
1625 const sal_uLong nDocNo
);
1628 * Dumps the entire nodes structure to the given destination (file nodes.xml in the current directory by default)
1630 void dumpAsXml(xmlTextWriterPtr
= nullptr) const;
1632 std::set
<Color
> GetDocColors();
1633 std::vector
< std::weak_ptr
<SwUnoCursor
> > mvUnoCursorTable
;
1635 // Remove expired UnoCursor weak pointers the document keeps to notify about document death.
1636 void cleanupUnoCursorTable() const
1638 auto & rTable
= const_cast<SwDoc
*>(this)->mvUnoCursorTable
;
1639 // In most cases we'll remove most of the elements.
1640 rTable
.erase( std::remove_if(rTable
.begin(),
1642 [] (std::weak_ptr
<SwUnoCursor
> const & x
) { return x
.expired(); }),
1647 * @param bSkipStart don't actually start the jobs, just check
1648 * @returns true if new background checking jobs were started
1650 bool StartGrammarChecking( bool bSkipStart
= false );
1652 /// Use to notify if the dictionary can be found for a single content portion (has to be called for all portions)
1653 void SetMissingDictionaries( bool bIsMissing
);
1654 /// Returns true if no dictionary can be found for any content
1655 bool IsDictionaryMissing() const { return meDictionaryMissing
== MissingDictionary::True
; }
1657 void SetLanguage(const LanguageType eLang
, const sal_uInt16 nId
);
1660 // Copies master header to left / first one, if necessary - used by ChgPageDesc().
1661 void CopyMasterHeader(const SwPageDesc
&rChged
, const SwFormatHeader
&rHead
, SwPageDesc
&pDesc
, bool bLeft
, bool bFirst
);
1662 // Copies master footer to left / first one, if necessary - used by ChgPageDesc().
1663 void CopyMasterFooter(const SwPageDesc
&rChged
, const SwFormatFooter
&rFoot
, SwPageDesc
&pDesc
, bool bLeft
, bool bFirst
);
1667 // This method is called in Dtor of SwDoc and deletes cache of ContourObjects.
1668 void ClrContourCache();
1670 inline const SwTableNode
* SwDoc::IsIdxInTable( const SwNodeIndex
& rIdx
) const
1672 return const_cast<SwDoc
*>(this)->IsIdxInTable( rIdx
);
1675 inline void SwDoc::SetOLEPrtNotifyPending( bool bSet
)
1677 mbOLEPrtNotifyPending
= bSet
;
1679 mbAllOLENotify
= false;
1682 bool sw_GetPostIts( IDocumentFieldsAccess
const * pIDFA
, SetGetExpFields
* pSrtLst
);
1686 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */