[Libreoffice-commits] core.git: Branch 'feature/formula-core-rework' - sc/inc sc/source
Kohei Yoshida
kohei.yoshida at gmail.com
Mon Jul 15 15:44:52 PDT 2013
sc/inc/refdata.hxx | 96 ++++++++++++++++++++--------------------
sc/source/core/tool/refdata.cxx | 8 +--
sc/source/core/tool/token.cxx | 4 -
3 files changed, 54 insertions(+), 54 deletions(-)
New commits:
commit 651943c037fd2c3afb8942e94033c261f14df338
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Mon Jul 15 18:45:02 2013 -0400
Bool cleanup in refdata.?xx.
Change-Id: Ibe5471b909f32939fac5e8a80e67faa0863ea2c4
diff --git a/sc/inc/refdata.hxx b/sc/inc/refdata.hxx
index 00dbf9b..a742dbf 100644
--- a/sc/inc/refdata.hxx
+++ b/sc/inc/refdata.hxx
@@ -32,7 +32,7 @@ struct OldSingleRefBools
sal_uInt8 bRelCol; ///< Flag values (see further down), 2 bits each in file format
sal_uInt8 bRelRow;
sal_uInt8 bRelTab;
- sal_uInt8 bOldFlag3D; ///< two sal_Bool flags (see further down)
+ sal_uInt8 bOldFlag3D; ///< two bool flags (see further down)
};
/// Single reference (one address) into the sheet
@@ -47,48 +47,48 @@ struct SC_DLLPUBLIC ScSingleRefData
union
{
- sal_Bool bFlags;
+ sal_uInt8 mnFlagValue;
struct
{
- sal_Bool bColRel :1;
- sal_Bool bColDeleted :1;
- sal_Bool bRowRel :1;
- sal_Bool bRowDeleted :1;
- sal_Bool bTabRel :1;
- sal_Bool bTabDeleted :1;
- sal_Bool bFlag3D :1; ///< 3D-Ref
- sal_Bool bRelName :1; ///< Reference derived from RangeName with relative values
- }Flags;
+ bool bColRel :1;
+ bool bColDeleted :1;
+ bool bRowRel :1;
+ bool bRowDeleted :1;
+ bool bTabRel :1;
+ bool bTabDeleted :1;
+ bool bFlag3D :1; ///< 3D-Ref
+ bool bRelName :1; ///< Reference derived from RangeName with relative values
+ } Flags;
};
/// No default ctor, because used in ScRawToken union, set InitFlags!
- inline void InitFlags() { bFlags = 0; } ///< all FALSE
+ inline void InitFlags() { mnFlagValue = 0; } ///< all FALSE
/// InitAddress: InitFlags and set address
inline void InitAddress( const ScAddress& rAdr );
inline void InitAddress( SCCOL nCol, SCROW nRow, SCTAB nTab );
/// InitAddressRel: InitFlags and set address, everything relative to rPos
inline void InitAddressRel( const ScAddress& rAdr, const ScAddress& rPos );
- inline void SetColRel( sal_Bool bVal ) { Flags.bColRel = (bVal ? sal_True : false ); }
- inline sal_Bool IsColRel() const { return Flags.bColRel; }
- inline void SetRowRel( sal_Bool bVal ) { Flags.bRowRel = (bVal ? sal_True : false ); }
- inline sal_Bool IsRowRel() const { return Flags.bRowRel; }
- inline void SetTabRel( sal_Bool bVal ) { Flags.bTabRel = (bVal ? sal_True : false ); }
- inline sal_Bool IsTabRel() const { return Flags.bTabRel; }
-
- inline void SetColDeleted( sal_Bool bVal ) { Flags.bColDeleted = (bVal ? sal_True : false ); }
- inline sal_Bool IsColDeleted() const { return Flags.bColDeleted; }
- inline void SetRowDeleted( sal_Bool bVal ) { Flags.bRowDeleted = (bVal ? sal_True : false ); }
- inline sal_Bool IsRowDeleted() const { return Flags.bRowDeleted; }
- inline void SetTabDeleted( sal_Bool bVal ) { Flags.bTabDeleted = (bVal ? sal_True : false ); }
- inline sal_Bool IsTabDeleted() const { return Flags.bTabDeleted; }
- sal_Bool IsDeleted() const;
-
- inline void SetFlag3D( sal_Bool bVal ) { Flags.bFlag3D = (bVal ? sal_True : false ); }
- inline sal_Bool IsFlag3D() const { return Flags.bFlag3D; }
- inline void SetRelName( sal_Bool bVal ) { Flags.bRelName = (bVal ? sal_True : false ); }
- inline sal_Bool IsRelName() const { return Flags.bRelName; }
-
- inline sal_Bool Valid() const;
+ inline void SetColRel( bool bVal ) { Flags.bColRel = (bVal ? true : false ); }
+ inline bool IsColRel() const{ return Flags.bColRel; }
+ inline void SetRowRel( bool bVal ) { Flags.bRowRel = (bVal ? true : false ); }
+ inline bool IsRowRel() const { return Flags.bRowRel; }
+ inline void SetTabRel( bool bVal ) { Flags.bTabRel = (bVal ? true : false ); }
+ inline bool IsTabRel() const { return Flags.bTabRel; }
+
+ inline void SetColDeleted( bool bVal ) { Flags.bColDeleted = (bVal ? true : false ); }
+ inline bool IsColDeleted() const { return Flags.bColDeleted; }
+ inline void SetRowDeleted( bool bVal ) { Flags.bRowDeleted = (bVal ? true : false ); }
+ inline bool IsRowDeleted() const { return Flags.bRowDeleted; }
+ inline void SetTabDeleted( bool bVal ) { Flags.bTabDeleted = (bVal ? true : false ); }
+ inline bool IsTabDeleted() const { return Flags.bTabDeleted; }
+ bool IsDeleted() const;
+
+ inline void SetFlag3D( bool bVal ) { Flags.bFlag3D = (bVal ? true : false ); }
+ inline bool IsFlag3D() const { return Flags.bFlag3D; }
+ inline void SetRelName( bool bVal ) { Flags.bRelName = (bVal ? true : false ); }
+ inline bool IsRelName() const { return Flags.bRelName; }
+
+ inline bool Valid() const;
/// In external references nTab is -1
inline bool ValidExternal() const;
@@ -97,7 +97,7 @@ struct SC_DLLPUBLIC ScSingleRefData
void SmartRelAbs( const ScAddress& rPos );
void CalcRelFromAbs( const ScAddress& rPos );
void CalcAbsIfRel( const ScAddress& rPos );
- sal_Bool operator==( const ScSingleRefData& ) const;
+ bool operator==( const ScSingleRefData& ) const;
bool operator!=( const ScSingleRefData& ) const;
};
@@ -118,13 +118,13 @@ inline void ScSingleRefData::InitAddressRel( const ScAddress& rAdr,
const ScAddress& rPos )
{
InitAddress( rAdr.Col(), rAdr.Row(), rAdr.Tab());
- SetColRel( sal_True );
- SetRowRel( sal_True );
- SetTabRel( sal_True );
+ SetColRel( true );
+ SetRowRel( true );
+ SetTabRel( true );
CalcRelFromAbs( rPos );
}
-inline sal_Bool ScSingleRefData::Valid() const
+inline bool ScSingleRefData::Valid() const
{
return nCol >= 0 && nCol <= MAXCOL &&
nRow >= 0 && nRow <= MAXROW &&
@@ -144,33 +144,33 @@ struct ScComplexRefData
ScSingleRefData Ref1;
ScSingleRefData Ref2;
- inline void InitFlags()
+ inline void InitFlags()
{ Ref1.InitFlags(); Ref2.InitFlags(); }
- inline void InitRange( const ScRange& rRange )
+ inline void InitRange( const ScRange& rRange )
{
Ref1.InitAddress( rRange.aStart );
Ref2.InitAddress( rRange.aEnd );
}
- inline void InitRangeRel( const ScRange& rRange, const ScAddress& rPos )
+ inline void InitRangeRel( const ScRange& rRange, const ScAddress& rPos )
{
Ref1.InitAddressRel( rRange.aStart, rPos );
Ref2.InitAddressRel( rRange.aEnd, rPos );
}
- inline void InitRange( SCCOL nCol1, SCROW nRow1, SCTAB nTab1,
+ inline void InitRange( SCCOL nCol1, SCROW nRow1, SCTAB nTab1,
SCCOL nCol2, SCROW nRow2, SCTAB nTab2 )
{
Ref1.InitAddress( nCol1, nRow1, nTab1 );
Ref2.InitAddress( nCol2, nRow2, nTab2 );
}
- inline void SmartRelAbs( const ScAddress& rPos )
+ inline void SmartRelAbs( const ScAddress& rPos )
{ Ref1.SmartRelAbs( rPos ); Ref2.SmartRelAbs( rPos ); }
- inline void CalcRelFromAbs( const ScAddress& rPos )
+ inline void CalcRelFromAbs( const ScAddress& rPos )
{ Ref1.CalcRelFromAbs( rPos ); Ref2.CalcRelFromAbs( rPos ); }
- inline void CalcAbsIfRel( const ScAddress& rPos )
+ inline void CalcAbsIfRel( const ScAddress& rPos )
{ Ref1.CalcAbsIfRel( rPos ); Ref2.CalcAbsIfRel( rPos ); }
- inline sal_Bool IsDeleted() const
+ inline bool IsDeleted() const
{ return Ref1.IsDeleted() || Ref2.IsDeleted(); }
- inline sal_Bool Valid() const
+ inline bool Valid() const
{ return Ref1.Valid() && Ref2.Valid(); }
/** In external references nTab is -1 for the start tab and -1 for the end
tab if one sheet, or >=0 if more than one sheets. */
@@ -178,7 +178,7 @@ struct ScComplexRefData
/// Absolute references have to be up-to-date when calling this!
void PutInOrder();
- inline sal_Bool operator==( const ScComplexRefData& r ) const
+ inline bool operator==( const ScComplexRefData& r ) const
{ return Ref1 == r.Ref1 && Ref2 == r.Ref2; }
/** Enlarge range if reference passed is not within existing range.
ScAddress position is used to calculate absolute references from
diff --git a/sc/source/core/tool/refdata.cxx b/sc/source/core/tool/refdata.cxx
index c218508..cdfaded 100644
--- a/sc/source/core/tool/refdata.cxx
+++ b/sc/source/core/tool/refdata.cxx
@@ -19,7 +19,7 @@
#include "refdata.hxx"
-sal_Bool ScSingleRefData::IsDeleted() const
+bool ScSingleRefData::IsDeleted() const
{
return IsColDeleted() || IsRowDeleted() || IsTabDeleted();
}
@@ -86,9 +86,9 @@ void ScSingleRefData::CalcAbsIfRel( const ScAddress& rPos )
-sal_Bool ScSingleRefData::operator==( const ScSingleRefData& r ) const
+bool ScSingleRefData::operator==( const ScSingleRefData& r ) const
{
- return bFlags == r.bFlags &&
+ return mnFlagValue == r.mnFlagValue &&
(Flags.bColRel ? nRelCol == r.nRelCol : nCol == r.nCol) &&
(Flags.bRowRel ? nRelRow == r.nRelRow : nRow == r.nRow) &&
(Flags.bTabRel ? nRelTab == r.nRelTab : nTab == r.nTab);
@@ -104,7 +104,7 @@ static void lcl_putInOrder( ScSingleRefData & rRef1, ScSingleRefData & rRef2 )
SCCOL nCol1, nCol2;
SCROW nRow1, nRow2;
SCTAB nTab1, nTab2;
- sal_Bool bTmp;
+ bool bTmp;
sal_uInt8 nRelState1, nRelState2;
if ( rRef1.Flags.bRelName )
nRelState1 =
diff --git a/sc/source/core/tool/token.cxx b/sc/source/core/tool/token.cxx
index 1af428f..f8e3e3b 100644
--- a/sc/source/core/tool/token.cxx
+++ b/sc/source/core/tool/token.cxx
@@ -504,11 +504,11 @@ bool ScToken::TextEqual( const FormulaToken& _rToken ) const
return aTemp1.Ref1.nCol == aTemp2.Ref1.nCol &&
aTemp1.Ref1.nRow == aTemp2.Ref1.nRow &&
aTemp1.Ref1.nTab == aTemp2.Ref1.nTab &&
- aTemp1.Ref1.bFlags == aTemp2.Ref1.bFlags &&
+ aTemp1.Ref1.mnFlagValue == aTemp2.Ref1.mnFlagValue &&
aTemp1.Ref2.nCol == aTemp2.Ref2.nCol &&
aTemp1.Ref2.nRow == aTemp2.Ref2.nRow &&
aTemp1.Ref2.nTab == aTemp2.Ref2.nTab &&
- aTemp1.Ref2.bFlags == aTemp2.Ref2.bFlags;
+ aTemp1.Ref2.mnFlagValue == aTemp2.Ref2.mnFlagValue;
}
else
return *this == _rToken; // else normal operator==
More information about the Libreoffice-commits
mailing list