xref: /trunk/main/sw/inc/doc.hxx (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 #ifndef SW_DOC_HXX
28 #define SW_DOC_HXX
29 
30 /** SwDoc interfaces */
31 
32 #include <IInterface.hxx>
33 #include <IDocumentSettingAccess.hxx>
34 #include <IDocumentDeviceAccess.hxx>
35 #include <IDocumentMarkAccess.hxx>
36 #include <IDocumentRedlineAccess.hxx>
37 #include <IDocumentLinksAdministration.hxx>
38 #include <IDocumentFieldsAccess.hxx>
39 #include <IDocumentContentOperations.hxx>
40 #include <IDocumentStylePoolAccess.hxx>
41 #include <IDocumentLineNumberAccess.hxx>
42 #include <IDocumentStatistics.hxx>
43 #include <IDocumentState.hxx>
44 #include <IDocumentDrawModelAccess.hxx>
45 #include <IDocumentLayoutAccess.hxx>
46 #include <IDocumentTimerAccess.hxx>
47 #include <IDocumentChartDataProviderAccess.hxx>
48 // --> OD 2007-10-26 #i83479#
49 #include <IDocumentOutlineNodes.hxx>
50 #include <IDocumentListItems.hxx>
51 #include <set>
52 // <--
53 // --> OD 2008-03-12 #refactorlists#
54 #include <IDocumentListsAccess.hxx>
55 class SwList;
56 // <--
57 #include <IDocumentExternalData.hxx>
58 #define _SVSTDARR_STRINGSDTOR
59 #include <svl/svstdarr.hxx>
60 #include <com/sun/star/embed/XEmbeddedObject.hpp>
61 #include <com/sun/star/embed/XStorage.hpp>
62 #include <vcl/timer.hxx>
63 #include "swdllapi.h"
64 #include <swtypes.hxx>
65 #include <swatrset.hxx>
66 #include <toxe.hxx>             // enums
67 #include <flyenum.hxx>
68 #include <itabenum.hxx>
69 #include <swdbdata.hxx>
70 #include <chcmprse.hxx>
71 #include <com/sun/star/linguistic2/XSpellChecker1.hpp>
72 #include <com/sun/star/linguistic2/XHyphenatedWord.hpp>
73 #include <vos/ref.hxx>
74 #include <svx/svdtypes.hxx>
75 #include <sfx2/objsh.hxx>
76 #include <svl/style.hxx>
77 #include <editeng/numitem.hxx>
78 #include "comphelper/implementationreference.hxx"
79 #include <com/sun/star/chart2/data/XDataProvider.hpp>
80 #include <com/sun/star/linguistic2/XProofreadingIterator.hpp>
81 #ifdef FUTURE_VBA
82 #include <com/sun/star/script/vba/XVBAEventProcessor.hpp>
83 #endif
84 
85 #include <hash_map>
86 #include <stringhash.hxx>
87 
88 #include <svtools/embedhlp.hxx>
89 #include <vector>
90 #include <set>
91 #include <map>
92 #include <memory>
93 
94 #include <boost/scoped_ptr.hpp>
95 
96 class SvxForbiddenCharactersTable;
97 class SwExtTextInput;
98 class DateTime;
99 class EditFieldInfo;
100 class JobSetup;
101 class Color;
102 class KeyCode;
103 class Outliner;
104 class OutputDevice;
105 class Point;
106 class SbxArray;
107 class SdrModel;
108 class SdrObject;
109 class SdrUndoAction;
110 class VirtualDevice;
111 class SfxPrinter;
112 class SvNumberFormatter;
113 class SvStringsSort;
114 class SvUShorts;
115 class SvUShortsSort;
116 class SvxMacro;
117 class SvxMacroTableDtor;
118 class SvxBorderLine;
119 class SwAutoCompleteWord;
120 class SwAutoCorrExceptWord;
121 class SwCalc;
122 class SwCellFrm;
123 class SwCharFmt;
124 class SwCharFmts;
125 class SwConditionTxtFmtColl;
126 class SwCrsrShell;
127 class SwCursor;
128 class SwDBNameInfField;
129 class SwDocShell;
130 class SwDocUpdtFld;
131 class SwDrawFrmFmt;
132 class SwDrawView;
133 class SwEditShell;
134 class SwFieldType;
135 class SwField;
136 class SwTxtFld;
137 class SwFldTypes;
138 class SwFlyFrmFmt;
139 class SwFmt;
140 class SwFmtINetFmt;
141 class SwFmtRefMark;
142 class SwFrmFmt;
143 class SwFrmFmts;
144 class SwFtnIdxs;
145 class SwFtnInfo;
146 class SwEndNoteInfo;
147 class GraphicObject;
148 class SwGrfFmtColl;
149 class SwGrfFmtColls;
150 class SwLineNumberInfo;
151 class SwNewDBMgr;
152 class SwNoTxtNode;
153 class SwNodeIndex;
154 class SwNodeRange;
155 class SwNodes;
156 class SwNumRule;
157 class SwNumRuleTbl;
158 class SwPageDesc;
159 class SwPosFlyFrms;
160 class SwPagePreViewPrtData;
161 class SwRedline;
162 class SwRedlineTbl;
163 class SwRootFrm;
164 class SwRubyList;
165 class SwRubyListEntry;
166 class SwSectionFmt;
167 class SwSectionFmts;
168 class SwSectionData;
169 class SwSelBoxes;
170 class SwSpzFrmFmts;
171 class SwTOXBase;
172 class SwTOXBaseSection;
173 class SwTOXMark;
174 class SwTOXMarks;
175 class SwTOXType;
176 class SwTOXTypes;
177 class SwTabCols;
178 class SwTable;
179 class SwTableAutoFmt;
180 class SwTableBox;
181 class SwTableBoxFmt;
182 class SwTableFmt;
183 class SwTableLineFmt;
184 class SwTableNode;
185 class SwTextBlocks;
186 class SwTxtFmtColl;
187 class SwTxtFmtColls;
188 class SwURLStateChanged;
189 class SwUnoCrsr;
190 class SwUnoCrsrTbl;
191 class ViewShell;
192 class _SetGetExpFld;
193 class SwDrawContact;
194 class SwLayouter;
195 class SdrView;
196 class SdrMarkList;
197 class SwAuthEntry;
198 class SwLayoutCache;
199 class IStyleAccess;
200 struct SwCallMouseEvent;
201 struct SwDocStat;
202 struct SwHash;
203 struct SwSortOptions;
204 struct SwDefTOXBase_Impl;
205 class SwPrintData;
206 class SwPrintUIOptions;
207 class SdrPageView;
208 struct SwConversionArgs;
209 class SwRewriter;
210 class SwMsgPoolItem;
211 class SwChartDataProvider;
212 class SwChartLockController_Helper;
213 class IGrammarContact;
214 class SwPrintData;
215 class SwRenderData;
216 class SwPageFrm;
217 class SwViewOption;
218 class IDocumentUndoRedo;
219 
220 namespace sw { namespace mark {
221     class MarkManager;
222 }}
223 namespace sw {
224     class MetaFieldManager;
225     class UndoManager;
226     class IShellCursorSupplier;
227 }
228 
229 namespace com { namespace sun { namespace star {
230 namespace i18n {
231     struct ForbiddenCharacters;    // comes from the I18N UNO interface
232 }
233 namespace uno {
234     template < class > class Sequence;
235 }
236 namespace container {
237     class XNameContainer; // for getXForms()/isXForms()/initXForms() methods
238 }
239 }}}
240 
241 namespace sfx2 {
242     class SvLinkSource;
243     class IXmlIdRegistry;
244     class LinkManager;
245 }
246 
247 //PageDescriptor-Schnittstelle, Array hier wegen inlines.
248 typedef SwPageDesc* SwPageDescPtr;
249 SV_DECL_PTRARR_DEL( SwPageDescs, SwPageDescPtr, 4, 4 )
250 
251 // forward declartion
252 void SetAllScriptItem( SfxItemSet& rSet, const SfxPoolItem& rItem );
253 
254 // global function to start grammar checking in the document
255 void StartGrammarChecking( SwDoc &rDoc );
256 
257 class SW_DLLPUBLIC SwDoc :
258     public IInterface,
259     public IDocumentSettingAccess,
260     public IDocumentDeviceAccess,
261     public IDocumentRedlineAccess,
262     public IDocumentLinksAdministration,
263     public IDocumentFieldsAccess,
264     public IDocumentContentOperations,
265     public IDocumentStylePoolAccess,
266     public IDocumentLineNumberAccess,
267     public IDocumentStatistics,
268     public IDocumentState,
269     public IDocumentDrawModelAccess,
270     public IDocumentLayoutAccess,
271     public IDocumentTimerAccess,
272     public IDocumentChartDataProviderAccess,
273     // --> OD 2007-10-26 #i83479#
274     public IDocumentListItems,
275     public IDocumentOutlineNodes,
276     // <--
277     // --> OD 2008-03-12 #refactorlists#
278     public IDocumentListsAccess,
279     // <--
280     public IDocumentExternalData
281 {
282 
283     friend void _InitCore();
284     friend void _FinitCore();
285 
286     //---------------- private Member --------------------------------
287 
288     // -------------------------------------------------------------------
289     ::boost::scoped_ptr<SwNodes> m_pNodes;  /// document content (Nodes Array)
290     SwAttrPool* mpAttrPool;             // der Attribut Pool
291     SwPageDescs aPageDescs;             // PageDescriptoren
292     Link        aOle2Link;              // OLE 2.0-Benachrichtigung
293     /* @@@MAINTAINABILITY-HORROR@@@
294        Timer should not be members of the model
295     */
296     Timer       aIdleTimer;             // der eigene IdleTimer
297     Timer       aOLEModifiedTimer;      // Timer for update modified OLE-Objecs
298     SwDBData    aDBData;                // database descriptor
299     ::com::sun::star::uno::Sequence <sal_Int8 > aRedlinePasswd;
300     String      sTOIAutoMarkURL;        // ::com::sun::star::util::URL of table of index AutoMark file
301     SvStringsDtor aPatternNms;          // Array fuer die Namen der Dokument-Vorlagen
302     com::sun::star::uno::Reference<com::sun::star::container::XNameContainer>
303         xXForms;                        // container with XForms models
304     mutable com::sun::star::uno::Reference< com::sun::star::linguistic2::XProofreadingIterator > m_xGCIterator;
305 
306     const ::boost::scoped_ptr< ::sw::mark::MarkManager> pMarkManager;
307     const ::boost::scoped_ptr< ::sw::MetaFieldManager > m_pMetaFieldManager;
308     const ::boost::scoped_ptr< ::sw::UndoManager > m_pUndoManager;
309 
310     // -------------------------------------------------------------------
311     // die Pointer
312                                 //Defaultformate
313     SwFrmFmt        *pDfltFrmFmt;
314     SwFrmFmt        *pEmptyPageFmt;     // Format fuer die Default-Leerseite.
315     SwFrmFmt        *pColumnContFmt;    // Format fuer Spaltencontainer
316     SwCharFmt       *pDfltCharFmt;
317     SwTxtFmtColl    *pDfltTxtFmtColl;   // Defaultformatcollections
318     SwGrfFmtColl    *pDfltGrfFmtColl;
319 
320     SwFrmFmts       *pFrmFmtTbl;        // Formattabellen
321     SwCharFmts      *pCharFmtTbl;
322     SwSpzFrmFmts    *pSpzFrmFmtTbl;
323     SwSectionFmts   *pSectionFmtTbl;
324     SwFrmFmts       *pTblFrmFmtTbl;     // spz. fuer Tabellen
325     SwTxtFmtColls   *pTxtFmtCollTbl;    // FormatCollections
326     SwGrfFmtColls   *pGrfFmtCollTbl;
327 
328     SwTOXTypes      *pTOXTypes;         // Verzeichnisse
329     SwDefTOXBase_Impl * pDefTOXBases;   // defaults of SwTOXBase's
330 
331     ViewShell       *pCurrentView;  // SwDoc should get a new member pCurrentView//swmod 071225
332     SdrModel        *pDrawModel;        // StarView Drawing
333 
334     SwDocUpdtFld    *pUpdtFlds;         // Struktur zum Field-Update
335     SwFldTypes      *pFldTypes;         // Feldtypen
336     SwNewDBMgr      *pNewDBMgr;         // Pointer auf den neuen DBMgr fuer
337                                         // Evaluierung der DB-Fields
338 
339     VirtualDevice   *pVirDev;           // can be used for formatting
340     SfxPrinter      *pPrt;              // can be used for formatting
341     SwPrintData     *pPrtData;          // Print configuration
342 
343     SwDoc           *pGlossaryDoc;      // Pointer auf das Glossary-Dokument. Dieses
344 
345     SwNumRule       *pOutlineRule;
346     SwFtnInfo       *pFtnInfo;
347     SwEndNoteInfo   *pEndNoteInfo;
348     SwLineNumberInfo*pLineNumberInfo;
349     SwFtnIdxs       *pFtnIdxs;
350     SwDocStat       *pDocStat;          // Statistic Informationen
351     SvxMacroTableDtor *pMacroTable;     // Tabelle der dokumentglobalen Macros
352 
353     SwDocShell      *pDocShell;         // Ptr auf die SfxDocShell vom Doc
354     SfxObjectShellLock xTmpDocShell;    // A temporary shell that is used to copy OLE-Nodes
355 
356     sfx2::LinkManager   *pLinkMgr;          // Liste von Verknuepften (Grafiken/DDE/OLE)
357 
358     SwAutoCorrExceptWord *pACEWord;     // fuer die automatische Uebernahme von
359                                         // autokorrigierten Woertern, die "zurueck"
360                                         // verbessert werden
361     SwURLStateChanged *pURLStateChgd;   // SfxClient fuer Aenderungen in der
362                                         // INetHistory
363     SvNumberFormatter *pNumberFormatter;    // NumFormatter fuer die Tabellen/Felder
364 
365     mutable SwNumRuleTbl    *pNumRuleTbl;           // Liste aller benannten NumRules
366 
367     // Hash map to find numrules by name
368     mutable std::hash_map<String, SwNumRule *, StringHash> maNumRuleMap;
369 
370     // --> OD 2008-03-12 #refactorlists#
371     typedef std::hash_map< String, SwList*, StringHash > tHashMapForLists;
372     // container to hold the lists of the text document
373     tHashMapForLists maLists;
374     // relation between list style and its default list
375     tHashMapForLists maListStyleLists;
376     // <--
377 
378     SwRedlineTbl    *pRedlineTbl;           // Liste aller Redlines
379     String          *pAutoFmtRedlnComment;  // Kommentar fuer Redlines, die
380                                         // uebers Autoformat eingefuegt werden
381     SwUnoCrsrTbl    *pUnoCrsrTbl;
382 
383     SwPagePreViewPrtData *pPgPViewPrtData;      // Einzuege/Abstaende fuers
384                                         // Drucken der Seitenansicht
385     SwPaM           *pExtInputRing;
386 
387     SwLayouter      *pLayouter;     // ::com::sun::star::frame::Controller for complex layout formatting
388                                     // like footnote/endnote in sections
389     IStyleAccess    *pStyleAccess;  // handling of automatic styles
390     SwLayoutCache   *pLayoutCache;  // Layout cache to read and save with the
391                                     // document for a faster formatting
392 
393     SwModify *pUnoCallBack;
394     IGrammarContact *mpGrammarContact;   // for grammar checking in paragraphs during editing
395 
396     mutable  comphelper::ImplementationReference< SwChartDataProvider
397         , ::com::sun::star::chart2::data::XDataProvider >
398                                 aChartDataProviderImplRef;
399     SwChartLockController_Helper  *pChartControllerHelper;
400 
401     // table of forbidden characters of this document
402     vos::ORef<SvxForbiddenCharactersTable>  xForbiddenCharsTable;
403 #ifdef FUTURE_VBA
404     com::sun::star::uno::Reference< com::sun::star::script::vba::XVBAEventProcessor > mxVbaEvents;
405 #endif
406     // --> OD 2007-10-26 #i83479#
407 public:
408     struct lessThanNodeNum
409     {
410         bool operator()( const SwNodeNum* pNodeNumOne,
411                          const SwNodeNum* pNodeNumTwo ) const;
412     };
413 
414     typedef ::std::set< const SwNodeNum*, lessThanNodeNum > tImplSortedNodeNumList;
415 private:
416     tImplSortedNodeNumList* mpListItemsList;
417     // <--
418 
419     ::std::auto_ptr< ::sfx2::IXmlIdRegistry > m_pXmlIdRegistry;
420 
421     // -------------------------------------------------------------------
422     // sonstige
423 
424     sal_uInt16 nAutoFmtRedlnCommentNo;  // SeqNo fuers UI-seitige zusammenfassen
425                                     // von AutoFmt-Redlines. Wird vom SwAutoFmt
426                                     // verwaltet!
427     sal_uInt16  nLinkUpdMode;       // UpdateMode fuer Links
428     SwFldUpdateFlags    eFldUpdMode;        // Mode fuer Felder/Charts automatisch aktualisieren
429     RedlineMode_t eRedlineMode;     // aktueller Redline Modus
430     SwCharCompressType eChrCmprType;    // for ASIAN: compress punctuation/kana
431 
432     sal_Int32   mReferenceCount;
433     sal_Int32   mIdleBlockCount;
434     sal_Int8    nLockExpFld;        // Wenn != 0 hat UpdateExpFlds() keine Wirkung
435 
436     /* Draw Model Layer IDs
437      * LayerIds, Heaven == ueber dem Dokument
438      * Hell   == unter dem Dokument
439      * Controls == ganz oben
440      */
441     SdrLayerID  nHeaven;
442     SdrLayerID  nHell;
443     SdrLayerID  nControls;
444     SdrLayerID  nInvisibleHeaven;
445     SdrLayerID  nInvisibleHell;
446     SdrLayerID  nInvisibleControls;
447 
448     bool mbGlossDoc              : 1;    //sal_True: ist ein Textbaustein Dokument
449     bool mbModified              : 1;    //sal_True: Dokument ist veraendert
450     bool mbDtor                  : 1;    //sal_True: ist im SwDoc DTOR
451                                          //      leider auch temporaer von
452                                          //      SwSwgReader::InLayout(), wenn fehlerhafte
453                                          //      Frames geloescht werden muessen
454     bool mbPageNums              : 1;    // TRUE: es gibt virtuelle Seitennummern
455     bool mbLoaded                : 1;    // TRUE: ein geladenes Doc
456     bool mbUpdateExpFld          : 1;    // TRUE: Expression-Felder updaten
457     bool mbNewDoc                : 1;    // TRUE: neues Doc
458     bool mbNewFldLst             : 1;    // TRUE: Felder-Liste neu aufbauen
459     bool mbCopyIsMove            : 1;    // TRUE: Copy ist ein verstecktes Move
460     bool mbVisibleLinks          : 1;    // TRUE: Links werden sichtbar eingefuegt
461     bool mbInReading             : 1;    // TRUE: Dokument wird gerade gelesen
462     bool mbInXMLImport           : 1;    // TRUE: During xml import, attribute portion building is not necessary
463     bool mbUpdateTOX             : 1;    // TRUE: nach Dokument laden die TOX Updaten
464     bool mbInLoadAsynchron       : 1;    // TRUE: Dokument wird gerade asynchron geladen
465     bool mbHTMLMode              : 1;    // TRUE: Dokument ist im HTMLMode
466     bool mbInCallModified        : 1;    // TRUE: im Set/Reset-Modified Link
467     bool mbIsGlobalDoc           : 1;    // TRUE: es ist ein GlobalDokument
468     bool mbGlblDocSaveLinks      : 1;    // TRUE: im GlobalDoc. gelinkte Sect. mit speichern
469     bool mbIsLabelDoc            : 1;    // TRUE: es ist ein Etiketten-Dokument
470     bool mbIsAutoFmtRedline      : 1;    // TRUE: die Redlines werden vom Autoformat aufgezeichnet
471     bool mbOLEPrtNotifyPending   : 1;    // TRUE: Printer  ist geaendert und beim
472                                          //       Erzeugen der ::com::sun::star::sdbcx::View ist eine Benachrichtigung
473                                          //       der OLE-Objekte PrtOLENotify() notwendig.
474     bool mbAllOLENotify          : 1;    // True: Benachrichtigung aller Objekte ist notwendig
475     bool mbIsRedlineMove         : 1;    // True: die Redlines werden in/aus der Section verschoben
476     bool mbInsOnlyTxtGlssry      : 1;    // True: insert 'only text' glossary into doc
477     bool mbContains_MSVBasic     : 1;    // True: MS-VBasic exist is in our storage
478     bool mbPurgeOLE              : 1;    // sal_True: Purge OLE-Objects
479     bool mbKernAsianPunctuation  : 1;    // sal_True: kerning also for ASIAN punctuation
480     bool mbReadlineChecked       : 1;    // sal_True: if the query was already shown
481     bool mbLinksUpdated          : 1;    // OD 2005-02-11 #i38810#
482                                          // flag indicating, that the links have been updated.
483     bool mbClipBoard             : 1;    // true: this document represents the clipboard
484     bool mbColumnSelection       : 1;    // true: this content has bee created by a column selection
485                                          //       (clipboard docs only)
486 
487 #ifdef DBG_UTIL
488     bool mbXMLExport : 1;                // sal_True: during XML export
489 #endif
490 
491     // --> OD 2006-03-21 #b6375613#
492     // Document flag to trigger conversion, which applys the workaround for documents,
493     // which uses a certain layout defect in OOo 1.x to layout the documents.
494     // This conversion is performed, when the frames for the layout are created.
495     // Thus, this document flag has to be set after load a document and before
496     // creating the document view.
497     bool mbApplyWorkaroundForB6375613 : 1;
498     // <--
499 
500     //
501     // COMPATIBILITY FLAGS START
502     //
503     //
504     // HISTORY OF THE COMPATIBILITY FLAGS:
505     //
506     // SO5:
507     // mbParaSpaceMax                        def = sal_False, sal_True since SO8
508     // mbParaSpaceMaxAtPages                 def = sal_False, sal_True since SO8
509     //
510     // SO6:
511     // mbTabCompat                           def = sal_False, sal_True since SO8
512     //
513     // SO7:
514     // mbUseVirtualDevice                    def = sal_True
515     // mbAddFlyOffsets                       def = sal_False, hidden
516     //
517     // SO7pp1:
518     // bOldNumbering                        def = sal_False, hidden
519     //
520     // SO8:
521     // mbAddExternalLeading                  def = sal_True
522     // mbUseHiResolutionVirtualDevice        def = sal_True, hidden
523     // mbOldLineSpacing                      def = sal_False
524     // mbAddParaSpacingToTableCells          def = sal_True
525     // mbUseFormerObjectPos                  def = sal_False
526     // mbUseFormerTextWrapping               def = sal_False
527     // mbConsiderWrapOnObjPos                def = sal_False
528     //
529     // SO8pp1:
530     // mbIgnoreFirstLineIndentInNumbering    def = sal_False, hidden
531     // mbDoNotJustifyLinesWithManualBreak    def = sal_False, hidden
532     // mbDoNotResetParaAttrsForNumFont       def = sal_False, hidden
533     //
534     // SO8pp3
535     // mbDoNotCaptureDrawObjsOnPage         def = sal_False, hidden
536     // - Relevant for drawing objects, which don't follow the text flow, but
537     //   whose position is outside the page area:
538     //   sal_False: Such drawing objects are captured on the page area of its anchor.
539     //   sal_True: Such drawing objects can leave the page area, they aren't captured.
540     // mbTableRowKeep                            def = sal_False, hidden
541     // mbIgnoreTabsAndBlanksForLineCalculation   def = sal_False, hidden
542     // mbClipAsCharacterAnchoredWriterFlyFrame   def = sal_False, hidden
543     // - Introduced in order to re-activate clipping of as-character anchored
544     //   Writer fly frames in method <SwFlyInCntFrm::MakeAll()> for documents,
545     //   which are created with version prior SO8/OOo 2.0
546     //
547     // SO8pp4
548     // mbUnixForceZeroExtLeading                def = sal_False, hidden
549     //
550     // SO8pu8
551     // mbOldPrinterMetrics                      def = sal_False, hidden
552     //
553     // SO9
554     // #i24363# tab stops relative to indent
555     // mbTabRelativeToIndent                    def = sal_True, hidden
556     // #i89181# suppress tab stop at left indent for paragraphs in lists, whose
557     // list level position and space mode equals LABEL_ALIGNMENT and whose list
558     // label is followed by a tab character.
559     // mbTabAtLeftIndentForParagraphsInList     def = sal_False, hidden
560 
561     bool mbParaSpaceMax                     : 1;
562     bool mbParaSpaceMaxAtPages              : 1;
563     bool mbTabCompat                        : 1;
564     bool mbUseVirtualDevice                 : 1;
565     bool mbAddFlyOffsets                    : 1;
566     bool mbAddExternalLeading               : 1;
567     bool mbUseHiResolutionVirtualDevice     : 1;
568     bool mbOldLineSpacing                   : 1;    // OD  2004-01-06 #i11859#
569     bool mbAddParaSpacingToTableCells       : 1;    // OD  2004-02-16 #106629#
570     bool mbUseFormerObjectPos               : 1;    // OD  2004-03-12 #i11860#
571     bool mbUseFormerTextWrapping            : 1;    // FME 2005-05-11 #108724#
572     bool mbConsiderWrapOnObjPos             : 1;    // OD  2004-05-05 #i28701#
573                                                     // sal_True: object positioning algorithm has consider the wrapping style of                                                    //       the floating screen objects as given by its attribute 'WrapInfluenceOnObjPos'
574     bool mbMathBaselineAlignment            : 1;    // TL  2010-10-29 #i972#
575 
576     // non-ui-compatibility flags:
577     bool mbOldNumbering                             : 1;   // HBRINKM #111955#
578     bool mbIgnoreFirstLineIndentInNumbering         : 1;   // FME 2005-05-30# i47448#
579     bool mbDoNotJustifyLinesWithManualBreak         : 1;   // FME 2005-06-08 #i49277#
580     bool mbDoNotResetParaAttrsForNumFont            : 1;   // FME 2005-08-11 #i53199#
581     bool mbTableRowKeep                             : 1;   // FME 2006-02-10 #131283#
582     bool mbIgnoreTabsAndBlanksForLineCalculation    : 1;   // FME 2006-03-01 #i3952#
583     bool mbDoNotCaptureDrawObjsOnPage               : 1;   // OD 2006-03-14 #i62875#
584     bool mbOutlineLevelYieldsOutlineRule            : 1;
585     bool mbClipAsCharacterAnchoredWriterFlyFrames   : 1;   // OD 2006-04-13 #b6402800#
586     bool mbUnixForceZeroExtLeading                  : 1;   // FME 2006-10-09 #i60945#
587     bool mbOldPrinterMetrics                        : 1;   // FME 2007-05-14 #147385#
588     bool mbTabRelativeToIndent                      : 1;   // #i24363# tab stops relative to indent
589     bool mbProtectForm                              : 1;
590     bool mbTabAtLeftIndentForParagraphsInList;             // OD 2008-06-05 #i89181# - see above
591 
592     bool mbLastBrowseMode                           : 1;
593 
594     // #i78591#
595     sal_uInt32  n32DummyCompatabilityOptions1;
596     sal_uInt32  n32DummyCompatabilityOptions2;
597     //
598     // COMPATIBILITY FLAGS END
599     //
600 
601     sal_Bool    mbStartIdleTimer                 ;    // idle timer mode start/stop
602 
603     bool        mbSetDrawDefaults                ;    // set draw pool defaults for freshly created documents
604 
605     static SwAutoCompleteWord *pACmpltWords;    // Liste aller Worte fuers AutoComplete
606 
607     //---------------- private Methoden ------------------------------
608     void checkRedlining(RedlineMode_t& _rReadlineMode);
609 
610     DECL_LINK( AddDrawUndo, SdrUndoAction * );
611                                         // DrawModel
612     void DrawNotifyUndoHdl();   // wegen CLOOKs
613 
614         // nur fuer den internen Gebrauch deshalb privat.
615         // Kopieren eines Bereiches im oder in ein anderes Dokument !
616         // Die Position darf nicht im Bereich liegen !!
617     bool CopyImpl( SwPaM&, SwPosition&, const bool MakeNewFrms /*= true */,
618             const bool bCopyAll, SwPaM *const pCpyRng /*= 0*/ ) const;
619 
620     SwFlyFrmFmt* _MakeFlySection( const SwPosition& rAnchPos,
621                                 const SwCntntNode& rNode, RndStdIds eRequestId,
622                                 const SfxItemSet* pFlyAttrSet,
623                                 SwFrmFmt* = 0 );
624 
625     SwFlyFrmFmt* _InsNoTxtNode( const SwPosition&rPos, SwNoTxtNode*,
626                                 const SfxItemSet* pFlyAttrSet,
627                                 const SfxItemSet* pGrfAttrSet,
628                                 SwFrmFmt* = 0 );
629 
630     void CopyFlyInFlyImpl(  const SwNodeRange& rRg,
631                             const xub_StrLen nEndContentIndex,
632                             const SwNodeIndex& rStartIdx,
633                             const bool bCopyFlyAtFly = false ) const;
634     sal_Int8 SetFlyFrmAnchor( SwFrmFmt& rFlyFmt, SfxItemSet& rSet, sal_Bool bNewFrms );
635 
636     // --> OD 2005-01-13 #i40550#
637     typedef SwFmt* (SwDoc:: *FNCopyFmt)( const String&, SwFmt*, sal_Bool, sal_Bool );
638     // <--
639     SwFmt* CopyFmt( const SwFmt& rFmt, const SvPtrarr& rFmtArr,
640                         FNCopyFmt fnCopyFmt, const SwFmt& rDfltFmt );
641     void CopyFmtArr( const SvPtrarr& rSourceArr, SvPtrarr& rDestArr,
642                         FNCopyFmt fnCopyFmt, SwFmt& rDfltFmt );
643     void CopyPageDescHeaderFooterImpl( bool bCpyHeader,
644                                 const SwFrmFmt& rSrcFmt, SwFrmFmt& rDestFmt );
645     SwFmt* FindFmtByName( const SvPtrarr& rFmtArr,
646                                     const String& rName ) const;
647 
648     VirtualDevice& CreateVirtualDevice_() const;
649     SfxPrinter& CreatePrinter_() const;
650     void        PrtDataChanged();   //Printer oder JobSetup geandert, es muss
651                                     //fuer entsprechende Invalidierungen und
652                                     //Benachrichtigungen gesorgt werden.
653 
654     // gcc: aFtnInfo::CopyCtor ist private, also muessen wir uns auch schuetzen
655     SwDoc( const SwDoc &);
656 
657     // fuer Felder:
658     void _InitFieldTypes();     // wird vom CTOR gerufen!!
659     void _MakeFldList( int eMode );
660 
661     // Datenbankfelder:
662     void UpdateDBNumFlds( SwDBNameInfField& rDBFld, SwCalc& rCalc );
663     void AddUsedDBToList( SvStringsDtor& rDBNameList,
664                           const SvStringsDtor& rUsedDBNames );
665     void AddUsedDBToList( SvStringsDtor& rDBNameList, const String& rDBName );
666     sal_Bool IsNameInArray( const SvStringsDtor& rOldNames, const String& rName );
667     void GetAllDBNames( SvStringsDtor& rAllDBNames );
668     void ReplaceUsedDBs( const SvStringsDtor& rUsedDBNames,
669                         const String& rNewName, String& rFormel );
670     SvStringsDtor& FindUsedDBs( const SvStringsDtor& rAllDBNames,
671                                 const String& rFormel,
672                                 SvStringsDtor& rUsedDBNames );
673 
674     void InitDrawModel();
675     void ReleaseDrawModel();
676 
677     void _CreateNumberFormatter();
678 
679     sal_Bool _UnProtectTblCells( SwTable& rTbl );
680 
681     // erzeuge Anhand der vorgebenen Collection Teildokumente
682     // falls keine angegeben ist, nehme die Kapitelvorlage der 1. Ebene
683     sal_Bool SplitDoc( sal_uInt16 eDocType, const String& rPath,
684                         const SwTxtFmtColl* pSplitColl );
685     sal_Bool SplitDoc( sal_uInt16 eDocType, const String& rPath, int nOutlineLevel = 0 ); //#outline level,add by zhaijianwei.
686 
687 
688     // Charts der angegebenen Tabelle updaten
689     void _UpdateCharts( const SwTable& rTbl, ViewShell& rVSh ) const;
690 
691     sal_Bool _SelectNextRubyChars( SwPaM& rPam, SwRubyListEntry& rRubyEntry,
692                                 sal_uInt16 nMode );
693 
694     // unser eigener 'IdlTimer' ruft folgende Methode
695     DECL_LINK( DoIdleJobs, Timer * );
696     // der CharTimer ruft diese Methode
697     DECL_LINK( DoUpdateAllCharts, Timer * );
698     DECL_LINK( DoUpdateModifiedOLE, Timer * );
699 
700      SwFmt *_MakeCharFmt(const String &, SwFmt *, sal_Bool, sal_Bool );
701      SwFmt *_MakeFrmFmt(const String &, SwFmt *, sal_Bool, sal_Bool );
702      SwFmt *_MakeTxtFmtColl(const String &, SwFmt *, sal_Bool, sal_Bool );
703 
704      void InitTOXTypes();
705      void   Paste( const SwDoc& );
706      bool DeleteAndJoinImpl(SwPaM&, const bool);
707      bool DeleteAndJoinWithRedlineImpl(SwPaM&, const bool unused = false);
708      bool DeleteRangeImpl(SwPaM&, const bool unused = false);
709      bool DeleteRangeImplImpl(SwPaM &);
710      bool ReplaceRangeImpl(SwPaM&, String const&, const bool);
711 
712 public:
713 
714     /** Life cycle
715     */
716     SwDoc();
717     ~SwDoc();
718 
719     inline bool IsInDtor() const { return mbDtor; }
720 
721     /* @@@MAINTAINABILITY-HORROR@@@
722        Implementation details made public.
723     */
724     SwNodes      & GetNodes()       { return *m_pNodes; }
725     SwNodes const& GetNodes() const { return *m_pNodes; }
726 
727     /** IInterface
728     */
729     virtual sal_Int32 acquire();
730     virtual sal_Int32 release();
731     virtual sal_Int32 getReferenceCount() const;
732 
733     /** IDocumentSettingAccess
734     */
735     virtual bool get(/*[in]*/ DocumentSettingId id) const;
736     virtual void set(/*[in]*/ DocumentSettingId id, /*[in]*/ bool value);
737     virtual const com::sun::star::i18n::ForbiddenCharacters* getForbiddenCharacters(/*[in]*/ sal_uInt16 nLang, /*[in]*/ bool bLocaleData ) const;
738     virtual void setForbiddenCharacters(/*[in]*/ sal_uInt16 nLang, /*[in]*/ const com::sun::star::i18n::ForbiddenCharacters& rForbiddenCharacters );
739     virtual vos::ORef<SvxForbiddenCharactersTable>& getForbiddenCharacterTable();
740     virtual const vos::ORef<SvxForbiddenCharactersTable>& getForbiddenCharacterTable() const;
741     virtual sal_uInt16 getLinkUpdateMode( /*[in]*/bool bGlobalSettings ) const;
742     virtual void setLinkUpdateMode( /*[in]*/ sal_uInt16 nMode );
743     virtual SwFldUpdateFlags getFieldUpdateFlags( /*[in]*/bool bGlobalSettings ) const;
744     virtual void setFieldUpdateFlags( /*[in]*/ SwFldUpdateFlags eMode );
745     virtual SwCharCompressType getCharacterCompressionType() const;
746     virtual void setCharacterCompressionType( /*[in]*/SwCharCompressType nType );
747 
748     /** IDocumentDeviceAccess
749     */
750     virtual SfxPrinter* getPrinter(/*[in]*/ bool bCreate ) const;
751     virtual void setPrinter(/*[in]*/ SfxPrinter* pP,/*[in]*/ bool bDeleteOld,/*[in]*/ bool bCallPrtDataChanged );
752     virtual VirtualDevice* getVirtualDevice(/*[in]*/ bool bCreate ) const;
753     virtual void setVirtualDevice(/*[in]*/ VirtualDevice* pVd,/*[in]*/ bool bDeleteOld, /*[in]*/ bool bCallVirDevDataChanged );
754     virtual OutputDevice* getReferenceDevice(/*[in]*/ bool bCreate ) const;
755     virtual void setReferenceDeviceType(/*[in]*/ bool bNewVirtual,/*[in]*/ bool bNewHiRes );
756     virtual const JobSetup* getJobsetup() const;
757     virtual void setJobsetup(/*[in]*/ const JobSetup& rJobSetup );
758     virtual const SwPrintData & getPrintData() const;
759     virtual void setPrintData(/*[in]*/ const SwPrintData& rPrtData);
760 
761     /** IDocumentMarkAccess
762     */
763     IDocumentMarkAccess* getIDocumentMarkAccess();
764     const IDocumentMarkAccess* getIDocumentMarkAccess() const;
765 
766     /** IDocumentRedlineAccess
767     */
768     virtual RedlineMode_t GetRedlineMode() const;
769     virtual void SetRedlineMode_intern(/*[in]*/RedlineMode_t eMode);
770     virtual void SetRedlineMode(/*[in]*/RedlineMode_t eMode);
771     virtual bool IsRedlineOn() const;
772     virtual bool IsIgnoreRedline() const;
773     virtual bool IsInRedlines(const SwNode& rNode) const;
774     virtual const SwRedlineTbl& GetRedlineTbl() const;
775     virtual bool AppendRedline(/*[in]*/SwRedline* pPtr, /*[in]*/bool bCallDelete);
776     virtual bool SplitRedline(const SwPaM& rPam);
777     virtual bool DeleteRedline(/*[in]*/const SwPaM& rPam, /*[in]*/bool bSaveInUndo, /*[in]*/sal_uInt16 nDelType);
778     virtual bool DeleteRedline(/*[in]*/const SwStartNode& rSection, /*[in]*/bool bSaveInUndo, /*[in]*/sal_uInt16 nDelType);
779     virtual sal_uInt16 GetRedlinePos(/*[in]*/const SwNode& rNode, /*[in]*/sal_uInt16 nType) const;
780     virtual void CompressRedlines();
781     virtual const SwRedline* GetRedline(/*[in]*/const SwPosition& rPos, /*[in]*/sal_uInt16* pFndPos) const;
782     virtual bool IsRedlineMove() const;
783     virtual void SetRedlineMove(/*[in]*/bool bFlag);
784     virtual bool AcceptRedline(/*[in]*/sal_uInt16 nPos, /*[in]*/bool bCallDelete);
785     virtual bool AcceptRedline(/*[in]*/const SwPaM& rPam, /*[in]*/bool bCallDelete);
786     virtual bool RejectRedline(/*[in]*/sal_uInt16 nPos, /*[in]*/bool bCallDelete);
787     virtual bool RejectRedline(/*[in]*/const SwPaM& rPam, /*[in]*/bool bCallDelete);
788     virtual const SwRedline* SelNextRedline(/*[in]*/SwPaM& rPam) const;
789     virtual const SwRedline* SelPrevRedline(/*[in]*/SwPaM& rPam) const;
790     virtual void UpdateRedlineAttr();
791     virtual sal_uInt16 GetRedlineAuthor();
792     virtual sal_uInt16 InsertRedlineAuthor(const String& rAuthor);
793     virtual bool SetRedlineComment(/*[in]*/const SwPaM& rPam, /*[in]*/const String& rComment);
794     virtual const ::com::sun::star::uno::Sequence <sal_Int8>& GetRedlinePassword() const;
795     virtual void SetRedlinePassword(/*[in]*/const ::com::sun::star::uno::Sequence <sal_Int8>& rNewPassword);
796 
797     /** IDocumentUndoRedo
798     */
799     IDocumentUndoRedo      & GetIDocumentUndoRedo();
800     IDocumentUndoRedo const& GetIDocumentUndoRedo() const;
801 
802     /** IDocumentLinksAdministration
803     */
804     virtual bool IsVisibleLinks() const;
805     virtual void SetVisibleLinks(bool bFlag);
806     virtual sfx2::LinkManager& GetLinkManager();
807     virtual const sfx2::LinkManager& GetLinkManager() const;
808     virtual void UpdateLinks(sal_Bool bUI);
809     virtual bool GetData(const String& rItem, const String& rMimeType, ::com::sun::star::uno::Any& rValue) const;
810     virtual bool SetData(const String& rItem, const String& rMimeType, const ::com::sun::star::uno::Any& rValue);
811     virtual ::sfx2::SvLinkSource* CreateLinkSource(const String& rItem);
812     virtual bool EmbedAllLinks();
813     virtual void SetLinksUpdated(const bool bNewLinksUpdated);
814     virtual bool LinksUpdated() const;
815 
816     /** IDocumentFieldsAccess
817     */
818     virtual const SwFldTypes *GetFldTypes() const;
819     virtual SwFieldType *InsertFldType(const SwFieldType &);
820     virtual SwFieldType *GetSysFldType( const sal_uInt16 eWhich ) const;
821     virtual SwFieldType* GetFldType(sal_uInt16 nResId, const String& rName, bool bDbFieldMatching) const;
822     virtual void RemoveFldType(sal_uInt16 nFld);
823     virtual void UpdateFlds( SfxPoolItem* pNewHt, bool bCloseDB);
824     virtual void InsDeletedFldType(SwFieldType &);
825     virtual bool PutValueToField(const SwPosition & rPos, const com::sun::star::uno::Any& rVal, sal_uInt16 nWhich);
826     virtual bool UpdateFld(SwTxtFld * rDstFmtFld, SwField & rSrcFld, SwMsgPoolItem * pMsgHnt, bool bUpdateTblFlds);
827     virtual void UpdateRefFlds(SfxPoolItem* pHt);
828     virtual void UpdateTblFlds(SfxPoolItem* pHt);
829     virtual void UpdateExpFlds(SwTxtFld* pFld, bool bUpdateRefFlds);
830     virtual void UpdateUsrFlds();
831     virtual void UpdatePageFlds(SfxPoolItem*);
832     virtual void LockExpFlds();
833     virtual void UnlockExpFlds();
834     virtual bool IsExpFldsLocked() const;
835     virtual SwDocUpdtFld& GetUpdtFlds() const;
836     virtual bool SetFieldsDirty(bool b, const SwNode* pChk, sal_uLong nLen);
837     virtual void SetFixFields(bool bOnlyTimeDate, const DateTime* pNewDateTime);
838     virtual void FldsToCalc(SwCalc& rCalc, sal_uLong nLastNd, sal_uInt16 nLastCnt);
839     virtual void FldsToCalc(SwCalc& rCalc, const _SetGetExpFld& rToThisFld);
840     virtual void FldsToExpand(SwHash**& ppTbl, sal_uInt16& rTblSize, const _SetGetExpFld& rToThisFld);
841     virtual bool IsNewFldLst() const;
842     virtual void SetNewFldLst( bool bFlag);
843     virtual void InsDelFldInFldLst(bool bIns, const SwTxtFld& rFld);
844 
845     /** Returns the field at a certain position.
846        @param rPos position to search at
847        @return pointer to field at the given position or NULL in case no field is found
848     */
849     static SwField* GetField(const SwPosition& rPos);
850 
851     /** Returns the field at a certain position.
852        @param rPos position to search at
853        @return pointer to field at the given position or NULL in case no field is found
854     */
855     static SwTxtFld* GetTxtFld(const SwPosition& rPos);
856 
857     /** IDocumentContentOperations
858     */
859     virtual bool CopyRange(SwPaM&, SwPosition&, const bool bCopyAll) const;
860     virtual void DeleteSection(SwNode* pNode);
861     virtual bool DeleteRange(SwPaM&);
862     virtual bool DelFullPara(SwPaM&);
863     // --> OD 2009-08-20 #i100466#
864     // Add optional parameter <bForceJoinNext>, default value <false>
865     // Needed for hiding of deletion redlines
866     virtual bool DeleteAndJoin( SwPaM&,
867                                 const bool bForceJoinNext = false );
868     // <--
869     virtual bool MoveRange(SwPaM&, SwPosition&, SwMoveFlags);
870     virtual bool MoveNodeRange(SwNodeRange&, SwNodeIndex&, SwMoveFlags);
871     virtual bool MoveAndJoin(SwPaM&, SwPosition&, SwMoveFlags);
872     virtual bool Overwrite(const SwPaM &rRg, const String& rStr);
873     virtual bool InsertString(const SwPaM &rRg, const String&,
874               const enum InsertFlags nInsertMode = INS_EMPTYEXPAND );
875     virtual SwFlyFrmFmt* Insert(const SwPaM &rRg, const String& rGrfName, const String& rFltName, const Graphic* pGraphic,
876                         const SfxItemSet* pFlyAttrSet, const SfxItemSet* pGrfAttrSet, SwFrmFmt*);
877     virtual SwFlyFrmFmt* Insert(const SwPaM& rRg, const GraphicObject& rGrfObj, const SfxItemSet* pFlyAttrSet,
878                         const SfxItemSet* pGrfAttrSet, SwFrmFmt*);
879     virtual SwDrawFrmFmt* Insert(const SwPaM &rRg, SdrObject& rDrawObj, const SfxItemSet* pFlyAttrSet, SwFrmFmt*);
880     virtual SwFlyFrmFmt* Insert(const SwPaM &rRg, const svt::EmbeddedObjectRef& xObj, const SfxItemSet* pFlyAttrSet,
881                         const SfxItemSet* pGrfAttrSet, SwFrmFmt*);
882     virtual bool InsertPoolItem(const SwPaM &rRg, const SfxPoolItem&,
883                                 const SetAttrMode nFlags);
884     virtual bool InsertItemSet (const SwPaM &rRg, const SfxItemSet&,
885                                 const SetAttrMode nFlags);
886     virtual void ReRead(SwPaM&, const String& rGrfName, const String& rFltName, const Graphic* pGraphic, const GraphicObject* pGrfObj);
887     virtual void TransliterateText(const SwPaM& rPaM, utl::TransliterationWrapper&);
888     virtual SwFlyFrmFmt* InsertOLE(const SwPaM &rRg, const String& rObjName, sal_Int64 nAspect, const SfxItemSet* pFlyAttrSet,
889                            const SfxItemSet* pGrfAttrSet, SwFrmFmt*);
890     virtual bool SplitNode(const SwPosition &rPos, bool bChkTableStart);
891     virtual bool AppendTxtNode(SwPosition& rPos);
892         virtual void SetModified(SwPaM &rPaM);
893     virtual bool ReplaceRange(SwPaM& rPam, const String& rNewStr,
894                               const bool bRegExReplace);
895     virtual void RemoveLeadingWhiteSpace(const SwPosition & rPos );
896 
897     /** IDocumentStylePoolAccess
898     */
899     virtual SwTxtFmtColl* GetTxtCollFromPool( sal_uInt16 nId, bool bRegardLanguage = true );
900     virtual SwFmt* GetFmtFromPool( sal_uInt16 nId );
901     virtual SwFrmFmt* GetFrmFmtFromPool( sal_uInt16 nId );
902     virtual SwCharFmt* GetCharFmtFromPool( sal_uInt16 nId );
903     virtual SwPageDesc* GetPageDescFromPool( sal_uInt16 nId, bool bRegardLanguage = true );
904     virtual SwNumRule* GetNumRuleFromPool( sal_uInt16 nId );
905     virtual bool IsPoolTxtCollUsed( sal_uInt16 nId ) const;
906     virtual bool IsPoolFmtUsed( sal_uInt16 nId ) const;
907     virtual bool IsPoolPageDescUsed( sal_uInt16 nId ) const;
908 
909     /** IDocumentLineNumberAccess
910     */
911     virtual const SwLineNumberInfo& GetLineNumberInfo() const;
912     virtual void SetLineNumberInfo(const SwLineNumberInfo& rInfo);
913 
914     /** IDocumentStatistics
915     */
916     virtual void DocInfoChgd();
917     virtual const SwDocStat &GetDocStat() const;
918     virtual void SetDocStat(const SwDocStat& rStat);
919     virtual void UpdateDocStat(SwDocStat& rStat);
920 
921     /** IDocumentState
922     */
923     virtual void SetModified();
924     virtual void ResetModified();
925     virtual bool IsModified() const;
926     virtual bool IsLoaded() const;
927     virtual bool IsUpdateExpFld() const;
928     virtual bool IsNewDoc() const;
929     virtual bool IsPageNums() const;
930     virtual void SetPageNums(bool b);
931     virtual void SetNewDoc(bool b);
932     virtual void SetUpdateExpFldStat(bool b);
933     virtual void SetLoaded(bool b);
934 
935     /** IDocumentDrawModelAccess
936     */
937     virtual const SdrModel* GetDrawModel() const;
938     virtual SdrModel* GetDrawModel();
939     virtual SdrLayerID GetHeavenId() const;
940     virtual SdrLayerID GetHellId() const;
941     virtual SdrLayerID GetControlsId() const;
942     virtual SdrLayerID GetInvisibleHeavenId() const;
943     virtual SdrLayerID GetInvisibleHellId() const;
944     virtual SdrLayerID GetInvisibleControlsId() const;
945     virtual void NotifyInvisibleLayers( SdrPageView& _rSdrPageView );
946     virtual bool IsVisibleLayerId( const SdrLayerID& _nLayerId ) const;
947     virtual SdrLayerID GetVisibleLayerIdByInvisibleOne( const SdrLayerID& _nInvisibleLayerId );
948     virtual SdrLayerID GetInvisibleLayerIdByVisibleOne( const SdrLayerID& _nVisibleLayerId );
949     virtual SdrModel* _MakeDrawModel();
950     virtual SdrModel* GetOrCreateDrawModel();
951 
952     /** IDocumentLayoutAccess
953     */
954     virtual void SetCurrentViewShell( ViewShell* pNew );//swmod 071225
955     virtual SwLayouter* GetLayouter();
956     virtual const SwLayouter* GetLayouter() const;
957     virtual void SetLayouter( SwLayouter* pNew );
958     virtual SwFrmFmt* MakeLayoutFmt( RndStdIds eRequest, const SfxItemSet* pSet );
959     virtual void DelLayoutFmt( SwFrmFmt *pFmt );
960     virtual SwFrmFmt* CopyLayoutFmt( const SwFrmFmt& rSrc, const SwFmtAnchor& rNewAnchor, bool bSetTxtFlyAtt, bool bMakeFrms );
961     virtual const ViewShell *GetCurrentViewShell() const;   //swmod 080219
962     virtual ViewShell *GetCurrentViewShell();//swmod 080219 It must be able to communicate to a ViewShell.This is going to be removerd later.
963     virtual const SwRootFrm *GetCurrentLayout() const;
964     virtual SwRootFrm *GetCurrentLayout();//swmod 080219
965     virtual bool HasLayout() const;
966 
967     /** IDocumentTimerAccess
968     */
969     virtual void StartIdling();
970     virtual void StopIdling();
971     virtual void BlockIdling();
972     virtual void UnblockIdling();
973 
974     /** IDocumentChartDataProviderAccess
975     */
976     virtual SwChartDataProvider * GetChartDataProvider( bool bCreate = false ) const;
977     virtual void CreateChartInternalDataProviders( const SwTable *pTable );
978     virtual SwChartLockController_Helper & GetChartControllerHelper();
979 
980     /** IDocumentListItems
981 
982         OD 2007-10-26 #i83479#
983     */
984     virtual void addListItem( const SwNodeNum& rNodeNum );
985     virtual void removeListItem( const SwNodeNum& rNodeNum );
986     virtual String getListItemText( const SwNodeNum& rNodeNum,
987                                     const bool bWithNumber = true,
988                                     const bool bWithSpacesForLevel = false ) const;
989     virtual void getListItems( IDocumentListItems::tSortedNodeNumList& orNodeNumList ) const;
990     virtual void getNumItems( IDocumentListItems::tSortedNodeNumList& orNodeNumList ) const;
991 
992     /** IDocumentOutlineNodes
993 
994         OD 2007-11-15 #i83479#
995     */
996     virtual sal_Int32 getOutlineNodesCount() const;
997     virtual int getOutlineLevel( const sal_Int32 nIdx ) const;
998     virtual String getOutlineText( const sal_Int32 nIdx,
999                                    const bool bWithNumber,
1000                                    const bool bWithSpacesForLevel ) const;
1001     virtual SwTxtNode* getOutlineNode( const sal_Int32 nIdx ) const;
1002     virtual void getOutlineNodes( IDocumentOutlineNodes::tSortedOutlineNodeList& orOutlineNodeList ) const;
1003 
1004     /** IDocumentListsAccess
1005 
1006         OD 2008-03-26 #refactorlists#
1007     */
1008     virtual SwList* createList( String sListId,
1009                                 const String sDefaultListStyleName );
1010     virtual void deleteList( const String sListId );
1011     virtual SwList* getListByName( const String sListId ) const;
1012     virtual SwList* createListForListStyle( const String sListStyleName );
1013     virtual SwList* getListForListStyle( const String sListStyleName ) const;
1014     virtual void deleteListForListStyle( const String sListStyleName );
1015     // --> OD 2008-07-08 #i91400#
1016     virtual void trackChangeOfListStyleName( const String sListStyleName,
1017                                              const String sNewListStyleName );
1018     // <--
1019 
1020     /** IDocumentExternalData */
1021     virtual void setExternalData(::sw::tExternalDataType eType,
1022                                  ::sw::tExternalDataPointer pPayload);
1023     virtual ::sw::tExternalDataPointer getExternalData(::sw::tExternalDataType eType);
1024 
1025 
1026     /** INextInterface here
1027     */
1028 
1029     DECL_STATIC_LINK( SwDoc, BackgroundDone, SvxBrushItem *);
1030     DECL_LINK(CalcFieldValueHdl, EditFieldInfo*);
1031 
1032     /** OLE ???
1033     */
1034     bool IsOLEPrtNotifyPending() const  { return mbOLEPrtNotifyPending; }
1035     inline void SetOLEPrtNotifyPending( bool bSet = true );
1036     void PrtOLENotify( sal_Bool bAll ); //Alle oder nur Markierte
1037 
1038 #ifdef DBG_UTIL
1039     bool InXMLExport() const            { return mbXMLExport; }
1040     void SetXMLExport( bool bFlag )     { mbXMLExport = bFlag; }
1041 #endif
1042 
1043     // liefert zu allen fliegenden Rahmen die Position im Dokument.
1044     // Wird ein Pam-Pointer uebergeben, muessen die absatzgebundenen
1045     // FlyFrames von der ::com::sun::star::awt::Selection vollstaendig umschlossen sein
1046     // ( Start < Pos < End ) !!!
1047     // (wird fuer die Writer benoetigt)
1048     void GetAllFlyFmts( SwPosFlyFrms& rPosFlyFmts, const SwPaM* = 0,
1049                         sal_Bool bDrawAlso = sal_False ) const;
1050 
1051     // wegen swrtf.cxx und define private public, jetzt hier
1052     SwFlyFrmFmt  *MakeFlyFrmFmt (const String &rFmtName, SwFrmFmt *pDerivedFrom);
1053     SwDrawFrmFmt *MakeDrawFrmFmt(const String &rFmtName, SwFrmFmt *pDerivedFrom);
1054 
1055     // JP 08.05.98: fuer Flys muss jetzt diese Schnittstelle benutzt
1056     //              werden. pAnchorPos muss gesetzt sein, wenn keine
1057     //              Seitenbindung vorliegt UND der ::com::sun::star::chaos::Anchor nicht schon
1058     //              im FlySet/FrmFmt mit gueltiger CntntPos gesetzt ist
1059     /* #109161# new parameter bCalledFromShell
1060 
1061        sal_True: An existing adjust item at pAnchorPos is propagated to
1062        the content node of the new fly section. That propagation only
1063        takes place if there is no adjust item in the paragraph style
1064        for the new fly section.
1065 
1066        sal_False: no propagation
1067     */
1068     SwFlyFrmFmt* MakeFlySection( RndStdIds eAnchorType,
1069                                  const SwPosition* pAnchorPos,
1070                                  const SfxItemSet* pSet = 0,
1071                                  SwFrmFmt *pParent = 0,
1072                                  sal_Bool bCalledFromShell = sal_False );
1073     SwFlyFrmFmt* MakeFlyAndMove( const SwPaM& rPam, const SfxItemSet& rSet,
1074                                 const SwSelBoxes* pSelBoxes = 0,
1075                                 SwFrmFmt *pParent = 0 );
1076 
1077     void CopyWithFlyInFly( const SwNodeRange& rRg,
1078                             const xub_StrLen nEndContentIndex,
1079                             const SwNodeIndex& rInsPos,
1080                             sal_Bool bMakeNewFrms = sal_True,
1081                             sal_Bool bDelRedlines = sal_True,
1082                             sal_Bool bCopyFlyAtFly = sal_False ) const;
1083 
1084     sal_Bool SetFlyFrmAttr( SwFrmFmt& rFlyFmt, SfxItemSet& rSet );
1085 
1086     sal_Bool SetFrmFmtToFly( SwFrmFmt& rFlyFmt, SwFrmFmt& rNewFmt,
1087                         SfxItemSet* pSet = 0, sal_Bool bKeepOrient = sal_False );
1088     // --> OD 2009-07-20 #i73249#
1089     void SetFlyFrmTitle( SwFlyFrmFmt& rFlyFrmFmt,
1090                          const String& sNewTitle );
1091     void SetFlyFrmDescription( SwFlyFrmFmt& rFlyFrmFmt,
1092                                const String& sNewDescription );
1093     // <--
1094 
1095     /** Footnotes
1096     */
1097     // Fussnoten Informationen
1098     const SwFtnInfo& GetFtnInfo() const         { return *pFtnInfo; }
1099     void SetFtnInfo(const SwFtnInfo& rInfo);
1100     const SwEndNoteInfo& GetEndNoteInfo() const { return *pEndNoteInfo; }
1101     void SetEndNoteInfo(const SwEndNoteInfo& rInfo);
1102           SwFtnIdxs& GetFtnIdxs()       { return *pFtnIdxs; }
1103     const SwFtnIdxs& GetFtnIdxs() const { return *pFtnIdxs; }
1104     // change footnotes in area
1105     bool SetCurFtn( const SwPaM& rPam, const String& rNumStr,
1106                     sal_uInt16 nNumber, bool bIsEndNote );
1107 
1108     /** Operations on the content of the document e.g.
1109         spell-checking/hyphenating/word-counting
1110     */
1111     ::com::sun::star::uno::Any
1112             Spell( SwPaM&, ::com::sun::star::uno::Reference<
1113                             ::com::sun::star::linguistic2::XSpellChecker1 > &,
1114                    sal_uInt16* pPageCnt, sal_uInt16* pPageSt, bool bGrammarCheck,
1115                    SwConversionArgs *pConvArgs = 0 ) const;
1116 
1117     ::com::sun::star::uno::Reference<
1118         ::com::sun::star::linguistic2::XHyphenatedWord >
1119             Hyphenate( SwPaM *pPam, const Point &rCrsrPos,
1120                        sal_uInt16* pPageCnt, sal_uInt16* pPageSt );
1121 
1122     // count words in pam
1123     void CountWords( const SwPaM& rPaM, SwDocStat& rStat ) const;
1124 
1125 
1126     /** ???
1127     */
1128     // Textbaustein Dokument?
1129     void SetGlossDoc( bool bGlssDc = true ) { mbGlossDoc = bGlssDc; }
1130     bool IsInsOnlyTextGlossary() const      { return mbInsOnlyTxtGlssry; }
1131 
1132     // Abstakt fuellen
1133     void Summary( SwDoc* pExtDoc, sal_uInt8 nLevel, sal_uInt8 nPara, sal_Bool bImpress );
1134 
1135     void ChangeAuthorityData(const SwAuthEntry* pNewData);
1136 
1137     bool IsInCallModified() const      { return mbInCallModified; }
1138     sal_Bool IsInHeaderFooter( const SwNodeIndex& rIdx ) const;
1139     short GetTextDirection( const SwPosition& rPos,
1140                             const Point* pPt = 0 ) const;
1141     sal_Bool IsInVerticalText( const SwPosition& rPos,
1142                                const Point* pPt = 0 ) const;
1143     /** Database ???
1144     */
1145 
1146     /*  Datenbank &&  DB-Manager */
1147     void SetNewDBMgr( SwNewDBMgr* pNewMgr )     { pNewDBMgr = pNewMgr; }
1148     SwNewDBMgr* GetNewDBMgr() const             { return pNewDBMgr; }
1149     void ChangeDBFields( const SvStringsDtor& rOldNames,
1150                         const String& rNewName );
1151     void SetInitDBFields(sal_Bool b);
1152     // Von Feldern verwendete Datenbanken herausfinden
1153     void GetAllUsedDB( SvStringsDtor& rDBNameList,
1154                        const SvStringsDtor* pAllDBNames = 0 );
1155 
1156     void ChgDBData( const SwDBData& rNewData );
1157     SwDBData GetDBData();
1158     const SwDBData& GetDBDesc();
1159     const SwDBData& _GetDBDesc() const { return aDBData; }
1160 
1161     /** Some helper functions
1162     */
1163     String GetUniqueGrfName() const;
1164     String GetUniqueOLEName() const;
1165     String GetUniqueFrameName() const;
1166 
1167     std::set<SwRootFrm*> GetAllLayouts();//swmod 080225
1168 
1169     void SetFlyName( SwFlyFrmFmt& rFmt, const String& rName );
1170     const SwFlyFrmFmt* FindFlyByName( const String& rName, sal_Int8 nNdTyp = 0 ) const;
1171 
1172     void GetGrfNms( const SwFlyFrmFmt& rFmt, String* pGrfName,
1173                     String* pFltName ) const;
1174 
1175     // setze bei allen Flys ohne Namen einen gueltigen (Wird von den Readern
1176     // nach dem Einlesen gerufen )
1177     void SetAllUniqueFlyNames();
1178 
1179         //Zuruecksetzen der Attribute; es werden alle TxtHints und bei
1180         //vollstaendiger Selektion harte Formatierung (AUTO-Formate) entfernt
1181     // --> OD 2008-11-28 #i96644#
1182     // introduce new optional parameter <bSendDataChangedEvents> in order to
1183     // control, if the side effect "send data changed events" is triggered or not.
1184     void ResetAttrs( const SwPaM &rRg,
1185                      sal_Bool bTxtAttr = sal_True,
1186                      const SvUShortsSort* = 0,
1187                      const bool bSendDataChangedEvents = true );
1188     // <--
1189     void RstTxtAttrs(const SwPaM &rRg, sal_Bool bInclRefToxMark = sal_False );
1190 
1191         // Setze das Attribut im angegebenen Format. Ist Undo aktiv, wird
1192         // das alte in die Undo-History aufgenommen
1193     void SetAttr( const SfxPoolItem&, SwFmt& );
1194     void SetAttr( const SfxItemSet&, SwFmt& );
1195 
1196     // --> OD 2008-02-12 #newlistlevelattrs#
1197     // method to reset a certain attribute at the given format
1198     void ResetAttrAtFormat( const sal_uInt16 nWhichId,
1199                             SwFmt& rChangedFormat );
1200     // <--
1201 
1202         // Setze das Attribut als neues default Attribut in diesem Dokument.
1203         // Ist Undo aktiv, wird das alte in die Undo-History aufgenommen
1204     void SetDefault( const SfxPoolItem& );
1205     void SetDefault( const SfxItemSet& );
1206 
1207     // Erfrage das Default Attribut in diesem Dokument.
1208     const SfxPoolItem& GetDefault( sal_uInt16 nFmtHint ) const;
1209     // TextAttribute nicht mehr aufspannen lassen
1210     sal_Bool DontExpandFmt( const SwPosition& rPos, sal_Bool bFlag = sal_True );
1211 
1212     /* Formate */
1213     const SwFrmFmts* GetFrmFmts() const     { return pFrmFmtTbl; }
1214           SwFrmFmts* GetFrmFmts()           { return pFrmFmtTbl; }
1215     const SwCharFmts* GetCharFmts() const   { return pCharFmtTbl;}
1216 
1217     /* LayoutFormate (Rahmen, DrawObjecte), mal const mal nicht */
1218     const SwSpzFrmFmts* GetSpzFrmFmts() const   { return pSpzFrmFmtTbl; }
1219           SwSpzFrmFmts* GetSpzFrmFmts()         { return pSpzFrmFmtTbl; }
1220 
1221     const SwFrmFmt *GetDfltFrmFmt() const   { return pDfltFrmFmt; }
1222           SwFrmFmt *GetDfltFrmFmt()         { return pDfltFrmFmt; }
1223     const SwFrmFmt *GetEmptyPageFmt() const { return pEmptyPageFmt; }
1224           SwFrmFmt *GetEmptyPageFmt()       { return pEmptyPageFmt; }
1225     const SwFrmFmt *GetColumnContFmt() const{ return pColumnContFmt; }
1226           SwFrmFmt *GetColumnContFmt()      { return pColumnContFmt; }
1227     const SwCharFmt *GetDfltCharFmt() const { return pDfltCharFmt;}
1228           SwCharFmt *GetDfltCharFmt()       { return pDfltCharFmt;}
1229 
1230     // Returns the interface of the management of (auto)styles
1231     IStyleAccess& GetIStyleAccess() { return *pStyleAccess; }
1232 
1233     // Remove all language dependencies from all existing formats
1234     void RemoveAllFmtLanguageDependencies();
1235 
1236     SwFrmFmt  *MakeFrmFmt(const String &rFmtName, SwFrmFmt *pDerivedFrom,
1237                           sal_Bool bBroadcast = sal_False, sal_Bool bAuto = sal_True);
1238     void       DelFrmFmt( SwFrmFmt *pFmt, sal_Bool bBroadcast = sal_False );
1239     SwFrmFmt* FindFrmFmtByName( const String& rName ) const
1240         {   return (SwFrmFmt*)FindFmtByName( (SvPtrarr&)*pFrmFmtTbl, rName ); }
1241 
1242     // --> OD 2005-01-13 #i40550#
1243     SwCharFmt *MakeCharFmt(const String &rFmtName, SwCharFmt *pDerivedFrom,
1244                            sal_Bool bBroadcast = sal_False,
1245                            sal_Bool bAuto = sal_True );
1246     // <--
1247     void       DelCharFmt(sal_uInt16 nFmt, sal_Bool bBroadcast = sal_False);
1248     void       DelCharFmt(SwCharFmt* pFmt, sal_Bool bBroadcast = sal_False);
1249     SwCharFmt* FindCharFmtByName( const String& rName ) const
1250         {   return (SwCharFmt*)FindFmtByName( (SvPtrarr&)*pCharFmtTbl, rName ); }
1251 
1252     /* Formatcollections (Vorlagen) */
1253     // TXT
1254     const SwTxtFmtColl* GetDfltTxtFmtColl() const { return pDfltTxtFmtColl; }
1255     const SwTxtFmtColls *GetTxtFmtColls() const { return pTxtFmtCollTbl; }
1256     // --> OD 2005-01-13 #i40550#
1257     SwTxtFmtColl *MakeTxtFmtColl( const String &rFmtName,
1258                                   SwTxtFmtColl *pDerivedFrom,
1259                                   sal_Bool bBroadcast = sal_False,
1260                                   sal_Bool bAuto = sal_True );
1261     // <--
1262     SwConditionTxtFmtColl* MakeCondTxtFmtColl( const String &rFmtName,
1263                                                SwTxtFmtColl *pDerivedFrom,
1264                                                sal_Bool bBroadcast = sal_False);
1265     void DelTxtFmtColl(sal_uInt16 nFmt, sal_Bool bBroadcast = sal_False);
1266     void DelTxtFmtColl( SwTxtFmtColl* pColl, sal_Bool bBroadcast = sal_False );
1267     // --> OD 2007-11-06 #i62675#
1268     // Add 4th optional parameter <bResetListAttrs>.
1269     // 'side effect' of <SetTxtFmtColl> with <bReset = true> is that the hard
1270     // attributes of the affected text nodes are cleared, except the break
1271     // attribute, the page description attribute and the list style attribute.
1272     // The new parameter <bResetListAttrs> indicates, if the list attributes
1273     // (list style, restart at and restart with) are cleared as well in case
1274     // that <bReset = true> and the paragraph style has a list style attribute set.
1275     sal_Bool SetTxtFmtColl( const SwPaM &rRg, SwTxtFmtColl *pFmt,
1276                             bool bReset = true,
1277                             bool bResetListAttrs = false );
1278     // <--
1279     SwTxtFmtColl* FindTxtFmtCollByName( const String& rName ) const
1280         {   return (SwTxtFmtColl*)FindFmtByName( (SvPtrarr&)*pTxtFmtCollTbl, rName ); }
1281 
1282     void ChkCondColls();
1283 
1284         // GRF
1285     const SwGrfFmtColl* GetDfltGrfFmtColl() const   { return pDfltGrfFmtColl; }
1286     const SwGrfFmtColls *GetGrfFmtColls() const     { return pGrfFmtCollTbl; }
1287     SwGrfFmtColl *MakeGrfFmtColl(const String &rFmtName,
1288                                     SwGrfFmtColl *pDerivedFrom);
1289     SwGrfFmtColl* FindGrfFmtCollByName( const String& rName ) const
1290         {   return (SwGrfFmtColl*)FindFmtByName( (SvPtrarr&)*pGrfFmtCollTbl, rName ); }
1291 
1292         // Tabellen-Formate
1293     const SwFrmFmts* GetTblFrmFmts() const  { return pTblFrmFmtTbl; }
1294           SwFrmFmts* GetTblFrmFmts()        { return pTblFrmFmtTbl; }
1295     sal_uInt16 GetTblFrmFmtCount( sal_Bool bUsed ) const;
1296     SwFrmFmt& GetTblFrmFmt(sal_uInt16 nFmt, sal_Bool bUsed ) const;
1297     SwTableFmt* MakeTblFrmFmt(const String &rFmtName, SwFrmFmt *pDerivedFrom);
1298     void        DelTblFrmFmt( SwTableFmt* pFmt );
1299     SwTableFmt* FindTblFmtByName( const String& rName, sal_Bool bAll = sal_False ) const;
1300 
1301     //Rahmenzugriff
1302     //iterieren ueber Flys - fuer Basic-Collections
1303     sal_uInt16 GetFlyCount( FlyCntType eType = FLYCNTTYPE_ALL) const;
1304     SwFrmFmt* GetFlyNum(sal_uInt16 nIdx, FlyCntType eType = FLYCNTTYPE_ALL);
1305 
1306 
1307     // kopiere die Formate in die eigenen Arrays und returne diese
1308     SwFrmFmt  *CopyFrmFmt ( const SwFrmFmt& );
1309     SwCharFmt *CopyCharFmt( const SwCharFmt& );
1310     SwTxtFmtColl* CopyTxtColl( const SwTxtFmtColl& rColl );
1311     SwGrfFmtColl* CopyGrfColl( const SwGrfFmtColl& rColl );
1312 
1313         // ersetze alle Formate mit denen aus rSource
1314     void ReplaceStyles( SwDoc& rSource );
1315 
1316     // erfrage ob die Absatz-/Zeichen-/Rahmen-/Seiten - Vorlage benutzt wird
1317     sal_Bool IsUsed( const SwModify& ) const;
1318     sal_Bool IsUsed( const SwNumRule& ) const;
1319 
1320         // setze den Namen der neu geladenen Dokument-Vorlage
1321     sal_uInt16 SetDocPattern( const String& rPatternName );
1322         // gebe den Dok-VorlagenNamen zurueck. !!! Kann auch 0 sein !!!
1323     String* GetDocPattern( sal_uInt16 nPos ) const { return aPatternNms[nPos]; }
1324 
1325         // Loesche alle nicht referenzierten FeldTypen
1326     void GCFieldTypes();                // impl. in docfld.cxx
1327 
1328         // akt. Dokument mit Textbausteindokument verbinden/erfragen
1329     void SetGlossaryDoc( SwDoc* pDoc ) { pGlossaryDoc = pDoc; }
1330 
1331     // travel over PaM Ring
1332     sal_Bool InsertGlossary( SwTextBlocks& rBlock, const String& rEntry,
1333                         SwPaM& rPaM, SwCrsrShell* pShell = 0);
1334 
1335     // get the set of printable pages for the XRenderable API by
1336     // evaluating the respective settings (see implementation)
1337     void CalculatePagesForPrinting( const SwRootFrm& rLayout, SwRenderData &rData, const SwPrintUIOptions &rOptions, bool bIsPDFExport,
1338             sal_Int32 nDocPageCount );
1339     void UpdatePagesForPrintingWithPostItData( SwRenderData &rData, const SwPrintUIOptions &rOptions, bool bIsPDFExport,
1340             sal_Int32 nDocPageCount );
1341     void CalculatePagePairsForProspectPrinting( const SwRootFrm& rLayout, SwRenderData &rData, const SwPrintUIOptions &rOptions,
1342             sal_Int32 nDocPageCount );
1343 
1344         //PageDescriptor-Schnittstelle
1345     sal_uInt16 GetPageDescCnt() const { return aPageDescs.Count(); }
1346     const SwPageDesc& GetPageDesc( const sal_uInt16 i ) const { return *aPageDescs[i]; }
1347     SwPageDesc* FindPageDescByName( const String& rName,
1348                                     sal_uInt16* pPos = 0 ) const;
1349 
1350         // kopiere den gesamten PageDesc - ueber Dokumentgrenzen und "tief"!
1351         // optional kann das kopieren der PoolFmtId, -HlpId verhindert werden
1352     void CopyPageDesc( const SwPageDesc& rSrcDesc, SwPageDesc& rDstDesc,
1353                         sal_Bool bCopyPoolIds = sal_True );
1354 
1355         // kopiere die Kopzeile (mit dem Inhalt!) aus dem SrcFmt
1356         // ins DestFmt ( auch ueber Doc grenzen hinaus!)
1357     void CopyHeader( const SwFrmFmt& rSrcFmt, SwFrmFmt& rDestFmt )
1358         { CopyPageDescHeaderFooterImpl( true, rSrcFmt, rDestFmt ); }
1359         // kopiere die Fusszeile (mit dem Inhalt!) aus dem SrcFmt
1360         // ins DestFmt ( auch ueber Doc grenzen hinaus!)
1361     void CopyFooter( const SwFrmFmt& rSrcFmt, SwFrmFmt& rDestFmt )
1362         { CopyPageDescHeaderFooterImpl( false, rSrcFmt, rDestFmt ); }
1363 
1364         //fuer Reader
1365 
1366     SwPageDesc * GetPageDesc( const String & rName );
1367     SwPageDesc& _GetPageDesc( sal_uInt16 i ) const { return *aPageDescs[i]; }
1368     void ChgPageDesc( const String & rName, const SwPageDesc& );
1369     void ChgPageDesc( sal_uInt16 i, const SwPageDesc& );
1370     sal_Bool FindPageDesc( const String & rName, sal_uInt16 * pFound );
1371     // -> #116530#
1372     void DelPageDesc( const String & rName, sal_Bool bBroadcast = sal_False);
1373     void DelPageDesc( sal_uInt16 i, sal_Bool bBroadcast = sal_False );
1374     // <- #116530#
1375     void PreDelPageDesc(SwPageDesc * pDel); // #i7983#
1376     // -> #116530#
1377     sal_uInt16 MakePageDesc( const String &rName, const SwPageDesc* pCpy = 0,
1378                              sal_Bool bRegardLanguage = sal_True,
1379                              sal_Bool bBroadcast = sal_False);
1380     void BroadcastStyleOperation(String rName, SfxStyleFamily eFamily,
1381                                  sal_uInt16 nOp);
1382     // <- #116530#
1383 
1384 
1385     // --> FME 2005-03-16 #i44963# The html import sometimes overwrites the
1386     // page sizes set in the page descriptions. This function is used to
1387     // correct this.
1388     void CheckDefaultPageFmt();
1389     // <--
1390 
1391         // Methoden fuer die Verzeichnisse:
1392         // - Verzeichnismarke einfuegen loeschen travel
1393     sal_uInt16 GetCurTOXMark( const SwPosition& rPos, SwTOXMarks& ) const;
1394     void DeleteTOXMark( const SwTOXMark* pTOXMark );
1395     const SwTOXMark& GotoTOXMark( const SwTOXMark& rCurTOXMark,
1396                                 SwTOXSearch eDir, sal_Bool bInReadOnly );
1397 
1398         // - Verzeichnis einfuegen, und bei Bedarf erneuern
1399     const SwTOXBaseSection* InsertTableOf( const SwPosition& rPos,
1400                                             const SwTOXBase& rTOX,
1401                                             const SfxItemSet* pSet = 0,
1402                                             sal_Bool bExpand = sal_False );
1403     const SwTOXBaseSection* InsertTableOf( sal_uLong nSttNd, sal_uLong nEndNd,
1404                                             const SwTOXBase& rTOX,
1405                                             const SfxItemSet* pSet = 0                                          );
1406     const SwTOXBase* GetCurTOX( const SwPosition& rPos ) const;
1407     const SwAttrSet& GetTOXBaseAttrSet(const SwTOXBase& rTOX) const;
1408 
1409     sal_Bool DeleteTOX( const SwTOXBase& rTOXBase, sal_Bool bDelNodes = sal_False );
1410     String GetUniqueTOXBaseName( const SwTOXType& rType,
1411                                 const String* pChkStr = 0 ) const;
1412 
1413     sal_Bool SetTOXBaseName(const SwTOXBase& rTOXBase, const String& rName);
1414     void SetTOXBaseProtection(const SwTOXBase& rTOXBase, sal_Bool bProtect);
1415 
1416     // nach einlesen einer Datei alle Verzeichnisse updaten
1417     void SetUpdateTOX( bool bFlag = true )     { mbUpdateTOX = bFlag; }
1418     bool IsUpdateTOX() const                   { return mbUpdateTOX; }
1419 
1420     const String&   GetTOIAutoMarkURL() const {return sTOIAutoMarkURL;}
1421     void            SetTOIAutoMarkURL(const String& rSet)  {sTOIAutoMarkURL = rSet;}
1422     void            ApplyAutoMark();
1423 
1424     bool IsInReading() const                    { return mbInReading; }
1425     void SetInReading( bool bNew )              { mbInReading = bNew; }
1426 
1427     bool IsClipBoard() const                    { return mbClipBoard; }
1428     // N.B.: must be called right after constructor! (@see GetXmlIdRegistry)
1429     void SetClipBoard( bool bNew )              { mbClipBoard = bNew; }
1430 
1431     bool IsColumnSelection() const              { return mbColumnSelection; }
1432     void SetColumnSelection( bool bNew )        { mbColumnSelection = bNew; }
1433 
1434     bool IsInXMLImport() const { return mbInXMLImport; }
1435     void SetInXMLImport( bool bNew ) { mbInXMLImport = bNew; }
1436 
1437     // - Verzeichnis-Typen verwalten
1438     sal_uInt16 GetTOXTypeCount( TOXTypes eTyp ) const;
1439     const SwTOXType* GetTOXType( TOXTypes eTyp, sal_uInt16 nId ) const;
1440     sal_Bool DeleteTOXType( TOXTypes eTyp, sal_uInt16 nId );
1441     const SwTOXType* InsertTOXType( const SwTOXType& rTyp );
1442     const SwTOXTypes& GetTOXTypes() const { return *pTOXTypes; }
1443 
1444     const SwTOXBase*    GetDefaultTOXBase( TOXTypes eTyp, sal_Bool bCreate = sal_False );
1445     void                SetDefaultTOXBase(const SwTOXBase& rBase);
1446 
1447     // - Schluessel fuer die Indexverwaltung
1448     sal_uInt16 GetTOIKeys( SwTOIKeyType eTyp, SvStringsSort& rArr ) const;
1449 
1450     // Sortieren Tabellen Text
1451     sal_Bool SortTbl(const SwSelBoxes& rBoxes, const SwSortOptions&);
1452     sal_Bool SortText(const SwPaM&, const SwSortOptions&);
1453 
1454         // korrigiere die im Dokument angemeldeten SwPosition-Objecte,
1455         // wie z.B. die ::com::sun::star::text::Bookmarks oder die Verzeichnisse.
1456         // JP 22.06.95: ist bMoveCrsr gesetzt, verschiebe auch die Crsr
1457 
1458         // Setzt alles in rOldNode auf rNewPos + Offset
1459     void CorrAbs( const SwNodeIndex& rOldNode, const SwPosition& rNewPos,
1460                     const xub_StrLen nOffset = 0, sal_Bool bMoveCrsr = sal_False );
1461         // Setzt alles im Bereich von [rStartNode, rEndNode] nach rNewPos
1462     void CorrAbs( const SwNodeIndex& rStartNode, const SwNodeIndex& rEndNode,
1463                     const SwPosition& rNewPos, sal_Bool bMoveCrsr = sal_False );
1464         // Setzt alles im Bereich von rRange nach rNewPos
1465     void CorrAbs( const SwPaM& rRange, const SwPosition& rNewPos,
1466                     sal_Bool bMoveCrsr = sal_False );
1467         // Setzt alles in rOldNode auf relative Pos
1468     void CorrRel( const SwNodeIndex& rOldNode, const SwPosition& rNewPos,
1469                     const xub_StrLen nOffset = 0, sal_Bool bMoveCrsr = sal_False );
1470 
1471         // GliederungsRegeln erfragen / setzen
1472     // --> OD 2005-11-02 #i51089 - TUNING#
1473     inline SwNumRule* GetOutlineNumRule() const
1474     {
1475         return pOutlineRule;
1476     }
1477     // <--
1478     void SetOutlineNumRule( const SwNumRule& rRule );
1479     void PropagateOutlineRule();
1480 
1481     // Gliederung - hoch-/runterstufen
1482     sal_Bool OutlineUpDown( const SwPaM& rPam, short nOffset = 1 );
1483     // Gliederung - hoch-/runtermoven
1484     sal_Bool MoveOutlinePara( const SwPaM& rPam, short nOffset = 1);
1485         // zu diesem Gliederungspunkt
1486     sal_Bool GotoOutline( SwPosition& rPos, const String& rName ) const;
1487     // die Aenderungen an den Gliederungsvorlagen in die OutlineRule uebernehmen
1488 
1489         // setzt, wenn noch keine Numerierung, sonst wird geaendert
1490         // arbeitet mit alten und neuen Regeln, nur Differenzen aktualisieren
1491     // --> OD 2005-02-18 #i42921# - re-use unused 3rd parameter
1492     // --> OD 2008-02-08 #newlistlevelattrs#
1493     // Add optional parameter <bResetIndentAttrs> - default value sal_False.
1494     // If <bResetIndentAttrs> equals true, the indent attributes "before text"
1495     // and "first line indent" are additionally reset at the provided PaM, if
1496     // the list style makes use of the new list level attributes.
1497     // --> OD 2008-03-17 #refactorlists#
1498     // introduce parameters <bCreateNewList> and <sContinuedListId>
1499     // <bCreateNewList> indicates, if a new list is created by applying the
1500     // given list style.
1501     void SetNumRule( const SwPaM&,
1502                      const SwNumRule&,
1503                      const bool bCreateNewList,
1504                      const String sContinuedListId = String(),
1505                      sal_Bool bSetItem = sal_True,
1506                      const bool bResetIndentAttrs = false );
1507     // <--
1508     void SetCounted( const SwPaM&, bool bCounted);
1509 
1510     // --> OD 2009-08-25 #i86492#
1511     // no longer needed.
1512     // SwDoc::SetNumRule( rPaM, rNumRule, false, <ListId>, sal_True, true ) have to be used instead.
1513 //    /**
1514 //       Replace numbering rules in a PaM by another numbering rule.
1515 
1516 //       \param rPaM         PaM to replace the numbering rules in
1517 //       \param rNumRule     numbering rule to replace the present numbering rules
1518 //     */
1519 //    void ReplaceNumRule(const SwPaM & rPaM, const SwNumRule & rNumRule);
1520 
1521     void MakeUniqueNumRules(const SwPaM & rPaM);
1522 
1523     void SetNumRuleStart( const SwPosition& rPos, sal_Bool bFlag = sal_True );
1524     void SetNodeNumStart( const SwPosition& rPos, sal_uInt16 nStt );
1525 
1526     SwNumRule* GetCurrNumRule( const SwPosition& rPos ) const;
1527 
1528     const SwNumRuleTbl& GetNumRuleTbl() const { return *pNumRuleTbl; }
1529 
1530     // #i36749#
1531     /**
1532        Add numbering rule to document.
1533 
1534        @param pRule    rule to add
1535     */
1536     void AddNumRule(SwNumRule * pRule);
1537 
1538     // --> OD 2008-02-11 #newlistlevelattrs#
1539     // add optional parameter <eDefaultNumberFormatPositionAndSpaceMode>
1540     sal_uInt16 MakeNumRule( const String &rName,
1541         const SwNumRule* pCpy = 0,
1542         sal_Bool bBroadcast = sal_False,
1543         const SvxNumberFormat::SvxNumPositionAndSpaceMode eDefaultNumberFormatPositionAndSpaceMode =
1544             SvxNumberFormat::LABEL_WIDTH_AND_POSITION );
1545     // <--
1546     sal_uInt16 FindNumRule( const String& rName ) const;
1547     SwNumRule* FindNumRulePtr( const String& rName ) const;
1548 
1549     // loeschen geht nur, wenn die ::com::sun::star::chaos::Rule niemand benutzt!
1550     // #106897#
1551     sal_Bool RenameNumRule(const String & aOldName, const String & aNewName,
1552                            sal_Bool bBroadcast = sal_False);
1553     sal_Bool DelNumRule( const String& rName, sal_Bool bBroadCast = sal_False );
1554     String GetUniqueNumRuleName( const String* pChkStr = 0, sal_Bool bAutoNum = sal_True ) const;
1555 
1556     void UpdateNumRule();   // alle invaliden Updaten
1557     // #106897#
1558     void ChgNumRuleFmts( const SwNumRule& rRule, const String * pOldName = 0 );
1559     sal_Bool ReplaceNumRule( const SwPosition& rPos, const String& rOldRule,
1560                         const String& rNewRule );
1561 
1562         // zum naechsten/vorhergehenden Punkt auf gleicher Ebene
1563     sal_Bool GotoNextNum( SwPosition&, sal_Bool bOverUpper = sal_True,
1564                         sal_uInt8* pUpper = 0, sal_uInt8* pLower = 0 );
1565     sal_Bool GotoPrevNum( SwPosition&, sal_Bool bOverUpper = sal_True,
1566                         sal_uInt8* pUpper = 0, sal_uInt8* pLower = 0 );
1567 
1568     // #i23731#
1569     /** Searches for a text node with a numbering rule.
1570 
1571        OD 2005-10-24 #i55391# - add optional parameter <bInvestigateStartNode>
1572        OD 2008-03-18 #refactorlists# - add output parameter <sListId>
1573 
1574        \param rPos         position to start search
1575        \param bForward     - sal_True:  search forward
1576                            - sal_False: search backward
1577        \param bNum         - sal_True:  search for enumeration
1578                            - sal_False: search for itemize
1579        \param bOutline     - sal_True:  search for outline numbering rule
1580                            - sal_False: search for non-outline numbering rule
1581        \param nNonEmptyAllowed   number of non-empty paragraphs allowed between
1582                                  rPos and found paragraph
1583 
1584         @param sListId
1585         output parameter - in case a list style is found, <sListId> holds the
1586         list id, to which the text node belongs, which applies the found list style.
1587 
1588         @param bInvestigateStartNode
1589         input parameter - boolean, indicating, if start node, determined by given
1590         start position has to be investigated or not.
1591      */
1592     const SwNumRule * SearchNumRule(const SwPosition & rPos,
1593                                     const bool bForward,
1594                                     const bool bNum,
1595                                     const bool bOutline,
1596                                     int nNonEmptyAllowed,
1597                                     String& sListId,
1598                                     const bool bInvestigateStartNode = false );
1599 
1600         // Absaetze ohne Numerierung, aber mit Einzuegen
1601     sal_Bool NoNum( const SwPaM& );
1602         // Loeschen, Splitten der Aufzaehlungsliste
1603     void DelNumRules( const SwPaM& );
1604 
1605     // Invalidates all numrules
1606     void InvalidateNumRules();
1607 
1608         // Hoch-/Runterstufen
1609     sal_Bool NumUpDown( const SwPaM&, sal_Bool bDown = sal_True );
1610         // Bewegt selektierte Absaetze (nicht nur Numerierungen)
1611         // entsprechend des Offsets. (negativ: zum Doc-Anf.)
1612     sal_Bool MoveParagraph( const SwPaM&, long nOffset = 1, sal_Bool bIsOutlMv = sal_False );
1613         // No-/Numerierung ueber Delete/Backspace ein/abschalten #115901#
1614     sal_Bool NumOrNoNum( const SwNodeIndex& rIdx, sal_Bool bDel = sal_False);
1615         // Animation der Grafiken stoppen
1616     void StopNumRuleAnimations( OutputDevice* );
1617 
1618         // fuege eine neue Tabelle auf der Position rPos ein. (es
1619         // wird vor dem Node eingefuegt !!)
1620         //JP 28.10.96:
1621         //  fuer AutoFormat bei der Eingabe: dann muessen die Spalten
1622         //  auf die vordefinierten Breite gesetzt werden. Im Array stehen die
1623         //  Positionen der Spalten!! (nicht deren Breite!)
1624     /* #109161# new parameter bCalledFromShell:
1625 
1626        sal_True: called from shell -> propagate existing adjust item at
1627        rPos to every new cell. A existing adjust item in the table
1628        heading or table contents paragraph style prevent that
1629        propagation.
1630 
1631        sal_False: do not propagate
1632     */
1633     const SwTable* InsertTable( const SwInsertTableOptions& rInsTblOpts,  // HEADLINE_NO_BORDER
1634                                 const SwPosition& rPos, sal_uInt16 nRows,
1635                                 sal_uInt16 nCols, short eAdjust,
1636                                 const SwTableAutoFmt* pTAFmt = 0,
1637                                 const SvUShorts* pColArr = 0,
1638                                 sal_Bool bCalledFromShell = sal_False,
1639                                 sal_Bool bNewModel = sal_True );
1640 
1641     // steht der Index in einer Tabelle, dann returne den TableNode sonst 0
1642                  SwTableNode* IsIdxInTbl( const SwNodeIndex& rIdx );
1643     inline const SwTableNode* IsIdxInTbl( const SwNodeIndex& rIdx ) const;
1644 
1645         // erzeuge aus dem makierten Bereich eine ausgeglichene Tabelle
1646     const SwTable* TextToTable( const SwInsertTableOptions& rInsTblOpts, // HEADLINE_NO_BORDER,
1647                                 const SwPaM& rRange, sal_Unicode cCh,
1648                                 short eAdjust,
1649                                 const SwTableAutoFmt* = 0 );
1650     // text to table conversion - API support
1651     const SwTable* TextToTable( const std::vector< std::vector<SwNodeRange> >& rTableNodes );
1652         // erzeuge aus der Tabelle wieder normalen Text
1653     sal_Bool TableToText( const SwTableNode* pTblNd, sal_Unicode cCh );
1654         // einfuegen von Spalten/Zeilen in der Tabelle
1655     sal_Bool InsertCol( const SwCursor& rCursor,
1656                     sal_uInt16 nCnt = 1, sal_Bool bBehind = sal_True );
1657     sal_Bool InsertCol( const SwSelBoxes& rBoxes,
1658                     sal_uInt16 nCnt = 1, sal_Bool bBehind = sal_True );
1659     sal_Bool InsertRow( const SwCursor& rCursor,
1660                     sal_uInt16 nCnt = 1, sal_Bool bBehind = sal_True );
1661     sal_Bool InsertRow( const SwSelBoxes& rBoxes,
1662                     sal_uInt16 nCnt = 1, sal_Bool bBehind = sal_True );
1663         // loeschen von Spalten/Zeilen in der Tabelle
1664     sal_Bool DeleteRowCol( const SwSelBoxes& rBoxes, bool bColumn = false );
1665     sal_Bool DeleteRow( const SwCursor& rCursor );
1666     sal_Bool DeleteCol( const SwCursor& rCursor );
1667         // teilen / zusammenfassen von Boxen in der Tabelle
1668     sal_Bool SplitTbl( const SwSelBoxes& rBoxes, sal_Bool bVert = sal_True,
1669                        sal_uInt16 nCnt = 1, sal_Bool bSameHeight = sal_False );
1670         // returnt den enum TableMergeErr
1671     sal_uInt16 MergeTbl( SwPaM& rPam );
1672     String GetUniqueTblName() const;
1673     sal_Bool IsInsTblFormatNum() const;
1674     sal_Bool IsInsTblChangeNumFormat() const;
1675     sal_Bool IsInsTblAlignNum() const;
1676 
1677         // aus der FEShell wg.. Undo und bModified
1678     void GetTabCols( SwTabCols &rFill, const SwCursor* pCrsr,
1679                     const SwCellFrm* pBoxFrm = 0 ) const;
1680     void SetTabCols( const SwTabCols &rNew, sal_Bool bCurRowOnly,
1681                     const SwCursor* pCrsr, const SwCellFrm* pBoxFrm = 0 );
1682     void GetTabRows( SwTabCols &rFill, const SwCursor* pCrsr,
1683                     const SwCellFrm* pBoxFrm = 0 ) const;
1684     void SetTabRows( const SwTabCols &rNew, sal_Bool bCurColOnly, const SwCursor* pCrsr,
1685                      const SwCellFrm* pBoxFrm = 0 );
1686 
1687 
1688     // Direktzugriff fuer Uno
1689     void SetTabCols(SwTable& rTab, const SwTabCols &rNew, const SwTabCols &rOld,
1690                                     const SwTableBox *pStart, sal_Bool bCurRowOnly);
1691 
1692     void SetRowsToRepeat( SwTable &rTable, sal_uInt16 nSet );
1693 
1694         // AutoFormat fuer die Tabelle/TabellenSelection
1695     sal_Bool SetTableAutoFmt( const SwSelBoxes& rBoxes, const SwTableAutoFmt& rNew );
1696         // Erfrage wie attributiert ist
1697     sal_Bool GetTableAutoFmt( const SwSelBoxes& rBoxes, SwTableAutoFmt& rGet );
1698         // setze das InsertDB als Tabelle Undo auf:
1699     void AppendUndoForInsertFromDB( const SwPaM& rPam, sal_Bool bIsTable );
1700         // setze die Spalten/Zeilen/ZTellen Breite/Hoehe
1701     sal_Bool SetColRowWidthHeight( SwTableBox& rAktBox, sal_uInt16 eType,
1702                                 SwTwips nAbsDiff, SwTwips nRelDiff );
1703     SwTableBoxFmt* MakeTableBoxFmt();
1704     SwTableLineFmt* MakeTableLineFmt();
1705     // teste ob die Box ein numerischen Wert darstellt und aender dann ggfs.
1706     // das Format der Box
1707     void ChkBoxNumFmt( SwTableBox& rAktBox, sal_Bool bCallUpdate );
1708     void SetTblBoxFormulaAttrs( SwTableBox& rBox, const SfxItemSet& rSet );
1709     void ClearBoxNumAttrs( const SwNodeIndex& rNode );
1710 
1711     sal_Bool InsCopyOfTbl( SwPosition& rInsPos, const SwSelBoxes& rBoxes,
1712                         const SwTable* pCpyTbl = 0, sal_Bool bCpyName = sal_False,
1713                         sal_Bool bCorrPos = sal_False );
1714 
1715     sal_Bool UnProtectCells( const String& rTblName );
1716     sal_Bool UnProtectCells( const SwSelBoxes& rBoxes );
1717     sal_Bool UnProtectTbls( const SwPaM& rPam );
1718     sal_Bool HasTblAnyProtection( const SwPosition* pPos,
1719                               const String* pTblName = 0,
1720                               sal_Bool* pFullTblProtection = 0 );
1721 
1722     // Tabelle an der Position in der GrundLine aufsplitten, sprich eine
1723     // neue Tabelle erzeugen.
1724     sal_Bool SplitTable( const SwPosition& rPos, sal_uInt16 eMode = 0,
1725                         sal_Bool bCalcNewSize = sal_False );
1726     // und die Umkehrung davon. rPos muss in der Tabelle stehen, die bestehen
1727     // bleibt. Das Flag besagt ob die aktuelle mit der davor oder dahinter
1728     // stehenden vereint wird.
1729     sal_Bool MergeTable( const SwPosition& rPos, sal_Bool bWithPrev = sal_True,
1730                         sal_uInt16 nMode = 0 );
1731 
1732     // Charts der angegebenen Tabelle zum Update bewegen
1733     void UpdateCharts( const String &rName ) const;
1734     // update all charts, for that exists any table
1735     void UpdateAllCharts()          { DoUpdateAllCharts( 0 ); }
1736     // Tabelle wird umbenannt und aktualisiert die Charts
1737     void SetTableName( SwFrmFmt& rTblFmt, const String &rNewName );
1738 
1739     // returne zum Namen die im Doc gesetzte Referenz
1740     const SwFmtRefMark* GetRefMark( const String& rName ) const;
1741     // returne die RefMark per Index - fuer Uno
1742     const SwFmtRefMark* GetRefMark( sal_uInt16 nIndex ) const;
1743     // returne die Namen aller im Doc gesetzten Referenzen.
1744     //  Ist der ArrayPointer 0 dann returne nur, ob im Doc. eine RefMark
1745     //  gesetzt ist
1746     sal_uInt16 GetRefMarks( SvStringsDtor* = 0 ) const;
1747 
1748     //Einfuegen einer Beschriftung - falls ein FlyFormat erzeugt wird, so
1749     // returne dieses.
1750     SwFlyFrmFmt* InsertLabel( const SwLabelType eType, const String &rTxt, const String& rSeparator,
1751                     const String& rNumberingSeparator,
1752                     const sal_Bool bBefore, const sal_uInt16 nId, const sal_uLong nIdx,
1753                     const String& rCharacterStyle,
1754                     const sal_Bool bCpyBrd = sal_True );
1755     SwFlyFrmFmt* InsertDrawLabel(
1756         const String &rTxt, const String& rSeparator, const String& rNumberSeparator,
1757         const sal_uInt16 nId, const String& rCharacterStyle, SdrObject& rObj );
1758 
1759     // erfrage den Attribut Pool
1760     const SwAttrPool& GetAttrPool() const   { return *mpAttrPool; }
1761           SwAttrPool& GetAttrPool()         { return *mpAttrPool; }
1762 
1763     // suche ueber das Layout eine EditShell und ggfs. eine ViewShell
1764     SwEditShell* GetEditShell( ViewShell** ppSh = 0 ) const;
1765     ::sw::IShellCursorSupplier * GetIShellCursorSupplier();
1766 
1767     // OLE 2.0-Benachrichtung
1768     inline       void  SetOle2Link(const Link& rLink) {aOle2Link = rLink;}
1769     inline const Link& GetOle2Link() const {return aOle2Link;}
1770 
1771     // insert section (the ODF kind of section, not the nodesarray kind)
1772     SwSection * InsertSwSection(SwPaM const& rRange, SwSectionData &,
1773             SwTOXBase const*const pTOXBase = 0,
1774             SfxItemSet const*const pAttr = 0, bool const bUpdate = true);
1775     sal_uInt16 IsInsRegionAvailable( const SwPaM& rRange,
1776                                 const SwNode** ppSttNd = 0 ) const;
1777     SwSection* GetCurrSection( const SwPosition& rPos ) const;
1778     SwSectionFmts& GetSections() { return *pSectionFmtTbl; }
1779     const SwSectionFmts& GetSections() const { return *pSectionFmtTbl; }
1780     SwSectionFmt *MakeSectionFmt( SwSectionFmt *pDerivedFrom );
1781     void DelSectionFmt( SwSectionFmt *pFmt, sal_Bool bDelNodes = sal_False );
1782     void UpdateSection(sal_uInt16 const nSect, SwSectionData &,
1783             SfxItemSet const*const = 0, bool const bPreventLinkUpdate = false);
1784     String GetUniqueSectionName( const String* pChkStr = 0 ) const;
1785 
1786     /* @@@MAINTAINABILITY-HORROR@@@
1787        The model should not have anything to do with a shell.
1788        Unnecessary compile/link time dependency.
1789     */
1790     // Pointer auf die SfxDocShell vom Doc, kann 0 sein !!!
1791           SwDocShell* GetDocShell()         { return pDocShell; }
1792     const SwDocShell* GetDocShell() const   { return pDocShell; }
1793     void SetDocShell( SwDocShell* pDSh );
1794 
1795     // in case during copying of embedded object a new shell is created,
1796     // it should be set here and cleaned later
1797     void SetTmpDocShell( SfxObjectShellLock rLock )    { xTmpDocShell = rLock; }
1798     SfxObjectShellLock GetTmpDocShell()    { return xTmpDocShell; }
1799 
1800     // fuer die TextBausteine - diese habe nur ein SvPersist zur
1801     // Verfuegung
1802     SfxObjectShell* GetPersist() const;
1803 
1804     // Pointer auf den Storage des SfxDocShells, kann 0 sein !!!
1805     ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage > GetDocStorage();
1806 
1807         // abfrage/setze Flag, ob das Dokument im asynchronen Laden ist
1808     bool IsInLoadAsynchron() const             { return mbInLoadAsynchron; }
1809     void SetInLoadAsynchron( bool bFlag )       { mbInLoadAsynchron = bFlag; }
1810 
1811     // erzeuge um das zu Servende Object eine Selektion
1812     sal_Bool SelectServerObj( const String& rStr, SwPaM*& rpPam,
1813                             SwNodeRange*& rpRange ) const;
1814 
1815     // fuer Drag&Move: ( z.B. RefMarks "verschieben" erlauben )
1816     bool IsCopyIsMove() const              { return mbCopyIsMove; }
1817     void SetCopyIsMove( bool bFlag )        { mbCopyIsMove = bFlag; }
1818 
1819     SwDrawContact* GroupSelection( SdrView& );
1820     void UnGroupSelection( SdrView& );
1821     sal_Bool DeleteSelection( SwDrawView& );
1822 
1823     // Invalidiert OnlineSpell-WrongListen
1824     void SpellItAgainSam( sal_Bool bInvalid, sal_Bool bOnlyWrong, sal_Bool bSmartTags );
1825     void InvalidateAutoCompleteFlag();
1826 
1827     // <--
1828     void SetCalcFieldValueHdl(Outliner* pOutliner);
1829 
1830     // erfrage ob die ::com::sun::star::util::URL besucht war. Uebers Doc, falls nur ein ::com::sun::star::text::Bookmark
1831     // angegeben ist. Dann muss der Doc. Name davor gesetzt werden!
1832     sal_Bool IsVisitedURL( const String& rURL ) const;
1833 
1834     // speicher die akt. Werte fuer die automatische Aufnahme von Ausnahmen
1835     // in die Autokorrektur
1836     void SetAutoCorrExceptWord( SwAutoCorrExceptWord* pNew );
1837     SwAutoCorrExceptWord* GetAutoCorrExceptWord()       { return pACEWord; }
1838 
1839     const SwFmtINetFmt* FindINetAttr( const String& rName ) const;
1840 
1841     // rufe ins dunkle Basic, mit evt. Return String
1842     sal_Bool ExecMacro( const SvxMacro& rMacro, String* pRet = 0, SbxArray* pArgs = 0 );
1843     // rufe ins dunkle Basic/JavaScript
1844     sal_uInt16 CallEvent( sal_uInt16 nEvent, const SwCallMouseEvent& rCallEvent,
1845                         sal_Bool bChkPtr = sal_False, SbxArray* pArgs = 0,
1846                         const Link* pCallBack = 0 );
1847 
1848     // linken Rand ueber Objectleiste einstellen (aenhlich dem Stufen von
1849     // Numerierungen), optional kann man "um" den Offset stufen oder "auf"
1850     // die Position gestuft werden (bModulus = sal_True)
1851     void MoveLeftMargin( const SwPaM& rPam, sal_Bool bRight = sal_True,
1852                         sal_Bool bModulus = sal_True );
1853 
1854     // Numberformatter erfragen
1855     inline       SvNumberFormatter* GetNumberFormatter( sal_Bool bCreate = sal_True );
1856     inline const SvNumberFormatter* GetNumberFormatter( sal_Bool bCreate = sal_True ) const;
1857 
1858     bool HasInvisibleContent() const;
1859     /// delete invisible content, like hidden sections and paragraphs
1860     bool RemoveInvisibleContent();
1861     /// restore the invisible content if it's available on the undo stack
1862     bool RestoreInvisibleContent();
1863     // replace fields by text - mailmerge support
1864     sal_Bool ConvertFieldsToText();
1865 
1866     // erzeuge Anhand der vorgebenen Collection Teildokumente
1867     // falls keine angegeben ist, nehme die Kapitelvorlage der 1. Ebene
1868     sal_Bool GenerateGlobalDoc( const String& rPath,
1869                                 const SwTxtFmtColl* pSplitColl = 0 );
1870     sal_Bool GenerateGlobalDoc( const String& rPath, int nOutlineLevel = 0 );   //#outline level,add by zhaojianwei
1871     sal_Bool GenerateHTMLDoc( const String& rPath,
1872                                 const SwTxtFmtColl* pSplitColl = 0 );
1873     sal_Bool GenerateHTMLDoc( const String& rPath, int nOutlineLevel = 0 ); //#outline level,add by zhaojianwei
1874 
1875     //  vergleiche zwei Dokument miteinander
1876     long CompareDoc( const SwDoc& rDoc );
1877     // merge zweier Dokumente
1878     long MergeDoc( const SwDoc& rDoc );
1879     // setze Kommentar-Text fuers Redline, das dann per AppendRedline
1880     // hereinkommt. Wird vom Autoformat benutzt. 0-Pointer setzt den Modus
1881     // wieder zurueck. Die SequenceNummer ist fuers UI-seitige zusammen-
1882     // fassen von Redlines.
1883     void SetAutoFmtRedlineComment( const String* pTxt, sal_uInt16 nSeqNo = 0 );
1884 
1885     bool IsAutoFmtRedline() const           { return mbIsAutoFmtRedline; }
1886     void SetAutoFmtRedline( bool bFlag )    { mbIsAutoFmtRedline = bFlag; }
1887 
1888     // fuer AutoFormat: mit Undo/Redlining - Behandlung
1889     void SetTxtFmtCollByAutoFmt( const SwPosition& rPos, sal_uInt16 nPoolId,
1890                                 const SfxItemSet* pSet = 0 );
1891     void SetFmtItemByAutoFmt( const SwPaM& rPam, const SfxItemSet& );
1892 
1893     // !!!NUR fuer die SW-Textblocks!! beachtet kein LAYOUT!!!
1894     void ClearDoc();        // loescht den gesamten Inhalt.
1895 
1896     // erfrage / setze die Daten fuer die PagePreView
1897     const SwPagePreViewPrtData* GetPreViewPrtData() const { return pPgPViewPrtData; }
1898     // wenn der Pointer == 0 ist, dann wird im Doc der Pointer zerstoert,
1899     // ansonsten wird das Object kopiert.
1900     // Der Pointer geht NICHT in den Besitz des Doc's!!
1901     void SetPreViewPrtData( const SwPagePreViewPrtData* pData );
1902 
1903     // update all modified OLE-Objects. The modification is called over the
1904     // StarOne - Interface              --> Bug 67026
1905     void SetOLEObjModified()
1906     {   if( GetCurrentViewShell() ) aOLEModifiedTimer.Start(); }    //swmod 071107//swmod 071225
1907 
1908     // -------------------- Uno - Schnittstellen ---------------------------
1909     const SwUnoCrsrTbl& GetUnoCrsrTbl() const       { return *pUnoCrsrTbl; }
1910     SwUnoCrsr* CreateUnoCrsr( const SwPosition& rPos, sal_Bool bTblCrsr = sal_False );
1911     // -------------------- Uno - Schnittstellen ---------------------------
1912 
1913     // -------------------- FeShell - Schnittstellen -----------------------
1914     // !!!!! diese gehen immer davon aus, das ein Layout existiert  !!!!
1915     sal_Bool ChgAnchor( const SdrMarkList& _rMrkList,
1916                         RndStdIds _eAnchorType,
1917                         const sal_Bool _bSameOnly,
1918                         const sal_Bool _bPosCorr );
1919 
1920     void SetRowHeight( const SwCursor& rCursor, const SwFmtFrmSize &rNew );
1921     void GetRowHeight( const SwCursor& rCursor, SwFmtFrmSize *& rpSz ) const;
1922     void SetRowSplit( const SwCursor& rCursor, const SwFmtRowSplit &rNew );
1923     void GetRowSplit( const SwCursor& rCursor, SwFmtRowSplit *& rpSz ) const;
1924     sal_Bool BalanceRowHeight( const SwCursor& rCursor, sal_Bool bTstOnly = sal_True );
1925     void SetRowBackground( const SwCursor& rCursor, const SvxBrushItem &rNew );
1926     sal_Bool GetRowBackground( const SwCursor& rCursor, SvxBrushItem &rToFill ) const;
1927     void SetTabBorders( const SwCursor& rCursor, const SfxItemSet& rSet );
1928     void SetTabLineStyle( const SwCursor& rCursor,
1929                           const Color* pColor, sal_Bool bSetLine,
1930                           const SvxBorderLine* pBorderLine );
1931     void GetTabBorders( const SwCursor& rCursor, SfxItemSet& rSet ) const;
1932     void SetBoxAttr( const SwCursor& rCursor, const SfxPoolItem &rNew );
1933     sal_Bool GetBoxAttr( const SwCursor& rCursor, SfxPoolItem &rToFill ) const;
1934     void SetBoxAlign( const SwCursor& rCursor, sal_uInt16 nAlign );
1935     sal_uInt16 GetBoxAlign( const SwCursor& rCursor ) const;
1936     void AdjustCellWidth( const SwCursor& rCursor, sal_Bool bBalance = sal_False );
1937 
1938     int Chainable( const SwFrmFmt &rSource, const SwFrmFmt &rDest );
1939     int Chain( SwFrmFmt &rSource, const SwFrmFmt &rDest );
1940     void Unchain( SwFrmFmt &rFmt );
1941 
1942     // fuers Copy/Move aus der FrmShell
1943     SdrObject* CloneSdrObj( const SdrObject&, sal_Bool bMoveWithinDoc = sal_False,
1944                             sal_Bool bInsInPage = sal_True );
1945 
1946     //
1947     // -------------------- FeShell - Schnittstellen Ende ------------------
1948 
1949 
1950     // Schnittstelle fuer die TextInputDaten - ( fuer die Texteingabe
1951     // von japanischen/chinesischen Zeichen)
1952     SwExtTextInput* CreateExtTextInput( const SwPaM& rPam );
1953     void DeleteExtTextInput( SwExtTextInput* pDel );
1954     SwExtTextInput* GetExtTextInput( const SwNode& rNd,
1955                                 xub_StrLen nCntntPos = STRING_NOTFOUND) const;
1956     SwExtTextInput* GetExtTextInput() const;
1957 
1958     // Schnistelle fuer den Zugriff auf die AutoComplete-Liste
1959     static SwAutoCompleteWord& GetAutoCompleteWords() { return *pACmpltWords; }
1960 
1961     bool ContainsMSVBasic() const          { return mbContains_MSVBasic; }
1962     void SetContainsMSVBasic( bool bFlag )  { mbContains_MSVBasic = bFlag; }
1963 
1964     // Interface for the list of Ruby - texts/attributes
1965     sal_uInt16 FillRubyList( const SwPaM& rPam, SwRubyList& rList,
1966                         sal_uInt16 nMode );
1967     sal_uInt16 SetRubyList( const SwPaM& rPam, const SwRubyList& rList,
1968                         sal_uInt16 nMode );
1969 
1970     void ReadLayoutCache( SvStream& rStream );
1971     void WriteLayoutCache( SvStream& rStream );
1972     SwLayoutCache* GetLayoutCache() const { return pLayoutCache; }
1973 
1974     /** Checks if any of the text node contains hidden characters.
1975         Used for optimization. Changing the view option 'view hidden text'
1976         has to trigger a reformatting only if some of the text is hidden.
1977     */
1978     bool ContainsHiddenChars() const;
1979 
1980     // call back for API wrapper
1981     SwModify*   GetUnoCallBack() const;
1982 
1983     IGrammarContact* getGrammarContact() const { return mpGrammarContact; }
1984 
1985     // -> #i27615#
1986     /** Marks/Unmarks a list level of a certain list
1987 
1988         OD 2008-04-02 #refactorlists#
1989         levels of a certain lists are marked now
1990 
1991         @param sListId    list Id of the list whose level has to be marked/unmarked
1992         @param nListLevel level to mark
1993         @param bValue     - sal_True  mark the level
1994                           - sal_False unmark the level
1995     */
1996     void MarkListLevel( const String& sListId,
1997                         const int nListLevel,
1998                         const sal_Bool bValue );
1999 
2000     /** Marks/Unmarks a list level of a certain list
2001 
2002         OD 2008-04-02 #refactorlists#
2003         levels of a certain lists are marked now
2004 
2005         @param rList      list whose level has to be marked/unmarked
2006         @param nListLevel level to mark
2007         @param bValue     - sal_True  mark the level
2008                           - sal_False unmark the level
2009      */
2010     void MarkListLevel( SwList& rList,
2011                         const int nListLevel,
2012                         const sal_Bool bValue );
2013     // <- #i27615#
2014 
2015     // Change a format undoable.
2016     void ChgFmt(SwFmt & rFmt, const SfxItemSet & rSet);
2017 
2018     void RenameFmt(SwFmt & rFmt, const String & sNewName,
2019                    sal_Bool bBroadcast = sal_False);
2020 
2021     // Change a TOX undoable.
2022     void ChgTOX(SwTOXBase & rTOX, const SwTOXBase & rNew);
2023 
2024     // #111827#
2025     /**
2026        Returns a textual description of a PaM.
2027 
2028        @param rPaM     the PaM to describe
2029 
2030        If rPaM only spans one paragraph the result is:
2031 
2032             '<text in the PaM>'
2033 
2034        <text in the PaM> is shortened to nUndoStringLength characters.
2035 
2036        If rPaM spans more than one paragraph the result is:
2037 
2038             paragraphs                               (STR_PARAGRAPHS)
2039 
2040        @return the textual description of rPaM
2041      */
2042     String GetPaMDescr(const SwPaM & rPaM) const;
2043 
2044     // -> #i23726#
2045     sal_Bool IsFirstOfNumRule(SwPosition & rPos);
2046     // <- #i23726#
2047 
2048     // --> #i31958# access methods for XForms model(s)
2049 
2050     /// access container for XForms model; will be NULL if !isXForms()
2051     com::sun::star::uno::Reference<com::sun::star::container::XNameContainer>
2052         getXForms() const;
2053 
2054     com::sun::star::uno::Reference< com::sun::star::linguistic2::XProofreadingIterator > GetGCIterator() const;
2055 
2056     /// is this an XForms document?
2057     bool isXForms() const;
2058 
2059     /// initialize XForms models; turn this into an XForms document
2060     void initXForms( bool bCreateDefaultModel );
2061     // <-- #i31958# access methods for XForms model(s)
2062 
2063     // --> OD 2006-03-21 #b6375613#
2064     inline bool ApplyWorkaroundForB6375613() const
2065     {
2066         return mbApplyWorkaroundForB6375613;
2067     }
2068     void SetApplyWorkaroundForB6375613( bool p_bApplyWorkaroundForB6375613 );
2069     // <--
2070 
2071     //Update all the page masters
2072     void SetDefaultPageMode(bool bSquaredPageMode);
2073     sal_Bool IsSquaredPageMode() const;
2074 
2075     // i#78591#
2076     void Setn32DummyCompatabilityOptions1( sal_uInt32 CompatabilityOptions1 )
2077     {
2078         n32DummyCompatabilityOptions1 = CompatabilityOptions1;
2079     }
2080     sal_uInt32 Getn32DummyCompatabilityOptions1( )
2081     {
2082         return n32DummyCompatabilityOptions1;
2083     }
2084     void Setn32DummyCompatabilityOptions2( sal_uInt32 CompatabilityOptions2 )
2085     {
2086         n32DummyCompatabilityOptions2 = CompatabilityOptions2;
2087     }
2088     sal_uInt32 Getn32DummyCompatabilityOptions2( )
2089     {
2090         return n32DummyCompatabilityOptions2;
2091     }
2092 #ifdef FUTURE_VBA
2093     com::sun::star::uno::Reference< com::sun::star::script::vba::XVBAEventProcessor > GetVbaEventProcessor();
2094 #endif
2095     ::sfx2::IXmlIdRegistry& GetXmlIdRegistry();
2096     ::sw::MetaFieldManager & GetMetaFieldManager();
2097     ::sw::UndoManager      & GetUndoManager();
2098     ::sw::UndoManager const& GetUndoManager() const;
2099     SfxObjectShell* CreateCopy(bool bCallInitNew) const;
2100 
2101     /// must be called only in SwDocShell::InitNew, causes UpdateDrawDefaults to be called when drawing layer is created
2102     void SetDrawDefaults();
2103 
2104 private:
2105     /// method to set new graphics pool defaults, must only be called by SetDrawDefaults!
2106     void UpdateDrawDefaults();
2107 };
2108 
2109 
2110 // Diese Methode wird im Dtor vom SwDoc gerufen und loescht den Cache
2111 // der Konturobjekte
2112 void ClrContourCache();
2113 
2114 
2115 //------------------ inline impl. ---------------------------------
2116 
2117 inline const SwTableNode* SwDoc::IsIdxInTbl( const SwNodeIndex& rIdx ) const
2118 {
2119     return ((SwDoc*)this)->IsIdxInTbl( rIdx );
2120 }
2121 
2122 inline SvNumberFormatter* SwDoc::GetNumberFormatter( sal_Bool bCreate )
2123 {
2124     if( bCreate && !pNumberFormatter )
2125         _CreateNumberFormatter();
2126     return pNumberFormatter;
2127 }
2128 
2129 inline const SvNumberFormatter* SwDoc::GetNumberFormatter( sal_Bool bCreate ) const
2130 {
2131     return ((SwDoc*)this)->GetNumberFormatter( bCreate );
2132 }
2133 
2134 inline void SwDoc::SetOLEPrtNotifyPending( bool bSet )
2135 {
2136     mbOLEPrtNotifyPending = bSet;
2137     if( !bSet )
2138         mbAllOLENotify = sal_False;
2139 }
2140 
2141 // --> OD 2006-03-14 #i62875#
2142 // namespace <docfunc> for functions and procedures working on a Writer document.
2143 namespace docfunc
2144 {
2145     /** method to check, if given Writer document contains at least one drawing object
2146 
2147         OD 2006-03-17 #i62875#
2148 
2149         @author OD
2150 
2151         @param p_rDoc
2152         input parameter - reference to the Writer document, which is investigated.
2153     */
2154     bool ExistsDrawObjs( SwDoc& p_rDoc );
2155 
2156     /** method to check, if given Writer document contains only drawing objects,
2157         which are completely on its page.
2158 
2159         OD 2006-03-17 #i62875#
2160 
2161         @author OD
2162 
2163         @param p_rDoc
2164         input parameter - reference to the Writer document, which is investigated.
2165     */
2166     bool AllDrawObjsOnPage( SwDoc& p_rDoc );
2167 
2168     /** method to check, if the outline style has to written as a normal list style
2169 
2170         OD 2006-09-27 #i69627#
2171         The outline style has to written as a normal list style, if a parent
2172         paragraph style of one of the paragraph styles, which are assigned to
2173         the list levels of the outline style, has a list style set or inherits
2174         a list style from its parent paragraphs style.
2175         This information is needed for the OpenDocument file format export.
2176 
2177         @author OD
2178 
2179         @param rDoc
2180         input parameter - reference to the text document, which is investigated.
2181 
2182         @return boolean
2183         indicating, if the outline style has to written as a normal list style
2184     */
2185     bool HasOutlineStyleToBeWrittenAsNormalListStyle( SwDoc& rDoc );
2186 }
2187 // <--
2188 #endif  //_DOC_HXX
2189