xmloff/source/text/XMLIndexAlphabeticalSourceContext.cxx | 4 xmloff/source/text/XMLIndexAlphabeticalSourceContext.hxx | 2 xmloff/source/text/XMLIndexBibliographySourceContext.cxx | 4 xmloff/source/text/XMLIndexBibliographySourceContext.hxx | 3 xmloff/source/text/XMLIndexBodyContext.cxx | 9 - xmloff/source/text/XMLIndexBodyContext.hxx | 5 xmloff/source/text/XMLIndexIllustrationSourceContext.cxx | 4 xmloff/source/text/XMLIndexIllustrationSourceContext.hxx | 3 xmloff/source/text/XMLIndexObjectSourceContext.cxx | 4 xmloff/source/text/XMLIndexObjectSourceContext.hxx | 2 xmloff/source/text/XMLIndexSourceBaseContext.cxx | 4 xmloff/source/text/XMLIndexSourceBaseContext.hxx | 2 xmloff/source/text/XMLIndexTOCContext.cxx | 124 +++++++-------- xmloff/source/text/XMLIndexTOCContext.hxx | 12 - xmloff/source/text/XMLIndexTOCSourceContext.cxx | 4 xmloff/source/text/XMLIndexTOCSourceContext.hxx | 2 xmloff/source/text/XMLIndexTableSourceContext.cxx | 5 xmloff/source/text/XMLIndexTableSourceContext.hxx | 3 xmloff/source/text/XMLIndexUserSourceContext.cxx | 4 xmloff/source/text/XMLIndexUserSourceContext.hxx | 3 20 files changed, 76 insertions(+), 127 deletions(-)
New commits: commit b563b61af9a8d9917845f52d2058b7d18ec6cdce Author: Noel Grandin <noelgran...@gmail.com> AuthorDate: Tue Nov 24 20:23:19 2020 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Wed Nov 25 08:42:54 2020 +0100 fastparser in text index Change-Id: Ia1811b6e913aabcb9f1fb138ab440f5cee8a9d74 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106548 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/xmloff/source/text/XMLIndexAlphabeticalSourceContext.cxx b/xmloff/source/text/XMLIndexAlphabeticalSourceContext.cxx index c5ad3ffe1c3a..b6ed744129c8 100644 --- a/xmloff/source/text/XMLIndexAlphabeticalSourceContext.cxx +++ b/xmloff/source/text/XMLIndexAlphabeticalSourceContext.cxx @@ -45,10 +45,8 @@ using ::xmloff::token::XML_OUTLINE_LEVEL; XMLIndexAlphabeticalSourceContext::XMLIndexAlphabeticalSourceContext( SvXMLImport& rImport, - sal_uInt16 nPrfx, - const OUString& rLocalName, Reference<XPropertySet> & rPropSet) -: XMLIndexSourceBaseContext(rImport, nPrfx, rLocalName, rPropSet, false) +: XMLIndexSourceBaseContext(rImport, rPropSet, false) , bMainEntryStyleNameOK(false) , bSeparators(false) , bCombineEntries(true) diff --git a/xmloff/source/text/XMLIndexAlphabeticalSourceContext.hxx b/xmloff/source/text/XMLIndexAlphabeticalSourceContext.hxx index 8f39f4c7788a..ef4938b5be69 100644 --- a/xmloff/source/text/XMLIndexAlphabeticalSourceContext.hxx +++ b/xmloff/source/text/XMLIndexAlphabeticalSourceContext.hxx @@ -56,8 +56,6 @@ public: XMLIndexAlphabeticalSourceContext( SvXMLImport& rImport, - sal_uInt16 nPrfx, - const OUString& rLocalName, css::uno::Reference<css::beans::XPropertySet> & rPropSet); virtual ~XMLIndexAlphabeticalSourceContext() override; diff --git a/xmloff/source/text/XMLIndexBibliographySourceContext.cxx b/xmloff/source/text/XMLIndexBibliographySourceContext.cxx index 3b3cab16ded2..6ac60aece7ba 100644 --- a/xmloff/source/text/XMLIndexBibliographySourceContext.cxx +++ b/xmloff/source/text/XMLIndexBibliographySourceContext.cxx @@ -37,10 +37,8 @@ using ::com::sun::star::xml::sax::XAttributeList; XMLIndexBibliographySourceContext::XMLIndexBibliographySourceContext( SvXMLImport& rImport, - sal_uInt16 nPrfx, - const OUString& rLocalName, Reference<XPropertySet> & rPropSet) : - XMLIndexSourceBaseContext(rImport, nPrfx, rLocalName, + XMLIndexSourceBaseContext(rImport, rPropSet, false) { } diff --git a/xmloff/source/text/XMLIndexBibliographySourceContext.hxx b/xmloff/source/text/XMLIndexBibliographySourceContext.hxx index c6684c24e150..bc02d9568b54 100644 --- a/xmloff/source/text/XMLIndexBibliographySourceContext.hxx +++ b/xmloff/source/text/XMLIndexBibliographySourceContext.hxx @@ -38,11 +38,8 @@ class XMLIndexBibliographySourceContext : public XMLIndexSourceBaseContext public: - XMLIndexBibliographySourceContext( SvXMLImport& rImport, - sal_uInt16 nPrfx, - const OUString& rLocalName, css::uno::Reference<css::beans::XPropertySet> & rPropSet); virtual ~XMLIndexBibliographySourceContext() override; diff --git a/xmloff/source/text/XMLIndexBodyContext.cxx b/xmloff/source/text/XMLIndexBodyContext.cxx index 25c01a7db135..b83e7fd36531 100644 --- a/xmloff/source/text/XMLIndexBodyContext.cxx +++ b/xmloff/source/text/XMLIndexBodyContext.cxx @@ -27,12 +27,9 @@ using ::com::sun::star::uno::Reference; using ::com::sun::star::xml::sax::XAttributeList; -XMLIndexBodyContext::XMLIndexBodyContext( - SvXMLImport& rImport, - sal_uInt16 nPrfx, - const OUString& rLocalName ) : - SvXMLImportContext(rImport, nPrfx, rLocalName), - bHasContent(false) +XMLIndexBodyContext::XMLIndexBodyContext( SvXMLImport& rImport ) : + SvXMLImportContext(rImport), + bHasContent(false) { } diff --git a/xmloff/source/text/XMLIndexBodyContext.hxx b/xmloff/source/text/XMLIndexBodyContext.hxx index 01688a1f2cdb..936542e243ea 100644 --- a/xmloff/source/text/XMLIndexBodyContext.hxx +++ b/xmloff/source/text/XMLIndexBodyContext.hxx @@ -42,10 +42,7 @@ class XMLIndexBodyContext : public SvXMLImportContext public: - XMLIndexBodyContext( - SvXMLImport& rImport, - sal_uInt16 nPrfx, - const OUString& rLocalName ); + XMLIndexBodyContext( SvXMLImport& rImport ); virtual ~XMLIndexBodyContext() override; diff --git a/xmloff/source/text/XMLIndexIllustrationSourceContext.cxx b/xmloff/source/text/XMLIndexIllustrationSourceContext.cxx index d4a9c3b23a90..780d821bc883 100644 --- a/xmloff/source/text/XMLIndexIllustrationSourceContext.cxx +++ b/xmloff/source/text/XMLIndexIllustrationSourceContext.cxx @@ -37,10 +37,8 @@ using ::xmloff::token::XML_TOKEN_INVALID; XMLIndexIllustrationSourceContext::XMLIndexIllustrationSourceContext( SvXMLImport& rImport, - sal_uInt16 nPrfx, - const OUString& rLocalName, Reference<XPropertySet> & rPropSet) : - XMLIndexTableSourceContext(rImport, nPrfx, rLocalName, rPropSet) + XMLIndexTableSourceContext(rImport, rPropSet) { } diff --git a/xmloff/source/text/XMLIndexIllustrationSourceContext.hxx b/xmloff/source/text/XMLIndexIllustrationSourceContext.hxx index e3d2ccd4f5b7..07ec8aca41ff 100644 --- a/xmloff/source/text/XMLIndexIllustrationSourceContext.hxx +++ b/xmloff/source/text/XMLIndexIllustrationSourceContext.hxx @@ -40,11 +40,8 @@ class XMLIndexIllustrationSourceContext : public XMLIndexTableSourceContext { public: - XMLIndexIllustrationSourceContext( SvXMLImport& rImport, - sal_uInt16 nPrfx, - const OUString& rLocalName, css::uno::Reference<css::beans::XPropertySet> & rPropSet); virtual ~XMLIndexIllustrationSourceContext() override; diff --git a/xmloff/source/text/XMLIndexObjectSourceContext.cxx b/xmloff/source/text/XMLIndexObjectSourceContext.cxx index 8471e5994d08..d73acd30b047 100644 --- a/xmloff/source/text/XMLIndexObjectSourceContext.cxx +++ b/xmloff/source/text/XMLIndexObjectSourceContext.cxx @@ -44,10 +44,8 @@ using ::xmloff::token::XML_TOKEN_INVALID; XMLIndexObjectSourceContext::XMLIndexObjectSourceContext( SvXMLImport& rImport, - sal_uInt16 nPrfx, - const OUString& rLocalName, Reference<XPropertySet> & rPropSet) : - XMLIndexSourceBaseContext(rImport, nPrfx, rLocalName, + XMLIndexSourceBaseContext(rImport, rPropSet, false), bUseCalc(false), bUseChart(false), diff --git a/xmloff/source/text/XMLIndexObjectSourceContext.hxx b/xmloff/source/text/XMLIndexObjectSourceContext.hxx index 586f8a13a3eb..98f5c8c803b6 100644 --- a/xmloff/source/text/XMLIndexObjectSourceContext.hxx +++ b/xmloff/source/text/XMLIndexObjectSourceContext.hxx @@ -46,8 +46,6 @@ public: XMLIndexObjectSourceContext( SvXMLImport& rImport, - sal_uInt16 nPrfx, - const OUString& rLocalName, css::uno::Reference<css::beans::XPropertySet> & rPropSet); virtual ~XMLIndexObjectSourceContext() override; diff --git a/xmloff/source/text/XMLIndexSourceBaseContext.cxx b/xmloff/source/text/XMLIndexSourceBaseContext.cxx index ec1790c1e43a..c4c2a58f38c2 100644 --- a/xmloff/source/text/XMLIndexSourceBaseContext.cxx +++ b/xmloff/source/text/XMLIndexSourceBaseContext.cxx @@ -140,11 +140,9 @@ const SvXMLTokenMapEntry aIndexSourceTokenMap[] = XMLIndexSourceBaseContext::XMLIndexSourceBaseContext( SvXMLImport& rImport, - sal_uInt16 nPrfx, - const OUString& rLocalName, Reference<XPropertySet> & rPropSet, bool bLevelFormats) -: SvXMLImportContext(rImport, nPrfx, rLocalName) +: SvXMLImportContext(rImport) , bUseLevelFormats(bLevelFormats) , bChapterIndex(false) , bRelativeTabs(true) diff --git a/xmloff/source/text/XMLIndexSourceBaseContext.hxx b/xmloff/source/text/XMLIndexSourceBaseContext.hxx index 3370d86055bc..2e1fb871baa7 100644 --- a/xmloff/source/text/XMLIndexSourceBaseContext.hxx +++ b/xmloff/source/text/XMLIndexSourceBaseContext.hxx @@ -89,8 +89,6 @@ public: XMLIndexSourceBaseContext( SvXMLImport& rImport, - sal_uInt16 nPrfx, - const OUString& rLocalName, css::uno::Reference<css::beans::XPropertySet> & rPropSet, bool bLevelFormats); diff --git a/xmloff/source/text/XMLIndexTOCContext.cxx b/xmloff/source/text/XMLIndexTOCContext.cxx index 8eb82b48311f..3c05f623d23a 100644 --- a/xmloff/source/text/XMLIndexTOCContext.cxx +++ b/xmloff/source/text/XMLIndexTOCContext.cxx @@ -273,79 +273,73 @@ void XMLIndexTOCContext::endFastElement(sal_Int32 ) } } -SvXMLImportContextRef XMLIndexTOCContext::CreateChildContext( - sal_uInt16 nPrefix, - const OUString& rLocalName, - const Reference<XAttributeList> & /*xAttrList*/ ) +css::uno::Reference< css::xml::sax::XFastContextHandler > XMLIndexTOCContext::createFastChildContext( + sal_Int32 nElement, + const css::uno::Reference< css::xml::sax::XFastAttributeList >& ) { SvXMLImportContextRef xContext; - if (bValid) + // not valid -> ignore + if (!bValid) + return nullptr; + + if (nElement == XML_ELEMENT(TEXT, XML_INDEX_BODY) ) { - if (XML_NAMESPACE_TEXT == nPrefix) + rtl::Reference<XMLIndexBodyContext> xNewBodyContext = new XMLIndexBodyContext(GetImport()); + xContext = xNewBodyContext; + if ( !xBodyContextRef.is() || !xBodyContextRef->HasContent() ) { - if ( IsXMLToken( rLocalName, XML_INDEX_BODY ) ) - { - rtl::Reference<XMLIndexBodyContext> xNewBodyContext = new XMLIndexBodyContext(GetImport(), nPrefix, - rLocalName); - xContext = xNewBodyContext; - if ( !xBodyContextRef.is() || !xBodyContextRef->HasContent() ) - { - xBodyContextRef = xNewBodyContext; - } - } - else if (IsXMLToken(rLocalName, aIndexSourceElementMap[eIndexType])) - { - // instantiate source context for the appropriate index type - switch (eIndexType) - { - case TEXT_INDEX_TOC: - xContext = new XMLIndexTOCSourceContext( - GetImport(), nPrefix, rLocalName, xTOCPropertySet); - break; - - case TEXT_INDEX_OBJECT: - xContext = new XMLIndexObjectSourceContext( - GetImport(), nPrefix, rLocalName, xTOCPropertySet); - break; - - case TEXT_INDEX_ALPHABETICAL: - xContext = new XMLIndexAlphabeticalSourceContext( - GetImport(), nPrefix, rLocalName, xTOCPropertySet); - break; - - case TEXT_INDEX_USER: - xContext = new XMLIndexUserSourceContext( - GetImport(), nPrefix, rLocalName, xTOCPropertySet); - break; - - case TEXT_INDEX_BIBLIOGRAPHY: - xContext = new XMLIndexBibliographySourceContext( - GetImport(), nPrefix, rLocalName, xTOCPropertySet); - break; - - case TEXT_INDEX_TABLE: - xContext = new XMLIndexTableSourceContext( - GetImport(), nPrefix, rLocalName, xTOCPropertySet); - break; - - case TEXT_INDEX_ILLUSTRATION: - xContext = new XMLIndexIllustrationSourceContext( - GetImport(), nPrefix, rLocalName, xTOCPropertySet); - break; - - default: - OSL_FAIL("index type not implemented"); - break; - } - } - // else: ignore + xBodyContextRef = xNewBodyContext; + } + } + else if (nElement == XML_ELEMENT(TEXT, aIndexSourceElementMap[eIndexType])) + { + // instantiate source context for the appropriate index type + switch (eIndexType) + { + case TEXT_INDEX_TOC: + xContext = new XMLIndexTOCSourceContext( + GetImport(), xTOCPropertySet); + break; + + case TEXT_INDEX_OBJECT: + xContext = new XMLIndexObjectSourceContext( + GetImport(), xTOCPropertySet); + break; + + case TEXT_INDEX_ALPHABETICAL: + xContext = new XMLIndexAlphabeticalSourceContext( + GetImport(), xTOCPropertySet); + break; + + case TEXT_INDEX_USER: + xContext = new XMLIndexUserSourceContext( + GetImport(), xTOCPropertySet); + break; + + case TEXT_INDEX_BIBLIOGRAPHY: + xContext = new XMLIndexBibliographySourceContext( + GetImport(), xTOCPropertySet); + break; + + case TEXT_INDEX_TABLE: + xContext = new XMLIndexTableSourceContext( + GetImport(), xTOCPropertySet); + break; + + case TEXT_INDEX_ILLUSTRATION: + xContext = new XMLIndexIllustrationSourceContext( + GetImport(), xTOCPropertySet); + break; + + default: + OSL_FAIL("index type not implemented"); + break; } - // else: no text: namespace -> ignore } - // else: not valid -> ignore + // else: ignore - return xContext; + return xContext.get(); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/source/text/XMLIndexTOCContext.hxx b/xmloff/source/text/XMLIndexTOCContext.hxx index cfff7e115654..b67381ca8ef1 100644 --- a/xmloff/source/text/XMLIndexTOCContext.hxx +++ b/xmloff/source/text/XMLIndexTOCContext.hxx @@ -52,7 +52,7 @@ class XMLIndexBodyContext; * indices, and hence is named inappropriately. Depending on the * element name it decides which index source element context to create. */ -class XMLIndexTOCContext : public SvXMLImportContext +class XMLIndexTOCContext final : public SvXMLImportContext { /** XPropertySet of the index */ css::uno::Reference<css::beans::XPropertySet> xTOCPropertySet; @@ -65,7 +65,6 @@ class XMLIndexTOCContext : public SvXMLImportContext public: - XMLIndexTOCContext( SvXMLImport& rImport, sal_uInt16 nPrfx, @@ -73,17 +72,14 @@ public: virtual ~XMLIndexTOCContext() override; -protected: - virtual void StartElement( const css::uno::Reference<css::xml::sax::XAttributeList> & xAttrList) override; virtual void SAL_CALL endFastElement(sal_Int32 nElement) override; - virtual SvXMLImportContextRef CreateChildContext( - sal_uInt16 nPrefix, - const OUString& rLocalName, - const css::uno::Reference<css::xml::sax::XAttributeList> & xAttrList ) override; + virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( + sal_Int32 nElement, + const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ) override; }; #endif diff --git a/xmloff/source/text/XMLIndexTOCSourceContext.cxx b/xmloff/source/text/XMLIndexTOCSourceContext.cxx index 801d59e72bd5..62b05e0635ba 100644 --- a/xmloff/source/text/XMLIndexTOCSourceContext.cxx +++ b/xmloff/source/text/XMLIndexTOCSourceContext.cxx @@ -39,10 +39,8 @@ using ::com::sun::star::xml::sax::XAttributeList; XMLIndexTOCSourceContext::XMLIndexTOCSourceContext( SvXMLImport& rImport, - sal_uInt16 nPrfx, - const OUString& rLocalName, Reference<XPropertySet> & rPropSet) -: XMLIndexSourceBaseContext(rImport, nPrfx, rLocalName, rPropSet, true) +: XMLIndexSourceBaseContext(rImport, rPropSet, true) // use all chapters by default , nOutlineLevel(rImport.GetTextImport()->GetChapterNumbering()->getCount()) , bUseOutline(true) diff --git a/xmloff/source/text/XMLIndexTOCSourceContext.hxx b/xmloff/source/text/XMLIndexTOCSourceContext.hxx index e28e8526cdfe..7a0897eca7c1 100644 --- a/xmloff/source/text/XMLIndexTOCSourceContext.hxx +++ b/xmloff/source/text/XMLIndexTOCSourceContext.hxx @@ -45,8 +45,6 @@ public: XMLIndexTOCSourceContext( SvXMLImport& rImport, - sal_uInt16 nPrfx, - const OUString& rLocalName, css::uno::Reference<css::beans::XPropertySet> & rPropSet); virtual ~XMLIndexTOCSourceContext() override; diff --git a/xmloff/source/text/XMLIndexTableSourceContext.cxx b/xmloff/source/text/XMLIndexTableSourceContext.cxx index b05b84470dd7..87f06dc6eb2b 100644 --- a/xmloff/source/text/XMLIndexTableSourceContext.cxx +++ b/xmloff/source/text/XMLIndexTableSourceContext.cxx @@ -44,9 +44,8 @@ using ::com::sun::star::uno::Any; using ::com::sun::star::xml::sax::XAttributeList; XMLIndexTableSourceContext::XMLIndexTableSourceContext( - SvXMLImport& rImport, sal_uInt16 nPrfx, - const OUString& rLocalName, Reference<XPropertySet> & rPropSet) - : XMLIndexSourceBaseContext(rImport, nPrfx, rLocalName, + SvXMLImport& rImport, Reference<XPropertySet> & rPropSet) + : XMLIndexSourceBaseContext(rImport, rPropSet, false) , nDisplayFormat(0) , bSequenceOK(false) diff --git a/xmloff/source/text/XMLIndexTableSourceContext.hxx b/xmloff/source/text/XMLIndexTableSourceContext.hxx index 5feaf5e2bff3..624480f780b4 100644 --- a/xmloff/source/text/XMLIndexTableSourceContext.hxx +++ b/xmloff/source/text/XMLIndexTableSourceContext.hxx @@ -44,11 +44,8 @@ class XMLIndexTableSourceContext : public XMLIndexSourceBaseContext public: - XMLIndexTableSourceContext( SvXMLImport& rImport, - sal_uInt16 nPrfx, - const OUString& rLocalName, css::uno::Reference<css::beans::XPropertySet> & rPropSet); virtual ~XMLIndexTableSourceContext() override; diff --git a/xmloff/source/text/XMLIndexUserSourceContext.cxx b/xmloff/source/text/XMLIndexUserSourceContext.cxx index 2376eaba6c86..df6239b95755 100644 --- a/xmloff/source/text/XMLIndexUserSourceContext.cxx +++ b/xmloff/source/text/XMLIndexUserSourceContext.cxx @@ -38,10 +38,8 @@ using ::xmloff::token::XML_OUTLINE_LEVEL; XMLIndexUserSourceContext::XMLIndexUserSourceContext( SvXMLImport& rImport, - sal_uInt16 nPrfx, - const OUString& rLocalName, Reference<XPropertySet> & rPropSet) : - XMLIndexSourceBaseContext(rImport, nPrfx, rLocalName, + XMLIndexSourceBaseContext(rImport, rPropSet, true), bUseObjects(false), bUseGraphic(false), diff --git a/xmloff/source/text/XMLIndexUserSourceContext.hxx b/xmloff/source/text/XMLIndexUserSourceContext.hxx index e133b22c99fc..f2f9151bc6c1 100644 --- a/xmloff/source/text/XMLIndexUserSourceContext.hxx +++ b/xmloff/source/text/XMLIndexUserSourceContext.hxx @@ -46,11 +46,8 @@ class XMLIndexUserSourceContext : public XMLIndexSourceBaseContext public: - XMLIndexUserSourceContext( SvXMLImport& rImport, - sal_uInt16 nPrfx, - const OUString& rLocalName, css::uno::Reference<css::beans::XPropertySet> & rPropSet); virtual ~XMLIndexUserSourceContext() override; _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits