summaryrefslogtreecommitdiff
path: root/xmloff/source
diff options
context:
space:
mode:
authorMaxim Monastirsky <momonasmon@gmail.com>2022-12-07 15:51:01 +0200
committerMaxim Monastirsky <momonasmon@gmail.com>2022-12-09 00:13:30 +0000
commit8bd31225d79f10993d0e0727ee7d27c729874b51 (patch)
treedc811ae2899ae23945e071a1ac3dd8e60648e250 /xmloff/source
parent15e94efb87118b0ceb4aa926181a8906259f369b (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>
Diffstat (limited to 'xmloff/source')
-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& )