[Libreoffice-commits] core.git: sw/source
Jan-Marek Glogowski
glogow at fbihome.de
Wed Dec 9 10:47:20 PST 2015
sw/source/core/doc/DocumentContentOperationsManager.cxx | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
New commits:
commit 689962feae2054f965a7378c3408b0ccfad2bbd5
Author: Jan-Marek Glogowski <glogow at fbihome.de>
Date: Thu Dec 3 23:18:16 2015 +0100
tdf#92623 Handle StartOfContent node for copying bookmarks
For SwDoc::AppendDoc we use the StartOfContent node as the
starting copy node to prevent merging of the first node in
CopyRange and to get a 2nd node needed for CopyRange in case
of single content node documents.
This correctly counts StartOfContent as a non-copy node when
adapting the bookmark ranges for copying.
Change-Id: Ia3ee0328a1be5548f8751aa2240812c4662fb73f
Reviewed-on: https://gerrit.libreoffice.org/20383
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Björn Michaelsen <bjoern.michaelsen at canonical.com>
diff --git a/sw/source/core/doc/DocumentContentOperationsManager.cxx b/sw/source/core/doc/DocumentContentOperationsManager.cxx
index d1d0254..8fdc824 100644
--- a/sw/source/core/doc/DocumentContentOperationsManager.cxx
+++ b/sw/source/core/doc/DocumentContentOperationsManager.cxx
@@ -124,7 +124,8 @@ 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.
+ 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
@@ -138,6 +139,13 @@ namespace
sal_uLong nEnd = rPam.End()->nNode.GetIndex();
if( rLastIdx.GetIndex() < nNewIdx ) // Moving forward?
{
+ // We never copy the StartOfContent node
+ // Special handling for SwDoc::AppendDoc
+ if( rPam.GetDoc()->GetNodes().GetEndOfExtras().GetIndex() + 1 == nStart )
+ {
+ ++rDelCount;
+ ++rLastIdx;
+ }
do // count "non-copy" nodes
{
SwNode& rNode = rLastIdx.GetNode();
More information about the Libreoffice-commits
mailing list