summaryrefslogtreecommitdiff
path: root/xmloff
diff options
context:
space:
mode:
authorMaxim Monastirsky <momonasmon@gmail.com>2022-12-07 15:51:01 +0200
committerXisco Fauli <xiscofauli@libreoffice.org>2022-12-09 17:49:17 +0000
commit03a84f60e94edc803bc3825b3ccb81771d4e522a (patch)
treea354196372cb45d146fbbb14042bd78af1f3056b /xmloff
parentf561cf425cda33fa1c688dac14be052e116ce0f6 (diff)
Fix sd encoded table style name handling
Found this while looking into improving insertion of pages with tables, as SdDrawDocument::InsertBookmarkAsPage uses "_" as the rename suffix for styles with identical names but a different content. This commit fixes two issues: - For import, cell styles with encoded names couldn't be found by table styles. The reason is that styles are referenced in ODF by encoded names, but at runtime by display names. Yet we were searching the cell style family by encoded names. This was already handled for sw in insertTabletemplate(), and now do the same for sd. - For export, table template names were encoded, but then referenced by tables using their non-encoded names. This is unlike the sw code that doesn't encode them, and therefore doesn't have this problem. Looking at the schema, both table:name attribute of a table template, and table:template-name attribute of a table are of type "string", which suggests that there is indeed no need to encode those names. This aligns with the fact that table templates don't have a display-name attribute. Change-Id: Ie61b6a1c95b033404ee98f3fc40d8e82434a6a6c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143839 Tested-by: Jenkins Reviewed-by: Maxim Monastirsky <momonasmon@gmail.com> (cherry picked from commit 8bd31225d79f10993d0e0727ee7d27c729874b51) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143729 Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'xmloff')
-rw-r--r--xmloff/source/table/XMLTableExport.cxx4
-rw-r--r--xmloff/source/table/XMLTableImport.cxx2
2 files changed, 3 insertions, 3 deletions
diff --git a/xmloff/source/table/XMLTableExport.cxx b/xmloff/source/table/XMLTableExport.cxx
index f415bb171af9..0b8fd95aadda 100644
--- a/xmloff/source/table/XMLTableExport.cxx
+++ b/xmloff/source/table/XMLTableExport.cxx
@@ -640,9 +640,9 @@ void XMLTableExport::exportTableTemplates()
// tdf#106780 historically this wrong attribute was used
// for the name; write it if extended because LO < 5.3 can
// read only text:style-name, not the correct table:name
- mrExport.AddAttribute(XML_NAMESPACE_TEXT, XML_STYLE_NAME, GetExport().EncodeStyleName( xTableStyle->getName() ) );
+ mrExport.AddAttribute(XML_NAMESPACE_TEXT, XML_STYLE_NAME, xTableStyle->getName());
}
- mrExport.AddAttribute(XML_NAMESPACE_TABLE, XML_NAME, GetExport().EncodeStyleName(xTableStyle->getName()));
+ mrExport.AddAttribute(XML_NAMESPACE_TABLE, XML_NAME, xTableStyle->getName());
}
SvXMLElementExport tableTemplate( mrExport, XML_NAMESPACE_TABLE, XML_TABLE_TEMPLATE, true, true );
diff --git a/xmloff/source/table/XMLTableImport.cxx b/xmloff/source/table/XMLTableImport.cxx
index afc86cf4000c..65b6be09d2ff 100644
--- a/xmloff/source/table/XMLTableImport.cxx
+++ b/xmloff/source/table/XMLTableImport.cxx
@@ -376,7 +376,7 @@ void XMLTableImport::finishStyles()
for( const auto& rStyle : *xT ) try
{
const OUString sPropName( rStyle.first );
- const OUString sStyleName( rStyle.second );
+ const OUString sStyleName( mrImport.GetStyleDisplayName(XmlStyleFamily::TABLE_CELL, rStyle.second) );
xTemplate->replaceByName( sPropName, xCellFamily->getByName( sStyleName ) );
}
catch( Exception& )