diff options
author | Kohei Yoshida <kyoshida@novell.com> | 2010-11-12 16:34:27 -0500 |
---|---|---|
committer | Kohei Yoshida <kyoshida@novell.com> | 2010-11-12 16:34:27 -0500 |
commit | 8a5114fa5e7ce8dbb25fe2b49a9086647fd4dfd5 (patch) | |
tree | c608c8f33542349b79195b5b67636b6a0a989372 | |
parent | e76c614251ee2b8dfd6d7cd10ec2b0f0ed527fa8 (diff) |
More datapilt-related cleanups.
New code should *never* use BOOL, TRUE, FALSE. Also the indentation
mistakes are pretty frequent.
-rw-r--r-- | sc/inc/dpcachetable.hxx | 2 | ||||
-rw-r--r-- | sc/inc/dpglobal.hxx | 45 | ||||
-rw-r--r-- | sc/inc/dpshttab.hxx | 6 | ||||
-rw-r--r-- | sc/inc/dptablecache.hxx | 23 | ||||
-rw-r--r-- | sc/source/core/data/dpcachetable.cxx | 4 | ||||
-rw-r--r-- | sc/source/core/data/dpglobal.cxx | 29 | ||||
-rw-r--r-- | sc/source/core/data/dpshttab.cxx | 2 | ||||
-rw-r--r-- | sc/source/core/data/dptablecache.cxx | 120 |
8 files changed, 110 insertions, 121 deletions
diff --git a/sc/inc/dpcachetable.hxx b/sc/inc/dpcachetable.hxx index 1fda7446f717..22e57a2ac495 100644 --- a/sc/inc/dpcachetable.hxx +++ b/sc/inc/dpcachetable.hxx @@ -139,7 +139,7 @@ public: /** Fill the internal table from the cell range provided. This function assumes that the first row is the column header. */ - void fillTable( const ScQueryParam& rQuery, BOOL* pSpecial, + void fillTable( const ScQueryParam& rQuery, bool* pSpecial, bool bIgnoreEmptyRows, bool bRepeatIfEmpty ); /** Fill the internal table from database connection object. This function diff --git a/sc/inc/dpglobal.hxx b/sc/inc/dpglobal.hxx index 73da14d17642..253f478cbf2b 100644 --- a/sc/inc/dpglobal.hxx +++ b/sc/inc/dpglobal.hxx @@ -29,9 +29,7 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ -// Wang Xu Ming - DataPilot migration -// Buffer&&Performance -// + #ifndef _SC_DPGLOBAL_HXX #define _SC_DPGLOBAL_HXX @@ -107,6 +105,9 @@ class TypedStrData; class ScDPObject; +class ScDPInfoWnd; +class ScDocShell; +class ScTabViewShell; class SC_DLLPUBLIC ScDPItemData { @@ -122,25 +123,25 @@ private: String aString; double fValue; BYTE mbFlag; - //BOOL bHasValue: 1 ; - //BOOL bHasData: 1; - //BOOL bErr: 1; + //bool bHasValue: 1 ; + //bool bHasData: 1; + //bool bErr: 1; friend class ScDPTableDataCache; public: ScDPItemData() : nNumFormat( 0 ), fValue(0.0), mbFlag( 0 ){} ScDPItemData( ULONG nNF, const String & rS, double fV, BYTE bF ):nNumFormat(nNF), aString(rS), fValue(fV), mbFlag( bF ){} - ScDPItemData( const String& rS, double fV = 0.0, BOOL bHV = FALSE, const ULONG nNumFormat = 0 , BOOL bData = TRUE) ; + ScDPItemData( const String& rS, double fV = 0.0, bool bHV = FALSE, const ULONG nNumFormat = 0 , bool bData = TRUE) ; ScDPItemData( ScDocument* pDoc, SCROW nRow, USHORT nCol, USHORT nDocTab ); void SetString( const String& rS ) { aString = rS; mbFlag &= ~(MK_VAL|MK_DATE); nNumFormat = 0; mbFlag |= MK_DATA; } // void SetValue ( double value , ULONG nNumFormat = 0 ) { bHasValue = TRUE; nNumFormat = 0;bHasData = TRUE; bDate = FALSE; fValue = value ;} - BOOL IsCaseInsEqual( const ScDPItemData& r ) const; + bool IsCaseInsEqual( const ScDPItemData& r ) const; size_t Hash() const; // exact equality - BOOL operator==( const ScDPItemData& r ) const; + bool operator==( const ScDPItemData& r ) const; // case insensitive equality static sal_Int32 Compare( const ScDPItemData& rA, const ScDPItemData& rB ); @@ -149,16 +150,16 @@ public: #endif public: - BOOL IsHasData() const ; - BOOL IsHasErr() const ; - BOOL IsValue() const; + bool IsHasData() const ; + bool IsHasErr() const ; + bool IsValue() const; String GetString() const ; double GetValue() const ; ULONG GetNumFormat() const ; - BOOL HasStringData() const ; - BOOL IsDate() const; - BOOL HasDatePart() const; - void SetDate( BOOL b ) ; + bool HasStringData() const ; + bool IsDate() const; + bool HasDatePart() const; + void SetDate( bool b ) ; TypedStrData* CreateTypeString( ); sal_uInt8 GetType() const; @@ -169,11 +170,10 @@ public: class SC_DLLPUBLIC ScDPItemDataPool { public: - // construct - ScDPItemDataPool(void); + ScDPItemDataPool(); ScDPItemDataPool(const ScDPItemDataPool& r); - virtual ~ScDPItemDataPool(void); + virtual ~ScDPItemDataPool(); virtual const ScDPItemData* getData( sal_Int32 nId ); virtual sal_Int32 getDataId( const ScDPItemData& aData ); virtual sal_Int32 insertData( const ScDPItemData& aData ); @@ -189,13 +189,10 @@ protected: DataHash maItemIds; }; -class ScDPInfoWnd; -class ScDocShell; -class ScTabViewShell; namespace ScDPGlobal { // used for core data - String GetFieldFuncString( const String& rSourceName, USHORT &rFuncMask, BOOL bIsValue ); + String GetFieldFuncString( const String& rSourceName, USHORT &rFuncMask, bool bIsValue ); String GetFuncString( const String &rString, const USHORT nIndex ); com::sun::star::uno::Reference<com::sun::star::container::XNameAccess> DP_GetMembers( const com::sun::star::uno::Reference< com::sun::star::sheet::XDimensionsSupplier>&rSrc, long nField ); @@ -204,7 +201,7 @@ namespace ScDPGlobal Rectangle operator *( const Rectangle &rLeft, const std::pair<double,double> & rRight ); // used for DataPilot Panel ScDPInfoWnd* GetDPInfoWnd( ScTabViewShell *pViewShell ); - bool ChkDPTableOverlap( ScDocument *pDestDoc, std::list<ScDPObject> & rClipboard, SCCOL nClipStartCol, SCROW nClipStartRow, SCCOL nStartCol, SCROW nStartRow, SCTAB nStartTab, USHORT nEndTab, BOOL bExcludeClip = FALSE ); + bool ChkDPTableOverlap( ScDocument *pDestDoc, std::list<ScDPObject> & rClipboard, SCCOL nClipStartCol, SCROW nClipStartRow, SCCOL nStartCol, SCROW nStartRow, SCTAB nStartTab, USHORT nEndTab, bool bExcludeClip = FALSE ); } #endif diff --git a/sc/inc/dpshttab.hxx b/sc/inc/dpshttab.hxx index 13a201c0020e..c4fadb848ca5 100644 --- a/sc/inc/dpshttab.hxx +++ b/sc/inc/dpshttab.hxx @@ -74,9 +74,9 @@ class SC_DLLPUBLIC ScSheetDPData : public ScDPTableData { private: ScQueryParam aQuery; - BOOL* pSpecial; - BOOL bIgnoreEmptyRows; - BOOL bRepeatIfEmpty; + bool* pSpecial; + bool bIgnoreEmptyRows; + bool bRepeatIfEmpty; ScDPCacheTable aCacheTable; diff --git a/sc/inc/dptablecache.hxx b/sc/inc/dptablecache.hxx index a662795809f4..8ff667822f09 100644 --- a/sc/inc/dptablecache.hxx +++ b/sc/inc/dptablecache.hxx @@ -29,14 +29,11 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ -#ifndef DPTABLECACHE_HXX -#define DPTABLECACHE_HXX -// Wang Xu Ming -- 12/21/2008 -// Add Data Cache Support. +#ifndef SC_DPTABLECACHE_HXX +#define SC_DPTABLECACHE_HXX + #include "global.hxx" -//Added by PengYunQuan for SODC_16015 #include <svl/zforlist.hxx> -//end #include <vector> #include "dpglobal.hxx" @@ -66,7 +63,7 @@ class SC_DLLPUBLIC ScDPTableDataCache std::vector<SCROW>* mpGlobalOrder; //Sorted members index std::vector<SCROW>* mpIndexOrder; //Index the sorted number std::vector<ScDPItemData*> mrLabelNames; //Source Label data - std::vector<BOOL> mbEmptyRow; //If empty row? + std::vector<bool> mbEmptyRow; //If empty row? mutable ScDPItemDataPool maAdditionalDatas; public: SCROW GetOrder( long nDim, SCROW nIndex ) const; @@ -80,7 +77,7 @@ public: const ScDPItemData* GetSortedItemData( SCCOL nDim, SCROW nOrder ) const; ULONG GetNumType ( ULONG nFormat ) const; ULONG GetNumberFormat( long nDim ) const; - BOOL IsDateDimension( long nDim ) const ; + bool IsDateDimension( long nDim ) const ; ULONG GetDimNumType( SCCOL nDim) const; SCROW GetDimMemberCount( SCCOL nDim ) const; @@ -92,12 +89,12 @@ public: bool InitFromDataBase (const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet>& xRowSet, const Date& rNullDate); SCROW GetRowCount() const; - SCROW GetItemDataId( USHORT nDim, SCROW nRow, BOOL bRepeatIfEmpty ) const; + SCROW GetItemDataId( USHORT nDim, SCROW nRow, bool bRepeatIfEmpty ) const; String GetDimensionName( USHORT nColumn ) const; bool IsEmptyMember( SCROW nRow, USHORT nColumn ) const; bool IsRowEmpty( SCROW nRow ) const; bool IsValid() const; - bool ValidQuery( SCROW nRow, const ScQueryParam& rQueryParam, BOOL* pSpecial ); + bool ValidQuery( SCROW nRow, const ScQueryParam& rQueryParam, bool* pSpecial ); ScDocument* GetDoc() const;//ms-cache-core long GetColumnCount() const; @@ -105,17 +102,15 @@ public: const ScDPItemData* GetItemDataById( long nDim, SCROW nId ) const; - BOOL operator== ( const ScDPTableDataCache& r ) const; + bool operator== ( const ScDPTableDataCache& r ) const; -//construction ScDPTableDataCache( ScDocument* pDoc ); -//deconstruction virtual ~ScDPTableDataCache(); protected: private: void AddLabel( ScDPItemData* pData); - BOOL AddData( long nDim, ScDPItemData* itemData ); + bool AddData( long nDim, ScDPItemData* itemData ); }; #endif //DPTABLECACHE_HXX diff --git a/sc/source/core/data/dpcachetable.cxx b/sc/source/core/data/dpcachetable.cxx index 3ad2af69b63c..54556e4e55fb 100644 --- a/sc/source/core/data/dpcachetable.cxx +++ b/sc/source/core/data/dpcachetable.cxx @@ -186,8 +186,8 @@ sal_Int32 ScDPCacheTable::getColSize() const return getCache()->GetColumnCount(); } -void ScDPCacheTable::fillTable( const ScQueryParam& rQuery, BOOL* pSpecial, - bool bIgnoreEmptyRows, bool bRepeatIfEmpty ) +void ScDPCacheTable::fillTable( + const ScQueryParam& rQuery, bool* pSpecial, bool bIgnoreEmptyRows, bool bRepeatIfEmpty) { // check cache if ( mpCache == NULL ) diff --git a/sc/source/core/data/dpglobal.cxx b/sc/source/core/data/dpglobal.cxx index 4ce715600a9c..23e1bcb2f58d 100644 --- a/sc/source/core/data/dpglobal.cxx +++ b/sc/source/core/data/dpglobal.cxx @@ -60,28 +60,28 @@ namespace ScDPGlobal return strRet; } - bool ChkDPTableOverlap( ScDocument *pDestDoc, std::list<ScDPObject> & rClipboard, SCCOL nClipStartCol, SCROW nClipStartRow, SCCOL nStartCol, SCROW nStartRow, SCTAB nStartTab, USHORT nEndTab, BOOL bExcludeClip /*= FALSE*/ ) + bool ChkDPTableOverlap( ScDocument *pDestDoc, std::list<ScDPObject> & rClipboard, SCCOL nClipStartCol, SCROW nClipStartRow, SCCOL nStartCol, SCROW nStartRow, SCTAB nStartTab, USHORT nEndTab, BOOL bExcludeClip /*= FALSE*/ ) { - if ( ScDPCollection* pDPCollection = pDestDoc->GetDPCollection() ) + if (ScDPCollection* pDPCollection = pDestDoc->GetDPCollection()) { USHORT nCount = pDPCollection->GetCount(); SCsCOL nOffsetX = nStartCol - nClipStartCol; SCsROW nOffsetY = nStartRow - nClipStartRow; - for( std::list<ScDPObject>::iterator iter = rClipboard.begin(); iter!=rClipboard.end(); iter++ ) + for (std::list<ScDPObject>::iterator iter = rClipboard.begin(); iter!=rClipboard.end(); iter++) { ScRange aRange = iter->GetOutRange(); - for( USHORT nCurrTab = nStartTab; nCurrTab<=nEndTab; nCurrTab++ ) + for (USHORT nCurrTab = nStartTab; nCurrTab<=nEndTab; nCurrTab++) { SCsTAB nOffsetZ = nCurrTab - aRange.aStart.Tab(); aRange.Move( nOffsetX, nOffsetY, nOffsetZ ); - for ( USHORT i = 0; i<nCount; i++) + for (USHORT i = 0; i<nCount; i++) { - if ( (*pDPCollection)[i] && aRange.Intersects( (*pDPCollection)[i]->GetOutRange())) + if ((*pDPCollection)[i] && aRange.Intersects( (*pDPCollection)[i]->GetOutRange())) { - if ( bExcludeClip && iter->GetOutRange() == (*pDPCollection)[i]->GetOutRange() ) + if (bExcludeClip && iter->GetOutRange() == (*pDPCollection)[i]->GetOutRange()) { continue; } @@ -91,25 +91,22 @@ namespace ScDPGlobal } } } - return true; -} -//end + return true; + } } -// -------------------------------------------------------------------- -// ScDPItemDataPool -// Construct -ScDPItemDataPool::ScDPItemDataPool(void) + +ScDPItemDataPool::ScDPItemDataPool() { } -// + ScDPItemDataPool::ScDPItemDataPool(const ScDPItemDataPool& r): maItems(r.maItems), maItemIds(r.maItemIds) { } -ScDPItemDataPool::~ScDPItemDataPool(void) +ScDPItemDataPool::~ScDPItemDataPool() { } diff --git a/sc/source/core/data/dpshttab.cxx b/sc/source/core/data/dpshttab.cxx index c2ae12b20ed1..cb41716aff1c 100644 --- a/sc/source/core/data/dpshttab.cxx +++ b/sc/source/core/data/dpshttab.cxx @@ -71,7 +71,7 @@ ScSheetDPData::ScSheetDPData( ScDocument* pD, const ScSheetSourceDesc& rDesc , l aCacheTable( pD, rDesc.GetCacheId( pD, nCacheId)) { SCSIZE nEntryCount( aQuery.GetEntryCount()); - pSpecial = new BOOL[nEntryCount]; + pSpecial = new bool[nEntryCount]; for (SCSIZE j = 0; j < nEntryCount; ++j ) { ScQueryEntry& rEntry = aQuery.GetEntry(j); diff --git a/sc/source/core/data/dptablecache.cxx b/sc/source/core/data/dptablecache.cxx index 1e8b4cd2dea3..68924b6a9ff7 100644 --- a/sc/source/core/data/dptablecache.cxx +++ b/sc/source/core/data/dptablecache.cxx @@ -61,15 +61,15 @@ using ::com::sun::star::uno::UNO_QUERY_THROW; namespace { -BOOL lcl_isDate( ULONG nNumType ) +bool lcl_isDate( ULONG nNumType ) { return ( (nNumType & NUMBERFORMAT_DATE) != 0 )? 1:0 ; } -BOOL lcl_Search( const std::vector<ScDPItemData*>& list, const ::std::vector<SCROW>& rOrder, const ScDPItemData& item, SCROW& rIndex) +bool lcl_Search( const std::vector<ScDPItemData*>& list, const ::std::vector<SCROW>& rOrder, const ScDPItemData& item, SCROW& rIndex) { rIndex = list.size(); - BOOL bFound = FALSE; + bool bFound = false; SCROW nLo = 0; SCROW nHi = list.size() - 1; SCROW nIndex; @@ -85,7 +85,7 @@ BOOL lcl_Search( const std::vector<ScDPItemData*>& list, const ::std::vector<SCR nHi = nIndex - 1; if (nCompare == 0) { - bFound = TRUE; + bFound = true; nLo = nIndex; } } @@ -109,7 +109,7 @@ ScDPItemData* lcl_GetItemValue(const Reference<sdbc::XRow>& xRow, sal_Int32 nTy { nNumType = NUMBERFORMAT_LOGICAL; fValue = xRow->getBoolean(nCol) ? 1 : 0; - return new ScDPItemData( rStr, fValue,TRUE,nNumType); + return new ScDPItemData( rStr, fValue,true,nNumType); } case sdbc::DataType::TINYINT: case sdbc::DataType::SMALLINT: @@ -123,7 +123,7 @@ ScDPItemData* lcl_GetItemValue(const Reference<sdbc::XRow>& xRow, sal_Int32 nTy { //! do the conversion here? fValue = xRow->getDouble(nCol); - return new ScDPItemData( rStr, fValue,TRUE); + return new ScDPItemData( rStr, fValue,true); } case sdbc::DataType::DATE: { @@ -131,7 +131,7 @@ ScDPItemData* lcl_GetItemValue(const Reference<sdbc::XRow>& xRow, sal_Int32 nTy util::Date aDate = xRow->getDate(nCol); fValue = Date(aDate.Day, aDate.Month, aDate.Year) - rNullDate; - return new ScDPItemData( rStr, fValue, TRUE, nNumType ); + return new ScDPItemData( rStr, fValue, true, nNumType ); } case sdbc::DataType::TIME: { @@ -140,7 +140,7 @@ ScDPItemData* lcl_GetItemValue(const Reference<sdbc::XRow>& xRow, sal_Int32 nTy util::Time aTime = xRow->getTime(nCol); fValue = ( aTime.Hours * 3600 + aTime.Minutes * 60 + aTime.Seconds + aTime.HundredthSeconds / 100.0 ) / D_TIMEFACTOR; - return new ScDPItemData( rStr,fValue, TRUE, nNumType ); + return new ScDPItemData( rStr,fValue, true, nNumType ); } case sdbc::DataType::TIMESTAMP: { @@ -150,7 +150,7 @@ ScDPItemData* lcl_GetItemValue(const Reference<sdbc::XRow>& xRow, sal_Int32 nTy fValue = ( Date( aStamp.Day, aStamp.Month, aStamp.Year ) - rNullDate ) + ( aStamp.Hours * 3600 + aStamp.Minutes * 60 + aStamp.Seconds + aStamp.HundredthSeconds / 100.0 ) / D_TIMEFACTOR; - return new ScDPItemData( rStr,fValue, TRUE, nNumType ); + return new ScDPItemData( rStr,fValue, true, nNumType ); } case sdbc::DataType::CHAR: case sdbc::DataType::VARCHAR: @@ -172,9 +172,9 @@ ScDPItemData* lcl_GetItemValue(const Reference<sdbc::XRow>& xRow, sal_Int32 nTy } -ScDPItemData::ScDPItemData( const String& rS, double fV/* = 0.0*/, BOOL bHV/* = FALSE*/, const ULONG nNumFormatP /*= 0*/ , BOOL bData/* = TRUE*/) : +ScDPItemData::ScDPItemData( const String& rS, double fV/* = 0.0*/, bool bHV/* = false*/, const ULONG nNumFormatP /*= 0*/ , bool bData/* = true*/) : nNumFormat( nNumFormatP ), aString(rS), fValue(fV), - mbFlag( (MK_VAL*!!bHV) | (MK_DATA*!!bData) | (MK_ERR*!!FALSE) | (MK_DATE*!!lcl_isDate( nNumFormat ) ) ) + mbFlag( (MK_VAL*!!bHV) | (MK_DATA*!!bData) | (MK_ERR*!!false) | (MK_DATE*!!lcl_isDate( nNumFormat ) ) ) { } @@ -207,7 +207,7 @@ ScDPItemData::ScDPItemData( ScDocument* pDoc, SCROW nRow, USHORT nCol, USHORT nD SetString ( aDocStr ); } -BOOL ScDPItemData::IsCaseInsEqual( const ScDPItemData& r ) const +bool ScDPItemData::IsCaseInsEqual( const ScDPItemData& r ) const { //! pass Transliteration? //! inline? @@ -226,22 +226,22 @@ size_t ScDPItemData::Hash() const return rtl_ustr_hashCode_WithLength( aString.GetBuffer(), aString.Len() ); } -BOOL ScDPItemData::operator==( const ScDPItemData& r ) const +bool ScDPItemData::operator==( const ScDPItemData& r ) const { if ( IsValue() ) { if( (HasDatePart() != r.HasDatePart()) || (HasDatePart() && mnDatePart != r.mnDatePart) ) - return FALSE; + return false; if ( IsDate() != r.IsDate() ) - return FALSE; + return false; else if ( r.IsValue() ) return rtl::math::approxEqual( fValue, r.fValue ); else - return FALSE; + return false; } else if ( r.IsValue() ) - return FALSE; + return false; else // need exact equality until we have a safe case insensitive string hash return aString == r.aString; @@ -307,17 +307,17 @@ sal_uInt8 ScDPItemData::GetType() const } -BOOL ScDPItemData::IsHasData() const +bool ScDPItemData::IsHasData() const { return !!(mbFlag&MK_DATA); } -BOOL ScDPItemData::IsHasErr() const +bool ScDPItemData::IsHasErr() const { return !!(mbFlag&MK_ERR); } -BOOL ScDPItemData::IsValue() const +bool ScDPItemData::IsValue() const { return !!(mbFlag&MK_VAL); } @@ -337,20 +337,20 @@ ULONG ScDPItemData::GetNumFormat() const return nNumFormat; } -BOOL ScDPItemData::HasStringData() const +bool ScDPItemData::HasStringData() const { return IsHasData()&&!IsHasErr()&&!IsValue(); } -BOOL ScDPItemData::IsDate() const +bool ScDPItemData::IsDate() const { return !!(mbFlag&MK_DATE); } -BOOL ScDPItemData::HasDatePart() const +bool ScDPItemData::HasDatePart() const { return !!(mbFlag&MK_DATEPART); } -void ScDPItemData::SetDate( BOOL b ) +void ScDPItemData::SetDate( bool b ) { b ? ( mbFlag |= MK_DATE ) : ( mbFlag &= ~MK_DATE ); } @@ -359,17 +359,17 @@ void ScDPItemData::SetDate( BOOL b ) //class ScDPTableDataCache //To cache the pivot table data source -BOOL ScDPTableDataCache::operator== ( const ScDPTableDataCache& r ) const +bool ScDPTableDataCache::operator== ( const ScDPTableDataCache& r ) const { if ( GetColumnCount() == r.GetColumnCount() ) { for ( SCCOL i = 0 ; i < GetColumnCount(); i++ ) { //check dim names if ( GetDimensionName( i ) != r.GetDimensionName( i ) ) - return FALSE; + return false; //check rows count if ( GetRowCount() != r.GetRowCount() ) - return FALSE; + return false; //check dim member values size_t nMembersCount = GetDimMemberValues( i ).size(); if ( GetDimMemberValues( i ).size() == r. GetDimMemberValues( i ).size() ) @@ -379,22 +379,22 @@ BOOL ScDPTableDataCache::operator== ( const ScDPTableDataCache& r ) const if ( *( GetDimMemberValues( i )[j] ) == *( r.GetDimMemberValues( i )[j] ) ) continue; else - return FALSE; + return false; } } else - return FALSE; + return false; //check source table index for ( SCROW k=0 ; k < GetRowCount(); k ++ ) { - if ( GetItemDataId( i, k, FALSE ) == r.GetItemDataId( i,k,FALSE) ) + if ( GetItemDataId( i, k, false ) == r.GetItemDataId( i,k,false) ) continue; else - return FALSE; + return false; } } } - return TRUE; + return true; } ScDPTableDataCache::ScDPTableDataCache( ScDocument* pDoc ) : @@ -530,7 +530,7 @@ bool ScDPTableDataCache::InitFromDoc( ScDocument* pDoc, const ScRange& rRange ) AddData( nCol - nStartCol, new ScDPItemData( pDoc, nRow, nCol, nDocTab ) ); } } - return TRUE; + return true; } bool ScDPTableDataCache::InitFromDataBase (const Reference<sdbc::XRowSet>& xRowSet, const Date& rNullDate) @@ -611,20 +611,20 @@ ULONG ScDPTableDataCache::GetDimNumType( SCCOL nDim) const return GetNumType(mpTableDataValues[nDim][0]->nNumFormat); } -bool ScDPTableDataCache::ValidQuery( SCROW nRow, const ScQueryParam &rParam, BOOL *pSpecial) +bool ScDPTableDataCache::ValidQuery( SCROW nRow, const ScQueryParam &rParam, bool *pSpecial) { //Copied and modified from ScTable::ValidQuery if (!rParam.GetEntry(0).bDoQuery) - return TRUE; - BOOL bMatchWholeCell = mpDoc->GetDocOptions().IsMatchWholeCell(); + return true; + bool bMatchWholeCell = mpDoc->GetDocOptions().IsMatchWholeCell(); //--------------------------------------------------------------- const SCSIZE nFixedBools = 32; - BOOL aBool[nFixedBools]; - BOOL aTest[nFixedBools]; + bool aBool[nFixedBools]; + bool aTest[nFixedBools]; SCSIZE nEntryCount = rParam.GetEntryCount(); - BOOL* pPasst = ( nEntryCount <= nFixedBools ? &aBool[0] : new BOOL[nEntryCount] ); - BOOL* pTest = ( nEntryCount <= nFixedBools ? &aTest[0] : new BOOL[nEntryCount] ); + bool* pPasst = ( nEntryCount <= nFixedBools ? &aBool[0] : new bool[nEntryCount] ); + bool* pTest = ( nEntryCount <= nFixedBools ? &aTest[0] : new bool[nEntryCount] ); long nPos = -1; SCSIZE i = 0; @@ -637,11 +637,11 @@ bool ScDPTableDataCache::ValidQuery( SCROW nRow, const ScQueryParam &rParam, BOO { ScQueryEntry& rEntry = rParam.GetEntry(i); // we can only handle one single direct query - SCROW nId = GetItemDataId( (SCCOL)rEntry.nField, nRow, FALSE ); + SCROW nId = GetItemDataId( (SCCOL)rEntry.nField, nRow, false ); const ScDPItemData* pCellData = GetItemDataById( (SCCOL)rEntry.nField, nId); - BOOL bOk = FALSE; - BOOL bTestEqual = FALSE; + bool bOk = false; + bool bTestEqual = false; if (pSpecial && pSpecial[i]) { @@ -675,7 +675,7 @@ bool ScDPTableDataCache::ValidQuery( SCROW nRow, const ScQueryParam &rParam, BOO bOk = !::rtl::math::approxEqual( nCellVal, rEntry.nVal ); break; default: - bOk= FALSE; + bOk= false; break; } } @@ -686,19 +686,19 @@ bool ScDPTableDataCache::ValidQuery( SCROW nRow, const ScQueryParam &rParam, BOO { // by String String aCellStr = pCellData->GetString(); - BOOL bRealRegExp = (rParam.bRegExp && ((rEntry.eOp == SC_EQUAL) + bool bRealRegExp = (rParam.bRegExp && ((rEntry.eOp == SC_EQUAL) || (rEntry.eOp == SC_NOT_EQUAL))); - BOOL bTestRegExp = FALSE; + bool bTestRegExp = false; if (bRealRegExp || bTestRegExp) { xub_StrLen nStart = 0; xub_StrLen nEnd = aCellStr.Len(); - BOOL bMatch = (BOOL) rEntry.GetSearchTextPtr( rParam.bCaseSens ) + bool bMatch = (bool) rEntry.GetSearchTextPtr( rParam.bCaseSens ) ->SearchFrwrd( aCellStr, &nStart, &nEnd ); // from 614 on, nEnd is behind the found text if (bMatch && bMatchWholeCell && (nStart != 0 || nEnd != aCellStr.Len())) - bMatch = FALSE; // RegExp must match entire cell string + bMatch = false; // RegExp must match entire cell string if (bRealRegExp) bOk = ((rEntry.eOp == SC_NOT_EQUAL) ? !bMatch : bMatch); else @@ -812,7 +812,7 @@ bool ScDPTableDataCache::ValidQuery( SCROW nRow, const ScQueryParam &rParam, BOO pTest[0] = pTest[0] || pTest[j]; } - BOOL bRet = pPasst[0]; + bool bRet = pPasst[0]; if (pPasst != &aBool[0]) delete [] pPasst; if (pTest != &aTest[0]) @@ -828,16 +828,16 @@ bool ScDPTableDataCache::IsRowEmpty( SCROW nRow ) const bool ScDPTableDataCache::IsEmptyMember( SCROW nRow, USHORT nColumn ) const { - return !GetItemDataById( nColumn, GetItemDataId( nColumn, nRow, FALSE ) )->IsHasData(); + return !GetItemDataById( nColumn, GetItemDataId( nColumn, nRow, false ) )->IsHasData(); } -BOOL ScDPTableDataCache::AddData(long nDim, ScDPItemData* pitemData) +bool ScDPTableDataCache::AddData(long nDim, ScDPItemData* pitemData) { DBG_ASSERT( IsValid(), " IsValid() == false " ); DBG_ASSERT( nDim < mnColumnCount && nDim >=0 , "dimension out of bound" ); SCROW nIndex = 0; - BOOL bInserted = FALSE; + bool bInserted = false; pitemData->SetDate( lcl_isDate( GetNumType( pitemData->nNumFormat ) ) ); @@ -847,7 +847,7 @@ BOOL ScDPTableDataCache::AddData(long nDim, ScDPItemData* pitemData) mpGlobalOrder[nDim].insert( mpGlobalOrder[nDim].begin()+nIndex, mpTableDataValues[nDim].size()-1 ); DBG_ASSERT( (size_t) mpGlobalOrder[nDim][nIndex] == mpTableDataValues[nDim].size()-1 ,"ScDPTableDataCache::AddData "); mpSourceData[nDim].push_back( mpTableDataValues[nDim].size()-1 ); - bInserted = TRUE; + bInserted = true; } else mpSourceData[nDim].push_back( mpGlobalOrder[nDim][nIndex] ); @@ -855,15 +855,15 @@ BOOL ScDPTableDataCache::AddData(long nDim, ScDPItemData* pitemData) size_t nCurRow = mpSourceData[nDim].size() -1 ; while ( mbEmptyRow.size() <= nCurRow ) - mbEmptyRow.push_back( TRUE ); + mbEmptyRow.push_back( true ); if ( pitemData->IsHasData() ) - mbEmptyRow[ nCurRow ] = FALSE; + mbEmptyRow[ nCurRow ] = false; if ( !bInserted ) delete pitemData; - return TRUE; + return true; } @@ -888,7 +888,7 @@ void ScDPTableDataCache::AddLabel(ScDPItemData *pData) //reset name if needed String strNewName = pData->aString; - BOOL bFound = FALSE; + bool bFound = false; long nIndex = 1; do { @@ -899,7 +899,7 @@ void ScDPTableDataCache::AddLabel(ScDPItemData *pData) strNewName = pData->aString; strNewName += String::CreateFromInt32( nIndex ); nIndex ++ ; - bFound = TRUE; + bFound = true; } } bFound = !bFound; @@ -910,7 +910,7 @@ void ScDPTableDataCache::AddLabel(ScDPItemData *pData) mrLabelNames.push_back( pData ); } -SCROW ScDPTableDataCache::GetItemDataId(USHORT nDim, SCROW nRow, BOOL bRepeatIfEmpty) const +SCROW ScDPTableDataCache::GetItemDataId(USHORT nDim, SCROW nRow, bool bRepeatIfEmpty) const { DBG_ASSERT( IsValid(), " IsValid() == false " ); DBG_ASSERT( /* nDim >= 0 && */ nDim < mnColumnCount, "ScDPTableDataCache::GetItemDataId " ); @@ -977,7 +977,7 @@ ULONG ScDPTableDataCache::GetNumberFormat( long nDim ) const return mpTableDataValues[nDim][0]->nNumFormat; } -BOOL ScDPTableDataCache::IsDateDimension( long nDim ) const +bool ScDPTableDataCache::IsDateDimension( long nDim ) const { if ( nDim >= mnColumnCount ) return false; |