Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 : #ifndef INCLUDED_SW_INC_DOC_HXX
20 : #define INCLUDED_SW_INC_DOC_HXX
21 :
22 : // SwDoc interfaces
23 : #include <IInterface.hxx>
24 : #include <IDocumentMarkAccess.hxx>
25 : #include <com/sun/star/embed/XEmbeddedObject.hpp>
26 : #include <com/sun/star/embed/XStorage.hpp>
27 : #include <vcl/timer.hxx>
28 : #include <sal/macros.h>
29 : #include "swdllapi.h"
30 : #include <swtypes.hxx>
31 : #include <swatrset.hxx>
32 : #include <toxe.hxx>
33 : #include <flyenum.hxx>
34 : #include <flypos.hxx>
35 : #include <itabenum.hxx>
36 : #include <swdbdata.hxx>
37 : #include <chcmprse.hxx>
38 : #include <com/sun/star/linguistic2/XSpellChecker1.hpp>
39 : #include <com/sun/star/linguistic2/XHyphenatedWord.hpp>
40 : #include <sfx2/objsh.hxx>
41 : #include <svl/style.hxx>
42 : #include <editeng/numitem.hxx>
43 : #include <com/sun/star/linguistic2/XProofreadingIterator.hpp>
44 : #include <com/sun/star/script/vba/XVBAEventProcessor.hpp>
45 : #include <tox.hxx>
46 :
47 : #include <boost/unordered_map.hpp>
48 :
49 : #include <svtools/embedhlp.hxx>
50 : #include <vector>
51 : #include <set>
52 : #include <memory>
53 :
54 : #include <boost/scoped_ptr.hpp>
55 : #include <boost/ptr_container/ptr_vector.hpp>
56 :
57 : namespace editeng { class SvxBorderLine; }
58 :
59 : class SvxForbiddenCharactersTable;
60 : class SwExtTextInput;
61 : class DateTime;
62 : class EditFieldInfo;
63 : class JobSetup;
64 : class Color;
65 : class Outliner;
66 : class OutputDevice;
67 : class Point;
68 : class SbxArray;
69 : class SwDrawModel;
70 : class SdrObject;
71 : class SdrUndoAction;
72 : class VirtualDevice;
73 : class SfxPrinter;
74 : class SvNumberFormatter;
75 : class SvxMacro;
76 : class SvxMacroTableDtor;
77 : class SwAutoCompleteWord;
78 : class SwAutoCorrExceptWord;
79 : class SwCalc;
80 : class SwCellFrm;
81 : class SwCharFmt;
82 : class SwCharFmts;
83 : class SwConditionTxtFmtColl;
84 : class SwCrsrShell;
85 : class SwCursor;
86 : class SwDBNameInfField;
87 : class SwDocShell;
88 : class SwDocUpdtFld;
89 : class SwDrawFrmFmt;
90 : class SwDrawView;
91 : class SwEditShell;
92 : class SwFieldType;
93 : class SwField;
94 : class SwTxtFld;
95 : class SwFldTypes;
96 : class SwFlyFrmFmt;
97 : class SwFmtsBase;
98 : class SwFmt;
99 : class SwFmtINetFmt;
100 : class SwFmtRefMark;
101 : class SwFrmFmt;
102 : class SwFrmFmts;
103 : class SwFtnIdxs;
104 : class SwFtnInfo;
105 : class SwEndNoteInfo;
106 : class GraphicObject;
107 : class SwGrfFmtColl;
108 : class SwGrfFmtColls;
109 : class SwLineNumberInfo;
110 : class SwDBManager;
111 : class SwNoTxtNode;
112 : class SwNodeIndex;
113 : class SwNodeRange;
114 : class SwNodes;
115 : class SwNumRule;
116 : class SwNumRuleTbl;
117 : class SwPageDesc;
118 : class SwPagePreviewPrtData;
119 : class SwRangeRedline;
120 : class SwRedlineTbl;
121 : class SwExtraRedlineTbl;
122 : class SwRootFrm;
123 : class SwRubyList;
124 : class SwRubyListEntry;
125 : class SwSectionFmt;
126 : class SwSectionFmts;
127 : class SwSectionData;
128 : class SwSelBoxes;
129 : class SwTOXBaseSection;
130 : class SwTOXTypes;
131 : class SwTabCols;
132 : class SwTable;
133 : class SwTableAutoFmt;
134 : class SwTableBox;
135 : class SwTableBoxFmt;
136 : class SwTableFmt;
137 : class SwTableLineFmt;
138 : class SwTableNode;
139 : class SwTextBlocks;
140 : class SwTxtFmtColl;
141 : class SwTxtFmtColls;
142 : class SwURLStateChanged;
143 : class SwUnoCrsr;
144 : class SwUnoCrsrTbl;
145 : class SwViewShell;
146 : class _SetGetExpFld;
147 : class SwDrawContact;
148 : class SwLayouter;
149 : class SdrView;
150 : class SdrMarkList;
151 : class SwAuthEntry;
152 : class SwLayoutCache;
153 : class IStyleAccess;
154 : struct SwCallMouseEvent;
155 : struct SwDocStat;
156 : struct SwHash;
157 : struct SwSortOptions;
158 : struct SwDefTOXBase_Impl;
159 : class SwPrintData;
160 : class SwPrintUIOptions;
161 : class SdrPageView;
162 : struct SwConversionArgs;
163 : class SwRewriter;
164 : class SwMsgPoolItem;
165 : class SwChartDataProvider;
166 : class SwChartLockController_Helper;
167 : class IGrammarContact;
168 : class SwPrintData;
169 : class SwRenderData;
170 : class SwPageFrm;
171 : class SwViewOption;
172 : class SwList;
173 : class IDocumentUndoRedo;
174 : class IDocumentSettingAccess;
175 : class IDocumentDeviceAccess;
176 : class IDocumentDrawModelAccess;
177 : class IDocumentChartDataProviderAccess;
178 : class IDocumentTimerAccess;
179 : class IDocumentLinksAdministration;
180 : class IDocumentListItems;
181 : class IDocumentListsAccess;
182 : class IDocumentOutlineNodes;
183 : class IDocumentContentOperations;
184 : class IDocumentRedlineAccess;
185 : class IDocumentStatistics;
186 : class IDocumentState;
187 : class IDocumentLayoutAccess;
188 : class IDocumentStylePoolAccess;
189 : class IDocumentExternalData;
190 : class _SetGetExpFlds;
191 :
192 : namespace sw { namespace mark {
193 : class MarkManager;
194 : }}
195 : namespace sw {
196 : class MetaFieldManager;
197 : class UndoManager;
198 : class IShellCursorSupplier;
199 : class DocumentSettingManager;
200 : class DocumentDeviceManager;
201 : class DocumentDrawModelManager;
202 : class DocumentChartDataProviderManager;
203 : class DocumentTimerManager;
204 : class DocumentLinksAdministrationManager;
205 : class DocumentListItemsManager;
206 : class DocumentListsManager;
207 : class DocumentOutlineNodesManager;
208 : class DocumentContentOperationsManager;
209 : class DocumentRedlineManager;
210 : class DocumentFieldsManager;
211 : class DocumentStatisticsManager;
212 : class DocumentStateManager;
213 : class DocumentLayoutManager;
214 : class DocumentStylePoolManager;
215 : class DocumentExternalDataManager;
216 : }
217 :
218 : namespace com { namespace sun { namespace star {
219 : namespace i18n {
220 : struct ForbiddenCharacters; //< comes from the I18N UNO interface
221 : }
222 : namespace uno {
223 : template < class > class Sequence;
224 : }
225 : namespace container {
226 : class XNameContainer; //< for getXForms()/isXForms()/initXForms() methods
227 : }
228 : }}}
229 :
230 : namespace sfx2 {
231 : class SvLinkSource;
232 : class IXmlIdRegistry;
233 : class LinkManager;
234 : }
235 :
236 : // PageDescriptor-interface, Array because of inlines.
237 5052 : class SwPageDescs : public std::vector<SwPageDesc*>
238 : {
239 : public:
240 : // the destructor will free all objects still in the vector
241 : ~SwPageDescs();
242 : };
243 :
244 : // forward declaration
245 : void SetAllScriptItem( SfxItemSet& rSet, const SfxPoolItem& rItem );
246 :
247 : // global function to start grammar checking in the document
248 : void StartGrammarChecking( SwDoc &rDoc );
249 :
250 : // Represents the model of a Writer document.
251 : class SW_DLLPUBLIC SwDoc :
252 : public IInterface
253 : {
254 : friend class ::sw::DocumentContentOperationsManager;
255 :
256 : friend void _InitCore();
257 : friend void _FinitCore();
258 :
259 : // private Member
260 : ::boost::scoped_ptr<SwNodes> m_pNodes; //< document content (Nodes Array)
261 : SwAttrPool* mpAttrPool; //< the attribute pool
262 : SwPageDescs maPageDescs; //< PageDescriptors
263 : Link maOle2Link; //< OLE 2.0-notification
264 : /* @@@MAINTAINABILITY-HORROR@@@
265 : Timer should not be members of the model
266 : */
267 : Timer maOLEModifiedTimer; //< Timer for update modified OLE-Objecs
268 : SwDBData maDBData; //< database descriptor
269 : OUString msTOIAutoMarkURL; //< URL of table of index AutoMark file
270 : boost::ptr_vector< boost::nullable<OUString> > maPatternNms; // Array for names of document-templates
271 : com::sun::star::uno::Reference<com::sun::star::container::XNameContainer>
272 : mxXForms; //< container with XForms models
273 : mutable com::sun::star::uno::Reference< com::sun::star::linguistic2::XProofreadingIterator > m_xGCIterator;
274 :
275 : const ::boost::scoped_ptr< ::sw::mark::MarkManager> mpMarkManager;
276 : const ::boost::scoped_ptr< ::sw::MetaFieldManager > m_pMetaFieldManager;
277 : const ::boost::scoped_ptr< ::sw::DocumentDrawModelManager > m_pDocumentDrawModelManager;
278 : const ::boost::scoped_ptr< ::sw::DocumentRedlineManager > m_pDocumentRedlineManager;
279 : const ::boost::scoped_ptr< ::sw::DocumentStateManager > m_pDocumentStateManager;
280 : const ::boost::scoped_ptr< ::sw::UndoManager > m_pUndoManager;
281 : const ::boost::scoped_ptr< ::sw::DocumentSettingManager > m_pDocumentSettingManager;
282 : const ::boost::scoped_ptr< ::sw::DocumentChartDataProviderManager > m_pDocumentChartDataProviderManager;
283 : ::boost::scoped_ptr< ::sw::DocumentDeviceManager > m_pDeviceAccess;
284 : const ::boost::scoped_ptr< ::sw::DocumentTimerManager > m_pDocumentTimerManager;
285 : const ::boost::scoped_ptr< ::sw::DocumentLinksAdministrationManager > m_pDocumentLinksAdministrationManager;
286 : const ::boost::scoped_ptr< ::sw::DocumentListItemsManager > m_pDocumentListItemsManager;
287 : const ::boost::scoped_ptr< ::sw::DocumentListsManager > m_pDocumentListsManager;
288 : const ::boost::scoped_ptr< ::sw::DocumentOutlineNodesManager > m_pDocumentOutlineNodesManager;
289 : const ::boost::scoped_ptr< ::sw::DocumentContentOperationsManager > m_pDocumentContentOperationsManager;
290 : const ::boost::scoped_ptr< ::sw::DocumentFieldsManager > m_pDocumentFieldsManager;
291 : const ::boost::scoped_ptr< ::sw::DocumentStatisticsManager > m_pDocumentStatisticsManager;
292 : const ::boost::scoped_ptr< ::sw::DocumentLayoutManager > m_pDocumentLayoutManager;
293 : const ::boost::scoped_ptr< ::sw::DocumentStylePoolManager > m_pDocumentStylePoolManager;
294 : const ::boost::scoped_ptr< ::sw::DocumentExternalDataManager > m_pDocumentExternalDataManager;
295 :
296 : // Pointer
297 : SwFrmFmt *mpDfltFrmFmt; //< Default formats.
298 : SwFrmFmt *mpEmptyPageFmt; //< Format for the default empty page
299 : SwFrmFmt *mpColumnContFmt; //< Format for column container
300 : SwCharFmt *mpDfltCharFmt;
301 : SwTxtFmtColl *mpDfltTxtFmtColl; //< Defaultformatcollections
302 : SwGrfFmtColl *mpDfltGrfFmtColl;
303 :
304 : SwFrmFmts *mpFrmFmtTbl; //< Format table
305 : SwCharFmts *mpCharFmtTbl;
306 : SwFrmFmts *mpSpzFrmFmtTbl;
307 : SwSectionFmts *mpSectionFmtTbl;
308 : SwFrmFmts *mpTblFrmFmtTbl; //< For tables
309 : SwTxtFmtColls *mpTxtFmtCollTbl; //< FormatCollections
310 : SwGrfFmtColls *mpGrfFmtCollTbl;
311 :
312 : SwTOXTypes *mpTOXTypes; //< Tables/indices
313 : SwDefTOXBase_Impl * mpDefTOXBases; //< defaults of SwTOXBase's
314 :
315 : SwDBManager *mpDBManager; /**< Pointer to the DBManager for
316 : evaluation of DB-fields. */
317 :
318 : SwDoc *mpGlossaryDoc; //< Pointer to glossary-document.
319 :
320 : SwNumRule *mpOutlineRule;
321 : SwFtnInfo *mpFtnInfo;
322 : SwEndNoteInfo *mpEndNoteInfo;
323 : SwLineNumberInfo*mpLineNumberInfo;
324 : SwFtnIdxs *mpFtnIdxs;
325 :
326 : SwDocShell *mpDocShell; //< Ptr to SfxDocShell of Doc.
327 : SfxObjectShellLock mxTmpDocShell; //< A temporary shell that is used to copy OLE-Nodes
328 :
329 : SwAutoCorrExceptWord *mpACEWord; /**< For the automated takeover of
330 : auto-corrected words that are "re-corrected". */
331 : SwURLStateChanged *mpURLStateChgd; //< SfxClient for changes in INetHistory
332 : SvNumberFormatter *mpNumberFormatter;//< NumFormatter for tables / fields
333 :
334 : mutable SwNumRuleTbl *mpNumRuleTbl; //< List of all named NumRules.
335 :
336 : // Hash map to find numrules by name
337 : mutable boost::unordered_map<OUString, SwNumRule *, OUStringHash> maNumRuleMap;
338 :
339 : SwUnoCrsrTbl *mpUnoCrsrTbl;
340 :
341 : SwPagePreviewPrtData *mpPgPViewPrtData; //< Indenting / spacing for printing of page view.
342 : SwPaM *mpExtInputRing;
343 :
344 : IStyleAccess *mpStyleAccess; //< handling of automatic styles
345 : SwLayoutCache *mpLayoutCache; /**< Layout cache to read and save with the
346 : document for a faster formatting */
347 :
348 : IGrammarContact *mpGrammarContact; //< for grammar checking in paragraphs during editing
349 :
350 : // table of forbidden characters of this document
351 : rtl::Reference<SvxForbiddenCharactersTable> mxForbiddenCharsTable;
352 : com::sun::star::uno::Reference< com::sun::star::script::vba::XVBAEventProcessor > mxVbaEvents;
353 : com::sun::star::uno::Reference<com::sun::star::container::XNameContainer> m_xTemplateToProjectCache;
354 :
355 : private:
356 : ::std::unique_ptr< ::sfx2::IXmlIdRegistry > m_pXmlIdRegistry;
357 :
358 : // other
359 :
360 : sal_uInt16 mnUndoCnt; //< Count of Undo Actions.
361 : sal_uInt16 mnUndoSttEnd; //< != 0 -> within parentheses.
362 :
363 : sal_uInt32 mnRsid; //< current session ID of the document
364 : sal_uInt32 mnRsidRoot; //< session ID when the document was created
365 :
366 : sal_Int32 mReferenceCount;
367 :
368 : bool mbGlossDoc : 1; //< TRUE: glossary document.
369 : bool mbDtor : 1; /**< TRUE: is in SwDoc DTOR.
370 : and unfortunately temorarily also in
371 : SwSwgReader::InLayout() when flawed
372 : frames need deletion. */
373 : bool mbCopyIsMove : 1; //< TRUE: Copy is a hidden Move.
374 : bool mbInReading : 1; //< TRUE: Document is in the process of being read.
375 : bool mbInMailMerge : 1; //< TRUE: Document is in the process of being written by mail merge.
376 : bool mbInXMLImport : 1; //< TRUE: During xml import, attribute portion building is not necessary.
377 : bool mbUpdateTOX : 1; //< TRUE: After loading document, update TOX.
378 : bool mbInLoadAsynchron : 1; //< TRUE: Document is in the process of being loaded asynchronously.
379 : bool mbIsAutoFmtRedline : 1; //< TRUE: Redlines are recorded by Autoformat.
380 : bool mbOLEPrtNotifyPending : 1; /**< TRUE: Printer has changed. At creation of
381 : View
382 : notification of OLE-Objects PrtOLENotify() is required. */
383 : bool mbAllOLENotify : 1; //< True: Notification of all objects is required.
384 : bool mbIsRedlineMove : 1; //< True: Redlines are moved into to / out of the section.
385 : bool mbInsOnlyTxtGlssry : 1; //< True: insert 'only text' glossary into doc
386 : bool mbContains_MSVBasic : 1; //< True: MS-VBasic exist is in our storage
387 : bool mbClipBoard : 1; //< TRUE: this document represents the clipboard
388 : bool mbColumnSelection : 1; /**< TRUE: this content has bee created by a column selection
389 : (clipboard docs only) */
390 : bool mbIsPrepareSelAll : 1;
391 :
392 : #ifdef DBG_UTIL
393 : bool mbXMLExport : 1; //< sal_True: during XML export
394 : #endif
395 :
396 : // true: Document contains at least one anchored object, which is anchored AT_PAGE with a content position.
397 : // Thus, certain adjustment needed during formatting for these kind of anchored objects.
398 : bool mbContainsAtPageObjWithContentAnchor : 1;
399 :
400 : static SwAutoCompleteWord *mpACmpltWords; //< List of all words for AutoComplete
401 :
402 : // private methods
403 : SwFlyFrmFmt* _MakeFlySection( const SwPosition& rAnchPos,
404 : const SwCntntNode& rNode, RndStdIds eRequestId,
405 : const SfxItemSet* pFlyAttrSet,
406 : SwFrmFmt* = 0 );
407 : sal_Int8 SetFlyFrmAnchor( SwFrmFmt& rFlyFmt, SfxItemSet& rSet, bool bNewFrms );
408 :
409 : typedef SwFmt* (SwDoc:: *FNCopyFmt)( const OUString&, SwFmt*, bool, bool );
410 : SwFmt* CopyFmt( const SwFmt& rFmt, const SwFmtsBase& rFmtArr,
411 : FNCopyFmt fnCopyFmt, const SwFmt& rDfltFmt );
412 : void CopyFmtArr( const SwFmtsBase& rSourceArr, SwFmtsBase& rDestArr,
413 : FNCopyFmt fnCopyFmt, SwFmt& rDfltFmt );
414 : void CopyPageDescHeaderFooterImpl( bool bCpyHeader,
415 : const SwFrmFmt& rSrcFmt, SwFrmFmt& rDestFmt );
416 : SwFmt* FindFmtByName( const SwFmtsBase& rFmtArr, const OUString& rName ) const;
417 :
418 : // gcc: aFtnInfo::CopyCtor is private, therefore we too have to protect ourselves.
419 : SwDoc( const SwDoc &);
420 :
421 : // Database fields:
422 : void AddUsedDBToList( std::vector<OUString>& rDBNameList,
423 : const std::vector<OUString>& rUsedDBNames );
424 : void AddUsedDBToList( std::vector<OUString>& rDBNameList, const OUString& rDBName );
425 : bool IsNameInArray( const std::vector<OUString>& rOldNames, const OUString& rName );
426 : void GetAllDBNames( std::vector<OUString>& rAllDBNames );
427 : OUString ReplaceUsedDBs( const std::vector<OUString>& rUsedDBNames,
428 : const OUString& rNewName, const OUString& rFormula );
429 : std::vector<OUString>& FindUsedDBs( const std::vector<OUString>& rAllDBNames,
430 : const OUString& rFormula,
431 : std::vector<OUString>& rUsedDBNames );
432 :
433 : void _CreateNumberFormatter();
434 :
435 : bool _UnProtectTblCells( SwTable& rTbl );
436 :
437 : /** Create sub-documents according to the given collection.
438 : If no collection is given, take chapter style of the 1st level. */
439 : bool SplitDoc( sal_uInt16 eDocType, const OUString& rPath, bool bOutline,
440 : const SwTxtFmtColl* pSplitColl, int nOutlineLevel = 0 );
441 :
442 : // Update charts of given table.
443 : void _UpdateCharts( const SwTable& rTbl, SwViewShell const & rVSh ) const;
444 :
445 : bool _SelectNextRubyChars( SwPaM& rPam, SwRubyListEntry& rRubyEntry,
446 : sal_uInt16 nMode );
447 :
448 : // CharTimer calls this method.
449 : void DoUpdateAllCharts();
450 : DECL_LINK( DoUpdateModifiedOLE, Timer * );
451 :
452 : public:
453 : SwFmt *_MakeCharFmt(const OUString &, SwFmt *, bool, bool );
454 : SwFmt *_MakeFrmFmt(const OUString &, SwFmt *, bool, bool );
455 :
456 : private:
457 : SwFmt *_MakeTxtFmtColl(const OUString &, SwFmt *, bool, bool );
458 :
459 : private:
460 : bool mbReadOnly;
461 : OUString msDocAccTitle;
462 :
463 : void InitTOXTypes();
464 :
465 : public:
466 : enum DocumentType {
467 : DOCTYPE_NATIVE,
468 : DOCTYPE_MSWORD //This doc medul is come from Ms Word
469 : };
470 : DocumentType meDocType;
471 0 : DocumentType GetDocumentType(){ return meDocType; }
472 186 : void SetDocumentType( DocumentType eDocType ) { meDocType = eDocType; }
473 :
474 : // Life cycle
475 : SwDoc();
476 : virtual ~SwDoc();
477 :
478 2785809 : bool IsInDtor() const { return mbDtor; }
479 :
480 : /* @@@MAINTAINABILITY-HORROR@@@
481 : Implementation details made public.
482 : */
483 4434360 : SwNodes & GetNodes() { return *m_pNodes; }
484 401611 : SwNodes const& GetNodes() const { return *m_pNodes; }
485 :
486 : // IInterface
487 : virtual sal_Int32 acquire() SAL_OVERRIDE;
488 : virtual sal_Int32 release() SAL_OVERRIDE;
489 : virtual sal_Int32 getReferenceCount() const SAL_OVERRIDE;
490 :
491 : // IDocumentSettingAccess
492 : IDocumentSettingAccess const & getIDocumentSettingAccess() const; //The IDocumentSettingAccess interface
493 : IDocumentSettingAccess & getIDocumentSettingAccess();
494 : ::sw::DocumentSettingManager & GetDocumentSettingManager(); //The implementation of the interface with some additional methods
495 : ::sw::DocumentSettingManager const& GetDocumentSettingManager() const;
496 : virtual sal_uInt32 getRsid() const;
497 : virtual void setRsid( sal_uInt32 nVal );
498 : virtual sal_uInt32 getRsidRoot() const;
499 : virtual void setRsidRoot( sal_uInt32 nVal );
500 :
501 : // IDocumentDeviceAccess
502 : IDocumentDeviceAccess const & getIDocumentDeviceAccess() const;
503 : IDocumentDeviceAccess & getIDocumentDeviceAccess();
504 :
505 : // IDocumentMarkAccess
506 : IDocumentMarkAccess* getIDocumentMarkAccess();
507 : const IDocumentMarkAccess* getIDocumentMarkAccess() const;
508 :
509 : // IDocumentRedlineAccess
510 : IDocumentRedlineAccess const& getIDocumentRedlineAccess() const;
511 : IDocumentRedlineAccess& getIDocumentRedlineAccess();
512 :
513 : ::sw::DocumentRedlineManager const& GetDocumentRedlineManager() const;
514 : ::sw::DocumentRedlineManager& GetDocumentRedlineManager();
515 :
516 : // IDocumentUndoRedo
517 : IDocumentUndoRedo & GetIDocumentUndoRedo();
518 : IDocumentUndoRedo const& GetIDocumentUndoRedo() const;
519 :
520 : // IDocumentLinksAdministration
521 : IDocumentLinksAdministration const & getIDocumentLinksAdministration() const;
522 : IDocumentLinksAdministration & getIDocumentLinksAdministration();
523 :
524 : ::sw::DocumentLinksAdministrationManager const & GetDocumentLinksAdministrationManager() const;
525 : ::sw::DocumentLinksAdministrationManager & GetDocumentLinksAdministrationManager();
526 :
527 : // IDocumentFieldsAccess
528 : IDocumentFieldsAccess const & getIDocumentFieldsAccess() const;
529 : IDocumentFieldsAccess & getIDocumentFieldsAccess();
530 :
531 : ::sw::DocumentFieldsManager & GetDocumentFieldsManager();
532 :
533 : // IDocumentContentOperations
534 : IDocumentContentOperations const & getIDocumentContentOperations() const;
535 : IDocumentContentOperations & getIDocumentContentOperations();
536 : ::sw::DocumentContentOperationsManager const & GetDocumentContentOperationsManager() const;
537 : ::sw::DocumentContentOperationsManager & GetDocumentContentOperationsManager();
538 :
539 : virtual void SetModified(SwPaM &rPaM);
540 : virtual bool UpdateParRsid( SwTxtNode *pTxtNode, sal_uInt32 nVal = 0 );
541 : virtual bool UpdateRsid( const SwPaM &rRg, sal_Int32 nLen );
542 :
543 : // IDocumentStylePoolAccess
544 : IDocumentStylePoolAccess const & getIDocumentStylePoolAccess() const;
545 : IDocumentStylePoolAccess & getIDocumentStylePoolAccess();
546 :
547 : // SwLineNumberInfo
548 : virtual const SwLineNumberInfo& GetLineNumberInfo() const;
549 : virtual void SetLineNumberInfo(const SwLineNumberInfo& rInfo);
550 :
551 : // IDocumentStatistics
552 : IDocumentStatistics const & getIDocumentStatistics() const;
553 : IDocumentStatistics & getIDocumentStatistics();
554 :
555 : ::sw::DocumentStatisticsManager const & GetDocumentStatisticsManager() const;
556 : ::sw::DocumentStatisticsManager & GetDocumentStatisticsManager();
557 :
558 : // IDocumentState
559 : IDocumentState const & getIDocumentState() const;
560 : IDocumentState & getIDocumentState();
561 :
562 : // IDocumentDrawModelAccess
563 : DECL_LINK( AddDrawUndo, SdrUndoAction * );
564 : IDocumentDrawModelAccess const & getIDocumentDrawModelAccess() const;
565 : IDocumentDrawModelAccess & getIDocumentDrawModelAccess();
566 :
567 : ::sw::DocumentDrawModelManager const & GetDocumentDrawModelManager() const;
568 : ::sw::DocumentDrawModelManager & GetDocumentDrawModelManager();
569 :
570 : // IDocumentLayoutAccess
571 : IDocumentLayoutAccess const & getIDocumentLayoutAccess() const;
572 : IDocumentLayoutAccess & getIDocumentLayoutAccess();
573 :
574 : ::sw::DocumentLayoutManager const & GetDocumentLayoutManager() const;
575 : ::sw::DocumentLayoutManager & GetDocumentLayoutManager();
576 :
577 : // IDocumentTimerAccess
578 : // Our own 'IdleTimer' calls the following method
579 : IDocumentTimerAccess const & getIDocumentTimerAccess() const;
580 : IDocumentTimerAccess & getIDocumentTimerAccess();
581 :
582 : // IDocumentChartDataProviderAccess
583 : IDocumentChartDataProviderAccess const & getIDocumentChartDataProviderAccess() const;
584 : IDocumentChartDataProviderAccess & getIDocumentChartDataProviderAccess();
585 :
586 : // IDocumentListItems
587 : IDocumentListItems const & getIDocumentListItems() const;
588 : IDocumentListItems & getIDocumentListItems();
589 :
590 : // IDocumentOutlineNodes
591 : IDocumentOutlineNodes const & getIDocumentOutlineNodes() const;
592 : IDocumentOutlineNodes & getIDocumentOutlineNodes();
593 :
594 : // IDocumentListsAccess
595 : IDocumentListsAccess const & getIDocumentListsAccess() const;
596 : IDocumentListsAccess & getIDocumentListsAccess();
597 :
598 : //IDocumentExternalData
599 : IDocumentExternalData const & getIDocumentExternalData() const;
600 : IDocumentExternalData & getIDocumentExternalData();
601 :
602 : //End of Interfaces
603 :
604 0 : virtual void setDocReadOnly( bool b) { mbReadOnly = b; }
605 28 : virtual bool getDocReadOnly() const { return mbReadOnly; }
606 220 : virtual void setDocAccTitle( const OUString& rTitle ) { msDocAccTitle = rTitle; }
607 28 : virtual const OUString getDocAccTitle() const { return msDocAccTitle; }
608 :
609 : // INextInterface here
610 : DECL_STATIC_LINK( SwDoc, BackgroundDone, SvxBrushItem *);
611 : DECL_LINK(CalcFieldValueHdl, EditFieldInfo*);
612 :
613 : // OLE ???
614 28793 : bool IsOLEPrtNotifyPending() const { return mbOLEPrtNotifyPending; }
615 : inline void SetOLEPrtNotifyPending( bool bSet = true );
616 : void PrtOLENotify( bool bAll ); //All or only marked
617 :
618 : #ifdef DBG_UTIL
619 : bool InXMLExport() const { return mbXMLExport; }
620 : void SetXMLExport( bool bFlag ) { mbXMLExport = bFlag; }
621 : #endif
622 : void SetSelAll( bool bSel )
623 : {
624 : mbIsPrepareSelAll = bSel;
625 : }
626 209 : bool IsPrepareSelAll() const { return mbIsPrepareSelAll; }
627 18 : void SetPrepareSelAll() { mbIsPrepareSelAll = true; }
628 :
629 544 : void SetContainsAtPageObjWithContentAnchor( const bool bFlag )
630 : {
631 544 : mbContainsAtPageObjWithContentAnchor = bFlag;
632 544 : }
633 29728 : bool DoesContainAtPageObjWithContentAnchor()
634 : {
635 29728 : return mbContainsAtPageObjWithContentAnchor;
636 : }
637 :
638 : /** Returns positions of all FlyFrames in the document.
639 : If a Pam-Pointer is passed the FlyFrames attached to paragraphes
640 : have to be surrounded completely by ::com::sun::star::awt::Selection.
641 : ( Start < Pos < End ) !!!
642 : (Required for Writers.) */
643 : SwPosFlyFrms GetAllFlyFmts( const SwPaM* = 0,
644 : bool bDrawAlso = false,
645 : bool bAsCharAlso = false ) const;
646 :
647 : // Because swrtf.cxx and define private public here now.
648 : SwFlyFrmFmt *MakeFlyFrmFmt (const OUString &rFmtName, SwFrmFmt *pDerivedFrom);
649 : SwDrawFrmFmt *MakeDrawFrmFmt(const OUString &rFmtName, SwFrmFmt *pDerivedFrom);
650 :
651 : // From now on this interface has to be used for Flys.
652 : // pAnchorPos must be set, if they are not attached to pages AND
653 : // Anchor is not already set at valid CntntPos
654 : // in FlySet/FrmFmt.
655 : /* new parameter bCalledFromShell
656 :
657 : sal_True: An existing adjust item at pAnchorPos is propagated to
658 : the content node of the new fly section. That propagation only
659 : takes place if there is no adjust item in the paragraph style
660 : for the new fly section.
661 :
662 : sal_False: no propagation
663 : */
664 : SwFlyFrmFmt* MakeFlySection( RndStdIds eAnchorType,
665 : const SwPosition* pAnchorPos,
666 : const SfxItemSet* pSet = 0,
667 : SwFrmFmt *pParent = 0,
668 : bool bCalledFromShell = false );
669 : SwFlyFrmFmt* MakeFlyAndMove( const SwPaM& rPam, const SfxItemSet& rSet,
670 : const SwSelBoxes* pSelBoxes = 0,
671 : SwFrmFmt *pParent = 0 );
672 :
673 : //UUUU Helper that checks for unique items for DrawingLayer items of type NameOrIndex
674 : // and evtl. corrects that items to ensure unique names for that type. This call may
675 : // modify/correct entries inside of the given SfxItemSet, and it will apply a name to
676 : // the items in question (what is essential to make the named slots associated with
677 : // these items work for the UNO API and thus e.g. for ODF im/export)
678 : void CheckForUniqueItemForLineFillNameOrIndex(SfxItemSet& rSet);
679 :
680 : bool SetFlyFrmAttr( SwFrmFmt& rFlyFmt, SfxItemSet& rSet );
681 :
682 : bool SetFrmFmtToFly( SwFrmFmt& rFlyFmt, SwFrmFmt& rNewFmt,
683 : SfxItemSet* pSet = 0, bool bKeepOrient = false );
684 : void SetFlyFrmTitle( SwFlyFrmFmt& rFlyFrmFmt,
685 : const OUString& sNewTitle );
686 : void SetFlyFrmDescription( SwFlyFrmFmt& rFlyFrmFmt,
687 : const OUString& sNewDescription );
688 :
689 : // Footnotes
690 : // Footnote information
691 47372 : const SwFtnInfo& GetFtnInfo() const { return *mpFtnInfo; }
692 : void SetFtnInfo(const SwFtnInfo& rInfo);
693 6070 : const SwEndNoteInfo& GetEndNoteInfo() const { return *mpEndNoteInfo; }
694 : void SetEndNoteInfo(const SwEndNoteInfo& rInfo);
695 98079 : SwFtnIdxs& GetFtnIdxs() { return *mpFtnIdxs; }
696 552 : const SwFtnIdxs& GetFtnIdxs() const { return *mpFtnIdxs; }
697 : // change footnotes in area
698 : bool SetCurFtn( const SwPaM& rPam, const OUString& rNumStr,
699 : sal_uInt16 nNumber, bool bIsEndNote );
700 :
701 : /** Operations on the content of the document e.g.
702 : spell-checking/hyphenating/word-counting
703 : */
704 : ::com::sun::star::uno::Any
705 : Spell( SwPaM&, ::com::sun::star::uno::Reference<
706 : ::com::sun::star::linguistic2::XSpellChecker1 > &,
707 : sal_uInt16* pPageCnt, sal_uInt16* pPageSt, bool bGrammarCheck,
708 : SwConversionArgs *pConvArgs = 0 ) const;
709 :
710 : ::com::sun::star::uno::Reference<
711 : ::com::sun::star::linguistic2::XHyphenatedWord >
712 : Hyphenate( SwPaM *pPam, const Point &rCrsrPos,
713 : sal_uInt16* pPageCnt, sal_uInt16* pPageSt );
714 :
715 : // count words in pam
716 : void CountWords( const SwPaM& rPaM, SwDocStat& rStat ) const;
717 :
718 : // Glossary Document
719 : void SetGlossDoc( bool bGlssDc = true ) { mbGlossDoc = bGlssDc; }
720 10518 : bool IsInsOnlyTextGlossary() const { return mbInsOnlyTxtGlssry; }
721 :
722 : void Summary( SwDoc* pExtDoc, sal_uInt8 nLevel, sal_uInt8 nPara, bool bImpress );
723 :
724 : void ChangeAuthorityData(const SwAuthEntry* pNewData);
725 :
726 : bool IsInHeaderFooter( const SwNodeIndex& rIdx ) const;
727 : short GetTextDirection( const SwPosition& rPos,
728 : const Point* pPt = 0 ) const;
729 : bool IsInVerticalText( const SwPosition& rPos,
730 : const Point* pPt = 0 ) const;
731 :
732 : // Database and DB-Manager
733 20 : void SetDBManager( SwDBManager* pNewMgr ) { mpDBManager = pNewMgr; }
734 1676 : SwDBManager* GetDBManager() const { return mpDBManager; }
735 : void ChangeDBFields( const std::vector<OUString>& rOldNames,
736 : const OUString& rNewName );
737 : void SetInitDBFields(bool b);
738 :
739 : // Find out which databases are used by fields.
740 : void GetAllUsedDB( std::vector<OUString>& rDBNameList,
741 : const std::vector<OUString>* pAllDBNames = 0 );
742 :
743 : void ChgDBData( const SwDBData& rNewData );
744 : SwDBData GetDBData();
745 : const SwDBData& GetDBDesc();
746 : const SwDBData& _GetDBDesc() const { return maDBData; }
747 :
748 : // Some helper functions
749 : OUString GetUniqueGrfName() const;
750 : OUString GetUniqueOLEName() const;
751 : OUString GetUniqueFrameName() const;
752 :
753 : std::set<SwRootFrm*> GetAllLayouts();
754 :
755 : void SetFlyName( SwFlyFrmFmt& rFmt, const OUString& rName );
756 : const SwFlyFrmFmt* FindFlyByName( const OUString& rName, sal_Int8 nNdTyp = 0 ) const;
757 :
758 : void GetGrfNms( const SwFlyFrmFmt& rFmt, OUString* pGrfName, OUString* pFltName ) const;
759 :
760 : // Set a valid name for all Flys that have none (Called by Readers after reading).
761 : void SetAllUniqueFlyNames();
762 :
763 : /** Reset attributes. All TxtHints and (if completely selected) all hard-
764 : formated stuff (auto-formats) are removed.
765 : Introduce new optional parameter <bSendDataChangedEvents> in order to
766 : control, if the side effect "send data changed events" is triggered or not. */
767 : void ResetAttrs( const SwPaM &rRg,
768 : bool bTxtAttr = true,
769 : const std::set<sal_uInt16> &rAttrs = std::set<sal_uInt16>(),
770 : const bool bSendDataChangedEvents = true );
771 : void RstTxtAttrs(const SwPaM &rRg, bool bInclRefToxMark = false );
772 :
773 : /** Set attribute in given format.1y
774 : * If Undo is enabled, the old values is added to the Undo history. */
775 : void SetAttr( const SfxPoolItem&, SwFmt& );
776 : /** Set attribute in given format.1y
777 : * If Undo is enabled, the old values is added to the Undo history. */
778 : void SetAttr( const SfxItemSet&, SwFmt& );
779 :
780 : // method to reset a certain attribute at the given format
781 : void ResetAttrAtFormat( const sal_uInt16 nWhichId,
782 : SwFmt& rChangedFormat );
783 :
784 : /** Set attribute as new default attribute in current document.
785 : If Undo is activated, the old one is listed in Undo-History. */
786 : void SetDefault( const SfxPoolItem& );
787 : void SetDefault( const SfxItemSet& );
788 :
789 : // Query default attribute in this document.
790 : const SfxPoolItem& GetDefault( sal_uInt16 nFmtHint ) const;
791 :
792 : // Do not expand text attributes.
793 : bool DontExpandFmt( const SwPosition& rPos, bool bFlag = true );
794 :
795 : // Formats
796 0 : const SwFrmFmts* GetFrmFmts() const { return mpFrmFmtTbl; }
797 13115 : SwFrmFmts* GetFrmFmts() { return mpFrmFmtTbl; }
798 18 : const SwCharFmts* GetCharFmts() const { return mpCharFmtTbl;}
799 420961 : SwCharFmts* GetCharFmts() { return mpCharFmtTbl;}
800 :
801 : // LayoutFormats (frames, DrawObjects), sometimes const sometimes not
802 66701 : const SwFrmFmts* GetSpzFrmFmts() const { return mpSpzFrmFmtTbl; }
803 477236 : SwFrmFmts* GetSpzFrmFmts() { return mpSpzFrmFmtTbl; }
804 :
805 13413 : const SwFrmFmt *GetDfltFrmFmt() const { return mpDfltFrmFmt; }
806 120366 : SwFrmFmt *GetDfltFrmFmt() { return mpDfltFrmFmt; }
807 : const SwFrmFmt *GetEmptyPageFmt() const { return mpEmptyPageFmt; }
808 7588 : SwFrmFmt *GetEmptyPageFmt() { return mpEmptyPageFmt; }
809 : const SwFrmFmt *GetColumnContFmt() const{ return mpColumnContFmt; }
810 28 : SwFrmFmt *GetColumnContFmt() { return mpColumnContFmt; }
811 8 : const SwCharFmt *GetDfltCharFmt() const { return mpDfltCharFmt;}
812 1090597 : SwCharFmt *GetDfltCharFmt() { return mpDfltCharFmt;}
813 :
814 : // @return the interface of the management of (auto)styles
815 400230 : IStyleAccess& GetIStyleAccess() { return *mpStyleAccess; }
816 :
817 : // Remove all language dependencies from all existing formats
818 : void RemoveAllFmtLanguageDependencies();
819 :
820 : SwFrmFmt *MakeFrmFmt(const OUString &rFmtName, SwFrmFmt *pDerivedFrom,
821 : bool bBroadcast = false, bool bAuto = true);
822 : void DelFrmFmt( SwFrmFmt *pFmt, bool bBroadcast = false );
823 11688 : SwFrmFmt* FindFrmFmtByName( const OUString& rName ) const
824 11688 : { return (SwFrmFmt*)FindFmtByName( (SwFmtsBase&)*mpFrmFmtTbl, rName ); }
825 :
826 : SwCharFmt *MakeCharFmt(const OUString &rFmtName, SwCharFmt *pDerivedFrom,
827 : bool bBroadcast = false,
828 : bool bAuto = true );
829 : void DelCharFmt(sal_uInt16 nFmt, bool bBroadcast = false);
830 : void DelCharFmt(SwCharFmt* pFmt, bool bBroadcast = false);
831 341026 : SwCharFmt* FindCharFmtByName( const OUString& rName ) const
832 341026 : { return (SwCharFmt*)FindFmtByName( (SwFmtsBase&)*mpCharFmtTbl, rName ); }
833 :
834 : // Formatcollections (styles)
835 : // TXT
836 : const SwTxtFmtColl* GetDfltTxtFmtColl() const { return mpDfltTxtFmtColl; }
837 706136 : SwTxtFmtColl* GetDfltTxtFmtColl() { return mpDfltTxtFmtColl; }
838 0 : const SwTxtFmtColls *GetTxtFmtColls() const { return mpTxtFmtCollTbl; }
839 5177490 : SwTxtFmtColls *GetTxtFmtColls() { return mpTxtFmtCollTbl; }
840 : SwTxtFmtColl *MakeTxtFmtColl( const OUString &rFmtName,
841 : SwTxtFmtColl *pDerivedFrom,
842 : bool bBroadcast = false,
843 : bool bAuto = true );
844 : SwConditionTxtFmtColl* MakeCondTxtFmtColl( const OUString &rFmtName,
845 : SwTxtFmtColl *pDerivedFrom,
846 : bool bBroadcast = false);
847 : void DelTxtFmtColl(sal_uInt16 nFmt, bool bBroadcast = false);
848 : void DelTxtFmtColl( SwTxtFmtColl* pColl, bool bBroadcast = false );
849 : /** Add 4th optional parameter <bResetListAttrs>.
850 : 'side effect' of <SetTxtFmtColl> with <bReset = true> is that the hard
851 : attributes of the affected text nodes are cleared, except the break
852 : attribute, the page description attribute and the list style attribute.
853 : The new parameter <bResetListAttrs> indicates, if the list attributes
854 : (list style, restart at and restart with) are cleared as well in case
855 : that <bReset = true> and the paragraph style has a list style attribute set. */
856 : bool SetTxtFmtColl(const SwPaM &rRg, SwTxtFmtColl *pFmt,
857 : const bool bReset = true,
858 : const bool bResetListAttrs = false);
859 1036204 : SwTxtFmtColl* FindTxtFmtCollByName( const OUString& rName ) const
860 1036204 : { return (SwTxtFmtColl*)FindFmtByName( (SwFmtsBase&)*mpTxtFmtCollTbl, rName ); }
861 :
862 : void ChkCondColls();
863 :
864 : const SwGrfFmtColl* GetDfltGrfFmtColl() const { return mpDfltGrfFmtColl; }
865 1976 : SwGrfFmtColl* GetDfltGrfFmtColl() { return mpDfltGrfFmtColl; }
866 0 : const SwGrfFmtColls *GetGrfFmtColls() const { return mpGrfFmtCollTbl; }
867 : SwGrfFmtColl *MakeGrfFmtColl(const OUString &rFmtName,
868 : SwGrfFmtColl *pDerivedFrom);
869 278 : SwGrfFmtColl* FindGrfFmtCollByName( const OUString& rName ) const
870 278 : { return (SwGrfFmtColl*)FindFmtByName( (SwFmtsBase&)*mpGrfFmtCollTbl, rName ); }
871 :
872 : // Table formatting
873 : const SwFrmFmts* GetTblFrmFmts() const { return mpTblFrmFmtTbl; }
874 10773 : SwFrmFmts* GetTblFrmFmts() { return mpTblFrmFmtTbl; }
875 : sal_uInt16 GetTblFrmFmtCount( bool bUsed ) const;
876 : SwFrmFmt& GetTblFrmFmt(sal_uInt16 nFmt, bool bUsed ) const;
877 : SwTableFmt* MakeTblFrmFmt(const OUString &rFmtName, SwFrmFmt *pDerivedFrom);
878 : void DelTblFrmFmt( SwTableFmt* pFmt );
879 : SwTableFmt* FindTblFmtByName( const OUString& rName, bool bAll = false ) const;
880 :
881 : /** Access to frames.
882 : Iterate over Flys - forr Basic-Collections. */
883 : sal_uInt16 GetFlyCount( FlyCntType eType = FLYCNTTYPE_ALL, bool bIgnoreTextBoxes = false ) const;
884 : SwFrmFmt* GetFlyNum(sal_uInt16 nIdx, FlyCntType eType = FLYCNTTYPE_ALL, bool bIgnoreTextBoxes = false );
885 :
886 : // Copy formats in own arrays and return them.
887 : SwFrmFmt *CopyFrmFmt ( const SwFrmFmt& );
888 : SwCharFmt *CopyCharFmt( const SwCharFmt& );
889 : SwTxtFmtColl* CopyTxtColl( const SwTxtFmtColl& rColl );
890 : SwGrfFmtColl* CopyGrfColl( const SwGrfFmtColl& rColl );
891 :
892 : // Replace all styles with those from rSource.
893 : void ReplaceStyles( const SwDoc& rSource, bool bIncludePageStyles = true );
894 :
895 : // Replace all property defaults with those from rSource.
896 : void ReplaceDefaults( const SwDoc& rSource );
897 :
898 : // Replace all compatibility options with those from rSource.
899 : void ReplaceCompatibilityOptions( const SwDoc& rSource );
900 :
901 : /** Replace all user defined document properties with xSourceDocProps.
902 :
903 : Convenince function used by ReplaceDocumentProperties to skip some UNO calls.
904 : */
905 : void ReplaceUserDefinedDocumentProperties( const ::com::sun::star::uno::Reference< ::com::sun::star::document::XDocumentProperties > xSourceDocProps );
906 :
907 : /** Replace document properties with those from rSource.
908 :
909 : This includes the user defined document properties!
910 : */
911 : void ReplaceDocumentProperties(const SwDoc& rSource, bool mailMerge = false);
912 :
913 : // Query if style (paragraph- / character- / frame- / page-) is used.
914 : bool IsUsed( const SwModify& ) const;
915 : bool IsUsed( const SwNumRule& ) const;
916 :
917 : // Set name of newly loaded document template.
918 : sal_uInt16 SetDocPattern( const OUString& rPatternName );
919 :
920 : // @return name of document template. Can be 0!
921 0 : const OUString* GetDocPattern( sal_uInt16 nPos ) const
922 : {
923 0 : if(nPos >= maPatternNms.size())
924 0 : return NULL;
925 0 : if(boost::is_null(maPatternNms.begin() + nPos))
926 0 : return NULL;
927 0 : return &(maPatternNms[nPos]);
928 : }
929 :
930 : // Query / connect current document with glossary document.
931 : void SetGlossaryDoc( SwDoc* pDoc ) { mpGlossaryDoc = pDoc; }
932 :
933 : // travel over PaM Ring
934 : bool InsertGlossary( SwTextBlocks& rBlock, const OUString& rEntry,
935 : SwPaM& rPaM, SwCrsrShell* pShell = 0);
936 :
937 : /** get the set of printable pages for the XRenderable API by
938 : evaluating the respective settings (see implementation) */
939 : void CalculatePagesForPrinting( const SwRootFrm& rLayout, SwRenderData &rData, const SwPrintUIOptions &rOptions, bool bIsPDFExport,
940 : sal_Int32 nDocPageCount );
941 : void UpdatePagesForPrintingWithPostItData( SwRenderData &rData, const SwPrintUIOptions &rOptions, bool bIsPDFExport,
942 : sal_Int32 nDocPageCount );
943 : void CalculatePagePairsForProspectPrinting( const SwRootFrm& rLayout, SwRenderData &rData, const SwPrintUIOptions &rOptions,
944 : sal_Int32 nDocPageCount );
945 :
946 : // PageDescriptor interface.
947 202046 : sal_uInt16 GetPageDescCnt() const { return maPageDescs.size(); }
948 4002 : const SwPageDesc& GetPageDesc( const sal_uInt16 i ) const { return *maPageDescs[i]; }
949 339163 : SwPageDesc& GetPageDesc( sal_uInt16 i ) { return *maPageDescs[i]; }
950 : SwPageDesc* FindPageDesc(const OUString& rName, sal_uInt16* pPos = NULL) const;
951 :
952 : /** Copy the complete PageDesc - beyond document and "deep"!
953 : Optionally copying of PoolFmtId, -HlpId can be prevented. */
954 : void CopyPageDesc( const SwPageDesc& rSrcDesc, SwPageDesc& rDstDesc,
955 : bool bCopyPoolIds = true );
956 :
957 : /** Copy header (with contents) from SrcFmt to DestFmt
958 : (can also be copied into other document). */
959 11246 : void CopyHeader( const SwFrmFmt& rSrcFmt, SwFrmFmt& rDestFmt )
960 11246 : { CopyPageDescHeaderFooterImpl( true, rSrcFmt, rDestFmt ); }
961 :
962 : /** Copy footer (with contents) from SrcFmt to DestFmt.
963 : (can also be copied into other document). */
964 10916 : void CopyFooter( const SwFrmFmt& rSrcFmt, SwFrmFmt& rDestFmt )
965 10916 : { CopyPageDescHeaderFooterImpl( false, rSrcFmt, rDestFmt ); }
966 :
967 : // For Reader
968 : SwPageDesc * GetPageDesc( const OUString & rName );
969 : void ChgPageDesc( const OUString & rName, const SwPageDesc& );
970 : void ChgPageDesc( sal_uInt16 i, const SwPageDesc& );
971 : void DelPageDesc( const OUString & rName, bool bBroadcast = false);
972 : void DelPageDesc( sal_uInt16 i, bool bBroadcast = false );
973 : void PreDelPageDesc(SwPageDesc * pDel);
974 : SwPageDesc* MakePageDesc(const OUString &rName, const SwPageDesc* pCpy = 0,
975 : bool bRegardLanguage = true,
976 : bool bBroadcast = false);
977 : void BroadcastStyleOperation(const OUString& rName, SfxStyleFamily eFamily,
978 : sal_uInt16 nOp);
979 :
980 : /** The html import sometimes overwrites the
981 : page sizes set in the page descriptions. This function is used to
982 : correct this. */
983 : void CheckDefaultPageFmt();
984 :
985 : // Methods for tables/indices
986 : sal_uInt16 GetCurTOXMark( const SwPosition& rPos, SwTOXMarks& ) const;
987 : void DeleteTOXMark( const SwTOXMark* pTOXMark );
988 : const SwTOXMark& GotoTOXMark( const SwTOXMark& rCurTOXMark,
989 : SwTOXSearch eDir, bool bInReadOnly );
990 :
991 : // Insert/Renew table/indes
992 : const SwTOXBaseSection* InsertTableOf( const SwPosition& rPos,
993 : const SwTOXBase& rTOX,
994 : const SfxItemSet* pSet = 0,
995 : bool bExpand = false );
996 : const SwTOXBaseSection* InsertTableOf( sal_uLong nSttNd, sal_uLong nEndNd,
997 : const SwTOXBase& rTOX,
998 : const SfxItemSet* pSet = 0 );
999 : const SwTOXBase* GetCurTOX( const SwPosition& rPos ) const;
1000 : const SwAttrSet& GetTOXBaseAttrSet(const SwTOXBase& rTOX) const;
1001 :
1002 : bool DeleteTOX( const SwTOXBase& rTOXBase, bool bDelNodes = false );
1003 : OUString GetUniqueTOXBaseName( const SwTOXType& rType,
1004 : const OUString& sChkStr ) const;
1005 :
1006 : bool SetTOXBaseName(const SwTOXBase& rTOXBase, const OUString& rName);
1007 : void SetTOXBaseProtection(const SwTOXBase& rTOXBase, bool bProtect);
1008 :
1009 : // After reading file update all tables/indices
1010 0 : void SetUpdateTOX( bool bFlag = true ) { mbUpdateTOX = bFlag; }
1011 4708 : bool IsUpdateTOX() const { return mbUpdateTOX; }
1012 :
1013 64 : OUString GetTOIAutoMarkURL() const {return msTOIAutoMarkURL;}
1014 2 : void SetTOIAutoMarkURL(const OUString& rSet) {msTOIAutoMarkURL = rSet;}
1015 : void ApplyAutoMark();
1016 :
1017 130746 : bool IsInReading() const { return mbInReading; }
1018 8008 : void SetInReading( bool bNew ) { mbInReading = bNew; }
1019 :
1020 52 : bool IsInMailMerge() const { return mbInMailMerge; }
1021 8 : void SetInMailMerge( bool bNew ) { mbInMailMerge = bNew; }
1022 :
1023 40700 : bool IsClipBoard() const { return mbClipBoard; }
1024 : // N.B.: must be called right after constructor! (@see GetXmlIdRegistry)
1025 4 : void SetClipBoard( bool bNew ) { mbClipBoard = bNew; }
1026 :
1027 12 : bool IsColumnSelection() const { return mbColumnSelection; }
1028 0 : void SetColumnSelection( bool bNew ) { mbColumnSelection = bNew; }
1029 :
1030 142722 : bool IsInXMLImport() const { return mbInXMLImport; }
1031 2060 : void SetInXMLImport( bool bNew ) { mbInXMLImport = bNew; }
1032 :
1033 : // Manage types of tables/indices
1034 : sal_uInt16 GetTOXTypeCount( TOXTypes eTyp ) const;
1035 : const SwTOXType* GetTOXType( TOXTypes eTyp, sal_uInt16 nId ) const;
1036 : bool DeleteTOXType( TOXTypes eTyp, sal_uInt16 nId );
1037 : const SwTOXType* InsertTOXType( const SwTOXType& rTyp );
1038 0 : const SwTOXTypes& GetTOXTypes() const { return *mpTOXTypes; }
1039 :
1040 : const SwTOXBase* GetDefaultTOXBase( TOXTypes eTyp, bool bCreate = false );
1041 : void SetDefaultTOXBase(const SwTOXBase& rBase);
1042 :
1043 : // Key for management of index.
1044 : sal_uInt16 GetTOIKeys( SwTOIKeyType eTyp, std::vector<OUString>& rArr ) const;
1045 :
1046 : // Sort table text.
1047 : bool SortTbl(const SwSelBoxes& rBoxes, const SwSortOptions&);
1048 : bool SortText(const SwPaM&, const SwSortOptions&);
1049 :
1050 : // Correct the SwPosition-Objects that are registered with the document
1051 : // e. g. Bookmarks or tables/indices.
1052 : // If bMoveCrsr is set move Crsr too.
1053 :
1054 : // Set everything in rOldNode on rNewPos + Offset.
1055 : void CorrAbs(
1056 : const SwNodeIndex& rOldNode,
1057 : const SwPosition& rNewPos,
1058 : const sal_Int32 nOffset = 0,
1059 : bool bMoveCrsr = false );
1060 :
1061 : // Set everything in the range of [rStartNode, rEndNode] to rNewPos.
1062 : void CorrAbs(
1063 : const SwNodeIndex& rStartNode,
1064 : const SwNodeIndex& rEndNode,
1065 : const SwPosition& rNewPos,
1066 : bool bMoveCrsr = false );
1067 :
1068 : // Set everything in this range from rRange to rNewPos.
1069 : void CorrAbs(
1070 : const SwPaM& rRange,
1071 : const SwPosition& rNewPos,
1072 : bool bMoveCrsr = false );
1073 :
1074 : // Set everything in rOldNode to relative Pos.
1075 : void CorrRel(
1076 : const SwNodeIndex& rOldNode,
1077 : const SwPosition& rNewPos,
1078 : const sal_Int32 nOffset = 0,
1079 : bool bMoveCrsr = false );
1080 :
1081 : // Query / set rules for Outline.
1082 130122 : inline SwNumRule* GetOutlineNumRule() const
1083 : {
1084 130122 : return mpOutlineRule;
1085 : }
1086 : void SetOutlineNumRule( const SwNumRule& rRule );
1087 : void PropagateOutlineRule();
1088 :
1089 : // Outline - promote / demote.
1090 : bool OutlineUpDown( const SwPaM& rPam, short nOffset = 1 );
1091 :
1092 : // Ountline - move up / move down.
1093 : bool MoveOutlinePara( const SwPaM& rPam, short nOffset = 1);
1094 :
1095 : bool GotoOutline( SwPosition& rPos, const OUString& rName ) const;
1096 :
1097 : /** Accept changes of outline styles for OUtlineRule.
1098 : re-use unused 3rd parameter
1099 : Optional parameter <bResetIndentAttrs> - default value false:
1100 : If <bResetIndentAttrs> equals true, the indent attributes "before text"
1101 : and "first line indent" are additionally reset at the provided PaM, if
1102 : the list style makes use of the new list level attributes.
1103 : Parameters <bCreateNewList> and <sContinuedListId>:
1104 : <bCreateNewList> indicates, if a new list is created by applying the given list style.
1105 : If <bCreateNewList> equals false, <sContinuedListId> may contain the
1106 : list Id of a list, which has to be continued by applying the given list style */
1107 : void SetNumRule( const SwPaM&,
1108 : const SwNumRule&,
1109 : const bool bCreateNewList,
1110 : const OUString& sContinuedListId = OUString(),
1111 : bool bSetItem = true,
1112 : const bool bResetIndentAttrs = false );
1113 : void SetCounted( const SwPaM&, bool bCounted);
1114 :
1115 : void MakeUniqueNumRules(const SwPaM & rPaM);
1116 :
1117 : void SetNumRuleStart( const SwPosition& rPos, bool bFlag = true );
1118 : void SetNodeNumStart( const SwPosition& rPos, sal_uInt16 nStt );
1119 :
1120 : SwNumRule* GetNumRuleAtPos( const SwPosition& rPos ) const;
1121 :
1122 1262430 : const SwNumRuleTbl& GetNumRuleTbl() const { return *mpNumRuleTbl; }
1123 :
1124 : /**
1125 : Add numbering rule to document.
1126 :
1127 : @param pRule rule to add
1128 : */
1129 : void AddNumRule(SwNumRule * pRule);
1130 :
1131 : // add optional parameter <eDefaultNumberFormatPositionAndSpaceMode>
1132 : sal_uInt16 MakeNumRule( const OUString &rName,
1133 : const SwNumRule* pCpy = 0,
1134 : bool bBroadcast = false,
1135 : const SvxNumberFormat::SvxNumPositionAndSpaceMode eDefaultNumberFormatPositionAndSpaceMode =
1136 : SvxNumberFormat::LABEL_WIDTH_AND_POSITION );
1137 : sal_uInt16 FindNumRule( const OUString& rName ) const;
1138 : SwNumRule* FindNumRulePtr( const OUString& rName ) const;
1139 :
1140 : // Deletion only possible if Rule is not used!
1141 : bool RenameNumRule(const OUString & aOldName, const OUString & aNewName,
1142 : bool bBroadcast = false);
1143 : bool DelNumRule( const OUString& rName, bool bBroadCast = false );
1144 : OUString GetUniqueNumRuleName( const OUString* pChkStr = 0, bool bAutoNum = true ) const;
1145 :
1146 : void UpdateNumRule(); // Update all invalids.
1147 : void ChgNumRuleFmts( const SwNumRule& rRule );
1148 : bool ReplaceNumRule( const SwPosition& rPos, const OUString& rOldRule,
1149 : const OUString& rNewRule );
1150 :
1151 : // Goto next/previous on same level.
1152 : bool GotoNextNum( SwPosition&, bool bOverUpper = true,
1153 : sal_uInt8* pUpper = 0, sal_uInt8* pLower = 0 );
1154 : bool GotoPrevNum( SwPosition&, bool bOverUpper = true,
1155 : sal_uInt8* pUpper = 0, sal_uInt8* pLower = 0 );
1156 :
1157 : /** Searches for a text node with a numbering rule.
1158 :
1159 : add optional parameter <bInvestigateStartNode>
1160 : add output parameter <sListId>
1161 :
1162 : \param rPos position to start search
1163 : \param bForward - sal_True: search forward
1164 : - sal_False: search backward
1165 : \param bNum - sal_True: search for enumeration
1166 : - sal_False: search for itemize
1167 : \param bOutline - sal_True: search for outline numbering rule
1168 : - sal_False: search for non-outline numbering rule
1169 : \param nNonEmptyAllowed number of non-empty paragraphs allowed between
1170 : rPos and found paragraph
1171 :
1172 : @param sListId
1173 : output parameter - in case a list style is found, <sListId> holds the
1174 : list id, to which the text node belongs, which applies the found list style.
1175 :
1176 : @param bInvestigateStartNode
1177 : input parameter - boolean, indicating, if start node, determined by given
1178 : start position has to be investigated or not.
1179 : */
1180 : const SwNumRule * SearchNumRule(const SwPosition & rPos,
1181 : const bool bForward,
1182 : const bool bNum,
1183 : const bool bOutline,
1184 : int nNonEmptyAllowed,
1185 : OUString& sListId,
1186 : const bool bInvestigateStartNode = false );
1187 :
1188 : // Paragraphs without numbering but with indents.
1189 : bool NoNum( const SwPaM& );
1190 :
1191 : // Delete, splitting of numbering list.
1192 : void DelNumRules( const SwPaM& );
1193 :
1194 : // Invalidates all numrules
1195 : void InvalidateNumRules();
1196 :
1197 : bool NumUpDown( const SwPaM&, bool bDown = true );
1198 :
1199 : /** Move selected paragraphes (not only numberings)
1200 : according to offsets. (if negative: go to doc start). */
1201 : bool MoveParagraph( const SwPaM&, long nOffset = 1, bool bIsOutlMv = false );
1202 :
1203 : bool NumOrNoNum( const SwNodeIndex& rIdx, bool bDel = false);
1204 :
1205 : void StopNumRuleAnimations( OutputDevice* );
1206 :
1207 : /** Insert new table at position @param rPos (will be inserted before Node!).
1208 : For AutoFormat at input: columns have to be set at predefined width.
1209 : The array holds the positions of the columns (not their widths).
1210 : new @param bCalledFromShell:
1211 : sal_True: called from shell -> propagate existing adjust item at
1212 : rPos to every new cell. A existing adjust item in the table
1213 : heading or table contents paragraph style prevent that
1214 : propagation.
1215 : sal_False: do not propagate
1216 : */
1217 : const SwTable* InsertTable( const SwInsertTableOptions& rInsTblOpts, // HEADLINE_NO_BORDER
1218 : const SwPosition& rPos, sal_uInt16 nRows,
1219 : sal_uInt16 nCols, short eAdjust,
1220 : const SwTableAutoFmt* pTAFmt = 0,
1221 : const std::vector<sal_uInt16> *pColArr = 0,
1222 : bool bCalledFromShell = false,
1223 : bool bNewModel = true );
1224 :
1225 : // If index is in a table, return TableNode, else 0.
1226 : SwTableNode* IsIdxInTbl( const SwNodeIndex& rIdx );
1227 : inline const SwTableNode* IsIdxInTbl( const SwNodeIndex& rIdx ) const;
1228 :
1229 : // Create a balanced table out of the selected range.
1230 : const SwTable* TextToTable( const SwInsertTableOptions& rInsTblOpts, // HEADLINE_NO_BORDER,
1231 : const SwPaM& rRange, sal_Unicode cCh,
1232 : short eAdjust,
1233 : const SwTableAutoFmt* = 0 );
1234 :
1235 : // text to table conversion - API support
1236 : const SwTable* TextToTable( const std::vector< std::vector<SwNodeRange> >& rTableNodes );
1237 :
1238 : bool TableToText( const SwTableNode* pTblNd, sal_Unicode cCh );
1239 :
1240 : // Create columns / rows in table.
1241 : bool InsertCol( const SwCursor& rCursor,
1242 : sal_uInt16 nCnt = 1, bool bBehind = true );
1243 : bool InsertCol( const SwSelBoxes& rBoxes,
1244 : sal_uInt16 nCnt = 1, bool bBehind = true );
1245 : bool InsertRow( const SwCursor& rCursor,
1246 : sal_uInt16 nCnt = 1, bool bBehind = true );
1247 : bool InsertRow( const SwSelBoxes& rBoxes,
1248 : sal_uInt16 nCnt = 1, bool bBehind = true );
1249 :
1250 : // Delete Columns/Rows in table.
1251 : bool DeleteRowCol( const SwSelBoxes& rBoxes, bool bColumn = false );
1252 : bool DeleteRow( const SwCursor& rCursor );
1253 : bool DeleteCol( const SwCursor& rCursor );
1254 :
1255 : // Split / concatenate boxes in table.
1256 : bool SplitTbl( const SwSelBoxes& rBoxes, bool bVert = true,
1257 : sal_uInt16 nCnt = 1, bool bSameHeight = false );
1258 :
1259 : // @return enum TableMergeErr.
1260 : sal_uInt16 MergeTbl( SwPaM& rPam );
1261 : OUString GetUniqueTblName() const;
1262 : bool IsInsTblFormatNum() const;
1263 : bool IsInsTblChangeNumFormat() const;
1264 : bool IsInsTblAlignNum() const;
1265 :
1266 : // From FEShell (for Undo and BModified).
1267 : void GetTabCols( SwTabCols &rFill, const SwCursor* pCrsr,
1268 : const SwCellFrm* pBoxFrm = 0 ) const;
1269 : void SetTabCols( const SwTabCols &rNew, bool bCurRowOnly,
1270 : const SwCursor* pCrsr, const SwCellFrm* pBoxFrm = 0 );
1271 : void GetTabRows( SwTabCols &rFill, const SwCursor* pCrsr,
1272 : const SwCellFrm* pBoxFrm = 0 ) const;
1273 : void SetTabRows( const SwTabCols &rNew, bool bCurColOnly, const SwCursor* pCrsr,
1274 : const SwCellFrm* pBoxFrm = 0 );
1275 :
1276 : // Direct access for UNO.
1277 : void SetTabCols(SwTable& rTab, const SwTabCols &rNew, const SwTabCols &rOld,
1278 : const SwTableBox *pStart, bool bCurRowOnly);
1279 :
1280 : void SetRowsToRepeat( SwTable &rTable, sal_uInt16 nSet );
1281 :
1282 : // AutoFormat for table/table selection.
1283 : bool SetTableAutoFmt( const SwSelBoxes& rBoxes, const SwTableAutoFmt& rNew );
1284 :
1285 : // Query attributes.
1286 : bool GetTableAutoFmt( const SwSelBoxes& rBoxes, SwTableAutoFmt& rGet );
1287 :
1288 : void AppendUndoForInsertFromDB( const SwPaM& rPam, bool bIsTable );
1289 :
1290 : bool SetColRowWidthHeight( SwTableBox& rAktBox, sal_uInt16 eType,
1291 : SwTwips nAbsDiff, SwTwips nRelDiff );
1292 : SwTableBoxFmt* MakeTableBoxFmt();
1293 : SwTableLineFmt* MakeTableLineFmt();
1294 :
1295 : // Check if box has numerical valule. Change format of box if required.
1296 : void ChkBoxNumFmt( SwTableBox& rAktBox, bool bCallUpdate );
1297 : void SetTblBoxFormulaAttrs( SwTableBox& rBox, const SfxItemSet& rSet );
1298 : void ClearBoxNumAttrs( const SwNodeIndex& rNode );
1299 : void ClearLineNumAttrs( SwPosition & rPos );
1300 :
1301 : bool InsCopyOfTbl( SwPosition& rInsPos, const SwSelBoxes& rBoxes,
1302 : const SwTable* pCpyTbl = 0, bool bCpyName = false,
1303 : bool bCorrPos = false );
1304 :
1305 : bool UnProtectCells( const OUString& rTblName );
1306 : bool UnProtectCells( const SwSelBoxes& rBoxes );
1307 : bool UnProtectTbls( const SwPaM& rPam );
1308 : bool HasTblAnyProtection( const SwPosition* pPos,
1309 : const OUString* pTblName = 0,
1310 : bool* pFullTblProtection = 0 );
1311 :
1312 : // Split table at baseline position, i.e. create a new table.
1313 : bool SplitTable( const SwPosition& rPos, sal_uInt16 eMode = 0,
1314 : bool bCalcNewSize = false );
1315 :
1316 : /** And vice versa: rPos must be in the table that remains. The flag indicates
1317 : whether the current table is merged with the one before or behind it. */
1318 : bool MergeTable( const SwPosition& rPos, bool bWithPrev = true,
1319 : sal_uInt16 nMode = 0 );
1320 :
1321 : // Make charts of given table update.
1322 : void UpdateCharts( const OUString &rName ) const;
1323 :
1324 : // Update all charts, for that exists any table.
1325 0 : void UpdateAllCharts() { DoUpdateAllCharts(); }
1326 :
1327 : // Table is renamed and refreshes charts.
1328 : void SetTableName( SwFrmFmt& rTblFmt, const OUString &rNewName );
1329 :
1330 : // @return the reference in document that is set for name.
1331 : const SwFmtRefMark* GetRefMark( const OUString& rName ) const;
1332 :
1333 : // @return RefMark via index - for UNO.
1334 : const SwFmtRefMark* GetRefMark( sal_uInt16 nIndex ) const;
1335 :
1336 : /** @return names of all references that are set in document.
1337 : If array pointer is 0 return only whether a RefMark is set in document. */
1338 : sal_uInt16 GetRefMarks( std::vector<OUString>* = 0 ) const;
1339 :
1340 : // Insert label. If a FlyFormat is created, return it.
1341 : SwFlyFrmFmt* InsertLabel( const SwLabelType eType, const OUString &rTxt, const OUString& rSeparator,
1342 : const OUString& rNumberingSeparator,
1343 : const bool bBefore, const sal_uInt16 nId, const sal_uLong nIdx,
1344 : const OUString& rCharacterStyle,
1345 : const bool bCpyBrd = true );
1346 : SwFlyFrmFmt* InsertDrawLabel(
1347 : const OUString &rTxt, const OUString& rSeparator, const OUString& rNumberSeparator,
1348 : const sal_uInt16 nId, const OUString& rCharacterStyle, SdrObject& rObj );
1349 :
1350 : // Query attribute pool.
1351 510102 : const SwAttrPool& GetAttrPool() const { return *mpAttrPool; }
1352 3001569 : SwAttrPool& GetAttrPool() { return *mpAttrPool; }
1353 :
1354 : // Search for an EditShell.
1355 : SwEditShell const * GetEditShell() const;
1356 : SwEditShell* GetEditShell();
1357 : ::sw::IShellCursorSupplier * GetIShellCursorSupplier();
1358 :
1359 : // OLE 2.0-notification.
1360 46007 : inline void SetOle2Link(const Link& rLink) {maOle2Link = rLink;}
1361 3155564 : inline const Link& GetOle2Link() const {return maOle2Link;}
1362 :
1363 : // insert section (the ODF kind of section, not the nodesarray kind)
1364 : SwSection * InsertSwSection(SwPaM const& rRange, SwSectionData &,
1365 : SwTOXBase const*const pTOXBase = 0,
1366 : SfxItemSet const*const pAttr = 0, bool const bUpdate = true);
1367 : sal_uInt16 IsInsRegionAvailable( const SwPaM& rRange,
1368 : const SwNode** ppSttNd = 0 ) const;
1369 : SwSection* GetCurrSection( const SwPosition& rPos ) const;
1370 5276 : SwSectionFmts& GetSections() { return *mpSectionFmtTbl; }
1371 0 : const SwSectionFmts& GetSections() const { return *mpSectionFmtTbl; }
1372 : SwSectionFmt *MakeSectionFmt( SwSectionFmt *pDerivedFrom );
1373 : void DelSectionFmt( SwSectionFmt *pFmt, bool bDelNodes = false );
1374 : void UpdateSection(sal_uInt16 const nSect, SwSectionData &,
1375 : SfxItemSet const*const = 0, bool const bPreventLinkUpdate = false);
1376 : OUString GetUniqueSectionName( const OUString* pChkStr = 0 ) const;
1377 :
1378 : /* @@@MAINTAINABILITY-HORROR@@@
1379 : The model should not have anything to do with a shell.
1380 : Unnecessary compile/link time dependency.
1381 : */
1382 :
1383 : // Pointer to SfxDocShell from Doc. Can be 0!!
1384 2538806 : SwDocShell* GetDocShell() { return mpDocShell; }
1385 1633 : const SwDocShell* GetDocShell() const { return mpDocShell; }
1386 : void SetDocShell( SwDocShell* pDSh );
1387 :
1388 : /** in case during copying of embedded object a new shell is created,
1389 : it should be set here and cleaned later */
1390 12 : void SetTmpDocShell( SfxObjectShellLock rLock ) { mxTmpDocShell = rLock; }
1391 2 : SfxObjectShellLock GetTmpDocShell() { return mxTmpDocShell; }
1392 :
1393 : // For Autotexts? (text modules) They have only one SVPersist at their disposal.
1394 : SfxObjectShell* GetPersist() const;
1395 :
1396 : // Pointer to storage of SfxDocShells. Can be 0!!!
1397 : ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage > GetDocStorage();
1398 :
1399 : // Query / set flag indicating if document is loaded asynchronously at this moment.
1400 546 : bool IsInLoadAsynchron() const { return mbInLoadAsynchron; }
1401 22 : void SetInLoadAsynchron( bool bFlag ) { mbInLoadAsynchron = bFlag; }
1402 :
1403 : bool SelectServerObj( const OUString& rStr, SwPaM*& rpPam,
1404 : SwNodeRange*& rpRange ) const;
1405 :
1406 : // For Drag&Move: (e.g. allow "moving" of RefMarks)
1407 1598 : bool IsCopyIsMove() const { return mbCopyIsMove; }
1408 4 : void SetCopyIsMove( bool bFlag ) { mbCopyIsMove = bFlag; }
1409 :
1410 : SwDrawContact* GroupSelection( SdrView& );
1411 : void UnGroupSelection( SdrView& );
1412 : bool DeleteSelection( SwDrawView& );
1413 :
1414 : // Invalidates OnlineSpell-WrongLists.
1415 : void SpellItAgainSam( bool bInvalid, bool bOnlyWrong, bool bSmartTags );
1416 : void InvalidateAutoCompleteFlag();
1417 :
1418 : void SetCalcFieldValueHdl(Outliner* pOutliner);
1419 :
1420 : // Query if URL was visited.
1421 : // Query via Doc, if only a Bookmark has been given.
1422 : // In this case the document name has to be set in front.
1423 : bool IsVisitedURL( const OUString& rURL );
1424 :
1425 : // Save current values for automatic registration of exceptions in Autocorrection.
1426 : void SetAutoCorrExceptWord( SwAutoCorrExceptWord* pNew );
1427 1892300 : SwAutoCorrExceptWord* GetAutoCorrExceptWord() { return mpACEWord; }
1428 : void DeleteAutoCorrExceptWord();
1429 :
1430 : const SwFmtINetFmt* FindINetAttr( const OUString& rName ) const;
1431 :
1432 : // Call into intransparent Basic; expect possible Return String.
1433 : bool ExecMacro( const SvxMacro& rMacro, OUString* pRet = 0, SbxArray* pArgs = 0 );
1434 :
1435 : // Call into intransparent Basic / JavaScript.
1436 : sal_uInt16 CallEvent( sal_uInt16 nEvent, const SwCallMouseEvent& rCallEvent,
1437 : bool bChkPtr = false, SbxArray* pArgs = 0,
1438 : const Link* pCallBack = 0 );
1439 :
1440 : /** Adjust left margin via object bar (similar to adjustment of numerations).
1441 : One can either change the margin "by" adding or substracting a given
1442 : offset or set it "to" this position (bModulus = true). */
1443 : void MoveLeftMargin( const SwPaM& rPam, bool bRight = true,
1444 : bool bModulus = true );
1445 :
1446 : // Query NumberFormatter.
1447 : inline SvNumberFormatter* GetNumberFormatter( bool bCreate = true );
1448 : inline const SvNumberFormatter* GetNumberFormatter( bool bCreate = true ) const;
1449 :
1450 : bool HasInvisibleContent() const;
1451 : // delete invisible content, like hidden sections and paragraphs
1452 : bool RemoveInvisibleContent();
1453 : // restore the invisible content if it's available on the undo stack
1454 : bool RestoreInvisibleContent();
1455 :
1456 : bool ConvertFieldsToText();
1457 :
1458 : // Create sub-documents according to given collection.
1459 : // If no collection is given, use chapter styles for 1st level.
1460 : bool GenerateGlobalDoc( const OUString& rPath,
1461 : const SwTxtFmtColl* pSplitColl = 0 );
1462 : bool GenerateGlobalDoc( const OUString& rPath, int nOutlineLevel = 0 );
1463 : bool GenerateHTMLDoc( const OUString& rPath,
1464 : const SwTxtFmtColl* pSplitColl = 0 );
1465 : bool GenerateHTMLDoc( const OUString& rPath, int nOutlineLevel = 0 );
1466 :
1467 : // Compare two documents.
1468 : long CompareDoc( const SwDoc& rDoc );
1469 :
1470 : // Merge two documents.
1471 : long MergeDoc( const SwDoc& rDoc );
1472 :
1473 4443 : bool IsAutoFmtRedline() const { return mbIsAutoFmtRedline; }
1474 0 : void SetAutoFmtRedline( bool bFlag ) { mbIsAutoFmtRedline = bFlag; }
1475 :
1476 : // For AutoFormat: with Undo/Redlining.
1477 : void SetTxtFmtCollByAutoFmt( const SwPosition& rPos, sal_uInt16 nPoolId,
1478 : const SfxItemSet* pSet = 0 );
1479 : void SetFmtItemByAutoFmt( const SwPaM& rPam, const SfxItemSet& );
1480 :
1481 : // Only for SW-textbloxks! Does not pay any attention to layout!
1482 : void ClearDoc(); // Deletes all content!
1483 :
1484 : // Query /set data for PagePreview.
1485 0 : const SwPagePreviewPrtData* GetPreviewPrtData() const { return mpPgPViewPrtData; }
1486 :
1487 : // If pointer == 0 destroy pointer in document.
1488 : // Else copy object.
1489 : // Pointer is not transferred to ownership by document!
1490 : void SetPreviewPrtData( const SwPagePreviewPrtData* pData );
1491 :
1492 : /** update all modified OLE-Objects. The modification is called over the
1493 : StarOne - Interface */
1494 : void SetOLEObjModified();
1495 :
1496 : // Uno - Interfaces
1497 403442 : const SwUnoCrsrTbl& GetUnoCrsrTbl() const { return *mpUnoCrsrTbl; }
1498 : SwUnoCrsr* CreateUnoCrsr( const SwPosition& rPos, bool bTblCrsr = false );
1499 :
1500 : // FeShell - Interfaces
1501 : // !!! These assume always an existing layout !!!
1502 : bool ChgAnchor( const SdrMarkList& _rMrkList,
1503 : RndStdIds _eAnchorType,
1504 : const bool _bSameOnly,
1505 : const bool _bPosCorr );
1506 :
1507 : void SetRowHeight( const SwCursor& rCursor, const SwFmtFrmSize &rNew );
1508 : void GetRowHeight( const SwCursor& rCursor, SwFmtFrmSize *& rpSz ) const;
1509 : void SetRowSplit( const SwCursor& rCursor, const SwFmtRowSplit &rNew );
1510 : void GetRowSplit( const SwCursor& rCursor, SwFmtRowSplit *& rpSz ) const;
1511 : bool BalanceRowHeight( const SwCursor& rCursor, bool bTstOnly = true );
1512 : void SetRowBackground( const SwCursor& rCursor, const SvxBrushItem &rNew );
1513 : bool GetRowBackground( const SwCursor& rCursor, SvxBrushItem &rToFill ) const;
1514 : void SetTabBorders( const SwCursor& rCursor, const SfxItemSet& rSet );
1515 : void SetTabLineStyle( const SwCursor& rCursor,
1516 : const Color* pColor, bool bSetLine,
1517 : const editeng::SvxBorderLine* pBorderLine );
1518 : void GetTabBorders( const SwCursor& rCursor, SfxItemSet& rSet ) const;
1519 : void SetBoxAttr( const SwCursor& rCursor, const SfxPoolItem &rNew );
1520 : /**
1521 : Retrieves a box attribute from the given cursor.
1522 :
1523 : @return Whether the property is set over the current box selection.
1524 :
1525 : @remarks A property is 'set' if it's set to the same value over all boxes in the current selection.
1526 : The property value is retrieved from the first box in the current selection. It is then compared to
1527 : the values of the same property over any other boxes in the selection; if any value is different from
1528 : that of the first box, the property is unset (and sal_False is returned).
1529 : */
1530 : bool GetBoxAttr( const SwCursor& rCursor, SfxPoolItem &rToFill ) const;
1531 : void SetBoxAlign( const SwCursor& rCursor, sal_uInt16 nAlign );
1532 : sal_uInt16 GetBoxAlign( const SwCursor& rCursor ) const;
1533 : void AdjustCellWidth( const SwCursor& rCursor, bool bBalance = false );
1534 :
1535 : int Chainable( const SwFrmFmt &rSource, const SwFrmFmt &rDest );
1536 : int Chain( SwFrmFmt &rSource, const SwFrmFmt &rDest );
1537 : void Unchain( SwFrmFmt &rFmt );
1538 :
1539 : // For Copy/Move from FrmShell.
1540 : SdrObject* CloneSdrObj( const SdrObject&, bool bMoveWithinDoc = false,
1541 : bool bInsInPage = true );
1542 :
1543 : // FeShell - Interface end
1544 :
1545 : // Interface for TextInputData - for text input of Chinese and Japanese.
1546 : SwExtTextInput* CreateExtTextInput( const SwPaM& rPam );
1547 : void DeleteExtTextInput( SwExtTextInput* pDel );
1548 : SwExtTextInput* GetExtTextInput( const SwNode& rNd,
1549 : sal_Int32 nCntntPos = -1) const;
1550 : SwExtTextInput* GetExtTextInput() const;
1551 :
1552 : // Interface for access to AutoComplete-List.
1553 2587 : static SwAutoCompleteWord& GetAutoCompleteWords() { return *mpACmpltWords; }
1554 :
1555 144 : bool ContainsMSVBasic() const { return mbContains_MSVBasic; }
1556 2 : void SetContainsMSVBasic( bool bFlag ) { mbContains_MSVBasic = bFlag; }
1557 :
1558 : // Interface for the list of Ruby - texts/attributes
1559 : sal_uInt16 FillRubyList( const SwPaM& rPam, SwRubyList& rList,
1560 : sal_uInt16 nMode );
1561 : sal_uInt16 SetRubyList( const SwPaM& rPam, const SwRubyList& rList,
1562 : sal_uInt16 nMode );
1563 :
1564 : void ReadLayoutCache( SvStream& rStream );
1565 : void WriteLayoutCache( SvStream& rStream );
1566 15938 : SwLayoutCache* GetLayoutCache() const { return mpLayoutCache; }
1567 :
1568 : /** Checks if any of the text node contains hidden characters.
1569 : Used for optimization. Changing the view option 'view hidden text'
1570 : has to trigger a reformatting only if some of the text is hidden.
1571 : */
1572 : bool ContainsHiddenChars() const;
1573 :
1574 100888 : IGrammarContact* getGrammarContact() const { return mpGrammarContact; }
1575 :
1576 : /** Marks/Unmarks a list level of a certain list
1577 :
1578 : levels of a certain lists are marked now
1579 :
1580 : @param sListId list Id of the list whose level has to be marked/unmarked
1581 : @param nListLevel level to mark
1582 : @param bValue - true mark the level
1583 : - false unmark the level
1584 : */
1585 : void MarkListLevel( const OUString& sListId,
1586 : const int nListLevel,
1587 : const bool bValue );
1588 :
1589 : /** Marks/Unmarks a list level of a certain list
1590 :
1591 : levels of a certain lists are marked now
1592 :
1593 : @param rList list whose level has to be marked/unmarked
1594 : @param nListLevel level to mark
1595 : @param bValue - true mark the level
1596 : - false unmark the level
1597 : */
1598 : void MarkListLevel( SwList& rList,
1599 : const int nListLevel,
1600 : const bool bValue );
1601 :
1602 : // Change a format undoable.
1603 : void ChgFmt(SwFmt & rFmt, const SfxItemSet & rSet);
1604 :
1605 : void RenameFmt(SwFmt & rFmt, const OUString & sNewName,
1606 : bool bBroadcast = false);
1607 :
1608 : // Change a TOX undoable.
1609 : void ChgTOX(SwTOXBase & rTOX, const SwTOXBase & rNew);
1610 :
1611 : /**
1612 : Returns a textual description of a PaM.
1613 :
1614 : @param rPaM the PaM to describe
1615 :
1616 : If rPaM only spans one paragraph the result is:
1617 :
1618 : '<text in the PaM>'
1619 :
1620 : <text in the PaM> is shortened to nUndoStringLength characters.
1621 :
1622 : If rPaM spans more than one paragraph the result is:
1623 :
1624 : paragraphs (STR_PARAGRAPHS)
1625 :
1626 : @return the textual description of rPaM
1627 : */
1628 : OUString GetPaMDescr(const SwPaM & rPaM) const;
1629 :
1630 : bool IsFirstOfNumRuleAtPos( const SwPosition & rPos );
1631 :
1632 : // access methods for XForms model(s)
1633 :
1634 : // access container for XForms model; will be NULL if !isXForms()
1635 : com::sun::star::uno::Reference<com::sun::star::container::XNameContainer>
1636 118 : getXForms() const { return mxXForms;}
1637 :
1638 : com::sun::star::uno::Reference< com::sun::star::linguistic2::XProofreadingIterator > GetGCIterator() const;
1639 :
1640 : // #i31958# is this an XForms document?
1641 : bool isXForms() const;
1642 :
1643 : // #i31958# initialize XForms models; turn this into an XForms document
1644 : void initXForms( bool bCreateDefaultModel );
1645 :
1646 : // #i113606# for disposing XForms
1647 : void disposeXForms( );
1648 :
1649 : //Update all the page masters
1650 : void SetDefaultPageMode(bool bSquaredPageMode);
1651 : bool IsSquaredPageMode() const;
1652 :
1653 : com::sun::star::uno::Reference< com::sun::star::script::vba::XVBAEventProcessor > GetVbaEventProcessor();
1654 134 : void SetVBATemplateToProjectCache( com::sun::star::uno::Reference< com::sun::star::container::XNameContainer >& xCache ) { m_xTemplateToProjectCache = xCache; };
1655 182 : com::sun::star::uno::Reference< com::sun::star::container::XNameContainer > GetVBATemplateToProjectCache() { return m_xTemplateToProjectCache; };
1656 : ::sfx2::IXmlIdRegistry& GetXmlIdRegistry();
1657 : ::sw::MetaFieldManager & GetMetaFieldManager();
1658 : ::sw::UndoManager & GetUndoManager();
1659 : ::sw::UndoManager const& GetUndoManager() const;
1660 :
1661 : SfxObjectShell* CreateCopy(bool bCallInitNew) const;
1662 : void AppendDoc(const SwDoc& rSource, sal_uInt16 nStartPageNumber,
1663 : SwPageDesc* pTargetPageDesc, bool bDeletePrevious = false );
1664 :
1665 : /**
1666 : * Dumps the entire nodes structure to the given destination (file nodes.xml in the current directory by default)
1667 : * @since 3.5
1668 : */
1669 : void dumpAsXml( xmlTextWriterPtr writer = NULL ) const;
1670 :
1671 : std::vector<Color> GetDocColors();
1672 :
1673 : private:
1674 : // Copies master header to left / first one, if necessary - used by ChgPageDesc().
1675 : void CopyMasterHeader(const SwPageDesc &rChged, const SwFmtHeader &rHead, SwPageDesc *pDesc, bool bLeft, bool bFirst);
1676 : // Copies master footer to left / first one, if necessary - used by ChgPageDesc().
1677 : void CopyMasterFooter(const SwPageDesc &rChged, const SwFmtFooter &rFoot, SwPageDesc *pDesc, bool bLeft, bool bFirst);
1678 :
1679 : };
1680 :
1681 : // This method is called in Dtor of SwDoc and deletes cache of ContourObjects.
1682 : void ClrContourCache();
1683 :
1684 : inline const SwTableNode* SwDoc::IsIdxInTbl( const SwNodeIndex& rIdx ) const
1685 : {
1686 : return ((SwDoc*)this)->IsIdxInTbl( rIdx );
1687 : }
1688 :
1689 7194 : inline SvNumberFormatter* SwDoc::GetNumberFormatter( bool bCreate )
1690 : {
1691 7194 : if( bCreate && !mpNumberFormatter )
1692 4740 : _CreateNumberFormatter();
1693 7194 : return mpNumberFormatter;
1694 : }
1695 :
1696 0 : inline const SvNumberFormatter* SwDoc::GetNumberFormatter( bool bCreate ) const
1697 : {
1698 0 : return ((SwDoc*)this)->GetNumberFormatter( bCreate );
1699 : }
1700 :
1701 56 : inline void SwDoc::SetOLEPrtNotifyPending( bool bSet )
1702 : {
1703 56 : mbOLEPrtNotifyPending = bSet;
1704 56 : if( !bSet )
1705 2 : mbAllOLENotify = false;
1706 56 : }
1707 :
1708 : // namespace <docfunc> for functions and procedures working on a Writer document.
1709 : namespace docfunc
1710 : {
1711 : /** method to check, if given Writer document contains at least one drawing object
1712 :
1713 : @author OD
1714 :
1715 : @param p_rDoc
1716 : input parameter - reference to the Writer document, which is investigated.
1717 : */
1718 : bool ExistsDrawObjs( SwDoc& p_rDoc );
1719 :
1720 : /** method to check, if given Writer document contains only drawing objects,
1721 : which are completely on its page.
1722 :
1723 : @author OD
1724 :
1725 : @param p_rDoc
1726 : input parameter - reference to the Writer document, which is investigated.
1727 : */
1728 : bool AllDrawObjsOnPage( SwDoc& p_rDoc );
1729 :
1730 : /** method to check, if the outline style has to written as a normal list style
1731 :
1732 : #i69627#
1733 : The outline style has to written as a normal list style, if a parent
1734 : paragraph style of one of the paragraph styles, which are assigned to
1735 : the list levels of the outline style, has a list style set or inherits
1736 : a list style from its parent paragraphs style.
1737 : This information is needed for the OpenDocument file format export.
1738 :
1739 : @author OD
1740 :
1741 : @param rDoc
1742 : input parameter - reference to the text document, which is investigated.
1743 :
1744 : @return boolean
1745 : indicating, if the outline style has to written as a normal list style
1746 : */
1747 : bool HasOutlineStyleToBeWrittenAsNormalListStyle( SwDoc& rDoc );
1748 : }
1749 :
1750 : bool sw_GetPostIts( IDocumentFieldsAccess* pIDFA, _SetGetExpFlds * pSrtLst );
1751 :
1752 : #endif //_DOC_HXX
1753 :
1754 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|