diff options
author | Kohei Yoshida <kohei.yoshida@collabora.com> | 2014-02-24 16:02:20 -0500 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@collabora.com> | 2014-02-24 16:05:07 -0500 |
commit | 4917cebdb988223be47b0f1a82241ade643bc675 (patch) | |
tree | 6e681178e37cce491cb4e5e0278509003743ae14 /sc/source | |
parent | 3cf0847e7514a3f1217554c08cb109902cf2a637 (diff) |
fdo#75304: Set external reference info to ScCompiler.
And remove this excessive const fetish which was unfortunately necessary to
get this to compile. Setting the container const is good enough.
Change-Id: I2c6cc55a88643a68e065c4518cdf069c247f4f02
Diffstat (limited to 'sc/source')
-rw-r--r-- | sc/source/core/tool/address.cxx | 12 | ||||
-rw-r--r-- | sc/source/core/tool/compiler.cxx | 14 | ||||
-rw-r--r-- | sc/source/filter/oox/formulabuffer.cxx | 21 |
3 files changed, 25 insertions, 22 deletions
diff --git a/sc/source/core/tool/address.cxx b/sc/source/core/tool/address.cxx index adb1d654e836..3cdd2fe5b1d6 100644 --- a/sc/source/core/tool/address.cxx +++ b/sc/source/core/tool/address.cxx @@ -383,7 +383,7 @@ lcl_XL_ParseSheetRef( const sal_Unicode* start, name is not numeric. */ static bool lcl_XL_getExternalDoc( const sal_Unicode** ppErrRet, OUString& rExternDocName, - const uno::Sequence< const sheet::ExternalLinkInfo > * pExternalLinks) + const uno::Sequence<sheet::ExternalLinkInfo>* pExternalLinks ) { // 1-based, sequence starts with an empty element. if (pExternalLinks && pExternalLinks->hasElements()) @@ -434,7 +434,7 @@ const sal_Unicode* ScRange::Parse_XL_Header( OUString& rEndTabName, sal_uInt16& nFlags, bool bOnlyAcceptSingle, - const uno::Sequence< const sheet::ExternalLinkInfo > * pExternalLinks ) + const uno::Sequence<sheet::ExternalLinkInfo>* pExternalLinks ) { const sal_Unicode* startTabs, *start = p; sal_uInt16 nSaveFlags = nFlags; @@ -881,7 +881,7 @@ lcl_ScRange_Parse_XL_A1( ScRange& r, ScDocument* pDoc, bool bOnlyAcceptSingle, ScAddress::ExternalInfo* pExtInfo, - const uno::Sequence< const sheet::ExternalLinkInfo > * pExternalLinks ) + const uno::Sequence<sheet::ExternalLinkInfo>* pExternalLinks ) { const sal_Unicode* tmp1, *tmp2; OUString aExternDocName, aStartTabName, aEndTabName; // for external link table @@ -1270,7 +1270,7 @@ static sal_uInt16 lcl_ScAddress_Parse ( const sal_Unicode* p, ScDocument* pDoc, ScAddress& rAddr, const ScAddress::Details& rDetails, ScAddress::ExternalInfo* pExtInfo = NULL, - const uno::Sequence< const sheet::ExternalLinkInfo > * pExternalLinks = NULL ) + const uno::Sequence<sheet::ExternalLinkInfo>* pExternalLinks = NULL ) { if( !*p ) return 0; @@ -1353,7 +1353,7 @@ bool ConvertDoubleRef( ScDocument* pDoc, const OUString& rRefString, SCTAB nDefT sal_uInt16 ScAddress::Parse( const OUString& r, ScDocument* pDoc, const Details& rDetails, ExternalInfo* pExtInfo, - const uno::Sequence< const sheet::ExternalLinkInfo > * pExternalLinks ) + const uno::Sequence<sheet::ExternalLinkInfo>* pExternalLinks ) { return lcl_ScAddress_Parse( r.getStr(), pDoc, *this, rDetails, pExtInfo, pExternalLinks ); } @@ -1486,7 +1486,7 @@ lcl_ScRange_Parse_OOo( ScRange &aRange, const OUString& r, ScDocument* pDoc, ScA sal_uInt16 ScRange::Parse( const OUString& r, ScDocument* pDoc, const ScAddress::Details& rDetails, ScAddress::ExternalInfo* pExtInfo, - const uno::Sequence< const sheet::ExternalLinkInfo > * pExternalLinks ) + const uno::Sequence<sheet::ExternalLinkInfo>* pExternalLinks ) { if (r.isEmpty()) return 0; diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx index 1ddbcfbc8b0a..afb8f5fd77a5 100644 --- a/sc/source/core/tool/compiler.cxx +++ b/sc/source/core/tool/compiler.cxx @@ -454,7 +454,7 @@ static bool lcl_parseExternalName( OUString& rName, const sal_Unicode cSep, const ScDocument* pDoc = NULL, - const uno::Sequence< const sheet::ExternalLinkInfo > * pExternalLinks = NULL ) + const uno::Sequence<sheet::ExternalLinkInfo>* pExternalLinks = NULL ) { /* TODO: future versions will have to support sheet-local names too, thus * return a possible sheet name as well. */ @@ -818,8 +818,7 @@ struct ConventionOOO_A1 : public Convention_A1 virtual bool parseExternalName( const OUString& rSymbol, OUString& rFile, OUString& rName, const ScDocument* pDoc, - const ::com::sun::star::uno::Sequence< - const ::com::sun::star::sheet::ExternalLinkInfo > * pExternalLinks ) const + const uno::Sequence<sheet::ExternalLinkInfo>* pExternalLinks ) const { return lcl_parseExternalName(rSymbol, rFile, rName, '#', pDoc, pExternalLinks); } @@ -1045,8 +1044,7 @@ struct ConventionXL static bool parseExternalName( const OUString& rSymbol, OUString& rFile, OUString& rName, const ScDocument* pDoc, - const ::com::sun::star::uno::Sequence< - const ::com::sun::star::sheet::ExternalLinkInfo > * pExternalLinks ) + const uno::Sequence<sheet::ExternalLinkInfo>* pExternalLinks ) { return lcl_parseExternalName( rSymbol, rFile, rName, '!', pDoc, pExternalLinks); } @@ -1261,8 +1259,7 @@ struct ConventionXL_A1 : public Convention_A1, public ConventionXL virtual bool parseExternalName( const OUString& rSymbol, OUString& rFile, OUString& rName, const ScDocument* pDoc, - const ::com::sun::star::uno::Sequence< - const ::com::sun::star::sheet::ExternalLinkInfo > * pExternalLinks ) const + const uno::Sequence<sheet::ExternalLinkInfo>* pExternalLinks ) const { return ConventionXL::parseExternalName( rSymbol, rFile, rName, pDoc, pExternalLinks); } @@ -1436,8 +1433,7 @@ struct ConventionXL_R1C1 : public ScCompiler::Convention, public ConventionXL virtual bool parseExternalName( const OUString& rSymbol, OUString& rFile, OUString& rName, const ScDocument* pDoc, - const ::com::sun::star::uno::Sequence< - const ::com::sun::star::sheet::ExternalLinkInfo > * pExternalLinks ) const + const uno::Sequence<sheet::ExternalLinkInfo>* pExternalLinks ) const { return ConventionXL::parseExternalName( rSymbol, rFile, rName, pDoc, pExternalLinks); } diff --git a/sc/source/filter/oox/formulabuffer.cxx b/sc/source/filter/oox/formulabuffer.cxx index 9f4404b3d6c1..ca241a6b2113 100644 --- a/sc/source/filter/oox/formulabuffer.cxx +++ b/sc/source/filter/oox/formulabuffer.cxx @@ -9,6 +9,7 @@ #include "formulabuffer.hxx" #include "formulaparser.hxx" +#include <externallinkbuffer.hxx> #include <com/sun/star/sheet/XFormulaTokens.hpp> #include <com/sun/star/sheet/XArrayFormulaTokens.hpp> #include <com/sun/star/container/XIndexAccess.hpp> @@ -178,6 +179,7 @@ void applySharedFormulas( void applyCellFormulas( ScDocumentImport& rDoc, CachedTokenArray& rCache, SvNumberFormatter& rFormatter, + const uno::Sequence<sheet::ExternalLinkInfo>& rExternalLinks, const std::vector<FormulaBuffer::TokenAddressItem>& rCells ) { std::vector<FormulaBuffer::TokenAddressItem>::const_iterator it = rCells.begin(), itEnd = rCells.end(); @@ -220,6 +222,7 @@ void applyCellFormulas( ScCompiler aCompiler(&rDoc.getDoc(), aPos); aCompiler.SetNumberFormatter(&rFormatter); aCompiler.SetGrammar(formula::FormulaGrammar::GRAM_OOXML); + aCompiler.SetExternalLinks(rExternalLinks); ScTokenArray* pCode = aCompiler.CompileString(it->maTokenStr); if (!pCode) continue; @@ -271,7 +274,8 @@ void applyCellFormulaValues( } void processSheetFormulaCells( - ScDocumentImport& rDoc, FormulaBuffer::SheetItem& rItem, SvNumberFormatter& rFormatter ) + ScDocumentImport& rDoc, FormulaBuffer::SheetItem& rItem, SvNumberFormatter& rFormatter, + const uno::Sequence<sheet::ExternalLinkInfo>& rExternalLinks ) { if (rItem.mpSharedFormulaEntries && rItem.mpSharedFormulaIDs) applySharedFormulas(rDoc, rFormatter, *rItem.mpSharedFormulaEntries, *rItem.mpSharedFormulaIDs); @@ -279,7 +283,7 @@ void processSheetFormulaCells( if (rItem.mpCellFormulas) { CachedTokenArray aCache(rDoc.getDoc()); - applyCellFormulas(rDoc, aCache, rFormatter, *rItem.mpCellFormulas); + applyCellFormulas(rDoc, aCache, rFormatter, rExternalLinks, *rItem.mpCellFormulas); } if (rItem.mpArrayFormulas) @@ -294,21 +298,24 @@ class WorkerThread : public salhelper::Thread ScDocumentImport& mrDoc; FormulaBuffer::SheetItem& mrItem; boost::scoped_ptr<SvNumberFormatter> mpFormatter; + const uno::Sequence<sheet::ExternalLinkInfo>& mrExternalLinks; WorkerThread( const WorkerThread& ); WorkerThread& operator= ( const WorkerThread& ); public: - WorkerThread( ScDocumentImport& rDoc, FormulaBuffer::SheetItem& rItem, SvNumberFormatter* pFormatter ) : + WorkerThread( + ScDocumentImport& rDoc, FormulaBuffer::SheetItem& rItem, SvNumberFormatter* pFormatter, + const uno::Sequence<sheet::ExternalLinkInfo>& rExternalLinks ) : salhelper::Thread("xlsx-import-formula-buffer-worker-thread"), - mrDoc(rDoc), mrItem(rItem), mpFormatter(pFormatter) {} + mrDoc(rDoc), mrItem(rItem), mpFormatter(pFormatter), mrExternalLinks(rExternalLinks) {} virtual ~WorkerThread() {} protected: virtual void execute() { - processSheetFormulaCells(mrDoc, mrItem, *mpFormatter); + processSheetFormulaCells(mrDoc, mrItem, *mpFormatter, mrExternalLinks); } }; @@ -366,7 +373,7 @@ void FormulaBuffer::finalizeImport() if (nThreadCount == 1) { for (; it != itEnd; ++it) - processSheetFormulaCells(rDoc, *it, *rDoc.getDoc().GetFormatTable()); + processSheetFormulaCells(rDoc, *it, *rDoc.getDoc().GetFormatTable(), getExternalLinks().getLinkInfos()); } else { @@ -384,7 +391,7 @@ void FormulaBuffer::finalizeImport() if (it == itEnd) break; - WorkerThreadRef xThread(new WorkerThread(rDoc, *it, rDoc.getDoc().CreateFormatTable())); + WorkerThreadRef xThread(new WorkerThread(rDoc, *it, rDoc.getDoc().CreateFormatTable(), getExternalLinks().getLinkInfos())); ++it; aThreads.push_back(xThread); xThread->launch(); |