[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.4' - oox/inc oox/source

Sarper Akdemir (via logerrit) logerrit at kemper.freedesktop.org
Wed Jun 23 21:30:35 UTC 2021


 oox/inc/drawingml/textbody.hxx           |    3 +++
 oox/inc/drawingml/textparagraph.hxx      |    5 +++++
 oox/source/drawingml/textbody.cxx        |   10 ++++++++++
 oox/source/drawingml/textbodycontext.cxx |    1 +
 oox/source/drawingml/textparagraph.cxx   |    1 +
 5 files changed, 20 insertions(+)

New commits:
commit 2f7dd53b8b93d5da9f8261062185a64619d9f63c
Author:     Sarper Akdemir <sarper.akdemir at collabora.com>
AuthorDate: Sun May 9 20:47:35 2021 +0300
Commit:     Mike Kaganski <mike.kaganski at collabora.com>
CommitDate: Wed Jun 23 23:29:56 2021 +0200

    tdf#59323: ooxml import: hasParagraphProperties
    
    Introduces hasParagraphProperties to determine whether or not there was a pPr
    tag in the textbody on import.
    
    Change-Id: I3c6815e8405b0087f64520ee4e0e39297b3b4548
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117005
    Tested-by: Jenkins
    Reviewed-by: Miklos Vajna <vmiklos at collabora.com>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117532
    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 f09380d632a1..ba9fde01227a 100644
--- a/oox/inc/drawingml/textbody.hxx
+++ b/oox/inc/drawingml/textbody.hxx
@@ -74,6 +74,9 @@ public:
      */
     bool hasVisualRunProperties() const;
 
+    /// Returns whether the textbody had a pPr tag in it
+    bool hasParagraphProperties() const;
+
     void                ApplyStyleEmpty(
                             const ::oox::core::XmlFilterBase& rFilterBase,
                             const css::uno::Reference < css::text::XText > & xText,
diff --git a/oox/inc/drawingml/textparagraph.hxx b/oox/inc/drawingml/textparagraph.hxx
index 4e3abab18a90..27c7cb251271 100644
--- a/oox/inc/drawingml/textparagraph.hxx
+++ b/oox/inc/drawingml/textparagraph.hxx
@@ -52,6 +52,10 @@ public:
 
     TextParagraphProperties&         getProperties() { return maProperties; }
     const TextParagraphProperties&   getProperties() const { return maProperties; }
+    /// Flags the textparagraph as having a pPr tag in it
+    void                             setHasProperties() { mbHasProperties = true; }
+    /// Returns whether the textparagraph had an pPr tag in it during import
+    bool                             hasProperties() const { return mbHasProperties; }
 
     TextCharacterProperties&         getEndProperties() { return maEndProperties; }
     const TextCharacterProperties&   getEndProperties() const { return maEndProperties; }
@@ -86,6 +90,7 @@ public:
 
 private:
     TextParagraphProperties     maProperties;
+    bool                        mbHasProperties;
     TextCharacterProperties     maEndProperties;
     TextRunVector               maRuns;
     // temporarily store this here
diff --git a/oox/source/drawingml/textbody.cxx b/oox/source/drawingml/textbody.cxx
index 2a4d89de4030..534440cf0042 100644
--- a/oox/source/drawingml/textbody.cxx
+++ b/oox/source/drawingml/textbody.cxx
@@ -114,6 +114,16 @@ bool TextBody::hasVisualRunProperties() const
     return false;
 }
 
+bool TextBody::hasParagraphProperties() const
+{
+    for ( auto& pTextParagraph : getParagraphs() )
+    {
+        if ( pTextParagraph->hasProperties() )
+            return true;
+    }
+    return false;
+}
+
 void TextBody::ApplyStyleEmpty(
     const ::oox::core::XmlFilterBase& rFilterBase,
     const Reference < XText > & xText,
diff --git a/oox/source/drawingml/textbodycontext.cxx b/oox/source/drawingml/textbodycontext.cxx
index cbd1e420ee5a..c636899121a4 100644
--- a/oox/source/drawingml/textbodycontext.cxx
+++ b/oox/source/drawingml/textbodycontext.cxx
@@ -86,6 +86,7 @@ ContextHandlerRef TextParagraphContext::onCreateContext( sal_Int32 aElementToken
         }
         case A_TOKEN( pPr ):
         case W_TOKEN( pPr ):
+            mrParagraph.setHasProperties();
             return new TextParagraphPropertiesContext( *this, rAttribs, mrParagraph.getProperties() );
         case A_TOKEN( endParaRPr ):
             return new TextCharacterPropertiesContext( *this, rAttribs, mrParagraph.getEndProperties() );
diff --git a/oox/source/drawingml/textparagraph.cxx b/oox/source/drawingml/textparagraph.cxx
index 6de9c1417a8c..c85878715310 100644
--- a/oox/source/drawingml/textparagraph.cxx
+++ b/oox/source/drawingml/textparagraph.cxx
@@ -38,6 +38,7 @@ using namespace ::com::sun::star::beans;
 namespace oox { namespace drawingml {
 
 TextParagraph::TextParagraph()
+    : mbHasProperties( false )
 {
 }
 


More information about the Libreoffice-commits mailing list