summaryrefslogtreecommitdiffstats
path: root/kspread/kspread_locale.cpp
diff options
context:
space:
mode:
authorMichele Calgaro <michele.calgaro@yahoo.it>2021-05-23 20:48:35 +0900
committerMichele Calgaro <michele.calgaro@yahoo.it>2021-05-29 15:17:38 +0900
commitd63c9d696eb6e2539528b99afc21f4086c9defe3 (patch)
treeb3bfc97a66431a12cdd8f9379c0072673ede43df /kspread/kspread_locale.cpp
parent5363fe3c36504c37bdc6dcfafd5f71daeae251e8 (diff)
downloadkoffice-d63c9d69.tar.gz
koffice-d63c9d69.zip
Renaming of files in preparation for code style tools.
Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it> (cherry picked from commit 8b78a8791bc539bcffe7159f9d9714d577cb3d7d)
Diffstat (limited to 'kspread/kspread_locale.cpp')
-rw-r--r--kspread/kspread_locale.cpp106
1 files changed, 106 insertions, 0 deletions
diff --git a/kspread/kspread_locale.cpp b/kspread/kspread_locale.cpp
new file mode 100644
index 000000000..fc665f0a5
--- /dev/null
+++ b/kspread/kspread_locale.cpp
@@ -0,0 +1,106 @@
+#include "kspread_locale.h"
+
+#include <tqdom.h>
+
+using namespace KSpread;
+
+Locale::Locale()
+ : TDELocale("kspread")
+{
+ insertCatalogue("koffice");
+}
+
+void Locale::load( const TQDomElement& element )
+{
+ if ( element.hasAttribute( "weekStartsMonday" ) )
+ {
+ TQString c = element.attribute( "weekStartsMonday" );
+ if ( c != "False")
+ {
+ setWeekStartDay( 1 /*Monday*/ );
+ }
+ }
+ if ( element.hasAttribute( "decimalSymbol" ) )
+ setDecimalSymbol( element.attribute( "decimalSymbol" ) );
+ if ( element.hasAttribute( "thousandsSeparator" ) )
+ setThousandsSeparator( element.attribute( "thousandsSeparator" ) );
+ if ( element.hasAttribute( "currencySymbol" ) )
+ setCurrencySymbol( element.attribute( "currencySymbol" ) );
+ if ( element.hasAttribute( "monetaryDecimalSymbol" ) )
+ setMonetaryDecimalSymbol( element.attribute( "monetaryDecimalSymbol" ) );
+ if ( element.hasAttribute( "monetaryThousandsSeparator" ) )
+ setMonetaryThousandsSeparator( element.attribute( "monetaryThousandsSeparator" ) );
+ if ( element.hasAttribute( "positiveSign" ) )
+ setPositiveSign( element.attribute( "positiveSign" ) );
+ if ( element.hasAttribute( "negativeSign" ) )
+ setNegativeSign( element.attribute( "negativeSign" ) );
+ if ( element.hasAttribute( "fracDigits" ) )
+ setFracDigits( element.attribute( "fracDigits" ).toInt() );
+ if ( element.hasAttribute( "positivePrefixCurrencySymbol" ) )
+ {
+ TQString c = element.attribute( "positivePrefixCurrencySymbol" );
+ setPositivePrefixCurrencySymbol( c == "True" );
+ }
+ if ( element.hasAttribute( "negativePrefixCurrencySymbol" ) )
+ {
+ TQString c = element.attribute( "negativePrefixCurrencySymbol" );
+ setNegativePrefixCurrencySymbol( c == "True" );
+ }
+ if ( element.hasAttribute( "positiveMonetarySignPosition" ) )
+ setPositiveMonetarySignPosition( (SignPosition)element.attribute( "positiveMonetarySignPosition" ).toInt() );
+ if ( element.hasAttribute( "negativeMonetarySignPosition" ) )
+ setNegativeMonetarySignPosition( (SignPosition)element.attribute( "negativeMonetarySignPosition" ).toInt() );
+ if ( element.hasAttribute( "timeFormat" ) )
+ setTimeFormat( element.attribute( "timeFormat" ) );
+ if ( element.hasAttribute( "dateFormat" ) )
+ setDateFormat( element.attribute( "dateFormat" ) );
+ if ( element.hasAttribute( "dateFormatShort" ) )
+ setDateFormatShort( element.attribute( "dateFormatShort" ) );
+}
+
+TQDomElement Locale::save( TQDomDocument& doc ) const
+{
+ TQDomElement element = doc.createElement( "locale" );
+
+ element.setAttribute( "weekStartsMonday", (weekStartDay() == 1) ? "True" : "False" );
+ element.setAttribute( "decimalSymbol", decimalSymbol() );
+ element.setAttribute( "thousandsSeparator", thousandsSeparator() );
+ element.setAttribute( "currencySymbol", currencySymbol() );
+ element.setAttribute( "monetaryDecimalSymbol", monetaryDecimalSymbol() );
+ element.setAttribute( "monetaryThousandsSeparator", monetaryThousandsSeparator() );
+ element.setAttribute( "positiveSign", positiveSign() );
+ element.setAttribute( "negativeSign", negativeSign() );
+ element.setAttribute( "fracDigits", fracDigits() );
+ element.setAttribute( "positivePrefixCurrencySymbol", positivePrefixCurrencySymbol() ? "True" : "False");
+ element.setAttribute( "negativePrefixCurrencySymbol", negativePrefixCurrencySymbol() ? "True" : "False");
+ element.setAttribute( "positiveMonetarySignPosition", (int)positiveMonetarySignPosition() );
+ element.setAttribute( "negativeMonetarySignPosition", (int)negativeMonetarySignPosition() );
+ element.setAttribute( "timeFormat", timeFormat() );
+ element.setAttribute( "dateFormat", dateFormat() );
+ element.setAttribute( "dateFormatShort", dateFormatShort() );
+
+ return element;
+}
+
+void Locale::defaultSystemConfig( )
+{
+ TDELocale locale("kspread");
+ setWeekStartDay( locale.weekStartDay() );
+ setDecimalSymbol( locale.decimalSymbol());
+ setThousandsSeparator( locale.thousandsSeparator() );
+ setCurrencySymbol( locale.currencySymbol() );
+ setMonetaryDecimalSymbol( locale.monetaryDecimalSymbol() );
+ setMonetaryThousandsSeparator( locale.monetaryThousandsSeparator());
+ setPositiveSign( locale.positiveSign() );
+ setNegativeSign( locale.negativeSign() );
+ setFracDigits( locale.fracDigits() );
+ setPositivePrefixCurrencySymbol( locale.positivePrefixCurrencySymbol() );
+ setNegativePrefixCurrencySymbol( locale.negativePrefixCurrencySymbol() );
+ setPositiveMonetarySignPosition( locale.positiveMonetarySignPosition() );
+ setNegativeMonetarySignPosition( locale.negativeMonetarySignPosition() );
+ setTimeFormat( locale.timeFormat() );
+ setDateFormat( locale.dateFormat() );
+ setDateFormatShort( locale.dateFormatShort() );
+
+}
+