diff -uNr old/offapi/com/sun/star/sheet/FilterOperator2.idl new/offapi/com/sun/star/sheet/FilterOperator2.idl --- old/offapi/com/sun/star/sheet/FilterOperator2.idl 1970-01-01 08:00:00.000000000 +0800 +++ new/offapi/com/sun/star/sheet/FilterOperator2.idl 2009-03-25 10:04:44.593750000 +0800 @@ -0,0 +1,162 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: FilterOperator2.idl,v $ + * $Revision: 1.7 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef __com_sun_star_sheet_FilterOperator2_idl__ +#define __com_sun_star_sheet_FilterOperator2_idl__ + +//============================================================================= + +module com { module sun { module star { module sheet { + +//============================================================================= + +/** specifies the type of a single condition in a filter descriptor. +

This constants group extends the FilterOperator enum by + additional filter operators.

+ @since OOo 3.0 + */ +published constants FilterOperator2 +{ + + //------------------------------------------------------------------------- + + /** selects empty entries. + */ + const long EMPTY = 0; + + //------------------------------------------------------------------------- + + /** selects non-empty entries. + */ + const long NOT_EMPTY = 1; + + //------------------------------------------------------------------------- + + /** value has to be equal to the specified value. + */ + const long EQUAL = 2; + + //------------------------------------------------------------------------- + + /** value must not be equal to the specified value. + */ + const long NOT_EQUAL = 3; + + //------------------------------------------------------------------------- + + /** value has to be greater than the specified value. + */ + const long GREATER = 4; + + //------------------------------------------------------------------------- + + /** value has to be greater than or equal to the specified value. + */ + const long GREATER_EQUAL = 5; + + //------------------------------------------------------------------------- + + /** value has to be less than the specified value. + */ + const long LESS = 6; + + //------------------------------------------------------------------------- + + /** value has to be less than or equal to the specified value. + */ + const long LESS_EQUAL = 7; + + //------------------------------------------------------------------------- + + /** selects a specified number of entries with the greatest values. + */ + const long TOP_VALUES = 8; + + //------------------------------------------------------------------------- + + /** selects a specified percentage of entries with the greatest values. + */ + const long TOP_PERCENT = 9; + + //------------------------------------------------------------------------- + + /** selects a specified number of entries with the lowest values. + */ + const long BOTTOM_VALUES = 10; + + //------------------------------------------------------------------------- + + /** selects a specified percentage of entries with the lowest values. + */ + const long BOTTOM_PERCENT = 11; + + //------------------------------------------------------------------------- + + /** selects contains entries. + */ + const long CONTAINS = 12; + + //------------------------------------------------------------------------- + + /** selects does-not-contain entries. + */ + const long DOES_NOT_CONTAIN = 13; + + //------------------------------------------------------------------------- + + /** selects begins-with entries. + */ + const long BEGINS_WITH = 14; + + //------------------------------------------------------------------------- + + /** selects does-not-begin-with entries. + */ + const long DOES_NOT_BEGIN_WITH = 15; + //------------------------------------------------------------------------- + + /** selects ends-with entries. + */ + const long ENDS_WITH = 16; + + //------------------------------------------------------------------------- + + /** selects does-not-end-with entries. + */ + const long DOES_NOT_END_WITH = 17; + +}; + +//============================================================================= + +}; }; }; }; + +#endif + diff -uNr old/offapi/com/sun/star/sheet/TableFilterField2.idl new/offapi/com/sun/star/sheet/TableFilterField2.idl --- old/offapi/com/sun/star/sheet/TableFilterField2.idl 1970-01-01 08:00:00.000000000 +0800 +++ new/offapi/com/sun/star/sheet/TableFilterField2.idl 2009-03-25 10:07:54.906250000 +0800 @@ -0,0 +1,104 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: TableFilterField2.idl,v $ + * $Revision: 1.7 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef __com_sun_star_sheet_TableFilterField2_idl__ +#define __com_sun_star_sheet_TableFilterField2_idl__ + + +#ifndef __com_sun_star_sheet_FilterConnection_idl__ +#include +#endif + +#ifndef __com_sun_star_sheet_FilterOperator2_idl__ +#include +#endif + +//============================================================================= + +module com { module sun { module star { module sheet { + +//============================================================================= + +/** describes a single condition in a filter descriptor. +

This struct has the FilterOperator2 constants group as + member, whereas the TableFilterField struct uses the + FilterOperator enum.

+ @see com::sun::star::sheet::SheetFilterDescriptor + @since OOo 3.0 + */ +published struct TableFilterField2 +{ + //------------------------------------------------------------------------- + + /** specifies how the condition is connected to the previous condition. + */ + com::sun::star::sheet::FilterConnection Connection; + + //------------------------------------------------------------------------- + + /** specifies which field (column) is used for the condition. + */ + long Field; + + //------------------------------------------------------------------------- + + /** specifies the type of the condition as defined in + FilterOperator2. + */ + long Operator; + + //------------------------------------------------------------------------- + + /** selects whether the TableFilterField2::NumericValue + or the TableFilterField2::StringValue is used. + */ + boolean IsNumeric; + + //------------------------------------------------------------------------- + + /** specifies a numeric value for the condition. + */ + double NumericValue; + + //------------------------------------------------------------------------- + + /** specifies a string value for the condition. + */ + string StringValue; + +}; + +//============================================================================= + +}; }; }; }; + + +#endif + diff -uNr old/offapi/com/sun/star/sheet/XSheetFilterDescriptor2.idl new/offapi/com/sun/star/sheet/XSheetFilterDescriptor2.idl --- old/offapi/com/sun/star/sheet/XSheetFilterDescriptor2.idl 1970-01-01 08:00:00.000000000 +0800 +++ new/offapi/com/sun/star/sheet/XSheetFilterDescriptor2.idl 2009-03-25 14:44:39.250000000 +0800 @@ -0,0 +1,77 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: XSheetFilterDescriptor2.idl,v $ + * $Revision: 1.9 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef __com_sun_star_sheet_XSheetFilterDescriptor2_idl__ +#define __com_sun_star_sheet_XSheetFilterDescriptor2_idl__ + +#ifndef __com_sun_star_sheet_TableFilterField2_idl__ +#include +#endif + +#ifndef __com_sun_star_uno_XInterface_idl__ +#include +#endif + +//============================================================================= + +module com { module sun { module star { module sheet { + +//============================================================================= + +/** provides access to a collection of filter conditions (filter fields). +

This interface uses the TableFilterField2 struct, + whereas the XSheetFilterDescriptor interface uses the + TableFilterField struct.

+ @see com::sun::star::sheet::SheetFilterDescriptor + @since OOo 3.0 + */ +published interface XSheetFilterDescriptor2: com::sun::star::uno::XInterface +{ + //------------------------------------------------------------------------- + + /** returns the collection of filter fields. + */ + sequence< com::sun::star::sheet::TableFilterField2 > getFilterFields2(); + + //------------------------------------------------------------------------- + + /** sets a new collection of filter fields. + */ + void setFilterFields2( + [in] sequence< com::sun::star::sheet::TableFilterField2 > aFilterFields ); + +}; + +//============================================================================= + +}; }; }; }; + +#endif + diff -uNr old/offapi/com/sun/star/sheet/makefile.mk new/offapi/com/sun/star/sheet/makefile.mk --- old/offapi/com/sun/star/sheet/makefile.mk 2009-03-12 18:37:16.546875000 +0800 +++ new/offapi/com/sun/star/sheet/makefile.mk 2009-03-24 15:29:26.500000000 +0800 @@ -136,6 +136,7 @@ FillMode.idl\ FilterConnection.idl\ FilterOperator.idl\ + FilterOperator2.idl\ FormulaLanguage.idl\ FormulaMapGroup.idl\ FormulaMapGroupSpecialOffset.idl\ @@ -217,6 +218,7 @@ TableConditionalEntryEnumeration.idl\ TableConditionalFormat.idl\ TableFilterField.idl\ + TableFilterField2.idl\ TableOperationMode.idl\ TablePageBreakData.idl\ TablePageStyle.idl\ @@ -312,6 +314,7 @@ XSheetConditionalEntries.idl\ XSheetConditionalEntry.idl\ XSheetFilterDescriptor.idl\ + XSheetFilterDescriptor2.idl\ XSheetFilterable.idl\ XSheetFilterableEx.idl\ XSheetLinkable.idl\ diff -uNr old/sc/inc/datauno.hxx new/sc/inc/datauno.hxx --- old/sc/inc/datauno.hxx 2009-03-12 18:06:11.234375000 +0800 +++ new/sc/inc/datauno.hxx 2009-03-24 15:30:54.546875000 +0800 @@ -50,6 +50,7 @@ #include #include #include +#include #include #include #include @@ -340,7 +341,8 @@ // to uno, all three look the same -class ScFilterDescriptorBase : public cppu::WeakImplHelper3< +class ScFilterDescriptorBase : public cppu::WeakImplHelper4< + com::sun::star::sheet::XSheetFilterDescriptor2, com::sun::star::sheet::XSheetFilterDescriptor, com::sun::star::beans::XPropertySet, com::sun::star::lang::XServiceInfo >, @@ -367,6 +369,11 @@ virtual void SAL_CALL setFilterFields( const ::com::sun::star::uno::Sequence< ::com::sun::star::sheet::TableFilterField >& aFilterFields ) throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::sheet::TableFilterField2 > SAL_CALL + getFilterFields2() throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setFilterFields2( const ::com::sun::star::uno::Sequence< + ::com::sun::star::sheet::TableFilterField2 >& aFilterFields ) + throw(::com::sun::star::uno::RuntimeException); // XPropertySet virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > diff -uNr old/sc/inc/global.hxx new/sc/inc/global.hxx --- old/sc/inc/global.hxx 2009-03-12 18:06:10.875000000 +0800 +++ new/sc/inc/global.hxx 2009-03-24 15:31:09.984375000 +0800 @@ -722,7 +722,13 @@ SC_TOPVAL, SC_BOTVAL, SC_TOPPERC, - SC_BOTPERC + SC_BOTPERC, + SC_CONTAINS, + SC_DOES_NOT_CONTAIN, + SC_BEGINS_WITH, + SC_DOES_NOT_BEGIN_WITH, + SC_ENDS_WITH, + SC_DOES_NOT_END_WITH }; // ----------------------------------------------------------------------- diff -uNr old/sc/inc/sc.hrc new/sc/inc/sc.hrc --- old/sc/inc/sc.hrc 2009-03-12 18:06:10.703125000 +0800 +++ new/sc/inc/sc.hrc 2009-03-24 15:31:20.609375000 +0800 @@ -1305,6 +1305,8 @@ #define SCSTR_DPFUNCLISTBOX (STR_START + 92) #define STR_PRINT_NOTHING (STR_START + 93) #define SCSTR_ALLFILTER (STR_START + 94) +#define SCSTR_MOREBTN_MOREOPTIONS (STR_START + 95) +#define SCSTR_MOREBTN_LESSOPTIONS (STR_START + 96) // Items diff -uNr old/sc/source/core/data/table3.cxx new/sc/source/core/data/table3.cxx --- old/sc/source/core/data/table3.cxx 2009-03-12 18:03:15.921875000 +0800 +++ new/sc/source/core/data/table3.cxx 2009-03-24 15:32:03.531250000 +0800 @@ -1021,12 +1021,19 @@ } } else 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 || + rEntry.eOp == SC_DOES_NOT_BEGIN_WITH || rEntry.eOp == SC_DOES_NOT_END_WITH) || (rEntry.bQueryByString && (pCell ? pCell->HasStringData() : HasStringData( static_cast(rEntry.nField), nRow)))) { // by String String aCellStr; + if( rEntry.eOp == SC_CONTAINS || rEntry.eOp == SC_DOES_NOT_CONTAIN + || rEntry.eOp == SC_BEGINS_WITH || rEntry.eOp == SC_ENDS_WITH + || rEntry.eOp == SC_DOES_NOT_BEGIN_WITH || rEntry.eOp == SC_DOES_NOT_END_WITH ) + bMatchWholeCell = FALSE; if ( pCell ) { if (pCell->GetCellType() != CELLTYPE_NOTE) @@ -1039,7 +1046,10 @@ 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) || (rEntry.eOp == SC_DOES_NOT_BEGIN_WITH) + || (rEntry.eOp == SC_DOES_NOT_END_WITH))); BOOL bTestRegExp = (pbTestEqualCondition && rParam.bRegExp && ((rEntry.eOp == SC_LESS_EQUAL) || (rEntry.eOp == SC_GREATER_EQUAL))); @@ -1047,20 +1057,61 @@ { xub_StrLen nStart = 0; xub_StrLen nEnd = aCellStr.Len(); - BOOL bMatch = (BOOL) rEntry.GetSearchTextPtr( rParam.bCaseSens ) - ->SearchFrwrd( aCellStr, &nStart, &nEnd ); + // from 614 on, nEnd is behind the found text + BOOL bMatch = FALSE; + if ( rEntry.eOp == SC_ENDS_WITH || rEntry.eOp == SC_DOES_NOT_END_WITH ) + { + nEnd = 0; + nStart = aCellStr.Len(); + bMatch = (BOOL) rEntry.GetSearchTextPtr( rParam.bCaseSens ) + ->SearchBkwrd( aCellStr, &nStart, &nEnd ); + } + else + { + bMatch = (BOOL) rEntry.GetSearchTextPtr( rParam.bCaseSens ) + ->SearchFrwrd( aCellStr, &nStart, &nEnd ); + } if ( bMatch && bMatchWholeCell && (nStart != 0 || nEnd != aCellStr.Len()) ) bMatch = FALSE; // RegExp must match entire cell string if ( bRealRegExp ) - bOk = ((rEntry.eOp == SC_NOT_EQUAL) ? !bMatch : bMatch); + switch (rEntry.eOp) + { + case SC_EQUAL: + case SC_CONTAINS: + bOk = bMatch; + break; + case SC_NOT_EQUAL: + case SC_DOES_NOT_CONTAIN: + bOk = !bMatch; + break; + case SC_BEGINS_WITH: + bOk = ( bMatch && (nStart == 0) ); + break; + case SC_DOES_NOT_BEGIN_WITH: + bOk = !( bMatch && (nStart == 0) ); + break; + case SC_ENDS_WITH: + bOk = ( bMatch && (nEnd == aCellStr.Len()) ); + break; + case SC_DOES_NOT_END_WITH: + bOk = !( bMatch && (nEnd == aCellStr.Len()) ); + break; + default: + { + // added to avoid warnings + } + } 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 + || rEntry.eOp == SC_DOES_NOT_BEGIN_WITH || rEntry.eOp == SC_DOES_NOT_END_WITH ) { if ( !rEntry.bQueryByString && rEntry.pStr->Len() == 0 ) { @@ -1068,9 +1119,15 @@ // the query value is assigned directly, and the string is empty. In that case, // don't find any string (isEqual would find empty string results in formula cells). bOk = FALSE; + if ( rEntry.eOp == SC_NOT_EQUAL ) + bOk = !bOk; } else if ( bMatchWholeCell ) + { bOk = pTransliteration->isEqual( aCellStr, *rEntry.pStr ); + if ( rEntry.eOp == SC_NOT_EQUAL ) + bOk = !bOk; + } else { ::com::sun::star::uno::Sequence< sal_Int32 > xOff; @@ -1080,10 +1137,37 @@ String aQuer( pTransliteration->transliterate( *rEntry.pStr, ScGlobal::eLnge, 0, rEntry.pStr->Len(), &xOff ) ); - bOk = (aCell.Search( aQuer ) != STRING_NOTFOUND); + xub_StrLen nIndex = (rEntry.eOp == SC_ENDS_WITH + || rEntry.eOp == SC_DOES_NOT_END_WITH)? (aCell.Len()-aQuer.Len()):0; + xub_StrLen nStrPos = aCell.Search( aQuer, nIndex ); + switch (rEntry.eOp) + { + case SC_EQUAL: + case SC_CONTAINS: + bOk = ( nStrPos != STRING_NOTFOUND ); + break; + case SC_NOT_EQUAL: + case SC_DOES_NOT_CONTAIN: + bOk = ( nStrPos == STRING_NOTFOUND ); + break; + case SC_BEGINS_WITH: + bOk = ( nStrPos == 0 ); + break; + case SC_DOES_NOT_BEGIN_WITH: + bOk = ( nStrPos != 0 ); + break; + case SC_ENDS_WITH: + bOk = ( nStrPos + aQuer.Len() == aCell.Len() ); + break; + case SC_DOES_NOT_END_WITH: + bOk = ( nStrPos + aQuer.Len() != aCell.Len() ); + break; + default: + { + // added to avoid warnings + } + } } - if ( rEntry.eOp == SC_NOT_EQUAL ) - bOk = !bOk; } else { // use collator here because data was probably sorted diff -uNr old/sc/source/filter/excel/excimp8.cxx new/sc/source/filter/excel/excimp8.cxx --- old/sc/source/filter/excel/excimp8.cxx 2009-03-12 18:02:50.500000000 +0800 +++ new/sc/source/filter/excel/excimp8.cxx 2009-03-24 15:58:36.093750000 +0800 @@ -426,6 +426,38 @@ } } +static void ExcelQueryToOooQuery( ScQueryEntry& rEntry ) +{ + if( ( rEntry.eOp != SC_EQUAL && rEntry.eOp != SC_NOT_EQUAL ) || rEntry.pStr == NULL ) + return; + else + { + xub_StrLen nLen = rEntry.pStr->Len(); + sal_Unicode nStart = rEntry.pStr->GetChar( 0 ); + sal_Unicode nEnd = rEntry.pStr->GetChar( nLen-1 ); + if( nLen >2 && nStart == '*' && nEnd == '*' ) + { + rEntry.pStr->Erase( nLen-1, 1 ); + rEntry.pStr->Erase( 0, 1 ); + rEntry.eOp = ( rEntry.eOp == SC_EQUAL ) ? SC_CONTAINS : SC_DOES_NOT_CONTAIN; + } + else if( nLen > 1 && nStart == '*' && nEnd != '*' ) + { + rEntry.pStr->Erase( 0, 1 ); + rEntry.eOp = ( rEntry.eOp == SC_EQUAL ) ? SC_ENDS_WITH : SC_DOES_NOT_END_WITH; + } + else if( nLen > 1 && nStart != '*' && nEnd == '*' ) + { + rEntry.pStr->Erase( nLen-1, 1 ); + rEntry.eOp = ( rEntry.eOp == SC_EQUAL ) ? SC_BEGINS_WITH : SC_DOES_NOT_BEGIN_WITH; + } + else if( nLen == 2 && nStart == '*' && nEnd == '*' ) + { + rEntry.pStr->Erase( 0, 1 ); + } + } +} + void XclImpAutoFilterData::ReadAutoFilter( XclImpStream& rStrm ) { UINT16 nCol, nFlags; @@ -463,14 +495,14 @@ BOOL bIgnore; UINT8 nStrLen[ 2 ] = { 0, 0 }; - String* pEntryStr[ 2 ] = { NULL, NULL }; + ScQueryEntry *pQueryEntries[ 2 ] = { NULL, NULL }; for( nE = 0; nE < 2; nE++ ) { if( nFirstEmpty < nCount ) { ScQueryEntry& aEntry = aParam.GetEntry( nFirstEmpty ); - pEntryStr[ nE ] = aEntry.pStr; + pQueryEntries[ nE ] = &aEntry; bIgnore = FALSE; rStrm >> nType >> nOper; @@ -558,8 +590,12 @@ } for( nE = 0; nE < 2; nE++ ) - if( nStrLen[ nE ] && pEntryStr[ nE ] ) - pEntryStr[ nE ]->Assign( rStrm.ReadUniString( nStrLen[ nE ] ) ); + if( nStrLen[ nE ] && pQueryEntries[ nE ] ) + { + pQueryEntries[ nE ]->pStr->Assign ( rStrm.ReadUniString( nStrLen[ nE ] ) ); + ExcelQueryToOooQuery( *pQueryEntries[ nE ] ); + } + } } diff -uNr old/sc/source/filter/excel/excrecds.cxx new/sc/source/filter/excel/excrecds.cxx --- old/sc/source/filter/excel/excrecds.cxx 2009-03-12 18:02:50.656250000 +0800 +++ new/sc/source/filter/excel/excrecds.cxx 2009-03-24 15:57:52.093750000 +0800 @@ -699,7 +699,31 @@ String sText; if( rEntry.pStr ) - sText.Assign( *rEntry.pStr ); + { + sText.Assign( *rEntry.pStr ); + switch( rEntry.eOp ) + { + case SC_CONTAINS: + case SC_DOES_NOT_CONTAIN: + { + sText.InsertAscii( "*" , 0 ); + sText.AppendAscii( "*" ); + } + break; + case SC_BEGINS_WITH: + case SC_DOES_NOT_BEGIN_WITH: + sText.AppendAscii( "*" ); + break; + case SC_ENDS_WITH: + case SC_DOES_NOT_END_WITH: + sText.InsertAscii( "*" , 0 ); + break; + default: + { + //nothing + } + } + } BOOL bLen = sText.Len() > 0; @@ -759,6 +783,14 @@ case SC_LESS_EQUAL: nOper = EXC_AFOPER_LESSEQUAL; break; case SC_GREATER_EQUAL: nOper = EXC_AFOPER_GREATEREQUAL; break; case SC_NOT_EQUAL: nOper = EXC_AFOPER_NOTEQUAL; break; + case SC_CONTAINS: + case SC_BEGINS_WITH: + case SC_ENDS_WITH: + nOper = EXC_AFOPER_EQUAL; break; + case SC_DOES_NOT_CONTAIN: + case SC_DOES_NOT_BEGIN_WITH: + case SC_DOES_NOT_END_WITH: + nOper = EXC_AFOPER_NOTEQUAL; break; default:; } bConflict = !AddCondition( rEntry.eConnect, nType, nOper, fVal, pText ); diff -uNr old/sc/source/filter/xml/XMLExportDatabaseRanges.cxx new/sc/source/filter/xml/XMLExportDatabaseRanges.cxx --- old/sc/source/filter/xml/XMLExportDatabaseRanges.cxx 2009-03-12 18:02:56.578125000 +0800 +++ new/sc/source/filter/xml/XMLExportDatabaseRanges.cxx 2009-03-24 15:44:18.375000000 +0800 @@ -55,6 +55,7 @@ #include #include #include +#include #include #include @@ -203,44 +204,56 @@ } } -rtl::OUString ScXMLExportDatabaseRanges::getOperatorXML(const sheet::FilterOperator aFilterOperator, const sal_Bool bUseRegularExpressions) const +rtl::OUString ScXMLExportDatabaseRanges::getOperatorXML(const long aFilterOperator, const sal_Bool bUseRegularExpressions) const { - switch (aFilterOperator) - { - case sheet::FilterOperator_EQUAL : - { - if (bUseRegularExpressions) - return GetXMLToken(XML_MATCH); - else - return rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("=")); - } - case sheet::FilterOperator_NOT_EQUAL : - { - if (bUseRegularExpressions) - return GetXMLToken(XML_NOMATCH); - else - return rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("!=")); - } - case sheet::FilterOperator_BOTTOM_PERCENT : - return GetXMLToken(XML_BOTTOM_PERCENT); - case sheet::FilterOperator_BOTTOM_VALUES : - return GetXMLToken(XML_BOTTOM_VALUES); - case sheet::FilterOperator_EMPTY : - return GetXMLToken(XML_EMPTY); - case sheet::FilterOperator_GREATER : - return rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(">")); - case sheet::FilterOperator_GREATER_EQUAL : - return rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(">=")); - case sheet::FilterOperator_LESS : - return rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("<")); - case sheet::FilterOperator_LESS_EQUAL : - return rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("<=")); - case sheet::FilterOperator_NOT_EMPTY : - return GetXMLToken(XML_NOEMPTY); - case sheet::FilterOperator_TOP_PERCENT : - return GetXMLToken(XML_TOP_PERCENT); - case sheet::FilterOperator_TOP_VALUES : - return GetXMLToken(XML_TOP_VALUES); + switch (aFilterOperator) + { + case sheet::FilterOperator2::EQUAL : + { + if (bUseRegularExpressions) + return GetXMLToken(XML_MATCH); + else + return rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("=")); + } + case sheet::FilterOperator2::NOT_EQUAL : + { + if (bUseRegularExpressions) + return GetXMLToken(XML_NOMATCH); + else + return rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("!=")); + } + case sheet::FilterOperator2::BOTTOM_PERCENT : + return GetXMLToken(XML_BOTTOM_PERCENT); + case sheet::FilterOperator2::BOTTOM_VALUES : + return GetXMLToken(XML_BOTTOM_VALUES); + case sheet::FilterOperator2::EMPTY : + return GetXMLToken(XML_EMPTY); + case sheet::FilterOperator2::GREATER : + return rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(">")); + case sheet::FilterOperator2::GREATER_EQUAL : + return rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(">=")); + case sheet::FilterOperator2::LESS : + return rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("<")); + case sheet::FilterOperator2::LESS_EQUAL : + return rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("<=")); + case sheet::FilterOperator2::NOT_EMPTY : + return GetXMLToken(XML_NOEMPTY); + case sheet::FilterOperator2::TOP_PERCENT : + return GetXMLToken(XML_TOP_PERCENT); + case sheet::FilterOperator2::TOP_VALUES : + return GetXMLToken(XML_TOP_VALUES); + case sheet::FilterOperator2::CONTAINS : + return GetXMLToken(XML_CONTAINS); + case sheet::FilterOperator2::DOES_NOT_CONTAIN : + return GetXMLToken(XML_DOES_NOT_CONTAIN); + case sheet::FilterOperator2::BEGINS_WITH : + return GetXMLToken(XML_BEGINS_WITH); + case sheet::FilterOperator2::DOES_NOT_BEGIN_WITH : + return GetXMLToken(XML_DOES_NOT_BEGIN_WITH); + case sheet::FilterOperator2::ENDS_WITH : + return GetXMLToken(XML_ENDS_WITH); + case sheet::FilterOperator2::DOES_NOT_END_WITH : + return GetXMLToken(XML_DOES_NOT_END_WITH); default: { // added to avoid warnings @@ -249,7 +262,7 @@ return rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("=")); } -void ScXMLExportDatabaseRanges::WriteCondition(const sheet::TableFilterField& aFilterField, sal_Bool bIsCaseSensitive, sal_Bool bUseRegularExpressions) +void ScXMLExportDatabaseRanges::WriteCondition(const sheet::TableFilterField2& aFilterField, sal_Bool bIsCaseSensitive, sal_Bool bUseRegularExpressions) { rExport.AddAttribute(XML_NAMESPACE_TABLE, XML_FIELD_NUMBER, rtl::OUString::valueOf(aFilterField.Field)); if (bIsCaseSensitive) @@ -267,9 +280,9 @@ SvXMLElementExport aElemC(rExport, XML_NAMESPACE_TABLE, XML_FILTER_CONDITION, sal_True, sal_True); } -void ScXMLExportDatabaseRanges::WriteFilterDescriptor(const uno::Reference & xSheetFilterDescriptor, const rtl::OUString sDatabaseRangeName) +void ScXMLExportDatabaseRanges::WriteFilterDescriptor(const uno::Reference & xSheetFilterDescriptor, const rtl::OUString sDatabaseRangeName) { - uno::Sequence aTableFilterFields(xSheetFilterDescriptor->getFilterFields()); + uno::Sequence< sheet::TableFilterField2 > aTableFilterFields( xSheetFilterDescriptor->getFilterFields2() ); sal_Int32 nTableFilterFields = aTableFilterFields.getLength(); if (nTableFilterFields > 0) { @@ -336,7 +349,7 @@ else { SvXMLElementExport aElemC(rExport, XML_NAMESPACE_TABLE, XML_FILTER_OR, sal_True, sal_True); - sheet::TableFilterField aPrevFilterField = aTableFilterFields[0]; + sheet::TableFilterField2 aPrevFilterField = aTableFilterFields[0]; sheet::FilterConnection aConnection = aTableFilterFields[1].Connection; sal_Bool bOpenAndElement; rtl::OUString aName = rExport.GetNamespaceMap().GetQNameByKey(XML_NAMESPACE_TABLE, GetXMLToken(XML_FILTER_AND)); @@ -632,11 +645,13 @@ if (::cppu::any2bool(xPropertySetDatabaseRange->getPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_UNONAME_STRIPDAT))))) rExport.AddAttribute(XML_NAMESPACE_TABLE, XML_HAS_PERSISTENT_DATA, XML_FALSE); } - uno::Reference xSheetFilterDescriptor(xDatabaseRange->getFilterDescriptor()); + + uno::Reference xSheetFilterDescriptor(xDatabaseRange->getFilterDescriptor()); + uno::Reference< sheet::XSheetFilterDescriptor2 > xSheetFilterDescriptor2( xSheetFilterDescriptor, uno::UNO_QUERY ); uno::Sequence aSortProperties(xDatabaseRange->getSortDescriptor()); - if (xSheetFilterDescriptor.is()) + if (xSheetFilterDescriptor2.is()) { - uno::Reference xFilterProperties (xSheetFilterDescriptor, uno::UNO_QUERY); + uno::Reference xFilterProperties (xSheetFilterDescriptor2, uno::UNO_QUERY); if (xFilterProperties.is()) { if (!::cppu::any2bool(xFilterProperties->getPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_UNONAME_CONTHDR))))) @@ -675,8 +690,8 @@ SvXMLElementExport aElemDR(rExport, XML_NAMESPACE_TABLE, XML_DATABASE_RANGE, sal_True, sal_True); rExport.CheckAttrList(); WriteImportDescriptor(xDatabaseRange->getImportDescriptor()); - if (xSheetFilterDescriptor.is()) - WriteFilterDescriptor(xSheetFilterDescriptor, sDatabaseRangeName); + if ( xSheetFilterDescriptor2.is() ) + WriteFilterDescriptor( xSheetFilterDescriptor2, sDatabaseRangeName ); WriteSortDescriptor(aSortProperties); WriteSubTotalDescriptor(xDatabaseRange->getSubTotalDescriptor(), sDatabaseRangeName); } diff -uNr old/sc/source/filter/xml/XMLExportDatabaseRanges.hxx new/sc/source/filter/xml/XMLExportDatabaseRanges.hxx --- old/sc/source/filter/xml/XMLExportDatabaseRanges.hxx 2009-03-12 18:02:56.359375000 +0800 +++ new/sc/source/filter/xml/XMLExportDatabaseRanges.hxx 2009-03-24 15:45:02.906250000 +0800 @@ -33,9 +33,9 @@ #include #include -#include -#include -#include +#include +#include +#include #include #include @@ -49,9 +49,9 @@ ScDocument* pDoc; void WriteImportDescriptor(const com::sun::star::uno::Sequence aImportDescriptor); - rtl::OUString getOperatorXML(const com::sun::star::sheet::FilterOperator aFilterOperator, const sal_Bool bUseRegularExpressions) const; - void WriteCondition(const com::sun::star::sheet::TableFilterField& aFilterField, sal_Bool bIsCaseSensitive, sal_Bool bUseRegularExpressions); - void WriteFilterDescriptor(const com::sun::star::uno::Reference & xSheetFilterDescriptor, const rtl::OUString sDatabaseRangeName); + rtl::OUString getOperatorXML(const long aFilterOperator, const sal_Bool bUseRegularExpressions) const; + void WriteCondition(const com::sun::star::sheet::TableFilterField2& aFilterField, sal_Bool bIsCaseSensitive, sal_Bool bUseRegularExpressions); + void WriteFilterDescriptor(const com::sun::star::uno::Reference & xSheetFilterDescriptor, const rtl::OUString sDatabaseRangeName); void WriteSortDescriptor(const com::sun::star::uno::Sequence aSortProperties); void WriteSubTotalDescriptor(const com::sun::star::uno::Reference xSubTotalDescriptor, const rtl::OUString sDatabaseRangeName); public: diff -uNr old/sc/source/filter/xml/xmldrani.cxx new/sc/source/filter/xml/xmldrani.cxx --- old/sc/source/filter/xml/xmldrani.cxx 2009-03-12 18:02:56.531250000 +0800 +++ new/sc/source/filter/xml/xmldrani.cxx 2009-03-24 15:32:44.187500000 +0800 @@ -60,6 +60,7 @@ #include #include #include +#include #include #include #include @@ -382,9 +383,10 @@ pDBData->SetSortParam(aSortParam); } uno::Reference xSheetFilterDescriptor(xDatabaseRange->getFilterDescriptor()); - if (xSheetFilterDescriptor.is()) + uno::Reference< sheet::XSheetFilterDescriptor2 > xSheetFilterDescriptor2( xSheetFilterDescriptor, uno::UNO_QUERY ); + if (xSheetFilterDescriptor2.is()) { - uno::Reference xFilterPropertySet (xSheetFilterDescriptor, uno::UNO_QUERY); + uno::Reference xFilterPropertySet (xSheetFilterDescriptor2, uno::UNO_QUERY); if (xFilterPropertySet.is()) { sal_Bool bOrientation(table::TableOrientation_COLUMNS == eOrientation); @@ -396,7 +398,8 @@ xFilterPropertySet->setPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_UNONAME_USEREGEX)), uno::makeAny(bFilterUseRegularExpressions)); xFilterPropertySet->setPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_UNONAME_OUTPOS)), uno::makeAny(aFilterOutputPosition)); } - xSheetFilterDescriptor->setFilterFields(aFilterFields); + if ( xSheetFilterDescriptor2.is() ) + xSheetFilterDescriptor2->setFilterFields2(aFilterFields); if (bFilterConditionSourceRange) { ScRange aAdvSource; diff -uNr old/sc/source/filter/xml/xmldrani.hxx new/sc/source/filter/xml/xmldrani.hxx --- old/sc/source/filter/xml/xmldrani.hxx 2009-03-12 18:02:56.328125000 +0800 +++ new/sc/source/filter/xml/xmldrani.hxx 2009-03-24 15:33:09.546875000 +0800 @@ -36,7 +36,7 @@ #include #include #include -#include +#include #include #include #include @@ -79,7 +79,7 @@ rtl::OUString sDatabaseName; rtl::OUString sSourceObject; com::sun::star::uno::Sequence aSortSequence; - com::sun::star::uno::Sequence aFilterFields; + com::sun::star::uno::Sequence aFilterFields; std::vector < ScSubTotalRule > aSubTotalRules; com::sun::star::table::CellAddress aFilterOutputPosition; com::sun::star::table::CellRangeAddress aFilterConditionSourceRangeAddress; @@ -146,7 +146,7 @@ void SetFilterIsCaseSensitive(const sal_Bool bTemp) { bFilterIsCaseSensitive = bTemp; } void SetFilterSkipDuplicates(const sal_Bool bTemp) { bFilterSkipDuplicates = bTemp; } void SetFilterUseRegularExpressions(const sal_Bool bTemp) { bFilterUseRegularExpressions = bTemp; } - void SetFilterFields(const com::sun::star::uno::Sequence & aTemp) { aFilterFields = aTemp; } + void SetFilterFields(const com::sun::star::uno::Sequence & aTemp) { aFilterFields = aTemp; } void SetFilterOutputPosition(const com::sun::star::table::CellAddress& aTemp) { aFilterOutputPosition = aTemp; } void SetFilterConditionSourceRangeAddress(const com::sun::star::table::CellRangeAddress& aTemp) { aFilterConditionSourceRangeAddress = aTemp; bFilterConditionSourceRange = sal_True; } diff -uNr old/sc/source/filter/xml/xmlfilti.cxx new/sc/source/filter/xml/xmlfilti.cxx --- old/sc/source/filter/xml/xmlfilti.cxx 2009-03-12 18:02:56.187500000 +0800 +++ new/sc/source/filter/xml/xmlfilti.cxx 2009-03-24 15:45:46.015625000 +0800 @@ -335,48 +335,60 @@ return new SvXMLImportContext( GetImport(), nPrefix, rLName ); } -void ScXMLConditionContext::getOperatorXML(const rtl::OUString sTempOperator, sheet::FilterOperator& aFilterOperator, sal_Bool& bUseRegularExpressions) const +void ScXMLConditionContext::getOperatorXML(const rtl::OUString sTempOperator, long& aFilterOperator, sal_Bool& bUseRegularExpressions) const { - bUseRegularExpressions = sal_False; - if (IsXMLToken(sTempOperator, XML_MATCH)) - { - bUseRegularExpressions = sal_True; - aFilterOperator = sheet::FilterOperator_EQUAL; - } - else if (IsXMLToken(sTempOperator, XML_NOMATCH)) - { - bUseRegularExpressions = sal_True; - aFilterOperator = sheet::FilterOperator_NOT_EQUAL; - } - else if (sTempOperator.compareToAscii("=") == 0) - aFilterOperator = sheet::FilterOperator_EQUAL; - else if (sTempOperator.compareToAscii("!=") == 0) - aFilterOperator = sheet::FilterOperator_NOT_EQUAL; - else if (IsXMLToken(sTempOperator, XML_BOTTOM_PERCENT)) - aFilterOperator = sheet::FilterOperator_BOTTOM_PERCENT; - else if (IsXMLToken(sTempOperator, XML_BOTTOM_VALUES)) - aFilterOperator = sheet::FilterOperator_BOTTOM_VALUES; - else if (IsXMLToken(sTempOperator, XML_EMPTY)) - aFilterOperator = sheet::FilterOperator_EMPTY; - else if (sTempOperator.compareToAscii(">") == 0) - aFilterOperator = sheet::FilterOperator_GREATER; - else if (sTempOperator.compareToAscii(">=") == 0) - aFilterOperator = sheet::FilterOperator_GREATER_EQUAL; - else if (sTempOperator.compareToAscii("<") == 0) - aFilterOperator = sheet::FilterOperator_LESS; - else if (sTempOperator.compareToAscii("<=") == 0) - aFilterOperator = sheet::FilterOperator_LESS_EQUAL; - else if (IsXMLToken(sTempOperator, XML_NOEMPTY)) - aFilterOperator = sheet::FilterOperator_NOT_EMPTY; - else if (IsXMLToken(sTempOperator, XML_TOP_PERCENT)) - aFilterOperator = sheet::FilterOperator_TOP_PERCENT; - else if (IsXMLToken(sTempOperator, XML_TOP_VALUES)) - aFilterOperator = sheet::FilterOperator_TOP_VALUES; + bUseRegularExpressions = sal_False; + if (IsXMLToken(sTempOperator, XML_MATCH)) + { + bUseRegularExpressions = sal_True; + aFilterOperator = sheet::FilterOperator2::EQUAL; + } + else if (IsXMLToken(sTempOperator, XML_NOMATCH)) + { + bUseRegularExpressions = sal_True; + aFilterOperator = sheet::FilterOperator2::NOT_EQUAL; + } + else if (sTempOperator.compareToAscii("=") == 0) + aFilterOperator = sheet::FilterOperator2::EQUAL; + else if (sTempOperator.compareToAscii("!=") == 0) + aFilterOperator = sheet::FilterOperator2::NOT_EQUAL; + else if (IsXMLToken(sTempOperator, XML_BOTTOM_PERCENT)) + aFilterOperator = sheet::FilterOperator2::BOTTOM_PERCENT; + else if (IsXMLToken(sTempOperator, XML_BOTTOM_VALUES)) + aFilterOperator = sheet::FilterOperator2::BOTTOM_VALUES; + else if (IsXMLToken(sTempOperator, XML_EMPTY)) + aFilterOperator = sheet::FilterOperator2::EMPTY; + else if (sTempOperator.compareToAscii(">") == 0) + aFilterOperator = sheet::FilterOperator2::GREATER; + else if (sTempOperator.compareToAscii(">=") == 0) + aFilterOperator = sheet::FilterOperator2::GREATER_EQUAL; + else if (sTempOperator.compareToAscii("<") == 0) + aFilterOperator = sheet::FilterOperator2::LESS; + else if (sTempOperator.compareToAscii("<=") == 0) + aFilterOperator = sheet::FilterOperator2::LESS_EQUAL; + else if (IsXMLToken(sTempOperator, XML_NOEMPTY)) + aFilterOperator = sheet::FilterOperator2::NOT_EMPTY; + else if (IsXMLToken(sTempOperator, XML_TOP_PERCENT)) + aFilterOperator = sheet::FilterOperator2::TOP_PERCENT; + else if (IsXMLToken(sTempOperator, XML_TOP_VALUES)) + aFilterOperator = sheet::FilterOperator2::TOP_VALUES; + else if (IsXMLToken(sTempOperator, XML_CONTAINS)) + aFilterOperator = sheet::FilterOperator2::CONTAINS; + else if (IsXMLToken(sTempOperator, XML_DOES_NOT_CONTAIN)) + aFilterOperator = sheet::FilterOperator2::DOES_NOT_CONTAIN; + else if (IsXMLToken(sTempOperator, XML_BEGINS_WITH)) + aFilterOperator = sheet::FilterOperator2::BEGINS_WITH; + else if (IsXMLToken(sTempOperator, XML_DOES_NOT_BEGIN_WITH)) + aFilterOperator = sheet::FilterOperator2::DOES_NOT_BEGIN_WITH; + else if (IsXMLToken(sTempOperator, XML_ENDS_WITH)) + aFilterOperator = sheet::FilterOperator2::ENDS_WITH; + else if (IsXMLToken(sTempOperator, XML_DOES_NOT_END_WITH)) + aFilterOperator = sheet::FilterOperator2::DOES_NOT_END_WITH; } void ScXMLConditionContext::EndElement() { - sheet::TableFilterField aFilterField; + sheet::TableFilterField2 aFilterField; if (pFilterContext->GetConnection()) aFilterField.Connection = sheet::FilterConnection_OR; else diff -uNr old/sc/source/filter/xml/xmlfilti.hxx new/sc/source/filter/xml/xmlfilti.hxx --- old/sc/source/filter/xml/xmlfilti.hxx 2009-03-12 18:02:56.453125000 +0800 +++ new/sc/source/filter/xml/xmlfilti.hxx 2009-03-24 15:46:16.718750000 +0800 @@ -36,7 +36,8 @@ #include #include #include -#include +#include +#include #include #include "xmldrani.hxx" @@ -48,7 +49,7 @@ { ScXMLDatabaseRangeContext* pDatabaseRangeContext; - com::sun::star::uno::Sequence aFilterFields; + com::sun::star::uno::Sequence aFilterFields; com::sun::star::table::CellAddress aOutputPosition; com::sun::star::table::CellRangeAddress aConditionSourceRangeAddress; sal_Int16 nUserListIndex; @@ -89,8 +90,8 @@ aConnectionOrStack.Push(pTemp);} void CloseConnection() { sal_Bool* pTemp = static_cast (aConnectionOrStack.Pop()); bConnectionOr = *pTemp; bNextConnectionOr = *pTemp; delete pTemp;} sal_Bool GetConnection() { sal_Bool bTemp = bConnectionOr; bConnectionOr = bNextConnectionOr; return bTemp; } - void AddFilterField (const com::sun::star::sheet::TableFilterField aFilterField) { aFilterFields.realloc(aFilterFields.getLength() + 1); - aFilterFields[aFilterFields.getLength() - 1] = aFilterField; } + void AddFilterField(const com::sun::star::sheet::TableFilterField2 aFilterField) { aFilterFields.realloc(aFilterFields.getLength() + 1); + aFilterFields[aFilterFields.getLength() - 1] = aFilterField; } }; class ScXMLAndContext : public SvXMLImportContext @@ -171,7 +172,7 @@ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList>& xAttrList ); - void getOperatorXML(const rtl::OUString sTempOperator, com::sun::star::sheet::FilterOperator& aFilterOperator, sal_Bool& bUseRegularExpressions) const; + void getOperatorXML(const rtl::OUString sTempOperator, long& aFilterOperator, sal_Bool& bUseRegularExpressions) const; virtual void EndElement(); }; diff -uNr old/sc/source/ui/dbgui/filtdlg.cxx new/sc/source/ui/dbgui/filtdlg.cxx --- old/sc/source/ui/dbgui/filtdlg.cxx 2009-03-12 18:04:46.312500000 +0800 +++ new/sc/source/ui/dbgui/filtdlg.cxx 2009-03-24 15:46:33.281250000 +0800 @@ -90,6 +90,7 @@ aFtField ( this, ScResId( FT_FIELD ) ), aFtCond ( this, ScResId( FT_COND ) ), aFtVal ( this, ScResId( FT_VAL ) ), + aFlSeparator ( this, ScResId( FL_SEPARATOR ) ), _INIT_COMMON_FILTER_RSCOBJS aStrEmpty ( ScResId( SCSTR_EMPTY ) ), aStrNotEmpty ( ScResId( SCSTR_NOTEMPTY ) ), @@ -111,6 +112,8 @@ for (USHORT i=0; i<=MAXCOL; i++) pEntryLists[i] = NULL; + aBtnMore.SetMoreText( String(ScResId( SCSTR_MOREBTN_MOREOPTIONS )) ); + aBtnMore.SetLessText( String(ScResId( SCSTR_MOREBTN_LESSOPTIONS )) ); Init( rArgSet ); FreeResource(); diff -uNr old/sc/source/ui/inc/filtdlg.hxx new/sc/source/ui/inc/filtdlg.hxx --- old/sc/source/ui/inc/filtdlg.hxx 2009-03-12 18:05:42.312500000 +0800 +++ new/sc/source/ui/inc/filtdlg.hxx 2009-03-25 09:51:32.234375000 +0800 @@ -138,6 +138,7 @@ FixedText aFtField; FixedText aFtCond; FixedText aFtVal; + FixedLine aFlSeparator; _COMMON_FILTER_RSCOBJS diff -uNr old/sc/source/ui/inc/filter.hrc new/sc/source/ui/inc/filter.hrc --- old/sc/source/ui/inc/filter.hrc 2009-03-12 18:05:42.343750000 +0800 +++ new/sc/source/ui/inc/filter.hrc 2009-03-24 15:47:38.359375000 +0800 @@ -68,6 +68,7 @@ #define ED_VAL2 33 #define ED_VAL3 34 #define FL_CRITERIA 35 +#define FL_SEPARATOR 36 // Spezialfilter diff -uNr old/sc/source/ui/src/filter.src new/sc/source/ui/src/filter.src --- old/sc/source/ui/src/filter.src 2009-03-12 18:04:37.343750000 +0800 +++ new/sc/source/ui/src/filter.src 2009-03-24 15:49:09.000000000 +0800 @@ -34,7 +34,7 @@ HelpId = SID_FILTER ; Hide = TRUE ; SVLook = TRUE ; - Size = MAP_APPFONT ( 298 , 83 ) ; + Size = MAP_APPFONT ( 267 , 105 ) ; Text [ en-US ] = "Standard Filter" ; Moveable = TRUE ; Closeable = FALSE ; @@ -53,12 +53,12 @@ FixedText FT_COND { Pos = MAP_APPFONT ( 122 , 14 ) ; - Size = MAP_APPFONT ( 47 , 8 ) ; + Size = MAP_APPFONT ( 75 , 8 ) ; Text [ en-US ] = "Condition" ; }; FixedText FT_VAL { - Pos = MAP_APPFONT ( 173 , 14 ) ; + Pos = MAP_APPFONT ( 201 , 14 ) ; Size = MAP_APPFONT ( 60 , 8 ) ; Text [ en-US ] = "Value" ; }; @@ -116,7 +116,7 @@ { Border = TRUE ; Pos = MAP_APPFONT ( 122 , 25 ) ; - Size = MAP_APPFONT ( 47 , 105 ) ; + Size = MAP_APPFONT ( 75 , 145 ) ; TabStop = TRUE ; DropDown = TRUE ; stringlist [ en-US ] = @@ -131,13 +131,19 @@ < "Smallest" ; Default ; > ; < "Largest %" ; Default ; > ; < "Smallest %" ; Default ; > ; + < "Contains" ; Default ; > ; + < "Does not contain" ; Default ; > ; + < "Begins with" ; Default ; > ; + < "Does not begin with" ; Default ; > ; + < "Ends with" ; Default ; > ; + < "Does not end with" ; Default ; > ; }; }; ListBox LB_COND2 { Border = TRUE ; Pos = MAP_APPFONT ( 122 , 41 ) ; - Size = MAP_APPFONT ( 47 , 105 ) ; + Size = MAP_APPFONT ( 75 , 145 ) ; TabStop = TRUE ; DropDown = TRUE ; stringlist [ en-US ] = @@ -152,13 +158,19 @@ < "Smallest" ; Default ; > ; < "Largest %" ; Default ; > ; < "Smallest %" ; Default ; > ; + < "Contains" ; Default ; > ; + < "Does not contain" ; Default ; > ; + < "Begins with" ; Default ; > ; + < "Does not begin with" ; Default ; > ; + < "Ends with" ; Default ; > ; + < "Does not end with" ; Default ; > ; }; }; ListBox LB_COND3 { Border = TRUE ; Pos = MAP_APPFONT ( 122 , 57 ) ; - Size = MAP_APPFONT ( 47 , 105 ) ; + Size = MAP_APPFONT ( 75 , 145 ) ; TabStop = TRUE ; DropDown = TRUE ; stringlist [ en-US ] = @@ -173,25 +185,31 @@ < "Smallest" ; Default ; > ; < "Largest %" ; Default ; > ; < "Smallest %" ; Default ; > ; + < "Contains" ; Default ; > ; + < "Does not contain" ; Default ; > ; + < "Begins with" ; Default ; > ; + < "Does not begin with" ; Default ; > ; + < "Ends with" ; Default ; > ; + < "Does not end with" ; Default ; > ; }; }; ComboBox ED_VAL1 { - Pos = MAP_APPFONT ( 173 , 25 ) ; + Pos = MAP_APPFONT ( 201 , 25 ) ; Size = MAP_APPFONT ( 60 , 90 ) ; TabStop = TRUE ; DropDown = TRUE ; }; ComboBox ED_VAL2 { - Pos = MAP_APPFONT ( 173 , 41 ) ; + Pos = MAP_APPFONT ( 201 , 41 ) ; Size = MAP_APPFONT ( 60 , 90 ) ; TabStop = TRUE ; DropDown = TRUE ; }; ComboBox ED_VAL3 { - Pos = MAP_APPFONT ( 173 , 57 ) ; + Pos = MAP_APPFONT ( 201 , 57 ) ; Size = MAP_APPFONT ( 60 , 90 ) ; TabStop = TRUE ; DropDown = TRUE ; @@ -199,13 +217,13 @@ FixedLine FL_CRITERIA { Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 230 , 8 ) ; + Size = MAP_APPFONT ( 258 , 8 ) ; Text [ en-US ] = "Filter criteria"; }; CheckBox BTN_CASE { Hide = TRUE ; - Pos = MAP_APPFONT ( 12 , 86 ) ; + Pos = MAP_APPFONT ( 12 , 116 ) ; Size = MAP_APPFONT ( 128 , 10 ) ; TabStop = TRUE ; Text [ en-US ] = "Case ~sensitive" ; @@ -213,7 +231,7 @@ CheckBox BTN_REGEXP { Hide = TRUE ; - Pos = MAP_APPFONT ( 142 , 86 ) ; + Pos = MAP_APPFONT ( 142 , 116 ) ; Size = MAP_APPFONT ( 94 , 10 ) ; TabStop = TRUE ; Text [ en-US ] = "Regular ~expression" ; @@ -221,7 +239,7 @@ CheckBox BTN_HEADER { Hide = TRUE ; - Pos = MAP_APPFONT ( 12 , 100 ) ; + Pos = MAP_APPFONT ( 12 , 130 ) ; Size = MAP_APPFONT ( 128 , 10 ) ; TabStop = TRUE ; Text [ en-US ] = "Range contains ~column labels" ; @@ -229,7 +247,7 @@ CheckBox BTN_UNIQUE { Hide = TRUE ; - Pos = MAP_APPFONT ( 142 , 100 ) ; + Pos = MAP_APPFONT ( 142 , 130 ) ; Size = MAP_APPFONT ( 94 , 10 ) ; TabStop = TRUE ; Text [ en-US ] = "~No duplication" ; @@ -237,7 +255,7 @@ CheckBox BTN_COPY_RESULT { Hide = TRUE ; - Pos = MAP_APPFONT ( 12 , 114 ) ; + Pos = MAP_APPFONT ( 12 , 144 ) ; Size = MAP_APPFONT ( 128 , 10 ) ; TabStop = TRUE ; Text [ en-US ] = "Copy ~results to..." ; @@ -245,7 +263,7 @@ CheckBox BTN_DEST_PERS { Hide = TRUE ; - Pos = MAP_APPFONT ( 142 , 114 ) ; + Pos = MAP_APPFONT ( 142 , 144 ) ; Size = MAP_APPFONT ( 94 , 10 ) ; TabStop = TRUE ; Text [ en-US ] = "~Keep filter criteria" ; @@ -254,8 +272,8 @@ { Border = TRUE ; Hide = TRUE ; - Pos = MAP_APPFONT ( 21 , 126 ) ; - Size = MAP_APPFONT ( 90 , 90 ) ; + Pos = MAP_APPFONT ( 21 , 156 ) ; + Size = MAP_APPFONT ( 110 , 90 ) ; TabStop = TRUE ; DropDown = TRUE ; }; @@ -263,13 +281,13 @@ { Border = TRUE ; Hide = TRUE ; - Pos = MAP_APPFONT ( 115 , 126 ) ; - Size = MAP_APPFONT ( 104 , 12 ) ; + Pos = MAP_APPFONT ( 136 , 156 ) ; + Size = MAP_APPFONT ( 110 , 12 ) ; TabStop = TRUE ; }; ImageButton RB_COPY_AREA { - Pos = MAP_APPFONT ( 221 , 125 ) ; + Pos = MAP_APPFONT ( 248 , 155 ) ; Size = MAP_APPFONT ( 13 , 15 ) ; TabStop = FALSE ; QuickHelpText [ en-US ] = "Shrink" ; @@ -277,14 +295,14 @@ FixedLine FL_OPTIONS { Hide = TRUE ; - Pos = MAP_APPFONT ( 6 , 75 ) ; - Size = MAP_APPFONT ( 230 , 8 ) ; + Pos = MAP_APPFONT ( 6 , 104 ) ; + Size = MAP_APPFONT ( 258 , 8 ) ; Text [ en-US ] = "Options" ; }; FixedText FT_DBAREA { Hide = TRUE ; - Pos = MAP_APPFONT ( 66 , 144 ) ; + Pos = MAP_APPFONT ( 66 , 174 ) ; Size = MAP_APPFONT ( 167 , 8 ) ; Left = TRUE ; Text [ en-US ] = "dummy" ; @@ -292,36 +310,41 @@ FixedText FT_DBAREA_LABEL { Hide = TRUE ; - Pos = MAP_APPFONT ( 6 , 144 ) ; + Pos = MAP_APPFONT ( 6 , 174 ) ; Size = MAP_APPFONT ( 58 , 8 ) ; Text [ en-US ] = "Data range:" ; }; OKButton BTN_OK { - Pos = MAP_APPFONT ( 242 , 6 ) ; + Pos = MAP_APPFONT ( 103 , 85 ) ; Size = MAP_APPFONT ( 50 , 14 ) ; TabStop = TRUE ; DefButton = TRUE ; }; CancelButton BTN_CANCEL { - Pos = MAP_APPFONT ( 242 , 23 ) ; + Pos = MAP_APPFONT ( 157 , 85 ) ; Size = MAP_APPFONT ( 50 , 14 ) ; TabStop = TRUE ; }; HelpButton BTN_HELP { - Pos = MAP_APPFONT ( 242 , 43 ) ; + Pos = MAP_APPFONT ( 211 , 85 ) ; Size = MAP_APPFONT ( 50 , 14 ) ; TabStop = TRUE ; }; MoreButton BTN_MORE { - Pos = MAP_APPFONT ( 242 , 63 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; + Pos = MAP_APPFONT ( 6 , 85 ) ; + Size = MAP_APPFONT ( 55 , 14 ) ; TabStop = TRUE ; MapUnit = MAP_APPFONT ; - Delta = 75 ; + Delta = 81 ; + }; + FixedLine FL_SEPARATOR + { + Pos = MAP_APPFONT ( 0 , 75 ) ; + Size = MAP_APPFONT ( 267 , 6 ) ; }; }; //============================================================================ diff -uNr old/sc/source/ui/src/scstring.src new/sc/source/ui/src/scstring.src --- old/sc/source/ui/src/scstring.src 2009-03-12 18:04:37.234375000 +0800 +++ new/sc/source/ui/src/scstring.src 2009-03-24 15:49:25.359375000 +0800 @@ -728,3 +728,13 @@ Text [ en-US ] = "Mouse button pressed"; }; +String SCSTR_MOREBTN_MOREOPTIONS +{ + Text [ en-US ] = "More ~Options"; +}; + +String SCSTR_MOREBTN_LESSOPTIONS +{ + Text [ en-US ] = "Less ~Options"; +}; + diff -uNr old/sc/source/ui/unoobj/cellsuno.cxx new/sc/source/ui/unoobj/cellsuno.cxx --- old/sc/source/ui/unoobj/cellsuno.cxx 2009-03-12 18:04:52.718750000 +0800 +++ new/sc/source/ui/unoobj/cellsuno.cxx 2009-03-24 15:49:34.265625000 +0800 @@ -5702,7 +5702,15 @@ ScDocShell* pDocSh = GetDocShell(); ScFilterDescriptor aImpl(pDocSh); - aImpl.setFilterFields( xDescriptor->getFilterFields() ); + uno::Reference< sheet::XSheetFilterDescriptor2 > xDescriptor2( xDescriptor, uno::UNO_QUERY ); + if ( xDescriptor2.is() ) + { + aImpl.setFilterFields2( xDescriptor2->getFilterFields2() ); + } + else + { + aImpl.setFilterFields( xDescriptor->getFilterFields() ); + } // Rest sind jetzt Properties... uno::Reference xPropSet( xDescriptor, uno::UNO_QUERY ); diff -uNr old/sc/source/ui/unoobj/datauno.cxx new/sc/source/ui/unoobj/datauno.cxx --- old/sc/source/ui/unoobj/datauno.cxx 2009-03-12 18:04:52.750000000 +0800 +++ new/sc/source/ui/unoobj/datauno.cxx 2009-03-24 15:50:08.531250000 +0800 @@ -45,6 +45,8 @@ #include #include #include +#include +#include #include "datauno.hxx" #include "dapiuno.hxx" @@ -1106,7 +1108,7 @@ } } -// XSheetFilterDescriptor +// XSheetFilterDescriptor and XSheetFilterDescriptor2 uno::Sequence SAL_CALL ScFilterDescriptorBase::getFilterFields() throw(uno::RuntimeException) @@ -1177,6 +1179,80 @@ return aSeq; } +uno::Sequence SAL_CALL ScFilterDescriptorBase::getFilterFields2() +throw(uno::RuntimeException) +{ + ScUnoGuard aGuard; + ScQueryParam aParam; + GetData(aParam); + + SCSIZE nEntries = aParam.GetEntryCount(); // allozierte Eintraege im Param + SCSIZE nCount = 0; // aktive + while ( nCount < nEntries && + aParam.GetEntry(nCount).bDoQuery ) + ++nCount; + + sheet::TableFilterField2 aField; + uno::Sequence aSeq(static_cast(nCount)); + sheet::TableFilterField2* pAry = aSeq.getArray(); + for (SCSIZE i=0; i& aFilterFields ) throw(uno::RuntimeException) @@ -1251,6 +1327,86 @@ PutData(aParam); } +void SAL_CALL ScFilterDescriptorBase::setFilterFields2( + const uno::Sequence& aFilterFields ) + throw(uno::RuntimeException) +{ + ScUnoGuard aGuard; + ScQueryParam aParam; + GetData(aParam); + + SCSIZE nCount = static_cast(aFilterFields.getLength()); + DBG_ASSERT( nCount <= MAXQUERY, "setFilterFields: zu viele" ); + + aParam.Resize( nCount ); + + const sheet::TableFilterField2* pAry = aFilterFields.getConstArray(); + SCSIZE i; + for (i=0; iGetDocument()->GetFormatTable()->GetInputLineString(rEntry.nVal, 0, *rEntry.pStr); + } + + switch (pAry[i].Operator) // FilterOperator + { + case sheet::FilterOperator2::EQUAL: rEntry.eOp = SC_EQUAL; break; + case sheet::FilterOperator2::LESS: rEntry.eOp = SC_LESS; break; + case sheet::FilterOperator2::GREATER: rEntry.eOp = SC_GREATER; break; + case sheet::FilterOperator2::LESS_EQUAL: rEntry.eOp = SC_LESS_EQUAL; break; + case sheet::FilterOperator2::GREATER_EQUAL: rEntry.eOp = SC_GREATER_EQUAL; break; + case sheet::FilterOperator2::NOT_EQUAL: rEntry.eOp = SC_NOT_EQUAL; break; + case sheet::FilterOperator2::TOP_VALUES: rEntry.eOp = SC_TOPVAL; break; + case sheet::FilterOperator2::BOTTOM_VALUES: rEntry.eOp = SC_BOTVAL; break; + case sheet::FilterOperator2::TOP_PERCENT: rEntry.eOp = SC_TOPPERC; break; + case sheet::FilterOperator2::BOTTOM_PERCENT: rEntry.eOp = SC_BOTPERC; break; + case sheet::FilterOperator2::CONTAINS: rEntry.eOp = SC_CONTAINS; break; + case sheet::FilterOperator2::DOES_NOT_CONTAIN: rEntry.eOp = SC_DOES_NOT_CONTAIN; break; + case sheet::FilterOperator2::BEGINS_WITH: rEntry.eOp = SC_BEGINS_WITH; break; + case sheet::FilterOperator2::DOES_NOT_BEGIN_WITH: rEntry.eOp = SC_DOES_NOT_BEGIN_WITH;break; + case sheet::FilterOperator2::ENDS_WITH: rEntry.eOp = SC_ENDS_WITH; break; + case sheet::FilterOperator2::DOES_NOT_END_WITH: rEntry.eOp = SC_DOES_NOT_END_WITH; break; + case sheet::FilterOperator2::EMPTY: + { + rEntry.eOp = SC_EQUAL; + rEntry.nVal = SC_EMPTYFIELDS; + rEntry.bQueryByString = FALSE; + *rEntry.pStr = EMPTY_STRING; + } + break; + case sheet::FilterOperator2::NOT_EMPTY: + { + rEntry.eOp = SC_EQUAL; + rEntry.nVal = SC_NONEMPTYFIELDS; + rEntry.bQueryByString = FALSE; + *rEntry.pStr = EMPTY_STRING; + } + break; + default: + DBG_ERROR("Falscher Query-enum"); + rEntry.eOp = SC_EQUAL; + } + } + + SCSIZE nParamCount = aParam.GetEntryCount(); // Param wird nicht unter 8 resized + for (i=nCount; i #include #include +#include #include +#include +#include +#include #include #include #include @@ -4027,7 +4031,7 @@ } // Modifies sCriteria, and nOp depending on the value of sCriteria -void lcl_setTableFieldsFromCriteria( rtl::OUString& sCriteria1, uno::Reference< beans::XPropertySet >& xDescProps, sheet::TableFilterField& rFilterField ) +void lcl_setTableFieldsFromCriteria( rtl::OUString& sCriteria1, uno::Reference< beans::XPropertySet >& xDescProps, sheet::TableFilterField2& rFilterField ) { // #TODO make this more efficient and cycle through // sCriteria1 character by character to pick up <,<>,=, * etc. @@ -4047,10 +4051,10 @@ if ( ( nPos = sCriteria1.indexOf( EQUALS ) ) == 0 ) { if ( sCriteria1.getLength() == EQUALS.getLength() ) - rFilterField.Operator = sheet::FilterOperator_EMPTY; + rFilterField.Operator = sheet::FilterOperator2::EMPTY; else { - rFilterField.Operator = sheet::FilterOperator_EQUAL; + rFilterField.Operator = sheet::FilterOperator2::EQUAL; sCriteria1 = sCriteria1.copy( EQUALS.getLength() ); sCriteria1 = VBAToRegexp( sCriteria1 ); // UseRegularExpressions @@ -4062,10 +4066,10 @@ else if ( ( nPos = sCriteria1.indexOf( NOTEQUALS ) ) == 0 ) { if ( sCriteria1.getLength() == NOTEQUALS.getLength() ) - rFilterField.Operator = sheet::FilterOperator_NOT_EMPTY; + rFilterField.Operator = sheet::FilterOperator2::NOT_EMPTY; else { - rFilterField.Operator = sheet::FilterOperator_NOT_EQUAL; + rFilterField.Operator = sheet::FilterOperator2::NOT_EQUAL; sCriteria1 = sCriteria1.copy( NOTEQUALS.getLength() ); sCriteria1 = VBAToRegexp( sCriteria1 ); // UseRegularExpressions @@ -4079,12 +4083,12 @@ if ( ( nPos = sCriteria1.indexOf( GREATERTHANEQUALS ) ) == 0 ) { sCriteria1 = sCriteria1.copy( GREATERTHANEQUALS.getLength() ); - rFilterField.Operator = sheet::FilterOperator_GREATER_EQUAL; + rFilterField.Operator = sheet::FilterOperator2::GREATER_EQUAL; } else { sCriteria1 = sCriteria1.copy( GREATERTHAN.getLength() ); - rFilterField.Operator = sheet::FilterOperator_GREATER; + rFilterField.Operator = sheet::FilterOperator2::GREATER; } } @@ -4094,17 +4098,17 @@ if ( ( nPos = sCriteria1.indexOf( LESSTHANEQUALS ) ) == 0 ) { sCriteria1 = sCriteria1.copy( LESSTHANEQUALS.getLength() ); - rFilterField.Operator = sheet::FilterOperator_LESS_EQUAL; + rFilterField.Operator = sheet::FilterOperator2::LESS_EQUAL; } else { sCriteria1 = sCriteria1.copy( LESSTHAN.getLength() ); - rFilterField.Operator = sheet::FilterOperator_LESS; + rFilterField.Operator = sheet::FilterOperator2::LESS; } } else - rFilterField.Operator = sheet::FilterOperator_EQUAL; + rFilterField.Operator = sheet::FilterOperator2::EQUAL; if ( bIsNumeric ) { @@ -4213,13 +4217,16 @@ bool bAll = false;; if ( ( Field >>= nField ) ) { - uno::Sequence< sheet::TableFilterField > sTabFilts; - uno::Reference< sheet::XSheetFilterDescriptor > xDesc = xDataBaseRange->getFilterDescriptor(); - uno::Reference< beans::XPropertySet > xDescProps( xDesc, uno::UNO_QUERY_THROW ); + uno::Reference< sheet::XSheetFilterDescriptor > xDesc = xDataBaseRange->getFilterDescriptor(); + uno::Reference< sheet::XSheetFilterDescriptor2 > xDesc2( xDesc, uno::UNO_QUERY ); + if ( xDesc2.is() ) + { + uno::Sequence< sheet::TableFilterField2 > sTabFilts; + uno::Reference< beans::XPropertySet > xDescProps( xDesc2, uno::UNO_QUERY_THROW ); if ( Criteria1.hasValue() ) { sTabFilts.realloc( 1 ); - sTabFilts[0].Operator = sheet::FilterOperator_EQUAL;// sensible default + sTabFilts[0].Operator = sheet::FilterOperator2::EQUAL;// sensible default if ( !bCritHasNumericValue ) { Criteria1 >>= sCriteria1; @@ -4252,16 +4259,16 @@ switch ( nOperator ) { case excel::XlAutoFilterOperator::xlBottom10Items: - sTabFilts[0].Operator = sheet::FilterOperator_BOTTOM_VALUES; + sTabFilts[0].Operator = sheet::FilterOperator2::BOTTOM_VALUES; break; case excel::XlAutoFilterOperator::xlBottom10Percent: - sTabFilts[0].Operator = sheet::FilterOperator_BOTTOM_PERCENT; + sTabFilts[0].Operator = sheet::FilterOperator2::BOTTOM_PERCENT; break; case excel::XlAutoFilterOperator::xlTop10Items: - sTabFilts[0].Operator = sheet::FilterOperator_TOP_VALUES; + sTabFilts[0].Operator = sheet::FilterOperator2::TOP_VALUES; break; case excel::XlAutoFilterOperator::xlTop10Percent: - sTabFilts[0].Operator = sheet::FilterOperator_TOP_PERCENT; + sTabFilts[0].Operator = sheet::FilterOperator2::TOP_PERCENT; break; case excel::XlAutoFilterOperator::xlOr: nConn = sheet::FilterConnection_OR; @@ -4300,12 +4307,12 @@ { Criteria2 >>= sTabFilts[1].NumericValue; sTabFilts[1].IsNumeric = sal_True; - sTabFilts[1].Operator = sheet::FilterOperator_EQUAL; + sTabFilts[1].Operator = sheet::FilterOperator2::EQUAL; } } } - xDesc->setFilterFields( sTabFilts ); + xDesc2->setFilterFields2( sTabFilts ); if ( !bAll ) { xDataBaseRange->refresh(); @@ -4313,6 +4320,7 @@ else // was 0 based now seems to be 1 lcl_SetAllQueryForField( pShell, nField, nSheet ); + } } else { @@ -4333,7 +4341,10 @@ lcl_SetAllQueryForField( pShell, rEntry.nField, nSheet ); } // remove exising filters - xDataBaseRange->getFilterDescriptor()->setFilterFields( uno::Sequence< sheet::TableFilterField >() ); + uno::Reference xSheetFilterDescriptor( xDataBaseRange->getFilterDescriptor() ); + uno::Reference< sheet::XSheetFilterDescriptor2 > xSheetFilterDescriptor2( xSheetFilterDescriptor, uno::UNO_QUERY ); + if( xSheetFilterDescriptor2.is() ) + xSheetFilterDescriptor2->setFilterFields2( uno::Sequence< sheet::TableFilterField2 >() ); } xDBRangeProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("AutoFilter") ), uno::Any(!bHasAuto) ); diff -uNr old/xmloff/inc/xmlkywd.hxx new/xmloff/inc/xmlkywd.hxx --- old/xmloff/inc/xmlkywd.hxx 2009-03-12 17:22:34.281250000 +0800 +++ new/xmloff/inc/xmlkywd.hxx 2009-03-24 15:30:08.312500000 +0800 @@ -1991,4 +1991,11 @@ XML_CONSTASCII_ACTION( sXML_page_continuation, "page-continuation" ); +XML_CONSTASCII_ACTION( sXML_contains, "contains" ); +XML_CONSTASCII_ACTION( sXML_does_not_contain, "does-not-contain" ); +XML_CONSTASCII_ACTION( sXML_begins_with, "begins-with" ); +XML_CONSTASCII_ACTION( sXML_does_not_begin_with, "does-not-begin-with" ); +XML_CONSTASCII_ACTION( sXML_ends_with, "ends-with" ); +XML_CONSTASCII_ACTION( sXML_does_not_end_with, "does-not-end-with" ); + #endif diff -uNr old/xmloff/inc/xmloff/xmltoken.hxx new/xmloff/inc/xmloff/xmltoken.hxx --- old/xmloff/inc/xmloff/xmltoken.hxx 2009-03-12 17:22:30.875000000 +0800 +++ new/xmloff/inc/xmloff/xmltoken.hxx 2009-03-24 15:29:56.000000000 +0800 @@ -2975,7 +2975,13 @@ XML_AVOID_OVERLAP, XML_NEAR_ORIGIN, XML_DEPENDENCY, - XML_NAV_ORDER, + XML_NAV_ORDER, + XML_CONTAINS, + XML_DOES_NOT_CONTAIN, + XML_BEGINS_WITH, + XML_DOES_NOT_BEGIN_WITH, + XML_ENDS_WITH, + XML_DOES_NOT_END_WITH, XML_USE_FIRST_ROW_STYLES, XML_USE_LAST_ROW_STYLES, diff -uNr old/xmloff/source/core/xmltoken.cxx new/xmloff/source/core/xmltoken.cxx --- old/xmloff/source/core/xmltoken.cxx 2009-03-12 17:22:16.859375000 +0800 +++ new/xmloff/source/core/xmltoken.cxx 2009-03-24 15:30:21.234375000 +0800 @@ -2976,6 +2976,12 @@ TOKEN( "near-origin", XML_NEAR_ORIGIN ), TOKEN( "dependency", XML_DEPENDENCY ), TOKEN( "nav-order", XML_NAV_ORDER ), + TOKEN( "contains", XML_CONTAINS ), + TOKEN( "does-not-contain", XML_DOES_NOT_CONTAIN ), + TOKEN( "begins-with", XML_BEGINS_WITH ), + TOKEN( "does-not-begin-with", XML_DOES_NOT_BEGIN_WITH ), + TOKEN( "ends-with", XML_ENDS_WITH ), + TOKEN( "does-not-end-with", XML_DOES_NOT_END_WITH ), TOKEN( "use-first-row-styles", XML_USE_FIRST_ROW_STYLES ), TOKEN( "use-last-row-styles", XML_USE_LAST_ROW_STYLES ),