diff options
Diffstat (limited to 'sw/source/core/bastyp')
-rw-r--r-- | sw/source/core/bastyp/bparr.cxx | 20 | ||||
-rw-r--r-- | sw/source/core/bastyp/calc.cxx | 60 | ||||
-rw-r--r-- | sw/source/core/bastyp/init.cxx | 6 |
3 files changed, 47 insertions, 39 deletions
diff --git a/sw/source/core/bastyp/bparr.cxx b/sw/source/core/bastyp/bparr.cxx index 69ad8c6b0894..afd1c7f135a7 100644 --- a/sw/source/core/bastyp/bparr.cxx +++ b/sw/source/core/bastyp/bparr.cxx @@ -2,9 +2,9 @@ * * $RCSfile: bparr.cxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: mib $ $Date: 2001-11-28 13:47:32 $ + * last change: $Author: hr $ $Date: 2003-03-27 15:39:26 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -117,11 +117,11 @@ BigPtrArray::~BigPtrArray() BlockInfo** pp = ppInf; for( USHORT n = 0; n < nBlock; ++n, ++pp ) { - __DELETE( (*pp)->nElem ) (*pp)->pData; - delete *pp; + delete[] (*pp)->pData; + delete *pp; } } - __DELETE( nMaxBlock ) ppInf; + delete[] ppInf; } // Einfachst-Implementation, evtl. spaeter mal komplexer @@ -278,7 +278,7 @@ BlockInfo* BigPtrArray::InsBlock( USHORT pos ) // dann sollte wir mal das Array erweitern BlockInfo** ppNew = new BlockInfo* [ nMaxBlock + nBlockGrowSize ]; memcpy( ppNew, ppInf, nMaxBlock * sizeof( BlockInfo* )); - __DELETE( nMaxBlock ) ppInf; + delete[] ppInf; nMaxBlock += nBlockGrowSize; ppInf = ppNew; } @@ -309,7 +309,7 @@ void BigPtrArray::BlockDel( USHORT nDel ) nDel = (( nBlock / nBlockGrowSize ) + 1 ) * nBlockGrowSize; BlockInfo** ppNew = new BlockInfo* [ nDel ]; memcpy( ppNew, ppInf, nBlock * sizeof( BlockInfo* )); - __DELETE( nMaxBlock ) ppInf; + delete[] ppInf; ppInf = ppNew; nMaxBlock = nDel; } @@ -449,7 +449,7 @@ void BigPtrArray::Remove( ULONG pos, ULONG n ) if( !p->nElem ) { // eventuell Block ganz entfernen - delete p->pData; + delete[] p->pData; nBlkdel++; if( USHRT_MAX == nBlk1del ) nBlk1del = cur; @@ -588,8 +588,8 @@ USHORT BigPtrArray::Compress( short nMax ) if( !p->nElem ) { // dann kann der entfernt werden - delete p->pData; - delete p, p = 0; + delete[] p->pData; + delete p, p = 0; ++nBlkdel; } else diff --git a/sw/source/core/bastyp/calc.cxx b/sw/source/core/bastyp/calc.cxx index c2ffd57314c2..342e2bff30ee 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.20 $ + * $Revision: 1.21 $ * - * last change: $Author: fme $ $Date: 2002-11-07 09:43:32 $ + * last change: $Author: hr $ $Date: 2003-03-27 15:39:28 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -83,8 +83,8 @@ #include <tools/svwin.h> #endif -#ifndef _TOOLS_SOLMATH_HXX -#include <tools/solmath.hxx> +#ifndef INCLUDED_RTL_MATH_HXX +#include <rtl/math.hxx> #endif #ifndef _SVX_ADRITEM_HXX //autogen #include <svx/adritem.hxx> @@ -144,6 +144,9 @@ #ifndef _SWUNODEF_HXX #include <swunodef.hxx> #endif +#ifndef _SWTYPES_HXX +#include <swtypes.hxx> +#endif // tippt sich schneller #define RESOURCE ViewShell::GetShellRes() @@ -556,13 +559,11 @@ String SwCalc::GetStrResult( double nValue, BOOL bRound ) } USHORT nDec = 15; //pLclData->getNumDigits(); - String aRetStr; - - SolarMath::DoubleToString( aRetStr, nValue, - 'A', /// 'F' 'E' 'G' 'A' - nDec, /// Nachkommastellen - pLclData->getNumDecimalSep().GetChar(0), /// Dezimalseparator - TRUE ); + String aRetStr( ::rtl::math::doubleToUString( nValue, + rtl_math_StringFormat_Automatic, + nDec, + pLclData->getNumDecimalSep().GetChar(0), + true )); return aRetStr; } @@ -1628,18 +1629,20 @@ FASTBOOL SwCalc::Str2Double( const String& rCommand, xub_StrLen& rCommandPos, if( !pLclD ) pLclD = &GetAppLocaleData(); - const xub_Unicode *pEnd, nCurrCmdPos = rCommandPos; - int nErrno; - rVal = SolarMath::StringToDouble( rCommand.GetBuffer() + rCommandPos, - pLclD->getNumThousandSep().GetChar(0), - pLclD->getNumDecimalSep().GetChar(0), - nErrno, &pEnd ); + const xub_Unicode nCurrCmdPos = rCommandPos; + rtl_math_ConversionStatus eStatus; + const sal_Unicode* pEnd; + rVal = rtl_math_uStringToDouble( rCommand.GetBuffer() + rCommandPos, + rCommand.GetBuffer() + rCommand.Len(), + pLclD->getNumDecimalSep().GetChar(0), + pLclD->getNumThousandSep().GetChar(0), + &eStatus, &pEnd ); rCommandPos = pEnd - rCommand.GetBuffer(); if( !pLclData && pLclD != &GetAppLocaleData() ) delete (LocaleDataWrapper*)pLclD; - return 0 == nErrno && nCurrCmdPos != rCommandPos; + return rtl_math_ConversionStatus_Ok == eStatus && nCurrCmdPos != rCommandPos; } FASTBOOL SwCalc::Str2Double( const String& rCommand, xub_StrLen& rCommandPos, @@ -1656,18 +1659,20 @@ FASTBOOL SwCalc::Str2Double( const String& rCommand, xub_StrLen& rCommandPos, 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 ); + const xub_Unicode nCurrCmdPos = rCommandPos; + rtl_math_ConversionStatus eStatus; + const sal_Unicode* pEnd; + rVal = rtl_math_uStringToDouble( rCommand.GetBuffer() + rCommandPos, + rCommand.GetBuffer() + rCommand.Len(), + pLclD->getNumDecimalSep().GetChar(0), + pLclD->getNumThousandSep().GetChar(0), + &eStatus, &pEnd ); rCommandPos = pEnd - rCommand.GetBuffer(); if( pLclD != &GetAppLocaleData() ) delete (LocaleDataWrapper*)pLclD; - return 0 == nErrno && nCurrCmdPos != rCommandPos; + return rtl_math_ConversionStatus_Ok == eStatus && nCurrCmdPos != rCommandPos; } //------------------------------------------------------------------------------ @@ -1740,7 +1745,6 @@ SwSbxValue::~SwSbxValue() { } - BOOL SwSbxValue::GetBool() const { return SbxSTRING == GetType() ? 0 != GetString().Len() @@ -1755,6 +1759,10 @@ double SwSbxValue::GetDouble() const xub_StrLen nStt = 0; SwCalc::Str2Double( GetString(), nStt, nRet ); } + else if (IsBool()) + { + nRet = 0 != GetBool() ? 1.0 : 0.0; + } else nRet = SbxValue::GetDouble(); return nRet; diff --git a/sw/source/core/bastyp/init.cxx b/sw/source/core/bastyp/init.cxx index a6b85ced9b74..ead3be0207b1 100644 --- a/sw/source/core/bastyp/init.cxx +++ b/sw/source/core/bastyp/init.cxx @@ -2,9 +2,9 @@ * * $RCSfile: init.cxx,v $ * - * $Revision: 1.35 $ + * $Revision: 1.36 $ * - * last change: $Author: os $ $Date: 2002-08-26 11:36:56 $ + * last change: $Author: hr $ $Date: 2003-03-27 15:39:29 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -991,7 +991,7 @@ void _FinitCore() #ifndef PRODUCT //Defaultattribut freigeben lassen um asserts zu vermeiden. - if ( aAttrTab[0]->GetRef() ) + if ( aAttrTab[0]->GetRefCount() ) SfxItemPool::ReleaseDefaults( aAttrTab, POOLATTR_END-POOLATTR_BEGIN, FALSE); #endif delete SwDoc::pACmpltWords; |