[Libreoffice-commits] core.git: xmloff/source

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Tue Jan 21 07:22:24 UTC 2020


 xmloff/source/draw/sdxmlimp.cxx      |   23 +++++++++++------------
 xmloff/source/draw/sdxmlimp_impl.hxx |    3 +--
 xmloff/source/draw/ximpstyl.cxx      |   12 +++++++++---
 xmloff/source/draw/ximpstyl.hxx      |   10 +++++++---
 4 files changed, 28 insertions(+), 20 deletions(-)

New commits:
commit faa0d7b3405eaab610ada004b9053dcd8bc25e4a
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Mon Jan 20 16:47:01 2020 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Tue Jan 21 08:21:48 2020 +0100

    use FastParser in SdXMLMasterStylesContext
    
    Change-Id: I9fb57f4bf97e3aa67bcdd55f5e98ebcddaaf9e4b
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87082
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/xmloff/source/draw/sdxmlimp.cxx b/xmloff/source/draw/sdxmlimp.cxx
index 98a4ebccbbd3..dfb4bf267ea8 100644
--- a/xmloff/source/draw/sdxmlimp.cxx
+++ b/xmloff/source/draw/sdxmlimp.cxx
@@ -159,15 +159,6 @@ SvXMLImportContextRef SdXMLDocContext_Impl::CreateChildContext(
             }
             break;
         }
-        case XML_TOK_DOC_MASTERSTYLES:
-        {
-            if( GetImport().getImportFlags() & SvXMLImportFlags::MASTERSTYLES )
-            {
-                // office:master-styles inside office:document
-                xContext = GetSdImport().CreateMasterStylesContext(rLocalName, xAttrList);
-            }
-            break;
-        }
         case XML_TOK_DOC_META:
         {
             SAL_INFO("xmloff.draw", "XML_TOK_DOC_META: should not have come here, maybe document is invalid?");
@@ -202,6 +193,15 @@ uno::Reference< xml::sax::XFastContextHandler > SAL_CALL SdXMLDocContext_Impl::c
             }
             break;
         }
+        case XML_ELEMENT(OFFICE, XML_MASTER_STYLES):
+        {
+            if( GetImport().getImportFlags() & SvXMLImportFlags::MASTERSTYLES )
+            {
+                // office:master-styles inside office:document
+                return GetSdImport().CreateMasterStylesContext();
+            }
+            break;
+        }
     }
     return nullptr;
 }
@@ -731,11 +731,10 @@ SvXMLStylesContext *SdXMLImport::CreateAutoStylesContext(const OUString& rLocalN
     return GetShapeImport()->GetAutoStylesContext();
 }
 
-SvXMLImportContext* SdXMLImport::CreateMasterStylesContext(const OUString& rLocalName,
-    const uno::Reference<xml::sax::XAttributeList>&)
+SvXMLImportContext* SdXMLImport::CreateMasterStylesContext()
 {
     if (!mxMasterStylesContext.is())
-        mxMasterStylesContext.set(new SdXMLMasterStylesContext(*this, rLocalName));
+        mxMasterStylesContext.set(new SdXMLMasterStylesContext(*this));
     return mxMasterStylesContext.get();
 }
 
diff --git a/xmloff/source/draw/sdxmlimp_impl.hxx b/xmloff/source/draw/sdxmlimp_impl.hxx
index 7205d4867ec8..32f9690634f3 100644
--- a/xmloff/source/draw/sdxmlimp_impl.hxx
+++ b/xmloff/source/draw/sdxmlimp_impl.hxx
@@ -206,8 +206,7 @@ public:
         const css::uno::Reference< css::xml::sax::XAttributeList >& xAttrList);
     SvXMLStylesContext* CreateAutoStylesContext(const OUString& rLocalName,
         const css::uno::Reference< css::xml::sax::XAttributeList >& xAttrList);
-    SvXMLImportContext* CreateMasterStylesContext(const OUString& rLocalName,
-        const css::uno::Reference< css::xml::sax::XAttributeList >& xAttrList);
+    SvXMLImportContext* CreateMasterStylesContext();
     SvXMLImportContext *CreateFontDeclsContext(const OUString& rLocalName,
         const css::uno::Reference< css::xml::sax::XAttributeList > & xAttrList );
 
diff --git a/xmloff/source/draw/ximpstyl.cxx b/xmloff/source/draw/ximpstyl.cxx
index 1d05a80fbfad..4d0084bb9412 100644
--- a/xmloff/source/draw/ximpstyl.cxx
+++ b/xmloff/source/draw/ximpstyl.cxx
@@ -1380,10 +1380,16 @@ uno::Reference< container::XNameAccess > SdXMLStylesContext::getPageLayouts() co
 
 
 SdXMLMasterStylesContext::SdXMLMasterStylesContext(
-    SdXMLImport& rImport,
-    const OUString& rLName)
-:   SvXMLImportContext( rImport, XML_NAMESPACE_OFFICE, rLName)
+    SdXMLImport& rImport)
+:   SvXMLImportContext( rImport )
+{
+}
+
+css::uno::Reference< css::xml::sax::XFastContextHandler > SdXMLMasterStylesContext::createFastChildContext(
+    sal_Int32 /*nElement*/,
+    const css::uno::Reference< css::xml::sax::XFastAttributeList >& /*xAttrList*/ )
 {
+    return nullptr;
 }
 
 SvXMLImportContextRef SdXMLMasterStylesContext::CreateChildContext(
diff --git a/xmloff/source/draw/ximpstyl.hxx b/xmloff/source/draw/ximpstyl.hxx
index bc0a2b09aa23..b9038609715f 100644
--- a/xmloff/source/draw/ximpstyl.hxx
+++ b/xmloff/source/draw/ximpstyl.hxx
@@ -228,9 +228,13 @@ class SdXMLMasterStylesContext : public SvXMLImportContext
 
 public:
 
-    SdXMLMasterStylesContext(
-        SdXMLImport& rImport,
-        const OUString& rLName);
+    SdXMLMasterStylesContext(SdXMLImport& 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 >& AttrList ) override;
 
     virtual SvXMLImportContextRef CreateChildContext(
         sal_uInt16 nPrefix,


More information about the Libreoffice-commits mailing list