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