1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: docnew.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_sw.hxx"
33 #define ROLBCK_HISTORY_ONLY // Der Kampf gegen die CLOOK's
35 #include <dcontact.hxx>
36 #include <com/sun/star/document/PrinterIndependentLayout.hpp>
37 #include <com/sun/star/document/UpdateDocMode.hpp>
38 #include <com/sun/star/text/XTextDocument.hpp>
39 #include <com/sun/star/linguistic2/XProofreadingIterator.hpp>
40 #include <com/sun/star/text/XFlatParagraphIteratorProvider.hpp>
42 #include <unotools/processfactory.hxx>
43 #include <vcl/svapp.hxx>
44 #include <vcl/virdev.hxx>
45 #include <rtl/logfile.hxx>
46 #include <sfx2/printer.hxx>
47 #include <sfx2/docfile.hxx>
48 #include <sfx2/frame.hxx>
50 #include <svtools/macitem.hxx>
51 #include <svx/svxids.hrc>
52 #include <svx/svdogrp.hxx>
53 #include <svx/linkmgr.hxx>
54 #include <svx/forbiddencharacterstable.hxx>
55 #include <svtools/zforlist.hxx>
56 #include <svtools/compatibility.hxx>
57 #include <svtools/lingucfg.hxx>
58 #include <svx/svdpage.hxx>
60 #include <fchrfmt.hxx>
61 #include <fmtcntnt.hxx>
62 #include <fmtanchr.hxx>
63 #include <fmtfsize.hxx>
64 #include <fmtfordr.hxx>
65 #include <fmtpdsc.hxx>
66 #include <pvprtdat.hxx>
67 #include <rootfrm.hxx> //Damit der RootDtor gerufen wird.
68 #include <layouter.hxx>
69 #include <pagedesc.hxx> //Damit die PageDescs zerstoert werden koennen.
71 #include <printdata.hxx>
73 #include <ftninfo.hxx>
75 #include <docstat.hxx>
76 #include <charfmt.hxx>
78 #include <rolbck.hxx> // Undo-Attr, SwHistory
79 #include <poolfmt.hxx> // fuer die Pool-Vorlage
82 #include <acorrect.hxx> // fuer die autom. Aufnahme von Ausnahmen
83 #include <visiturl.hxx> // fuer die URL-Change Benachrichtigung
85 #include <lineinfo.hxx>
86 #include <drawdoc.hxx>
87 #include <linkenum.hxx>
88 #include <fldupde.hxx>
89 #include <extinput.hxx>
92 #include <shellres.hxx>
93 #include <unoclbck.hxx>
94 #include <breakit.hxx>
95 #include <laycache.hxx>
97 #include <istyleaccess.hxx>
98 #include <swstylemanager.hxx>
99 #include <IGrammarContact.hxx>
100 #include <tblsel.hxx>
101 #include <MarkManager.hxx>
102 #include <unochart.hxx>
104 #include <cmdid.h> // fuer den dflt - Printer in SetJob
107 // --> OD 2006-04-19 #b6375613#
108 #include <com/sun/star/document/XDocumentInfoSupplier.hpp>
109 #include <com/sun/star/beans/XPropertyContainer.hpp>
110 #include <com/sun/star/beans/PropertyAttribute.hpp>
114 // --> OD 2007-03-16 #i73788#
115 #include <pausethreadstarting.hxx>
117 #include <numrule.hxx>
118 // --> OD 2008-03-13 #refactorlists#
120 #include <listfunc.hxx>
123 #include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
125 #include <sfx2/Metadatable.hxx>
126 #include <fmtmeta.hxx> // MetaFieldManager
129 using namespace ::com::sun::star
;
130 using namespace ::com::sun::star::document
;
132 const sal_Char __FAR_DATA sFrmFmtStr
[] = "Frameformat";
133 const sal_Char __FAR_DATA sEmptyPageStr
[] = "Empty Page";
134 const sal_Char __FAR_DATA sColumnCntStr
[] = "Columncontainer";
135 const sal_Char __FAR_DATA sCharFmtStr
[] = "Zeichenformat";
136 const sal_Char __FAR_DATA sTxtCollStr
[] = "Textformatvorlage";
137 const sal_Char __FAR_DATA sGrfCollStr
[] = "Graphikformatvorlage";
139 SV_IMPL_PTRARR( SwNumRuleTbl
, SwNumRulePtr
)
140 SV_IMPL_PTRARR( SwTxtFmtColls
, SwTxtFmtCollPtr
)
141 SV_IMPL_PTRARR( SwGrfFmtColls
, SwGrfFmtCollPtr
)
144 * global functions...
147 uno::Reference
< linguistic2::XProofreadingIterator
> SwDoc::GetGCIterator() const
149 if (!m_xGCIterator
.is() && SvtLinguConfig().HasGrammarChecker())
151 uno::Reference
< lang::XMultiServiceFactory
> xMgr( utl::getProcessServiceFactory() );
156 rtl::OUString
aServiceName( rtl::OUString::createFromAscii("com.sun.star.linguistic2.ProofreadingIterator") );
157 m_xGCIterator
= uno::Reference
< linguistic2::XProofreadingIterator
>
158 ( xMgr
->createInstance( aServiceName
), uno::UNO_QUERY_THROW
);
160 catch (uno::Exception
&)
162 DBG_ERROR( "No GCIterator" );
167 return m_xGCIterator
;
170 void StartGrammarChecking( SwDoc
&rDoc
)
172 uno::Reference
< linguistic2::XProofreadingIterator
> xGCIterator( rDoc
.GetGCIterator() );
173 if ( xGCIterator
.is() )
175 uno::Reference
< lang::XComponent
> xDoc( rDoc
.GetDocShell()->GetBaseModel(), uno::UNO_QUERY
);
176 uno::Reference
< text::XFlatParagraphIteratorProvider
> xFPIP( xDoc
, uno::UNO_QUERY
);
178 // start automatic background checking if not active already
179 if ( xFPIP
.is() && !xGCIterator
->isProofreading( xDoc
) )
180 xGCIterator
->startProofreading( xDoc
, xFPIP
);
190 BOOL
lcl_DelFmtIndizes( const SwFrmFmtPtr
& rpFmt
, void* )
192 SwFmtCntnt
&rFmtCntnt
= (SwFmtCntnt
&)rpFmt
->GetCntnt();
193 if ( rFmtCntnt
.GetCntntIdx() )
194 rFmtCntnt
.SetNewCntntIdx( 0 );
195 SwFmtAnchor
&rFmtAnchor
= (SwFmtAnchor
&)rpFmt
->GetAnchor();
196 if ( rFmtAnchor
.GetCntntAnchor() )
197 rFmtAnchor
.SetAnchor( 0 );
202 * exportierte Methoden
208 mpAttrPool(new SwAttrPool(this)),
209 pMarkManager(new ::sw::mark::MarkManager(*this)),
210 m_pMetaFieldManager(new ::sw::MetaFieldManager()),
211 pDfltFrmFmt( new SwFrmFmt( GetAttrPool(), sFrmFmtStr
, 0 ) ),
212 pEmptyPageFmt( new SwFrmFmt( GetAttrPool(), sEmptyPageStr
, pDfltFrmFmt
) ),
213 pColumnContFmt( new SwFrmFmt( GetAttrPool(), sColumnCntStr
, pDfltFrmFmt
) ),
214 pDfltCharFmt( new SwCharFmt( GetAttrPool(), sCharFmtStr
, 0 ) ),
215 pDfltTxtFmtColl( new SwTxtFmtColl( GetAttrPool(), sTxtCollStr
) ),
216 pDfltGrfFmtColl( new SwGrfFmtColl( GetAttrPool(), sGrfCollStr
) ),
217 pFrmFmtTbl( new SwFrmFmts() ),
218 pCharFmtTbl( new SwCharFmts() ),
219 pSpzFrmFmtTbl( new SwSpzFrmFmts() ),
220 pSectionFmtTbl( new SwSectionFmts() ),
221 pTblFrmFmtTbl( new SwFrmFmts() ),
222 pTxtFmtCollTbl( new SwTxtFmtColls() ),
223 pGrfFmtCollTbl( new SwGrfFmtColls() ),
224 pTOXTypes( new SwTOXTypes() ),
225 pDefTOXBases( new SwDefTOXBase_Impl() ),
226 pLayout( 0 ), // Rootframe des spezifischen Layouts.
228 pUndos( new SwUndos( 0, 20 ) ),
229 pUpdtFlds( new SwDocUpdtFld() ),
230 pFldTypes( new SwFldTypes() ),
236 pFtnInfo( new SwFtnInfo
),
237 pEndNoteInfo( new SwEndNoteInfo
),
238 pLineNumberInfo( new SwLineNumberInfo
),
239 pFtnIdxs( new SwFtnIdxs
),
240 pDocStat( new SwDocStat
),
243 pLinkMgr( new SvxLinkManager( 0 ) ),
246 pNumberFormatter( 0 ),
247 pNumRuleTbl( new SwNumRuleTbl
),
248 // --> OD 2008-03-26 #refactorlists#
252 pRedlineTbl( new SwRedlineTbl
),
253 pAutoFmtRedlnComment( 0 ),
254 pUnoCrsrTbl( new SwUnoCrsrTbl( 0, 16 ) ),
255 pPgPViewPrtData( 0 ),
258 // --> OD 2008-03-07 #refactorlists#
262 pUnoCallBack(new SwUnoCallBack(0)),
263 mpGrammarContact( 0 ),
264 aChartDataProviderImplRef(),
265 pChartControllerHelper( 0 ),
266 // --> OD 2007-10-31 #i83479#
267 mpListItemsList( new tImplSortedNodeNumList() ),
274 nAutoFmtRedlnCommentNo( 0 ),
275 nLinkUpdMode( GLOBALSETTING
),
276 eFldUpdMode( AUTOUPD_GLOBALSETTING
),
277 eRedlineMode((RedlineMode_t
)(nsRedlineMode_t::REDLINE_SHOW_INSERT
| nsRedlineMode_t::REDLINE_SHOW_DELETE
)),
278 eChrCmprType( CHARCOMPRESS_NONE
),
282 mbReadlineChecked(false),
283 // --> OD 2005-02-11 #i38810#
284 mbLinksUpdated( sal_False
),
285 mbClipBoard( false ),
286 mbColumnSelection( false ),
288 mbProtectForm(false),
289 n32DummyCompatabilityOptions1(0),
290 n32DummyCompatabilityOptions2(0),
291 mbStartIdleTimer(sal_False
)
293 RTL_LOGFILE_CONTEXT_AUTHOR( aLog
, "SW", "JP93722", "SwDoc::SwDoc" );
316 mbOLEPrtNotifyPending
=
320 mbContains_MSVBasic
=
321 mbKernAsianPunctuation
=
325 // --> OD 2006-03-21 #b6375613#
326 mbApplyWorkaroundForB6375613
=
337 // COMPATIBILITY FLAGS START
340 // Note: Any non-hidden compatibility flag should obtain its default
341 // by asking SvtCompatibilityOptions, see below.
343 const SvtCompatibilityOptions aOptions
;
344 mbParaSpaceMax
= aOptions
.IsAddSpacing();
345 mbParaSpaceMaxAtPages
= aOptions
.IsAddSpacingAtPages();
346 mbTabCompat
= !aOptions
.IsUseOurTabStops();
347 mbUseVirtualDevice
= !aOptions
.IsUsePrtDevice();
348 mbAddExternalLeading
= !aOptions
.IsNoExtLeading();
349 mbOldLineSpacing
= aOptions
.IsUseLineSpacing();
350 mbAddParaSpacingToTableCells
= aOptions
.IsAddTableSpacing();
351 mbUseFormerObjectPos
= aOptions
.IsUseObjectPositioning();
352 mbUseFormerTextWrapping
= aOptions
.IsUseOurTextWrapping();
353 mbConsiderWrapOnObjPos
= aOptions
.IsConsiderWrappingStyle();
354 mbAddFlyOffsets
= false; // hidden
355 mbOldNumbering
= false; // hidden
356 mbUseHiResolutionVirtualDevice
= true; // hidden
357 mbIgnoreFirstLineIndentInNumbering
= false; // hidden
358 mbDoNotJustifyLinesWithManualBreak
= !aOptions
.IsExpandWordSpace();
359 mbDoNotResetParaAttrsForNumFont
= false; // hidden
360 mbOutlineLevelYieldsOutlineRule
= false; // hidden
361 mbTableRowKeep
= false; // hidden
362 mbIgnoreTabsAndBlanksForLineCalculation
= false; // hidden
363 mbDoNotCaptureDrawObjsOnPage
= false; // hidden
364 mbClipAsCharacterAnchoredWriterFlyFrames
= false; // hidden
365 mbUnixForceZeroExtLeading
= false; // hidden
366 mbOldPrinterMetrics
= false; // hidden
367 mbTabRelativeToIndent
= true; // hidden
368 // --> OD 2008-06-05 #i89181#
369 mbTabAtLeftIndentForParagraphsInList
= false; // hidden
371 mbInvertBorderSpacing
= false; // hidden
372 mbCollapseEmptyCellPara
= true; // hidden
375 // COMPATIBILITY FLAGS END
378 pMacroTable
= new SvxMacroTableDtor
;
380 mpGrammarContact
= ::createGrammarContact();
383 * Defaultformate und DefaultFormatsammlungen (FmtColl)
384 * werden an der Position 0 in das jeweilige Array eingetragen.
385 * Die Formate der FmtColls sind von den Defaultformaten
386 * abgeleitet und stehen auch in der Liste.
389 pFrmFmtTbl
->Insert(pDfltFrmFmt
, 0 );
390 pCharFmtTbl
->Insert(pDfltCharFmt
, 0 );
394 pTxtFmtCollTbl
->Insert(pDfltTxtFmtColl
, 0 );
396 pGrfFmtCollTbl
->Insert(pDfltGrfFmtColl
, 0 );
398 // PageDesc, EmptyPageFmt und ColumnFmt anlegen
399 if ( !aPageDescs
.Count() )
400 GetPageDescFromPool( RES_POOLPAGE_STANDARD
);
402 //Leere Seite Einstellen.
403 pEmptyPageFmt
->SetFmtAttr( SwFmtFrmSize( ATT_FIX_SIZE
) );
404 //BodyFmt fuer Spalten Einstellen.
405 pColumnContFmt
->SetFmtAttr( SwFmtFillOrder( ATT_LEFT_TO_RIGHT
) );
409 // lege (fuer die Filter) eine Default-OutlineNumRule an
410 // --> OD 2008-02-11 #newlistlevelattrs#
411 pOutlineRule
= new SwNumRule( String::CreateFromAscii( SwNumRule::GetOutlineRuleName() ),
412 // --> OD 2008-06-06 #i89178#
413 numfunc::GetDefaultPositionAndSpaceMode(),
418 AddNumRule(pOutlineRule
);
419 // --> OD 2005-10-21 - counting of phantoms depends on <IsOldNumbering()>
420 pOutlineRule
->SetCountPhantoms( !get(IDocumentSettingAccess::OLD_NUMBERING
) );
423 new SwTxtNode( SwNodeIndex( aUndoNodes
.GetEndOfContent() ), pDfltTxtFmtColl
);
424 new SwTxtNode( SwNodeIndex( aNodes
.GetEndOfContent() ),
425 GetTxtCollFromPool( RES_POOLCOLL_STANDARD
));
427 // den eigenen IdleTimer setzen
428 aIdleTimer
.SetTimeout( 600 );
429 aIdleTimer
.SetTimeoutHdl( LINK(this, SwDoc
, DoIdleJobs
) );
431 aOLEModifiedTimer
.SetTimeout( 1000 );
432 aOLEModifiedTimer
.SetTimeoutHdl( LINK( this, SwDoc
, DoUpdateModifiedOLE
));
435 pNewDBMgr
= new SwNewDBMgr
;
440 // --> OD 2008-03-07 #refactorlists#
441 // pass empty item set containing the paragraph's list attributes
442 // as ignorable items to the stype manager.
444 SfxItemSet
aIgnorableParagraphItems( GetAttrPool(),
445 RES_PARATR_LIST_BEGIN
, RES_PARATR_LIST_END
-1,
447 pStyleAccess
= createStyleManager( &aIgnorableParagraphItems
);
455 * Besonderheiten: an der Position 0 des Arrays der Formate und
456 * der GDI-Objekte befindet sich ein Member der Klasse SwDoc.
457 * Dieser darf also keinesfalls durch delete geloescht
464 // --> OD 2007-03-16 #i73788#
465 SwPauseThreadStarting aPauseThreadStarting
;
468 // --> OD 2007-11-01 #i83479#
469 delete mpListItemsList
;
473 // clean up chart related structures...
474 // Note: the chart data provider gets already diposed in ~SwDocShell
475 // since all UNO API related functionality requires an existing SwDocShell
476 // this assures that dipose gets called if there is need for it.
477 aChartDataProviderImplRef
.reset();
478 delete pChartControllerHelper
;
480 delete mpGrammarContact
;
481 mpGrammarContact
= 0;
483 //!! needs to be done to destroy a possible SwFmtDrop format that may
484 //!! be connected to a char format which may not otherwise be removed
485 //!! and thus would leave a unremoved SwFmt object. (TL)
486 //!! (this is case is not possible via UI but via API...)
489 //!! same for SwFmtCharFmt
490 SwFmtCharFmt
aCharFmt(NULL
);
491 SetDefault(aCharFmt
);
493 StopIdling(); // stop idle timer
495 delete pUnoCallBack
, pUnoCallBack
= 0;
496 delete pURLStateChgd
;
499 // --> OD 2005-09-05 #125370#
503 // Undo-Benachrichtigung vom Draw abschalten
510 delete pPgPViewPrtData
;
512 mbUndo
= FALSE
; // immer das Undo abschalten !!
513 // damit die Fussnotenattribute die Fussnotennodes in Frieden lassen.
520 delete pAutoFmtRedlnComment
;
528 // die BaseLinks freigeben.
530 for( USHORT n
= pLinkMgr
->GetServers().Count(); n
; )
531 pLinkMgr
->GetServers()[ --n
]->Closed();
533 if( pLinkMgr
->GetLinks().Count() )
534 pLinkMgr
->Remove( 0, pLinkMgr
->GetLinks().Count() );
537 // die KapitelNummern / Nummern muessen vor den Vorlage geloescht werden
538 // ansonsten wird noch staendig geupdatet !!!
539 aNodes
.pOutlineNds
->Remove( USHORT(0), aNodes
.pOutlineNds
->Count() );
540 aUndoNodes
.pOutlineNds
->Remove( USHORT(0), aUndoNodes
.pOutlineNds
->Count() );
542 pFtnIdxs
->Remove( USHORT(0), pFtnIdxs
->Count() );
544 pUndos
->DeleteAndDestroy( 0, pUndos
->Count() ); //Es koennen in den Attributen noch
545 //noch indizes angemeldet sein.
547 // in den BookMarks sind Indizies auf den Content. Diese muessen vorm
548 // loesche der Nodes geloescht werden.
549 pMarkManager
->clearAllMarks();
550 DELETEZ( pMacroTable
);
554 Ring
* pTmp
= pExtInputRing
;
556 while( pTmp
->GetNext() != pTmp
)
557 delete pTmp
->GetNext();
561 //JP: alt - loeschen ohne Flag ist teuer; Modify wird verschickt!
562 // aTOXTypes.DeleteAndDestroy( 0, aTOXTypes.Count() );
564 for( USHORT n
= pTOXTypes
->Count(); n
; )
566 (*pTOXTypes
)[ --n
]->SetInDocDTOR();
567 delete (*pTOXTypes
)[ n
];
569 pTOXTypes
->Remove( 0, pTOXTypes
->Count() );
573 //Im einen oder anderen FrmFormat koennen noch Indizes angemeldet sein,
574 //Diese muessen spaetestens jetzt zerstoert werden.
575 pFrmFmtTbl
->ForEach( &lcl_DelFmtIndizes
, this );
576 pSpzFrmFmtTbl
->ForEach( &lcl_DelFmtIndizes
, this );
577 ((SwFrmFmts
&)*pSectionFmtTbl
).ForEach( &lcl_DelFmtIndizes
, this );
579 //Die Formate, die hier hinter stehen sind von den DefaultFormaten
580 //abhaengig. Erst nach dem Loeschen der FmtIndizes weil der Inhalt von
581 //Kopf-/Fussbereichen geloescht wird. Wenn dort noch Indizes von Flys
582 //angemeldet sind gibts was an die Ohren.
583 aPageDescs
.DeleteAndDestroy( 0, aPageDescs
.Count() );
585 // Inhaltssections loeschen
586 // nicht erst durch den SwNodes-DTOR, damit Formate
587 // keine Abhaengigen mehr haben.
588 aNodes
.DelNodes( SwNodeIndex( aNodes
), aNodes
.Count() );
589 aUndoNodes
.DelNodes( SwNodeIndex( aUndoNodes
), aUndoNodes
.Count() );
591 // Formate loeschen, spaeter mal permanent machen.
593 // Delete fuer Collections
594 // damit die Abhaengigen wech sind
595 SwTxtFmtColl
*pFtnColl
= pFtnInfo
->GetFtnTxtColl();
596 if ( pFtnColl
) pFtnColl
->Remove(pFtnInfo
);
597 pFtnColl
= pEndNoteInfo
->GetFtnTxtColl();
598 if ( pFtnColl
) pFtnColl
->Remove(pEndNoteInfo
);
600 ASSERT( pDfltTxtFmtColl
== (*pTxtFmtCollTbl
)[0],
601 "Default-Text-Collection muss immer am Anfang stehen" );
603 // JP 27.01.98: opt.: ausgehend davon, das Standard als 2. im Array
604 // steht, sollte das als letztes geloescht werden, damit
605 // die ganze Umhaengerei der Formate vermieden wird!
606 if( 2 < pTxtFmtCollTbl
->Count() )
607 pTxtFmtCollTbl
->DeleteAndDestroy( 2, pTxtFmtCollTbl
->Count()-2 );
608 pTxtFmtCollTbl
->DeleteAndDestroy( 1, pTxtFmtCollTbl
->Count()-1 );
609 delete pTxtFmtCollTbl
;
611 ASSERT( pDfltGrfFmtColl
== (*pGrfFmtCollTbl
)[0],
612 "Default-Grf-Collection muss immer am Anfang stehen" );
614 pGrfFmtCollTbl
->DeleteAndDestroy( 1, pGrfFmtCollTbl
->Count()-1 );
615 // ergibt sich automatisch - kein _DEL Array!
616 // pGrfFmtCollTbl->Remove( 0, n );
617 delete pGrfFmtCollTbl
;
620 * Defaultformate und DefaultFormatsammlungen (FmtColl)
621 * sind an der Position 0 der jeweiligen Arrays eingetragen.
622 * Damit sie nicht vom DTOR der Array's zum 2.mal geloescht werden,
623 * nehme sie aus dem Array.
625 pFrmFmtTbl
->Remove( 0 );
626 pCharFmtTbl
->Remove( 0 );
630 DELETEZ( pNewDBMgr
);
632 // Alle Flys muessen vor dem Drawing Model zerstoert werden,
633 // da Flys noch DrawContacts enthalten koennen, wenn wegen
634 // eines Lesefehlers kein Layout aufgebaut wurde.
635 pSpzFrmFmtTbl
->DeleteAndDestroy( 0, pSpzFrmFmtTbl
->Count() );
637 //Erst jetzt das Model zerstoeren, die Zeichenobjekte - die ja auch
638 //im Undo herumlungern - wollen noch ihre Attribute beim Model entfernen.
639 //Ausserdem koennen vorher noch DrawContacts existieren.
641 //JP 28.01.99: DrawModel vorm LinkManager zerstoeren, da am DrawModel
642 // dieser immer gesetzt ist.
645 //Tables vor dem loeschen der Defaults leeren, sonst GPF wegen Def-Abhaengigen.
646 //Die Arrays sollten (wegen includes) bei Gelegenheit auch zu Pointern werden.
648 delete pSpzFrmFmtTbl
;
653 delete pSectionFmtTbl
;
654 delete pTblFrmFmtTbl
;
655 delete pDfltTxtFmtColl
;
656 delete pDfltGrfFmtColl
;
659 // --> OD 2008-03-26 #refactorlists#
661 for ( std::hash_map
< String
, SwList
*, StringHash
>::iterator
662 aListIter
= maLists
.begin();
663 aListIter
!= maLists
.end();
666 delete (*aListIter
).second
;
670 maListStyleLists
.clear();
674 delete pNumberFormatter
;
677 delete pLineNumberInfo
;
683 delete pEmptyPageFmt
;
684 delete pColumnContFmt
;
690 SfxItemPool::Free(mpAttrPool
);
693 //---------------------------------------------------
695 VirtualDevice
& SwDoc::CreateVirtualDevice_() const
697 VirtualDevice
* pNewVir
= new VirtualDevice( 1 );
700 pNewVir
->SetReferenceDevice( VirtualDevice::REFDEV_MODE_MSO1
);
702 // --> FME 2006-10-09 #i60945# External leading compatibility for unix systems.
703 if ( get(IDocumentSettingAccess::UNIX_FORCE_ZERO_EXT_LEADING
) )
704 pNewVir
->Compat_ZeroExtleadBug();
707 MapMode
aMapMode( pNewVir
->GetMapMode() );
708 aMapMode
.SetMapUnit( MAP_TWIP
);
709 pNewVir
->SetMapMode( aMapMode
);
711 const_cast<SwDoc
*>(this)->setVirtualDevice( pNewVir
, true, true );
715 //---------------------------------------------------
717 SfxPrinter
& SwDoc::CreatePrinter_() const
719 ASSERT( ! pPrt
, "Do not call CreatePrinter_(), call getPrinter() instead" )
721 #if OSL_DEBUG_LEVEL > 1
722 ASSERT( false, "Printer will be created!" )
725 // wir erzeugen einen default SfxPrinter.
726 // Das ItemSet wird vom Sfx geloescht!
727 SfxItemSet
*pSet
= new SfxItemSet( ((SwDoc
*)this)->GetAttrPool(),
728 FN_PARAM_ADDPRINTER
, FN_PARAM_ADDPRINTER
,
729 SID_HTML_MODE
, SID_HTML_MODE
,
730 SID_PRINTER_NOTFOUND_WARN
, SID_PRINTER_NOTFOUND_WARN
,
731 SID_PRINTER_CHANGESTODOC
, SID_PRINTER_CHANGESTODOC
,
734 SfxPrinter
* pNewPrt
= new SfxPrinter( pSet
);
735 const_cast<SwDoc
*>(this)->setPrinter( pNewPrt
, true, true );
738 //---------------------------------------------------
740 void SwDoc::SetDocShell( SwDocShell
* pDSh
)
742 if( pDocShell
!= pDSh
)
746 pLinkMgr
->SetPersist( pDocShell
);
747 //JP 27.08.98: Bug 55570 - DocShell Pointer auch am DrawModel setzen
750 ((SwDrawDocument
*)pDrawModel
)->SetObjectShell( pDocShell
);
751 pDrawModel
->SetPersist( pDocShell
);
752 ASSERT( pDrawModel
->GetPersist() == GetPersist(),
753 "draw model's persist is out of sync" );
759 // Convenience-Methode, um uebermaessige Includes von docsh.hxx
764 uno::Reference
< embed::XStorage
> SwDoc::GetDocStorage()
767 return pDocShell
->GetStorage();
768 if( pLinkMgr
->GetPersist() )
769 return pLinkMgr
->GetPersist()->GetStorage();
775 SfxObjectShell
* SwDoc::GetPersist() const
777 return pDocShell
? pDocShell
: pLinkMgr
->GetPersist();
781 void SwDoc::ClearDoc()
783 BOOL bOldUndo
= mbUndo
;
785 mbUndo
= FALSE
; // immer das Undo abschalten !!
787 // Undo-Benachrichtigung vom Draw abschalten
794 // stehen noch FlyFrames rum, loesche auch diese
796 while ( 0 != (n
= GetSpzFrmFmts()->Count()) )
797 DelLayoutFmt((*pSpzFrmFmtTbl
)[n
-1]);
798 ASSERT( !pDrawModel
|| !pDrawModel
->GetPage(0)->GetObjCount(),
799 "not all DrawObjects removed from the page" );
801 pRedlineTbl
->DeleteAndDestroy( 0, pRedlineTbl
->Count() );
806 // in den BookMarks sind Indizies auf den Content. Diese muessen vorm
807 // loesche der Nodes geloescht werden.
808 pMarkManager
->clearAllMarks();
811 // create a dummy pagedesc for the layout
812 sal_uInt16 nDummyPgDsc
= MakePageDesc( String::CreateFromAscii( "?DUMMY?" ));
813 SwPageDesc
* pDummyPgDsc
= aPageDescs
[ nDummyPgDsc
];
815 SwNodeIndex
aSttIdx( *GetNodes().GetEndOfContent().StartOfSectionNode(), 1 );
816 // den ersten immer wieder neu anlegen (ohne Attribute/Vorlagen/...)
817 SwTxtNode
* pFirstNd
= GetNodes().MakeTxtNode( aSttIdx
, pDfltTxtFmtColl
);
821 // set the layout to the dummy pagedesc
822 pFirstNd
->SetAttr( SwFmtPageDesc( pDummyPgDsc
));
824 SwPosition
aPos( *pFirstNd
, SwIndex( pFirstNd
));
825 ::PaMCorrAbs( aSttIdx
, SwNodeIndex( GetNodes().GetEndOfContent() ),
829 GetNodes().Delete( aSttIdx
,
830 GetNodes().GetEndOfContent().GetIndex() - aSttIdx
.GetIndex() );
832 // --> OD 2006-02-28 #i62440#
833 // destruction of numbering rules and creation of new outline rule
834 // *after* the document nodes are deleted.
836 pNumRuleTbl
->DeleteAndDestroy( 0, pNumRuleTbl
->Count() );
837 // creation of new outline numbering rule
838 // --> OD 2008-02-11 #newlistlevelattrs#
839 pOutlineRule
= new SwNumRule( String::CreateFromAscii( SwNumRule::GetOutlineRuleName() ),
840 // --> OD 2008-06-06 #i89178#
841 numfunc::GetDefaultPositionAndSpaceMode(),
845 AddNumRule(pOutlineRule
);
846 // --> OD 2005-10-21 - counting of phantoms depends on <IsOldNumbering()>
847 pOutlineRule
->SetCountPhantoms( !get(IDocumentSettingAccess::OLD_NUMBERING
) );
851 //remove the dummy pagedec from the array and delete all the old ones
852 aPageDescs
.Remove( nDummyPgDsc
);
853 aPageDescs
.DeleteAndDestroy( 0, aPageDescs
.Count() );
855 // Delete fuer Collections
856 // damit die Abhaengigen wech sind
857 SwTxtFmtColl
* pFtnColl
= pFtnInfo
->GetFtnTxtColl();
858 if( pFtnColl
) pFtnColl
->Remove( pFtnInfo
);
859 pFtnColl
= pEndNoteInfo
->GetFtnTxtColl();
860 if( pFtnColl
) pFtnColl
->Remove( pEndNoteInfo
);
862 // JP 27.01.98: opt.: ausgehend davon, das Standard als 2. im Array
863 // steht, sollte das als letztes geloescht werden, damit
864 // die ganze Umhaengerei der Formate vermieden wird!
865 if( 2 < pTxtFmtCollTbl
->Count() )
866 pTxtFmtCollTbl
->DeleteAndDestroy( 2, pTxtFmtCollTbl
->Count()-2 );
867 pTxtFmtCollTbl
->DeleteAndDestroy( 1, pTxtFmtCollTbl
->Count()-1 );
868 pGrfFmtCollTbl
->DeleteAndDestroy( 1, pGrfFmtCollTbl
->Count()-1 );
869 pCharFmtTbl
->DeleteAndDestroy( 1, pCharFmtTbl
->Count()-1 );
873 // search the FrameFormat of the root frm. This is not allowed to delete
874 pFrmFmtTbl
->Remove( pFrmFmtTbl
->GetPos( pLayout
->GetFmt() ) );
875 pFrmFmtTbl
->DeleteAndDestroy( 1, pFrmFmtTbl
->Count()-1 );
876 pFrmFmtTbl
->Insert( pLayout
->GetFmt(), pFrmFmtTbl
->Count() );
879 pFrmFmtTbl
->DeleteAndDestroy( 1, pFrmFmtTbl
->Count()-1 );
881 xForbiddenCharsTable
.unbind();
883 pFldTypes
->DeleteAndDestroy( INIT_FLDTYPES
,
884 pFldTypes
->Count() - INIT_FLDTYPES
);
886 delete pNumberFormatter
, pNumberFormatter
= 0;
888 GetPageDescFromPool( RES_POOLPAGE_STANDARD
);
889 pFirstNd
->ChgFmtColl( GetTxtCollFromPool( RES_POOLCOLL_STANDARD
));
890 nDummyPgDsc
= aPageDescs
.Count();
891 aPageDescs
.Insert( pDummyPgDsc
, nDummyPgDsc
);
892 // set the layout back to the new standard pagedesc
893 pFirstNd
->ResetAllAttr();
894 // delete now the dummy pagedesc
895 DelPageDesc( nDummyPgDsc
);
900 void SwDoc::SetPreViewPrtData( const SwPagePreViewPrtData
* pNew
)
904 if( pPgPViewPrtData
)
905 *pPgPViewPrtData
= *pNew
;
907 pPgPViewPrtData
= new SwPagePreViewPrtData( *pNew
);
909 else if( pPgPViewPrtData
)
910 DELETEZ( pPgPViewPrtData
);
913 /* -----------------------------06.01.00 14:03--------------------------------
915 ---------------------------------------------------------------------------*/
916 SwModify
* SwDoc::GetUnoCallBack() const
921 /*-----------------28.5.2001 10:06------------------
923 * Reading and writing of the layout cache.
924 *--------------------------------------------------*/
926 void SwDoc::ReadLayoutCache( SvStream
& rStream
)
929 pLayoutCache
= new SwLayoutCache();
930 if( !pLayoutCache
->IsLocked() )
932 pLayoutCache
->GetLockCount() |= 0x8000;
933 pLayoutCache
->Read( rStream
);
934 pLayoutCache
->GetLockCount() &= 0x7fff;
938 void SwDoc::WriteLayoutCache( SvStream
& rStream
)
940 pLayoutCache
->Write( rStream
, *this );
943 IGrammarContact
* getGrammarContact( const SwTxtNode
& rTxtNode
)
945 const SwDoc
* pDoc
= rTxtNode
.GetDoc();
946 if( !pDoc
|| pDoc
->IsInDtor() )
948 return pDoc
->getGrammarContact();
951 // --> FME 2005-02-25 #i42634# Moved common code of SwReader::Read() and
952 // SwDocShell::UpdateLinks() to new SwDoc::UpdateLinks():
953 void SwDoc::UpdateLinks( BOOL bUI
)
955 SfxObjectCreateMode eMode
;
956 USHORT nLinkMode
= getLinkUpdateMode( true );
957 USHORT nUpdateDocMode
= GetDocShell()->GetUpdateDocMode();
959 (nLinkMode
!= NEVER
|| document::UpdateDocMode::FULL_UPDATE
== nUpdateDocMode
) &&
960 GetLinkManager().GetLinks().Count() &&
961 SFX_CREATE_MODE_INTERNAL
!=
962 ( eMode
= GetDocShell()->GetCreateMode()) &&
963 SFX_CREATE_MODE_ORGANIZER
!= eMode
&&
964 SFX_CREATE_MODE_PREVIEW
!= eMode
&&
965 !GetDocShell()->IsPreview() )
968 BOOL bAskUpdate
= nLinkMode
== MANUAL
;
970 switch(nUpdateDocMode
)
972 case document::UpdateDocMode::NO_UPDATE
: bUpdate
= FALSE
;break;
973 case document::UpdateDocMode::QUIET_UPDATE
:bAskUpdate
= FALSE
; break;
974 case document::UpdateDocMode::FULL_UPDATE
: bAskUpdate
= TRUE
; break;
976 if( bUpdate
&& (bUI
|| !bAskUpdate
) )
978 SfxMedium
* pMedium
= GetDocShell()->GetMedium();
979 SfxFrame
* pFrm
= pMedium
? pMedium
->GetLoadTargetFrame() : 0;
980 Window
* pDlgParent
= pFrm
? &pFrm
->GetWindow() : 0;
981 if( GetRootFrm() && !GetEditShell( &pVSh
) && !pVSh
)
983 ViewShell
aVSh( *this, 0, 0 );
985 SET_CURR_SHELL( &aVSh
);
986 GetLinkManager().UpdateAllLinks( bAskUpdate
, TRUE
, FALSE
, pDlgParent
);
989 GetLinkManager().UpdateAllLinks( bAskUpdate
, TRUE
, FALSE
, pDlgParent
);
995 // --> OD 2006-04-19 #b6375613#
996 void SwDoc::SetApplyWorkaroundForB6375613( bool p_bApplyWorkaroundForB6375613
)
998 if ( mbApplyWorkaroundForB6375613
!= p_bApplyWorkaroundForB6375613
)
1000 mbApplyWorkaroundForB6375613
= p_bApplyWorkaroundForB6375613
;
1002 uno::Reference
< document::XDocumentInfoSupplier
> xDoc(
1003 GetDocShell()->GetBaseModel(),
1007 uno::Reference
< beans::XPropertyContainer
> xDocInfo(
1008 xDoc
->getDocumentInfo(),
1010 if ( xDocInfo
.is() )
1014 if ( mbApplyWorkaroundForB6375613
)
1016 xDocInfo
->addProperty(
1017 rtl::OUString::createFromAscii("WorkaroundForB6375613Applied"),
1018 beans::PropertyAttribute::TRANSIENT
| beans::PropertyAttribute::REMOVABLE
,
1019 uno::makeAny( false ) );
1023 xDocInfo
->removeProperty( rtl::OUString::createFromAscii("WorkaroundForB6375613Applied") );
1026 catch( uno::Exception
& )
1035 ::sfx2::IXmlIdRegistry
&
1036 SwDoc::GetXmlIdRegistry()
1038 // UGLY: this relies on SetClipBoard being called before GetXmlIdRegistry!
1039 if (!m_pXmlIdRegistry
.get())
1041 m_pXmlIdRegistry
.reset( ::sfx2::createXmlIdRegistry( IsClipBoard() ) );
1043 return *m_pXmlIdRegistry
;
1046 ::sw::MetaFieldManager
&
1047 SwDoc::GetMetaFieldManager()
1049 return *m_pMetaFieldManager
;
1052 void SwDoc::InitTOXTypes()
1054 ShellResource
* pShellRes
= ViewShell::GetShellRes();
1055 SwTOXType
* pNew
= new SwTOXType(TOX_CONTENT
, pShellRes
->aTOXContentName
);
1056 pTOXTypes
->Insert( pNew
, pTOXTypes
->Count() );
1057 pNew
= new SwTOXType(TOX_INDEX
, pShellRes
->aTOXIndexName
);
1058 pTOXTypes
->Insert( pNew
, pTOXTypes
->Count() );
1059 pNew
= new SwTOXType(TOX_USER
, pShellRes
->aTOXUserName
);
1060 pTOXTypes
->Insert( pNew
, pTOXTypes
->Count() );
1061 pNew
= new SwTOXType(TOX_ILLUSTRATIONS
, pShellRes
->aTOXIllustrationsName
);
1062 pTOXTypes
->Insert( pNew
, pTOXTypes
->Count() );
1063 pNew
= new SwTOXType(TOX_OBJECTS
, pShellRes
->aTOXObjectsName
);
1064 pTOXTypes
->Insert( pNew
, pTOXTypes
->Count() );
1065 pNew
= new SwTOXType(TOX_TABLES
, pShellRes
->aTOXTablesName
);
1066 pTOXTypes
->Insert( pNew
, pTOXTypes
->Count() );
1067 pNew
= new SwTOXType(TOX_AUTHORITIES
, pShellRes
->aTOXAuthoritiesName
);
1068 pTOXTypes
->Insert( pNew
, pTOXTypes
->Count() );
1071 /*-- 08.05.2009 10:07:57---------------------------------------------------
1073 -----------------------------------------------------------------------*/
1074 SwDoc
* SwDoc::CreateCopy() const
1076 SwDoc
* pRet
= new SwDoc
;
1080 //aUndoNodes( this ),
1081 mpAttrPool(new SwAttrPool(this)),*/
1082 USHORT __FAR_DATA aRangeOfDefaults
[] = {
1083 RES_FRMATR_BEGIN
, RES_FRMATR_END
-1,
1084 RES_CHRATR_BEGIN
, RES_CHRATR_END
-1,
1085 RES_PARATR_BEGIN
, RES_PARATR_END
-1,
1086 // --> OD 2008-02-25 #refactorlists##
1087 RES_PARATR_LIST_BEGIN
, RES_PARATR_LIST_END
-1,
1089 RES_UNKNOWNATR_BEGIN
, RES_UNKNOWNATR_END
-1,
1093 SfxItemSet
aNewDefaults( pRet
->GetAttrPool(), aRangeOfDefaults
);
1097 while( aRangeOfDefaults
[nRange
] != 0)
1099 for( nWhich
= aRangeOfDefaults
[nRange
]; nWhich
< aRangeOfDefaults
[nRange
+ 1]; ++nWhich
)
1101 const SfxPoolItem
& rSourceAttr
= mpAttrPool
->GetDefaultItem( nWhich
);
1102 if( rSourceAttr
!= pRet
->mpAttrPool
->GetDefaultItem( nWhich
) )
1103 aNewDefaults
.Put( rSourceAttr
);
1107 if( aNewDefaults
.Count() )
1108 pRet
->SetDefault( aNewDefaults
);
1111 pDfltFrmFmt( new SwFrmFmt( GetAttrPool(), sFrmFmtStr, 0 ) ),
1112 pEmptyPageFmt( new SwFrmFmt( GetAttrPool(), sEmptyPageStr, pDfltFrmFmt ) ),
1113 pColumnContFmt( new SwFrmFmt( GetAttrPool(), sColumnCntStr, pDfltFrmFmt ) ),
1114 pDfltCharFmt( new SwCharFmt( GetAttrPool(), sCharFmtStr, 0 ) ),
1115 pDfltTxtFmtColl( new SwTxtFmtColl( GetAttrPool(), sTxtCollStr ) ),
1116 pDfltGrfFmtColl( new SwGrfFmtColl( GetAttrPool(), sGrfCollStr ) ),
1117 pFrmFmtTbl( new SwFrmFmts() ),
1118 pCharFmtTbl( new SwCharFmts() ),
1119 pSpzFrmFmtTbl( new SwSpzFrmFmts() ),
1120 pSectionFmtTbl( new SwSectionFmts() ),
1121 pTblFrmFmtTbl( new SwFrmFmts() ),
1122 pTxtFmtCollTbl( new SwTxtFmtColls() ),
1123 pGrfFmtCollTbl( new SwGrfFmtColls() ),
1124 pBookmarkTbl( new SwBookmarks( 0, 16 ) ),
1125 pTOXTypes( new SwTOXTypes() ),
1126 pDefTOXBases( new SwDefTOXBase_Impl() ),
1127 pLayout( 0 ), // Rootframe des spezifischen Layouts.
1129 pUndos( new SwUndos( 0, 20 ) ),
1130 pUpdtFlds( new SwDocUpdtFld() ),
1131 pFldTypes( new SwFldTypes() ),
1137 pFtnInfo( new SwFtnInfo ),
1138 pEndNoteInfo( new SwEndNoteInfo ),
1139 pLineNumberInfo( new SwLineNumberInfo ),
1140 pFtnIdxs( new SwFtnIdxs ),
1141 pDocStat( new SwDocStat ),
1144 pLinkMgr( new SvxLinkManager( 0 ) ),
1147 pNumberFormatter( 0 ),
1148 pNumRuleTbl( new SwNumRuleTbl ),
1149 // --> OD 2008-03-26 #refactorlists#
1153 pRedlineTbl( new SwRedlineTbl ),
1154 pAutoFmtRedlnComment( 0 ),
1155 pUnoCrsrTbl( new SwUnoCrsrTbl( 0, 16 ) ),
1156 pPgPViewPrtData( 0 ),
1159 // --> OD 2008-03-07 #refactorlists#
1163 pUnoCallBack(new SwUnoCallBack(0)),
1164 mpGrammarContact( 0 ),
1165 aChartDataProviderImplRef(),
1166 pChartControllerHelper( 0 ),
1167 // --> OD 2007-10-31 #i83479#
1168 mpListItemsList( new tImplSortedNodeNumList() ),
1174 nAutoFmtRedlnCommentNo( 0 ),
1175 nLinkUpdMode( GLOBALSETTING ),
1176 eFldUpdMode( AUTOUPD_GLOBALSETTING ),
1177 eRedlineMode((RedlineMode_t)(nsRedlineMode_t::REDLINE_SHOW_INSERT | nsRedlineMode_t::REDLINE_SHOW_DELETE)),
1178 eChrCmprType( CHARCOMPRESS_NONE ),
1182 mbReadlineChecked(false),
1183 mbWinEncryption(sal_False),
1184 // --> OD 2005-02-11 #i38810#
1185 mbLinksUpdated( sal_False ),
1186 mbClipBoard( false ),
1187 mbColumnSelection( false ),
1189 mbProtectForm(false),*/
1190 pRet
->n32DummyCompatabilityOptions1
= n32DummyCompatabilityOptions1
;
1191 pRet
->n32DummyCompatabilityOptions2
= n32DummyCompatabilityOptions2
;
1193 mbStartIdleTimer(sal_False)
1195 RTL_LOGFILE_CONTEXT_AUTHOR( aLog, "SW", "JP93722", "SwDoc::SwDoc" );
1215 mbGlblDocSaveLinks =
1217 mbIsAutoFmtRedline =
1218 mbOLEPrtNotifyPending =
1221 mbInsOnlyTxtGlssry =
1222 mbContains_MSVBasic =
1223 mbKernAsianPunctuation =
1227 // --> OD 2006-03-21 #b6375613#
1228 mbApplyWorkaroundForB6375613 =
1239 // COMPATIBILITY FLAGS START
1242 // Note: Any non-hidden compatibility flag should obtain its default
1243 // by asking SvtCompatibilityOptions, see below.
1245 const SvtCompatibilityOptions aOptions;
1247 pRet
->mbParaSpaceMax
= mbParaSpaceMax
;
1248 pRet
->mbParaSpaceMaxAtPages
= mbParaSpaceMaxAtPages
;
1249 pRet
->mbTabCompat
= mbTabCompat
;
1250 pRet
->mbUseVirtualDevice
= mbUseVirtualDevice
;
1251 pRet
->mbAddExternalLeading
= mbAddExternalLeading
;
1252 pRet
->mbOldLineSpacing
= mbOldLineSpacing
;
1253 pRet
->mbAddParaSpacingToTableCells
= mbAddParaSpacingToTableCells
;
1254 pRet
->mbUseFormerObjectPos
= mbUseFormerObjectPos
;
1255 pRet
->mbUseFormerTextWrapping
= mbUseFormerTextWrapping
;
1256 pRet
->mbConsiderWrapOnObjPos
= mbConsiderWrapOnObjPos
;
1257 pRet
->mbAddFlyOffsets
= mbAddFlyOffsets
;
1258 pRet
->mbOldNumbering
= mbOldNumbering
;
1259 pRet
->mbUseHiResolutionVirtualDevice
= mbUseHiResolutionVirtualDevice
;
1260 pRet
->mbIgnoreFirstLineIndentInNumbering
= mbIgnoreFirstLineIndentInNumbering
;
1261 pRet
->mbDoNotJustifyLinesWithManualBreak
= mbDoNotJustifyLinesWithManualBreak
;
1262 pRet
->mbDoNotResetParaAttrsForNumFont
= mbDoNotResetParaAttrsForNumFont
;
1263 pRet
->mbOutlineLevelYieldsOutlineRule
= mbOutlineLevelYieldsOutlineRule
;
1264 pRet
->mbTableRowKeep
= mbTableRowKeep
;
1265 pRet
->mbIgnoreTabsAndBlanksForLineCalculation
= mbIgnoreTabsAndBlanksForLineCalculation
;
1266 pRet
->mbDoNotCaptureDrawObjsOnPage
= mbDoNotCaptureDrawObjsOnPage
;
1267 pRet
->mbClipAsCharacterAnchoredWriterFlyFrames
= mbClipAsCharacterAnchoredWriterFlyFrames
;
1268 pRet
->mbUnixForceZeroExtLeading
= mbUnixForceZeroExtLeading
;
1269 pRet
->mbOldPrinterMetrics
= mbOldPrinterMetrics
;
1270 pRet
->mbTabRelativeToIndent
= mbTabRelativeToIndent
;
1271 pRet
->mbTabAtLeftIndentForParagraphsInList
= mbTabAtLeftIndentForParagraphsInList
;
1274 // COMPATIBILITY FLAGS END
1277 pMacroTable = new SvxMacroTableDtor;
1279 mpGrammarContact = ::createGrammarContact();
1282 pFrmFmtTbl->Insert(pDfltFrmFmt, 0 );
1283 pCharFmtTbl->Insert(pDfltCharFmt, 0 );
1287 pTxtFmtCollTbl->Insert(pDfltTxtFmtColl, 0 );
1289 pGrfFmtCollTbl->Insert(pDfltGrfFmtColl, 0 );
1291 // PageDesc, EmptyPageFmt und ColumnFmt anlegen
1292 if ( !aPageDescs.Count() )
1293 GetPageDescFromPool( RES_POOLPAGE_STANDARD );
1295 //Leere Seite Einstellen.
1296 pEmptyPageFmt->SetFmtAttr( SwFmtFrmSize( ATT_FIX_SIZE ) );
1297 //BodyFmt fuer Spalten Einstellen.
1298 pColumnContFmt->SetFmtAttr( SwFmtFillOrder( ATT_LEFT_TO_RIGHT ) );
1302 // lege (fuer die Filter) eine Default-OutlineNumRule an
1303 // --> OD 2008-02-11 #newlistlevelattrs#
1304 pOutlineRule = new SwNumRule( String::CreateFromAscii( SwNumRule::GetOutlineRuleName() ),
1305 // --> OD 2008-06-06 #i89178#
1306 numfunc::GetDefaultPositionAndSpaceMode(),
1311 AddNumRule(pOutlineRule);
1312 // --> OD 2005-10-21 - counting of phantoms depends on <IsOldNumbering()>
1313 pOutlineRule->SetCountPhantoms( !get(IDocumentSettingAccess::OLD_NUMBERING) );
1316 new SwTxtNode( SwNodeIndex( aUndoNodes.GetEndOfContent() ), pDfltTxtFmtColl );
1317 new SwTxtNode( SwNodeIndex( aNodes.GetEndOfContent() ),
1318 GetTxtCollFromPool( RES_POOLCOLL_STANDARD ));
1320 // den eigenen IdleTimer setzen
1321 aIdleTimer.SetTimeout( 600 );
1322 aIdleTimer.SetTimeoutHdl( LINK(this, SwDoc, DoIdleJobs) );
1324 aOLEModifiedTimer.SetTimeout( 1000 );
1325 aOLEModifiedTimer.SetTimeoutHdl( LINK( this, SwDoc, DoUpdateModifiedOLE ));
1328 pNewDBMgr = new SwNewDBMgr;
1331 ShellResource* pShellRes = ViewShell::GetShellRes();
1333 SwTOXType * pNew = new SwTOXType(TOX_CONTENT, pShellRes->aTOXContentName );
1334 pTOXTypes->Insert( pNew, pTOXTypes->Count() );
1335 pNew = new SwTOXType(TOX_INDEX, pShellRes->aTOXIndexName );
1336 pTOXTypes->Insert( pNew, pTOXTypes->Count() );
1337 pNew = new SwTOXType(TOX_USER, pShellRes->aTOXUserName );
1338 pTOXTypes->Insert( pNew, pTOXTypes->Count() );
1339 pNew = new SwTOXType(TOX_ILLUSTRATIONS, pShellRes->aTOXIllustrationsName );
1340 pTOXTypes->Insert( pNew, pTOXTypes->Count() );
1341 pNew = new SwTOXType(TOX_OBJECTS, pShellRes->aTOXObjectsName );
1342 pTOXTypes->Insert( pNew, pTOXTypes->Count() );
1343 pNew = new SwTOXType(TOX_TABLES, pShellRes->aTOXTablesName );
1344 pTOXTypes->Insert( pNew, pTOXTypes->Count() );
1345 pNew = new SwTOXType(TOX_AUTHORITIES, pShellRes->aTOXAuthoritiesName );
1346 pTOXTypes->Insert( pNew, pTOXTypes->Count() );
1349 SfxItemSet aIgnorableParagraphItems( GetAttrPool(),
1350 RES_PARATR_LIST_BEGIN, RES_PARATR_LIST_END-1,
1352 pStyleAccess = createStyleManager( &aIgnorableParagraphItems );
1359 pRet
->Paste( *this );
1362 /*-- 08.05.2009 10:52:40---------------------------------------------------
1363 copy document content - code from SwFEShell::Paste( SwDoc* , BOOL )
1364 -----------------------------------------------------------------------*/
1365 void SwDoc::Paste( const SwDoc
& rSource
)
1367 // this has to be empty const USHORT nStartPageNumber = GetPhyPageNum();
1368 // until the end of the NodesArray
1369 SwNodeIndex
aSourceIdx( rSource
.GetNodes().GetEndOfExtras(), 2 );
1370 SwPaM
aCpyPam( aSourceIdx
); //DocStart
1371 SwNodeIndex
aTargetIdx( GetNodes().GetEndOfExtras(), 2 );
1372 SwPaM
aInsertPam( aTargetIdx
); //replaces PCURCRSR from SwFEShell::Paste()
1376 aCpyPam
.Move( fnMoveForward
, fnGoDoc
);
1378 this->StartUndo( UNDO_INSGLOSSARY
, NULL
);
1379 this->LockExpFlds();
1382 SwPosition
& rInsPos
= *aInsertPam
.GetPoint();
1383 //find out if the clipboard document starts with a table
1384 bool bStartWithTable
= 0 != aCpyPam
.Start()->nNode
.GetNode().FindTableNode();
1385 SwPosition
aInsertPosition( rInsPos
);
1388 SwNodeIndex
aIndexBefore(rInsPos
.nNode
);
1392 rSource
.CopyRange( aCpyPam
, rInsPos
, true );
1396 SwPaM
aPaM(SwPosition(aIndexBefore
, 0),
1397 SwPosition(rInsPos
.nNode
, 0));
1399 MakeUniqueNumRules(aPaM
);
1403 //TODO: Is this necessary here? SaveTblBoxCntnt( &rInsPos );
1404 if(/*bIncludingPageFrames && */bStartWithTable
)
1406 //remove the paragraph in front of the table
1407 SwPaM
aPara(aInsertPosition
);
1408 this->DelFullPara(aPara
);
1410 //additionally copy page bound frames
1411 if( /*bIncludingPageFrames && */rSource
.GetSpzFrmFmts()->Count() )
1413 for ( USHORT i
= 0; i
< rSource
.GetSpzFrmFmts()->Count(); ++i
)
1415 BOOL bInsWithFmt
= TRUE
;
1416 const SwFrmFmt
& rCpyFmt
= *(*rSource
.GetSpzFrmFmts())[i
];
1419 SwFmtAnchor
aAnchor( rCpyFmt
.GetAnchor() );
1420 if( FLY_PAGE
== aAnchor
.GetAnchorId() )
1422 aAnchor
.SetPageNum( aAnchor
.GetPageNum() + /*nStartPageNumber - */1 );
1426 this->CopyLayoutFmt( rCpyFmt
, aAnchor
, true, true );
1432 this->EndUndo( UNDO_INSGLOSSARY
, NULL
);
1435 UpdateFlds(NULL
, false);