summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin Luth <justin.luth@collabora.com>2018-08-25 22:22:55 +0300
committerAndras Timar <andras.timar@collabora.com>2018-09-12 10:13:00 +0200
commitae30aa3ae49fca79d1989bb6df25cbbf80bec414 (patch)
tree696982a2cab38d3e60d390188886171f71c636ad
parent6636362374fc0f0a3dee7f33e5042d840277391e (diff)
tdf#82177 docx export: no inside borders on outside cells
Well, not on the bottom or right outside cells. Obviously the presence of a bottom or a right in those cases doesn't indicate an inside line. Reviewed-on: https://gerrit.libreoffice.org/59600 Tested-by: Jenkins Reviewed-by: Justin Luth <justin_luth@sil.org> Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> (cherry picked from commit cecf71c18da5430c10daa8522d38d5144edefc14) Change-Id: I5d0661fd60f478a392b12fe9093c2e47e130631b
-rw-r--r--sw/qa/extras/ooxmlexport/data/tdf82177_outsideCellBorders.docxbin0 -> 8990 bytes
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport11.cxx10
-rw-r--r--sw/source/filter/ww8/WW8TableInfo.cxx4
-rw-r--r--sw/source/filter/ww8/WW8TableInfo.hxx1
-rw-r--r--sw/source/filter/ww8/docxattributeoutput.cxx17
5 files changed, 27 insertions, 5 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/tdf82177_outsideCellBorders.docx b/sw/qa/extras/ooxmlexport/data/tdf82177_outsideCellBorders.docx
new file mode 100644
index 000000000000..75c9a656da06
--- /dev/null
+++ b/sw/qa/extras/ooxmlexport/data/tdf82177_outsideCellBorders.docx
Binary files differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
index f9c6524cafe8..ca518d554a29 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
@@ -344,6 +344,16 @@ DECLARE_OOXMLEXPORT_TEST(testTdf112118_DOCX, "tdf112118.docx")
}
}
+DECLARE_OOXMLEXPORT_TEST(testTdf82177_outsideCellBorders, "tdf82177_outsideCellBorders.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 );
+ uno::Reference< table::XCell > xCell = xTable->getCellByName( "E4" );
+ CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt32>(0), getProperty<table::BorderLine2>(xCell, "TopBorder").LineWidth);
+ CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt32>(0), getProperty<table::BorderLine2>(xCell, "LeftBorder").LineWidth);
+}
+
DECLARE_OOXMLEXPORT_TEST(testTdf119143, "tdf119143.docx")
{
// The runs inside <w:dir> were ignored
diff --git a/sw/source/filter/ww8/WW8TableInfo.cxx b/sw/source/filter/ww8/WW8TableInfo.cxx
index 00f55e075424..71fb8d1cd4d7 100644
--- a/sw/source/filter/ww8/WW8TableInfo.cxx
+++ b/sw/source/filter/ww8/WW8TableInfo.cxx
@@ -119,6 +119,10 @@ void WW8TableNodeInfoInner::setRect(const SwRect & rRect)
maRect = rRect;
}
+bool WW8TableNodeInfoInner::isFinalRow() const
+{
+ return mpTable && mpTable->GetTabLines().size() - 1 == mnRow;
+}
const SwNode * WW8TableNodeInfoInner::getNode() const
{
diff --git a/sw/source/filter/ww8/WW8TableInfo.hxx b/sw/source/filter/ww8/WW8TableInfo.hxx
index a3b6df799180..f2a2db21806a 100644
--- a/sw/source/filter/ww8/WW8TableInfo.hxx
+++ b/sw/source/filter/ww8/WW8TableInfo.hxx
@@ -94,6 +94,7 @@ public:
bool isEndOfCell() const { return mbEndOfCell;}
bool isEndOfLine() const { return mbEndOfLine;}
bool isFinalEndOfLine() const { return mbFinalEndOfLine;}
+ bool isFinalRow() const;
bool isFirstInTable() const { return mbFirstInTable;}
const SwTableBox * getTableBox() const { return mpTableBox;}
const SwTable * getTable() const { return mpTable;}
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index 8f69ab6b2e27..5ada807693dc 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -3044,8 +3044,13 @@ static OutputBorderOptions lcl_getBoxBorderOptions()
return rOptions;
}
-static void impl_borders( FSHelperPtr const & pSerializer, const SvxBoxItem& rBox, const OutputBorderOptions& rOptions,
- std::map<SvxBoxItemLine, css::table::BorderLine2> &rTableStyleConf )
+static void impl_borders( FSHelperPtr const & pSerializer,
+ const SvxBoxItem& rBox,
+ const OutputBorderOptions& rOptions,
+ std::map<SvxBoxItemLine,
+ css::table::BorderLine2> &rTableStyleConf,
+ const bool bIsLastColumn = false,
+ const bool bIsLastRow = false )
{
static const SvxBoxItemLine aBorders[] =
{
@@ -3137,14 +3142,14 @@ static void impl_borders( FSHelperPtr const & pSerializer, const SvxBoxItem& rBo
bWriteInsideV = true;
}
}
- if (bWriteInsideH)
+ if (bWriteInsideH && !bIsLastRow)
{
const table::BorderLine2 *aStyleProps = nullptr;
if( rTableStyleConf.find( SvxBoxItemLine::BOTTOM ) != rTableStyleConf.end() )
aStyleProps = &rTableStyleConf[ SvxBoxItemLine::BOTTOM ];
impl_borderLine( pSerializer, XML_insideH, rBox.GetLine(SvxBoxItemLine::BOTTOM), 0, false, aStyleProps );
}
- if (bWriteInsideV)
+ if (bWriteInsideV && !bIsLastColumn)
{
const table::BorderLine2 *aStyleProps = nullptr;
if( rTableStyleConf.find( SvxBoxItemLine::RIGHT ) != rTableStyleConf.end() )
@@ -3213,6 +3218,8 @@ void DocxAttributeOutput::TableCellProperties( ww8::WW8TableNodeInfoInner::Point
const SwTableBox *pTableBox = pTableTextNodeInfoInner->getTableBox( );
bool bEcma = GetExport().GetFilter().getVersion( ) == oox::core::ECMA_DIALECT;
+ const bool bIsLastColumn = pTableTextNodeInfoInner->isEndOfLine();
+ const bool bIsLastRow = pTableTextNodeInfoInner->isFinalRow();
// Output any table cell redlines if there are any attached to this specific cell
TableCellRedline( pTableTextNodeInfoInner );
@@ -3272,7 +3279,7 @@ void DocxAttributeOutput::TableCellProperties( ww8::WW8TableNodeInfoInner::Point
const SvxBoxItem& rDefaultBox = (*tableFirstCells.rbegin())->getTableBox( )->GetFrameFormat( )->GetBox( );
{
// The cell borders
- impl_borders( m_pSerializer, rBox, lcl_getTableCellBorderOptions(bEcma), m_aTableStyleConf );
+ impl_borders( m_pSerializer, rBox, lcl_getTableCellBorderOptions(bEcma), m_aTableStyleConf, bIsLastColumn, bIsLastRow );
}
TableBackgrounds( pTableTextNodeInfoInner );