summaryrefslogtreecommitdiff
path: root/reportdesign
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@gmail.com>2020-01-19 21:09:42 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2020-01-20 07:09:20 +0100
commitfc1f85127968d1c2e0a53dace51bf8a78f9e6ca5 (patch)
treeb8699cb455e732de2129feac4321c021385d29ce /reportdesign
parent267d2d721c7e89a7b5f28ce0a4fee87d37ee2c61 (diff)
use more FastParser in ORptFilter
Change-Id: I517a26a3ea64d86a1f494e3b9ea52ee28604e0b9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87046 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'reportdesign')
-rw-r--r--reportdesign/source/filter/xml/xmlfilter.cxx96
-rw-r--r--reportdesign/source/filter/xml/xmlfilter.hxx5
2 files changed, 43 insertions, 58 deletions
diff --git a/reportdesign/source/filter/xml/xmlfilter.cxx b/reportdesign/source/filter/xml/xmlfilter.cxx
index 69d4251fc337..d6cedca1f54a 100644
--- a/reportdesign/source/filter/xml/xmlfilter.cxx
+++ b/reportdesign/source/filter/xml/xmlfilter.cxx
@@ -590,13 +590,20 @@ namespace {
class RptXMLDocumentSettingsContext : public SvXMLImportContext
{
public:
- RptXMLDocumentSettingsContext(SvXMLImport & rImport,
- sal_uInt16 const nPrefix,
- const OUString& rLocalName)
- : SvXMLImportContext(rImport, nPrefix, rLocalName)
+ RptXMLDocumentSettingsContext(SvXMLImport & rImport)
+ : SvXMLImportContext(rImport)
{
}
+ virtual void SAL_CALL startFastElement( sal_Int32 /*nElement*/,
+ const css::uno::Reference< css::xml::sax::XFastAttributeList >& ) 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
+ {
+ return nullptr;
+ }
+
virtual SvXMLImportContextRef CreateChildContext(sal_uInt16 const nPrefix,
const OUString& rLocalName,
const uno::Reference<xml::sax::XAttributeList> & xAttrList) override
@@ -612,13 +619,20 @@ public:
class RptXMLDocumentStylesContext : public SvXMLImportContext
{
public:
- RptXMLDocumentStylesContext(SvXMLImport & rImport,
- sal_uInt16 const nPrefix,
- const OUString& rLocalName)
- : SvXMLImportContext(rImport, nPrefix, rLocalName)
+ RptXMLDocumentStylesContext(SvXMLImport & rImport)
+ : SvXMLImportContext(rImport)
{
}
+ virtual void SAL_CALL startFastElement( sal_Int32 /*nElement*/,
+ const css::uno::Reference< css::xml::sax::XFastAttributeList >& ) 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
+ {
+ return nullptr;
+ }
+
virtual SvXMLImportContextRef CreateChildContext(sal_uInt16 const nPrefix,
const OUString& rLocalName,
const uno::Reference<xml::sax::XAttributeList> & xAttrList) override
@@ -687,13 +701,20 @@ namespace {
class RptXMLDocumentContentContext : public SvXMLImportContext
{
public:
- RptXMLDocumentContentContext(SvXMLImport & rImport,
- sal_uInt16 const nPrefix,
- const OUString& rLocalName)
- : SvXMLImportContext(rImport, nPrefix, rLocalName)
+ RptXMLDocumentContentContext(SvXMLImport & rImport)
+ : SvXMLImportContext(rImport)
{
}
+ virtual void SAL_CALL startFastElement( sal_Int32 /*nElement*/,
+ const css::uno::Reference< css::xml::sax::XFastAttributeList >& ) 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
+ {
+ return nullptr;
+ }
+
virtual SvXMLImportContextRef CreateChildContext(sal_uInt16 const nPrefix,
const OUString& rLocalName,
const uno::Reference<xml::sax::XAttributeList> & xAttrList) override
@@ -725,30 +746,6 @@ public:
}
-SvXMLImportContext* ORptFilter::CreateDocumentContext( sal_uInt16 nPrefix,
- const OUString& rLocalName,
- const uno::Reference< xml::sax::XAttributeList >& /*xAttrList*/ )
-{
- SvXMLImportContext *pContext = nullptr;
-
- const SvXMLTokenMap& rTokenMap = GetDocElemTokenMap();
- switch( rTokenMap.Get( nPrefix, rLocalName ) )
- {
- case XML_TOK_DOC_SETTINGS:
- GetProgressBarHelper()->Increment( PROGRESS_BAR_STEP );
- pContext = new RptXMLDocumentSettingsContext(*this, nPrefix, rLocalName);
- break;
- case XML_TOK_DOC_STYLES:
- pContext = new RptXMLDocumentStylesContext(*this, nPrefix, rLocalName);
- break;
- case XML_TOK_DOC_CONTENT:
- pContext = new RptXMLDocumentContentContext(*this, nPrefix, rLocalName);
- break;
- }
-
- return pContext;
-}
-
SvXMLImportContext *ORptFilter::CreateFastContext( sal_Int32 nElement,
const uno::Reference< xml::sax::XFastAttributeList >& /*xAttrList*/ )
{
@@ -760,27 +757,20 @@ SvXMLImportContext *ORptFilter::CreateFastContext( sal_Int32 nElement,
GetProgressBarHelper()->Increment( PROGRESS_BAR_STEP );
pContext = CreateMetaContext( nElement );
break;
+ case XML_ELEMENT( OFFICE, XML_DOCUMENT_CONTENT ):
+ pContext = new RptXMLDocumentContentContext(*this);
+ break;
+ case XML_ELEMENT( OFFICE, XML_DOCUMENT_STYLES ):
+ pContext = new RptXMLDocumentStylesContext(*this);
+ break;
+ case XML_ELEMENT( OFFICE, XML_DOCUMENT_SETTINGS ):
+ GetProgressBarHelper()->Increment( PROGRESS_BAR_STEP );
+ pContext = new RptXMLDocumentSettingsContext(*this);
+ break;
}
return pContext;
}
-const SvXMLTokenMap& ORptFilter::GetDocElemTokenMap() const
-{
- if (!m_pDocElemTokenMap)
- {
- static const SvXMLTokenMapEntry aElemTokenMap[]=
- {
- { XML_NAMESPACE_OFFICE, XML_DOCUMENT_SETTINGS, XML_TOK_DOC_SETTINGS },
- { XML_NAMESPACE_OFFICE, XML_DOCUMENT_CONTENT, XML_TOK_DOC_CONTENT },
- { XML_NAMESPACE_OFFICE, XML_DOCUMENT_STYLES, XML_TOK_DOC_STYLES },
- { XML_NAMESPACE_OFFICE, XML_DOCUMENT_META, XML_TOK_DOC_META },
- XML_TOKEN_MAP_END
- };
- m_pDocElemTokenMap.reset(new SvXMLTokenMap( aElemTokenMap ));
- }
- return *m_pDocElemTokenMap;
-}
-
const SvXMLTokenMap& ORptFilter::GetDocContentElemTokenMap() const
{
if (!m_pDocContentElemTokenMap)
diff --git a/reportdesign/source/filter/xml/xmlfilter.hxx b/reportdesign/source/filter/xml/xmlfilter.hxx
index 266198f46bfb..995a7268e149 100644
--- a/reportdesign/source/filter/xml/xmlfilter.hxx
+++ b/reportdesign/source/filter/xml/xmlfilter.hxx
@@ -101,10 +101,6 @@ public:
const css::uno::Reference< css::xml::sax::XAttributeList > & xAttrList );
protected:
// SvXMLImport
- virtual SvXMLImportContext *CreateDocumentContext( sal_uInt16 nPrefix,
- const OUString& rLocalName,
- const css::uno::Reference< css::xml::sax::XAttributeList >& xAttrList ) override;
-
virtual SvXMLImportContext *CreateFastContext( sal_Int32 nElement,
const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ) override;
@@ -133,7 +129,6 @@ public:
virtual void SAL_CALL startDocument() override;
virtual void SAL_CALL endDocument() override;
- const SvXMLTokenMap& GetDocElemTokenMap() const;
const SvXMLTokenMap& GetDocContentElemTokenMap() const;
const SvXMLTokenMap& GetReportElemTokenMap() const;
const SvXMLTokenMap& GetGroupElemTokenMap() const;