summaryrefslogtreecommitdiff
path: root/scaddins
diff options
context:
space:
mode:
authorKurt Zenker <kz@openoffice.org>2009-09-11 18:55:06 +0000
committerKurt Zenker <kz@openoffice.org>2009-09-11 18:55:06 +0000
commit6c08543a370b759d495b0f4a593b1f7cd329de64 (patch)
tree7e33d6f928c03c1201008de2f38907b7dcd63a1c /scaddins
parent921ff4b99a018c4d45c6d8d810fc96130c1b3a70 (diff)
CWS-TOOLING: integrate CWS odff06
2009-09-10 18:58:49 +0200 dr r276042 : #i104954# excel export: fixed broken handling of unary operators 2009-09-06 19:30:43 +0200 er r275861 : warnings 2009-09-05 19:48:41 +0200 er r275849 : warnings; wntmsci12 tries to be too smart 2009-09-05 19:37:47 +0200 er r275848 : warnings 2009-09-03 22:45:42 +0200 er r275776 : #i5658# GetCellValueOrZero: missed the formula cell case 2009-09-03 14:28:41 +0200 er r275752 : #i90759# better description of ZTEST 2009-09-03 03:34:03 +0200 er r275739 : warnings 2009-09-03 03:31:19 +0200 er r275738 : warnings 2009-09-03 03:16:46 +0200 er r275737 : warnings 2009-09-03 03:11:42 +0200 er r275736 : CELLTYPE_DESTROYED only if DBG_UTIL 2009-09-03 03:06:31 +0200 er r275735 : warnings 2009-09-03 03:00:30 +0200 er r275734 : warnings 2009-09-03 02:32:35 +0200 er r275733 : fix broken rebase merge 2009-09-02 22:27:53 +0200 er r275730 : CWS-TOOLING: rebase CWS odff06 to trunk@275331 (milestone: DEV300:m56) 2009-09-02 14:45:05 +0200 er r275712 : #i5658# calculate with string operands as long as they unambiguously represent an integer or ISO 8601 date and/or time value 2009-08-29 22:05:31 +0200 er r275559 : #i99140# CONVERT_ADD new conversions as per ODFF; patch from <lvyue>, slightly changed 2009-08-25 13:23:59 +0200 er r275349 : #i90759# rewording of ZTEST description 2009-08-21 00:10:22 +0200 er r275204 : #i82007# correct description of POWER and parameters; patch from <regina> 2009-08-20 23:58:20 +0200 er r275203 : #i74704# B correct calculation for SP arguments 0 and 1; patch from <regina> 2009-08-20 22:58:57 +0200 er r275201 : #i90759# ZTEST correct calculation using the 3rd parameter sigma 2009-08-14 17:55:45 +0200 er r275000 : #i81214# LOOKUP with single values, data arrays and result arrays; based on a patch from <lvyue> 2009-08-11 00:47:48 +0200 er r274845 : unxlngi6 compiler warnings 2009-08-11 00:43:06 +0200 er r274844 : unxlngi6 compiler warnings 2009-08-10 23:59:05 +0200 er r274843 : #91351# make HYPERLINK accept and return numeric values, propagate errors 2009-07-08 18:46:00 +0200 dr r273846 : #i102022# export 3D refs to cond. formats and data validation 2009-07-02 17:59:40 +0200 dr r273667 : #i102702# adapt changes from sc/source/filter/excel 2009-07-02 15:20:37 +0200 dr r273656 : #i102702# reimplementation of formula token class export 2009-07-02 14:41:02 +0200 er r273653 : a surrogate with value 0x10000 is also valid (ran into when testing #i99900# Calc's UNICHAR function), and Unicode ends at 0x10ffff 2009-07-01 00:10:16 +0200 er r273536 : #i99900# iterateCodePoints: check index against string length to avoid assertion; caught this when testing Calc's new UNICHAR function, with the result of a surrogate pair forming one character. 2009-07-01 00:03:57 +0200 er r273535 : #i99900# new UNICODE and UNICHAR functions; patch from <tanchengbiao> 2009-06-15 16:42:06 +0200 er r272999 : merge patch from #i102701 2009-06-15 11:15:16 +0200 dr r272970 : #i102702# in BIFF, the SKIP flag may be missing for the tAttrSkip token 2009-06-11 13:27:46 +0200 er r272867 : CWS-TOOLING: rebase CWS odff06 to trunk@272827 (milestone: DEV300:m50) 2009-04-30 18:28:02 +0200 er r271423 : #i94618# on status bar, ignore error of cell for COUNT and COUNTA if selection; patch from <kohei> 2009-04-30 13:58:44 +0200 er r271413 : get rid of that ugly mail address thingie in RTL_LOGFILE_CONTEXT_AUTHOR introduced by CWS frmdlg ... 2009-04-30 12:32:44 +0200 er r271411 : #i94618# do not display error of cell for COUNT and COUNTA status bar functions 2009-04-30 01:32:38 +0200 er r271399 : #i101316# improve accuracy of STDEV on equal values; patch from <regina> 2009-04-30 01:18:54 +0200 er r271398 : #i97605# improve accuracy of ASINH and ACOSH; patch from <regina> 2009-04-30 00:46:00 +0200 er r271397 : #i59153# improve accuracy of MOD; patch from <regina> 2009-04-30 00:29:43 +0200 er r271396 : #i69069# improve accuracy of NORMSDIST and POISSON; patch from <regina> 2009-04-29 23:53:28 +0200 er r271395 : #i100119# NORMDIST and LOGNORMDIST optional parameters, plus improvement in accuracy also of NORMSDIST (part of i69069); patch from <regina> 2009-04-28 18:22:07 +0200 er r271337 : #i97052# REPLACE with no length of text to be removed simply inserts new text; patch from <lvyue>, slightly modified 2009-03-24 17:29:36 +0100 er r269982 : #i97091# moved implementation of erf() and erfc() from scaddins to sal to provide C99 functions for compilers lacking it
Diffstat (limited to 'scaddins')
-rw-r--r--scaddins/source/analysis/analysishelper.cxx380
-rw-r--r--scaddins/source/analysis/analysishelper.hxx19
2 files changed, 163 insertions, 236 deletions
diff --git a/scaddins/source/analysis/analysishelper.cxx b/scaddins/source/analysis/analysishelper.cxx
index 32f9c4d2c04d..e241b0ab88c8 100644
--- a/scaddins/source/analysis/analysishelper.cxx
+++ b/scaddins/source/analysis/analysishelper.cxx
@@ -669,209 +669,16 @@ STRING ConvertFromDec( double fNum, double fMin, double fMax, sal_uInt16 nBase,
return aRet;
}
-/** Approximation algorithm for erf for 0 < x < 0.65. */
-void Erf0065( double x, double& fVal )
-{
- static const double pn[] = {
- 1.12837916709551256,
- 1.35894887627277916E-1,
- 4.03259488531795274E-2,
- 1.20339380863079457E-3,
- 6.49254556481904354E-5
- };
- static const double qn[] = {
- 1.00000000000000000,
- 4.53767041780002545E-1,
- 8.69936222615385890E-2,
- 8.49717371168693357E-3,
- 3.64915280629351082E-4
- };
-
- double fPSum = 0.0;
- double fQSum = 0.0;
- double fXPow = 1.0;
- for ( unsigned int i = 0; i <= 4; ++i )
- {
- fPSum += pn[i]*fXPow;
- fQSum += qn[i]*fXPow;
- fXPow *= x*x;
- }
- fVal = x * fPSum / fQSum;
-}
-
-/** Approximation algorithm for erfc for 0.65 < x < 6.0. */
-void Erfc0600( double x, double& fVal )
-{
- double fPSum = 0.0;
- double fQSum = 0.0;
- double fXPow = 1.0;
- const double *pn;
- const double *qn;
-
- if ( x < 2.2 )
- {
- static const double pn22[] = {
- 9.99999992049799098E-1,
- 1.33154163936765307,
- 8.78115804155881782E-1,
- 3.31899559578213215E-1,
- 7.14193832506776067E-2,
- 7.06940843763253131E-3
- };
- static const double qn22[] = {
- 1.00000000000000000,
- 2.45992070144245533,
- 2.65383972869775752,
- 1.61876655543871376,
- 5.94651311286481502E-1,
- 1.26579413030177940E-1,
- 1.25304936549413393E-2
- };
- pn = pn22;
- qn = qn22;
- }
- else /* if ( x < 6.0 ) this is true, but the compiler does not know */
- {
- static const double pn60[] = {
- 9.99921140009714409E-1,
- 1.62356584489366647,
- 1.26739901455873222,
- 5.81528574177741135E-1,
- 1.57289620742838702E-1,
- 2.25716982919217555E-2
- };
- static const double qn60[] = {
- 1.00000000000000000,
- 2.75143870676376208,
- 3.37367334657284535,
- 2.38574194785344389,
- 1.05074004614827206,
- 2.78788439273628983E-1,
- 4.00072964526861362E-2
- };
- pn = pn60;
- qn = qn60;
- }
-
- for ( unsigned int i = 0; i < 6; ++i )
- {
- fPSum += pn[i]*fXPow;
- fQSum += qn[i]*fXPow;
- fXPow *= x;
- }
- fQSum += qn[6]*fXPow;
- fVal = exp( -1.0*x*x )* fPSum / fQSum;
-}
-
-/** Approximation algorithm for erfc for 6.0 < x < 26.54 (but used for all
- x > 6.0). */
-void Erfc2654( double x, double& fVal )
-{
- static const double pn[] = {
- 5.64189583547756078E-1,
- 8.80253746105525775,
- 3.84683103716117320E1,
- 4.77209965874436377E1,
- 8.08040729052301677
- };
- static const double qn[] = {
- 1.00000000000000000,
- 1.61020914205869003E1,
- 7.54843505665954743E1,
- 1.12123870801026015E2,
- 3.73997570145040850E1
- };
-
- double fPSum = 0.0;
- double fQSum = 0.0;
- double fXPow = 1.0;
-
- for ( unsigned int i = 0; i <= 4; ++i )
- {
- fPSum += pn[i]*fXPow;
- fQSum += qn[i]*fXPow;
- fXPow /= x*x;
- }
- fVal = exp(-1.0*x*x)*fPSum / (x*fQSum);
-}
-
-double Erfc( double );
-
-/** Parent error function (erf) that calls different algorithms based on the
- value of x. It takes care of cases where x is negative as erf is an odd
- function i.e. erf(-x) = -erf(x).
-
- Kramer, W., and Blomquist, F., 2000, Algorithms with Guaranteed Error Bounds
- for the Error Function and the Complementary Error Function
-
- http://www.math.uni-wuppertal.de/wrswt/literatur_en.html
-
- @author Kohei Yoshida <kohei@openoffice.org>
-
- @see #i55735#
- */
+// implementation moved to module sal, see #i97091#
double Erf( double x )
{
- if( x == 0.0 )
- return 0.0;
-
- bool bNegative = false;
- if ( x < 0.0 )
- {
- x = fabs( x );
- bNegative = true;
- }
-
- double fErf = 1.0;
- if ( x < 1.0e-10 )
- fErf = (double) (x*1.1283791670955125738961589031215452L);
- else if ( x < 0.65 )
- Erf0065( x, fErf );
- else
- fErf = 1.0 - Erfc( x );
-
- if ( bNegative )
- fErf *= -1.0;
-
- return fErf;
+ return ::rtl::math::erf(x);
}
-/** Parent complementary error function (erfc) that calls different algorithms
- based on the value of x. It takes care of cases where x is negative as erfc
- satisfies relationship erfc(-x) = 2 - erfc(x). See the comment for Erf(x)
- for the source publication.
-
- @author Kohei Yoshida <kohei@openoffice.org>
-
- @see #i55735#
- */
+// implementation moved to module sal, see #i97091#
double Erfc( double x )
{
- if ( x == 0.0 )
- return 1.0;
-
- bool bNegative = false;
- if ( x < 0.0 )
- {
- x = fabs( x );
- bNegative = true;
- }
-
- double fErfc = 0.0;
- if ( x >= 0.65 )
- {
- if ( x < 6.0 )
- Erfc0600( x, fErfc );
- else
- Erfc2654( x, fErfc );
- }
- else
- fErfc = 1.0 - Erf( x );
-
- if ( bNegative )
- fErfc = 2.0 - fErfc;
-
- return fErfc;
+ return ::rtl::math::erfc(x);
}
inline sal_Bool IsNum( sal_Unicode c )
@@ -2378,10 +2185,11 @@ void ComplexList::Append( const SEQ( ANY )& aMultPars, ComplListAppendHandl eAH
-ConvertData::ConvertData( const sal_Char p[], double fC, ConvertDataClass e ) : aName( p, strlen( p ), RTL_TEXTENCODING_MS_1252 )
+ConvertData::ConvertData( const sal_Char p[], double fC, ConvertDataClass e, sal_Bool bPrefSupport ) : aName( p, strlen( p ), RTL_TEXTENCODING_MS_1252 )
{
fConst = fC;
eClass = e;
+ bPrefixSupport = bPrefSupport;
}
ConvertData::~ConvertData()
@@ -2391,13 +2199,26 @@ ConvertData::~ConvertData()
sal_Int16 ConvertData::GetMatchingLevel( const STRING& rRef ) const
{
- if( aName.equals( rRef ) )
+ STRING aStr = rRef;
+ sal_Int32 nLen = rRef.getLength();
+ sal_Int32 nIndex = rRef.lastIndexOf( '^' );
+ if( nIndex > 0 && nIndex == ( nLen - 2 ) )
+ {
+ const sal_Unicode* p = aStr.getStr();
+ aStr = STRING( p, nLen - 2 );
+ aStr += STRING( p[ nLen - 1 ] );
+ }
+ if( aName.equals( aStr ) )
return 0;
else
{
- const sal_Unicode* p = rRef.getStr();
+ const sal_Unicode* p = aStr.getStr();
- if ( aName == p + 1 )
+ nLen = aStr.getLength();
+ bool bPref = IsPrefixSupport();
+ bool bOneChar = (bPref && nLen > 1 && (aName == p + 1));
+ if (bOneChar || (bPref && nLen > 2 && (aName == p + 2) &&
+ *p == 'd' && *(p+1) == 'a'))
{
sal_Int16 n;
switch( *p )
@@ -2411,7 +2232,14 @@ sal_Int16 ConvertData::GetMatchingLevel( const STRING& rRef ) const
case 'u': n = -6; break;
case 'm': n = -3; break;
case 'c': n = -2; break;
- case 'd': n = -1; break;
+ case 'd':
+ {
+ if ( bOneChar )
+ n = -1; // deci
+ else
+ n = 1; // deca
+ }
+ break;
case 'e': n = 1; break;
case 'h': n = 2; break;
case 'k': n = 3; break;
@@ -2426,10 +2254,16 @@ sal_Int16 ConvertData::GetMatchingLevel( const STRING& rRef ) const
n = INV_MATCHLEV;
}
+// We could weed some nonsense out, ODFF doesn't say so though.
+#if 0
+ if (n < 0 && Class() == CDC_Information)
+ n = INV_MATCHLEV; // milli-bits doesn't make sense
+#endif
+
//! <HACK> #100616# "cm3" is not 10^-2 m^3 but 10^-6 m^3 !!! ------------------
if( n != INV_MATCHLEV )
{
- sal_Unicode cLast = p[ rRef.getLength() - 1 ];
+ sal_Unicode cLast = p[ aStr.getLength() - 1 ];
if( cLast == '2' )
n *= 2;
else if( cLast == '3' )
@@ -2439,6 +2273,27 @@ sal_Int16 ConvertData::GetMatchingLevel( const STRING& rRef ) const
return n;
}
+ else if ( nLen > 2 && ( aName == p + 2 ) && ( Class() == CDC_Information ) )
+ {
+ const sal_Unicode* pStr = aStr.getStr();
+ if ( *(pStr + 1) != 'i')
+ return INV_MATCHLEV;
+ sal_Int16 n;
+ switch( *pStr )
+ {
+ case 'k': n = 10; break;
+ case 'M': n = 20; break;
+ case 'G': n = 30; break;
+ case 'T': n = 40; break;
+ case 'P': n = 50; break;
+ case 'E': n = 60; break;
+ case 'Z': n = 70; break;
+ case 'Y': n = 80; break;
+ default:
+ n = INV_MATCHLEV;
+ }
+ return n;
+ }
else
return INV_MATCHLEV;
}
@@ -2451,6 +2306,25 @@ double ConvertData::Convert(
if( Class() != r.Class() )
THROW_IAE;
+ sal_Bool bBinFromLev = ( nLevFrom > 0 && ( nLevFrom % 10 ) == 0 );
+ sal_Bool bBinToLev = ( nLevTo > 0 && ( nLevTo % 10 ) == 0 );
+
+ if ( Class() == CDC_Information && ( bBinFromLev || bBinToLev ) )
+ {
+ if ( bBinFromLev && bBinToLev )
+ {
+ nLevFrom = sal::static_int_cast<sal_Int16>( nLevFrom - nLevTo );
+ f *= r.fConst / fConst;
+ if( nLevFrom )
+ f *= pow( 2.0, nLevFrom );
+ }
+ else if ( bBinFromLev )
+ f *= ( r.fConst / fConst ) * ( pow( 2.0, nLevFrom ) / pow( 10.0, nLevTo ) );
+ else
+ f *= ( r.fConst / fConst ) * ( pow( 10.0, nLevFrom ) / pow( 2.0, nLevTo ) );
+ return f;
+ }
+
nLevFrom = sal::static_int_cast<sal_Int16>( nLevFrom - nLevTo ); // effective level
f *= r.fConst / fConst;
@@ -2519,15 +2393,17 @@ double ConvertDataLinear::ConvertFromBase( double f, sal_Int16 n ) const
ConvertDataList::ConvertDataList( void )
{
#define NEWD(str,unit,cl) Append(new ConvertData(str,unit,cl))
+#define NEWDP(str,unit,cl) Append(new ConvertData(str,unit,cl,sal_True))
#define NEWL(str,unit,offs,cl) Append(new ConvertDataLinear(str,unit,offs,cl))
+#define NEWLP(str,unit,offs,cl) Append(new ConvertDataLinear(str,unit,offs,cl,sal_True))
// *** are extra and not standard Excel Analysis Addin!
// MASS: 1 Gram is...
- NEWD( "g", 1.0000000000000000E00, CDC_Mass ); // Gram
+ NEWDP( "g", 1.0000000000000000E00, CDC_Mass ); // Gram
NEWD( "sg", 6.8522050005347800E-05, CDC_Mass ); // Pieces
NEWD( "lbm", 2.2046229146913400E-03, CDC_Mass ); // Pound (commercial weight)
- NEWD( "u", 6.0221370000000000E23, CDC_Mass ); // U (atomic mass)
+ NEWDP( "u", 6.0221370000000000E23, CDC_Mass ); // U (atomic mass)
NEWD( "ozm", 3.5273971800362700E-02, CDC_Mass ); // Ounce (commercial weight)
NEWD( "stone", 1.574730e-04, CDC_Mass ); // *** Stone
NEWD( "ton", 1.102311e-06, CDC_Mass ); // *** Ton
@@ -2536,9 +2412,16 @@ ConvertDataList::ConvertDataList( void )
NEWD( "hweight", 1.968413E-05, CDC_Mass ); // *** Hundredweight
NEWD( "shweight", 2.204623E-05, CDC_Mass ); // *** Shorthundredweight
NEWD( "brton", 9.842065E-07, CDC_Mass ); // *** Gross Registered Ton
+ NEWD( "cwt", 2.2046226218487758E-05, CDC_Mass ); // U.S. (short) hundredweight
+ NEWD( "shweight", 2.2046226218487758E-05, CDC_Mass ); // U.S. (short) hundredweight also
+ NEWD( "uk_cwt", 1.9684130552221213E-05, CDC_Mass ); // Imperial hundredweight
+ NEWD( "lcwt", 1.9684130552221213E-05, CDC_Mass ); // Imperial hundredweight also
+ NEWD( "hweight", 1.9684130552221213E-05, CDC_Mass ); // Imperial hundredweight also
+ NEWD( "uk_ton", 9.8420652761106063E-07, CDC_Mass ); // Imperial ton
+ NEWD( "LTON", 9.8420652761106063E-07, CDC_Mass ); // Imperial ton also
// LENGTH: 1 Meter is...
- NEWD( "m", 1.0000000000000000E00, CDC_Length ); // Meter
+ NEWDP( "m", 1.0000000000000000E00, CDC_Length ); // Meter
NEWD( "mi", 6.2137119223733397E-04, CDC_Length ); // Britsh Mile 6,21371192237333969617434184363e-4
NEWD( "Nmi", 5.3995680345572354E-04, CDC_Length ); // Nautical Mile 5,39956803455723542116630669546e-4
NEWD( "in", 3.9370078740157480E01, CDC_Length ); // Inch 39,37007874015748031496062992126
@@ -2547,56 +2430,73 @@ ConvertDataList::ConvertDataList( void )
NEWD( "ang", 1.0000000000000000E10, CDC_Length ); // Angstroem
NEWD( "Pica", 2.8346456692913386E03, CDC_Length ); // Pica (1/72 Inch) 2834,6456692913385826771653543307
NEWD( "ell", 8.748906E-01, CDC_Length ); // *** Ell
- NEWD( "parsec", 3.240779E-17, CDC_Length ); // *** Parsec
- NEWD( "lightyear", 1.0570234557732930E-16, CDC_Length ); // *** Light Year
+ NEWDP( "parsec", 3.240779E-17, CDC_Length ); // *** Parsec
+ NEWDP( "pc", 3.240779E-17, CDC_Length ); // *** Parsec also
+ NEWDP( "lightyear", 1.0570234557732930E-16, CDC_Length ); // *** Light Year
+ NEWDP( "ly", 1.0570234557732930E-16, CDC_Length ); // *** Light Year also
+ NEWD( "survey_mi", 6.2136994949494949E-04, CDC_Length ); // U.S. survey mile
// TIME: 1 Second is...
NEWD( "yr", 3.1688087814028950E-08, CDC_Time ); // Year
NEWD( "day", 1.1574074074074074E-05, CDC_Time ); // Day
+ NEWD( "d", 1.1574074074074074E-05, CDC_Time ); // Day also
NEWD( "hr", 2.7777777777777778E-04, CDC_Time ); // Hour
NEWD( "mn", 1.6666666666666667E-02, CDC_Time ); // Minute
- NEWD( "sec", 1.0000000000000000E00, CDC_Time ); // Second
+ NEWD( "min", 1.6666666666666667E-02, CDC_Time ); // Minute also
+ NEWDP( "sec", 1.0000000000000000E00, CDC_Time ); // Second
+ NEWDP( "s", 1.0000000000000000E00, CDC_Time ); // Second also
// PRESSURE: 1 Pascal is...
- NEWD( "Pa", 1.0000000000000000E00, CDC_Pressure ); // Pascal
- NEWD( "atm", 9.8692329999819300E-06, CDC_Pressure ); // Atmoshpere
- NEWD( "mmHg", 7.5006170799862700E-03, CDC_Pressure ); // mm Hg (Mercury)
+ NEWDP( "Pa", 1.0000000000000000E00, CDC_Pressure ); // Pascal
+ NEWDP( "atm", 9.8692329999819300E-06, CDC_Pressure ); // Atmosphere
+ NEWDP( "at", 9.8692329999819300E-06, CDC_Pressure ); // Atmosphere also
+ NEWDP( "mmHg", 7.5006170799862700E-03, CDC_Pressure ); // mm Hg (Mercury)
NEWD( "Torr", 7.5006380000000000E-03, CDC_Pressure ); // *** Torr
NEWD( "psi", 1.4503770000000000E-04, CDC_Pressure ); // *** Psi
// FORCE: 1 Newton is...
- NEWD( "N", 1.0000000000000000E00, CDC_Force ); // Newton
- NEWD( "dyn", 1.0000000000000000E05, CDC_Force ); // Dyn
+ NEWDP( "N", 1.0000000000000000E00, CDC_Force ); // Newton
+ NEWDP( "dyn", 1.0000000000000000E05, CDC_Force ); // Dyn
+ NEWDP( "dy", 1.0000000000000000E05, CDC_Force ); // Dyn also
NEWD( "lbf", 2.24808923655339E-01, CDC_Force ); // Pound-Force
- NEWD( "pond", 1.019716E02, CDC_Force ); // *** Pond
+ NEWDP( "pond", 1.019716E02, CDC_Force ); // *** Pond
// ENERGY: 1 Joule is...
- NEWD( "J", 1.0000000000000000E00, CDC_Energy ); // Joule
- NEWD( "e", 1.0000000000000000E07, CDC_Energy ); // Erg -> http://www.chemie.fu-berlin.de/chemistry/general/si.html
+ NEWDP( "J", 1.0000000000000000E00, CDC_Energy ); // Joule
+ NEWDP( "e", 1.0000000000000000E07, CDC_Energy ); // Erg -> http://www.chemie.fu-berlin.de/chemistry/general/si.html
// NEWD( "e", 9.99999519343231E06, CDC_Energy ); // Erg
- NEWD( "c", 2.3900624947346700E-01, CDC_Energy ); // Thermodynamical Calorie
- NEWD( "cal", 2.3884619064201700E-01, CDC_Energy ); // Calorie
- NEWD( "eV", 6.2414570000000000E18, CDC_Energy ); // Electronvolt
+ NEWDP( "c", 2.3900624947346700E-01, CDC_Energy ); // Thermodynamical Calorie
+ NEWDP( "cal", 2.3884619064201700E-01, CDC_Energy ); // Calorie
+ NEWDP( "eV", 6.2414570000000000E18, CDC_Energy ); // Electronvolt
+ NEWDP( "ev", 6.2414570000000000E18, CDC_Energy ); // Electronvolt also
NEWD( "HPh", 3.7250611111111111E-07, CDC_Energy ); // Horsepower Hours
+ NEWD( "hh", 3.7250611111111111E-07, CDC_Energy ); // Horsepower Hours also
// NEWD( "HPh", 3.72506430801000E-07, CDC_Energy ); // Horsepower Hours
- NEWD( "Wh", 2.7777777777777778E-04, CDC_Energy ); // Watt Hours
+ NEWDP( "Wh", 2.7777777777777778E-04, CDC_Energy ); // Watt Hours
+ NEWDP( "wh", 2.7777777777777778E-04, CDC_Energy ); // Watt Hours also
NEWD( "flb", 2.37304222192651E01, CDC_Energy ); // Foot Pound
NEWD( "BTU", 9.4781506734901500E-04, CDC_Energy ); // British Thermal Unit
+ NEWD( "btu", 9.4781506734901500E-04, CDC_Energy ); // British Thermal Unit also
// POWER: 1 Watt is...
- NEWD( "W", 1.0000000000000000E00, CDC_Power ); // Watt
+ NEWDP( "W", 1.0000000000000000E00, CDC_Power ); // Watt
+ NEWDP( "w", 1.0000000000000000E00, CDC_Power ); // Watt also
NEWD( "HP", 1.341022E-03, CDC_Power ); // Horsepower
+ NEWD( "h", 1.341022E-03, CDC_Power ); // Horsepower also
NEWD( "PS", 1.359622E-03, CDC_Power ); // *** German Pferdestaerke
// NEWD( "HP", 1.4102006031908E-03, CDC_Power ); // Excel seams to be a little bit wrong... either this doesn't fit to J -> HPh
// MAGNETISM: 1 Tesla is...
- NEWD( "T", 1.0000000000000000E00, CDC_Magnetism ); // Tesla
- NEWD( "ga", 1.0000000000000000E04, CDC_Magnetism ); // Gauss
+ NEWDP( "T", 1.0000000000000000E00, CDC_Magnetism ); // Tesla
+ NEWDP( "ga", 1.0000000000000000E04, CDC_Magnetism ); // Gauss
// TEMERATURE: 1 Kelvin is...
NEWL( "C", 1.0000000000000000E00, -2.7315000000000000E02, CDC_Temperature ); // Celsius
+ NEWL( "cel", 1.0000000000000000E00, -2.7315000000000000E02, CDC_Temperature ); // Celsius also
NEWL( "F", 1.8000000000000000E00, -2.5537222222222222E02, CDC_Temperature ); // Fahrenheit
- NEWL( "K", 1.0000000000000000E00, +0.0000000000000000E00, CDC_Temperature ); // Kelvin
+ NEWL( "fah", 1.8000000000000000E00, -2.5537222222222222E02, CDC_Temperature ); // Fahrenheit also
+ NEWLP( "K", 1.0000000000000000E00, +0.0000000000000000E00, CDC_Temperature ); // Kelvin
+ NEWLP( "kel", 1.0000000000000000E00, +0.0000000000000000E00, CDC_Temperature ); // Kelvin also
NEWL( "Reau", 8.0000000000000000E-01, -2.7315000000000000E02, CDC_Temperature ); // *** Reaumur
NEWL( "Rank", 1.8000000000000000E00, +0.0000000000000000E00, CDC_Temperature ); // *** Rankine
@@ -2606,11 +2506,14 @@ ConvertDataList::ConvertDataList( void )
NEWD( "oz", 3.3806666666666667E01, CDC_Volume ); // Ounce Liquid
NEWD( "cup", 4.2258333333333333E00, CDC_Volume ); // Cup
NEWD( "pt", 2.1129166666666667E00, CDC_Volume ); // US Pint
+ NEWD( "us_pt", 2.1129166666666667E00, CDC_Volume ); // US Pint also
NEWD( "uk_pt", 1.75975569552166E00, CDC_Volume ); // UK Pint
NEWD( "qt", 1.0564583333333333E00, CDC_Volume ); // Quart
NEWD( "gal", 2.6411458333333333E-01, CDC_Volume ); // Gallone
- NEWD( "l", 1.0000000000000000E00, CDC_Volume ); // Liter
- NEWD( "m3", 1.0000000000000000E-03, CDC_Volume ); // *** Cubic Meter
+ NEWDP( "l", 1.0000000000000000E00, CDC_Volume ); // Liter
+ NEWDP( "L", 1.0000000000000000E00, CDC_Volume ); // Liter also
+ NEWDP( "lt", 1.0000000000000000E00, CDC_Volume ); // Liter also
+ NEWDP( "m3", 1.0000000000000000E-03, CDC_Volume ); // *** Cubic Meter
NEWD( "mi3", 2.3991275857892772E-13, CDC_Volume ); // *** Cubic Britsh Mile
NEWD( "Nmi3", 1.5742621468581148E-13, CDC_Volume ); // *** Cubic Nautical Mile
NEWD( "in3", 6.1023744094732284E01, CDC_Volume ); // *** Cubic Inch
@@ -2621,30 +2524,41 @@ ConvertDataList::ConvertDataList( void )
NEWD( "barrel", 6.289811E-03, CDC_Volume ); // *** Barrel (=42gal?)
NEWD( "bushel", 2.837759E-02, CDC_Volume ); // *** Bushel
NEWD( "regton", 3.531467E-04, CDC_Volume ); // *** Register ton
+ NEWD( "GRT", 3.531467E-04, CDC_Volume ); // *** Register ton also
NEWD( "Schooner", 2.3529411764705882E00, CDC_Volume ); // *** austr. Schooner
NEWD( "Middy", 3.5087719298245614E00, CDC_Volume ); // *** austr. Middy
NEWD( "Glass", 5.0000000000000000E00, CDC_Volume ); // *** austr. Glass
NEWD( "Sixpack", 0.5, CDC_Volume ); // ***
NEWD( "Humpen", 2.0, CDC_Volume ); // ***
+ NEWD( "ly3", 1.1810108125623799E-51, CDC_Volume ); // *** Cubic light-year
+ NEWD( "MTON", 1.4125866688595436E00, CDC_Volume ); // *** Measurement ton
+ NEWD( "tspm", 5.0000000000000000E02, CDC_Volume ); // *** Modern teaspoon
+ NEWD( "uk_gal", 2.6411458333333333E-01, CDC_Volume ); // U.K. / Imperial gallon ??
+ NEWD( "uk_qt", 1.0564583333333333E00, CDC_Volume ); // U.K. / Imperial quart ??
// 1 Square Meter is...
- NEWD( "m2", 1.0000000000000000E00, CDC_Area ); // *** Square Meter
+ NEWDP( "m2", 1.0000000000000000E00, CDC_Area ); // *** Square Meter
NEWD( "mi2", 3.8610215854244585E-07, CDC_Area ); // *** Square Britsh Mile
NEWD( "Nmi2", 2.9155334959812286E-07, CDC_Area ); // *** Square Nautical Mile
NEWD( "in2", 1.5500031000062000E03, CDC_Area ); // *** Square Inch
NEWD( "ft2", 1.0763910416709722E01, CDC_Area ); // *** Square Foot
NEWD( "yd2", 1.1959900463010803E00, CDC_Area ); // *** Square Yard
- NEWD( "ang2", 1.0000000000000000E20, CDC_Area ); // *** Square Angstroem
+ NEWDP( "ang2", 1.0000000000000000E20, CDC_Area ); // *** Square Angstroem
NEWD( "Pica2", 8.0352160704321409E06, CDC_Area ); // *** Square Pica
NEWD( "Morgen", 4.0000000000000000E-04, CDC_Area ); // *** Morgen
- NEWD( "ar", 1.000000E-02, CDC_Area ); // *** Ar
+ NEWDP( "ar", 1.000000E-02, CDC_Area ); // *** Ar
NEWD( "acre", 2.471053815E-04, CDC_Area ); // *** Acre
+ NEWD( "uk_acre", 2.4710538146716534E-04, CDC_Area ); // *** International acre
+ NEWD( "us_acre", 2.4710439304662790E-04, CDC_Area ); // *** U.S. survey/statute acre
+ NEWD( "ly2", 1.1172985860549147E-32, CDC_Area ); // *** Square Light-year
NEWD( "ha", 1.000000E-04, CDC_Area ); // *** Hectare
NEWD( "Quadratlatschen",5.6689342403628117914,CDC_Area ); // ***
// SPEED: 1 Meter per Second is...
- NEWD( "m/s", 1.0000000000000000E00, CDC_Speed ); // *** Meters per Second
+ NEWDP( "m/s", 1.0000000000000000E00, CDC_Speed ); // *** Meters per Second
+ NEWDP( "m/sec", 1.0000000000000000E00, CDC_Speed ); // *** Meters per Second also
NEWD( "m/h", 3.6000000000000000E03, CDC_Speed ); // *** Meters per Hour
+ NEWD( "m/hr", 3.6000000000000000E03, CDC_Speed ); // *** Meters per Hour also
NEWD( "mph", 2.2369362920544023E00, CDC_Speed ); // *** Britsh Miles per Hour
NEWD( "kn", 1.9438444924406048E00, CDC_Speed ); // *** Knot = Nautical Miles per Hour
NEWD( "admkn", 1.9438446603753486E00, CDC_Speed ); // *** Admiralty Knot
@@ -2652,6 +2566,10 @@ ConvertDataList::ConvertDataList( void )
NEWD( "ludicrous speed", 2.0494886343432328E-14, CDC_Speed ); // ***
NEWD( "laecherliche Geschwindigkeit", 4.0156958471424288E-06, CDC_Speed); // ***
NEWD( "ridiculous speed", 4.0156958471424288E-06, CDC_Speed); // ***
+
+ // INFORMATION: 1 Bit is...
+ NEWDP( "bit", 1.00E00, CDC_Information); // *** Bit
+ NEWDP( "byte", 1.25E-01, CDC_Information); // *** Byte
}
diff --git a/scaddins/source/analysis/analysishelper.hxx b/scaddins/source/analysis/analysishelper.hxx
index bdc3e6d7e977..e651e8a16eb5 100644
--- a/scaddins/source/analysis/analysishelper.hxx
+++ b/scaddins/source/analysis/analysishelper.hxx
@@ -514,7 +514,7 @@ public:
enum ConvertDataClass
{
CDC_Mass, CDC_Length, CDC_Time, CDC_Pressure, CDC_Force, CDC_Energy, CDC_Power, CDC_Magnetism,
- CDC_Temperature, CDC_Volume, CDC_Area, CDC_Speed
+ CDC_Temperature, CDC_Volume, CDC_Area, CDC_Speed, CDC_Information
};
@@ -533,11 +533,13 @@ protected:
double fConst;
STRING aName;
ConvertDataClass eClass;
+ sal_Bool bPrefixSupport;
public:
ConvertData(
const sal_Char pUnitName[],
double fConvertConstant,
- ConvertDataClass eClass );
+ ConvertDataClass eClass,
+ sal_Bool bPrefSupport = sal_False );
virtual ~ConvertData();
@@ -556,6 +558,7 @@ public:
virtual double ConvertFromBase( double fVal, sal_Int16 nMatchLevel ) const;
inline ConvertDataClass Class( void ) const;
+ inline sal_Bool IsPrefixSupport( void ) const;
};
@@ -570,7 +573,8 @@ public:
const sal_Char pUnitName[],
double fConvertConstant,
double fConvertOffset,
- ConvertDataClass eClass );
+ ConvertDataClass eClass,
+ sal_Bool bPrefSupport = sal_False );
virtual ~ConvertDataLinear();
@@ -891,9 +895,14 @@ inline ConvertDataClass ConvertData::Class( void ) const
+inline sal_Bool ConvertData::IsPrefixSupport( void ) const
+{
+ return bPrefixSupport;
+}
-inline ConvertDataLinear::ConvertDataLinear( const sal_Char* p, double fC, double fO, ConvertDataClass e ) :
- ConvertData( p, fC, e ),
+inline ConvertDataLinear::ConvertDataLinear( const sal_Char* p, double fC, double fO, ConvertDataClass e,
+ sal_Bool bPrefSupport ) :
+ ConvertData( p, fC, e, bPrefSupport ),
fOffs( fO )
{
}