summaryrefslogtreecommitdiff
path: root/sw/source/filter/ww8/rtfattributeoutput.cxx
diff options
context:
space:
mode:
authorJustin Luth <justin_luth@sil.org>2018-08-18 11:41:35 +0300
committerMiklos Vajna <vmiklos@collabora.co.uk>2018-08-27 17:52:37 +0200
commit1a4bc964f15003c6aaec84989e3e47501b7f72df (patch)
treef2a144aea8d9d9fb1c74bffd2724d3df8d51e581 /sw/source/filter/ww8/rtfattributeoutput.cxx
parentcc2f7944c2f058038bb4c54a592681f2413cd865 (diff)
tdf#116436 rtf export: add missing table background fill
MS formats only have support for Table and Cell fill. Interestingly, MS Word doesn't let the cells inherit from the Table fill setting, so that value also needs to be written out into every cell. Since Word apparently ignores the table color, I didn't bother trying to search out how to export that in RTF format. (I did add it to DOCX since it was so easy to find.) Change-Id: I7fe7723fb1603bc60608762aea79ff3b8122e073 Reviewed-on: https://gerrit.libreoffice.org/59282 Tested-by: Jenkins Reviewed-by: Justin Luth <justin_luth@sil.org> Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Diffstat (limited to 'sw/source/filter/ww8/rtfattributeoutput.cxx')
-rw-r--r--sw/source/filter/ww8/rtfattributeoutput.cxx28
1 files changed, 23 insertions, 5 deletions
diff --git a/sw/source/filter/ww8/rtfattributeoutput.cxx b/sw/source/filter/ww8/rtfattributeoutput.cxx
index 09241ae57b26..86bbb4201a2d 100644
--- a/sw/source/filter/ww8/rtfattributeoutput.cxx
+++ b/sw/source/filter/ww8/rtfattributeoutput.cxx
@@ -726,6 +726,21 @@ void RtfAttributeOutput::TableDefaultBorders(
void RtfAttributeOutput::TableBackgrounds(
ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner)
{
+ const SwTable* pTable = pTableTextNodeInfoInner->getTable();
+ const SwTableBox* pTableBox = pTableTextNodeInfoInner->getTableBox();
+ const SwTableLine* pTableLine = pTableBox->GetUpper();
+
+ Color aColor = COL_AUTO;
+ const SvxBrushItem* pTableColorProp
+ = pTable->GetFrameFormat()->GetAttrSet().GetItem<SvxBrushItem>(RES_BACKGROUND);
+ if (pTableColorProp)
+ aColor = pTableColorProp->GetColor();
+
+ const SvxBrushItem* pRowColorProp
+ = pTableLine->GetFrameFormat()->GetAttrSet().GetItem<SvxBrushItem>(RES_BACKGROUND);
+ if (pRowColorProp && pRowColorProp->GetColor() != COL_AUTO)
+ aColor = pRowColorProp->GetColor();
+
const SwWriteTableRows& aRows = m_pTableWrt->GetRows();
SwWriteTableRow* pRow = aRows[pTableTextNodeInfoInner->getRow()];
const SwWriteTableCell* const pCell
@@ -735,11 +750,14 @@ void RtfAttributeOutput::TableBackgrounds(
if (pCellFormat->GetAttrSet().HasItem(RES_BACKGROUND, &pItem))
{
auto& rBack = static_cast<const SvxBrushItem&>(*pItem);
- if (!rBack.GetColor().GetTransparency())
- {
- m_aRowDefs.append(OOO_STRING_SVTOOLS_RTF_CLCBPAT);
- m_aRowDefs.append(static_cast<sal_Int32>(m_rExport.GetColor(rBack.GetColor())));
- }
+ if (rBack.GetColor() != COL_AUTO)
+ aColor = rBack.GetColor();
+ }
+
+ if (!aColor.GetTransparency())
+ {
+ m_aRowDefs.append(OOO_STRING_SVTOOLS_RTF_CLCBPAT);
+ m_aRowDefs.append(static_cast<sal_Int32>(m_rExport.GetColor(aColor)));
}
}