[Libreoffice-commits] .: 2 commits - sc/inc sc/source
Markus Mohrhard
mmohrhard at kemper.freedesktop.org
Tue Aug 9 15:09:52 PDT 2011
sc/inc/compiler.hxx | 24 ++++++--------
sc/inc/rangenam.hxx | 24 +++++++-------
sc/source/core/data/cell2.cxx | 10 +++---
sc/source/core/data/conditio.cxx | 16 ++++-----
sc/source/core/tool/compiler.cxx | 62 +++++++++++++++++++-------------------
sc/source/core/tool/rangenam.cxx | 46 ++++++++++++++--------------
sc/source/filter/xml/xmlexprt.cxx | 22 ++++++++++++-
7 files changed, 110 insertions(+), 94 deletions(-)
New commits:
commit df59a409a7a14a985fcf4f2bb62f4ce1544c39e9
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Tue Aug 9 23:59:36 2011 +0200
change from sal_Bool to bool in ScRangeName/ScRangeData
diff --git a/sc/inc/compiler.hxx b/sc/inc/compiler.hxx
index 1e1d81e..2148b00 100644
--- a/sc/inc/compiler.hxx
+++ b/sc/inc/compiler.hxx
@@ -344,11 +344,11 @@ private:
sal_Bool IsPredetectedReference( const String& );
sal_Bool IsDoubleReference( const String& );
sal_Bool IsMacro( const String& );
- sal_Bool IsNamedRange( const String& );
+ bool IsNamedRange( const String& );
bool IsExternalNamedRange( const String& rSymbol );
bool IsDBRange( const String& );
sal_Bool IsColRowName( const String& );
- sal_Bool IsBoolean( const String& );
+ bool IsBoolean( const String& );
void AutoCorrectParsedSymbol();
void SetRelNameReference();
@@ -428,10 +428,10 @@ public:
static void MoveRelWrap( ScTokenArray& rArr, ScDocument* pDoc, const ScAddress& rPos,
SCCOL nMaxCol, SCROW nMaxRow );
- sal_Bool UpdateNameReference( UpdateRefMode eUpdateRefMode,
+ bool UpdateNameReference( UpdateRefMode eUpdateRefMode,
const ScRange&,
SCsCOL nDx, SCsROW nDy, SCsTAB nDz,
- sal_Bool& rChanged, sal_Bool bSharedFormula = false);
+ bool& rChanged, bool bSharedFormula = false);
ScRangeData* UpdateReference( UpdateRefMode eUpdateRefMode,
const ScAddress& rOldPos, const ScRange&,
@@ -444,15 +444,15 @@ public:
const ScAddress& rOldPos, const ScRange&,
SCsCOL nDx, SCsROW nDy, SCsTAB nDz );
- ScRangeData* UpdateInsertTab(SCTAB nTable, sal_Bool bIsName, SCTAB nNewSheets = 1 );
- ScRangeData* UpdateDeleteTab(SCTAB nTable, sal_Bool bIsMove, sal_Bool bIsName, sal_Bool& bCompile, SCTAB nSheets = 1);
- ScRangeData* UpdateMoveTab(SCTAB nOldPos, SCTAB nNewPos, sal_Bool bIsName );
+ ScRangeData* UpdateInsertTab(SCTAB nTable, bool bIsName, SCTAB nNewSheets = 1 );
+ ScRangeData* UpdateDeleteTab(SCTAB nTable, bool bIsMove, bool bIsName, bool& bCompile, SCTAB nSheets = 1);
+ ScRangeData* UpdateMoveTab(SCTAB nOldPos, SCTAB nNewPos, bool bIsName );
bool HasModifiedRange();
/** If the character is allowed as first character in sheet names or
references, includes '$' and '?'. */
- static inline sal_Bool IsCharWordChar( String const & rStr,
+ static inline bool IsCharWordChar( String const & rStr,
xub_StrLen nPos,
const formula::FormulaGrammar::AddressConvention eConv = formula::FormulaGrammar::CONV_OOO )
{
@@ -460,8 +460,7 @@ public:
sal_Unicode cLast = nPos > 0 ? rStr.GetChar(nPos-1) : 0;
if (c < 128)
{
- return pConventions[eConv] ? static_cast<sal_Bool>(
- (pConventions[eConv]->getCharTableFlags(c, cLast) & SC_COMPILER_C_CHAR_WORD) == SC_COMPILER_C_CHAR_WORD) :
+ return pConventions[eConv] ? (pConventions[eConv]->getCharTableFlags(c, cLast) & SC_COMPILER_C_CHAR_WORD) == SC_COMPILER_C_CHAR_WORD :
false; // no convention => assume invalid
}
else
@@ -470,7 +469,7 @@ public:
/** If the character is allowed in sheet names, thus may be part of a
reference, includes '$' and '?' and such. */
- static inline sal_Bool IsWordChar( String const & rStr,
+ static inline bool IsWordChar( String const & rStr,
xub_StrLen nPos,
const formula::FormulaGrammar::AddressConvention eConv = formula::FormulaGrammar::CONV_OOO )
{
@@ -478,8 +477,7 @@ public:
sal_Unicode cLast = nPos > 0 ? rStr.GetChar(nPos-1) : 0;
if (c < 128)
{
- return pConventions[eConv] ? static_cast<sal_Bool>(
- (pConventions[eConv]->getCharTableFlags(c, cLast) & SC_COMPILER_C_WORD) == SC_COMPILER_C_WORD) :
+ return pConventions[eConv] ? (pConventions[eConv]->getCharTableFlags(c, cLast) & SC_COMPILER_C_WORD) == SC_COMPILER_C_WORD :
false; // convention not known => assume invalid
}
else
diff --git a/sc/inc/rangenam.hxx b/sc/inc/rangenam.hxx
index 543d727..a3b3bc7 100644
--- a/sc/inc/rangenam.hxx
+++ b/sc/inc/rangenam.hxx
@@ -78,7 +78,7 @@ private:
RangeType eType;
ScDocument* pDoc;
sal_uInt16 nIndex;
- sal_Bool bModified; // is set/cleared by UpdateReference
+ bool bModified; // is set/cleared by UpdateReference
// max row and column to use for wrapping of references. If -1 use the
// application's default.
@@ -108,7 +108,7 @@ public:
SC_DLLPUBLIC ~ScRangeData();
- sal_Bool operator== (const ScRangeData& rData) const;
+ bool operator== (const ScRangeData& rData) const;
void GetName( String& rName ) const { rName = aName; }
const String& GetName( void ) const { return aName; }
@@ -120,13 +120,13 @@ public:
ScTokenArray* GetCode() { return pCode; }
const ScTokenArray* GetCode() const { return pCode; }
sal_uInt16 GetErrCode() const;
- sal_Bool HasReferences() const;
+ bool HasReferences() const;
void SetDocument( ScDocument* pDocument){ pDoc = pDocument; }
ScDocument* GetDocument() const { return pDoc; }
void SetType( RangeType nType ) { eType = nType; }
void AddType( RangeType nType ) { eType = eType|nType; }
RangeType GetType() const { return eType; }
- sal_Bool HasType( RangeType nType ) const;
+ bool HasType( RangeType nType ) const;
SC_DLLPUBLIC void GetSymbol( String& rSymbol, const formula::FormulaGrammar::Grammar eGrammar = formula::FormulaGrammar::GRAM_DEFAULT ) const;
SC_DLLPUBLIC void GetSymbol( rtl::OUString& rSymbol, const formula::FormulaGrammar::Grammar eGrammar = formula::FormulaGrammar::GRAM_DEFAULT ) const;
void UpdateSymbol( rtl::OUStringBuffer& rBuffer, const ScAddress&,
@@ -134,17 +134,17 @@ public:
void UpdateReference( UpdateRefMode eUpdateRefMode,
const ScRange& r,
SCsCOL nDx, SCsROW nDy, SCsTAB nDz );
- sal_Bool IsModified() const { return bModified; }
+ bool IsModified() const { return bModified; }
SC_DLLPUBLIC void GuessPosition();
void UpdateTranspose( const ScRange& rSource, const ScAddress& rDest );
void UpdateGrow( const ScRange& rArea, SCCOL nGrowX, SCROW nGrowY );
- SC_DLLPUBLIC sal_Bool IsReference( ScRange& rRef ) const;
- sal_Bool IsReference( ScRange& rRef, const ScAddress& rPos ) const;
- SC_DLLPUBLIC sal_Bool IsValidReference( ScRange& rRef ) const;
- sal_Bool IsRangeAtBlock( const ScRange& ) const;
+ SC_DLLPUBLIC bool IsReference( ScRange& rRef ) const;
+ bool IsReference( ScRange& rRef, const ScAddress& rPos ) const;
+ SC_DLLPUBLIC bool IsValidReference( ScRange& rRef ) const;
+ bool IsRangeAtBlock( const ScRange& ) const;
void UpdateTabRef(SCTAB nOldTable, sal_uInt16 nFlag, SCTAB nNewTable, SCTAB nNewSheets);
void TransferTabRef( SCTAB nOldTab, SCTAB nNewTab );
@@ -154,7 +154,7 @@ public:
void ReplaceRangeNamesInUse( const IndexMap& rMap );
static void MakeValidName( String& rName );
- SC_DLLPUBLIC static sal_Bool IsNameValid( const String& rName, ScDocument* pDoc );
+ SC_DLLPUBLIC static bool IsNameValid( const String& rName, ScDocument* pDoc );
SC_DLLPUBLIC void SetMaxRow(SCROW nRow);
SCROW GetMaxRow() const;
@@ -162,7 +162,7 @@ public:
SCCOL GetMaxCol() const;
};
-inline sal_Bool ScRangeData::HasType( RangeType nType ) const
+inline bool ScRangeData::HasType( RangeType nType ) const
{
return ( ( eType & nType ) == nType );
}
diff --git a/sc/source/core/data/cell2.cxx b/sc/source/core/data/cell2.cxx
index 231cb83..63784e9 100644
--- a/sc/source/core/data/cell2.cxx
+++ b/sc/source/core/data/cell2.cxx
@@ -1146,7 +1146,7 @@ void ScFormulaCell::UpdateInsertTab(SCTAB nTable, SCTAB nNewSheets)
pRangeData = aComp.UpdateInsertTab( nTable, false, nNewSheets );
if (pRangeData) // Shared Formula gegen echte Formel
{ // austauschen
- sal_Bool bRefChanged;
+ bool bRefChanged;
pDocument->RemoveFromFormulaTree( this ); // update formula count
delete pCode;
pCode = new ScTokenArray( *pRangeData->GetCode() );
@@ -1156,7 +1156,7 @@ void ScFormulaCell::UpdateInsertTab(SCTAB nTable, SCTAB nNewSheets)
aComp2.UpdateInsertTab( nTable, false, nNewSheets );
// If the shared formula contained a named range/formula containing
// an absolute reference to a sheet, those have to be readjusted.
- aComp2.UpdateDeleteTab( nTable, false, sal_True, bRefChanged, nNewSheets );
+ aComp2.UpdateDeleteTab( nTable, false, true, bRefChanged, nNewSheets );
bCompile = sal_True;
}
// kein StartListeningTo weil pTab[nTab] noch nicht existiert!
@@ -1167,7 +1167,7 @@ void ScFormulaCell::UpdateInsertTab(SCTAB nTable, SCTAB nNewSheets)
sal_Bool ScFormulaCell::UpdateDeleteTab(SCTAB nTable, sal_Bool bIsMove, SCTAB nSheets)
{
- sal_Bool bRefChanged = false;
+ bool bRefChanged = false;
sal_Bool bPosChanged = ( aPos.Tab() > nTable + nSheets ? sal_True : false );
pCode->Reset();
if( pCode->GetNextReferenceRPN() && !pDocument->IsClipOrUndo() )
@@ -1192,7 +1192,7 @@ sal_Bool ScFormulaCell::UpdateDeleteTab(SCTAB nTable, sal_Bool bIsMove, SCTAB nS
aComp2.UpdateDeleteTab( nTable, false, false, bRefChanged, nSheets );
// If the shared formula contained a named range/formula containing
// an absolute reference to a sheet, those have to be readjusted.
- aComp2.UpdateInsertTab( nTable,sal_True, nSheets );
+ aComp2.UpdateInsertTab( nTable,true, nSheets );
// bRefChanged kann beim letzten UpdateDeleteTab zurueckgesetzt worden sein
bRefChanged = sal_True;
bCompile = sal_True;
@@ -1226,7 +1226,7 @@ void ScFormulaCell::UpdateMoveTab( SCTAB nOldPos, SCTAB nNewPos, SCTAB nTabNo )
aComp2.SetGrammar(pDocument->GetGrammar());
aComp2.CompileTokenArray();
aComp2.MoveRelWrap(pRangeData->GetMaxCol(), pRangeData->GetMaxRow());
- aComp2.UpdateMoveTab( nOldPos, nNewPos, sal_True );
+ aComp2.UpdateMoveTab( nOldPos, nNewPos, true );
bCompile = sal_True;
}
// kein StartListeningTo weil pTab[nTab] noch nicht korrekt!
diff --git a/sc/source/core/data/conditio.cxx b/sc/source/core/data/conditio.cxx
index ce6327c..923f90d 100644
--- a/sc/source/core/data/conditio.cxx
+++ b/sc/source/core/data/conditio.cxx
@@ -474,7 +474,7 @@ void ScConditionEntry::SetFormula2( const ScTokenArray& rArray )
}
}
-void lcl_CondUpdateInsertTab( ScTokenArray& rCode, SCTAB nInsTab, SCTAB nPosTab, sal_Bool& rChanged )
+void lcl_CondUpdateInsertTab( ScTokenArray& rCode, SCTAB nInsTab, SCTAB nPosTab, bool& rChanged )
{
// Insert table: only update absolute table references.
// (Similar to ScCompiler::UpdateInsertTab with bIsName=sal_True, result is the same as for named ranges)
@@ -508,11 +508,11 @@ void lcl_CondUpdateInsertTab( ScTokenArray& rCode, SCTAB nInsTab, SCTAB nPosTab,
void ScConditionEntry::UpdateReference( UpdateRefMode eUpdateRefMode,
const ScRange& rRange, SCsCOL nDx, SCsROW nDy, SCsTAB nDz )
{
- sal_Bool bInsertTab = ( eUpdateRefMode == URM_INSDEL && nDz == 1 );
- sal_Bool bDeleteTab = ( eUpdateRefMode == URM_INSDEL && nDz == -1 );
+ bool bInsertTab = ( eUpdateRefMode == URM_INSDEL && nDz == 1 );
+ bool bDeleteTab = ( eUpdateRefMode == URM_INSDEL && nDz == -1 );
- sal_Bool bChanged1 = false;
- sal_Bool bChanged2 = false;
+ bool bChanged1 = false;
+ bool bChanged2 = false;
if (pFormula1)
{
@@ -523,7 +523,7 @@ void ScConditionEntry::UpdateReference( UpdateRefMode eUpdateRefMode,
ScCompiler aComp( pDoc, aSrcPos, *pFormula1 );
aComp.SetGrammar(pDoc->GetGrammar());
if ( bDeleteTab )
- aComp.UpdateDeleteTab( rRange.aStart.Tab(), false, sal_True, bChanged1 );
+ aComp.UpdateDeleteTab( rRange.aStart.Tab(), false, true, bChanged1 );
else
aComp.UpdateNameReference( eUpdateRefMode, rRange, nDx, nDy, nDz, bChanged1 );
}
@@ -540,7 +540,7 @@ void ScConditionEntry::UpdateReference( UpdateRefMode eUpdateRefMode,
ScCompiler aComp( pDoc, aSrcPos, *pFormula2);
aComp.SetGrammar(pDoc->GetGrammar());
if ( bDeleteTab )
- aComp.UpdateDeleteTab( rRange.aStart.Tab(), false, sal_True, bChanged2 );
+ aComp.UpdateDeleteTab( rRange.aStart.Tab(), false, true, bChanged2 );
else
aComp.UpdateNameReference( eUpdateRefMode, rRange, nDx, nDy, nDz, bChanged2 );
}
@@ -563,7 +563,7 @@ void ScConditionEntry::UpdateMoveTab( SCTAB nOldPos, SCTAB nNewPos )
{
ScCompiler aComp( pDoc, aSrcPos, *pFormula2);
aComp.SetGrammar(pDoc->GetGrammar());
- aComp.UpdateMoveTab(nOldPos, nNewPos, sal_True );
+ aComp.UpdateMoveTab(nOldPos, nNewPos, true );
DELETEZ(pFCell2);
}
}
diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx
index 31f164e..55c8229 100644
--- a/sc/source/core/tool/compiler.cxx
+++ b/sc/source/core/tool/compiler.cxx
@@ -2888,7 +2888,7 @@ sal_Bool ScCompiler::IsMacro( const String& rName )
return sal_True;
}
-sal_Bool ScCompiler::IsNamedRange( const String& rUpperName )
+bool ScCompiler::IsNamedRange( const String& rUpperName )
{
// IsNamedRange is called only from NextNewToken, with an upper-case string
@@ -3253,7 +3253,7 @@ sal_Bool ScCompiler::IsColRowName( const String& rName )
return false;
}
-sal_Bool ScCompiler::IsBoolean( const String& rName )
+bool ScCompiler::IsBoolean( const String& rName )
{
OpCodeHashMap::const_iterator iLook( mxSymbols->getHashMap()->find( rName ) );
if( iLook != mxSymbols->getHashMap()->end() &&
@@ -3263,7 +3263,7 @@ sal_Bool ScCompiler::IsBoolean( const String& rName )
ScRawToken aToken;
aToken.SetOpCode( (*iLook).second );
pRawToken = aToken.Clone();
- return sal_True;
+ return true;
}
else
return false;
@@ -4169,14 +4169,14 @@ ScRangeData* ScCompiler::UpdateReference(UpdateRefMode eUpdateRefMode,
for( t = static_cast<ScToken*>(pArr->GetNextReferenceRPN()); t && !pRangeData;
t = static_cast<ScToken*>(pArr->GetNextReferenceRPN()) )
{
- sal_Bool bRelName = (t->GetType() == svSingleRef ?
+ bool bRelName = (t->GetType() == svSingleRef ?
t->GetSingleRef().IsRelName() :
(t->GetDoubleRef().Ref1.IsRelName() ||
t->GetDoubleRef().Ref2.IsRelName()));
if (bRelName)
{
t->CalcAbsIfRel( rOldPos);
- sal_Bool bValid = (t->GetType() == svSingleRef ?
+ bool bValid = (t->GetType() == svSingleRef ?
t->GetSingleRef().Valid() :
t->GetDoubleRef().Valid());
// If the reference isn't valid, copying the formula
@@ -4367,12 +4367,12 @@ ScRangeData* ScCompiler::UpdateReference(UpdateRefMode eUpdateRefMode,
}
}
-sal_Bool ScCompiler::UpdateNameReference(UpdateRefMode eUpdateRefMode,
+bool ScCompiler::UpdateNameReference(UpdateRefMode eUpdateRefMode,
const ScRange& r,
SCsCOL nDx, SCsROW nDy, SCsTAB nDz,
- sal_Bool& rChanged, sal_Bool bSharedFormula)
+ bool& rChanged, bool bSharedFormula)
{
- sal_Bool bRelRef = false; // set if relative reference
+ bool bRelRef = false; // set if relative reference
rChanged = false;
pArr->Reset();
ScToken* t;
@@ -4407,7 +4407,7 @@ sal_Bool ScCompiler::UpdateNameReference(UpdateRefMode eUpdateRefMode,
if (ScRefUpdate::Update( pDoc, eUpdateRefMode, aPos, r,
nDx, nDy, nDz, rRef, ScRefUpdate::ABSOLUTE)
!= UR_NOTHING )
- rChanged = sal_True;
+ rChanged = true;
}
}
return bRelRef;
@@ -4483,12 +4483,12 @@ void ScCompiler::UpdateSharedFormulaReference( UpdateRefMode eUpdateRefMode,
}
-ScRangeData* ScCompiler::UpdateInsertTab( SCTAB nTable, sal_Bool bIsName , SCTAB nNewSheets)
+ScRangeData* ScCompiler::UpdateInsertTab( SCTAB nTable, bool bIsName , SCTAB nNewSheets)
{
ScRangeData* pRangeData = NULL;
SCTAB nPosTab = aPos.Tab(); // _after_ incremented!
SCTAB nOldPosTab = ((nPosTab > nTable) ? (nPosTab - nNewSheets) : nPosTab);
- sal_Bool bIsRel = false;
+ bool bIsRel = false;
ScToken* t;
pArr->Reset();
if (bIsName)
@@ -4522,7 +4522,7 @@ ScRangeData* ScCompiler::UpdateInsertTab( SCTAB nTable, sal_Bool bIsName , SCTAB
rRef.nRelTab = rRef.nTab - nPosTab;
}
else
- bIsRel = sal_True;
+ bIsRel = true;
if ( t->GetType() == svDoubleRef )
{
if ( !(bIsName && t->GetDoubleRef().Ref2.IsTabRel()) )
@@ -4539,7 +4539,7 @@ ScRangeData* ScCompiler::UpdateInsertTab( SCTAB nTable, sal_Bool bIsName , SCTAB
rRef.nRelTab = rRef.nTab - nPosTab;
}
else
- bIsRel = sal_True;
+ bIsRel = true;
}
if ( bIsName && bIsRel )
pRangeData = (ScRangeData*) this; // not dereferenced in rangenam
@@ -4591,15 +4591,15 @@ ScRangeData* ScCompiler::UpdateInsertTab( SCTAB nTable, sal_Bool bIsName , SCTAB
return pRangeData;
}
-ScRangeData* ScCompiler::UpdateDeleteTab(SCTAB nTable, sal_Bool /* bIsMove */, sal_Bool bIsName,
- sal_Bool& rChanged, SCTAB nSheets)
+ScRangeData* ScCompiler::UpdateDeleteTab(SCTAB nTable, bool /* bIsMove */, bool bIsName,
+ bool& rChanged, SCTAB nSheets)
{
ScRangeData* pRangeData = NULL;
SCTAB nTab, nTab2;
SCTAB nPosTab = aPos.Tab(); // _after_ decremented!
SCTAB nOldPosTab = ((nPosTab >= nTable) ? (nPosTab + nSheets) : nPosTab);
rChanged = false;
- sal_Bool bIsRel = false;
+ bool bIsRel = false;
ScToken* t;
pArr->Reset();
if (bIsName)
@@ -4616,7 +4616,7 @@ ScRangeData* ScCompiler::UpdateDeleteTab(SCTAB nTable, sal_Bool /* bIsMove */, s
if (pName && pName->HasType(RT_SHAREDMOD))
pRangeData = pName;
}
- rChanged = sal_True;
+ rChanged = true;
}
else if( t->GetType() != svIndex ) // it may be a DB area!!!
{
@@ -4630,7 +4630,7 @@ ScRangeData* ScCompiler::UpdateDeleteTab(SCTAB nTable, sal_Bool /* bIsMove */, s
if ( nTable < nTab )
{
rRef.nTab = nTab - nSheets;
- rChanged = sal_True;
+ rChanged = true;
}
else if ( nTable == nTab )
{
@@ -4655,12 +4655,12 @@ ScRangeData* ScCompiler::UpdateDeleteTab(SCTAB nTable, sal_Bool /* bIsMove */, s
rRef.nTab = MAXTAB+1;
rRef.SetTabDeleted( sal_True );
}
- rChanged = sal_True;
+ rChanged = true;
}
rRef.nRelTab = rRef.nTab - nPosTab;
}
else
- bIsRel = sal_True;
+ bIsRel = true;
if ( t->GetType() == svDoubleRef )
{
if ( !(bIsName && t->GetDoubleRef().Ref2.IsTabRel()) )
@@ -4673,7 +4673,7 @@ ScRangeData* ScCompiler::UpdateDeleteTab(SCTAB nTable, sal_Bool /* bIsMove */, s
if ( nTable < nTab )
{
rRef.nTab = nTab - nSheets;
- rChanged = sal_True;
+ rChanged = true;
}
else if ( nTable == nTab )
{
@@ -4684,12 +4684,12 @@ ScRangeData* ScCompiler::UpdateDeleteTab(SCTAB nTable, sal_Bool /* bIsMove */, s
rRef.nTab = MAXTAB+1;
rRef.SetTabDeleted( sal_True );
}
- rChanged = sal_True;
+ rChanged = true;
}
rRef.nRelTab = rRef.nTab - nPosTab;
}
else
- bIsRel = sal_True;
+ bIsRel = true;
}
if ( bIsName && bIsRel )
pRangeData = (ScRangeData*) this; // not dereferenced in rangenam
@@ -4716,7 +4716,7 @@ ScRangeData* ScCompiler::UpdateDeleteTab(SCTAB nTable, sal_Bool /* bIsMove */, s
if ( nTable < nTab )
{
rRef1.nTab = nTab - nSheets;
- rChanged = sal_True;
+ rChanged = true;
}
else if ( nTable == nTab )
{
@@ -4741,7 +4741,7 @@ ScRangeData* ScCompiler::UpdateDeleteTab(SCTAB nTable, sal_Bool /* bIsMove */, s
rRef1.nTab = MAXTAB+1;
rRef1.SetTabDeleted( sal_True );
}
- rChanged = sal_True;
+ rChanged = true;
}
rRef1.nRelTab = rRef1.nTab - nPosTab;
}
@@ -4757,7 +4757,7 @@ ScRangeData* ScCompiler::UpdateDeleteTab(SCTAB nTable, sal_Bool /* bIsMove */, s
if ( nTable < nTab )
{
rRef2.nTab = nTab - nSheets;
- rChanged = sal_True;
+ rChanged = true;
}
else if ( nTable == nTab )
{
@@ -4768,7 +4768,7 @@ ScRangeData* ScCompiler::UpdateDeleteTab(SCTAB nTable, sal_Bool /* bIsMove */, s
rRef2.nTab = MAXTAB+1;
rRef2.SetTabDeleted( sal_True );
}
- rChanged = sal_True;
+ rChanged = true;
}
rRef2.nRelTab = rRef2.nTab - nPosTab;
}
@@ -4781,7 +4781,7 @@ ScRangeData* ScCompiler::UpdateDeleteTab(SCTAB nTable, sal_Bool /* bIsMove */, s
// aPos.Tab() must be already adjusted!
ScRangeData* ScCompiler::UpdateMoveTab( SCTAB nOldTab, SCTAB nNewTab,
- sal_Bool bIsName )
+ bool bIsName )
{
ScRangeData* pRangeData = NULL;
SCsTAB nTab;
@@ -4809,7 +4809,7 @@ ScRangeData* ScCompiler::UpdateMoveTab( SCTAB nOldTab, SCTAB nNewTab,
else
nOldPosTab = nPosTab - nDir; // moved by one
- sal_Bool bIsRel = false;
+ bool bIsRel = false;
ScToken* t;
pArr->Reset();
if (bIsName)
@@ -4843,7 +4843,7 @@ ScRangeData* ScCompiler::UpdateMoveTab( SCTAB nOldTab, SCTAB nNewTab,
rRef1.nRelTab = rRef1.nTab - nPosTab;
}
else
- bIsRel = sal_True;
+ bIsRel = true;
if ( t->GetType() == svDoubleRef )
{
ScSingleRefData& rRef2 = t->GetDoubleRef().Ref2;
@@ -4860,7 +4860,7 @@ ScRangeData* ScCompiler::UpdateMoveTab( SCTAB nOldTab, SCTAB nNewTab,
rRef2.nRelTab = rRef2.nTab - nPosTab;
}
else
- bIsRel = sal_True;
+ bIsRel = true;
SCsTAB nTab1, nTab2;
if ( rRef1.IsTabRel() )
nTab1 = rRef1.nRelTab + nPosTab;
diff --git a/sc/source/core/tool/rangenam.cxx b/sc/source/core/tool/rangenam.cxx
index c79457a..eab59f8 100644
--- a/sc/source/core/tool/rangenam.cxx
+++ b/sc/source/core/tool/rangenam.cxx
@@ -250,15 +250,15 @@ void ScRangeData::UpdateReference( UpdateRefMode eUpdateRefMode,
const ScRange& r,
SCsCOL nDx, SCsROW nDy, SCsTAB nDz )
{
- sal_Bool bChanged = false;
+ bool bChanged = false;
pCode->Reset();
if( pCode->GetNextReference() )
{
- sal_Bool bSharedFormula = ((eType & RT_SHARED) == RT_SHARED);
+ bool bSharedFormula = ((eType & RT_SHARED) == RT_SHARED);
ScCompiler aComp( pDoc, aPos, *pCode );
aComp.SetGrammar(pDoc->GetGrammar());
- const sal_Bool bRelRef = aComp.UpdateNameReference( eUpdateRefMode, r,
+ const bool bRelRef = aComp.UpdateNameReference( eUpdateRefMode, r,
nDx, nDy, nDz,
bChanged, bSharedFormula);
if (bSharedFormula)
@@ -276,7 +276,7 @@ void ScRangeData::UpdateReference( UpdateRefMode eUpdateRefMode,
void ScRangeData::UpdateTranspose( const ScRange& rSource, const ScAddress& rDest )
{
- sal_Bool bChanged = false;
+ bool bChanged = false;
ScToken* t;
pCode->Reset();
@@ -294,7 +294,7 @@ void ScRangeData::UpdateTranspose( const ScRange& rSource, const ScAddress& rDes
(!rRef.Ref2.IsFlag3D() || !rRef.Ref2.IsTabRel()))))
{
if ( ScRefUpdate::UpdateTranspose( pDoc, rSource, rDest, rRef ) != UR_NOTHING )
- bChanged = sal_True;
+ bChanged = true;
}
}
}
@@ -304,7 +304,7 @@ void ScRangeData::UpdateTranspose( const ScRange& rSource, const ScAddress& rDes
void ScRangeData::UpdateGrow( const ScRange& rArea, SCCOL nGrowX, SCROW nGrowY )
{
- sal_Bool bChanged = false;
+ bool bChanged = false;
ScToken* t;
pCode->Reset();
@@ -322,7 +322,7 @@ void ScRangeData::UpdateGrow( const ScRange& rArea, SCCOL nGrowX, SCROW nGrowY )
(!rRef.Ref2.IsFlag3D() || !rRef.Ref2.IsTabRel()))))
{
if ( ScRefUpdate::UpdateGrow( rArea,nGrowX,nGrowY, rRef ) != UR_NOTHING )
- bChanged = sal_True;
+ bChanged = true;
}
}
}
@@ -330,7 +330,7 @@ void ScRangeData::UpdateGrow( const ScRange& rArea, SCCOL nGrowX, SCROW nGrowY )
bModified = bChanged; // muss direkt hinterher ausgewertet werden
}
-sal_Bool ScRangeData::operator== (const ScRangeData& rData) const // fuer Undo
+bool ScRangeData::operator== (const ScRangeData& rData) const // fuer Undo
{
if ( nIndex != rData.nIndex ||
aName != rData.aName ||
@@ -347,20 +347,20 @@ sal_Bool ScRangeData::operator== (const ScRangeData& rData) const // fuer
if ( ppThis[i] != ppOther[i] && !(*ppThis[i] == *ppOther[i]) )
return false;
- return sal_True;
+ return true;
}
-sal_Bool ScRangeData::IsRangeAtBlock( const ScRange& rBlock ) const
+bool ScRangeData::IsRangeAtBlock( const ScRange& rBlock ) const
{
- sal_Bool bRet = false;
+ bool bRet = false;
ScRange aRange;
if ( IsReference(aRange) )
bRet = ( rBlock == aRange );
return bRet;
}
-sal_Bool ScRangeData::IsReference( ScRange& rRange ) const
+bool ScRangeData::IsReference( ScRange& rRange ) const
{
if ( (eType & ( RT_ABSAREA | RT_REFAREA | RT_ABSPOS )) && pCode )
return pCode->IsReference( rRange );
@@ -368,7 +368,7 @@ sal_Bool ScRangeData::IsReference( ScRange& rRange ) const
return false;
}
-sal_Bool ScRangeData::IsReference( ScRange& rRange, const ScAddress& rPos ) const
+bool ScRangeData::IsReference( ScRange& rRange, const ScAddress& rPos ) const
{
if ( (eType & ( RT_ABSAREA | RT_REFAREA | RT_ABSPOS ) ) && pCode )
{
@@ -382,7 +382,7 @@ sal_Bool ScRangeData::IsReference( ScRange& rRange, const ScAddress& rPos ) cons
return false;
}
-sal_Bool ScRangeData::IsValidReference( ScRange& rRange ) const
+bool ScRangeData::IsValidReference( ScRange& rRange ) const
{
if ( (eType & ( RT_ABSAREA | RT_REFAREA | RT_ABSPOS ) ) && pCode )
return pCode->IsValidReference( rRange );
@@ -396,20 +396,20 @@ void ScRangeData::UpdateTabRef(SCTAB nOldTable, sal_uInt16 nFlag, SCTAB nNewTabl
if( pCode->GetNextReference() )
{
ScRangeData* pRangeData = NULL; // must not be dereferenced
- sal_Bool bChanged;
+ bool bChanged;
ScCompiler aComp( pDoc, aPos, *pCode);
aComp.SetGrammar(pDoc->GetGrammar());
switch (nFlag)
{
case 1: // einfache InsertTab (doc.cxx)
- pRangeData = aComp.UpdateInsertTab(nOldTable, sal_True, nNewSheets ); // und CopyTab (doc2.cxx)
+ pRangeData = aComp.UpdateInsertTab(nOldTable, true, nNewSheets ); // und CopyTab (doc2.cxx)
break;
case 2: // einfaches delete (doc.cxx)
- pRangeData = aComp.UpdateDeleteTab(nOldTable, false, sal_True, bChanged);
+ pRangeData = aComp.UpdateDeleteTab(nOldTable, false, true, bChanged);
break;
case 3: // move (doc2.cxx)
{
- pRangeData = aComp.UpdateMoveTab(nOldTable, nNewTable, sal_True );
+ pRangeData = aComp.UpdateMoveTab(nOldTable, nNewTable, true );
}
break;
default:
@@ -471,7 +471,7 @@ void ScRangeData::MakeValidName( String& rName )
}
}
-sal_Bool ScRangeData::IsNameValid( const String& rName, ScDocument* pDoc )
+bool ScRangeData::IsNameValid( const String& rName, ScDocument* pDoc )
{
/* XXX If changed, sc/source/filter/ftools/ftools.cxx
* ScfTools::ConvertToScDefinedName needs to be changed too. */
@@ -497,7 +497,7 @@ sal_Bool ScRangeData::IsNameValid( const String& rName, ScDocument* pDoc )
if (aRange.Parse( rName, pDoc, details) || aAddr.Parse( rName, pDoc, details))
return false;
}
- return sal_True;
+ return true;
}
void ScRangeData::SetMaxRow(SCROW nRow)
@@ -526,10 +526,10 @@ sal_uInt16 ScRangeData::GetErrCode() const
return pCode ? pCode->GetCodeError() : 0;
}
-sal_Bool ScRangeData::HasReferences() const
+bool ScRangeData::HasReferences() const
{
pCode->Reset();
- return sal_Bool( pCode->GetNextReference() != NULL );
+ return pCode->GetNextReference() != NULL;
}
// bei TransferTab von einem in ein anderes Dokument anpassen,
commit 96336b01a8e2836a3cabe407a92ac5d7b5ac5bf7
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Tue Aug 9 04:47:03 2011 +0200
fix for fdo#37391: don't write invalid references to files
diff --git a/sc/inc/rangenam.hxx b/sc/inc/rangenam.hxx
index 5d3ff49..543d727 100644
--- a/sc/inc/rangenam.hxx
+++ b/sc/inc/rangenam.hxx
@@ -119,7 +119,7 @@ public:
sal_uInt16 GetIndex() const { return nIndex; }
ScTokenArray* GetCode() { return pCode; }
const ScTokenArray* GetCode() const { return pCode; }
- sal_uInt16 GetErrCode();
+ sal_uInt16 GetErrCode() const;
sal_Bool HasReferences() const;
void SetDocument( ScDocument* pDocument){ pDoc = pDocument; }
ScDocument* GetDocument() const { return pDoc; }
diff --git a/sc/source/core/tool/rangenam.cxx b/sc/source/core/tool/rangenam.cxx
index 9b19fbf..c79457a 100644
--- a/sc/source/core/tool/rangenam.cxx
+++ b/sc/source/core/tool/rangenam.cxx
@@ -521,7 +521,7 @@ SCCOL ScRangeData::GetMaxCol() const
}
-sal_uInt16 ScRangeData::GetErrCode()
+sal_uInt16 ScRangeData::GetErrCode() const
{
return pCode ? pCode->GetCodeError() : 0;
}
diff --git a/sc/source/filter/xml/xmlexprt.cxx b/sc/source/filter/xml/xmlexprt.cxx
index 5ef06cf..5737d28 100644
--- a/sc/source/filter/xml/xmlexprt.cxx
+++ b/sc/source/filter/xml/xmlexprt.cxx
@@ -2856,7 +2856,15 @@ void ScXMLExport::WriteTable(sal_Int32 nTable, const Reference<sheet::XSpreadshe
AddAttribute(XML_NAMESPACE_TABLE, XML_BASE_CELL_ADDRESS, aStr);
// expression
- itr->GetSymbol(aStr, pDoc->GetStorageGrammar());
+ ScRange aRan;
+ if (itr->GetErrCode() || itr->IsValidReference(aRan))
+ {
+ aStr = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("[#REF!]"));
+ }
+ else
+ {
+ itr->GetSymbol(aStr, pDoc->GetStorageGrammar());
+ }
AddAttribute(XML_NAMESPACE_TABLE, XML_EXPRESSION, aStr);
SvXMLElementExport aElemNR(*this, XML_NAMESPACE_TABLE, XML_NAMED_EXPRESSION, sal_True, sal_True);
@@ -3808,7 +3816,17 @@ void ScXMLExport::WriteNamedExpressions(const com::sun::star::uno::Reference <co
}
else
{
- AddAttribute(XML_NAMESPACE_TABLE, XML_EXPRESSION, sOUTempContent);
+ ScRange aRange;
+ rtl::OUString aStr;
+ if (pNamedRange->GetErrCode() || !pNamedRange->IsValidReference(aRange))
+ {
+ aStr = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("[#REF!]"));
+ }
+ else
+ {
+ pNamedRange->GetSymbol(aStr, pDoc->GetStorageGrammar());
+ }
+ AddAttribute(XML_NAMESPACE_TABLE, XML_EXPRESSION, aStr);
SvXMLElementExport aElemNE(*this, XML_NAMESPACE_TABLE, XML_NAMED_EXPRESSION, sal_True, sal_True);
}
}
More information about the Libreoffice-commits
mailing list