summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVasily Melenchuk <vasily.melenchuk@cib.de>2019-02-25 08:35:54 +0300
committerThorsten Behrens <Thorsten.Behrens@CIB.de>2019-03-04 12:31:36 +0100
commitf3578459912dca8ebf2bd62a956e2812ee41b63e (patch)
tree53342c09b727f9dc9b54f22a2574d5948e2510ba
parent7d7396d096369be06e7de3df566c5da7b25ef2c7 (diff)
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/68588 Tested-by: Jenkins Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
-rw-r--r--sw/CppunitTest_sw_ooxmlimport2.mk1
-rw-r--r--sw/qa/extras/ooxmlimport/data/tdf121440.docxbin0 -> 23209 bytes
-rw-r--r--sw/qa/extras/ooxmlimport/ooxmlimport2.cxx16
-rw-r--r--writerfilter/source/dmapper/DomainMapper_Impl.cxx6
4 files changed, 23 insertions, 0 deletions
diff --git a/sw/CppunitTest_sw_ooxmlimport2.mk b/sw/CppunitTest_sw_ooxmlimport2.mk
index c269c7282028..1760b61e98b3 100644
--- a/sw/CppunitTest_sw_ooxmlimport2.mk
+++ b/sw/CppunitTest_sw_ooxmlimport2.mk
@@ -39,6 +39,7 @@ $(eval $(call gb_CppunitTest_use_externals,sw_ooxmlimport2,\
$(eval $(call gb_CppunitTest_set_include,sw_ooxmlimport2,\
-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
--- /dev/null
+++ b/sw/qa/extras/ooxmlimport/data/tdf121440.docx
Binary files differ
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx
index d2289a28beb4..53d46cabe198 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx
@@ -17,6 +17,7 @@
#endif
#include <swmodeltestbase.hxx>
+#include <wrtsh.hxx>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/document/XEmbeddedObjectSupplier2.hpp>
#include <com/sun/star/embed/Aspects.hpp>
@@ -306,6 +307,21 @@ DECLARE_OOXMLIMPORT_TEST(testTdf115094v2, "tdf115094v2.docx")
CPPUNIT_ASSERT(getProperty<bool>(getShapeByName("Grafik 19"), "IsLayoutInCell"));
}
+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 5c0e8148406f..756f3d18333e 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -2015,6 +2015,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(