diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2018-08-06 21:42:32 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2018-08-07 09:14:03 +0200 |
commit | 59f5f666a5085ae58a8dd164636a6bea47e6bddc (patch) | |
tree | 2ce2f852b1befcff27f46757f039238590ede889 /sw | |
parent | 7d800d0fa98978e06c5dc0f189501f96402e11d5 (diff) |
tdf#109137 sw textbox: fix initial wrap type of a shape's textbox
This was already working for the DOCX import by luck. Make the wrap type
explicit, so the ODF import has it correctly.
The wrap type for the hidden sw text frame ("textbox of a shape") should
be always "through", wrapping is only performed for the surrounding draw
shape.
Change-Id: Ice28cd5b517d544cfab4900dee32f01b534fee26
Reviewed-on: https://gerrit.libreoffice.org/58656
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/qa/extras/layout/data/tdf109137.docx | bin | 0 -> 19429 bytes | |||
-rw-r--r-- | sw/qa/extras/layout/layout.cxx | 20 | ||||
-rw-r--r-- | sw/source/core/doc/textboxhelper.cxx | 2 |
3 files changed, 22 insertions, 0 deletions
diff --git a/sw/qa/extras/layout/data/tdf109137.docx b/sw/qa/extras/layout/data/tdf109137.docx Binary files differnew file mode 100644 index 000000000000..03e2423bc155 --- /dev/null +++ b/sw/qa/extras/layout/data/tdf109137.docx diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx index 2325fd84e5a2..9bf7affcfd87 100644 --- a/sw/qa/extras/layout/layout.cxx +++ b/sw/qa/extras/layout/layout.cxx @@ -8,6 +8,7 @@ */ #include <swmodeltestbase.hxx> +#include <comphelper/propertysequence.hxx> #include <test/mtfxmldump.hxx> #include <com/sun/star/linguistic2/LinguServiceManager.hpp> #include <comphelper/scopeguard.hxx> @@ -31,6 +32,7 @@ public: void testTdf117923(); void testTdf109077(); void testUserFieldTypeLanguage(); + void testTdf109137(); CPPUNIT_TEST_SUITE(SwLayoutWriter); CPPUNIT_TEST(testTdf116830); @@ -45,6 +47,7 @@ public: CPPUNIT_TEST(testTdf117923); CPPUNIT_TEST(testTdf109077); CPPUNIT_TEST(testUserFieldTypeLanguage); + CPPUNIT_TEST(testTdf109137); CPPUNIT_TEST_SUITE_END(); private: @@ -274,6 +277,23 @@ void SwLayoutWriter::testUserFieldTypeLanguage() assertXPath(pXmlDoc, "/root/page/body/txt/Special[@nType='POR_FLD']", "rText", "1,234.56"); } +void SwLayoutWriter::testTdf109137() +{ + createDoc("tdf109137.docx"); + uno::Reference<frame::XStorable> xStorable(mxComponent, uno::UNO_QUERY); + utl::TempFile aTempFile; + aTempFile.EnableKillingFile(); + uno::Sequence<beans::PropertyValue> aDescriptor(comphelper::InitPropertySequence({ + { "FilterName", uno::Any(OUString("writer8")) }, + })); + xStorable->storeToURL(aTempFile.GetURL(), aDescriptor); + loadURL(aTempFile.GetURL(), "tdf109137.odt"); + xmlDocPtr pXmlDoc = parseLayoutDump(); + // This was 0, the blue rectangle moved from the 1st to the 2nd page. + assertXPath(pXmlDoc, "/root/page[1]/body/txt/anchored/fly/notxt", + /*nNumberOfNodes=*/1); +} + CPPUNIT_TEST_SUITE_REGISTRATION(SwLayoutWriter); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sw/source/core/doc/textboxhelper.cxx b/sw/source/core/doc/textboxhelper.cxx index c84131f5f3a1..acd112c17c2b 100644 --- a/sw/source/core/doc/textboxhelper.cxx +++ b/sw/source/core/doc/textboxhelper.cxx @@ -86,6 +86,8 @@ void SwTextBoxHelper::create(SwFrameFormat* pShape) xPropertySet->setPropertyValue(UNO_NAME_SIZE_TYPE, uno::makeAny(text::SizeType::FIX)); + xPropertySet->setPropertyValue(UNO_NAME_SURROUND, uno::makeAny(text::WrapTextMode_THROUGH)); + uno::Reference<container::XNamed> xNamed(xTextFrame, uno::UNO_QUERY); xNamed->setName(pShape->GetDoc()->GetUniqueFrameName()); |