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

tdf#82553 DOCX import: handle table margin when converting floattables

Change-Id: I7a3a233a34453153b3e1c0fe3d60bb0ede65dc86
üst f89deaaf
......@@ -2707,6 +2707,15 @@ DECLARE_OOXMLIMPORT_TEST(mathtype, "mathtype.docx")
CPPUNIT_ASSERT(xModel->supportsService("com.sun.star.formula.FormulaProperties"));
}
DECLARE_OOXMLIMPORT_TEST(testTdf8255, "tdf8255.docx")
{
uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY);
uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(xTextDocument, uno::UNO_QUERY);
uno::Reference<drawing::XDrawPage> xDrawPage = xDrawPageSupplier->getDrawPage();
// This was 1: a full-page-wide multi-page floating table was imported as a TextFrame.
CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0), xDrawPage->getCount());
}
#endif
CPPUNIT_PLUGIN_IMPLEMENT();
......
......@@ -1029,6 +1029,16 @@ void SectionPropertyMap::CloseSectionGroup( DomainMapper_Impl& rDM_Impl )
for (size_t i = 0; i < rPendingFloatingTables.size(); ++i)
{
FloatingTableInfo& rInfo = rPendingFloatingTables[i];
// Count the layout width of the table.
sal_Int32 nTableWidth = rInfo.m_nTableWidth;
sal_Int32 nLeftMargin = 0;
if (rInfo.getPropertyValue("LeftMargin") >>= nLeftMargin)
nTableWidth += nLeftMargin;
sal_Int32 nRightMargin = 0;
if (rInfo.getPropertyValue("RightMargin") >>= nRightMargin)
nTableWidth += nRightMargin;
// If the table is wider than the text area, then don't create a fly
// for the table: no wrapping will be performed anyway, but multi-page
// tables will be broken.
......@@ -1037,7 +1047,7 @@ void SectionPropertyMap::CloseSectionGroup( DomainMapper_Impl& rDM_Impl )
// If there are columns, always create the fly, otherwise the columns would
// restrict geometry of the table.
if ( ( rInfo.getPropertyValue("HoriOrientRelation") == text::RelOrientation::PAGE_FRAME ) ||
( rInfo.m_nTableWidth < nTextAreaWidth ) || ColumnCount() + 1 >= 2 )
nTableWidth < nTextAreaWidth || ColumnCount() + 1 >= 2 )
xBodyText->convertToTextFrame(rInfo.m_xStart, rInfo.m_xEnd, rInfo.m_aFrameProperties);
}
rPendingFloatingTables.clear();
......
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