diff -cNr i35579old/offapi/com/sun/star/sheet/FilterOperator2.idl i35579new/offapi/com/sun/star/sheet/FilterOperator2.idl *** i35579old/offapi/com/sun/star/sheet/FilterOperator2.idl Thu Jan 1 08:00:00 1970 --- i35579new/offapi/com/sun/star/sheet/FilterOperator2.idl Tue Apr 8 16:50:36 2008 *************** *** 0 **** --- 1,169 ---- + /************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: FilterOperator.idl,v $ + * + * $Revision: 1.6 $ + * + * last change: $Author: rt $ $Date: 2005/09/08 04:39:51 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + + #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 -cNr i35579old/offapi/com/sun/star/sheet/TableFilterField2.idl i35579new/offapi/com/sun/star/sheet/TableFilterField2.idl *** i35579old/offapi/com/sun/star/sheet/TableFilterField2.idl Thu Jan 1 08:00:00 1970 --- i35579new/offapi/com/sun/star/sheet/TableFilterField2.idl Tue Apr 8 16:53:06 2008 *************** *** 0 **** --- 1,108 ---- + /************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: TableFilterField.idl,v $ + * + * $Revision: 1.6 $ + * + * last change: $Author: rt $ $Date: 2005/09/08 04:58:16 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + + #ifndef __com_sun_star_sheet_TableFilterField2_idl__ + #define __com_sun_star_sheet_TableFilterField2_idl__ + + + #ifndef __com_sun_star_sheet_FilterConnection_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. + */ + 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 -cNr i35579old/offapi/com/sun/star/sheet/XSheetFilterDescriptor2.idl i35579new/offapi/com/sun/star/sheet/XSheetFilterDescriptor2.idl *** i35579old/offapi/com/sun/star/sheet/XSheetFilterDescriptor2.idl Thu Jan 1 08:00:00 1970 --- i35579new/offapi/com/sun/star/sheet/XSheetFilterDescriptor2.idl Tue Apr 8 16:55:06 2008 *************** *** 0 **** --- 1,85 ---- + /************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: XSheetFilterDescriptor.idl,v $ + * + * $Revision: 1.8 $ + * + * last change: $Author: rt $ $Date: 2005/09/08 05:19:41 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + + #ifndef __com_sun_star_sheet_XSheetFilterDescriptor2_idl__ + #define __com_sun_star_sheet_XSheetFilterDescriptor2_idl__ + + #ifndef __com_sun_star_uno_XInterface_idl__ + #include + #endif + + #ifndef __com_sun_star_sheet_TableFilterField2_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 -cNr i35579old/offapi/com/sun/star/sheet/makefile.mk i35579new/offapi/com/sun/star/sheet/makefile.mk *** i35579old/offapi/com/sun/star/sheet/makefile.mk Tue Apr 8 16:58:16 2008 --- i35579new/offapi/com/sun/star/sheet/makefile.mk Tue Apr 8 17:00:38 2008 *************** *** 126,131 **** --- 126,132 ---- FillMode.idl\ FilterConnection.idl\ FilterOperator.idl\ + FilterOperator2.idl\ FormulaLanguage.idl\ FormulaMapGroup.idl\ FormulaMapGroupSpecialOffset.idl\ *************** *** 204,209 **** --- 205,211 ---- TableConditionalEntryEnumeration.idl\ TableConditionalFormat.idl\ TableFilterField.idl\ + TableFilterField2.idl\ TableOperationMode.idl\ TablePageBreakData.idl\ TablePageStyle.idl\ *************** *** 294,299 **** --- 296,302 ---- XSheetConditionalEntries.idl\ XSheetConditionalEntry.idl\ XSheetFilterDescriptor.idl\ + XSheetFilterDescriptor2.idl\ XSheetFilterable.idl\ XSheetFilterableEx.idl\ XSheetLinkable.idl\ diff -cNr i35579old/sc/inc/datauno.hxx i35579new/sc/inc/datauno.hxx *** i35579old/sc/inc/datauno.hxx Sun Mar 4 18:07:44 2007 --- i35579new/sc/inc/datauno.hxx Wed Apr 9 11:03:44 2008 *************** *** 60,65 **** --- 60,68 ---- #ifndef _COM_SUN_STAR_SHEET_XSHEETFILTERDESCRIPTOR_HPP_ #include #endif + #ifndef _COM_SUN_STAR_SHEET_XSHEETFILTERDESCRIPTOR2_HPP_ + #include + #endif #ifndef _COM_SUN_STAR_SHEET_XCONSOLIDATIONDESCRIPTOR_HPP_ #include #endif *************** *** 397,403 **** // to uno, all three look the same ! class ScFilterDescriptorBase : public cppu::WeakImplHelper3< com::sun::star::sheet::XSheetFilterDescriptor, com::sun::star::beans::XPropertySet, com::sun::star::lang::XServiceInfo >, --- 400,407 ---- // to uno, all three look the same ! 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 >, *************** *** 424,429 **** --- 428,438 ---- 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 -cNr i35579old/sc/inc/global.hxx i35579new/sc/inc/global.hxx *** i35579old/sc/inc/global.hxx Fri Mar 7 23:10:04 2008 --- i35579new/sc/inc/global.hxx Tue Apr 8 14:06:34 2008 *************** *** 709,715 **** SC_TOPVAL, SC_BOTVAL, SC_TOPPERC, ! SC_BOTPERC }; // ----------------------------------------------------------------------- --- 709,721 ---- SC_TOPVAL, SC_BOTVAL, SC_TOPPERC, ! 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 -cNr i35579old/sc/inc/sc.hrc i35579new/sc/inc/sc.hrc *** i35579old/sc/inc/sc.hrc Tue Mar 11 18:43:02 2008 --- i35579new/sc/inc/sc.hrc Tue Apr 8 14:09:46 2008 *************** *** 1304,1309 **** --- 1304,1311 ---- #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 -cNr i35579old/sc/source/core/data/table3.cxx i35579new/sc/source/core/data/table3.cxx *** i35579old/sc/source/core/data/table3.cxx Sat Sep 22 15:53:28 2007 --- i35579new/sc/source/core/data/table3.cxx Tue Apr 8 14:52:50 2008 *************** *** 1019,1030 **** --- 1019,1037 ---- } } 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) *************** *** 1037,1043 **** GetInputString( static_cast(rEntry.nField), nRow, aCellStr ); BOOL bRealRegExp = (rParam.bRegExp && ((rEntry.eOp == SC_EQUAL) ! || (rEntry.eOp == SC_NOT_EQUAL))); BOOL bTestRegExp = (pbTestEqualCondition && rParam.bRegExp && ((rEntry.eOp == SC_LESS_EQUAL) || (rEntry.eOp == SC_GREATER_EQUAL))); --- 1044,1053 ---- GetInputString( static_cast(rEntry.nField), nRow, aCellStr ); BOOL bRealRegExp = (rParam.bRegExp && ((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))); BOOL bTestRegExp = (pbTestEqualCondition && rParam.bRegExp && ((rEntry.eOp == SC_LESS_EQUAL) || (rEntry.eOp == SC_GREATER_EQUAL))); *************** *** 1045,1064 **** { 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 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); else bTestEqual = bMatch; } if ( !bRealRegExp ) { ! if ( rEntry.eOp == SC_EQUAL || rEntry.eOp == SC_NOT_EQUAL ) { if ( !rEntry.bQueryByString && rEntry.pStr->Len() == 0 ) { --- 1055,1115 ---- { xub_StrLen nStart = 0; xub_StrLen nEnd = aCellStr.Len(); ! // 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 ) ! 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 ! || 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 ) { *************** *** 1066,1074 **** --- 1117,1131 ---- // 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; *************** *** 1078,1087 **** String aQuer( pTransliteration->transliterate( *rEntry.pStr, ScGlobal::eLnge, 0, rEntry.pStr->Len(), &xOff ) ); ! bOk = (aCell.Search( aQuer ) != STRING_NOTFOUND); } - if ( rEntry.eOp == SC_NOT_EQUAL ) - bOk = !bOk; } else { // use collator here because data was probably sorted --- 1135,1171 ---- String aQuer( pTransliteration->transliterate( *rEntry.pStr, ScGlobal::eLnge, 0, rEntry.pStr->Len(), &xOff ) ); ! 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 ! } ! } } } else { // use collator here because data was probably sorted diff -cNr i35579old/sc/source/filter/xml/XMLExportDatabaseRanges.cxx i35579new/sc/source/filter/xml/XMLExportDatabaseRanges.cxx *** i35579old/sc/source/filter/xml/XMLExportDatabaseRanges.cxx Wed Apr 9 11:20:40 2008 --- i35579new/sc/source/filter/xml/XMLExportDatabaseRanges.cxx Thu Apr 24 15:44:46 2008 *************** *** 259,264 **** --- 259,322 ---- } } + rtl::OUString ScXMLExportDatabaseRanges::getOperatorXML(const long aFilterOperator, const sal_Bool bUseRegularExpressions) const + { + 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 + } + } + return rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("=")); + } + rtl::OUString ScXMLExportDatabaseRanges::getOperatorXML(const sheet::FilterOperator aFilterOperator, const sal_Bool bUseRegularExpressions) const { switch (aFilterOperator) *************** *** 305,310 **** --- 363,386 ---- return rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("=")); } + 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) + rExport.AddAttribute(XML_NAMESPACE_TABLE, XML_CASE_SENSITIVE, XML_TRUE); + if (aFilterField.IsNumeric) + { + rExport.AddAttribute(XML_NAMESPACE_TABLE, XML_DATA_TYPE, XML_NUMBER); + rtl::OUStringBuffer sBuffer; + rExport.GetMM100UnitConverter().convertDouble(sBuffer, aFilterField.NumericValue); + rExport.AddAttribute(XML_NAMESPACE_TABLE, XML_VALUE, sBuffer.makeStringAndClear()); + } + else + rExport.AddAttribute(XML_NAMESPACE_TABLE, XML_VALUE, aFilterField.StringValue); + rExport.AddAttribute(XML_NAMESPACE_TABLE, XML_OPERATOR, getOperatorXML(aFilterField.Operator, bUseRegularExpressions)); + SvXMLElementExport aElemC(rExport, XML_NAMESPACE_TABLE, XML_FILTER_CONDITION, sal_True, sal_True); + } + void ScXMLExportDatabaseRanges::WriteCondition(const sheet::TableFilterField& aFilterField, sal_Bool bIsCaseSensitive, sal_Bool bUseRegularExpressions) { rExport.AddAttribute(XML_NAMESPACE_TABLE, XML_FIELD_NUMBER, rtl::OUString::valueOf(aFilterField.Field)); *************** *** 323,328 **** --- 399,537 ---- SvXMLElementExport aElemC(rExport, XML_NAMESPACE_TABLE, XML_FILTER_CONDITION, sal_True, sal_True); } + void ScXMLExportDatabaseRanges::WriteFilterDescriptor(const uno::Reference & xSheetFilterDescriptor, const rtl::OUString sDatabaseRangeName) + { + uno::Reference< sheet::XSheetFilterDescriptor2 > xSheetFilterDescriptor2( xSheetFilterDescriptor, uno::UNO_QUERY ); + if ( xSheetFilterDescriptor2.is() ) + { + uno::Sequence< sheet::TableFilterField2 > aTableFilterFields2( + xSheetFilterDescriptor2->getFilterFields2() ); + sal_Int32 nTableFilterFields = aTableFilterFields2.getLength(); + if (nTableFilterFields > 0) + { + uno::Reference xPropertySet (xSheetFilterDescriptor, uno::UNO_QUERY); + if (xPropertySet.is()) + { + if (::cppu::any2bool(xPropertySet->getPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_UNONAME_COPYOUT))))) + { + table::CellAddress aOutputPosition; + if (xPropertySet->getPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_UNONAME_OUTPOS))) >>= aOutputPosition) + { + rtl::OUString sOUCellAddress; + ScRangeStringConverter::GetStringFromAddress( sOUCellAddress, aOutputPosition, pDoc ); + rExport.AddAttribute(XML_NAMESPACE_TABLE, XML_TARGET_RANGE_ADDRESS, sOUCellAddress); + } + } + ScDBCollection* pDBCollection = pDoc->GetDBCollection(); + sal_uInt16 nIndex; + pDBCollection->SearchName(sDatabaseRangeName, nIndex); + ScDBData* pDBData = (*pDBCollection)[nIndex]; + ScRange aAdvSource; + if (pDBData->GetAdvancedQuerySource(aAdvSource)) + { + rtl::OUString sOUCellAddress; + ScRangeStringConverter::GetStringFromRange( sOUCellAddress, aAdvSource, pDoc ); + rExport.AddAttribute(XML_NAMESPACE_TABLE, XML_CONDITION_SOURCE_RANGE_ADDRESS, sOUCellAddress); + } + + if (::cppu::any2bool(xPropertySet->getPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_UNONAME_SKIPDUP))))) + rExport.AddAttribute(XML_NAMESPACE_TABLE, XML_DISPLAY_DUPLICATES, XML_FALSE); + SvXMLElementExport aElemF(rExport, XML_NAMESPACE_TABLE, XML_FILTER, sal_True, sal_True); + rExport.CheckAttrList(); + sal_Bool bIsCaseSensitive = ::cppu::any2bool(xPropertySet->getPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_UNONAME_ISCASE)))); + sal_Bool bUseRegularExpressions = ::cppu::any2bool(xPropertySet->getPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_UNONAME_USEREGEX)))); + sal_Bool bAnd = sal_False; + sal_Bool bOr = sal_False; + for (sal_Int32 i = 1; i < nTableFilterFields; ++i) + { + if (aTableFilterFields2[i].Connection == sheet::FilterConnection_AND) + bAnd = sal_True; + else + bOr = sal_True; + } + if (bOr && !bAnd) + { + SvXMLElementExport aElemOr(rExport, XML_NAMESPACE_TABLE, XML_FILTER_OR, sal_True, sal_True); + for (sal_Int32 i = 0; i < nTableFilterFields; ++i) + { + WriteCondition(aTableFilterFields2[i], bIsCaseSensitive, bUseRegularExpressions); + } + } + else if (bAnd && !bOr) + { + SvXMLElementExport aElemAnd(rExport, XML_NAMESPACE_TABLE, XML_FILTER_AND, sal_True, sal_True); + for (sal_Int32 i = 0; i < nTableFilterFields; ++i) + { + WriteCondition(aTableFilterFields2[i], bIsCaseSensitive, bUseRegularExpressions); + } + } + else if (nTableFilterFields == 1) + { + WriteCondition(aTableFilterFields2[0], bIsCaseSensitive, bUseRegularExpressions); + } + else + { + SvXMLElementExport aElemC(rExport, XML_NAMESPACE_TABLE, XML_FILTER_OR, sal_True, sal_True); + sheet::TableFilterField2 aPrevFilterField = aTableFilterFields2[0]; + sheet::FilterConnection aConnection = aTableFilterFields2[1].Connection; + sal_Bool bOpenAndElement; + rtl::OUString aName = rExport.GetNamespaceMap().GetQNameByKey(XML_NAMESPACE_TABLE, GetXMLToken(XML_FILTER_AND)); + if (aConnection == sheet::FilterConnection_AND) + { + rExport.StartElement( aName, sal_True); + bOpenAndElement = sal_True; + } + else + bOpenAndElement = sal_False; + for (sal_Int32 i = 1; i < nTableFilterFields; ++i) + { + if (aConnection != aTableFilterFields2[i].Connection) + { + aConnection = aTableFilterFields2[i].Connection; + if (aTableFilterFields2[i].Connection == sheet::FilterConnection_AND) + { + rExport.StartElement( aName, sal_True ); + bOpenAndElement = sal_True; + WriteCondition(aPrevFilterField, bIsCaseSensitive, bUseRegularExpressions); + aPrevFilterField = aTableFilterFields2[i]; + if (i == nTableFilterFields - 1) + { + WriteCondition(aPrevFilterField, bIsCaseSensitive, bUseRegularExpressions); + rExport.EndElement(aName, sal_True); + bOpenAndElement = sal_False; + } + } + else + { + WriteCondition(aPrevFilterField, bIsCaseSensitive, bUseRegularExpressions); + aPrevFilterField = aTableFilterFields2[i]; + if (bOpenAndElement) + { + rExport.EndElement(aName, sal_True); + bOpenAndElement = sal_False; + } + if (i == nTableFilterFields - 1) + { + WriteCondition(aPrevFilterField, bIsCaseSensitive, bUseRegularExpressions); + } + } + } + else + { + WriteCondition(aPrevFilterField, bIsCaseSensitive, bUseRegularExpressions); + aPrevFilterField = aTableFilterFields2[i]; + if (i == nTableFilterFields - 1) + WriteCondition(aPrevFilterField, bIsCaseSensitive, bUseRegularExpressions); + } + } + if(bOpenAndElement) + rExport.EndElement(aName, sal_True); + } + } + } + } + } + void ScXMLExportDatabaseRanges::WriteFilterDescriptor(const uno::Reference & xSheetFilterDescriptor, const rtl::OUString sDatabaseRangeName) { uno::Sequence aTableFilterFields(xSheetFilterDescriptor->getFilterFields()); *************** *** 731,738 **** SvXMLElementExport aElemDR(rExport, XML_NAMESPACE_TABLE, XML_DATABASE_RANGE, sal_True, sal_True); rExport.CheckAttrList(); WriteImportDescriptor(xDatabaseRange->getImportDescriptor()); ! if (xSheetFilterDescriptor.is()) ! WriteFilterDescriptor(xSheetFilterDescriptor, sDatabaseRangeName); WriteSortDescriptor(aSortProperties); WriteSubTotalDescriptor(xDatabaseRange->getSubTotalDescriptor(), sDatabaseRangeName); } --- 940,955 ---- SvXMLElementExport aElemDR(rExport, XML_NAMESPACE_TABLE, XML_DATABASE_RANGE, sal_True, sal_True); rExport.CheckAttrList(); WriteImportDescriptor(xDatabaseRange->getImportDescriptor()); ! uno::Reference< sheet::XSheetFilterDescriptor2 > xSheetFilterDescriptor2( ! xSheetFilterDescriptor, uno::UNO_QUERY ); ! if ( xSheetFilterDescriptor2.is() ) ! { ! WriteFilterDescriptor( xSheetFilterDescriptor2, sDatabaseRangeName ); ! } ! else if ( xSheetFilterDescriptor.is() ) ! { ! WriteFilterDescriptor( xSheetFilterDescriptor, sDatabaseRangeName ); ! } WriteSortDescriptor(aSortProperties); WriteSubTotalDescriptor(xDatabaseRange->getSubTotalDescriptor(), sDatabaseRangeName); } diff -cNr i35579old/sc/source/filter/xml/XMLExportDatabaseRanges.hxx i35579new/sc/source/filter/xml/XMLExportDatabaseRanges.hxx *** i35579old/sc/source/filter/xml/XMLExportDatabaseRanges.hxx Fri Dec 16 16:08:52 2005 --- i35579new/sc/source/filter/xml/XMLExportDatabaseRanges.hxx Wed Apr 9 15:04:02 2008 *************** *** 45,56 **** --- 45,65 ---- #ifndef _COM_SUN_STAR_SHEET_FILTEROPERATOR_HPP_ #include #endif + #ifndef _COM_SUN_STAR_SHEET_FILTEROPERATOR2_HPP_ + #include + #endif #ifndef _COM_SUN_STAR_SHEET_TABLEFILTERFIELD_HPP_ #include #endif + #ifndef _COM_SUN_STAR_SHEET_TABLEFILTERFIELD2_HPP_ + #include + #endif #ifndef _COM_SUN_STAR_SHEET_XSHEETFILTERDESCRIPTOR_HPP_ #include #endif + #ifndef _COM_SUN_STAR_SHEET_XSHEETFILTERDESCRIPTOR2_HPP_ + #include + #endif #ifndef _COM_SUN_STAR_SHEET_XSUBTOTALDESCRIPTOR_HPP_ #include #endif *************** *** 69,76 **** --- 78,88 ---- void WriteImportDescriptor(const com::sun::star::uno::Sequence aImportDescriptor); rtl::OUString getOperatorXML(const com::sun::star::sheet::FilterOperator aFilterOperator, const sal_Bool bUseRegularExpressions) const; + rtl::OUString getOperatorXML(const long aFilterOperator, const sal_Bool bUseRegularExpressions) const; void WriteCondition(const com::sun::star::sheet::TableFilterField& aFilterField, sal_Bool bIsCaseSensitive, sal_Bool bUseRegularExpressions); + 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 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 -cNr i35579old/sc/source/filter/xml/xmldrani.cxx i35579new/sc/source/filter/xml/xmldrani.cxx *** i35579old/sc/source/filter/xml/xmldrani.cxx Thu May 24 17:27:34 2007 --- i35579new/sc/source/filter/xml/xmldrani.cxx Fri Apr 25 15:08:12 2008 *************** *** 426,432 **** 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 (bFilterConditionSourceRange) { ScRange aAdvSource; --- 426,441 ---- 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)); } ! uno::Reference< sheet::XSheetFilterDescriptor2 > xSheetFilterDescriptor2( ! xSheetFilterDescriptor, uno::UNO_QUERY ); ! if ( xSheetFilterDescriptor2.is() ) ! { ! xSheetFilterDescriptor2->setFilterFields2(aFilterFields2); ! } ! else ! { ! xSheetFilterDescriptor->setFilterFields(aFilterFields); ! } if (bFilterConditionSourceRange) { ScRange aAdvSource; diff -cNr i35579old/sc/source/filter/xml/xmldrani.hxx i35579new/sc/source/filter/xml/xmldrani.hxx *** i35579old/sc/source/filter/xml/xmldrani.hxx Fri Dec 16 16:08:52 2005 --- i35579new/sc/source/filter/xml/xmldrani.hxx Wed May 7 11:38:56 2008 *************** *** 56,61 **** --- 56,64 ---- #ifndef _COM_SUN_STAR_SHEET_TABLEFILTERFIELD_HPP_ #include #endif + #ifndef _COM_SUN_STAR_SHEET_TABLEFILTERFIELD2_HPP_ + #include + #endif #ifndef _COM_SUN_STAR_TABLE_CELLADDRESS_HPP_ #include #endif *************** *** 105,110 **** --- 108,114 ---- rtl::OUString sSourceObject; com::sun::star::uno::Sequence aSortSequence; com::sun::star::uno::Sequence aFilterFields; + com::sun::star::uno::Sequence aFilterFields2; std::vector < ScSubTotalRule > aSubTotalRules; com::sun::star::table::CellAddress aFilterOutputPosition; com::sun::star::table::CellRangeAddress aFilterConditionSourceRangeAddress; *************** *** 172,177 **** --- 176,182 ---- 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 SetFilterFields2(const com::sun::star::uno::Sequence & aTemp) { aFilterFields2 = 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 -cNr i35579old/sc/source/filter/xml/xmlfilti.cxx i35579new/sc/source/filter/xml/xmlfilti.cxx *** i35579old/sc/source/filter/xml/xmlfilti.cxx Thu May 24 17:27:34 2007 --- i35579new/sc/source/filter/xml/xmlfilti.cxx Thu May 8 11:50:38 2008 *************** *** 179,184 **** --- 179,185 ---- pDatabaseRangeContext->SetFilterIsCaseSensitive(bIsCaseSensitive); pDatabaseRangeContext->SetFilterSkipDuplicates(bSkipDuplicates); pDatabaseRangeContext->SetFilterFields(aFilterFields); + pDatabaseRangeContext->SetFilterFields2(aFilterFields2); if (bConditionSourceRange) pDatabaseRangeContext->SetFilterConditionSourceRangeAddress(aConditionSourceRangeAddress); } *************** *** 391,396 **** --- 392,398 ---- void ScXMLConditionContext::EndElement() { sheet::TableFilterField aFilterField; + sheet::TableFilterField2 aFilterField2; if (pFilterContext->GetConnection()) aFilterField.Connection = sheet::FilterConnection_OR; else *************** *** 411,416 **** --- 413,419 ---- aFilterField.IsNumeric = sal_False; } pFilterContext->AddFilterField(aFilterField); + pFilterContext->AddFilterField2(aFilterField2); } //========================================================================== *************** *** 751,756 **** --- 754,771 ---- aFilterOperator = SC_TOPPERC; else if (IsXMLToken(sTempOperator, XML_TOP_VALUES)) aFilterOperator = SC_TOPVAL; + else if (IsXMLToken(sTempOperator, XML_CONTAINS)) + aFilterOperator = SC_CONTAINS; + else if (IsXMLToken(sTempOperator, XML_DOES_NOT_CONTAIN)) + aFilterOperator = SC_DOES_NOT_CONTAIN; + else if (IsXMLToken(sTempOperator, XML_BEGINS_WITH)) + aFilterOperator = SC_BEGINS_WITH; + else if (IsXMLToken(sTempOperator, XML_DOES_NOT_BEGIN_WITH)) + aFilterOperator = SC_DOES_NOT_BEGIN_WITH; + else if (IsXMLToken(sTempOperator, XML_ENDS_WITH)) + aFilterOperator = SC_ENDS_WITH; + else if (IsXMLToken(sTempOperator, XML_DOES_NOT_END_WITH)) + aFilterOperator = SC_DOES_NOT_END_WITH; } void ScXMLDPConditionContext::EndElement() diff -cNr i35579old/sc/source/filter/xml/xmlfilti.hxx i35579new/sc/source/filter/xml/xmlfilti.hxx *** i35579old/sc/source/filter/xml/xmlfilti.hxx Fri Apr 25 16:04:16 2008 --- i35579new/sc/source/filter/xml/xmlfilti.hxx Wed May 7 11:31:42 2008 *************** *** 52,57 **** --- 52,60 ---- #ifndef _COM_SUN_STAR_SHEET_TABLEFILTERFIELD_HPP_ #include #endif + #ifndef _COM_SUN_STAR_SHEET_TABLEFILTERFIELD2_HPP_ + #include + #endif #ifndef _STACK_HXX #include #endif *************** *** 66,71 **** --- 69,75 ---- ScXMLDatabaseRangeContext* pDatabaseRangeContext; com::sun::star::uno::Sequence aFilterFields; + com::sun::star::uno::Sequence aFilterFields2; com::sun::star::table::CellAddress aOutputPosition; com::sun::star::table::CellRangeAddress aConditionSourceRangeAddress; sal_Int16 nUserListIndex; *************** *** 108,113 **** --- 112,119 ---- 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 AddFilterField2 (const com::sun::star::sheet::TableFilterField2 aFilterField2) { aFilterFields2.realloc(aFilterFields2.getLength() + 1); + aFilterFields2[aFilterFields2.getLength() - 1] = aFilterField2; } }; class ScXMLAndContext : public SvXMLImportContext diff -cNr i35579old/sc/source/ui/dbgui/filtdlg.cxx i35579new/sc/source/ui/dbgui/filtdlg.cxx *** i35579old/sc/source/ui/dbgui/filtdlg.cxx Wed Jan 30 21:32:24 2008 --- i35579new/sc/source/ui/dbgui/filtdlg.cxx Tue Apr 8 14:14:50 2008 *************** *** 103,108 **** --- 103,109 ---- 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 ) ), *************** *** 124,129 **** --- 125,132 ---- 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 -cNr i35579old/sc/source/ui/inc/filtdlg.hxx i35579new/sc/source/ui/inc/filtdlg.hxx *** i35579old/sc/source/ui/inc/filtdlg.hxx Sun Mar 4 18:08:02 2007 --- i35579new/sc/source/ui/inc/filtdlg.hxx Tue Apr 8 14:16:58 2008 *************** *** 154,159 **** --- 154,160 ---- FixedText aFtField; FixedText aFtCond; FixedText aFtVal; + FixedLine aFlSeparator; _COMMON_FILTER_RSCOBJS diff -cNr i35579old/sc/source/ui/inc/filter.hrc i35579new/sc/source/ui/inc/filter.hrc *** i35579old/sc/source/ui/inc/filter.hrc Fri Dec 16 16:08:58 2005 --- i35579new/sc/source/ui/inc/filter.hrc Tue Apr 8 14:18:30 2008 *************** *** 73,78 **** --- 73,79 ---- #define ED_VAL2 33 #define ED_VAL3 34 #define FL_CRITERIA 35 + #define FL_SEPARATOR 36 // Spezialfilter diff -cNr i35579old/sc/source/ui/src/filter.src i35579new/sc/source/ui/src/filter.src *** i35579old/sc/source/ui/src/filter.src Fri Apr 20 21:21:46 2007 --- i35579new/sc/source/ui/src/filter.src Tue Apr 8 15:53:54 2008 *************** *** 39,45 **** HelpId = SID_FILTER ; Hide = TRUE ; SVLook = TRUE ; ! Size = MAP_APPFONT ( 298 , 83 ) ; Text [ en-US ] = "Standard Filter" ; Moveable = TRUE ; Closeable = FALSE ; --- 39,45 ---- HelpId = SID_FILTER ; Hide = TRUE ; SVLook = TRUE ; ! Size = MAP_APPFONT ( 267 , 105 ) ; Text [ en-US ] = "Standard Filter" ; Moveable = TRUE ; Closeable = FALSE ; *************** *** 58,69 **** FixedText FT_COND { Pos = MAP_APPFONT ( 122 , 14 ) ; ! Size = MAP_APPFONT ( 47 , 8 ) ; Text [ en-US ] = "Condition" ; }; FixedText FT_VAL { ! Pos = MAP_APPFONT ( 173 , 14 ) ; Size = MAP_APPFONT ( 60 , 8 ) ; Text [ en-US ] = "Value" ; }; --- 58,69 ---- FixedText FT_COND { Pos = MAP_APPFONT ( 122 , 14 ) ; ! Size = MAP_APPFONT ( 75 , 8 ) ; Text [ en-US ] = "Condition" ; }; FixedText FT_VAL { ! Pos = MAP_APPFONT ( 201 , 14 ) ; Size = MAP_APPFONT ( 60 , 8 ) ; Text [ en-US ] = "Value" ; }; *************** *** 121,127 **** { Border = TRUE ; Pos = MAP_APPFONT ( 122 , 25 ) ; ! Size = MAP_APPFONT ( 47 , 105 ) ; TabStop = TRUE ; DropDown = TRUE ; stringlist [ en-US ] = --- 121,127 ---- { Border = TRUE ; Pos = MAP_APPFONT ( 122 , 25 ) ; ! Size = MAP_APPFONT ( 75 , 145 ) ; TabStop = TRUE ; DropDown = TRUE ; stringlist [ en-US ] = *************** *** 136,148 **** < "Smallest" ; Default ; > ; < "Largest %" ; Default ; > ; < "Smallest %" ; Default ; > ; }; }; ListBox LB_COND2 { Border = TRUE ; Pos = MAP_APPFONT ( 122 , 41 ) ; ! Size = MAP_APPFONT ( 47 , 105 ) ; TabStop = TRUE ; DropDown = TRUE ; stringlist [ en-US ] = --- 136,154 ---- < "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 ( 75 , 145 ) ; TabStop = TRUE ; DropDown = TRUE ; stringlist [ en-US ] = *************** *** 157,169 **** < "Smallest" ; Default ; > ; < "Largest %" ; Default ; > ; < "Smallest %" ; Default ; > ; }; }; ListBox LB_COND3 { Border = TRUE ; Pos = MAP_APPFONT ( 122 , 57 ) ; ! Size = MAP_APPFONT ( 47 , 105 ) ; TabStop = TRUE ; DropDown = TRUE ; stringlist [ en-US ] = --- 163,181 ---- < "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 ( 75 , 145 ) ; TabStop = TRUE ; DropDown = TRUE ; stringlist [ en-US ] = *************** *** 178,202 **** < "Smallest" ; Default ; > ; < "Largest %" ; Default ; > ; < "Smallest %" ; Default ; > ; }; }; ComboBox ED_VAL1 { ! Pos = MAP_APPFONT ( 173 , 25 ) ; Size = MAP_APPFONT ( 60 , 90 ) ; TabStop = TRUE ; DropDown = TRUE ; }; ComboBox ED_VAL2 { ! Pos = MAP_APPFONT ( 173 , 41 ) ; Size = MAP_APPFONT ( 60 , 90 ) ; TabStop = TRUE ; DropDown = TRUE ; }; ComboBox ED_VAL3 { ! Pos = MAP_APPFONT ( 173 , 57 ) ; Size = MAP_APPFONT ( 60 , 90 ) ; TabStop = TRUE ; DropDown = TRUE ; --- 190,220 ---- < "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 ( 201 , 25 ) ; Size = MAP_APPFONT ( 60 , 90 ) ; TabStop = TRUE ; DropDown = TRUE ; }; ComboBox ED_VAL2 { ! Pos = MAP_APPFONT ( 201 , 41 ) ; Size = MAP_APPFONT ( 60 , 90 ) ; TabStop = TRUE ; DropDown = TRUE ; }; ComboBox ED_VAL3 { ! Pos = MAP_APPFONT ( 201 , 57 ) ; Size = MAP_APPFONT ( 60 , 90 ) ; TabStop = TRUE ; DropDown = TRUE ; *************** *** 204,216 **** FixedLine FL_CRITERIA { Pos = MAP_APPFONT ( 6 , 3 ) ; ! Size = MAP_APPFONT ( 230 , 8 ) ; Text [ en-US ] = "Filter criteria"; }; CheckBox BTN_CASE { Hide = TRUE ; ! Pos = MAP_APPFONT ( 12 , 86 ) ; Size = MAP_APPFONT ( 128 , 10 ) ; TabStop = TRUE ; Text [ en-US ] = "Case ~sensitive" ; --- 222,234 ---- FixedLine FL_CRITERIA { Pos = MAP_APPFONT ( 6 , 3 ) ; ! Size = MAP_APPFONT ( 258 , 8 ) ; Text [ en-US ] = "Filter criteria"; }; CheckBox BTN_CASE { Hide = TRUE ; ! Pos = MAP_APPFONT ( 12 , 116 ) ; Size = MAP_APPFONT ( 128 , 10 ) ; TabStop = TRUE ; Text [ en-US ] = "Case ~sensitive" ; *************** *** 218,224 **** CheckBox BTN_REGEXP { Hide = TRUE ; ! Pos = MAP_APPFONT ( 142 , 86 ) ; Size = MAP_APPFONT ( 94 , 10 ) ; TabStop = TRUE ; Text [ en-US ] = "Regular ~expression" ; --- 236,242 ---- CheckBox BTN_REGEXP { Hide = TRUE ; ! Pos = MAP_APPFONT ( 142 , 116 ) ; Size = MAP_APPFONT ( 94 , 10 ) ; TabStop = TRUE ; Text [ en-US ] = "Regular ~expression" ; *************** *** 226,232 **** CheckBox BTN_HEADER { Hide = TRUE ; ! Pos = MAP_APPFONT ( 12 , 100 ) ; Size = MAP_APPFONT ( 128 , 10 ) ; TabStop = TRUE ; Text [ en-US ] = "Range contains ~column labels" ; --- 244,250 ---- CheckBox BTN_HEADER { Hide = TRUE ; ! Pos = MAP_APPFONT ( 12 , 130 ) ; Size = MAP_APPFONT ( 128 , 10 ) ; TabStop = TRUE ; Text [ en-US ] = "Range contains ~column labels" ; *************** *** 234,240 **** CheckBox BTN_UNIQUE { Hide = TRUE ; ! Pos = MAP_APPFONT ( 142 , 100 ) ; Size = MAP_APPFONT ( 94 , 10 ) ; TabStop = TRUE ; Text [ en-US ] = "~No duplication" ; --- 252,258 ---- CheckBox BTN_UNIQUE { Hide = TRUE ; ! Pos = MAP_APPFONT ( 142 , 130 ) ; Size = MAP_APPFONT ( 94 , 10 ) ; TabStop = TRUE ; Text [ en-US ] = "~No duplication" ; *************** *** 242,248 **** CheckBox BTN_COPY_RESULT { Hide = TRUE ; ! Pos = MAP_APPFONT ( 12 , 114 ) ; Size = MAP_APPFONT ( 128 , 10 ) ; TabStop = TRUE ; Text [ en-US ] = "Copy ~results to..." ; --- 260,266 ---- CheckBox BTN_COPY_RESULT { Hide = TRUE ; ! Pos = MAP_APPFONT ( 12 , 144 ) ; Size = MAP_APPFONT ( 128 , 10 ) ; TabStop = TRUE ; Text [ en-US ] = "Copy ~results to..." ; *************** *** 250,256 **** CheckBox BTN_DEST_PERS { Hide = TRUE ; ! Pos = MAP_APPFONT ( 142 , 114 ) ; Size = MAP_APPFONT ( 94 , 10 ) ; TabStop = TRUE ; Text [ en-US ] = "~Keep filter criteria" ; --- 268,274 ---- CheckBox BTN_DEST_PERS { Hide = TRUE ; ! Pos = MAP_APPFONT ( 142 , 144 ) ; Size = MAP_APPFONT ( 94 , 10 ) ; TabStop = TRUE ; Text [ en-US ] = "~Keep filter criteria" ; *************** *** 259,266 **** { Border = TRUE ; Hide = TRUE ; ! Pos = MAP_APPFONT ( 21 , 126 ) ; ! Size = MAP_APPFONT ( 90 , 90 ) ; TabStop = TRUE ; DropDown = TRUE ; }; --- 277,284 ---- { Border = TRUE ; Hide = TRUE ; ! Pos = MAP_APPFONT ( 21 , 156 ) ; ! Size = MAP_APPFONT ( 110 , 90 ) ; TabStop = TRUE ; DropDown = TRUE ; }; *************** *** 268,280 **** { Border = TRUE ; Hide = TRUE ; ! Pos = MAP_APPFONT ( 115 , 126 ) ; ! Size = MAP_APPFONT ( 104 , 12 ) ; TabStop = TRUE ; }; ImageButton RB_COPY_AREA { ! Pos = MAP_APPFONT ( 221 , 125 ) ; Size = MAP_APPFONT ( 13 , 15 ) ; TabStop = FALSE ; QuickHelpText [ en-US ] = "Shrink" ; --- 286,298 ---- { Border = TRUE ; Hide = TRUE ; ! Pos = MAP_APPFONT ( 136 , 156 ) ; ! Size = MAP_APPFONT ( 110 , 12 ) ; TabStop = TRUE ; }; ImageButton RB_COPY_AREA { ! Pos = MAP_APPFONT ( 248 , 155 ) ; Size = MAP_APPFONT ( 13 , 15 ) ; TabStop = FALSE ; QuickHelpText [ en-US ] = "Shrink" ; *************** *** 282,295 **** FixedLine FL_OPTIONS { Hide = TRUE ; ! Pos = MAP_APPFONT ( 6 , 75 ) ; ! Size = MAP_APPFONT ( 230 , 8 ) ; Text [ en-US ] = "Options" ; }; FixedText FT_DBAREA { Hide = TRUE ; ! Pos = MAP_APPFONT ( 66 , 144 ) ; Size = MAP_APPFONT ( 167 , 8 ) ; Left = TRUE ; Text [ en-US ] = "dummy" ; --- 300,313 ---- FixedLine FL_OPTIONS { Hide = TRUE ; ! Pos = MAP_APPFONT ( 6 , 104 ) ; ! Size = MAP_APPFONT ( 258 , 8 ) ; Text [ en-US ] = "Options" ; }; FixedText FT_DBAREA { Hide = TRUE ; ! Pos = MAP_APPFONT ( 66 , 174 ) ; Size = MAP_APPFONT ( 167 , 8 ) ; Left = TRUE ; Text [ en-US ] = "dummy" ; *************** *** 297,332 **** FixedText FT_DBAREA_LABEL { Hide = TRUE ; ! Pos = MAP_APPFONT ( 6 , 144 ) ; Size = MAP_APPFONT ( 58 , 8 ) ; Text [ en-US ] = "Data range:" ; }; OKButton BTN_OK { ! Pos = MAP_APPFONT ( 242 , 6 ) ; Size = MAP_APPFONT ( 50 , 14 ) ; TabStop = TRUE ; DefButton = TRUE ; }; CancelButton BTN_CANCEL { ! Pos = MAP_APPFONT ( 242 , 23 ) ; Size = MAP_APPFONT ( 50 , 14 ) ; TabStop = TRUE ; }; HelpButton BTN_HELP { ! Pos = MAP_APPFONT ( 242 , 43 ) ; Size = MAP_APPFONT ( 50 , 14 ) ; TabStop = TRUE ; }; MoreButton BTN_MORE { ! Pos = MAP_APPFONT ( 242 , 63 ) ; ! Size = MAP_APPFONT ( 50 , 14 ) ; TabStop = TRUE ; MapUnit = MAP_APPFONT ; ! Delta = 75 ; }; }; //============================================================================ --- 315,355 ---- FixedText FT_DBAREA_LABEL { Hide = TRUE ; ! Pos = MAP_APPFONT ( 6 , 174 ) ; Size = MAP_APPFONT ( 58 , 8 ) ; Text [ en-US ] = "Data range:" ; }; OKButton BTN_OK { ! Pos = MAP_APPFONT ( 103 , 85 ) ; Size = MAP_APPFONT ( 50 , 14 ) ; TabStop = TRUE ; DefButton = TRUE ; }; CancelButton BTN_CANCEL { ! Pos = MAP_APPFONT ( 157 , 85 ) ; Size = MAP_APPFONT ( 50 , 14 ) ; TabStop = TRUE ; }; HelpButton BTN_HELP { ! Pos = MAP_APPFONT ( 211 , 85 ) ; Size = MAP_APPFONT ( 50 , 14 ) ; TabStop = TRUE ; }; MoreButton BTN_MORE { ! Pos = MAP_APPFONT ( 6 , 85 ) ; ! Size = MAP_APPFONT ( 55 , 14 ) ; TabStop = TRUE ; MapUnit = MAP_APPFONT ; ! Delta = 81 ; ! }; ! FixedLine FL_SEPARATOR ! { ! Pos = MAP_APPFONT ( 0 , 75 ) ; ! Size = MAP_APPFONT ( 267 , 6 ) ; }; }; //============================================================================ diff -cNr i35579old/sc/source/ui/src/scstring.src i35579new/sc/source/ui/src/scstring.src *** i35579old/sc/source/ui/src/scstring.src Sat Sep 22 15:53:56 2007 --- i35579new/sc/source/ui/src/scstring.src Tue Apr 8 14:37:00 2008 *************** *** 733,735 **** --- 733,745 ---- 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 -cNr i35579old/sc/source/ui/unoobj/cellsuno.cxx i35579new/sc/source/ui/unoobj/cellsuno.cxx *** i35579old/sc/source/ui/unoobj/cellsuno.cxx Fri Mar 7 23:11:08 2008 --- i35579new/sc/source/ui/unoobj/cellsuno.cxx Fri Apr 11 09:54:46 2008 *************** *** 5688,5694 **** ScDocShell* pDocSh = GetDocShell(); ScFilterDescriptor aImpl(pDocSh); ! aImpl.setFilterFields( xDescriptor->getFilterFields() ); // Rest sind jetzt Properties... uno::Reference xPropSet( xDescriptor, uno::UNO_QUERY ); --- 5688,5703 ---- ScDocShell* pDocSh = GetDocShell(); ScFilterDescriptor aImpl(pDocSh); ! 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 -cNr i35579old/sc/source/ui/unoobj/datauno.cxx i35579new/sc/source/ui/unoobj/datauno.cxx *** i35579old/sc/source/ui/unoobj/datauno.cxx Thu Jan 17 03:56:06 2008 --- i35579new/sc/source/ui/unoobj/datauno.cxx Wed Apr 30 10:25:44 2008 *************** *** 51,56 **** --- 51,60 ---- #include #include + #include + #include + #include + #include "datauno.hxx" #include "dapiuno.hxx" #include "cellsuno.hxx" *************** *** 1190,1195 **** --- 1194,1274 ---- 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) *************** *** 1264,1269 **** --- 1343,1428 ---- 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 *************** *** 3844,3849 **** --- 3847,3938 ---- rFilterField.StringValue = sCriteria1; } + void lcl_setTableFieldsFromCriteria2( 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. + // right now I am more concerned with just getting it to work right + + sCriteria1 = sCriteria1.trim(); + // table of translation of criteria text to FilterOperators + // <>searchtext - NOT_EQUAL + // =searchtext - EQUAL + // *searchtext - startwith + // <>*searchtext - doesn't startwith + // *searchtext* - contains + // <>*searchtext* - doesn't contain + // [>|>=|<=|...]searchtext for GREATER_value, GREATER_EQUAL_value etc. + sal_Int32 nPos = 0; + bool bIsNumeric = false; + if ( ( nPos = sCriteria1.indexOf( EQUALS ) ) == 0 ) + { + if ( sCriteria1.getLength() == EQUALS.getLength() ) + rFilterField.Operator = sheet::FilterOperator2::EMPTY; + else + { + rFilterField.Operator = sheet::FilterOperator2::EQUAL; + sCriteria1 = sCriteria1.copy( EQUALS.getLength() ); + sCriteria1 = VBAToRegexp( sCriteria1 ); + // UseRegularExpressions + if ( xDescProps.is() ) + xDescProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "UseRegularExpressions" ) ), uno::Any( sal_True ) ); + } + + } + else if ( ( nPos = sCriteria1.indexOf( NOTEQUALS ) ) == 0 ) + { + if ( sCriteria1.getLength() == NOTEQUALS.getLength() ) + rFilterField.Operator = sheet::FilterOperator2::NOT_EMPTY; + else + { + rFilterField.Operator = sheet::FilterOperator2::NOT_EQUAL; + sCriteria1 = sCriteria1.copy( NOTEQUALS.getLength() ); + sCriteria1 = VBAToRegexp( sCriteria1 ); + // UseRegularExpressions + if ( xDescProps.is() ) + xDescProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "UseRegularExpressions" ) ), uno::Any( sal_True ) ); + } + } + else if ( ( nPos = sCriteria1.indexOf( GREATERTHAN ) ) == 0 ) + { + bIsNumeric = true; + if ( ( nPos = sCriteria1.indexOf( GREATERTHANEQUALS ) ) == 0 ) + { + sCriteria1 = sCriteria1.copy( GREATERTHANEQUALS.getLength() ); + rFilterField.Operator = sheet::FilterOperator2::GREATER_EQUAL; + } + else + { + sCriteria1 = sCriteria1.copy( GREATERTHAN.getLength() ); + rFilterField.Operator = sheet::FilterOperator2::GREATER; + } + + } + else if ( ( nPos = sCriteria1.indexOf( LESSTHAN ) ) == 0 ) + { + bIsNumeric = true; + if ( ( nPos = sCriteria1.indexOf( LESSTHANEQUALS ) ) == 0 ) + { + sCriteria1 = sCriteria1.copy( LESSTHANEQUALS.getLength() ); + rFilterField.Operator = sheet::FilterOperator2::LESS_EQUAL; + } + else + { + sCriteria1 = sCriteria1.copy( LESSTHAN.getLength() ); + rFilterField.Operator = sheet::FilterOperator2::LESS; + } + + } + else + rFilterField.Operator = sheet::FilterOperator2::EQUAL; + + if ( bIsNumeric ) + { + rFilterField.IsNumeric= sal_True; + rFilterField.NumericValue = sCriteria1.toDouble(); + } + rFilterField.StringValue = sCriteria1; + } void SAL_CALL ScVbaRange::AutoFilter( const uno::Any& Field, const uno::Any& Criteria1, const uno::Any& Operator, const uno::Any& Criteria2, const uno::Any& VisibleDropDown ) throw (uno::RuntimeException) { *************** *** 3943,4048 **** 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 ); ! if ( Criteria1.hasValue() ) ! { ! sTabFilts.realloc( 1 ); ! sTabFilts[0].Operator = sheet::FilterOperator_EQUAL;// sensible default ! if ( !bCritHasNumericValue ) ! { ! Criteria1 >>= sCriteria1; ! sTabFilts[0].IsNumeric = bCritHasNumericValue; ! if ( bHasCritValue && sCriteria1.getLength() ) ! lcl_setTableFieldsFromCriteria( sCriteria1, xDescProps, sTabFilts[0] ); ! else ! bAll = true; ! } ! else // numeric ! { ! sTabFilts[0].IsNumeric = sal_True; ! sTabFilts[0].NumericValue = nCriteria1; ! } ! } ! else // no value specified ! bAll = true; ! // not sure what the relationship between Criteria1 and Operator is, ! // e.g. can you have a Operator without a Criteria ? in openoffice it ! if ( Operator.hasValue() && ( Operator >>= nOperator ) ) ! { ! // if its a bottom/top Ten(Percent/Value) and there ! // is no value specified for critera1 set it to 10 ! if ( !bCritHasNumericValue && !sCriteria1.getLength() && ( nOperator != excel::XlAutoFilterOperator::xlOr ) && ( nOperator != excel::XlAutoFilterOperator::xlAnd ) ) ! { ! sTabFilts[0].IsNumeric = sal_True; ! sTabFilts[0].NumericValue = 10; ! bAll = false; ! } ! switch ( nOperator ) ! { ! case excel::XlAutoFilterOperator::xlBottom10Items: ! sTabFilts[0].Operator = sheet::FilterOperator_BOTTOM_VALUES; ! break; ! case excel::XlAutoFilterOperator::xlBottom10Percent: ! sTabFilts[0].Operator = sheet::FilterOperator_BOTTOM_PERCENT; ! break; ! case excel::XlAutoFilterOperator::xlTop10Items: ! sTabFilts[0].Operator = sheet::FilterOperator_TOP_VALUES; ! break; ! case excel::XlAutoFilterOperator::xlTop10Percent: ! sTabFilts[0].Operator = sheet::FilterOperator_TOP_PERCENT; ! break; ! case excel::XlAutoFilterOperator::xlOr: ! nConn = sheet::FilterConnection_OR; ! break; ! case excel::XlAutoFilterOperator::xlAnd: ! nConn = sheet::FilterConnection_AND; ! break; ! default: ! throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("UnknownOption") ), uno::Reference< uno::XInterface >() ); ! ! } ! } ! if ( !bAll ) ! { ! sTabFilts[0].Connection = sheet::FilterConnection_AND; ! sTabFilts[0].Field = (nField - 1); ! rtl::OUString sCriteria2; ! if ( Criteria2.hasValue() ) // there is a Criteria2 ! { ! sTabFilts.realloc(2); ! sTabFilts[1].Field = sTabFilts[0].Field; ! sTabFilts[1].Connection = nConn; ! if ( Criteria2 >>= sCriteria2 ) ! { ! if ( sCriteria2.getLength() > 0 ) ! { ! uno::Reference< beans::XPropertySet > xProps; ! lcl_setTableFieldsFromCriteria( sCriteria2, xProps, sTabFilts[1] ); ! sTabFilts[1].IsNumeric = sal_False; ! } ! } ! else // numeric ! { ! Criteria2 >>= sTabFilts[1].NumericValue; ! sTabFilts[1].IsNumeric = sal_True; ! sTabFilts[1].Operator = sheet::FilterOperator_EQUAL; ! } ! } ! } ! xDesc->setFilterFields( sTabFilts ); ! if ( !bAll ) ! { ! xDataBaseRange->refresh(); ! } ! else ! // was 0 based now seems to be 1 ! lcl_SetAllQueryForField( pShell, nField, nSheet ); } else { --- 4032,4244 ---- bool bAll = false;; if ( ( Field >>= nField ) ) { ! uno::Reference< sheet::XSheetFilterDescriptor > xDesc = xDataBaseRange->getFilterDescriptor(); ! uno::Reference< sheet::XSheetFilterDescriptor2 > xDesc2( ! xDesc, uno::UNO_QUERY ); ! if ( xDesc2.is() ) ! { ! uno::Sequence< sheet::TableFilterField2 > sTabFilts2; ! uno::Reference< beans::XPropertySet > xDescProps( xDesc2, uno::UNO_QUERY_THROW ); ! if ( Criteria1.hasValue() ) ! { ! sTabFilts2.realloc( 1 ); ! sTabFilts2[0].Operator = sheet::FilterOperator2::EQUAL;// sensible default ! if ( !bCritHasNumericValue ) ! { ! Criteria1 >>= sCriteria1; ! sTabFilts2[0].IsNumeric = bCritHasNumericValue; ! if ( bHasCritValue && sCriteria1.getLength() ) ! lcl_setTableFieldsFromCriteria2( sCriteria1, xDescProps, sTabFilts2[0] ); ! else ! bAll = true; ! } ! else // numeric ! { ! sTabFilts2[0].IsNumeric = sal_True; ! sTabFilts2[0].NumericValue = nCriteria1; ! } ! } ! else // no value specified ! bAll = true; ! // not sure what the relationship between Criteria1 and Operator is, ! // e.g. can you have a Operator without a Criteria ? in openoffice it ! if ( Operator.hasValue() && ( Operator >>= nOperator ) ) ! { ! // if its a bottom/top Ten(Percent/Value) and there ! // is no value specified for critera1 set it to 10 ! if ( !bCritHasNumericValue && !sCriteria1.getLength() && ( nOperator != excel::XlAutoFilterOperator::xlOr ) && ( nOperator != excel::XlAutoFilterOperator::xlAnd ) ) ! { ! sTabFilts2[0].IsNumeric = sal_True; ! sTabFilts2[0].NumericValue = 10; ! bAll = false; ! } ! switch ( nOperator ) ! { ! case excel::XlAutoFilterOperator::xlBottom10Items: ! sTabFilts2[0].Operator = sheet::FilterOperator2::BOTTOM_VALUES; ! break; ! case excel::XlAutoFilterOperator::xlBottom10Percent: ! sTabFilts2[0].Operator = sheet::FilterOperator2::BOTTOM_PERCENT; ! break; ! case excel::XlAutoFilterOperator::xlTop10Items: ! sTabFilts2[0].Operator = sheet::FilterOperator2::TOP_VALUES; ! break; ! case excel::XlAutoFilterOperator::xlTop10Percent: ! sTabFilts2[0].Operator = sheet::FilterOperator2::TOP_PERCENT; ! break; ! case excel::XlAutoFilterOperator::xlOr: ! nConn = sheet::FilterConnection_OR; ! break; ! case excel::XlAutoFilterOperator::xlAnd: ! nConn = sheet::FilterConnection_AND; ! break; ! default: ! throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("UnknownOption") ), uno::Reference< uno::XInterface >() ); ! } ! } ! if ( !bAll ) ! { ! sTabFilts2[0].Connection = sheet::FilterConnection_AND; ! sTabFilts2[0].Field = (nField - 1); ! rtl::OUString sCriteria2; ! if ( Criteria2.hasValue() ) // there is a Criteria2 ! { ! sTabFilts2.realloc(2); ! sTabFilts2[1].Field = sTabFilts2[0].Field; ! sTabFilts2[1].Connection = nConn; ! ! if ( Criteria2 >>= sCriteria2 ) ! { ! if ( sCriteria2.getLength() > 0 ) ! { ! uno::Reference< beans::XPropertySet > xProps; ! lcl_setTableFieldsFromCriteria2( sCriteria2, xProps, sTabFilts2[1] ); ! sTabFilts2[1].IsNumeric = sal_False; ! } ! } ! else // numeric ! { ! Criteria2 >>= sTabFilts2[1].NumericValue; ! sTabFilts2[1].IsNumeric = sal_True; ! sTabFilts2[1].Operator = sheet::FilterOperator2::EQUAL; ! } ! } ! } ! xDesc2->setFilterFields2( sTabFilts2 ); ! if ( !bAll ) ! { ! xDataBaseRange->refresh(); ! } ! else ! // was 0 based now seems to be 1 ! lcl_SetAllQueryForField( pShell, nField, nSheet ); ! } ! else ! { ! uno::Sequence< sheet::TableFilterField > sTabFilts; ! uno::Reference< beans::XPropertySet > xDescProps( xDesc, uno::UNO_QUERY_THROW ); ! if ( Criteria1.hasValue() ) ! { ! sTabFilts.realloc( 1 ); ! sTabFilts[0].Operator = sheet::FilterOperator_EQUAL;// sensible default ! if ( !bCritHasNumericValue ) ! { ! Criteria1 >>= sCriteria1; ! sTabFilts[0].IsNumeric = bCritHasNumericValue; ! if ( bHasCritValue && sCriteria1.getLength() ) ! lcl_setTableFieldsFromCriteria( sCriteria1, xDescProps, sTabFilts[0] ); ! else ! bAll = true; ! } ! else // numeric ! { ! sTabFilts[0].IsNumeric = sal_True; ! sTabFilts[0].NumericValue = nCriteria1; ! } ! } ! else // no value specified ! bAll = true; ! // not sure what the relationship between Criteria1 and Operator is, ! // e.g. can you have a Operator without a Criteria ? in openoffice it ! if ( Operator.hasValue() && ( Operator >>= nOperator ) ) ! { ! // if its a bottom/top Ten(Percent/Value) and there ! // is no value specified for critera1 set it to 10 ! if ( !bCritHasNumericValue && !sCriteria1.getLength() && ( nOperator != excel::XlAutoFilterOperator::xlOr ) && ( nOperator != excel::XlAutoFilterOperator::xlAnd ) ) ! { ! sTabFilts[0].IsNumeric = sal_True; ! sTabFilts[0].NumericValue = 10; ! bAll = false; ! } ! switch ( nOperator ) ! { ! case excel::XlAutoFilterOperator::xlBottom10Items: ! sTabFilts[0].Operator = sheet::FilterOperator_BOTTOM_VALUES; ! break; ! case excel::XlAutoFilterOperator::xlBottom10Percent: ! sTabFilts[0].Operator = sheet::FilterOperator_BOTTOM_PERCENT; ! break; ! case excel::XlAutoFilterOperator::xlTop10Items: ! sTabFilts[0].Operator = sheet::FilterOperator_TOP_VALUES; ! break; ! case excel::XlAutoFilterOperator::xlTop10Percent: ! sTabFilts[0].Operator = sheet::FilterOperator_TOP_PERCENT; ! break; ! case excel::XlAutoFilterOperator::xlOr: ! nConn = sheet::FilterConnection_OR; ! break; ! case excel::XlAutoFilterOperator::xlAnd: ! nConn = sheet::FilterConnection_AND; ! break; ! default: ! throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("UnknownOption") ), uno::Reference< uno::XInterface >() ); ! ! } ! ! } ! if ( !bAll ) ! { ! sTabFilts[0].Connection = sheet::FilterConnection_AND; ! sTabFilts[0].Field = (nField - 1); ! ! rtl::OUString sCriteria2; ! if ( Criteria2.hasValue() ) // there is a Criteria2 ! { ! sTabFilts.realloc(2); ! sTabFilts[1].Field = sTabFilts[0].Field; ! sTabFilts[1].Connection = nConn; ! ! if ( Criteria2 >>= sCriteria2 ) ! { ! if ( sCriteria2.getLength() > 0 ) ! { ! uno::Reference< beans::XPropertySet > xProps; ! lcl_setTableFieldsFromCriteria( sCriteria2, xProps, sTabFilts[1] ); ! sTabFilts[1].IsNumeric = sal_False; ! } ! } ! else // numeric ! { ! Criteria2 >>= sTabFilts[1].NumericValue; ! sTabFilts[1].IsNumeric = sal_True; ! sTabFilts[1].Operator = sheet::FilterOperator_EQUAL; ! } ! } ! } ! ! xDesc->setFilterFields( sTabFilts ); ! if ( !bAll ) ! { ! xDataBaseRange->refresh(); ! } ! else ! // was 0 based now seems to be 1 ! lcl_SetAllQueryForField( pShell, nField, nSheet ); ! } } else { diff -cNr i35579old/xmloff/inc/xmlkywd.hxx i35579new/xmloff/inc/xmlkywd.hxx *** i35579old/xmloff/inc/xmlkywd.hxx Thu Feb 28 19:21:42 2008 --- i35579new/xmloff/inc/xmlkywd.hxx Wed Apr 9 10:40:02 2008 *************** *** 1998,2001 **** --- 1998,2008 ---- 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 -cNr i35579old/xmloff/inc/xmloff/xmltoken.hxx i35579new/xmloff/inc/xmloff/xmltoken.hxx *** i35579old/xmloff/inc/xmloff/xmltoken.hxx Sat Mar 8 01:49:04 2008 --- i35579new/xmloff/inc/xmloff/xmltoken.hxx Wed Apr 9 10:43:18 2008 *************** *** 2963,2968 **** --- 2963,2974 ---- XML_NEAR_ORIGIN, XML_DEPENDENCY, 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_AUTOMATIC_CONTENT, XML_DISPLAY_R_SQUARE, XML_DISPLAY_EQUATION, diff -cNr i35579old/xmloff/source/core/xmltoken.cxx i35579new/xmloff/source/core/xmltoken.cxx *** i35579old/xmloff/source/core/xmltoken.cxx Sat Mar 8 01:49:06 2008 --- i35579new/xmloff/source/core/xmltoken.cxx Wed Apr 9 10:43:20 2008 *************** *** 2962,2967 **** --- 2962,2973 ---- 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( "automatic-content", XML_AUTOMATIC_CONTENT ), TOKEN( "display-r-square", XML_DISPLAY_R_SQUARE ), TOKEN( "display-equation", XML_DISPLAY_EQUATION ),