From 33e392e7d4fbfc61480751311e7187a5730acc78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Bosdonnat?= Date: Wed, 22 May 2013 11:34:01 +0200 Subject: n#816593: Floating table width import fix: adjust the frame width (cherry picked from commit 9f4c8a8bca06b4c2a916a51909367b453fc41a8b) Conflicts: sw/qa/extras/ooxmlimport/data/table_width.docx sw/qa/extras/ooxmlimport/ooxmlimport.cxx Change-Id: I8212bc5981418f6cbd514bf5002e6a5dbdf53152 --- .../source/dmapper/DomainMapperTableHandler.cxx | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx index 2a5f5031072f..41d2c045daf0 100644 --- a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx +++ b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx @@ -774,9 +774,23 @@ void DomainMapperTableHandler::endTable(unsigned int nestedTableLevel) if (xTable.is() && xStart.is() && xEnd.is()) { uno::Reference xTableProperties(xTable, uno::UNO_QUERY); - aFrameProperties.realloc(aFrameProperties.getLength() + 1); - aFrameProperties[aFrameProperties.getLength() - 1].Name = "Width"; - aFrameProperties[aFrameProperties.getLength() - 1].Value = xTableProperties->getPropertyValue("Width"); + sal_Bool bIsRelative = sal_False; + xTableProperties->getPropertyValue("IsWidthRelative") >>= bIsRelative; + if (!bIsRelative) + { + aFrameProperties.realloc(aFrameProperties.getLength() + 1); + aFrameProperties[aFrameProperties.getLength() - 1].Name = "Width"; + aFrameProperties[aFrameProperties.getLength() - 1].Value = xTableProperties->getPropertyValue("Width"); + } + else + { + aFrameProperties.realloc(aFrameProperties.getLength() + 1); + aFrameProperties[aFrameProperties.getLength() - 1].Name = "FrameWidthPercent"; + aFrameProperties[aFrameProperties.getLength() - 1].Value = xTableProperties->getPropertyValue("RelativeWidth"); + + // 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))); + } // A non-zero left margin would move the table out of the frame, move the frame itself instead. xTableProperties->setPropertyValue("LeftMargin", uno::makeAny(sal_Int32(0))); -- cgit v1.2.1