From 297363822d460321c0b3bdd4a8acc9f689f4661b Mon Sep 17 00:00:00 2001 From: Markus Mohrhard Date: Sat, 29 Jun 2013 02:50:48 +0200 Subject: handle localized default style names, fdo#61339 We need to map localized style names during import and export from and to ODF. The default styles are the only localized style names and are not imported with the name written into the file. Change-Id: Ibdc2f750b7a4b7ce6994b22248e237fe95ac638d (cherry picked from commit 5b9bad7482a98f2d0d37c4b75a13292abe653ea3) Reviewed-on: https://gerrit.libreoffice.org/4615 Reviewed-by: Bosdonnat Cedric Tested-by: Bosdonnat Cedric --- sc/source/filter/xml/xmlcondformat.cxx | 5 +++-- sc/source/filter/xml/xmlexprt.cxx | 6 ++++-- 2 files changed, 7 insertions(+), 4 deletions(-) (limited to 'sc') diff --git a/sc/source/filter/xml/xmlcondformat.cxx b/sc/source/filter/xml/xmlcondformat.cxx index 41f4f3d8cc83..afeec54fee7b 100644 --- a/sc/source/filter/xml/xmlcondformat.cxx +++ b/sc/source/filter/xml/xmlcondformat.cxx @@ -18,6 +18,7 @@ #include "rangeutl.hxx" #include "docfunc.hxx" #include "XMLConverter.hxx" +#include "stylehelper.hxx" ScXMLConditionalFormatsContext::ScXMLConditionalFormatsContext( ScXMLImport& rImport, sal_uInt16 nPrfx, @@ -566,7 +567,7 @@ ScXMLCondContext::ScXMLCondContext( ScXMLImport& rImport, sal_uInt16 nPrfx, sExpression = sValue; break; case XML_TOK_CONDITION_APPLY_STYLE_NAME: - sStyle = sValue; + sStyle = ScStyleNameConversion::ProgrammaticToDisplayName(sValue, SFX_STYLE_FAMILY_PARA ); break; case XML_TOK_CONDITION_BASE_CELL_ADDRESS: sAddress = sValue; @@ -764,7 +765,7 @@ ScXMLDateContext::ScXMLDateContext( ScXMLImport& rImport, sal_uInt16 nPrfx, sDateType = sValue; break; case XML_TOK_COND_DATE_STYLE: - sStyle = sValue; + sStyle = ScStyleNameConversion::ProgrammaticToDisplayName(sValue, SFX_STYLE_FAMILY_PARA ); break; default: break; diff --git a/sc/source/filter/xml/xmlexprt.cxx b/sc/source/filter/xml/xmlexprt.cxx index 2b72e894df0e..9089f2718924 100644 --- a/sc/source/filter/xml/xmlexprt.cxx +++ b/sc/source/filter/xml/xmlexprt.cxx @@ -59,6 +59,7 @@ #include "colorscale.hxx" #include "conditio.hxx" #include "cellvalue.hxx" +#include "stylehelper.hxx" #include #include @@ -4011,7 +4012,7 @@ void ScXMLExport::ExportConditionalFormat(SCTAB nTab) default: SAL_WARN("sc", "unimplemented conditional format export"); } - OUString sStyle = pEntry->GetStyle(); + OUString sStyle = ScStyleNameConversion::DisplayToProgrammaticName(pEntry->GetStyle(), SFX_STYLE_FAMILY_PARA); AddAttribute(XML_NAMESPACE_CALC_EXT, XML_APPLY_STYLE_NAME, sStyle); AddAttribute(XML_NAMESPACE_CALC_EXT, XML_VALUE, aCond.makeStringAndClear()); @@ -4138,7 +4139,8 @@ void ScXMLExport::ExportConditionalFormat(SCTAB nTab) { const ScCondDateFormatEntry& mrDateFormat = static_cast(*pFormatEntry); OUString aDateType = getDateStringForType(mrDateFormat.GetDateType()); - AddAttribute( XML_NAMESPACE_CALC_EXT, XML_STYLE, mrDateFormat.GetStyleName()); + OUString aStyleName = ScStyleNameConversion::DisplayToProgrammaticName(mrDateFormat.GetStyleName(), SFX_STYLE_FAMILY_PARA ); + AddAttribute( XML_NAMESPACE_CALC_EXT, XML_STYLE, aStyleName); AddAttribute( XML_NAMESPACE_CALC_EXT, XML_DATE, aDateType); SvXMLElementExport aElementDateFormat(*this, XML_NAMESPACE_CALC_EXT, XML_DATE_IS, true, true); } -- cgit v1.2.3