Kaydet (Commit) d4a51391 authored tarafından Kohei Yoshida's avatar Kohei Yoshida

Correctly import multi-value filter settings.

We are still not 100% compatible, e.g. Excel's "show blanks" setting
is not cleanly mapped (partly due to ODF's limitation).  But that's
a future TODO.
üst af4435c5
...@@ -54,8 +54,9 @@ struct ApiFilterSettings ...@@ -54,8 +54,9 @@ struct ApiFilterSettings
explicit ApiFilterSettings(); explicit ApiFilterSettings();
void appendField( bool bAnd, sal_Int32 nOperator, double fValue ); void appendField( bool bAnd, sal_Int32 nOperator, double fValue );
void appendField( bool bAnd, sal_Int32 nOperator, const ::rtl::OUString& rValue ); void appendField( bool bAnd, sal_Int32 nOperator, const ::rtl::OUString& rValue );
void appendField( bool bAnd, const std::vector<rtl::OUString>& rValues );
}; };
// ============================================================================ // ============================================================================
......
...@@ -189,6 +189,21 @@ void ApiFilterSettings::appendField( bool bAnd, sal_Int32 nOperator, const OUStr ...@@ -189,6 +189,21 @@ void ApiFilterSettings::appendField( bool bAnd, sal_Int32 nOperator, const OUStr
rFilterField.Values[0].StringValue = rValue; rFilterField.Values[0].StringValue = rValue;
} }
void ApiFilterSettings::appendField( bool bAnd, const std::vector<rtl::OUString>& rValues )
{
maFilterFields.resize( maFilterFields.size() + 1 );
TableFilterField3& rFilterField = maFilterFields.back();
rFilterField.Connection = bAnd ? FilterConnection_AND : FilterConnection_OR;
rFilterField.Operator = FilterOperator2::EQUAL;
size_t n = rValues.size();
rFilterField.Values.realloc(n);
for (size_t i = 0; i < n; ++i)
{
rFilterField.Values[i].IsNumeric = false;
rFilterField.Values[i].StringValue = rValues[i];
}
}
// ============================================================================ // ============================================================================
FilterSettingsBase::FilterSettingsBase( const WorkbookHelper& rHelper ) : FilterSettingsBase::FilterSettingsBase( const WorkbookHelper& rHelper ) :
...@@ -276,8 +291,7 @@ ApiFilterSettings DiscreteFilter::finalizeImport( sal_Int32 nMaxCount ) ...@@ -276,8 +291,7 @@ ApiFilterSettings DiscreteFilter::finalizeImport( sal_Int32 nMaxCount )
aSettings.maFilterFields.reserve( maValues.size() ); aSettings.maFilterFields.reserve( maValues.size() );
// insert all filter values // insert all filter values
for( FilterValueVector::iterator aIt = maValues.begin(), aEnd = maValues.end(); aIt != aEnd; ++aIt ) aSettings.appendField( true, maValues );
aSettings.appendField( false, FilterOperator2::EQUAL, *aIt );
// extra field for 'show empty' // extra field for 'show empty'
if( mbShowBlank ) if( mbShowBlank )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment