diff options
author | Katarina Behrens <bubli@bubli.org> | 2015-03-12 23:30:02 +0100 |
---|---|---|
committer | Katarina Behrens <bubli@bubli.org> | 2015-03-20 15:17:48 +0100 |
commit | 529e9b61171f3155a76fe68e3019f5f3eb23bc4e (patch) | |
tree | 59f0beef041d41056f5612bdc980c39e14292b5d /sc | |
parent | abae860fa702b56fb11164ebb98acb4681e49cc1 (diff) |
tdf#89597: Resize formula buffers after adding a dummy sheet
for pivot table cache records.
Regression from commit d17a83fa549f828f29e6939. On loading pivot table
cache records, a dummy sheet is created to store them. Formula buffers
are now vectors, not maps and need to be resized in such case.
Change-Id: Ib6abeac1b139ffb74579712017eed2194cff592b
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/filter/inc/worksheetbuffer.hxx | 3 | ||||
-rw-r--r-- | sc/source/filter/oox/pivotcachefragment.cxx | 6 | ||||
-rw-r--r-- | sc/source/filter/oox/worksheetbuffer.cxx | 7 |
3 files changed, 16 insertions, 0 deletions
diff --git a/sc/source/filter/inc/worksheetbuffer.hxx b/sc/source/filter/inc/worksheetbuffer.hxx index 69fafa118af1..35e9c66eae23 100644 --- a/sc/source/filter/inc/worksheetbuffer.hxx +++ b/sc/source/filter/inc/worksheetbuffer.hxx @@ -24,6 +24,7 @@ #include <oox/helper/refmap.hxx> #include <oox/helper/refvector.hxx> #include "workbookhelper.hxx" +#include "documentimport.hxx" namespace com { namespace sun { namespace star { namespace i18n { class XCharacterClassification; } @@ -65,6 +66,8 @@ public: /** Returns the number of original sheets contained in the workbook. */ sal_Int32 getWorksheetCount() const; + /** Returns the number of all sheets, workbook + dummy ones (pivot table cache records ) */ + sal_Int32 getAllSheetCount() const; /** Returns the OOXML relation identifier of the specified worksheet. */ OUString getWorksheetRelId( sal_Int32 nWorksheet ) const; diff --git a/sc/source/filter/oox/pivotcachefragment.cxx b/sc/source/filter/oox/pivotcachefragment.cxx index d6ee51d1c70a..e90656ccb9ab 100644 --- a/sc/source/filter/oox/pivotcachefragment.cxx +++ b/sc/source/filter/oox/pivotcachefragment.cxx @@ -23,7 +23,9 @@ #include <oox/helper/attributelist.hxx> #include "addressconverter.hxx" #include "biffinputstream.hxx" +#include "formulabuffer.hxx" #include "pivotcachebuffer.hxx" +#include "worksheetbuffer.hxx" namespace oox { namespace xls { @@ -210,8 +212,12 @@ PivotCacheRecordsFragment::PivotCacheRecordsFragment( const WorksheetHelper& rHe mnRowIdx( 0 ), mbInRecord( false ) { + sal_Int32 nSheetCount = rPivotCache.getWorksheets().getAllSheetCount(); + // prepare sheet: insert column header names into top row rPivotCache.writeSourceHeaderCells( *this ); + // resize formula buffers since we've added a new dummy sheet + rHelper.getFormulaBuffer().SetSheetCount( nSheetCount ); } ContextHandlerRef PivotCacheRecordsFragment::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ) diff --git a/sc/source/filter/oox/worksheetbuffer.cxx b/sc/source/filter/oox/worksheetbuffer.cxx index 4f3bec9461f7..9d680dcc5205 100644 --- a/sc/source/filter/oox/worksheetbuffer.cxx +++ b/sc/source/filter/oox/worksheetbuffer.cxx @@ -86,6 +86,12 @@ sal_Int32 WorksheetBuffer::getWorksheetCount() const return static_cast< sal_Int32 >( maSheetInfos.size() ); } +sal_Int32 WorksheetBuffer::getAllSheetCount() const +{ + const ScDocumentImport& rDoc = getDocImport(); + return rDoc.getSheetCount(); +} + OUString WorksheetBuffer::getWorksheetRelId( sal_Int32 nWorksheet ) const { const SheetInfo* pSheetInfo = maSheetInfos.get( nWorksheet ).get(); @@ -166,6 +172,7 @@ WorksheetBuffer::SheetInfo::SheetInfo( const SheetInfoModel& rModel, sal_Int16 n WorksheetBuffer::IndexNamePair WorksheetBuffer::createSheet( const OUString& rPreferredName, sal_Int32 nSheetPos, bool bVisible ) { + //FIXME: Rewrite this block using ScDocument[Import] instead of UNO try { Reference< XSpreadsheets > xSheets( getDocument()->getSheets(), UNO_QUERY_THROW ); |