diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2016-12-07 10:00:10 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2016-12-07 12:34:29 +0100 |
commit | 862c12396585661606d4e6ae583d1d024a19d222 (patch) | |
tree | 2bdb838ed8fcd487dc6b0462ee5d54dc0bc6bc29 | |
parent | 1d74d19a76f203ca33956e564b916704e17af4f7 (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.
Change-Id: Ifc9f17458ad0501b8ab6077e5a4998d48fd6f1d8
-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 c3ca4ee7717d..44dd39e410a9 100644 --- a/sw/qa/extras/uiwriter/uiwriter.cxx +++ b/sw/qa/extras/uiwriter/uiwriter.cxx @@ -216,6 +216,7 @@ public: void testLandscape(); void testTdf95699(); void testTdf104032(); + void testTdf104440(); CPPUNIT_TEST_SUITE(SwUiWriterTest); CPPUNIT_TEST(testReplaceForward); @@ -328,6 +329,7 @@ public: CPPUNIT_TEST(testLandscape); CPPUNIT_TEST(testTdf95699); CPPUNIT_TEST(testTdf104032); + CPPUNIT_TEST(testTdf104440); CPPUNIT_TEST_SUITE_END(); private: @@ -4086,6 +4088,19 @@ void SwUiWriterTest::testTdf104032() rUndoManager.Undo(); } +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 d0ed11e6f281..2547d9845c32 100644 --- a/sw/source/core/text/txtfly.cxx +++ b/sw/source/core/text/txtfly.cxx @@ -1370,6 +1370,13 @@ SwSurround SwTextFly::GetSurroundForTextWrap( const SwAnchoredObject* pAnchoredO 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 ) |