diff options
author | Jan-Marek Glogowski <glogow@fbihome.de> | 2015-12-03 23:18:16 +0100 |
---|---|---|
committer | Björn Michaelsen <bjoern.michaelsen@canonical.com> | 2015-12-09 18:46:55 +0000 |
commit | 689962feae2054f965a7378c3408b0ccfad2bbd5 (patch) | |
tree | b28280d32683297a797468a6dd45057b30979c67 | |
parent | 9e84157a7aafeee311dee13a0cf98a01941ba5e9 (diff) |
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@libreoffice.org>
Reviewed-by: Björn Michaelsen <bjoern.michaelsen@canonical.com>
-rw-r--r-- | sw/source/core/doc/DocumentContentOperationsManager.cxx | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/sw/source/core/doc/DocumentContentOperationsManager.cxx b/sw/source/core/doc/DocumentContentOperationsManager.cxx index d1d025459dc5..8fdc82442736 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(); |