[Libreoffice-commits] core.git: sw/qa sw/source
Miklos Vajna (via logerrit)
logerrit at kemper.freedesktop.org
Sat Mar 20 08:03:13 UTC 2021
sw/qa/extras/odfimport/odfimport.cxx | 10 ++++++++++
sw/source/filter/xml/xmltble.cxx | 11 +++++++++++
2 files changed, 21 insertions(+)
New commits:
commit 6fa6e19fdca29752492a5230b2a948075a347c87
Author: Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Fri Mar 19 16:27:28 2021 +0100
Commit: Miklos Vajna <vmiklos at collabora.com>
CommitDate: Sat Mar 20 09:02:31 2021 +0100
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 at collabora.com>
Tested-by: Jenkins
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 );
More information about the Libreoffice-commits
mailing list