[Libreoffice-commits] core.git: xmloff/source
Noel (via logerrit)
logerrit at kemper.freedesktop.org
Tue Dec 1 05:59:21 UTC 2020
xmloff/source/text/XMLChangeImportContext.cxx | 52 +++++++++++++-------------
xmloff/source/text/XMLChangeImportContext.hxx | 5 +-
2 files changed, 30 insertions(+), 27 deletions(-)
New commits:
commit b794ea29531bce1e3972e88bbb80cd7c5ef89400
Author: Noel <noelgrandin at gmail.com>
AuthorDate: Mon Nov 30 15:23:16 2020 +0200
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Tue Dec 1 06:58:42 2020 +0100
fastparser in XMLChangeImportContext
Change-Id: I1d083a48caacb88e37ee2c669ec63c9b68cc664a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106869
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/xmloff/source/text/XMLChangeImportContext.cxx b/xmloff/source/text/XMLChangeImportContext.cxx
index 44a942cbc3b1..6938c9cdf760 100644
--- a/xmloff/source/text/XMLChangeImportContext.cxx
+++ b/xmloff/source/text/XMLChangeImportContext.cxx
@@ -22,6 +22,7 @@
#include <xmloff/xmlnamespace.hxx>
#include <xmloff/namespacemap.hxx>
#include <xmloff/xmltoken.hxx>
+#include <sal/log.hxx>
using ::com::sun::star::uno::Reference;
using ::com::sun::star::xml::sax::XAttributeList;
@@ -45,39 +46,40 @@ XMLChangeImportContext::~XMLChangeImportContext()
{
}
-void XMLChangeImportContext::StartElement(
- const Reference<XAttributeList>& xAttrList)
+void XMLChangeImportContext::startFastElement(
+ sal_Int32 /*nElement*/,
+ const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList )
{
- sal_Int16 nLength = xAttrList->getLength();
- for(sal_Int16 nAttr = 0; nAttr < nLength; nAttr++)
+ for( auto& aIter : sax_fastparser::castToFastAttributeList(xAttrList) )
{
- OUString sLocalName;
- sal_uInt16 nPrefix = GetImport().GetNamespaceMap().
- GetKeyByAttrName( xAttrList->getNameByIndex(nAttr),
- &sLocalName );
- if ( (XML_NAMESPACE_TEXT == nPrefix) &&
- IsXMLToken( sLocalName, XML_CHANGE_ID ) )
+ switch(aIter.getToken())
{
- // Id found! Now call RedlineImportHelper
+ case XML_ELEMENT(TEXT, XML_CHANGE_ID):
+ {
+ // Id found! Now call RedlineImportHelper
- // prepare parameters
- rtl::Reference<XMLTextImportHelper> rHelper =
- GetImport().GetTextImport();
- OUString sID = xAttrList->getValueByIndex(nAttr);
+ // prepare parameters
+ rtl::Reference<XMLTextImportHelper> rHelper =
+ GetImport().GetTextImport();
+ OUString sID = aIter.toString();
- // <text:change> is both start and end
- if (Element::START == m_Element || Element::POINT == m_Element)
- rHelper->RedlineSetCursor(sID, true, m_bIsOutsideOfParagraph);
- if (Element::END == m_Element || Element::POINT == m_Element)
- rHelper->RedlineSetCursor(sID, false, m_bIsOutsideOfParagraph);
+ // <text:change> is both start and end
+ if (Element::START == m_Element || Element::POINT == m_Element)
+ rHelper->RedlineSetCursor(sID, true, m_bIsOutsideOfParagraph);
+ if (Element::END == m_Element || Element::POINT == m_Element)
+ rHelper->RedlineSetCursor(sID, false, m_bIsOutsideOfParagraph);
- // outside of paragraph and still open? set open redline ID
- if (m_bIsOutsideOfParagraph)
- {
- rHelper->SetOpenRedlineId(sID);
+ // outside of paragraph and still open? set open redline ID
+ if (m_bIsOutsideOfParagraph)
+ {
+ rHelper->SetOpenRedlineId(sID);
+ }
+ break;
}
+ // else: ignore
+ default:
+ XMLOFF_WARN_UNKNOWN("xmloff", aIter);
}
- // else: ignore
}
}
diff --git a/xmloff/source/text/XMLChangeImportContext.hxx b/xmloff/source/text/XMLChangeImportContext.hxx
index 4f6f4de65187..4040cc0f2413 100644
--- a/xmloff/source/text/XMLChangeImportContext.hxx
+++ b/xmloff/source/text/XMLChangeImportContext.hxx
@@ -58,8 +58,9 @@ public:
virtual ~XMLChangeImportContext() override;
- virtual void StartElement(
- const css::uno::Reference<css::xml::sax::XAttributeList> & xAttrList) override;
+ virtual void SAL_CALL startFastElement(
+ sal_Int32 nElement,
+ const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ) override;
private:
Element m_Element;
More information about the Libreoffice-commits
mailing list