Kaydet (Commit) 9f4c8a8b authored tarafından Cédric Bosdonnat's avatar Cédric Bosdonnat Kaydeden (comit) Cédric Bosdonnat

n#816593: Floating table width import fix: adjust the frame width

Change-Id: I8212bc5981418f6cbd514bf5002e6a5dbdf53152
üst 788a38fd
......@@ -1311,6 +1311,10 @@ void Test::testTableWidth()
uno::Reference<container::XIndexAccess> xTables(xTablesSupplier->getTextTables(), uno::UNO_QUERY);
// Relative width wasn't recognized during import.
CPPUNIT_ASSERT_EQUAL(true, bool(getProperty<sal_Bool>(xTables->getByIndex(0), "IsWidthRelative")));
uno::Reference<text::XTextFramesSupplier> xFramesSupplier(mxComponent, uno::UNO_QUERY);
uno::Reference<container::XIndexAccess> xFrames(xFramesSupplier->getTextFrames(), uno::UNO_QUERY);
CPPUNIT_ASSERT_EQUAL(sal_Int32(100), getProperty<sal_Int32>(xFrames->getByIndex(0), "FrameWidthPercent"));
}
void Test::testConditionalstylesTbllook()
......
......@@ -828,9 +828,23 @@ void DomainMapperTableHandler::endTable(unsigned int nestedTableLevel)
if (xTable.is() && xStart.is() && xEnd.is())
{
uno::Reference<beans::XPropertySet> 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)));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment