Switch to TableFilterField3, but no other changes.

This commit is contained in:
Kohei Yoshida 2011-11-29 17:17:59 -05:00
parent 24497be469
commit af4435c5a4
2 changed files with 20 additions and 16 deletions

View file

@ -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<com::sun::star::sheet::TableFilterField3> 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;

View file

@ -30,9 +30,9 @@
#include <com/sun/star/sheet/FilterConnection.hpp>
#include <com/sun/star/sheet/FilterOperator2.hpp>
#include <com/sun/star/sheet/TableFilterField2.hpp>
#include <com/sun/star/sheet/TableFilterField3.hpp>
#include <com/sun/star/sheet/XDatabaseRange.hpp>
#include <com/sun/star/sheet/XSheetFilterDescriptor2.hpp>
#include <com/sun/star/sheet/XSheetFilterDescriptor3.hpp>
#include <com/sun/star/table/TableOrientation.hpp>
#include <rtl/ustrbuf.hxx>
#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<XSheetFilterDescriptor3>& 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<TableFilterField3> 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;