diff options
author | Maxim Monastirsky <momonasmon@gmail.com> | 2022-11-13 11:05:28 +0200 |
---|---|---|
committer | Maxim Monastirsky <momonasmon@gmail.com> | 2022-11-21 14:38:59 +0100 |
commit | 5d683e8f6c9e677d7b6bc829a4ce9ee384f4fbd8 (patch) | |
tree | ab8bc64934e52293f3289461ae906f88de039fca /xmloff/source | |
parent | 9e4b47190eb762f3aea80920846fe5135b7d76fc (diff) |
Export modified table styles
In addition to actually used styles, we want to
export user defined styles, as well as built in
styles that were modified.
Detecting the real modification state might be
challenging in some cases, e.g. when importing
the style from an existing document. So for
simplicity, we consider a style as "modified"
if at least one of its child cell styles is user
defined. The UI for modifying cell styles will be
implemented in such a way that built in styles
will never be modified themselves. Instead, a
user defined style will be created on the fly,
with the corresponding built in style set as its
parent, and only that new style will be modified.
It is still possible to modify built in cell
styles via the UNO API, but such styles won't be
exported unless actually used in the document.
Change-Id: Ic73eb460fd024f23016553e134397e07259f5c90
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143011
Tested-by: Jenkins
Reviewed-by: Maxim Monastirsky <momonasmon@gmail.com>
Diffstat (limited to 'xmloff/source')
-rw-r--r-- | xmloff/source/table/XMLTableExport.cxx | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/xmloff/source/table/XMLTableExport.cxx b/xmloff/source/table/XMLTableExport.cxx index 54bfb268d054..f415bb171af9 100644 --- a/xmloff/source/table/XMLTableExport.cxx +++ b/xmloff/source/table/XMLTableExport.cxx @@ -598,14 +598,24 @@ void XMLTableExport::exportTableTemplates() SvtSaveOptions::ODFSaneDefaultVersion eVersion = mrExport.getSaneDefaultVersion(); Reference< XStyle > xTableStyle( xTableFamily->getByIndex( nIndex ), UNO_QUERY_THROW ); - if( !xTableStyle->isInUse() ) + Reference<XPropertySet> xTableStylePropSet( xTableStyle, UNO_QUERY_THROW ); + bool bPhysical = false; + + try + { + xTableStylePropSet->getPropertyValue("IsPhysical") >>= bPhysical; + } + catch(const Exception&) + { + } + + if (!xTableStyle->isInUse() && !bPhysical) continue; const TableStyleElement* pElements; if (mbWriter) { mrExport.AddAttribute(XML_NAMESPACE_TABLE, XML_NAME, xTableStyle->getName()); - Reference<XPropertySet> xTableStylePropSet(xTableStyle, UNO_QUERY_THROW); pElements = getWriterSpecificTableStyleAttributes(); while(pElements->meElement != XML_TOKEN_END) { |