[Libreoffice-commits] core.git: dbaccess/source include/xmloff reportdesign/source sc/source sw/source xmloff/source

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Tue Aug 25 16:22:45 UTC 2020


 dbaccess/source/filter/xml/xmlStyleImport.hxx     |    1 
 include/xmloff/XMLGraphicsDefaultStyle.hxx        |    4 ++
 include/xmloff/XMLTextMasterStylesContext.hxx     |    1 
 include/xmloff/xmlstyle.hxx                       |    8 +++++
 reportdesign/source/filter/xml/xmlStyleImport.cxx |   32 +++++++-------------
 reportdesign/source/filter/xml/xmlStyleImport.hxx |   17 +++++------
 sc/source/filter/xml/xmlstyli.hxx                 |    3 +
 sw/source/filter/xml/xmlfmt.cxx                   |    2 +
 xmloff/source/draw/XMLGraphicsDefaultStyle.cxx    |    5 +++
 xmloff/source/draw/ximpstyl.hxx                   |    2 +
 xmloff/source/style/xmlstyle.cxx                  |   34 ++++++++++++++++++++++
 11 files changed, 79 insertions(+), 30 deletions(-)

New commits:
commit 5bf60ba188bb96b4fbda0ff0aa30aa1815ca647f
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Tue Aug 25 12:42:01 2020 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Tue Aug 25 18:22:02 2020 +0200

    use more fastparser in OReportStylesContext
    
    Change-Id: Ie8126206d9144ccba1fb120d47af9ebe35a345d5
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101320
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/dbaccess/source/filter/xml/xmlStyleImport.hxx b/dbaccess/source/filter/xml/xmlStyleImport.hxx
index 8eeb7ac7dd54..326479df74d2 100644
--- a/dbaccess/source/filter/xml/xmlStyleImport.hxx
+++ b/dbaccess/source/filter/xml/xmlStyleImport.hxx
@@ -77,6 +77,7 @@ namespace dbaxml
     protected:
 
         // Create a style context.
+        using SvXMLStylesContext::CreateStyleStyleChildContext;
         virtual SvXMLStyleContext *CreateStyleStyleChildContext(
                 XmlStyleFamily nFamily,
                 sal_uInt16 nPrefix,
diff --git a/include/xmloff/XMLGraphicsDefaultStyle.hxx b/include/xmloff/XMLGraphicsDefaultStyle.hxx
index 791d429238c1..0d3c088c76f0 100644
--- a/include/xmloff/XMLGraphicsDefaultStyle.hxx
+++ b/include/xmloff/XMLGraphicsDefaultStyle.hxx
@@ -33,6 +33,10 @@ public:
         const css::uno::Reference< css::xml::sax::XAttributeList >& xAttrList,
         SvXMLStylesContext& rStyles);
 
+    XMLGraphicsDefaultStyle( SvXMLImport& rImport, sal_Int32 nElement,
+        const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList,
+        SvXMLStylesContext& rStyles);
+
     virtual ~XMLGraphicsDefaultStyle() override;
 
     virtual SvXMLImportContextRef CreateChildContext(
diff --git a/include/xmloff/XMLTextMasterStylesContext.hxx b/include/xmloff/XMLTextMasterStylesContext.hxx
index 423092f0cf17..59d769e9f643 100644
--- a/include/xmloff/XMLTextMasterStylesContext.hxx
+++ b/include/xmloff/XMLTextMasterStylesContext.hxx
@@ -31,6 +31,7 @@ protected:
     virtual SvXMLStyleContext *CreateStyleChildContext( sal_Int32 nElement,
         const css::uno::Reference< css::xml::sax::XFastAttributeList > & xAttrList ) override;
 
+    using SvXMLStylesContext::CreateStyleStyleChildContext;
     virtual SvXMLStyleContext *CreateStyleStyleChildContext( XmlStyleFamily nFamily,
         sal_uInt16 nPrefix,
         const OUString& rLocalName,
diff --git a/include/xmloff/xmlstyle.hxx b/include/xmloff/xmlstyle.hxx
index e02f2d81a674..475fe6c8ec79 100644
--- a/include/xmloff/xmlstyle.hxx
+++ b/include/xmloff/xmlstyle.hxx
@@ -199,11 +199,19 @@ protected:
         sal_uInt16 nPrefix, const OUString& rLocalName,
         const css::uno::Reference< css::xml::sax::XAttributeList > & xAttrList );
 
+    virtual SvXMLStyleContext *CreateStyleStyleChildContext( XmlStyleFamily nFamily,
+        sal_Int32 nElement,
+        const css::uno::Reference< css::xml::sax::XFastAttributeList > & xAttrList );
+
     virtual SvXMLStyleContext *CreateDefaultStyleStyleChildContext(
         XmlStyleFamily nFamily, sal_uInt16 nPrefix,
         const OUString& rLocalName,
         const css::uno::Reference< css::xml::sax::XAttributeList > & xAttrList );
 
+    virtual SvXMLStyleContext *CreateDefaultStyleStyleChildContext(
+        XmlStyleFamily nFamily, sal_Int32 nElement,
+        const css::uno::Reference< css::xml::sax::XFastAttributeList > & xAttrList );
+
     virtual bool InsertStyleFamily( XmlStyleFamily nFamily ) const;
 
 public:
diff --git a/reportdesign/source/filter/xml/xmlStyleImport.cxx b/reportdesign/source/filter/xml/xmlStyleImport.cxx
index 57aa5fcd706f..6242d6ea9489 100644
--- a/reportdesign/source/filter/xml/xmlStyleImport.cxx
+++ b/reportdesign/source/filter/xml/xmlStyleImport.cxx
@@ -67,10 +67,10 @@ public:
 }
 
 OControlStyleContext::OControlStyleContext( ORptFilter& rImport,
-        sal_uInt16 nPrfx, const OUString& rLName,
-        const Reference< XAttributeList > & xAttrList,
+        sal_Int32 nElement,
+        const Reference< XFastAttributeList > & xAttrList,
         SvXMLStylesContext& rStyles, XmlStyleFamily nFamily ) :
-    XMLPropStyleContext( rImport, nPrfx, rLName, xAttrList, rStyles, nFamily, false/*bDefaultStyle*/ ),
+    XMLPropStyleContext( rImport, nElement, xAttrList, rStyles, nFamily, false/*bDefaultStyle*/ ),
     pStyles(&rStyles),
     m_nNumberFormat(-1),
     m_rImport(rImport)
@@ -233,34 +233,24 @@ rtl::Reference < SvXMLImportPropertyMapper >
 }
 
 SvXMLStyleContext *OReportStylesContext::CreateDefaultStyleStyleChildContext(
-        XmlStyleFamily nFamily, sal_uInt16 nPrefix, const OUString& rLocalName,
-        const uno::Reference< xml::sax::XAttributeList > & xAttrList )
+        XmlStyleFamily nFamily, sal_Int32 nElement,
+        const uno::Reference< xml::sax::XFastAttributeList > & xAttrList )
 {
-    SvXMLStyleContext *pStyle = nullptr;
-
     switch( nFamily )
     {
         case XmlStyleFamily::SD_GRAPHICS_ID:
             // There are no writer specific defaults for graphic styles!
-            pStyle = new XMLGraphicsDefaultStyle( GetImport(), nPrefix,
-                                rLocalName, xAttrList, *this );
-            break;
+            return new XMLGraphicsDefaultStyle( GetImport(), nElement, xAttrList, *this );
         default:
-            pStyle = SvXMLStylesContext::CreateDefaultStyleStyleChildContext( nFamily,
-                                                                       nPrefix,
-                                                                rLocalName,
-                                                                xAttrList );
-            break;
+            return nullptr;
     }
-    return pStyle;
 }
 
 SvXMLStyleContext *OReportStylesContext::CreateStyleStyleChildContext(
-        XmlStyleFamily nFamily, sal_uInt16 nPrefix, const OUString& rLocalName,
-        const Reference< xml::sax::XAttributeList > & xAttrList )
+        XmlStyleFamily nFamily, sal_Int32 nElement,
+        const Reference< xml::sax::XFastAttributeList > & xAttrList )
 {
-    SvXMLStyleContext *pStyle = SvXMLStylesContext::CreateStyleStyleChildContext( nFamily, nPrefix,
-                                                            rLocalName,
+    SvXMLStyleContext *pStyle = SvXMLStylesContext::CreateStyleStyleChildContext( nFamily, nElement,
                                                             xAttrList );
     if (!pStyle)
     {
@@ -270,7 +260,7 @@ SvXMLStyleContext *OReportStylesContext::CreateStyleStyleChildContext(
         case XmlStyleFamily::TABLE_COLUMN:
         case XmlStyleFamily::TABLE_ROW:
         case XmlStyleFamily::TABLE_CELL:
-            pStyle = new OControlStyleContext( GetOwnImport(), nPrefix, rLocalName,
+            pStyle = new OControlStyleContext( GetOwnImport(), nElement,
                                                xAttrList, *this, nFamily );
             break;
         default:
diff --git a/reportdesign/source/filter/xml/xmlStyleImport.hxx b/reportdesign/source/filter/xml/xmlStyleImport.hxx
index 4353bd33d951..d670ccf5d843 100644
--- a/reportdesign/source/filter/xml/xmlStyleImport.hxx
+++ b/reportdesign/source/filter/xml/xmlStyleImport.hxx
@@ -46,9 +46,8 @@ namespace rptxml
 
     public:
 
-        OControlStyleContext( ORptFilter& rImport, sal_uInt16 nPrfx,
-                const OUString& rLName,
-                const css::uno::Reference< css::xml::sax::XAttributeList > & xAttrList,
+        OControlStyleContext( ORptFilter& rImport, sal_Int32 nElement,
+                const css::uno::Reference< css::xml::sax::XFastAttributeList > & xAttrList,
                 SvXMLStylesContext& rStyles, XmlStyleFamily nFamily );
 
         virtual ~OControlStyleContext() override;
@@ -86,16 +85,16 @@ namespace rptxml
     protected:
 
         // Create a style context.
+        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:
 
diff --git a/sc/source/filter/xml/xmlstyli.hxx b/sc/source/filter/xml/xmlstyli.hxx
index e9658cc7c614..c8a00a34ab99 100644
--- a/sc/source/filter/xml/xmlstyli.hxx
+++ b/sc/source/filter/xml/xmlstyli.hxx
@@ -139,12 +139,14 @@ class XMLTableStylesContext : public SvXMLStylesContext
 protected:
 
     // Create a style context.
+    using SvXMLStylesContext::CreateStyleStyleChildContext;
     virtual SvXMLStyleContext *CreateStyleStyleChildContext(
             XmlStyleFamily nFamily,
             sal_uInt16 nPrefix,
             const OUString& rLocalName,
             const css::uno::Reference< css::xml::sax::XAttributeList > & xAttrList ) override;
 
+    using SvXMLStylesContext::CreateDefaultStyleStyleChildContext;
     virtual SvXMLStyleContext *CreateDefaultStyleStyleChildContext(
         XmlStyleFamily nFamily, sal_uInt16 nPrefix,
         const OUString& rLocalName,
@@ -173,6 +175,7 @@ protected:
     virtual SvXMLStyleContext *CreateStyleChildContext( sal_Int32 nElement,
         const css::uno::Reference< css::xml::sax::XFastAttributeList > & xAttrList ) override;
 
+    using SvXMLStylesContext::CreateStyleStyleChildContext;
     virtual SvXMLStyleContext *CreateStyleStyleChildContext( XmlStyleFamily nFamily,
         sal_uInt16 nPrefix, const OUString& rLocalName,
         const css::uno::Reference< css::xml::sax::XAttributeList > & xAttrList ) override;
diff --git a/sw/source/filter/xml/xmlfmt.cxx b/sw/source/filter/xml/xmlfmt.cxx
index f07ec1c89cf7..d9457eddd69b 100644
--- a/sw/source/filter/xml/xmlfmt.cxx
+++ b/sw/source/filter/xml/xmlfmt.cxx
@@ -754,9 +754,11 @@ protected:
     virtual SvXMLStyleContext *CreateStyleChildContext( sal_Int32 nElement,
         const css::uno::Reference< css::xml::sax::XFastAttributeList > & xAttrList ) override;
 
+    using SvXMLStylesContext::CreateStyleStyleChildContext;
     virtual SvXMLStyleContext *CreateStyleStyleChildContext( XmlStyleFamily nFamily,
         sal_uInt16 nPrefix, const OUString& rLocalName,
         const uno::Reference< xml::sax::XAttributeList > & xAttrList ) override;
+    using SvXMLStylesContext::CreateDefaultStyleStyleChildContext;
     virtual SvXMLStyleContext *CreateDefaultStyleStyleChildContext(
         XmlStyleFamily nFamily, sal_uInt16 nPrefix, const OUString& rLocalName,
         const uno::Reference< xml::sax::XAttributeList > & xAttrList ) override;
diff --git a/xmloff/source/draw/XMLGraphicsDefaultStyle.cxx b/xmloff/source/draw/XMLGraphicsDefaultStyle.cxx
index 2fadc9811a88..5a18b149a354 100644
--- a/xmloff/source/draw/XMLGraphicsDefaultStyle.cxx
+++ b/xmloff/source/draw/XMLGraphicsDefaultStyle.cxx
@@ -54,6 +54,11 @@ XMLGraphicsDefaultStyle::XMLGraphicsDefaultStyle( SvXMLImport& rImport, sal_uInt
 {
 }
 
+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()
 {
 }
diff --git a/xmloff/source/draw/ximpstyl.hxx b/xmloff/source/draw/ximpstyl.hxx
index cd8c9f225910..e335045b5873 100644
--- a/xmloff/source/draw/ximpstyl.hxx
+++ b/xmloff/source/draw/ximpstyl.hxx
@@ -187,12 +187,14 @@ protected:
         sal_Int32 nElement,
         const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList) override;
 
+    using SvXMLStylesContext::CreateStyleStyleChildContext;
     virtual SvXMLStyleContext *CreateStyleStyleChildContext(
         XmlStyleFamily nFamily,
         sal_uInt16 nPrefix,
         const OUString& rLocalName,
         const css::uno::Reference< css::xml::sax::XAttributeList >& xAttrList) override;
 
+    using SvXMLStylesContext::CreateDefaultStyleStyleChildContext;
     virtual SvXMLStyleContext *CreateDefaultStyleStyleChildContext(
         XmlStyleFamily nFamily, sal_uInt16 nPrefix,
         const OUString& rLocalName,
diff --git a/xmloff/source/style/xmlstyle.cxx b/xmloff/source/style/xmlstyle.cxx
index e5dbf53b7361..f5a84198d7fb 100644
--- a/xmloff/source/style/xmlstyle.cxx
+++ b/xmloff/source/style/xmlstyle.cxx
@@ -416,6 +416,23 @@ SvXMLStyleContext *SvXMLStylesContext::CreateStyleChildContext(
 
     switch (nElement)
     {
+        case XML_ELEMENT(STYLE, XML_STYLE):
+        case XML_ELEMENT(STYLE, XML_DEFAULT_STYLE):
+        {
+            XmlStyleFamily nFamily = XmlStyleFamily::DATA_STYLE;
+            for( auto &aIter : sax_fastparser::castToFastAttributeList( xAttrList ) )
+            {
+                if( aIter.getToken() == XML_ELEMENT(STYLE, XML_FAMILY) )
+                {
+                    nFamily = GetFamily( aIter.toString() );
+                    break;
+                }
+            }
+            pStyle = XML_ELEMENT(STYLE, XML_STYLE)==nElement
+                ? CreateStyleStyleChildContext( nFamily, nElement, xAttrList )
+                : CreateDefaultStyleStyleChildContext( nFamily, nElement, xAttrList );
+            break;
+        }
         case XML_ELEMENT(TEXT, XML_BIBLIOGRAPHY_CONFIGURATION):
             pStyle = new XMLIndexBibliographyConfigurationContext(
                 GetImport(), nElement, xAttrList);
@@ -477,6 +494,9 @@ SvXMLStyleContext *SvXMLStylesContext::CreateStyleChildContext(
         }
     }
 
+    if (!pStyle)
+        SAL_WARN("xmloff", "Unknown element " << SvXMLImport::getPrefixAndNameFromToken(nElement));
+
     return pStyle;
 }
 
@@ -561,6 +581,13 @@ SvXMLStyleContext *SvXMLStylesContext::CreateStyleStyleChildContext(
     return pStyle;
 }
 
+SvXMLStyleContext *SvXMLStylesContext::CreateStyleStyleChildContext(
+        XmlStyleFamily /*nFamily*/, sal_Int32 /*nElement*/,
+        const uno::Reference< xml::sax::XFastAttributeList > & /*xAttrList*/ )
+{
+    return nullptr;
+}
+
 SvXMLStyleContext *SvXMLStylesContext::CreateDefaultStyleStyleChildContext(
         XmlStyleFamily /*nFamily*/, sal_uInt16 /*nPrefix*/, const OUString& /*rLocalName*/,
         const uno::Reference< xml::sax::XAttributeList > & )
@@ -568,6 +595,13 @@ SvXMLStyleContext *SvXMLStylesContext::CreateDefaultStyleStyleChildContext(
     return nullptr;
 }
 
+SvXMLStyleContext *SvXMLStylesContext::CreateDefaultStyleStyleChildContext(
+        XmlStyleFamily /*nFamily*/, sal_Int32 /*nElement*/,
+        const uno::Reference< xml::sax::XFastAttributeList > & )
+{
+    return nullptr;
+}
+
 bool SvXMLStylesContext::InsertStyleFamily( XmlStyleFamily ) const
 {
     return true;


More information about the Libreoffice-commits mailing list