diff options
author | Katarina Behrens <bubli@bubli.org> | 2015-03-27 16:03:11 +0100 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2015-04-20 11:22:11 +0000 |
commit | 589f7cbe3789224a8836f3cd4705f067be6789c5 (patch) | |
tree | 743a229f864909fe09da1b5d23e671b484e7151f | |
parent | 2cd486b1dd75d530d8c12eb223e5f215fa8f1944 (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.
+ add a const version of getDocImport method, need to use it in
the new getAllSheetCount method
Change-Id: I5d57a822da5fe5a97029b83406e8ff877a5dbd7c
Reviewed-on: https://gerrit.libreoffice.org/15030
Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
Tested-by: Miklos Vajna <vmiklos@collabora.co.uk>
Reviewed-on: https://gerrit.libreoffice.org/15325
Reviewed-by: Eike Rathke <erack@redhat.com>
Tested-by: Eike Rathke <erack@redhat.com>
-rw-r--r-- | sc/source/filter/inc/workbookhelper.hxx | 1 | ||||
-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/workbookhelper.cxx | 5 | ||||
-rw-r--r-- | sc/source/filter/oox/worksheetbuffer.cxx | 6 |
5 files changed, 21 insertions, 0 deletions
diff --git a/sc/source/filter/inc/workbookhelper.hxx b/sc/source/filter/inc/workbookhelper.hxx index 892992543912..3b5bb232604d 100644 --- a/sc/source/filter/inc/workbookhelper.hxx +++ b/sc/source/filter/inc/workbookhelper.hxx @@ -149,6 +149,7 @@ public: const ScDocument& getScDocument() const; ScDocumentImport& getDocImport(); + const ScDocumentImport& getDocImport() const; ScEditEngineDefaulter& getEditEngine() const; /** Returns a reference to the source/target spreadsheet document model. */ 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 9fc8ca27a34f..db3918f6ec8d 100644 --- a/sc/source/filter/oox/pivotcachefragment.cxx +++ b/sc/source/filter/oox/pivotcachefragment.cxx @@ -22,7 +22,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/workbookhelper.cxx b/sc/source/filter/oox/workbookhelper.cxx index 1e6d31967ecd..50455f33d029 100644 --- a/sc/source/filter/oox/workbookhelper.cxx +++ b/sc/source/filter/oox/workbookhelper.cxx @@ -798,6 +798,11 @@ ScDocumentImport& WorkbookHelper::getDocImport() return mrBookGlob.getDocImport(); } +const ScDocumentImport& WorkbookHelper::getDocImport() const +{ + return mrBookGlob.getDocImport(); +} + ScEditEngineDefaulter& WorkbookHelper::getEditEngine() const { return mrBookGlob.getEditEngine(); diff --git a/sc/source/filter/oox/worksheetbuffer.cxx b/sc/source/filter/oox/worksheetbuffer.cxx index 2655e10e070b..c30b9b55d12e 100644 --- a/sc/source/filter/oox/worksheetbuffer.cxx +++ b/sc/source/filter/oox/worksheetbuffer.cxx @@ -84,6 +84,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(); |