From af4435c5a4964a86457fe61c3bade42ca3cf236d Mon Sep 17 00:00:00 2001 From: Kohei Yoshida Date: Tue, 29 Nov 2011 17:17:59 -0500 Subject: [PATCH] Switch to TableFilterField3, but no other changes. --- oox/inc/oox/xls/autofilterbuffer.hxx | 10 ++++++---- oox/source/xls/autofilterbuffer.cxx | 26 ++++++++++++++------------ 2 files changed, 20 insertions(+), 16 deletions(-) diff --git a/oox/inc/oox/xls/autofilterbuffer.hxx b/oox/inc/oox/xls/autofilterbuffer.hxx index bc2a98614959..869c2114b098 100644 --- a/oox/inc/oox/xls/autofilterbuffer.hxx +++ b/oox/inc/oox/xls/autofilterbuffer.hxx @@ -34,9 +34,9 @@ #include "oox/xls/workbookhelper.hxx" namespace com { namespace sun { namespace star { - namespace sheet { struct TableFilterField2; } + namespace sheet { struct TableFilterField3; } namespace sheet { class XDatabaseRange; } - namespace sheet { class XSheetFilterDescriptor2; } + namespace sheet { class XSheetFilterDescriptor3; } } } } namespace oox { @@ -47,7 +47,7 @@ namespace xls { /** Contains UNO API filter settings for a column in a filtered range. */ struct ApiFilterSettings { - typedef ::std::vector< ::com::sun::star::sheet::TableFilterField2 > FilterFieldVector; + typedef ::std::vector FilterFieldVector; FilterFieldVector maFilterFields; /// List of UNO API filter settings. OptValue< bool > mobNeedsRegExp; /// If set, requires regular expressions to be enabled/disabled. @@ -236,7 +236,9 @@ public: FilterColumn& createFilterColumn(); /** Applies the filter to the passed filter descriptor. */ - void finalizeImport( const ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XSheetFilterDescriptor2 >& rxFilterDesc ); + void finalizeImport( + const ::com::sun::star::uno::Reference< + ::com::sun::star::sheet::XSheetFilterDescriptor3>& rxFilterDesc ); private: typedef RefVector< FilterColumn > FilterColumnVector; diff --git a/oox/source/xls/autofilterbuffer.cxx b/oox/source/xls/autofilterbuffer.cxx index 0ffcdf6a151b..dd3fc5acf31d 100644 --- a/oox/source/xls/autofilterbuffer.cxx +++ b/oox/source/xls/autofilterbuffer.cxx @@ -30,9 +30,9 @@ #include #include -#include +#include #include -#include +#include #include #include #include "oox/helper/attributelist.hxx" @@ -170,21 +170,23 @@ ApiFilterSettings::ApiFilterSettings() void ApiFilterSettings::appendField( bool bAnd, sal_Int32 nOperator, double fValue ) { maFilterFields.resize( maFilterFields.size() + 1 ); - TableFilterField2& rFilterField = maFilterFields.back(); + TableFilterField3& rFilterField = maFilterFields.back(); rFilterField.Connection = bAnd ? FilterConnection_AND : FilterConnection_OR; rFilterField.Operator = nOperator; - rFilterField.IsNumeric = sal_True; - rFilterField.NumericValue = fValue; + rFilterField.Values.realloc(1); + rFilterField.Values[0].IsNumeric = true; + rFilterField.Values[0].NumericValue = fValue; } void ApiFilterSettings::appendField( bool bAnd, sal_Int32 nOperator, const OUString& rValue ) { maFilterFields.resize( maFilterFields.size() + 1 ); - TableFilterField2& rFilterField = maFilterFields.back(); + TableFilterField3& rFilterField = maFilterFields.back(); rFilterField.Connection = bAnd ? FilterConnection_AND : FilterConnection_OR; rFilterField.Operator = nOperator; - rFilterField.IsNumeric = sal_False; - rFilterField.StringValue = rValue; + rFilterField.Values.realloc(1); + rFilterField.Values[0].IsNumeric = false; + rFilterField.Values[0].StringValue = rValue; } // ============================================================================ @@ -669,7 +671,7 @@ FilterColumn& AutoFilter::createFilterColumn() return *xFilterColumn; } -void AutoFilter::finalizeImport( const Reference< XSheetFilterDescriptor2 >& rxFilterDesc ) +void AutoFilter::finalizeImport( const Reference& rxFilterDesc ) { if( rxFilterDesc.is() ) { @@ -687,7 +689,7 @@ void AutoFilter::finalizeImport( const Reference< XSheetFilterDescriptor2 >& rxF OSL_ENSURE( nMaxCount > 0, "AutoFilter::finalizeImport - invalid maximum filter field count" ); // resulting list of all UNO API filter fields - ::std::vector< TableFilterField2 > aFilterFields; + ::std::vector aFilterFields; // track if columns require to enable or disable regular expressions OptValue< bool > obNeedsRegExp; @@ -742,7 +744,7 @@ void AutoFilter::finalizeImport( const Reference< XSheetFilterDescriptor2 >& rxF // insert all filter fields to the filter descriptor if( !aFilterFields.empty() ) - rxFilterDesc->setFilterFields2( ContainerHelper::vectorToSequence( aFilterFields ) ); + rxFilterDesc->setFilterFields3( ContainerHelper::vectorToSequence( aFilterFields ) ); // regular expressions bool bUseRegExp = obNeedsRegExp.get( false ); @@ -828,7 +830,7 @@ bool AutoFilterBuffer::finalizeImport( const Reference< XDatabaseRange >& rxData PropertySet aRangeProps( rxDatabaseRange ); aRangeProps.setProperty( PROP_AutoFilter, true ); // convert filter settings using the filter descriptor of the database range - Reference< XSheetFilterDescriptor2 > xFilterDesc( rxDatabaseRange->getFilterDescriptor(), UNO_QUERY_THROW ); + Reference< XSheetFilterDescriptor3 > xFilterDesc( rxDatabaseRange->getFilterDescriptor(), UNO_QUERY_THROW ); pAutoFilter->finalizeImport( xFilterDesc ); // return true to indicate enabled autofilter return true;