diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-08-30 10:22:09 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-08-30 13:50:06 +0200 |
commit | f59334988a77eece1cae7d63e0df4320beebf384 (patch) | |
tree | 1a7b79dc48a4a4a043e998a0809e29013f71bb99 | |
parent | 8c65269a70b2d7d2323629204842f0ac751cf555 (diff) |
use more fastparser in SvXMLStyleContext subclasses
Change-Id: I6a1596bdbfa4db128730a663fc590c9e5bfa249d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101659
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
39 files changed, 275 insertions, 533 deletions
diff --git a/dbaccess/source/filter/xml/xmlStyleImport.cxx b/dbaccess/source/filter/xml/xmlStyleImport.cxx index e75a1d57861f..46534bb233c7 100644 --- a/dbaccess/source/filter/xml/xmlStyleImport.cxx +++ b/dbaccess/source/filter/xml/xmlStyleImport.cxx @@ -41,10 +41,8 @@ using namespace xmloff::token; OTableStyleContext::OTableStyleContext( ODBFilter& rImport, - sal_Int32 nElement, - const Reference< XFastAttributeList > & xAttrList, SvXMLStylesContext& rStyles, XmlStyleFamily nFamily ) - :XMLPropStyleContext( rImport, nElement, xAttrList, rStyles, nFamily, false ) + :XMLPropStyleContext( rImport, rStyles, nFamily, false ) ,pStyles(&rStyles) ,m_nNumberFormat(-1) { @@ -204,8 +202,7 @@ SvXMLStyleContext *OTableStylesContext::CreateStyleStyleChildContext( case XmlStyleFamily::TABLE_TABLE: case XmlStyleFamily::TABLE_COLUMN: case XmlStyleFamily::TABLE_CELL: - return new OTableStyleContext( GetOwnImport(), nElement, - xAttrList, *this, nFamily ); + return new OTableStyleContext( GetOwnImport(), *this, nFamily ); break; default: break; } diff --git a/dbaccess/source/filter/xml/xmlStyleImport.hxx b/dbaccess/source/filter/xml/xmlStyleImport.hxx index 8f962fd42b71..ee8ec1524357 100644 --- a/dbaccess/source/filter/xml/xmlStyleImport.hxx +++ b/dbaccess/source/filter/xml/xmlStyleImport.hxx @@ -47,8 +47,7 @@ namespace dbaxml public: - OTableStyleContext( ODBFilter& rImport, sal_Int32 nElement, - const css::uno::Reference< css::xml::sax::XFastAttributeList > & xAttrList, + OTableStyleContext( ODBFilter& rImport, SvXMLStylesContext& rStyles, XmlStyleFamily nFamily ); virtual ~OTableStyleContext() override; diff --git a/include/xmloff/XMLDrawingPageStyleContext.hxx b/include/xmloff/XMLDrawingPageStyleContext.hxx index 5587e5ddde07..9ef8d060bb56 100644 --- a/include/xmloff/XMLDrawingPageStyleContext.hxx +++ b/include/xmloff/XMLDrawingPageStyleContext.hxx @@ -27,11 +27,9 @@ class XMLOFF_DLLPUBLIC XMLDrawingPageStyleContext : public XMLPropStyleContext { public: - XMLDrawingPageStyleContext( - SvXMLImport& rImport, sal_Int32 nElement, - css::uno::Reference<css::xml::sax::XFastAttributeList> const& xAttrList, - SvXMLStylesContext& rStyles, ContextID_Index_Pair const pContextIDs[], - XmlStyleFamily const pFamilies[]); + XMLDrawingPageStyleContext(SvXMLImport& rImport, SvXMLStylesContext& rStyles, + ContextID_Index_Pair const pContextIDs[], + XmlStyleFamily const pFamilies[]); virtual void FillPropertySet(css::uno::Reference<css::beans::XPropertySet> const& rPropSet) override; diff --git a/include/xmloff/XMLGraphicsDefaultStyle.hxx b/include/xmloff/XMLGraphicsDefaultStyle.hxx index 20c6c1dbfe7e..229b480d1fd5 100644 --- a/include/xmloff/XMLGraphicsDefaultStyle.hxx +++ b/include/xmloff/XMLGraphicsDefaultStyle.hxx @@ -28,8 +28,7 @@ class XMLOFF_DLLPUBLIC XMLGraphicsDefaultStyle final : public XMLPropStyleContex { public: - XMLGraphicsDefaultStyle( SvXMLImport& rImport, sal_Int32 nElement, - const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList, + XMLGraphicsDefaultStyle( SvXMLImport& rImport, SvXMLStylesContext& rStyles); virtual ~XMLGraphicsDefaultStyle() override; diff --git a/include/xmloff/XMLShapeStyleContext.hxx b/include/xmloff/XMLShapeStyleContext.hxx index 86f18a8340c3..556cfec7cdfc 100644 --- a/include/xmloff/XMLShapeStyleContext.hxx +++ b/include/xmloff/XMLShapeStyleContext.hxx @@ -44,8 +44,6 @@ public: XMLShapeStyleContext( SvXMLImport& rImport, - sal_Int32 nElement, - const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList, SvXMLStylesContext& rStyles, XmlStyleFamily nFamily); virtual ~XMLShapeStyleContext() override; diff --git a/include/xmloff/XMLTextShapeStyleContext.hxx b/include/xmloff/XMLTextShapeStyleContext.hxx index 3d03dcc578af..77e2bcbe58b1 100644 --- a/include/xmloff/XMLTextShapeStyleContext.hxx +++ b/include/xmloff/XMLTextShapeStyleContext.hxx @@ -36,8 +36,7 @@ class XMLOFF_DLLPUBLIC XMLTextShapeStyleContext final : public XMLShapeStyleCont public: - XMLTextShapeStyleContext( SvXMLImport& rImport, sal_Int32 nElement, - const css::uno::Reference< css::xml::sax::XFastAttributeList > & xAttrList, + XMLTextShapeStyleContext( SvXMLImport& rImport, SvXMLStylesContext& rStyles, XmlStyleFamily nFamily ); virtual ~XMLTextShapeStyleContext() override; diff --git a/include/xmloff/prstylei.hxx b/include/xmloff/prstylei.hxx index 38d0147eb148..b79ae267f9b1 100644 --- a/include/xmloff/prstylei.hxx +++ b/include/xmloff/prstylei.hxx @@ -88,8 +88,7 @@ protected: public: - XMLPropStyleContext( SvXMLImport& rImport, sal_Int32 nElement, - const css::uno::Reference< css::xml::sax::XFastAttributeList > & xAttrList, + XMLPropStyleContext( SvXMLImport& rImport, SvXMLStylesContext& rStyles, XmlStyleFamily nFamily, bool bDefaultStyle=false ); virtual ~XMLPropStyleContext() override; diff --git a/include/xmloff/txtstyli.hxx b/include/xmloff/txtstyli.hxx index 4224d49e4869..bb570ac9095c 100644 --- a/include/xmloff/txtstyli.hxx +++ b/include/xmloff/txtstyli.hxx @@ -53,8 +53,7 @@ protected: public: - XMLTextStyleContext( SvXMLImport& rImport, sal_Int32 nElement, - const css::uno::Reference< css::xml::sax::XFastAttributeList > & xAttrList, + XMLTextStyleContext( SvXMLImport& rImport, SvXMLStylesContext& rStyles, XmlStyleFamily nFamily, bool bDefaultStyle = false ); ~XMLTextStyleContext() override; diff --git a/include/xmloff/xmlnumi.hxx b/include/xmloff/xmlnumi.hxx index b1a7391acea2..e8d0b1def920 100644 --- a/include/xmloff/xmlnumi.hxx +++ b/include/xmloff/xmlnumi.hxx @@ -51,16 +51,12 @@ public: SvxXMLListStyleContext( SvXMLImport& rImport, - sal_Int32 nElement, - const css::uno::Reference< css::xml::sax::XFastAttributeList > & xAttrList, bool bOutl = false ); ~SvxXMLListStyleContext() 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 >& AttrList ) override; void FillUnoNumRule( const css::uno::Reference< css::container::XIndexReplace> & rNumRule) const; diff --git a/include/xmloff/xmlstyle.hxx b/include/xmloff/xmlstyle.hxx index 4fdfcec0ebbe..991b22edc9fa 100644 --- a/include/xmloff/xmlstyle.hxx +++ b/include/xmloff/xmlstyle.hxx @@ -85,29 +85,12 @@ protected: public: - - SvXMLStyleContext( SvXMLImport& rImport, sal_uInt16 nPrfx, - const OUString& rLName, - const css::uno::Reference< css::xml::sax::XAttributeList >& xAttrList, - XmlStyleFamily nFamily=XmlStyleFamily::DATA_STYLE, - bool bDefaultStyle = false ); - - SvXMLStyleContext( SvXMLImport& rImport, - sal_Int32 nElement, - const css::uno::Reference< css::xml::sax::XFastAttributeList > & xAttrList, - XmlStyleFamily nFamily=XmlStyleFamily::DATA_STYLE, - bool bDefaultStyle = false ); - - // Fast-parser constructor SvXMLStyleContext( SvXMLImport& rImport, XmlStyleFamily nFamily=XmlStyleFamily::DATA_STYLE, bool bDefaultStyle = false ); virtual ~SvXMLStyleContext() override; - virtual void StartElement( - const css::uno::Reference< css::xml::sax::XAttributeList > & xAttrList ) final override; - virtual void SAL_CALL startFastElement( sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& ) override; diff --git a/reportdesign/source/filter/xml/xmlStyleImport.cxx b/reportdesign/source/filter/xml/xmlStyleImport.cxx index 2a3e457c49a6..3e473740cf8b 100644 --- a/reportdesign/source/filter/xml/xmlStyleImport.cxx +++ b/reportdesign/source/filter/xml/xmlStyleImport.cxx @@ -67,10 +67,8 @@ public: } OControlStyleContext::OControlStyleContext( ORptFilter& rImport, - sal_Int32 nElement, - const Reference< XFastAttributeList > & xAttrList, SvXMLStylesContext& rStyles, XmlStyleFamily nFamily ) : - XMLPropStyleContext( rImport, nElement, xAttrList, rStyles, nFamily, false/*bDefaultStyle*/ ), + XMLPropStyleContext( rImport, rStyles, nFamily, false/*bDefaultStyle*/ ), pStyles(&rStyles), m_nNumberFormat(-1), m_rImport(rImport) @@ -233,14 +231,14 @@ rtl::Reference < SvXMLImportPropertyMapper > } SvXMLStyleContext *OReportStylesContext::CreateDefaultStyleStyleChildContext( - XmlStyleFamily nFamily, sal_Int32 nElement, - const uno::Reference< xml::sax::XFastAttributeList > & xAttrList ) + XmlStyleFamily nFamily, sal_Int32 /*nElement*/, + const uno::Reference< xml::sax::XFastAttributeList > & /*xAttrList*/ ) { switch( nFamily ) { case XmlStyleFamily::SD_GRAPHICS_ID: // There are no writer specific defaults for graphic styles! - return new XMLGraphicsDefaultStyle( GetImport(), nElement, xAttrList, *this ); + return new XMLGraphicsDefaultStyle( GetImport(), *this ); default: return nullptr; } @@ -260,8 +258,7 @@ SvXMLStyleContext *OReportStylesContext::CreateStyleStyleChildContext( case XmlStyleFamily::TABLE_COLUMN: case XmlStyleFamily::TABLE_ROW: case XmlStyleFamily::TABLE_CELL: - pStyle = new OControlStyleContext( GetOwnImport(), nElement, - xAttrList, *this, nFamily ); + pStyle = new OControlStyleContext( GetOwnImport(), *this, nFamily ); break; default: OSL_FAIL("OReportStylesContext::CreateStyleStyleChildContext: Unknown style family. Please check."); diff --git a/reportdesign/source/filter/xml/xmlStyleImport.hxx b/reportdesign/source/filter/xml/xmlStyleImport.hxx index d670ccf5d843..fac89edc67bf 100644 --- a/reportdesign/source/filter/xml/xmlStyleImport.hxx +++ b/reportdesign/source/filter/xml/xmlStyleImport.hxx @@ -46,8 +46,7 @@ namespace rptxml public: - OControlStyleContext( ORptFilter& rImport, sal_Int32 nElement, - const css::uno::Reference< css::xml::sax::XFastAttributeList > & xAttrList, + OControlStyleContext( ORptFilter& rImport, SvXMLStylesContext& rStyles, XmlStyleFamily nFamily ); virtual ~OControlStyleContext() override; diff --git a/sc/source/filter/xml/xmlstyli.cxx b/sc/source/filter/xml/xmlstyli.cxx index 191e8a6323d7..356acf8101f4 100644 --- a/sc/source/filter/xml/xmlstyli.cxx +++ b/sc/source/filter/xml/xmlstyli.cxx @@ -416,10 +416,8 @@ void XMLTableStyleContext::SetAttribute( sal_uInt16 nPrefixKey, XMLTableStyleContext::XMLTableStyleContext( ScXMLImport& rImport, - sal_Int32 nElement, - const uno::Reference< XFastAttributeList > & xAttrList, SvXMLStylesContext& rStyles, XmlStyleFamily nFamily, bool bDefaultStyle ) : - XMLPropStyleContext( rImport, nElement, xAttrList, rStyles, nFamily, bDefaultStyle ), + XMLPropStyleContext( rImport, rStyles, nFamily, bDefaultStyle ), sDataStyleName(), pStyles(&rStyles), nNumberFormat(-1), @@ -614,8 +612,7 @@ SvXMLStyleContext *XMLTableStylesContext::CreateStyleStyleChildContext( SvXMLStyleContext *pStyle; // use own wrapper for text and paragraph, to record style usage if (nFamily == XmlStyleFamily::TEXT_PARAGRAPH || nFamily == XmlStyleFamily::TEXT_TEXT) - pStyle = new ScCellTextStyleContext( GetImport(), nElement, - xAttrList, *this, nFamily ); + pStyle = new ScCellTextStyleContext( GetImport(),*this, nFamily ); else pStyle = SvXMLStylesContext::CreateStyleStyleChildContext( nFamily, nElement, xAttrList ); @@ -628,8 +625,7 @@ SvXMLStyleContext *XMLTableStylesContext::CreateStyleStyleChildContext( case XmlStyleFamily::TABLE_COLUMN: case XmlStyleFamily::TABLE_ROW: case XmlStyleFamily::TABLE_TABLE: - pStyle = new XMLTableStyleContext( GetScImport(), nElement, - xAttrList, *this, nFamily ); + pStyle = new XMLTableStyleContext( GetScImport(), *this, nFamily ); break; default: break; } @@ -649,12 +645,10 @@ SvXMLStyleContext *XMLTableStylesContext::CreateDefaultStyleStyleChildContext( switch( nFamily ) { case XmlStyleFamily::TABLE_CELL: - pStyle = new XMLTableStyleContext( GetScImport(), nElement, - xAttrList, *this, nFamily, true); + pStyle = new XMLTableStyleContext( GetScImport(), *this, nFamily, true); break; case XmlStyleFamily::SD_GRAPHICS_ID: - pStyle = new XMLGraphicsDefaultStyle( GetScImport(), nElement, - xAttrList, *this); + pStyle = new XMLGraphicsDefaultStyle( GetScImport(), *this); break; default: break; } @@ -997,10 +991,9 @@ void ScMasterPageContext::Finish( bool bOverwrite ) ClearContent(SC_UNO_PAGE_RIGHTHDRCON); } -ScCellTextStyleContext::ScCellTextStyleContext( SvXMLImport& rImport, sal_Int32 nElement, - const uno::Reference<xml::sax::XFastAttributeList> & xAttrList, +ScCellTextStyleContext::ScCellTextStyleContext( SvXMLImport& rImport, SvXMLStylesContext& rStyles, XmlStyleFamily nFamily ) : - XMLTextStyleContext( rImport, nElement, xAttrList, rStyles, nFamily, false/*bDefaultStyle*/ ), + XMLTextStyleContext( rImport, rStyles, nFamily, false/*bDefaultStyle*/ ), nLastSheet(-1) { } diff --git a/sc/source/filter/xml/xmlstyli.hxx b/sc/source/filter/xml/xmlstyli.hxx index 0bbcefb18a0b..e867b4969ae1 100644 --- a/sc/source/filter/xml/xmlstyli.hxx +++ b/sc/source/filter/xml/xmlstyli.hxx @@ -85,9 +85,7 @@ protected: public: - - XMLTableStyleContext( ScXMLImport& rImport, sal_Int32 nElement, - const css::uno::Reference< css::xml::sax::XFastAttributeList > & xAttrList, + XMLTableStyleContext( ScXMLImport& rImport, SvXMLStylesContext& rStyles, XmlStyleFamily nFamily, bool bDefaultStyle = false ); virtual ~XMLTableStyleContext() override; @@ -217,8 +215,7 @@ class ScCellTextStyleContext : public XMLTextStyleContext ScXMLImport& GetScImport() { return static_cast<ScXMLImport&>(GetImport()); } public: - ScCellTextStyleContext( SvXMLImport& rImport, sal_Int32 nElement, - const css::uno::Reference< css::xml::sax::XFastAttributeList > & xAttrList, + ScCellTextStyleContext( SvXMLImport& rImport, SvXMLStylesContext& rStyles, XmlStyleFamily nFamily ); virtual ~ScCellTextStyleContext() override; diff --git a/sw/source/filter/xml/xmlfmt.cxx b/sw/source/filter/xml/xmlfmt.cxx index f56c2009035d..e1aebad2ed0b 100644 --- a/sw/source/filter/xml/xmlfmt.cxx +++ b/sw/source/filter/xml/xmlfmt.cxx @@ -269,8 +269,7 @@ protected: public: - SwXMLTextStyleContext_Impl( SwXMLImport& rImport, sal_Int32 nElement, - const uno::Reference< xml::sax::XFastAttributeList > & xAttrList, + SwXMLTextStyleContext_Impl( SwXMLImport& rImport, XmlStyleFamily nFamily, SvXMLStylesContext& rStyles ); @@ -348,11 +347,9 @@ SwXMLTextStyleContext_Impl::Finish( bool bOverwrite ) } SwXMLTextStyleContext_Impl::SwXMLTextStyleContext_Impl( SwXMLImport& rImport, - sal_Int32 nElement, - const uno::Reference< xml::sax::XFastAttributeList > & xAttrList, XmlStyleFamily nFamily, SvXMLStylesContext& rStyles ) : - XMLTextStyleContext( rImport, nElement, xAttrList, rStyles, nFamily ) + XMLTextStyleContext( rImport, rStyles, nFamily ) { } @@ -417,8 +414,7 @@ public: SwXMLItemSetStyleContext_Impl( - SwXMLImport& rImport, sal_Int32 nElement, - const uno::Reference< xml::sax::XFastAttributeList > & xAttrList, + SwXMLImport& rImport, SvXMLStylesContext& rStylesC, XmlStyleFamily nFamily); @@ -574,11 +570,9 @@ SvXMLImportContext *SwXMLItemSetStyleContext_Impl::CreateItemSetContext( SwXMLItemSetStyleContext_Impl::SwXMLItemSetStyleContext_Impl( SwXMLImport& rImport, - sal_Int32 nElement, - const uno::Reference< xml::sax::XFastAttributeList > & xAttrList, SvXMLStylesContext& rStylesC, XmlStyleFamily nFamily ) : - SvXMLStyleContext( rImport, nElement, xAttrList, nFamily ), + SvXMLStyleContext( rImport, nFamily ), pTextStyle( nullptr ), rStyles( rStylesC ), bHasMasterPageName( false ), @@ -610,10 +604,9 @@ css::uno::Reference< css::xml::sax::XFastContextHandler > SwXMLItemSetStyleConte { if( !pTextStyle ) { + pTextStyle = new SwXMLTextStyleContext_Impl( GetSwImport(), XmlStyleFamily::TEXT_PARAGRAPH, rStyles ); rtl::Reference<sax_fastparser::FastAttributeList> xTmpAttrList = new sax_fastparser::FastAttributeList(nullptr); xTmpAttrList->add(XML_ELEMENT(STYLE, XML_NAME), GetName().toUtf8() ); - pTextStyle = new SwXMLTextStyleContext_Impl( GetSwImport(), nElement, - xTmpAttrList.get(), XmlStyleFamily::TEXT_PARAGRAPH, rStyles ); pTextStyle->startFastElement( nElement, xTmpAttrList.get() ); rStyles.AddStyle( *pTextStyle ); } @@ -783,8 +776,7 @@ SvXMLStyleContext *SwXMLStylesContext_Impl::CreateStyleStyleChildContext( switch( nFamily ) { case XmlStyleFamily::TEXT_PARAGRAPH: - pStyle = new SwXMLTextStyleContext_Impl( GetSwImport(), nElement, - xAttrList, nFamily, *this ); + pStyle = new SwXMLTextStyleContext_Impl( GetSwImport(), nFamily, *this ); break; case XmlStyleFamily::TABLE_TABLE: case XmlStyleFamily::TABLE_COLUMN: @@ -792,21 +784,20 @@ SvXMLStyleContext *SwXMLStylesContext_Impl::CreateStyleStyleChildContext( case XmlStyleFamily::TABLE_CELL: // Distinguish real and automatic styles. if (IsAutomaticStyle()) - pStyle = new SwXMLItemSetStyleContext_Impl(GetSwImport(), nElement, xAttrList, *this, nFamily); + pStyle = new SwXMLItemSetStyleContext_Impl(GetSwImport(), *this, nFamily); else if (nFamily == XmlStyleFamily::TABLE_CELL) // Real cell styles are used for table-template import. - pStyle = new SwXMLCellStyleContext(GetSwImport(), nElement, xAttrList, *this, nFamily); + pStyle = new SwXMLCellStyleContext(GetSwImport(), *this, nFamily); else SAL_WARN("sw.xml", "Context does not exists for non automatic table, column or row style."); break; case XmlStyleFamily::SD_GRAPHICS_ID: // As long as there are no element items, we can use the text // style class. - pStyle = new XMLTextShapeStyleContext( GetImport(), nElement, - xAttrList, *this, nFamily ); + pStyle = new XMLTextShapeStyleContext( GetImport(), *this, nFamily ); break; case XmlStyleFamily::SD_DRAWINGPAGE_ID: - pStyle = new XMLDrawingPageStyleContext(GetImport(), nElement, - xAttrList, *this, g_MasterPageContextIDs, g_MasterPageFamilies); + pStyle = new XMLDrawingPageStyleContext(GetImport(), + *this, g_MasterPageContextIDs, g_MasterPageFamilies); break; default: pStyle = SvXMLStylesContext::CreateStyleStyleChildContext( nFamily, @@ -829,14 +820,13 @@ SvXMLStyleContext *SwXMLStylesContext_Impl::CreateDefaultStyleStyleChildContext( case XmlStyleFamily::TEXT_PARAGRAPH: case XmlStyleFamily::TABLE_TABLE: case XmlStyleFamily::TABLE_ROW: - pStyle = new XMLTextStyleContext( GetImport(), nElement, - xAttrList, *this, nFamily, + pStyle = new XMLTextStyleContext( GetImport(), + *this, nFamily, true ); break; case XmlStyleFamily::SD_GRAPHICS_ID: // There are no writer specific defaults for graphic styles! - pStyle = new XMLGraphicsDefaultStyle( GetImport(), nElement, - xAttrList, *this ); + pStyle = new XMLGraphicsDefaultStyle( GetImport(), *this ); break; default: pStyle = SvXMLStylesContext::CreateDefaultStyleStyleChildContext( nFamily, diff --git a/sw/source/uibase/config/StoredChapterNumbering.cxx b/sw/source/uibase/config/StoredChapterNumbering.cxx index 732c38f82b86..4bedb4fa29a4 100644 --- a/sw/source/uibase/config/StoredChapterNumbering.cxx +++ b/sw/source/uibase/config/StoredChapterNumbering.cxx @@ -351,8 +351,7 @@ public: if (m_nCounter <= SwChapterNumRules::nMaxRules) { SvxXMLListStyleContext *const pContext( - new SvxXMLListStyleContext(GetImport(), - Element, xAttrList, true)); + new SvxXMLListStyleContext(GetImport(), true)); m_Contexts.emplace_back(pContext); return pContext; } diff --git a/xmloff/inc/PageMasterImportContext.hxx b/xmloff/inc/PageMasterImportContext.hxx index 158c7ce29503..08b361fbb84c 100644 --- a/xmloff/inc/PageMasterImportContext.hxx +++ b/xmloff/inc/PageMasterImportContext.hxx @@ -36,8 +36,7 @@ private: public: - PageStyleContext( SvXMLImport& rImport, sal_Int32 nElement, - const css::uno::Reference< css::xml::sax::XFastAttributeList > & xAttrList, + PageStyleContext( SvXMLImport& rImport, SvXMLStylesContext& rStyles, bool bDefaultStyle); virtual ~PageStyleContext() override; diff --git a/xmloff/inc/XMLChartStyleContext.hxx b/xmloff/inc/XMLChartStyleContext.hxx index 8fc13f3cc6da..c22df28ffa75 100644 --- a/xmloff/inc/XMLChartStyleContext.hxx +++ b/xmloff/inc/XMLChartStyleContext.hxx @@ -36,8 +36,7 @@ private: public: XMLChartStyleContext( - SvXMLImport& rImport, sal_Int32 nElement, - const css::uno::Reference< css::xml::sax::XFastAttributeList > & xAttrList, + SvXMLImport& rImport, SvXMLStylesContext& rStyles, XmlStyleFamily nFamily ); virtual ~XMLChartStyleContext() override; diff --git a/xmloff/inc/XMLIndexBibliographyConfigurationContext.hxx b/xmloff/inc/XMLIndexBibliographyConfigurationContext.hxx index 4efc71336502..d02e799200c3 100644 --- a/xmloff/inc/XMLIndexBibliographyConfigurationContext.hxx +++ b/xmloff/inc/XMLIndexBibliographyConfigurationContext.hxx @@ -54,10 +54,7 @@ class XMLIndexBibliographyConfigurationContext final : public SvXMLStyleContext public: - XMLIndexBibliographyConfigurationContext( - SvXMLImport& rImport, - sal_Int32 nElement, - const css::uno::Reference< css::xml::sax::XFastAttributeList> & xAttrList); + XMLIndexBibliographyConfigurationContext(SvXMLImport& rImport); virtual ~XMLIndexBibliographyConfigurationContext() override; diff --git a/xmloff/inc/XMLLineNumberingImportContext.hxx b/xmloff/inc/XMLLineNumberingImportContext.hxx index 852f3076d574..4baeb35048a4 100644 --- a/xmloff/inc/XMLLineNumberingImportContext.hxx +++ b/xmloff/inc/XMLLineNumberingImportContext.hxx @@ -65,11 +65,7 @@ class XMLLineNumberingImportContext final : public SvXMLStyleContext public: - - XMLLineNumberingImportContext( - SvXMLImport& rImport, - sal_Int32 nElement, - const css::uno::Reference<css::xml::sax::XFastAttributeList> & xAttrList); + XMLLineNumberingImportContext(SvXMLImport& rImport); virtual ~XMLLineNumberingImportContext() override; diff --git a/xmloff/source/chart/XMLChartStyleContext.cxx b/xmloff/source/chart/XMLChartStyleContext.cxx index 7433cf10c4cc..b000a36b2f03 100644 --- a/xmloff/source/chart/XMLChartStyleContext.cxx +++ b/xmloff/source/chart/XMLChartStyleContext.cxx @@ -61,11 +61,9 @@ void XMLChartStyleContext::SetAttribute( } XMLChartStyleContext::XMLChartStyleContext( - SvXMLImport& rImport, sal_Int32 nElement, - const uno::Reference< xml::sax::XFastAttributeList > & xAttrList, + SvXMLImport& rImport, SvXMLStylesContext& rStyles, XmlStyleFamily nFamily ) : - - XMLShapeStyleContext( rImport, nElement, xAttrList, rStyles, nFamily ), + XMLShapeStyleContext( rImport, rStyles, nFamily ), mrStyles( rStyles ) {} diff --git a/xmloff/source/draw/XMLGraphicsDefaultStyle.cxx b/xmloff/source/draw/XMLGraphicsDefaultStyle.cxx index 8224bed6392a..8795e0a7a645 100644 --- a/xmloff/source/draw/XMLGraphicsDefaultStyle.cxx +++ b/xmloff/source/draw/XMLGraphicsDefaultStyle.cxx @@ -49,8 +49,8 @@ using ::xmloff::token::XML_GRAPHIC_PROPERTIES; using ::xmloff::token::XML_PARAGRAPH_PROPERTIES; -XMLGraphicsDefaultStyle::XMLGraphicsDefaultStyle( SvXMLImport& rImport, sal_Int32 nElement, const Reference< XFastAttributeList >& xAttrList, SvXMLStylesContext& rStyles ) -: XMLPropStyleContext( rImport, nElement, xAttrList, rStyles, XmlStyleFamily::SD_GRAPHICS_ID, true ) +XMLGraphicsDefaultStyle::XMLGraphicsDefaultStyle( SvXMLImport& rImport, SvXMLStylesContext& rStyles ) +: XMLPropStyleContext( rImport, rStyles, XmlStyleFamily::SD_GRAPHICS_ID, true ) { } diff --git a/xmloff/source/draw/XMLShapePropertySetContext.cxx b/xmloff/source/draw/XMLShapePropertySetContext.cxx index 4a86aa4dcc99..2c13b36ac187 100644 --- a/xmloff/source/draw/XMLShapePropertySetContext.cxx +++ b/xmloff/source/draw/XMLShapePropertySetContext.cxx @@ -74,7 +74,7 @@ css::uno::Reference< css::xml::sax::XFastContextHandler > XMLShapePropertySetCon { case CTF_NUMBERINGRULES: mnBulletIndex = rProp.mnIndex; - mxBulletStyle = new SvxXMLListStyleContext( GetImport(), nElement, xAttrList ); + mxBulletStyle = new SvxXMLListStyleContext( GetImport() ); return mxBulletStyle.get(); break; case CTF_TABSTOP: diff --git a/xmloff/source/draw/XMLShapeStyleContext.cxx b/xmloff/source/draw/XMLShapeStyleContext.cxx index 1096c0aae417..5dd1da864f05 100644 --- a/xmloff/source/draw/XMLShapeStyleContext.cxx +++ b/xmloff/source/draw/XMLShapeStyleContext.cxx @@ -50,11 +50,9 @@ using ::xmloff::token::XML_PARAGRAPH_PROPERTIES; XMLShapeStyleContext::XMLShapeStyleContext( SvXMLImport& rImport, - sal_Int32 nElement, - const uno::Reference< xml::sax::XFastAttributeList >& xAttrList, SvXMLStylesContext& rStyles, XmlStyleFamily nFamily) -: XMLPropStyleContext(rImport, nElement, xAttrList, rStyles, nFamily ), +: XMLPropStyleContext(rImport, rStyles, nFamily ), m_bIsNumRuleAlreadyConverted( false ) { } diff --git a/xmloff/source/draw/ximpstyl.cxx b/xmloff/source/draw/ximpstyl.cxx index f07820a4f428..a707a1a723cd 100644 --- a/xmloff/source/draw/ximpstyl.cxx +++ b/xmloff/source/draw/ximpstyl.cxx @@ -126,8 +126,6 @@ public: SdXMLDrawingPageStyleContext( SvXMLImport& rImport, - sal_Int32 nElement, - const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList, SvXMLStylesContext& rStyles); virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( @@ -163,12 +161,10 @@ XmlStyleFamily const g_Families[MAX_SPECIAL_DRAW_STYLES] = XMLDrawingPageStyleContext::XMLDrawingPageStyleContext( SvXMLImport& rImport, - sal_Int32 nElement, - const uno::Reference< xml::sax::XFastAttributeList >& xAttrList, SvXMLStylesContext& rStyles, ContextID_Index_Pair const pContextIDs[], XmlStyleFamily const pFamilies[]) - : XMLPropStyleContext(rImport, nElement, xAttrList, rStyles, XmlStyleFamily::SD_DRAWINGPAGE_ID) + : XMLPropStyleContext(rImport, rStyles, XmlStyleFamily::SD_DRAWINGPAGE_ID) , m_pFamilies(pFamilies) { size_t size(1); // for the -1 entry @@ -179,11 +175,8 @@ XMLDrawingPageStyleContext::XMLDrawingPageStyleContext( SdXMLDrawingPageStyleContext::SdXMLDrawingPageStyleContext( SvXMLImport& rImport, - sal_Int32 nElement, - const uno::Reference< xml::sax::XFastAttributeList >& xAttrList, SvXMLStylesContext& rStyles) - : XMLDrawingPageStyleContext(rImport, nElement, xAttrList, rStyles, - g_ContextIDs, g_Families) + : XMLDrawingPageStyleContext(rImport, rStyles, g_ContextIDs, g_Families) { } @@ -285,9 +278,9 @@ void XMLDrawingPageStyleContext::FillPropertySet( SdXMLPageMasterStyleContext::SdXMLPageMasterStyleContext( SdXMLImport& rImport, - sal_Int32 nElement, + sal_Int32 /*nElement*/, const uno::Reference< xml::sax::XFastAttributeList>& xAttrList) -: SvXMLStyleContext(rImport, nElement, xAttrList, XmlStyleFamily::SD_PAGEMASTERSTYLECONEXT_ID), +: SvXMLStyleContext(rImport, XmlStyleFamily::SD_PAGEMASTERSTYLECONEXT_ID), mnBorderBottom( 0 ), mnBorderLeft( 0 ), mnBorderRight( 0 ), @@ -367,9 +360,9 @@ SdXMLPageMasterStyleContext::~SdXMLPageMasterStyleContext() SdXMLPageMasterContext::SdXMLPageMasterContext( SdXMLImport& rImport, - sal_Int32 nElement, - const uno::Reference< xml::sax::XFastAttributeList>& xAttrList) -: SvXMLStyleContext(rImport, nElement, xAttrList, XmlStyleFamily::SD_PAGEMASTERCONEXT_ID) + sal_Int32 /*nElement*/, + const uno::Reference< xml::sax::XFastAttributeList>& /*xAttrList*/) +: SvXMLStyleContext(rImport, XmlStyleFamily::SD_PAGEMASTERCONEXT_ID) { // set family to something special at SvXMLStyleContext // for differences in search-methods @@ -394,9 +387,9 @@ css::uno::Reference< css::xml::sax::XFastContextHandler > SdXMLPageMasterContext SdXMLPresentationPageLayoutContext::SdXMLPresentationPageLayoutContext( SdXMLImport& rImport, - sal_Int32 nElement, - const uno::Reference< xml::sax::XFastAttributeList >& xAttrList) -: SvXMLStyleContext(rImport, nElement, xAttrList, XmlStyleFamily::SD_PRESENTATIONPAGELAYOUT_ID), + sal_Int32 /*nElement*/, + const uno::Reference< xml::sax::XFastAttributeList >& /*xAttrList*/) +: SvXMLStyleContext(rImport, XmlStyleFamily::SD_PRESENTATIONPAGELAYOUT_ID), mnTypeId( AUTOLAYOUT_NONE ) { // set family to something special at SvXMLStyleContext @@ -800,7 +793,7 @@ css::uno::Reference< css::xml::sax::XFastContextHandler > SdXMLMasterPageContext { // style:style inside master-page context -> presentation style XMLShapeStyleContext* pNew = new XMLShapeStyleContext( - GetSdImport(), nElement, xAttrList, + GetSdImport(), *GetSdImport().GetShapeImport()->GetStylesContext(), XmlStyleFamily::SD_PRESENTATION_ID); @@ -902,12 +895,12 @@ SvXMLStyleContext* SdXMLStylesContext::CreateStyleStyleChildContext( switch( nFamily ) { case XmlStyleFamily::SD_DRAWINGPAGE_ID: - return new SdXMLDrawingPageStyleContext(GetSdImport(), nElement, xAttrList, *this ); + return new SdXMLDrawingPageStyleContext(GetSdImport(), *this ); break; case XmlStyleFamily::TABLE_CELL: case XmlStyleFamily::TABLE_COLUMN: case XmlStyleFamily::TABLE_ROW: - return new XMLShapeStyleContext( GetSdImport(), nElement, xAttrList, *this, nFamily ); + return new XMLShapeStyleContext( GetSdImport(), *this, nFamily ); break; default: break; } @@ -924,7 +917,7 @@ SvXMLStyleContext* SdXMLStylesContext::CreateDefaultStyleStyleChildContext( switch( nFamily ) { case XmlStyleFamily::SD_GRAPHICS_ID: - return new XMLGraphicsDefaultStyle(GetSdImport(), nElement, xAttrList, *this ); + return new XMLGraphicsDefaultStyle(GetSdImport(), *this ); break; default: break; } diff --git a/xmloff/source/style/PageMasterImportContext.cxx b/xmloff/source/style/PageMasterImportContext.cxx index 00cf0656d532..7d70190cec89 100644 --- a/xmloff/source/style/PageMasterImportContext.cxx +++ b/xmloff/source/style/PageMasterImportContext.cxx @@ -61,11 +61,9 @@ void PageStyleContext::SetAttribute( sal_uInt16 nPrefixKey, PageStyleContext::PageStyleContext( SvXMLImport& rImport, - sal_Int32 nElement, - const uno::Reference< xml::sax::XFastAttributeList > & xAttrList, SvXMLStylesContext& rStyles, bool bDefaultStyle) : - XMLPropStyleContext( rImport, nElement, xAttrList, rStyles, XmlStyleFamily::PAGE_MASTER, bDefaultStyle), + XMLPropStyleContext( rImport, rStyles, XmlStyleFamily::PAGE_MASTER, bDefaultStyle), sPageUsage(), m_bIsFillStyleAlreadyConverted(false) // { diff --git a/xmloff/source/style/XMLFontStylesContext.cxx b/xmloff/source/style/XMLFontStylesContext.cxx index 7a9d36a7cac5..f8e3184740dd 100644 --- a/xmloff/source/style/XMLFontStylesContext.cxx +++ b/xmloff/source/style/XMLFontStylesContext.cxx @@ -85,10 +85,8 @@ static const SvXMLTokenMapEntry* lcl_getFontStyleAttrTokenMap() XMLFontStyleContextFontFace::XMLFontStyleContextFontFace( SvXMLImport& rImport, - sal_Int32 nElement, - const Reference< XFastAttributeList > & xAttrList, XMLFontStylesContext& rStyles ) : - SvXMLStyleContext( rImport, nElement, xAttrList, XML_STYLE_FAMILY_FONT ), + SvXMLStyleContext( rImport, XML_STYLE_FAMILY_FONT ), xStyles( &rStyles ) { aFamilyName <<= OUString(); @@ -197,10 +195,8 @@ OUString XMLFontStyleContextFontFace::familyName() const XMLFontStyleContextFontFaceFormat::XMLFontStyleContextFontFaceFormat( SvXMLImport& rImport, - sal_Int32 nElement, - const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList, XMLFontStyleContextFontFaceUri& _uri ) - : SvXMLStyleContext( rImport, nElement, xAttrList) + : SvXMLStyleContext( rImport ) , uri(_uri) { } @@ -224,31 +220,29 @@ XMLFontStyleContextFontFaceSrc::XMLFontStyleContextFontFaceSrc( SvXMLImport& rIm css::uno::Reference< css::xml::sax::XFastContextHandler > XMLFontStyleContextFontFaceSrc::createFastChildContext( sal_Int32 nElement, - const css::uno::Reference< css::xml::sax::XFastAttributeList > & xAttrList ) + const css::uno::Reference< css::xml::sax::XFastAttributeList > & /*xAttrList*/ ) { if( nElement == XML_ELEMENT(SVG, XML_FONT_FACE_URI) || nElement == XML_ELEMENT(SVG_COMPAT, XML_FONT_FACE_URI) ) - return new XMLFontStyleContextFontFaceUri( GetImport(), nElement, xAttrList, font ); + return new XMLFontStyleContextFontFaceUri( GetImport(), font ); SAL_WARN("xmloff", "unknown element " << SvXMLImport::getPrefixAndNameFromToken(nElement)); return nullptr; } XMLFontStyleContextFontFaceUri::XMLFontStyleContextFontFaceUri( SvXMLImport& rImport, - sal_Int32 nElement, - const css::uno::Reference< css::xml::sax::XFastAttributeList > & xAttrList, const XMLFontStyleContextFontFace& _font ) - : SvXMLStyleContext( rImport, nElement, xAttrList ) + : SvXMLStyleContext( rImport ) , font( _font ) { } css::uno::Reference< css::xml::sax::XFastContextHandler > XMLFontStyleContextFontFaceUri::createFastChildContext( sal_Int32 nElement, - const css::uno::Reference< css::xml::sax::XFastAttributeList > & xAttrList ) + const css::uno::Reference< css::xml::sax::XFastAttributeList > & /*xAttrList*/ ) { if( nElement == XML_ELEMENT(SVG, XML_FONT_FACE_FORMAT) ) - return new XMLFontStyleContextFontFaceFormat( GetImport(), nElement, xAttrList, *this ); + return new XMLFontStyleContextFontFaceFormat( GetImport(), *this ); else if( nElement == XML_ELEMENT(OFFICE, XML_BINARY_DATA) ) { assert(linkPath.isEmpty()); @@ -356,7 +350,7 @@ SvXMLStyleContext *XMLFontStylesContext::CreateStyleChildContext( { if( nElement == XML_ELEMENT(STYLE, XML_FONT_FACE) ) { - return new XMLFontStyleContextFontFace( GetImport(), nElement, xAttrList, *this ); + return new XMLFontStyleContextFontFace( GetImport(), *this ); } return SvXMLStylesContext::CreateStyleChildContext( nElement, xAttrList ); } diff --git a/xmloff/source/style/XMLFontStylesContext_impl.hxx b/xmloff/source/style/XMLFontStylesContext_impl.hxx index b9c56ad8114c..2df396c09796 100644 --- a/xmloff/source/style/XMLFontStylesContext_impl.hxx +++ b/xmloff/source/style/XMLFontStylesContext_impl.hxx @@ -46,9 +46,6 @@ public: XMLFontStyleContextFontFace( SvXMLImport& rImport, - sal_Int32 nElement, - const css::uno::Reference< - css::xml::sax::XFastAttributeList > & xAttrList, XMLFontStylesContext& rStyles ); virtual ~XMLFontStyleContextFontFace() override; @@ -100,8 +97,7 @@ class XMLFontStyleContextFontFaceUri : public SvXMLStyleContext public: - XMLFontStyleContextFontFaceUri( SvXMLImport& rImport, sal_Int32 nElement, - const css::uno::Reference< css::xml::sax::XFastAttributeList > & xAttrList, + XMLFontStyleContextFontFaceUri( SvXMLImport& rImport, const XMLFontStyleContextFontFace& font ); virtual void SetAttribute( sal_uInt16 nPrefixKey, const OUString& rLocalName, @@ -119,8 +115,7 @@ class XMLFontStyleContextFontFaceFormat : public SvXMLStyleContext XMLFontStyleContextFontFaceUri& uri; public: - XMLFontStyleContextFontFaceFormat( SvXMLImport& rImport, sal_Int32 nElement, - const css::uno::Reference< css::xml::sax::XFastAttributeList > & xAttrList, + XMLFontStyleContextFontFaceFormat( SvXMLImport& rImport, XMLFontStyleContextFontFaceUri& uri ); void SetAttribute( sal_uInt16 nPrefixKey, const OUString& rLocalName, diff --git a/xmloff/source/style/prstylei.cxx b/xmloff/source/style/prstylei.cxx index 38c648e414de..48cbeca9edad 100644 --- a/xmloff/source/style/prstylei.cxx +++ b/xmloff/source/style/prstylei.cxx @@ -147,11 +147,9 @@ const OUStringLiteral gsIsPhysical( u"IsPhysical" ); const OUStringLiteral gsFollowStyle( u"FollowStyle" ); XMLPropStyleContext::XMLPropStyleContext( SvXMLImport& rImport, - sal_Int32 nElement, - const Reference< XFastAttributeList > & xAttrList, SvXMLStylesContext& rStyles, XmlStyleFamily nFamily, bool bDefault ) -: SvXMLStyleContext( rImport, nElement, xAttrList, nFamily, bDefault ) +: SvXMLStyleContext( rImport, nFamily, bDefault ) , mxStyles( &rStyles ) { } diff --git a/xmloff/source/style/xmlnumfi.cxx b/xmloff/source/style/xmlnumfi.cxx index 2c32e4745ab1..829a3cbe5980 100644 --- a/xmloff/source/style/xmlnumfi.cxx +++ b/xmloff/source/style/xmlnumfi.cxx @@ -1256,10 +1256,10 @@ SvXMLNumFormatContext::SvXMLNumFormatContext( SvXMLImport& rImport, SvXMLNumFormatContext::SvXMLNumFormatContext( SvXMLImport& rImport, const OUString& rName, - const uno::Reference<xml::sax::XFastAttributeList>& xAttrList, + const uno::Reference<xml::sax::XFastAttributeList>& /*xAttrList*/, const sal_Int32 nTempKey, LanguageType nLang, SvXMLStylesContext& rStyles ) : - SvXMLStyleContext( rImport, 0, xAttrList, XmlStyleFamily::DATA_STYLE ), + SvXMLStyleContext( rImport, XmlStyleFamily::DATA_STYLE ), pData( nullptr ), pStyles( &rStyles ), aMyConditions(), diff --git a/xmloff/source/style/xmlnumi.cxx b/xmloff/source/style/xmlnumi.cxx index e0d09cebd366..9fdba383d98e 100644 --- a/xmloff/source/style/xmlnumi.cxx +++ b/xmloff/source/style/xmlnumi.cxx @@ -82,14 +82,15 @@ class SvxXMLListLevelStyleAttrContext_Impl : public SvXMLImportContext public: SvxXMLListLevelStyleAttrContext_Impl( - SvXMLImport& rImport, sal_uInt16 nPrfx, - const OUString& rLName, - const Reference< xml::sax::XAttributeList >& xAttrList, + SvXMLImport& rImport, sal_Int32 nElement, + const Reference< xml::sax::XFastAttributeList >& xAttrList, SvxXMLListLevelStyleContext_Impl& rLLevel ); - virtual SvXMLImportContextRef CreateChildContext( - sal_uInt16 nPrefix, const OUString& rLocalName, - const Reference< xml::sax::XAttributeList > & xAttrList ) override; + 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; }; class SvxXMLListLevelStyleLabelAlignmentAttrContext_Impl : public SvXMLImportContext @@ -97,9 +98,8 @@ class SvxXMLListLevelStyleLabelAlignmentAttrContext_Impl : public SvXMLImportCon public: SvxXMLListLevelStyleLabelAlignmentAttrContext_Impl( - SvXMLImport& rImport, sal_uInt16 nPrfx, - const OUString& rLName, - const Reference< xml::sax::XAttributeList >& xAttrList, + SvXMLImport& rImport, sal_Int32 nElement, + const Reference< xml::sax::XFastAttributeList >& xAttrList, SvxXMLListLevelStyleContext_Impl& rLLevel ); }; @@ -122,30 +122,6 @@ enum SvxXMLTextListLevelStyleAttrTokens } -static const SvXMLTokenMapEntry* lcl_getLevelAttrTokenMap() -{ - static const SvXMLTokenMapEntry aLevelAttrTokenMap[] = - { - { XML_NAMESPACE_TEXT, XML_LEVEL, XML_TOK_TEXT_LEVEL_ATTR_LEVEL }, - { XML_NAMESPACE_TEXT, XML_STYLE_NAME, XML_TOK_TEXT_LEVEL_ATTR_STYLE_NAME }, - { XML_NAMESPACE_TEXT, XML_BULLET_CHAR, XML_TOK_TEXT_LEVEL_ATTR_BULLET_CHAR }, - { XML_NAMESPACE_XLINK, XML_HREF, XML_TOK_TEXT_LEVEL_ATTR_HREF }, - { XML_NAMESPACE_XLINK, XML_TYPE, XML_TOK_TEXT_LEVEL_ATTR_TYPE }, - { XML_NAMESPACE_XLINK, XML_SHOW, XML_TOK_TEXT_LEVEL_ATTR_SHOW }, - { XML_NAMESPACE_XLINK, XML_ACTUATE, XML_TOK_TEXT_LEVEL_ATTR_ACTUATE }, - - { XML_NAMESPACE_STYLE, XML_NUM_FORMAT, XML_TOK_TEXT_LEVEL_ATTR_NUM_FORMAT }, - { XML_NAMESPACE_STYLE, XML_NUM_PREFIX, XML_TOK_TEXT_LEVEL_ATTR_NUM_PREFIX }, - { XML_NAMESPACE_STYLE, XML_NUM_SUFFIX, XML_TOK_TEXT_LEVEL_ATTR_NUM_SUFFIX }, - { XML_NAMESPACE_STYLE, XML_NUM_LETTER_SYNC, XML_TOK_TEXT_LEVEL_ATTR_NUM_LETTER_SYNC }, - { XML_NAMESPACE_TEXT, XML_START_VALUE, XML_TOK_TEXT_LEVEL_ATTR_START_VALUE }, - { XML_NAMESPACE_TEXT, XML_DISPLAY_LEVELS, XML_TOK_TEXT_LEVEL_ATTR_DISPLAY_LEVELS }, - - XML_TOKEN_MAP_END - }; - return aLevelAttrTokenMap; -} - class SvxXMLListLevelStyleContext_Impl : public SvXMLImportContext { friend SvxXMLListLevelStyleAttrContext_Impl; @@ -216,13 +192,14 @@ class SvxXMLListLevelStyleContext_Impl : public SvXMLImportContext public: SvxXMLListLevelStyleContext_Impl( - SvXMLImport& rImport, sal_uInt16 nPrfx, - const OUString& rLName, - const Reference< xml::sax::XAttributeList > & xAttrList ); + SvXMLImport& rImport, sal_Int32 nElement, + const Reference< xml::sax::XFastAttributeList > & xAttrList ); - virtual SvXMLImportContextRef CreateChildContext( - sal_uInt16 nPrefix, const OUString& rLocalName, - const Reference< xml::sax::XAttributeList > & xAttrList ) override; + 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; sal_Int32 GetLevel() const { return nLevel; } Sequence<beans::PropertyValue> GetProperties(); @@ -253,11 +230,10 @@ const OUStringLiteral gsStarBats( u"StarBats" ); const OUStringLiteral gsStarMath( u"StarMath" ); SvxXMLListLevelStyleContext_Impl::SvxXMLListLevelStyleContext_Impl( - SvXMLImport& rImport, sal_uInt16 nPrfx, - const OUString& rLName, - const Reference< xml::sax::XAttributeList > & xAttrList ) + SvXMLImport& rImport, sal_Int32 nElement, + const Reference< xml::sax::XFastAttributeList > & xAttrList ) -: SvXMLImportContext( rImport, nPrfx, rLName ) +: SvXMLImportContext( rImport ) , sNumFormat( "1" ) , nLevel( -1 ) , nSpaceBefore( 0 ) @@ -285,115 +261,109 @@ SvxXMLListLevelStyleContext_Impl::SvxXMLListLevelStyleContext_Impl( , bNum( false ) , bHasColor( false ) { - if( IsXMLToken( rLName, XML_LIST_LEVEL_STYLE_NUMBER ) || - IsXMLToken( rLName, XML_OUTLINE_LEVEL_STYLE ) ) - bNum = true; - else if( IsXMLToken( rLName, XML_LIST_LEVEL_STYLE_BULLET ) ) - bBullet = true; - else if( IsXMLToken( rLName, XML_LIST_LEVEL_STYLE_IMAGE ) ) - bImage = true; - - static const SvXMLTokenMap aTokenMap( lcl_getLevelAttrTokenMap() ); - sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0; - for( sal_Int16 i=0; i < nAttrCount; i++ ) + switch (nElement & TOKEN_MASK) { - const OUString& rAttrName = xAttrList->getNameByIndex( i ); - OUString aLocalName; - sal_uInt16 nPrefix = - GetImport().GetNamespaceMap().GetKeyByAttrName( rAttrName, - &aLocalName ); - const OUString& rValue = xAttrList->getValueByIndex( i ); - - switch( aTokenMap.Get( nPrefix, aLocalName ) ) + case XML_LIST_LEVEL_STYLE_NUMBER: + case XML_OUTLINE_LEVEL_STYLE: + bNum = true; + break; + case XML_LIST_LEVEL_STYLE_BULLET: + bBullet = true; + break; + case XML_LIST_LEVEL_STYLE_IMAGE: + bImage = true; + break; + } + + for( auto& aIter : sax_fastparser::castToFastAttributeList(xAttrList) ) + { + const OUString sValue = aIter.toString(); + switch( aIter.getToken() ) { - case XML_TOK_TEXT_LEVEL_ATTR_LEVEL: - nLevel = rValue.toInt32(); + case XML_ELEMENT(TEXT, XML_LEVEL): + nLevel = sValue.toInt32(); if( nLevel >= 1 ) nLevel--; else nLevel = 0; break; - case XML_TOK_TEXT_LEVEL_ATTR_STYLE_NAME: - sTextStyleName = rValue; + case XML_ELEMENT(TEXT, XML_STYLE_NAME): + sTextStyleName = sValue; break; - case XML_TOK_TEXT_LEVEL_ATTR_BULLET_CHAR: - if (!rValue.isEmpty()) - cBullet = rValue[0]; + case XML_ELEMENT(TEXT, XML_BULLET_CHAR): + if (!sValue.isEmpty()) + cBullet = sValue[0]; break; - case XML_TOK_TEXT_LEVEL_ATTR_HREF: + case XML_ELEMENT(XLINK, XML_HREF): if( bImage ) - sImageURL = rValue; + sImageURL = sValue; break; - case XML_TOK_TEXT_LEVEL_ATTR_TYPE: - case XML_TOK_TEXT_LEVEL_ATTR_SHOW: - case XML_TOK_TEXT_LEVEL_ATTR_ACTUATE: + case XML_ELEMENT(XLINK, XML_TYPE): + case XML_ELEMENT(XLINK, XML_SHOW): + case XML_ELEMENT(XLINK, XML_ACTUATE): // This properties will be ignored break; - case XML_TOK_TEXT_LEVEL_ATTR_NUM_FORMAT: + case XML_ELEMENT(STYLE, XML_NUM_FORMAT): if( bNum ) - sNumFormat = rValue; + sNumFormat = sValue; break; - case XML_TOK_TEXT_LEVEL_ATTR_NUM_PREFIX: - sPrefix = rValue; + case XML_ELEMENT(STYLE, XML_NUM_PREFIX): + sPrefix = sValue; break; - case XML_TOK_TEXT_LEVEL_ATTR_NUM_SUFFIX: - sSuffix = rValue; + case XML_ELEMENT(STYLE, XML_NUM_SUFFIX): + sSuffix = sValue; break; - case XML_TOK_TEXT_LEVEL_ATTR_NUM_LETTER_SYNC: + case XML_ELEMENT(STYLE, XML_NUM_LETTER_SYNC): if( bNum ) - sNumLetterSync = rValue; + sNumLetterSync = sValue; break; - case XML_TOK_TEXT_LEVEL_ATTR_START_VALUE: + case XML_ELEMENT(TEXT, XML_START_VALUE): if( bNum ) { - sal_Int32 nTmp = rValue.toInt32(); + sal_Int32 nTmp = sValue.toInt32(); nNumStartValue = (nTmp < 0) ? 1 : ( (nTmp>SHRT_MAX) ? SHRT_MAX : static_cast<sal_Int16>(nTmp) ); } break; - case XML_TOK_TEXT_LEVEL_ATTR_DISPLAY_LEVELS: + case XML_ELEMENT(TEXT, XML_DISPLAY_LEVELS): if( bNum ) { - sal_Int32 nTmp = rValue.toInt32(); + sal_Int32 nTmp = sValue.toInt32(); nNumDisplayLevels = (nTmp < 1) ? 1 : ( (nTmp>SHRT_MAX) ? SHRT_MAX : static_cast<sal_Int16>(nTmp) ); } break; + default: + SAL_WARN("xmloff", "unknown attribute " << SvXMLImport::getPrefixAndNameFromToken(aIter.getToken()) << "=" << sValue); } } } -SvXMLImportContextRef SvxXMLListLevelStyleContext_Impl::CreateChildContext( - sal_uInt16 nPrefix, const OUString& rLocalName, - const Reference< xml::sax::XAttributeList > & xAttrList ) +css::uno::Reference< css::xml::sax::XFastContextHandler > SvxXMLListLevelStyleContext_Impl::createFastChildContext( + sal_Int32 nElement, + const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ) { - SvXMLImportContext *pContext = nullptr; - if( XML_NAMESPACE_STYLE == nPrefix && - ( IsXMLToken( rLocalName, XML_LIST_LEVEL_PROPERTIES ) || - IsXMLToken( rLocalName, XML_TEXT_PROPERTIES ) ) ) + if( nElement == XML_ELEMENT(STYLE, XML_LIST_LEVEL_PROPERTIES) || + nElement == XML_ELEMENT(STYLE, XML_TEXT_PROPERTIES) ) { - pContext = new SvxXMLListLevelStyleAttrContext_Impl( GetImport(), - nPrefix, - rLocalName, - xAttrList, - *this ); + return new SvxXMLListLevelStyleAttrContext_Impl( GetImport(), + nElement, + xAttrList, + *this ); } - else if( (XML_NAMESPACE_OFFICE == nPrefix) && xmloff::token::IsXMLToken( rLocalName, - xmloff::token::XML_BINARY_DATA ) ) + else if( nElement == XML_ELEMENT(OFFICE, XML_BINARY_DATA) ) { if( bImage && sImageURL.isEmpty() && !xBase64Stream.is() ) { xBase64Stream = GetImport().GetStreamForGraphicObjectURLFromBase64(); if( xBase64Stream.is() ) - pContext = new XMLBase64ImportContext( GetImport(), nPrefix, - rLocalName, xAttrList, - xBase64Stream ); + return new XMLBase64ImportContext( GetImport(), xBase64Stream ); } } - - return pContext; + SAL_WARN("xmloff", "unknown element " << SvXMLImport::getPrefixAndNameFromToken(nElement)); + return nullptr; } Sequence<beans::PropertyValue> SvxXMLListLevelStyleContext_Impl::GetProperties() @@ -610,160 +580,115 @@ enum SvxXMLStyleAttributesAttrTokens } -static const SvXMLTokenMapEntry* lcl_getStyleAttributesAttrTokenMap() -{ - static const SvXMLTokenMapEntry aStyleAttributesAttrTokenMap[] = - { - { XML_NAMESPACE_TEXT, XML_SPACE_BEFORE, - XML_TOK_STYLE_ATTRIBUTES_ATTR_SPACE_BEFORE }, - { XML_NAMESPACE_TEXT, XML_MIN_LABEL_WIDTH, - XML_TOK_STYLE_ATTRIBUTES_ATTR_MIN_LABEL_WIDTH }, - { XML_NAMESPACE_TEXT, XML_MIN_LABEL_DISTANCE, - XML_TOK_STYLE_ATTRIBUTES_ATTR_MIN_LABEL_DIST }, - { XML_NAMESPACE_FO, XML_TEXT_ALIGN, - XML_TOK_STYLE_ATTRIBUTES_ATTR_TEXT_ALIGN }, - { XML_NAMESPACE_STYLE, XML_FONT_NAME, - XML_TOK_STYLE_ATTRIBUTES_ATTR_FONT_NAME }, - { XML_NAMESPACE_FO, XML_FONT_FAMILY, - XML_TOK_STYLE_ATTRIBUTES_ATTR_FONT_FAMILY }, - { XML_NAMESPACE_STYLE, XML_FONT_FAMILY_GENERIC, - XML_TOK_STYLE_ATTRIBUTES_ATTR_FONT_FAMILY_GENERIC }, - { XML_NAMESPACE_STYLE, XML_FONT_STYLE_NAME, - XML_TOK_STYLE_ATTRIBUTES_ATTR_FONT_STYLENAME }, - { XML_NAMESPACE_STYLE, XML_FONT_PITCH, - XML_TOK_STYLE_ATTRIBUTES_ATTR_FONT_PITCH }, - { XML_NAMESPACE_STYLE, XML_FONT_CHARSET, - XML_TOK_STYLE_ATTRIBUTES_ATTR_FONT_CHARSET }, - { XML_NAMESPACE_STYLE, XML_VERTICAL_POS, - XML_TOK_STYLE_ATTRIBUTES_ATTR_VERTICAL_POS }, - { XML_NAMESPACE_STYLE, XML_VERTICAL_REL, - XML_TOK_STYLE_ATTRIBUTES_ATTR_VERTICAL_REL }, - { XML_NAMESPACE_FO, XML_WIDTH, - XML_TOK_STYLE_ATTRIBUTES_ATTR_WIDTH }, - { XML_NAMESPACE_FO, XML_HEIGHT, - XML_TOK_STYLE_ATTRIBUTES_ATTR_HEIGHT }, - { XML_NAMESPACE_FO, XML_COLOR, - XML_TOK_STYLE_ATTRIBUTES_ATTR_COLOR }, - { XML_NAMESPACE_STYLE, XML_USE_WINDOW_FONT_COLOR, - XML_TOK_STYLE_ATTRIBUTES_ATTR_WINDOW_FONT_COLOR }, - { XML_NAMESPACE_FO, XML_FONT_SIZE, - XML_TOK_STYLE_ATTRIBUTES_ATTR_FONT_SIZE }, - { XML_NAMESPACE_TEXT, XML_LIST_LEVEL_POSITION_AND_SPACE_MODE, - XML_TOK_STYLE_ATTRIBUTES_ATTR_POSITION_AND_SPACE_MODE }, - XML_TOKEN_MAP_END - }; - return aStyleAttributesAttrTokenMap; -} SvxXMLListLevelStyleAttrContext_Impl::SvxXMLListLevelStyleAttrContext_Impl( - SvXMLImport& rImport, sal_uInt16 nPrfx, - const OUString& rLName, - const Reference< xml::sax::XAttributeList > & xAttrList, + SvXMLImport& rImport, sal_Int32 /*nElement*/, + const Reference< xml::sax::XFastAttributeList > & xAttrList, SvxXMLListLevelStyleContext_Impl& rLLevel ) : - SvXMLImportContext( rImport, nPrfx, rLName ), + SvXMLImportContext( rImport ), rListLevel( rLLevel ) { - static const SvXMLTokenMap aTokenMap( lcl_getStyleAttributesAttrTokenMap() ); SvXMLUnitConverter& rUnitConv = GetImport().GetMM100UnitConverter(); OUString sFontName, sFontFamily, sFontStyleName, sFontFamilyGeneric, sFontPitch, sFontCharset; OUString sVerticalPos, sVerticalRel; - sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0; - for( sal_Int16 i=0; i < nAttrCount; i++ ) + for( auto& aIter : sax_fastparser::castToFastAttributeList(xAttrList) ) { - const OUString& rAttrName = xAttrList->getNameByIndex( i ); - OUString aLocalName; - sal_uInt16 nPrefix = - GetImport().GetNamespaceMap().GetKeyByAttrName( rAttrName, - &aLocalName ); - const OUString& rValue = xAttrList->getValueByIndex( i ); - + const OUString sValue = aIter.toString(); sal_Int32 nVal; - switch( aTokenMap.Get( nPrefix, aLocalName ) ) + switch( aIter.getToken() ) { - case XML_TOK_STYLE_ATTRIBUTES_ATTR_SPACE_BEFORE: - if (rUnitConv.convertMeasureToCore(nVal, rValue, SHRT_MIN, SHRT_MAX)) + case XML_ELEMENT(TEXT, XML_SPACE_BEFORE): + if (rUnitConv.convertMeasureToCore(nVal, sValue, SHRT_MIN, SHRT_MAX)) rListLevel.SetSpaceBefore( nVal ); break; - case XML_TOK_STYLE_ATTRIBUTES_ATTR_MIN_LABEL_WIDTH: - if (rUnitConv.convertMeasureToCore( nVal, rValue, 0, SHRT_MAX )) + case XML_ELEMENT(TEXT, XML_MIN_LABEL_WIDTH): + if (rUnitConv.convertMeasureToCore( nVal, sValue, 0, SHRT_MAX )) rListLevel.SetMinLabelWidth( nVal ); break; - case XML_TOK_STYLE_ATTRIBUTES_ATTR_MIN_LABEL_DIST: - if (rUnitConv.convertMeasureToCore( nVal, rValue, 0, USHRT_MAX )) + case XML_ELEMENT(TEXT, XML_MIN_LABEL_DISTANCE): + if (rUnitConv.convertMeasureToCore( nVal, sValue, 0, USHRT_MAX )) rListLevel.SetMinLabelDist( nVal ); break; - case XML_TOK_STYLE_ATTRIBUTES_ATTR_TEXT_ALIGN: - if( !rValue.isEmpty() ) + case XML_ELEMENT(FO, XML_TEXT_ALIGN): + case XML_ELEMENT(FO_COMPAT, XML_TEXT_ALIGN): + if( !sValue.isEmpty() ) { sal_Int16 eAdjust = HoriOrientation::LEFT; - if( IsXMLToken( rValue, XML_CENTER ) ) + if( IsXMLToken( sValue, XML_CENTER ) ) eAdjust = HoriOrientation::CENTER; - else if( IsXMLToken( rValue, XML_END ) ) + else if( IsXMLToken( sValue, XML_END ) ) eAdjust = HoriOrientation::RIGHT; rListLevel.SetAdjust( eAdjust ); } break; - case XML_TOK_STYLE_ATTRIBUTES_ATTR_FONT_NAME: - sFontName = rValue; + case XML_ELEMENT(STYLE, XML_FONT_NAME): + sFontName = sValue; break; - case XML_TOK_STYLE_ATTRIBUTES_ATTR_FONT_FAMILY: - sFontFamily = rValue; + case XML_ELEMENT(FO, XML_FONT_FAMILY): + case XML_ELEMENT(FO_COMPAT, XML_FONT_FAMILY): + sFontFamily = sValue; break; - case XML_TOK_STYLE_ATTRIBUTES_ATTR_FONT_FAMILY_GENERIC: - sFontFamilyGeneric = rValue; + case XML_ELEMENT(STYLE, XML_FONT_FAMILY_GENERIC): + sFontFamilyGeneric = sValue; break; - case XML_TOK_STYLE_ATTRIBUTES_ATTR_FONT_STYLENAME: - sFontStyleName = rValue; + case XML_ELEMENT(STYLE, XML_FONT_STYLE_NAME): + sFontStyleName = sValue; break; - case XML_TOK_STYLE_ATTRIBUTES_ATTR_FONT_PITCH: - sFontPitch = rValue; + case XML_ELEMENT(STYLE, XML_FONT_PITCH): + sFontPitch = sValue; break; - case XML_TOK_STYLE_ATTRIBUTES_ATTR_FONT_CHARSET: - sFontCharset = rValue; + case XML_ELEMENT(STYLE, XML_FONT_CHARSET): + sFontCharset = sValue; break; - case XML_TOK_STYLE_ATTRIBUTES_ATTR_VERTICAL_POS: - sVerticalPos = rValue; + case XML_ELEMENT(STYLE, XML_VERTICAL_POS): + sVerticalPos = sValue; break; - case XML_TOK_STYLE_ATTRIBUTES_ATTR_VERTICAL_REL: - sVerticalRel = rValue; + case XML_ELEMENT(STYLE, XML_VERTICAL_REL): + sVerticalRel = sValue; break; - case XML_TOK_STYLE_ATTRIBUTES_ATTR_WIDTH: - if (rUnitConv.convertMeasureToCore(nVal, rValue)) + case XML_ELEMENT(FO, XML_WIDTH): + case XML_ELEMENT(FO_COMPAT, XML_WIDTH): + if (rUnitConv.convertMeasureToCore(nVal, sValue)) rListLevel.SetImageWidth( nVal ); break; - case XML_TOK_STYLE_ATTRIBUTES_ATTR_HEIGHT: - if (rUnitConv.convertMeasureToCore(nVal, rValue)) + case XML_ELEMENT(FO, XML_HEIGHT): + case XML_ELEMENT(FO_COMPAT, XML_HEIGHT): + if (rUnitConv.convertMeasureToCore(nVal, sValue)) rListLevel.SetImageHeight( nVal ); break; - case XML_TOK_STYLE_ATTRIBUTES_ATTR_COLOR: + case XML_ELEMENT(FO, XML_COLOR): + case XML_ELEMENT(FO_COMPAT, XML_COLOR): { sal_Int32 nColor(0); - if (::sax::Converter::convertColor( nColor, rValue )) + if (::sax::Converter::convertColor( nColor, sValue )) { rListLevel.SetColor( Color(nColor) ); } } break; - case XML_TOK_STYLE_ATTRIBUTES_ATTR_WINDOW_FONT_COLOR: + case XML_ELEMENT(STYLE, XML_USE_WINDOW_FONT_COLOR): { - if( IsXMLToken( rValue, XML_TRUE ) ) + if( IsXMLToken( sValue, XML_TRUE ) ) rListLevel.SetColor( Color(0xffffffff) ); } break; - case XML_TOK_STYLE_ATTRIBUTES_ATTR_FONT_SIZE: - if (::sax::Converter::convertPercent( nVal, rValue )) + case XML_ELEMENT(FO, XML_FONT_SIZE): + case XML_ELEMENT(FO_COMPAT, XML_FONT_SIZE): + if (::sax::Converter::convertPercent( nVal, sValue )) rListLevel.SetRelSize( static_cast<sal_Int16>(nVal) ); break; - case XML_TOK_STYLE_ATTRIBUTES_ATTR_POSITION_AND_SPACE_MODE: + case XML_ELEMENT(TEXT, XML_LIST_LEVEL_POSITION_AND_SPACE_MODE): { sal_Int16 ePosAndSpaceMode = PositionAndSpaceMode::LABEL_WIDTH_AND_POSITION; - if( IsXMLToken( rValue, XML_LABEL_ALIGNMENT ) ) + if( IsXMLToken( sValue, XML_LABEL_ALIGNMENT ) ) ePosAndSpaceMode = PositionAndSpaceMode::LABEL_ALIGNMENT; rListLevel.SetPosAndSpaceMode( ePosAndSpaceMode ); } break; + default: + SAL_WARN("xmloff", "unknown attribute " << SvXMLImport::getPrefixAndNameFromToken(aIter.getToken()) << "=" << sValue); } } @@ -895,22 +820,19 @@ SvxXMLListLevelStyleAttrContext_Impl::SvxXMLListLevelStyleAttrContext_Impl( rListLevel.SetImageVertOrient( eVertOrient ); } -SvXMLImportContextRef SvxXMLListLevelStyleAttrContext_Impl::CreateChildContext( - sal_uInt16 nPrefix, const OUString& rLocalName, - const Reference< xml::sax::XAttributeList > & xAttrList ) +css::uno::Reference< css::xml::sax::XFastContextHandler > SvxXMLListLevelStyleAttrContext_Impl::createFastChildContext( + sal_Int32 nElement, + const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ) { - SvXMLImportContext *pContext = nullptr; - if ( XML_NAMESPACE_STYLE == nPrefix && - IsXMLToken( rLocalName, XML_LIST_LEVEL_LABEL_ALIGNMENT ) ) + if ( nElement == XML_ELEMENT(STYLE, XML_LIST_LEVEL_LABEL_ALIGNMENT) ) { - pContext = new SvxXMLListLevelStyleLabelAlignmentAttrContext_Impl( GetImport(), - nPrefix, - rLocalName, + return new SvxXMLListLevelStyleLabelAlignmentAttrContext_Impl( GetImport(), + nElement, xAttrList, rListLevel ); } - - return pContext; + SAL_WARN("xmloff", "unknown element " << SvXMLImport::getPrefixAndNameFromToken(nElement)); + return nullptr; } namespace { @@ -925,74 +847,52 @@ enum SvxXMLStyleAttributesLabelAlignmentAttrTokens } -static const SvXMLTokenMapEntry* lcl_getStyleAlignmentAttributesAttrTokenMap() -{ - static const SvXMLTokenMapEntry aStyleAlignmentAttributesAttrTokenMap[] = - { - { XML_NAMESPACE_TEXT, XML_LABEL_FOLLOWED_BY, - XML_TOK_STYLE_ATTRIBUTES_ATTR_LABEL_FOLLOWED_BY }, - { XML_NAMESPACE_LO_EXT, XML_LABEL_FOLLOWED_BY, - XML_TOK_STYLE_ATTRIBUTES_ATTR_LABEL_FOLLOWED_BY }, - { XML_NAMESPACE_TEXT, XML_LIST_TAB_STOP_POSITION, - XML_TOK_STYLE_ATTRIBUTES_ATTR_LISTTAB_STOP_POSITION }, - { XML_NAMESPACE_FO, XML_TEXT_INDENT, - XML_TOK_STYLE_ATTRIBUTES_ATTR_FIRST_LINE_INDENT }, - { XML_NAMESPACE_FO, XML_MARGIN_LEFT, - XML_TOK_STYLE_ATTRIBUTES_ATTR_INDENT_AT }, - - XML_TOKEN_MAP_END - }; - return aStyleAlignmentAttributesAttrTokenMap; -} SvxXMLListLevelStyleLabelAlignmentAttrContext_Impl::SvxXMLListLevelStyleLabelAlignmentAttrContext_Impl( - SvXMLImport& rImport, sal_uInt16 nPrfx, - const OUString& rLName, - const Reference< xml::sax::XAttributeList > & xAttrList, + SvXMLImport& rImport, sal_Int32 /*nElement*/, + const Reference< xml::sax::XFastAttributeList > & xAttrList, SvxXMLListLevelStyleContext_Impl& rLLevel ) : - SvXMLImportContext( rImport, nPrfx, rLName ) + SvXMLImportContext( rImport ) { - static const SvXMLTokenMap aTokenMap( lcl_getStyleAlignmentAttributesAttrTokenMap() ); SvXMLUnitConverter& rUnitConv = GetImport().GetMM100UnitConverter(); - sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0; sal_Int16 eLabelFollowedBy = LabelFollow::LISTTAB; - for( sal_Int16 i=0; i < nAttrCount; i++ ) + for( auto& aIter : sax_fastparser::castToFastAttributeList(xAttrList) ) { - const OUString& rAttrName = xAttrList->getNameByIndex( i ); - OUString aLocalName; - sal_uInt16 nPrefix = - GetImport().GetNamespaceMap().GetKeyByAttrName( rAttrName, - &aLocalName ); - const OUString& rValue = xAttrList->getValueByIndex( i ); + const OUString sValue = aIter.toString(); sal_Int32 nVal; - switch( aTokenMap.Get( nPrefix, aLocalName ) ) + switch( aIter.getToken() ) { - case XML_TOK_STYLE_ATTRIBUTES_ATTR_LABEL_FOLLOWED_BY: + case XML_ELEMENT(TEXT, XML_LABEL_FOLLOWED_BY): + case XML_ELEMENT(LO_EXT, XML_LABEL_FOLLOWED_BY): { if( eLabelFollowedBy == LabelFollow::NEWLINE) //NewLine from LO_EXT has precedence over other values of the Non LO_EXT namespace break; - if( IsXMLToken( rValue, XML_SPACE ) ) + if( IsXMLToken( sValue, XML_SPACE ) ) eLabelFollowedBy = LabelFollow::SPACE; - else if( IsXMLToken( rValue, XML_NOTHING ) ) + else if( IsXMLToken( sValue, XML_NOTHING ) ) eLabelFollowedBy = LabelFollow::NOTHING; - else if( IsXMLToken( rValue, XML_NEWLINE ) ) + else if( IsXMLToken( sValue, XML_NEWLINE ) ) eLabelFollowedBy = LabelFollow::NEWLINE; } break; - case XML_TOK_STYLE_ATTRIBUTES_ATTR_LISTTAB_STOP_POSITION: - if (rUnitConv.convertMeasureToCore(nVal, rValue, 0, SHRT_MAX)) + case XML_ELEMENT(TEXT, XML_LIST_TAB_STOP_POSITION): + if (rUnitConv.convertMeasureToCore(nVal, sValue, 0, SHRT_MAX)) rLLevel.SetListtabStopPosition( nVal ); break; - case XML_TOK_STYLE_ATTRIBUTES_ATTR_FIRST_LINE_INDENT: - if (rUnitConv.convertMeasureToCore(nVal, rValue, SHRT_MIN, SHRT_MAX)) + case XML_ELEMENT(FO, XML_TEXT_INDENT): + case XML_ELEMENT(FO_COMPAT, XML_TEXT_INDENT): + if (rUnitConv.convertMeasureToCore(nVal, sValue, SHRT_MIN, SHRT_MAX)) rLLevel.SetFirstLineIndent( nVal ); break; - case XML_TOK_STYLE_ATTRIBUTES_ATTR_INDENT_AT: - if (rUnitConv.convertMeasureToCore(nVal, rValue, SHRT_MIN, SHRT_MAX)) + case XML_ELEMENT(FO, XML_MARGIN_LEFT): + case XML_ELEMENT(FO_COMPAT, XML_MARGIN_LEFT): + if (rUnitConv.convertMeasureToCore(nVal, sValue, SHRT_MIN, SHRT_MAX)) rLLevel.SetIndentAt( nVal ); break; + default: + SAL_WARN("xmloff", "unknown attribute " << SvXMLImport::getPrefixAndNameFromToken(aIter.getToken()) << "=" << sValue); } } rLLevel.SetLabelFollowedBy( eLabelFollowedBy ); @@ -1018,10 +918,8 @@ const OUStringLiteral sNumberingRules( u"NumberingRules" ); const OUStringLiteral sIsContinuousNumbering( u"IsContinuousNumbering" ); SvxXMLListStyleContext::SvxXMLListStyleContext( SvXMLImport& rImport, - sal_Int32 nElement, - const css::uno::Reference< css::xml::sax::XFastAttributeList > & xAttrList, bool bOutl ) -: SvXMLStyleContext( rImport, nElement, xAttrList, bOutl ? XmlStyleFamily::TEXT_OUTLINE : XmlStyleFamily::TEXT_LIST ) +: SvXMLStyleContext( rImport, bOutl ? XmlStyleFamily::TEXT_OUTLINE : XmlStyleFamily::TEXT_LIST ) , bConsecutive( false ) , bOutline( bOutl ) { @@ -1029,31 +927,26 @@ SvxXMLListStyleContext::SvxXMLListStyleContext( SvXMLImport& rImport, SvxXMLListStyleContext::~SvxXMLListStyleContext() {} -SvXMLImportContextRef SvxXMLListStyleContext::CreateChildContext( - sal_uInt16 nPrefix, - const OUString& rLocalName, - const Reference< xml::sax::XAttributeList > & xAttrList ) +css::uno::Reference< css::xml::sax::XFastContextHandler > SvxXMLListStyleContext::createFastChildContext( + sal_Int32 nElement, + const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ) { - SvXMLImportContextRef xContext; - - if( XML_NAMESPACE_TEXT == nPrefix && - ( bOutline - ? IsXMLToken( rLocalName, XML_OUTLINE_LEVEL_STYLE ) - : ( IsXMLToken( rLocalName, XML_LIST_LEVEL_STYLE_NUMBER ) || - IsXMLToken( rLocalName, XML_LIST_LEVEL_STYLE_BULLET ) || - IsXMLToken( rLocalName, XML_LIST_LEVEL_STYLE_IMAGE ) ) ) ) + if( bOutline + ? nElement == XML_ELEMENT(TEXT, XML_OUTLINE_LEVEL_STYLE) + : ( nElement == XML_ELEMENT(TEXT, XML_LIST_LEVEL_STYLE_NUMBER) || + nElement == XML_ELEMENT(TEXT, XML_LIST_LEVEL_STYLE_BULLET) || + nElement == XML_ELEMENT(TEXT, XML_LIST_LEVEL_STYLE_IMAGE ) ) ) { rtl::Reference<SvxXMLListLevelStyleContext_Impl> xLevelStyle{ - new SvxXMLListLevelStyleContext_Impl( GetImport(), nPrefix, - rLocalName, xAttrList )}; + new SvxXMLListLevelStyleContext_Impl( GetImport(), nElement, xAttrList )}; if( !pLevelStyles ) pLevelStyles = std::make_unique<SvxXMLListStyle_Impl>(); pLevelStyles->push_back( xLevelStyle ); - xContext = xLevelStyle.get(); + return xLevelStyle.get(); } - - return xContext; + SAL_WARN("xmloff", "unknown element " << SvXMLImport::getPrefixAndNameFromToken(nElement)); + return nullptr; } void SvxXMLListStyleContext::FillUnoNumRule( diff --git a/xmloff/source/style/xmlstyle.cxx b/xmloff/source/style/xmlstyle.cxx index b93f50d74d8f..a861996b99b6 100644 --- a/xmloff/source/style/xmlstyle.cxx +++ b/xmloff/source/style/xmlstyle.cxx @@ -128,35 +128,6 @@ void SvXMLStyleContext::SetAttribute( sal_uInt16 nPrefixKey, SvXMLStyleContext::SvXMLStyleContext( - SvXMLImport& rImp, sal_uInt16 nPrfx, - const OUString& rLName, - const uno::Reference< xml::sax::XAttributeList >&, - XmlStyleFamily nFam, bool bDefault ) : - SvXMLImportContext( rImp, nPrfx, rLName ), - mbHidden( false ), - mnFamily( nFam ), - mbValid( true ), - mbNew( true ), - mbDefaultStyle( bDefault ) -{ -} - -SvXMLStyleContext::SvXMLStyleContext( - SvXMLImport& rImp, - sal_Int32 /*nElement*/, - const css::uno::Reference< css::xml::sax::XFastAttributeList > &, - XmlStyleFamily nFam, bool bDefault ) : - SvXMLImportContext( rImp ), - mbHidden( false ), - mnFamily( nFam ), - mbValid( true ), - mbNew( true ), - mbDefaultStyle( bDefault ) -{ -} - -// fast-parser constructor -SvXMLStyleContext::SvXMLStyleContext( SvXMLImport& rImp, XmlStyleFamily nFam, bool bDefault ) : SvXMLImportContext( rImp ), @@ -172,20 +143,6 @@ SvXMLStyleContext::~SvXMLStyleContext() { } -void SvXMLStyleContext::StartElement( const uno::Reference< xml::sax::XAttributeList > & xAttrList ) -{ - sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0; - for( sal_Int16 i=0; i < nAttrCount; i++ ) - { - const OUString& rAttrName = xAttrList->getNameByIndex( i ); - OUString aLocalName; - sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName( rAttrName, &aLocalName ); - const OUString& rValue = xAttrList->getValueByIndex( i ); - - SetAttribute( nPrefix, aLocalName, rValue ); - } -} - void SvXMLStyleContext::startFastElement( sal_Int32 /*nElement*/, const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ) @@ -425,30 +382,28 @@ SvXMLStyleContext *SvXMLStylesContext::CreateStyleChildContext( break; } case XML_ELEMENT(TEXT, XML_BIBLIOGRAPHY_CONFIGURATION): - pStyle = new XMLIndexBibliographyConfigurationContext( - GetImport(), nElement, xAttrList); + pStyle = new XMLIndexBibliographyConfigurationContext(GetImport()); break; case XML_ELEMENT(TEXT, XML_NOTES_CONFIGURATION): pStyle = new XMLFootnoteConfigurationImportContext( GetImport(), nElement, xAttrList); break; case XML_ELEMENT(TEXT, XML_LINENUMBERING_CONFIGURATION): - pStyle = new XMLLineNumberingImportContext( - GetImport(), nElement, xAttrList); + pStyle = new XMLLineNumberingImportContext(GetImport()); break; case XML_ELEMENT(STYLE, XML_PAGE_LAYOUT): case XML_ELEMENT(STYLE, XML_DEFAULT_PAGE_LAYOUT): { //there is not page family in ODF now, so I specify one for it bool bDefaultStyle = XML_ELEMENT(STYLE, XML_DEFAULT_PAGE_LAYOUT) == nElement; - pStyle = new PageStyleContext( GetImport(), nElement, xAttrList, *this, bDefaultStyle ); + pStyle = new PageStyleContext( GetImport(), *this, bDefaultStyle ); } break; case XML_ELEMENT(TEXT, XML_LIST_STYLE): - pStyle = new SvxXMLListStyleContext( GetImport(), nElement, xAttrList ); + pStyle = new SvxXMLListStyleContext( GetImport() ); break; case XML_ELEMENT(TEXT, XML_OUTLINE_STYLE): - pStyle = new SvxXMLListStyleContext( GetImport(), nElement, xAttrList, true ); + pStyle = new SvxXMLListStyleContext( GetImport(), true ); break; // FillStyles @@ -492,8 +447,8 @@ SvXMLStyleContext *SvXMLStylesContext::CreateStyleChildContext( } SvXMLStyleContext *SvXMLStylesContext::CreateStyleStyleChildContext( - XmlStyleFamily nFamily, sal_Int32 nElement, - const uno::Reference< xml::sax::XFastAttributeList > & xAttrList ) + XmlStyleFamily nFamily, sal_Int32 /*nElement*/, + const uno::Reference< xml::sax::XFastAttributeList > & /*xAttrList*/ ) { SvXMLStyleContext *pStyle = nullptr; @@ -502,24 +457,20 @@ SvXMLStyleContext *SvXMLStylesContext::CreateStyleStyleChildContext( case XmlStyleFamily::TEXT_PARAGRAPH: case XmlStyleFamily::TEXT_TEXT: case XmlStyleFamily::TEXT_SECTION: - pStyle = new XMLTextStyleContext( GetImport(), nElement, - xAttrList, *this, nFamily ); + pStyle = new XMLTextStyleContext( GetImport(), *this, nFamily ); break; case XmlStyleFamily::TEXT_RUBY: - pStyle = new XMLPropStyleContext( GetImport(), nElement, - xAttrList, *this, nFamily ); + pStyle = new XMLPropStyleContext( GetImport(), *this, nFamily ); break; case XmlStyleFamily::SCH_CHART_ID: - pStyle = new XMLChartStyleContext( GetImport(), nElement, - xAttrList, *this, nFamily ); + pStyle = new XMLChartStyleContext( GetImport(), *this, nFamily ); break; case XmlStyleFamily::SD_GRAPHICS_ID: case XmlStyleFamily::SD_PRESENTATION_ID: case XmlStyleFamily::SD_POOL_ID: - pStyle = new XMLShapeStyleContext( GetImport(), nElement, - xAttrList, *this, nFamily ); + pStyle = new XMLShapeStyleContext( GetImport(), *this, nFamily ); break; default: break; } diff --git a/xmloff/source/table/XMLTableImport.cxx b/xmloff/source/table/XMLTableImport.cxx index d5fdf6772545..64b6a93b30a3 100644 --- a/xmloff/source/table/XMLTableImport.cxx +++ b/xmloff/source/table/XMLTableImport.cxx @@ -157,7 +157,7 @@ public: class XMLTableTemplateContext : public SvXMLStyleContext { public: - XMLTableTemplateContext( SvXMLImport& rImport, sal_Int32 nElement, const Reference< XFastAttributeList >& xAttrList ); + XMLTableTemplateContext( SvXMLImport& rImport ); // Create child element. virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( @@ -236,9 +236,9 @@ SvXMLImportContext* XMLTableImport::CreateTableContext( sal_uInt16 nPrfx, const return new XMLTableImportContext( xThis, nPrfx, rLName, xColumnRowRange ); } -SvXMLStyleContext* XMLTableImport::CreateTableTemplateContext( sal_Int32 nElement, const Reference< XFastAttributeList >& xAttrList ) +SvXMLStyleContext* XMLTableImport::CreateTableTemplateContext( sal_Int32 /*nElement*/, const Reference< XFastAttributeList >& /*xAttrList*/ ) { - return new XMLTableTemplateContext( mrImport, nElement, xAttrList ); + return new XMLTableTemplateContext( mrImport ); } void XMLTableImport::addTableTemplate( const OUString& rsStyleName, XMLTableTemplate& xTableTemplate ) @@ -747,8 +747,8 @@ void XMLCellImportContext::EndElement() } -XMLTableTemplateContext::XMLTableTemplateContext( SvXMLImport& rImport, sal_Int32 nElement, const Reference< XFastAttributeList >& xAttrList ) -: SvXMLStyleContext( rImport, nElement, xAttrList, XmlStyleFamily::TABLE_TEMPLATE_ID, false ) +XMLTableTemplateContext::XMLTableTemplateContext( SvXMLImport& rImport ) +: SvXMLStyleContext( rImport, XmlStyleFamily::TABLE_TEMPLATE_ID, false ) { } diff --git a/xmloff/source/text/XMLFootnoteConfigurationImportContext.cxx b/xmloff/source/text/XMLFootnoteConfigurationImportContext.cxx index f3b6f4af110e..855ce4a1a97a 100644 --- a/xmloff/source/text/XMLFootnoteConfigurationImportContext.cxx +++ b/xmloff/source/text/XMLFootnoteConfigurationImportContext.cxx @@ -124,9 +124,9 @@ const OUStringLiteral gsPropertyBeginNotice(u"BeginNotice"); XMLFootnoteConfigurationImportContext::XMLFootnoteConfigurationImportContext( SvXMLImport& rImport, - sal_Int32 nElement, + sal_Int32 /*nElement*/, const Reference<XFastAttributeList> & xAttrList) -: SvXMLStyleContext(rImport, nElement, xAttrList, XmlStyleFamily::TEXT_FOOTNOTECONFIG) +: SvXMLStyleContext(rImport, XmlStyleFamily::TEXT_FOOTNOTECONFIG) , sNumFormat("1") , sNumSync("false") , nOffset(0) diff --git a/xmloff/source/text/XMLIndexBibliographyConfigurationContext.cxx b/xmloff/source/text/XMLIndexBibliographyConfigurationContext.cxx index cdbba6bd863c..41f102ba519c 100644 --- a/xmloff/source/text/XMLIndexBibliographyConfigurationContext.cxx +++ b/xmloff/source/text/XMLIndexBibliographyConfigurationContext.cxx @@ -57,10 +57,8 @@ const OUStringLiteral gsSortAlgorithm(u"SortAlgorithm"); const OUStringLiteral gsLocale(u"Locale"); XMLIndexBibliographyConfigurationContext::XMLIndexBibliographyConfigurationContext( - SvXMLImport& rImport, - sal_Int32 nElement, - const Reference<XFastAttributeList> & xAttrList) : - SvXMLStyleContext(rImport, nElement, xAttrList, XmlStyleFamily::TEXT_BIBLIOGRAPHYCONFIG), + SvXMLImport& rImport) : + SvXMLStyleContext(rImport, XmlStyleFamily::TEXT_BIBLIOGRAPHYCONFIG), sSuffix(), sPrefix(), sAlgorithm(), diff --git a/xmloff/source/text/XMLLineNumberingImportContext.cxx b/xmloff/source/text/XMLLineNumberingImportContext.cxx index 43ff3ddbe00f..7df8c1917c1e 100644 --- a/xmloff/source/text/XMLLineNumberingImportContext.cxx +++ b/xmloff/source/text/XMLLineNumberingImportContext.cxx @@ -57,10 +57,8 @@ const OUStringLiteral gsRestartAtEachPage(u"RestartAtEachPage"); const OUStringLiteral gsSeparatorInterval(u"SeparatorInterval"); XMLLineNumberingImportContext::XMLLineNumberingImportContext( - SvXMLImport& rImport, - sal_Int32 nElement, - const Reference<XFastAttributeList> & xAttrList) -: SvXMLStyleContext(rImport, nElement, xAttrList, XmlStyleFamily::TEXT_LINENUMBERINGCONFIG) + SvXMLImport& rImport) +: SvXMLStyleContext(rImport, XmlStyleFamily::TEXT_LINENUMBERINGCONFIG) , sNumFormat(GetXMLToken(XML_1)) , sNumLetterSync(GetXMLToken(XML_FALSE)) , nOffset(-1) diff --git a/xmloff/source/text/XMLTextMasterPageContext.cxx b/xmloff/source/text/XMLTextMasterPageContext.cxx index 6acd6a68e9dd..9a0350db0974 100644 --- a/xmloff/source/text/XMLTextMasterPageContext.cxx +++ b/xmloff/source/text/XMLTextMasterPageContext.cxx @@ -68,10 +68,10 @@ Reference < XStyle > XMLTextMasterPageContext::Create() const OUStringLiteral gsFollowStyle( u"FollowStyle" ); XMLTextMasterPageContext::XMLTextMasterPageContext( SvXMLImport& rImport, - sal_Int32 nElement, + sal_Int32 /*nElement*/, const Reference< XFastAttributeList > & xAttrList, bool bOverwrite ) -: SvXMLStyleContext( rImport, nElement, xAttrList, XmlStyleFamily::MASTER_PAGE ) +: SvXMLStyleContext( rImport, XmlStyleFamily::MASTER_PAGE ) , bInsertHeader( false ) , bInsertFooter( false ) , bInsertHeaderLeft( false ) diff --git a/xmloff/source/text/XMLTextShapeStyleContext.cxx b/xmloff/source/text/XMLTextShapeStyleContext.cxx index cf43c0452e31..a7c7049c025d 100644 --- a/xmloff/source/text/XMLTextShapeStyleContext.cxx +++ b/xmloff/source/text/XMLTextShapeStyleContext.cxx @@ -137,11 +137,8 @@ void XMLTextShapeStyleContext::SetAttribute( sal_uInt16 nPrefixKey, const OUStringLiteral gsIsAutoUpdate( u"IsAutoUpdate" ); XMLTextShapeStyleContext::XMLTextShapeStyleContext( SvXMLImport& rImport, - sal_Int32 nElement, - const Reference< XFastAttributeList > & xAttrList, SvXMLStylesContext& rStyles, XmlStyleFamily nFamily ) : - XMLShapeStyleContext( rImport, nElement, xAttrList, rStyles, - nFamily ), + XMLShapeStyleContext( rImport, rStyles, nFamily ), bAutoUpdate( false ) { } diff --git a/xmloff/source/text/txtstyli.cxx b/xmloff/source/text/txtstyli.cxx index 7d15c874eeea..350c0e584830 100644 --- a/xmloff/source/text/txtstyli.cxx +++ b/xmloff/source/text/txtstyli.cxx @@ -126,11 +126,9 @@ void XMLTextStyleContext::SetAttribute( sal_uInt16 nPrefixKey, } XMLTextStyleContext::XMLTextStyleContext( SvXMLImport& rImport, - sal_Int32 nElement, - const Reference< XFastAttributeList > & xAttrList, SvXMLStylesContext& rStyles, XmlStyleFamily nFamily, bool bDefaultStyle ) -: XMLPropStyleContext( rImport, nElement, xAttrList, rStyles, nFamily, bDefaultStyle ) +: XMLPropStyleContext( rImport, rStyles, nFamily, bDefaultStyle ) , m_nOutlineLevel( -1 ) , m_isAutoUpdate( false ) , m_bHasMasterPageName( false ) |