[Libreoffice-commits] .: Branch 'feature/new-autofilter-popup' - 2 commits - sc/inc sc/source
Kohei Yoshida
kohei at kemper.freedesktop.org
Thu Nov 3 19:07:31 PDT 2011
sc/inc/global.hxx | 9 +-
sc/inc/queryparam.hxx | 2
sc/source/core/data/dociter.cxx | 3
sc/source/core/data/global2.cxx | 4 -
sc/source/core/tool/dbdata.cxx | 9 --
sc/source/core/tool/queryparam.cxx | 17 +++--
sc/source/filter/xml/xmldrani.cxx | 2
sc/source/ui/dbgui/filtdlg.cxx | 118 +++++++++++++++++++++++--------------
sc/source/ui/dbgui/sfiltdlg.cxx | 10 ---
sc/source/ui/inc/filtdlg.hxx | 9 +-
sc/source/ui/unoobj/datauno.cxx | 12 ---
sc/source/ui/vba/vbarange.cxx | 5 -
sc/source/ui/view/gridwin.cxx | 8 +-
sc/source/ui/view/gridwin4.cxx | 6 +
14 files changed, 116 insertions(+), 98 deletions(-)
New commits:
commit 7b52f9c32dea268f7ea53f11ece47418bc679111
Author: Kohei Yoshida <kohei.yoshida at suse.com>
Date: Thu Nov 3 22:05:12 2011 -0400
Let's not use a hard-coded MAXQUERY all over the place.
For now, the maximum query size is determined by the size of the
vector that holds the entries. For now, the size of the vector is
fixed, and won't change. We may later work on making it dynamically
sized, however...
diff --git a/sc/inc/global.hxx b/sc/inc/global.hxx
index 7a96782..ead69ba 100644
--- a/sc/inc/global.hxx
+++ b/sc/inc/global.hxx
@@ -96,7 +96,6 @@ const sal_Unicode CHAR_ZWNBSP = 0x2060;
#define MAXZOOM 400
const SCSIZE MAXSUBTOTAL = 3;
-const SCSIZE MAXQUERY = 8;
#define SC_START_INDEX_DB_COLL 50000
// Above this threshold are indices
diff --git a/sc/inc/queryparam.hxx b/sc/inc/queryparam.hxx
index 1515cd1..9154224 100644
--- a/sc/inc/queryparam.hxx
+++ b/sc/inc/queryparam.hxx
@@ -60,7 +60,7 @@ protected:
ScQueryParamBase();
ScQueryParamBase(const ScQueryParamBase& r);
- mutable ::std::vector<ScQueryEntry> maEntries;
+ mutable std::vector<ScQueryEntry> maEntries;
};
// ============================================================================
diff --git a/sc/source/core/data/dociter.cxx b/sc/source/core/data/dociter.cxx
index bc9689b..632abf8 100644
--- a/sc/source/core/data/dociter.cxx
+++ b/sc/source/core/data/dociter.cxx
@@ -1102,7 +1102,8 @@ ScQueryCellIterator::ScQueryCellIterator(ScDocument* pDocument, SCTAB nTable,
SCSIZE i;
if (bMod) // sonst schon eingetragen
{
- for (i=0; (i<MAXQUERY) && (aParam.GetEntry(i).bDoQuery); i++)
+ SCSIZE nCount = aParam.GetEntryCount();
+ for (i = 0; (i < nCount) && (aParam.GetEntry(i).bDoQuery); ++i)
{
ScQueryEntry& rEntry = aParam.GetEntry(i);
sal_uInt32 nIndex = 0;
diff --git a/sc/source/core/tool/dbdata.cxx b/sc/source/core/tool/dbdata.cxx
index 609fc52..40bc0d3 100644
--- a/sc/source/core/tool/dbdata.cxx
+++ b/sc/source/core/tool/dbdata.cxx
@@ -313,9 +313,8 @@ void ScDBData::MoveTo(SCTAB nTab, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW n
}
}
- if (maQueryParam.GetEntryCount() < MAXQUERY)
- maQueryParam.Resize(MAXQUERY);
- for (i=0; i<MAXQUERY; i++)
+ SCSIZE nCount = maQueryParam.GetEntryCount();
+ for (i = 0; i < nCount; ++i)
{
ScQueryEntry& rEntry = maQueryParam.GetEntry(i);
rEntry.nField += nDifX;
@@ -369,10 +368,6 @@ void ScDBData::GetQueryParam( ScQueryParam& rQueryParam ) const
void ScDBData::SetQueryParam(const ScQueryParam& rQueryParam)
{
- OSL_ENSURE( rQueryParam.GetEntryCount() <= MAXQUERY ||
- !rQueryParam.GetEntry(MAXQUERY).bDoQuery,
- "zuviele Eintraege bei ScDBData::SetQueryParam" );
-
maQueryParam = rQueryParam;
// set bIsAdvanced to false for everything that is not from the
diff --git a/sc/source/core/tool/queryparam.cxx b/sc/source/core/tool/queryparam.cxx
index 46a14a2..61a763c 100644
--- a/sc/source/core/tool/queryparam.cxx
+++ b/sc/source/core/tool/queryparam.cxx
@@ -35,13 +35,17 @@
using ::std::vector;
+namespace {
+
+const SCSIZE MAXQUERY = 8;
+
+}
+
// ============================================================================
-ScQueryParamBase::ScQueryParamBase()
+ScQueryParamBase::ScQueryParamBase() :
+ maEntries(MAXQUERY)
{
- Resize( MAXQUERY );
- for (sal_uInt16 i=0; i<MAXQUERY; i++)
- maEntries[i].Clear();
}
ScQueryParamBase::ScQueryParamBase(const ScQueryParamBase& r) :
@@ -219,9 +223,8 @@ void ScQueryParam::Clear()
bHasHeader = bCaseSens = bRegExp = bMixedComparison = false;
bInplace = bByRow = bDuplicate = sal_True;
- Resize( MAXQUERY );
- for (sal_uInt16 i=0; i<MAXQUERY; i++)
- maEntries[i].Clear();
+ std::vector<ScQueryEntry> aNewEntries(MAXQUERY);
+ maEntries.swap(aNewEntries);
ClearDestParams();
}
diff --git a/sc/source/filter/xml/xmldrani.cxx b/sc/source/filter/xml/xmldrani.cxx
index 785d03e..9f88a20 100644
--- a/sc/source/filter/xml/xmldrani.cxx
+++ b/sc/source/filter/xml/xmldrani.cxx
@@ -358,7 +358,7 @@ ScDBData* ScXMLDatabaseRangeContext::ConvertToDBData(const OUString& rName)
// Convert from relative to absolute column IDs for the fields. Calc
// core expects the field positions to be absolute column IDs.
SCCOLROW nStartPos = aParam.bByRow ? aRange.aStart.Col() : aRange.aStart.Row();
- for (size_t i = 0; i < MAXQUERY; ++i)
+ for (SCSIZE i = 0; i < aParam.GetEntryCount(); ++i)
{
ScQueryEntry& rEntry = aParam.GetEntry(i);
if (!rEntry.bDoQuery)
diff --git a/sc/source/ui/dbgui/filtdlg.cxx b/sc/source/ui/dbgui/filtdlg.cxx
index 539e0a4..4f949c4 100644
--- a/sc/source/ui/dbgui/filtdlg.cxx
+++ b/sc/source/ui/dbgui/filtdlg.cxx
@@ -136,10 +136,7 @@ ScFilterDlg::ScFilterDlg( SfxBindings* pB, SfxChildWindow* pCW, Window* pParent,
{
for (sal_uInt16 i=0; i<=MAXCOL; i++)
pEntryLists[i] = NULL;
- for (SCSIZE i=0;i<MAXQUERY;i++)
- {
- bRefreshExceptQuery[i]=false;
- }
+
aBtnMore.SetMoreText( String(ScResId( SCSTR_MOREBTN_MOREOPTIONS )) );
aBtnMore.SetLessText( String(ScResId( SCSTR_MOREBTN_FEWEROPTIONS )) );
Init( rArgSet );
@@ -333,7 +330,9 @@ void ScFilterDlg::Init( const SfxItemSet& rArgSet )
rEntry.nField = nFieldSelPos ? (theQueryData.nCol1 +
static_cast<SCCOL>(nFieldSelPos) - 1) : static_cast<SCCOL>(0);
rEntry.bDoQuery=true;
- bRefreshExceptQuery[i]=true;
+ if (maRefreshExceptQuery.size() < i + 1)
+ maRefreshExceptQuery.resize(i + 1, false);
+ maRefreshExceptQuery[i] = true;
}
aFieldLbArr[i]->SelectEntryPos( nFieldSelPos );
@@ -530,14 +529,16 @@ void ScFilterDlg::UpdateValueList( sal_uInt16 nList )
SCTAB nTab = nSrcTab;
SCROW nFirstRow = theQueryData.nRow1;
SCROW nLastRow = theQueryData.nRow2;
- mbHasDates[nOffset+nList-1] = false;
+ if (maHasDates.size() < nOffset+nList)
+ maHasDates.resize(nOffset+nList, false);
+ maHasDates[nOffset+nList-1] = false;
// first without the first line
pEntryLists[nColumn] = new TypedScStrCollection( 128, 128 );
pEntryLists[nColumn]->SetCaseSensitive( aBtnCase.IsChecked() );
pDoc->GetFilterEntriesArea( nColumn, nFirstRow+1, nLastRow,
- nTab, *pEntryLists[nColumn], mbHasDates[nOffset+nList-1] );
+ nTab, *pEntryLists[nColumn], maHasDates[nOffset+nList-1] );
// Entry for the first line
//! Entry (pHdrEntry) doesn't generate collection?
@@ -805,9 +806,11 @@ IMPL_LINK( ScFilterDlg, LbSelectHdl, ListBox*, pLb )
aEdVal1.Enable();
sal_uInt16 nConnect1 = aLbConnect1.GetSelectEntryPos();
- sal_uInt16 nQE = nOffset;
+ size_t nQE = nOffset;
theQueryData.GetEntry(nQE).eConnect =(ScQueryConnect)nConnect1;
- bRefreshExceptQuery[nQE]=true;
+ if (maRefreshExceptQuery.size() < nQE + 1)
+ maRefreshExceptQuery.resize(nQE + 1, false);
+ maRefreshExceptQuery[nQE] = true;
}
else if ( pLb == &aLbConnect2 )
@@ -817,9 +820,11 @@ IMPL_LINK( ScFilterDlg, LbSelectHdl, ListBox*, pLb )
aEdVal2.Enable();
sal_uInt16 nConnect2 = aLbConnect2.GetSelectEntryPos();
- sal_uInt16 nQE = 1+nOffset;
+ size_t nQE = 1+nOffset;
theQueryData.GetEntry(nQE).eConnect =(ScQueryConnect)nConnect2;
- bRefreshExceptQuery[nQE]=true;
+ if (maRefreshExceptQuery.size() < nQE + 1)
+ maRefreshExceptQuery.resize(nQE + 1, false);
+ maRefreshExceptQuery[nQE]=true;
}
else if ( pLb == &aLbConnect3 )
{
@@ -828,9 +833,11 @@ IMPL_LINK( ScFilterDlg, LbSelectHdl, ListBox*, pLb )
aEdVal3.Enable();
sal_uInt16 nConnect3 = aLbConnect3.GetSelectEntryPos();
- sal_uInt16 nQE = 2+nOffset;
+ size_t nQE = 2 + nOffset;
theQueryData.GetEntry(nQE).eConnect = (ScQueryConnect)nConnect3;
- bRefreshExceptQuery[nQE]=true;
+ if (maRefreshExceptQuery.size() < nQE + 1)
+ maRefreshExceptQuery.resize(nQE + 1, false);
+ maRefreshExceptQuery[nQE] = true;
}
else if ( pLb == &aLbConnect4 )
@@ -840,10 +847,11 @@ IMPL_LINK( ScFilterDlg, LbSelectHdl, ListBox*, pLb )
aEdVal4.Enable();
sal_uInt16 nConnect4 = aLbConnect4.GetSelectEntryPos();
- sal_uInt16 nQE = 3+nOffset;
+ size_t nQE = 3 + nOffset;
theQueryData.GetEntry(nQE).eConnect = (ScQueryConnect)nConnect4;
- bRefreshExceptQuery[nQE]=true;
-
+ if (maRefreshExceptQuery.size() < nQE + 1)
+ maRefreshExceptQuery.resize(nQE + 1, false);
+ maRefreshExceptQuery[nQE] = true;
}
else if ( pLb == &aLbField1 )
{
@@ -875,13 +883,16 @@ IMPL_LINK( ScFilterDlg, LbSelectHdl, ListBox*, pLb )
aEdVal2.Disable();
aEdVal3.Disable();
aEdVal4.Disable();
- for (sal_uInt16 i= nOffset; i< MAXQUERY; i++)
+ SCSIZE nCount = theQueryData.GetEntryCount();
+ if (maRefreshExceptQuery.size() < nCount + 1)
+ maRefreshExceptQuery.resize(nCount + 1, false);
+ for (sal_uInt16 i = nOffset; i < nCount; ++i)
{
theQueryData.GetEntry(i).bDoQuery = false;
- bRefreshExceptQuery[i]=false;
+ maRefreshExceptQuery[i] = false;
theQueryData.GetEntry(i).nField = static_cast<SCCOL>(0);
}
- bRefreshExceptQuery[nOffset] =true;
+ maRefreshExceptQuery[nOffset] = true;
}
else
{
@@ -919,13 +930,16 @@ IMPL_LINK( ScFilterDlg, LbSelectHdl, ListBox*, pLb )
aEdVal4.Disable();
sal_uInt16 nTemp=nOffset+1;
- for (sal_uInt16 i= nTemp; i< MAXQUERY; i++)
+ SCSIZE nCount = theQueryData.GetEntryCount();
+ if (maRefreshExceptQuery.size() < nCount)
+ maRefreshExceptQuery.resize(nCount, false);
+ for (sal_uInt16 i= nTemp; i< nCount; i++)
{
theQueryData.GetEntry(i).bDoQuery = false;
- bRefreshExceptQuery[i]=false;
+ maRefreshExceptQuery[i] = false;
theQueryData.GetEntry(i).nField = static_cast<SCCOL>(0);
}
- bRefreshExceptQuery[nTemp]=true;
+ maRefreshExceptQuery[nTemp] = true;
}
else
{
@@ -956,13 +970,16 @@ IMPL_LINK( ScFilterDlg, LbSelectHdl, ListBox*, pLb )
aEdVal4.Disable();
sal_uInt16 nTemp=nOffset+2;
- for (sal_uInt16 i= nTemp; i< MAXQUERY; i++)
+ SCSIZE nCount = theQueryData.GetEntryCount();
+ if (maRefreshExceptQuery.size() < nCount)
+ maRefreshExceptQuery.resize(nCount, false);
+ for (sal_uInt16 i = nTemp; i < nCount; ++i)
{
theQueryData.GetEntry(i).bDoQuery = false;
- bRefreshExceptQuery[i]=false;
+ maRefreshExceptQuery[i] = false;
theQueryData.GetEntry(i).nField = static_cast<SCCOL>(0);
}
- bRefreshExceptQuery[nTemp]=true;
+ maRefreshExceptQuery[nTemp] = true;
}
else
{
@@ -985,13 +1002,16 @@ IMPL_LINK( ScFilterDlg, LbSelectHdl, ListBox*, pLb )
{
ClearValueList( 4 );
sal_uInt16 nTemp=nOffset+3;
- for (sal_uInt16 i= nTemp; i< MAXQUERY; i++)
+ SCSIZE nCount = theQueryData.GetEntryCount();
+ if (maRefreshExceptQuery.size() < nCount)
+ maRefreshExceptQuery.resize(nCount, false);
+ for (sal_uInt16 i = nTemp; i < nCount; ++i)
{
theQueryData.GetEntry(i).bDoQuery = false;
- bRefreshExceptQuery[i]=false;
+ maRefreshExceptQuery[i] = false;
theQueryData.GetEntry(i).nField = static_cast<SCCOL>(0);
}
- bRefreshExceptQuery[nTemp]=true;
+ maRefreshExceptQuery[nTemp] = true;
}
else
{
@@ -1074,9 +1094,9 @@ IMPL_LINK( ScFilterDlg, CheckBoxHdl, CheckBox*, pBox )
IMPL_LINK( ScFilterDlg, ValModifyHdl, ComboBox*, pEd )
{
- sal_uInt16 nOffset = GetSliderPos();
- sal_uInt16 i=0;
- sal_uInt16 nQE =i + nOffset;
+ size_t nOffset = GetSliderPos();
+ size_t i = 0;
+ size_t nQE = i + nOffset;
if ( pEd )
{
String aStrVal = pEd->GetText();
@@ -1112,11 +1132,16 @@ IMPL_LINK( ScFilterDlg, ValModifyHdl, ComboBox*, pEd )
else
pLbCond->Enable();
+ if (maHasDates.size() < nQE + 1)
+ maHasDates.resize(nQE + 1, false);
+ if (maRefreshExceptQuery.size() < nQE + 1)
+ maRefreshExceptQuery.resize(nQE + 1, false);
+
ScQueryEntry& rEntry = theQueryData.GetEntry( nQE );
bool bDoThis = (pLbField->GetSelectEntryPos() != 0);
rEntry.bDoQuery = bDoThis;
- if ( rEntry.bDoQuery || bRefreshExceptQuery[nQE] )
+ if ( rEntry.bDoQuery || maRefreshExceptQuery[nQE] )
{
if ( aStrEmpty.equals(aStrVal) )
{
@@ -1143,7 +1168,7 @@ IMPL_LINK( ScFilterDlg, ValModifyHdl, ComboBox*, pEd )
ScQueryOp eOp = (ScQueryOp)pLbCond->GetSelectEntryPos();
rEntry.eOp = eOp;
- rEntry.bQueryByDate = mbHasDates[nQE];
+ rEntry.bQueryByDate = maHasDates[nQE];
}
}
@@ -1159,14 +1184,16 @@ IMPL_LINK( ScFilterDlg, ScrollHdl, ScrollBar*, EMPTYARG )
void ScFilterDlg::SliderMoved()
{
- sal_uInt16 nOffset = GetSliderPos();
+ size_t nOffset = GetSliderPos();
RefreshEditRow( nOffset);
}
-sal_uInt16 ScFilterDlg::GetSliderPos()
+
+size_t ScFilterDlg::GetSliderPos()
{
- return (sal_uInt16) aScrollBar.GetThumbPos();
+ return static_cast<size_t>(aScrollBar.GetThumbPos());
}
-void ScFilterDlg::RefreshEditRow( sal_uInt16 nOffset )
+
+void ScFilterDlg::RefreshEditRow( size_t nOffset )
{
if (nOffset==0)
aConnLbArr[0]->Hide();
@@ -1178,10 +1205,13 @@ void ScFilterDlg::RefreshEditRow( sal_uInt16 nOffset )
String aValStr;
sal_uInt16 nCondPos = 0;
sal_uInt16 nFieldSelPos = 0;
- sal_uInt16 nQE = i+nOffset;
+ size_t nQE = i + nOffset;
+
+ if (maRefreshExceptQuery.size() < nQE + 1)
+ maRefreshExceptQuery.resize(nQE + 1, false);
ScQueryEntry& rEntry = theQueryData.GetEntry( nQE);
- if ( rEntry.bDoQuery || bRefreshExceptQuery[nQE] )
+ if ( rEntry.bDoQuery || maRefreshExceptQuery[nQE] )
{
nCondPos = (sal_uInt16)rEntry.eOp;
if(rEntry.bDoQuery)
@@ -1213,8 +1243,10 @@ void ScFilterDlg::RefreshEditRow( sal_uInt16 nOffset )
aConnLbArr[i+1]->Enable();
else
aConnLbArr[i+1]->Disable();
- sal_uInt16 nQENext = nQE+1;
- if(theQueryData.GetEntry(nQENext).bDoQuery || bRefreshExceptQuery[nQENext])
+ size_t nQENext = nQE + 1;
+ if (maRefreshExceptQuery.size() < nQENext + 1)
+ maRefreshExceptQuery.resize(nQENext + 1, false);
+ if (theQueryData.GetEntry(nQENext).bDoQuery || maRefreshExceptQuery[nQENext])
aConnLbArr[i+1]->SelectEntryPos( (sal_uInt16) theQueryData.GetEntry(nQENext).eConnect );
else
aConnLbArr[i+1]->SetNoSelection();
@@ -1227,7 +1259,9 @@ void ScFilterDlg::RefreshEditRow( sal_uInt16 nOffset )
else
aConnLbArr[i]->Disable();
- if(rEntry.bDoQuery || bRefreshExceptQuery[nQE])
+ if (maRefreshExceptQuery.size() < nQE + 1)
+ maRefreshExceptQuery.resize(nQE + 1, false);
+ if(rEntry.bDoQuery || maRefreshExceptQuery[nQE])
aConnLbArr[i]->SelectEntryPos( (sal_uInt16) rEntry.eConnect );
else
aConnLbArr[i]->SetNoSelection();
diff --git a/sc/source/ui/dbgui/sfiltdlg.cxx b/sc/source/ui/dbgui/sfiltdlg.cxx
index d4ea918..83d8fde 100644
--- a/sc/source/ui/dbgui/sfiltdlg.cxx
+++ b/sc/source/ui/dbgui/sfiltdlg.cxx
@@ -408,16 +408,6 @@ IMPL_LINK( ScSpecialFilterDlg, EndDlgHdl, Button*, pBtn )
rEnd.Row(),
rStart.Tab(),
theOutParam );
-
- // an der DB-Collection koennen nur MAXQUERY Filter-Eintraege
- // gespeichert werden
-
- if ( bQueryOk && theOutParam.GetEntryCount() > MAXQUERY &&
- theOutParam.GetEntry(MAXQUERY).bDoQuery )
- {
- bQueryOk = false; // zu viele
- //! andere Fehlermeldung ??
- }
}
}
diff --git a/sc/source/ui/inc/filtdlg.hxx b/sc/source/ui/inc/filtdlg.hxx
index 043eb1c..b0842e9 100644
--- a/sc/source/ui/inc/filtdlg.hxx
+++ b/sc/source/ui/inc/filtdlg.hxx
@@ -37,6 +37,7 @@
#include "address.hxx"
#include "anyrefdg.hxx"
+#include <deque>
//----------------------------------------------------------------------------
@@ -61,8 +62,8 @@ public:
virtual sal_Bool Close();
void SliderMoved();
- sal_uInt16 GetSliderPos();
- void RefreshEditRow( sal_uInt16 nOffset );
+ size_t GetSliderPos();
+ void RefreshEditRow( size_t nOffset );
private:
FixedLine aFlCriteria;
@@ -134,8 +135,8 @@ private:
ListBox* aFieldLbArr[4];
ListBox* aCondLbArr[4];
ListBox* aConnLbArr[4];
- bool mbHasDates[MAXQUERY];
- bool bRefreshExceptQuery[MAXQUERY];
+ std::deque<bool> maHasDates;
+ std::deque<bool> maRefreshExceptQuery;
sal_uInt16 nFieldCount;
bool bRefInputMode;
diff --git a/sc/source/ui/unoobj/datauno.cxx b/sc/source/ui/unoobj/datauno.cxx
index 0a208ad..62db49e 100644
--- a/sc/source/ui/unoobj/datauno.cxx
+++ b/sc/source/ui/unoobj/datauno.cxx
@@ -1065,8 +1065,6 @@ void ScFilterDescriptorBase::fillQueryParam(
const uno::Sequence<sheet::TableFilterField2>& aFilterFields)
{
SCSIZE nCount = static_cast<SCSIZE>(aFilterFields.getLength());
- OSL_ENSURE( nCount <= MAXQUERY, "setFilterFields: zu viele" );
-
rParam.Resize( nCount );
const sheet::TableFilterField2* pAry = aFilterFields.getConstArray();
@@ -1314,8 +1312,6 @@ void SAL_CALL ScFilterDescriptorBase::setFilterFields(
GetData(aParam);
SCSIZE nCount = static_cast<SCSIZE>(aFilterFields.getLength());
- OSL_ENSURE( nCount <= MAXQUERY, "setFilterFields: zu viele" );
-
aParam.Resize( nCount );
const sheet::TableFilterField* pAry = aFilterFields.getConstArray();
@@ -1422,11 +1418,7 @@ void SAL_CALL ScFilterDescriptorBase::setPropertyValue(
aParam.bCaseSens = ScUnoHelpFunctions::GetBoolFromAny( aValue );
else if (aString.EqualsAscii( SC_UNONAME_MAXFLD ))
{
- sal_Int32 nVal = 0;
- if ( (aValue >>= nVal) && nVal > sal::static_int_cast<sal_Int32>(MAXQUERY) )
- {
- throw lang::IllegalArgumentException();
- }
+ // silently ignored
}
else if (aString.EqualsAscii( SC_UNONAME_ORIENT ))
{
@@ -1473,7 +1465,7 @@ uno::Any SAL_CALL ScFilterDescriptorBase::getPropertyValue( const rtl::OUString&
else if (aString.EqualsAscii( SC_UNONAME_ISCASE ))
ScUnoHelpFunctions::SetBoolInAny( aRet, aParam.bCaseSens );
else if (aString.EqualsAscii( SC_UNONAME_MAXFLD ))
- aRet <<= (sal_Int32) MAXQUERY;
+ aRet <<= (sal_Int32) aParam.GetEntryCount();
else if (aString.EqualsAscii( SC_UNONAME_ORIENT ))
{
table::TableOrientation eOrient = aParam.bByRow ? table::TableOrientation_ROWS :
diff --git a/sc/source/ui/vba/vbarange.cxx b/sc/source/ui/vba/vbarange.cxx
index 659bff8..9b2ff40 100644
--- a/sc/source/ui/vba/vbarange.cxx
+++ b/sc/source/ui/vba/vbarange.cxx
@@ -4407,7 +4407,7 @@ void lcl_SetAllQueryForField( ScQueryParam& aParam, SCCOLROW nField )
{
bool bFound = false;
SCSIZE i = 0;
- for (; i<MAXQUERY && !bFound; i++)
+ for (; i < aParam.GetEntryCount() && !bFound; ++i)
{
ScQueryEntry& rEntry = aParam.GetEntry(i);
if ( rEntry.nField == nField)
@@ -4764,8 +4764,7 @@ ScVbaRange::AutoFilter( const uno::Any& Field, const uno::Any& Criteria1, const
{
// find the any field with the query and select all
ScQueryParam aParam = lcl_GetQueryParam( pShell, nSheet );
- SCSIZE i = 0;
- for (; i<MAXQUERY; i++)
+ for (SCSIZE i = 0; i< aParam.GetEntryCount(); ++i)
{
ScQueryEntry& rEntry = aParam.GetEntry(i);
if ( rEntry.bDoQuery )
diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index 9ed7fd2..14aeaa1 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -1157,7 +1157,8 @@ void ScGridWindow::LaunchDataSelectMenu( SCCOL nCol, SCROW nRow, bool bDataSelec
pDBData->GetQueryParam( aParam ); // kann nur MAXQUERY Eintraege ergeben
sal_Bool bValid = sal_True;
- for (SCSIZE j=0; j<MAXQUERY && bValid; j++) // bisherige Filter-Einstellungen
+ SCSIZE nCount = aParam.GetEntryCount();
+ for (SCSIZE j = 0; j < nCount && bValid; ++j) // bisherige Filter-Einstellungen
if (aParam.GetEntry(j).bDoQuery)
{
//! Abfrage mit DrawButtons zusammenfassen!
@@ -1345,7 +1346,8 @@ void ScGridWindow::ExecFilter( sal_uLong nSel,
bDeleteOld = sal_True;
if (aParam.bRegExp)
bDeleteOld = sal_True;
- for (SCSIZE i=0; i<MAXQUERY && !bDeleteOld; i++) // bisherige Filter-Einstellungen
+ SCSIZE nCount = aParam.GetEntryCount();
+ for (SCSIZE i = 0; i < nCount && !bDeleteOld; ++i) // bisherige Filter-Einstellungen
if (aParam.GetEntry(i).bDoQuery)
{
//! Abfrage mit DrawButtons zusammenfassen!
@@ -1376,7 +1378,7 @@ void ScGridWindow::ExecFilter( sal_uLong nSel,
aParam.bRegExp = false;
}
- if ( nQueryPos < MAXQUERY || SC_AUTOFILTER_ALL == nSel ) // loeschen geht immer
+ if ( nQueryPos < nCount || SC_AUTOFILTER_ALL == nSel ) // loeschen geht immer
{
if (nSel)
{
diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx
index 9d35f84..612763c 100644
--- a/sc/source/ui/view/gridwin4.cxx
+++ b/sc/source/ui/view/gridwin4.cxx
@@ -1182,7 +1182,8 @@ void ScGridWindow::DrawButtons( SCCOL nX1, SCROW /*nY1*/, SCCOL nX2, SCROW /*nY2
sal_Bool bColumnFound = false;
if (!pQueryParam->bInplace)
bSimpleQuery = false;
- for (nQuery=0; nQuery<MAXQUERY && bSimpleQuery; nQuery++)
+ SCSIZE nCount = pQueryParam->GetEntryCount();
+ for (nQuery = 0; nQuery < nCount && bSimpleQuery; ++nQuery)
if (pQueryParam->GetEntry(nQuery).bDoQuery)
{
// hier nicht auf EQUAL beschraenken
@@ -1330,7 +1331,8 @@ bool ScGridWindow::IsAutoFilterActive( SCCOL nCol, SCROW nRow, SCTAB nTab )
// aQueryParam kann nur MAXQUERY Eintraege enthalten
- for ( nQuery=0; nQuery<MAXQUERY && bSimpleQuery; nQuery++ )
+ SCSIZE nCount = aQueryParam.GetEntryCount();
+ for (nQuery = 0; nQuery < nCount && bSimpleQuery; ++nQuery)
if ( aQueryParam.GetEntry(nQuery).bDoQuery )
{
if (aQueryParam.GetEntry(nQuery).nField == nCol)
commit a9b69d2d67d18188aace35d80e654d1269d25ff3
Author: Kohei Yoshida <kohei.yoshida at suse.com>
Date: Thu Nov 3 20:58:54 2011 -0400
sal_Bool to bool.
diff --git a/sc/inc/global.hxx b/sc/inc/global.hxx
index e8f7da1..7a96782 100644
--- a/sc/inc/global.hxx
+++ b/sc/inc/global.hxx
@@ -738,8 +738,8 @@ namespace utl
struct ScQueryEntry
{
- sal_Bool bDoQuery;
- sal_Bool bQueryByString;
+ bool bDoQuery;
+ bool bQueryByString;
bool bQueryByDate;
SCCOLROW nField;
ScQueryOp eOp;
@@ -754,11 +754,11 @@ struct ScQueryEntry
~ScQueryEntry();
// creates pSearchParam and pSearchText if necessary, always RegExp!
- utl::TextSearch* GetSearchTextPtr( sal_Bool bCaseSens );
+ utl::TextSearch* GetSearchTextPtr( bool bCaseSens );
void Clear();
ScQueryEntry& operator=( const ScQueryEntry& r );
- sal_Bool operator==( const ScQueryEntry& r ) const;
+ bool operator==( const ScQueryEntry& r ) const;
};
class ScArea;
diff --git a/sc/source/core/data/global2.cxx b/sc/source/core/data/global2.cxx
index 0aa7ad6..486bfda 100644
--- a/sc/source/core/data/global2.cxx
+++ b/sc/source/core/data/global2.cxx
@@ -203,7 +203,7 @@ void ScQueryEntry::Clear()
pSearchText = NULL;
}
-sal_Bool ScQueryEntry::operator==( const ScQueryEntry& r ) const
+bool ScQueryEntry::operator==( const ScQueryEntry& r ) const
{
return bDoQuery == r.bDoQuery
&& bQueryByString == r.bQueryByString
@@ -216,7 +216,7 @@ sal_Bool ScQueryEntry::operator==( const ScQueryEntry& r ) const
//! pSearchParam und pSearchText nicht vergleichen
}
-utl::TextSearch* ScQueryEntry::GetSearchTextPtr( sal_Bool bCaseSens )
+utl::TextSearch* ScQueryEntry::GetSearchTextPtr( bool bCaseSens )
{
if ( !pSearchParam )
{
More information about the Libreoffice-commits
mailing list