tdf#126395 writerfilter: don't guess table direction
Wihtout specifying a direction, TextToTable is going
to guess. Well, import isn't a guessing game,
and there is a default value for something unspecified.
Perhaps specifying LR_TB would be better,
but we'll try with CONTEXT first,
since it is a LO default.
Existing unit tests (not affected)
Both ooxmlexport and rtfexport have a table-rtf test
which ensure bidiVisual is properly applied to tables.
Change-Id: I1cabf518937e57dd757aca75ae5d2527c61fa736
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136673
Tested-by: Jenkins
Reviewed-by: Justin Luth <jluth@mail.com>
diff --git a/sw/qa/extras/ooxmlexport/data/table-ltr.docx b/sw/qa/extras/ooxmlexport/data/table-ltr.docx
new file mode 100644
index 0000000..d627b81
--- /dev/null
+++ b/sw/qa/extras/ooxmlexport/data/table-ltr.docx
Binary files differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index 5cd096e..c102902 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -718,6 +718,15 @@ DECLARE_OOXMLEXPORT_TEST(testTableRtl, "table-rtl.docx")
CPPUNIT_ASSERT_EQUAL(text::WritingMode2::RL_TB, getProperty<sal_Int16>(xTable, "WritingMode"));
}
DECLARE_OOXMLEXPORT_TEST(testTableLr, "table-ltr.docx")
{
uno::Reference<text::XTextTablesSupplier> xTablesSupplier(mxComponent, uno::UNO_QUERY);
uno::Reference<container::XIndexAccess> xTables(xTablesSupplier->getTextTables(), uno::UNO_QUERY);
uno::Reference<text::XTextTable> xTable(xTables->getByIndex(0), uno::UNO_QUERY);
// This was text::WritingMode2::RL_TB, i.e. direction of the table was wrongly guessed.
CPPUNIT_ASSERT_EQUAL(text::WritingMode2::CONTEXT, getProperty<sal_Int16>(xTable, "WritingMode"));
}
DECLARE_OOXMLEXPORT_TEST(testOoxmlCjklist30, "cjklist30.docx")
{
sal_Int16 numFormat = getNumberingTypeOfParagraph(1);
diff --git a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
index d0c4257..774cba78 100644
--- a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
+++ b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
@@ -33,6 +33,7 @@
#include <com/sun/star/text/HoriOrientation.hpp>
#include <com/sun/star/text/SizeType.hpp>
#include <com/sun/star/text/TextContentAnchorType.hpp>
#include <com/sun/star/text/WritingMode2.hpp>
#include <com/sun/star/text/XTextField.hpp>
#include <com/sun/star/text/XTextRangeCompare.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
@@ -666,6 +667,9 @@ TableStyleSheetEntry * DomainMapperTableHandler::endTableGetTableStyle(TableInfo
m_aTableProperties->Insert( PROP_HORI_ORIENT, uno::Any( sal_Int16(nHoriOrient) ) );
//fill default value - if not available
m_aTableProperties->Insert( PROP_HEADER_ROW_COUNT, uno::Any( sal_Int32(0)), false);
m_aTableProperties->Insert(PROP_WRITING_MODE,
uno::Any(sal_Int16(text::WritingMode2::CONTEXT)),
/*bOverWrite=*/false);
// if table is only a single row, and row is set as don't split, set the same value for the whole table.
if( m_aRowProperties.size() == 1 && m_aRowProperties[0] )