Branch libreoffice-5-0-4
[LibreOffice.git] / sw / inc / doc.hxx
blob77a045880e3b04126af0169b879972fe6b8478bc
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
19 #ifndef INCLUDED_SW_INC_DOC_HXX
20 #define INCLUDED_SW_INC_DOC_HXX
22 // SwDoc interfaces
23 #include <IInterface.hxx>
24 #include <IDocumentMarkAccess.hxx>
25 #include <com/sun/star/embed/XEmbeddedObject.hpp>
26 #include <com/sun/star/embed/XStorage.hpp>
27 #include <vcl/timer.hxx>
28 #include <vcl/idle.hxx>
29 #include <sal/macros.h>
30 #include "swdllapi.h"
31 #include <swtypes.hxx>
32 #include <swatrset.hxx>
33 #include <toxe.hxx>
34 #include <flyenum.hxx>
35 #include <flypos.hxx>
36 #include <itabenum.hxx>
37 #include <swdbdata.hxx>
38 #include <chcmprse.hxx>
39 #include <com/sun/star/linguistic2/XSpellChecker1.hpp>
40 #include <com/sun/star/linguistic2/XHyphenatedWord.hpp>
41 #include <sfx2/objsh.hxx>
42 #include <svl/style.hxx>
43 #include <editeng/numitem.hxx>
44 #include <com/sun/star/linguistic2/XProofreadingIterator.hpp>
45 #include <com/sun/star/script/vba/XVBAEventProcessor.hpp>
46 #include <tox.hxx>
47 #include <frmfmt.hxx>
48 #include <charfmt.hxx>
49 #include <docary.hxx>
51 #include <svtools/embedhlp.hxx>
53 #include <memory>
54 #include <set>
55 #include <unordered_map>
56 #include <vector>
58 #include <boost/scoped_ptr.hpp>
59 #include <boost/ptr_container/ptr_vector.hpp>
61 namespace editeng { class SvxBorderLine; }
63 class SvxForbiddenCharactersTable;
64 class SwExtTextInput;
65 class DateTime;
66 class EditFieldInfo;
67 class JobSetup;
68 class Color;
69 class Outliner;
70 class OutputDevice;
71 class Point;
72 class SbxArray;
73 class SwDrawModel;
74 class SdrObject;
75 class SdrUndoAction;
76 class VirtualDevice;
77 class SfxPrinter;
78 class SvNumberFormatter;
79 class SvxMacro;
80 class SvxMacroTableDtor;
81 class SwAutoCompleteWord;
82 class SwAutoCorrExceptWord;
83 class SwCalc;
84 class SwCellFrm;
85 class SwCharFormat;
86 class SwCharFormats;
87 class SwConditionTextFormatColl;
88 class SwCrsrShell;
89 class SwCursor;
90 class SwDBNameInfField;
91 class SwDocShell;
92 class SwDocUpdateField;
93 class SwDrawFrameFormat;
94 class SwDrawView;
95 class SwEditShell;
96 class SwFieldType;
97 class SwField;
98 class SwTextField;
99 class SwFieldTypes;
100 class SwFlyFrameFormat;
101 class SwFormatsBase;
102 class SwFormat;
103 class SwFormatINetFormat;
104 class SwFormatRefMark;
105 class SwFrameFormat;
106 class SwFrameFormats;
107 class SwFootnoteIdxs;
108 class SwFootnoteInfo;
109 class SwEndNoteInfo;
110 class GraphicObject;
111 class SwGrfFormatColl;
112 class SwGrfFormatColls;
113 class SwLineNumberInfo;
114 class SwDBManager;
115 class SwNoTextNode;
116 class SwNodeIndex;
117 class SwNodeRange;
118 class SwNodes;
119 class SwNumRule;
120 class SwNumRuleTable;
121 class SwPageDesc;
122 class SwPagePreviewPrtData;
123 class SwRangeRedline;
124 class SwRedlineTable;
125 class SwExtraRedlineTable;
126 class SwRootFrm;
127 class SwRubyList;
128 class SwRubyListEntry;
129 class SwSectionFormat;
130 class SwSectionFormats;
131 class SwSectionData;
132 class SwSelBoxes;
133 class SwTOXBaseSection;
134 class SwTOXTypes;
135 class SwTabCols;
136 class SwTable;
137 class SwTableAutoFormat;
138 class SwTableBox;
139 class SwTableBoxFormat;
140 class SwTableFormat;
141 class SwTableLineFormat;
142 class SwTableNode;
143 class SwTextBlocks;
144 class SwTextFormatColl;
145 class SwTextFormatColls;
146 class SwURLStateChanged;
147 class SwUnoCrsr;
148 class SwUnoCrsrTable;
149 class SwViewShell;
150 class _SetGetExpField;
151 class SwDrawContact;
152 class SwLayouter;
153 class SdrView;
154 class SdrMarkList;
155 class SwAuthEntry;
156 class SwLayoutCache;
157 class IStyleAccess;
158 struct SwCallMouseEvent;
159 struct SwDocStat;
160 struct SwHash;
161 struct SwSortOptions;
162 struct SwDefTOXBase_Impl;
163 class SwPrintData;
164 class SwPrintUIOptions;
165 class SdrPageView;
166 struct SwConversionArgs;
167 class SwRewriter;
168 class SwMsgPoolItem;
169 class SwChartDataProvider;
170 class SwChartLockController_Helper;
171 class IGrammarContact;
172 class SwPrintData;
173 class SwRenderData;
174 class SwPageFrm;
175 class SwViewOption;
176 class SwList;
177 class IDocumentUndoRedo;
178 class IDocumentSettingAccess;
179 class IDocumentDeviceAccess;
180 class IDocumentDrawModelAccess;
181 class IDocumentChartDataProviderAccess;
182 class IDocumentTimerAccess;
183 class IDocumentLinksAdministration;
184 class IDocumentListItems;
185 class IDocumentListsAccess;
186 class IDocumentOutlineNodes;
187 class IDocumentContentOperations;
188 class IDocumentRedlineAccess;
189 class IDocumentStatistics;
190 class IDocumentState;
191 class IDocumentLayoutAccess;
192 class IDocumentStylePoolAccess;
193 class IDocumentExternalData;
194 class _SetGetExpFields;
196 namespace sw { namespace mark {
197 class MarkManager;
199 namespace sw {
200 class MetaFieldManager;
201 class UndoManager;
202 class IShellCursorSupplier;
203 class DocumentSettingManager;
204 class DocumentDeviceManager;
205 class DocumentDrawModelManager;
206 class DocumentChartDataProviderManager;
207 class DocumentTimerManager;
208 class DocumentLinksAdministrationManager;
209 class DocumentListItemsManager;
210 class DocumentListsManager;
211 class DocumentOutlineNodesManager;
212 class DocumentContentOperationsManager;
213 class DocumentRedlineManager;
214 class DocumentFieldsManager;
215 class DocumentStatisticsManager;
216 class DocumentStateManager;
217 class DocumentLayoutManager;
218 class DocumentStylePoolManager;
219 class DocumentExternalDataManager;
222 namespace com { namespace sun { namespace star {
223 namespace i18n {
224 struct ForbiddenCharacters; //< comes from the I18N UNO interface
226 namespace uno {
227 template < class > class Sequence;
229 namespace container {
230 class XNameContainer; //< for getXForms()/isXForms()/initXForms() methods
234 namespace sfx2 {
235 class SvLinkSource;
236 class IXmlIdRegistry;
237 class LinkManager;
240 typedef boost::ptr_vector<SwPageDesc> SwPageDescs;
242 void SetAllScriptItem( SfxItemSet& rSet, const SfxPoolItem& rItem );
244 // global function to start grammar checking in the document
245 void StartGrammarChecking( SwDoc &rDoc );
247 // Represents the model of a Writer document.
248 class SW_DLLPUBLIC SwDoc :
249 public IInterface
251 friend class ::sw::DocumentContentOperationsManager;
253 friend void _InitCore();
254 friend void _FinitCore();
256 // private Member
257 ::boost::scoped_ptr<SwNodes> m_pNodes; //< document content (Nodes Array)
258 SwAttrPool* mpAttrPool; //< the attribute pool
259 SwPageDescs maPageDescs; //< PageDescriptors
260 Link<> maOle2Link; //< OLE 2.0-notification
261 /* @@@MAINTAINABILITY-HORROR@@@
262 Timer should not be members of the model
264 Idle maOLEModifiedIdle; //< Timer for update modified OLE-Objecs
265 SwDBData maDBData; //< database descriptor
266 OUString msTOIAutoMarkURL; //< URL of table of index AutoMark file
267 boost::ptr_vector< boost::nullable<OUString> > maPatternNms; // Array for names of document-templates
268 com::sun::star::uno::Reference<com::sun::star::container::XNameContainer>
269 mxXForms; //< container with XForms models
270 mutable com::sun::star::uno::Reference< com::sun::star::linguistic2::XProofreadingIterator > m_xGCIterator;
272 const ::boost::scoped_ptr< ::sw::mark::MarkManager> mpMarkManager;
273 const ::boost::scoped_ptr< ::sw::MetaFieldManager > m_pMetaFieldManager;
274 const ::boost::scoped_ptr< ::sw::DocumentDrawModelManager > m_pDocumentDrawModelManager;
275 const ::boost::scoped_ptr< ::sw::DocumentRedlineManager > m_pDocumentRedlineManager;
276 const ::boost::scoped_ptr< ::sw::DocumentStateManager > m_pDocumentStateManager;
277 const ::boost::scoped_ptr< ::sw::UndoManager > m_pUndoManager;
278 const ::boost::scoped_ptr< ::sw::DocumentSettingManager > m_pDocumentSettingManager;
279 const ::boost::scoped_ptr< ::sw::DocumentChartDataProviderManager > m_pDocumentChartDataProviderManager;
280 ::boost::scoped_ptr< ::sw::DocumentDeviceManager > m_pDeviceAccess;
281 const ::boost::scoped_ptr< ::sw::DocumentTimerManager > m_pDocumentTimerManager;
282 const ::boost::scoped_ptr< ::sw::DocumentLinksAdministrationManager > m_pDocumentLinksAdministrationManager;
283 const ::boost::scoped_ptr< ::sw::DocumentListItemsManager > m_pDocumentListItemsManager;
284 const ::boost::scoped_ptr< ::sw::DocumentListsManager > m_pDocumentListsManager;
285 const ::boost::scoped_ptr< ::sw::DocumentOutlineNodesManager > m_pDocumentOutlineNodesManager;
286 const ::boost::scoped_ptr< ::sw::DocumentContentOperationsManager > m_pDocumentContentOperationsManager;
287 const ::boost::scoped_ptr< ::sw::DocumentFieldsManager > m_pDocumentFieldsManager;
288 const ::boost::scoped_ptr< ::sw::DocumentStatisticsManager > m_pDocumentStatisticsManager;
289 const ::boost::scoped_ptr< ::sw::DocumentLayoutManager > m_pDocumentLayoutManager;
290 const ::boost::scoped_ptr< ::sw::DocumentStylePoolManager > m_pDocumentStylePoolManager;
291 const ::boost::scoped_ptr< ::sw::DocumentExternalDataManager > m_pDocumentExternalDataManager;
293 // Pointer
294 SwFrameFormat *mpDfltFrameFormat; //< Default formats.
295 SwFrameFormat *mpEmptyPageFormat; //< Format for the default empty page
296 SwFrameFormat *mpColumnContFormat; //< Format for column container
297 SwCharFormat *mpDfltCharFormat;
298 SwTextFormatColl *mpDfltTextFormatColl; //< Defaultformatcollections
299 SwGrfFormatColl *mpDfltGrfFormatColl;
301 SwFrameFormats *mpFrameFormatTable; //< Format table
302 SwCharFormats *mpCharFormatTable;
303 SwFrameFormats *mpSpzFrameFormatTable;
304 SwSectionFormats *mpSectionFormatTable;
305 SwFrameFormats *mpTableFrameFormatTable; //< For tables
306 SwTextFormatColls *mpTextFormatCollTable; //< FormatCollections
307 SwGrfFormatColls *mpGrfFormatCollTable;
309 SwTOXTypes *mpTOXTypes; //< Tables/indices
310 SwDefTOXBase_Impl * mpDefTOXBases; //< defaults of SwTOXBase's
312 SwDBManager *mpDBManager; /**< Pointer to the DBManager for
313 evaluation of DB-fields. */
315 SwDoc *mpGlossaryDoc; //< Pointer to glossary-document.
317 SwNumRule *mpOutlineRule;
318 SwFootnoteInfo *mpFootnoteInfo;
319 SwEndNoteInfo *mpEndNoteInfo;
320 SwLineNumberInfo*mpLineNumberInfo;
321 SwFootnoteIdxs *mpFootnoteIdxs;
323 SwDocShell *mpDocShell; //< Ptr to SfxDocShell of Doc.
324 SfxObjectShellLock mxTmpDocShell; //< A temporary shell that is used to copy OLE-Nodes
326 SwAutoCorrExceptWord *mpACEWord; /**< For the automated takeover of
327 auto-corrected words that are "re-corrected". */
328 SwURLStateChanged *mpURLStateChgd; //< SfxClient for changes in INetHistory
329 SvNumberFormatter *mpNumberFormatter;//< NumFormatter for tables / fields
331 mutable SwNumRuleTable *mpNumRuleTable; //< List of all named NumRules.
333 // Hash map to find numrules by name
334 mutable std::unordered_map<OUString, SwNumRule *, OUStringHash> maNumRuleMap;
336 SwUnoCrsrTable *mpUnoCrsrTable;
338 SwPagePreviewPrtData *mpPgPViewPrtData; //< Indenting / spacing for printing of page view.
339 SwPaM *mpExtInputRing;
341 IStyleAccess *mpStyleAccess; //< handling of automatic styles
342 SwLayoutCache *mpLayoutCache; /**< Layout cache to read and save with the
343 document for a faster formatting */
345 IGrammarContact *mpGrammarContact; //< for grammar checking in paragraphs during editing
347 // table of forbidden characters of this document
348 rtl::Reference<SvxForbiddenCharactersTable> mxForbiddenCharsTable;
349 com::sun::star::uno::Reference< com::sun::star::script::vba::XVBAEventProcessor > mxVbaEvents;
350 com::sun::star::uno::Reference<com::sun::star::container::XNameContainer> m_xTemplateToProjectCache;
352 private:
353 ::std::unique_ptr< ::sfx2::IXmlIdRegistry > m_pXmlIdRegistry;
355 // other
357 sal_uInt16 mnUndoCnt; //< Count of Undo Actions.
358 sal_uInt16 mnUndoSttEnd; //< != 0 -> within parentheses.
360 sal_uInt32 mnRsid; //< current session ID of the document
361 sal_uInt32 mnRsidRoot; //< session ID when the document was created
363 sal_Int32 mReferenceCount;
365 bool mbGlossDoc : 1; //< TRUE: glossary document.
366 bool mbDtor : 1; /**< TRUE: is in SwDoc DTOR.
367 and unfortunately temorarily also in
368 SwSwgReader::InLayout() when flawed
369 frames need deletion. */
370 bool mbCopyIsMove : 1; //< TRUE: Copy is a hidden Move.
371 bool mbInReading : 1; //< TRUE: Document is in the process of being read.
372 bool mbInMailMerge : 1; //< TRUE: Document is in the process of being written by mail merge.
373 bool mbInXMLImport : 1; //< TRUE: During xml import, attribute portion building is not necessary.
374 bool mbUpdateTOX : 1; //< TRUE: After loading document, update TOX.
375 bool mbInLoadAsynchron : 1; //< TRUE: Document is in the process of being loaded asynchronously.
376 bool mbIsAutoFormatRedline : 1; //< TRUE: Redlines are recorded by Autoformat.
377 bool mbOLEPrtNotifyPending : 1; /**< TRUE: Printer has changed. At creation of
378 View
379 notification of OLE-Objects PrtOLENotify() is required. */
380 bool mbAllOLENotify : 1; //< True: Notification of all objects is required.
381 bool mbIsRedlineMove : 1; //< True: Redlines are moved into to / out of the section.
382 bool mbInsOnlyTextGlssry : 1; //< True: insert 'only text' glossary into doc
383 bool mbContains_MSVBasic : 1; //< True: MS-VBasic exist is in our storage
384 bool mbClipBoard : 1; //< TRUE: this document represents the clipboard
385 bool mbColumnSelection : 1; /**< TRUE: this content has bee created by a column selection
386 (clipboard docs only) */
387 bool mbIsPrepareSelAll : 1;
389 #ifdef DBG_UTIL
390 bool mbXMLExport : 1; //< true: during XML export
391 #endif
393 // true: Document contains at least one anchored object, which is anchored AT_PAGE with a content position.
394 // Thus, certain adjustment needed during formatting for these kind of anchored objects.
395 bool mbContainsAtPageObjWithContentAnchor : 1;
397 static SwAutoCompleteWord *mpACmpltWords; //< List of all words for AutoComplete
399 // private methods
400 SwFlyFrameFormat* _MakeFlySection( const SwPosition& rAnchPos,
401 const SwContentNode& rNode, RndStdIds eRequestId,
402 const SfxItemSet* pFlyAttrSet,
403 SwFrameFormat* = 0 );
404 sal_Int8 SetFlyFrmAnchor( SwFrameFormat& rFlyFormat, SfxItemSet& rSet, bool bNewFrms );
406 typedef SwFormat* (SwDoc:: *FNCopyFormat)( const OUString&, SwFormat*, bool, bool );
407 SwFormat* CopyFormat( const SwFormat& rFormat, const SwFormatsBase& rFormatArr,
408 FNCopyFormat fnCopyFormat, const SwFormat& rDfltFormat );
409 void CopyFormatArr( const SwFormatsBase& rSourceArr, SwFormatsBase& rDestArr,
410 FNCopyFormat fnCopyFormat, SwFormat& rDfltFormat );
411 void CopyPageDescHeaderFooterImpl( bool bCpyHeader,
412 const SwFrameFormat& rSrcFormat, SwFrameFormat& rDestFormat );
413 static SwFormat* FindFormatByName( const SwFormatsBase& rFormatArr, const OUString& rName );
415 SwDoc( const SwDoc &) SAL_DELETED_FUNCTION;
417 // Database fields:
418 void AddUsedDBToList( std::vector<OUString>& rDBNameList,
419 const std::vector<OUString>& rUsedDBNames );
420 void AddUsedDBToList( std::vector<OUString>& rDBNameList, const OUString& rDBName );
421 static bool IsNameInArray( const std::vector<OUString>& rOldNames, const OUString& rName );
422 void GetAllDBNames( std::vector<OUString>& rAllDBNames );
423 static OUString ReplaceUsedDBs( const std::vector<OUString>& rUsedDBNames,
424 const OUString& rNewName, const OUString& rFormula );
425 static std::vector<OUString>& FindUsedDBs( const std::vector<OUString>& rAllDBNames,
426 const OUString& rFormula,
427 std::vector<OUString>& rUsedDBNames );
429 void _CreateNumberFormatter();
431 bool _UnProtectTableCells( SwTable& rTable );
433 /** Create sub-documents according to the given collection.
434 If no collection is given, take chapter style of the 1st level. */
435 bool SplitDoc( sal_uInt16 eDocType, const OUString& rPath, bool bOutline,
436 const SwTextFormatColl* pSplitColl, int nOutlineLevel = 0 );
438 // Update charts of given table.
439 void _UpdateCharts( const SwTable& rTable, SwViewShell const & rVSh ) const;
441 static bool _SelectNextRubyChars( SwPaM& rPam, SwRubyListEntry& rRubyEntry,
442 sal_uInt16 nMode );
444 // CharTimer calls this method.
445 void DoUpdateAllCharts();
446 DECL_LINK_TYPED( DoUpdateModifiedOLE, Idle *, void );
448 public:
449 SwFormat *_MakeCharFormat(const OUString &, SwFormat *, bool, bool );
450 SwFormat *_MakeFrameFormat(const OUString &, SwFormat *, bool, bool );
452 private:
453 SwFormat *_MakeTextFormatColl(const OUString &, SwFormat *, bool, bool );
455 private:
456 bool mbReadOnly;
457 OUString msDocAccTitle;
459 void InitTOXTypes();
461 public:
462 enum DocumentType {
463 DOCTYPE_NATIVE,
464 DOCTYPE_MSWORD //This doc medul is come from Ms Word
466 DocumentType meDocType;
467 DocumentType GetDocumentType(){ return meDocType; }
468 void SetDocumentType( DocumentType eDocType ) { meDocType = eDocType; }
470 // Life cycle
471 SwDoc();
472 virtual ~SwDoc();
474 bool IsInDtor() const { return mbDtor; }
476 /* @@@MAINTAINABILITY-HORROR@@@
477 Implementation details made public.
479 SwNodes & GetNodes() { return *m_pNodes; }
480 SwNodes const& GetNodes() const { return *m_pNodes; }
482 // IInterface
483 virtual sal_Int32 acquire() SAL_OVERRIDE;
484 virtual sal_Int32 release() SAL_OVERRIDE;
485 virtual sal_Int32 getReferenceCount() const SAL_OVERRIDE;
487 // IDocumentSettingAccess
488 IDocumentSettingAccess const & getIDocumentSettingAccess() const; //The IDocumentSettingAccess interface
489 IDocumentSettingAccess & getIDocumentSettingAccess();
490 ::sw::DocumentSettingManager & GetDocumentSettingManager(); //The implementation of the interface with some additional methods
491 ::sw::DocumentSettingManager const& GetDocumentSettingManager() const;
492 sal_uInt32 getRsid() const;
493 void setRsid( sal_uInt32 nVal );
494 sal_uInt32 getRsidRoot() const;
495 void setRsidRoot( sal_uInt32 nVal );
497 // IDocumentDeviceAccess
498 IDocumentDeviceAccess const & getIDocumentDeviceAccess() const;
499 IDocumentDeviceAccess & getIDocumentDeviceAccess();
501 // IDocumentMarkAccess
502 IDocumentMarkAccess* getIDocumentMarkAccess();
503 const IDocumentMarkAccess* getIDocumentMarkAccess() const;
505 // IDocumentRedlineAccess
506 IDocumentRedlineAccess const& getIDocumentRedlineAccess() const;
507 IDocumentRedlineAccess& getIDocumentRedlineAccess();
509 ::sw::DocumentRedlineManager const& GetDocumentRedlineManager() const;
510 ::sw::DocumentRedlineManager& GetDocumentRedlineManager();
512 // IDocumentUndoRedo
513 IDocumentUndoRedo & GetIDocumentUndoRedo();
514 IDocumentUndoRedo const& GetIDocumentUndoRedo() const;
516 // IDocumentLinksAdministration
517 IDocumentLinksAdministration const & getIDocumentLinksAdministration() const;
518 IDocumentLinksAdministration & getIDocumentLinksAdministration();
520 ::sw::DocumentLinksAdministrationManager const & GetDocumentLinksAdministrationManager() const;
521 ::sw::DocumentLinksAdministrationManager & GetDocumentLinksAdministrationManager();
523 // IDocumentFieldsAccess
524 IDocumentFieldsAccess const & getIDocumentFieldsAccess() const;
525 IDocumentFieldsAccess & getIDocumentFieldsAccess();
527 ::sw::DocumentFieldsManager & GetDocumentFieldsManager();
529 // IDocumentContentOperations
530 IDocumentContentOperations const & getIDocumentContentOperations() const;
531 IDocumentContentOperations & getIDocumentContentOperations();
532 ::sw::DocumentContentOperationsManager const & GetDocumentContentOperationsManager() const;
533 ::sw::DocumentContentOperationsManager & GetDocumentContentOperationsManager();
535 bool UpdateParRsid( SwTextNode *pTextNode, sal_uInt32 nVal = 0 );
536 bool UpdateRsid( const SwPaM &rRg, sal_Int32 nLen );
538 // IDocumentStylePoolAccess
539 IDocumentStylePoolAccess const & getIDocumentStylePoolAccess() const;
540 IDocumentStylePoolAccess & getIDocumentStylePoolAccess();
542 // SwLineNumberInfo
543 const SwLineNumberInfo& GetLineNumberInfo() const;
544 void SetLineNumberInfo(const SwLineNumberInfo& rInfo);
546 // IDocumentStatistics
547 IDocumentStatistics const & getIDocumentStatistics() const;
548 IDocumentStatistics & getIDocumentStatistics();
550 ::sw::DocumentStatisticsManager const & GetDocumentStatisticsManager() const;
551 ::sw::DocumentStatisticsManager & GetDocumentStatisticsManager();
553 // IDocumentState
554 IDocumentState const & getIDocumentState() const;
555 IDocumentState & getIDocumentState();
557 // IDocumentDrawModelAccess
558 DECL_LINK( AddDrawUndo, SdrUndoAction * );
559 IDocumentDrawModelAccess const & getIDocumentDrawModelAccess() const;
560 IDocumentDrawModelAccess & getIDocumentDrawModelAccess();
562 ::sw::DocumentDrawModelManager const & GetDocumentDrawModelManager() const;
563 ::sw::DocumentDrawModelManager & GetDocumentDrawModelManager();
565 // IDocumentLayoutAccess
566 IDocumentLayoutAccess const & getIDocumentLayoutAccess() const;
567 IDocumentLayoutAccess & getIDocumentLayoutAccess();
569 ::sw::DocumentLayoutManager const & GetDocumentLayoutManager() const;
570 ::sw::DocumentLayoutManager & GetDocumentLayoutManager();
572 // IDocumentTimerAccess
573 // Our own 'IdleTimer' calls the following method
574 IDocumentTimerAccess const & getIDocumentTimerAccess() const;
575 IDocumentTimerAccess & getIDocumentTimerAccess();
577 // IDocumentChartDataProviderAccess
578 IDocumentChartDataProviderAccess const & getIDocumentChartDataProviderAccess() const;
579 IDocumentChartDataProviderAccess & getIDocumentChartDataProviderAccess();
581 // IDocumentListItems
582 IDocumentListItems const & getIDocumentListItems() const;
583 IDocumentListItems & getIDocumentListItems();
585 // IDocumentOutlineNodes
586 IDocumentOutlineNodes const & getIDocumentOutlineNodes() const;
587 IDocumentOutlineNodes & getIDocumentOutlineNodes();
589 // IDocumentListsAccess
590 IDocumentListsAccess const & getIDocumentListsAccess() const;
591 IDocumentListsAccess & getIDocumentListsAccess();
593 //IDocumentExternalData
594 IDocumentExternalData const & getIDocumentExternalData() const;
595 IDocumentExternalData & getIDocumentExternalData();
597 //End of Interfaces
599 void setDocReadOnly( bool b) { mbReadOnly = b; }
600 bool getDocReadOnly() const { return mbReadOnly; }
601 void setDocAccTitle( const OUString& rTitle ) { msDocAccTitle = rTitle; }
602 const OUString getDocAccTitle() const { return msDocAccTitle; }
604 // INextInterface here
605 DECL_LINK(BackgroundDone, SvxBrushItem *);
606 DECL_LINK(CalcFieldValueHdl, EditFieldInfo*);
608 // OLE ???
609 bool IsOLEPrtNotifyPending() const { return mbOLEPrtNotifyPending; }
610 inline void SetOLEPrtNotifyPending( bool bSet = true );
611 void PrtOLENotify( bool bAll ); //All or only marked
613 #ifdef DBG_UTIL
614 bool InXMLExport() const { return mbXMLExport; }
615 void SetXMLExport( bool bFlag ) { mbXMLExport = bFlag; }
616 #endif
617 void SetSelAll( bool bSel )
619 mbIsPrepareSelAll = bSel;
621 bool IsPrepareSelAll() const { return mbIsPrepareSelAll; }
622 void SetPrepareSelAll() { mbIsPrepareSelAll = true; }
624 void SetContainsAtPageObjWithContentAnchor( const bool bFlag )
626 mbContainsAtPageObjWithContentAnchor = bFlag;
628 bool DoesContainAtPageObjWithContentAnchor()
630 return mbContainsAtPageObjWithContentAnchor;
633 /** Returns positions of all FlyFrames in the document.
634 If a Pam-Pointer is passed the FlyFrames attached to paragraphes
635 have to be surrounded completely by ::com::sun::star::awt::Selection.
636 ( Start < Pos < End ) !!!
637 (Required for Writers.) */
638 SwPosFlyFrms GetAllFlyFormats( const SwPaM* = 0,
639 bool bDrawAlso = false,
640 bool bAsCharAlso = false ) const;
642 // Because swrtf.cxx and define private public here now.
643 SwFlyFrameFormat *MakeFlyFrameFormat (const OUString &rFormatName, SwFrameFormat *pDerivedFrom);
644 SwDrawFrameFormat *MakeDrawFrameFormat(const OUString &rFormatName, SwFrameFormat *pDerivedFrom);
646 // From now on this interface has to be used for Flys.
647 // pAnchorPos must be set, if they are not attached to pages AND
648 // Anchor is not already set at valid ContentPos
649 // in FlySet/FrameFormat.
650 /* new parameter bCalledFromShell
652 true: An existing adjust item at pAnchorPos is propagated to
653 the content node of the new fly section. That propagation only
654 takes place if there is no adjust item in the paragraph style
655 for the new fly section.
657 false: no propagation
659 SwFlyFrameFormat* MakeFlySection( RndStdIds eAnchorType,
660 const SwPosition* pAnchorPos,
661 const SfxItemSet* pSet = 0,
662 SwFrameFormat *pParent = 0,
663 bool bCalledFromShell = false );
664 SwFlyFrameFormat* MakeFlyAndMove( const SwPaM& rPam, const SfxItemSet& rSet,
665 const SwSelBoxes* pSelBoxes = 0,
666 SwFrameFormat *pParent = 0 );
668 //UUUU Helper that checks for unique items for DrawingLayer items of type NameOrIndex
669 // and evtl. corrects that items to ensure unique names for that type. This call may
670 // modify/correct entries inside of the given SfxItemSet, and it will apply a name to
671 // the items in question (what is essential to make the named slots associated with
672 // these items work for the UNO API and thus e.g. for ODF im/export)
673 void CheckForUniqueItemForLineFillNameOrIndex(SfxItemSet& rSet);
675 bool SetFlyFrmAttr( SwFrameFormat& rFlyFormat, SfxItemSet& rSet );
677 bool SetFrameFormatToFly( SwFrameFormat& rFlyFormat, SwFrameFormat& rNewFormat,
678 SfxItemSet* pSet = 0, bool bKeepOrient = false );
679 void SetFlyFrmTitle( SwFlyFrameFormat& rFlyFrameFormat,
680 const OUString& sNewTitle );
681 void SetFlyFrmDescription( SwFlyFrameFormat& rFlyFrameFormat,
682 const OUString& sNewDescription );
684 // Footnotes
685 // Footnote information
686 const SwFootnoteInfo& GetFootnoteInfo() const { return *mpFootnoteInfo; }
687 void SetFootnoteInfo(const SwFootnoteInfo& rInfo);
688 const SwEndNoteInfo& GetEndNoteInfo() const { return *mpEndNoteInfo; }
689 void SetEndNoteInfo(const SwEndNoteInfo& rInfo);
690 SwFootnoteIdxs& GetFootnoteIdxs() { return *mpFootnoteIdxs; }
691 const SwFootnoteIdxs& GetFootnoteIdxs() const { return *mpFootnoteIdxs; }
692 // change footnotes in area
693 bool SetCurFootnote( const SwPaM& rPam, const OUString& rNumStr,
694 sal_uInt16 nNumber, bool bIsEndNote );
696 /** Operations on the content of the document e.g.
697 spell-checking/hyphenating/word-counting
699 ::com::sun::star::uno::Any
700 Spell( SwPaM&, ::com::sun::star::uno::Reference<
701 ::com::sun::star::linguistic2::XSpellChecker1 > &,
702 sal_uInt16* pPageCnt, sal_uInt16* pPageSt, bool bGrammarCheck,
703 SwConversionArgs *pConvArgs = 0 ) const;
705 ::com::sun::star::uno::Reference<
706 ::com::sun::star::linguistic2::XHyphenatedWord >
707 Hyphenate( SwPaM *pPam, const Point &rCrsrPos,
708 sal_uInt16* pPageCnt, sal_uInt16* pPageSt );
710 // count words in pam
711 static void CountWords( const SwPaM& rPaM, SwDocStat& rStat );
713 // Glossary Document
714 void SetGlossDoc( bool bGlssDc = true ) { mbGlossDoc = bGlssDc; }
715 bool IsInsOnlyTextGlossary() const { return mbInsOnlyTextGlssry; }
717 void Summary( SwDoc* pExtDoc, sal_uInt8 nLevel, sal_uInt8 nPara, bool bImpress );
719 void ChangeAuthorityData(const SwAuthEntry* pNewData);
721 bool IsInHeaderFooter( const SwNodeIndex& rIdx ) const;
722 short GetTextDirection( const SwPosition& rPos,
723 const Point* pPt = 0 ) const;
724 bool IsInVerticalText( const SwPosition& rPos,
725 const Point* pPt = 0 ) const;
727 // Database and DB-Manager
728 void SetDBManager( SwDBManager* pNewMgr ) { mpDBManager = pNewMgr; }
729 SwDBManager* GetDBManager() const { return mpDBManager; }
730 void ChangeDBFields( const std::vector<OUString>& rOldNames,
731 const OUString& rNewName );
732 void SetInitDBFields(bool b);
734 // Find out which databases are used by fields.
735 void GetAllUsedDB( std::vector<OUString>& rDBNameList,
736 const std::vector<OUString>* pAllDBNames = 0 );
738 void ChgDBData( const SwDBData& rNewData );
739 SwDBData GetDBData();
740 const SwDBData& GetDBDesc();
741 const SwDBData& _GetDBDesc() const { return maDBData; }
743 // Some helper functions
744 OUString GetUniqueGrfName() const;
745 OUString GetUniqueOLEName() const;
746 OUString GetUniqueFrameName() const;
748 std::set<SwRootFrm*> GetAllLayouts();
750 void SetFlyName( SwFlyFrameFormat& rFormat, const OUString& rName );
751 const SwFlyFrameFormat* FindFlyByName( const OUString& rName, sal_Int8 nNdTyp = 0 ) const;
753 static void GetGrfNms( const SwFlyFrameFormat& rFormat, OUString* pGrfName, OUString* pFltName );
755 // Set a valid name for all Flys that have none (Called by Readers after reading).
756 void SetAllUniqueFlyNames();
758 /** Reset attributes. All TextHints and (if completely selected) all hard-
759 formatted stuff (auto-formats) are removed.
760 Introduce new optional parameter <bSendDataChangedEvents> in order to
761 control, if the side effect "send data changed events" is triggered or not. */
762 void ResetAttrs( const SwPaM &rRg,
763 bool bTextAttr = true,
764 const std::set<sal_uInt16> &rAttrs = std::set<sal_uInt16>(),
765 const bool bSendDataChangedEvents = true );
766 void RstTextAttrs(const SwPaM &rRg, bool bInclRefToxMark = false, bool bExactRange = false );
768 /** Set attribute in given format.1y
769 * If Undo is enabled, the old values is added to the Undo history. */
770 void SetAttr( const SfxPoolItem&, SwFormat& );
771 /** Set attribute in given format.1y
772 * If Undo is enabled, the old values is added to the Undo history. */
773 void SetAttr( const SfxItemSet&, SwFormat& );
775 // method to reset a certain attribute at the given format
776 void ResetAttrAtFormat( const sal_uInt16 nWhichId,
777 SwFormat& rChangedFormat );
779 /** Set attribute as new default attribute in current document.
780 If Undo is activated, the old one is listed in Undo-History. */
781 void SetDefault( const SfxPoolItem& );
782 void SetDefault( const SfxItemSet& );
784 // Query default attribute in this document.
785 const SfxPoolItem& GetDefault( sal_uInt16 nFormatHint ) const;
787 // Do not expand text attributes.
788 bool DontExpandFormat( const SwPosition& rPos, bool bFlag = true );
790 // Formats
791 const SwFrameFormats* GetFrameFormats() const { return mpFrameFormatTable; }
792 SwFrameFormats* GetFrameFormats() { return mpFrameFormatTable; }
793 const SwCharFormats* GetCharFormats() const { return mpCharFormatTable;}
794 SwCharFormats* GetCharFormats() { return mpCharFormatTable;}
796 // LayoutFormats (frames, DrawObjects), sometimes const sometimes not
797 const SwFrameFormats* GetSpzFrameFormats() const { return mpSpzFrameFormatTable; }
798 SwFrameFormats* GetSpzFrameFormats() { return mpSpzFrameFormatTable; }
800 const SwFrameFormat *GetDfltFrameFormat() const { return mpDfltFrameFormat; }
801 SwFrameFormat *GetDfltFrameFormat() { return mpDfltFrameFormat; }
802 const SwFrameFormat *GetEmptyPageFormat() const { return mpEmptyPageFormat; }
803 SwFrameFormat *GetEmptyPageFormat() { return mpEmptyPageFormat; }
804 const SwFrameFormat *GetColumnContFormat() const{ return mpColumnContFormat; }
805 SwFrameFormat *GetColumnContFormat() { return mpColumnContFormat; }
806 const SwCharFormat *GetDfltCharFormat() const { return mpDfltCharFormat;}
807 SwCharFormat *GetDfltCharFormat() { return mpDfltCharFormat;}
809 // @return the interface of the management of (auto)styles
810 IStyleAccess& GetIStyleAccess() { return *mpStyleAccess; }
812 // Remove all language dependencies from all existing formats
813 void RemoveAllFormatLanguageDependencies();
815 SwFrameFormat *MakeFrameFormat(const OUString &rFormatName, SwFrameFormat *pDerivedFrom,
816 bool bBroadcast = false, bool bAuto = true);
817 void DelFrameFormat( SwFrameFormat *pFormat, bool bBroadcast = false );
818 SwFrameFormat* FindFrameFormatByName( const OUString& rName ) const
819 { return static_cast<SwFrameFormat*>(FindFormatByName( static_cast<SwFormatsBase&>(*mpFrameFormatTable), rName )); }
821 SwCharFormat *MakeCharFormat(const OUString &rFormatName, SwCharFormat *pDerivedFrom,
822 bool bBroadcast = false,
823 bool bAuto = true );
824 void DelCharFormat(size_t nFormat, bool bBroadcast = false);
825 void DelCharFormat(SwCharFormat* pFormat, bool bBroadcast = false);
826 SwCharFormat* FindCharFormatByName( const OUString& rName ) const
827 { return static_cast<SwCharFormat*>(FindFormatByName( (SwFormatsBase&)*mpCharFormatTable, rName )); }
829 // Formatcollections (styles)
830 // TXT
831 const SwTextFormatColl* GetDfltTextFormatColl() const { return mpDfltTextFormatColl; }
832 SwTextFormatColl* GetDfltTextFormatColl() { return mpDfltTextFormatColl; }
833 const SwTextFormatColls *GetTextFormatColls() const { return mpTextFormatCollTable; }
834 SwTextFormatColls *GetTextFormatColls() { return mpTextFormatCollTable; }
835 SwTextFormatColl *MakeTextFormatColl( const OUString &rFormatName,
836 SwTextFormatColl *pDerivedFrom,
837 bool bBroadcast = false,
838 bool bAuto = true );
839 SwConditionTextFormatColl* MakeCondTextFormatColl( const OUString &rFormatName,
840 SwTextFormatColl *pDerivedFrom,
841 bool bBroadcast = false);
842 void DelTextFormatColl(size_t nFormat, bool bBroadcast = false);
843 void DelTextFormatColl( SwTextFormatColl* pColl, bool bBroadcast = false );
844 /** Add 4th optional parameter <bResetListAttrs>.
845 'side effect' of <SetTextFormatColl> with <bReset = true> is that the hard
846 attributes of the affected text nodes are cleared, except the break
847 attribute, the page description attribute and the list style attribute.
848 The new parameter <bResetListAttrs> indicates, if the list attributes
849 (list style, restart at and restart with) are cleared as well in case
850 that <bReset = true> and the paragraph style has a list style attribute set. */
851 bool SetTextFormatColl(const SwPaM &rRg, SwTextFormatColl *pFormat,
852 const bool bReset = true,
853 const bool bResetListAttrs = false);
854 SwTextFormatColl* FindTextFormatCollByName( const OUString& rName ) const
855 { return static_cast<SwTextFormatColl*>(FindFormatByName( (SwFormatsBase&)*mpTextFormatCollTable, rName )); }
857 void ChkCondColls();
859 const SwGrfFormatColl* GetDfltGrfFormatColl() const { return mpDfltGrfFormatColl; }
860 SwGrfFormatColl* GetDfltGrfFormatColl() { return mpDfltGrfFormatColl; }
861 const SwGrfFormatColls *GetGrfFormatColls() const { return mpGrfFormatCollTable; }
862 SwGrfFormatColl *MakeGrfFormatColl(const OUString &rFormatName,
863 SwGrfFormatColl *pDerivedFrom);
864 SwGrfFormatColl* FindGrfFormatCollByName( const OUString& rName ) const
865 { return static_cast<SwGrfFormatColl*>(FindFormatByName( (SwFormatsBase&)*mpGrfFormatCollTable, rName )); }
867 // Table formatting
868 const SwFrameFormats* GetTableFrameFormats() const { return mpTableFrameFormatTable; }
869 SwFrameFormats* GetTableFrameFormats() { return mpTableFrameFormatTable; }
870 size_t GetTableFrameFormatCount( bool bUsed ) const;
871 SwFrameFormat& GetTableFrameFormat(size_t nFormat, bool bUsed ) const;
872 SwTableFormat* MakeTableFrameFormat(const OUString &rFormatName, SwFrameFormat *pDerivedFrom);
873 void DelTableFrameFormat( SwTableFormat* pFormat );
874 SwTableFormat* FindTableFormatByName( const OUString& rName, bool bAll = false ) const;
876 /** Access to frames.
877 Iterate over Flys - forr Basic-Collections. */
878 size_t GetFlyCount( FlyCntType eType = FLYCNTTYPE_ALL, bool bIgnoreTextBoxes = false ) const;
879 SwFrameFormat* GetFlyNum(size_t nIdx, FlyCntType eType = FLYCNTTYPE_ALL, bool bIgnoreTextBoxes = false );
881 // Copy formats in own arrays and return them.
882 SwFrameFormat *CopyFrameFormat ( const SwFrameFormat& );
883 SwCharFormat *CopyCharFormat( const SwCharFormat& );
884 SwTextFormatColl* CopyTextColl( const SwTextFormatColl& rColl );
885 SwGrfFormatColl* CopyGrfColl( const SwGrfFormatColl& rColl );
887 // Replace all styles with those from rSource.
888 void ReplaceStyles( const SwDoc& rSource, bool bIncludePageStyles = true );
890 // Replace all property defaults with those from rSource.
891 void ReplaceDefaults( const SwDoc& rSource );
893 // Replace all compatibility options with those from rSource.
894 void ReplaceCompatibilityOptions( const SwDoc& rSource );
896 /** Replace all user defined document properties with xSourceDocProps.
898 Convenince function used by ReplaceDocumentProperties to skip some UNO calls.
900 void ReplaceUserDefinedDocumentProperties( const ::com::sun::star::uno::Reference< ::com::sun::star::document::XDocumentProperties > xSourceDocProps );
902 /** Replace document properties with those from rSource.
904 This includes the user defined document properties!
906 void ReplaceDocumentProperties(const SwDoc& rSource, bool mailMerge = false);
908 // Query if style (paragraph- / character- / frame- / page-) is used.
909 bool IsUsed( const SwModify& ) const;
910 static bool IsUsed( const SwNumRule& );
912 // Set name of newly loaded document template.
913 sal_uInt16 SetDocPattern( const OUString& rPatternName );
915 // @return name of document template. Can be 0!
916 const OUString* GetDocPattern( sal_uInt16 nPos ) const
918 if(nPos >= maPatternNms.size())
919 return NULL;
920 if(boost::is_null(maPatternNms.begin() + nPos))
921 return NULL;
922 return &(maPatternNms[nPos]);
925 // Query / connect current document with glossary document.
926 void SetGlossaryDoc( SwDoc* pDoc ) { mpGlossaryDoc = pDoc; }
928 // travel over PaM Ring
929 bool InsertGlossary( SwTextBlocks& rBlock, const OUString& rEntry,
930 SwPaM& rPaM, SwCrsrShell* pShell = 0);
932 /** get the set of printable pages for the XRenderable API by
933 evaluating the respective settings (see implementation) */
934 static void CalculatePagesForPrinting( const SwRootFrm& rLayout, SwRenderData &rData, const SwPrintUIOptions &rOptions, bool bIsPDFExport,
935 sal_Int32 nDocPageCount );
936 static void UpdatePagesForPrintingWithPostItData( SwRenderData &rData, const SwPrintUIOptions &rOptions, bool bIsPDFExport,
937 sal_Int32 nDocPageCount );
938 static void CalculatePagePairsForProspectPrinting( const SwRootFrm& rLayout, SwRenderData &rData, const SwPrintUIOptions &rOptions,
939 sal_Int32 nDocPageCount );
941 // PageDescriptor interface.
942 size_t GetPageDescCnt() const { return maPageDescs.size(); }
943 const SwPageDesc& GetPageDesc( const size_t i ) const { return maPageDescs[i]; }
944 SwPageDesc& GetPageDesc( size_t i ) { return maPageDescs[i]; }
945 SwPageDesc* FindPageDesc(const OUString& rName, size_t* pPos = NULL);
946 SwPageDesc* FindPageDesc(const OUString& rName, size_t* pPos = NULL) const;
947 // Just searches the pointer in the maPageDescs vector!
948 bool ContainsPageDesc(const SwPageDesc *pDesc, size_t* pPos = NULL);
950 /** Copy the complete PageDesc - beyond document and "deep"!
951 Optionally copying of PoolFormatId, -HlpId can be prevented. */
952 void CopyPageDesc( const SwPageDesc& rSrcDesc, SwPageDesc& rDstDesc,
953 bool bCopyPoolIds = true );
955 /** Copy header (with contents) from SrcFormat to DestFormat
956 (can also be copied into other document). */
957 void CopyHeader( const SwFrameFormat& rSrcFormat, SwFrameFormat& rDestFormat )
958 { CopyPageDescHeaderFooterImpl( true, rSrcFormat, rDestFormat ); }
960 /** Copy footer (with contents) from SrcFormat to DestFormat.
961 (can also be copied into other document). */
962 void CopyFooter( const SwFrameFormat& rSrcFormat, SwFrameFormat& rDestFormat )
963 { CopyPageDescHeaderFooterImpl( false, rSrcFormat, rDestFormat ); }
965 // For Reader
966 void ChgPageDesc( const OUString & rName, const SwPageDesc& );
967 void ChgPageDesc( size_t i, const SwPageDesc& );
968 void DelPageDesc( const OUString & rName, bool bBroadcast = false);
969 void DelPageDesc( size_t i, bool bBroadcast = false );
970 void PreDelPageDesc(SwPageDesc * pDel);
971 SwPageDesc* MakePageDesc(const OUString &rName, const SwPageDesc* pCpy = 0,
972 bool bRegardLanguage = true,
973 bool bBroadcast = false);
974 void BroadcastStyleOperation(const OUString& rName, SfxStyleFamily eFamily,
975 sal_uInt16 nOp);
977 /** The html import sometimes overwrites the
978 page sizes set in the page descriptions. This function is used to
979 correct this. */
980 void CheckDefaultPageFormat();
982 // Methods for tables/indices
983 static sal_uInt16 GetCurTOXMark( const SwPosition& rPos, SwTOXMarks& );
984 void DeleteTOXMark( const SwTOXMark* pTOXMark );
985 const SwTOXMark& GotoTOXMark( const SwTOXMark& rCurTOXMark,
986 SwTOXSearch eDir, bool bInReadOnly );
988 // Insert/Renew table/indes
989 SwTOXBaseSection* InsertTableOf( const SwPosition& rPos,
990 const SwTOXBase& rTOX,
991 const SfxItemSet* pSet = 0,
992 bool bExpand = false );
993 const SwTOXBaseSection* InsertTableOf( sal_uLong nSttNd, sal_uLong nEndNd,
994 const SwTOXBase& rTOX,
995 const SfxItemSet* pSet = 0 );
996 static SwTOXBase* GetCurTOX( const SwPosition& rPos );
997 static const SwAttrSet& GetTOXBaseAttrSet(const SwTOXBase& rTOX);
999 bool DeleteTOX( const SwTOXBase& rTOXBase, bool bDelNodes = false );
1000 OUString GetUniqueTOXBaseName( const SwTOXType& rType,
1001 const OUString& sChkStr ) const;
1003 bool SetTOXBaseName(const SwTOXBase& rTOXBase, const OUString& rName);
1004 void SetTOXBaseProtection(const SwTOXBase& rTOXBase, bool bProtect);
1006 // After reading file update all tables/indices
1007 void SetUpdateTOX( bool bFlag = true ) { mbUpdateTOX = bFlag; }
1008 bool IsUpdateTOX() const { return mbUpdateTOX; }
1010 OUString GetTOIAutoMarkURL() const {return msTOIAutoMarkURL;}
1011 void SetTOIAutoMarkURL(const OUString& rSet) {msTOIAutoMarkURL = rSet;}
1012 void ApplyAutoMark();
1014 bool IsInReading() const { return mbInReading; }
1015 void SetInReading( bool bNew ) { mbInReading = bNew; }
1017 bool IsInMailMerge() const { return mbInMailMerge; }
1018 void SetInMailMerge( bool bNew ) { mbInMailMerge = bNew; }
1020 bool IsClipBoard() const { return mbClipBoard; }
1021 // N.B.: must be called right after constructor! (@see GetXmlIdRegistry)
1022 void SetClipBoard( bool bNew ) { mbClipBoard = bNew; }
1024 bool IsColumnSelection() const { return mbColumnSelection; }
1025 void SetColumnSelection( bool bNew ) { mbColumnSelection = bNew; }
1027 bool IsInXMLImport() const { return mbInXMLImport; }
1028 void SetInXMLImport( bool bNew ) { mbInXMLImport = bNew; }
1030 // Manage types of tables/indices
1031 sal_uInt16 GetTOXTypeCount( TOXTypes eTyp ) const;
1032 const SwTOXType* GetTOXType( TOXTypes eTyp, sal_uInt16 nId ) const;
1033 bool DeleteTOXType( TOXTypes eTyp, sal_uInt16 nId );
1034 const SwTOXType* InsertTOXType( const SwTOXType& rTyp );
1035 const SwTOXTypes& GetTOXTypes() const { return *mpTOXTypes; }
1037 const SwTOXBase* GetDefaultTOXBase( TOXTypes eTyp, bool bCreate = false );
1038 void SetDefaultTOXBase(const SwTOXBase& rBase);
1040 // Key for management of index.
1041 sal_uInt16 GetTOIKeys( SwTOIKeyType eTyp, std::vector<OUString>& rArr ) const;
1043 // Sort table text.
1044 bool SortTable(const SwSelBoxes& rBoxes, const SwSortOptions&);
1045 bool SortText(const SwPaM&, const SwSortOptions&);
1047 // Correct the SwPosition-Objects that are registered with the document
1048 // e. g. Bookmarks or tables/indices.
1049 // If bMoveCrsr is set move Crsr too.
1051 // Set everything in rOldNode on rNewPos + Offset.
1052 void CorrAbs(
1053 const SwNodeIndex& rOldNode,
1054 const SwPosition& rNewPos,
1055 const sal_Int32 nOffset = 0,
1056 bool bMoveCrsr = false );
1058 // Set everything in the range of [rStartNode, rEndNode] to rNewPos.
1059 static void CorrAbs(
1060 const SwNodeIndex& rStartNode,
1061 const SwNodeIndex& rEndNode,
1062 const SwPosition& rNewPos,
1063 bool bMoveCrsr = false );
1065 // Set everything in this range from rRange to rNewPos.
1066 static void CorrAbs(
1067 const SwPaM& rRange,
1068 const SwPosition& rNewPos,
1069 bool bMoveCrsr = false );
1071 // Set everything in rOldNode to relative Pos.
1072 void CorrRel(
1073 const SwNodeIndex& rOldNode,
1074 const SwPosition& rNewPos,
1075 const sal_Int32 nOffset = 0,
1076 bool bMoveCrsr = false );
1078 // Query / set rules for Outline.
1079 inline SwNumRule* GetOutlineNumRule() const
1081 return mpOutlineRule;
1083 void SetOutlineNumRule( const SwNumRule& rRule );
1084 void PropagateOutlineRule();
1086 // Outline - promote / demote.
1087 bool OutlineUpDown( const SwPaM& rPam, short nOffset = 1 );
1089 // Ountline - move up / move down.
1090 bool MoveOutlinePara( const SwPaM& rPam, short nOffset = 1);
1092 bool GotoOutline( SwPosition& rPos, const OUString& rName ) const;
1094 /** Accept changes of outline styles for OUtlineRule.
1095 re-use unused 3rd parameter
1096 Optional parameter <bResetIndentAttrs> - default value false:
1097 If <bResetIndentAttrs> equals true, the indent attributes "before text"
1098 and "first line indent" are additionally reset at the provided PaM, if
1099 the list style makes use of the new list level attributes.
1100 Parameters <bCreateNewList> and <sContinuedListId>:
1101 <bCreateNewList> indicates, if a new list is created by applying the given list style.
1102 If <bCreateNewList> equals false, <sContinuedListId> may contain the
1103 list Id of a list, which has to be continued by applying the given list style
1105 Returns the set ListId if bSetItem is true */
1106 OUString SetNumRule( const SwPaM&,
1107 const SwNumRule&,
1108 bool bCreateNewList,
1109 const OUString& sContinuedListId = OUString(),
1110 bool bSetItem = true,
1111 const bool bResetIndentAttrs = false );
1112 void SetCounted( const SwPaM&, bool bCounted);
1114 void MakeUniqueNumRules(const SwPaM & rPaM);
1116 void SetNumRuleStart( const SwPosition& rPos, bool bFlag = true );
1117 void SetNodeNumStart( const SwPosition& rPos, sal_uInt16 nStt );
1119 static SwNumRule* GetNumRuleAtPos( const SwPosition& rPos );
1121 const SwNumRuleTable& GetNumRuleTable() const { return *mpNumRuleTable; }
1124 Add numbering rule to document.
1126 @param pRule rule to add
1128 void AddNumRule(SwNumRule * pRule);
1130 // add optional parameter <eDefaultNumberFormatPositionAndSpaceMode>
1131 sal_uInt16 MakeNumRule( const OUString &rName,
1132 const SwNumRule* pCpy = 0,
1133 bool bBroadcast = false,
1134 const SvxNumberFormat::SvxNumPositionAndSpaceMode eDefaultNumberFormatPositionAndSpaceMode =
1135 SvxNumberFormat::LABEL_WIDTH_AND_POSITION );
1136 sal_uInt16 FindNumRule( const OUString& rName ) const;
1137 SwNumRule* FindNumRulePtr( const OUString& rName ) const;
1139 // Deletion only possible if Rule is not used!
1140 bool RenameNumRule(const OUString & aOldName, const OUString & aNewName,
1141 bool bBroadcast = false);
1142 bool DelNumRule( const OUString& rName, bool bBroadCast = false );
1143 OUString GetUniqueNumRuleName( const OUString* pChkStr = 0, bool bAutoNum = true ) const;
1145 void UpdateNumRule(); // Update all invalids.
1146 void ChgNumRuleFormats( const SwNumRule& rRule );
1147 bool ReplaceNumRule( const SwPosition& rPos, const OUString& rOldRule,
1148 const OUString& rNewRule );
1150 // Goto next/previous on same level.
1151 static bool GotoNextNum( SwPosition&, bool bOverUpper = true,
1152 sal_uInt8* pUpper = 0, sal_uInt8* pLower = 0 );
1153 static bool GotoPrevNum( SwPosition&, bool bOverUpper = true,
1154 sal_uInt8* pUpper = 0, sal_uInt8* pLower = 0 );
1156 /** Searches for a text node with a numbering rule.
1158 add optional parameter <bInvestigateStartNode>
1159 add output parameter <sListId>
1161 \param rPos position to start search
1162 \param bForward - true: search forward
1163 - false: search backward
1164 \param bNum - true: search for enumeration
1165 - false: search for itemize
1166 \param bOutline - true: search for outline numbering rule
1167 - false: search for non-outline numbering rule
1168 \param nNonEmptyAllowed number of non-empty paragraphs allowed between
1169 rPos and found paragraph
1171 @param sListId
1172 output parameter - in case a list style is found, <sListId> holds the
1173 list id, to which the text node belongs, which applies the found list style.
1175 @param bInvestigateStartNode
1176 input parameter - boolean, indicating, if start node, determined by given
1177 start position has to be investigated or not.
1179 const SwNumRule * SearchNumRule(const SwPosition & rPos,
1180 const bool bForward,
1181 const bool bNum,
1182 const bool bOutline,
1183 int nNonEmptyAllowed,
1184 OUString& sListId,
1185 const bool bInvestigateStartNode = false );
1187 // Paragraphs without numbering but with indents.
1188 bool NoNum( const SwPaM& );
1190 // Delete, splitting of numbering list.
1191 void DelNumRules( const SwPaM& );
1193 // Invalidates all numrules
1194 void InvalidateNumRules();
1196 bool NumUpDown( const SwPaM&, bool bDown = true );
1198 /** Move selected paragraphes (not only numberings)
1199 according to offsets. (if negative: go to doc start). */
1200 bool MoveParagraph( const SwPaM&, long nOffset = 1, bool bIsOutlMv = false );
1202 bool NumOrNoNum( const SwNodeIndex& rIdx, bool bDel = false);
1204 void StopNumRuleAnimations( OutputDevice* );
1206 /** Insert new table at position @param rPos (will be inserted before Node!).
1207 For AutoFormat at input: columns have to be set at predefined width.
1208 The array holds the positions of the columns (not their widths).
1209 new @param bCalledFromShell:
1210 true: called from shell -> propagate existing adjust item at
1211 rPos to every new cell. A existing adjust item in the table
1212 heading or table contents paragraph style prevent that
1213 propagation.
1214 false: do not propagate
1216 const SwTable* InsertTable( const SwInsertTableOptions& rInsTableOpts, // HEADLINE_NO_BORDER
1217 const SwPosition& rPos, sal_uInt16 nRows,
1218 sal_uInt16 nCols, short eAdjust,
1219 const SwTableAutoFormat* pTAFormat = 0,
1220 const std::vector<sal_uInt16> *pColArr = 0,
1221 bool bCalledFromShell = false,
1222 bool bNewModel = true );
1224 // If index is in a table, return TableNode, else 0.
1225 SwTableNode* IsIdxInTable( const SwNodeIndex& rIdx );
1226 inline const SwTableNode* IsIdxInTable( const SwNodeIndex& rIdx ) const;
1228 // Create a balanced table out of the selected range.
1229 const SwTable* TextToTable( const SwInsertTableOptions& rInsTableOpts, // HEADLINE_NO_BORDER,
1230 const SwPaM& rRange, sal_Unicode cCh,
1231 short eAdjust,
1232 const SwTableAutoFormat* = 0 );
1234 // text to table conversion - API support
1235 const SwTable* TextToTable( const std::vector< std::vector<SwNodeRange> >& rTableNodes );
1237 bool TableToText( const SwTableNode* pTableNd, sal_Unicode cCh );
1239 // Create columns / rows in table.
1240 bool InsertCol( const SwCursor& rCursor,
1241 sal_uInt16 nCnt = 1, bool bBehind = true );
1242 bool InsertCol( const SwSelBoxes& rBoxes,
1243 sal_uInt16 nCnt = 1, bool bBehind = true );
1244 bool InsertRow( const SwCursor& rCursor,
1245 sal_uInt16 nCnt = 1, bool bBehind = true );
1246 bool InsertRow( const SwSelBoxes& rBoxes,
1247 sal_uInt16 nCnt = 1, bool bBehind = true );
1249 // Delete Columns/Rows in table.
1250 bool DeleteRowCol( const SwSelBoxes& rBoxes, bool bColumn = false );
1251 bool DeleteRow( const SwCursor& rCursor );
1252 bool DeleteCol( const SwCursor& rCursor );
1254 // Split / concatenate boxes in table.
1255 bool SplitTable( const SwSelBoxes& rBoxes, bool bVert = true,
1256 sal_uInt16 nCnt = 1, bool bSameHeight = false );
1258 // @return enum TableMergeErr.
1259 sal_uInt16 MergeTable( SwPaM& rPam );
1260 OUString GetUniqueTableName() const;
1261 bool IsInsTableFormatNum() const;
1262 bool IsInsTableChangeNumFormat() const;
1263 bool IsInsTableAlignNum() const;
1265 // From FEShell (for Undo and BModified).
1266 static void GetTabCols( SwTabCols &rFill, const SwCursor* pCrsr,
1267 const SwCellFrm* pBoxFrm = 0 );
1268 void SetTabCols( const SwTabCols &rNew, bool bCurRowOnly,
1269 const SwCursor* pCrsr, const SwCellFrm* pBoxFrm = 0 );
1270 static void GetTabRows( SwTabCols &rFill, const SwCursor* pCrsr,
1271 const SwCellFrm* pBoxFrm = 0 );
1272 void SetTabRows( const SwTabCols &rNew, bool bCurColOnly, const SwCursor* pCrsr,
1273 const SwCellFrm* pBoxFrm = 0 );
1275 // Direct access for UNO.
1276 void SetTabCols(SwTable& rTab, const SwTabCols &rNew, const SwTabCols &rOld,
1277 const SwTableBox *pStart, bool bCurRowOnly);
1279 void SetRowsToRepeat( SwTable &rTable, sal_uInt16 nSet );
1281 // AutoFormat for table/table selection.
1282 bool SetTableAutoFormat( const SwSelBoxes& rBoxes, const SwTableAutoFormat& rNew );
1284 // Query attributes.
1285 bool GetTableAutoFormat( const SwSelBoxes& rBoxes, SwTableAutoFormat& rGet );
1287 void AppendUndoForInsertFromDB( const SwPaM& rPam, bool bIsTable );
1289 bool SetColRowWidthHeight( SwTableBox& rAktBox, sal_uInt16 eType,
1290 SwTwips nAbsDiff, SwTwips nRelDiff );
1291 SwTableBoxFormat* MakeTableBoxFormat();
1292 SwTableLineFormat* MakeTableLineFormat();
1294 // Check if box has numerical valule. Change format of box if required.
1295 void ChkBoxNumFormat( SwTableBox& rAktBox, bool bCallUpdate );
1296 void SetTableBoxFormulaAttrs( SwTableBox& rBox, const SfxItemSet& rSet );
1297 void ClearBoxNumAttrs( const SwNodeIndex& rNode );
1298 void ClearLineNumAttrs( SwPosition & rPos );
1300 bool InsCopyOfTable( SwPosition& rInsPos, const SwSelBoxes& rBoxes,
1301 const SwTable* pCpyTable = 0, bool bCpyName = false,
1302 bool bCorrPos = false );
1304 bool UnProtectCells( const OUString& rTableName );
1305 bool UnProtectCells( const SwSelBoxes& rBoxes );
1306 bool UnProtectTables( const SwPaM& rPam );
1307 bool HasTableAnyProtection( const SwPosition* pPos,
1308 const OUString* pTableName = 0,
1309 bool* pFullTableProtection = 0 );
1311 // Split table at baseline position, i.e. create a new table.
1312 bool SplitTable( const SwPosition& rPos, sal_uInt16 eMode = 0,
1313 bool bCalcNewSize = false );
1315 /** And vice versa: rPos must be in the table that remains. The flag indicates
1316 whether the current table is merged with the one before or behind it. */
1317 bool MergeTable( const SwPosition& rPos, bool bWithPrev = true,
1318 sal_uInt16 nMode = 0 );
1320 // Make charts of given table update.
1321 void UpdateCharts( const OUString &rName ) const;
1323 // Update all charts, for that exists any table.
1324 void UpdateAllCharts() { DoUpdateAllCharts(); }
1326 // Table is renamed and refreshes charts.
1327 void SetTableName( SwFrameFormat& rTableFormat, const OUString &rNewName );
1329 // @return the reference in document that is set for name.
1330 const SwFormatRefMark* GetRefMark( const OUString& rName ) const;
1332 // @return RefMark via index - for UNO.
1333 const SwFormatRefMark* GetRefMark( sal_uInt16 nIndex ) const;
1335 /** @return names of all references that are set in document.
1336 If array pointer is 0 return only whether a RefMark is set in document. */
1337 sal_uInt16 GetRefMarks( std::vector<OUString>* = 0 ) const;
1339 // Insert label. If a FlyFormat is created, return it.
1340 SwFlyFrameFormat* InsertLabel( const SwLabelType eType, const OUString &rText, const OUString& rSeparator,
1341 const OUString& rNumberingSeparator,
1342 const bool bBefore, const sal_uInt16 nId, const sal_uLong nIdx,
1343 const OUString& rCharacterStyle,
1344 const bool bCpyBrd = true );
1345 SwFlyFrameFormat* InsertDrawLabel(
1346 const OUString &rText, const OUString& rSeparator, const OUString& rNumberSeparator,
1347 const sal_uInt16 nId, const OUString& rCharacterStyle, SdrObject& rObj );
1349 // Query attribute pool.
1350 const SwAttrPool& GetAttrPool() const { return *mpAttrPool; }
1351 SwAttrPool& GetAttrPool() { return *mpAttrPool; }
1353 // Search for an EditShell.
1354 SwEditShell const * GetEditShell() const;
1355 SwEditShell* GetEditShell();
1356 ::sw::IShellCursorSupplier * GetIShellCursorSupplier();
1358 // OLE 2.0-notification.
1359 inline void SetOle2Link(const Link<>& rLink) {maOle2Link = rLink;}
1360 inline const Link<>& GetOle2Link() const {return maOle2Link;}
1362 // insert section (the ODF kind of section, not the nodesarray kind)
1363 SwSection * InsertSwSection(SwPaM const& rRange, SwSectionData &,
1364 SwTOXBase const*const pTOXBase = 0,
1365 SfxItemSet const*const pAttr = 0, bool const bUpdate = true);
1366 static sal_uInt16 IsInsRegionAvailable( const SwPaM& rRange,
1367 const SwNode** ppSttNd = 0 );
1368 static SwSection* GetCurrSection( const SwPosition& rPos );
1369 SwSectionFormats& GetSections() { return *mpSectionFormatTable; }
1370 const SwSectionFormats& GetSections() const { return *mpSectionFormatTable; }
1371 SwSectionFormat *MakeSectionFormat( SwSectionFormat *pDerivedFrom );
1372 void DelSectionFormat( SwSectionFormat *pFormat, bool bDelNodes = false );
1373 void UpdateSection(size_t const nSect, SwSectionData &,
1374 SfxItemSet const*const = 0, bool const bPreventLinkUpdate = false);
1375 OUString GetUniqueSectionName( const OUString* pChkStr = 0 ) const;
1377 /* @@@MAINTAINABILITY-HORROR@@@
1378 The model should not have anything to do with a shell.
1379 Unnecessary compile/link time dependency.
1382 // Pointer to SfxDocShell from Doc. Can be 0!!
1383 SwDocShell* GetDocShell() { return mpDocShell; }
1384 const SwDocShell* GetDocShell() const { return mpDocShell; }
1385 void SetDocShell( SwDocShell* pDSh );
1387 /** in case during copying of embedded object a new shell is created,
1388 it should be set here and cleaned later */
1389 void SetTmpDocShell( SfxObjectShellLock rLock ) { mxTmpDocShell = rLock; }
1390 SfxObjectShellLock GetTmpDocShell() { return mxTmpDocShell; }
1392 // For Autotexts? (text modules) They have only one SVPersist at their disposal.
1393 SfxObjectShell* GetPersist() const;
1395 // Pointer to storage of SfxDocShells. Can be 0!!!
1396 ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage > GetDocStorage();
1398 // Query / set flag indicating if document is loaded asynchronously at this moment.
1399 bool IsInLoadAsynchron() const { return mbInLoadAsynchron; }
1400 void SetInLoadAsynchron( bool bFlag ) { mbInLoadAsynchron = bFlag; }
1402 bool SelectServerObj( const OUString& rStr, SwPaM*& rpPam,
1403 SwNodeRange*& rpRange ) const;
1405 // For Drag&Move: (e.g. allow "moving" of RefMarks)
1406 bool IsCopyIsMove() const { return mbCopyIsMove; }
1407 void SetCopyIsMove( bool bFlag ) { mbCopyIsMove = bFlag; }
1409 SwDrawContact* GroupSelection( SdrView& );
1410 void UnGroupSelection( SdrView& );
1411 bool DeleteSelection( SwDrawView& );
1413 // Invalidates OnlineSpell-WrongLists.
1414 void SpellItAgainSam( bool bInvalid, bool bOnlyWrong, bool bSmartTags );
1415 void InvalidateAutoCompleteFlag();
1417 void SetCalcFieldValueHdl(Outliner* pOutliner);
1419 // Query if URL was visited.
1420 // Query via Doc, if only a Bookmark has been given.
1421 // In this case the document name has to be set in front.
1422 bool IsVisitedURL( const OUString& rURL );
1424 // Save current values for automatic registration of exceptions in Autocorrection.
1425 void SetAutoCorrExceptWord( SwAutoCorrExceptWord* pNew );
1426 SwAutoCorrExceptWord* GetAutoCorrExceptWord() { return mpACEWord; }
1427 void DeleteAutoCorrExceptWord();
1429 const SwFormatINetFormat* FindINetAttr( const OUString& rName ) const;
1431 // Call into intransparent Basic; expect possible Return String.
1432 bool ExecMacro( const SvxMacro& rMacro, OUString* pRet = 0, SbxArray* pArgs = 0 );
1434 // Call into intransparent Basic / JavaScript.
1435 sal_uInt16 CallEvent( sal_uInt16 nEvent, const SwCallMouseEvent& rCallEvent,
1436 bool bChkPtr = false, SbxArray* pArgs = 0,
1437 const Link<>* pCallBack = 0 );
1439 /** Adjust left margin via object bar (similar to adjustment of numerations).
1440 One can either change the margin "by" adding or subtracting a given
1441 offset or set it "to" this position (bModulus = true). */
1442 void MoveLeftMargin( const SwPaM& rPam, bool bRight = true,
1443 bool bModulus = true );
1445 // Query NumberFormatter.
1446 inline SvNumberFormatter* GetNumberFormatter( bool bCreate = true );
1447 inline const SvNumberFormatter* GetNumberFormatter( bool bCreate = true ) const;
1449 bool HasInvisibleContent() const;
1450 // delete invisible content, like hidden sections and paragraphs
1451 bool RemoveInvisibleContent();
1452 // restore the invisible content if it's available on the undo stack
1453 bool RestoreInvisibleContent();
1455 bool ConvertFieldsToText();
1457 // Create sub-documents according to given collection.
1458 // If no collection is given, use chapter styles for 1st level.
1459 bool GenerateGlobalDoc( const OUString& rPath,
1460 const SwTextFormatColl* pSplitColl = 0 );
1461 bool GenerateGlobalDoc( const OUString& rPath, int nOutlineLevel = 0 );
1462 bool GenerateHTMLDoc( const OUString& rPath,
1463 const SwTextFormatColl* pSplitColl = 0 );
1464 bool GenerateHTMLDoc( const OUString& rPath, int nOutlineLevel = 0 );
1466 // Compare two documents.
1467 long CompareDoc( const SwDoc& rDoc );
1469 // Merge two documents.
1470 long MergeDoc( const SwDoc& rDoc );
1472 bool IsAutoFormatRedline() const { return mbIsAutoFormatRedline; }
1473 void SetAutoFormatRedline( bool bFlag ) { mbIsAutoFormatRedline = bFlag; }
1475 // For AutoFormat: with Undo/Redlining.
1476 void SetTextFormatCollByAutoFormat( const SwPosition& rPos, sal_uInt16 nPoolId,
1477 const SfxItemSet* pSet = 0 );
1478 void SetFormatItemByAutoFormat( const SwPaM& rPam, const SfxItemSet& );
1480 // Only for SW-textbloxks! Does not pay any attention to layout!
1481 void ClearDoc(); // Deletes all content!
1483 // Query /set data for PagePreview.
1484 const SwPagePreviewPrtData* GetPreviewPrtData() const { return mpPgPViewPrtData; }
1486 // If pointer == 0 destroy pointer in document.
1487 // Else copy object.
1488 // Pointer is not transferred to ownership by document!
1489 void SetPreviewPrtData( const SwPagePreviewPrtData* pData );
1491 /** update all modified OLE-Objects. The modification is called over the
1492 StarOne - Interface */
1493 void SetOLEObjModified();
1495 // Uno - Interfaces
1496 const SwUnoCrsrTable& GetUnoCrsrTable() const { return *mpUnoCrsrTable; }
1497 SwUnoCrsr* CreateUnoCrsr( const SwPosition& rPos, bool bTableCrsr = false );
1499 // FeShell - Interfaces
1500 // !!! These assume always an existing layout !!!
1501 bool ChgAnchor( const SdrMarkList& _rMrkList,
1502 RndStdIds _eAnchorType,
1503 const bool _bSameOnly,
1504 const bool _bPosCorr );
1506 void SetRowHeight( const SwCursor& rCursor, const SwFormatFrmSize &rNew );
1507 static void GetRowHeight( const SwCursor& rCursor, SwFormatFrmSize *& rpSz );
1508 void SetRowSplit( const SwCursor& rCursor, const SwFormatRowSplit &rNew );
1509 static void GetRowSplit( const SwCursor& rCursor, SwFormatRowSplit *& rpSz );
1510 bool BalanceRowHeight( const SwCursor& rCursor, bool bTstOnly = true );
1511 void SetRowBackground( const SwCursor& rCursor, const SvxBrushItem &rNew );
1512 static bool GetRowBackground( const SwCursor& rCursor, SvxBrushItem &rToFill );
1513 void SetTabBorders( const SwCursor& rCursor, const SfxItemSet& rSet );
1514 void SetTabLineStyle( const SwCursor& rCursor,
1515 const Color* pColor, bool bSetLine,
1516 const editeng::SvxBorderLine* pBorderLine );
1517 static void GetTabBorders( const SwCursor& rCursor, SfxItemSet& rSet );
1518 void SetBoxAttr( const SwCursor& rCursor, const SfxPoolItem &rNew );
1520 Retrieves a box attribute from the given cursor.
1522 @return Whether the property is set over the current box selection.
1524 @remarks A property is 'set' if it's set to the same value over all boxes in the current selection.
1525 The property value is retrieved from the first box in the current selection. It is then compared to
1526 the values of the same property over any other boxes in the selection; if any value is different from
1527 that of the first box, the property is unset (and false is returned).
1529 static bool GetBoxAttr( const SwCursor& rCursor, SfxPoolItem &rToFill );
1530 void SetBoxAlign( const SwCursor& rCursor, sal_uInt16 nAlign );
1531 static sal_uInt16 GetBoxAlign( const SwCursor& rCursor );
1532 void AdjustCellWidth( const SwCursor& rCursor, bool bBalance = false );
1534 SwChainRet Chainable( const SwFrameFormat &rSource, const SwFrameFormat &rDest );
1535 SwChainRet Chain( SwFrameFormat &rSource, const SwFrameFormat &rDest );
1536 void Unchain( SwFrameFormat &rFormat );
1538 // For Copy/Move from FrmShell.
1539 SdrObject* CloneSdrObj( const SdrObject&, bool bMoveWithinDoc = false,
1540 bool bInsInPage = true );
1542 // FeShell - Interface end
1544 // Interface for TextInputData - for text input of Chinese and Japanese.
1545 SwExtTextInput* CreateExtTextInput( const SwPaM& rPam );
1546 void DeleteExtTextInput( SwExtTextInput* pDel );
1547 SwExtTextInput* GetExtTextInput( const SwNode& rNd,
1548 sal_Int32 nContentPos = -1) const;
1549 SwExtTextInput* GetExtTextInput() const;
1551 // Interface for access to AutoComplete-List.
1552 static SwAutoCompleteWord& GetAutoCompleteWords() { return *mpACmpltWords; }
1554 bool ContainsMSVBasic() const { return mbContains_MSVBasic; }
1555 void SetContainsMSVBasic( bool bFlag ) { mbContains_MSVBasic = bFlag; }
1557 // Interface for the list of Ruby - texts/attributes
1558 static sal_uInt16 FillRubyList( const SwPaM& rPam, SwRubyList& rList,
1559 sal_uInt16 nMode );
1560 sal_uInt16 SetRubyList( const SwPaM& rPam, const SwRubyList& rList,
1561 sal_uInt16 nMode );
1563 void ReadLayoutCache( SvStream& rStream );
1564 void WriteLayoutCache( SvStream& rStream );
1565 SwLayoutCache* GetLayoutCache() const { return mpLayoutCache; }
1567 /** Checks if any of the text node contains hidden characters.
1568 Used for optimization. Changing the view option 'view hidden text'
1569 has to trigger a reformatting only if some of the text is hidden.
1571 bool ContainsHiddenChars() const;
1573 IGrammarContact* getGrammarContact() const { return mpGrammarContact; }
1575 /** Marks/Unmarks a list level of a certain list
1577 levels of a certain lists are marked now
1579 @param sListId list Id of the list whose level has to be marked/unmarked
1580 @param nListLevel level to mark
1581 @param bValue - true mark the level
1582 - false unmark the level
1584 void MarkListLevel( const OUString& sListId,
1585 const int nListLevel,
1586 const bool bValue );
1588 /** Marks/Unmarks a list level of a certain list
1590 levels of a certain lists are marked now
1592 @param rList list whose level has to be marked/unmarked
1593 @param nListLevel level to mark
1594 @param bValue - true mark the level
1595 - false unmark the level
1597 static void MarkListLevel( SwList& rList,
1598 const int nListLevel,
1599 const bool bValue );
1601 // Change a format undoable.
1602 void ChgFormat(SwFormat & rFormat, const SfxItemSet & rSet);
1604 void RenameFormat(SwFormat & rFormat, const OUString & sNewName,
1605 bool bBroadcast = false);
1607 // Change a TOX undoable.
1608 void ChgTOX(SwTOXBase & rTOX, const SwTOXBase & rNew);
1611 Returns a textual description of a PaM.
1613 @param rPaM the PaM to describe
1615 If rPaM only spans one paragraph the result is:
1617 '<text in the PaM>'
1619 <text in the PaM> is shortened to nUndoStringLength characters.
1621 If rPaM spans more than one paragraph the result is:
1623 paragraphs (STR_PARAGRAPHS)
1625 @return the textual description of rPaM
1627 static OUString GetPaMDescr(const SwPaM & rPaM);
1629 static bool IsFirstOfNumRuleAtPos( const SwPosition & rPos );
1631 // access methods for XForms model(s)
1633 // access container for XForms model; will be NULL if !isXForms()
1634 com::sun::star::uno::Reference<com::sun::star::container::XNameContainer>
1635 getXForms() const { return mxXForms;}
1637 com::sun::star::uno::Reference< com::sun::star::linguistic2::XProofreadingIterator > GetGCIterator() const;
1639 // #i31958# is this an XForms document?
1640 bool isXForms() const;
1642 // #i31958# initialize XForms models; turn this into an XForms document
1643 void initXForms( bool bCreateDefaultModel );
1645 // #i113606# for disposing XForms
1646 void disposeXForms( );
1648 //Update all the page masters
1649 void SetDefaultPageMode(bool bSquaredPageMode);
1650 bool IsSquaredPageMode() const;
1652 com::sun::star::uno::Reference< com::sun::star::script::vba::XVBAEventProcessor > GetVbaEventProcessor();
1653 void SetVBATemplateToProjectCache( com::sun::star::uno::Reference< com::sun::star::container::XNameContainer >& xCache ) { m_xTemplateToProjectCache = xCache; };
1654 com::sun::star::uno::Reference< com::sun::star::container::XNameContainer > GetVBATemplateToProjectCache() { return m_xTemplateToProjectCache; };
1655 ::sfx2::IXmlIdRegistry& GetXmlIdRegistry();
1656 ::sw::MetaFieldManager & GetMetaFieldManager();
1657 ::sw::UndoManager & GetUndoManager();
1658 ::sw::UndoManager const& GetUndoManager() const;
1660 SfxObjectShell* CreateCopy(bool bCallInitNew) const;
1661 SwNodeIndex AppendDoc(const SwDoc& rSource, sal_uInt16 nStartPageNumber,
1662 SwPageDesc* pTargetPageDesc, bool bDeletePrevious = false, int physicalPageOffset = 0 );
1665 * Dumps the entire nodes structure to the given destination (file nodes.xml in the current directory by default)
1666 * @since 3.5
1668 void dumpAsXml(struct _xmlTextWriter* = 0) const;
1670 std::set<Color> GetDocColors();
1672 private:
1673 // Copies master header to left / first one, if necessary - used by ChgPageDesc().
1674 void CopyMasterHeader(const SwPageDesc &rChged, const SwFormatHeader &rHead, SwPageDesc &pDesc, bool bLeft, bool bFirst);
1675 // Copies master footer to left / first one, if necessary - used by ChgPageDesc().
1676 void CopyMasterFooter(const SwPageDesc &rChged, const SwFormatFooter &rFoot, SwPageDesc &pDesc, bool bLeft, bool bFirst);
1680 // This method is called in Dtor of SwDoc and deletes cache of ContourObjects.
1681 void ClrContourCache();
1683 inline const SwTableNode* SwDoc::IsIdxInTable( const SwNodeIndex& rIdx ) const
1685 return const_cast<SwDoc*>(this)->IsIdxInTable( rIdx );
1688 inline SvNumberFormatter* SwDoc::GetNumberFormatter( bool bCreate )
1690 if( bCreate && !mpNumberFormatter )
1691 _CreateNumberFormatter();
1692 return mpNumberFormatter;
1695 inline const SvNumberFormatter* SwDoc::GetNumberFormatter( bool bCreate ) const
1697 return const_cast<SwDoc*>(this)->GetNumberFormatter( bCreate );
1700 inline void SwDoc::SetOLEPrtNotifyPending( bool bSet )
1702 mbOLEPrtNotifyPending = bSet;
1703 if( !bSet )
1704 mbAllOLENotify = false;
1707 bool sw_GetPostIts( IDocumentFieldsAccess* pIDFA, _SetGetExpFields * pSrtLst );
1709 #endif //_DOC_HXX
1711 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */