Files
libreoffice/sw/source/core/docnode/ndcopy.cxx

1445 lines
53 KiB
C++
Raw Normal View History

2000-09-18 23:08:29 +00:00
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
2000-09-18 23:08:29 +00:00
*
* Copyright 2008 by Sun Microsystems, Inc.
2000-09-18 23:08:29 +00:00
*
* OpenOffice.org - a multi-platform office productivity suite
2000-09-18 23:08:29 +00:00
*
* $RCSfile: ndcopy.cxx,v $
* $Revision: 1.34.74.1 $
2000-09-18 23:08:29 +00:00
*
* This file is part of OpenOffice.org.
2000-09-18 23:08:29 +00:00
*
* 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.
2000-09-18 23:08:29 +00:00
*
* 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).
2000-09-18 23:08:29 +00:00
*
* 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.
2000-09-18 23:08:29 +00:00
*
************************************************************************/
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_sw.hxx"
2000-09-18 23:08:29 +00:00
#define _ZFORLIST_DECLARE_TABLE
#include <hintids.hxx>
#include <svx/brkitem.hxx>
#include <fmtpdsc.hxx>
#include <fmtanchr.hxx>
#include <fmtcntnt.hxx>
#include <doc.hxx>
#include <pam.hxx>
#include <ndtxt.hxx>
#include <fldbas.hxx>
#include <swtable.hxx>
#include <ddefld.hxx>
#include <undobj.hxx>
CWS-TOOLING: integrate CWS swrefactormarks2 2009-04-09 12:51:41 +0200 b_michaelsen r270689 : #i94949# cleaned up assertions after rebasing 2009-04-08 17:37:08 +0200 b_michaelsen r270658 : fixing sw/source/ui/utlui/makefile.mk 2009-04-07 17:56:54 +0200 b_michaelsen r270606 : added bookctrl.cxx to EXCEPTIONFILES, because this is needed for stl on unxsols4 2009-04-07 17:05:20 +0200 b_michaelsen r270603 : added crbm.cxx to EXCEPTIONFILES, because this is needed for stl on unxsols4 2009-04-02 23:44:38 +0200 b_michaelsen r270436 : CWS-TOOLING: rebase CWS swrefactormarks2 to trunk@270033 (milestone: DEV300:m45) 2009-02-27 16:25:31 +0100 b_michaelsen r268606 : #i94949# fixed Windows buildbreaker 2009-02-25 18:01:13 +0100 b_michaelsen r268464 : #i94949# Bookmarktest document filter roundtrips 2009-02-24 18:23:55 +0100 b_michaelsen r268404 : #i94949# Bookmark unittests 2009-02-23 19:47:44 +0100 b_michaelsen r268370 : #i94949# added unittest for bookmarks 2009-02-23 12:22:07 +0100 b_michaelsen r268348 : #i94949# fixing CheckCrossReferences testcase 2009-02-20 18:12:50 +0100 b_michaelsen r268335 : #i94949# fixing SwXTextRange 2009-02-18 18:32:57 +0100 b_michaelsen r268252 : #i94949# deregistering DdeBookmarks on delete 2009-02-18 18:29:08 +0100 b_michaelsen r268251 : fixing dbgoutsw.cxx for debug builds 2009-02-16 18:42:43 +0100 b_michaelsen r267834 : CWS-TOOLING: rebase CWS swrefactormarks2 to trunk@267171 (milestone: DEV300:m41) 2009-02-12 15:32:02 +0100 b_michaelsen r267667 : #i94949 fixed crossrefbookmark naming 2009-02-11 18:30:08 +0100 b_michaelsen r267624 : #94949# fixing bookmark navigation 2009-02-11 13:55:26 +0100 b_michaelsen r267599 : #i94949# fixed bookmark naming 2009-02-10 17:53:05 +0100 b_michaelsen r267571 : #i94949# renamed HasOtherMarkPos to IsExpanded 2009-02-10 17:23:01 +0100 b_michaelsen r267564 : #i94949# renamed ::sw::bookmark namespace to more fitting ::sw::mark 2009-02-10 16:16:32 +0100 b_michaelsen r267553 : #i94949# creating only CrossRefBookmark per Txtnode 2009-02-10 12:14:05 +0100 b_michaelsen r267547 : #i94949# fixed bookmark count in navigator 2009-02-09 19:12:18 +0100 b_michaelsen r267532 : #i94949# lcl_CopyBookmarks(..) - handle marks on boundaries correctly 2009-02-09 17:32:45 +0100 b_michaelsen r267524 : #i94949# setting the refobject of the DdeBookmark in Sin SwServerObject::SetDdeBookmark(..) 2009-02-09 17:22:15 +0100 b_michaelsen r267523 : #i94949# trying to harden SwServerObject 2009-02-09 16:47:32 +0100 b_michaelsen r267521 : #i94949# lcl_CopyBookmarks(..): try to get the source mark name, if possible 2009-02-09 16:05:42 +0100 b_michaelsen r267519 : #i94949# clearing the OtherMarkPos if PaM has no mark in repositionMark(..), swapping inverted bookmarks without hissing an assertion 2009-02-09 15:55:38 +0100 b_michaelsen r267518 : #i94949# checking for out-of-bounds in SwView::ExecuteStatusLine(..) 2009-02-09 15:23:47 +0100 b_michaelsen r267517 : #i94949# using an UNO_BOOKMARK in ui/dbui/dbinsdlg.cxx 2009-02-09 14:14:47 +0100 b_michaelsen r267514 : #i94949# IDocumentMarkAccess::GetType(..) asserts on unknown type 2009-02-09 14:04:25 +0100 b_michaelsen r267513 : #i94949# using rtl strings instead of tools-strings in CrossRefBookmarks 2009-02-09 13:55:01 +0100 b_michaelsen r267510 : #i94949# using empty string for UnoMark construction 2009-02-09 13:46:46 +0100 b_michaelsen r267509 : #i94949# removed superfluous #includes, removed superfluous member DdeBookmark::bGenerateName, initialized DdeBookmark::m_aRefObj removed superfluous local _FindItem::ClearObj 2009-02-06 14:38:37 +0100 b_michaelsen r267462 : #i94949# fixing FN_STAT_BOOKMARK dispatches 2009-02-05 18:05:07 +0100 b_michaelsen r267436 : #i94949# removing superfluous #includes 2009-02-04 15:51:31 +0100 b_michaelsen r267391 : fixing resync merge error 2009-02-02 19:39:55 +0100 b_michaelsen r267294 : #i94949# bookmark performance 2009-01-30 19:30:51 +0100 b_michaelsen r267229 : #i94949# throwing IllegalArgumentException, if appropriate 2009-01-30 19:29:56 +0100 b_michaelsen r267228 : #i94949# refactored lcl_FillBookmarkArray, comments, constness 2009-01-30 19:23:49 +0100 b_michaelsen r267227 : #i94949# refactored lcl_FillBookmarkArray, comments, constness 2009-01-30 19:16:06 +0100 b_michaelsen r267226 : #i94949# refactored lcl_FillBookmarkArray 2009-01-30 17:59:27 +0100 b_michaelsen r267222 : #i94949# removed superficial #include 2009-01-30 17:50:02 +0100 b_michaelsen r267220 : #i94949# SwXTextRange remembers its UNO bookmark 2009-01-29 20:19:58 +0100 b_michaelsen r267168 : #i94949# implemented IDocumentMarkAccess::findBookmark 2009-01-29 17:22:17 +0100 b_michaelsen r267162 : #i94949# implemented renameMark in Markmanager 2009-01-29 14:17:10 +0100 b_michaelsen r267134 : #i94949# cleanup in SwXBookmark, whitespace 2009-01-29 13:21:54 +0100 b_michaelsen r267125 : #i94949# cleanup in SwXBookmark, whitespace 2009-01-29 13:06:10 +0100 b_michaelsen r267120 : #i94949# cleanup in SwXBookmark, whitespace 2009-01-29 13:00:09 +0100 b_michaelsen r267118 : #i94949# cleanup in SwXBookmark, whitespace 2009-01-29 10:35:10 +0100 b_michaelsen r267101 : #i94949# renamed SetCrsrToBkmk to SetCrsrToMark, moving to start/end of doc if no more bookmarks can be found 2009-01-28 17:05:36 +0100 b_michaelsen r267070 : #i94949# fixed order in aProvNamesId in unocoll.cxx 2009-01-28 15:46:13 +0100 b_michaelsen r267063 : #i94949# documentation 2009-01-28 15:36:59 +0100 b_michaelsen r267062 : #i94949# removing superficial #include 2009-01-28 15:30:36 +0100 b_michaelsen r267061 : #i94949# basic code conventions 2009-01-28 11:14:30 +0100 b_michaelsen r267039 : #i94949# comparing to the actual name of the new mark 2009-01-26 15:22:25 +0100 b_michaelsen r266927 : #i94949# performance fixes 2009-01-14 21:16:56 +0100 b_michaelsen r266332 : #i94949# fixing linux x86-64 compiler warnings 2009-01-14 19:52:06 +0100 b_michaelsen r266331 : #i94949# fixing some compiler warnings 2008-12-15 13:04:49 +0100 b_michaelsen r265474 : #i94949# fixed microsoft compiler warnings 2008-12-12 18:26:02 +0100 b_michaelsen r265434 : #i94949# fixed pro platform buildbreakers 2008-12-11 17:51:24 +0100 b_michaelsen r265342 : CWS-TOOLING: rebase CWS swrefactormarks2 to trunk@264807 (milestone: DEV300:m37) 2008-12-09 18:30:59 +0100 b_michaelsen r265134 : #i94949# fixed IDocumentMarkAccess::GetType for new mark inheritance tree 2008-12-09 16:56:26 +0100 b_michaelsen r265118 : #i94949# fixed deleteMark optimization 2008-12-09 14:55:58 +0100 b_michaelsen r265092 : #i94949# DdeLink and DdeBookmark 2008-12-05 18:28:05 +0100 b_michaelsen r264914 : #i94949# fixed InitDoc in bookmarks 2008-12-02 02:23:51 +0100 b_michaelsen r264649 : #i94949# removed obsolete naming proposal code in SwXTextRange, fixed navigator reminders to forget the oldest reminder when the pool is empty 2008-12-02 02:05:19 +0100 b_michaelsen r264648 : #i94949# using bisect search for delete 2008-12-02 01:58:16 +0100 b_michaelsen r264647 : #i94949# using bisect search for delete 2008-12-02 01:37:33 +0100 b_michaelsen r264646 : #i94949# using bisect search for delete 2008-12-02 01:03:29 +0100 b_michaelsen r264645 : #i94949# fixed deleteMark crash 2008-12-01 20:55:00 +0100 b_michaelsen r264638 : #i94949# removed crossrefs from ui enumerations 2008-12-01 15:48:12 +0100 b_michaelsen r264613 : #i94949# removed superfluous local functions 2008-12-01 15:01:19 +0100 b_michaelsen r264608 : #i94949# optimized insertion of new marks 2008-12-01 14:33:21 +0100 b_michaelsen r264603 : #i94949# simplified code finding Fieldmark for a position 2008-12-01 14:05:55 +0100 b_michaelsen r264598 : #i94949# fixed reverse travelling through marks, removed obsolete getUniqueMarkName() 2008-11-27 18:48:15 +0100 b_michaelsen r264515 : #i94949# fixed _SaveCntntIdx and friends 2008-11-27 15:59:49 +0100 b_michaelsen r264500 : #i94949# fix Mark position only in ctor 2008-11-27 15:52:28 +0100 b_michaelsen r264497 : #i94949# fixed Bug in SwXBookmark, was using pDoc too early 2008-11-26 14:54:22 +0100 b_michaelsen r264396 : #i94949# fixed documentation, simplified navigator reminder code 2008-11-24 20:45:51 +0100 b_michaelsen r264266 : #i94949# removed last obsolete getUniqueMarkName calls 2008-11-24 20:21:35 +0100 b_michaelsen r264265 : #i94949# fixed typo in IDocumentMarkAccess, removed obsolete getUniqueMarkName calls 2008-11-24 18:34:32 +0100 b_michaelsen r264264 : #i94949# repositioning of Marks, removed possibility to delete marks by name in the core, refactoring of navigator reminder generation 2008-11-21 14:08:49 +0100 b_michaelsen r264137 : #i94949# simplified makeMark 2008-11-21 12:07:09 +0100 b_michaelsen r264120 : #i94949# moved ShortName and KeyCode from IMark to IBookmark 2008-11-19 12:50:49 +0100 b_michaelsen r263981 : #i94949# starting refactoring of bookmark naming 2008-11-19 11:31:08 +0100 b_michaelsen r263972 : #i94949# getting rid of obsolete dynamic casts 2008-11-18 19:06:09 +0100 b_michaelsen r263795 : #i94949# getting rid of index based mark access, IDocumentMarkAccess already provides iterators 2008-11-18 17:50:18 +0100 b_michaelsen r263792 : #i94949# getting rid of index based mark access, IDocumentMarkAccess already provides iterators 2008-11-18 16:48:20 +0100 b_michaelsen r263783 : #i94949# removed methods from crsrsh which are already available directly via IDocumentMarkAccess 2008-11-18 11:31:35 +0100 b_michaelsen r263753 : #i94949# cleaning up mark code in crsrsh 2008-11-17 10:15:25 +0100 b_michaelsen r263705 : #i94949# removed possible integer overflow 2008-11-14 18:48:45 +0100 b_michaelsen r263695 : #i94949# management of mark names in MarkManager 2008-11-14 18:23:40 +0100 b_michaelsen r263693 : #i94949# using polymorphism to do mark-specific setup in SwDoc 2008-11-14 16:27:09 +0100 b_michaelsen r263684 : #i94949# got rid of makeCrossRefBookmark 2008-11-14 13:03:32 +0100 b_michaelsen r263674 : #i94949# refactored Correction methods 2008-11-13 12:27:55 +0100 b_michaelsen r263631 : #i94949# got rid of old-style tools assertions in new code 2008-11-12 16:58:16 +0100 b_michaelsen r263608 : #i94949# added assertion for unique names 2008-11-12 16:55:18 +0100 b_michaelsen r263607 : #i94949# maked XFormField deprecated 2008-11-12 13:04:29 +0100 b_michaelsen r263587 : #i94949# replaced IDocumentMarkAccess::GetType with simple dynamic_cast where possible 2008-11-11 18:45:53 +0100 b_michaelsen r263572 : #i94949# cleaned up SwHstryBookmark 2008-11-11 13:48:18 +0100 b_michaelsen r263557 : #i94949# removed dynamic_casts to SwModify by inheriting IMark from it 2008-11-11 11:26:28 +0100 b_michaelsen r263548 : #i94949# fixed SwXBookmark 2008-11-10 17:01:19 +0100 b_michaelsen r263529 : #i94949# fixed DdeBookmarks in clipboard 2008-11-10 16:44:52 +0100 b_michaelsen r263527 : #i94949# formatting 2008-11-10 16:29:16 +0100 b_michaelsen r263526 : #i94949# fixing unoobj.cxx 2008-11-10 16:23:50 +0100 b_michaelsen r263525 : #i94949# cleaning up crossrefbookmark.cxx/.hxx 2008-11-10 16:02:08 +0100 b_michaelsen r263524 : #i94949# Pdf Export should only generate 'real' bookmarks 2008-11-10 15:33:58 +0100 b_michaelsen r263521 : #i94949# removed const_casts 2008-11-10 15:12:06 +0100 b_michaelsen r263520 : #i94949# moved _DelBookmarks into MarksManager 2008-11-07 18:48:38 +0100 b_michaelsen r263480 : #i94949# using iterator interface 2008-11-07 18:41:46 +0100 b_michaelsen r263478 : #i94949# using iterator interface 2008-11-07 18:07:41 +0100 b_michaelsen r263477 : #i94949# using iterator interface 2008-11-07 17:54:41 +0100 b_michaelsen r263476 : #i94949# using iterator interface 2008-11-07 17:44:41 +0100 b_michaelsen r263475 : #i94949# moved correction methods into MarkManager 2008-11-06 18:47:28 +0100 b_michaelsen r263404 : #i94949# getting rid of superfluous const_casts 2008-11-06 17:58:01 +0100 b_michaelsen r263403 : #i94949# no more setting of mark positions outside of the core 2008-11-06 17:08:37 +0100 b_michaelsen r263401 : #i94949# removed setters from IMark 2008-11-06 13:55:25 +0100 b_michaelsen r263383 : #i94949 SwDoc does not implement IDocumentMarkAccess anymore 2008-11-04 18:17:03 +0100 b_michaelsen r263333 : #i94949# began removing IDocumentMarkAccess from SwDoc 2008-11-04 16:48:34 +0100 b_michaelsen r263330 : removing dead code (SwBitArray) found by mst 2008-11-04 16:29:32 +0100 b_michaelsen r263329 : removing dead code (SwBitArray) found by mst 2008-11-04 14:57:48 +0100 b_michaelsen r263326 : removing dead code (SwBitArray) found by mst 2008-11-04 14:50:18 +0100 b_michaelsen r263325 : #i94949# stricter typing in IDocumentMarkAccess 2008-10-24 15:16:27 +0200 b_michaelsen r262647 : #i94949# renamed ::sw::bookmark::SimpleMark to NavigatorReminder to fit the IDocumentMarkAccess enum 2008-10-24 15:10:10 +0200 b_michaelsen r262646 : #i94949# only 'real' bookmark implement IBookmark, Marks also get removed from m_vFieldmarks on delete/clear 2008-10-24 13:06:23 +0200 b_michaelsen r262636 : #i94949# Fieldmark tabnavigation 2008-10-23 12:16:36 +0200 b_michaelsen r262619 : #i94949# Fieldmark classes and filters 2008-10-22 13:17:18 +0200 b_michaelsen r262597 : #i94949# writer import fixes 2008-10-21 11:30:38 +0200 b_michaelsen r262565 : #i94949# renamed methods containing Bookmark in the generic IMark interface 2008-10-20 14:09:02 +0200 b_michaelsen r262318 : #i94949# fixed SwDoc::CorrRel 2008-10-16 22:45:13 +0200 b_michaelsen r262273 : #i94949 simplified Before/After methods 2008-10-16 21:40:57 +0200 b_michaelsen r262271 : #i94949 renamed SimpleMark to NavigatorReminder 2008-10-16 21:15:23 +0200 b_michaelsen r262270 : #i94949 using shared_ptr only in MarkManager 2008-10-16 17:46:37 +0200 b_michaelsen r262269 : #i94949# getFieldmarkBefore and getFieldmarkAfter 2008-10-16 17:12:13 +0200 b_michaelsen r262265 : #i94949# cleanup in crbm.cxx 2008-10-16 12:49:01 +0200 b_michaelsen r262257 : #i94949# fixed usage of invalid iterator, fixed invalid cast 2008-10-15 15:34:20 +0200 b_michaelsen r262239 : #i94949# added moved files 2008-10-15 15:26:45 +0200 b_michaelsen r262237 : #i94949# initial reimplementation of Bookmarks
2009-04-21 15:40:02 +00:00
#include <IMark.hxx>
2000-09-18 23:08:29 +00:00
#include <mvsave.hxx>
#include <cellatr.hxx>
#include <swtblfmt.hxx>
#include <swddetbl.hxx>
#include <docary.hxx>
#include <fmtcnct.hxx>
#include <redline.hxx>
#include <paratr.hxx>
#include <pagedesc.hxx>
#include <poolfmt.hxx>
#include <SwNodeNum.hxx>
#ifdef PRODUCT
#define CHECK_TABLE(t)
#else
#ifdef DEBUG
#define CHECK_TABLE(t) (t).CheckConsistency();
#else
#define CHECK_TABLE(t)
#endif
#endif
CWS-TOOLING: integrate CWS swrefactormarks2 2009-04-09 12:51:41 +0200 b_michaelsen r270689 : #i94949# cleaned up assertions after rebasing 2009-04-08 17:37:08 +0200 b_michaelsen r270658 : fixing sw/source/ui/utlui/makefile.mk 2009-04-07 17:56:54 +0200 b_michaelsen r270606 : added bookctrl.cxx to EXCEPTIONFILES, because this is needed for stl on unxsols4 2009-04-07 17:05:20 +0200 b_michaelsen r270603 : added crbm.cxx to EXCEPTIONFILES, because this is needed for stl on unxsols4 2009-04-02 23:44:38 +0200 b_michaelsen r270436 : CWS-TOOLING: rebase CWS swrefactormarks2 to trunk@270033 (milestone: DEV300:m45) 2009-02-27 16:25:31 +0100 b_michaelsen r268606 : #i94949# fixed Windows buildbreaker 2009-02-25 18:01:13 +0100 b_michaelsen r268464 : #i94949# Bookmarktest document filter roundtrips 2009-02-24 18:23:55 +0100 b_michaelsen r268404 : #i94949# Bookmark unittests 2009-02-23 19:47:44 +0100 b_michaelsen r268370 : #i94949# added unittest for bookmarks 2009-02-23 12:22:07 +0100 b_michaelsen r268348 : #i94949# fixing CheckCrossReferences testcase 2009-02-20 18:12:50 +0100 b_michaelsen r268335 : #i94949# fixing SwXTextRange 2009-02-18 18:32:57 +0100 b_michaelsen r268252 : #i94949# deregistering DdeBookmarks on delete 2009-02-18 18:29:08 +0100 b_michaelsen r268251 : fixing dbgoutsw.cxx for debug builds 2009-02-16 18:42:43 +0100 b_michaelsen r267834 : CWS-TOOLING: rebase CWS swrefactormarks2 to trunk@267171 (milestone: DEV300:m41) 2009-02-12 15:32:02 +0100 b_michaelsen r267667 : #i94949 fixed crossrefbookmark naming 2009-02-11 18:30:08 +0100 b_michaelsen r267624 : #94949# fixing bookmark navigation 2009-02-11 13:55:26 +0100 b_michaelsen r267599 : #i94949# fixed bookmark naming 2009-02-10 17:53:05 +0100 b_michaelsen r267571 : #i94949# renamed HasOtherMarkPos to IsExpanded 2009-02-10 17:23:01 +0100 b_michaelsen r267564 : #i94949# renamed ::sw::bookmark namespace to more fitting ::sw::mark 2009-02-10 16:16:32 +0100 b_michaelsen r267553 : #i94949# creating only CrossRefBookmark per Txtnode 2009-02-10 12:14:05 +0100 b_michaelsen r267547 : #i94949# fixed bookmark count in navigator 2009-02-09 19:12:18 +0100 b_michaelsen r267532 : #i94949# lcl_CopyBookmarks(..) - handle marks on boundaries correctly 2009-02-09 17:32:45 +0100 b_michaelsen r267524 : #i94949# setting the refobject of the DdeBookmark in Sin SwServerObject::SetDdeBookmark(..) 2009-02-09 17:22:15 +0100 b_michaelsen r267523 : #i94949# trying to harden SwServerObject 2009-02-09 16:47:32 +0100 b_michaelsen r267521 : #i94949# lcl_CopyBookmarks(..): try to get the source mark name, if possible 2009-02-09 16:05:42 +0100 b_michaelsen r267519 : #i94949# clearing the OtherMarkPos if PaM has no mark in repositionMark(..), swapping inverted bookmarks without hissing an assertion 2009-02-09 15:55:38 +0100 b_michaelsen r267518 : #i94949# checking for out-of-bounds in SwView::ExecuteStatusLine(..) 2009-02-09 15:23:47 +0100 b_michaelsen r267517 : #i94949# using an UNO_BOOKMARK in ui/dbui/dbinsdlg.cxx 2009-02-09 14:14:47 +0100 b_michaelsen r267514 : #i94949# IDocumentMarkAccess::GetType(..) asserts on unknown type 2009-02-09 14:04:25 +0100 b_michaelsen r267513 : #i94949# using rtl strings instead of tools-strings in CrossRefBookmarks 2009-02-09 13:55:01 +0100 b_michaelsen r267510 : #i94949# using empty string for UnoMark construction 2009-02-09 13:46:46 +0100 b_michaelsen r267509 : #i94949# removed superfluous #includes, removed superfluous member DdeBookmark::bGenerateName, initialized DdeBookmark::m_aRefObj removed superfluous local _FindItem::ClearObj 2009-02-06 14:38:37 +0100 b_michaelsen r267462 : #i94949# fixing FN_STAT_BOOKMARK dispatches 2009-02-05 18:05:07 +0100 b_michaelsen r267436 : #i94949# removing superfluous #includes 2009-02-04 15:51:31 +0100 b_michaelsen r267391 : fixing resync merge error 2009-02-02 19:39:55 +0100 b_michaelsen r267294 : #i94949# bookmark performance 2009-01-30 19:30:51 +0100 b_michaelsen r267229 : #i94949# throwing IllegalArgumentException, if appropriate 2009-01-30 19:29:56 +0100 b_michaelsen r267228 : #i94949# refactored lcl_FillBookmarkArray, comments, constness 2009-01-30 19:23:49 +0100 b_michaelsen r267227 : #i94949# refactored lcl_FillBookmarkArray, comments, constness 2009-01-30 19:16:06 +0100 b_michaelsen r267226 : #i94949# refactored lcl_FillBookmarkArray 2009-01-30 17:59:27 +0100 b_michaelsen r267222 : #i94949# removed superficial #include 2009-01-30 17:50:02 +0100 b_michaelsen r267220 : #i94949# SwXTextRange remembers its UNO bookmark 2009-01-29 20:19:58 +0100 b_michaelsen r267168 : #i94949# implemented IDocumentMarkAccess::findBookmark 2009-01-29 17:22:17 +0100 b_michaelsen r267162 : #i94949# implemented renameMark in Markmanager 2009-01-29 14:17:10 +0100 b_michaelsen r267134 : #i94949# cleanup in SwXBookmark, whitespace 2009-01-29 13:21:54 +0100 b_michaelsen r267125 : #i94949# cleanup in SwXBookmark, whitespace 2009-01-29 13:06:10 +0100 b_michaelsen r267120 : #i94949# cleanup in SwXBookmark, whitespace 2009-01-29 13:00:09 +0100 b_michaelsen r267118 : #i94949# cleanup in SwXBookmark, whitespace 2009-01-29 10:35:10 +0100 b_michaelsen r267101 : #i94949# renamed SetCrsrToBkmk to SetCrsrToMark, moving to start/end of doc if no more bookmarks can be found 2009-01-28 17:05:36 +0100 b_michaelsen r267070 : #i94949# fixed order in aProvNamesId in unocoll.cxx 2009-01-28 15:46:13 +0100 b_michaelsen r267063 : #i94949# documentation 2009-01-28 15:36:59 +0100 b_michaelsen r267062 : #i94949# removing superficial #include 2009-01-28 15:30:36 +0100 b_michaelsen r267061 : #i94949# basic code conventions 2009-01-28 11:14:30 +0100 b_michaelsen r267039 : #i94949# comparing to the actual name of the new mark 2009-01-26 15:22:25 +0100 b_michaelsen r266927 : #i94949# performance fixes 2009-01-14 21:16:56 +0100 b_michaelsen r266332 : #i94949# fixing linux x86-64 compiler warnings 2009-01-14 19:52:06 +0100 b_michaelsen r266331 : #i94949# fixing some compiler warnings 2008-12-15 13:04:49 +0100 b_michaelsen r265474 : #i94949# fixed microsoft compiler warnings 2008-12-12 18:26:02 +0100 b_michaelsen r265434 : #i94949# fixed pro platform buildbreakers 2008-12-11 17:51:24 +0100 b_michaelsen r265342 : CWS-TOOLING: rebase CWS swrefactormarks2 to trunk@264807 (milestone: DEV300:m37) 2008-12-09 18:30:59 +0100 b_michaelsen r265134 : #i94949# fixed IDocumentMarkAccess::GetType for new mark inheritance tree 2008-12-09 16:56:26 +0100 b_michaelsen r265118 : #i94949# fixed deleteMark optimization 2008-12-09 14:55:58 +0100 b_michaelsen r265092 : #i94949# DdeLink and DdeBookmark 2008-12-05 18:28:05 +0100 b_michaelsen r264914 : #i94949# fixed InitDoc in bookmarks 2008-12-02 02:23:51 +0100 b_michaelsen r264649 : #i94949# removed obsolete naming proposal code in SwXTextRange, fixed navigator reminders to forget the oldest reminder when the pool is empty 2008-12-02 02:05:19 +0100 b_michaelsen r264648 : #i94949# using bisect search for delete 2008-12-02 01:58:16 +0100 b_michaelsen r264647 : #i94949# using bisect search for delete 2008-12-02 01:37:33 +0100 b_michaelsen r264646 : #i94949# using bisect search for delete 2008-12-02 01:03:29 +0100 b_michaelsen r264645 : #i94949# fixed deleteMark crash 2008-12-01 20:55:00 +0100 b_michaelsen r264638 : #i94949# removed crossrefs from ui enumerations 2008-12-01 15:48:12 +0100 b_michaelsen r264613 : #i94949# removed superfluous local functions 2008-12-01 15:01:19 +0100 b_michaelsen r264608 : #i94949# optimized insertion of new marks 2008-12-01 14:33:21 +0100 b_michaelsen r264603 : #i94949# simplified code finding Fieldmark for a position 2008-12-01 14:05:55 +0100 b_michaelsen r264598 : #i94949# fixed reverse travelling through marks, removed obsolete getUniqueMarkName() 2008-11-27 18:48:15 +0100 b_michaelsen r264515 : #i94949# fixed _SaveCntntIdx and friends 2008-11-27 15:59:49 +0100 b_michaelsen r264500 : #i94949# fix Mark position only in ctor 2008-11-27 15:52:28 +0100 b_michaelsen r264497 : #i94949# fixed Bug in SwXBookmark, was using pDoc too early 2008-11-26 14:54:22 +0100 b_michaelsen r264396 : #i94949# fixed documentation, simplified navigator reminder code 2008-11-24 20:45:51 +0100 b_michaelsen r264266 : #i94949# removed last obsolete getUniqueMarkName calls 2008-11-24 20:21:35 +0100 b_michaelsen r264265 : #i94949# fixed typo in IDocumentMarkAccess, removed obsolete getUniqueMarkName calls 2008-11-24 18:34:32 +0100 b_michaelsen r264264 : #i94949# repositioning of Marks, removed possibility to delete marks by name in the core, refactoring of navigator reminder generation 2008-11-21 14:08:49 +0100 b_michaelsen r264137 : #i94949# simplified makeMark 2008-11-21 12:07:09 +0100 b_michaelsen r264120 : #i94949# moved ShortName and KeyCode from IMark to IBookmark 2008-11-19 12:50:49 +0100 b_michaelsen r263981 : #i94949# starting refactoring of bookmark naming 2008-11-19 11:31:08 +0100 b_michaelsen r263972 : #i94949# getting rid of obsolete dynamic casts 2008-11-18 19:06:09 +0100 b_michaelsen r263795 : #i94949# getting rid of index based mark access, IDocumentMarkAccess already provides iterators 2008-11-18 17:50:18 +0100 b_michaelsen r263792 : #i94949# getting rid of index based mark access, IDocumentMarkAccess already provides iterators 2008-11-18 16:48:20 +0100 b_michaelsen r263783 : #i94949# removed methods from crsrsh which are already available directly via IDocumentMarkAccess 2008-11-18 11:31:35 +0100 b_michaelsen r263753 : #i94949# cleaning up mark code in crsrsh 2008-11-17 10:15:25 +0100 b_michaelsen r263705 : #i94949# removed possible integer overflow 2008-11-14 18:48:45 +0100 b_michaelsen r263695 : #i94949# management of mark names in MarkManager 2008-11-14 18:23:40 +0100 b_michaelsen r263693 : #i94949# using polymorphism to do mark-specific setup in SwDoc 2008-11-14 16:27:09 +0100 b_michaelsen r263684 : #i94949# got rid of makeCrossRefBookmark 2008-11-14 13:03:32 +0100 b_michaelsen r263674 : #i94949# refactored Correction methods 2008-11-13 12:27:55 +0100 b_michaelsen r263631 : #i94949# got rid of old-style tools assertions in new code 2008-11-12 16:58:16 +0100 b_michaelsen r263608 : #i94949# added assertion for unique names 2008-11-12 16:55:18 +0100 b_michaelsen r263607 : #i94949# maked XFormField deprecated 2008-11-12 13:04:29 +0100 b_michaelsen r263587 : #i94949# replaced IDocumentMarkAccess::GetType with simple dynamic_cast where possible 2008-11-11 18:45:53 +0100 b_michaelsen r263572 : #i94949# cleaned up SwHstryBookmark 2008-11-11 13:48:18 +0100 b_michaelsen r263557 : #i94949# removed dynamic_casts to SwModify by inheriting IMark from it 2008-11-11 11:26:28 +0100 b_michaelsen r263548 : #i94949# fixed SwXBookmark 2008-11-10 17:01:19 +0100 b_michaelsen r263529 : #i94949# fixed DdeBookmarks in clipboard 2008-11-10 16:44:52 +0100 b_michaelsen r263527 : #i94949# formatting 2008-11-10 16:29:16 +0100 b_michaelsen r263526 : #i94949# fixing unoobj.cxx 2008-11-10 16:23:50 +0100 b_michaelsen r263525 : #i94949# cleaning up crossrefbookmark.cxx/.hxx 2008-11-10 16:02:08 +0100 b_michaelsen r263524 : #i94949# Pdf Export should only generate 'real' bookmarks 2008-11-10 15:33:58 +0100 b_michaelsen r263521 : #i94949# removed const_casts 2008-11-10 15:12:06 +0100 b_michaelsen r263520 : #i94949# moved _DelBookmarks into MarksManager 2008-11-07 18:48:38 +0100 b_michaelsen r263480 : #i94949# using iterator interface 2008-11-07 18:41:46 +0100 b_michaelsen r263478 : #i94949# using iterator interface 2008-11-07 18:07:41 +0100 b_michaelsen r263477 : #i94949# using iterator interface 2008-11-07 17:54:41 +0100 b_michaelsen r263476 : #i94949# using iterator interface 2008-11-07 17:44:41 +0100 b_michaelsen r263475 : #i94949# moved correction methods into MarkManager 2008-11-06 18:47:28 +0100 b_michaelsen r263404 : #i94949# getting rid of superfluous const_casts 2008-11-06 17:58:01 +0100 b_michaelsen r263403 : #i94949# no more setting of mark positions outside of the core 2008-11-06 17:08:37 +0100 b_michaelsen r263401 : #i94949# removed setters from IMark 2008-11-06 13:55:25 +0100 b_michaelsen r263383 : #i94949 SwDoc does not implement IDocumentMarkAccess anymore 2008-11-04 18:17:03 +0100 b_michaelsen r263333 : #i94949# began removing IDocumentMarkAccess from SwDoc 2008-11-04 16:48:34 +0100 b_michaelsen r263330 : removing dead code (SwBitArray) found by mst 2008-11-04 16:29:32 +0100 b_michaelsen r263329 : removing dead code (SwBitArray) found by mst 2008-11-04 14:57:48 +0100 b_michaelsen r263326 : removing dead code (SwBitArray) found by mst 2008-11-04 14:50:18 +0100 b_michaelsen r263325 : #i94949# stricter typing in IDocumentMarkAccess 2008-10-24 15:16:27 +0200 b_michaelsen r262647 : #i94949# renamed ::sw::bookmark::SimpleMark to NavigatorReminder to fit the IDocumentMarkAccess enum 2008-10-24 15:10:10 +0200 b_michaelsen r262646 : #i94949# only 'real' bookmark implement IBookmark, Marks also get removed from m_vFieldmarks on delete/clear 2008-10-24 13:06:23 +0200 b_michaelsen r262636 : #i94949# Fieldmark tabnavigation 2008-10-23 12:16:36 +0200 b_michaelsen r262619 : #i94949# Fieldmark classes and filters 2008-10-22 13:17:18 +0200 b_michaelsen r262597 : #i94949# writer import fixes 2008-10-21 11:30:38 +0200 b_michaelsen r262565 : #i94949# renamed methods containing Bookmark in the generic IMark interface 2008-10-20 14:09:02 +0200 b_michaelsen r262318 : #i94949# fixed SwDoc::CorrRel 2008-10-16 22:45:13 +0200 b_michaelsen r262273 : #i94949 simplified Before/After methods 2008-10-16 21:40:57 +0200 b_michaelsen r262271 : #i94949 renamed SimpleMark to NavigatorReminder 2008-10-16 21:15:23 +0200 b_michaelsen r262270 : #i94949 using shared_ptr only in MarkManager 2008-10-16 17:46:37 +0200 b_michaelsen r262269 : #i94949# getFieldmarkBefore and getFieldmarkAfter 2008-10-16 17:12:13 +0200 b_michaelsen r262265 : #i94949# cleanup in crbm.cxx 2008-10-16 12:49:01 +0200 b_michaelsen r262257 : #i94949# fixed usage of invalid iterator, fixed invalid cast 2008-10-15 15:34:20 +0200 b_michaelsen r262239 : #i94949# added moved files 2008-10-15 15:26:45 +0200 b_michaelsen r262237 : #i94949# initial reimplementation of Bookmarks
2009-04-21 15:40:02 +00:00
namespace
{
/*
The lcl_CopyBookmarks function has to copy bookmarks from the source to the destination nodes
array. It is called after a call of the _CopyNodes(..) function. But this function does not copy
every node (at least at the moment: 2/08/2006 ), section start and end nodes will not be copied if the corresponding end/start node is outside the copied pam.
The lcl_NonCopyCount function counts the number of these nodes, given the copied pam and a node
index inside the pam.
rPam is the original source pam, rLastIdx is the last calculated position, rDelCount the number
of "non-copy" nodes between rPam.Start() and rLastIdx.
nNewIdx is the new position of interest.
*/
static void lcl_NonCopyCount( const SwPaM& rPam, SwNodeIndex& rLastIdx, const ULONG nNewIdx, ULONG& rDelCount )
{
ULONG nStart = rPam.Start()->nNode.GetIndex();
ULONG nEnd = rPam.End()->nNode.GetIndex();
if( rLastIdx.GetIndex() < nNewIdx ) // Moving forward?
{
do // count "non-copy" nodes
{
SwNode& rNode = rLastIdx.GetNode();
if( ( rNode.IsSectionNode() && rNode.EndOfSectionIndex() >= nEnd )
|| ( rNode.IsEndNode() && rNode.StartOfSectionNode()->GetIndex() < nStart ) )
++rDelCount;
rLastIdx++;
}
while( rLastIdx.GetIndex() < nNewIdx );
}
else if( rDelCount ) // optimization: if there are no "non-copy" nodes until now,
// no move backward needed
{
while( rLastIdx.GetIndex() > nNewIdx )
{
SwNode& rNode = rLastIdx.GetNode();
if( ( rNode.IsSectionNode() && rNode.EndOfSectionIndex() >= nEnd )
|| ( rNode.IsEndNode() && rNode.StartOfSectionNode()->GetIndex() < nStart ) )
--rDelCount;
rLastIdx--;
}
}
}
static void lcl_SetCpyPos( const SwPosition& rOrigPos,
const SwPosition& rOrigStt,
const SwPosition& rCpyStt,
SwPosition& rChgPos,
ULONG nDelCount )
{
ULONG nNdOff = rOrigPos.nNode.GetIndex();
nNdOff -= rOrigStt.nNode.GetIndex();
nNdOff -= nDelCount;
xub_StrLen nCntntPos = rOrigPos.nContent.GetIndex();
// --> OD, AMA 2008-07-07 #b6713815#
// Always adjust <nNode> at to be changed <SwPosition> instance <rChgPos>
rChgPos.nNode = nNdOff + rCpyStt.nNode.GetIndex();
if( !nNdOff )
// <--
{
// dann nur den Content anpassen
if( nCntntPos > rOrigStt.nContent.GetIndex() )
nCntntPos = nCntntPos - rOrigStt.nContent.GetIndex();
else
nCntntPos = 0;
nCntntPos = nCntntPos + rCpyStt.nContent.GetIndex();
}
rChgPos.nContent.Assign( rChgPos.nNode.GetNode().GetCntntNode(), nCntntPos );
}
// TODO: use SaveBookmark (from _DelBookmarks)
static void lcl_CopyBookmarks(const SwPaM& rPam, SwPaM& rCpyPam)
{
const SwDoc* pSrcDoc = rPam.GetDoc();
SwDoc* pDestDoc = rCpyPam.GetDoc();
const IDocumentMarkAccess* const pSrcMarkAccess = pSrcDoc->getIDocumentMarkAccess();
bool bDoesUndo = pDestDoc->DoesUndo();
pDestDoc->DoUndo(false);
const SwPosition &rStt = *rPam.Start(), &rEnd = *rPam.End();
SwPosition* pCpyStt = rCpyPam.Start();
typedef ::std::vector< const ::sw::mark::IMark* > mark_vector_t;
mark_vector_t vMarksToCopy;
for(IDocumentMarkAccess::const_iterator_t ppMark = pSrcMarkAccess->getMarksBegin();
ppMark != pSrcMarkAccess->getMarksEnd();
ppMark++)
{
const ::sw::mark::IMark* const pMark = ppMark->get();
const SwPosition& rMarkStart = pMark->GetMarkStart();
const SwPosition& rMarkEnd = pMark->GetMarkEnd();
// only include marks that are in the range and not touching
// both start and end
bool bIsNotOnBoundary = pMark->IsExpanded()
? (rMarkStart != rStt || rMarkEnd != rEnd) // rMarkStart != rMarkEnd
: (rMarkStart != rStt && rMarkEnd != rEnd); // rMarkStart == rMarkEnd
if(rMarkStart >= rStt && rMarkEnd <= rEnd && bIsNotOnBoundary)
{
vMarksToCopy.push_back(pMark);
}
}
// We have to count the "non-copied" nodes..
SwNodeIndex aCorrIdx(rStt.nNode);
ULONG nDelCount = 0;
for(mark_vector_t::const_iterator ppMark = vMarksToCopy.begin();
ppMark != vMarksToCopy.end();
++ppMark)
{
const ::sw::mark::IMark* const pMark = *ppMark;
SwPaM aTmpPam(*pCpyStt);
lcl_NonCopyCount(rPam, aCorrIdx, pMark->GetMarkPos().nNode.GetIndex(), nDelCount);
lcl_SetCpyPos( pMark->GetMarkPos(), rStt, *pCpyStt, *aTmpPam.GetPoint(), nDelCount);
if(pMark->IsExpanded())
{
aTmpPam.SetMark();
lcl_NonCopyCount(rPam, aCorrIdx, pMark->GetOtherMarkPos().nNode.GetIndex(), nDelCount);
lcl_SetCpyPos(pMark->GetOtherMarkPos(), rStt, *pCpyStt, *aTmpPam.GetMark(), nDelCount);
}
::sw::mark::IMark* const pNewMark = pDestDoc->getIDocumentMarkAccess()->makeMark(
aTmpPam,
pMark->GetName(),
IDocumentMarkAccess::GetType(*pMark));
// Explicitly try to get exactly the same name as in the source
// because NavigatorReminders, DdeBookmarks etc. ignore the proposed name
pDestDoc->getIDocumentMarkAccess()->renameMark(pNewMark, pMark->GetName());
::sw::mark::IBookmark* const pNewBookmark =
dynamic_cast< ::sw::mark::IBookmark* const >(pNewMark);
if(pNewBookmark) /* copying additional attributes for bookmarks */
{
const ::sw::mark::IBookmark* const pOldBookmark = dynamic_cast< const ::sw::mark::IBookmark* >(pMark);
pNewBookmark->SetKeyCode(pOldBookmark->GetKeyCode());
pNewBookmark->SetShortName(pOldBookmark->GetShortName());
}
}
pDestDoc->DoUndo(bDoesUndo);
}
}
2000-09-18 23:08:29 +00:00
// Struktur fuer das Mappen von alten und neuen Frame-Formaten an den
// Boxen und Lines einer Tabelle
struct _MapTblFrmFmt
{
const SwFrmFmt *pOld, *pNew;
_MapTblFrmFmt( const SwFrmFmt *pOldFmt, const SwFrmFmt*pNewFmt )
: pOld( pOldFmt ), pNew( pNewFmt )
{}
};
SV_DECL_VARARR( _MapTblFrmFmts, _MapTblFrmFmt, 0, 10 )
2000-09-18 23:08:29 +00:00
SV_IMPL_VARARR( _MapTblFrmFmts, _MapTblFrmFmt );
SwCntntNode* SwTxtNode::MakeCopy( SwDoc* pDoc, const SwNodeIndex& rIdx ) const
{
// the Copy-Textnode is the Node with the Text, the Copy-Attrnode is the
// node with the collection and hard attributes. Normally ist the same
// node, but if insert a glossary without formatting, then the Attrnode
// is the prev node of the destionation position in dest. document.
SwTxtNode* pCpyTxtNd = (SwTxtNode*)this;
SwTxtNode* pCpyAttrNd = pCpyTxtNd;
// kopiere die Formate in das andere Dokument:
SwTxtFmtColl* pColl = 0;
if( pDoc->IsInsOnlyTextGlossary() )
{
SwNodeIndex aIdx( rIdx, -1 );
if( aIdx.GetNode().IsTxtNode() )
{
pCpyAttrNd = aIdx.GetNode().GetTxtNode();
pColl = &pCpyAttrNd->GetTxtColl()->GetNextTxtFmtColl();
}
}
if( !pColl )
pColl = pDoc->CopyTxtColl( *GetTxtColl() );
SwTxtNode* pTxtNd = pDoc->GetNodes().MakeTxtNode( rIdx, pColl );
// kopiere Attribute/Text
if( !pCpyAttrNd->HasSwAttrSet() )
2000-09-18 23:08:29 +00:00
// wurde ein AttrSet fuer die Numerierung angelegt, so loesche diesen!
pTxtNd->ResetAllAttr();
// if Copy-Textnode unequal to Copy-Attrnode, then copy first
// the attributes into the new Node.
if( pCpyAttrNd != pCpyTxtNd )
{
pCpyAttrNd->CopyAttr( pTxtNd, 0, 0 );
if( pCpyAttrNd->HasSwAttrSet() )
2000-09-18 23:08:29 +00:00
{
SwAttrSet aSet( *pCpyAttrNd->GetpSwAttrSet() );
aSet.ClearItem( RES_PAGEDESC );
aSet.ClearItem( RES_BREAK );
aSet.CopyToModify( *pTxtNd );
}
}
// ??? reicht das ??? was ist mit PostIts/Feldern/FeldTypen ???
// --> OD 2008-11-18 #i96213# - force copy of all attributes
pCpyTxtNd->Copy( pTxtNd, SwIndex( pCpyTxtNd ), pCpyTxtNd->GetTxt().Len(), true );
// <--
2000-09-18 23:08:29 +00:00
//FEATURE::CONDCOLL
if( RES_CONDTXTFMTCOLL == pColl->Which() )
pTxtNd->ChkCondColl();
//FEATURE::CONDCOLL
return pTxtNd;
}
BOOL lcl_SrchNew( const _MapTblFrmFmt& rMap, void * pPara )
{
if( rMap.pOld != *(const SwFrmFmt**)pPara )
return TRUE;
*((const SwFrmFmt**)pPara) = rMap.pNew;
return FALSE; // abbrechen, Pointer gefunden
}
struct _CopyTable
{
SwDoc* pDoc;
ULONG nOldTblSttIdx;
_MapTblFrmFmts& rMapArr;
SwTableLine* pInsLine;
SwTableBox* pInsBox;
SwTableNode *pTblNd;
const SwTable *pOldTable;
_CopyTable( SwDoc* pDc, _MapTblFrmFmts& rArr, ULONG nOldStt,
SwTableNode& rTblNd, const SwTable* pOldTbl )
: pDoc(pDc), nOldTblSttIdx(nOldStt), rMapArr(rArr),
pInsLine(0), pInsBox(0), pTblNd(&rTblNd), pOldTable( pOldTbl )
2000-09-18 23:08:29 +00:00
{}
};
BOOL lcl_CopyTblBox( const SwTableBox*& rpBox, void* pPara );
BOOL lcl_CopyTblLine( const SwTableLine*& rpLine, void* pPara );
BOOL lcl_CopyTblBox( const SwTableBox*& rpBox, void* pPara )
{
_CopyTable* pCT = (_CopyTable*)pPara;
SwTableBoxFmt* pBoxFmt = (SwTableBoxFmt*)rpBox->GetFrmFmt();
pCT->rMapArr.ForEach( lcl_SrchNew, &pBoxFmt );
if( pBoxFmt == rpBox->GetFrmFmt() ) // ein neues anlegen ??
{
const SfxPoolItem* pItem;
if( SFX_ITEM_SET == pBoxFmt->GetItemState( RES_BOXATR_FORMULA, FALSE,
&pItem ) && ((SwTblBoxFormula*)pItem)->IsIntrnlName() )
{
((SwTblBoxFormula*)pItem)->PtrToBoxNm( pCT->pOldTable );
}
pBoxFmt = pCT->pDoc->MakeTableBoxFmt();
pBoxFmt->CopyAttrs( *rpBox->GetFrmFmt() );
if( rpBox->GetSttIdx() )
{
SvNumberFormatter* pN = pCT->pDoc->GetNumberFormatter( FALSE );
if( pN && pN->HasMergeFmtTbl() && SFX_ITEM_SET == pBoxFmt->
GetItemState( RES_BOXATR_FORMAT, FALSE, &pItem ) )
{
ULONG nOldIdx = ((SwTblBoxNumFormat*)pItem)->GetValue();
ULONG nNewIdx = pN->GetMergeFmtIndex( nOldIdx );
if( nNewIdx != nOldIdx )
pBoxFmt->SetFmtAttr( SwTblBoxNumFormat( nNewIdx ));
2000-09-18 23:08:29 +00:00
}
}
pCT->rMapArr.Insert( _MapTblFrmFmt( rpBox->GetFrmFmt(), pBoxFmt ),
pCT->rMapArr.Count() );
}
USHORT nLines = rpBox->GetTabLines().Count();
SwTableBox* pNewBox;
if( nLines )
pNewBox = new SwTableBox( pBoxFmt, nLines, pCT->pInsLine );
else
{
SwNodeIndex aNewIdx( *pCT->pTblNd,
rpBox->GetSttIdx() - pCT->nOldTblSttIdx );
ASSERT( aNewIdx.GetNode().IsStartNode(), "Index nicht auf einem StartNode" );
pNewBox = new SwTableBox( pBoxFmt, aNewIdx, pCT->pInsLine );
pNewBox->setRowSpan( rpBox->getRowSpan() );
2000-09-18 23:08:29 +00:00
}
pCT->pInsLine->GetTabBoxes().C40_INSERT( SwTableBox, pNewBox,
pCT->pInsLine->GetTabBoxes().Count() );
if( nLines )
{
_CopyTable aPara( *pCT );
aPara.pInsBox = pNewBox;
((SwTableBox*)rpBox)->GetTabLines().ForEach( &lcl_CopyTblLine, &aPara );
}
else if( pNewBox->IsInHeadline( &pCT->pTblNd->GetTable() ))
// in der HeadLine sind die Absaetze mit BedingtenVorlage anzupassen
pNewBox->GetSttNd()->CheckSectionCondColl();
return TRUE;
}
BOOL lcl_CopyTblLine( const SwTableLine*& rpLine, void* pPara )
{
_CopyTable* pCT = (_CopyTable*)pPara;
SwTableLineFmt* pLineFmt = (SwTableLineFmt*)rpLine->GetFrmFmt();
pCT->rMapArr.ForEach( lcl_SrchNew, &pLineFmt );
if( pLineFmt == rpLine->GetFrmFmt() ) // ein neues anlegen ??
{
pLineFmt = pCT->pDoc->MakeTableLineFmt();
pLineFmt->CopyAttrs( *rpLine->GetFrmFmt() );
pCT->rMapArr.Insert( _MapTblFrmFmt( rpLine->GetFrmFmt(), pLineFmt ),
pCT->rMapArr.Count());
}
SwTableLine* pNewLine = new SwTableLine( pLineFmt,
rpLine->GetTabBoxes().Count(), pCT->pInsBox );
// die neue Zeile in die Tabelle eintragen
if( pCT->pInsBox )
{
pCT->pInsBox->GetTabLines().C40_INSERT( SwTableLine, pNewLine,
pCT->pInsBox->GetTabLines().Count() );
}
else
{
pCT->pTblNd->GetTable().GetTabLines().C40_INSERT( SwTableLine, pNewLine,
pCT->pTblNd->GetTable().GetTabLines().Count() );
}
pCT->pInsLine = pNewLine;
((SwTableLine*)rpLine)->GetTabBoxes().ForEach( &lcl_CopyTblBox, pCT );
return TRUE;
}
SwTableNode* SwTableNode::MakeCopy( SwDoc* pDoc, const SwNodeIndex& rIdx ) const
{
// in welchen Array steht ich denn Nodes, UndoNodes ??
SwNodes& rNds = (SwNodes&)GetNodes();
{
// nicht in Fussnoten kopieren !!
/*
!! Mal ohne Frames
SwCntntNode* pCNd = pDoc->GetNodes()[ rIdx ]->GetCntntNode();
SwFrm* pFrm;
if( (pCNd && 0 != ( pFrm = pCNd->GetFrm()))
? pFrm->FindFtnFrm()
: rIdx < pDoc->GetNodes().EndOfInserts &&
pDoc->GetNodes()[pDoc->GetNodes().EndOfInserts]->StartOfSection()
< rIdx )
*/
if( rIdx < pDoc->GetNodes().GetEndOfInserts().GetIndex() &&
rIdx >= pDoc->GetNodes().GetEndOfInserts().StartOfSectionIndex() )
return 0;
}
// das TableFrmFmt kopieren
String sTblName( GetTable().GetFrmFmt()->GetName() );
if( !pDoc->IsCopyIsMove() )
{
const SwFrmFmts& rTblFmts = *pDoc->GetTblFrmFmts();
for( USHORT n = rTblFmts.Count(); n; )
if( rTblFmts[ --n ]->GetName() == sTblName )
{
sTblName = pDoc->GetUniqueTblName();
break;
}
}
SwFrmFmt* pTblFmt = pDoc->MakeTblFrmFmt( sTblName, pDoc->GetDfltFrmFmt() );
pTblFmt->CopyAttrs( *GetTable().GetFrmFmt() );
SwTableNode* pTblNd = new SwTableNode( rIdx );
SwEndNode* pEndNd = new SwEndNode( rIdx, *pTblNd );
SwNodeIndex aInsPos( *pEndNd );
SwTable& rTbl = (SwTable&)pTblNd->GetTable();
pTblFmt->Add( &rTbl ); // das Frame-Format setzen
rTbl.SetRowsToRepeat( GetTable().GetRowsToRepeat() );
2000-09-18 23:08:29 +00:00
rTbl.SetTblChgMode( GetTable().GetTblChgMode() );
rTbl.SetTableModel( GetTable().IsNewModel() );
2000-09-18 23:08:29 +00:00
SwDDEFieldType* pDDEType = 0;
if( IS_TYPE( SwDDETable, &GetTable() ))
{
// es wird eine DDE-Tabelle kopiert
// ist im neuen Dokument ueberhaupt der FeldTyp vorhanden ?
pDDEType = ((SwDDETable&)GetTable()).GetDDEFldType();
if( pDDEType->IsDeleted() )
pDoc->InsDeletedFldType( *pDDEType );
else
pDDEType = (SwDDEFieldType*)pDoc->InsertFldType( *pDDEType );
ASSERT( pDDEType, "unbekannter FieldType" );
// tauschen am Node den Tabellen-Pointer aus
SwDDETable* pNewTable = new SwDDETable( pTblNd->GetTable(), pDDEType );
pTblNd->SetNewTable( pNewTable, FALSE );
}
// dann kopiere erstmal den Inhalt der Tabelle, die Zuordnung der
// Boxen/Lines und das anlegen der Frames erfolgt spaeter
SwNodeRange aRg( *this, +1, *EndOfSectionNode() ); // (wo stehe in denn nun ??)
// If there is a table in this table, the table format for the outer table
// does not seem to be used, because the table does not have any contents yet
// (see IsUsed). Therefore the inner table gets the same name as the outer table.
// We have to make sure that the table node of the SwTable is accessible, even
// without any content in aSortCntBoxes. #i26629#
pTblNd->GetTable().SetTableNode( pTblNd );
2000-09-18 23:08:29 +00:00
rNds._Copy( aRg, aInsPos, FALSE );
pTblNd->GetTable().SetTableNode( 0 );
2000-09-18 23:08:29 +00:00
// Sonderbehandlung fuer eine einzelne Box
if( 1 == GetTable().GetTabSortBoxes().Count() )
{
aRg.aStart.Assign( *pTblNd, 1 );
aRg.aEnd.Assign( *pTblNd->EndOfSectionNode() );
pDoc->GetNodes().SectionDown( &aRg, SwTableBoxStartNode );
}
// loesche alle Frames vom kopierten Bereich, diese werden beim
// erzeugen des TableFrames angelegt !
pTblNd->DelFrms();
_MapTblFrmFmts aMapArr;
_CopyTable aPara( pDoc, aMapArr, GetIndex(), *pTblNd, &GetTable() );
((SwTable&)GetTable()).GetTabLines().ForEach( &lcl_CopyTblLine, &aPara );
if( pDDEType )
2000-09-18 23:08:29 +00:00
pDDEType->IncRefCnt();
CHECK_TABLE( GetTable() );
2000-09-18 23:08:29 +00:00
return pTblNd;
}
void SwTxtNode::CopyCollFmt( SwTxtNode& rDestNd )
{
// kopiere die Formate in das andere Dokument:
// Sonderbehandlung fuer PageBreak/PageDesc/ColBrk
SwDoc* pDestDoc = rDestNd.GetDoc();
SwAttrSet aPgBrkSet( pDestDoc->GetAttrPool(), aBreakSetRange );
const SwAttrSet* pSet;
2000-09-18 23:08:29 +00:00
if( 0 != ( pSet = rDestNd.GetpSwAttrSet() ) )
{
// Sonderbehandlung fuer unsere Break-Attribute
const SfxPoolItem* pAttr;
if( SFX_ITEM_SET == pSet->GetItemState( RES_BREAK, FALSE, &pAttr ) )
aPgBrkSet.Put( *pAttr );
if( SFX_ITEM_SET == pSet->GetItemState( RES_PAGEDESC, FALSE, &pAttr ) )
aPgBrkSet.Put( *pAttr );
}
rDestNd.ChgFmtColl( pDestDoc->CopyTxtColl( *GetTxtColl() ));
if( 0 != ( pSet = GetpSwAttrSet() ) )
pSet->CopyToModify( rDestNd );
if( aPgBrkSet.Count() )
rDestNd.SetAttr( aPgBrkSet );
2000-09-18 23:08:29 +00:00
}
// ----- Copy-Methode vom SwDoc ------
// verhinder das Kopieren in Fly's, die im Bereich verankert sind.
BOOL lcl_ChkFlyFly( SwDoc* pDoc, ULONG nSttNd, ULONG nEndNd,
ULONG nInsNd )
{
const SwFrmFmt* pFmt;
const SwFmtAnchor* pAnchor;
const SwPosition* pAPos;
const SwSpzFrmFmts& rFrmFmtTbl = *pDoc->GetSpzFrmFmts();
for( USHORT n = 0; n < rFrmFmtTbl.Count(); ++n )
{
pFmt = rFrmFmtTbl[n];
pAnchor = &pFmt->GetAnchor();
if( 0 != ( pAPos = pAnchor->GetCntntAnchor()) &&
( FLY_IN_CNTNT == pAnchor->GetAnchorId() ||
FLY_AUTO_CNTNT == pAnchor->GetAnchorId() ||
FLY_AT_FLY == pAnchor->GetAnchorId() ||
FLY_AT_CNTNT == pAnchor->GetAnchorId() ) &&
nSttNd <= pAPos->nNode.GetIndex() &&
pAPos->nNode.GetIndex() < nEndNd )
{
const SwFmtCntnt& rCntnt = pFmt->GetCntnt();
SwStartNode* pSNd;
if( !rCntnt.GetCntntIdx() ||
0 == ( pSNd = rCntnt.GetCntntIdx()->GetNode().GetStartNode() ))
continue;
if( pSNd->GetIndex() < nInsNd &&
nInsNd < pSNd->EndOfSectionIndex() )
return TRUE; // nicht kopieren !!
if( lcl_ChkFlyFly( pDoc, pSNd->GetIndex(),
pSNd->EndOfSectionIndex(), nInsNd ) )
return TRUE; // nicht kopieren !!
}
}
return FALSE;
}
void lcl_DeleteRedlines( const SwPaM& rPam, SwPaM& rCpyPam )
{
const SwDoc* pSrcDoc = rPam.GetDoc();
const SwRedlineTbl& rTbl = pSrcDoc->GetRedlineTbl();
if( rTbl.Count() )
{
SwDoc* pDestDoc = rCpyPam.GetDoc();
SwPosition* pCpyStt = rCpyPam.Start(), *pCpyEnd = rCpyPam.End();
SwPaM* pDelPam = 0;
const SwPosition *pStt = rPam.Start(), *pEnd = rPam.End();
// We have to count the "non-copied" nodes
ULONG nDelCount = 0;
SwNodeIndex aCorrIdx( pStt->nNode );
2000-09-18 23:08:29 +00:00
USHORT n = 0;
pSrcDoc->GetRedline( *pStt, &n );
for( ; n < rTbl.Count(); ++n )
{
const SwRedline* pRedl = rTbl[ n ];
if( nsRedlineType_t::REDLINE_DELETE == pRedl->GetType() && pRedl->IsVisible() )
2000-09-18 23:08:29 +00:00
{
const SwPosition *pRStt = pRedl->Start(), *pREnd = pRedl->End();
SwComparePosition eCmpPos = ComparePosition( *pStt, *pEnd, *pRStt, *pREnd );
switch( eCmpPos )
{
case POS_COLLIDE_END:
2000-09-18 23:08:29 +00:00
case POS_BEFORE: // Pos1 liegt vor Pos2
break;
case POS_COLLIDE_START:
2000-09-18 23:08:29 +00:00
case POS_BEHIND: // Pos1 liegt hinter Pos2
n = rTbl.Count();
break;
default:
{
pDelPam = new SwPaM( *pCpyStt, pDelPam );
if( *pStt < *pRStt )
{
lcl_NonCopyCount( rPam, aCorrIdx, pRStt->nNode.GetIndex(), nDelCount );
2000-09-18 23:08:29 +00:00
lcl_SetCpyPos( *pRStt, *pStt, *pCpyStt,
*pDelPam->GetPoint(), nDelCount );
}
2000-09-18 23:08:29 +00:00
pDelPam->SetMark();
if( *pEnd < *pREnd )
*pDelPam->GetPoint() = *pCpyEnd;
else
{
lcl_NonCopyCount( rPam, aCorrIdx, pREnd->nNode.GetIndex(), nDelCount );
2000-09-18 23:08:29 +00:00
lcl_SetCpyPos( *pREnd, *pStt, *pCpyStt,
*pDelPam->GetPoint(), nDelCount );
}
2000-09-18 23:08:29 +00:00
}
}
}
}
if( pDelPam )
{
RedlineMode_t eOld = pDestDoc->GetRedlineMode();
pDestDoc->SetRedlineMode_intern( (RedlineMode_t)(eOld | nsRedlineMode_t::REDLINE_IGNORE));
2000-09-18 23:08:29 +00:00
BOOL bDoesUndo = pDestDoc->DoesUndo();
pDestDoc->DoUndo( FALSE );
do {
pDestDoc->DeleteAndJoin( *(SwPaM*)pDelPam->GetNext() );
if( pDelPam->GetNext() == pDelPam )
break;
delete pDelPam->GetNext();
} while( TRUE );
delete pDelPam;
pDestDoc->DoUndo( bDoesUndo );
pDestDoc->SetRedlineMode_intern( eOld );
}
}
}
void lcl_DeleteRedlines( const SwNodeRange& rRg, SwNodeRange& rCpyRg )
{
SwDoc* pSrcDoc = rRg.aStart.GetNode().GetDoc();
if( pSrcDoc->GetRedlineTbl().Count() )
{
SwPaM aRgTmp( rRg.aStart, rRg.aEnd );
SwPaM aCpyTmp( rCpyRg.aStart, rCpyRg.aEnd );
lcl_DeleteRedlines( aRgTmp, aCpyTmp );
}
}
// Kopieren eines Bereiches im oder in ein anderes Dokument !
bool SwDoc::Copy( SwPaM& rPam, SwPosition& rPos ) const
2000-09-18 23:08:29 +00:00
{
const SwPosition *pStt = rPam.Start(), *pEnd = rPam.End();
SwDoc* pDoc = rPos.nNode.GetNode().GetDoc();
bool bColumnSel = pDoc->IsClipBoard() && pDoc->IsColumnSelection();
// kein Copy abfangen.
if( !rPam.HasMark() || ( *pStt >= *pEnd && !bColumnSel ) )
return FALSE;
2000-09-18 23:08:29 +00:00
// verhinder das Kopieren in Fly's, die im Bereich verankert sind.
if( pDoc == this )
{
// Start-/EndNode noch korrigieren
ULONG nStt = pStt->nNode.GetIndex(),
nEnd = pEnd->nNode.GetIndex(),
nDiff = nEnd - nStt +1;
SwNode* pNd = GetNodes()[ nStt ];
if( pNd->IsCntntNode() && pStt->nContent.GetIndex() )
++nStt, --nDiff;
if( (pNd = GetNodes()[ nEnd ])->IsCntntNode() &&
((SwCntntNode*)pNd)->Len() != pEnd->nContent.GetIndex() )
--nEnd, --nDiff;
if( nDiff &&
lcl_ChkFlyFly( pDoc, nStt, nEnd, rPos.nNode.GetIndex() ) )
return FALSE;
}
SwPaM* pRedlineRange = 0;
if( pDoc->IsRedlineOn() ||
(!pDoc->IsIgnoreRedline() && pDoc->GetRedlineTbl().Count() ) )
pRedlineRange = new SwPaM( rPos );
RedlineMode_t eOld = pDoc->GetRedlineMode();
2000-09-18 23:08:29 +00:00
BOOL bRet = FALSE;
if( pDoc != this )
2000-09-18 23:08:29 +00:00
bRet = _Copy( rPam, rPos, TRUE, pRedlineRange ); // nur normales Kopieren
// Copy in sich selbst (ueber mehrere Nodes wird hier gesondert
// behandelt; in einem TextNode wird normal behandelt)
else if( ! ( *pStt <= rPos && rPos < *pEnd &&
( pStt->nNode != pEnd->nNode ||
!pStt->nNode.GetNode().IsTxtNode() )) )
bRet = _Copy( rPam, rPos, TRUE, pRedlineRange ); // nur normales Kopieren
else
{
ASSERT( this == pDoc, " falscher Copy-Zweig!" );
pDoc->SetRedlineMode_intern((RedlineMode_t)(eOld | nsRedlineMode_t::REDLINE_IGNORE));
2000-09-18 23:08:29 +00:00
BOOL bDoUndo = pDoc->DoesUndo();
pDoc->DoUndo( FALSE ); // Auf jedenfall Undo abschalten
// dann kopiere den Bereich im unteren DokumentBereich,
// (mit Start/End-Nodes geklammert) und verschiebe diese
// dann an die gewuenschte Stelle.
SwUndoCpyDoc* pUndo = 0;
2000-09-18 23:08:29 +00:00
SwPaM aPam( rPos ); // UndoBereich sichern
if( bDoUndo )
{
pDoc->ClearRedo();
pUndo = new SwUndoCpyDoc( aPam );
}
SwStartNode* pSttNd = pDoc->GetNodes().MakeEmptySection(
SwNodeIndex( GetNodes().GetEndOfAutotext() ));
aPam.GetPoint()->nNode = *pSttNd->EndOfSectionNode();
pDoc->_Copy( rPam, *aPam.GetPoint(), FALSE ); // kopieren ohne Frames
aPam.GetPoint()->nNode = pDoc->GetNodes().GetEndOfAutotext();
aPam.SetMark();
SwCntntNode* pNode = pDoc->GetNodes().GoPrevious( &aPam.GetMark()->nNode );
pNode->MakeEndIndex( &aPam.GetMark()->nContent );
aPam.GetPoint()->nNode = *aPam.GetNode()->StartOfSectionNode();
pNode = pDoc->GetNodes().GoNext( &aPam.GetPoint()->nNode );
pNode->MakeStartIndex( &aPam.GetPoint()->nContent );
pDoc->Move( aPam, rPos, DOC_MOVEDEFAULT ); // auf gewuenschte Position moven
2000-09-18 23:08:29 +00:00
pNode = aPam.GetCntntNode();
*aPam.GetPoint() = rPos; // Cursor umsetzen fuers Undo !
aPam.SetMark(); // auch den Mark umsetzen !!
aPam.DeleteMark(); // aber keinen Bereich makieren !!
pDoc->DeleteSection( pNode ); // Bereich wieder loeschen
// falls Undo eingeschaltet ist, so speicher den eingefuegten Bereich
pDoc->DoUndo( bDoUndo );
if( bDoUndo )
{
pUndo->SetInsertRange( aPam );
pDoc->AppendUndo( pUndo );
}
if( pRedlineRange )
{
pRedlineRange->SetMark();
*pRedlineRange->GetPoint() = *aPam.GetPoint();
*pRedlineRange->GetMark() = *aPam.GetMark();
}
pDoc->SetModified();
bRet = TRUE;
}
pDoc->SetRedlineMode_intern( eOld );
if( pRedlineRange )
{
if( pDoc->IsRedlineOn() )
pDoc->AppendRedline( new SwRedline( nsRedlineType_t::REDLINE_INSERT, *pRedlineRange ), true);
2000-09-18 23:08:29 +00:00
else
pDoc->SplitRedline( *pRedlineRange );
delete pRedlineRange;
}
return bRet;
}
// Kopieren eines Bereiches im oder in ein anderes Dokument !
// Die Position darf nicht im Bereich liegen !!
BOOL lcl_MarksWholeNode(const SwPaM & rPam)
{
BOOL bResult = FALSE;
const SwPosition * pStt = rPam.Start(), * pEnd = rPam.End();
if (NULL != pStt && NULL != pEnd)
{
SwTxtNode * pSttNd = pStt->nNode.GetNode().GetTxtNode();
SwTxtNode * pEndNd = pEnd->nNode.GetNode().GetTxtNode();
if (NULL != pSttNd && NULL != pEndNd &&
pStt->nContent.GetIndex() == 0 &&
pEnd->nContent.GetIndex() == pEndNd->Len())
{
bResult = TRUE;
}
}
return bResult;
}
2000-09-18 23:08:29 +00:00
BOOL SwDoc::_Copy( SwPaM& rPam, SwPosition& rPos,
BOOL bMakeNewFrms, SwPaM* pCpyRange ) const
{
SwDoc* pDoc = rPos.nNode.GetNode().GetDoc();
bool bColumnSel = pDoc->IsClipBoard() && pDoc->IsColumnSelection();
2000-09-18 23:08:29 +00:00
SwPosition *pStt = rPam.Start(), *pEnd = rPam.End();
// kein Copy abfangen.
if( !rPam.HasMark() || ( *pStt >= *pEnd && !bColumnSel ) ||
//JP 29.6.2001: 88963 - dont copy if inspos is in region of start to end
//JP 15.11.2001: don't test inclusive the end, ever exclusive
( pDoc == this && *pStt <= rPos && rPos < *pEnd ))
2000-09-18 23:08:29 +00:00
return FALSE;
BOOL bEndEqualIns = pDoc == this && rPos == *pEnd;
// falls Undo eingeschaltet, erzeuge das UndoCopy-Objekt
SwUndoCpyDoc* pUndo = 0;
2000-09-18 23:08:29 +00:00
SwPaM aCpyPam( rPos );
SwTblNumFmtMerge aTNFM( *this, *pDoc );
if( pDoc->DoesUndo() )
{
pDoc->ClearRedo();
pUndo = new SwUndoCpyDoc( aCpyPam );
pDoc->AppendUndo( pUndo );
}
RedlineMode_t eOld = pDoc->GetRedlineMode();
pDoc->SetRedlineMode_intern((RedlineMode_t)(eOld | nsRedlineMode_t::REDLINE_IGNORE));
2000-09-18 23:08:29 +00:00
// bewege den Pam von der Insert-Position ein zurueck, dadurch wird
// die Position nicht "verschoben"
aCpyPam.SetMark();
BOOL bCanMoveBack = aCpyPam.Move( fnMoveBackward, fnGoCntnt );
if( !bCanMoveBack )
aCpyPam.GetPoint()->nNode--;
SwNodeRange aRg( pStt->nNode, pEnd->nNode );
SwNodeIndex aInsPos( rPos.nNode );
BOOL bOneNode = pStt->nNode == pEnd->nNode;
SwTxtNode* pSttNd = pStt->nNode.GetNode().GetTxtNode();
SwTxtNode* pEndNd = pEnd->nNode.GetNode().GetTxtNode();
SwTxtNode* pDestNd = aInsPos.GetNode().GetTxtNode();
BOOL bCopyCollFmt = !pDoc->IsInsOnlyTextGlossary() && (
( pDestNd && !pDestNd->GetTxt().Len() ) ||
( !bOneNode && !rPos.nContent.GetIndex() ));
BOOL bCopyBookmarks = TRUE;
BOOL bStartIsTxtNode = 0 != pSttNd;
2000-09-18 23:08:29 +00:00
// --> OD 2008-03-18 #refactorlists#
String aDummy;
const SwNumRule * pNumRuleToPropagate =
pDoc->SearchNumRule(rPos, FALSE, FALSE, TRUE, 0, aDummy);
// <--
2000-09-18 23:08:29 +00:00
// Block, damit aus diesem gesprungen werden kann !!
do {
if( pSttNd )
{
// den Anfang nicht komplett kopieren ?
if( !bCopyCollFmt || bColumnSel || pStt->nContent.GetIndex() )
2000-09-18 23:08:29 +00:00
{
SwIndex aDestIdx( rPos.nContent );
BOOL bCopyOk = FALSE;
if( !pDestNd )
{
if( pStt->nContent.GetIndex() || bOneNode )
pDestNd = pDoc->GetNodes().MakeTxtNode( aInsPos,
pDoc->GetTxtCollFromPool(RES_POOLCOLL_STANDARD));
else
{
pDestNd = (SwTxtNode*)pSttNd->MakeCopy( pDoc, aInsPos );
bCopyOk = TRUE;
}
aDestIdx.Assign( pDestNd, 0 );
bCopyCollFmt = TRUE;
}
else if( !bOneNode || bColumnSel )
2000-09-18 23:08:29 +00:00
{
xub_StrLen nCntntEnd = pEnd->nContent.GetIndex();
BOOL bDoesUndo = pDoc->DoesUndo();
pDoc->DoUndo( FALSE );
pDoc->SplitNode( rPos, false );
2000-09-18 23:08:29 +00:00
pDoc->DoUndo( bDoesUndo );
if( bCanMoveBack && rPos == *aCpyPam.GetPoint() )
{
// nach dem SplitNode, den CpyPam wieder richtig aufspannen
aCpyPam.Move( fnMoveBackward, fnGoCntnt );
aCpyPam.Move( fnMoveBackward, fnGoCntnt );
}
pDestNd = pDoc->GetNodes()[ aInsPos.GetIndex()-1 ]->GetTxtNode();
aDestIdx.Assign( pDestNd, pDestNd->GetTxt().Len() );
// korrigiere den Bereich wieder !!
if( bEndEqualIns )
{
BOOL bChg = pEnd != rPam.GetPoint();
if( bChg )
rPam.Exchange();
rPam.Move( fnMoveBackward, fnGoCntnt );
if( bChg )
rPam.Exchange();
aRg.aEnd = pEnd->nNode;
pEndNd = pEnd->nNode.GetNode().GetTxtNode();
2000-09-18 23:08:29 +00:00
}
else if( rPos == *pEnd ) // Wurde das Ende auch verschoben
{
pEnd->nNode--;
pEnd->nContent.Assign( pDestNd, nCntntEnd );
aRg.aEnd = pEnd->nNode;
pEndNd = pEnd->nNode.GetNode().GetTxtNode();
}
}
const SfxPoolItem * pItem = NULL;
const SfxItemSet * pAttrSet = pDestNd->GetpSwAttrSet();
/* #107213#: Safe numrule item at destination. */
int aState = SFX_ITEM_UNKNOWN;
SwNumRuleItem aNumRuleItem;
if (pAttrSet != NULL)
{
aState =
pAttrSet->GetItemState(RES_PARATR_NUMRULE, FALSE, &pItem);
if (SFX_ITEM_SET == aState)
aNumRuleItem = *((SwNumRuleItem *) pItem);
}
/* #107213# */
2000-09-18 23:08:29 +00:00
if( !bCopyOk )
{
xub_StrLen nCpyLen = ( bOneNode ? pEnd->nContent.GetIndex()
: pSttNd->GetTxt().Len() )
- pStt->nContent.GetIndex();
pSttNd->Copy( pDestNd, aDestIdx, pStt->nContent, nCpyLen );
if( bEndEqualIns )
pEnd->nContent -= nCpyLen;
}
if( bOneNode )
{
// ist der DestinationNode leer, kopiere die Vorlage mit
if( bCopyCollFmt )
{
pSttNd->CopyCollFmt( *pDestNd );
/* #107213# If only a part of one paragraph is copied
restore the numrule at the destination. */
if (! lcl_MarksWholeNode(rPam))
{
if (SFX_ITEM_SET == aState)
pDestNd->SetAttr(aNumRuleItem);
else
pDestNd->ResetAttr(RES_PARATR_NUMRULE);
}
2000-09-18 23:08:29 +00:00
}
2000-09-18 23:08:29 +00:00
break;
}
2000-09-18 23:08:29 +00:00
aRg.aStart++;
}
}
else if( pDestNd )
{
// Problems with insertion of table selections into "normal" text solved.
// We have to set the correct PaM for Undo, if this PaM starts in a textnode,
// the undo operation will try to merge this node after removing the table.
// If we didn't split a textnode, the PaM should start at the inserted table node
2000-09-18 23:08:29 +00:00
if( rPos.nContent.GetIndex() == pDestNd->Len() )
{ // Insertion at the last position of a textnode (empty or not)
aInsPos++; // The table will be inserted behind the text node
}
2000-09-18 23:08:29 +00:00
else if( rPos.nContent.GetIndex() )
{ // Insertion in the middle of a text node, it has to be split
// (and joined from undo)
bStartIsTxtNode = TRUE;
2000-09-18 23:08:29 +00:00
// splitte den TextNode, bei dem Eingefuegt wird.
xub_StrLen nCntntEnd = pEnd->nContent.GetIndex();
BOOL bDoesUndo = pDoc->DoesUndo();
pDoc->DoUndo( FALSE );
pDoc->SplitNode( rPos, false );
2000-09-18 23:08:29 +00:00
pDoc->DoUndo( bDoesUndo );
if( bCanMoveBack && rPos == *aCpyPam.GetPoint() )
{
// nach dem SplitNode, den CpyPam wieder richtig aufspannen
aCpyPam.Move( fnMoveBackward, fnGoCntnt );
aCpyPam.Move( fnMoveBackward, fnGoCntnt );
}
// korrigiere den Bereich wieder !!
if( bEndEqualIns )
aRg.aEnd--;
else if( rPos == *pEnd ) // Wurde das Ende auch verschoben
{
rPos.nNode-=2;
rPos.nContent.Assign( rPos.nNode.GetNode().GetCntntNode(),
nCntntEnd );
rPos.nNode++;
aRg.aEnd--;
}
}
else if( bCanMoveBack )
{ //Insertion at the first position of a text node. It will not be splitted, the table
// will be inserted before the text node.
// See below, before the SetInsertRange funciton of the undo object will be called,
// the CpyPam would be moved to the next content position. This has to be avoided
// We want to be moved to the table node itself thus we have to set bCanMoveBack
// and to manipulate aCpyPam.
bCanMoveBack = false;
aCpyPam.GetPoint()->nNode--;
}
2000-09-18 23:08:29 +00:00
}
pDestNd = aInsPos.GetNode().GetTxtNode();
if( pEndNd )
{
SwIndex aDestIdx( rPos.nContent );
if( !pDestNd )
{
pDestNd = pDoc->GetNodes().MakeTxtNode( aInsPos,
pDoc->GetTxtCollFromPool(RES_POOLCOLL_STANDARD));
aDestIdx.Assign( pDestNd, 0 );
aInsPos--;
// #112756# #98130# if we have to insert an extra text node
// at the destination, this node will be our new destination
// (text) node, and thus we set bStartisTxtNode to true. This
// will ensure that this node will be deleted during Undo
// using JoinNext.
DBG_ASSERT( !bStartIsTxtNode, "Oops, undo may be instable now." );
bStartIsTxtNode = TRUE;
2000-09-18 23:08:29 +00:00
}
const SfxPoolItem * pItem = NULL;
const SfxItemSet* pAttrSet = pDestNd->GetpSwAttrSet();
/* #107213# Save numrule at destination */
int aState = SFX_ITEM_UNKNOWN;
SwNumRuleItem aNumRuleItem;
if (pAttrSet != NULL)
{
aState =
pAttrSet->GetItemState(RES_PARATR_NUMRULE, FALSE, &pItem);
if (SFX_ITEM_SET == aState)
aNumRuleItem = *((SwNumRuleItem *) pItem);
}
/* #107213# */
2000-09-18 23:08:29 +00:00
BOOL bEmptyDestNd = 0 == pDestNd->GetTxt().Len();
pEndNd->Copy( pDestNd, aDestIdx, SwIndex( pEndNd ),
pEnd->nContent.GetIndex() );
// auch alle FormatVorlagen kopieren
if( bCopyCollFmt && ( bOneNode || bEmptyDestNd ))
{
pEndNd->CopyCollFmt( *pDestNd );
if (bOneNode)
{
/* #107213# If only a part of one paragraph is copied
restore the numrule at the destination. */
if ( ! lcl_MarksWholeNode(rPam))
{
if (SFX_ITEM_SET == aState)
pDestNd->SetAttr(aNumRuleItem);
else
pDestNd->ResetAttr(RES_PARATR_NUMRULE);
}
}
2000-09-18 23:08:29 +00:00
}
}
if( aRg.aStart != aRg.aEnd )
2000-09-18 23:08:29 +00:00
{
SfxItemSet aBrkSet( pDoc->GetAttrPool(), aBreakSetRange );
if( pSttNd && bCopyCollFmt && pDestNd->HasSwAttrSet() )
{
aBrkSet.Put( *pDestNd->GetpSwAttrSet() );
if( SFX_ITEM_SET == aBrkSet.GetItemState( RES_BREAK, FALSE ) )
pDestNd->ResetAttr( RES_BREAK );
if( SFX_ITEM_SET == aBrkSet.GetItemState( RES_PAGEDESC, FALSE ) )
pDestNd->ResetAttr( RES_PAGEDESC );
}
if( aInsPos == pEnd->nNode )
{
SwNodeIndex aSaveIdx( aInsPos, -1 );
CopyWithFlyInFly( aRg, aInsPos, bMakeNewFrms, FALSE );
aSaveIdx++;
pEnd->nNode = aSaveIdx;
pEnd->nContent.Assign( aSaveIdx.GetNode().GetTxtNode(), 0 );
}
else
CopyWithFlyInFly( aRg, aInsPos, bMakeNewFrms, FALSE );
2000-09-18 23:08:29 +00:00
bCopyBookmarks = FALSE;
// harte Umbrueche wieder in den ersten Node setzen
if( aBrkSet.Count() && 0 != ( pDestNd = pDoc->GetNodes()[
aCpyPam.GetPoint()->nNode.GetIndex()+1 ]->GetTxtNode() ) )
{
pDestNd->SetAttr( aBrkSet );
}
2000-09-18 23:08:29 +00:00
}
} while( FALSE );
// Position ummelden ( falls verschoben / im anderen Node )
rPos.nContent.Assign( rPos.nNode.GetNode().GetCntntNode(),
rPos.nContent.GetIndex() );
if( rPos.nNode != aInsPos )
{
aCpyPam.GetMark()->nNode = aInsPos;
aCpyPam.GetMark()->nContent.Assign( aCpyPam.GetCntntNode(FALSE), 0 );
rPos = *aCpyPam.GetMark();
}
else
*aCpyPam.GetMark() = rPos;
aCpyPam.Move( fnMoveForward, bCanMoveBack ? fnGoCntnt : fnGoNode );
aCpyPam.Exchange();
// dann kopiere noch alle Bookmarks
CWS-TOOLING: integrate CWS swrefactormarks2 2009-04-09 12:51:41 +0200 b_michaelsen r270689 : #i94949# cleaned up assertions after rebasing 2009-04-08 17:37:08 +0200 b_michaelsen r270658 : fixing sw/source/ui/utlui/makefile.mk 2009-04-07 17:56:54 +0200 b_michaelsen r270606 : added bookctrl.cxx to EXCEPTIONFILES, because this is needed for stl on unxsols4 2009-04-07 17:05:20 +0200 b_michaelsen r270603 : added crbm.cxx to EXCEPTIONFILES, because this is needed for stl on unxsols4 2009-04-02 23:44:38 +0200 b_michaelsen r270436 : CWS-TOOLING: rebase CWS swrefactormarks2 to trunk@270033 (milestone: DEV300:m45) 2009-02-27 16:25:31 +0100 b_michaelsen r268606 : #i94949# fixed Windows buildbreaker 2009-02-25 18:01:13 +0100 b_michaelsen r268464 : #i94949# Bookmarktest document filter roundtrips 2009-02-24 18:23:55 +0100 b_michaelsen r268404 : #i94949# Bookmark unittests 2009-02-23 19:47:44 +0100 b_michaelsen r268370 : #i94949# added unittest for bookmarks 2009-02-23 12:22:07 +0100 b_michaelsen r268348 : #i94949# fixing CheckCrossReferences testcase 2009-02-20 18:12:50 +0100 b_michaelsen r268335 : #i94949# fixing SwXTextRange 2009-02-18 18:32:57 +0100 b_michaelsen r268252 : #i94949# deregistering DdeBookmarks on delete 2009-02-18 18:29:08 +0100 b_michaelsen r268251 : fixing dbgoutsw.cxx for debug builds 2009-02-16 18:42:43 +0100 b_michaelsen r267834 : CWS-TOOLING: rebase CWS swrefactormarks2 to trunk@267171 (milestone: DEV300:m41) 2009-02-12 15:32:02 +0100 b_michaelsen r267667 : #i94949 fixed crossrefbookmark naming 2009-02-11 18:30:08 +0100 b_michaelsen r267624 : #94949# fixing bookmark navigation 2009-02-11 13:55:26 +0100 b_michaelsen r267599 : #i94949# fixed bookmark naming 2009-02-10 17:53:05 +0100 b_michaelsen r267571 : #i94949# renamed HasOtherMarkPos to IsExpanded 2009-02-10 17:23:01 +0100 b_michaelsen r267564 : #i94949# renamed ::sw::bookmark namespace to more fitting ::sw::mark 2009-02-10 16:16:32 +0100 b_michaelsen r267553 : #i94949# creating only CrossRefBookmark per Txtnode 2009-02-10 12:14:05 +0100 b_michaelsen r267547 : #i94949# fixed bookmark count in navigator 2009-02-09 19:12:18 +0100 b_michaelsen r267532 : #i94949# lcl_CopyBookmarks(..) - handle marks on boundaries correctly 2009-02-09 17:32:45 +0100 b_michaelsen r267524 : #i94949# setting the refobject of the DdeBookmark in Sin SwServerObject::SetDdeBookmark(..) 2009-02-09 17:22:15 +0100 b_michaelsen r267523 : #i94949# trying to harden SwServerObject 2009-02-09 16:47:32 +0100 b_michaelsen r267521 : #i94949# lcl_CopyBookmarks(..): try to get the source mark name, if possible 2009-02-09 16:05:42 +0100 b_michaelsen r267519 : #i94949# clearing the OtherMarkPos if PaM has no mark in repositionMark(..), swapping inverted bookmarks without hissing an assertion 2009-02-09 15:55:38 +0100 b_michaelsen r267518 : #i94949# checking for out-of-bounds in SwView::ExecuteStatusLine(..) 2009-02-09 15:23:47 +0100 b_michaelsen r267517 : #i94949# using an UNO_BOOKMARK in ui/dbui/dbinsdlg.cxx 2009-02-09 14:14:47 +0100 b_michaelsen r267514 : #i94949# IDocumentMarkAccess::GetType(..) asserts on unknown type 2009-02-09 14:04:25 +0100 b_michaelsen r267513 : #i94949# using rtl strings instead of tools-strings in CrossRefBookmarks 2009-02-09 13:55:01 +0100 b_michaelsen r267510 : #i94949# using empty string for UnoMark construction 2009-02-09 13:46:46 +0100 b_michaelsen r267509 : #i94949# removed superfluous #includes, removed superfluous member DdeBookmark::bGenerateName, initialized DdeBookmark::m_aRefObj removed superfluous local _FindItem::ClearObj 2009-02-06 14:38:37 +0100 b_michaelsen r267462 : #i94949# fixing FN_STAT_BOOKMARK dispatches 2009-02-05 18:05:07 +0100 b_michaelsen r267436 : #i94949# removing superfluous #includes 2009-02-04 15:51:31 +0100 b_michaelsen r267391 : fixing resync merge error 2009-02-02 19:39:55 +0100 b_michaelsen r267294 : #i94949# bookmark performance 2009-01-30 19:30:51 +0100 b_michaelsen r267229 : #i94949# throwing IllegalArgumentException, if appropriate 2009-01-30 19:29:56 +0100 b_michaelsen r267228 : #i94949# refactored lcl_FillBookmarkArray, comments, constness 2009-01-30 19:23:49 +0100 b_michaelsen r267227 : #i94949# refactored lcl_FillBookmarkArray, comments, constness 2009-01-30 19:16:06 +0100 b_michaelsen r267226 : #i94949# refactored lcl_FillBookmarkArray 2009-01-30 17:59:27 +0100 b_michaelsen r267222 : #i94949# removed superficial #include 2009-01-30 17:50:02 +0100 b_michaelsen r267220 : #i94949# SwXTextRange remembers its UNO bookmark 2009-01-29 20:19:58 +0100 b_michaelsen r267168 : #i94949# implemented IDocumentMarkAccess::findBookmark 2009-01-29 17:22:17 +0100 b_michaelsen r267162 : #i94949# implemented renameMark in Markmanager 2009-01-29 14:17:10 +0100 b_michaelsen r267134 : #i94949# cleanup in SwXBookmark, whitespace 2009-01-29 13:21:54 +0100 b_michaelsen r267125 : #i94949# cleanup in SwXBookmark, whitespace 2009-01-29 13:06:10 +0100 b_michaelsen r267120 : #i94949# cleanup in SwXBookmark, whitespace 2009-01-29 13:00:09 +0100 b_michaelsen r267118 : #i94949# cleanup in SwXBookmark, whitespace 2009-01-29 10:35:10 +0100 b_michaelsen r267101 : #i94949# renamed SetCrsrToBkmk to SetCrsrToMark, moving to start/end of doc if no more bookmarks can be found 2009-01-28 17:05:36 +0100 b_michaelsen r267070 : #i94949# fixed order in aProvNamesId in unocoll.cxx 2009-01-28 15:46:13 +0100 b_michaelsen r267063 : #i94949# documentation 2009-01-28 15:36:59 +0100 b_michaelsen r267062 : #i94949# removing superficial #include 2009-01-28 15:30:36 +0100 b_michaelsen r267061 : #i94949# basic code conventions 2009-01-28 11:14:30 +0100 b_michaelsen r267039 : #i94949# comparing to the actual name of the new mark 2009-01-26 15:22:25 +0100 b_michaelsen r266927 : #i94949# performance fixes 2009-01-14 21:16:56 +0100 b_michaelsen r266332 : #i94949# fixing linux x86-64 compiler warnings 2009-01-14 19:52:06 +0100 b_michaelsen r266331 : #i94949# fixing some compiler warnings 2008-12-15 13:04:49 +0100 b_michaelsen r265474 : #i94949# fixed microsoft compiler warnings 2008-12-12 18:26:02 +0100 b_michaelsen r265434 : #i94949# fixed pro platform buildbreakers 2008-12-11 17:51:24 +0100 b_michaelsen r265342 : CWS-TOOLING: rebase CWS swrefactormarks2 to trunk@264807 (milestone: DEV300:m37) 2008-12-09 18:30:59 +0100 b_michaelsen r265134 : #i94949# fixed IDocumentMarkAccess::GetType for new mark inheritance tree 2008-12-09 16:56:26 +0100 b_michaelsen r265118 : #i94949# fixed deleteMark optimization 2008-12-09 14:55:58 +0100 b_michaelsen r265092 : #i94949# DdeLink and DdeBookmark 2008-12-05 18:28:05 +0100 b_michaelsen r264914 : #i94949# fixed InitDoc in bookmarks 2008-12-02 02:23:51 +0100 b_michaelsen r264649 : #i94949# removed obsolete naming proposal code in SwXTextRange, fixed navigator reminders to forget the oldest reminder when the pool is empty 2008-12-02 02:05:19 +0100 b_michaelsen r264648 : #i94949# using bisect search for delete 2008-12-02 01:58:16 +0100 b_michaelsen r264647 : #i94949# using bisect search for delete 2008-12-02 01:37:33 +0100 b_michaelsen r264646 : #i94949# using bisect search for delete 2008-12-02 01:03:29 +0100 b_michaelsen r264645 : #i94949# fixed deleteMark crash 2008-12-01 20:55:00 +0100 b_michaelsen r264638 : #i94949# removed crossrefs from ui enumerations 2008-12-01 15:48:12 +0100 b_michaelsen r264613 : #i94949# removed superfluous local functions 2008-12-01 15:01:19 +0100 b_michaelsen r264608 : #i94949# optimized insertion of new marks 2008-12-01 14:33:21 +0100 b_michaelsen r264603 : #i94949# simplified code finding Fieldmark for a position 2008-12-01 14:05:55 +0100 b_michaelsen r264598 : #i94949# fixed reverse travelling through marks, removed obsolete getUniqueMarkName() 2008-11-27 18:48:15 +0100 b_michaelsen r264515 : #i94949# fixed _SaveCntntIdx and friends 2008-11-27 15:59:49 +0100 b_michaelsen r264500 : #i94949# fix Mark position only in ctor 2008-11-27 15:52:28 +0100 b_michaelsen r264497 : #i94949# fixed Bug in SwXBookmark, was using pDoc too early 2008-11-26 14:54:22 +0100 b_michaelsen r264396 : #i94949# fixed documentation, simplified navigator reminder code 2008-11-24 20:45:51 +0100 b_michaelsen r264266 : #i94949# removed last obsolete getUniqueMarkName calls 2008-11-24 20:21:35 +0100 b_michaelsen r264265 : #i94949# fixed typo in IDocumentMarkAccess, removed obsolete getUniqueMarkName calls 2008-11-24 18:34:32 +0100 b_michaelsen r264264 : #i94949# repositioning of Marks, removed possibility to delete marks by name in the core, refactoring of navigator reminder generation 2008-11-21 14:08:49 +0100 b_michaelsen r264137 : #i94949# simplified makeMark 2008-11-21 12:07:09 +0100 b_michaelsen r264120 : #i94949# moved ShortName and KeyCode from IMark to IBookmark 2008-11-19 12:50:49 +0100 b_michaelsen r263981 : #i94949# starting refactoring of bookmark naming 2008-11-19 11:31:08 +0100 b_michaelsen r263972 : #i94949# getting rid of obsolete dynamic casts 2008-11-18 19:06:09 +0100 b_michaelsen r263795 : #i94949# getting rid of index based mark access, IDocumentMarkAccess already provides iterators 2008-11-18 17:50:18 +0100 b_michaelsen r263792 : #i94949# getting rid of index based mark access, IDocumentMarkAccess already provides iterators 2008-11-18 16:48:20 +0100 b_michaelsen r263783 : #i94949# removed methods from crsrsh which are already available directly via IDocumentMarkAccess 2008-11-18 11:31:35 +0100 b_michaelsen r263753 : #i94949# cleaning up mark code in crsrsh 2008-11-17 10:15:25 +0100 b_michaelsen r263705 : #i94949# removed possible integer overflow 2008-11-14 18:48:45 +0100 b_michaelsen r263695 : #i94949# management of mark names in MarkManager 2008-11-14 18:23:40 +0100 b_michaelsen r263693 : #i94949# using polymorphism to do mark-specific setup in SwDoc 2008-11-14 16:27:09 +0100 b_michaelsen r263684 : #i94949# got rid of makeCrossRefBookmark 2008-11-14 13:03:32 +0100 b_michaelsen r263674 : #i94949# refactored Correction methods 2008-11-13 12:27:55 +0100 b_michaelsen r263631 : #i94949# got rid of old-style tools assertions in new code 2008-11-12 16:58:16 +0100 b_michaelsen r263608 : #i94949# added assertion for unique names 2008-11-12 16:55:18 +0100 b_michaelsen r263607 : #i94949# maked XFormField deprecated 2008-11-12 13:04:29 +0100 b_michaelsen r263587 : #i94949# replaced IDocumentMarkAccess::GetType with simple dynamic_cast where possible 2008-11-11 18:45:53 +0100 b_michaelsen r263572 : #i94949# cleaned up SwHstryBookmark 2008-11-11 13:48:18 +0100 b_michaelsen r263557 : #i94949# removed dynamic_casts to SwModify by inheriting IMark from it 2008-11-11 11:26:28 +0100 b_michaelsen r263548 : #i94949# fixed SwXBookmark 2008-11-10 17:01:19 +0100 b_michaelsen r263529 : #i94949# fixed DdeBookmarks in clipboard 2008-11-10 16:44:52 +0100 b_michaelsen r263527 : #i94949# formatting 2008-11-10 16:29:16 +0100 b_michaelsen r263526 : #i94949# fixing unoobj.cxx 2008-11-10 16:23:50 +0100 b_michaelsen r263525 : #i94949# cleaning up crossrefbookmark.cxx/.hxx 2008-11-10 16:02:08 +0100 b_michaelsen r263524 : #i94949# Pdf Export should only generate 'real' bookmarks 2008-11-10 15:33:58 +0100 b_michaelsen r263521 : #i94949# removed const_casts 2008-11-10 15:12:06 +0100 b_michaelsen r263520 : #i94949# moved _DelBookmarks into MarksManager 2008-11-07 18:48:38 +0100 b_michaelsen r263480 : #i94949# using iterator interface 2008-11-07 18:41:46 +0100 b_michaelsen r263478 : #i94949# using iterator interface 2008-11-07 18:07:41 +0100 b_michaelsen r263477 : #i94949# using iterator interface 2008-11-07 17:54:41 +0100 b_michaelsen r263476 : #i94949# using iterator interface 2008-11-07 17:44:41 +0100 b_michaelsen r263475 : #i94949# moved correction methods into MarkManager 2008-11-06 18:47:28 +0100 b_michaelsen r263404 : #i94949# getting rid of superfluous const_casts 2008-11-06 17:58:01 +0100 b_michaelsen r263403 : #i94949# no more setting of mark positions outside of the core 2008-11-06 17:08:37 +0100 b_michaelsen r263401 : #i94949# removed setters from IMark 2008-11-06 13:55:25 +0100 b_michaelsen r263383 : #i94949 SwDoc does not implement IDocumentMarkAccess anymore 2008-11-04 18:17:03 +0100 b_michaelsen r263333 : #i94949# began removing IDocumentMarkAccess from SwDoc 2008-11-04 16:48:34 +0100 b_michaelsen r263330 : removing dead code (SwBitArray) found by mst 2008-11-04 16:29:32 +0100 b_michaelsen r263329 : removing dead code (SwBitArray) found by mst 2008-11-04 14:57:48 +0100 b_michaelsen r263326 : removing dead code (SwBitArray) found by mst 2008-11-04 14:50:18 +0100 b_michaelsen r263325 : #i94949# stricter typing in IDocumentMarkAccess 2008-10-24 15:16:27 +0200 b_michaelsen r262647 : #i94949# renamed ::sw::bookmark::SimpleMark to NavigatorReminder to fit the IDocumentMarkAccess enum 2008-10-24 15:10:10 +0200 b_michaelsen r262646 : #i94949# only 'real' bookmark implement IBookmark, Marks also get removed from m_vFieldmarks on delete/clear 2008-10-24 13:06:23 +0200 b_michaelsen r262636 : #i94949# Fieldmark tabnavigation 2008-10-23 12:16:36 +0200 b_michaelsen r262619 : #i94949# Fieldmark classes and filters 2008-10-22 13:17:18 +0200 b_michaelsen r262597 : #i94949# writer import fixes 2008-10-21 11:30:38 +0200 b_michaelsen r262565 : #i94949# renamed methods containing Bookmark in the generic IMark interface 2008-10-20 14:09:02 +0200 b_michaelsen r262318 : #i94949# fixed SwDoc::CorrRel 2008-10-16 22:45:13 +0200 b_michaelsen r262273 : #i94949 simplified Before/After methods 2008-10-16 21:40:57 +0200 b_michaelsen r262271 : #i94949 renamed SimpleMark to NavigatorReminder 2008-10-16 21:15:23 +0200 b_michaelsen r262270 : #i94949 using shared_ptr only in MarkManager 2008-10-16 17:46:37 +0200 b_michaelsen r262269 : #i94949# getFieldmarkBefore and getFieldmarkAfter 2008-10-16 17:12:13 +0200 b_michaelsen r262265 : #i94949# cleanup in crbm.cxx 2008-10-16 12:49:01 +0200 b_michaelsen r262257 : #i94949# fixed usage of invalid iterator, fixed invalid cast 2008-10-15 15:34:20 +0200 b_michaelsen r262239 : #i94949# added moved files 2008-10-15 15:26:45 +0200 b_michaelsen r262237 : #i94949# initial reimplementation of Bookmarks
2009-04-21 15:40:02 +00:00
if( bCopyBookmarks && getIDocumentMarkAccess()->getMarksCount() )
2000-09-18 23:08:29 +00:00
lcl_CopyBookmarks( rPam, aCpyPam );
if( nsRedlineMode_t::REDLINE_DELETE_REDLINES & eOld )
2000-09-18 23:08:29 +00:00
lcl_DeleteRedlines( rPam, aCpyPam );
// falls Undo eingeschaltet ist, so speicher den eingefuegten Bereich
if( pDoc->DoesUndo() )
pUndo->SetInsertRange( aCpyPam, TRUE, bStartIsTxtNode );
2000-09-18 23:08:29 +00:00
if( pCpyRange )
{
pCpyRange->SetMark();
*pCpyRange->GetPoint() = *aCpyPam.GetPoint();
*pCpyRange->GetMark() = *aCpyPam.GetMark();
}
if (pNumRuleToPropagate)
pDoc->ReplaceNumRule(aCpyPam, *pNumRuleToPropagate);
2000-09-18 23:08:29 +00:00
pDoc->SetRedlineMode_intern( eOld );
pDoc->SetModified();
2000-09-18 23:08:29 +00:00
return TRUE;
}
// ----- Copy-Methode vom SwDoc - "kopiere Fly's in Fly's" ------
void SwDoc::CopyWithFlyInFly( const SwNodeRange& rRg,
const SwNodeIndex& rInsPos, BOOL bMakeNewFrms,
BOOL bDelRedlines, BOOL bCopyFlyAtFly ) const
{
SwDoc* pDest = rInsPos.GetNode().GetDoc();
_SaveRedlEndPosForRestore aRedlRest( rInsPos, 0 );
2000-09-18 23:08:29 +00:00
SwNodeIndex aSavePos( rInsPos, -1 );
BOOL bEndIsEqualEndPos = rInsPos == rRg.aEnd;
2000-09-18 23:08:29 +00:00
GetNodes()._CopyNodes( rRg, rInsPos, bMakeNewFrms, TRUE );
aSavePos++;
if( bEndIsEqualEndPos )
((SwNodeIndex&)rRg.aEnd) = aSavePos;
2000-09-18 23:08:29 +00:00
aRedlRest.Restore();
#ifndef PRODUCT
{
//JP 17.06.99: Bug 66973 - check count only if the selection is in
// the same (or no) section. Becaus not full selected
// section are not copied.
const SwSectionNode* pSSectNd = rRg.aStart.GetNode().FindSectionNode();
SwNodeIndex aTmpI( rRg.aEnd, -1 );
const SwSectionNode* pESectNd = aTmpI.GetNode().FindSectionNode();
if( pSSectNd == pESectNd &&
!rRg.aStart.GetNode().IsSectionNode() &&
!aTmpI.GetNode().IsEndNode() )
{
ASSERT( rInsPos.GetIndex() - aSavePos.GetIndex() ==
2000-09-18 23:08:29 +00:00
rRg.aEnd.GetIndex() - rRg.aStart.GetIndex(),
"Es wurden zu wenig Nodes kopiert!" )
}
}
#endif
// Undo abschalten
BOOL bUndo = pDest->DoesUndo();
pDest->DoUndo( FALSE );
_CopyFlyInFly( rRg, aSavePos, bCopyFlyAtFly );
pDest->DoUndo( bUndo );
SwNodeRange aCpyRange( aSavePos, rInsPos );
// dann kopiere noch alle Bookmarks
CWS-TOOLING: integrate CWS swrefactormarks2 2009-04-09 12:51:41 +0200 b_michaelsen r270689 : #i94949# cleaned up assertions after rebasing 2009-04-08 17:37:08 +0200 b_michaelsen r270658 : fixing sw/source/ui/utlui/makefile.mk 2009-04-07 17:56:54 +0200 b_michaelsen r270606 : added bookctrl.cxx to EXCEPTIONFILES, because this is needed for stl on unxsols4 2009-04-07 17:05:20 +0200 b_michaelsen r270603 : added crbm.cxx to EXCEPTIONFILES, because this is needed for stl on unxsols4 2009-04-02 23:44:38 +0200 b_michaelsen r270436 : CWS-TOOLING: rebase CWS swrefactormarks2 to trunk@270033 (milestone: DEV300:m45) 2009-02-27 16:25:31 +0100 b_michaelsen r268606 : #i94949# fixed Windows buildbreaker 2009-02-25 18:01:13 +0100 b_michaelsen r268464 : #i94949# Bookmarktest document filter roundtrips 2009-02-24 18:23:55 +0100 b_michaelsen r268404 : #i94949# Bookmark unittests 2009-02-23 19:47:44 +0100 b_michaelsen r268370 : #i94949# added unittest for bookmarks 2009-02-23 12:22:07 +0100 b_michaelsen r268348 : #i94949# fixing CheckCrossReferences testcase 2009-02-20 18:12:50 +0100 b_michaelsen r268335 : #i94949# fixing SwXTextRange 2009-02-18 18:32:57 +0100 b_michaelsen r268252 : #i94949# deregistering DdeBookmarks on delete 2009-02-18 18:29:08 +0100 b_michaelsen r268251 : fixing dbgoutsw.cxx for debug builds 2009-02-16 18:42:43 +0100 b_michaelsen r267834 : CWS-TOOLING: rebase CWS swrefactormarks2 to trunk@267171 (milestone: DEV300:m41) 2009-02-12 15:32:02 +0100 b_michaelsen r267667 : #i94949 fixed crossrefbookmark naming 2009-02-11 18:30:08 +0100 b_michaelsen r267624 : #94949# fixing bookmark navigation 2009-02-11 13:55:26 +0100 b_michaelsen r267599 : #i94949# fixed bookmark naming 2009-02-10 17:53:05 +0100 b_michaelsen r267571 : #i94949# renamed HasOtherMarkPos to IsExpanded 2009-02-10 17:23:01 +0100 b_michaelsen r267564 : #i94949# renamed ::sw::bookmark namespace to more fitting ::sw::mark 2009-02-10 16:16:32 +0100 b_michaelsen r267553 : #i94949# creating only CrossRefBookmark per Txtnode 2009-02-10 12:14:05 +0100 b_michaelsen r267547 : #i94949# fixed bookmark count in navigator 2009-02-09 19:12:18 +0100 b_michaelsen r267532 : #i94949# lcl_CopyBookmarks(..) - handle marks on boundaries correctly 2009-02-09 17:32:45 +0100 b_michaelsen r267524 : #i94949# setting the refobject of the DdeBookmark in Sin SwServerObject::SetDdeBookmark(..) 2009-02-09 17:22:15 +0100 b_michaelsen r267523 : #i94949# trying to harden SwServerObject 2009-02-09 16:47:32 +0100 b_michaelsen r267521 : #i94949# lcl_CopyBookmarks(..): try to get the source mark name, if possible 2009-02-09 16:05:42 +0100 b_michaelsen r267519 : #i94949# clearing the OtherMarkPos if PaM has no mark in repositionMark(..), swapping inverted bookmarks without hissing an assertion 2009-02-09 15:55:38 +0100 b_michaelsen r267518 : #i94949# checking for out-of-bounds in SwView::ExecuteStatusLine(..) 2009-02-09 15:23:47 +0100 b_michaelsen r267517 : #i94949# using an UNO_BOOKMARK in ui/dbui/dbinsdlg.cxx 2009-02-09 14:14:47 +0100 b_michaelsen r267514 : #i94949# IDocumentMarkAccess::GetType(..) asserts on unknown type 2009-02-09 14:04:25 +0100 b_michaelsen r267513 : #i94949# using rtl strings instead of tools-strings in CrossRefBookmarks 2009-02-09 13:55:01 +0100 b_michaelsen r267510 : #i94949# using empty string for UnoMark construction 2009-02-09 13:46:46 +0100 b_michaelsen r267509 : #i94949# removed superfluous #includes, removed superfluous member DdeBookmark::bGenerateName, initialized DdeBookmark::m_aRefObj removed superfluous local _FindItem::ClearObj 2009-02-06 14:38:37 +0100 b_michaelsen r267462 : #i94949# fixing FN_STAT_BOOKMARK dispatches 2009-02-05 18:05:07 +0100 b_michaelsen r267436 : #i94949# removing superfluous #includes 2009-02-04 15:51:31 +0100 b_michaelsen r267391 : fixing resync merge error 2009-02-02 19:39:55 +0100 b_michaelsen r267294 : #i94949# bookmark performance 2009-01-30 19:30:51 +0100 b_michaelsen r267229 : #i94949# throwing IllegalArgumentException, if appropriate 2009-01-30 19:29:56 +0100 b_michaelsen r267228 : #i94949# refactored lcl_FillBookmarkArray, comments, constness 2009-01-30 19:23:49 +0100 b_michaelsen r267227 : #i94949# refactored lcl_FillBookmarkArray, comments, constness 2009-01-30 19:16:06 +0100 b_michaelsen r267226 : #i94949# refactored lcl_FillBookmarkArray 2009-01-30 17:59:27 +0100 b_michaelsen r267222 : #i94949# removed superficial #include 2009-01-30 17:50:02 +0100 b_michaelsen r267220 : #i94949# SwXTextRange remembers its UNO bookmark 2009-01-29 20:19:58 +0100 b_michaelsen r267168 : #i94949# implemented IDocumentMarkAccess::findBookmark 2009-01-29 17:22:17 +0100 b_michaelsen r267162 : #i94949# implemented renameMark in Markmanager 2009-01-29 14:17:10 +0100 b_michaelsen r267134 : #i94949# cleanup in SwXBookmark, whitespace 2009-01-29 13:21:54 +0100 b_michaelsen r267125 : #i94949# cleanup in SwXBookmark, whitespace 2009-01-29 13:06:10 +0100 b_michaelsen r267120 : #i94949# cleanup in SwXBookmark, whitespace 2009-01-29 13:00:09 +0100 b_michaelsen r267118 : #i94949# cleanup in SwXBookmark, whitespace 2009-01-29 10:35:10 +0100 b_michaelsen r267101 : #i94949# renamed SetCrsrToBkmk to SetCrsrToMark, moving to start/end of doc if no more bookmarks can be found 2009-01-28 17:05:36 +0100 b_michaelsen r267070 : #i94949# fixed order in aProvNamesId in unocoll.cxx 2009-01-28 15:46:13 +0100 b_michaelsen r267063 : #i94949# documentation 2009-01-28 15:36:59 +0100 b_michaelsen r267062 : #i94949# removing superficial #include 2009-01-28 15:30:36 +0100 b_michaelsen r267061 : #i94949# basic code conventions 2009-01-28 11:14:30 +0100 b_michaelsen r267039 : #i94949# comparing to the actual name of the new mark 2009-01-26 15:22:25 +0100 b_michaelsen r266927 : #i94949# performance fixes 2009-01-14 21:16:56 +0100 b_michaelsen r266332 : #i94949# fixing linux x86-64 compiler warnings 2009-01-14 19:52:06 +0100 b_michaelsen r266331 : #i94949# fixing some compiler warnings 2008-12-15 13:04:49 +0100 b_michaelsen r265474 : #i94949# fixed microsoft compiler warnings 2008-12-12 18:26:02 +0100 b_michaelsen r265434 : #i94949# fixed pro platform buildbreakers 2008-12-11 17:51:24 +0100 b_michaelsen r265342 : CWS-TOOLING: rebase CWS swrefactormarks2 to trunk@264807 (milestone: DEV300:m37) 2008-12-09 18:30:59 +0100 b_michaelsen r265134 : #i94949# fixed IDocumentMarkAccess::GetType for new mark inheritance tree 2008-12-09 16:56:26 +0100 b_michaelsen r265118 : #i94949# fixed deleteMark optimization 2008-12-09 14:55:58 +0100 b_michaelsen r265092 : #i94949# DdeLink and DdeBookmark 2008-12-05 18:28:05 +0100 b_michaelsen r264914 : #i94949# fixed InitDoc in bookmarks 2008-12-02 02:23:51 +0100 b_michaelsen r264649 : #i94949# removed obsolete naming proposal code in SwXTextRange, fixed navigator reminders to forget the oldest reminder when the pool is empty 2008-12-02 02:05:19 +0100 b_michaelsen r264648 : #i94949# using bisect search for delete 2008-12-02 01:58:16 +0100 b_michaelsen r264647 : #i94949# using bisect search for delete 2008-12-02 01:37:33 +0100 b_michaelsen r264646 : #i94949# using bisect search for delete 2008-12-02 01:03:29 +0100 b_michaelsen r264645 : #i94949# fixed deleteMark crash 2008-12-01 20:55:00 +0100 b_michaelsen r264638 : #i94949# removed crossrefs from ui enumerations 2008-12-01 15:48:12 +0100 b_michaelsen r264613 : #i94949# removed superfluous local functions 2008-12-01 15:01:19 +0100 b_michaelsen r264608 : #i94949# optimized insertion of new marks 2008-12-01 14:33:21 +0100 b_michaelsen r264603 : #i94949# simplified code finding Fieldmark for a position 2008-12-01 14:05:55 +0100 b_michaelsen r264598 : #i94949# fixed reverse travelling through marks, removed obsolete getUniqueMarkName() 2008-11-27 18:48:15 +0100 b_michaelsen r264515 : #i94949# fixed _SaveCntntIdx and friends 2008-11-27 15:59:49 +0100 b_michaelsen r264500 : #i94949# fix Mark position only in ctor 2008-11-27 15:52:28 +0100 b_michaelsen r264497 : #i94949# fixed Bug in SwXBookmark, was using pDoc too early 2008-11-26 14:54:22 +0100 b_michaelsen r264396 : #i94949# fixed documentation, simplified navigator reminder code 2008-11-24 20:45:51 +0100 b_michaelsen r264266 : #i94949# removed last obsolete getUniqueMarkName calls 2008-11-24 20:21:35 +0100 b_michaelsen r264265 : #i94949# fixed typo in IDocumentMarkAccess, removed obsolete getUniqueMarkName calls 2008-11-24 18:34:32 +0100 b_michaelsen r264264 : #i94949# repositioning of Marks, removed possibility to delete marks by name in the core, refactoring of navigator reminder generation 2008-11-21 14:08:49 +0100 b_michaelsen r264137 : #i94949# simplified makeMark 2008-11-21 12:07:09 +0100 b_michaelsen r264120 : #i94949# moved ShortName and KeyCode from IMark to IBookmark 2008-11-19 12:50:49 +0100 b_michaelsen r263981 : #i94949# starting refactoring of bookmark naming 2008-11-19 11:31:08 +0100 b_michaelsen r263972 : #i94949# getting rid of obsolete dynamic casts 2008-11-18 19:06:09 +0100 b_michaelsen r263795 : #i94949# getting rid of index based mark access, IDocumentMarkAccess already provides iterators 2008-11-18 17:50:18 +0100 b_michaelsen r263792 : #i94949# getting rid of index based mark access, IDocumentMarkAccess already provides iterators 2008-11-18 16:48:20 +0100 b_michaelsen r263783 : #i94949# removed methods from crsrsh which are already available directly via IDocumentMarkAccess 2008-11-18 11:31:35 +0100 b_michaelsen r263753 : #i94949# cleaning up mark code in crsrsh 2008-11-17 10:15:25 +0100 b_michaelsen r263705 : #i94949# removed possible integer overflow 2008-11-14 18:48:45 +0100 b_michaelsen r263695 : #i94949# management of mark names in MarkManager 2008-11-14 18:23:40 +0100 b_michaelsen r263693 : #i94949# using polymorphism to do mark-specific setup in SwDoc 2008-11-14 16:27:09 +0100 b_michaelsen r263684 : #i94949# got rid of makeCrossRefBookmark 2008-11-14 13:03:32 +0100 b_michaelsen r263674 : #i94949# refactored Correction methods 2008-11-13 12:27:55 +0100 b_michaelsen r263631 : #i94949# got rid of old-style tools assertions in new code 2008-11-12 16:58:16 +0100 b_michaelsen r263608 : #i94949# added assertion for unique names 2008-11-12 16:55:18 +0100 b_michaelsen r263607 : #i94949# maked XFormField deprecated 2008-11-12 13:04:29 +0100 b_michaelsen r263587 : #i94949# replaced IDocumentMarkAccess::GetType with simple dynamic_cast where possible 2008-11-11 18:45:53 +0100 b_michaelsen r263572 : #i94949# cleaned up SwHstryBookmark 2008-11-11 13:48:18 +0100 b_michaelsen r263557 : #i94949# removed dynamic_casts to SwModify by inheriting IMark from it 2008-11-11 11:26:28 +0100 b_michaelsen r263548 : #i94949# fixed SwXBookmark 2008-11-10 17:01:19 +0100 b_michaelsen r263529 : #i94949# fixed DdeBookmarks in clipboard 2008-11-10 16:44:52 +0100 b_michaelsen r263527 : #i94949# formatting 2008-11-10 16:29:16 +0100 b_michaelsen r263526 : #i94949# fixing unoobj.cxx 2008-11-10 16:23:50 +0100 b_michaelsen r263525 : #i94949# cleaning up crossrefbookmark.cxx/.hxx 2008-11-10 16:02:08 +0100 b_michaelsen r263524 : #i94949# Pdf Export should only generate 'real' bookmarks 2008-11-10 15:33:58 +0100 b_michaelsen r263521 : #i94949# removed const_casts 2008-11-10 15:12:06 +0100 b_michaelsen r263520 : #i94949# moved _DelBookmarks into MarksManager 2008-11-07 18:48:38 +0100 b_michaelsen r263480 : #i94949# using iterator interface 2008-11-07 18:41:46 +0100 b_michaelsen r263478 : #i94949# using iterator interface 2008-11-07 18:07:41 +0100 b_michaelsen r263477 : #i94949# using iterator interface 2008-11-07 17:54:41 +0100 b_michaelsen r263476 : #i94949# using iterator interface 2008-11-07 17:44:41 +0100 b_michaelsen r263475 : #i94949# moved correction methods into MarkManager 2008-11-06 18:47:28 +0100 b_michaelsen r263404 : #i94949# getting rid of superfluous const_casts 2008-11-06 17:58:01 +0100 b_michaelsen r263403 : #i94949# no more setting of mark positions outside of the core 2008-11-06 17:08:37 +0100 b_michaelsen r263401 : #i94949# removed setters from IMark 2008-11-06 13:55:25 +0100 b_michaelsen r263383 : #i94949 SwDoc does not implement IDocumentMarkAccess anymore 2008-11-04 18:17:03 +0100 b_michaelsen r263333 : #i94949# began removing IDocumentMarkAccess from SwDoc 2008-11-04 16:48:34 +0100 b_michaelsen r263330 : removing dead code (SwBitArray) found by mst 2008-11-04 16:29:32 +0100 b_michaelsen r263329 : removing dead code (SwBitArray) found by mst 2008-11-04 14:57:48 +0100 b_michaelsen r263326 : removing dead code (SwBitArray) found by mst 2008-11-04 14:50:18 +0100 b_michaelsen r263325 : #i94949# stricter typing in IDocumentMarkAccess 2008-10-24 15:16:27 +0200 b_michaelsen r262647 : #i94949# renamed ::sw::bookmark::SimpleMark to NavigatorReminder to fit the IDocumentMarkAccess enum 2008-10-24 15:10:10 +0200 b_michaelsen r262646 : #i94949# only 'real' bookmark implement IBookmark, Marks also get removed from m_vFieldmarks on delete/clear 2008-10-24 13:06:23 +0200 b_michaelsen r262636 : #i94949# Fieldmark tabnavigation 2008-10-23 12:16:36 +0200 b_michaelsen r262619 : #i94949# Fieldmark classes and filters 2008-10-22 13:17:18 +0200 b_michaelsen r262597 : #i94949# writer import fixes 2008-10-21 11:30:38 +0200 b_michaelsen r262565 : #i94949# renamed methods containing Bookmark in the generic IMark interface 2008-10-20 14:09:02 +0200 b_michaelsen r262318 : #i94949# fixed SwDoc::CorrRel 2008-10-16 22:45:13 +0200 b_michaelsen r262273 : #i94949 simplified Before/After methods 2008-10-16 21:40:57 +0200 b_michaelsen r262271 : #i94949 renamed SimpleMark to NavigatorReminder 2008-10-16 21:15:23 +0200 b_michaelsen r262270 : #i94949 using shared_ptr only in MarkManager 2008-10-16 17:46:37 +0200 b_michaelsen r262269 : #i94949# getFieldmarkBefore and getFieldmarkAfter 2008-10-16 17:12:13 +0200 b_michaelsen r262265 : #i94949# cleanup in crbm.cxx 2008-10-16 12:49:01 +0200 b_michaelsen r262257 : #i94949# fixed usage of invalid iterator, fixed invalid cast 2008-10-15 15:34:20 +0200 b_michaelsen r262239 : #i94949# added moved files 2008-10-15 15:26:45 +0200 b_michaelsen r262237 : #i94949# initial reimplementation of Bookmarks
2009-04-21 15:40:02 +00:00
if( getIDocumentMarkAccess()->getMarksCount() )
2000-09-18 23:08:29 +00:00
{
SwPaM aRgTmp( rRg.aStart, rRg.aEnd );
SwPaM aCpyTmp( aCpyRange.aStart, aCpyRange.aEnd );
lcl_CopyBookmarks( aRgTmp, aCpyTmp );
}
if( bDelRedlines && ( nsRedlineMode_t::REDLINE_DELETE_REDLINES & pDest->GetRedlineMode() ))
2000-09-18 23:08:29 +00:00
lcl_DeleteRedlines( rRg, aCpyRange );
pDest->GetNodes()._DelDummyNodes( aCpyRange );
}
void lcl_ChainFmts( SwFlyFrmFmt *pSrc, SwFlyFrmFmt *pDest )
{
SwFmtChain aSrc( pSrc->GetChain() );
if ( !aSrc.GetNext() )
{
aSrc.SetNext( pDest );
pSrc->SetFmtAttr( aSrc );
2000-09-18 23:08:29 +00:00
}
SwFmtChain aDest( pDest->GetChain() );
if ( !aDest.GetPrev() )
{
aDest.SetPrev( pSrc );
pDest->SetFmtAttr( aDest );
2000-09-18 23:08:29 +00:00
}
}
void SwDoc::_CopyFlyInFly( const SwNodeRange& rRg, const SwNodeIndex& rSttIdx,
BOOL bCopyFlyAtFly ) const
{
// Bug 22727: suche erst mal alle Flys zusammen, sortiere sie entsprechend
// ihrer Ordnungsnummer und kopiere sie erst dann. Damit wird
// die Ordnungsnummer (wird nur im DrawModel verwaltet)
// beibehalten.
SwDoc* pDest = rSttIdx.GetNode().GetDoc();
_ZSortFlys aArr;
USHORT nArrLen = GetSpzFrmFmts()->Count();
USHORT n;
for( n = 0; n < nArrLen; ++n )
2000-09-18 23:08:29 +00:00
{
const SwFrmFmt* pFmt = (*GetSpzFrmFmts())[n];
const SwFmtAnchor* pAnchor = &pFmt->GetAnchor();
const SwPosition* pAPos;
if ( ( pAnchor->GetAnchorId() == FLY_AT_CNTNT ||
pAnchor->GetAnchorId() == FLY_AT_FLY ||
pAnchor->GetAnchorId() == FLY_AUTO_CNTNT ) &&
0 != ( pAPos = pAnchor->GetCntntAnchor()) &&
(( bCopyFlyAtFly && FLY_AT_FLY == pAnchor->GetAnchorId() )
? rRg.aStart <= pAPos->nNode.GetIndex() + 1
: ( IsRedlineMove()
? rRg.aStart < pAPos->nNode
: rRg.aStart <= pAPos->nNode )) &&
pAPos->nNode < rRg.aEnd )
{
aArr.Insert( _ZSortFly( pFmt, pAnchor, nArrLen + aArr.Count() ));
}
}
//Alle kopierten (also die neu erzeugten) Rahmen in ein weiteres Array
//stopfen. Dort sizten sie passend zu den Originalen, damit hinterher
//die Chains entsprechend aufgebaut werden koennen.
SvPtrarr aNewArr( 10, 10 );
for( n = 0; n < aArr.Count(); ++n )
{
const _ZSortFly& rZSortFly = aArr[ n ];
// --> OD 2006-01-04 #i59964#
// correct determination of new anchor position
2000-09-18 23:08:29 +00:00
SwFmtAnchor aAnchor( *rZSortFly.GetAnchor() );
SwPosition* pNewPos = (SwPosition*)aAnchor.GetCntntAnchor();
// for at-paragraph and at-character anchored objects the new anchor
// position can *not* be determined by the difference of the current
// anchor position to the start of the copied range, because not
// complete selected sections in the copied range aren't copied - see
// method <SwNodes::_CopyNodes(..)>.
// Thus, the new anchor position in the destination document is found
// by counting the text nodes.
if ( aAnchor.GetAnchorId() == FLY_AT_CNTNT ||
aAnchor.GetAnchorId() == FLY_AUTO_CNTNT )
{
// First, determine number of anchor text node in the copied range.
// Note: The anchor text node *have* to be inside the copied range.
ULONG nAnchorTxtNdNumInRange( 0L );
bool bAnchorTxtNdFound( false );
SwNodeIndex aIdx( rRg.aStart );
while ( !bAnchorTxtNdFound && aIdx <= rRg.aEnd )
{
if ( aIdx.GetNode().IsTxtNode() )
{
++nAnchorTxtNdNumInRange;
bAnchorTxtNdFound = aAnchor.GetCntntAnchor()->nNode == aIdx;
}
++aIdx;
}
if ( !bAnchorTxtNdFound )
{
// This case can *not* happen, but to be robust take the first
// text node in the destination document.
ASSERT( false,
"<SwDoc::_CopyFlyInFly(..)> - anchor text node in copied range not found" );
nAnchorTxtNdNumInRange = 1;
}
// Second, search corresponding text node in destination document
// by counting forward from start insert position <rSttIdx> the
// determined number of text nodes.
aIdx = rSttIdx;
SwNodeIndex aAnchorNdIdx( rSttIdx );
const SwNode& aEndOfContentNd =
aIdx.GetNode().GetNodes().GetEndOfContent();
while ( nAnchorTxtNdNumInRange > 0 &&
&(aIdx.GetNode()) != &aEndOfContentNd )
{
if ( aIdx.GetNode().IsTxtNode() )
{
--nAnchorTxtNdNumInRange;
aAnchorNdIdx = aIdx;
}
++aIdx;
}
if ( !aAnchorNdIdx.GetNode().IsTxtNode() )
{
// This case can *not* happen, but to be robust take the first
// text node in the destination document.
ASSERT( false,
"<SwDoc::_CopyFlyInFly(..)> - found anchor node index isn't a text node" );
aAnchorNdIdx = rSttIdx;
while ( !aAnchorNdIdx.GetNode().IsTxtNode() )
{
++aAnchorNdIdx;
}
}
// apply found anchor text node as new anchor position
pNewPos->nNode = aAnchorNdIdx;
}
else
{
long nOffset = pNewPos->nNode.GetIndex() - rRg.aStart.GetIndex();
SwNodeIndex aIdx( rSttIdx, nOffset );
pNewPos->nNode = aIdx;
}
// <--
2000-09-18 23:08:29 +00:00
// die am Zeichen Flys wieder ans das vorgegebene Zeichen setzen
if ( FLY_AUTO_CNTNT == aAnchor.GetAnchorId() &&
pNewPos->nNode.GetNode().IsTxtNode() )
{
pNewPos->nContent.Assign( (SwTxtNode*)&pNewPos->nNode.GetNode(),
2000-09-18 23:08:29 +00:00
pNewPos->nContent.GetIndex() );
}
2000-09-18 23:08:29 +00:00
else
{
2000-09-18 23:08:29 +00:00
pNewPos->nContent.Assign( 0, 0 );
}
2000-09-18 23:08:29 +00:00
// ueberpruefe Rekursion: Inhalt in "seinen eigenen" Frame
// kopieren. Dann nicht kopieren
BOOL bMakeCpy = TRUE;
2000-09-18 23:08:29 +00:00
if( pDest == this )
{
const SwFmtCntnt& rCntnt = rZSortFly.GetFmt()->GetCntnt();
const SwStartNode* pSNd;
if( rCntnt.GetCntntIdx() &&
0 != ( pSNd = rCntnt.GetCntntIdx()->GetNode().GetStartNode() ) &&
pSNd->GetIndex() < rSttIdx.GetIndex() &&
rSttIdx.GetIndex() < pSNd->EndOfSectionIndex() )
{
bMakeCpy = FALSE;
aArr.Remove( n, 1 );
--n;
}
}
// Format kopieren und den neuen Anker setzen
if( bMakeCpy )
aNewArr.Insert( pDest->CopyLayoutFmt( *rZSortFly.GetFmt(),
aAnchor, false, true ), aNewArr.Count() );
2000-09-18 23:08:29 +00:00
}
//Alle chains, die im Original vorhanden sind, soweit wie moeglich wieder
//aufbauen.
ASSERT( aArr.Count() == aNewArr.Count(), "Missing new Flys" );
if ( aArr.Count() == aNewArr.Count() )
{
for ( n = 0; n < aArr.Count(); ++n )
{
const SwFrmFmt *pFmt = aArr[n].GetFmt();
const SwFmtChain &rChain = pFmt->GetChain();
int nCnt = 0 != rChain.GetPrev();
nCnt += rChain.GetNext() ? 1: 0;
for ( USHORT k = 0; nCnt && k < aArr.Count(); ++k )
{
const _ZSortFly &rTmp = aArr[k];
const SwFrmFmt *pTmp = rTmp.GetFmt();
if ( rChain.GetPrev() == pTmp )
{
::lcl_ChainFmts( (SwFlyFrmFmt*)aNewArr[k],
(SwFlyFrmFmt*)aNewArr[n] );
--nCnt;
}
else if ( rChain.GetNext() == pTmp )
{
::lcl_ChainFmts( (SwFlyFrmFmt*)aNewArr[n],
(SwFlyFrmFmt*)aNewArr[k] );
--nCnt;
}
}
}
}
}