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 b05dfa46865f52583cfe370e153b44c7c57788b0 Author: Sarper Akdemir <sarper.akde...@collabora.com> AuthorDate: Sun May 9 20:47:35 2021 +0300 Commit: Mike Kaganski <mike.kagan...@collabora.com> CommitDate: Wed Jun 23 11:49:01 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 <vmik...@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117622 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com> diff --git a/oox/inc/drawingml/textbody.hxx b/oox/inc/drawingml/textbody.hxx index 34b7fce40725..66dcf4239c6b 100644 --- a/oox/inc/drawingml/textbody.hxx +++ b/oox/inc/drawingml/textbody.hxx @@ -73,6 +73,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 e5486a0d1afe..4ed70307d7c0 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 78bb00c2acfa..9d420e67dee3 100644 --- a/oox/source/drawingml/textbody.cxx +++ b/oox/source/drawingml/textbody.cxx @@ -108,6 +108,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 f4c33f7253e0..60d8ea8a8af2 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 0eaebfd4c9cb..d98fb7ebc0ff 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 ) { } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits