summaryrefslogtreecommitdiff
path: root/reportdesign
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2020-03-04 14:18:08 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2020-03-04 17:01:33 +0100
commitbaef7c68ddd62197fad3ff420a0fbb48bee1d7ef (patch)
tree6dd2a76088f49c4867594d84025477f4e66891bc /reportdesign
parent3820a5c093bcc69e277e6326464749c151031046 (diff)
use FastParser in OReportStylesContext
Change-Id: I7894d862f2b2fa3206d81682dcbe17474a24d120 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/89967 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'reportdesign')
-rw-r--r--reportdesign/source/filter/xml/xmlStyleImport.cxx9
-rw-r--r--reportdesign/source/filter/xml/xmlStyleImport.hxx6
-rw-r--r--reportdesign/source/filter/xml/xmlfilter.cxx73
-rw-r--r--reportdesign/source/filter/xml/xmlfilter.hxx4
4 files changed, 16 insertions, 76 deletions
diff --git a/reportdesign/source/filter/xml/xmlStyleImport.cxx b/reportdesign/source/filter/xml/xmlStyleImport.cxx
index 0d8ad1e260a5..ae6b578ee0b0 100644
--- a/reportdesign/source/filter/xml/xmlStyleImport.cxx
+++ b/reportdesign/source/filter/xml/xmlStyleImport.cxx
@@ -150,11 +150,8 @@ static const OUStringLiteral g_sRowStyleFamilyName( XML_STYLE_FAMILY_TABLE_ROW_S
static const OUStringLiteral g_sCellStyleFamilyName( XML_STYLE_FAMILY_TABLE_CELL_STYLES_NAME );
OReportStylesContext::OReportStylesContext( ORptFilter& rImport,
- sal_uInt16 nPrfx ,
- const OUString& rLName ,
- const Reference< XAttributeList > & xAttrList,
const bool bTempAutoStyles ) :
- SvXMLStylesContext( rImport, nPrfx, rLName, xAttrList ),
+ SvXMLStylesContext( rImport ),
m_rImport(rImport),
m_nNumberFormatIndex(-1),
bAutoStyles(bTempAutoStyles)
@@ -169,9 +166,9 @@ OReportStylesContext::~OReportStylesContext()
}
-void OReportStylesContext::EndElement()
+void OReportStylesContext::endFastElement(sal_Int32 nElement)
{
- SvXMLStylesContext::EndElement();
+ SvXMLStylesContext::endFastElement(nElement);
if (bAutoStyles)
GetImport().GetTextImport()->SetAutoStyles( this );
else
diff --git a/reportdesign/source/filter/xml/xmlStyleImport.hxx b/reportdesign/source/filter/xml/xmlStyleImport.hxx
index 8b8cf3781e92..2a120bfcfa9f 100644
--- a/reportdesign/source/filter/xml/xmlStyleImport.hxx
+++ b/reportdesign/source/filter/xml/xmlStyleImport.hxx
@@ -108,13 +108,11 @@ namespace rptxml
public:
- OReportStylesContext( ORptFilter& rImport, sal_uInt16 nPrfx ,
- const OUString& rLName ,
- const css::uno::Reference< css::xml::sax::XAttributeList > & xAttrList,
+ OReportStylesContext( ORptFilter& rImport,
const bool bAutoStyles );
virtual ~OReportStylesContext() override;
- virtual void EndElement() override;
+ virtual void SAL_CALL endFastElement(sal_Int32 nElement) override;
virtual rtl::Reference < SvXMLImportPropertyMapper > GetImportPropertyMapper(
XmlStyleFamily nFamily ) const override;
diff --git a/reportdesign/source/filter/xml/xmlfilter.cxx b/reportdesign/source/filter/xml/xmlfilter.cxx
index b9d6827620b7..8f493a9c8532 100644
--- a/reportdesign/source/filter/xml/xmlfilter.cxx
+++ b/reportdesign/source/filter/xml/xmlfilter.cxx
@@ -631,33 +631,16 @@ public:
return pStyleContext;
}
break;
- }
- return nullptr;
- }
-
- virtual SvXMLImportContextRef CreateChildContext(sal_uInt16 const nPrefix,
- const OUString& rLocalName,
- const uno::Reference<xml::sax::XAttributeList> & xAttrList) override
- {
- SvXMLImportContext *pContext = nullptr;
-
- ORptFilter & rImport(static_cast<ORptFilter&>(GetImport()));
- const SvXMLTokenMap& rTokenMap = rImport.GetDocContentElemTokenMap();
- switch (rTokenMap.Get(nPrefix, rLocalName))
- {
- case XML_TOK_CONTENT_STYLES:
+ case XML_ELEMENT(OFFICE, XML_STYLES):
rImport.GetProgressBarHelper()->Increment( PROGRESS_BAR_STEP );
- pContext = rImport.CreateStylesContext(rLocalName, xAttrList, false);
+ return rImport.CreateStylesContext(false);
break;
- case XML_TOK_CONTENT_AUTOSTYLES:
+ case XML_ELEMENT(OFFICE, XML_AUTOMATIC_STYLES):
// don't use the autostyles from the styles-document for the progress
- pContext = rImport.CreateStylesContext(rLocalName, xAttrList, true);
- break;
- default:
+ return rImport.CreateStylesContext(true);
break;
}
-
- return pContext;
+ return nullptr;
}
};
@@ -711,29 +694,12 @@ public:
rImport.GetProgressBarHelper()->Increment( PROGRESS_BAR_STEP );
return rImport.CreateFontDeclsContext();
break;
- }
- return nullptr;
- }
-
- virtual SvXMLImportContextRef CreateChildContext(sal_uInt16 const nPrefix,
- const OUString& rLocalName,
- const uno::Reference<xml::sax::XAttributeList> & xAttrList) override
- {
- SvXMLImportContext *pContext = nullptr;
-
- ORptFilter & rImport(static_cast<ORptFilter&>(GetImport()));
- const SvXMLTokenMap& rTokenMap = rImport.GetDocContentElemTokenMap();
- switch (rTokenMap.Get(nPrefix, rLocalName))
- {
- case XML_TOK_CONTENT_AUTOSTYLES:
+ case XML_ELEMENT(OFFICE, XML_AUTOMATIC_STYLES):
rImport.GetProgressBarHelper()->Increment( PROGRESS_BAR_STEP );
- pContext = rImport.CreateStylesContext(rLocalName, xAttrList, true);
- break;
- default:
+ return rImport.CreateStylesContext(true);
break;
}
-
- return pContext;
+ return nullptr;
}
};
@@ -764,24 +730,6 @@ SvXMLImportContext *ORptFilter::CreateFastContext( sal_Int32 nElement,
return pContext;
}
-const SvXMLTokenMap& ORptFilter::GetDocContentElemTokenMap() const
-{
- if (!m_pDocContentElemTokenMap)
- {
- static const SvXMLTokenMapEntry aElemTokenMap[]=
- {
- { XML_NAMESPACE_OFFICE, XML_STYLES, XML_TOK_CONTENT_STYLES },
- { XML_NAMESPACE_OFFICE, XML_AUTOMATIC_STYLES, XML_TOK_CONTENT_AUTOSTYLES },
- { XML_NAMESPACE_OFFICE, XML_FONT_FACE_DECLS, XML_TOK_CONTENT_FONTDECLS },
- { XML_NAMESPACE_OFFICE, XML_MASTER_STYLES, XML_TOK_CONTENT_MASTERSTYLES},
- { XML_NAMESPACE_OFFICE, XML_BODY, XML_TOK_CONTENT_BODY },
- XML_TOKEN_MAP_END
- };
- m_pDocContentElemTokenMap.reset(new SvXMLTokenMap( aElemTokenMap ));
- }
- return *m_pDocContentElemTokenMap;
-}
-
const SvXMLTokenMap& ORptFilter::GetReportElemTokenMap() const
{
if (!m_pReportElemTokenMap)
@@ -814,13 +762,12 @@ const SvXMLTokenMap& ORptFilter::GetCellElemTokenMap() const
return *m_pCellElemTokenMap;
}
-SvXMLImportContext* ORptFilter::CreateStylesContext(const OUString& rLocalName,
- const uno::Reference< XAttributeList>& xAttrList, bool bIsAutoStyle )
+SvXMLImportContext* ORptFilter::CreateStylesContext( bool bIsAutoStyle )
{
SvXMLImportContext* pContext = bIsAutoStyle ? GetAutoStyles() : GetStyles();
if ( !pContext )
{
- pContext = new OReportStylesContext(*this, XML_NAMESPACE_OFFICE, rLocalName, xAttrList, bIsAutoStyle);
+ pContext = new OReportStylesContext(*this, bIsAutoStyle);
if (bIsAutoStyle)
SetAutoStyles(static_cast<SvXMLStylesContext*>(pContext));
else
diff --git a/reportdesign/source/filter/xml/xmlfilter.hxx b/reportdesign/source/filter/xml/xmlfilter.hxx
index 23f71a25fb85..447c41a737e6 100644
--- a/reportdesign/source/filter/xml/xmlfilter.hxx
+++ b/reportdesign/source/filter/xml/xmlfilter.hxx
@@ -84,8 +84,7 @@ private:
public:
using SvXMLImport::SetMasterStyles;
- SvXMLImportContext* CreateStylesContext(const OUString& rLocalName,
- const Reference< XAttributeList>& xAttrList, bool bIsAutoStyle );
+ SvXMLImportContext* CreateStylesContext( bool bIsAutoStyle );
SvXMLImportContext* CreateMetaContext(const sal_Int32 nElement);
SvXMLImportContext* CreateFontDeclsContext();
protected:
@@ -118,7 +117,6 @@ public:
virtual void SAL_CALL startDocument() override;
virtual void SAL_CALL endDocument() override;
- const SvXMLTokenMap& GetDocContentElemTokenMap() const;
const SvXMLTokenMap& GetReportElemTokenMap() const;
const SvXMLTokenMap& GetCellElemTokenMap() const;