sc/source/filter/inc/sheetdatacontext.hxx | 2 +- sc/source/filter/inc/workbookhelper.hxx | 4 +++- sc/source/filter/oox/sheetdatacontext.cxx | 6 +++--- sc/source/filter/oox/workbookhelper.cxx | 11 +++++++++-- 4 files changed, 16 insertions(+), 7 deletions(-)
New commits: commit 17e68606b7c5001edf2ebede5e7d5ea0e0b9753f Author: Caolán McNamara <caol...@redhat.com> Date: Mon Oct 13 11:03:19 2014 +0100 fdo#84872 give each SheetDataContext a new FormulaParser Change-Id: I120a9d0943db38571892defe1b5d3169158e3e42 diff --git a/sc/source/filter/inc/sheetdatacontext.hxx b/sc/source/filter/inc/sheetdatacontext.hxx index 2d02f20..206d365 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 510474b..90fdca4 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 f6ca6a4..5105d25 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 06ecc60..0dc581b 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();
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits