summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSarper Akdemir <sarper.akdemir@collabora.com>2021-05-09 20:47:35 +0300
committerSarper Akdemir <sarper.akdemir@collabora.com>2021-06-10 18:22:08 +0300
commitda0ce6b2247455a54c46594f11e4566a2054936d (patch)
tree651a9f59fb60f29e6f6c9c08ce8686c3f500a7f1
parentedc4529af6e6df1218457d0c1ecf0685822741e1 (diff)
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
-rw-r--r--oox/inc/drawingml/textbody.hxx3
-rw-r--r--oox/inc/drawingml/textparagraph.hxx5
-rw-r--r--oox/source/drawingml/textbody.cxx10
-rw-r--r--oox/source/drawingml/textbodycontext.cxx1
-rw-r--r--oox/source/drawingml/textparagraph.cxx1
5 files changed, 20 insertions, 0 deletions
diff --git a/oox/inc/drawingml/textbody.hxx b/oox/inc/drawingml/textbody.hxx
index 8d0ce417f6b9..25a6ab194089 100644
--- a/oox/inc/drawingml/textbody.hxx
+++ b/oox/inc/drawingml/textbody.hxx
@@ -72,6 +72,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 4424eadf2cab..021434d6a5fb 100644
--- a/oox/inc/drawingml/textparagraph.hxx
+++ b/oox/inc/drawingml/textparagraph.hxx
@@ -53,6 +53,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; }
@@ -87,6 +91,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 9839f755dc39..5924728430a8 100644
--- a/oox/source/drawingml/textbody.cxx
+++ b/oox/source/drawingml/textbody.cxx
@@ -103,6 +103,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 49b50309f597..a10ba58a0499 100644
--- a/oox/source/drawingml/textbodycontext.cxx
+++ b/oox/source/drawingml/textbodycontext.cxx
@@ -89,6 +89,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 b1c57205dc26..9e4f309e9391 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::drawingml {
TextParagraph::TextParagraph()
+ : mbHasProperties( false )
{
}