diff options
author | Miklos Vajna <vmiklos@collabora.com> | 2021-03-19 16:27:28 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2021-03-20 09:02:31 +0100 |
commit | 6fa6e19fdca29752492a5230b2a948075a347c87 (patch) | |
tree | 9380a6f667c096ff1acb3917fe14e7cce3c95d58 /sw | |
parent | ea004488f6d55eaebe58c595ac53392bf936b5e4 (diff) |
ODT export: handle style name of covered cells
This is the export side of commit
1001dbaef4dec2b51c25ed8343bab6910f1219e1 (ODT import: handle style name
of covered cells, 2021-03-19). We already exported the autostyle, but
<table:covered-table-cell> did not refer to it.
This is useful when the covering and the covered table cells have
different border settings.
Change-Id: I7773903fa62f53686f000473f7a03c68dd77602a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112758
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
Diffstat (limited to 'sw')
-rw-r--r-- | sw/qa/extras/odfimport/odfimport.cxx | 10 | ||||
-rw-r--r-- | sw/source/filter/xml/xmltble.cxx | 11 |
2 files changed, 21 insertions, 0 deletions
diff --git a/sw/qa/extras/odfimport/odfimport.cxx b/sw/qa/extras/odfimport/odfimport.cxx index ac7e34a9ebdd..f6e657721f1c 100644 --- a/sw/qa/extras/odfimport/odfimport.cxx +++ b/sw/qa/extras/odfimport/odfimport.cxx @@ -1180,6 +1180,16 @@ CPPUNIT_TEST_FIXTURE(Test, testVerticallyMergedCellBorder) // right border, even if <table:covered-table-cell table:style-name="..."> explicitly disabled // it. CPPUNIT_ASSERT(!rA2Set.GetBox().GetRight()); + + // Given this document model, when exporting to ODT: + save("writer8", maTempFile); + mbExported = true; + + // Then make sure the covered cell has a style. + xmlDocUniquePtr pXmlSettings = parseExport("content.xml"); + // Without the accompanying fix in place, this test would have failed with: + // - In <...>, XPath '//table:covered-table-cell' no attribute 'style-name' exist + assertXPath(pXmlSettings, "//table:covered-table-cell", "style-name", "Table1.A2"); } CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sw/source/filter/xml/xmltble.cxx b/sw/source/filter/xml/xmltble.cxx index ad79a92e3732..fb3674c955d0 100644 --- a/sw/source/filter/xml/xmltble.cxx +++ b/sw/source/filter/xml/xmltble.cxx @@ -924,6 +924,17 @@ void SwXMLExport::ExportTableLine( const SwTableLine& rLine, const sal_Int32 nRowSpan = pBox->getRowSpan(); if( nRowSpan < 1 ) { + // Export style of covered cell, it includes border information. + const SwFrameFormat* pFormat = pBox->GetFrameFormat(); + if (pFormat) + { + const OUString& sName = pFormat->GetName(); + if (!sName.isEmpty()) + { + AddAttribute(XML_NAMESPACE_TABLE, XML_STYLE_NAME, EncodeStyleName(sName)); + } + } + SvXMLElementExport aElem2( *this, rTableInfo.GetPrefix(), XML_COVERED_TABLE_CELL, true, false ); |