summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@suse.com>2011-11-03 22:45:31 -0400
committerKohei Yoshida <kohei.yoshida@suse.com>2011-11-04 22:40:26 -0400
commitfa42b0d8382d1a509ff95a79dbd18787fd5b3735 (patch)
treeb8e65005e183bba673627312fcc94f54f637722b
parent54673798f3b765a71c7f0080c6449625782c6a9b (diff)
const correct ness etc & mutable only for lazy-initializing accessor.
-rw-r--r--sc/inc/global.hxx6
-rw-r--r--sc/inc/queryparam.hxx9
-rw-r--r--sc/source/core/data/dptablecache.cxx2
-rw-r--r--sc/source/core/data/global2.cxx2
-rw-r--r--sc/source/core/data/table3.cxx2
-rw-r--r--sc/source/core/tool/queryparam.cxx13
-rw-r--r--sc/source/ui/dbgui/pfiltdlg.cxx2
-rw-r--r--sc/source/ui/inc/filtdlg.hxx2
8 files changed, 22 insertions, 16 deletions
diff --git a/sc/inc/global.hxx b/sc/inc/global.hxx
index ff4814d3ae03..cc8c0fde1028 100644
--- a/sc/inc/global.hxx
+++ b/sc/inc/global.hxx
@@ -766,15 +766,15 @@ struct ScQueryEntry
ScQueryConnect eConnect;
String* pStr;
double nVal;
- utl::SearchParam* pSearchParam; // if RegExp, not saved
- utl::TextSearch* pSearchText; // if RegExp, not saved
+ mutable utl::SearchParam* pSearchParam; // if RegExp, not saved
+ mutable utl::TextSearch* pSearchText; // if RegExp, not saved
ScQueryEntry();
ScQueryEntry(const ScQueryEntry& r);
~ScQueryEntry();
// creates pSearchParam and pSearchText if necessary, always RegExp!
- utl::TextSearch* GetSearchTextPtr( bool bCaseSens );
+ utl::TextSearch* GetSearchTextPtr( bool bCaseSens ) const;
void Clear();
ScQueryEntry& operator=( const ScQueryEntry& r );
diff --git a/sc/inc/queryparam.hxx b/sc/inc/queryparam.hxx
index 915422458bcf..a083f74acb9c 100644
--- a/sc/inc/queryparam.hxx
+++ b/sc/inc/queryparam.hxx
@@ -51,7 +51,8 @@ struct ScQueryParamBase
virtual bool IsValidFieldIndex() const;
SC_DLLPUBLIC SCSIZE GetEntryCount() const;
- SC_DLLPUBLIC ScQueryEntry& GetEntry(SCSIZE n) const;
+ SC_DLLPUBLIC const ScQueryEntry& GetEntry(SCSIZE n) const;
+ SC_DLLPUBLIC ScQueryEntry& GetEntry(SCSIZE n);
void Resize(SCSIZE nNew);
SC_DLLPUBLIC void DeleteQuery( SCSIZE nPos );
void FillInExcelSyntax(String& aCellStr, SCSIZE nIndex);
@@ -60,7 +61,7 @@ protected:
ScQueryParamBase();
ScQueryParamBase(const ScQueryParamBase& r);
- mutable std::vector<ScQueryEntry> maEntries;
+ std::vector<ScQueryEntry> maEntries;
};
// ============================================================================
@@ -92,8 +93,8 @@ struct SC_DLLPUBLIC ScQueryParam : public ScQueryParamBase, public ScQueryParamT
ScQueryParam( const ScDBQueryParamInternal& r );
virtual ~ScQueryParam();
- ScQueryParam& operator= ( const ScQueryParam& r );
- sal_Bool operator== ( const ScQueryParam& rOther ) const;
+ ScQueryParam& operator= ( const ScQueryParam& r );
+ bool operator== ( const ScQueryParam& rOther ) const;
void Clear();
void ClearDestParams();
void MoveToDest();
diff --git a/sc/source/core/data/dptablecache.cxx b/sc/source/core/data/dptablecache.cxx
index b39c898b7e93..463ceb65ef34 100644
--- a/sc/source/core/data/dptablecache.cxx
+++ b/sc/source/core/data/dptablecache.cxx
@@ -599,7 +599,7 @@ bool ScDPCache::ValidQuery( SCROW nRow, const ScQueryParam &rParam, bool *pSpeci
while ((i < nEntryCount) && rParam.GetEntry(i).bDoQuery)
{
- ScQueryEntry& rEntry = rParam.GetEntry(i);
+ const ScQueryEntry& rEntry = rParam.GetEntry(i);
// we can only handle one single direct query
// #i115431# nField in QueryParam is the sheet column, not the field within the source range
SCCOL nQueryCol = (SCCOL)rEntry.nField;
diff --git a/sc/source/core/data/global2.cxx b/sc/source/core/data/global2.cxx
index 486bfda7743c..91c4ff63ad13 100644
--- a/sc/source/core/data/global2.cxx
+++ b/sc/source/core/data/global2.cxx
@@ -216,7 +216,7 @@ bool ScQueryEntry::operator==( const ScQueryEntry& r ) const
//! pSearchParam und pSearchText nicht vergleichen
}
-utl::TextSearch* ScQueryEntry::GetSearchTextPtr( bool bCaseSens )
+utl::TextSearch* ScQueryEntry::GetSearchTextPtr( bool bCaseSens ) const
{
if ( !pSearchParam )
{
diff --git a/sc/source/core/data/table3.cxx b/sc/source/core/data/table3.cxx
index 047a7f60bcdd..8f3c9857fa5f 100644
--- a/sc/source/core/data/table3.cxx
+++ b/sc/source/core/data/table3.cxx
@@ -1091,7 +1091,7 @@ bool ScTable::ValidQuery(SCROW nRow, const ScQueryParam& rParam,
while ( (i < nEntryCount) && rParam.GetEntry(i).bDoQuery )
{
- ScQueryEntry& rEntry = rParam.GetEntry(i);
+ const ScQueryEntry& rEntry = rParam.GetEntry(i);
// we can only handle one single direct query
if ( !pCell || i > 0 )
pCell = GetCell( static_cast<SCCOL>(rEntry.nField), nRow );
diff --git a/sc/source/core/tool/queryparam.cxx b/sc/source/core/tool/queryparam.cxx
index 61a763c87fec..f75c677a2312 100644
--- a/sc/source/core/tool/queryparam.cxx
+++ b/sc/source/core/tool/queryparam.cxx
@@ -69,7 +69,12 @@ SCSIZE ScQueryParamBase::GetEntryCount() const
return maEntries.size();
}
-ScQueryEntry& ScQueryParamBase::GetEntry(SCSIZE n) const
+const ScQueryEntry& ScQueryParamBase::GetEntry(SCSIZE n) const
+{
+ return maEntries[n];
+}
+
+ScQueryEntry& ScQueryParamBase::GetEntry(SCSIZE n)
{
return maEntries[n];
}
@@ -265,9 +270,9 @@ ScQueryParam& ScQueryParam::operator=( const ScQueryParam& r )
//------------------------------------------------------------------------
-sal_Bool ScQueryParam::operator==( const ScQueryParam& rOther ) const
+bool ScQueryParam::operator==( const ScQueryParam& rOther ) const
{
- sal_Bool bEqual = false;
+ bool bEqual = false;
// Anzahl der Queries gleich?
SCSIZE nUsed = 0;
@@ -297,7 +302,7 @@ sal_Bool ScQueryParam::operator==( const ScQueryParam& rOther ) const
&& (nDestCol == rOther.nDestCol)
&& (nDestRow == rOther.nDestRow) )
{
- bEqual = sal_True;
+ bEqual = true;
for ( SCSIZE i=0; i<nUsed && bEqual; i++ )
bEqual = maEntries[i] == rOther.maEntries[i];
}
diff --git a/sc/source/ui/dbgui/pfiltdlg.cxx b/sc/source/ui/dbgui/pfiltdlg.cxx
index cac65a15b2c9..171a2b5f5616 100644
--- a/sc/source/ui/dbgui/pfiltdlg.cxx
+++ b/sc/source/ui/dbgui/pfiltdlg.cxx
@@ -213,7 +213,7 @@ void ScPivotFilterDlg::Init( const SfxItemSet& rArgSet )
{
if ( theQueryData.GetEntry(i).bDoQuery )
{
- ScQueryEntry& rEntry = theQueryData.GetEntry(i);
+ const ScQueryEntry& rEntry = theQueryData.GetEntry(i);
String aValStr = *rEntry.pStr;
if (!rEntry.bQueryByString && aValStr == EMPTY_STRING)
diff --git a/sc/source/ui/inc/filtdlg.hxx b/sc/source/ui/inc/filtdlg.hxx
index b0842e99ad27..99f9b00cf039 100644
--- a/sc/source/ui/inc/filtdlg.hxx
+++ b/sc/source/ui/inc/filtdlg.hxx
@@ -125,7 +125,7 @@ private:
ScFilterOptionsMgr* pOptionsMgr;
const sal_uInt16 nWhichQuery;
- const ScQueryParam theQueryData;
+ ScQueryParam theQueryData;
ScQueryItem* pOutItem;
ScViewData* pViewData;
ScDocument* pDoc;