diff options
author | Caolán McNamara <caolanm@redhat.com> | 2014-10-13 11:03:19 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2014-10-13 12:18:03 +0100 |
commit | 17e68606b7c5001edf2ebede5e7d5ea0e0b9753f (patch) | |
tree | e269090e9a1640cc56a048ffa0b262fcb7def87c /sc | |
parent | b1e9163b5929f68860b56b04112fb76d303f6388 (diff) |
fdo#84872 give each SheetDataContext a new FormulaParser
Change-Id: I120a9d0943db38571892defe1b5d3169158e3e42
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/filter/inc/sheetdatacontext.hxx | 2 | ||||
-rw-r--r-- | sc/source/filter/inc/workbookhelper.hxx | 4 | ||||
-rw-r--r-- | sc/source/filter/oox/sheetdatacontext.cxx | 6 | ||||
-rw-r--r-- | sc/source/filter/oox/workbookhelper.cxx | 11 |
4 files changed, 16 insertions, 7 deletions
diff --git a/sc/source/filter/inc/sheetdatacontext.hxx b/sc/source/filter/inc/sheetdatacontext.hxx index 2d02f20ece7f..206d36500f65 100644 --- a/sc/source/filter/inc/sheetdatacontext.hxx +++ b/sc/source/filter/inc/sheetdatacontext.hxx @@ -36,7 +36,7 @@ namespace xls { struct SheetDataContextBase { AddressConverter& mrAddressConv; /// The address converter. - FormulaParser& mrFormulaParser; /// The formula parser. + std::unique_ptr<FormulaParser> mxFormulaParser; /// The formula parser, different one for each SheetDataContext SheetDataBuffer& mrSheetData; /// The sheet data buffer for cell content and formatting. CellModel maCellData; /// Position, contents, formatting of current imported cell. CellFormulaModel maFmlaData; /// Settings for a cell formula. diff --git a/sc/source/filter/inc/workbookhelper.hxx b/sc/source/filter/inc/workbookhelper.hxx index 510474b55383..90fdca461685 100644 --- a/sc/source/filter/inc/workbookhelper.hxx +++ b/sc/source/filter/inc/workbookhelper.hxx @@ -244,8 +244,10 @@ public: // converters ------------------------------------------------------------- - /** Returns the import formula parser (import filter only!). */ + /** Returns a shared import formula parser (import filter only!). */ FormulaParser& getFormulaParser() const; + /** Returns an unshared import formula parser (import filter only!). */ + FormulaParser* createFormulaParser() const; /** Returns the measurement unit converter. */ UnitConverter& getUnitConverter() const; /** Returns the converter for string to cell address/range conversion. */ diff --git a/sc/source/filter/oox/sheetdatacontext.cxx b/sc/source/filter/oox/sheetdatacontext.cxx index f6ca6a41c714..5105d2561f35 100644 --- a/sc/source/filter/oox/sheetdatacontext.cxx +++ b/sc/source/filter/oox/sheetdatacontext.cxx @@ -64,10 +64,10 @@ const sal_uInt8 BIFF12_ROW_SHOWPHONETIC = 0x01; SheetDataContextBase::SheetDataContextBase( const WorksheetHelper& rHelper ) : mrAddressConv( rHelper.getAddressConverter() ), - mrFormulaParser( rHelper.getFormulaParser() ), mrSheetData( rHelper.getSheetData() ), mnSheet( rHelper.getSheetIndex() ) { + mxFormulaParser.reset(rHelper.createFormulaParser()); } SheetDataContextBase::~SheetDataContextBase() @@ -426,7 +426,7 @@ bool SheetDataContext::readCellHeader( SequenceInputStream& rStrm, CellType eCel ApiTokenSequence SheetDataContext::readCellFormula( SequenceInputStream& rStrm ) { rStrm.skip( 2 ); - return mrFormulaParser.importFormula( maCellData.maCellAddr, FORMULATYPE_CELL, rStrm ); + return mxFormulaParser->importFormula( maCellData.maCellAddr, FORMULATYPE_CELL, rStrm ); } bool SheetDataContext::readFormulaRef( SequenceInputStream& rStrm ) @@ -536,7 +536,7 @@ void SheetDataContext::importArray( SequenceInputStream& rStrm ) if( readFormulaRef( rStrm ) && maFmlaData.isValidArrayRef( maCellData.maCellAddr ) ) { rStrm.skip( 1 ); - ApiTokenSequence aTokens = mrFormulaParser.importFormula( maCellData.maCellAddr, FORMULATYPE_ARRAY, rStrm ); + ApiTokenSequence aTokens = mxFormulaParser->importFormula( maCellData.maCellAddr, FORMULATYPE_ARRAY, rStrm ); mrSheetData.createArrayFormula( maFmlaData.maFormulaRef, aTokens ); } } diff --git a/sc/source/filter/oox/workbookhelper.cxx b/sc/source/filter/oox/workbookhelper.cxx index 06ecc600b27b..0dc581bc45e7 100644 --- a/sc/source/filter/oox/workbookhelper.cxx +++ b/sc/source/filter/oox/workbookhelper.cxx @@ -202,8 +202,10 @@ public: // converters ------------------------------------------------------------- - /** Returns the import formula parser. */ + /** Returns a shared import formula parser. */ inline FormulaParser& getFormulaParser() const { return *mxFmlaParser; } + /** Returns an unshared import formula parser. */ + inline FormulaParser* createFormulaParser() { return new FormulaParser(*this); } /** Returns the measurement unit converter. */ inline UnitConverter& getUnitConverter() const { return *mxUnitConverter; } /** Returns the converter for string to cell address/range conversion. */ @@ -590,7 +592,7 @@ void WorkbookGlobals::initialize( bool bWorkbookFile ) mpDoc->EnableExecuteLink(false); mxProgressBar.reset( new SegmentProgressBar( mrBaseFilter.getStatusIndicator(), ScGlobal::GetRscString(STR_LOAD_DOC) ) ); - mxFmlaParser.reset( new FormulaParser( *this ) ); + mxFmlaParser.reset( createFormulaParser() ); //prevent unnecessary broadcasts and "half way listeners" as //is done in ScDocShell::BeforeXMLLoading() for ods @@ -958,6 +960,11 @@ FormulaParser& WorkbookHelper::getFormulaParser() const return mrBookGlob.getFormulaParser(); } +FormulaParser* WorkbookHelper::createFormulaParser() const +{ + return mrBookGlob.createFormulaParser(); +} + UnitConverter& WorkbookHelper::getUnitConverter() const { return mrBookGlob.getUnitConverter(); |