diff options
author | Miklos Vajna <vmiklos@collabora.com> | 2020-02-03 17:21:32 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2020-02-03 22:44:01 +0100 |
commit | 2d87b09e6e675dd593e26cb266deb4ea91f0e7a7 (patch) | |
tree | 2eab43b08a11e565da3850a9c156bcc3d7f89b39 /sw/source | |
parent | 61e23146987b49617af29c745b427905752e0b16 (diff) |
DOCX export: fix table style config handling wrt nested tables
The bugdoc had 2 tables: both using the TableGrid table style, but one
had a direct formatting to disable all borders. The second was in the A1
cell of the first, and given that the table style config state was not
separated for nested tables, the border settings of the inner table
affected the settings of the later cells of the outer table.
Change-Id: Ie7897bc661d9f47ca9f5c1b3ed1c439ef0406037
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87899
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
Diffstat (limited to 'sw/source')
-rw-r--r-- | sw/source/filter/ww8/docxattributeoutput.cxx | 21 | ||||
-rw-r--r-- | sw/source/filter/ww8/docxattributeoutput.hxx | 2 |
2 files changed, 15 insertions, 8 deletions
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index bab586264976..53fa35acfe52 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -3491,7 +3491,8 @@ 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_aTableStyleConfs.back()); } TableBackgrounds( pTableTextNodeInfoInner ); @@ -3530,6 +3531,8 @@ void DocxAttributeOutput::InitTableHelper( ww8::WW8TableNodeInfoInner::Pointer_t void DocxAttributeOutput::StartTable( ww8::WW8TableNodeInfoInner::Pointer_t const & pTableTextNodeInfoInner ) { + m_aTableStyleConfs.push_back({}); + // In case any paragraph SDT's are open, close them here. EndParaSdtBlock(); @@ -3563,7 +3566,7 @@ void DocxAttributeOutput::EndTable() // Cleans the table helper m_xTableWrt.reset(); - m_aTableStyleConf.clear(); + m_aTableStyleConfs.pop_back(); } void DocxAttributeOutput::StartTableRow( ww8::WW8TableNodeInfoInner::Pointer_t const & pTableTextNodeInfoInner ) @@ -3797,7 +3800,8 @@ void DocxAttributeOutput::TableDefinition( ww8::WW8TableNodeInfoInner::Pointer_t // We should clear the TableStyle map. In case of Table inside multiple tables it contains the // table border style of the previous table. - m_aTableStyleConf.clear(); + std::map<SvxBoxItemLine, css::table::BorderLine2>& rTableStyleConf = m_aTableStyleConfs.back(); + rTableStyleConf.clear(); // Extract properties from grab bag for( const auto & rGrabBagElement : aGrabBag ) @@ -3808,13 +3812,16 @@ void DocxAttributeOutput::TableDefinition( ww8::WW8TableNodeInfoInner::Pointer_t m_pSerializer->singleElementNS(XML_w, XML_tblStyle, FSNS(XML_w, XML_val), sStyleName); } else if( rGrabBagElement.first == "TableStyleTopBorder" ) - m_aTableStyleConf[ SvxBoxItemLine::TOP ] = rGrabBagElement.second.get<table::BorderLine2>(); + rTableStyleConf[SvxBoxItemLine::TOP] = rGrabBagElement.second.get<table::BorderLine2>(); else if( rGrabBagElement.first == "TableStyleBottomBorder" ) - m_aTableStyleConf[ SvxBoxItemLine::BOTTOM ] = rGrabBagElement.second.get<table::BorderLine2>(); + rTableStyleConf[SvxBoxItemLine::BOTTOM] + = rGrabBagElement.second.get<table::BorderLine2>(); else if( rGrabBagElement.first == "TableStyleLeftBorder" ) - m_aTableStyleConf[ SvxBoxItemLine::LEFT ] = rGrabBagElement.second.get<table::BorderLine2>(); + rTableStyleConf[SvxBoxItemLine::LEFT] + = rGrabBagElement.second.get<table::BorderLine2>(); else if( rGrabBagElement.first == "TableStyleRightBorder" ) - m_aTableStyleConf[ SvxBoxItemLine::RIGHT ] = rGrabBagElement.second.get<table::BorderLine2>(); + rTableStyleConf[SvxBoxItemLine::RIGHT] + = rGrabBagElement.second.get<table::BorderLine2>(); else if (rGrabBagElement.first == "TableStyleLook") { FastAttributeList* pAttributeList = FastSerializerHelper::createAttrList(); diff --git a/sw/source/filter/ww8/docxattributeoutput.hxx b/sw/source/filter/ww8/docxattributeoutput.hxx index f13c49e34f47..05761c426abe 100644 --- a/sw/source/filter/ww8/docxattributeoutput.hxx +++ b/sw/source/filter/ww8/docxattributeoutput.hxx @@ -971,7 +971,7 @@ private: /// Currently paragraph SDT has a <w:id> child element. bool m_bParagraphSdtHasId; - std::map<SvxBoxItemLine, css::table::BorderLine2> m_aTableStyleConf; + std::vector<std::map<SvxBoxItemLine, css::table::BorderLine2>> m_aTableStyleConfs; public: DocxAttributeOutput( DocxExport &rExport, const ::sax_fastparser::FSHelperPtr& pSerializer, oox::drawingml::DrawingML* pDrawingML ); |