diff options
Diffstat (limited to 'sw')
-rw-r--r-- | sw/qa/extras/layout/data/writer-image-no-capture.docx | bin | 0 -> 14531 bytes | |||
-rw-r--r-- | sw/qa/extras/layout/layout.cxx | 15 | ||||
-rw-r--r-- | sw/source/core/objectpositioning/anchoredobjectposition.cxx | 6 |
3 files changed, 19 insertions, 2 deletions
diff --git a/sw/qa/extras/layout/data/writer-image-no-capture.docx b/sw/qa/extras/layout/data/writer-image-no-capture.docx Binary files differnew file mode 100644 index 000000000000..ebb1f669f4a7 --- /dev/null +++ b/sw/qa/extras/layout/data/writer-image-no-capture.docx diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx index f1ed1785532e..862f4a30eb41 100644 --- a/sw/qa/extras/layout/layout.cxx +++ b/sw/qa/extras/layout/layout.cxx @@ -3608,6 +3608,21 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf121658) assertXPath(pXmlDoc, "//Special[@nType='PortionType::Hyphen']", 2); } +CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testWriterImageNoCapture) +{ + createDoc("writer-image-no-capture.docx"); + xmlDocPtr pXmlDoc = parseLayoutDump(); + CPPUNIT_ASSERT(pXmlDoc); + sal_Int32 nPageLeft = getXPath(pXmlDoc, "//page/infos/bounds", "left").toInt32(); + sal_Int32 nImageLeft = getXPath(pXmlDoc, "//fly/infos/bounds", "left").toInt32(); + // Without the accompanying fix in place, this test would have failed with: + // - Expected less than: 284 + // - Actual : 284 + // i.e. the image position was modified to be inside the page frame ("captured"), even if Word + // does not do that. + CPPUNIT_ASSERT_LESS(nPageLeft, nImageLeft); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/core/objectpositioning/anchoredobjectposition.cxx b/sw/source/core/objectpositioning/anchoredobjectposition.cxx index 6a9e02a499bf..48a0e27c881c 100644 --- a/sw/source/core/objectpositioning/anchoredobjectposition.cxx +++ b/sw/source/core/objectpositioning/anchoredobjectposition.cxx @@ -117,10 +117,12 @@ void SwAnchoredObjectPosition::GetInfoAboutObj() // determine, if anchored object has not to be captured on the page. // the following conditions must be hold to *not* capture it: // - corresponding document compatibility flag is set - // - it's a drawing object + // - it's a drawing object or it's a non-textbox wrap-though fly frame // - it doesn't follow the text flow { - mbDoNotCaptureAnchoredObj = !mbIsObjFly && !mbFollowTextFlow && + bool bTextBox = SwTextBoxHelper::isTextBox(mpFrameFormat, RES_FLYFRMFMT); + bool bWrapThrough = mpFrameFormat->GetSurround().GetSurround() == css::text::WrapTextMode_THROUGH; + mbDoNotCaptureAnchoredObj = (!mbIsObjFly || (!bTextBox && bWrapThrough)) && !mbFollowTextFlow && mpFrameFormat->getIDocumentSettingAccess().get(DocumentSettingId::DO_NOT_CAPTURE_DRAW_OBJS_ON_PAGE); } } |