From 7ff8414a411ae35e1fe56e9724646d0e94fa17f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zolnai=20Tam=C3=A1s?= Date: Thu, 13 Feb 2014 15:19:49 +0100 Subject: [PATCH] DOCX import: fix relative width of floating tables Relative width of tables means relative to the page and not to the paragraph area so we have to set the RelativeWidthRelation property of the containing text frame. Change-Id: I054d22e1883eb0ed9b07b9141bb2bea956e8367e --- .../floating-table-with-relative-width.docx | Bin 0 -> 13314 bytes sw/qa/extras/ooxmlimport/ooxmlimport.cxx | 12 ++++++++++++ .../source/dmapper/DomainMapperTableHandler.cxx | 9 ++++++--- 3 files changed, 18 insertions(+), 3 deletions(-) create mode 100644 sw/qa/extras/ooxmlimport/data/floating-table-with-relative-width.docx diff --git a/sw/qa/extras/ooxmlimport/data/floating-table-with-relative-width.docx b/sw/qa/extras/ooxmlimport/data/floating-table-with-relative-width.docx new file mode 100644 index 0000000000000000000000000000000000000000..9d88d930277d018b9b9a70c0103d8ce14fc00862 GIT binary patch literal 13314 zcmeHu1zTL%vUcO{?tu{8g1ZEFcXtTx?(R;o;O+r}ySux4aMxg8XYQFhXL9C#f8gHD z!`=&eztz>Xt5&^hRkfTX7&tlr5&#VV0EhuFq#^!(AOJu#1OR{rfCkkRw6S(HwszE2 za>vV4~d4oZ;?00rLvf5-n~3)Ce_%Lecx2cMI@Le;2(t++GvC*Eb>7E703 zw$ceM4SE}yKHZ)ZNJy6E6lk=?b~2tnjlwYnOi6s10_CQ%P?(o>rvZI$RX9pxTs1TB zkSvTHI3#3_kZ*}FDAF?$(dBpwcwfqzQbPjnGQcqmTG!dj$>12TStXpU$+sgji1ZQ6 zd+m75)?6BZwk>B~y|oEq|B+shS!Ze|tyeINrnySDyj6iLgE|S_PwcVVXhUneLhw^k zx=XbjVik12rAo-rZgp4vS!(VjRe%|Zrz>h2!^8B?NK=(@mfKkTFXmfyZk43Ww@GQ& zDxf6Bl_U8aQ=d`^-UJZgk5MnqDL=2Foo*;m^t&O(^E$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bK zKlv%Z+#tevELMk?vm4UrR*5UP3d5qWCnv=3$Q`;9PK=U6Bm@K?@b;j*azAAI^BQ6u zzlke4j*EGkmA!i^X+HVV(CsBiYKkPbP3U%Gw6BT+6L8Ldp+Lg!`pSA5lTIV==1KL? z_@*orKd~p2+-<~^Kr?8NI%o{H{*CnQ*0X4nNL_KfUbFJ%{!j(HZrh*Xx8q2^X0x1(+adT$81oGG=jsOplonVf`R6Y={Q2nry#B*i9^@qdF5vII)_($j zU7LaN^>3ZmzXSi?fco#ibzqm#|F0eOcS*mu8U7{f6R`2{Kbj7IhyUK#^cNfn;a~9I z+njzE@p}RJFA+y*{}S=<<>cStzgMvSf)```3;tU@>vsvi*K_`ou!{Ys0{>Lq`CZQ6 z_hSB%0sxp10|5WAGxIzA_to@Y0`}hjO^sjk?C;>;bMar`UFv^<|CX75$Nzm^{|gNO fEYkj)?*E$Q11ZUz9r1AkzEp1Q;E>#zR@oTH;2 literal 0 HcmV?d00001 diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx index 3b3a227c63d2..d60247e672da 100644 --- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx +++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx @@ -1848,6 +1848,18 @@ DECLARE_OOXMLIMPORT_TEST(testFdo69656, "Table_cell_auto_width_fdo69656.docx") uno::Reference xTables(xTablesSupplier->getTextTables( ), uno::UNO_QUERY); CPPUNIT_ASSERT_EQUAL(sal_Int32(8154), getProperty(xTables->getByIndex(0), "Width")); } + +DECLARE_OOXMLIMPORT_TEST(testFloatingTableWithRelativeWidth, "floating-table-with-relative-width.docx") +{ + // Floating tables are imported to text frames and the size is defined by the frame size. + // Width of the text frame including table was relative to the paragraph area and not to the page. + uno::Reference xTextFramesSupplier(mxComponent, uno::UNO_QUERY); + uno::Reference xIndexAccess(xTextFramesSupplier->getTextFrames(), uno::UNO_QUERY); + uno::Reference xFrame(xIndexAccess->getByIndex(0), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(sal_Int32(80), getProperty(xFrame, "RelativeWidth")); + CPPUNIT_ASSERT_EQUAL(sal_Int16(text::RelOrientation::PAGE_FRAME), getProperty(xFrame, "RelativeWidthRelation")); + +} #endif CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx index 3bc66fac72d7..03be88dc4333 100644 --- a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx +++ b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx @@ -944,9 +944,12 @@ void DomainMapperTableHandler::endTable(unsigned int nestedTableLevel) } else { - aFrameProperties.realloc(aFrameProperties.getLength() + 1); - aFrameProperties[aFrameProperties.getLength() - 1].Name = "FrameWidthPercent"; - aFrameProperties[aFrameProperties.getLength() - 1].Value = xTableProperties->getPropertyValue("RelativeWidth"); + aFrameProperties.realloc(aFrameProperties.getLength() + 2); + aFrameProperties[aFrameProperties.getLength() - 2].Name = "FrameWidthPercent"; + aFrameProperties[aFrameProperties.getLength() - 2].Value = xTableProperties->getPropertyValue("RelativeWidth"); + + aFrameProperties[aFrameProperties.getLength() - 1].Name = "RelativeWidthRelation"; + aFrameProperties[aFrameProperties.getLength() - 1].Value = uno::makeAny(text::RelOrientation::PAGE_FRAME); // Applying the relative width to the frame, needs to have the table width to be 100% of the frame width xTableProperties->setPropertyValue("RelativeWidth", uno::makeAny(sal_Int16(100)));