summaryrefslogtreecommitdiff
path: root/oox/source/xls/pivotcachefragment.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'oox/source/xls/pivotcachefragment.cxx')
-rw-r--r--oox/source/xls/pivotcachefragment.cxx49
1 files changed, 29 insertions, 20 deletions
diff --git a/oox/source/xls/pivotcachefragment.cxx b/oox/source/xls/pivotcachefragment.cxx
index d49077af4f91..f6948917701a 100644
--- a/oox/source/xls/pivotcachefragment.cxx
+++ b/oox/source/xls/pivotcachefragment.cxx
@@ -208,18 +208,23 @@ void PivotCacheDefinitionFragment::finalizeImport()
{
OUString aRecFragmentPath = getRelations().getFragmentPathFromRelId( mrPivotCache.getRecordsRelId() );
if( aRecFragmentPath.getLength() > 0 )
- importOoxFragment( new PivotCacheRecordsFragment( *this, aRecFragmentPath, mrPivotCache ) );
+ {
+ sal_Int16 nSheet = mrPivotCache.getSourceRange().Sheet;
+ WorksheetGlobalsRef xSheetGlob = WorksheetHelper::constructGlobals( *this, ISegmentProgressBarRef(), SHEETTYPE_WORKSHEET, nSheet );
+ if( xSheetGlob.get() )
+ importOoxFragment( new PivotCacheRecordsFragment( *xSheetGlob, aRecFragmentPath, mrPivotCache ) );
+ }
}
}
// ============================================================================
-PivotCacheRecordsFragment::PivotCacheRecordsFragment( const WorkbookHelper& rHelper,
+PivotCacheRecordsFragment::PivotCacheRecordsFragment( const WorksheetHelper& rHelper,
const OUString& rFragmentPath, const PivotCache& rPivotCache ) :
- WorksheetFragmentBase( rHelper, rFragmentPath, ISegmentProgressBarRef(), SHEETTYPE_WORKSHEET, rPivotCache.getSourceRange().Sheet ),
+ WorksheetFragmentBase( rHelper, rFragmentPath ),
mrPivotCache( rPivotCache ),
- mnCol( 0 ),
- mnRow( 0 ),
+ mnColIdx( 0 ),
+ mnRowIdx( 0 ),
mbInRecord( false )
{
// prepare sheet: insert column header names into top row
@@ -252,8 +257,8 @@ ContextHandlerRef PivotCacheRecordsFragment::onCreateContext( sal_Int32 nElement
case XLS_TOKEN( x ): aItem.readIndex( rAttribs ); break;
default: OSL_ENSURE( false, "PivotCacheRecordsFragment::onCreateContext - unexpected element" );
}
- mrPivotCache.writeSourceDataCell( *this, mnCol, mnRow, aItem );
- ++mnCol;
+ mrPivotCache.writeSourceDataCell( *this, mnColIdx, mnRowIdx, aItem );
+ ++mnColIdx;
}
break;
}
@@ -294,15 +299,15 @@ const RecordInfo* PivotCacheRecordsFragment::getRecordInfos() const
void PivotCacheRecordsFragment::startCacheRecord()
{
- mnCol = 0;
- ++mnRow;
+ mnColIdx = 0;
+ ++mnRowIdx;
mbInRecord = true;
}
void PivotCacheRecordsFragment::importPCRecord( SequenceInputStream& rStrm )
{
startCacheRecord();
- mrPivotCache.importPCRecord( rStrm, *this, mnRow );
+ mrPivotCache.importPCRecord( rStrm, *this, mnRowIdx );
mbInRecord = false;
}
@@ -322,8 +327,8 @@ void PivotCacheRecordsFragment::importPCRecordItem( sal_Int32 nRecId, SequenceIn
case BIFF12_ID_PCITEM_INDEX: aItem.readIndex( rStrm ); break;
default: OSL_ENSURE( false, "PivotCacheRecordsFragment::importPCRecordItem - unexpected record" );
}
- mrPivotCache.writeSourceDataCell( *this, mnCol, mnRow, aItem );
- ++mnCol;
+ mrPivotCache.writeSourceDataCell( *this, mnColIdx, mnRowIdx, aItem );
+ ++mnColIdx;
}
}
@@ -373,10 +378,14 @@ bool BiffPivotCacheFragment::importFragment()
{
/* Last call of lclSeekToPCDField() failed and kept stream position
unchanged. Stream should point to source data table now. */
- BiffPivotCacheRecordsContext aContext( *this, mrPivotCache );
- if( aContext.isValidSheet() )
+ sal_Int16 nSheet = mrPivotCache.getSourceRange().Sheet;
+ WorksheetGlobalsRef xSheetGlob = WorksheetHelper::constructGlobals( *this, ISegmentProgressBarRef(), SHEETTYPE_WORKSHEET, nSheet );
+ if( xSheetGlob.get() )
+ {
+ BiffPivotCacheRecordsContext aContext( *xSheetGlob, mrPivotCache );
while( rStrm.startNextRecord() && (rStrm.getRecId() != BIFF_ID_EOF) )
aContext.importRecord( rStrm );
+ }
}
}
@@ -385,11 +394,11 @@ bool BiffPivotCacheFragment::importFragment()
// ============================================================================
-BiffPivotCacheRecordsContext::BiffPivotCacheRecordsContext( const WorkbookHelper& rHelper, const PivotCache& rPivotCache ) :
- BiffWorksheetContextBase( rHelper, ISegmentProgressBarRef(), SHEETTYPE_WORKSHEET, rPivotCache.getSourceRange().Sheet ),
+BiffPivotCacheRecordsContext::BiffPivotCacheRecordsContext( const WorksheetHelper& rHelper, const PivotCache& rPivotCache ) :
+ BiffWorksheetContextBase( rHelper ),
mrPivotCache( rPivotCache ),
mnColIdx( 0 ),
- mnRow( 0 ),
+ mnRowIdx( 0 ),
mbHasShared( false ),
mbInRow( false )
{
@@ -418,7 +427,7 @@ void BiffPivotCacheRecordsContext::importRecord( BiffInputStream& rStrm )
OSL_ENSURE( mbHasShared, "BiffPivotCacheRecordsContext::importRecord - unexpected PCITEM_INDEXLIST record" );
// PCITEM_INDEXLIST record always in front of a new data row
startNextRow();
- mrPivotCache.importPCItemIndexList( rStrm, *this, mnRow );
+ mrPivotCache.importPCItemIndexList( rStrm, *this, mnRowIdx );
mbInRow = !maUnsharedCols.empty(); // mbInRow remains true, if unshared items are expected
return;
}
@@ -449,14 +458,14 @@ void BiffPivotCacheRecordsContext::importRecord( BiffInputStream& rStrm )
// write the item data to the sheet cell
OSL_ENSURE( mnColIdx < maUnsharedCols.size(), "BiffPivotCacheRecordsContext::importRecord - invalid column index" );
if( mnColIdx < maUnsharedCols.size() )
- mrPivotCache.writeSourceDataCell( *this, maUnsharedCols[ mnColIdx ], mnRow, aItem );
+ mrPivotCache.writeSourceDataCell( *this, maUnsharedCols[ mnColIdx ], mnRowIdx, aItem );
++mnColIdx;
}
void BiffPivotCacheRecordsContext::startNextRow()
{
mnColIdx = 0;
- ++mnRow;
+ ++mnRowIdx;
mbInRow = true;
}