diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2016-12-07 10:00:10 +0100 |
---|---|---|
committer | Jan Holesovsky <kendy@collabora.com> | 2016-12-08 10:42:31 +0000 |
commit | c1ae11db4a56dea9369d379a83c8a2a7afc2b99b (patch) | |
tree | 063fbac03ee84e6ffe77110a505c07601c7a2e7f /sw | |
parent | 0543ac9016528aa9c49573b1b1115bb6fbddf0b4 (diff) |
tdf#104440 sw: fix layout inconsistency with dynamic wrapping and undo
The problem was that the second fly frame was placed on the first page
initially, but after typing a character (which moved it to the second
page) and then undoing, it wasn't moved back.
Fix the inconsistency by handling the "fly frame takes all horizontal
space" case as parallel wrapping (which will result in no wrapping at
the end), this way the second fly frame appears on the second page both
initially and after editing.
As an additional data point, the DOC export of the bugdoc is now
rendered in Word the same way as in Writer.
(cherry picked from commit 862c12396585661606d4e6ae583d1d024a19d222)
Conflicts:
sw/qa/extras/uiwriter/uiwriter.cxx
Change-Id: Ifc9f17458ad0501b8ab6077e5a4998d48fd6f1d8
Reviewed-on: https://gerrit.libreoffice.org/31725
Reviewed-by: Jan Holesovsky <kendy@collabora.com>
Tested-by: Jan Holesovsky <kendy@collabora.com>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/qa/extras/uiwriter/data/tdf104440.odt | bin | 0 -> 8807 bytes | |||
-rw-r--r-- | sw/qa/extras/uiwriter/uiwriter.cxx | 15 | ||||
-rw-r--r-- | sw/source/core/text/txtfly.cxx | 7 |
3 files changed, 22 insertions, 0 deletions
diff --git a/sw/qa/extras/uiwriter/data/tdf104440.odt b/sw/qa/extras/uiwriter/data/tdf104440.odt Binary files differnew file mode 100644 index 000000000000..b226bb55de8d --- /dev/null +++ b/sw/qa/extras/uiwriter/data/tdf104440.odt diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx index 1a37476f21e2..d7827ae6b734 100644 --- a/sw/qa/extras/uiwriter/uiwriter.cxx +++ b/sw/qa/extras/uiwriter/uiwriter.cxx @@ -199,6 +199,7 @@ public: void testCursorWindows(); void testLandscape(); void testTdf95699(); + void testTdf104440(); CPPUNIT_TEST_SUITE(SwUiWriterTest); CPPUNIT_TEST(testReplaceForward); @@ -299,6 +300,7 @@ public: CPPUNIT_TEST(testCursorWindows); CPPUNIT_TEST(testLandscape); CPPUNIT_TEST(testTdf95699); + CPPUNIT_TEST(testTdf104440); CPPUNIT_TEST_SUITE_END(); private: @@ -3484,6 +3486,19 @@ void SwUiWriterTest::testTdf95699() CPPUNIT_ASSERT_EQUAL(OUString("vnd.oasis.opendocument.field.FORMCHECKBOX"), pFieldMark->GetFieldname()); } +void SwUiWriterTest::testTdf104440() +{ + createDoc("tdf104440.odt"); + xmlDocPtr pXmlDoc = parseLayoutDump(); + xmlXPathObjectPtr pXmlObj = getXPathNode(pXmlDoc, "//page[2]/body/txt/anchored"); + xmlNodeSetPtr pXmlNodes = pXmlObj->nodesetval; + // This was 0: both Text Frames in the document were anchored to a + // paragraph on page 1, while we expect that the second Text Frame is + // anchored to a paragraph on page 2. + CPPUNIT_ASSERT_EQUAL(1, xmlXPathNodeSetGetLength(pXmlNodes)); + xmlXPathFreeObject(pXmlObj); +} + CPPUNIT_TEST_SUITE_REGISTRATION(SwUiWriterTest); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sw/source/core/text/txtfly.cxx b/sw/source/core/text/txtfly.cxx index 8c041c66492d..efc5abe12c72 100644 --- a/sw/source/core/text/txtfly.cxx +++ b/sw/source/core/text/txtfly.cxx @@ -1386,6 +1386,13 @@ SwSurround SwTextFly::_GetSurroundForTextWrap( const SwAnchoredObject* pAnchored const int textMin = GetMaster()->GetNode() ->getIDocumentSettingAccess()->get(DocumentSettingId::SURROUND_TEXT_WRAP_SMALL ) ? TEXT_MIN_SMALL : TEXT_MIN; + + // In case there is no space on either side, then SURROUND_PARALLEL + // gives the same result when doing the initial layout or a layout + // update after editing, so prefer that over SURROUND_NONE. + if (nLeft == 0 && nRight == 0) + return SURROUND_PARALLEL; + if( nLeft < textMin ) nLeft = 0; if( nRight < textMin ) |