sw/qa/extras/odfexport/data/tdf103091.fodt | 2 +- sw/qa/extras/odfexport/odfexport.cxx | 2 +- sw/source/filter/xml/xmlfmt.cxx | 8 +++----- 3 files changed, 5 insertions(+), 7 deletions(-)
New commits: commit 9d6fcca559d8dbfd77448b7aed9835c1fcae93f3 Author: Justin Luth <justin.l...@collabora.com> AuthorDate: Mon Dec 7 17:11:18 2020 +0300 Commit: Michael Stahl <michael.st...@cib.de> CommitDate: Sat Dec 19 23:27:31 2020 +0100 tdf#82802 sw conditional style conditions not saved for TextBody Someone thought it would be a good idea for the built-in paragraph style Text Body to be special and support conditional formatting. It has been broken for import/export since 2015. It was mostly fixed in duplicate issue tdf#103091, but the side case of Text Body was missed. Partially reverting commit a5b4cb3f836c991d0647f55e1ef4920ce6115eac. xNewStyle didn't need to be a member variable since it is assigned to GetStyle anyway. Change-Id: I102d86c0b1f28e42b2c1350abc247b6b1f8acd4e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107352 Tested-by: Justin Luth <justin_l...@sil.org> Reviewed-by: Justin Luth <justin_l...@sil.org> Reviewed-by: Michael Stahl <michael.st...@cib.de> (cherry picked from commit 4b5aaa9edfd58ec8f73de127410656f884f944d7) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108000 Tested-by: Jenkins diff --git a/sw/qa/extras/odfexport/data/tdf103091.fodt b/sw/qa/extras/odfexport/data/tdf103091.fodt index c2c84115d01a..1da98f49d828 100644 --- a/sw/qa/extras/odfexport/data/tdf103091.fodt +++ b/sw/qa/extras/odfexport/data/tdf103091.fodt @@ -32,7 +32,7 @@ <style:paragraph-properties fo:margin-top="0.423cm" fo:margin-bottom="0.212cm" fo:keep-with-next="always"/> <style:text-properties style:font-name="Liberation Sans" fo:font-size="14pt" style:font-name-asian="DejaVu Sans Mono" style:font-size-asian="14pt" style:font-name-complex="DejaVu Sans" style:font-size-complex="14pt"/> </style:style> - <style:style style:name="Conditional" style:family="paragraph" style:parent-style-name="Standard" style:class="text"> + <style:style style:name="Text Body" style:family="paragraph" style:parent-style-name="Standard" style:class="text"> <style:paragraph-properties fo:margin-top="0cm" fo:margin-bottom="0.212cm"/> <style:map style:condition="table-header()" style:apply-style-name="Addressee"/> <style:map style:condition="table()" style:apply-style-name="Bibliography_20_1"/> diff --git a/sw/qa/extras/odfexport/odfexport.cxx b/sw/qa/extras/odfexport/odfexport.cxx index 6554b6abc38b..33356e1dd5ca 100644 --- a/sw/qa/extras/odfexport/odfexport.cxx +++ b/sw/qa/extras/odfexport/odfexport.cxx @@ -1016,7 +1016,7 @@ DECLARE_ODFEXPORT_TEST(testTdf103091, "tdf103091.fodt") // check that all conditional paragraph style conditions are imported uno::Reference<container::XNameAccess> xParaStyles(getStyles("ParagraphStyles")); uno::Reference<beans::XPropertySet> xStyle1(xParaStyles->getByName( - "Conditional"), uno::UNO_QUERY); + "Text Body"), uno::UNO_QUERY); auto conditions(getProperty<uno::Sequence<beans::NamedValue>>(xStyle1, "ParaStyleConditions")); CPPUNIT_ASSERT_EQUAL(sal_Int32(28), conditions.getLength()); diff --git a/sw/source/filter/xml/xmlfmt.cxx b/sw/source/filter/xml/xmlfmt.cxx index 8bf022141423..b887fcfd6347 100644 --- a/sw/source/filter/xml/xmlfmt.cxx +++ b/sw/source/filter/xml/xmlfmt.cxx @@ -267,7 +267,6 @@ namespace { class SwXMLTextStyleContext_Impl : public XMLTextStyleContext { std::unique_ptr<SwXMLConditions_Impl> pConditions; - uno::Reference < style::XStyle > xNewStyle; protected: @@ -293,7 +292,7 @@ public: uno::Reference < style::XStyle > SwXMLTextStyleContext_Impl::Create() { - + uno::Reference < style::XStyle > xNewStyle; if( pConditions && XmlStyleFamily::TEXT_PARAGRAPH == GetFamily() ) { uno::Reference< lang::XMultiServiceFactory > xFactory( GetImport().GetModel(), @@ -317,12 +316,11 @@ uno::Reference < style::XStyle > SwXMLTextStyleContext_Impl::Create() void SwXMLTextStyleContext_Impl::Finish( bool bOverwrite ) { - - if( pConditions && XmlStyleFamily::TEXT_PARAGRAPH == GetFamily() && xNewStyle.is() ) + if( pConditions && XmlStyleFamily::TEXT_PARAGRAPH == GetFamily() && GetStyle().is() ) { CommandStruct const*const pCommands = SwCondCollItem::GetCmds(); - Reference< XPropertySet > xPropSet( xNewStyle, UNO_QUERY ); + Reference< XPropertySet > xPropSet( GetStyle(), UNO_QUERY ); uno::Sequence< beans::NamedValue > aSeq( pConditions->size() ); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits