summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2021-03-19 16:27:28 +0100
committerMiklos Vajna <vmiklos@collabora.com>2021-03-22 10:31:00 +0100
commit4898eab739460448727da48d47f8837718317b70 (patch)
tree360733896ed14ee924e00a1da042491216ac57f2
parentODT import: handle style name of covered cells (diff)
downloadcore-4898eab739460448727da48d47f8837718317b70.tar.gz
core-4898eab739460448727da48d47f8837718317b70.zip
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. (cherry picked from commit 6fa6e19fdca29752492a5230b2a948075a347c87) Change-Id: I7773903fa62f53686f000473f7a03c68dd77602a
-rw-r--r--sw/CppunitTest_sw_odfimport.mk39
-rw-r--r--sw/qa/extras/odfimport/odfimport.cxx10
-rw-r--r--sw/source/filter/xml/xmltble.cxx11
3 files changed, 22 insertions, 38 deletions
diff --git a/sw/CppunitTest_sw_odfimport.mk b/sw/CppunitTest_sw_odfimport.mk
index c3a3b535c8a4..80549d1c32e8 100644
--- a/sw/CppunitTest_sw_odfimport.mk
+++ b/sw/CppunitTest_sw_odfimport.mk
@@ -54,44 +54,7 @@ $(eval $(call gb_CppunitTest_use_api,sw_odfimport,\
$(eval $(call gb_CppunitTest_use_ure,sw_odfimport))
$(eval $(call gb_CppunitTest_use_vcl,sw_odfimport))
-$(eval $(call gb_CppunitTest_use_components,sw_odfimport,\
- basic/util/sb \
- comphelper/util/comphelp \
- configmgr/source/configmgr \
- embeddedobj/util/embobj \
- filter/source/config/cache/filterconfig1 \
- filter/source/storagefilterdetect/storagefd \
- filter/source/odfflatxml/odfflatxml \
- filter/source/xmlfilterdetect/xmlfd \
- filter/source/xmlfilteradaptor/xmlfa \
- framework/util/fwk \
- i18npool/util/i18npool \
- lingucomponent/source/languageguessing/guesslang \
- linguistic/source/lng \
- package/util/package2 \
- package/source/xstor/xstor \
- sw/util/sw \
- sw/util/swd \
- sax/source/expatwrap/expwrap \
- sfx2/util/sfx \
- svl/source/fsstor/fsstorage \
- svtools/util/svt \
- toolkit/util/tk \
- ucb/source/core/ucb1 \
- ucb/source/ucp/file/ucpfile1 \
- unotools/util/utl \
- unoxml/source/service/unoxml \
- uui/util/uui \
- $(if $(filter-out MACOSX WNT,$(OS)), \
- $(if $(DISABLE_GUI),, \
- vcl/vcl.unx \
- ) \
- ) \
- $(if $(filter DESKTOP,$(BUILD_TYPE)),xmlhelp/util/ucpchelp1) \
- vcl/vcl.common \
- xmloff/util/xo \
- svgio/svgio \
-))
+$(eval $(call gb_CppunitTest_use_rdb,sw_odfimport,services))
$(eval $(call gb_CppunitTest_use_configuration,sw_odfimport))
diff --git a/sw/qa/extras/odfimport/odfimport.cxx b/sw/qa/extras/odfimport/odfimport.cxx
index 3aea453dfb2e..40369b6e4609 100644
--- a/sw/qa/extras/odfimport/odfimport.cxx
+++ b/sw/qa/extras/odfimport/odfimport.cxx
@@ -959,6 +959,16 @@ DECLARE_ODFIMPORT_TEST(testVerticallyMergedCellBorder, "vmerge-cell-border.odt")
// 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.
+ xmlDocPtr 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 58ef026cf7e1..237d43d0ac6b 100644
--- a/sw/source/filter/xml/xmltble.cxx
+++ b/sw/source/filter/xml/xmltble.cxx
@@ -918,6 +918,17 @@ void SwXMLExport::ExportTableLine( const SwTableLine& rLine,
const long 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 );