summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSerge Krot <Serge.Krot@cib.de>2018-08-24 13:31:54 +0200
committerThorsten Behrens <Thorsten.Behrens@CIB.de>2018-08-27 22:57:10 +0200
commita3358bb4a75ce36e1dd4c26a3be7bf0d8dbbfa98 (patch)
tree80e76349861e6842a8f5feff80dd6c2ef4d54f73
parent5988d888099d018ca1000bb17341c9529c538649 (diff)
sw: fix inconsistent bookmark behavior around at-char/as-char anchored frames
Added fix for Change-Id: Ic1f173c85d3824afabb5b7ebf3a8594311eb9007 Reviewed-on: https://gerrit.libreoffice.org/46889 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Tested-by: Jenkins <ci@libreoffice.org> The problem was (the same condition of the bOnlyFrameStarts parameter was used during output of Start and End bookmarks): if (BkmType::Start == pPtr->nBkmType && !bOnlyFrameStarts) ... if (BkmType::End == pPtr->nBkmType && !bOnlyFrameStarts) ... Should be: if (BkmType::Start == pPtr->nBkmType && bOnlyFrameStarts) ... if (BkmType::End == pPtr->nBkmType && !bOnlyFrameStarts) ... I assume this was a simple copy-paste bug. Change-Id: I712a0dccc1638fed3b81c65628033a4dc06c1ca4 Reviewed-on: https://gerrit.libreoffice.org/59556 Tested-by: Jenkins Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
-rwxr-xr-x[-rw-r--r--]sw/source/core/unocore/unoportenum.cxx14
1 files changed, 7 insertions, 7 deletions
diff --git a/sw/source/core/unocore/unoportenum.cxx b/sw/source/core/unocore/unoportenum.cxx
index b60f7f297e6a..1a8a95c23f91 100644..100755
--- a/sw/source/core/unocore/unoportenum.cxx
+++ b/sw/source/core/unocore/unoportenum.cxx
@@ -615,7 +615,7 @@ static void lcl_ExportBookmark(
{
for ( SwXBookmarkPortion_ImplList::iterator aIter = rBkmArr.begin(), aEnd = rBkmArr.end(); aIter != aEnd; )
{
- SwXBookmarkPortion_ImplSharedPtr pPtr = (*aIter);
+ const SwXBookmarkPortion_ImplSharedPtr& pPtr = (*aIter);
if ( nIndex > pPtr->getIndex() )
{
if (bOnlyFrameStarts)
@@ -627,8 +627,7 @@ static void lcl_ExportBookmark(
if ( nIndex < pPtr->getIndex() )
break;
- SwXTextPortion* pPortion = nullptr;
- if ((BkmType::Start == pPtr->nBkmType && !bOnlyFrameStarts) ||
+ if ((BkmType::Start == pPtr->nBkmType && bOnlyFrameStarts) ||
(BkmType::StartEnd == pPtr->nBkmType))
{
bool bFrameStart = rFramePositions.find(nIndex) != rFramePositions.end();
@@ -642,21 +641,22 @@ static void lcl_ExportBookmark(
// - this is the start or end (depending on bOnlyFrameStarts)
// of a collapsed bookmark at the same position as an at-char
// anchored frame
- pPortion =
+ SwXTextPortion* pPortion =
new SwXTextPortion(pUnoCursor, xParent, bEnd ? PORTION_BOOKMARK_END : PORTION_BOOKMARK_START);
rPortions.emplace_back(pPortion);
pPortion->SetBookmark(pPtr->xBookmark);
pPortion->SetCollapsed( BkmType::StartEnd == pPtr->nBkmType && !bFrameStart );
}
-
}
- if (BkmType::End == pPtr->nBkmType && !bOnlyFrameStarts)
+ else if (BkmType::End == pPtr->nBkmType && !bOnlyFrameStarts)
{
- pPortion =
+ SwXTextPortion* pPortion =
new SwXTextPortion(pUnoCursor, xParent, PORTION_BOOKMARK_END);
rPortions.emplace_back(pPortion);
pPortion->SetBookmark(pPtr->xBookmark);
}
+
+ // next bookmark
if (bOnlyFrameStarts)
++aIter;
else