kspread_locale.cc
00001 #include "kspread_locale.h"
00002
00003 #include <qdom.h>
00004
00005 KSpreadLocale::KSpreadLocale()
00006 : KLocale("kspread")
00007 {
00008 insertCatalogue("koffice");
00009 }
00010
00011 void KSpreadLocale::load( const QDomElement& element )
00012 {
00013 if ( element.hasAttribute( "weekStartsMonday" ) )
00014 {
00015 QString c = element.attribute( "weekStartsMonday" );
00016 setWeekStartsMonday( c != "False");
00017 }
00018 if ( element.hasAttribute( "decimalSymbol" ) )
00019 setDecimalSymbol( element.attribute( "decimalSymbol" ) );
00020 if ( element.hasAttribute( "thousandsSeparator" ) )
00021 setThousandsSeparator( element.attribute( "thousandsSeparator" ) );
00022 if ( element.hasAttribute( "currencySymbol" ) )
00023 setCurrencySymbol( element.attribute( "currencySymbol" ) );
00024 if ( element.hasAttribute( "monetaryDecimalSymbol" ) )
00025 setMonetaryDecimalSymbol( element.attribute( "monetaryDecimalSymbol" ) );
00026 if ( element.hasAttribute( "monetaryThousandsSeparator" ) )
00027 setMonetaryThousandsSeparator( element.attribute( "monetaryThousandsSeparator" ) );
00028 if ( element.hasAttribute( "positiveSign" ) )
00029 setPositiveSign( element.attribute( "positiveSign" ) );
00030 if ( element.hasAttribute( "negativeSign" ) )
00031 setNegativeSign( element.attribute( "negativeSign" ) );
00032 if ( element.hasAttribute( "fracDigits" ) )
00033 setFracDigits( element.attribute( "fracDigits" ).toInt() );
00034 if ( element.hasAttribute( "positivePrefixCurrencySymbol" ) )
00035 {
00036 QString c = element.attribute( "positivePrefixCurrencySymbol" );
00037 setPositivePrefixCurrencySymbol( c == "True" );
00038 }
00039 if ( element.hasAttribute( "negativePrefixCurrencySymbol" ) )
00040 {
00041 QString c = element.attribute( "negativePrefixCurrencySymbol" );
00042 setNegativePrefixCurrencySymbol( c == "True" );
00043 }
00044 if ( element.hasAttribute( "positiveMonetarySignPosition" ) )
00045 setPositiveMonetarySignPosition( (SignPosition)element.attribute( "positiveMonetarySignPosition" ).toInt() );
00046 if ( element.hasAttribute( "negativeMonetarySignPosition" ) )
00047 setNegativeMonetarySignPosition( (SignPosition)element.attribute( "negativeMonetarySignPosition" ).toInt() );
00048 if ( element.hasAttribute( "timeFormat" ) )
00049 setTimeFormat( element.attribute( "timeFormat" ) );
00050 if ( element.hasAttribute( "dateFormat" ) )
00051 setDateFormat( element.attribute( "dateFormat" ) );
00052 if ( element.hasAttribute( "dateFormatShort" ) )
00053 setDateFormatShort( element.attribute( "dateFormatShort" ) );
00054 }
00055
00056 QDomElement KSpreadLocale::save( QDomDocument& doc ) const
00057 {
00058 QDomElement element = doc.createElement( "locale" );
00059
00060 element.setAttribute( "weekStartsMonday", weekStartsMonday() ? "True" : "False" );
00061 element.setAttribute( "decimalSymbol", decimalSymbol() );
00062 element.setAttribute( "thousandsSeparator", thousandsSeparator() );
00063 element.setAttribute( "currencySymbol", currencySymbol() );
00064 element.setAttribute( "monetaryDecimalSymbol", monetaryDecimalSymbol() );
00065 element.setAttribute( "monetaryThousandsSeparator", monetaryThousandsSeparator() );
00066 element.setAttribute( "positiveSign", positiveSign() );
00067 element.setAttribute( "negativeSign", negativeSign() );
00068 element.setAttribute( "fracDigits", fracDigits() );
00069 element.setAttribute( "positivePrefixCurrencySymbol", positivePrefixCurrencySymbol() ? "True" : "False");
00070 element.setAttribute( "negativePrefixCurrencySymbol", negativePrefixCurrencySymbol() ? "True" : "False");
00071 element.setAttribute( "positiveMonetarySignPosition", (int)positiveMonetarySignPosition() );
00072 element.setAttribute( "negativeMonetarySignPosition", (int)negativeMonetarySignPosition() );
00073 element.setAttribute( "timeFormat", timeFormat() );
00074 element.setAttribute( "dateFormat", dateFormat() );
00075 element.setAttribute( "dateFormatShort", dateFormatShort() );
00076
00077 return element;
00078 }
00079
00080 void KSpreadLocale::defaultSystemConfig( )
00081 {
00082 KLocale locale("kspread");
00083 setWeekStartsMonday( locale.weekStartsMonday());
00084 setDecimalSymbol( locale.decimalSymbol());
00085 setThousandsSeparator( locale.thousandsSeparator() );
00086 setCurrencySymbol( locale.currencySymbol() );
00087 setMonetaryDecimalSymbol( locale.monetaryDecimalSymbol() );
00088 setMonetaryThousandsSeparator( locale.monetaryThousandsSeparator());
00089 setPositiveSign( locale.positiveSign() );
00090 setNegativeSign( locale.negativeSign() );
00091 setFracDigits( locale.fracDigits() );
00092 setPositivePrefixCurrencySymbol( locale.positivePrefixCurrencySymbol() );
00093 setNegativePrefixCurrencySymbol( locale.negativePrefixCurrencySymbol() );
00094 setPositiveMonetarySignPosition( locale.positiveMonetarySignPosition() );
00095 setNegativeMonetarySignPosition( locale.negativeMonetarySignPosition() );
00096 setTimeFormat( locale.timeFormat() );
00097 setDateFormat( locale.dateFormat() );
00098 setDateFormatShort( locale.dateFormatShort() );
00099
00100 }
00101
This file is part of the documentation for kspread Library Version 1.4.2.