[Libreoffice-commits] core.git: sw/qa sw/source
Miklos Vajna (via logerrit)
logerrit at kemper.freedesktop.org
Fri Apr 5 07:05:18 UTC 2019
sw/qa/extras/rtfexport/data/btlr-cell.rtf | 9 +++++++++
sw/qa/extras/rtfexport/rtfexport4.cxx | 18 ++++++++++++++++++
sw/source/filter/ww8/rtfattributeoutput.cxx | 7 +++++++
3 files changed, 34 insertions(+)
New commits:
commit b62bfda66c1499806bfa35c26fdc05f76f8a4db2
Author: Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Thu Apr 4 21:34:31 2019 +0200
Commit: Miklos Vajna <vmiklos at collabora.com>
CommitDate: Fri Apr 5 09:04:50 2019 +0200
sw btlr writing mode: implement RTF export
Note that we can't work with the table box (and frame format) of
pTableTextNodeInfoInner in RtfAttributeOutput::TableVerticalCell(). This
is because cell definitions are written in
RtfAttributeOutput::TableDefinition(), and the loop only calls
setCell(), i.e. the cell index is updated in the node info, but the
table box is not.
Import was already working as-is.
Change-Id: Ia089c42b3a49f1a8f012a8cadaa8bcad16128c3e
Reviewed-on: https://gerrit.libreoffice.org/70269
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos at collabora.com>
diff --git a/sw/qa/extras/rtfexport/data/btlr-cell.rtf b/sw/qa/extras/rtfexport/data/btlr-cell.rtf
new file mode 100644
index 000000000000..2a2117358cbb
--- /dev/null
+++ b/sw/qa/extras/rtfexport/data/btlr-cell.rtf
@@ -0,0 +1,9 @@
+{\rtf1
+\trowd\trrh1500\cltxbtlr\cellx3000\cellx6000\cltxtbrl\cellx9000
+\intbl
+AAA1.\par AAA2.\cell
+BBB1.\par BBB2.\cell
+CCC1.\par CCC2.\cell
+\pard \intbl\row
+\pard \par
+}
diff --git a/sw/qa/extras/rtfexport/rtfexport4.cxx b/sw/qa/extras/rtfexport/rtfexport4.cxx
index 4fb9eb3daeb5..5f327782df6b 100644
--- a/sw/qa/extras/rtfexport/rtfexport4.cxx
+++ b/sw/qa/extras/rtfexport/rtfexport4.cxx
@@ -132,6 +132,24 @@ DECLARE_RTFEXPORT_TEST(testCjklist38, "cjklist38.rtf")
CPPUNIT_ASSERT_EQUAL(style::NumberingType::NUMBER_UPPER_ZH, numFormat);
}
+DECLARE_RTFEXPORT_TEST(testBtlrCell, "btlr-cell.rtf")
+{
+ // Without the accompanying fix in place, this test would have failed, as
+ // the btlr text direction in the A1 cell was lost.
+ uno::Reference<text::XTextTablesSupplier> xSupplier(mxComponent, uno::UNO_QUERY);
+ uno::Reference<container::XNameAccess> xTables = xSupplier->getTextTables();
+ uno::Reference<text::XTextTable> xTable(xTables->getByName("Table1"), uno::UNO_QUERY);
+ uno::Reference<beans::XPropertySet> xA1(xTable->getCellByName("A1"), uno::UNO_QUERY);
+ CPPUNIT_ASSERT_EQUAL(text::WritingMode2::BT_LR, getProperty<sal_Int16>(xA1, "WritingMode"));
+
+ uno::Reference<beans::XPropertySet> xB1(xTable->getCellByName("B1"), uno::UNO_QUERY);
+ auto nActual = getProperty<sal_Int16>(xB1, "WritingMode");
+ CPPUNIT_ASSERT(nActual == text::WritingMode2::LR_TB || nActual == text::WritingMode2::CONTEXT);
+
+ uno::Reference<beans::XPropertySet> xC1(xTable->getCellByName("C1"), uno::UNO_QUERY);
+ CPPUNIT_ASSERT_EQUAL(text::WritingMode2::TB_RL, getProperty<sal_Int16>(xC1, "WritingMode"));
+}
+
CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/filter/ww8/rtfattributeoutput.cxx b/sw/source/filter/ww8/rtfattributeoutput.cxx
index 554fc7291a22..de0098a07fc4 100644
--- a/sw/source/filter/ww8/rtfattributeoutput.cxx
+++ b/sw/source/filter/ww8/rtfattributeoutput.cxx
@@ -847,6 +847,13 @@ void RtfAttributeOutput::TableVerticalCell(
const SwWriteTableCell* const pCell
= pRow->GetCells()[pTableTextNodeInfoInner->getCell()].get();
const SwFrameFormat* pCellFormat = pCell->GetBox()->GetFrameFormat();
+
+ // Text direction.
+ if (SvxFrameDirection::Vertical_RL_TB == m_rExport.TrueFrameDirection(*pCellFormat))
+ m_aRowDefs.append(OOO_STRING_SVTOOLS_RTF_CLTXTBRL);
+ else if (SvxFrameDirection::Vertical_LR_BT == m_rExport.TrueFrameDirection(*pCellFormat))
+ m_aRowDefs.append(OOO_STRING_SVTOOLS_RTF_CLTXBTLR);
+
const SfxPoolItem* pItem;
// vertical merges
More information about the Libreoffice-commits
mailing list