summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin Luth <justin.luth@collabora.com>2020-04-22 13:44:33 +0300
committerMiklos Vajna <vmiklos@collabora.com>2020-04-24 10:06:39 +0200
commitaa12bf1a82fafef9a415659f21f2859169d7cba4 (patch)
treed258842c0b44d9dcd7d1965611ccfc99d3e50aec
parent7e82d7bf88f63b1dcd9da939904330054fc426f6 (diff)
NFC ww8export: fix outright lies and false insinuations
and other general cleanup related to tdf#98409 - see proof example there. The outright lie is that cell border defaults come from the first row and the first column. Instead, margins actually are defined for each row, and come from the last column. And there are no defaults for the border lines themselves. The insinuation is that these are table level settings that only should occur once, but most of them are per-row settings and all of them happen repeatedly. The three functions that appear to repeat table level definitions probably should run only once, but that is likely tricky to do with table-in-table situations, so no intention to do that here in a NoFunctionalChange patch. Change-Id: I9fa60902389668256b147df6bf9a2e972cf9174a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92700 Tested-by: Jenkins Reviewed-by: Justin Luth <justin_luth@sil.org> Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
-rw-r--r--sw/source/filter/ww8/wrtww8.cxx25
-rw-r--r--sw/source/filter/ww8/ww8atr.cxx7
2 files changed, 19 insertions, 13 deletions
diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx
index 84bf1a645531..6f5d843a2db9 100644
--- a/sw/source/filter/ww8/wrtww8.cxx
+++ b/sw/source/filter/ww8/wrtww8.cxx
@@ -2043,16 +2043,19 @@ void WW8AttributeOutput::TableInfoRow( ww8::WW8TableNodeInfoInner::Pointer_t pTa
m_rWW8Export.pO->push_back( sal_uInt8(0x1) );
}
- TableDefinition( pTableTextNodeInfoInner );
- TableHeight( pTableTextNodeInfoInner );
- TableBackgrounds( pTableTextNodeInfoInner );
- TableDefaultBorders( pTableTextNodeInfoInner );
- TableCanSplit( pTableTextNodeInfoInner );
+ // Most of these are per-row definitions, not per-table,
+ // so likely some the per-table functions are unnecessarily re-defined...
TableBidi( pTableTextNodeInfoInner );
- TableVerticalCell( pTableTextNodeInfoInner );
TableOrientation( pTableTextNodeInfoInner );
TableSpacing( pTableTextNodeInfoInner );
- TableCellBorders( pTableTextNodeInfoInner );
+ TableDefinition( pTableTextNodeInfoInner ); //per row definitions
+ TableHeight( pTableTextNodeInfoInner ); //per row definitions
+ TableBackgrounds( pTableTextNodeInfoInner ); //per row definitions
+ // Since this isEndOfLine, cell margin defaults for each row come from last column.
+ TableDefaultBorders( pTableTextNodeInfoInner ); //per row definitions
+ TableCanSplit( pTableTextNodeInfoInner ); //per row definitions
+ TableVerticalCell( pTableTextNodeInfoInner ); //per row definitions
+ TableCellBorders( pTableTextNodeInfoInner ); //per row definitions
}
}
}
@@ -2526,20 +2529,22 @@ void AttributeOutputBase::GetTablePageSize( ww8::WW8TableNodeInfoInner const * p
void WW8AttributeOutput::TableDefaultBorders( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner )
{
+ // This function name is misleading because it is not a table default, but a row default,
+ // and it also only sets default cell margins (aka border padding).
+ // The specs suggest there is no way to define default border lines/colors.
const SwTableBox * pTabBox = pTableTextNodeInfoInner->getTableBox();
const SwFrameFormat * pFrameFormat = pTabBox->GetFrameFormat();
- //Set Default, just taken from the first cell of the first
- //row
static const SvxBoxItemLine aBorders[] =
{
SvxBoxItemLine::TOP, SvxBoxItemLine::LEFT,
SvxBoxItemLine::BOTTOM, SvxBoxItemLine::RIGHT
};
+ // Set row default cell margins using this last cell in the row
for ( int i = 0; i < 4; ++i )
{
- SwWW8Writer::InsUInt16( *m_rWW8Export.pO, 0xD634 );
+ SwWW8Writer::InsUInt16( *m_rWW8Export.pO, NS_sprm::sprmTCellPaddingDefault );
m_rWW8Export.pO->push_back( sal_uInt8(6) );
m_rWW8Export.pO->push_back( sal_uInt8(0) );
m_rWW8Export.pO->push_back( sal_uInt8(1) );
diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx
index 51475ef1490a..3fb3cae37d6e 100644
--- a/sw/source/filter/ww8/ww8atr.cxx
+++ b/sw/source/filter/ww8/ww8atr.cxx
@@ -4512,6 +4512,9 @@ void WW8Export::Out_SwFormatTableBox( ww::bytes& rO, const SvxBoxItem * pBox )
void WW8Export::Out_CellRangeBorders( const SvxBoxItem * pBox, sal_uInt8 nStart,
sal_uInt8 nLimit )
{
+ if ( !pBox )
+ return;
+
static const SvxBoxItemLine aBorders[] =
{
SvxBoxItemLine::TOP, SvxBoxItemLine::LEFT, SvxBoxItemLine::BOTTOM, SvxBoxItemLine::RIGHT
@@ -4519,9 +4522,7 @@ void WW8Export::Out_CellRangeBorders( const SvxBoxItem * pBox, sal_uInt8 nStart,
for( int i = 0; i < 4; ++i )
{
- const SvxBorderLine* pLn = nullptr;
- if (pBox != nullptr)
- pLn = pBox->GetLine( aBorders[i] );
+ const SvxBorderLine* pLn = pBox->GetLine( aBorders[i] );
if (!pLn)
continue;