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>
1119 lines
32 KiB
C++
1119 lines
32 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: unins.cxx,v $
|
||
* $Revision: 1.33 $
|
||
*
|
||
* 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"
|
||
#include <hintids.hxx>
|
||
#include <unotools/charclass.hxx>
|
||
#include <sot/storage.hxx>
|
||
#include <svx/keepitem.hxx>
|
||
#include <svx/svdobj.hxx>
|
||
|
||
#include <docsh.hxx>
|
||
#include <fmtcntnt.hxx>
|
||
#include <fmtanchr.hxx>
|
||
#include <frmfmt.hxx>
|
||
#include <doc.hxx>
|
||
#include <swundo.hxx> // fuer die UndoIds
|
||
#include <pam.hxx>
|
||
#include <ndtxt.hxx>
|
||
#include <undobj.hxx>
|
||
#include <rolbck.hxx>
|
||
#include <ndgrf.hxx>
|
||
#include <ndole.hxx>
|
||
#include <grfatr.hxx>
|
||
#include <cntfrm.hxx>
|
||
#include <flyfrm.hxx>
|
||
#include <fesh.hxx>
|
||
#include <swtable.hxx>
|
||
#include <redline.hxx>
|
||
#include <docary.hxx>
|
||
#include <acorrect.hxx>
|
||
#include <dcontact.hxx>
|
||
|
||
#include <comcore.hrc> // #111827#
|
||
#include <undo.hrc>
|
||
|
||
using namespace ::com::sun::star;
|
||
|
||
|
||
class _UnReplaceData : private SwUndoSaveCntnt
|
||
{
|
||
String m_sOld, m_sIns;
|
||
ULONG m_nSttNd, m_nEndNd, m_nOffset;
|
||
xub_StrLen m_nSttCnt, m_nEndCnt, m_nSetPos, m_nSelEnd;
|
||
BOOL m_bSplitNext : 1;
|
||
BOOL m_bRegExp : 1;
|
||
// metadata references for paragraph and following para (if m_bSplitNext)
|
||
::boost::shared_ptr< ::sfx2::MetadatableUndo > m_pMetadataUndoStart;
|
||
::boost::shared_ptr< ::sfx2::MetadatableUndo > m_pMetadataUndoEnd;
|
||
|
||
public:
|
||
_UnReplaceData( const SwPaM& rPam, const String& rIns, BOOL bRegExp );
|
||
~_UnReplaceData();
|
||
|
||
void Undo( SwUndoIter& rIter );
|
||
void Redo( SwUndoIter& rIter );
|
||
void SetEnd( const SwPaM& rPam );
|
||
|
||
const String & GetOld() const { return m_sOld; }
|
||
const String & GetIns() const { return m_sIns; }
|
||
};
|
||
|
||
|
||
SV_IMPL_PTRARR( _UnReplaceDatas, _UnReplaceData* )
|
||
|
||
//------------------------------------------------------------------
|
||
|
||
inline SwDoc& SwUndoIter::GetDoc() const { return *pAktPam->GetDoc(); }
|
||
|
||
// zwei Zugriffs-Funktionen
|
||
inline SwPosition* IterPt( SwUndoIter& rUIter )
|
||
{ return rUIter.pAktPam->GetPoint(); }
|
||
inline SwPosition* IterMk( SwUndoIter& rUIter )
|
||
{ return rUIter.pAktPam->GetMark(); }
|
||
|
||
//------------------------------------------------------------
|
||
|
||
// INSERT
|
||
|
||
String * SwUndoInsert::GetTxtFromDoc() const
|
||
{
|
||
String * pResult = NULL;
|
||
|
||
SwNodeIndex aNd( pDoc->GetNodes(), nNode);
|
||
SwCntntNode* pCNd = aNd.GetNode().GetCntntNode();
|
||
SwPaM aPaM( *pCNd, nCntnt );
|
||
|
||
aPaM.SetMark();
|
||
|
||
if( pCNd->IsTxtNode() )
|
||
{
|
||
pResult = new String( ((SwTxtNode*)pCNd)->GetTxt().Copy(nCntnt-nLen,
|
||
nLen ) );
|
||
|
||
}
|
||
|
||
return pResult;
|
||
}
|
||
|
||
void SwUndoInsert::Init(const SwNodeIndex & rNd)
|
||
{
|
||
// Redline beachten
|
||
pDoc = rNd.GetNode().GetDoc();
|
||
if( pDoc->IsRedlineOn() )
|
||
{
|
||
pRedlData = new SwRedlineData( nsRedlineType_t::REDLINE_INSERT,
|
||
pDoc->GetRedlineAuthor() );
|
||
SetRedlineMode( pDoc->GetRedlineMode() );
|
||
}
|
||
|
||
pUndoTxt = GetTxtFromDoc();
|
||
|
||
bCacheComment = false;
|
||
}
|
||
|
||
// #111827#
|
||
SwUndoInsert::SwUndoInsert( const SwNodeIndex& rNd, xub_StrLen nCnt,
|
||
xub_StrLen nL,
|
||
const IDocumentContentOperations::InsertFlags nInsertFlags,
|
||
BOOL bWDelim )
|
||
: SwUndo(UNDO_TYPING), pPos( 0 ), pTxt( 0 ), pRedlData( 0 ),
|
||
nNode( rNd.GetIndex() ), nCntnt(nCnt), nLen(nL),
|
||
bIsWordDelim( bWDelim ), bIsAppend( FALSE )
|
||
, m_nInsertFlags(nInsertFlags)
|
||
{
|
||
Init(rNd);
|
||
}
|
||
|
||
// #111827#
|
||
SwUndoInsert::SwUndoInsert( const SwNodeIndex& rNd )
|
||
: SwUndo(UNDO_SPLITNODE), pPos( 0 ), pTxt( 0 ),
|
||
pRedlData( 0 ), nNode( rNd.GetIndex() ), nCntnt(0), nLen(1),
|
||
bIsWordDelim( FALSE ), bIsAppend( TRUE )
|
||
, m_nInsertFlags(IDocumentContentOperations::INS_EMPTYEXPAND)
|
||
{
|
||
Init(rNd);
|
||
}
|
||
|
||
// stelle fest, ob das naechste Insert mit dem aktuellen zusammengefasst
|
||
// werden kann. Wenn ja, dann aender die Laenge und die InsPos.
|
||
// Dann wird von SwDoc::Insert kein neues Object in die Undoliste gestellt.
|
||
|
||
BOOL SwUndoInsert::CanGrouping( const SwPosition& rInsPos, sal_Unicode cIns )
|
||
{
|
||
BOOL bRet = FALSE;
|
||
if( !bIsAppend )
|
||
{
|
||
++nCntnt;
|
||
bRet = CanGrouping( rInsPos );
|
||
--nCntnt;
|
||
if( bRet )
|
||
bRet = CanGrouping( cIns );
|
||
}
|
||
return bRet;
|
||
}
|
||
|
||
|
||
BOOL SwUndoInsert::CanGrouping( sal_Unicode cIns )
|
||
{
|
||
if( !bIsAppend && bIsWordDelim ==
|
||
!GetAppCharClass().isLetterNumeric( String( cIns )) )
|
||
{
|
||
nLen++;
|
||
nCntnt++;
|
||
|
||
if (pUndoTxt)
|
||
pUndoTxt->Insert(cIns);
|
||
|
||
return TRUE;
|
||
}
|
||
return FALSE;
|
||
}
|
||
|
||
BOOL SwUndoInsert::CanGrouping( const SwPosition& rPos )
|
||
{
|
||
BOOL bRet = FALSE;
|
||
if( nNode == rPos.nNode.GetIndex() &&
|
||
nCntnt == rPos.nContent.GetIndex() )
|
||
{
|
||
// Redline beachten
|
||
SwDoc& rDoc = *rPos.nNode.GetNode().GetDoc();
|
||
if( ( ~nsRedlineMode_t::REDLINE_SHOW_MASK & rDoc.GetRedlineMode() ) ==
|
||
( ~nsRedlineMode_t::REDLINE_SHOW_MASK & GetRedlineMode() ) )
|
||
{
|
||
bRet = TRUE;
|
||
|
||
// dann war oder ist noch Redline an:
|
||
// pruefe, ob an der InsPosition ein anderer Redline
|
||
// rumsteht. Wenn der gleiche nur einmalig vorhanden ist,
|
||
// kann zusammen gefasst werden.
|
||
const SwRedlineTbl& rTbl = rDoc.GetRedlineTbl();
|
||
if( rTbl.Count() )
|
||
{
|
||
SwRedlineData aRData( nsRedlineType_t::REDLINE_INSERT, rDoc.GetRedlineAuthor() );
|
||
const SwIndexReg* pIReg = rPos.nContent.GetIdxReg();
|
||
SwIndex* pIdx;
|
||
for( USHORT i = 0; i < rTbl.Count(); ++i )
|
||
{
|
||
SwRedline* pRedl = rTbl[ i ];
|
||
if( pIReg == (pIdx = &pRedl->End()->nContent)->GetIdxReg() &&
|
||
nCntnt == pIdx->GetIndex() )
|
||
{
|
||
if( !pRedl->HasMark() || !pRedlData ||
|
||
*pRedl != *pRedlData || *pRedl != aRData )
|
||
{
|
||
bRet = FALSE;
|
||
break;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
return bRet;
|
||
}
|
||
|
||
SwUndoInsert::~SwUndoInsert()
|
||
{
|
||
if( pPos ) // loesche noch den Bereich aus dem UndoNodes Array
|
||
{
|
||
// Insert speichert den Inhalt in der IconSection
|
||
SwNodes& rUNds = pPos->nNode.GetNode().GetNodes();
|
||
if( pPos->nContent.GetIndex() ) // nicht den gesamten Node loeschen
|
||
{
|
||
SwTxtNode* pTxtNd = pPos->nNode.GetNode().GetTxtNode();
|
||
ASSERT( pTxtNd, "kein TextNode, aus dem geloescht werden soll" );
|
||
pTxtNd->EraseText( pPos->nContent );
|
||
pPos->nNode++;
|
||
}
|
||
pPos->nContent.Assign( 0, 0 );
|
||
rUNds.Delete( pPos->nNode, rUNds.GetEndOfExtras().GetIndex() -
|
||
pPos->nNode.GetIndex() );
|
||
delete pPos;
|
||
}
|
||
else if( pTxt ) // der eingefuegte Text
|
||
delete pTxt;
|
||
delete pRedlData;
|
||
}
|
||
|
||
|
||
|
||
void SwUndoInsert::Undo( SwUndoIter& rUndoIter )
|
||
{
|
||
SwDoc* pTmpDoc = &rUndoIter.GetDoc();
|
||
|
||
if( bIsAppend )
|
||
{
|
||
SwPaM* pPam = rUndoIter.pAktPam;
|
||
pPam->GetPoint()->nNode = nNode;
|
||
|
||
if( IDocumentRedlineAccess::IsRedlineOn( GetRedlineMode() ))
|
||
{
|
||
pPam->GetPoint()->nContent.Assign( pPam->GetCntntNode(), 0 );
|
||
pPam->SetMark();
|
||
pPam->Move( fnMoveBackward );
|
||
pPam->Exchange();
|
||
pTmpDoc->DeleteRedline( *pPam, true, USHRT_MAX );
|
||
}
|
||
pPam->DeleteMark();
|
||
pTmpDoc->DelFullPara( *pPam );
|
||
pPam->GetPoint()->nContent.Assign( pPam->GetCntntNode(), 0 );
|
||
}
|
||
else
|
||
{
|
||
ULONG nNd = nNode;
|
||
xub_StrLen nCnt = nCntnt;
|
||
if( nLen )
|
||
{
|
||
SwNodeIndex aNd( pTmpDoc->GetNodes(), nNode);
|
||
SwCntntNode* pCNd = aNd.GetNode().GetCntntNode();
|
||
SwPaM aPaM( *pCNd, nCntnt );
|
||
|
||
aPaM.SetMark();
|
||
|
||
SwTxtNode * const pTxtNode( pCNd->GetTxtNode() );
|
||
if ( pTxtNode )
|
||
{
|
||
aPaM.GetPoint()->nContent -= nLen;
|
||
if( IDocumentRedlineAccess::IsRedlineOn( GetRedlineMode() ))
|
||
pTmpDoc->DeleteRedline( aPaM, true, USHRT_MAX );
|
||
RemoveIdxFromRange( aPaM, FALSE );
|
||
pTxt = new String( pTxtNode->GetTxt().Copy(nCntnt-nLen, nLen) );
|
||
pTxtNode->EraseText( aPaM.GetPoint()->nContent, nLen );
|
||
}
|
||
else // ansonsten Grafik/OLE/Text/...
|
||
{
|
||
aPaM.Move(fnMoveBackward);
|
||
if( IDocumentRedlineAccess::IsRedlineOn( GetRedlineMode() ))
|
||
pTmpDoc->DeleteRedline( aPaM, true, USHRT_MAX );
|
||
RemoveIdxFromRange( aPaM, FALSE );
|
||
}
|
||
|
||
nNd = aPaM.GetPoint()->nNode.GetIndex();
|
||
nCnt = aPaM.GetPoint()->nContent.GetIndex();
|
||
|
||
if( !pTxt )
|
||
{
|
||
pPos = new SwPosition( *aPaM.GetPoint() );
|
||
MoveToUndoNds( aPaM, &pPos->nNode, &pPos->nContent );
|
||
}
|
||
nNode = aPaM.GetPoint()->nNode.GetIndex();
|
||
nCntnt = aPaM.GetPoint()->nContent.GetIndex();
|
||
}
|
||
|
||
// setze noch den Cursor auf den Undo-Bereich
|
||
rUndoIter.pAktPam->DeleteMark();
|
||
|
||
IterPt(rUndoIter)->nNode = nNd;
|
||
IterPt(rUndoIter)->nContent.Assign( pTmpDoc->GetNodes()[
|
||
IterPt(rUndoIter)->nNode ]->GetCntntNode(), nCnt );
|
||
// SPoint und GetMark auf der gleichen Position
|
||
}
|
||
|
||
DELETEZ(pUndoTxt);
|
||
}
|
||
|
||
|
||
void SwUndoInsert::Redo( SwUndoIter& rUndoIter )
|
||
{
|
||
// setze noch den Cursor auf den Redo-Bereich
|
||
SwPaM* pPam = rUndoIter.pAktPam;
|
||
SwDoc* pTmpDoc = pPam->GetDoc();
|
||
pPam->DeleteMark();
|
||
|
||
if( bIsAppend )
|
||
{
|
||
pPam->GetPoint()->nNode = nNode - 1;
|
||
pTmpDoc->AppendTxtNode( *pPam->GetPoint() );
|
||
|
||
pPam->SetMark();
|
||
pPam->Move( fnMoveBackward );
|
||
pPam->Exchange();
|
||
|
||
if( pRedlData && IDocumentRedlineAccess::IsRedlineOn( GetRedlineMode() ))
|
||
{
|
||
RedlineMode_t eOld = pTmpDoc->GetRedlineMode();
|
||
pTmpDoc->SetRedlineMode_intern((RedlineMode_t)(eOld & ~nsRedlineMode_t::REDLINE_IGNORE));
|
||
pTmpDoc->AppendRedline( new SwRedline( *pRedlData, *pPam ), true);
|
||
pTmpDoc->SetRedlineMode_intern( eOld );
|
||
}
|
||
else if( !( nsRedlineMode_t::REDLINE_IGNORE & GetRedlineMode() ) &&
|
||
pTmpDoc->GetRedlineTbl().Count() )
|
||
pTmpDoc->SplitRedline( *pPam );
|
||
|
||
pPam->DeleteMark();
|
||
}
|
||
else
|
||
{
|
||
pPam->GetPoint()->nNode = nNode;
|
||
SwCntntNode* pCNd = pTmpDoc->GetNodes()[ pPam->GetPoint()->nNode ]->GetCntntNode();
|
||
pPam->GetPoint()->nContent.Assign( pCNd, nCntnt );
|
||
|
||
if( nLen )
|
||
{
|
||
BOOL bMvBkwrd = MovePtBackward( *pPam );
|
||
|
||
if( pTxt )
|
||
{
|
||
SwTxtNode *const pTxtNode = pCNd->GetTxtNode();
|
||
ASSERT( pTxtNode, "where is my textnode ?" );
|
||
pTxtNode->InsertText( *pTxt, pPam->GetMark()->nContent,
|
||
m_nInsertFlags );
|
||
DELETEZ( pTxt );
|
||
}
|
||
else
|
||
{
|
||
// Inhalt wieder einfuegen. (erst pPos abmelden !!)
|
||
ULONG nMvNd = pPos->nNode.GetIndex();
|
||
xub_StrLen nMvCnt = pPos->nContent.GetIndex();
|
||
DELETEZ( pPos );
|
||
MoveFromUndoNds( *pTmpDoc, nMvNd, nMvCnt, *pPam->GetMark() );
|
||
}
|
||
nNode = pPam->GetMark()->nNode.GetIndex();
|
||
nCntnt = pPam->GetMark()->nContent.GetIndex();
|
||
|
||
MovePtForward( *pPam, bMvBkwrd );
|
||
rUndoIter.pAktPam->Exchange();
|
||
if( pRedlData && IDocumentRedlineAccess::IsRedlineOn( GetRedlineMode() ))
|
||
{
|
||
RedlineMode_t eOld = pTmpDoc->GetRedlineMode();
|
||
pTmpDoc->SetRedlineMode_intern((RedlineMode_t)(eOld & ~nsRedlineMode_t::REDLINE_IGNORE));
|
||
pTmpDoc->AppendRedline( new SwRedline( *pRedlData,
|
||
*rUndoIter.pAktPam ), true);
|
||
pTmpDoc->SetRedlineMode_intern( eOld );
|
||
}
|
||
else if( !( nsRedlineMode_t::REDLINE_IGNORE & GetRedlineMode() ) &&
|
||
pTmpDoc->GetRedlineTbl().Count() )
|
||
pTmpDoc->SplitRedline( *rUndoIter.pAktPam );
|
||
}
|
||
}
|
||
|
||
pUndoTxt = GetTxtFromDoc();
|
||
}
|
||
|
||
|
||
void SwUndoInsert::Repeat( SwUndoIter& rUndoIter )
|
||
{
|
||
rUndoIter.pLastUndoObj = this;
|
||
if( !nLen )
|
||
return;
|
||
|
||
SwDoc& rDoc = rUndoIter.GetDoc();
|
||
SwNodeIndex aNd( rDoc.GetNodes(), nNode );
|
||
SwCntntNode* pCNd = aNd.GetNode().GetCntntNode();;
|
||
|
||
if( !bIsAppend && 1 == nLen ) // >1 dann immer nur Text, ansonsten Grafik/OLE/Text/...
|
||
{
|
||
SwPaM aPaM( *pCNd, nCntnt );
|
||
aPaM.SetMark();
|
||
aPaM.Move(fnMoveBackward);
|
||
pCNd = aPaM.GetCntntNode();
|
||
}
|
||
|
||
// Was passiert mit dem evt. selektierten Bereich ???
|
||
|
||
switch( pCNd->GetNodeType() )
|
||
{
|
||
case ND_TEXTNODE:
|
||
if( bIsAppend )
|
||
rDoc.AppendTxtNode( *rUndoIter.pAktPam->GetPoint() );
|
||
else
|
||
{
|
||
String aTxt( ((SwTxtNode*)pCNd)->GetTxt() );
|
||
BOOL bGroupUndo = rDoc.DoesGroupUndo();
|
||
rDoc.DoGroupUndo( FALSE );
|
||
rDoc.InsertString( *rUndoIter.pAktPam,
|
||
aTxt.Copy( nCntnt - nLen, nLen ) );
|
||
rDoc.DoGroupUndo( bGroupUndo );
|
||
}
|
||
break;
|
||
case ND_GRFNODE:
|
||
{
|
||
SwGrfNode* pGrfNd = (SwGrfNode*)pCNd;
|
||
String sFile, sFilter;
|
||
if( pGrfNd->IsGrfLink() )
|
||
pGrfNd->GetFileFilterNms( &sFile, &sFilter );
|
||
|
||
rDoc.Insert( *rUndoIter.pAktPam, sFile, sFilter,
|
||
&pGrfNd->GetGrf(),
|
||
0/* Grafik-Collection*/, NULL, NULL );
|
||
}
|
||
break;
|
||
|
||
case ND_OLENODE:
|
||
{
|
||
// StarView bietet noch nicht die Moeglichkeit ein StarOBJ zu kopieren
|
||
SvStorageRef aRef = new SvStorage( aEmptyStr );
|
||
SwOLEObj& rSwOLE = (SwOLEObj&)((SwOLENode*)pCNd)->GetOLEObj();
|
||
|
||
// temporary storage until object is inserted
|
||
// TODO/MBA: seems that here a physical copy is done - not as in drawing layer! Testing!
|
||
// TODO/LATER: Copying through the container would copy the replacement image as well
|
||
comphelper::EmbeddedObjectContainer aCnt;
|
||
::rtl::OUString aName = aCnt.CreateUniqueObjectName();
|
||
if ( aCnt.StoreEmbeddedObject( rSwOLE.GetOleRef(), aName, sal_True ) )
|
||
{
|
||
uno::Reference < embed::XEmbeddedObject > aNew = aCnt.GetEmbeddedObject( aName );
|
||
rDoc.Insert( *rUndoIter.pAktPam, svt::EmbeddedObjectRef( aNew, ((SwOLENode*)pCNd)->GetAspect() ), NULL, NULL, NULL );
|
||
}
|
||
|
||
break;
|
||
}
|
||
}
|
||
}
|
||
|
||
// #111827#
|
||
SwRewriter SwUndoInsert::GetRewriter() const
|
||
{
|
||
SwRewriter aResult;
|
||
String * pStr = NULL;
|
||
bool bDone = false;
|
||
|
||
if (pTxt)
|
||
pStr = pTxt;
|
||
else if (pUndoTxt)
|
||
pStr = pUndoTxt;
|
||
|
||
if (pStr)
|
||
{
|
||
String aString = ShortenString(DenoteSpecialCharacters(*pStr),
|
||
nUndoStringLength,
|
||
String(SW_RES(STR_LDOTS)));
|
||
|
||
aResult.AddRule(UNDO_ARG1, aString);
|
||
|
||
bDone = true;
|
||
}
|
||
|
||
if ( ! bDone )
|
||
{
|
||
aResult.AddRule(UNDO_ARG1, String("??", RTL_TEXTENCODING_ASCII_US));
|
||
}
|
||
|
||
return aResult;
|
||
}
|
||
|
||
|
||
/* */
|
||
|
||
SwUndoReplace::SwUndoReplace()
|
||
: SwUndo( UNDO_REPLACE ), nAktPos( USHRT_MAX )
|
||
{
|
||
}
|
||
|
||
SwUndoReplace::~SwUndoReplace()
|
||
{
|
||
}
|
||
|
||
void SwUndoReplace::Undo( SwUndoIter& rUndoIter )
|
||
{
|
||
// war dieses nicht die letze Undo-Aktion, dann setze den
|
||
// Count neu
|
||
if( rUndoIter.pLastUndoObj != this )
|
||
{
|
||
nAktPos = aArr.Count();
|
||
rUndoIter.pLastUndoObj = this;
|
||
bOldIterFlag = rUndoIter.bWeiter;
|
||
rUndoIter.bWeiter = TRUE;
|
||
}
|
||
|
||
aArr[ --nAktPos ]->Undo( rUndoIter );
|
||
|
||
if( !nAktPos ) // alten Status wieder zurueck
|
||
rUndoIter.bWeiter = bOldIterFlag;
|
||
}
|
||
|
||
|
||
void SwUndoReplace::Redo( SwUndoIter& rUndoIter )
|
||
{
|
||
// war dieses nicht die letze Undo-Aktion, dann setze den
|
||
// Count neu
|
||
if( rUndoIter.pLastUndoObj != this )
|
||
{
|
||
ASSERT( !nAktPos, "Redo ohne vorheriges Undo??" );
|
||
rUndoIter.pLastUndoObj = this;
|
||
bOldIterFlag = rUndoIter.bWeiter;
|
||
rUndoIter.bWeiter = TRUE;
|
||
}
|
||
|
||
aArr[ nAktPos ]->Redo( rUndoIter );
|
||
|
||
if( ++nAktPos >= aArr.Count() ) // alten Status wieder zurueck
|
||
{
|
||
nAktPos = USHRT_MAX;
|
||
rUndoIter.bWeiter = bOldIterFlag;
|
||
}
|
||
}
|
||
|
||
// #111827#
|
||
SwRewriter SwUndoReplace::GetRewriter() const
|
||
{
|
||
SwRewriter aResult;
|
||
|
||
if (aArr.Count() > 1)
|
||
{
|
||
aResult.AddRule(UNDO_ARG1, String::CreateFromInt32(aArr.Count()));
|
||
aResult.AddRule(UNDO_ARG2, String(SW_RES(STR_OCCURRENCES_OF)));
|
||
|
||
String aTmpStr;
|
||
aTmpStr += String(SW_RES(STR_START_QUOTE));
|
||
aTmpStr += ShortenString(aArr[0]->GetOld(), nUndoStringLength,
|
||
SW_RES(STR_LDOTS));
|
||
aTmpStr += String(SW_RES(STR_END_QUOTE));
|
||
aResult.AddRule(UNDO_ARG3, aTmpStr);
|
||
}
|
||
else if (aArr.Count() == 1)
|
||
{
|
||
{
|
||
String aTmpStr;
|
||
|
||
aTmpStr += String(SW_RES(STR_START_QUOTE));
|
||
// #i33488 #
|
||
aTmpStr += ShortenString(aArr[0]->GetOld(), nUndoStringLength,
|
||
SW_RES(STR_LDOTS));
|
||
aTmpStr += String(SW_RES(STR_END_QUOTE));
|
||
aResult.AddRule(UNDO_ARG1, aTmpStr);
|
||
}
|
||
|
||
aResult.AddRule(UNDO_ARG2, String(SW_RES(STR_YIELDS)));
|
||
|
||
{
|
||
String aTmpStr;
|
||
|
||
aTmpStr += String(SW_RES(STR_START_QUOTE));
|
||
// #i33488 #
|
||
aTmpStr += ShortenString(aArr[0]->GetIns(), nUndoStringLength,
|
||
SW_RES(STR_LDOTS));
|
||
aTmpStr += String(SW_RES(STR_END_QUOTE));
|
||
aResult.AddRule(UNDO_ARG3, aTmpStr);
|
||
}
|
||
}
|
||
|
||
return aResult;
|
||
}
|
||
|
||
void SwUndoReplace::AddEntry( const SwPaM& rPam, const String& rInsert,
|
||
BOOL bRegExp )
|
||
{
|
||
_UnReplaceData* pNew = new _UnReplaceData( rPam, rInsert, bRegExp );
|
||
aArr.C40_INSERT(_UnReplaceData, pNew, aArr.Count() );
|
||
}
|
||
|
||
void SwUndoReplace::SetEntryEnd( const SwPaM& rPam )
|
||
{
|
||
_UnReplaceData* pEntry = aArr[ aArr.Count()-1 ];
|
||
pEntry->SetEnd( rPam );
|
||
}
|
||
|
||
_UnReplaceData::_UnReplaceData( const SwPaM& rPam, const String& rIns,
|
||
BOOL bRgExp )
|
||
: m_sIns( rIns ), m_nOffset( 0 )
|
||
{
|
||
m_bRegExp = bRgExp;
|
||
|
||
const SwPosition * pStt( rPam.Start() );
|
||
const SwPosition * pEnd( rPam.End() );
|
||
|
||
m_nSttNd = m_nEndNd = pStt->nNode.GetIndex();
|
||
m_nSttCnt = pStt->nContent.GetIndex();
|
||
m_nSelEnd = m_nEndCnt = pEnd->nContent.GetIndex();
|
||
|
||
m_bSplitNext = m_nSttNd != pEnd->nNode.GetIndex();
|
||
|
||
SwTxtNode* pNd = pStt->nNode.GetNode().GetTxtNode();
|
||
ASSERT( pNd, "wo ist der TextNode" );
|
||
|
||
pHistory = new SwHistory;
|
||
DelCntntIndex( *rPam.GetMark(), *rPam.GetPoint() );
|
||
|
||
m_nSetPos = pHistory->Count();
|
||
|
||
ULONG nNewPos = pStt->nNode.GetIndex();
|
||
m_nOffset = m_nSttNd - nNewPos;
|
||
|
||
if ( pNd->GetpSwpHints() )
|
||
{
|
||
pHistory->CopyAttr( pNd->GetpSwpHints(), nNewPos, 0,
|
||
pNd->GetTxt().Len(), true );
|
||
}
|
||
|
||
if ( m_bSplitNext )
|
||
{
|
||
if( pNd->HasSwAttrSet() )
|
||
pHistory->CopyFmtAttr( *pNd->GetpSwAttrSet(), nNewPos );
|
||
pHistory->Add( pNd->GetTxtColl(), nNewPos, ND_TEXTNODE );
|
||
|
||
SwTxtNode* pNext = pEnd->nNode.GetNode().GetTxtNode();
|
||
ULONG nTmp = pNext->GetIndex();
|
||
pHistory->CopyAttr( pNext->GetpSwpHints(), nTmp, 0,
|
||
pNext->GetTxt().Len(), true );
|
||
if( pNext->HasSwAttrSet() )
|
||
pHistory->CopyFmtAttr( *pNext->GetpSwAttrSet(), nTmp );
|
||
pHistory->Add( pNext->GetTxtColl(),nTmp, ND_TEXTNODE );
|
||
// METADATA: store
|
||
m_pMetadataUndoStart = pNd ->CreateUndo();
|
||
m_pMetadataUndoEnd = pNext->CreateUndo();
|
||
}
|
||
|
||
if( !pHistory->Count() )
|
||
delete pHistory, pHistory = 0;
|
||
|
||
xub_StrLen nECnt = m_bSplitNext ? pNd->GetTxt().Len()
|
||
: pEnd->nContent.GetIndex();
|
||
m_sOld = pNd->GetTxt().Copy( m_nSttCnt, nECnt - m_nSttCnt );
|
||
}
|
||
|
||
_UnReplaceData::~_UnReplaceData()
|
||
{
|
||
}
|
||
|
||
void _UnReplaceData::Undo( SwUndoIter& rIter )
|
||
{
|
||
SwDoc* pDoc = &rIter.GetDoc();
|
||
SwPaM& rPam = *rIter.pAktPam;
|
||
rPam.DeleteMark();
|
||
|
||
SwTxtNode* pNd = pDoc->GetNodes()[ m_nSttNd - m_nOffset ]->GetTxtNode();
|
||
ASSERT( pNd, "Wo ist der TextNode geblieben?" )
|
||
|
||
SwAutoCorrExceptWord* pACEWord = pDoc->GetAutoCorrExceptWord();
|
||
if( pACEWord )
|
||
{
|
||
if( 1 == m_sIns.Len() && 1 == m_sOld.Len() )
|
||
{
|
||
SwPosition aPos( *pNd ); aPos.nContent.Assign( pNd, m_nSttCnt );
|
||
pACEWord->CheckChar( aPos, m_sOld.GetChar( 0 ) );
|
||
}
|
||
pDoc->SetAutoCorrExceptWord( 0 );
|
||
}
|
||
|
||
SwIndex aIdx( pNd, m_nSttCnt );
|
||
if( m_nSttNd == m_nEndNd )
|
||
{
|
||
pNd->EraseText( aIdx, m_sIns.Len() );
|
||
}
|
||
else
|
||
{
|
||
rPam.GetPoint()->nNode = *pNd;
|
||
rPam.GetPoint()->nContent.Assign( pNd, m_nSttCnt );
|
||
rPam.SetMark();
|
||
rPam.GetPoint()->nNode = m_nEndNd - m_nOffset;
|
||
rPam.GetPoint()->nContent.Assign( rPam.GetCntntNode(), m_nEndCnt );
|
||
|
||
pDoc->DeleteAndJoin( rPam );
|
||
rPam.DeleteMark();
|
||
pNd = rPam.GetNode()->GetTxtNode();
|
||
ASSERT( pNd, "Wo ist der TextNode geblieben?" );
|
||
aIdx.Assign( pNd, m_nSttCnt );
|
||
}
|
||
|
||
if( m_bSplitNext )
|
||
{
|
||
SwPosition aPos( *pNd, aIdx );
|
||
pDoc->SplitNode( aPos, false );
|
||
pNd->RestoreMetadata(m_pMetadataUndoEnd);
|
||
pNd = pDoc->GetNodes()[ m_nSttNd - m_nOffset ]->GetTxtNode();
|
||
aIdx.Assign( pNd, m_nSttCnt );
|
||
// METADATA: restore
|
||
pNd->RestoreMetadata(m_pMetadataUndoStart);
|
||
}
|
||
|
||
if( m_sOld.Len() )
|
||
{
|
||
pNd->InsertText( m_sOld, aIdx );
|
||
}
|
||
|
||
if( pHistory )
|
||
{
|
||
if( pNd->GetpSwpHints() )
|
||
pNd->ClearSwpHintsArr( true );
|
||
|
||
pHistory->TmpRollback( pDoc, m_nSetPos, false );
|
||
if ( m_nSetPos ) // there were footnotes/FlyFrames
|
||
{
|
||
// gibts ausser diesen noch andere ?
|
||
if( m_nSetPos < pHistory->Count() )
|
||
{
|
||
// dann sicher die Attribute anderen Attribute
|
||
SwHistory aHstr;
|
||
aHstr.Move( 0, pHistory, m_nSetPos );
|
||
pHistory->Rollback( pDoc );
|
||
pHistory->Move( 0, &aHstr );
|
||
}
|
||
else
|
||
{
|
||
pHistory->Rollback( pDoc );
|
||
DELETEZ( pHistory );
|
||
}
|
||
}
|
||
}
|
||
|
||
rPam.GetPoint()->nNode = m_nSttNd;
|
||
rPam.GetPoint()->nContent = aIdx;
|
||
}
|
||
|
||
void _UnReplaceData::Redo( SwUndoIter& rIter )
|
||
{
|
||
SwDoc& rDoc = rIter.GetDoc();
|
||
BOOL bUndo = rDoc.DoesUndo();
|
||
rDoc.DoUndo( FALSE );
|
||
|
||
SwPaM& rPam = *rIter.pAktPam;
|
||
rPam.DeleteMark();
|
||
rPam.GetPoint()->nNode = m_nSttNd;
|
||
|
||
SwTxtNode* pNd = rPam.GetPoint()->nNode.GetNode().GetTxtNode();
|
||
ASSERT( pNd, "Wo ist der TextNode geblieben?" )
|
||
rPam.GetPoint()->nContent.Assign( pNd, m_nSttCnt );
|
||
rPam.SetMark();
|
||
if( m_bSplitNext )
|
||
{
|
||
rPam.GetPoint()->nNode = m_nSttNd + 1;
|
||
pNd = rPam.GetPoint()->nNode.GetNode().GetTxtNode();
|
||
}
|
||
rPam.GetPoint()->nContent.Assign( pNd, m_nSelEnd );
|
||
|
||
if( pHistory )
|
||
{
|
||
SwHistory* pSave = pHistory;
|
||
SwHistory aHst;
|
||
pHistory = &aHst;
|
||
DelCntntIndex( *rPam.GetMark(), *rPam.GetPoint() );
|
||
m_nSetPos = pHistory->Count();
|
||
|
||
pHistory = pSave;
|
||
pHistory->Move( 0, &aHst );
|
||
}
|
||
else
|
||
{
|
||
pHistory = new SwHistory;
|
||
DelCntntIndex( *rPam.GetMark(), *rPam.GetPoint() );
|
||
m_nSetPos = pHistory->Count();
|
||
if( !m_nSetPos )
|
||
delete pHistory, pHistory = 0;
|
||
}
|
||
|
||
rDoc.ReplaceRange( rPam, m_sIns, m_bRegExp );
|
||
rPam.DeleteMark();
|
||
rDoc.DoUndo( bUndo );
|
||
}
|
||
|
||
void _UnReplaceData::SetEnd( const SwPaM& rPam )
|
||
{
|
||
if( rPam.GetPoint()->nNode != rPam.GetMark()->nNode )
|
||
{
|
||
// es wurden mehrere Absaetze eingefuegt
|
||
const SwPosition* pEnd = rPam.End();
|
||
m_nEndNd = m_nOffset + pEnd->nNode.GetIndex();
|
||
m_nEndCnt = pEnd->nContent.GetIndex();
|
||
}
|
||
}
|
||
|
||
/* */
|
||
|
||
|
||
SwUndoReRead::SwUndoReRead( const SwPaM& rPam, const SwGrfNode& rGrfNd )
|
||
: SwUndo( UNDO_REREAD ), nPos( rPam.GetPoint()->nNode.GetIndex() )
|
||
{
|
||
SaveGraphicData( rGrfNd );
|
||
}
|
||
|
||
|
||
SwUndoReRead::~SwUndoReRead()
|
||
{
|
||
delete pGrf;
|
||
delete pNm;
|
||
delete pFltr;
|
||
}
|
||
|
||
|
||
void SwUndoReRead::SetAndSave( SwUndoIter& rIter )
|
||
{
|
||
SwDoc& rDoc = rIter.GetDoc();
|
||
SwGrfNode* pGrfNd = rDoc.GetNodes()[ nPos ]->GetGrfNode();
|
||
|
||
if( !pGrfNd )
|
||
return ;
|
||
|
||
// die alten Werte zwischen speichern
|
||
Graphic* pOldGrf = pGrf;
|
||
String* pOldNm = pNm;
|
||
String* pOldFltr = pFltr;
|
||
USHORT nOldMirr = nMirr;
|
||
|
||
SaveGraphicData( *pGrfNd );
|
||
if( pOldNm )
|
||
{
|
||
pGrfNd->ReRead( *pOldNm, pFltr ? *pFltr : aEmptyStr, 0, 0, TRUE );
|
||
delete pOldNm;
|
||
delete pOldFltr;
|
||
}
|
||
else
|
||
{
|
||
pGrfNd->ReRead( aEmptyStr, aEmptyStr, pOldGrf, 0, TRUE );
|
||
delete pOldGrf;
|
||
}
|
||
|
||
if( RES_MIRROR_GRAPH_DONT != nOldMirr )
|
||
pGrfNd->SetAttr( SwMirrorGrf() );
|
||
|
||
rIter.pSelFmt = pGrfNd->GetFlyFmt();
|
||
}
|
||
|
||
|
||
void SwUndoReRead::Undo( SwUndoIter& rIter )
|
||
{
|
||
SetAndSave( rIter );
|
||
}
|
||
|
||
|
||
void SwUndoReRead::Redo( SwUndoIter& rIter )
|
||
{
|
||
SetAndSave( rIter );
|
||
}
|
||
|
||
|
||
void SwUndoReRead::SaveGraphicData( const SwGrfNode& rGrfNd )
|
||
{
|
||
if( rGrfNd.IsGrfLink() )
|
||
{
|
||
pNm = new String;
|
||
pFltr = new String;
|
||
rGrfNd.GetFileFilterNms( pNm, pFltr );
|
||
pGrf = 0;
|
||
}
|
||
else
|
||
{
|
||
((SwGrfNode&)rGrfNd).SwapIn( TRUE );
|
||
pGrf = new Graphic( rGrfNd.GetGrf() );
|
||
pNm = pFltr = 0;
|
||
}
|
||
nMirr = rGrfNd.GetSwAttrSet().GetMirrorGrf().GetValue();
|
||
}
|
||
|
||
/* */
|
||
|
||
SwUndoInsertLabel::SwUndoInsertLabel( const SwLabelType eTyp,
|
||
const String &rTxt,
|
||
const String& rSeparator,
|
||
const String& rNumberSeparator,
|
||
const BOOL bBef,
|
||
const USHORT nInitId,
|
||
const String& rCharacterStyle,
|
||
const BOOL bCpyBorder )
|
||
: SwUndo( UNDO_INSERTLABEL ),
|
||
sText( rTxt ),
|
||
sSeparator( rSeparator ),
|
||
sNumberSeparator( rNumberSeparator ),//#i61007# order of captions
|
||
sCharacterStyle( rCharacterStyle ),
|
||
nFldId( nInitId ),
|
||
eType( eTyp ),
|
||
nLayerId( 0 ),
|
||
bBefore( bBef ),
|
||
bCpyBrd( bCpyBorder )
|
||
{
|
||
bUndoKeep = FALSE;
|
||
OBJECT.pUndoFly = 0;
|
||
OBJECT.pUndoAttr = 0;
|
||
}
|
||
|
||
SwUndoInsertLabel::~SwUndoInsertLabel()
|
||
{
|
||
if( LTYPE_OBJECT == eType || LTYPE_DRAW == eType )
|
||
{
|
||
delete OBJECT.pUndoFly;
|
||
delete OBJECT.pUndoAttr;
|
||
}
|
||
else
|
||
delete NODE.pUndoInsNd;
|
||
}
|
||
|
||
void SwUndoInsertLabel::Undo( SwUndoIter& rIter )
|
||
{
|
||
SwDoc& rDoc = rIter.GetDoc();
|
||
|
||
if( LTYPE_OBJECT == eType || LTYPE_DRAW == eType )
|
||
{
|
||
ASSERT( OBJECT.pUndoAttr && OBJECT.pUndoFly, "Pointer nicht initialisiert" )
|
||
SwFrmFmt* pFmt;
|
||
SdrObject *pSdrObj = 0;
|
||
if( OBJECT.pUndoAttr &&
|
||
0 != (pFmt = (SwFrmFmt*)OBJECT.pUndoAttr->GetFmt( rDoc )) &&
|
||
( LTYPE_DRAW != eType ||
|
||
0 != (pSdrObj = pFmt->FindSdrObject()) ) )
|
||
{
|
||
OBJECT.pUndoAttr->Undo( rIter );
|
||
OBJECT.pUndoFly->Undo( rIter );
|
||
if( LTYPE_DRAW == eType )
|
||
{
|
||
pSdrObj->SetLayer( nLayerId );
|
||
}
|
||
}
|
||
}
|
||
else if( NODE.nNode )
|
||
{
|
||
if ( eType == LTYPE_TABLE && bUndoKeep )
|
||
{
|
||
SwTableNode *pNd = rDoc.GetNodes()[
|
||
rDoc.GetNodes()[NODE.nNode-1]->StartOfSectionIndex()]->GetTableNode();
|
||
if ( pNd )
|
||
pNd->GetTable().GetFrmFmt()->ResetFmtAttr( RES_KEEP );
|
||
}
|
||
SwPaM aPam( *rIter.pAktPam->GetPoint() );
|
||
aPam.GetPoint()->nNode = NODE.nNode;
|
||
aPam.SetMark();
|
||
aPam.GetPoint()->nNode = NODE.nNode + 1;
|
||
NODE.pUndoInsNd = new SwUndoDelete( aPam, TRUE );
|
||
}
|
||
}
|
||
|
||
|
||
void SwUndoInsertLabel::Redo( SwUndoIter& rIter )
|
||
{
|
||
SwDoc& rDoc = rIter.GetDoc();
|
||
|
||
if( LTYPE_OBJECT == eType || LTYPE_DRAW == eType )
|
||
{
|
||
ASSERT( OBJECT.pUndoAttr && OBJECT.pUndoFly, "Pointer nicht initialisiert" )
|
||
SwFrmFmt* pFmt;
|
||
SdrObject *pSdrObj = 0;
|
||
if( OBJECT.pUndoAttr &&
|
||
0 != (pFmt = (SwFrmFmt*)OBJECT.pUndoAttr->GetFmt( rDoc )) &&
|
||
( LTYPE_DRAW != eType ||
|
||
0 != (pSdrObj = pFmt->FindSdrObject()) ) )
|
||
{
|
||
OBJECT.pUndoFly->Redo( rIter );
|
||
OBJECT.pUndoAttr->Redo( rIter );
|
||
if( LTYPE_DRAW == eType )
|
||
{
|
||
pSdrObj->SetLayer( nLayerId );
|
||
if( pSdrObj->GetLayer() == rDoc.GetHellId() )
|
||
pSdrObj->SetLayer( rDoc.GetHeavenId() );
|
||
// OD 02.07.2003 #108784#
|
||
else if( pSdrObj->GetLayer() == rDoc.GetInvisibleHellId() )
|
||
pSdrObj->SetLayer( rDoc.GetInvisibleHeavenId() );
|
||
}
|
||
}
|
||
}
|
||
else if( NODE.pUndoInsNd )
|
||
{
|
||
if ( eType == LTYPE_TABLE && bUndoKeep )
|
||
{
|
||
SwTableNode *pNd = rDoc.GetNodes()[
|
||
rDoc.GetNodes()[NODE.nNode-1]->StartOfSectionIndex()]->GetTableNode();
|
||
if ( pNd )
|
||
pNd->GetTable().GetFrmFmt()->SetFmtAttr( SvxFmtKeepItem(TRUE, RES_KEEP) );
|
||
}
|
||
NODE.pUndoInsNd->Undo( rIter );
|
||
delete NODE.pUndoInsNd, NODE.pUndoInsNd = 0;
|
||
}
|
||
}
|
||
|
||
void SwUndoInsertLabel::Repeat( SwUndoIter& rIter )
|
||
{
|
||
SwDoc& rDoc = rIter.GetDoc();
|
||
const SwPosition& rPos = *rIter.pAktPam->GetPoint();
|
||
|
||
ULONG nIdx = 0;
|
||
|
||
SwCntntNode* pCNd = rPos.nNode.GetNode().GetCntntNode();
|
||
if( pCNd )
|
||
switch( eType )
|
||
{
|
||
case LTYPE_TABLE:
|
||
{
|
||
const SwTableNode* pTNd = pCNd->FindTableNode();
|
||
if( pTNd )
|
||
nIdx = pTNd->GetIndex();
|
||
}
|
||
break;
|
||
|
||
case LTYPE_FLY:
|
||
case LTYPE_OBJECT:
|
||
{
|
||
SwFlyFrm* pFly;
|
||
SwCntntFrm *pCnt = pCNd->GetFrm();
|
||
if( pCnt && 0 != ( pFly = pCnt->FindFlyFrm() ) )
|
||
nIdx = pFly->GetFmt()->GetCntnt().GetCntntIdx()->GetIndex();
|
||
}
|
||
break;
|
||
case LTYPE_DRAW:
|
||
break;
|
||
}
|
||
|
||
if( nIdx )
|
||
{
|
||
rDoc.InsertLabel( eType, sText, sSeparator, sNumberSeparator, bBefore,
|
||
nFldId, nIdx, sCharacterStyle, bCpyBrd );
|
||
}
|
||
}
|
||
|
||
// #111827#
|
||
SwRewriter SwUndoInsertLabel::GetRewriter() const
|
||
{
|
||
SwRewriter aRewriter;
|
||
|
||
String aTmpStr;
|
||
|
||
aTmpStr += String(SW_RES(STR_START_QUOTE));
|
||
aTmpStr += ShortenString(sText, nUndoStringLength,
|
||
String(SW_RES(STR_LDOTS)));
|
||
aTmpStr += String(SW_RES(STR_END_QUOTE));
|
||
|
||
aRewriter.AddRule(UNDO_ARG1, aTmpStr);
|
||
|
||
return aRewriter;
|
||
}
|
||
|
||
void SwUndoInsertLabel::SetFlys( SwFrmFmt& rOldFly, SfxItemSet& rChgSet,
|
||
SwFrmFmt& rNewFly )
|
||
{
|
||
if( LTYPE_OBJECT == eType || LTYPE_DRAW == eType )
|
||
{
|
||
SwUndoFmtAttrHelper aTmp( rOldFly, false );
|
||
rOldFly.SetFmtAttr( rChgSet );
|
||
if ( aTmp.GetUndo() )
|
||
{
|
||
OBJECT.pUndoAttr = aTmp.ReleaseUndo();
|
||
}
|
||
OBJECT.pUndoFly = new SwUndoInsLayFmt( &rNewFly,0,0 );
|
||
}
|
||
}
|
||
|
||
void SwUndoInsertLabel::SetDrawObj( BYTE nLId )
|
||
{
|
||
if( LTYPE_DRAW == eType )
|
||
{
|
||
nLayerId = nLId;
|
||
}
|
||
}
|
||
|