summaryrefslogtreecommitdiff
path: root/xmloff/source
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2025-03-26 21:13:40 +0500
committerMike Kaganski <mike.kaganski@collabora.com>2025-03-27 07:52:47 +0100
commitf9b487f44fc8a65febafc5ea713e493369be9445 (patch)
tree80105552deafb4d62f88f47ea2d4bcd86445d87d /xmloff/source
parent797292f65b214353e407e3d61ded45fb90ac3191 (diff)
tdf#165918: Avoid bookmarks correction when removing temporary nodes
When loading a table, each cell contains an extra node, which is dropped when finalizing the cell. The removal of the node calls SwDoc::CorrAbs, which it turn calls MarkManager::correctMarksAbsolute. The latter looks through all existing bookmarks, checking if they need to be corrected. In documents with lots of tables and lots of bookmarks, the time taken by eack following call to SwDoc::CorrAbs grows quadratically. We know, that these extra nodes in cells do not affect bookmarks, and it is safe to just skip these specific nodes from bookmark correction. This speeds up loading bugdoc by 40% in my testing. Change-Id: I61b587d04c9ae2301d9fef497885fb76c2d3ae74 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/183348 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'xmloff/source')
-rw-r--r--xmloff/source/text/txtimp.cxx14
1 files changed, 13 insertions, 1 deletions
diff --git a/xmloff/source/text/txtimp.cxx b/xmloff/source/text/txtimp.cxx
index 43dade94fcca..35ceb8d2898e 100644
--- a/xmloff/source/text/txtimp.cxx
+++ b/xmloff/source/text/txtimp.cxx
@@ -764,7 +764,7 @@ void XMLTextImportHelper::InsertTextContent(
}
}
-void XMLTextImportHelper::DeleteParagraph()
+void XMLTextImportHelper::DeleteParagraph(bool dontCorrectBookmarks)
{
assert(m_xImpl->m_xText.is());
assert(m_xImpl->m_xCursor.is());
@@ -784,6 +784,18 @@ void XMLTextImportHelper::DeleteParagraph()
assert(xComp.is());
if( xComp.is() )
{
+ if (dontCorrectBookmarks)
+ {
+ try
+ {
+ // See SwXParagraph::setPropertyValue
+ if (auto xProps = xComp.query<beans::XPropertySet>())
+ xProps->setPropertyValue(u"DeleteWithoutCorrection"_ustr, {});
+ }
+ catch (const beans::UnknownPropertyException&)
+ {
+ }
+ }
xComp->dispose();
bDelete = false;
}