summaryrefslogtreecommitdiff
path: root/xmloff/source/style
diff options
context:
space:
mode:
authorEike Rathke <er@openoffice.org>2002-06-26 15:55:05 +0000
committerEike Rathke <er@openoffice.org>2002-06-26 15:55:05 +0000
commitc75f4eaf6413bbd1e221f9748aa421eea518d3ed (patch)
tree563d8d0b5a287abe404eda8d3f0b68d8dad550e7 /xmloff/source/style
parent6bfcc14a42dd9d9d4045def25a38827541306e4c (diff)
#99859# store native number transliteration [NatNumN] in XML file format
Diffstat (limited to 'xmloff/source/style')
-rw-r--r--xmloff/source/style/xmlnumfe.cxx26
-rw-r--r--xmloff/source/style/xmlnumfi.cxx50
2 files changed, 71 insertions, 5 deletions
diff --git a/xmloff/source/style/xmlnumfe.cxx b/xmloff/source/style/xmlnumfe.cxx
index f48eb04dc9ff..0b76559b113c 100644
--- a/xmloff/source/style/xmlnumfe.cxx
+++ b/xmloff/source/style/xmlnumfe.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: xmlnumfe.cxx,v $
*
- * $Revision: 1.27 $
+ * $Revision: 1.28 $
*
- * last change: $Author: nn $ $Date: 2002-06-11 18:11:40 $
+ * last change: $Author: er $ $Date: 2002-06-26 16:51:10 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -74,6 +74,7 @@
#include <com/sun/star/lang/Locale.hpp>
#include <rtl/ustrbuf.hxx>
#include <comphelper/processfactory.hxx>
+#include <drafts/com/sun/star/i18n/NativeNumberXmlAttributes.hpp>
#include "xmlnumfe.hxx"
#include "xmlnmspe.hxx"
@@ -1179,6 +1180,26 @@ void SvXMLNumFmtExport::ExportPart_Impl( const SvNumberformat& rFormat, sal_uInt
XML_FALSE );
}
+ //
+ // Native number transliteration
+ //
+ ::drafts::com::sun::star::i18n::NativeNumberXmlAttributes aAttr;
+ rFormat.GetNatNumXml( aAttr, nPart );
+ if ( aAttr.Format.getLength() )
+ {
+ rExport.AddAttribute( XML_NAMESPACE_NUMBER, XML_TRANSLITERATION_FORMAT,
+ aAttr.Format );
+ rExport.AddAttribute( XML_NAMESPACE_NUMBER, XML_TRANSLITERATION_LANGUAGE,
+ aAttr.Locale.Language );
+ rExport.AddAttribute( XML_NAMESPACE_NUMBER, XML_TRANSLITERATION_COUNTRY,
+ aAttr.Locale.Country );
+ rExport.AddAttribute( XML_NAMESPACE_NUMBER, XML_TRANSLITERATION_STYLE,
+ aAttr.Style );
+ }
+
+ //
+ // The element
+ //
SvXMLElementExport aElem( rExport, XML_NAMESPACE_NUMBER, eType,
sal_True, sal_True );
@@ -1190,6 +1211,7 @@ void SvXMLNumFmtExport::ExportPart_Impl( const SvNumberformat& rFormat, sal_uInt
if (pCol)
WriteColorElement_Impl(*pCol);
+
// detect if there is "real" content, excluding color and maps
//! move to implementation of Write... methods?
sal_Bool bAnyContent = sal_False;
diff --git a/xmloff/source/style/xmlnumfi.cxx b/xmloff/source/style/xmlnumfi.cxx
index 73891318cd28..c8b9bc4317b1 100644
--- a/xmloff/source/style/xmlnumfi.cxx
+++ b/xmloff/source/style/xmlnumfi.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: xmlnumfi.cxx,v $
*
- * $Revision: 1.25 $
+ * $Revision: 1.26 $
*
- * last change: $Author: nn $ $Date: 2002-06-11 18:11:40 $
+ * last change: $Author: er $ $Date: 2002-06-26 16:51:10 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -312,7 +312,11 @@ enum SvXMLStyleAttrTokens
XML_TOK_STYLE_ATTR_AUTOMATIC_ORDER,
XML_TOK_STYLE_ATTR_FORMAT_SOURCE,
XML_TOK_STYLE_ATTR_TRUNCATE_ON_OVERFLOW,
- XML_TOK_STYLE_ATTR_VOLATILE
+ XML_TOK_STYLE_ATTR_VOLATILE,
+ XML_TOK_STYLE_ATTR_TRANSL_FORMAT,
+ XML_TOK_STYLE_ATTR_TRANSL_LANGUAGE,
+ XML_TOK_STYLE_ATTR_TRANSL_COUNTRY,
+ XML_TOK_STYLE_ATTR_TRANSL_STYLE
};
enum SvXMLStyleElemAttrTokens
@@ -408,6 +412,10 @@ static __FAR_DATA SvXMLTokenMapEntry aStyleAttrMap[] =
{ XML_NAMESPACE_NUMBER, XML_FORMAT_SOURCE, XML_TOK_STYLE_ATTR_FORMAT_SOURCE },
{ XML_NAMESPACE_NUMBER, XML_TRUNCATE_ON_OVERFLOW, XML_TOK_STYLE_ATTR_TRUNCATE_ON_OVERFLOW },
{ XML_NAMESPACE_STYLE, XML_VOLATILE, XML_TOK_STYLE_ATTR_VOLATILE },
+ { XML_NAMESPACE_NUMBER, XML_TRANSLITERATION_FORMAT, XML_TOK_STYLE_ATTR_TRANSL_FORMAT },
+ { XML_NAMESPACE_NUMBER, XML_TRANSLITERATION_LANGUAGE, XML_TOK_STYLE_ATTR_TRANSL_LANGUAGE },
+ { XML_NAMESPACE_NUMBER, XML_TRANSLITERATION_COUNTRY, XML_TOK_STYLE_ATTR_TRANSL_COUNTRY },
+ { XML_NAMESPACE_NUMBER, XML_TRANSLITERATION_STYLE, XML_TOK_STYLE_ATTR_TRANSL_STYLE },
XML_TOKEN_MAP_END
};
@@ -1173,6 +1181,7 @@ SvXMLNumFormatContext::SvXMLNumFormatContext( SvXMLImport& rImport,
nKey(-1)
{
OUString sLanguage, sCountry;
+ ::drafts::com::sun::star::i18n::NativeNumberXmlAttributes aNatNumAttr;
sal_Bool bAttrBool;
sal_uInt16 nAttrEnum;
@@ -1218,6 +1227,18 @@ SvXMLNumFormatContext::SvXMLNumFormatContext( SvXMLImport& rImport,
if ( SvXMLUnitConverter::convertBool( bAttrBool, sValue ) )
bRemoveAfterUse = bAttrBool;
break;
+ case XML_TOK_STYLE_ATTR_TRANSL_FORMAT:
+ aNatNumAttr.Format = sValue;
+ break;
+ case XML_TOK_STYLE_ATTR_TRANSL_LANGUAGE:
+ aNatNumAttr.Locale.Language = sValue;
+ break;
+ case XML_TOK_STYLE_ATTR_TRANSL_COUNTRY:
+ aNatNumAttr.Locale.Country = sValue;
+ break;
+ case XML_TOK_STYLE_ATTR_TRANSL_STYLE:
+ aNatNumAttr.Style = sValue;
+ break;
}
}
@@ -1227,6 +1248,29 @@ SvXMLNumFormatContext::SvXMLNumFormatContext( SvXMLImport& rImport,
if ( nFormatLang == LANGUAGE_DONTKNOW )
nFormatLang = LANGUAGE_SYSTEM; //! error handling for invalid locales?
}
+
+ if ( aNatNumAttr.Format.getLength() )
+ {
+ SvNumberFormatter* pFormatter = pData->GetNumberFormatter();
+ if ( pFormatter )
+ {
+ sal_Int32 nNatNum = pFormatter->GetNatNum()->convertFromXmlAttributes( aNatNumAttr );
+ aFormatCode.appendAscii( RTL_CONSTASCII_STRINGPARAM( "[NatNum" ) );
+ aFormatCode.append( nNatNum, 10 );
+
+ LanguageType eLang = ConvertIsoNamesToLanguage(
+ aNatNumAttr.Locale.Language, aNatNumAttr.Locale.Country );
+ if ( eLang == LANGUAGE_DONTKNOW )
+ eLang = LANGUAGE_SYSTEM; //! error handling for invalid locales?
+ if ( eLang != nFormatLang && eLang != LANGUAGE_SYSTEM )
+ {
+ aFormatCode.appendAscii( RTL_CONSTASCII_STRINGPARAM( "][$-" ) );
+ // language code in upper hex:
+ aFormatCode.append( String::CreateFromInt32( sal_Int32( eLang ), 16 ).ToUpperAscii() );
+ }
+ aFormatCode.append( sal_Unicode(']') );
+ }
+ }
}
SvXMLNumFormatContext::SvXMLNumFormatContext( SvXMLImport& rImport,