sw/CppunitTest_sw_ooxmlimport.mk | 1 + sw/qa/extras/ooxmlimport/data/tdf121440.docx |binary sw/qa/extras/ooxmlimport/ooxmlimport.cxx | 16 ++++++++++++++++ writerfilter/source/dmapper/DomainMapper_Impl.cxx | 6 ++++++ 4 files changed, 23 insertions(+)
New commits: commit 3280c7d21f92d0f87df8c9604e27ddb3515853aa Author: Vasily Melenchuk <[email protected]> AuthorDate: Mon Feb 25 08:35:54 2019 +0300 Commit: Thorsten Behrens <[email protected]> CommitDate: Mon Mar 4 12:32:22 2019 +0100 tdf#121440 writerfilter: do not use imported style for foot/endnotes Extra style is causing editing problem near footnote/endnote references. This behavior is a side effect of eaa9cf6a3069fba3d82c046f0041bfb537d9e648, allowing emission of these "technical" styles. Change-Id: I1885b92814746e7b5cd19f3ddd7bc22eb691615e Reviewed-on: https://gerrit.libreoffice.org/68584 Reviewed-by: Thorsten Behrens <[email protected]> Tested-by: Thorsten Behrens <[email protected]> diff --git a/sw/CppunitTest_sw_ooxmlimport.mk b/sw/CppunitTest_sw_ooxmlimport.mk index dbcead9598c3..52a7a163a5d0 100644 --- a/sw/CppunitTest_sw_ooxmlimport.mk +++ b/sw/CppunitTest_sw_ooxmlimport.mk @@ -39,6 +39,7 @@ $(eval $(call gb_CppunitTest_use_externals,sw_ooxmlimport,\ $(eval $(call gb_CppunitTest_set_include,sw_ooxmlimport,\ -I$(SRCDIR)/sw/inc \ -I$(SRCDIR)/sw/source/core/inc \ + -I$(SRCDIR)/sw/source/uibase/inc \ -I$(SRCDIR)/sw/qa/extras/inc \ $$(INCLUDE) \ )) diff --git a/sw/qa/extras/ooxmlimport/data/tdf121440.docx b/sw/qa/extras/ooxmlimport/data/tdf121440.docx new file mode 100644 index 000000000000..023599aec3ff Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf121440.docx differ diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx index 7c7b284cab6a..a51e0234924b 100644 --- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx +++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx @@ -17,6 +17,7 @@ #endif #include <swmodeltestbase.hxx> +#include <wrtsh.hxx> #include <basegfx/polygon/b2dpolypolygontools.hxx> #include <com/sun/star/awt/XBitmap.hpp> @@ -3301,6 +3302,21 @@ DECLARE_OOXMLIMPORT_TEST(testTdf43017, "tdf43017.docx") sal_Int32(-1), getProperty<sal_Int32>(xText, "CharColor")); } +DECLARE_OOXMLIMPORT_TEST(testTdf121440, "tdf121440.docx") +{ + // Insert some text in front of footnote + SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get()); + CPPUNIT_ASSERT(pTextDoc); + SwWrtShell* pWrtShell = pTextDoc->GetDocShell()->GetWrtShell(); + CPPUNIT_ASSERT(pWrtShell); + pWrtShell->Insert("test"); + + // Ensure that inserted text is not superscripted + CPPUNIT_ASSERT_EQUAL_MESSAGE( + "Inserted text should be not a superscript!", static_cast<sal_Int32>(0), + getProperty<sal_Int32>(getRun(getParagraph(1), 1), "CharEscapement")); +} + // tests should only be added to ooxmlIMPORT *if* they fail round-tripping in ooxmlEXPORT CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx index 82a202109613..a3b64298f82f 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -1604,6 +1604,12 @@ void DomainMapper_Impl::PushFootOrEndnote( bool bIsFootnote ) m_aRedlines.push(std::vector< RedlineParamsPtr >()); PropertyMapPtr pTopContext = GetTopContext(); + + // Remove style reference, if any. This reference did appear here as a side effect of tdf#43017 + // Seems it is not required by LO, but causes side effects during editing. So remove it + // for footnotes/endnotes to restore original LO behavior here. + pTopContext->Erase(PROP_CHAR_STYLE_NAME); + uno::Reference< text::XText > xFootnoteText; if (GetTextFactory().is()) xFootnoteText.set( GetTextFactory()->createInstance( _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
