summaryrefslogtreecommitdiff
path: root/sw/qa
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2018-12-12 00:31:13 +0300
committerMike Kaganski <mike.kaganski@collabora.com>2018-12-12 05:51:53 +0100
commitd398e9248c183cf988b6d985b342b0cbff93ea02 (patch)
tree6750cb396ae1baabf22184ee26ddd58c888a29ff /sw/qa
parent3c964980da07892a02d5ac721d80558c459532d0 (diff)
tdf#121734: ww8 import: use direct formatting for floating object frames
... and don't modify standard frame styles to have no borders and padding. This makes "Frame", "OLE", and "Graphics" frame styles of imported DOC files to have usual settings (for "Frame", it's 1.5 mm padding and all borders set to 0.05 pt black line). All objects that need invisible frame will have them with all necessary settings set explicitly, which allows to copy and paste such frames to other documents without problems. This makes DOC import aligned with DOCX import in this regard. Change-Id: I6f05cf71e63ceccb8e0ddebe23ec41bf69af9b52 Reviewed-on: https://gerrit.libreoffice.org/64992 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'sw/qa')
-rw-r--r--sw/qa/extras/ww8import/data/tdf121734.docbin0 -> 26624 bytes
-rw-r--r--sw/qa/extras/ww8import/ww8import.cxx43
2 files changed, 43 insertions, 0 deletions
diff --git a/sw/qa/extras/ww8import/data/tdf121734.doc b/sw/qa/extras/ww8import/data/tdf121734.doc
new file mode 100644
index 000000000000..11a9bf503ca5
--- /dev/null
+++ b/sw/qa/extras/ww8import/data/tdf121734.doc
Binary files differ
diff --git a/sw/qa/extras/ww8import/ww8import.cxx b/sw/qa/extras/ww8import/ww8import.cxx
index de16cfe253e6..cd07887669bd 100644
--- a/sw/qa/extras/ww8import/ww8import.cxx
+++ b/sw/qa/extras/ww8import/ww8import.cxx
@@ -13,6 +13,9 @@
#include <ndtxt.hxx>
#include <viscrs.hxx>
#include <wrtsh.hxx>
+#include <editeng/boxitem.hxx>
+#include <editeng/lrspitem.hxx>
+#include <editeng/ulspitem.hxx>
class Test : public SwModelTestBase
{
@@ -147,6 +150,46 @@ DECLARE_WW8IMPORT_TEST(testTdf112346, "tdf112346.doc")
CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0), xDrawPage->getCount());
}
+DECLARE_WW8IMPORT_TEST(testTdf121734, "tdf121734.doc")
+{
+ SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get());
+ CPPUNIT_ASSERT(pTextDoc);
+ SwDoc* pDoc = pTextDoc->GetDocShell()->GetDoc();
+ SwPosFlyFrames aPosFlyFrames = pDoc->GetAllFlyFormats(nullptr, false);
+ // There is only one fly frame in the document: the one with the imported floating table
+ CPPUNIT_ASSERT_EQUAL(size_t(1), aPosFlyFrames.size());
+ for (const auto& rPosFlyFrame : aPosFlyFrames)
+ {
+ const SwFrameFormat& rFormat = rPosFlyFrame->GetFormat();
+ const SfxPoolItem* pItem = nullptr;
+
+ // The LR and UL spacings and borders must all be set explicitly;
+ // spacings and border distances must be 0; borders must be absent.
+
+ CPPUNIT_ASSERT_EQUAL(SfxItemState::SET, rFormat.GetItemState(RES_LR_SPACE, false, &pItem));
+ auto pLR = static_cast<const SvxLRSpaceItem*>(pItem);
+ CPPUNIT_ASSERT(pLR);
+ CPPUNIT_ASSERT_EQUAL(long(0), pLR->GetLeft());
+ CPPUNIT_ASSERT_EQUAL(long(0), pLR->GetRight());
+
+ CPPUNIT_ASSERT_EQUAL(SfxItemState::SET, rFormat.GetItemState(RES_UL_SPACE, false, &pItem));
+ auto pUL = static_cast<const SvxULSpaceItem*>(pItem);
+ CPPUNIT_ASSERT(pUL);
+ CPPUNIT_ASSERT_EQUAL(sal_uInt16(0), pUL->GetUpper());
+ CPPUNIT_ASSERT_EQUAL(sal_uInt16(0), pUL->GetLower());
+
+ CPPUNIT_ASSERT_EQUAL(SfxItemState::SET, rFormat.GetItemState(RES_BOX, false, &pItem));
+ auto pBox = static_cast<const SvxBoxItem*>(pItem);
+ CPPUNIT_ASSERT(pBox);
+ for (auto eLine : { SvxBoxItemLine::TOP, SvxBoxItemLine::BOTTOM,
+ SvxBoxItemLine::LEFT, SvxBoxItemLine::RIGHT })
+ {
+ CPPUNIT_ASSERT_EQUAL(sal_uInt16(0), pBox->GetDistance(eLine));
+ CPPUNIT_ASSERT(!pBox->GetLine(eLine));
+ }
+ }
+}
+
// tests should only be added to ww8IMPORT *if* they fail round-tripping in ww8EXPORT
CPPUNIT_PLUGIN_IMPLEMENT();