2009-09-11 Michael Stahl merge DEV300_m58 2009-09-07 Michael Stahl SwFmtFld::Modify(): do nothing on RES_OBJECTDYING 2009-08-27 Michael Stahl #i91565#, #i91566#: TextPortionEnumerationTest.java: add test document 2009-08-27 Michael Stahl #i91565#, #i91566#: add complex test: TextPortionEnumerationTest.java 2009-08-27 Michael Stahl CLiteral::initialize(): zero-length literals probably not an error 2009-08-27 Michael Stahl #i91565#, #i91566#: offapi: new InContentMetadata and MetadataField services adapt TextPortion for InContentMetadata 2009-08-27 Michael Stahl #i91564#: xmloff: load/store xml:id and RDFa for text:bookmark(-start). 2009-08-27 Michael Stahl #i91564#: sw core: add support for xml:id at bookmarks: sw::mark::Bookmark: derive from Metadatable. SwHistoryBookmark, SaveBookmark: store a MetadatableUndo. ndcopy.cxx: lcl_CopyBookmarks(): copy the xml:id. SwXBookmark: derive from MetadatableMixin. 2009-08-27 Michael Stahl #i91565#, #i91566#: xmloff: refactor ruby import so nested meta(-field) works: remove XMLRubyHint_Impl. XMLImpRubyContext_Impl::~XMLImpRubyContext_Impl(): insert ruby directly. 2009-08-27 Michael Stahl #i91565#, #i91566#: xmloff: fix text:meta(-field) import/export: new XMLTextParagraphExport::exportTextField() overload for XTextField. CreateAndInsertMark(): set xml:id after insertion. fix meta(-field) service names, bugs etc. 2009-08-27 Michael Stahl #i91565#, #i91566#: sw text formatting: paint background of meta(-field) body: SwFont: add member m_nMetaCount. txttypes.hxx: add POR_META. atrstck.cxx: handle RES_TXTATR_META(FIELD). itrform2.cxx: SwTxtFormatter::WhichTxtPor(): create new class SwMetaPortion. 2009-08-27 Michael Stahl #i91566#: sw text formatting: display meta-field prefix and suffix: SwAttrIter::GetAttr(): replace with call to GetTxtAttrForCharAt(). SwTxtFormatter::NewExtraPortion(): handle meta-field prefix. SwTxtFormatter: new member m_nHintEndIndex. SwTxtFormatter::WhichFirstPortion(): call TryNewNoLengthPortion(). SwTxtFormatter::TryNewNoLengthPortion(): new; handle suffix of meta-field. SwTxtFormatter::UnderFlow(): UGLY HACK: decrement m_nHintEndIndex. SwFldPortion: add flag m_bNoLength: portion has zero length (for suffix). 2009-08-27 Michael Stahl #i91565#, #i91566#: extend text:meta(-field) uno wrapper with XText interface: unoobj.hxx: new CursorType CURSOR_META. unoobj2.cxx: refactor SwXText implementation to ensure that when the SwXText belongs to a SwXMeta, content is always inserted inside the meta(-field). unoobj.cxx: new SwXTextCursor::ForceIntoMeta(): cursor stays in meta(-field). unometa.hxx: SwXMeta implements XText, forwarding to a member SwXMetaText. DocInsertStringSplitCR(), SwX*::attachToRange(), SwX*::DeleteAndInsert(): use FORCEHINTEXPAND hack to ensure insert into the meta(-field) at the end. 2009-08-27 Michael Stahl #i91565#, #i91566#: add text:meta(-field) uno wrapper to sw: fmtmeta.hxx, fmtatr2.cxx: new class sw::MetaField, new sw::MetaFieldManager. doc.hxx, docnew.cxx: new SwDoc::GetMetaFieldManager(). unocoll.hxx,.cxx: new SW_SERVICE_FIELDTYPE_METAFIELD, SW_SERVICE_TYPE_META. unomap.hxx,.cxx: new PROPERTY_MAP_METAFIELD. unoprnms.hxx: new UNO_NAME_META. unoport.hxx: new PORTION_META; add "InContentMetadata" prop to SwXTextPortion. new unometa.hxx: new class SwXMeta and SwXMetaField. unofield.cxx: SwXFieldEnumeration: include meta-fields. unoportenum.cxx: handle RES_TXTATR_META(FIELD) by using a portion list stack. unotext.cxx: SwXText::insertTextContent(): handle meta(-field) as attribute. 2009-08-27 Michael Stahl #i91565#, #i91566#: ndhints.cxx: remove sort number from SwTxtAttrNesting 2009-08-27 Michael Stahl #i91565#, #i91566#: add support for hints with end and CH_TXTATR to sw core: doc.hxx, docedt.cxx: replace SwDoc::Delete(), DeleteAndJoin(), ReplaceRange() with wrappers that split at left-overlapped end+CH_TXTATR hints. txatbase.hxx: new member SwTxtAttr::m_bHasDummyChar. ndtxt.hxx: rename SwTxtNode::GetTxtAttr() to GetTxtAttrForCharAt(). ndtxt.cxx: SwTxtNode::CopyText(): copy end+CH_TXTATR hints iff copy CH_TXTATR. txtatr2.cxx, thints.cxx: SwTxtMeta gets a CH_TXTATR. 2009-08-27 Michael Stahl #i91565#, #i91566#: add text:meta(-field) to sw core: txatbase.hxx: new member SwTxtAttr::m_bNesting. hintids.hxx: new ids RES_TXTATR_META, RES_TXTATR_METAFIELD. txtatr.hxx: new base class SwTxtAttrNesting. new hint SwTxtMeta. SwTxtRuby derives from SwTxtAttrNesting. txtinet.hxx: SwTxtINetFmt derives from SwTxtAttrNesting. new header fmtmeta.hxx: new pool item SwFmtMeta. new class sw::Meta. ndhints.hxx, thints.cxx: new method SwpHints::TryInsertNesting(). thints.cxx: refactoring: BuildPortions() no longer handles Ruby/Hyperlink, but TryInsertNesting(), which also handles meta(-field). SwTxtNode::InsertItem(): check if the hint is actually inserted. ndhints.cxx: sort nesting hints based on sort number. ndtxt.cxx: lcl_CopyHint(): handle copy of meta/meta-field. 2009-08-27 Michael Stahl enable expanding hints with m_bLockExpandFlag set: add new InsertFlag: INS_FORCEHINTEXPAND. add new SetAttrMode: SETATTR_FORCEHINTEXPAND. rename SwEditShell::Insert() to Insert2() because changed signature fails to compile when SwWrtShell tries to overwrite these non-virtual members... SwWrtShell::Insert() sets FOCEHINTEXPAND if range was selected/deleted. adapt SwUndoInsert to store flags. 2009-08-27 Michael Stahl change formal parameters of item insertion methods to type SetAttrMode 2009-08-27 Michael Stahl fix incorrect resetting of text attributes in SwUndoInsSection, SwUndoInserts 2009-08-27 Michael Stahl clean up SwTxtNode::CutImpl() and lcl_CopyHint() 2009-08-27 Michael Stahl rename SwDoc::Copy() to CopyRange(), and _Copy() to CopyImpl() 2009-08-27 Michael Stahl rename SwNodes::Move() to MoveRange(), and remove unused parameter 2009-08-27 Michael Stahl rename SwDoc::Move() to MoveRange()/MoveNodeRange() 2009-08-27 Michael Stahl rename SwDoc::Insert() to InsertString(), and remove sal_Unicode variant 2009-08-27 Michael Stahl rename SwDoc::Insert() to InsertPoolItem()/InsertItemSet()/InsertSwSection() 2009-08-27 Michael Stahl rename SwDoc::Replace() to ReplaceRange() 2009-08-27 Michael Stahl remove SwDoc::Overwrite() sal_Unicode variant 2009-08-27 Michael Stahl split up SwDoc::DeleteAndJoin(): factor out DeleteAndJoinWithRedline() 2009-08-27 Michael Stahl rename overloaded SwDoc::Delete() to DeleteRange()/DeleteTOXMark() 2009-08-27 Michael Stahl rename SwTxtNode::Copy() to CopyText() 2009-08-27 Michael Stahl rename SwTxtNode::Cut() to CutText(), and _Cut() to CutImpl() 2009-08-27 Michael Stahl rename SwTxtNode::Delete() to DeleteAttribute()/DeleteAttributes() 2009-08-27 Michael Stahl rename SwTxtNode::Replace() to ReplaceText(), and remove the xub_Unicode variant 2009-08-27 Michael Stahl rename SwTxtNode::Erase() to EraseText() 2009-08-27 Michael Stahl rename SwTxtNode::Insert() to InsertText(), and remove the xub_Unicode variant 2009-08-27 Michael Stahl clean up SwTxtNode::Update() 2009-08-27 Michael Stahl remove SwTxtAttr::RemoveFromPool() and make destructor non-public, to be invoked by new method SwTxtAttr::Destroy() 2009-08-27 Michael Stahl ensure that SwDoc::Insert() for item (set) returns success indicator: replace SwRegHistory constructor with method InsertItems(), returning bool. refactor InsAttr() so that it checks if InsertItems() succeeds. 2009-08-27 Michael Stahl move SwXTextPortionEnumeration from unoobj.hxx to unoport.hxx 2009-08-27 Michael Stahl add missing SolarMutex in SwXTextPortion methods 2009-08-27 Michael Stahl SwXTextPortion: new member m_xTextField (so the TextField property need not be returned indirectly via SwUnoCursorHelper). factor out function CreateSwXTextField(). 2009-08-27 Michael Stahl SwXTextPortion: remove PORTION_CONTROL_CHAR and implementation of XTextField 2009-08-27 Michael Stahl remove obsolete hint SwTxtHardBlank and formats SwFmtHardBlank/SwFmtSoftHyph 2009-08-27 Michael Stahl clean up SwTxtAttr and friends: remove many accessor methods for obsolete (due to autofmt) char format items. remove unused flag SwTxtAttr::m_bDontMergeAttr. MakeRedlineTxtAttr() now dedicated function, no longer calls MakeTxtAttr(). 2009-08-27 Michael Stahl remove obsolete attribute SwTxt2Lines 2009-08-27 Michael Stahl SwXTextPortionEnumeration: finish refactoring CreatePortions change ExportHints so it always returns a text portion for hint w/ CH_TXTATR. remove special case for handling end of paragraph. unfortunately had to refactor the fieldmarks export as well (got in the way). 2009-08-27 Michael Stahl SwXTextPortionEnumeration: refactor CreatePortions: frames export extract function ExportFrames() from CreatePortions(). remove (un)dead code that calls evil MovePara(fnParaCurr, fnParaEnd) 2009-08-27 Michael Stahl clean up SwXParaFrameEnumeration 2009-08-27 Michael Stahl CollectFrameAtNode: replace SwDependArr with STL based FrameDependList_t 2009-08-27 Michael Stahl SwXTextPortionEnumeration: tweak refmark/toxmark export so ExportHints returns the portion for point marks 2009-08-27 Michael Stahl clean up SwXTextPortionEnumeration: prefix members, remove casts, replace SvWeirdArray with STL, etc. make CreatePortions() method a function, and remove lots of members. extract fieldmarks function from CreatePortions. 2009-08-27 Michael Stahl remove FOREACHUNOPAM_START/END macros 2009-08-27 Michael Stahl clean up SwXTextPortion: prefix members, remove casts, etc. remove SwXRubyPortion: replace it with another SwXTextPortion constructor 2009-08-27 Michael Stahl #i102541# SwXReferenceMark::InsertRefMark(): use flag SETATTR_DONTEXPAND 2009-08-27 Michael Stahl rename SwTxtNode::Insert to SwTxtNode::InsertHint, and fix constness in SwTxtNode::InsertItem 2009-08-27 Michael Stahl turn SwTxtNode::MakeTxtAttr() methods into global functions in ndhints.hxx 2009-08-27 Michael Stahl remove obsolete sw/inc/bookmrk.hxx 2009-08-27 Michael Stahl pam.cxx: fix ComparePosition functions (returned wrong result in one case) 2009-08-27 Michael Stahl #i103613# only import RDF metadata on normal open of a document 2009-09-11 kz CWS-TOOLING: integrate CWS impress176 2009-09-08 20:18:24 +0200 sj r275957 : fixed warning (shadowed variable) 2009-09-08 18:02:05 +0200 cl r275948 : #i104315# added missing tab pages 2009-09-08 17:35:18 +0200 cl r275947 : #i104866# fixed angle import 2009-09-08 17:32:53 +0200 cl r275946 : #i104841# fixed angle import 2009-09-08 17:01:25 +0200 cl r275943 : #i103935# fixed the SID_EVENTCONFIG mess 2009-09-08 14:32:57 +0200 sj r275928 : #i104685# only comments 2009-09-07 12:37:36 +0200 sj r275886 : #i104683# fixed import of bold/italic attributes for normal text shapes 2009-09-04 15:07:46 +0200 sj r275808 : #104689# fixed bullet color problem 2009-09-03 15:25:07 +0200 sj r275753 : #160200# added vertical alignment of table cells 2009-09-11 kz CWS-TOOLING: integrate CWS dv14 2009-09-10 15:16:32 +0200 sg r276035 : #160513# updated wfs scheme to accept ports 2009-09-10 07:41:47 +0200 dv r276019 : #i104942# Better renaming algorithmen 2009-08-31 13:41:11 +0200 dv r275604 : #160505# Setting APP1PRODUCTNAME must not overwrite APP1PRODUCTDEF 2009-09-11 kz CWS-TOOLING: integrate CWS jl131 2009-09-02 16:42:40 +0200 jl r275720 : #i97896# 2009-08-31 13:01:53 +0200 jl r275599 : CWS-TOOLING: rebase CWS jl131 to trunk@275331 (milestone: DEV300:m56) 2009-07-31 14:35:30 +0200 jl r274531 : CWS-TOOLING: rebase CWS jl131 to trunk@274203 (milestone: DEV300:m53) 2009-07-23 14:20:32 +0200 jl r274272 : #i79839# better error text when trying to modify shared layer without having write permission, eg. unopkg add --shared, unopkg remove --shared, unopkg reinstall --shared 2009-07-22 16:38:02 +0200 jl r274252 : #i97896# localize error message for lock file 2009-07-22 16:37:22 +0200 jl r274251 : #i80462# unprecise wording in updatedialog 2009-07-22 16:36:06 +0200 jl r274250 : #i97896# localize error message for lock file 2009-07-22 16:35:20 +0200 jl r274249 : #i97896# localize error message for lock file 2009-07-22 15:07:30 +0200 jl r274242 : #i98873# minimum java version is 1.5 since OOo 3.0 2009-09-11 kz CWS-TOOLING: integrate CWS changehc 2009-08-31 19:38:50 +0200 pl r275633 : remove dbug printf 2009-08-31 17:41:50 +0200 pl r275623 : CWS-TOOLING: rebase CWS changehc to trunk@275331 (milestone: DEV300:m56) 2009-07-15 19:45:46 +0200 pl r274028 : #i35482# use HC flag to decide high contrast mode 2009-07-15 17:40:52 +0200 pl r274020 : #i35482# use HC flag to decide high contrast mode 2009-07-15 17:39:50 +0200 pl r274019 : #i35482# update autohc correctly in MergeSystemSettings 2009-07-15 17:38:57 +0200 pl r274018 : #i35482# update autohc correctly in MergeSystemSettings 2009-09-11 kz CWS-TOOLING: integrate CWS notes10 2009-08-24 07:25:57 +0200 mod r275287 : 2009-07-26 02:38:32 +0200 mod r274343 : #i#i103645# 2009-07-26 02:01:53 +0200 mod r274342 : #i103645# 2009-07-26 01:52:42 +0200 mod r274341 : #i103490# 2009-07-22 08:31:48 +0200 mod r274215 : #i103373# 2009-07-15 00:55:11 +0200 mod r273987 : #i101419# 2009-07-14 07:07:55 +0200 mod r273956 : #i101419# 2009-07-14 07:07:43 +0200 mod r273955 : #i101419# 2009-07-14 07:02:10 +0200 mod r273954 : changes from notes9 2009-07-14 06:14:25 +0200 mod r273953 : #i103476# 2009-09-11 kz CWS-TOOLING: integrate CWS ab70 2009-09-10 15:12:54 +0200 jsk r276034 : #i85434# - mandatory automatic update test 2009-09-10 15:11:06 +0200 jsk r276033 : #i85434# - mandatory automatic update test 2009-09-02 09:49:24 +0200 ab r275698 : #i85434# Dialog Import 2009-09-11 kz CWS-TOOLING: integrate CWS hb32bugs02 2009-09-02 Henning Brinkmann #i102420# revert changes 2009-08-26 Henning Brinkmann merged DEV300_m56 2009-08-19 Henning Brinkmann merged DEV300_m55 2009-08-14 Henning Brinkmann merged changes from wntmsci12 2009-08-12 Henning Brinkmann Implemented NoSpaceEdit constructor and destructor in .cxx to allow compile with debug on wntmsci12. 2009-08-12 Henning Brinkmann Added some SW_DLLPUBLIC to make compilable on wntmsci12. 2009-08-11 Henning Brinkmann #i102420# dbg_out: surround output for SwNodes with <nodes-array>. 2009-08-10 Henning Brinkmann #i102420# rewritten debug output for SwNodes. 2009-08-07 Henning Brinkmann #i102420# debug _MoveNodes: output the destination, too. Break after two iterations. 2009-08-07 Henning Brinkmann #i102420# _MoveNodes: Additionally check if destination index is inside source => false Check if current range was already handled => loop Debug output current range 2009-08-06 Henning Brinkmann merged DEV300_m54 2009-08-06 Henning Brinkmann added master fix 2009-08-06 Henning Brinkmann debug output for SwNodeRange 2009-08-04 Henning Brinkmann #i102844# robustness: check for NULL pointer to prevent crash 2009-08-03 Henning Brinkmann #i103475# applied patch and verified 2009-08-03 Henning Brinkmann Removed code preventing build of sw with DEBUG. 2009-09-11 convert-repo update tags 2009-09-10 kz CWS-TOOLING: integrate CWS os2port06dev300 2009-09-05 22:49:00 +0200 ydario r275858 : #i99588# applied os2port06 diff to DEV300 tree. 2009-09-10 kz CWS-TOOLING: integrate CWS mingwport23 2009-08-29 07:07:53 +0200 tono r275555 : i#104522: mingw port graphite 2009-08-29 07:07:26 +0200 tono r275554 : i#104522: mingw port printf format fix 2009-09-10 kz CWS-TOOLING: integrate CWS mh232 2009-08-26 03:52:57 +0200 mh r275385 : #i102182# FreeBSD patch 2009-08-26 03:43:20 +0200 mh r275384 : #i101333# patch for FreeBSD 2009-08-26 03:11:20 +0200 mh r275383 : #i39230 2009-08-26 03:07:51 +0200 mh r275382 : #i39230# more space for initials field 2009-08-26 02:41:19 +0200 mh r275380 : #i39230# use vos::osecurity for reading the user name 2009-08-18 22:06:00 +0200 mh r275130 : #i104243#, line ending problem with newer perl 2009-08-18 21:53:21 +0200 mh r275129 : #i39230# read initials via getpwnam 2009-08-18 21:34:05 +0200 mh r275128 : enable CAIROCANVAS for Linux and Mac, #i88613# 2009-08-17 18:02:59 +0200 mh r275067 : #i95498# make compile with gcc3 2009-09-10 kz CWS-TOOLING: integrate CWS tkr24 2009-09-07 14:31:06 +0200 is r275898 : #160081# adding NO_LICENSE_INTO_COPYRIGHT 2009-09-10 releng #i10000# change KeyMapping to SingletonRef<framework::KeyMapping> 2009-09-11 convert-repo update tags 2009-09-10 kz CWS-TOOLING: integrate CWS os2port06dev300 2009-09-05 22:49:00 +0200 ydario r275858 : #i99588# applied os2port06 diff to DEV300 tree. 2009-09-10 kz CWS-TOOLING: integrate CWS mingwport23 2009-08-29 07:07:53 +0200 tono r275555 : i#104522: mingw port graphite 2009-08-29 07:07:26 +0200 tono r275554 : i#104522: mingw port printf format fix 2009-09-10 kz CWS-TOOLING: integrate CWS mh232 2009-08-26 03:52:57 +0200 mh r275385 : #i102182# FreeBSD patch 2009-08-26 03:43:20 +0200 mh r275384 : #i101333# patch for FreeBSD 2009-08-26 03:11:20 +0200 mh r275383 : #i39230 2009-08-26 03:07:51 +0200 mh r275382 : #i39230# more space for initials field 2009-08-26 02:41:19 +0200 mh r275380 : #i39230# use vos::osecurity for reading the user name 2009-08-18 22:06:00 +0200 mh r275130 : #i104243#, line ending problem with newer perl 2009-08-18 21:53:21 +0200 mh r275129 : #i39230# read initials via getpwnam 2009-08-18 21:34:05 +0200 mh r275128 : enable CAIROCANVAS for Linux and Mac, #i88613# 2009-08-17 18:02:59 +0200 mh r275067 : #i95498# make compile with gcc3 2009-09-10 kz CWS-TOOLING: integrate CWS tkr24 2009-09-07 14:31:06 +0200 is r275898 : #160081# adding NO_LICENSE_INTO_COPYRIGHT 2009-09-10 releng #i10000# change KeyMapping to SingletonRef<framework::KeyMapping>
1435 lines
48 KiB
C++
1435 lines
48 KiB
C++
/*************************************************************************
|
|
*
|
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
|
*
|
|
* Copyright 2008 by Sun Microsystems, Inc.
|
|
*
|
|
* OpenOffice.org - a multi-platform office productivity suite
|
|
*
|
|
* $RCSfile: docnew.cxx,v $
|
|
* $Revision: 1.89 $
|
|
*
|
|
* This file is part of OpenOffice.org.
|
|
*
|
|
* OpenOffice.org is free software: you can redistribute it and/or modify
|
|
* it under the terms of the GNU Lesser General Public License version 3
|
|
* only, as published by the Free Software Foundation.
|
|
*
|
|
* OpenOffice.org is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU Lesser General Public License version 3 for more details
|
|
* (a copy is included in the LICENSE file that accompanied this code).
|
|
*
|
|
* You should have received a copy of the GNU Lesser General Public License
|
|
* version 3 along with OpenOffice.org. If not, see
|
|
* <http://www.openoffice.org/license.html>
|
|
* for a copy of the LGPLv3 License.
|
|
*
|
|
************************************************************************/
|
|
|
|
// MARKER(update_precomp.py): autogen include statement, do not remove
|
|
#include "precompiled_sw.hxx"
|
|
#define ROLBCK_HISTORY_ONLY // Der Kampf gegen die CLOOK's
|
|
#include <doc.hxx>
|
|
#include <dcontact.hxx>
|
|
#include <com/sun/star/document/PrinterIndependentLayout.hpp>
|
|
#include <com/sun/star/document/UpdateDocMode.hpp>
|
|
#include <com/sun/star/text/XTextDocument.hpp>
|
|
#include <com/sun/star/linguistic2/XProofreadingIterator.hpp>
|
|
#include <com/sun/star/text/XFlatParagraphIteratorProvider.hpp>
|
|
|
|
#include <unotools/processfactory.hxx>
|
|
#include <vcl/svapp.hxx>
|
|
#include <vcl/virdev.hxx>
|
|
#include <rtl/logfile.hxx>
|
|
#include <sfx2/printer.hxx>
|
|
#include <sfx2/docfile.hxx>
|
|
#include <sfx2/frame.hxx>
|
|
|
|
#include <svtools/macitem.hxx>
|
|
#include <svx/svxids.hrc>
|
|
#include <svx/svdogrp.hxx>
|
|
#include <svx/linkmgr.hxx>
|
|
#include <svx/forbiddencharacterstable.hxx>
|
|
#include <svtools/zforlist.hxx>
|
|
#include <svtools/compatibility.hxx>
|
|
#include <svtools/lingucfg.hxx>
|
|
#include <svx/svdpage.hxx>
|
|
#include <paratr.hxx>
|
|
#include <fchrfmt.hxx>
|
|
#include <fmtcntnt.hxx>
|
|
#include <fmtanchr.hxx>
|
|
#include <fmtfsize.hxx>
|
|
#include <fmtfordr.hxx>
|
|
#include <fmtpdsc.hxx>
|
|
#include <pvprtdat.hxx>
|
|
#include <rootfrm.hxx> //Damit der RootDtor gerufen wird.
|
|
#include <layouter.hxx>
|
|
#include <pagedesc.hxx> //Damit die PageDescs zerstoert werden koennen.
|
|
#include <ndtxt.hxx>
|
|
#include <printdata.hxx>
|
|
#include <docfld.hxx>
|
|
#include <ftninfo.hxx>
|
|
#include <ftnidx.hxx>
|
|
#include <docstat.hxx>
|
|
#include <charfmt.hxx>
|
|
#include <frmfmt.hxx>
|
|
#include <rolbck.hxx> // Undo-Attr, SwHistory
|
|
#include <poolfmt.hxx> // fuer die Pool-Vorlage
|
|
#include <dbmgr.hxx>
|
|
#include <docsh.hxx>
|
|
#include <acorrect.hxx> // fuer die autom. Aufnahme von Ausnahmen
|
|
#include <visiturl.hxx> // fuer die URL-Change Benachrichtigung
|
|
#include <docary.hxx>
|
|
#include <lineinfo.hxx>
|
|
#include <drawdoc.hxx>
|
|
#include <linkenum.hxx>
|
|
#include <fldupde.hxx>
|
|
#include <extinput.hxx>
|
|
#include <viewsh.hxx>
|
|
#include <doctxm.hxx>
|
|
#include <shellres.hxx>
|
|
#include <unoclbck.hxx>
|
|
#include <breakit.hxx>
|
|
#include <laycache.hxx>
|
|
#include <mvsave.hxx>
|
|
#include <istyleaccess.hxx>
|
|
#include <swstylemanager.hxx>
|
|
#include <IGrammarContact.hxx>
|
|
#include <tblsel.hxx>
|
|
#include <MarkManager.hxx>
|
|
#include <unochart.hxx>
|
|
|
|
#include <cmdid.h> // fuer den dflt - Printer in SetJob
|
|
|
|
|
|
// --> OD 2006-04-19 #b6375613#
|
|
#include <com/sun/star/document/XDocumentInfoSupplier.hpp>
|
|
#include <com/sun/star/beans/XPropertyContainer.hpp>
|
|
#include <com/sun/star/beans/PropertyAttribute.hpp>
|
|
|
|
// <--
|
|
|
|
// --> OD 2007-03-16 #i73788#
|
|
#include <pausethreadstarting.hxx>
|
|
// <--
|
|
#include <numrule.hxx>
|
|
// --> OD 2008-03-13 #refactorlists#
|
|
#include <list.hxx>
|
|
#include <listfunc.hxx>
|
|
// <--
|
|
|
|
#include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
|
|
|
|
#include <sfx2/Metadatable.hxx>
|
|
#include <fmtmeta.hxx> // MetaFieldManager
|
|
|
|
|
|
using namespace ::com::sun::star;
|
|
using namespace ::com::sun::star::document;
|
|
|
|
const sal_Char __FAR_DATA sFrmFmtStr[] = "Frameformat";
|
|
const sal_Char __FAR_DATA sEmptyPageStr[] = "Empty Page";
|
|
const sal_Char __FAR_DATA sColumnCntStr[] = "Columncontainer";
|
|
const sal_Char __FAR_DATA sCharFmtStr[] = "Zeichenformat";
|
|
const sal_Char __FAR_DATA sTxtCollStr[] = "Textformatvorlage";
|
|
const sal_Char __FAR_DATA sGrfCollStr[] = "Graphikformatvorlage";
|
|
|
|
SV_IMPL_PTRARR( SwNumRuleTbl, SwNumRulePtr)
|
|
SV_IMPL_PTRARR( SwTxtFmtColls, SwTxtFmtCollPtr)
|
|
SV_IMPL_PTRARR( SwGrfFmtColls, SwGrfFmtCollPtr)
|
|
|
|
/*
|
|
* global functions...
|
|
*/
|
|
|
|
uno::Reference< linguistic2::XProofreadingIterator > SwDoc::GetGCIterator() const
|
|
{
|
|
if (!m_xGCIterator.is() && SvtLinguConfig().HasGrammarChecker())
|
|
{
|
|
uno::Reference< lang::XMultiServiceFactory > xMgr( utl::getProcessServiceFactory() );
|
|
if (xMgr.is())
|
|
{
|
|
try
|
|
{
|
|
rtl::OUString aServiceName( rtl::OUString::createFromAscii("com.sun.star.linguistic2.ProofreadingIterator") );
|
|
m_xGCIterator = uno::Reference< linguistic2::XProofreadingIterator >
|
|
( xMgr->createInstance( aServiceName ), uno::UNO_QUERY_THROW );
|
|
}
|
|
catch (uno::Exception &)
|
|
{
|
|
DBG_ERROR( "No GCIterator" );
|
|
}
|
|
}
|
|
}
|
|
|
|
return m_xGCIterator;
|
|
}
|
|
|
|
void StartGrammarChecking( SwDoc &rDoc )
|
|
{
|
|
uno::Reference< linguistic2::XProofreadingIterator > xGCIterator( rDoc.GetGCIterator() );
|
|
if ( xGCIterator.is() )
|
|
{
|
|
uno::Reference< lang::XComponent > xDoc( rDoc.GetDocShell()->GetBaseModel(), uno::UNO_QUERY );
|
|
uno::Reference< text::XFlatParagraphIteratorProvider > xFPIP( xDoc, uno::UNO_QUERY );
|
|
|
|
// start automatic background checking if not active already
|
|
if ( xFPIP.is() && !xGCIterator->isProofreading( xDoc ) )
|
|
xGCIterator->startProofreading( xDoc, xFPIP );
|
|
}
|
|
}
|
|
|
|
/*
|
|
* interne Funktionen
|
|
*/
|
|
|
|
|
|
|
|
BOOL lcl_DelFmtIndizes( const SwFrmFmtPtr& rpFmt, void* )
|
|
{
|
|
SwFmtCntnt &rFmtCntnt = (SwFmtCntnt&)rpFmt->GetCntnt();
|
|
if ( rFmtCntnt.GetCntntIdx() )
|
|
rFmtCntnt.SetNewCntntIdx( 0 );
|
|
SwFmtAnchor &rFmtAnchor = (SwFmtAnchor&)rpFmt->GetAnchor();
|
|
if ( rFmtAnchor.GetCntntAnchor() )
|
|
rFmtAnchor.SetAnchor( 0 );
|
|
return TRUE;
|
|
}
|
|
|
|
/*
|
|
* exportierte Methoden
|
|
*/
|
|
|
|
SwDoc::SwDoc() :
|
|
aNodes( this ),
|
|
aUndoNodes( this ),
|
|
mpAttrPool(new SwAttrPool(this)),
|
|
pMarkManager(new ::sw::mark::MarkManager(*this)),
|
|
m_pMetaFieldManager(new ::sw::MetaFieldManager()),
|
|
pDfltFrmFmt( new SwFrmFmt( GetAttrPool(), sFrmFmtStr, 0 ) ),
|
|
pEmptyPageFmt( new SwFrmFmt( GetAttrPool(), sEmptyPageStr, pDfltFrmFmt ) ),
|
|
pColumnContFmt( new SwFrmFmt( GetAttrPool(), sColumnCntStr, pDfltFrmFmt ) ),
|
|
pDfltCharFmt( new SwCharFmt( GetAttrPool(), sCharFmtStr, 0 ) ),
|
|
pDfltTxtFmtColl( new SwTxtFmtColl( GetAttrPool(), sTxtCollStr ) ),
|
|
pDfltGrfFmtColl( new SwGrfFmtColl( GetAttrPool(), sGrfCollStr ) ),
|
|
pFrmFmtTbl( new SwFrmFmts() ),
|
|
pCharFmtTbl( new SwCharFmts() ),
|
|
pSpzFrmFmtTbl( new SwSpzFrmFmts() ),
|
|
pSectionFmtTbl( new SwSectionFmts() ),
|
|
pTblFrmFmtTbl( new SwFrmFmts() ),
|
|
pTxtFmtCollTbl( new SwTxtFmtColls() ),
|
|
pGrfFmtCollTbl( new SwGrfFmtColls() ),
|
|
pTOXTypes( new SwTOXTypes() ),
|
|
pDefTOXBases( new SwDefTOXBase_Impl() ),
|
|
pLayout( 0 ), // Rootframe des spezifischen Layouts.
|
|
pDrawModel( 0 ),
|
|
pUndos( new SwUndos( 0, 20 ) ),
|
|
pUpdtFlds( new SwDocUpdtFld() ),
|
|
pFldTypes( new SwFldTypes() ),
|
|
pVirDev( 0 ),
|
|
pPrt( 0 ),
|
|
pPrtData( 0 ),
|
|
pGlossaryDoc( 0 ),
|
|
pOutlineRule( 0 ),
|
|
pFtnInfo( new SwFtnInfo ),
|
|
pEndNoteInfo( new SwEndNoteInfo ),
|
|
pLineNumberInfo( new SwLineNumberInfo ),
|
|
pFtnIdxs( new SwFtnIdxs ),
|
|
pDocStat( new SwDocStat ),
|
|
pDocShell( 0 ),
|
|
pDocShRef( 0 ),
|
|
pLinkMgr( new SvxLinkManager( 0 ) ),
|
|
pACEWord( 0 ),
|
|
pURLStateChgd( 0 ),
|
|
pNumberFormatter( 0 ),
|
|
pNumRuleTbl( new SwNumRuleTbl ),
|
|
// --> OD 2008-03-26 #refactorlists#
|
|
maLists(),
|
|
maListStyleLists(),
|
|
// <--
|
|
pRedlineTbl( new SwRedlineTbl ),
|
|
pAutoFmtRedlnComment( 0 ),
|
|
pUnoCrsrTbl( new SwUnoCrsrTbl( 0, 16 ) ),
|
|
pPgPViewPrtData( 0 ),
|
|
pExtInputRing( 0 ),
|
|
pLayouter( 0 ),
|
|
// --> OD 2008-03-07 #refactorlists#
|
|
pStyleAccess( 0 ),
|
|
// <--
|
|
pLayoutCache( 0 ),
|
|
pUnoCallBack(new SwUnoCallBack(0)),
|
|
mpGrammarContact( 0 ),
|
|
aChartDataProviderImplRef(),
|
|
pChartControllerHelper( 0 ),
|
|
// --> OD 2007-10-31 #i83479#
|
|
mpListItemsList( new tImplSortedNodeNumList() ),
|
|
// <--
|
|
m_pXmlIdRegistry(),
|
|
nUndoPos( 0 ),
|
|
nUndoSavePos( 0 ),
|
|
nUndoCnt( 0 ),
|
|
nUndoSttEnd( 0 ),
|
|
nAutoFmtRedlnCommentNo( 0 ),
|
|
nLinkUpdMode( GLOBALSETTING ),
|
|
eFldUpdMode( AUTOUPD_GLOBALSETTING ),
|
|
eRedlineMode((RedlineMode_t)(nsRedlineMode_t::REDLINE_SHOW_INSERT | nsRedlineMode_t::REDLINE_SHOW_DELETE)),
|
|
eChrCmprType( CHARCOMPRESS_NONE ),
|
|
mReferenceCount(0),
|
|
mIdleBlockCount(0),
|
|
nLockExpFld( 0 ),
|
|
mbReadlineChecked(false),
|
|
// --> OD 2005-02-11 #i38810#
|
|
mbLinksUpdated( sal_False ),
|
|
mbClipBoard( false ),
|
|
mbColumnSelection( false ),
|
|
// i#78591#
|
|
mbProtectForm(false),
|
|
n32DummyCompatabilityOptions1(0),
|
|
n32DummyCompatabilityOptions2(0),
|
|
mbStartIdleTimer(sal_False)
|
|
{
|
|
RTL_LOGFILE_CONTEXT_AUTHOR( aLog, "SW", "JP93722", "SwDoc::SwDoc" );
|
|
|
|
mbGlossDoc =
|
|
mbModified =
|
|
mbDtor =
|
|
mbUndo =
|
|
mbPageNums =
|
|
mbLoaded =
|
|
mbUpdateExpFld =
|
|
mbNewDoc =
|
|
mbCopyIsMove =
|
|
mbNoDrawUndoObj =
|
|
mbBrowseMode =
|
|
mbInReading =
|
|
mbInXMLImport =
|
|
mbUpdateTOX =
|
|
mbInLoadAsynchron =
|
|
mbHTMLMode =
|
|
mbInCallModified =
|
|
mbIsGlobalDoc =
|
|
mbGlblDocSaveLinks =
|
|
mbIsLabelDoc =
|
|
mbIsAutoFmtRedline =
|
|
mbOLEPrtNotifyPending =
|
|
mbAllOLENotify =
|
|
mbIsRedlineMove =
|
|
mbInsOnlyTxtGlssry =
|
|
mbContains_MSVBasic =
|
|
mbKernAsianPunctuation =
|
|
#ifndef PRODUCT
|
|
mbXMLExport =
|
|
#endif
|
|
// --> OD 2006-03-21 #b6375613#
|
|
mbApplyWorkaroundForB6375613 =
|
|
// <--
|
|
false;
|
|
|
|
mbGroupUndo =
|
|
mbNewFldLst =
|
|
mbVisibleLinks =
|
|
mbPurgeOLE =
|
|
true;
|
|
|
|
//
|
|
// COMPATIBILITY FLAGS START
|
|
//
|
|
|
|
// Note: Any non-hidden compatibility flag should obtain its default
|
|
// by asking SvtCompatibilityOptions, see below.
|
|
//
|
|
const SvtCompatibilityOptions aOptions;
|
|
mbParaSpaceMax = aOptions.IsAddSpacing();
|
|
mbParaSpaceMaxAtPages = aOptions.IsAddSpacingAtPages();
|
|
mbTabCompat = !aOptions.IsUseOurTabStops();
|
|
mbUseVirtualDevice = !aOptions.IsUsePrtDevice();
|
|
mbAddExternalLeading = !aOptions.IsNoExtLeading();
|
|
mbOldLineSpacing = aOptions.IsUseLineSpacing();
|
|
mbAddParaSpacingToTableCells = aOptions.IsAddTableSpacing();
|
|
mbUseFormerObjectPos = aOptions.IsUseObjectPositioning();
|
|
mbUseFormerTextWrapping = aOptions.IsUseOurTextWrapping();
|
|
mbConsiderWrapOnObjPos = aOptions.IsConsiderWrappingStyle();
|
|
mbAddFlyOffsets = false; // hidden
|
|
mbOldNumbering = false; // hidden
|
|
mbUseHiResolutionVirtualDevice = true; // hidden
|
|
mbIgnoreFirstLineIndentInNumbering = false; // hidden
|
|
mbDoNotJustifyLinesWithManualBreak = !aOptions.IsExpandWordSpace();
|
|
mbDoNotResetParaAttrsForNumFont = false; // hidden
|
|
mbOutlineLevelYieldsOutlineRule = false; // hidden
|
|
mbTableRowKeep = false; // hidden
|
|
mbIgnoreTabsAndBlanksForLineCalculation = false; // hidden
|
|
mbDoNotCaptureDrawObjsOnPage = false; // hidden
|
|
mbClipAsCharacterAnchoredWriterFlyFrames= false; // hidden
|
|
mbUnixForceZeroExtLeading = false; // hidden
|
|
mbOldPrinterMetrics = false; // hidden
|
|
mbTabRelativeToIndent = true; // hidden
|
|
// --> OD 2008-06-05 #i89181#
|
|
mbTabAtLeftIndentForParagraphsInList = false; // hidden
|
|
// <--
|
|
|
|
//
|
|
// COMPATIBILITY FLAGS END
|
|
//
|
|
|
|
pMacroTable = new SvxMacroTableDtor;
|
|
|
|
mpGrammarContact = ::createGrammarContact();
|
|
|
|
/*
|
|
* Defaultformate und DefaultFormatsammlungen (FmtColl)
|
|
* werden an der Position 0 in das jeweilige Array eingetragen.
|
|
* Die Formate der FmtColls sind von den Defaultformaten
|
|
* abgeleitet und stehen auch in der Liste.
|
|
*/
|
|
/* Formate */
|
|
pFrmFmtTbl->Insert(pDfltFrmFmt, 0 );
|
|
pCharFmtTbl->Insert(pDfltCharFmt, 0 );
|
|
|
|
/* FmtColls */
|
|
// TXT
|
|
pTxtFmtCollTbl->Insert(pDfltTxtFmtColl, 0 );
|
|
// GRF
|
|
pGrfFmtCollTbl->Insert(pDfltGrfFmtColl, 0 );
|
|
|
|
// PageDesc, EmptyPageFmt und ColumnFmt anlegen
|
|
if ( !aPageDescs.Count() )
|
|
GetPageDescFromPool( RES_POOLPAGE_STANDARD );
|
|
|
|
//Leere Seite Einstellen.
|
|
pEmptyPageFmt->SetFmtAttr( SwFmtFrmSize( ATT_FIX_SIZE ) );
|
|
//BodyFmt fuer Spalten Einstellen.
|
|
pColumnContFmt->SetFmtAttr( SwFmtFillOrder( ATT_LEFT_TO_RIGHT ) );
|
|
|
|
_InitFieldTypes();
|
|
|
|
// lege (fuer die Filter) eine Default-OutlineNumRule an
|
|
// --> OD 2008-02-11 #newlistlevelattrs#
|
|
pOutlineRule = new SwNumRule( String::CreateFromAscii( SwNumRule::GetOutlineRuleName() ),
|
|
// --> OD 2008-06-06 #i89178#
|
|
numfunc::GetDefaultPositionAndSpaceMode(),
|
|
// <--
|
|
OUTLINE_RULE );
|
|
// <--
|
|
// #115901#
|
|
AddNumRule(pOutlineRule);
|
|
// --> OD 2005-10-21 - counting of phantoms depends on <IsOldNumbering()>
|
|
pOutlineRule->SetCountPhantoms( !get(IDocumentSettingAccess::OLD_NUMBERING) );
|
|
// <--
|
|
|
|
new SwTxtNode( SwNodeIndex( aUndoNodes.GetEndOfContent() ), pDfltTxtFmtColl );
|
|
new SwTxtNode( SwNodeIndex( aNodes.GetEndOfContent() ),
|
|
GetTxtCollFromPool( RES_POOLCOLL_STANDARD ));
|
|
|
|
// den eigenen IdleTimer setzen
|
|
aIdleTimer.SetTimeout( 600 );
|
|
aIdleTimer.SetTimeoutHdl( LINK(this, SwDoc, DoIdleJobs) );
|
|
|
|
aOLEModifiedTimer.SetTimeout( 1000 );
|
|
aOLEModifiedTimer.SetTimeoutHdl( LINK( this, SwDoc, DoUpdateModifiedOLE ));
|
|
|
|
// DBMgr anlegen
|
|
pNewDBMgr = new SwNewDBMgr;
|
|
|
|
// create TOXTypes
|
|
InitTOXTypes();
|
|
|
|
// --> OD 2008-03-07 #refactorlists#
|
|
// pass empty item set containing the paragraph's list attributes
|
|
// as ignorable items to the stype manager.
|
|
{
|
|
SfxItemSet aIgnorableParagraphItems( GetAttrPool(),
|
|
RES_PARATR_LIST_BEGIN, RES_PARATR_LIST_END-1,
|
|
0 );
|
|
pStyleAccess = createStyleManager( &aIgnorableParagraphItems );
|
|
}
|
|
// <--
|
|
|
|
ResetModified();
|
|
}
|
|
|
|
/*
|
|
* Besonderheiten: an der Position 0 des Arrays der Formate und
|
|
* der GDI-Objekte befindet sich ein Member der Klasse SwDoc.
|
|
* Dieser darf also keinesfalls durch delete geloescht
|
|
* werden!!!!!!!!!!
|
|
*/
|
|
|
|
|
|
SwDoc::~SwDoc()
|
|
{
|
|
// --> OD 2007-03-16 #i73788#
|
|
SwPauseThreadStarting aPauseThreadStarting;
|
|
// <--
|
|
|
|
// --> OD 2007-11-01 #i83479#
|
|
delete mpListItemsList;
|
|
mpListItemsList = 0;
|
|
// <--
|
|
|
|
// clean up chart related structures...
|
|
// Note: the chart data provider gets already diposed in ~SwDocShell
|
|
// since all UNO API related functionality requires an existing SwDocShell
|
|
// this assures that dipose gets called if there is need for it.
|
|
aChartDataProviderImplRef.reset();
|
|
delete pChartControllerHelper;
|
|
|
|
delete mpGrammarContact;
|
|
mpGrammarContact = 0;
|
|
|
|
//!! needs to be done to destroy a possible SwFmtDrop format that may
|
|
//!! be connected to a char format which may not otherwise be removed
|
|
//!! and thus would leave a unremoved SwFmt object. (TL)
|
|
//!! (this is case is not possible via UI but via API...)
|
|
SwFmtDrop aDrop;
|
|
SetDefault(aDrop);
|
|
//!! same for SwFmtCharFmt
|
|
SwFmtCharFmt aCharFmt(NULL);
|
|
SetDefault(aCharFmt);
|
|
|
|
StopIdling(); // stop idle timer
|
|
|
|
delete pUnoCallBack, pUnoCallBack = 0;
|
|
delete pURLStateChgd;
|
|
|
|
delete pLayouter;
|
|
// --> OD 2005-09-05 #125370#
|
|
pLayouter = 0L;
|
|
// <--
|
|
|
|
// Undo-Benachrichtigung vom Draw abschalten
|
|
if( pDrawModel )
|
|
{
|
|
DrawNotifyUndoHdl();
|
|
ClrContourCache();
|
|
}
|
|
|
|
delete pPgPViewPrtData;
|
|
|
|
mbUndo = FALSE; // immer das Undo abschalten !!
|
|
// damit die Fussnotenattribute die Fussnotennodes in Frieden lassen.
|
|
mbDtor = TRUE;
|
|
|
|
DELETEZ( pLayout );
|
|
|
|
delete pRedlineTbl;
|
|
delete pUnoCrsrTbl;
|
|
delete pAutoFmtRedlnComment;
|
|
|
|
if( pUpdtFlds )
|
|
delete pUpdtFlds;
|
|
|
|
if( pACEWord )
|
|
delete pACEWord;
|
|
|
|
// die BaseLinks freigeben.
|
|
{
|
|
for( USHORT n = pLinkMgr->GetServers().Count(); n; )
|
|
pLinkMgr->GetServers()[ --n ]->Closed();
|
|
|
|
if( pLinkMgr->GetLinks().Count() )
|
|
pLinkMgr->Remove( 0, pLinkMgr->GetLinks().Count() );
|
|
}
|
|
|
|
// die KapitelNummern / Nummern muessen vor den Vorlage geloescht werden
|
|
// ansonsten wird noch staendig geupdatet !!!
|
|
aNodes.pOutlineNds->Remove( USHORT(0), aNodes.pOutlineNds->Count() );
|
|
aUndoNodes.pOutlineNds->Remove( USHORT(0), aUndoNodes.pOutlineNds->Count() );
|
|
|
|
pFtnIdxs->Remove( USHORT(0), pFtnIdxs->Count() );
|
|
|
|
pUndos->DeleteAndDestroy( 0, pUndos->Count() ); //Es koennen in den Attributen noch
|
|
//noch indizes angemeldet sein.
|
|
|
|
// in den BookMarks sind Indizies auf den Content. Diese muessen vorm
|
|
// loesche der Nodes geloescht werden.
|
|
pMarkManager->clearAllMarks();
|
|
DELETEZ( pMacroTable );
|
|
|
|
if( pExtInputRing )
|
|
{
|
|
Ring* pTmp = pExtInputRing;
|
|
pExtInputRing = 0;
|
|
while( pTmp->GetNext() != pTmp )
|
|
delete pTmp->GetNext();
|
|
delete pTmp;
|
|
}
|
|
|
|
//JP: alt - loeschen ohne Flag ist teuer; Modify wird verschickt!
|
|
// aTOXTypes.DeleteAndDestroy( 0, aTOXTypes.Count() );
|
|
{
|
|
for( USHORT n = pTOXTypes->Count(); n; )
|
|
{
|
|
(*pTOXTypes)[ --n ]->SetInDocDTOR();
|
|
delete (*pTOXTypes)[ n ];
|
|
}
|
|
pTOXTypes->Remove( 0, pTOXTypes->Count() );
|
|
}
|
|
delete pDefTOXBases;
|
|
|
|
//Im einen oder anderen FrmFormat koennen noch Indizes angemeldet sein,
|
|
//Diese muessen spaetestens jetzt zerstoert werden.
|
|
pFrmFmtTbl->ForEach( &lcl_DelFmtIndizes, this );
|
|
pSpzFrmFmtTbl->ForEach( &lcl_DelFmtIndizes, this );
|
|
((SwFrmFmts&)*pSectionFmtTbl).ForEach( &lcl_DelFmtIndizes, this );
|
|
|
|
//Die Formate, die hier hinter stehen sind von den DefaultFormaten
|
|
//abhaengig. Erst nach dem Loeschen der FmtIndizes weil der Inhalt von
|
|
//Kopf-/Fussbereichen geloescht wird. Wenn dort noch Indizes von Flys
|
|
//angemeldet sind gibts was an die Ohren.
|
|
aPageDescs.DeleteAndDestroy( 0, aPageDescs.Count() );
|
|
|
|
// Inhaltssections loeschen
|
|
// nicht erst durch den SwNodes-DTOR, damit Formate
|
|
// keine Abhaengigen mehr haben.
|
|
aNodes.DelNodes( SwNodeIndex( aNodes ), aNodes.Count() );
|
|
aUndoNodes.DelNodes( SwNodeIndex( aUndoNodes ), aUndoNodes.Count() );
|
|
|
|
// Formate loeschen, spaeter mal permanent machen.
|
|
|
|
// Delete fuer Collections
|
|
// damit die Abhaengigen wech sind
|
|
SwTxtFmtColl *pFtnColl = pFtnInfo->GetFtnTxtColl();
|
|
if ( pFtnColl ) pFtnColl->Remove(pFtnInfo);
|
|
pFtnColl = pEndNoteInfo->GetFtnTxtColl();
|
|
if ( pFtnColl ) pFtnColl->Remove(pEndNoteInfo);
|
|
|
|
ASSERT( pDfltTxtFmtColl == (*pTxtFmtCollTbl)[0],
|
|
"Default-Text-Collection muss immer am Anfang stehen" );
|
|
|
|
// JP 27.01.98: opt.: ausgehend davon, das Standard als 2. im Array
|
|
// steht, sollte das als letztes geloescht werden, damit
|
|
// die ganze Umhaengerei der Formate vermieden wird!
|
|
if( 2 < pTxtFmtCollTbl->Count() )
|
|
pTxtFmtCollTbl->DeleteAndDestroy( 2, pTxtFmtCollTbl->Count()-2 );
|
|
pTxtFmtCollTbl->DeleteAndDestroy( 1, pTxtFmtCollTbl->Count()-1 );
|
|
delete pTxtFmtCollTbl;
|
|
|
|
ASSERT( pDfltGrfFmtColl == (*pGrfFmtCollTbl)[0],
|
|
"Default-Grf-Collection muss immer am Anfang stehen" );
|
|
|
|
pGrfFmtCollTbl->DeleteAndDestroy( 1, pGrfFmtCollTbl->Count()-1 );
|
|
// ergibt sich automatisch - kein _DEL Array!
|
|
// pGrfFmtCollTbl->Remove( 0, n );
|
|
delete pGrfFmtCollTbl;
|
|
|
|
/*
|
|
* Defaultformate und DefaultFormatsammlungen (FmtColl)
|
|
* sind an der Position 0 der jeweiligen Arrays eingetragen.
|
|
* Damit sie nicht vom DTOR der Array's zum 2.mal geloescht werden,
|
|
* nehme sie aus dem Array.
|
|
*/
|
|
pFrmFmtTbl->Remove( 0 );
|
|
pCharFmtTbl->Remove( 0 );
|
|
|
|
// Delete fuer pPrt
|
|
DELETEZ( pPrt );
|
|
DELETEZ( pNewDBMgr );
|
|
|
|
// Alle Flys muessen vor dem Drawing Model zerstoert werden,
|
|
// da Flys noch DrawContacts enthalten koennen, wenn wegen
|
|
// eines Lesefehlers kein Layout aufgebaut wurde.
|
|
pSpzFrmFmtTbl->DeleteAndDestroy( 0, pSpzFrmFmtTbl->Count() );
|
|
|
|
//Erst jetzt das Model zerstoeren, die Zeichenobjekte - die ja auch
|
|
//im Undo herumlungern - wollen noch ihre Attribute beim Model entfernen.
|
|
//Ausserdem koennen vorher noch DrawContacts existieren.
|
|
ReleaseDrawModel();
|
|
//JP 28.01.99: DrawModel vorm LinkManager zerstoeren, da am DrawModel
|
|
// dieser immer gesetzt ist.
|
|
DELETEZ( pLinkMgr );
|
|
|
|
//Tables vor dem loeschen der Defaults leeren, sonst GPF wegen Def-Abhaengigen.
|
|
//Die Arrays sollten (wegen includes) bei Gelegenheit auch zu Pointern werden.
|
|
delete pFrmFmtTbl;
|
|
delete pSpzFrmFmtTbl;
|
|
|
|
delete pStyleAccess;
|
|
|
|
delete pCharFmtTbl;
|
|
delete pSectionFmtTbl;
|
|
delete pTblFrmFmtTbl;
|
|
delete pDfltTxtFmtColl;
|
|
delete pDfltGrfFmtColl;
|
|
delete pNumRuleTbl;
|
|
|
|
// --> OD 2008-03-26 #refactorlists#
|
|
{
|
|
for ( std::hash_map< String, SwList*, StringHash >::iterator
|
|
aListIter = maLists.begin();
|
|
aListIter != maLists.end();
|
|
++aListIter )
|
|
{
|
|
delete (*aListIter).second;
|
|
}
|
|
maLists.clear();
|
|
}
|
|
maListStyleLists.clear();
|
|
// <--
|
|
|
|
delete pPrtData;
|
|
delete pNumberFormatter;
|
|
delete pFtnInfo;
|
|
delete pEndNoteInfo;
|
|
delete pLineNumberInfo;
|
|
delete pFtnIdxs;
|
|
delete pFldTypes;
|
|
delete pTOXTypes;
|
|
delete pUndos;
|
|
delete pDocStat;
|
|
delete pEmptyPageFmt;
|
|
delete pColumnContFmt;
|
|
delete pDfltCharFmt;
|
|
delete pDfltFrmFmt;
|
|
delete pLayoutCache;
|
|
delete pVirDev;
|
|
|
|
SfxItemPool::Free(mpAttrPool);
|
|
}
|
|
|
|
//---------------------------------------------------
|
|
|
|
VirtualDevice& SwDoc::CreateVirtualDevice_() const
|
|
{
|
|
VirtualDevice* pNewVir = new VirtualDevice( 1 );
|
|
|
|
// <--
|
|
pNewVir->SetReferenceDevice( VirtualDevice::REFDEV_MODE_MSO1 );
|
|
|
|
// --> FME 2006-10-09 #i60945# External leading compatibility for unix systems.
|
|
if ( get(IDocumentSettingAccess::UNIX_FORCE_ZERO_EXT_LEADING ) )
|
|
pNewVir->Compat_ZeroExtleadBug();
|
|
// <--
|
|
|
|
MapMode aMapMode( pNewVir->GetMapMode() );
|
|
aMapMode.SetMapUnit( MAP_TWIP );
|
|
pNewVir->SetMapMode( aMapMode );
|
|
|
|
const_cast<SwDoc*>(this)->setVirtualDevice( pNewVir, true, true );
|
|
return *pVirDev;
|
|
}
|
|
|
|
//---------------------------------------------------
|
|
|
|
SfxPrinter& SwDoc::CreatePrinter_() const
|
|
{
|
|
ASSERT( ! pPrt, "Do not call CreatePrinter_(), call getPrinter() instead" )
|
|
|
|
#if OSL_DEBUG_LEVEL > 1
|
|
ASSERT( false, "Printer will be created!" )
|
|
#endif
|
|
|
|
// wir erzeugen einen default SfxPrinter.
|
|
// Das ItemSet wird vom Sfx geloescht!
|
|
SfxItemSet *pSet = new SfxItemSet( ((SwDoc*)this)->GetAttrPool(),
|
|
FN_PARAM_ADDPRINTER, FN_PARAM_ADDPRINTER,
|
|
SID_HTML_MODE, SID_HTML_MODE,
|
|
SID_PRINTER_NOTFOUND_WARN, SID_PRINTER_NOTFOUND_WARN,
|
|
SID_PRINTER_CHANGESTODOC, SID_PRINTER_CHANGESTODOC,
|
|
0 );
|
|
|
|
SfxPrinter* pNewPrt = new SfxPrinter( pSet );
|
|
const_cast<SwDoc*>(this)->setPrinter( pNewPrt, true, true );
|
|
return *pPrt;
|
|
}
|
|
//---------------------------------------------------
|
|
|
|
void SwDoc::SetDocShell( SwDocShell* pDSh )
|
|
{
|
|
if( pDocShell != pDSh )
|
|
{
|
|
pDocShell = pDSh;
|
|
|
|
pLinkMgr->SetPersist( pDocShell );
|
|
//JP 27.08.98: Bug 55570 - DocShell Pointer auch am DrawModel setzen
|
|
if( pDrawModel )
|
|
{
|
|
((SwDrawDocument*)pDrawModel)->SetObjectShell( pDocShell );
|
|
pDrawModel->SetPersist( pDocShell );
|
|
ASSERT( pDrawModel->GetPersist() == GetPersist(),
|
|
"draw model's persist is out of sync" );
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
// Convenience-Methode, um uebermaessige Includes von docsh.hxx
|
|
// zu vermeiden
|
|
|
|
|
|
|
|
uno::Reference < embed::XStorage > SwDoc::GetDocStorage()
|
|
{
|
|
if( pDocShell )
|
|
return pDocShell->GetStorage();
|
|
if( pLinkMgr->GetPersist() )
|
|
return pLinkMgr->GetPersist()->GetStorage();
|
|
return NULL;
|
|
}
|
|
|
|
|
|
|
|
SfxObjectShell* SwDoc::GetPersist() const
|
|
{
|
|
return pDocShell ? pDocShell : pLinkMgr->GetPersist();
|
|
}
|
|
|
|
|
|
void SwDoc::ClearDoc()
|
|
{
|
|
BOOL bOldUndo = mbUndo;
|
|
DelAllUndoObj();
|
|
mbUndo = FALSE; // immer das Undo abschalten !!
|
|
|
|
// Undo-Benachrichtigung vom Draw abschalten
|
|
if( pDrawModel )
|
|
{
|
|
DrawNotifyUndoHdl();
|
|
ClrContourCache();
|
|
}
|
|
|
|
// stehen noch FlyFrames rum, loesche auch diese
|
|
USHORT n;
|
|
while ( 0 != (n = GetSpzFrmFmts()->Count()) )
|
|
DelLayoutFmt((*pSpzFrmFmtTbl)[n-1]);
|
|
ASSERT( !pDrawModel || !pDrawModel->GetPage(0)->GetObjCount(),
|
|
"not all DrawObjects removed from the page" );
|
|
|
|
pRedlineTbl->DeleteAndDestroy( 0, pRedlineTbl->Count() );
|
|
|
|
if( pACEWord )
|
|
delete pACEWord;
|
|
|
|
// in den BookMarks sind Indizies auf den Content. Diese muessen vorm
|
|
// loesche der Nodes geloescht werden.
|
|
pMarkManager->clearAllMarks();
|
|
InitTOXTypes();
|
|
|
|
// create a dummy pagedesc for the layout
|
|
sal_uInt16 nDummyPgDsc = MakePageDesc( String::CreateFromAscii( "?DUMMY?" ));
|
|
SwPageDesc* pDummyPgDsc = aPageDescs[ nDummyPgDsc ];
|
|
|
|
SwNodeIndex aSttIdx( *GetNodes().GetEndOfContent().StartOfSectionNode(), 1 );
|
|
// den ersten immer wieder neu anlegen (ohne Attribute/Vorlagen/...)
|
|
SwTxtNode* pFirstNd = GetNodes().MakeTxtNode( aSttIdx, pDfltTxtFmtColl );
|
|
|
|
if( pLayout )
|
|
{
|
|
// set the layout to the dummy pagedesc
|
|
pFirstNd->SetAttr( SwFmtPageDesc( pDummyPgDsc ));
|
|
|
|
SwPosition aPos( *pFirstNd, SwIndex( pFirstNd ));
|
|
::PaMCorrAbs( aSttIdx, SwNodeIndex( GetNodes().GetEndOfContent() ),
|
|
aPos );
|
|
}
|
|
|
|
GetNodes().Delete( aSttIdx,
|
|
GetNodes().GetEndOfContent().GetIndex() - aSttIdx.GetIndex() );
|
|
|
|
// --> OD 2006-02-28 #i62440#
|
|
// destruction of numbering rules and creation of new outline rule
|
|
// *after* the document nodes are deleted.
|
|
pOutlineRule = NULL;
|
|
pNumRuleTbl->DeleteAndDestroy( 0, pNumRuleTbl->Count() );
|
|
// creation of new outline numbering rule
|
|
// --> OD 2008-02-11 #newlistlevelattrs#
|
|
pOutlineRule = new SwNumRule( String::CreateFromAscii( SwNumRule::GetOutlineRuleName() ),
|
|
// --> OD 2008-06-06 #i89178#
|
|
numfunc::GetDefaultPositionAndSpaceMode(),
|
|
// <--
|
|
OUTLINE_RULE );
|
|
// <--
|
|
AddNumRule(pOutlineRule);
|
|
// --> OD 2005-10-21 - counting of phantoms depends on <IsOldNumbering()>
|
|
pOutlineRule->SetCountPhantoms( !get(IDocumentSettingAccess::OLD_NUMBERING) );
|
|
// <--
|
|
// <--
|
|
|
|
//remove the dummy pagedec from the array and delete all the old ones
|
|
aPageDescs.Remove( nDummyPgDsc );
|
|
aPageDescs.DeleteAndDestroy( 0, aPageDescs.Count() );
|
|
|
|
// Delete fuer Collections
|
|
// damit die Abhaengigen wech sind
|
|
SwTxtFmtColl* pFtnColl = pFtnInfo->GetFtnTxtColl();
|
|
if( pFtnColl ) pFtnColl->Remove( pFtnInfo );
|
|
pFtnColl = pEndNoteInfo->GetFtnTxtColl();
|
|
if( pFtnColl ) pFtnColl->Remove( pEndNoteInfo );
|
|
|
|
// JP 27.01.98: opt.: ausgehend davon, das Standard als 2. im Array
|
|
// steht, sollte das als letztes geloescht werden, damit
|
|
// die ganze Umhaengerei der Formate vermieden wird!
|
|
if( 2 < pTxtFmtCollTbl->Count() )
|
|
pTxtFmtCollTbl->DeleteAndDestroy( 2, pTxtFmtCollTbl->Count()-2 );
|
|
pTxtFmtCollTbl->DeleteAndDestroy( 1, pTxtFmtCollTbl->Count()-1 );
|
|
pGrfFmtCollTbl->DeleteAndDestroy( 1, pGrfFmtCollTbl->Count()-1 );
|
|
pCharFmtTbl->DeleteAndDestroy( 1, pCharFmtTbl->Count()-1 );
|
|
|
|
if( pLayout )
|
|
{
|
|
// search the FrameFormat of the root frm. This is not allowed to delete
|
|
pFrmFmtTbl->Remove( pFrmFmtTbl->GetPos( pLayout->GetFmt() ) );
|
|
pFrmFmtTbl->DeleteAndDestroy( 1, pFrmFmtTbl->Count()-1 );
|
|
pFrmFmtTbl->Insert( pLayout->GetFmt(), pFrmFmtTbl->Count() );
|
|
}
|
|
else
|
|
pFrmFmtTbl->DeleteAndDestroy( 1, pFrmFmtTbl->Count()-1 );
|
|
|
|
xForbiddenCharsTable.unbind();
|
|
|
|
pFldTypes->DeleteAndDestroy( INIT_FLDTYPES,
|
|
pFldTypes->Count() - INIT_FLDTYPES );
|
|
|
|
delete pNumberFormatter, pNumberFormatter = 0;
|
|
|
|
GetPageDescFromPool( RES_POOLPAGE_STANDARD );
|
|
pFirstNd->ChgFmtColl( GetTxtCollFromPool( RES_POOLCOLL_STANDARD ));
|
|
nDummyPgDsc = aPageDescs.Count();
|
|
aPageDescs.Insert( pDummyPgDsc, nDummyPgDsc );
|
|
// set the layout back to the new standard pagedesc
|
|
pFirstNd->ResetAllAttr();
|
|
// delete now the dummy pagedesc
|
|
DelPageDesc( nDummyPgDsc );
|
|
|
|
mbUndo = bOldUndo;
|
|
}
|
|
|
|
void SwDoc::SetPreViewPrtData( const SwPagePreViewPrtData* pNew )
|
|
{
|
|
if( pNew )
|
|
{
|
|
if( pPgPViewPrtData )
|
|
*pPgPViewPrtData = *pNew;
|
|
else
|
|
pPgPViewPrtData = new SwPagePreViewPrtData( *pNew );
|
|
}
|
|
else if( pPgPViewPrtData )
|
|
DELETEZ( pPgPViewPrtData );
|
|
SetModified();
|
|
}
|
|
/* -----------------------------06.01.00 14:03--------------------------------
|
|
|
|
---------------------------------------------------------------------------*/
|
|
SwModify* SwDoc::GetUnoCallBack() const
|
|
{
|
|
return pUnoCallBack;
|
|
}
|
|
|
|
/*-----------------28.5.2001 10:06------------------
|
|
* SwDoc:
|
|
* Reading and writing of the layout cache.
|
|
*--------------------------------------------------*/
|
|
|
|
void SwDoc::ReadLayoutCache( SvStream& rStream )
|
|
{
|
|
if( !pLayoutCache )
|
|
pLayoutCache = new SwLayoutCache();
|
|
if( !pLayoutCache->IsLocked() )
|
|
{
|
|
pLayoutCache->GetLockCount() |= 0x8000;
|
|
pLayoutCache->Read( rStream );
|
|
pLayoutCache->GetLockCount() &= 0x7fff;
|
|
}
|
|
}
|
|
|
|
void SwDoc::WriteLayoutCache( SvStream& rStream )
|
|
{
|
|
pLayoutCache->Write( rStream, *this );
|
|
}
|
|
|
|
IGrammarContact* getGrammarContact( const SwTxtNode& rTxtNode )
|
|
{
|
|
const SwDoc* pDoc = rTxtNode.GetDoc();
|
|
if( !pDoc || pDoc->IsInDtor() )
|
|
return 0;
|
|
return pDoc->getGrammarContact();
|
|
}
|
|
|
|
// --> FME 2005-02-25 #i42634# Moved common code of SwReader::Read() and
|
|
// SwDocShell::UpdateLinks() to new SwDoc::UpdateLinks():
|
|
void SwDoc::UpdateLinks( BOOL bUI )
|
|
{
|
|
SfxObjectCreateMode eMode;
|
|
USHORT nLinkMode = getLinkUpdateMode( true );
|
|
USHORT nUpdateDocMode = GetDocShell()->GetUpdateDocMode();
|
|
if( GetDocShell() &&
|
|
(nLinkMode != NEVER || document::UpdateDocMode::FULL_UPDATE == nUpdateDocMode) &&
|
|
GetLinkManager().GetLinks().Count() &&
|
|
SFX_CREATE_MODE_INTERNAL !=
|
|
( eMode = GetDocShell()->GetCreateMode()) &&
|
|
SFX_CREATE_MODE_ORGANIZER != eMode &&
|
|
SFX_CREATE_MODE_PREVIEW != eMode &&
|
|
!GetDocShell()->IsPreview() )
|
|
{
|
|
ViewShell* pVSh = 0;
|
|
BOOL bAskUpdate = nLinkMode == MANUAL;
|
|
BOOL bUpdate = TRUE;
|
|
switch(nUpdateDocMode)
|
|
{
|
|
case document::UpdateDocMode::NO_UPDATE: bUpdate = FALSE;break;
|
|
case document::UpdateDocMode::QUIET_UPDATE:bAskUpdate = FALSE; break;
|
|
case document::UpdateDocMode::FULL_UPDATE: bAskUpdate = TRUE; break;
|
|
}
|
|
if( bUpdate && (bUI || !bAskUpdate) )
|
|
{
|
|
SfxMedium* pMedium = GetDocShell()->GetMedium();
|
|
SfxFrame* pFrm = pMedium ? pMedium->GetLoadTargetFrame() : 0;
|
|
Window* pDlgParent = pFrm ? &pFrm->GetWindow() : 0;
|
|
if( GetRootFrm() && !GetEditShell( &pVSh ) && !pVSh )
|
|
{
|
|
ViewShell aVSh( *this, 0, 0 );
|
|
|
|
SET_CURR_SHELL( &aVSh );
|
|
GetLinkManager().UpdateAllLinks( bAskUpdate , TRUE, FALSE, pDlgParent );
|
|
}
|
|
else
|
|
GetLinkManager().UpdateAllLinks( bAskUpdate, TRUE, FALSE, pDlgParent );
|
|
}
|
|
}
|
|
|
|
}
|
|
// <--
|
|
// --> OD 2006-04-19 #b6375613#
|
|
void SwDoc::SetApplyWorkaroundForB6375613( bool p_bApplyWorkaroundForB6375613 )
|
|
{
|
|
if ( mbApplyWorkaroundForB6375613 != p_bApplyWorkaroundForB6375613 )
|
|
{
|
|
mbApplyWorkaroundForB6375613 = p_bApplyWorkaroundForB6375613;
|
|
|
|
uno::Reference< document::XDocumentInfoSupplier > xDoc(
|
|
GetDocShell()->GetBaseModel(),
|
|
uno::UNO_QUERY);
|
|
if ( xDoc.is() )
|
|
{
|
|
uno::Reference< beans::XPropertyContainer > xDocInfo(
|
|
xDoc->getDocumentInfo(),
|
|
uno::UNO_QUERY );
|
|
if ( xDocInfo.is() )
|
|
{
|
|
try
|
|
{
|
|
if ( mbApplyWorkaroundForB6375613 )
|
|
{
|
|
xDocInfo->addProperty(
|
|
rtl::OUString::createFromAscii("WorkaroundForB6375613Applied"),
|
|
beans::PropertyAttribute::TRANSIENT | beans::PropertyAttribute::REMOVABLE,
|
|
uno::makeAny( false ) );
|
|
}
|
|
else
|
|
{
|
|
xDocInfo->removeProperty( rtl::OUString::createFromAscii("WorkaroundForB6375613Applied") );
|
|
}
|
|
}
|
|
catch( uno::Exception& )
|
|
{
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
// <--
|
|
|
|
::sfx2::IXmlIdRegistry&
|
|
SwDoc::GetXmlIdRegistry()
|
|
{
|
|
// UGLY: this relies on SetClipBoard being called before GetXmlIdRegistry!
|
|
if (!m_pXmlIdRegistry.get())
|
|
{
|
|
m_pXmlIdRegistry.reset( ::sfx2::createXmlIdRegistry( IsClipBoard() ) );
|
|
}
|
|
return *m_pXmlIdRegistry;
|
|
}
|
|
|
|
::sw::MetaFieldManager &
|
|
SwDoc::GetMetaFieldManager()
|
|
{
|
|
return *m_pMetaFieldManager;
|
|
}
|
|
|
|
void SwDoc::InitTOXTypes()
|
|
{
|
|
ShellResource* pShellRes = ViewShell::GetShellRes();
|
|
SwTOXType * pNew = new SwTOXType(TOX_CONTENT, pShellRes->aTOXContentName );
|
|
pTOXTypes->Insert( pNew, pTOXTypes->Count() );
|
|
pNew = new SwTOXType(TOX_INDEX, pShellRes->aTOXIndexName );
|
|
pTOXTypes->Insert( pNew, pTOXTypes->Count() );
|
|
pNew = new SwTOXType(TOX_USER, pShellRes->aTOXUserName );
|
|
pTOXTypes->Insert( pNew, pTOXTypes->Count() );
|
|
pNew = new SwTOXType(TOX_ILLUSTRATIONS, pShellRes->aTOXIllustrationsName );
|
|
pTOXTypes->Insert( pNew, pTOXTypes->Count() );
|
|
pNew = new SwTOXType(TOX_OBJECTS, pShellRes->aTOXObjectsName );
|
|
pTOXTypes->Insert( pNew, pTOXTypes->Count() );
|
|
pNew = new SwTOXType(TOX_TABLES, pShellRes->aTOXTablesName );
|
|
pTOXTypes->Insert( pNew, pTOXTypes->Count() );
|
|
pNew = new SwTOXType(TOX_AUTHORITIES, pShellRes->aTOXAuthoritiesName );
|
|
pTOXTypes->Insert( pNew, pTOXTypes->Count() );
|
|
}
|
|
|
|
/*-- 08.05.2009 10:07:57---------------------------------------------------
|
|
|
|
-----------------------------------------------------------------------*/
|
|
SwDoc* SwDoc::CreateCopy() const
|
|
{
|
|
SwDoc* pRet = new SwDoc;
|
|
//copy settings
|
|
/*
|
|
//aNodes( this ),
|
|
//aUndoNodes( this ),
|
|
mpAttrPool(new SwAttrPool(this)),*/
|
|
USHORT __FAR_DATA aRangeOfDefaults[] = {
|
|
RES_FRMATR_BEGIN, RES_FRMATR_END-1,
|
|
RES_CHRATR_BEGIN, RES_CHRATR_END-1,
|
|
RES_PARATR_BEGIN, RES_PARATR_END-1,
|
|
// --> OD 2008-02-25 #refactorlists##
|
|
RES_PARATR_LIST_BEGIN, RES_PARATR_LIST_END-1,
|
|
// <--
|
|
RES_UNKNOWNATR_BEGIN, RES_UNKNOWNATR_END-1,
|
|
0
|
|
};
|
|
|
|
SfxItemSet aNewDefaults( pRet->GetAttrPool(), aRangeOfDefaults );
|
|
|
|
USHORT nWhich;
|
|
USHORT nRange = 0;
|
|
while( aRangeOfDefaults[nRange] != 0)
|
|
{
|
|
for( nWhich = aRangeOfDefaults[nRange]; nWhich < aRangeOfDefaults[nRange + 1]; ++nWhich )
|
|
{
|
|
const SfxPoolItem& rSourceAttr = mpAttrPool->GetDefaultItem( nWhich );
|
|
if( rSourceAttr != pRet->mpAttrPool->GetDefaultItem( nWhich ) )
|
|
aNewDefaults.Put( rSourceAttr );
|
|
}
|
|
nRange += 2;
|
|
}
|
|
if( aNewDefaults.Count() )
|
|
pRet->SetDefault( aNewDefaults );
|
|
|
|
/*
|
|
pDfltFrmFmt( new SwFrmFmt( GetAttrPool(), sFrmFmtStr, 0 ) ),
|
|
pEmptyPageFmt( new SwFrmFmt( GetAttrPool(), sEmptyPageStr, pDfltFrmFmt ) ),
|
|
pColumnContFmt( new SwFrmFmt( GetAttrPool(), sColumnCntStr, pDfltFrmFmt ) ),
|
|
pDfltCharFmt( new SwCharFmt( GetAttrPool(), sCharFmtStr, 0 ) ),
|
|
pDfltTxtFmtColl( new SwTxtFmtColl( GetAttrPool(), sTxtCollStr ) ),
|
|
pDfltGrfFmtColl( new SwGrfFmtColl( GetAttrPool(), sGrfCollStr ) ),
|
|
pFrmFmtTbl( new SwFrmFmts() ),
|
|
pCharFmtTbl( new SwCharFmts() ),
|
|
pSpzFrmFmtTbl( new SwSpzFrmFmts() ),
|
|
pSectionFmtTbl( new SwSectionFmts() ),
|
|
pTblFrmFmtTbl( new SwFrmFmts() ),
|
|
pTxtFmtCollTbl( new SwTxtFmtColls() ),
|
|
pGrfFmtCollTbl( new SwGrfFmtColls() ),
|
|
pBookmarkTbl( new SwBookmarks( 0, 16 ) ),
|
|
pTOXTypes( new SwTOXTypes() ),
|
|
pDefTOXBases( new SwDefTOXBase_Impl() ),
|
|
pLayout( 0 ), // Rootframe des spezifischen Layouts.
|
|
pDrawModel( 0 ),
|
|
pUndos( new SwUndos( 0, 20 ) ),
|
|
pUpdtFlds( new SwDocUpdtFld() ),
|
|
pFldTypes( new SwFldTypes() ),
|
|
pVirDev( 0 ),
|
|
pPrt( 0 ),
|
|
pPrtData( 0 ),
|
|
pGlossaryDoc( 0 ),
|
|
pOutlineRule( 0 ),
|
|
pFtnInfo( new SwFtnInfo ),
|
|
pEndNoteInfo( new SwEndNoteInfo ),
|
|
pLineNumberInfo( new SwLineNumberInfo ),
|
|
pFtnIdxs( new SwFtnIdxs ),
|
|
pDocStat( new SwDocStat ),
|
|
pDocShell( 0 ),
|
|
pDocShRef( 0 ),
|
|
pLinkMgr( new SvxLinkManager( 0 ) ),
|
|
pACEWord( 0 ),
|
|
pURLStateChgd( 0 ),
|
|
pNumberFormatter( 0 ),
|
|
pNumRuleTbl( new SwNumRuleTbl ),
|
|
// --> OD 2008-03-26 #refactorlists#
|
|
maLists(),
|
|
maListStyleLists(),
|
|
// <--
|
|
pRedlineTbl( new SwRedlineTbl ),
|
|
pAutoFmtRedlnComment( 0 ),
|
|
pUnoCrsrTbl( new SwUnoCrsrTbl( 0, 16 ) ),
|
|
pPgPViewPrtData( 0 ),
|
|
pExtInputRing( 0 ),
|
|
pLayouter( 0 ),
|
|
// --> OD 2008-03-07 #refactorlists#
|
|
pStyleAccess( 0 ),
|
|
// <--
|
|
pLayoutCache( 0 ),
|
|
pUnoCallBack(new SwUnoCallBack(0)),
|
|
mpGrammarContact( 0 ),
|
|
aChartDataProviderImplRef(),
|
|
pChartControllerHelper( 0 ),
|
|
// --> OD 2007-10-31 #i83479#
|
|
mpListItemsList( new tImplSortedNodeNumList() ),
|
|
// <--
|
|
nUndoPos( 0 ),
|
|
nUndoSavePos( 0 ),
|
|
nUndoCnt( 0 ),
|
|
nUndoSttEnd( 0 ),
|
|
nAutoFmtRedlnCommentNo( 0 ),
|
|
nLinkUpdMode( GLOBALSETTING ),
|
|
eFldUpdMode( AUTOUPD_GLOBALSETTING ),
|
|
eRedlineMode((RedlineMode_t)(nsRedlineMode_t::REDLINE_SHOW_INSERT | nsRedlineMode_t::REDLINE_SHOW_DELETE)),
|
|
eChrCmprType( CHARCOMPRESS_NONE ),
|
|
mReferenceCount(0),
|
|
mIdleBlockCount(0),
|
|
nLockExpFld( 0 ),
|
|
mbReadlineChecked(false),
|
|
mbWinEncryption(sal_False),
|
|
// --> OD 2005-02-11 #i38810#
|
|
mbLinksUpdated( sal_False ),
|
|
mbClipBoard( false ),
|
|
mbColumnSelection( false ),
|
|
// i#78591#
|
|
mbProtectForm(false),*/
|
|
pRet->n32DummyCompatabilityOptions1 = n32DummyCompatabilityOptions1;
|
|
pRet->n32DummyCompatabilityOptions2 = n32DummyCompatabilityOptions2;
|
|
/*
|
|
mbStartIdleTimer(sal_False)
|
|
{
|
|
RTL_LOGFILE_CONTEXT_AUTHOR( aLog, "SW", "JP93722", "SwDoc::SwDoc" );
|
|
|
|
mbGlossDoc =
|
|
mbModified =
|
|
mbDtor =
|
|
mbUndo =
|
|
mbPageNums =
|
|
mbLoaded =
|
|
mbUpdateExpFld =
|
|
mbNewDoc =
|
|
mbCopyIsMove =
|
|
mbNoDrawUndoObj =
|
|
mbBrowseMode =
|
|
mbInReading =
|
|
mbInXMLImport =
|
|
mbUpdateTOX =
|
|
mbInLoadAsynchron =
|
|
mbHTMLMode =
|
|
mbInCallModified =
|
|
mbIsGlobalDoc =
|
|
mbGlblDocSaveLinks =
|
|
mbIsLabelDoc =
|
|
mbIsAutoFmtRedline =
|
|
mbOLEPrtNotifyPending =
|
|
mbAllOLENotify =
|
|
mbIsRedlineMove =
|
|
mbInsOnlyTxtGlssry =
|
|
mbContains_MSVBasic =
|
|
mbKernAsianPunctuation =
|
|
#ifndef PRODUCT
|
|
mbXMLExport =
|
|
#endif
|
|
// --> OD 2006-03-21 #b6375613#
|
|
mbApplyWorkaroundForB6375613 =
|
|
// <--
|
|
false;
|
|
|
|
mbGroupUndo =
|
|
mbNewFldLst =
|
|
mbVisibleLinks =
|
|
mbPurgeOLE =
|
|
true;
|
|
|
|
//
|
|
// COMPATIBILITY FLAGS START
|
|
//
|
|
|
|
// Note: Any non-hidden compatibility flag should obtain its default
|
|
// by asking SvtCompatibilityOptions, see below.
|
|
//
|
|
const SvtCompatibilityOptions aOptions;
|
|
*/
|
|
pRet->mbParaSpaceMax = mbParaSpaceMax ;
|
|
pRet->mbParaSpaceMaxAtPages = mbParaSpaceMaxAtPages ;
|
|
pRet->mbTabCompat = mbTabCompat ;
|
|
pRet->mbUseVirtualDevice = mbUseVirtualDevice ;
|
|
pRet->mbAddExternalLeading = mbAddExternalLeading ;
|
|
pRet->mbOldLineSpacing = mbOldLineSpacing ;
|
|
pRet->mbAddParaSpacingToTableCells = mbAddParaSpacingToTableCells ;
|
|
pRet->mbUseFormerObjectPos = mbUseFormerObjectPos ;
|
|
pRet->mbUseFormerTextWrapping = mbUseFormerTextWrapping ;
|
|
pRet->mbConsiderWrapOnObjPos = mbConsiderWrapOnObjPos ;
|
|
pRet->mbAddFlyOffsets = mbAddFlyOffsets ;
|
|
pRet->mbOldNumbering = mbOldNumbering ;
|
|
pRet->mbUseHiResolutionVirtualDevice = mbUseHiResolutionVirtualDevice ;
|
|
pRet->mbIgnoreFirstLineIndentInNumbering = mbIgnoreFirstLineIndentInNumbering ;
|
|
pRet->mbDoNotJustifyLinesWithManualBreak = mbDoNotJustifyLinesWithManualBreak ;
|
|
pRet->mbDoNotResetParaAttrsForNumFont = mbDoNotResetParaAttrsForNumFont ;
|
|
pRet->mbOutlineLevelYieldsOutlineRule = mbOutlineLevelYieldsOutlineRule ;
|
|
pRet->mbTableRowKeep = mbTableRowKeep ;
|
|
pRet->mbIgnoreTabsAndBlanksForLineCalculation = mbIgnoreTabsAndBlanksForLineCalculation ;
|
|
pRet->mbDoNotCaptureDrawObjsOnPage = mbDoNotCaptureDrawObjsOnPage ;
|
|
pRet->mbClipAsCharacterAnchoredWriterFlyFrames= mbClipAsCharacterAnchoredWriterFlyFrames;
|
|
pRet->mbUnixForceZeroExtLeading = mbUnixForceZeroExtLeading ;
|
|
pRet->mbOldPrinterMetrics = mbOldPrinterMetrics ;
|
|
pRet->mbTabRelativeToIndent = mbTabRelativeToIndent ;
|
|
pRet->mbTabAtLeftIndentForParagraphsInList = mbTabAtLeftIndentForParagraphsInList ;
|
|
|
|
//
|
|
// COMPATIBILITY FLAGS END
|
|
//
|
|
/*
|
|
pMacroTable = new SvxMacroTableDtor;
|
|
|
|
mpGrammarContact = ::createGrammarContact();
|
|
|
|
// Formate
|
|
pFrmFmtTbl->Insert(pDfltFrmFmt, 0 );
|
|
pCharFmtTbl->Insert(pDfltCharFmt, 0 );
|
|
|
|
// FmtColls
|
|
// TXT
|
|
pTxtFmtCollTbl->Insert(pDfltTxtFmtColl, 0 );
|
|
// GRF
|
|
pGrfFmtCollTbl->Insert(pDfltGrfFmtColl, 0 );
|
|
|
|
// PageDesc, EmptyPageFmt und ColumnFmt anlegen
|
|
if ( !aPageDescs.Count() )
|
|
GetPageDescFromPool( RES_POOLPAGE_STANDARD );
|
|
|
|
//Leere Seite Einstellen.
|
|
pEmptyPageFmt->SetFmtAttr( SwFmtFrmSize( ATT_FIX_SIZE ) );
|
|
//BodyFmt fuer Spalten Einstellen.
|
|
pColumnContFmt->SetFmtAttr( SwFmtFillOrder( ATT_LEFT_TO_RIGHT ) );
|
|
|
|
_InitFieldTypes();
|
|
|
|
// lege (fuer die Filter) eine Default-OutlineNumRule an
|
|
// --> OD 2008-02-11 #newlistlevelattrs#
|
|
pOutlineRule = new SwNumRule( String::CreateFromAscii( SwNumRule::GetOutlineRuleName() ),
|
|
// --> OD 2008-06-06 #i89178#
|
|
numfunc::GetDefaultPositionAndSpaceMode(),
|
|
// <--
|
|
OUTLINE_RULE );
|
|
// <--
|
|
// #115901#
|
|
AddNumRule(pOutlineRule);
|
|
// --> OD 2005-10-21 - counting of phantoms depends on <IsOldNumbering()>
|
|
pOutlineRule->SetCountPhantoms( !get(IDocumentSettingAccess::OLD_NUMBERING) );
|
|
// <--
|
|
|
|
new SwTxtNode( SwNodeIndex( aUndoNodes.GetEndOfContent() ), pDfltTxtFmtColl );
|
|
new SwTxtNode( SwNodeIndex( aNodes.GetEndOfContent() ),
|
|
GetTxtCollFromPool( RES_POOLCOLL_STANDARD ));
|
|
|
|
// den eigenen IdleTimer setzen
|
|
aIdleTimer.SetTimeout( 600 );
|
|
aIdleTimer.SetTimeoutHdl( LINK(this, SwDoc, DoIdleJobs) );
|
|
|
|
aOLEModifiedTimer.SetTimeout( 1000 );
|
|
aOLEModifiedTimer.SetTimeoutHdl( LINK( this, SwDoc, DoUpdateModifiedOLE ));
|
|
|
|
// DBMgr anlegen
|
|
pNewDBMgr = new SwNewDBMgr;
|
|
|
|
// create TOXTypes
|
|
ShellResource* pShellRes = ViewShell::GetShellRes();
|
|
|
|
SwTOXType * pNew = new SwTOXType(TOX_CONTENT, pShellRes->aTOXContentName );
|
|
pTOXTypes->Insert( pNew, pTOXTypes->Count() );
|
|
pNew = new SwTOXType(TOX_INDEX, pShellRes->aTOXIndexName );
|
|
pTOXTypes->Insert( pNew, pTOXTypes->Count() );
|
|
pNew = new SwTOXType(TOX_USER, pShellRes->aTOXUserName );
|
|
pTOXTypes->Insert( pNew, pTOXTypes->Count() );
|
|
pNew = new SwTOXType(TOX_ILLUSTRATIONS, pShellRes->aTOXIllustrationsName );
|
|
pTOXTypes->Insert( pNew, pTOXTypes->Count() );
|
|
pNew = new SwTOXType(TOX_OBJECTS, pShellRes->aTOXObjectsName );
|
|
pTOXTypes->Insert( pNew, pTOXTypes->Count() );
|
|
pNew = new SwTOXType(TOX_TABLES, pShellRes->aTOXTablesName );
|
|
pTOXTypes->Insert( pNew, pTOXTypes->Count() );
|
|
pNew = new SwTOXType(TOX_AUTHORITIES, pShellRes->aTOXAuthoritiesName );
|
|
pTOXTypes->Insert( pNew, pTOXTypes->Count() );
|
|
|
|
{
|
|
SfxItemSet aIgnorableParagraphItems( GetAttrPool(),
|
|
RES_PARATR_LIST_BEGIN, RES_PARATR_LIST_END-1,
|
|
0 );
|
|
pStyleAccess = createStyleManager( &aIgnorableParagraphItems );
|
|
}
|
|
|
|
ResetModified();
|
|
|
|
*/
|
|
//copy content
|
|
pRet->Paste( *this );
|
|
return pRet;
|
|
}
|
|
/*-- 08.05.2009 10:52:40---------------------------------------------------
|
|
copy document content - code from SwFEShell::Paste( SwDoc* , BOOL )
|
|
-----------------------------------------------------------------------*/
|
|
void SwDoc::Paste( const SwDoc& rSource )
|
|
{
|
|
// this has to be empty const USHORT nStartPageNumber = GetPhyPageNum();
|
|
// until the end of the NodesArray
|
|
SwNodeIndex aSourceIdx( rSource.GetNodes().GetEndOfExtras(), 2 );
|
|
SwPaM aCpyPam( aSourceIdx ); //DocStart
|
|
SwNodeIndex aTargetIdx( GetNodes().GetEndOfExtras(), 2 );
|
|
SwPaM aInsertPam( aTargetIdx ); //replaces PCURCRSR from SwFEShell::Paste()
|
|
|
|
|
|
aCpyPam.SetMark();
|
|
aCpyPam.Move( fnMoveForward, fnGoDoc );
|
|
|
|
this->StartUndo( UNDO_INSGLOSSARY, NULL );
|
|
this->LockExpFlds();
|
|
|
|
{
|
|
SwPosition& rInsPos = *aInsertPam.GetPoint();
|
|
//find out if the clipboard document starts with a table
|
|
bool bStartWithTable = 0 != aCpyPam.Start()->nNode.GetNode().FindTableNode();
|
|
SwPosition aInsertPosition( rInsPos );
|
|
|
|
{
|
|
SwNodeIndex aIndexBefore(rInsPos.nNode);
|
|
|
|
aIndexBefore--;
|
|
|
|
rSource.CopyRange( aCpyPam, rInsPos, true );
|
|
|
|
{
|
|
aIndexBefore++;
|
|
SwPaM aPaM(SwPosition(aIndexBefore, 0),
|
|
SwPosition(rInsPos.nNode, 0));
|
|
|
|
MakeUniqueNumRules(aPaM);
|
|
}
|
|
}
|
|
|
|
//TODO: Is this necessary here? SaveTblBoxCntnt( &rInsPos );
|
|
if(/*bIncludingPageFrames && */bStartWithTable)
|
|
{
|
|
//remove the paragraph in front of the table
|
|
SwPaM aPara(aInsertPosition);
|
|
this->DelFullPara(aPara);
|
|
}
|
|
//additionally copy page bound frames
|
|
if( /*bIncludingPageFrames && */rSource.GetSpzFrmFmts()->Count() )
|
|
{
|
|
for ( USHORT i = 0; i < rSource.GetSpzFrmFmts()->Count(); ++i )
|
|
{
|
|
BOOL bInsWithFmt = TRUE;
|
|
const SwFrmFmt& rCpyFmt = *(*rSource.GetSpzFrmFmts())[i];
|
|
if( bInsWithFmt )
|
|
{
|
|
SwFmtAnchor aAnchor( rCpyFmt.GetAnchor() );
|
|
if( FLY_PAGE == aAnchor.GetAnchorId() )
|
|
{
|
|
aAnchor.SetPageNum( aAnchor.GetPageNum() + /*nStartPageNumber - */1 );
|
|
}
|
|
else
|
|
continue;
|
|
this->CopyLayoutFmt( rCpyFmt, aAnchor, true, true );
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
this->EndUndo( UNDO_INSGLOSSARY, NULL );
|
|
|
|
UnlockExpFlds();
|
|
UpdateFlds(NULL, false);
|
|
}
|