summaryrefslogtreecommitdiff
path: root/sw/source
diff options
context:
space:
mode:
Diffstat (limited to 'sw/source')
-rw-r--r--sw/source/core/bastyp/calc.cxx34
-rw-r--r--sw/source/core/fields/fldbas.cxx35
2 files changed, 43 insertions, 26 deletions
diff --git a/sw/source/core/bastyp/calc.cxx b/sw/source/core/bastyp/calc.cxx
index e8b22d7f931d..6d5be08e2e2c 100644
--- a/sw/source/core/bastyp/calc.cxx
+++ b/sw/source/core/bastyp/calc.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: calc.cxx,v $
*
- * $Revision: 1.8 $
+ * $Revision: 1.9 $
*
- * last change: $Author: jp $ $Date: 2000-11-21 13:22:35 $
+ * last change: $Author: jp $ $Date: 2000-11-21 14:24:56 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -104,7 +104,6 @@
#ifndef _UNOTOOLS_CHARCLASS_HXX
#include <unotools/charclass.hxx>
#endif
-
#ifndef _UNO_LINGU_HXX
#include <svx/unolingu.hxx>
#endif
@@ -1564,6 +1563,35 @@ FASTBOOL SwCalc::Str2Double( const String& rCommand, xub_StrLen& rCommandPos,
return 0 == nErrno && nCurrCmdPos != rCommandPos;
}
+FASTBOOL SwCalc::Str2Double( const String& rCommand, xub_StrLen& rCommandPos,
+ double& rVal, SwDoc* pDoc )
+{
+ const LocaleDataWrapper* pLclD = &GetAppLocaleData();
+ if( pDoc )
+ {
+ LanguageType eLang = ((SvxLanguageItem&)pDoc->GetDefault(
+ RES_CHRATR_LANGUAGE )).GetLanguage();
+ if( eLang != SvxLocaleToLanguage( pLclD->getLocale() ) )
+ pLclD = new LocaleDataWrapper(
+ ::comphelper::getProcessServiceFactory(),
+ SvxCreateLocale( eLang ) );
+ }
+
+ const xub_Unicode *pEnd, nCurrCmdPos = rCommandPos;
+ int nErrno;
+ rVal = SolarMath::StringToDouble( rCommand.GetBuffer() + rCommandPos,
+ pLclD->getNumThousandSep().GetChar(0),
+ pLclD->getNumDecimalSep().GetChar(0),
+ nErrno, &pEnd );
+ rCommandPos = pEnd - rCommand.GetBuffer();
+
+ if( pLclD != &GetAppLocaleData() )
+ delete (LocaleDataWrapper*)pLclD;
+
+ return 0 == nErrno && nCurrCmdPos != rCommandPos;
+}
+
+
//------------------------------------------------------------------------------
/******************************************************************************
diff --git a/sw/source/core/fields/fldbas.cxx b/sw/source/core/fields/fldbas.cxx
index 2c3fe357fb98..84d4f9bec99f 100644
--- a/sw/source/core/fields/fldbas.cxx
+++ b/sw/source/core/fields/fldbas.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: fldbas.cxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: jp $ $Date: 2000-11-20 09:14:45 $
+ * last change: $Author: jp $ $Date: 2000-11-21 14:23:59 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -65,18 +65,14 @@
#pragma hdrstop
-
#include <math.h>
#ifdef MAC
#include <stdlib.h>
#endif
#include <float.h>
-#ifndef _SV_SVAPP_HXX //autogen
-#include <vcl/svapp.hxx>
-#endif
-#ifndef _SV_SYSTEM_HXX //autogen
-#include <vcl/system.hxx>
+#ifndef _TOOLS_SOLMATH_HXX
+#include <tools/solmath.hxx>
#endif
#ifndef _ZFORLIST_HXX //autogen
#include <svtools/zforlist.hxx>
@@ -84,9 +80,6 @@
#ifndef _ZFORMAT_HXX //autogen
#include <svtools/zformat.hxx>
#endif
-#ifndef _TOOLS_SOLMATH_HXX //autogen wg. SolarMath
-#include <tools/solmath.hxx>
-#endif
#ifndef _UNOTOOLS_LOCALEDATAWRAPPER_HXX
#include <unotools/localedatawrapper.hxx>
#endif
@@ -139,6 +132,11 @@
#ifndef _SHELLRES_HXX
#include <shellres.hxx>
#endif
+#ifndef _CALC_HXX
+#include <calc.hxx>
+#endif
+
+
using namespace ::com::sun::star;
USHORT lcl_GetLanguageOfFormat( USHORT nLng, ULONG nFmt,
@@ -953,18 +951,9 @@ void SwFormulaField::SetFormula(const String& rStr)
if( nFmt && ULONG_MAX != nFmt )
{
- // String muss im Systemformat vorliegen!
- // Geht bei Import/Export mit unterschiedlichen Systemformaten
- // voll in die Hose. Ist aber nicht anders moeglich, da der Kalkulator
- // nur im Systemformat rechnen kann und es keine Konvertierungsroutine
- // gibt.
- const LocaleDataWrapper& rLclD = GetAppLocaleData();
- int nErrno;
- double fValue = SolarMath::StringToDouble( rStr.GetBuffer(),
- rLclD.getNumThousandSep().GetChar(0),
- rLclD.getNumDecimalSep().GetChar(0),
- nErrno );
- if( !nErrno )
+ xub_StrLen nPos = 0;
+ double fValue;
+ if( SwCalc::Str2Double( rStr, nPos, fValue, GetDoc() ) )
SwValueField::SetValue( fValue );
}
}