diff options
Diffstat (limited to 'sc/source/ui')
-rw-r--r-- | sc/source/ui/dbgui/filtdlg.cxx | 118 | ||||
-rw-r--r-- | sc/source/ui/dbgui/sfiltdlg.cxx | 10 | ||||
-rw-r--r-- | sc/source/ui/inc/filtdlg.hxx | 9 | ||||
-rw-r--r-- | sc/source/ui/unoobj/datauno.cxx | 12 | ||||
-rw-r--r-- | sc/source/ui/vba/vbarange.cxx | 5 | ||||
-rw-r--r-- | sc/source/ui/view/gridwin.cxx | 8 | ||||
-rw-r--r-- | sc/source/ui/view/gridwin4.cxx | 6 |
7 files changed, 94 insertions, 74 deletions
diff --git a/sc/source/ui/dbgui/filtdlg.cxx b/sc/source/ui/dbgui/filtdlg.cxx index 539e0a4edf27..4f949c4d6c94 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 d4ea918ce3dd..83d8fdea54a1 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 043eb1cfd634..b0842e99ad27 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 0a208ad26a79..62db49e4f3d8 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 0fb69e0134c8..3373263a312c 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 9ed7fd22a0f4..14aeaa1e6f42 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 9d35f84c5785..612763c9b209 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) |