summaryrefslogtreecommitdiff
path: root/xmloff/source
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2024-06-12 12:34:48 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2024-06-12 21:12:25 +0200
commit5723e2054bb90f07fff7368e3f38fbe0311f6b83 (patch)
tree1cbb22032fc4348d4da388d63566f0f116d6d3ed /xmloff/source
parentc69b0d3b58523a1c981e973d1c9d3107257dd84c (diff)
tdf#144208 speedup doc with lots of redline (6)
implement a mechanism to look up annotation by name instead of iterating through all of them. Shaves 5% off the load time Change-Id: I14bf46cf2aebc5d4b019a3428107b46ac82c5087 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168705 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Tested-by: Jenkins
Diffstat (limited to 'xmloff/source')
-rw-r--r--xmloff/source/text/txtfldi.cxx22
1 files changed, 4 insertions, 18 deletions
diff --git a/xmloff/source/text/txtfldi.cxx b/xmloff/source/text/txtfldi.cxx
index a4a602b63665..3f75fa118311 100644
--- a/xmloff/source/text/txtfldi.cxx
+++ b/xmloff/source/text/txtfldi.cxx
@@ -61,6 +61,7 @@
#include <com/sun/star/util/XUpdatable.hpp>
#include <com/sun/star/sdb/CommandType.hpp>
#include <com/sun/star/container/XIndexReplace.hpp>
+#include <com/sun/star/container/XUniqueIDAccess.hpp>
#include <sax/tools/converter.hxx>
@@ -3256,24 +3257,9 @@ void XMLAnnotationImportContext::endFastElement(sal_Int32 /*nElement*/)
Reference<XTextFieldsSupplier> xTextFieldsSupplier(GetImport().GetModel(), UNO_QUERY);
if (!xTextFieldsSupplier)
return;
- uno::Reference<container::XEnumerationAccess> xFieldsAccess(xTextFieldsSupplier->getTextFields());
- uno::Reference<container::XEnumeration> xFields(xFieldsAccess->createEnumeration());
- while (xFields->hasMoreElements())
- {
- uno::Reference<beans::XPropertySet> xCurrField(xFields->nextElement(), uno::UNO_QUERY);
- uno::Reference<beans::XPropertySetInfo> const xInfo(
- xCurrField->getPropertySetInfo());
- if (xInfo->hasPropertyByName(sAPI_name))
- {
- OUString aFieldName;
- xCurrField->getPropertyValue(sAPI_name) >>= aFieldName;
- if (aFieldName == aName)
- {
- xPrevField.set( xCurrField, uno::UNO_QUERY );
- break;
- }
- }
- }
+ uno::Reference<container::XUniqueIDAccess> xFieldsAccess(xTextFieldsSupplier->getTextFields(), UNO_QUERY_THROW);
+ uno::Any aAny = xFieldsAccess->getByUniqueID(aName);
+ aAny >>= xPrevField;
}
if ( xPrevField.is() )
{