include/xmloff/XMLDrawingPageStyleContext.hxx | 5 ++ include/xmloff/XMLShapeStyleContext.hxx | 6 ++ xmloff/source/draw/XMLShapeStyleContext.cxx | 11 ++++ xmloff/source/draw/ximpstyl.cxx | 58 +++++++++++++------------- xmloff/source/draw/ximpstyl.hxx | 12 ++--- 5 files changed, 57 insertions(+), 35 deletions(-)
New commits: commit 2501bb3a9a142f62903cd0f20bafd96e2cea45fe Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Tue Aug 25 15:31:46 2020 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Wed Aug 26 07:52:52 2020 +0200 use fastparser in SdXMLStylesContext Change-Id: I5cf46f6ba8366c92a18d1cc00eb7eebf8ae82be6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101343 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/include/xmloff/XMLDrawingPageStyleContext.hxx b/include/xmloff/XMLDrawingPageStyleContext.hxx index ffc0a62998a5..22fa6f88f041 100644 --- a/include/xmloff/XMLDrawingPageStyleContext.hxx +++ b/include/xmloff/XMLDrawingPageStyleContext.hxx @@ -32,6 +32,11 @@ public: SvXMLStylesContext& rStyles, ContextID_Index_Pair const pContextIDs[], XmlStyleFamily const pFamilies[]); + 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[]); virtual void FillPropertySet(css::uno::Reference<css::beans::XPropertySet> const& rPropSet) override; diff --git a/include/xmloff/XMLShapeStyleContext.hxx b/include/xmloff/XMLShapeStyleContext.hxx index 96ae15ce8cde..4a7eef147b36 100644 --- a/include/xmloff/XMLShapeStyleContext.hxx +++ b/include/xmloff/XMLShapeStyleContext.hxx @@ -49,6 +49,12 @@ public: const css::uno::Reference< css::xml::sax::XAttributeList >& xAttrList, SvXMLStylesContext& rStyles, XmlStyleFamily nFamily); + XMLShapeStyleContext( + SvXMLImport& rImport, + sal_Int32 nElement, + const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList, + SvXMLStylesContext& rStyles, + XmlStyleFamily nFamily); virtual ~XMLShapeStyleContext() override; SvXMLImportContextRef CreateChildContext( diff --git a/xmloff/source/draw/XMLShapeStyleContext.cxx b/xmloff/source/draw/XMLShapeStyleContext.cxx index bcde133252bb..beddcb202321 100644 --- a/xmloff/source/draw/XMLShapeStyleContext.cxx +++ b/xmloff/source/draw/XMLShapeStyleContext.cxx @@ -60,6 +60,17 @@ XMLShapeStyleContext::XMLShapeStyleContext( { } +XMLShapeStyleContext::XMLShapeStyleContext( + SvXMLImport& rImport, + sal_Int32 nElement, + const uno::Reference< xml::sax::XFastAttributeList >& xAttrList, + SvXMLStylesContext& rStyles, + XmlStyleFamily nFamily) +: XMLPropStyleContext(rImport, nElement, xAttrList, rStyles, nFamily ), + m_bIsNumRuleAlreadyConverted( false ) +{ +} + XMLShapeStyleContext::~XMLShapeStyleContext() { } diff --git a/xmloff/source/draw/ximpstyl.cxx b/xmloff/source/draw/ximpstyl.cxx index 6e9bdeb94e29..82eac74740cd 100644 --- a/xmloff/source/draw/ximpstyl.cxx +++ b/xmloff/source/draw/ximpstyl.cxx @@ -137,9 +137,8 @@ public: SdXMLDrawingPageStyleContext( SvXMLImport& rImport, - sal_uInt16 nPrfx, - const OUString& rLName, - const css::uno::Reference< css::xml::sax::XAttributeList >& xAttrList, + sal_Int32 nElement, + const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList, SvXMLStylesContext& rStyles); SvXMLImportContextRef CreateChildContext( @@ -192,13 +191,28 @@ XMLDrawingPageStyleContext::XMLDrawingPageStyleContext( std::memcpy(m_pContextIDs.get(), pContextIDs, size * sizeof(ContextID_Index_Pair)); } +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) + , m_pFamilies(pFamilies) +{ + size_t size(1); // for the -1 entry + for (ContextID_Index_Pair const* pTemp(pContextIDs); pTemp->nContextID != -1; ++size, ++pTemp); + m_pContextIDs.reset(new ContextID_Index_Pair[size]); + std::memcpy(m_pContextIDs.get(), pContextIDs, size * sizeof(ContextID_Index_Pair)); +} + SdXMLDrawingPageStyleContext::SdXMLDrawingPageStyleContext( SvXMLImport& rImport, - sal_uInt16 nPrfx, - const OUString& rLName, - const uno::Reference< xml::sax::XAttributeList >& xAttrList, + sal_Int32 nElement, + const uno::Reference< xml::sax::XFastAttributeList >& xAttrList, SvXMLStylesContext& rStyles) - : XMLDrawingPageStyleContext(rImport, nPrfx, rLName, xAttrList, rStyles, + : XMLDrawingPageStyleContext(rImport, nElement, xAttrList, rStyles, g_ContextIDs, g_Families) { } @@ -939,53 +953,41 @@ SvXMLStyleContext* SdXMLStylesContext::CreateStyleChildContext( SvXMLStyleContext* SdXMLStylesContext::CreateStyleStyleChildContext( XmlStyleFamily nFamily, - sal_uInt16 nPrefix, - const OUString& rLocalName, - const uno::Reference< css::xml::sax::XAttributeList >& xAttrList) + sal_Int32 nElement, + const uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList) { - SvXMLStyleContext* pContext = nullptr; - switch( nFamily ) { case XmlStyleFamily::SD_DRAWINGPAGE_ID: - pContext = new SdXMLDrawingPageStyleContext(GetSdImport(), nPrefix, rLocalName, xAttrList, *this ); + return new SdXMLDrawingPageStyleContext(GetSdImport(), nElement, xAttrList, *this ); break; case XmlStyleFamily::TABLE_CELL: case XmlStyleFamily::TABLE_COLUMN: case XmlStyleFamily::TABLE_ROW: - pContext = new XMLShapeStyleContext( GetSdImport(), nPrefix, rLocalName, xAttrList, *this, nFamily ); + return new XMLShapeStyleContext( GetSdImport(), nElement, xAttrList, *this, nFamily ); break; default: break; } // call base class - if(!pContext) - pContext = SvXMLStylesContext::CreateStyleStyleChildContext(nFamily, nPrefix, rLocalName, xAttrList); - - return pContext; + return SvXMLStylesContext::CreateStyleStyleChildContext(nFamily, nElement, xAttrList); } SvXMLStyleContext* SdXMLStylesContext::CreateDefaultStyleStyleChildContext( XmlStyleFamily nFamily, - sal_uInt16 nPrefix, - const OUString& rLocalName, - const Reference< XAttributeList > & xAttrList ) + sal_Int32 nElement, + const Reference< XFastAttributeList > & xAttrList ) { - SvXMLStyleContext* pContext = nullptr; - switch( nFamily ) { case XmlStyleFamily::SD_GRAPHICS_ID: - pContext = new XMLGraphicsDefaultStyle(GetSdImport(), nPrefix, rLocalName, xAttrList, *this ); + return new XMLGraphicsDefaultStyle(GetSdImport(), nElement, xAttrList, *this ); break; default: break; } // call base class - if(!pContext) - pContext = SvXMLStylesContext::CreateDefaultStyleStyleChildContext(nFamily, nPrefix, rLocalName, xAttrList); - - return pContext; + return SvXMLStylesContext::CreateDefaultStyleStyleChildContext(nFamily, nElement, xAttrList); } rtl::Reference< SvXMLImportPropertyMapper > SdXMLStylesContext::GetImportPropertyMapper( diff --git a/xmloff/source/draw/ximpstyl.hxx b/xmloff/source/draw/ximpstyl.hxx index e335045b5873..13a11dda6c5b 100644 --- a/xmloff/source/draw/ximpstyl.hxx +++ b/xmloff/source/draw/ximpstyl.hxx @@ -190,16 +190,14 @@ protected: using SvXMLStylesContext::CreateStyleStyleChildContext; virtual SvXMLStyleContext *CreateStyleStyleChildContext( XmlStyleFamily nFamily, - sal_uInt16 nPrefix, - const OUString& rLocalName, - const css::uno::Reference< css::xml::sax::XAttributeList >& xAttrList) override; + sal_Int32 nElement, + const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList) override; using SvXMLStylesContext::CreateDefaultStyleStyleChildContext; virtual SvXMLStyleContext *CreateDefaultStyleStyleChildContext( - XmlStyleFamily nFamily, sal_uInt16 nPrefix, - const OUString& rLocalName, - const css::uno::Reference< - css::xml::sax::XAttributeList > & xAttrList ) override; + XmlStyleFamily nFamily, + sal_Int32 nElement, + const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList) override; public: SdXMLStylesContext( _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits