diff options
author | Noel Power <noel.power@suse.com> | 2013-08-15 16:23:46 +0100 |
---|---|---|
committer | Noel Power <noel.power@suse.com> | 2013-08-16 09:16:23 +0100 |
commit | edd51b813005c2159426d8f2917eede5b14a4577 (patch) | |
tree | 6a0a38479d8621646b6b0a6eca097729eeab500e /sc/source/filter/oox/tablebuffer.cxx | |
parent | String->OUString (diff) | |
download | core-edd51b813005c2159426d8f2917eede5b14a4577.tar.gz core-edd51b813005c2159426d8f2917eede5b14a4577.zip |
fix for bnc#834705 missing drop downs for autofilter
After commit fc861c7088e9b639a1c2c80f8ba4535c798aeb34 there is now an order
dependency, between any ScPatternAttr flags indirectly set and
SheetDataBuffer::finalizeImport which sets the attributes directly for a column
So the ATTR_MERGE_FLAG that has ScMergeFlagAttr ( and associated
SC_MF_AUTO flag ) is scrubbed when by the direct writting of the attribute
from SheetDataBuffer::finalizeImport -> Document::SetAttrEntries
I've reordered that Table import here and split the finalize ( which happens
before heetDataBuffer::finalizeImport ) so that the databaseranges which were
created before sheet import still happens, the autofilter part of the import
is now deferred ( until after SheetDataBuffer::finalizeImport )
Change-Id: I11bb45ee7b330760fd93ecca30b23399414ac3a7
Diffstat (limited to 'sc/source/filter/oox/tablebuffer.cxx')
-rw-r--r-- | sc/source/filter/oox/tablebuffer.cxx | 28 |
1 files changed, 25 insertions, 3 deletions
diff --git a/sc/source/filter/oox/tablebuffer.cxx b/sc/source/filter/oox/tablebuffer.cxx index 672e11cb358b..4dc61a06c137 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" @@ -96,9 +97,6 @@ void Table::finalizeImport() PropertySet aPropSet( xDatabaseRange ); if( !aPropSet.getProperty( mnTokenIndex, PROP_TokenIndex ) ) mnTokenIndex = -1; - - // filter settings - maAutoFilters.finalizeImport( xDatabaseRange ); } catch( Exception& ) { @@ -106,6 +104,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 ) : @@ -129,6 +146,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 ); |