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