summaryrefslogtreecommitdiff
path: root/sw/source/core/bastyp/calc.cxx
diff options
context:
space:
mode:
authorjp <jp@openoffice.org>2000-11-21 13:24:56 +0000
committerjp <jp@openoffice.org>2000-11-21 13:24:56 +0000
commitfa05fff1347f9427a7fc362c8e062fb9608a8f78 (patch)
tree6acff2c43cf67db535e2f760f5aaab992313bead /sw/source/core/bastyp/calc.cxx
parent77da25c56d9efa0f899c1cdf475c7d713daa1dc6 (diff)
Bug #79951#: Str2Double - new method with doc
Diffstat (limited to 'sw/source/core/bastyp/calc.cxx')
-rw-r--r--sw/source/core/bastyp/calc.cxx34
1 files changed, 31 insertions, 3 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;
+}
+
+
//------------------------------------------------------------------------------
/******************************************************************************