summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin Luth <justin_luth@sil.org>2018-09-26 10:23:20 +0300
committerJustin Luth <justin_luth@sil.org>2018-09-29 07:16:34 +0200
commit5d4c6ee89ef6302db08c23bbe2d3fb4d7de3b1a3 (patch)
treef7e4834b2a6d724d012d72c6630d5372dd3c3970
parent79761d6b64d31efdac61172ec4d9bf71197e462e (diff)
tdf#92026 docxexport: eliminate fake tblBorders
This patch depends on tdf#119760. The border was based on whatever cell A1 had, but that fake default was never passed to the cell's functions, so the table border definition served no purpose whatsoever. Cells had no idea whether they needed to override those default borders, and this was bad for non-borders, because then the default borders were assigned instead of none. The other option would be to properly fill m_aTableStyleConf, but that didn't seem valuable. Better, and less code churn, to just eliminate the function altogether. (Well, the empty function kept in place as a placeholder for someone who decides it could be useful to reduce the number of borders written out per cell.) Unit test fdo80097.docx's fix was just trying to prevent an invalid table border. Since that is still obviously true when no table border is defined, it is valid to just eliminate this part of the test. (Having a table definition wouldn't be invalid in the future, so I'm not testing for zero instances.) Change-Id: I983dbe120bfc3354fefd14bc95ac01abccea7ea8 Reviewed-on: https://gerrit.libreoffice.org/60989 Tested-by: Jenkins Reviewed-by: Justin Luth <justin_luth@sil.org>
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport11.cxx5
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport5.cxx11
-rw-r--r--sw/source/filter/ww8/docxattributeoutput.cxx27
3 files changed, 7 insertions, 36 deletions
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
index 933bd58b1071..db52d019439b 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
@@ -532,7 +532,10 @@ DECLARE_OOXMLEXPORT_TEST(testTdf82177_tblBorders, "tdf82177_tblBorders.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( "E5" );
+ uno::Reference< table::XCell > xCell = xTable->getCellByName( "A5" );
+ CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt32>(0), getProperty<table::BorderLine2>(xCell, "BottomBorder").LineWidth);
+ CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt32>(0), getProperty<table::BorderLine2>(xCell, "LeftBorder").LineWidth);
+ xCell.set(xTable->getCellByName( "E5" ));
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);
}
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx
index 858f20d0e3b9..401af06a6533 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx
@@ -669,17 +669,6 @@ DECLARE_OOXMLEXPORT_TEST(testfdo80097, "fdo80097.docx")
if (!pXmlDocument)
return;
- //Table Borders
- assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:tbl/w:tblPr/w:tblBorders/w:top[@w:val = 'single']",1);
- assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:tbl/w:tblPr/w:tblBorders/w:top[@w:sz = 4]", 1);
- assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:tbl/w:tblPr/w:tblBorders/w:top[@w:space = 0]", 1);
- assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:tbl/w:tblPr/w:tblBorders/w:top[@w:color = '000000']", 1);
-
- assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:tbl/w:tblPr/w:tblBorders/w:bottom[@w:val = 'single']",1);
- assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:tbl/w:tblPr/w:tblBorders/w:bottom[@w:sz = 4]", 1);
- assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:tbl/w:tblPr/w:tblBorders/w:bottom[@w:space = 0]", 1);
- assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:tbl/w:tblPr/w:tblBorders/w:bottom[@w:color = '000000']", 1);
-
//Table Cell Borders
assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:tbl/w:tr[1]/w:tc[1]/w:tcPr/w:tcBorders/w:top[@w:val = 'single']",1);
assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:tbl/w:tr[1]/w:tc[1]/w:tcPr/w:tcBorders/w:top[@w:sz = 4]", 1);
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index b3e4df7a5f1a..a39ba872cf04 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -3032,18 +3032,6 @@ static void impl_borderLine( FSHelperPtr const & pSerializer, sal_Int32 elementT
pSerializer->singleElementNS( XML_w, elementToken, xAttrs );
}
-static OutputBorderOptions lcl_getTableDefaultBorderOptions(bool bEcma)
-{
- OutputBorderOptions rOptions;
-
- rOptions.tag = XML_tblBorders;
- rOptions.bUseStartEnd = !bEcma;
- rOptions.bWriteTag = true;
- rOptions.bWriteDistance = false;
-
- return rOptions;
-}
-
static OutputBorderOptions lcl_getTableCellBorderOptions(bool bEcma)
{
OutputBorderOptions rOptions;
@@ -3780,19 +3768,10 @@ void DocxAttributeOutput::TableDefinition( ww8::WW8TableNodeInfoInner::Pointer_t
m_pSerializer->endElementNS( XML_w, XML_tblGrid );
}
-void DocxAttributeOutput::TableDefaultBorders( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner )
+void DocxAttributeOutput::TableDefaultBorders( ww8::WW8TableNodeInfoInner::Pointer_t /*pTableTextNodeInfoInner*/ )
{
- const SwTableBox * pTabBox = pTableTextNodeInfoInner->getTableBox();
- const SwFrameFormat * pFrameFormat = pTabBox->GetFrameFormat();
-
- bool bEcma = GetExport().GetFilter().getVersion( ) == oox::core::ECMA_DIALECT;
-
- // Don't write table defaults based on the top-left cell if we have a table style available.
- if (m_aTableStyleConf.empty())
- {
- // the defaults of the table are taken from the top-left cell
- impl_borders(m_pSerializer, pFrameFormat->GetBox(), lcl_getTableDefaultBorderOptions(bEcma), m_aTableStyleConf);
- }
+ // Table defaults should only be created IF m_aTableStyleConf contents haven't come from a table style.
+ // Previously this function wrote out Cell A1 as the table default, causing problems with no benefit.
}
void DocxAttributeOutput::TableDefaultCellMargins( ww8::WW8TableNodeInfoInner::Pointer_t const & pTableTextNodeInfoInner )