[Libreoffice-commits] core.git: Branch 'distro/collabora/co-2021' - 2 commits - oox/inc oox/source

Sarper Akdemir (via logerrit) logerrit at kemper.freedesktop.org
Wed Jun 23 09:50:03 UTC 2021


 oox/inc/drawingml/textbody.hxx                |   10 ++++++++++
 oox/inc/drawingml/textliststyle.hxx           |   10 ++++++++++
 oox/source/drawingml/textbody.cxx             |    1 +
 oox/source/drawingml/textbodycontext.cxx      |    4 ++++
 oox/source/drawingml/textliststyle.cxx        |    1 +
 oox/source/drawingml/textliststylecontext.cxx |    1 +
 6 files changed, 27 insertions(+)

New commits:
commit 685917c74983061b36b0c5bbe40c89692efa863c
Author:     Sarper Akdemir <sarper.akdemir at collabora.com>
AuthorDate: Sun May 9 20:56:41 2021 +0300
Commit:     Mike Kaganski <mike.kaganski at collabora.com>
CommitDate: Wed Jun 23 11:49:42 2021 +0200

    tdf#59323: ooxml import: hasListStyleOnImport
    
    Introduces hasListStyleOnImport to determine whether or not the textbody had a
    non-empty lstStyle tag in it on import.
    
    Change-Id: Iccb8cfb20e4402e7cadb8e2f2b9a1f6fa178ade4
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117007
    Tested-by: Jenkins
    Reviewed-by: Miklos Vajna <vmiklos at collabora.com>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117624
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Mike Kaganski <mike.kaganski at collabora.com>

diff --git a/oox/inc/drawingml/textbody.hxx b/oox/inc/drawingml/textbody.hxx
index d82dc7e4b3fd..8b600a862211 100644
--- a/oox/inc/drawingml/textbody.hxx
+++ b/oox/inc/drawingml/textbody.hxx
@@ -81,6 +81,9 @@ public:
     /// Flags textbody as having a non-empty bodyPr tag
     void setHasNoninheritedBodyProperties() { mbHasNoninheritedBodyProperties = true; }
 
+    /// Returns whether the textbody had a non-empty lstStyle tag in it
+    bool hasListStyleOnImport() const { return maTextListStyle.hasListStyleOnImport(); }
+
     void                ApplyStyleEmpty(
                             const ::oox::core::XmlFilterBase& rFilterBase,
                             const css::uno::Reference < css::text::XText > & xText,
diff --git a/oox/inc/drawingml/textliststyle.hxx b/oox/inc/drawingml/textliststyle.hxx
index 52cb29330877..c13c7a103266 100644
--- a/oox/inc/drawingml/textliststyle.hxx
+++ b/oox/inc/drawingml/textliststyle.hxx
@@ -47,6 +47,14 @@ public:
     };
     TextParagraphPropertiesVector& getAggregationListStyle() { return maAggregationListStyle; };
 
+    /// Flags ListStyle as having a non-empty lstStyle tag on import
+    void setHasListStyleOnImport() { mbHasListStyleOnImport = true; }
+    /** Returns whether the lstStyle tag was non-empty on import
+     *
+     *  @return true if list style has it's own noninherited properties.
+     */
+    bool hasListStyleOnImport() const { return mbHasListStyleOnImport; }
+
 #ifdef DBG_UTIL
     void dump() const;
 #endif
@@ -54,6 +62,8 @@ public:
 private:
     TextParagraphPropertiesVector maListStyle;
     TextParagraphPropertiesVector maAggregationListStyle;
+    /// Set if ListStyle has a non-empty lstStyle tag on import
+    bool mbHasListStyleOnImport;
 };
 }
 
diff --git a/oox/source/drawingml/textliststyle.cxx b/oox/source/drawingml/textliststyle.cxx
index d900e3cef338..749cc17268e4 100644
--- a/oox/source/drawingml/textliststyle.cxx
+++ b/oox/source/drawingml/textliststyle.cxx
@@ -23,6 +23,7 @@
 namespace oox::drawingml {
 
 TextListStyle::TextListStyle()
+    : mbHasListStyleOnImport(false)
 {
     for ( int i = 0; i < 9; i++ )
     {
diff --git a/oox/source/drawingml/textliststylecontext.cxx b/oox/source/drawingml/textliststylecontext.cxx
index c1d865b2adc9..183a710f7431 100644
--- a/oox/source/drawingml/textliststylecontext.cxx
+++ b/oox/source/drawingml/textliststylecontext.cxx
@@ -41,6 +41,7 @@ TextListStyleContext::~TextListStyleContext()
 
 ContextHandlerRef TextListStyleContext::onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs )
 {
+    mrTextListStyle.setHasListStyleOnImport();
     switch( aElementToken )
     {
         case A_TOKEN( defPPr ):     // CT_TextParagraphProperties
commit 37dd39eb2e3086f7412a84727cfa69765065d2dd
Author:     Sarper Akdemir <sarper.akdemir at collabora.com>
AuthorDate: Sun May 9 20:55:17 2021 +0300
Commit:     Mike Kaganski <mike.kaganski at collabora.com>
CommitDate: Wed Jun 23 11:49:26 2021 +0200

    tdf#59323: ooxml import: hasNoninheritedBodyProperties
    
    Introduces hasNoninheritedBodyProperties.
    
    Change-Id: Id108f692005455376537e515f41528cc66a8c25c
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117006
    Tested-by: Jenkins
    Reviewed-by: Miklos Vajna <vmiklos at collabora.com>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117623
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Mike Kaganski <mike.kaganski at collabora.com>

diff --git a/oox/inc/drawingml/textbody.hxx b/oox/inc/drawingml/textbody.hxx
index 66dcf4239c6b..d82dc7e4b3fd 100644
--- a/oox/inc/drawingml/textbody.hxx
+++ b/oox/inc/drawingml/textbody.hxx
@@ -76,6 +76,11 @@ public:
     /// Returns whether the textbody had a pPr tag in it
     bool hasParagraphProperties() const;
 
+    /// Returns whether the textbody had a non-empty bodyPr tag in it
+    bool hasNoninheritedBodyProperties() const { return mbHasNoninheritedBodyProperties; }
+    /// Flags textbody as having a non-empty bodyPr tag
+    void setHasNoninheritedBodyProperties() { mbHasNoninheritedBodyProperties = true; }
+
     void                ApplyStyleEmpty(
                             const ::oox::core::XmlFilterBase& rFilterBase,
                             const css::uno::Reference < css::text::XText > & xText,
@@ -84,6 +89,8 @@ public:
 protected:
     TextParagraphVector maParagraphs;
     TextBodyProperties  maTextProperties;
+    /// Set if bodyPr tag in this textbody is non-empty during import
+    bool                mbHasNoninheritedBodyProperties;
     TextListStyle       maTextListStyle;
     Text3DProperties    ma3DProperties;
 };
diff --git a/oox/source/drawingml/textbody.cxx b/oox/source/drawingml/textbody.cxx
index 9d420e67dee3..a419a41d0d83 100644
--- a/oox/source/drawingml/textbody.cxx
+++ b/oox/source/drawingml/textbody.cxx
@@ -30,6 +30,7 @@ using namespace ::com::sun::star::beans;
 namespace oox::drawingml {
 
 TextBody::TextBody()
+    : mbHasNoninheritedBodyProperties( false )
 {
 }
 
diff --git a/oox/source/drawingml/textbodycontext.cxx b/oox/source/drawingml/textbodycontext.cxx
index 60d8ea8a8af2..d725aaa57bab 100644
--- a/oox/source/drawingml/textbodycontext.cxx
+++ b/oox/source/drawingml/textbodycontext.cxx
@@ -27,6 +27,8 @@
 #include <drawingml/textfieldcontext.hxx>
 #include <oox/drawingml/shape.hxx>
 #include <oox/token/namespaces.hxx>
+#include <oox/helper/attributelist.hxx>
+#include <sax/fastattribs.hxx>
 
 #include <oox/mathml/import.hxx>
 
@@ -179,6 +181,8 @@ ContextHandlerRef TextBodyContext::onCreateContext( sal_Int32 aElementToken, con
     switch( aElementToken )
     {
         case A_TOKEN( bodyPr ):     // CT_TextBodyPropertyBag
+            if (sax_fastparser::castToFastAttributeList(rAttribs.getFastAttributeList()).getFastAttributeTokens().size() > 0)
+                mrTextBody.setHasNoninheritedBodyProperties();
             if ( mpShapePtr )
                 return new TextBodyPropertiesContext( *this, rAttribs, mpShapePtr );
             else


More information about the Libreoffice-commits mailing list