diff options
author | Jan-Marek Glogowski <glogow@fbihome.de> | 2015-12-03 23:18:16 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2016-01-05 14:51:09 +0000 |
commit | bdcafdff89836518cb94f362ca7ea4c09a82fa03 (patch) | |
tree | 2d2d38b66315a5d48f64c93d678e4fb0f1fb48e1 /sw/source | |
parent | e781a8273eb2938f905485c00fbaf432e517d1dc (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>
(cherry picked from commit 689962feae2054f965a7378c3408b0ccfad2bbd5)
tdf#92623 MM: add unit test
Adds the missing unit test to the bugfix.
Actually the original bug was a crash, so this just
does some test on the resulting MM document.
Change-Id: I4c9f031e57157fe5744aa8290b7503b7e1990fc7
(cherry picked from commit 480e943f0100154fa82942db092ed1f66b76ef66)
Reviewed-on: https://gerrit.libreoffice.org/21076
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Miklos Vajna <vmiklos@collabora.co.uk>
Diffstat (limited to 'sw/source')
-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(); |