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 SW_DOC_HXX
20 : #define SW_DOC_HXX
21 :
22 : /** SwDoc interfaces */
23 :
24 : #include <IInterface.hxx>
25 : #include <IDocumentSettingAccess.hxx>
26 : #include <IDocumentDeviceAccess.hxx>
27 : #include <IDocumentMarkAccess.hxx>
28 : #include <IDocumentRedlineAccess.hxx>
29 : #include <IDocumentLinksAdministration.hxx>
30 : #include <IDocumentFieldsAccess.hxx>
31 : #include <IDocumentContentOperations.hxx>
32 : #include <IDocumentStylePoolAccess.hxx>
33 : #include <IDocumentLineNumberAccess.hxx>
34 : #include <IDocumentStatistics.hxx>
35 : #include <IDocumentState.hxx>
36 : #include <IDocumentDrawModelAccess.hxx>
37 : #include <IDocumentLayoutAccess.hxx>
38 : #include <IDocumentTimerAccess.hxx>
39 : #include <IDocumentChartDataProviderAccess.hxx>
40 : #include <IDocumentOutlineNodes.hxx>
41 : #include <IDocumentListItems.hxx>
42 :
43 : #include <IDocumentListsAccess.hxx>
44 : class SwList;
45 :
46 : #include <IDocumentExternalData.hxx>
47 : #include <com/sun/star/embed/XEmbeddedObject.hpp>
48 : #include <com/sun/star/embed/XStorage.hpp>
49 : #include <vcl/timer.hxx>
50 : #include <sal/macros.h>
51 : #include "swdllapi.h"
52 : #include <swtypes.hxx>
53 : #include <swatrset.hxx>
54 : #include <toxe.hxx> // enums
55 : #include <flyenum.hxx>
56 : #include <flypos.hxx>
57 : #include <itabenum.hxx>
58 : #include <swdbdata.hxx>
59 : #include <chcmprse.hxx>
60 : #include <com/sun/star/linguistic2/XSpellChecker1.hpp>
61 : #include <com/sun/star/linguistic2/XHyphenatedWord.hpp>
62 : #include <rtl/ref.hxx>
63 : #include <svx/svdtypes.hxx>
64 : #include <sfx2/objsh.hxx>
65 : #include <svl/style.hxx>
66 : #include <editeng/numitem.hxx>
67 : #include "comphelper/implementationreference.hxx"
68 : #include <com/sun/star/chart2/data/XDataProvider.hpp>
69 : #include <com/sun/star/linguistic2/XProofreadingIterator.hpp>
70 : #include <com/sun/star/script/vba/XVBAEventProcessor.hpp>
71 :
72 : #include <boost/unordered_map.hpp>
73 : #include <stringhash.hxx>
74 :
75 : #include <svtools/embedhlp.hxx>
76 : #include <vector>
77 : #include <set>
78 : #include <map>
79 : #include <memory>
80 :
81 : #include <boost/scoped_ptr.hpp>
82 : #include <boost/ptr_container/ptr_vector.hpp>
83 :
84 : namespace editeng { class SvxBorderLine; }
85 :
86 : class SvxForbiddenCharactersTable;
87 : class SwExtTextInput;
88 : class DateTime;
89 : class EditFieldInfo;
90 : class JobSetup;
91 : class Color;
92 : class KeyCode;
93 : class Outliner;
94 : class OutputDevice;
95 : class Point;
96 : class SbxArray;
97 : class SdrModel;
98 : class SdrObject;
99 : class SdrUndoAction;
100 : class VirtualDevice;
101 : class SfxPrinter;
102 : class SvNumberFormatter;
103 : class SvxMacro;
104 : class SvxMacroTableDtor;
105 : class SwAutoCompleteWord;
106 : class SwAutoCorrExceptWord;
107 : class SwCalc;
108 : class SwCellFrm;
109 : class SwCharFmt;
110 : class SwCharFmts;
111 : class SwConditionTxtFmtColl;
112 : class SwCrsrShell;
113 : class SwCursor;
114 : class SwDBNameInfField;
115 : class SwDocShell;
116 : class SwDocUpdtFld;
117 : class SwDrawFrmFmt;
118 : class SwDrawView;
119 : class SwEditShell;
120 : class SwFieldType;
121 : class SwField;
122 : class SwTxtFld;
123 : class SwFldTypes;
124 : class SwFlyFrmFmt;
125 : class SwFmtsBase;
126 : class SwFmt;
127 : class SwFmtINetFmt;
128 : class SwFmtRefMark;
129 : class SwFrmFmt;
130 : class SwFrmFmts;
131 : class SwFtnIdxs;
132 : class SwFtnInfo;
133 : class SwEndNoteInfo;
134 : class GraphicObject;
135 : class SwGrfFmtColl;
136 : class SwGrfFmtColls;
137 : class SwLineNumberInfo;
138 : class SwNewDBMgr;
139 : class SwNoTxtNode;
140 : class SwNodeIndex;
141 : class SwNodeRange;
142 : class SwNodes;
143 : class SwNumRule;
144 : class SwNumRuleTbl;
145 : class SwPageDesc;
146 : class SwPagePreViewPrtData;
147 : class SwRedline;
148 : class SwRedlineTbl;
149 : class SwRootFrm;
150 : class SwRubyList;
151 : class SwRubyListEntry;
152 : class SwSectionFmt;
153 : class SwSectionFmts;
154 : class SwSectionData;
155 : class SwSelBoxes;
156 : class SwTOXBase;
157 : class SwTOXBaseSection;
158 : class SwTOXMark;
159 : class SwTOXMarks;
160 : class SwTOXType;
161 : class SwTOXTypes;
162 : class SwTabCols;
163 : class SwTable;
164 : class SwTableAutoFmt;
165 : class SwTableBox;
166 : class SwTableBoxFmt;
167 : class SwTableFmt;
168 : class SwTableLineFmt;
169 : class SwTableNode;
170 : class SwTextBlocks;
171 : class SwTxtFmtColl;
172 : class SwTxtFmtColls;
173 : class SwURLStateChanged;
174 : class SwUnoCrsr;
175 : class SwUnoCrsrTbl;
176 : class ViewShell;
177 : class _SetGetExpFld;
178 : class SwDrawContact;
179 : class SwLayouter;
180 : class SdrView;
181 : class SdrMarkList;
182 : class SwAuthEntry;
183 : class SwLayoutCache;
184 : class IStyleAccess;
185 : struct SwCallMouseEvent;
186 : struct SwDocStat;
187 : struct SwHash;
188 : struct SwSortOptions;
189 : struct SwDefTOXBase_Impl;
190 : class SwPrintData;
191 : class SwPrintUIOptions;
192 : class SdrPageView;
193 : struct SwConversionArgs;
194 : class SwRewriter;
195 : class SwMsgPoolItem;
196 : class SwChartDataProvider;
197 : class SwChartLockController_Helper;
198 : class IGrammarContact;
199 : class SwPrintData;
200 : class SwRenderData;
201 : class SwPageFrm;
202 : class SwViewOption;
203 : class IDocumentUndoRedo;
204 :
205 : namespace sw { namespace mark {
206 : class MarkManager;
207 : }}
208 : namespace sw {
209 : class MetaFieldManager;
210 : class UndoManager;
211 : class IShellCursorSupplier;
212 : }
213 :
214 : namespace com { namespace sun { namespace star {
215 : namespace i18n {
216 : struct ForbiddenCharacters; ///< comes from the I18N UNO interface
217 : }
218 : namespace uno {
219 : template < class > class Sequence;
220 : }
221 : namespace container {
222 : class XNameContainer; ///< for getXForms()/isXForms()/initXForms() methods
223 : }
224 : }}}
225 :
226 : namespace sfx2 {
227 : class SvLinkSource;
228 : class IXmlIdRegistry;
229 : class LinkManager;
230 : }
231 :
232 : /// PageDescriptor-interface, Array because of inlines.
233 898 : class SwPageDescs : public std::vector<SwPageDesc*>
234 : {
235 : public:
236 : /// the destructor will free all objects still in the vector
237 : ~SwPageDescs();
238 : };
239 :
240 : /// forward declaration
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 : public IDocumentSettingAccess,
250 : public IDocumentDeviceAccess,
251 : public IDocumentRedlineAccess,
252 : public IDocumentLinksAdministration,
253 : public IDocumentFieldsAccess,
254 : public IDocumentContentOperations,
255 : public IDocumentStylePoolAccess,
256 : public IDocumentLineNumberAccess,
257 : public IDocumentStatistics,
258 : public IDocumentState,
259 : public IDocumentDrawModelAccess,
260 : public IDocumentLayoutAccess,
261 : public IDocumentTimerAccess,
262 : public IDocumentChartDataProviderAccess,
263 : public IDocumentListItems,
264 : public IDocumentOutlineNodes,
265 : public IDocumentListsAccess,
266 : public IDocumentExternalData
267 : {
268 :
269 : friend void _InitCore();
270 : friend void _FinitCore();
271 :
272 : //---------------- private Member --------------------------------
273 :
274 : // -------------------------------------------------------------------
275 : ::boost::scoped_ptr<SwNodes> m_pNodes; ///< document content (Nodes Array)
276 : SwAttrPool* mpAttrPool; ///< the attribute pool
277 : SwPageDescs maPageDescs; ///< PageDescriptors
278 : Link maOle2Link; ///< OLE 2.0-notification
279 : /* @@@MAINTAINABILITY-HORROR@@@
280 : Timer should not be members of the model
281 : */
282 : Timer maIdleTimer; ///< Own IdleTimer
283 : Timer maOLEModifiedTimer; ///< Timer for update modified OLE-Objecs
284 : Timer maStatsUpdateTimer; ///< Timer for asynchronous stats calculation
285 : SwDBData maDBData; ///< database descriptor
286 : ::com::sun::star::uno::Sequence <sal_Int8 > maRedlinePasswd;
287 : String msTOIAutoMarkURL; ///< ::com::sun::star::util::URL of table of index AutoMark file
288 : boost::ptr_vector< boost::nullable<String> > maPatternNms; // Array for names of document-templates
289 : com::sun::star::uno::Reference<com::sun::star::container::XNameContainer>
290 : mxXForms; ///< container with XForms models
291 : mutable com::sun::star::uno::Reference< com::sun::star::linguistic2::XProofreadingIterator > m_xGCIterator;
292 :
293 : const ::boost::scoped_ptr< ::sw::mark::MarkManager> mpMarkManager;
294 : const ::boost::scoped_ptr< ::sw::MetaFieldManager > m_pMetaFieldManager;
295 : const ::boost::scoped_ptr< ::sw::UndoManager > m_pUndoManager;
296 :
297 : // -------------------------------------------------------------------
298 : // Pointer
299 :
300 : SwFrmFmt *mpDfltFrmFmt; ///< Default formats.
301 : SwFrmFmt *mpEmptyPageFmt; ///< Format for the default empty page
302 : SwFrmFmt *mpColumnContFmt; ///< Format for column container
303 : SwCharFmt *mpDfltCharFmt;
304 : SwTxtFmtColl *mpDfltTxtFmtColl; ///< Defaultformatcollections
305 : SwGrfFmtColl *mpDfltGrfFmtColl;
306 :
307 : SwFrmFmts *mpFrmFmtTbl; ///< Format table
308 : SwCharFmts *mpCharFmtTbl;
309 : SwFrmFmts *mpSpzFrmFmtTbl;
310 : SwSectionFmts *mpSectionFmtTbl;
311 : SwFrmFmts *mpTblFrmFmtTbl; ///< For tables
312 : SwTxtFmtColls *mpTxtFmtCollTbl; ///< FormatCollections
313 : SwGrfFmtColls *mpGrfFmtCollTbl;
314 :
315 : SwTOXTypes *mpTOXTypes; ///< Tables/indices
316 : SwDefTOXBase_Impl * mpDefTOXBases; ///< defaults of SwTOXBase's
317 :
318 : ViewShell *mpCurrentView; ///< SwDoc should get a new member mpCurrentView//swmod 071225
319 : SdrModel *mpDrawModel; ///< StarView Drawing
320 :
321 : SwDocUpdtFld *mpUpdtFlds; ///< Struct for updating fields
322 : SwFldTypes *mpFldTypes;
323 : SwNewDBMgr *mpNewDBMgr; /**< Pointer to the new DBMgr for
324 : evaluation of DB-fields. */
325 :
326 : VirtualDevice *mpVirDev; ///< can be used for formatting
327 : SfxPrinter *mpPrt; ///< can be used for formatting
328 : SwPrintData *mpPrtData; ///< Print configuration
329 :
330 : SwDoc *mpGlossaryDoc; ///< Pointer to glossary-document.
331 :
332 : SwNumRule *mpOutlineRule;
333 : SwFtnInfo *mpFtnInfo;
334 : SwEndNoteInfo *mpEndNoteInfo;
335 : SwLineNumberInfo*mpLineNumberInfo;
336 : SwFtnIdxs *mpFtnIdxs;
337 : SwDocStat *mpDocStat; ///< Statistics information.
338 :
339 : SwDocShell *mpDocShell; ///< Ptr to SfxDocShell of Doc.
340 : SfxObjectShellLock mxTmpDocShell; ///< A temporary shell that is used to copy OLE-Nodes
341 :
342 :
343 : sfx2::LinkManager *mpLinkMgr; ///< List of linked stuff (graphics/DDE/OLE).
344 :
345 : SwAutoCorrExceptWord *mpACEWord; /**< For the automated takeover of
346 : auto-corrected words that are "re-corrected". */
347 : SwURLStateChanged *mpURLStateChgd; ///< SfxClient for changes in INetHistory
348 : SvNumberFormatter *mpNumberFormatter;///< NumFormatter for tables / fields
349 :
350 : mutable SwNumRuleTbl *mpNumRuleTbl; ///< List of all named NumRules.
351 :
352 : /// Hash map to find numrules by name
353 : mutable boost::unordered_map<String, SwNumRule *, StringHash> maNumRuleMap;
354 :
355 : typedef boost::unordered_map< String, SwList*, StringHash > tHashMapForLists;
356 : /// container to hold the lists of the text document
357 : tHashMapForLists maLists;
358 : /// relation between list style and its default list
359 : tHashMapForLists maListStyleLists;
360 :
361 : SwRedlineTbl *mpRedlineTbl; ///< List of all Redlines.
362 : String *mpAutoFmtRedlnComment; ///< Comment for Redlines inserted via AutoFormat.
363 :
364 : SwUnoCrsrTbl *mpUnoCrsrTbl;
365 :
366 : SwPagePreViewPrtData *mpPgPViewPrtData; ///< Indenting / spacing for printing of page view.
367 : SwPaM *mpExtInputRing;
368 :
369 : SwLayouter *mpLayouter; /**< ::com::sun::star::frame::Controller for complex layout formatting
370 : like footnote/endnote in sections */
371 : IStyleAccess *mpStyleAccess; ///< handling of automatic styles
372 : SwLayoutCache *mpLayoutCache; /**< Layout cache to read and save with the
373 : document for a faster formatting */
374 :
375 : SwModify *mpUnoCallBack;
376 : IGrammarContact *mpGrammarContact; ///< for grammar checking in paragraphs during editing
377 :
378 : mutable comphelper::ImplementationReference< SwChartDataProvider
379 : , ::com::sun::star::chart2::data::XDataProvider >
380 : maChartDataProviderImplRef;
381 : SwChartLockController_Helper *mpChartControllerHelper;
382 :
383 : /// table of forbidden characters of this document
384 : rtl::Reference<SvxForbiddenCharactersTable> mxForbiddenCharsTable;
385 : com::sun::star::uno::Reference< com::sun::star::script::vba::XVBAEventProcessor > mxVbaEvents;
386 : com::sun::star::uno::Reference<com::sun::star::container::XNameContainer> m_xTemplateToProjectCache;
387 : public:
388 : struct lessThanNodeNum
389 : {
390 : bool operator()( const SwNodeNum* pNodeNumOne,
391 : const SwNodeNum* pNodeNumTwo ) const;
392 : };
393 :
394 : typedef ::std::set< const SwNodeNum*, lessThanNodeNum > tImplSortedNodeNumList;
395 : private:
396 : tImplSortedNodeNumList* mpListItemsList;
397 :
398 : ::std::auto_ptr< ::sfx2::IXmlIdRegistry > m_pXmlIdRegistry;
399 :
400 : // -------------------------------------------------------------------
401 : // other
402 :
403 : sal_uInt16 mnUndoCnt; ///< Count of Undo Actions.
404 : sal_uInt16 mnUndoSttEnd; ///< != 0 -> within parentheses.
405 :
406 : sal_uInt16 mnAutoFmtRedlnCommentNo; /**< SeqNo for conjoining of AutoFmt-Redlines.
407 : by the UI. Managed by SwAutoFmt! */
408 :
409 : sal_uInt16 mnLinkUpdMode; ///< UpdateMode for links.
410 : SwFldUpdateFlags meFldUpdMode;///< Automatically Update Mode for fields/charts.
411 : RedlineMode_t meRedlineMode; ///< Current Redline Mode.
412 : SwCharCompressType meChrCmprType;///< for ASIAN: compress punctuation/kana
413 :
414 : sal_uInt32 mnRsid; ///< current session ID of the document
415 : sal_uInt32 mnRsidRoot; ///< session ID when the document was created
416 :
417 : sal_Int32 mReferenceCount;
418 : sal_Int32 mIdleBlockCount;
419 : sal_Int8 mnLockExpFld; ///< If != 0 UpdateExpFlds() has no effect!
420 :
421 : /** Draw Model Layer IDs
422 : * LayerIds, Heaven == above document
423 : * Hell == below document
424 : * Controls == at the very top
425 : */
426 : SdrLayerID mnHeaven;
427 : SdrLayerID mnHell;
428 : SdrLayerID mnControls;
429 : SdrLayerID mnInvisibleHeaven;
430 : SdrLayerID mnInvisibleHell;
431 : SdrLayerID mnInvisibleControls;
432 :
433 : bool mbGlossDoc : 1; ///< TRUE: glossary document.
434 : bool mbModified : 1; ///< TRUE: document has changed.
435 : bool mbDtor : 1; /**< TRUE: is in SwDoc DTOR.
436 : and unfortunately temorarily also in
437 : SwSwgReader::InLayout() when flawed
438 : frames need deletion. */
439 : bool mbPageNums : 1; ///< TRUE: There are virtual page numbers.
440 : bool mbLoaded : 1; ///< TRUE: Doc loaded.
441 : bool mbUpdateExpFld : 1; ///< TRUE: Update expression fields.
442 : bool mbNewDoc : 1; ///< TRUE: new Doc.
443 : bool mbNewFldLst : 1; ///< TRUE: Rebuild field-list.
444 : bool mbCopyIsMove : 1; ///< TRUE: Copy is a hidden Move.
445 : bool mbVisibleLinks : 1; ///< TRUE: Links are inserted visibly.
446 : bool mbInReading : 1; ///< TRUE: Document is in the process of being read.
447 : bool mbInXMLImport : 1; ///< TRUE: During xml import, attribute portion building is not necessary.
448 : bool mbUpdateTOX : 1; ///< TRUE: After loading document, update TOX.
449 : bool mbInLoadAsynchron : 1; ///< TRUE: Document is in the process of being loaded asynchronously.
450 : bool mbHTMLMode : 1; ///< TRUE: Document is in HTMLMode.
451 : bool mbInCallModified : 1; ///< TRUE: in Set/Reset-Modified link.
452 : bool mbIsGlobalDoc : 1; ///< TRUE: It's a global document.
453 : bool mbGlblDocSaveLinks : 1; ///< TRUE: Save sections linked in global document.
454 : bool mbIsLabelDoc : 1; ///< TRUE: It's a label document.
455 : bool mbIsAutoFmtRedline : 1; ///< TRUE: Redlines are recorded by Autoformat.
456 : bool mbOLEPrtNotifyPending : 1; /**< TRUE: Printer has changed. At creation of
457 : ::com::sun::star::sdbcx::View
458 : notification of OLE-Objects PrtOLENotify() is required. */
459 : bool mbAllOLENotify : 1; ///< True: Notification of all objects is required.
460 : bool mbIsRedlineMove : 1; ///< True: Redlines are moved into to / out of the section.
461 : bool mbInsOnlyTxtGlssry : 1; ///< True: insert 'only text' glossary into doc
462 : bool mbContains_MSVBasic : 1; ///< True: MS-VBasic exist is in our storage
463 : bool mbPurgeOLE : 1; ///< sal_True: Purge OLE-Objects
464 : bool mbKernAsianPunctuation : 1; ///< sal_True: kerning also for ASIAN punctuation
465 : bool mbReadlineChecked : 1; ///< sal_True: if the query was already shown
466 : bool mbLinksUpdated : 1; /**< #i38810#
467 : flag indicating, that the links have been updated. */
468 : bool mbClipBoard : 1; ///< TRUE: this document represents the clipboard
469 : bool mbColumnSelection : 1; /**< TRUE: this content has bee created by a column selection
470 : (clipboard docs only) */
471 :
472 : #ifdef DBG_UTIL
473 : bool mbXMLExport : 1; ///< sal_True: during XML export
474 : #endif
475 :
476 : // true: Document contains at least one anchored object, which is anchored AT_PAGE with a content position.
477 : // Thus, certain adjustment needed during formatting for these kind of anchored objects.
478 : bool mbContainsAtPageObjWithContentAnchor : 1;
479 :
480 : //
481 : // COMPATIBILITY FLAGS START
482 : //
483 : //
484 : // HISTORY OF THE COMPATIBILITY FLAGS:
485 : //
486 : // SO5:
487 : // mbParaSpaceMax def = sal_False, sal_True since SO8
488 : // mbParaSpaceMaxAtPages def = sal_False, sal_True since SO8
489 : //
490 : // SO6:
491 : // mbTabCompat def = sal_False, sal_True since SO8
492 : //
493 : // SO7:
494 : // mbUseVirtualDevice def = sal_True
495 : // mbAddFlyOffsets def = sal_False, hidden
496 : //
497 : // SO7pp1:
498 : // bOldNumbering def = sal_False, hidden
499 : //
500 : // SO8:
501 : // mbAddExternalLeading def = sal_True
502 : // mbUseHiResolutionVirtualDevice def = sal_True, hidden
503 : // mbOldLineSpacing def = sal_False
504 : // mbAddParaSpacingToTableCells def = sal_True
505 : // mbUseFormerObjectPos def = sal_False
506 : // mbUseFormerTextWrapping def = sal_False
507 : // mbConsiderWrapOnObjPos def = sal_False
508 : //
509 : // SO8pp1:
510 : // mbIgnoreFirstLineIndentInNumbering def = sal_False, hidden
511 : // mbDoNotJustifyLinesWithManualBreak def = sal_False, hidden
512 : // mbDoNotResetParaAttrsForNumFont def = sal_False, hidden
513 : //
514 : // SO8pp3
515 : // mbDoNotCaptureDrawObjsOnPage def = sal_False, hidden
516 : // - Relevant for drawing objects, which don't follow the text flow, but
517 : // whose position is outside the page area:
518 : // sal_False: Such drawing objects are captured on the page area of its anchor.
519 : // sal_True: Such drawing objects can leave the page area, they aren't captured.
520 : // mbTableRowKeep def = sal_False, hidden
521 : // mbIgnoreTabsAndBlanksForLineCalculation def = sal_False, hidden
522 : // mbClipAsCharacterAnchoredWriterFlyFrame def = sal_False, hidden
523 : // - Introduced in order to re-activate clipping of as-character anchored
524 : // Writer fly frames in method <SwFlyInCntFrm::MakeAll()> for documents,
525 : // which are created with version prior SO8/OOo 2.0
526 : //
527 : // SO8pp4
528 : // mbUnixForceZeroExtLeading def = sal_False, hidden
529 : //
530 : // SO8pu8
531 : // mbOldPrinterMetrics def = sal_False, hidden
532 : //
533 : // SO9
534 : // #i24363# tab stops relative to indent
535 : // mbTabRelativeToIndent def = sal_True, hidden
536 : // #i89181# suppress tab stop at left indent for paragraphs in lists, whose
537 : // list level position and space mode equals LABEL_ALIGNMENT and whose list
538 : // label is followed by a tab character.
539 : // mbTabAtLeftIndentForParagraphsInList def = sal_False, hidden
540 :
541 : bool mbParaSpaceMax : 1;
542 : bool mbParaSpaceMaxAtPages : 1;
543 : bool mbTabCompat : 1;
544 : bool mbUseVirtualDevice : 1;
545 : bool mbAddFlyOffsets : 1;
546 : bool mbAddExternalLeading : 1;
547 : bool mbUseHiResolutionVirtualDevice : 1;
548 : bool mbOldLineSpacing : 1; // #i11859#
549 : bool mbAddParaSpacingToTableCells : 1;
550 : bool mbUseFormerObjectPos : 1; // #i11860#
551 : bool mbUseFormerTextWrapping : 1;
552 : bool mbConsiderWrapOnObjPos : 1; // #i28701#
553 : // sal_True: object positioning algorithm has consider the wrapping style of // the floating screen objects as given by its attribute 'WrapInfluenceOnObjPos'
554 : // floating screen objects as given by its
555 : // attribute 'WrapInfluenceOnObjPos'.
556 : bool mbMathBaselineAlignment : 1; // TL 2010-10-29 #i972#
557 : bool mbStylesNoDefault : 1;
558 : bool mbFloattableNomargins : 1; ///< If paragraph margins next to a floating table should be ignored.
559 : bool mEmbedFonts : 1; ///< Whether to embed fonts used by the document when saving.
560 : bool mEmbedSystemFonts : 1; ///< Whether to embed also system fonts.
561 :
562 : // non-ui-compatibility flags:
563 : bool mbOldNumbering : 1;
564 : bool mbIgnoreFirstLineIndentInNumbering : 1; // #i47448#
565 : bool mbDoNotJustifyLinesWithManualBreak : 1; // #i49277#
566 : bool mbDoNotResetParaAttrsForNumFont : 1; // #i53199#
567 : bool mbTableRowKeep : 1;
568 : bool mbIgnoreTabsAndBlanksForLineCalculation : 1; // #i3952#
569 : bool mbDoNotCaptureDrawObjsOnPage : 1; // #i62875#
570 : bool mbOutlineLevelYieldsOutlineRule : 1;
571 : bool mbClipAsCharacterAnchoredWriterFlyFrames : 1;
572 : bool mbUnixForceZeroExtLeading : 1; // #i60945#
573 : bool mbOldPrinterMetrics : 1;
574 : bool mbTabRelativeToIndent : 1; // #i24363# tab stops relative to indent
575 : bool mbProtectForm : 1;
576 : bool mbInvertBorderSpacing : 1;
577 : bool mbCollapseEmptyCellPara : 1;
578 : bool mbTabAtLeftIndentForParagraphsInList; // #i89181# - see above
579 : bool mbSmallCapsPercentage66;
580 : bool mbTabOverflow;
581 : bool mbUnbreakableNumberings;
582 : bool mbClippedPictures;
583 : bool mbBackgroundParaOverDrawings;
584 : bool mbTabOverMargin;
585 :
586 : bool mbLastBrowseMode : 1;
587 :
588 : sal_uInt32 mn32DummyCompatabilityOptions1;
589 : sal_uInt32 mn32DummyCompatabilityOptions2;
590 : //
591 : // COMPATIBILITY FLAGS END
592 : //
593 :
594 : bool mbStartIdleTimer; ///< idle timer mode start/stop
595 :
596 : static SwAutoCompleteWord *mpACmpltWords; ///< List of all words for AutoComplete
597 :
598 : //---------------- private methods ------------------------------
599 : void checkRedlining(RedlineMode_t& _rReadlineMode);
600 :
601 :
602 : DECL_LINK( AddDrawUndo, SdrUndoAction * );
603 : // DrawModel
604 : void DrawNotifyUndoHdl();
605 :
606 : /** Only for internal use and therefore private.
607 : Copy a range within the same or to another document.
608 : Position may not lie within range! */
609 : bool CopyImpl( SwPaM&, SwPosition&, const bool MakeNewFrms /*= true */,
610 : const bool bCopyAll, SwPaM *const pCpyRng /*= 0*/ ) const;
611 :
612 : SwFlyFrmFmt* _MakeFlySection( const SwPosition& rAnchPos,
613 : const SwCntntNode& rNode, RndStdIds eRequestId,
614 : const SfxItemSet* pFlyAttrSet,
615 : SwFrmFmt* = 0 );
616 :
617 : SwFlyFrmFmt* _InsNoTxtNode( const SwPosition&rPos, SwNoTxtNode*,
618 : const SfxItemSet* pFlyAttrSet,
619 : const SfxItemSet* pGrfAttrSet,
620 : SwFrmFmt* = 0 );
621 :
622 : void CopyFlyInFlyImpl( const SwNodeRange& rRg,
623 : const xub_StrLen nEndContentIndex,
624 : const SwNodeIndex& rStartIdx,
625 : const bool bCopyFlyAtFly = false ) const;
626 : sal_Int8 SetFlyFrmAnchor( SwFrmFmt& rFlyFmt, SfxItemSet& rSet, bool bNewFrms );
627 :
628 : typedef SwFmt* (SwDoc:: *FNCopyFmt)( const String&, SwFmt*, bool, bool );
629 : SwFmt* CopyFmt( const SwFmt& rFmt, const SwFmtsBase& rFmtArr,
630 : FNCopyFmt fnCopyFmt, const SwFmt& rDfltFmt );
631 : void CopyFmtArr( const SwFmtsBase& rSourceArr, SwFmtsBase& rDestArr,
632 : FNCopyFmt fnCopyFmt, SwFmt& rDfltFmt );
633 : void CopyPageDescHeaderFooterImpl( bool bCpyHeader,
634 : const SwFrmFmt& rSrcFmt, SwFrmFmt& rDestFmt );
635 : SwFmt* FindFmtByName( const SwFmtsBase& rFmtArr,
636 : const String& rName ) const;
637 :
638 : VirtualDevice& CreateVirtualDevice_() const;
639 : SfxPrinter& CreatePrinter_() const;
640 : void PrtDataChanged(); /**< Printer or JobSetup altered.
641 : Care has to be taken of the necessary
642 : invalidations and notifications. */
643 :
644 : /// gcc: aFtnInfo::CopyCtor is private, therefore we too have to protect ourselves.
645 : SwDoc( const SwDoc &);
646 :
647 : // For fields:
648 : void _InitFieldTypes(); ///< Called by CTOR!!
649 : void _MakeFldList( int eMode );
650 :
651 : /// Database fields:
652 : void UpdateDBNumFlds( SwDBNameInfField& rDBFld, SwCalc& rCalc );
653 : void AddUsedDBToList( std::vector<String>& rDBNameList,
654 : const std::vector<String>& rUsedDBNames );
655 : void AddUsedDBToList( std::vector<String>& rDBNameList, const String& rDBName );
656 : bool IsNameInArray( const std::vector<String>& rOldNames, const String& rName );
657 : void GetAllDBNames( std::vector<String>& rAllDBNames );
658 : void ReplaceUsedDBs( const std::vector<String>& rUsedDBNames,
659 : const String& rNewName, String& rFormel );
660 : std::vector<String>& FindUsedDBs( const std::vector<String>& rAllDBNames,
661 : const String& rFormel,
662 : std::vector<String>& rUsedDBNames );
663 :
664 : void InitDrawModel();
665 : void ReleaseDrawModel();
666 :
667 : void _CreateNumberFormatter();
668 :
669 : sal_Bool _UnProtectTblCells( SwTable& rTbl );
670 :
671 : /** Create sub-documents according to the given collection.
672 : If no collection is given, take chapter style of the 1st level. */
673 : bool SplitDoc( sal_uInt16 eDocType, const String& rPath, bool bOutline,
674 : const SwTxtFmtColl* pSplitColl, int nOutlineLevel = 0 );
675 :
676 : /// Update charts of given table.
677 : void _UpdateCharts( const SwTable& rTbl, ViewShell& rVSh ) const;
678 :
679 : sal_Bool _SelectNextRubyChars( SwPaM& rPam, SwRubyListEntry& rRubyEntry,
680 : sal_uInt16 nMode );
681 :
682 : /// Our own 'IdleTimer' calls the following method
683 : DECL_LINK( DoIdleJobs, Timer * );
684 : /// CharTimer calls this method.
685 : void DoUpdateAllCharts();
686 : DECL_LINK( DoUpdateModifiedOLE, Timer * );
687 :
688 : SwFmt *_MakeCharFmt(const String &, SwFmt *, bool, bool );
689 : SwFmt *_MakeFrmFmt(const String &, SwFmt *, bool, bool );
690 : SwFmt *_MakeTxtFmtColl(const String &, SwFmt *, bool, bool );
691 :
692 : void InitTOXTypes();
693 : void Paste( const SwDoc& );
694 : bool DeleteAndJoinImpl(SwPaM&, const bool);
695 : bool DeleteAndJoinWithRedlineImpl(SwPaM&, const bool unused = false);
696 : bool DeleteRangeImpl(SwPaM&, const bool unused = false);
697 : bool DeleteRangeImplImpl(SwPaM &);
698 : bool ReplaceRangeImpl(SwPaM&, String const&, const bool);
699 :
700 : public:
701 :
702 : /** Life cycle
703 : */
704 : SwDoc();
705 : ~SwDoc();
706 :
707 226554 : inline bool IsInDtor() const { return mbDtor; }
708 :
709 : /* @@@MAINTAINABILITY-HORROR@@@
710 : Implementation details made public.
711 : */
712 438710 : SwNodes & GetNodes() { return *m_pNodes; }
713 142563 : SwNodes const& GetNodes() const { return *m_pNodes; }
714 :
715 : /** IInterface
716 : */
717 : virtual sal_Int32 acquire();
718 : virtual sal_Int32 release();
719 : virtual sal_Int32 getReferenceCount() const;
720 :
721 : /** IDocumentSettingAccess
722 : */
723 : virtual bool get(/*[in]*/ DocumentSettingId id) const;
724 : virtual void set(/*[in]*/ DocumentSettingId id, /*[in]*/ bool value);
725 : virtual const com::sun::star::i18n::ForbiddenCharacters* getForbiddenCharacters(/*[in]*/ sal_uInt16 nLang, /*[in]*/ bool bLocaleData ) const;
726 : virtual void setForbiddenCharacters(/*[in]*/ sal_uInt16 nLang, /*[in]*/ const com::sun::star::i18n::ForbiddenCharacters& rForbiddenCharacters );
727 : virtual rtl::Reference<SvxForbiddenCharactersTable>& getForbiddenCharacterTable();
728 : virtual const rtl::Reference<SvxForbiddenCharactersTable>& getForbiddenCharacterTable() const;
729 : virtual sal_uInt16 getLinkUpdateMode( /*[in]*/bool bGlobalSettings ) const;
730 : virtual void setLinkUpdateMode( /*[in]*/ sal_uInt16 nMode );
731 : virtual SwFldUpdateFlags getFieldUpdateFlags( /*[in]*/bool bGlobalSettings ) const;
732 : virtual void setFieldUpdateFlags( /*[in]*/ SwFldUpdateFlags eMode );
733 : virtual SwCharCompressType getCharacterCompressionType() const;
734 : virtual void setCharacterCompressionType( /*[in]*/SwCharCompressType nType );
735 : virtual sal_uInt32 getRsid() const;
736 : virtual void setRsid( sal_uInt32 nVal );
737 : virtual sal_uInt32 getRsidRoot() const;
738 : virtual void setRsidRoot( sal_uInt32 nVal );
739 :
740 : /** IDocumentDeviceAccess
741 : */
742 : virtual SfxPrinter* getPrinter(/*[in]*/ bool bCreate ) const;
743 : virtual void setPrinter(/*[in]*/ SfxPrinter* pP,/*[in]*/ bool bDeleteOld,/*[in]*/ bool bCallPrtDataChanged );
744 : virtual VirtualDevice* getVirtualDevice(/*[in]*/ bool bCreate ) const;
745 : virtual void setVirtualDevice(/*[in]*/ VirtualDevice* pVd,/*[in]*/ bool bDeleteOld, /*[in]*/ bool bCallVirDevDataChanged );
746 : virtual OutputDevice* getReferenceDevice(/*[in]*/ bool bCreate ) const;
747 : virtual void setReferenceDeviceType(/*[in]*/ bool bNewVirtual,/*[in]*/ bool bNewHiRes );
748 : virtual const JobSetup* getJobsetup() const;
749 : virtual void setJobsetup(/*[in]*/ const JobSetup& rJobSetup );
750 : virtual const SwPrintData & getPrintData() const;
751 : virtual void setPrintData(/*[in]*/ const SwPrintData& rPrtData);
752 :
753 : /** IDocumentMarkAccess
754 : */
755 : IDocumentMarkAccess* getIDocumentMarkAccess();
756 : const IDocumentMarkAccess* getIDocumentMarkAccess() const;
757 :
758 : /** IDocumentRedlineAccess
759 : */
760 : virtual RedlineMode_t GetRedlineMode() const;
761 : virtual void SetRedlineMode_intern(/*[in]*/RedlineMode_t eMode);
762 : virtual void SetRedlineMode(/*[in]*/RedlineMode_t eMode);
763 : virtual bool IsRedlineOn() const;
764 : virtual bool IsIgnoreRedline() const;
765 : virtual bool IsInRedlines(const SwNode& rNode) const;
766 : virtual const SwRedlineTbl& GetRedlineTbl() const;
767 : virtual bool AppendRedline(/*[in]*/SwRedline* pPtr, /*[in]*/bool bCallDelete);
768 : virtual bool SplitRedline(const SwPaM& rPam);
769 : virtual bool DeleteRedline(/*[in]*/const SwPaM& rPam, /*[in]*/bool bSaveInUndo, /*[in]*/sal_uInt16 nDelType);
770 : virtual bool DeleteRedline(/*[in]*/const SwStartNode& rSection, /*[in]*/bool bSaveInUndo, /*[in]*/sal_uInt16 nDelType);
771 : virtual sal_uInt16 GetRedlinePos(/*[in]*/const SwNode& rNode, /*[in]*/sal_uInt16 nType) const;
772 : virtual void CompressRedlines();
773 : virtual const SwRedline* GetRedline(/*[in]*/const SwPosition& rPos, /*[in]*/sal_uInt16* pFndPos) const;
774 : virtual bool IsRedlineMove() const;
775 : virtual void SetRedlineMove(/*[in]*/bool bFlag);
776 : virtual bool AcceptRedline(/*[in]*/sal_uInt16 nPos, /*[in]*/bool bCallDelete);
777 : virtual bool AcceptRedline(/*[in]*/const SwPaM& rPam, /*[in]*/bool bCallDelete);
778 : virtual bool RejectRedline(/*[in]*/sal_uInt16 nPos, /*[in]*/bool bCallDelete);
779 : virtual bool RejectRedline(/*[in]*/const SwPaM& rPam, /*[in]*/bool bCallDelete);
780 : virtual const SwRedline* SelNextRedline(/*[in]*/SwPaM& rPam) const;
781 : virtual const SwRedline* SelPrevRedline(/*[in]*/SwPaM& rPam) const;
782 : virtual void UpdateRedlineAttr();
783 : virtual sal_uInt16 GetRedlineAuthor();
784 : virtual sal_uInt16 InsertRedlineAuthor(const String& rAuthor);
785 : virtual bool SetRedlineComment(/*[in]*/const SwPaM& rPam, /*[in]*/const String& rComment);
786 : virtual const ::com::sun::star::uno::Sequence <sal_Int8>& GetRedlinePassword() const;
787 : virtual void SetRedlinePassword(/*[in]*/const ::com::sun::star::uno::Sequence <sal_Int8>& rNewPassword);
788 :
789 : /** IDocumentUndoRedo
790 : */
791 : IDocumentUndoRedo & GetIDocumentUndoRedo();
792 : IDocumentUndoRedo const& GetIDocumentUndoRedo() const;
793 :
794 : /** IDocumentLinksAdministration
795 : */
796 : virtual bool IsVisibleLinks() const;
797 : virtual void SetVisibleLinks(bool bFlag);
798 : virtual sfx2::LinkManager& GetLinkManager();
799 : virtual const sfx2::LinkManager& GetLinkManager() const;
800 : virtual void UpdateLinks(bool bUI);
801 : virtual bool GetData(const OUString& rItem, const String& rMimeType, ::com::sun::star::uno::Any& rValue) const;
802 : virtual bool SetData(const OUString& rItem, const String& rMimeType, const ::com::sun::star::uno::Any& rValue);
803 : virtual ::sfx2::SvLinkSource* CreateLinkSource(const OUString& rItem);
804 : virtual bool EmbedAllLinks();
805 : virtual void SetLinksUpdated(const bool bNewLinksUpdated);
806 : virtual bool LinksUpdated() const;
807 :
808 : /** IDocumentFieldsAccess
809 : */
810 : virtual const SwFldTypes *GetFldTypes() const;
811 : virtual SwFieldType *InsertFldType(const SwFieldType &);
812 : virtual SwFieldType *GetSysFldType( const sal_uInt16 eWhich ) const;
813 : virtual SwFieldType* GetFldType(sal_uInt16 nResId, const String& rName, bool bDbFieldMatching) const;
814 : virtual void RemoveFldType(sal_uInt16 nFld);
815 : virtual void UpdateFlds( SfxPoolItem* pNewHt, bool bCloseDB);
816 : virtual void InsDeletedFldType(SwFieldType &);
817 : virtual bool PutValueToField(const SwPosition & rPos, const com::sun::star::uno::Any& rVal, sal_uInt16 nWhich);
818 : virtual bool UpdateFld(SwTxtFld * rDstFmtFld, SwField & rSrcFld, SwMsgPoolItem * pMsgHnt, bool bUpdateTblFlds);
819 : virtual void UpdateRefFlds(SfxPoolItem* pHt);
820 : virtual void UpdateTblFlds(SfxPoolItem* pHt);
821 : virtual void UpdateExpFlds(SwTxtFld* pFld, bool bUpdateRefFlds);
822 : virtual void UpdateUsrFlds();
823 : virtual void UpdatePageFlds(SfxPoolItem*);
824 : virtual void LockExpFlds();
825 : virtual void UnlockExpFlds();
826 : virtual bool IsExpFldsLocked() const;
827 : virtual SwDocUpdtFld& GetUpdtFlds() const;
828 : virtual bool SetFieldsDirty(bool b, const SwNode* pChk, sal_uLong nLen);
829 : virtual void SetFixFields(bool bOnlyTimeDate, const DateTime* pNewDateTime);
830 : virtual void FldsToCalc(SwCalc& rCalc, sal_uLong nLastNd, sal_uInt16 nLastCnt);
831 : virtual void FldsToCalc(SwCalc& rCalc, const _SetGetExpFld& rToThisFld);
832 : virtual void FldsToExpand(SwHash**& ppTbl, sal_uInt16& rTblSize, const _SetGetExpFld& rToThisFld);
833 : virtual bool IsNewFldLst() const;
834 : virtual void SetNewFldLst( bool bFlag);
835 : virtual void InsDelFldInFldLst(bool bIns, const SwTxtFld& rFld);
836 :
837 : /** Returns the field at a certain position.
838 : @param rPos position to search at
839 : @return pointer to field at the given position or NULL in case no field is found
840 : */
841 : static SwField* GetField(const SwPosition& rPos);
842 :
843 : /** Returns the field at a certain position.
844 : @param rPos position to search at
845 : @return pointer to field at the given position or NULL in case no field is found
846 : */
847 : static SwTxtFld* GetTxtFld(const SwPosition& rPos);
848 : bool containsUpdatableFields();
849 :
850 : /** IDocumentContentOperations
851 : */
852 : virtual bool CopyRange(SwPaM&, SwPosition&, const bool bCopyAll) const;
853 : virtual void DeleteSection(SwNode* pNode);
854 : virtual bool DeleteRange(SwPaM&);
855 : virtual bool DelFullPara(SwPaM&);
856 : // Add optional parameter <bForceJoinNext>, default value <false>
857 : // Needed for hiding of deletion redlines
858 : virtual bool DeleteAndJoin( SwPaM&,
859 : const bool bForceJoinNext = false );
860 :
861 : virtual bool MoveRange(SwPaM&, SwPosition&, SwMoveFlags);
862 : virtual bool MoveNodeRange(SwNodeRange&, SwNodeIndex&, SwMoveFlags);
863 : virtual bool MoveAndJoin(SwPaM&, SwPosition&, SwMoveFlags);
864 : virtual bool Overwrite(const SwPaM &rRg, const String& rStr);
865 : virtual bool InsertString(const SwPaM &rRg, const String&,
866 : const enum InsertFlags nInsertMode = INS_EMPTYEXPAND );
867 : virtual bool UpdateParRsid( SwTxtNode *pTxtNode, sal_uInt32 nVal = 0 );
868 : virtual bool UpdateRsid( const SwPaM &rRg, xub_StrLen nLen );
869 : virtual SwFlyFrmFmt* Insert(const SwPaM &rRg, const String& rGrfName, const String& rFltName, const Graphic* pGraphic,
870 : const SfxItemSet* pFlyAttrSet, const SfxItemSet* pGrfAttrSet, SwFrmFmt*);
871 : virtual SwFlyFrmFmt* Insert(const SwPaM& rRg, const GraphicObject& rGrfObj, const SfxItemSet* pFlyAttrSet,
872 : const SfxItemSet* pGrfAttrSet, SwFrmFmt*);
873 : virtual SwDrawFrmFmt* Insert(const SwPaM &rRg, SdrObject& rDrawObj, const SfxItemSet* pFlyAttrSet, SwFrmFmt*);
874 : virtual SwFlyFrmFmt* Insert(const SwPaM &rRg, const svt::EmbeddedObjectRef& xObj, const SfxItemSet* pFlyAttrSet,
875 : const SfxItemSet* pGrfAttrSet, SwFrmFmt*);
876 : /// Add a para for the char attribute exp...
877 : virtual bool InsertPoolItem(const SwPaM &rRg, const SfxPoolItem&,
878 : const SetAttrMode nFlags,bool bExpandCharToPara=false);
879 : virtual bool InsertItemSet (const SwPaM &rRg, const SfxItemSet&,
880 : const SetAttrMode nFlags);
881 : virtual void ReRead(SwPaM&, const String& rGrfName, const String& rFltName, const Graphic* pGraphic, const GraphicObject* pGrfObj);
882 : virtual void TransliterateText(const SwPaM& rPaM, utl::TransliterationWrapper&);
883 : virtual SwFlyFrmFmt* InsertOLE(const SwPaM &rRg, const String& rObjName, sal_Int64 nAspect, const SfxItemSet* pFlyAttrSet,
884 : const SfxItemSet* pGrfAttrSet, SwFrmFmt*);
885 : virtual bool SplitNode(const SwPosition &rPos, bool bChkTableStart);
886 : virtual bool AppendTxtNode(SwPosition& rPos);
887 : virtual void SetModified(SwPaM &rPaM);
888 : virtual bool ReplaceRange(SwPaM& rPam, const String& rNewStr,
889 : const bool bRegExReplace);
890 : virtual void RemoveLeadingWhiteSpace(const SwPosition & rPos );
891 :
892 : /** IDocumentStylePoolAccess
893 : */
894 : virtual SwTxtFmtColl* GetTxtCollFromPool( sal_uInt16 nId, bool bRegardLanguage = true );
895 : virtual SwFmt* GetFmtFromPool( sal_uInt16 nId );
896 : virtual SwFrmFmt* GetFrmFmtFromPool( sal_uInt16 nId );
897 : virtual SwCharFmt* GetCharFmtFromPool( sal_uInt16 nId );
898 : virtual SwPageDesc* GetPageDescFromPool( sal_uInt16 nId, bool bRegardLanguage = true );
899 : virtual SwNumRule* GetNumRuleFromPool( sal_uInt16 nId );
900 : virtual bool IsPoolTxtCollUsed( sal_uInt16 nId ) const;
901 : virtual bool IsPoolFmtUsed( sal_uInt16 nId ) const;
902 : virtual bool IsPoolPageDescUsed( sal_uInt16 nId ) const;
903 :
904 : /** IDocumentLineNumberAccess
905 : */
906 : virtual const SwLineNumberInfo& GetLineNumberInfo() const;
907 : virtual void SetLineNumberInfo(const SwLineNumberInfo& rInfo);
908 :
909 : /** IDocumentStatistics
910 : */
911 : virtual void DocInfoChgd();
912 : virtual const SwDocStat &GetDocStat() const;
913 : virtual const SwDocStat &GetUpdatedDocStat(bool bCompleteAsync = false);
914 : virtual void SetDocStat(const SwDocStat& rStat);
915 : virtual void UpdateDocStat(bool bCompleteAsync = false);
916 :
917 : /** IDocumentState
918 : */
919 : virtual void SetModified();
920 : virtual void ResetModified();
921 : virtual bool IsModified() const;
922 : virtual bool IsLoaded() const;
923 : virtual bool IsUpdateExpFld() const;
924 : virtual bool IsNewDoc() const;
925 : virtual bool IsPageNums() const;
926 : virtual void SetPageNums(bool b);
927 : virtual void SetNewDoc(bool b);
928 : virtual void SetUpdateExpFldStat(bool b);
929 : virtual void SetLoaded(bool b);
930 :
931 : /** IDocumentDrawModelAccess
932 : */
933 : virtual const SdrModel* GetDrawModel() const;
934 : virtual SdrModel* GetDrawModel();
935 : virtual SdrLayerID GetHeavenId() const;
936 : virtual SdrLayerID GetHellId() const;
937 : virtual SdrLayerID GetControlsId() const;
938 : virtual SdrLayerID GetInvisibleHeavenId() const;
939 : virtual SdrLayerID GetInvisibleHellId() const;
940 : virtual SdrLayerID GetInvisibleControlsId() const;
941 : virtual void NotifyInvisibleLayers( SdrPageView& _rSdrPageView );
942 : virtual bool IsVisibleLayerId( const SdrLayerID& _nLayerId ) const;
943 : virtual SdrLayerID GetVisibleLayerIdByInvisibleOne( const SdrLayerID& _nInvisibleLayerId );
944 : virtual SdrLayerID GetInvisibleLayerIdByVisibleOne( const SdrLayerID& _nVisibleLayerId );
945 : virtual SdrModel* _MakeDrawModel();
946 : virtual SdrModel* GetOrCreateDrawModel();
947 :
948 : /** IDocumentLayoutAccess
949 : */
950 : virtual void SetCurrentViewShell( ViewShell* pNew );//swmod 071225
951 : virtual SwLayouter* GetLayouter();
952 : virtual const SwLayouter* GetLayouter() const;
953 : virtual void SetLayouter( SwLayouter* pNew );
954 : virtual SwFrmFmt* MakeLayoutFmt( RndStdIds eRequest, const SfxItemSet* pSet );
955 : virtual void DelLayoutFmt( SwFrmFmt *pFmt );
956 : virtual SwFrmFmt* CopyLayoutFmt( const SwFrmFmt& rSrc, const SwFmtAnchor& rNewAnchor, bool bSetTxtFlyAtt, bool bMakeFrms );
957 : virtual const ViewShell *GetCurrentViewShell() const; //swmod 080219
958 : virtual ViewShell *GetCurrentViewShell(); ///< swmod 080219 It must be able to communicate to a ViewShell.This is going to be removerd later.
959 : virtual const SwRootFrm *GetCurrentLayout() const;
960 : virtual SwRootFrm *GetCurrentLayout();//swmod 080219
961 : virtual bool HasLayout() const;
962 : void ClearSwLayouterEntries();
963 :
964 : /** IDocumentTimerAccess
965 : */
966 : virtual void StartIdling();
967 : virtual void StopIdling();
968 : virtual void BlockIdling();
969 : virtual void UnblockIdling();
970 : virtual void StartBackgroundJobs();
971 :
972 : /** IDocumentChartDataProviderAccess
973 : */
974 : virtual SwChartDataProvider * GetChartDataProvider( bool bCreate = false ) const;
975 : virtual void CreateChartInternalDataProviders( const SwTable *pTable );
976 : virtual SwChartLockController_Helper & GetChartControllerHelper();
977 :
978 : /** IDocumentListItems
979 : */
980 : virtual void addListItem( const SwNodeNum& rNodeNum );
981 : virtual void removeListItem( const SwNodeNum& rNodeNum );
982 : virtual String getListItemText( const SwNodeNum& rNodeNum,
983 : const bool bWithNumber = true,
984 : const bool bWithSpacesForLevel = false ) const;
985 : virtual void getListItems( IDocumentListItems::tSortedNodeNumList& orNodeNumList ) const;
986 : virtual void getNumItems( IDocumentListItems::tSortedNodeNumList& orNodeNumList ) const;
987 :
988 : /** IDocumentOutlineNodes
989 : */
990 : virtual sal_Int32 getOutlineNodesCount() const;
991 : virtual int getOutlineLevel( const sal_Int32 nIdx ) const;
992 : virtual String getOutlineText( const sal_Int32 nIdx,
993 : const bool bWithNumber,
994 : const bool bWithSpacesForLevel ) const;
995 : virtual SwTxtNode* getOutlineNode( const sal_Int32 nIdx ) const;
996 : virtual void getOutlineNodes( IDocumentOutlineNodes::tSortedOutlineNodeList& orOutlineNodeList ) const;
997 :
998 : /** IDocumentListsAccess
999 : */
1000 : virtual SwList* createList( String sListId,
1001 : const String sDefaultListStyleName );
1002 : virtual void deleteList( const String sListId );
1003 : virtual SwList* getListByName( const String sListId ) const;
1004 : virtual SwList* createListForListStyle( const String sListStyleName );
1005 : virtual SwList* getListForListStyle( const String sListStyleName ) const;
1006 : virtual void deleteListForListStyle( const String sListStyleName );
1007 : virtual void trackChangeOfListStyleName( const String sListStyleName,
1008 : const String sNewListStyleName );
1009 :
1010 : /** IDocumentExternalData */
1011 : virtual void setExternalData(::sw::tExternalDataType eType,
1012 : ::sw::tExternalDataPointer pPayload);
1013 : virtual ::sw::tExternalDataPointer getExternalData(::sw::tExternalDataType eType);
1014 :
1015 : /** INextInterface here
1016 : */
1017 :
1018 : DECL_STATIC_LINK( SwDoc, BackgroundDone, SvxBrushItem *);
1019 : DECL_LINK(CalcFieldValueHdl, EditFieldInfo*);
1020 :
1021 : /** OLE ???
1022 : */
1023 10914 : bool IsOLEPrtNotifyPending() const { return mbOLEPrtNotifyPending; }
1024 : inline void SetOLEPrtNotifyPending( bool bSet = true );
1025 : void PrtOLENotify( sal_Bool bAll ); //All or only marked
1026 :
1027 : #ifdef DBG_UTIL
1028 : bool InXMLExport() const { return mbXMLExport; }
1029 : void SetXMLExport( bool bFlag ) { mbXMLExport = bFlag; }
1030 : #endif
1031 :
1032 109 : void SetContainsAtPageObjWithContentAnchor( const bool bFlag )
1033 : {
1034 109 : mbContainsAtPageObjWithContentAnchor = bFlag;
1035 109 : }
1036 1260 : bool DoesContainAtPageObjWithContentAnchor()
1037 : {
1038 1260 : return mbContainsAtPageObjWithContentAnchor;
1039 : }
1040 :
1041 : /** Returns positions of all FlyFrames in the document.
1042 : If a Pam-Pointer is passed the FlyFrames attached to paragraphes
1043 : have to be surrounded completely by ::com::sun::star::awt::Selection.
1044 : ( Start < Pos < End ) !!!
1045 : (Required for Writers.) */
1046 : SwPosFlyFrms GetAllFlyFmts( const SwPaM* = 0,
1047 : bool bDrawAlso = false,
1048 : bool bAsCharAlso = false ) const;
1049 :
1050 : /// Because swrtf.cxx and define private public here now.
1051 : SwFlyFrmFmt *MakeFlyFrmFmt (const String &rFmtName, SwFrmFmt *pDerivedFrom);
1052 : SwDrawFrmFmt *MakeDrawFrmFmt(const String &rFmtName, SwFrmFmt *pDerivedFrom);
1053 :
1054 : // From now on this interface has to be used for Flys.
1055 : // pAnchorPos must be set, if they are not attached to pages AND
1056 : // ::com::sun::star::chaos::Anchor is not already set at valid CntntPos
1057 : // in FlySet/FrmFmt.
1058 : /* new parameter bCalledFromShell
1059 :
1060 : sal_True: An existing adjust item at pAnchorPos is propagated to
1061 : the content node of the new fly section. That propagation only
1062 : takes place if there is no adjust item in the paragraph style
1063 : for the new fly section.
1064 :
1065 : sal_False: no propagation
1066 : */
1067 : SwFlyFrmFmt* MakeFlySection( RndStdIds eAnchorType,
1068 : const SwPosition* pAnchorPos,
1069 : const SfxItemSet* pSet = 0,
1070 : SwFrmFmt *pParent = 0,
1071 : bool bCalledFromShell = false );
1072 : SwFlyFrmFmt* MakeFlyAndMove( const SwPaM& rPam, const SfxItemSet& rSet,
1073 : const SwSelBoxes* pSelBoxes = 0,
1074 : SwFrmFmt *pParent = 0 );
1075 :
1076 : void CopyWithFlyInFly( const SwNodeRange& rRg,
1077 : const xub_StrLen nEndContentIndex,
1078 : const SwNodeIndex& rInsPos,
1079 : sal_Bool bMakeNewFrms = sal_True,
1080 : sal_Bool bDelRedlines = sal_True,
1081 : sal_Bool bCopyFlyAtFly = sal_False ) const;
1082 :
1083 : bool SetFlyFrmAttr( SwFrmFmt& rFlyFmt, SfxItemSet& rSet );
1084 :
1085 : bool SetFrmFmtToFly( SwFrmFmt& rFlyFmt, SwFrmFmt& rNewFmt,
1086 : SfxItemSet* pSet = 0, bool bKeepOrient = false );
1087 : void SetFlyFrmTitle( SwFlyFrmFmt& rFlyFrmFmt,
1088 : const String& sNewTitle );
1089 : void SetFlyFrmDescription( SwFlyFrmFmt& rFlyFrmFmt,
1090 : const String& sNewDescription );
1091 :
1092 : /** Footnotes
1093 : */
1094 : // Footnote information
1095 4285 : const SwFtnInfo& GetFtnInfo() const { return *mpFtnInfo; }
1096 : void SetFtnInfo(const SwFtnInfo& rInfo);
1097 1323 : const SwEndNoteInfo& GetEndNoteInfo() const { return *mpEndNoteInfo; }
1098 : void SetEndNoteInfo(const SwEndNoteInfo& rInfo);
1099 19320 : SwFtnIdxs& GetFtnIdxs() { return *mpFtnIdxs; }
1100 93 : const SwFtnIdxs& GetFtnIdxs() const { return *mpFtnIdxs; }
1101 : /// change footnotes in area
1102 : bool SetCurFtn( const SwPaM& rPam, const String& rNumStr,
1103 : sal_uInt16 nNumber, bool bIsEndNote );
1104 :
1105 : /** Operations on the content of the document e.g.
1106 : spell-checking/hyphenating/word-counting
1107 : */
1108 : ::com::sun::star::uno::Any
1109 : Spell( SwPaM&, ::com::sun::star::uno::Reference<
1110 : ::com::sun::star::linguistic2::XSpellChecker1 > &,
1111 : sal_uInt16* pPageCnt, sal_uInt16* pPageSt, bool bGrammarCheck,
1112 : SwConversionArgs *pConvArgs = 0 ) const;
1113 :
1114 : ::com::sun::star::uno::Reference<
1115 : ::com::sun::star::linguistic2::XHyphenatedWord >
1116 : Hyphenate( SwPaM *pPam, const Point &rCrsrPos,
1117 : sal_uInt16* pPageCnt, sal_uInt16* pPageSt );
1118 :
1119 : /// count words in pam
1120 : void CountWords( const SwPaM& rPaM, SwDocStat& rStat ) const;
1121 :
1122 : /// Glossary Document
1123 : void SetGlossDoc( bool bGlssDc = true ) { mbGlossDoc = bGlssDc; }
1124 337 : bool IsInsOnlyTextGlossary() const { return mbInsOnlyTxtGlssry; }
1125 :
1126 : void Summary( SwDoc* pExtDoc, sal_uInt8 nLevel, sal_uInt8 nPara, bool bImpress );
1127 :
1128 : void ChangeAuthorityData(const SwAuthEntry* pNewData);
1129 :
1130 24523 : bool IsInCallModified() const { return mbInCallModified; }
1131 : bool IsInHeaderFooter( const SwNodeIndex& rIdx ) const;
1132 : short GetTextDirection( const SwPosition& rPos,
1133 : const Point* pPt = 0 ) const;
1134 : bool IsInVerticalText( const SwPosition& rPos,
1135 : const Point* pPt = 0 ) const;
1136 :
1137 : /** Database and DB-Manager
1138 : */
1139 0 : void SetNewDBMgr( SwNewDBMgr* pNewMgr ) { mpNewDBMgr = pNewMgr; }
1140 323 : SwNewDBMgr* GetNewDBMgr() const { return mpNewDBMgr; }
1141 : void ChangeDBFields( const std::vector<String>& rOldNames,
1142 : const String& rNewName );
1143 : void SetInitDBFields(sal_Bool b);
1144 :
1145 : /// Find out which databases are used by fields.
1146 : void GetAllUsedDB( std::vector<String>& rDBNameList,
1147 : const std::vector<String>* pAllDBNames = 0 );
1148 :
1149 : void ChgDBData( const SwDBData& rNewData );
1150 : SwDBData GetDBData();
1151 : const SwDBData& GetDBDesc();
1152 : const SwDBData& _GetDBDesc() const { return maDBData; }
1153 :
1154 : /** Some helper functions
1155 : */
1156 : String GetUniqueGrfName() const;
1157 : String GetUniqueOLEName() const;
1158 : String GetUniqueFrameName() const;
1159 :
1160 : std::set<SwRootFrm*> GetAllLayouts();//swmod 080225
1161 :
1162 : void SetFlyName( SwFlyFrmFmt& rFmt, const String& rName );
1163 : const SwFlyFrmFmt* FindFlyByName( const String& rName, sal_Int8 nNdTyp = 0 ) const;
1164 :
1165 : void GetGrfNms( const SwFlyFrmFmt& rFmt, String* pGrfName,
1166 : String* pFltName ) const;
1167 :
1168 : /// Set a valid name for all Flys that have none (Called by Readers after reading).
1169 : void SetAllUniqueFlyNames();
1170 :
1171 : /** Reset attributes. All TxtHints and (if completely selected) all hard-
1172 : formated stuff (auto-formats) are removed.
1173 : Introduce new optional parameter <bSendDataChangedEvents> in order to
1174 : control, if the side effect "send data changed events" is triggered or not. */
1175 : void ResetAttrs( const SwPaM &rRg,
1176 : bool bTxtAttr = true,
1177 : const std::set<sal_uInt16> &rAttrs = std::set<sal_uInt16>(),
1178 : const bool bSendDataChangedEvents = true );
1179 : void RstTxtAttrs(const SwPaM &rRg, bool bInclRefToxMark = false );
1180 :
1181 : /** Set attribute in given format.1y
1182 : * If Undo is enabled, the old values is added to the Undo history. */
1183 : void SetAttr( const SfxPoolItem&, SwFmt& );
1184 : /** Set attribute in given format.1y
1185 : * If Undo is enabled, the old values is added to the Undo history. */
1186 : void SetAttr( const SfxItemSet&, SwFmt& );
1187 :
1188 : /// method to reset a certain attribute at the given format
1189 : void ResetAttrAtFormat( const sal_uInt16 nWhichId,
1190 : SwFmt& rChangedFormat );
1191 :
1192 : /** Set attribute as new default attribute in current document.
1193 : If Undo is activated, the old one is listed in Undo-History. */
1194 : void SetDefault( const SfxPoolItem& );
1195 : void SetDefault( const SfxItemSet& );
1196 :
1197 : /// Query default attribute in this document.
1198 : const SfxPoolItem& GetDefault( sal_uInt16 nFmtHint ) const;
1199 :
1200 : /// Do not expand text attributes.
1201 : bool DontExpandFmt( const SwPosition& rPos, bool bFlag = true );
1202 :
1203 : /* Formats */
1204 0 : const SwFrmFmts* GetFrmFmts() const { return mpFrmFmtTbl; }
1205 2492 : SwFrmFmts* GetFrmFmts() { return mpFrmFmtTbl; }
1206 4882 : const SwCharFmts* GetCharFmts() const { return mpCharFmtTbl;}
1207 :
1208 : /** LayoutFormats (frames, DrawObjects), sometimes const sometimes not */
1209 1176 : const SwFrmFmts* GetSpzFrmFmts() const { return mpSpzFrmFmtTbl; }
1210 15333 : SwFrmFmts* GetSpzFrmFmts() { return mpSpzFrmFmtTbl; }
1211 :
1212 : const SwFrmFmt *GetDfltFrmFmt() const { return mpDfltFrmFmt; }
1213 4809 : SwFrmFmt *GetDfltFrmFmt() { return mpDfltFrmFmt; }
1214 : const SwFrmFmt *GetEmptyPageFmt() const { return mpEmptyPageFmt; }
1215 915 : SwFrmFmt *GetEmptyPageFmt() { return mpEmptyPageFmt; }
1216 : const SwFrmFmt *GetColumnContFmt() const{ return mpColumnContFmt; }
1217 2 : SwFrmFmt *GetColumnContFmt() { return mpColumnContFmt; }
1218 4 : const SwCharFmt *GetDfltCharFmt() const { return mpDfltCharFmt;}
1219 56334 : SwCharFmt *GetDfltCharFmt() { return mpDfltCharFmt;}
1220 :
1221 : /// @return the interface of the management of (auto)styles
1222 40642 : IStyleAccess& GetIStyleAccess() { return *mpStyleAccess; }
1223 :
1224 : /// Remove all language dependencies from all existing formats
1225 : void RemoveAllFmtLanguageDependencies();
1226 :
1227 : SwFrmFmt *MakeFrmFmt(const String &rFmtName, SwFrmFmt *pDerivedFrom,
1228 : bool bBroadcast = false, bool bAuto = true);
1229 : void DelFrmFmt( SwFrmFmt *pFmt, bool bBroadcast = false );
1230 1781 : SwFrmFmt* FindFrmFmtByName( const String& rName ) const
1231 1781 : { return (SwFrmFmt*)FindFmtByName( (SwFmtsBase&)*mpFrmFmtTbl, rName ); }
1232 :
1233 : SwCharFmt *MakeCharFmt(const String &rFmtName, SwCharFmt *pDerivedFrom,
1234 : bool bBroadcast = false,
1235 : bool bAuto = true );
1236 : void DelCharFmt(sal_uInt16 nFmt, bool bBroadcast = false);
1237 : void DelCharFmt(SwCharFmt* pFmt, bool bBroadcast = false);
1238 15173 : SwCharFmt* FindCharFmtByName( const String& rName ) const
1239 15173 : { return (SwCharFmt*)FindFmtByName( (SwFmtsBase&)*mpCharFmtTbl, rName ); }
1240 :
1241 : /* Formatcollections (styles) */
1242 : // TXT
1243 152 : const SwTxtFmtColl* GetDfltTxtFmtColl() const { return mpDfltTxtFmtColl; }
1244 89408 : const SwTxtFmtColls *GetTxtFmtColls() const { return mpTxtFmtCollTbl; }
1245 : SwTxtFmtColl *MakeTxtFmtColl( const String &rFmtName,
1246 : SwTxtFmtColl *pDerivedFrom,
1247 : bool bBroadcast = false,
1248 : bool bAuto = true );
1249 : SwConditionTxtFmtColl* MakeCondTxtFmtColl( const String &rFmtName,
1250 : SwTxtFmtColl *pDerivedFrom,
1251 : bool bBroadcast = false);
1252 : void DelTxtFmtColl(sal_uInt16 nFmt, bool bBroadcast = false);
1253 : void DelTxtFmtColl( SwTxtFmtColl* pColl, bool bBroadcast = false );
1254 : /** Add 4th optional parameter <bResetListAttrs>.
1255 : 'side effect' of <SetTxtFmtColl> with <bReset = true> is that the hard
1256 : attributes of the affected text nodes are cleared, except the break
1257 : attribute, the page description attribute and the list style attribute.
1258 : The new parameter <bResetListAttrs> indicates, if the list attributes
1259 : (list style, restart at and restart with) are cleared as well in case
1260 : that <bReset = true> and the paragraph style has a list style attribute set. */
1261 : bool SetTxtFmtColl( const SwPaM &rRg, SwTxtFmtColl *pFmt,
1262 : bool bReset = true,
1263 : bool bResetListAttrs = false );
1264 250151 : SwTxtFmtColl* FindTxtFmtCollByName( const String& rName ) const
1265 250151 : { return (SwTxtFmtColl*)FindFmtByName( (SwFmtsBase&)*mpTxtFmtCollTbl, rName ); }
1266 :
1267 : void ChkCondColls();
1268 :
1269 36 : const SwGrfFmtColl* GetDfltGrfFmtColl() const { return mpDfltGrfFmtColl; }
1270 0 : const SwGrfFmtColls *GetGrfFmtColls() const { return mpGrfFmtCollTbl; }
1271 : SwGrfFmtColl *MakeGrfFmtColl(const String &rFmtName,
1272 : SwGrfFmtColl *pDerivedFrom);
1273 2 : SwGrfFmtColl* FindGrfFmtCollByName( const String& rName ) const
1274 2 : { return (SwGrfFmtColl*)FindFmtByName( (SwFmtsBase&)*mpGrfFmtCollTbl, rName ); }
1275 :
1276 : /// Table formating
1277 : const SwFrmFmts* GetTblFrmFmts() const { return mpTblFrmFmtTbl; }
1278 1703 : SwFrmFmts* GetTblFrmFmts() { return mpTblFrmFmtTbl; }
1279 : sal_uInt16 GetTblFrmFmtCount( bool bUsed ) const;
1280 : SwFrmFmt& GetTblFrmFmt(sal_uInt16 nFmt, bool bUsed ) const;
1281 : SwTableFmt* MakeTblFrmFmt(const String &rFmtName, SwFrmFmt *pDerivedFrom);
1282 : void DelTblFrmFmt( SwTableFmt* pFmt );
1283 : SwTableFmt* FindTblFmtByName( const String& rName, sal_Bool bAll = sal_False ) const;
1284 :
1285 : /** Access to frames.
1286 : Iterate over Flys - forr Basic-Collections. */
1287 : sal_uInt16 GetFlyCount( FlyCntType eType = FLYCNTTYPE_ALL) const;
1288 : SwFrmFmt* GetFlyNum(sal_uInt16 nIdx, FlyCntType eType = FLYCNTTYPE_ALL);
1289 :
1290 : /// Copy formats in own arrays and return them.
1291 : SwFrmFmt *CopyFrmFmt ( const SwFrmFmt& );
1292 : SwCharFmt *CopyCharFmt( const SwCharFmt& );
1293 : SwTxtFmtColl* CopyTxtColl( const SwTxtFmtColl& rColl );
1294 : SwGrfFmtColl* CopyGrfColl( const SwGrfFmtColl& rColl );
1295 :
1296 : /// Replace all styles with those from rSource.
1297 : void ReplaceStyles( const SwDoc& rSource, bool bIncludePageStyles = true );
1298 :
1299 : /// Replace all property defaults with those from rSource.
1300 : void ReplaceDefaults( const SwDoc& rSource );
1301 :
1302 : /// Replace all compatability options with those from rSource.
1303 : void ReplaceCompatabilityOptions(const SwDoc& rSource);
1304 :
1305 : /// Query if style (paragraph- / character- / frame- / page-) is used.
1306 : bool IsUsed( const SwModify& ) const;
1307 : bool IsUsed( const SwNumRule& ) const;
1308 :
1309 : /// Set name of newly loaded document template.
1310 : sal_uInt16 SetDocPattern( const String& rPatternName );
1311 :
1312 : /// @return name of document template. Can be 0!
1313 0 : const String* GetDocPattern( sal_uInt16 nPos ) const
1314 : {
1315 0 : if(nPos >= maPatternNms.size())
1316 0 : return NULL;
1317 0 : if(boost::is_null(maPatternNms.begin() + nPos))
1318 0 : return NULL;
1319 0 : return &(maPatternNms[nPos]);
1320 : }
1321 :
1322 : /// Delete all unreferenced field types.
1323 : void GCFieldTypes(); ///< impl. in docfld.cxx
1324 :
1325 : /// Query / connect current document with glossary document.
1326 : void SetGlossaryDoc( SwDoc* pDoc ) { mpGlossaryDoc = pDoc; }
1327 :
1328 : /// travel over PaM Ring
1329 : bool InsertGlossary( SwTextBlocks& rBlock, const String& rEntry,
1330 : SwPaM& rPaM, SwCrsrShell* pShell = 0);
1331 :
1332 : /** get the set of printable pages for the XRenderable API by
1333 : evaluating the respective settings (see implementation) */
1334 : void CalculatePagesForPrinting( const SwRootFrm& rLayout, SwRenderData &rData, const SwPrintUIOptions &rOptions, bool bIsPDFExport,
1335 : sal_Int32 nDocPageCount );
1336 : void UpdatePagesForPrintingWithPostItData( SwRenderData &rData, const SwPrintUIOptions &rOptions, bool bIsPDFExport,
1337 : sal_Int32 nDocPageCount );
1338 : void CalculatePagePairsForProspectPrinting( const SwRootFrm& rLayout, SwRenderData &rData, const SwPrintUIOptions &rOptions,
1339 : sal_Int32 nDocPageCount );
1340 :
1341 : /// PageDescriptor interface.
1342 7864 : sal_uInt16 GetPageDescCnt() const { return maPageDescs.size(); }
1343 90 : const SwPageDesc& GetPageDesc( const sal_uInt16 i ) const { return *maPageDescs[i]; }
1344 9746 : SwPageDesc& GetPageDesc( sal_uInt16 i ) { return *maPageDescs[i]; }
1345 : SwPageDesc* FindPageDescByName( const String& rName,
1346 : sal_uInt16* pPos = 0 ) const;
1347 :
1348 : /** Copy the complete PageDesc - beyond document and "deep"!
1349 : Optionally copying of PoolFmtId, -HlpId can be prevented. */
1350 : void CopyPageDesc( const SwPageDesc& rSrcDesc, SwPageDesc& rDstDesc,
1351 : bool bCopyPoolIds = true );
1352 :
1353 : /** Copy header (with contents) from SrcFmt to DestFmt
1354 : (can also be copied into other document). */
1355 784 : void CopyHeader( const SwFrmFmt& rSrcFmt, SwFrmFmt& rDestFmt )
1356 784 : { CopyPageDescHeaderFooterImpl( true, rSrcFmt, rDestFmt ); }
1357 :
1358 : /** Copy footer (with contents) from SrcFmt to DestFmt.
1359 : (can also be copied into other document). */
1360 780 : void CopyFooter( const SwFrmFmt& rSrcFmt, SwFrmFmt& rDestFmt )
1361 780 : { CopyPageDescHeaderFooterImpl( false, rSrcFmt, rDestFmt ); }
1362 :
1363 : //For Reader.
1364 :
1365 : SwPageDesc * GetPageDesc( const String & rName );
1366 : void ChgPageDesc( const String & rName, const SwPageDesc& );
1367 : void ChgPageDesc( sal_uInt16 i, const SwPageDesc& );
1368 : bool FindPageDesc( const String & rName, sal_uInt16 * pFound );
1369 : void DelPageDesc( const String & rName, bool bBroadcast = false);
1370 : void DelPageDesc( sal_uInt16 i, bool bBroadcast = false );
1371 : void PreDelPageDesc(SwPageDesc * pDel);
1372 : sal_uInt16 MakePageDesc( const String &rName, const SwPageDesc* pCpy = 0,
1373 : bool bRegardLanguage = true,
1374 : bool bBroadcast = false);
1375 : void BroadcastStyleOperation(String rName, SfxStyleFamily eFamily,
1376 : sal_uInt16 nOp);
1377 :
1378 : /** The html import sometimes overwrites the
1379 : page sizes set in the page descriptions. This function is used to
1380 : correct this. */
1381 : void CheckDefaultPageFmt();
1382 :
1383 : /// Methods for tables/indices.
1384 :
1385 : sal_uInt16 GetCurTOXMark( const SwPosition& rPos, SwTOXMarks& ) const;
1386 : void DeleteTOXMark( const SwTOXMark* pTOXMark );
1387 : const SwTOXMark& GotoTOXMark( const SwTOXMark& rCurTOXMark,
1388 : SwTOXSearch eDir, sal_Bool bInReadOnly );
1389 :
1390 : /// Insert/Renew table/indes.
1391 : const SwTOXBaseSection* InsertTableOf( const SwPosition& rPos,
1392 : const SwTOXBase& rTOX,
1393 : const SfxItemSet* pSet = 0,
1394 : bool bExpand = false );
1395 : const SwTOXBaseSection* InsertTableOf( sal_uLong nSttNd, sal_uLong nEndNd,
1396 : const SwTOXBase& rTOX,
1397 : const SfxItemSet* pSet = 0 );
1398 : const SwTOXBase* GetCurTOX( const SwPosition& rPos ) const;
1399 : const SwAttrSet& GetTOXBaseAttrSet(const SwTOXBase& rTOX) const;
1400 :
1401 : bool DeleteTOX( const SwTOXBase& rTOXBase, bool bDelNodes = false );
1402 : String GetUniqueTOXBaseName( const SwTOXType& rType,
1403 : const String* pChkStr = 0 ) const;
1404 :
1405 : bool SetTOXBaseName(const SwTOXBase& rTOXBase, const String& rName);
1406 : void SetTOXBaseProtection(const SwTOXBase& rTOXBase, sal_Bool bProtect);
1407 :
1408 : /// After reading file update all tables/indices.
1409 0 : void SetUpdateTOX( bool bFlag = true ) { mbUpdateTOX = bFlag; }
1410 793 : bool IsUpdateTOX() const { return mbUpdateTOX; }
1411 :
1412 18 : const String& GetTOIAutoMarkURL() const {return msTOIAutoMarkURL;}
1413 1 : void SetTOIAutoMarkURL(const String& rSet) {msTOIAutoMarkURL = rSet;}
1414 : void ApplyAutoMark();
1415 :
1416 13183 : bool IsInReading() const { return mbInReading; }
1417 902 : void SetInReading( bool bNew ) { mbInReading = bNew; }
1418 :
1419 7589 : bool IsClipBoard() const { return mbClipBoard; }
1420 : /// N.B.: must be called right after constructor! (@see GetXmlIdRegistry)
1421 0 : void SetClipBoard( bool bNew ) { mbClipBoard = bNew; }
1422 :
1423 0 : bool IsColumnSelection() const { return mbColumnSelection; }
1424 0 : void SetColumnSelection( bool bNew ) { mbColumnSelection = bNew; }
1425 :
1426 9274 : bool IsInXMLImport() const { return mbInXMLImport; }
1427 436 : void SetInXMLImport( bool bNew ) { mbInXMLImport = bNew; }
1428 :
1429 : /// Manage types of tables/indices.
1430 : sal_uInt16 GetTOXTypeCount( TOXTypes eTyp ) const;
1431 : const SwTOXType* GetTOXType( TOXTypes eTyp, sal_uInt16 nId ) const;
1432 : sal_Bool DeleteTOXType( TOXTypes eTyp, sal_uInt16 nId );
1433 : const SwTOXType* InsertTOXType( const SwTOXType& rTyp );
1434 0 : const SwTOXTypes& GetTOXTypes() const { return *mpTOXTypes; }
1435 :
1436 : const SwTOXBase* GetDefaultTOXBase( TOXTypes eTyp, bool bCreate = false );
1437 : void SetDefaultTOXBase(const SwTOXBase& rBase);
1438 :
1439 : /// Key for management of index.
1440 : sal_uInt16 GetTOIKeys( SwTOIKeyType eTyp, std::vector<String>& rArr ) const;
1441 :
1442 : /// Sort table text.
1443 : bool SortTbl(const SwSelBoxes& rBoxes, const SwSortOptions&);
1444 : bool SortText(const SwPaM&, const SwSortOptions&);
1445 :
1446 : // Correct the SwPosition-Objects that are registered with the document
1447 : // e. g. ::com::sun::star::text::Bookmarks or tables/indices.
1448 : // If bMoveCrsr is set move Crsr too.
1449 :
1450 : /// Set everything in rOldNode on rNewPos + Offset.
1451 : void CorrAbs( const SwNodeIndex& rOldNode, const SwPosition& rNewPos,
1452 : const xub_StrLen nOffset = 0, sal_Bool bMoveCrsr = sal_False );
1453 :
1454 : /// Set everything in the range of [rStartNode, rEndNode] to rNewPos.
1455 : void CorrAbs( const SwNodeIndex& rStartNode, const SwNodeIndex& rEndNode,
1456 : const SwPosition& rNewPos, sal_Bool bMoveCrsr = sal_False );
1457 :
1458 : /// Set everything in this range from rRange to rNewPos.
1459 : void CorrAbs( const SwPaM& rRange, const SwPosition& rNewPos,
1460 : sal_Bool bMoveCrsr = sal_False );
1461 :
1462 : /// Set everything in rOldNode to relative Pos.
1463 : void CorrRel( const SwNodeIndex& rOldNode, const SwPosition& rNewPos,
1464 : const xub_StrLen nOffset = 0, sal_Bool bMoveCrsr = sal_False );
1465 :
1466 : /// Query / set rules for Outline.
1467 15974 : inline SwNumRule* GetOutlineNumRule() const
1468 : {
1469 15974 : return mpOutlineRule;
1470 : }
1471 : void SetOutlineNumRule( const SwNumRule& rRule );
1472 : void PropagateOutlineRule();
1473 :
1474 : /// Outline - promote / demote.
1475 : bool OutlineUpDown( const SwPaM& rPam, short nOffset = 1 );
1476 :
1477 : /// Ountline - move up / move down.
1478 : bool MoveOutlinePara( const SwPaM& rPam, short nOffset = 1);
1479 :
1480 : bool GotoOutline( SwPosition& rPos, const String& rName ) const;
1481 :
1482 : /** Accept changes of outline styles for OUtlineRule.
1483 : re-use unused 3rd parameter
1484 : Add optional parameter <bResetIndentAttrs> - default value sal_False.
1485 : If <bResetIndentAttrs> equals true, the indent attributes "before text"
1486 : and "first line indent" are additionally reset at the provided PaM, if
1487 : the list style makes use of the new list level attributes.
1488 : introduce parameters <bCreateNewList> and <sContinuedListId>
1489 : <bCreateNewList> indicates, if a new list is created by applying the
1490 : given list style. */
1491 : void SetNumRule( const SwPaM&,
1492 : const SwNumRule&,
1493 : const bool bCreateNewList,
1494 : const String sContinuedListId = String(),
1495 : bool bSetItem = true,
1496 : const bool bResetIndentAttrs = false );
1497 : void SetCounted( const SwPaM&, bool bCounted);
1498 :
1499 : void MakeUniqueNumRules(const SwPaM & rPaM);
1500 :
1501 : void SetNumRuleStart( const SwPosition& rPos, sal_Bool bFlag = sal_True );
1502 : void SetNodeNumStart( const SwPosition& rPos, sal_uInt16 nStt );
1503 :
1504 : SwNumRule* GetCurrNumRule( const SwPosition& rPos ) const;
1505 :
1506 79410 : const SwNumRuleTbl& GetNumRuleTbl() const { return *mpNumRuleTbl; }
1507 :
1508 : /**
1509 : Add numbering rule to document.
1510 :
1511 : @param pRule rule to add
1512 : */
1513 : void AddNumRule(SwNumRule * pRule);
1514 :
1515 : /// add optional parameter <eDefaultNumberFormatPositionAndSpaceMode>
1516 : sal_uInt16 MakeNumRule( const String &rName,
1517 : const SwNumRule* pCpy = 0,
1518 : bool bBroadcast = false,
1519 : const SvxNumberFormat::SvxNumPositionAndSpaceMode eDefaultNumberFormatPositionAndSpaceMode =
1520 : SvxNumberFormat::LABEL_WIDTH_AND_POSITION );
1521 : sal_uInt16 FindNumRule( const String& rName ) const;
1522 : SwNumRule* FindNumRulePtr( const String& rName ) const;
1523 :
1524 : /// Deletion only possible if ::com::sun::star::chaos::Rule is not used!
1525 : bool RenameNumRule(const String & aOldName, const String & aNewName,
1526 : bool bBroadcast = false);
1527 : bool DelNumRule( const String& rName, bool bBroadCast = false );
1528 : String GetUniqueNumRuleName( const String* pChkStr = 0, bool bAutoNum = true ) const;
1529 :
1530 : void UpdateNumRule(); /// Update all invalids.
1531 : void ChgNumRuleFmts( const SwNumRule& rRule, const String * pOldName = 0 );
1532 : bool ReplaceNumRule( const SwPosition& rPos, const String& rOldRule,
1533 : const String& rNewRule );
1534 :
1535 : /// Goto next/previous on same level.
1536 : bool GotoNextNum( SwPosition&, bool bOverUpper = true,
1537 : sal_uInt8* pUpper = 0, sal_uInt8* pLower = 0 );
1538 : bool GotoPrevNum( SwPosition&, bool bOverUpper = true,
1539 : sal_uInt8* pUpper = 0, sal_uInt8* pLower = 0 );
1540 :
1541 : /** Searches for a text node with a numbering rule.
1542 :
1543 : add optional parameter <bInvestigateStartNode>
1544 : add output parameter <sListId>
1545 :
1546 : \param rPos position to start search
1547 : \param bForward - sal_True: search forward
1548 : - sal_False: search backward
1549 : \param bNum - sal_True: search for enumeration
1550 : - sal_False: search for itemize
1551 : \param bOutline - sal_True: search for outline numbering rule
1552 : - sal_False: search for non-outline numbering rule
1553 : \param nNonEmptyAllowed number of non-empty paragraphs allowed between
1554 : rPos and found paragraph
1555 :
1556 : @param sListId
1557 : output parameter - in case a list style is found, <sListId> holds the
1558 : list id, to which the text node belongs, which applies the found list style.
1559 :
1560 : @param bInvestigateStartNode
1561 : input parameter - boolean, indicating, if start node, determined by given
1562 : start position has to be investigated or not.
1563 : */
1564 : const SwNumRule * SearchNumRule(const SwPosition & rPos,
1565 : const bool bForward,
1566 : const bool bNum,
1567 : const bool bOutline,
1568 : int nNonEmptyAllowed,
1569 : String& sListId,
1570 : const bool bInvestigateStartNode = false );
1571 :
1572 : /// Paragraphs without numbering but with indents.
1573 : bool NoNum( const SwPaM& );
1574 :
1575 : /// Delete, splitting of numbering list.
1576 : void DelNumRules( const SwPaM& );
1577 :
1578 : /// Invalidates all numrules
1579 : void InvalidateNumRules();
1580 :
1581 : bool NumUpDown( const SwPaM&, bool bDown = true );
1582 :
1583 : /** Move selected paragraphes (not only numberings)
1584 : according to offsets. (if negative: go to doc start). */
1585 : bool MoveParagraph( const SwPaM&, long nOffset = 1, bool bIsOutlMv = false );
1586 :
1587 : bool NumOrNoNum( const SwNodeIndex& rIdx, sal_Bool bDel = sal_False);
1588 :
1589 : void StopNumRuleAnimations( OutputDevice* );
1590 :
1591 : /** Insert new table at position @param rPos (will be inserted before Node!).
1592 : For AutoFormat at input: columns have to be set at predefined width.
1593 : The array holds the positions of the columns (not their widths).
1594 : new @param bCalledFromShell:
1595 : sal_True: called from shell -> propagate existing adjust item at
1596 : rPos to every new cell. A existing adjust item in the table
1597 : heading or table contents paragraph style prevent that
1598 : propagation.
1599 : sal_False: do not propagate
1600 : */
1601 : const SwTable* InsertTable( const SwInsertTableOptions& rInsTblOpts, // HEADLINE_NO_BORDER
1602 : const SwPosition& rPos, sal_uInt16 nRows,
1603 : sal_uInt16 nCols, short eAdjust,
1604 : const SwTableAutoFmt* pTAFmt = 0,
1605 : const std::vector<sal_uInt16> *pColArr = 0,
1606 : sal_Bool bCalledFromShell = sal_False,
1607 : sal_Bool bNewModel = sal_True );
1608 :
1609 : /// If index is in a table, return TableNode, else 0.
1610 : SwTableNode* IsIdxInTbl( const SwNodeIndex& rIdx );
1611 : inline const SwTableNode* IsIdxInTbl( const SwNodeIndex& rIdx ) const;
1612 :
1613 : /// Create a balanced table out of the selected range.
1614 : const SwTable* TextToTable( const SwInsertTableOptions& rInsTblOpts, // HEADLINE_NO_BORDER,
1615 : const SwPaM& rRange, sal_Unicode cCh,
1616 : short eAdjust,
1617 : const SwTableAutoFmt* = 0 );
1618 :
1619 : /// text to table conversion - API support
1620 : const SwTable* TextToTable( const std::vector< std::vector<SwNodeRange> >& rTableNodes );
1621 :
1622 : sal_Bool TableToText( const SwTableNode* pTblNd, sal_Unicode cCh );
1623 :
1624 : /// Create columns / rows in table.
1625 : bool InsertCol( const SwCursor& rCursor,
1626 : sal_uInt16 nCnt = 1, bool bBehind = true );
1627 : bool InsertCol( const SwSelBoxes& rBoxes,
1628 : sal_uInt16 nCnt = 1, bool bBehind = true );
1629 : bool InsertRow( const SwCursor& rCursor,
1630 : sal_uInt16 nCnt = 1, bool bBehind = true );
1631 : bool InsertRow( const SwSelBoxes& rBoxes,
1632 : sal_uInt16 nCnt = 1, bool bBehind = true );
1633 :
1634 : /// Delete Colums/Rows in table.
1635 : sal_Bool DeleteRowCol( const SwSelBoxes& rBoxes, bool bColumn = false );
1636 : sal_Bool DeleteRow( const SwCursor& rCursor );
1637 : sal_Bool DeleteCol( const SwCursor& rCursor );
1638 :
1639 : /// Split / concatenate boxes in table.
1640 : sal_Bool SplitTbl( const SwSelBoxes& rBoxes, sal_Bool bVert = sal_True,
1641 : sal_uInt16 nCnt = 1, sal_Bool bSameHeight = sal_False );
1642 :
1643 : /// @return enum TableMergeErr.
1644 : sal_uInt16 MergeTbl( SwPaM& rPam );
1645 : String GetUniqueTblName() const;
1646 : sal_Bool IsInsTblFormatNum() const;
1647 : sal_Bool IsInsTblChangeNumFormat() const;
1648 : sal_Bool IsInsTblAlignNum() const;
1649 :
1650 : /// From FEShell (for Undo and BModified).
1651 : void GetTabCols( SwTabCols &rFill, const SwCursor* pCrsr,
1652 : const SwCellFrm* pBoxFrm = 0 ) const;
1653 : void SetTabCols( const SwTabCols &rNew, sal_Bool bCurRowOnly,
1654 : const SwCursor* pCrsr, const SwCellFrm* pBoxFrm = 0 );
1655 : void GetTabRows( SwTabCols &rFill, const SwCursor* pCrsr,
1656 : const SwCellFrm* pBoxFrm = 0 ) const;
1657 : void SetTabRows( const SwTabCols &rNew, sal_Bool bCurColOnly, const SwCursor* pCrsr,
1658 : const SwCellFrm* pBoxFrm = 0 );
1659 :
1660 : /// Direct access for UNO.
1661 : void SetTabCols(SwTable& rTab, const SwTabCols &rNew, const SwTabCols &rOld,
1662 : const SwTableBox *pStart, sal_Bool bCurRowOnly);
1663 :
1664 : void SetRowsToRepeat( SwTable &rTable, sal_uInt16 nSet );
1665 :
1666 : /// AutoFormat for table/table selection.
1667 : sal_Bool SetTableAutoFmt( const SwSelBoxes& rBoxes, const SwTableAutoFmt& rNew );
1668 :
1669 : /// Query attributes.
1670 : sal_Bool GetTableAutoFmt( const SwSelBoxes& rBoxes, SwTableAutoFmt& rGet );
1671 :
1672 : void AppendUndoForInsertFromDB( const SwPaM& rPam, sal_Bool bIsTable );
1673 :
1674 : sal_Bool SetColRowWidthHeight( SwTableBox& rAktBox, sal_uInt16 eType,
1675 : SwTwips nAbsDiff, SwTwips nRelDiff );
1676 : SwTableBoxFmt* MakeTableBoxFmt();
1677 : SwTableLineFmt* MakeTableLineFmt();
1678 :
1679 : /// Check if box has numerical valule. Change format of box if required.
1680 : void ChkBoxNumFmt( SwTableBox& rAktBox, sal_Bool bCallUpdate );
1681 : void SetTblBoxFormulaAttrs( SwTableBox& rBox, const SfxItemSet& rSet );
1682 : void ClearBoxNumAttrs( const SwNodeIndex& rNode );
1683 : void ClearLineNumAttrs( SwPosition & rPos );
1684 :
1685 : sal_Bool InsCopyOfTbl( SwPosition& rInsPos, const SwSelBoxes& rBoxes,
1686 : const SwTable* pCpyTbl = 0, sal_Bool bCpyName = sal_False,
1687 : sal_Bool bCorrPos = sal_False );
1688 :
1689 : sal_Bool UnProtectCells( const String& rTblName );
1690 : sal_Bool UnProtectCells( const SwSelBoxes& rBoxes );
1691 : sal_Bool UnProtectTbls( const SwPaM& rPam );
1692 : sal_Bool HasTblAnyProtection( const SwPosition* pPos,
1693 : const String* pTblName = 0,
1694 : sal_Bool* pFullTblProtection = 0 );
1695 :
1696 : /// Split table at baseline position, i.e. create a new table.
1697 : sal_Bool SplitTable( const SwPosition& rPos, sal_uInt16 eMode = 0,
1698 : sal_Bool bCalcNewSize = sal_False );
1699 :
1700 : /** And vice versa: rPos must be in the table that remains. The flag indicates
1701 : whether the current table is merged with the one before or behind it. */
1702 : sal_Bool MergeTable( const SwPosition& rPos, sal_Bool bWithPrev = sal_True,
1703 : sal_uInt16 nMode = 0 );
1704 :
1705 : /// Make charts of given table update.
1706 : void UpdateCharts( const String &rName ) const;
1707 :
1708 : /// Update all charts, for that exists any table.
1709 0 : void UpdateAllCharts() { DoUpdateAllCharts(); }
1710 :
1711 : /// Table is renamed and refreshes charts.
1712 : void SetTableName( SwFrmFmt& rTblFmt, const String &rNewName );
1713 :
1714 : /// @return the reference in document that is set for name.
1715 : const SwFmtRefMark* GetRefMark( const String& rName ) const;
1716 :
1717 : /// @return RefMark via index - for UNO.
1718 : const SwFmtRefMark* GetRefMark( sal_uInt16 nIndex ) const;
1719 :
1720 : /** @return names of all references that are set in document.
1721 : If array pointer is 0 return only whether a RefMark is set in document. */
1722 : sal_uInt16 GetRefMarks( std::vector<OUString>* = 0 ) const;
1723 :
1724 : /// Insert label. If a FlyFormat is created, return it.
1725 : SwFlyFrmFmt* InsertLabel( const SwLabelType eType, const String &rTxt, const String& rSeparator,
1726 : const String& rNumberingSeparator,
1727 : const sal_Bool bBefore, const sal_uInt16 nId, const sal_uLong nIdx,
1728 : const String& rCharacterStyle,
1729 : const sal_Bool bCpyBrd = sal_True );
1730 : SwFlyFrmFmt* InsertDrawLabel(
1731 : const String &rTxt, const String& rSeparator, const String& rNumberSeparator,
1732 : const sal_uInt16 nId, const String& rCharacterStyle, SdrObject& rObj );
1733 :
1734 : /// Query attribute pool.
1735 30793 : const SwAttrPool& GetAttrPool() const { return *mpAttrPool; }
1736 282143 : SwAttrPool& GetAttrPool() { return *mpAttrPool; }
1737 :
1738 : /// Search an EditShell or, if appropriate, a ViewShell via layout.
1739 : SwEditShell* GetEditShell( ViewShell** ppSh = 0 ) const;
1740 : ::sw::IShellCursorSupplier * GetIShellCursorSupplier();
1741 :
1742 : /// OLE 2.0-notification.
1743 2475 : inline void SetOle2Link(const Link& rLink) {maOle2Link = rLink;}
1744 317 : inline const Link& GetOle2Link() const {return maOle2Link;}
1745 :
1746 : /// insert section (the ODF kind of section, not the nodesarray kind)
1747 : SwSection * InsertSwSection(SwPaM const& rRange, SwSectionData &,
1748 : SwTOXBase const*const pTOXBase = 0,
1749 : SfxItemSet const*const pAttr = 0, bool const bUpdate = true);
1750 : sal_uInt16 IsInsRegionAvailable( const SwPaM& rRange,
1751 : const SwNode** ppSttNd = 0 ) const;
1752 : SwSection* GetCurrSection( const SwPosition& rPos ) const;
1753 716 : SwSectionFmts& GetSections() { return *mpSectionFmtTbl; }
1754 0 : const SwSectionFmts& GetSections() const { return *mpSectionFmtTbl; }
1755 : SwSectionFmt *MakeSectionFmt( SwSectionFmt *pDerivedFrom );
1756 : void DelSectionFmt( SwSectionFmt *pFmt, bool bDelNodes = false );
1757 : void UpdateSection(sal_uInt16 const nSect, SwSectionData &,
1758 : SfxItemSet const*const = 0, bool const bPreventLinkUpdate = false);
1759 : String GetUniqueSectionName( const String* pChkStr = 0 ) const;
1760 :
1761 : /* @@@MAINTAINABILITY-HORROR@@@
1762 : The model should not have anything to do with a shell.
1763 : Unnecessary compile/link time dependency.
1764 : */
1765 :
1766 : // Pointer to SfxDocShell from Doc. Can be 0!!
1767 146623 : SwDocShell* GetDocShell() { return mpDocShell; }
1768 1969 : const SwDocShell* GetDocShell() const { return mpDocShell; }
1769 : void SetDocShell( SwDocShell* pDSh );
1770 :
1771 : /** in case during copying of embedded object a new shell is created,
1772 : it should be set here and cleaned later */
1773 0 : void SetTmpDocShell( SfxObjectShellLock rLock ) { mxTmpDocShell = rLock; }
1774 0 : SfxObjectShellLock GetTmpDocShell() { return mxTmpDocShell; }
1775 :
1776 : /// For Autotexts? (text modules) They have only one SVPersist at their disposal.
1777 : SfxObjectShell* GetPersist() const;
1778 :
1779 : /// Pointer to storage of SfxDocShells. Can be 0!!!
1780 : ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage > GetDocStorage();
1781 :
1782 : /// Query / set flag indicating if document is loaded asynchronously at this moment.
1783 106 : bool IsInLoadAsynchron() const { return mbInLoadAsynchron; }
1784 1 : void SetInLoadAsynchron( bool bFlag ) { mbInLoadAsynchron = bFlag; }
1785 :
1786 : bool SelectServerObj( const String& rStr, SwPaM*& rpPam,
1787 : SwNodeRange*& rpRange ) const;
1788 :
1789 : /// For Drag&Move: (e.g. allow "moving" of RefMarks)
1790 12 : bool IsCopyIsMove() const { return mbCopyIsMove; }
1791 2 : void SetCopyIsMove( bool bFlag ) { mbCopyIsMove = bFlag; }
1792 :
1793 : SwDrawContact* GroupSelection( SdrView& );
1794 : void UnGroupSelection( SdrView& );
1795 : bool DeleteSelection( SwDrawView& );
1796 :
1797 : /// Invalidates OnlineSpell-WrongLists.
1798 : void SpellItAgainSam( bool bInvalid, bool bOnlyWrong, bool bSmartTags );
1799 : void InvalidateAutoCompleteFlag();
1800 :
1801 : void SetCalcFieldValueHdl(Outliner* pOutliner);
1802 :
1803 : // Query if ::com::sun::star::util::URL was visited.
1804 : // Query via Doc, if only a ::com::sun::star::text::Bookmark has been given.
1805 : // In this case the document name has to be set in front.
1806 : bool IsVisitedURL( const String& rURL ) const;
1807 :
1808 : /// Save current values for automatic registration of exceptions in Autocorrection.
1809 : void SetAutoCorrExceptWord( SwAutoCorrExceptWord* pNew );
1810 0 : SwAutoCorrExceptWord* GetAutoCorrExceptWord() { return mpACEWord; }
1811 :
1812 : const SwFmtINetFmt* FindINetAttr( const String& rName ) const;
1813 :
1814 : /// Call into intransparent Basic; expect possible Return String.
1815 : bool ExecMacro( const SvxMacro& rMacro, String* pRet = 0, SbxArray* pArgs = 0 );
1816 :
1817 : /// Call into intransparent Basic / JavaScript.
1818 : sal_uInt16 CallEvent( sal_uInt16 nEvent, const SwCallMouseEvent& rCallEvent,
1819 : bool bChkPtr = false, SbxArray* pArgs = 0,
1820 : const Link* pCallBack = 0 );
1821 :
1822 : /** Adjust left margin via object bar (similar to adjustment of numerations).
1823 : One can either change the margin "by" adding or substracting a given
1824 : offset or set it "to" this position (bModulus = true). */
1825 : void MoveLeftMargin( const SwPaM& rPam, bool bRight = true,
1826 : bool bModulus = true );
1827 :
1828 : /// Query NumberFormatter.
1829 : inline SvNumberFormatter* GetNumberFormatter( sal_Bool bCreate = sal_True );
1830 : inline const SvNumberFormatter* GetNumberFormatter( sal_Bool bCreate = sal_True ) const;
1831 :
1832 : bool HasInvisibleContent() const;
1833 : /// delete invisible content, like hidden sections and paragraphs
1834 : bool RemoveInvisibleContent();
1835 : /// restore the invisible content if it's available on the undo stack
1836 : bool RestoreInvisibleContent();
1837 :
1838 : bool ConvertFieldsToText();
1839 :
1840 : /// Create sub-documents according to given collection.
1841 : /// If no collection is given, use chapter styles for 1st level.
1842 : sal_Bool GenerateGlobalDoc( const String& rPath,
1843 : const SwTxtFmtColl* pSplitColl = 0 );
1844 : sal_Bool GenerateGlobalDoc( const String& rPath, int nOutlineLevel = 0 );
1845 : sal_Bool GenerateHTMLDoc( const String& rPath,
1846 : const SwTxtFmtColl* pSplitColl = 0 );
1847 : sal_Bool GenerateHTMLDoc( const String& rPath, int nOutlineLevel = 0 );
1848 :
1849 : /// Compare two documents.
1850 : long CompareDoc( const SwDoc& rDoc );
1851 :
1852 : /// Merge two documents.
1853 : long MergeDoc( const SwDoc& rDoc );
1854 :
1855 : /** Set comment-text for Redline. It then comes in via AppendRedLine.
1856 : Used by AutoFormat. 0-pointer resets mode.
1857 : Sequence number is for conjoining of Redlines by the UI. */
1858 : void SetAutoFmtRedlineComment( const String* pTxt, sal_uInt16 nSeqNo = 0 );
1859 :
1860 0 : bool IsAutoFmtRedline() const { return mbIsAutoFmtRedline; }
1861 0 : void SetAutoFmtRedline( bool bFlag ) { mbIsAutoFmtRedline = bFlag; }
1862 :
1863 : /// For AutoFormat: with Undo/Redlining.
1864 : void SetTxtFmtCollByAutoFmt( const SwPosition& rPos, sal_uInt16 nPoolId,
1865 : const SfxItemSet* pSet = 0 );
1866 : void SetFmtItemByAutoFmt( const SwPaM& rPam, const SfxItemSet& );
1867 :
1868 : /// Only for SW-textbloxks! Does not pay any attention to layout!
1869 : void ClearDoc(); // Deletes all content!
1870 :
1871 : /// Query /set data for PagePreView.
1872 0 : const SwPagePreViewPrtData* GetPreViewPrtData() const { return mpPgPViewPrtData; }
1873 :
1874 : // If pointer == 0 destroy pointer in document.
1875 : // Else copy object.
1876 : // Pointer is not transferred to ownership by document!
1877 : void SetPreViewPrtData( const SwPagePreViewPrtData* pData );
1878 :
1879 : /** update all modified OLE-Objects. The modification is called over the
1880 : StarOne - Interface */
1881 0 : void SetOLEObjModified()
1882 0 : { if( GetCurrentViewShell() ) maOLEModifiedTimer.Start(); } //swmod 071107//swmod 071225
1883 :
1884 : // -------------------- Uno - Interfaces ---------------------------
1885 26466 : const SwUnoCrsrTbl& GetUnoCrsrTbl() const { return *mpUnoCrsrTbl; }
1886 : SwUnoCrsr* CreateUnoCrsr( const SwPosition& rPos, bool bTblCrsr = false );
1887 :
1888 : // -------------------- FeShell - Interfaces -----------------------
1889 : // !!! These assume always an existing layout !!!
1890 : bool ChgAnchor( const SdrMarkList& _rMrkList,
1891 : RndStdIds _eAnchorType,
1892 : const bool _bSameOnly,
1893 : const bool _bPosCorr );
1894 :
1895 : void SetRowHeight( const SwCursor& rCursor, const SwFmtFrmSize &rNew );
1896 : void GetRowHeight( const SwCursor& rCursor, SwFmtFrmSize *& rpSz ) const;
1897 : void SetRowSplit( const SwCursor& rCursor, const SwFmtRowSplit &rNew );
1898 : void GetRowSplit( const SwCursor& rCursor, SwFmtRowSplit *& rpSz ) const;
1899 : sal_Bool BalanceRowHeight( const SwCursor& rCursor, sal_Bool bTstOnly = sal_True );
1900 : void SetRowBackground( const SwCursor& rCursor, const SvxBrushItem &rNew );
1901 : sal_Bool GetRowBackground( const SwCursor& rCursor, SvxBrushItem &rToFill ) const;
1902 : void SetTabBorders( const SwCursor& rCursor, const SfxItemSet& rSet );
1903 : void SetTabLineStyle( const SwCursor& rCursor,
1904 : const Color* pColor, sal_Bool bSetLine,
1905 : const editeng::SvxBorderLine* pBorderLine );
1906 : void GetTabBorders( const SwCursor& rCursor, SfxItemSet& rSet ) const;
1907 : void SetBoxAttr( const SwCursor& rCursor, const SfxPoolItem &rNew );
1908 : /**
1909 : Retrieves a box attribute from the given cursor.
1910 :
1911 : @return Whether the property is set over the current box selection.
1912 :
1913 : @remarks A property is 'set' if it's set to the same value over all boxes in the current selection.
1914 : The property value is retrieved from the first box in the current selection. It is then compared to
1915 : the values of the same property over any other boxes in the selection; if any value is different from
1916 : that of the first box, the property is unset (and sal_False is returned).
1917 : */
1918 : sal_Bool GetBoxAttr( const SwCursor& rCursor, SfxPoolItem &rToFill ) const;
1919 : void SetBoxAlign( const SwCursor& rCursor, sal_uInt16 nAlign );
1920 : sal_uInt16 GetBoxAlign( const SwCursor& rCursor ) const;
1921 : void AdjustCellWidth( const SwCursor& rCursor, sal_Bool bBalance = sal_False );
1922 :
1923 : int Chainable( const SwFrmFmt &rSource, const SwFrmFmt &rDest );
1924 : int Chain( SwFrmFmt &rSource, const SwFrmFmt &rDest );
1925 : void Unchain( SwFrmFmt &rFmt );
1926 :
1927 : // For Copy/Move from FrmShell.
1928 : SdrObject* CloneSdrObj( const SdrObject&, bool bMoveWithinDoc = false,
1929 : bool bInsInPage = true );
1930 :
1931 : //
1932 : // -------------------- FeShell - Interface end ------------------
1933 :
1934 : /// Interface for TextInputData - for text input of Chinese and Japanese.
1935 : SwExtTextInput* CreateExtTextInput( const SwPaM& rPam );
1936 : void DeleteExtTextInput( SwExtTextInput* pDel );
1937 : SwExtTextInput* GetExtTextInput( const SwNode& rNd,
1938 : xub_StrLen nCntntPos = STRING_NOTFOUND) const;
1939 : SwExtTextInput* GetExtTextInput() const;
1940 :
1941 : /// Interface for access to AutoComplete-List.
1942 3467 : static SwAutoCompleteWord& GetAutoCompleteWords() { return *mpACmpltWords; }
1943 :
1944 31 : bool ContainsMSVBasic() const { return mbContains_MSVBasic; }
1945 1 : void SetContainsMSVBasic( bool bFlag ) { mbContains_MSVBasic = bFlag; }
1946 :
1947 : /// Interface for the list of Ruby - texts/attributes
1948 : sal_uInt16 FillRubyList( const SwPaM& rPam, SwRubyList& rList,
1949 : sal_uInt16 nMode );
1950 : sal_uInt16 SetRubyList( const SwPaM& rPam, const SwRubyList& rList,
1951 : sal_uInt16 nMode );
1952 :
1953 : void ReadLayoutCache( SvStream& rStream );
1954 : void WriteLayoutCache( SvStream& rStream );
1955 2546 : SwLayoutCache* GetLayoutCache() const { return mpLayoutCache; }
1956 :
1957 : /** Checks if any of the text node contains hidden characters.
1958 : Used for optimization. Changing the view option 'view hidden text'
1959 : has to trigger a reformatting only if some of the text is hidden.
1960 : */
1961 : bool ContainsHiddenChars() const;
1962 :
1963 : /// call back for API wrapper
1964 : SwModify* GetUnoCallBack() const;
1965 :
1966 24013 : IGrammarContact* getGrammarContact() const { return mpGrammarContact; }
1967 :
1968 : /** Marks/Unmarks a list level of a certain list
1969 :
1970 : levels of a certain lists are marked now
1971 :
1972 : @param sListId list Id of the list whose level has to be marked/unmarked
1973 : @param nListLevel level to mark
1974 : @param bValue - true mark the level
1975 : - false unmark the level
1976 : */
1977 : void MarkListLevel( const String& sListId,
1978 : const int nListLevel,
1979 : const bool bValue );
1980 :
1981 : /** Marks/Unmarks a list level of a certain list
1982 :
1983 : levels of a certain lists are marked now
1984 :
1985 : @param rList list whose level has to be marked/unmarked
1986 : @param nListLevel level to mark
1987 : @param bValue - true mark the level
1988 : - false unmark the level
1989 : */
1990 : void MarkListLevel( SwList& rList,
1991 : const int nListLevel,
1992 : const bool bValue );
1993 :
1994 : /// Change a format undoable.
1995 : void ChgFmt(SwFmt & rFmt, const SfxItemSet & rSet);
1996 :
1997 : void RenameFmt(SwFmt & rFmt, const String & sNewName,
1998 : bool bBroadcast = false);
1999 :
2000 : /// Change a TOX undoable.
2001 : void ChgTOX(SwTOXBase & rTOX, const SwTOXBase & rNew);
2002 :
2003 : /**
2004 : Returns a textual description of a PaM.
2005 :
2006 : @param rPaM the PaM to describe
2007 :
2008 : If rPaM only spans one paragraph the result is:
2009 :
2010 : '<text in the PaM>'
2011 :
2012 : <text in the PaM> is shortened to nUndoStringLength characters.
2013 :
2014 : If rPaM spans more than one paragraph the result is:
2015 :
2016 : paragraphs (STR_PARAGRAPHS)
2017 :
2018 : @return the textual description of rPaM
2019 : */
2020 : String GetPaMDescr(const SwPaM & rPaM) const;
2021 :
2022 : bool IsFirstOfNumRule(SwPosition & rPos);
2023 :
2024 : // access methods for XForms model(s)
2025 :
2026 : /// access container for XForms model; will be NULL if !isXForms()
2027 : com::sun::star::uno::Reference<com::sun::star::container::XNameContainer>
2028 : getXForms() const;
2029 :
2030 : com::sun::star::uno::Reference< com::sun::star::linguistic2::XProofreadingIterator > GetGCIterator() const;
2031 :
2032 : /// #i31958# is this an XForms document?
2033 : bool isXForms() const;
2034 :
2035 : /// #i31958# initialize XForms models; turn this into an XForms document
2036 : void initXForms( bool bCreateDefaultModel );
2037 :
2038 : /// #i113606# for disposing XForms
2039 : void disposeXForms( );
2040 :
2041 : //Update all the page masters
2042 : void SetDefaultPageMode(bool bSquaredPageMode);
2043 : sal_Bool IsSquaredPageMode() const;
2044 :
2045 50 : void Setn32DummyCompatabilityOptions1( sal_uInt32 CompatabilityOptions1 )
2046 : {
2047 50 : mn32DummyCompatabilityOptions1 = CompatabilityOptions1;
2048 50 : }
2049 8 : sal_uInt32 Getn32DummyCompatabilityOptions1( )
2050 : {
2051 8 : return mn32DummyCompatabilityOptions1;
2052 : }
2053 50 : void Setn32DummyCompatabilityOptions2( sal_uInt32 CompatabilityOptions2 )
2054 : {
2055 50 : mn32DummyCompatabilityOptions2 = CompatabilityOptions2;
2056 50 : }
2057 8 : sal_uInt32 Getn32DummyCompatabilityOptions2( )
2058 : {
2059 8 : return mn32DummyCompatabilityOptions2;
2060 : }
2061 : com::sun::star::uno::Reference< com::sun::star::script::vba::XVBAEventProcessor > GetVbaEventProcessor();
2062 26 : void SetVBATemplateToProjectCache( com::sun::star::uno::Reference< com::sun::star::container::XNameContainer >& xCache ) { m_xTemplateToProjectCache = xCache; };
2063 50 : com::sun::star::uno::Reference< com::sun::star::container::XNameContainer > GetVBATemplateToProjectCache() { return m_xTemplateToProjectCache; };
2064 : ::sfx2::IXmlIdRegistry& GetXmlIdRegistry();
2065 : ::sw::MetaFieldManager & GetMetaFieldManager();
2066 : ::sw::UndoManager & GetUndoManager();
2067 : ::sw::UndoManager const& GetUndoManager() const;
2068 : SfxObjectShell* CreateCopy(bool bCallInitNew) const;
2069 :
2070 : /**
2071 : * Dumps the entire nodes structure to the given destination (file nodes.xml in the current directory by default)
2072 : * @since 3.5
2073 : */
2074 : void dumpAsXml( xmlTextWriterPtr writer = NULL );
2075 :
2076 : private:
2077 : /// Copies master header to left / first one, if necessary - used by ChgPageDesc().
2078 : void CopyMasterHeader(const SwPageDesc &rChged, const SwFmtHeader &rHead, SwPageDesc *pDesc, bool bLeft);
2079 : /// Copies master footer to left / first one, if necessary - used by ChgPageDesc().
2080 : void CopyMasterFooter(const SwPageDesc &rChged, const SwFmtFooter &rFoot, SwPageDesc *pDesc, bool bLeft);
2081 :
2082 : /** continue computing a chunk of document statistics
2083 : * \param nTextNodes number of paragraphs to calculate before
2084 : * exiting
2085 : *
2086 : * returns false when there is no more to calculate
2087 : */
2088 : bool IncrementalDocStatCalculate(long nTextNodes = 250);
2089 :
2090 : /// Our own 'StatsUpdateTimer' calls the following method
2091 : DECL_LINK( DoIdleStatsUpdate, Timer * );
2092 : };
2093 :
2094 : // This method is called in Dtor of SwDoc and deletes cache of ContourObjects.
2095 : void ClrContourCache();
2096 :
2097 : inline const SwTableNode* SwDoc::IsIdxInTbl( const SwNodeIndex& rIdx ) const
2098 : {
2099 : return ((SwDoc*)this)->IsIdxInTbl( rIdx );
2100 : }
2101 :
2102 1101 : inline SvNumberFormatter* SwDoc::GetNumberFormatter( sal_Bool bCreate )
2103 : {
2104 1101 : if( bCreate && !mpNumberFormatter )
2105 796 : _CreateNumberFormatter();
2106 1101 : return mpNumberFormatter;
2107 : }
2108 :
2109 0 : inline const SvNumberFormatter* SwDoc::GetNumberFormatter( sal_Bool bCreate ) const
2110 : {
2111 0 : return ((SwDoc*)this)->GetNumberFormatter( bCreate );
2112 : }
2113 :
2114 5 : inline void SwDoc::SetOLEPrtNotifyPending( bool bSet )
2115 : {
2116 5 : mbOLEPrtNotifyPending = bSet;
2117 5 : if( !bSet )
2118 1 : mbAllOLENotify = sal_False;
2119 5 : }
2120 :
2121 : // namespace <docfunc> for functions and procedures working on a Writer document.
2122 : namespace docfunc
2123 : {
2124 : /** method to check, if given Writer document contains at least one drawing object
2125 :
2126 : @author OD
2127 :
2128 : @param p_rDoc
2129 : input parameter - reference to the Writer document, which is investigated.
2130 : */
2131 : bool ExistsDrawObjs( SwDoc& p_rDoc );
2132 :
2133 : /** method to check, if given Writer document contains only drawing objects,
2134 : which are completely on its page.
2135 :
2136 : @author OD
2137 :
2138 : @param p_rDoc
2139 : input parameter - reference to the Writer document, which is investigated.
2140 : */
2141 : bool AllDrawObjsOnPage( SwDoc& p_rDoc );
2142 :
2143 : /** method to check, if the outline style has to written as a normal list style
2144 :
2145 : #i69627#
2146 : The outline style has to written as a normal list style, if a parent
2147 : paragraph style of one of the paragraph styles, which are assigned to
2148 : the list levels of the outline style, has a list style set or inherits
2149 : a list style from its parent paragraphs style.
2150 : This information is needed for the OpenDocument file format export.
2151 :
2152 : @author OD
2153 :
2154 : @param rDoc
2155 : input parameter - reference to the text document, which is investigated.
2156 :
2157 : @return boolean
2158 : indicating, if the outline style has to written as a normal list style
2159 : */
2160 : bool HasOutlineStyleToBeWrittenAsNormalListStyle( SwDoc& rDoc );
2161 : }
2162 : #endif //_DOC_HXX
2163 :
2164 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|