[Libreoffice-commits] core.git: sw/qa sw/source
Justin Luth (via logerrit)
logerrit at kemper.freedesktop.org
Mon Mar 30 07:38:14 UTC 2020
sw/qa/extras/ww8export/data/tdf80635_marginLeft.doc |binary
sw/qa/extras/ww8export/data/tdf80635_pageLeft.doc |binary
sw/qa/extras/ww8export/ww8export2.cxx | 22 +++++++++++++++++++-
sw/source/filter/ww8/ww8par2.cxx | 17 ++++++++++++---
4 files changed, 35 insertions(+), 4 deletions(-)
New commits:
commit ba989a99ea19ffd0aafeea01f9b737ea79fa952a
Author: Justin Luth <justin.luth at collabora.com>
AuthorDate: Fri Mar 27 08:09:29 2020 +0300
Commit: Miklos Vajna <vmiklos at collabora.com>
CommitDate: Mon Mar 30 09:37:35 2020 +0200
tdf#80635 ww8import:3 take float table orient to inlined table
Since SW has problems with floating tables, any unnecessarily
floated tables are converted to inline. However, the
positioning of the tables is mostly lost. So the choice is
either to refuse to inline a strangely positioned table
or else to transfer the positioning onto the inlined table.
For absolutely positioned flies, which are LEFT_AND_WIDTH,
pass the X position to the left margin.
Change-Id: I996a06c753e8b9b1151f7deea8ad4caf5724dd0d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91273
Tested-by: Jenkins
Reviewed-by: Justin Luth <justin_luth at sil.org>
Reviewed-by: Miklos Vajna <vmiklos at collabora.com>
diff --git a/sw/qa/extras/ww8export/data/tdf80635_marginLeft.doc b/sw/qa/extras/ww8export/data/tdf80635_marginLeft.doc
new file mode 100644
index 000000000000..ad70ff641076
Binary files /dev/null and b/sw/qa/extras/ww8export/data/tdf80635_marginLeft.doc differ
diff --git a/sw/qa/extras/ww8export/data/tdf80635_pageLeft.doc b/sw/qa/extras/ww8export/data/tdf80635_pageLeft.doc
new file mode 100644
index 000000000000..16f32e3e3bca
Binary files /dev/null and b/sw/qa/extras/ww8export/data/tdf80635_pageLeft.doc differ
diff --git a/sw/qa/extras/ww8export/ww8export2.cxx b/sw/qa/extras/ww8export/ww8export2.cxx
index 4672b750baa3..42cc8237b873 100644
--- a/sw/qa/extras/ww8export/ww8export2.cxx
+++ b/sw/qa/extras/ww8export/ww8export2.cxx
@@ -259,7 +259,7 @@ DECLARE_WW8EXPORT_TEST(testTdf80635_pageRightRTL, "tdf80635_pageRightRTL.doc")
uno::Reference<container::XIndexAccess> xTables(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY);
uno::Reference<text::XTextTable> xTable(xTables->getByIndex(0), uno::UNO_QUERY);
CPPUNIT_ASSERT_EQUAL_MESSAGE("Horizontal Orientation", text::HoriOrientation::LEFT_AND_WIDTH, getProperty<sal_Int16>(xTable, "HoriOrient"));
- //CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE("Table Indent", long(3500), getProperty<long>(xTable, "LeftMargin"), 100);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE("Table Indent", long(3500), getProperty<long>(xTable, "LeftMargin"), 100);
CPPUNIT_ASSERT_EQUAL_MESSAGE("Did you fix me? Text probably should wrap here", 2, getPages() );
// If so, replace test with the table set to a greater preferred width so that the text shouldn't wrap
}
@@ -274,6 +274,26 @@ DECLARE_WW8EXPORT_TEST(testTdf80635_marginRTL, "tdf80635_marginRightRTL.doc")
CPPUNIT_ASSERT_EQUAL_MESSAGE("Horizontal Orientation", text::HoriOrientation::RIGHT, getProperty<sal_Int16>(xTable, "HoriOrient"));
}
+DECLARE_WW8EXPORT_TEST(testTdf80635_marginLeft, "tdf80635_marginLeft.doc")
+{
+ // tdf#80635 - transfer the float orientation to the table.
+ uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY);
+ uno::Reference<container::XIndexAccess> xTables(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY);
+ uno::Reference<text::XTextTable> xTable(xTables->getByIndex(0), uno::UNO_QUERY);
+ // This was just the GetMinLeft of -199
+ CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE("Table Indent", long(-2950), getProperty<long>(xTable, "LeftMargin"), 100);
+}
+
+DECLARE_WW8EXPORT_TEST(testTdf80635_pageLeft, "tdf80635_pageLeft.doc")
+{
+ // tdf#80635 - transfer the float orientation to the table.
+ uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY);
+ uno::Reference<container::XIndexAccess> xTables(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY);
+ uno::Reference<text::XTextTable> xTable(xTables->getByIndex(0), uno::UNO_QUERY);
+ // This was just the GetMinLeft of -199
+ CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE("Table Indent", long(-2750), getProperty<long>(xTable, "LeftMargin"), 100);
+}
+
DECLARE_WW8EXPORT_TEST(testTdf107773, "tdf107773.doc")
{
uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY);
diff --git a/sw/source/filter/ww8/ww8par2.cxx b/sw/source/filter/ww8/ww8par2.cxx
index 775dae384f6d..3f3ff253a44e 100644
--- a/sw/source/filter/ww8/ww8par2.cxx
+++ b/sw/source/filter/ww8/ww8par2.cxx
@@ -2425,6 +2425,7 @@ void WW8TabDesc::CreateSwTable()
// Because SW cannot handle multi-page floating frames,
// _any unnecessary_ floating tables have been converted to inline.
+ long nLeft = 0;
if ( m_pIo->m_xSFlyPara && !m_pIo->m_xSFlyPara->pFlyFormat )
{
// Get the table orientation from the fly
@@ -2436,6 +2437,17 @@ void WW8TabDesc::CreateSwTable()
m_eOri = text::HoriOrientation::LEFT_AND_WIDTH;
else if ( m_pIo->m_xSFlyPara->eHAlign != text::HoriOrientation::NONE )
m_eOri = m_pIo->m_xSFlyPara->eHAlign;
+ if ( m_eOri == text::HoriOrientation::LEFT_AND_WIDTH )
+ {
+ nLeft = m_pIo->m_xSFlyPara->nXPos;
+ if ( m_pIo->m_xSFlyPara->eHRel == text::RelOrientation::PAGE_FRAME )
+ {
+ if ( !m_bIsBiDi )
+ nLeft -= m_pIo->m_aSectionManager.GetPageLeft();
+ else
+ nLeft += m_pIo->m_aSectionManager.GetPageRight();
+ }
+ }
}
// The table is small: The number of columns is the lowest count of
@@ -2527,13 +2539,12 @@ void WW8TabDesc::CreateSwTable()
//ability to set the margin.
SvxLRSpaceItem aL( RES_LR_SPACE );
- long nLeft = 0;
if (!m_bIsBiDi)
- nLeft = GetMinLeft();
+ nLeft += GetMinLeft();
else
{
const short nTableWidth = m_nPreferredWidth ? m_nPreferredWidth : m_nSwWidth;
- nLeft = m_pIo->m_aSectionManager.GetTextAreaWidth();
+ nLeft += m_pIo->m_aSectionManager.GetTextAreaWidth();
nLeft = nLeft - nTableWidth - GetMinLeft();
}
aL.SetLeft(nLeft);
More information about the Libreoffice-commits
mailing list