Kaydet (Commit) fd61dee6 authored tarafından Miklos Vajna's avatar Miklos Vajna

tdf#99140 DOCX import: fix table horizontal aligment to be 'from left' ...

... when it was 'manual'.

Regression from commit c1e563f6
(fdo#76741 [DOCX] Table Alignment and width type, 2014-04-04), DOCX
import code had to deal with two kinds of horizontal alignment when it
came to floating tables: the alignment of the table itself, and the
alignment of the float parameters. The problem is, in general it's
wanted that the table is aligned according to the floating parameters,
but in Writer the "from left" UI setting is described differently for
tables and fly frames: tables use LEFT_AND_WIDTH for that, while fly
frames use NONE.

Fix the problem by touching the default only in case the floating
parameters have something that's different from NONE.

With this, the width of tables is no longer lost when they are described
to be floating ones in the DOCX markup, but FloatingTableConversion()
decides to ignore that.

Change-Id: Idd41c3e03e6ded8552e9d15b6080e4b45eb18d3d
Reviewed-on: https://gerrit.libreoffice.org/23923Reviewed-by: 's avatarMiklos Vajna <vmiklos@collabora.co.uk>
Tested-by: 's avatarJenkins <ci@libreoffice.org>
üst b98f2cc3
...@@ -3231,6 +3231,12 @@ DECLARE_OOXMLIMPORT_TEST(testTdf99140, "tdf99140.docx") ...@@ -3231,6 +3231,12 @@ DECLARE_OOXMLIMPORT_TEST(testTdf99140, "tdf99140.docx")
uno::Reference<drawing::XDrawPage> xDrawPage = xDrawPageSupplier->getDrawPage(); uno::Reference<drawing::XDrawPage> xDrawPage = xDrawPageSupplier->getDrawPage();
// This was 1: a multi-page floating table was imported as a TextFrame. // This was 1: a multi-page floating table was imported as a TextFrame.
CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0), xDrawPage->getCount()); CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0), xDrawPage->getCount());
uno::Reference<text::XTextTablesSupplier> xTablesSupplier(mxComponent, uno::UNO_QUERY);
uno::Reference<container::XIndexAccess> xTables(xTablesSupplier->getTextTables(), uno::UNO_QUERY);
uno::Reference<beans::XPropertySet> xTableProperties(xTables->getByIndex(1), uno::UNO_QUERY);
// This was text::HoriOrientation::NONE, the second table was too wide due to this.
CPPUNIT_ASSERT_EQUAL(text::HoriOrientation::LEFT_AND_WIDTH, getProperty<sal_Int16>(xTableProperties, "HoriOrient"));
} }
CPPUNIT_PLUGIN_IMPLEMENT(); CPPUNIT_PLUGIN_IMPLEMENT();
......
...@@ -281,20 +281,21 @@ bool lcl_extractTableBorderProperty(PropertyMapPtr pTableProperties, const Prope ...@@ -281,20 +281,21 @@ bool lcl_extractTableBorderProperty(PropertyMapPtr pTableProperties, const Prope
return false; return false;
} }
} void lcl_extractHoriOrient(std::vector<beans::PropertyValue>& rFrameProperties, sal_Int32& nHoriOrient)
bool lcl_extractHoriOrient(std::vector<beans::PropertyValue>& rFrameProperties, sal_Int32& nHoriOrient)
{ {
// Shifts the frame left by the given value. // Shifts the frame left by the given value.
for (size_t i = 0; i < rFrameProperties.size(); ++i) for (size_t i = 0; i < rFrameProperties.size(); ++i)
{ {
if (rFrameProperties[i].Name == "HoriOrient") if (rFrameProperties[i].Name == "HoriOrient")
{ {
nHoriOrient = rFrameProperties[i].Value.get<sal_Int32>(); sal_Int32 nValue = rFrameProperties[i].Value.get<sal_Int32>();
return true; if (nValue != text::HoriOrientation::NONE)
nHoriOrient = nValue;
return;
} }
} }
return false; }
} }
void lcl_DecrementHoriOrientPosition(std::vector<beans::PropertyValue>& rFrameProperties, sal_Int32 nAmount) void lcl_DecrementHoriOrientPosition(std::vector<beans::PropertyValue>& rFrameProperties, sal_Int32 nAmount)
......
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