Index: sc/inc/global.hxx =================================================================== RCS file: /cvs/sc/sc/inc/global.hxx,v retrieving revision 1.42 diff -u -p -u -r1.42 global.hxx --- sc/inc/global.hxx 13 Jan 2005 17:21:00 -0000 1.42 +++ sc/inc/global.hxx 11 Apr 2005 11:36:29 -0000 @@ -818,7 +818,11 @@ enum ScQueryOp SC_TOPVAL, SC_BOTVAL, SC_TOPPERC, - SC_BOTPERC + SC_BOTPERC, + SC_CONTAINS, + SC_DOES_NOT_CONTAIN, + SC_BEGINS_WITH, + SC_ENDS_WITH }; // ----------------------------------------------------------------------- Index: sc/source/ui/src/filter.src =================================================================== RCS file: /cvs/sc/sc/source/ui/src/filter.src,v retrieving revision 1.54 diff -u -p -u -r1.54 filter.src --- sc/source/ui/src/filter.src 18 Mar 2005 15:17:32 -0000 1.54 +++ sc/source/ui/src/filter.src 11 Apr 2005 11:36:29 -0000 @@ -180,16 +180,20 @@ ModelessDialog RID_SCDLG_FILTER }; stringlist [ en-US ] = { - < "=" ; Default ; > ; + < "Equals" ; Default ; > ; < "<" ; Default ; > ; < ">" ; Default ; > ; < "<=" ; Default ; > ; < ">=" ; Default ; > ; - < "<>" ; Default ; > ; + < "Not equals" ; Default ; > ; < "Largest" ; Default ; > ; < "Smallest" ; Default ; > ; < "Largest %" ; Default ; > ; < "Smallest %" ; Default ; > ; + < "Contains" ; Default ; > ; + < "Does not Contain" ; Default ; > ; + < "Begins with" ; Default ; > ; + < "Ends with" ; Default ; > ; }; }; ListBox LB_COND2 @@ -214,16 +218,20 @@ ModelessDialog RID_SCDLG_FILTER }; stringlist [ en-US ] = { - < "=" ; Default ; > ; + < "Equals" ; Default ; > ; < "<" ; Default ; > ; < ">" ; Default ; > ; < "<=" ; Default ; > ; < ">=" ; Default ; > ; - < "<>" ; Default ; > ; + < "Not equals" ; Default ; > ; < "Largest" ; Default ; > ; < "Smallest" ; Default ; > ; < "Largest %" ; Default ; > ; < "Smallest %" ; Default ; > ; + < "Contains" ; Default ; > ; + < "Does not Contain" ; Default ; > ; + < "Begins with" ; Default ; > ; + < "Ends with" ; Default ; > ; }; }; ListBox LB_COND3 @@ -248,16 +256,20 @@ ModelessDialog RID_SCDLG_FILTER }; stringlist [ en-US ] = { - < "=" ; Default ; > ; + < "Equals" ; Default ; > ; < "<" ; Default ; > ; < ">" ; Default ; > ; < "<=" ; Default ; > ; < ">=" ; Default ; > ; - < "<>" ; Default ; > ; + < "Not equals" ; Default ; > ; < "Largest" ; Default ; > ; < "Smallest" ; Default ; > ; < "Largest %" ; Default ; > ; < "Smallest %" ; Default ; > ; + < "Contains" ; Default ; > ; + < "Does not Contain" ; Default ; > ; + < "Begins with" ; Default ; > ; + < "Ends with" ; Default ; > ; }; }; ComboBox ED_VAL1 Index: sc/source/ui/dbgui/filtdlg.cxx =================================================================== RCS file: /cvs/sc/sc/source/ui/dbgui/filtdlg.cxx,v retrieving revision 1.11 diff -u -p -u -r1.11 filtdlg.cxx --- sc/source/ui/dbgui/filtdlg.cxx 23 Jul 2004 10:51:24 -0000 1.11 +++ sc/source/ui/dbgui/filtdlg.cxx 11 Apr 2005 11:36:29 -0000 @@ -84,6 +84,7 @@ #include "document.hxx" #include "docsh.hxx" #include "scresid.hxx" +#include "docoptio.hxx" #include "foptmgr.hxx" @@ -572,6 +573,8 @@ ScQueryItem* ScFilterDlg::GetOutputItem( bCopyPosOk = ( SCA_VALID == (nResult & SCA_VALID) ); } + theParam.bRegExp = aBtnRegExp.IsChecked(); + for ( i = 0; i < 3; i++ ) { USHORT nField = aFieldLbArr[i]->GetSelectEntryPos(); @@ -605,6 +608,18 @@ ScQueryItem* ScFilterDlg::GetOutputItem( } else { + if (eOp == SC_BEGINS_WITH ) { + String tmp ('^'); + tmp .Append(aStrVal); + ::rtl::OUString str (tmp); + aStrVal.Assign(tmp); + theParam.bRegExp = TRUE; + } + else if (eOp == SC_ENDS_WITH ) { + aStrVal.Append (String('$')); + theParam.bRegExp = TRUE; + } + *rEntry.pStr = aStrVal; rEntry.nVal = 0; rEntry.bQueryByString = TRUE; @@ -642,7 +657,7 @@ ScQueryItem* ScFilterDlg::GetOutputItem( theParam.bByRow = TRUE; theParam.bDuplicate = !aBtnUnique.IsChecked(); theParam.bCaseSens = aBtnCase.IsChecked(); - theParam.bRegExp = aBtnRegExp.IsChecked(); + theParam.bDestPers = aBtnDestPers.IsChecked(); // nur die drei eingestellten - alles andere zuruecksetzen Index: sc/source/core/data/table3.cxx =================================================================== RCS file: /cvs/sc/sc/source/core/data/table3.cxx,v retrieving revision 1.20 diff -u -p -u -r1.20 table3.cxx --- sc/source/core/data/table3.cxx 15 Nov 2004 16:34:51 -0000 1.20 +++ sc/source/core/data/table3.cxx 11 Apr 2005 11:36:30 -0000 @@ -1037,13 +1037,22 @@ BOOL ScTable::ValidQuery(SCROW nRow, con break; } } - else if ( (rEntry.eOp == SC_EQUAL || rEntry.eOp == SC_NOT_EQUAL) || + else if ( (rEntry.eOp == SC_CONTAINS || rEntry.eOp == SC_DOES_NOT_CONTAIN || + rEntry.eOp == SC_BEGINS_WITH || rEntry.eOp == SC_ENDS_WITH || + rEntry.eOp == SC_EQUAL || rEntry.eOp == SC_NOT_EQUAL) || (rEntry.bQueryByString && (pCell ? pCell->HasStringData() : HasStringData( static_cast(rEntry.nField), nRow)))) { // by String String aCellStr; + + // Contains and Does not contain is similar to EQUAL and NOT EQUAL + // but with bMatchWholeCell set to false + if(rEntry.eOp == SC_CONTAINS || rEntry.eOp == SC_BEGINS_WITH || + rEntry.eOp == SC_ENDS_WITH || rEntry.eOp == SC_DOES_NOT_CONTAIN) + bMatchWholeCell = FALSE; + if ( pCell ) { if (pCell->GetCellType() != CELLTYPE_NOTE) @@ -1056,7 +1065,9 @@ BOOL ScTable::ValidQuery(SCROW nRow, con GetInputString( static_cast(rEntry.nField), nRow, aCellStr ); BOOL bRealRegExp = (rParam.bRegExp && ((rEntry.eOp == SC_EQUAL) - || (rEntry.eOp == SC_NOT_EQUAL))); + || (rEntry.eOp == SC_NOT_EQUAL) || (rEntry.eOp == SC_CONTAINS) + || (rEntry.eOp == SC_DOES_NOT_CONTAIN) || (rEntry.eOp == SC_BEGINS_WITH) + || (rEntry.eOp == SC_ENDS_WITH))); BOOL bTestRegExp = (pbTestEqualCondition && rParam.bRegExp && ((rEntry.eOp == SC_LESS_EQUAL) || (rEntry.eOp == SC_GREATER_EQUAL))); @@ -1071,13 +1082,16 @@ BOOL ScTable::ValidQuery(SCROW nRow, con && (nStart != 0 || nEnd != aCellStr.Len()) ) bMatch = FALSE; // RegExp must match entire cell string if ( bRealRegExp ) - bOk = ((rEntry.eOp == SC_NOT_EQUAL) ? !bMatch : bMatch); + bOk = ((rEntry.eOp == SC_NOT_EQUAL || + rEntry.eOp == SC_DOES_NOT_CONTAIN) ? !bMatch : bMatch); else bTestEqual = bMatch; } if ( !bRealRegExp ) { - if ( rEntry.eOp == SC_EQUAL || rEntry.eOp == SC_NOT_EQUAL ) + if ( rEntry.eOp == SC_EQUAL || rEntry.eOp == SC_NOT_EQUAL + || rEntry.eOp == SC_CONTAINS || rEntry.eOp == SC_DOES_NOT_CONTAIN + || rEntry.eOp == SC_BEGINS_WITH || rEntry.eOp == SC_ENDS_WITH) { if ( !rEntry.bQueryByString && rEntry.pStr->Len() == 0 ) { @@ -1099,7 +1113,8 @@ BOOL ScTable::ValidQuery(SCROW nRow, con &xOff ) ); bOk = (aCell.Search( aQuer ) != STRING_NOTFOUND); } - if ( rEntry.eOp == SC_NOT_EQUAL ) + if ( rEntry.eOp == SC_NOT_EQUAL || + rEntry.eOp == SC_DOES_NOT_CONTAIN) bOk = !bOk; } else