kspread

kspread_locale.cpp
1#include "kspread_locale.h"
2
3#include <tqdom.h>
4
5using namespace KSpread;
6
7Locale::Locale()
8 : TDELocale("kspread")
9{
10 insertCatalogue("koffice");
11}
12
13void Locale::load( const TQDomElement& element )
14{
15 if ( element.hasAttribute( "weekStartsMonday" ) )
16 {
17 TQString c = element.attribute( "weekStartsMonday" );
18 if ( c != "False")
19 {
20 setWeekStartDay( 1 /*Monday*/ );
21 }
22 }
23 if ( element.hasAttribute( "decimalSymbol" ) )
24 setDecimalSymbol( element.attribute( "decimalSymbol" ) );
25 if ( element.hasAttribute( "thousandsSeparator" ) )
26 setThousandsSeparator( element.attribute( "thousandsSeparator" ) );
27 if ( element.hasAttribute( "currencySymbol" ) )
28 setCurrencySymbol( element.attribute( "currencySymbol" ) );
29 if ( element.hasAttribute( "monetaryDecimalSymbol" ) )
30 setMonetaryDecimalSymbol( element.attribute( "monetaryDecimalSymbol" ) );
31 if ( element.hasAttribute( "monetaryThousandsSeparator" ) )
32 setMonetaryThousandsSeparator( element.attribute( "monetaryThousandsSeparator" ) );
33 if ( element.hasAttribute( "positiveSign" ) )
34 setPositiveSign( element.attribute( "positiveSign" ) );
35 if ( element.hasAttribute( "negativeSign" ) )
36 setNegativeSign( element.attribute( "negativeSign" ) );
37 if ( element.hasAttribute( "fracDigits" ) )
38 setFracDigits( element.attribute( "fracDigits" ).toInt() );
39 if ( element.hasAttribute( "positivePrefixCurrencySymbol" ) )
40 {
41 TQString c = element.attribute( "positivePrefixCurrencySymbol" );
42 setPositivePrefixCurrencySymbol( c == "True" );
43 }
44 if ( element.hasAttribute( "negativePrefixCurrencySymbol" ) )
45 {
46 TQString c = element.attribute( "negativePrefixCurrencySymbol" );
47 setNegativePrefixCurrencySymbol( c == "True" );
48 }
49 if ( element.hasAttribute( "positiveMonetarySignPosition" ) )
50 setPositiveMonetarySignPosition( (SignPosition)element.attribute( "positiveMonetarySignPosition" ).toInt() );
51 if ( element.hasAttribute( "negativeMonetarySignPosition" ) )
52 setNegativeMonetarySignPosition( (SignPosition)element.attribute( "negativeMonetarySignPosition" ).toInt() );
53 if ( element.hasAttribute( "timeFormat" ) )
54 setTimeFormat( element.attribute( "timeFormat" ) );
55 if ( element.hasAttribute( "dateFormat" ) )
56 setDateFormat( element.attribute( "dateFormat" ) );
57 if ( element.hasAttribute( "dateFormatShort" ) )
58 setDateFormatShort( element.attribute( "dateFormatShort" ) );
59}
60
61TQDomElement Locale::save( TQDomDocument& doc ) const
62{
63 TQDomElement element = doc.createElement( "locale" );
64
65 element.setAttribute( "weekStartsMonday", (weekStartDay() == 1) ? "True" : "False" );
66 element.setAttribute( "decimalSymbol", decimalSymbol() );
67 element.setAttribute( "thousandsSeparator", thousandsSeparator() );
68 element.setAttribute( "currencySymbol", currencySymbol() );
69 element.setAttribute( "monetaryDecimalSymbol", monetaryDecimalSymbol() );
70 element.setAttribute( "monetaryThousandsSeparator", monetaryThousandsSeparator() );
71 element.setAttribute( "positiveSign", positiveSign() );
72 element.setAttribute( "negativeSign", negativeSign() );
73 element.setAttribute( "fracDigits", fracDigits() );
74 element.setAttribute( "positivePrefixCurrencySymbol", positivePrefixCurrencySymbol() ? "True" : "False");
75 element.setAttribute( "negativePrefixCurrencySymbol", negativePrefixCurrencySymbol() ? "True" : "False");
76 element.setAttribute( "positiveMonetarySignPosition", (int)positiveMonetarySignPosition() );
77 element.setAttribute( "negativeMonetarySignPosition", (int)negativeMonetarySignPosition() );
78 element.setAttribute( "timeFormat", timeFormat() );
79 element.setAttribute( "dateFormat", dateFormat() );
80 element.setAttribute( "dateFormatShort", dateFormatShort() );
81
82 return element;
83}
84
85void Locale::defaultSystemConfig( )
86{
87 TDELocale locale("kspread");
88 setWeekStartDay( locale.weekStartDay() );
89 setDecimalSymbol( locale.decimalSymbol());
90 setThousandsSeparator( locale.thousandsSeparator() );
91 setCurrencySymbol( locale.currencySymbol() );
92 setMonetaryDecimalSymbol( locale.monetaryDecimalSymbol() );
93 setMonetaryThousandsSeparator( locale.monetaryThousandsSeparator());
94 setPositiveSign( locale.positiveSign() );
95 setNegativeSign( locale.negativeSign() );
96 setFracDigits( locale.fracDigits() );
97 setPositivePrefixCurrencySymbol( locale.positivePrefixCurrencySymbol() );
98 setNegativePrefixCurrencySymbol( locale.negativePrefixCurrencySymbol() );
99 setPositiveMonetarySignPosition( locale.positiveMonetarySignPosition() );
100 setNegativeMonetarySignPosition( locale.negativeMonetarySignPosition() );
101 setTimeFormat( locale.timeFormat() );
102 setDateFormat( locale.dateFormat() );
103 setDateFormatShort( locale.dateFormatShort() );
104
105}
106
The KSpread namespace.
Definition commands.h:39