summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sc/source/filter/inc/tablebuffer.hxx4
-rw-r--r--sc/source/filter/oox/tablebuffer.cxx28
-rw-r--r--sc/source/filter/oox/worksheethelper.cxx4
3 files changed, 32 insertions, 4 deletions
diff --git a/sc/source/filter/inc/tablebuffer.hxx b/sc/source/filter/inc/tablebuffer.hxx
index 5ed673bb9bf3..d162391c26f3 100644
--- a/sc/source/filter/inc/tablebuffer.hxx
+++ b/sc/source/filter/inc/tablebuffer.hxx
@@ -59,6 +59,7 @@ public:
/** Creates a database range from this tables. */
void finalizeImport();
+ void applyAutoFilters();
/** Returns the unique table identifier. */
inline sal_Int32 getTableId() const { return maModel.mnId; }
@@ -103,7 +104,8 @@ public:
/** Creates database ranges from all imported tables. */
void finalizeImport();
-
+ /** Applies autofilters from created database range ( requires finalizeImport to have run before being called */
+ void applyAutoFilters();
/** Returns a table by its identifier. */
TableRef getTable( sal_Int32 nTableId ) const;
/** Returns a table by its display name. */
diff --git a/sc/source/filter/oox/tablebuffer.cxx b/sc/source/filter/oox/tablebuffer.cxx
index 0748e3ca3bee..87e12007f310 100644
--- a/sc/source/filter/oox/tablebuffer.cxx
+++ b/sc/source/filter/oox/tablebuffer.cxx
@@ -20,6 +20,7 @@
#include "tablebuffer.hxx"
#include <com/sun/star/sheet/XDatabaseRange.hpp>
+#include <com/sun/star/sheet/XDatabaseRanges.hpp>
#include "oox/helper/attributelist.hxx"
#include "oox/helper/binaryinputstream.hxx"
#include "oox/helper/propertyset.hxx"
@@ -97,9 +98,6 @@ void Table::finalizeImport()
PropertySet aPropSet( xDatabaseRange );
if( !aPropSet.getProperty( mnTokenIndex, PROP_TokenIndex ) )
mnTokenIndex = -1;
-
- // filter settings
- maAutoFilters.finalizeImport( xDatabaseRange );
}
catch( Exception& )
{
@@ -107,6 +105,25 @@ void Table::finalizeImport()
}
}
+void Table::applyAutoFilters()
+{
+ if( !maDBRangeName.isEmpty() )
+ {
+ try
+ {
+ // get the range ( maybe we should cache the xDatabaseRange from finalizeImport )
+ PropertySet aDocProps( getDocument() );
+ Reference< XDatabaseRanges > xDatabaseRanges( aDocProps.getAnyProperty( PROP_DatabaseRanges ), UNO_QUERY_THROW );
+ Reference< XDatabaseRange > xDatabaseRange( xDatabaseRanges->getByName( maDBRangeName ), UNO_QUERY );
+ maAutoFilters.finalizeImport( xDatabaseRange );
+ }
+ catch( Exception& )
+ {
+ OSL_FAIL( "Table::applyAutofilters - cannot create filter" );
+ }
+ }
+}
+
// ============================================================================
TableBuffer::TableBuffer( const WorkbookHelper& rHelper ) :
@@ -130,6 +147,11 @@ void TableBuffer::finalizeImport()
maIdTables.forEachMem( &Table::finalizeImport );
}
+void TableBuffer::applyAutoFilters()
+{
+ maIdTables.forEachMem( &Table::applyAutoFilters );
+}
+
TableRef TableBuffer::getTable( sal_Int32 nTableId ) const
{
return maIdTables.get( nTableId );
diff --git a/sc/source/filter/oox/worksheethelper.cxx b/sc/source/filter/oox/worksheethelper.cxx
index f736393fb80f..03bde26dcb87 100644
--- a/sc/source/filter/oox/worksheethelper.cxx
+++ b/sc/source/filter/oox/worksheethelper.cxx
@@ -66,6 +66,7 @@
#include "worksheetbuffer.hxx"
#include "worksheetsettings.hxx"
#include "formulabuffer.hxx"
+#include "tablebuffer.hxx"
namespace oox {
namespace xls {
@@ -943,6 +944,9 @@ void WorksheetGlobals::finalizeWorksheetImport()
{
lclUpdateProgressBar( mxRowProgress, 1.0 );
maSheetData.finalizeImport();
+ // assumes getTables().finalizeImport ( which creates the DatabaseRanges )
+ // has been called already
+ getTables().applyAutoFilters();
lclUpdateProgressBar( mxFinalProgress, 0.25 );
finalizeHyperlinkRanges();
finalizeValidationRanges();