summaryrefslogtreecommitdiff
path: root/writerfilter/source/dmapper/DomainMapper_Impl.cxx
diff options
context:
space:
mode:
authorLászló Németh <nemeth@numbertext.org>2023-07-21 17:35:12 +0200
committerLászló Németh <nemeth@numbertext.org>2023-07-22 01:14:19 +0200
commit818f8f13128ba78769b4f542ed1efef658de38d9 (patch)
tree9b0ee2c012d58f76d4d1a5e4fc5770d3bcdaa754 /writerfilter/source/dmapper/DomainMapper_Impl.cxx
parentade2565cc2b2e5e8cf35fe828bf85649f7ff593a (diff)
tdf#149498 sw: fix Undo crash at bookmark over cells
Importing DOCX files with bookmarks between w:p paragraph elements resulted bookmark ranges over cell boundaries within text tables, causing crash with Undo. Partial revert of commit 9e1e88ad5cf2dc0e9b188c60930445652a6c7519 to avoid bookmark ranges over cell boundaries, creating only collapsed bookmarks here, as before. Regression from commit 9e1e88ad5cf2dc0e9b188c60930445652a6c7519 "tdf#145720 DOCX export: fix loss of tracked moving". Note: to avoid of another assertion, skip testing with debug builds. Change-Id: I3ed6daa55323f20130fcee6cc24d00a480731d0c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154743 Tested-by: László Németh <nemeth@numbertext.org> Reviewed-by: László Németh <nemeth@numbertext.org>
Diffstat (limited to 'writerfilter/source/dmapper/DomainMapper_Impl.cxx')
-rw-r--r--writerfilter/source/dmapper/DomainMapper_Impl.cxx5
1 files changed, 3 insertions, 2 deletions
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index ec1766f9e750..a9522e53db2c 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -8454,10 +8454,11 @@ void DomainMapper_Impl::StartOrEndBookmark( const OUString& rId )
// then move the bookmark-End to the earlier paragraph
if (IsOutsideAParagraph())
{
- // keep bookmark range
+ // keep bookmark range, if it doesn't exceed cell boundary
uno::Reference< text::XTextRange > xStart = xCursor->getStart();
xCursor->goLeft( 1, false );
- xCursor->gotoRange(xStart, true );
+ if (m_nTableDepth == 0 || !m_bFirstParagraphInCell)
+ xCursor->gotoRange(xStart, true );
}
uno::Reference< container::XNamed > xBkmNamed( xBookmark, uno::UNO_QUERY_THROW );
SAL_WARN_IF(aBookmarkIter->second.m_sBookmarkName.isEmpty(), "writerfilter.dmapper", "anonymous bookmark");