sc/inc/address.hxx | 6 +++--- sc/inc/compiler.hxx | 10 +++++----- sc/inc/tokenuno.hxx | 2 +- sc/source/core/tool/address.cxx | 12 ++++++------ sc/source/core/tool/compiler.cxx | 14 +++++--------- sc/source/filter/oox/formulabuffer.cxx | 21 ++++++++++++++------- 6 files changed, 34 insertions(+), 31 deletions(-)
New commits: commit 86af0776a09fd49cbd8339350e3b699100c0142a Author: Kohei Yoshida <kohei.yosh...@collabora.com> Date: Mon Feb 24 16:02:20 2014 -0500 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 (cherry picked from commit 4917cebdb988223be47b0f1a82241ade643bc675) Reviewed-on: https://gerrit.libreoffice.org/8212 Tested-by: Markus Mohrhard <markus.mohrh...@googlemail.com> Reviewed-by: Markus Mohrhard <markus.mohrh...@googlemail.com> diff --git a/sc/inc/address.hxx b/sc/inc/address.hxx index f764e08..608a505 100644 --- a/sc/inc/address.hxx +++ b/sc/inc/address.hxx @@ -286,7 +286,7 @@ public: const Details& rDetails = detailsOOOa1, ExternalInfo* pExtInfo = NULL, const ::com::sun::star::uno::Sequence< - const ::com::sun::star::sheet::ExternalLinkInfo > * pExternalLinks = NULL ); + com::sun::star::sheet::ExternalLinkInfo>* pExternalLinks = NULL ); SC_DLLPUBLIC OUString Format( sal_uInt16 = 0, const ScDocument* = NULL, const Details& rDetails = detailsOOOa1) const; @@ -450,7 +450,7 @@ public: const ScAddress::Details& rDetails = ScAddress::detailsOOOa1, ScAddress::ExternalInfo* pExtInfo = NULL, const ::com::sun::star::uno::Sequence< - const ::com::sun::star::sheet::ExternalLinkInfo > * pExternalLinks = NULL ); + com::sun::star::sheet::ExternalLinkInfo>* pExternalLinks = NULL ); SC_DLLPUBLIC sal_uInt16 ParseAny( const OUString&, ScDocument* = NULL, const ScAddress::Details& rDetails = ScAddress::detailsOOOa1 ); @@ -483,7 +483,7 @@ public: OUString& rExternDocName, OUString& rStartTabName, OUString& rEndTabName, sal_uInt16& nFlags, bool bOnlyAcceptSingle, const ::com::sun::star::uno::Sequence< - const ::com::sun::star::sheet::ExternalLinkInfo > * pExternalLinks = NULL ); + com::sun::star::sheet::ExternalLinkInfo>* pExternalLinks = NULL ); SC_DLLPUBLIC OUString Format(sal_uInt16 = 0, const ScDocument* = NULL, const ScAddress::Details& rDetails = ScAddress::detailsOOOa1) const; diff --git a/sc/inc/compiler.hxx b/sc/inc/compiler.hxx index 78f896e..b88ecd5 100644 --- a/sc/inc/compiler.hxx +++ b/sc/inc/compiler.hxx @@ -254,7 +254,7 @@ public: 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 = 0; + com::sun::star::sheet::ExternalLinkInfo>* pExternalLinks ) const = 0; virtual OUString makeExternalNameStr( const OUString& rFile, const OUString& rName ) const = 0; @@ -318,7 +318,7 @@ private: SvNumberFormatter* mpFormatter; // For CONV_XL_OOX, may be set via API by MOOXML filter. - ::com::sun::star::uno::Sequence< const ::com::sun::star::sheet::ExternalLinkInfo > maExternalLinks; + com::sun::star::uno::Sequence<com::sun::star::sheet::ExternalLinkInfo> maExternalLinks; sal_Unicode cSymbol[MAXSTRLEN]; // current Symbol OUString aFormula; // formula source code @@ -431,9 +431,9 @@ private: public: /// Set external link info for ScAddress::CONV_XL_OOX. - inline void SetExternalLinks( - const ::com::sun::star::uno::Sequence< - const ::com::sun::star::sheet::ExternalLinkInfo > & rLinks ) + void SetExternalLinks( + const ::com::sun::star::uno::Sequence< + com::sun::star::sheet::ExternalLinkInfo>& rLinks ) { maExternalLinks = rLinks; } diff --git a/sc/inc/tokenuno.hxx b/sc/inc/tokenuno.hxx index 4287405..408298d 100644 --- a/sc/inc/tokenuno.hxx +++ b/sc/inc/tokenuno.hxx @@ -56,7 +56,7 @@ class ScFormulaParserObj : public ::cppu::WeakImplHelper3< { private: ::com::sun::star::uno::Sequence< const ::com::sun::star::sheet::FormulaOpCodeMapEntry > maOpCodeMapping; - ::com::sun::star::uno::Sequence< const ::com::sun::star::sheet::ExternalLinkInfo > maExternalLinks; + ::com::sun::star::uno::Sequence<com::sun::star::sheet::ExternalLinkInfo> maExternalLinks; ScCompiler::OpCodeMapPtr mxOpCodeMap; ScDocShell* mpDocShell; sal_Int16 mnConv; diff --git a/sc/source/core/tool/address.cxx b/sc/source/core/tool/address.cxx index bda4a5a..3ed6213 100644 --- a/sc/source/core/tool/address.cxx +++ b/sc/source/core/tool/address.cxx @@ -384,7 +384,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()) @@ -435,7 +435,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; @@ -882,7 +882,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 @@ -1271,7 +1271,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; @@ -1354,7 +1354,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 ); } @@ -1487,7 +1487,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 22a5035..4c63a4b 100644 --- a/sc/source/core/tool/compiler.cxx +++ b/sc/source/core/tool/compiler.cxx @@ -455,7 +455,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. */ @@ -819,8 +819,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); } @@ -1052,8 +1051,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); } @@ -1268,8 +1266,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); } @@ -1449,8 +1446,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 9f4404b..ca241a6 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(); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits