From 7df05a4b4bbc91a2abf51f27976f1aebf92f9a14 Mon Sep 17 00:00:00 2001 From: Eike Rathke Date: Mon, 29 Jan 2018 18:19:33 +0100 Subject: CheckLinkFormulaNeedingCheck() for named expressions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is a combination of 3 commits. CheckLinkFormulaNeedingCheck() for .ods named expressions This is specifically necessary for named expressions that are used in conditional format formulas, for which RPN is generated at a later stage, not during import. (cherry picked from commit eae9648e99be53ba441d9d8207aac6f3ce211ef2) CheckLinkFormulaNeedingCheck() for .xls named expressions (cherry picked from commit 8512f13c42ae3fbb287a555616fe10ff04295616) CheckLinkFormulaNeedingCheck() for .xlsx named expressions (cherry picked from commit a1f933ee2b9e23a505d937035821e9571cf4119c) Conflicts: sc/source/filter/oox/defnamesbuffer.cxx e03cb5767c34f8157a492a6d6c3b0700d065052d 217c89822ab477a6c383d170ae739e44efd10fa3 Change-Id: I54ab8dc14f81d6b18b0d17f448187d19d8e396fc Reviewed-on: https://gerrit.libreoffice.org/48858 Tested-by: Jenkins Reviewed-by: Caolán McNamara Tested-by: Caolán McNamara (cherry picked from commit 908854a7b281454332af434be9468ec45d420030) --- sc/source/core/tool/rangenam.cxx | 8 +++++++- sc/source/filter/excel/xiname.cxx | 3 +++ sc/source/filter/oox/defnamesbuffer.cxx | 2 ++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/sc/source/core/tool/rangenam.cxx b/sc/source/core/tool/rangenam.cxx index eae117c08434..18cbabb1cd93 100644 --- a/sc/source/core/tool/rangenam.cxx +++ b/sc/source/core/tool/rangenam.cxx @@ -64,9 +64,14 @@ ScRangeData::ScRangeData( ScDocument* pDok, mnMaxCol (-1) { if (!rSymbol.isEmpty()) - CompileRangeData( rSymbol, pDoc->IsImportingXML()); + { // Let the compiler set an error on unknown names for a subsequent // CompileUnresolvedXML(). + const bool bImporting = pDoc->IsImportingXML(); + CompileRangeData( rSymbol, bImporting); + if (bImporting) + pDoc->CheckLinkFormulaNeedingCheck( *pCode); + } else { // #i63513#/#i65690# don't leave pCode as NULL. @@ -199,6 +204,7 @@ void ScRangeData::CompileUnresolvedXML( sc::CompileFormulaContext& rCxt ) // Don't let the compiler set an error for unknown names on final // compile, errors are handled by the interpreter thereafter. CompileRangeData( aSymbol, false); + rCxt.getDoc()->CheckLinkFormulaNeedingCheck( *pCode); } } diff --git a/sc/source/filter/excel/xiname.cxx b/sc/source/filter/excel/xiname.cxx index 7189c2a0a2f2..efc181921091 100644 --- a/sc/source/filter/excel/xiname.cxx +++ b/sc/source/filter/excel/xiname.cxx @@ -265,7 +265,10 @@ void XclImpName::InsertName(const ScTokenArray* pArray) } } if (pData) + { + GetDoc().CheckLinkFormulaNeedingCheck( *pData->GetCode()); mpScData = pData; // cache for later use + } } XclImpNameManager::XclImpNameManager( const XclImpRoot& rRoot ) : diff --git a/sc/source/filter/oox/defnamesbuffer.cxx b/sc/source/filter/oox/defnamesbuffer.cxx index 79457ab57e5f..a1d10906c687 100644 --- a/sc/source/filter/oox/defnamesbuffer.cxx +++ b/sc/source/filter/oox/defnamesbuffer.cxx @@ -38,6 +38,7 @@ #include "tokenarray.hxx" #include "tokenuno.hxx" #include "compiler.hxx" +#include "document.hxx" namespace oox { namespace xls { @@ -334,6 +335,7 @@ std::unique_ptr DefinedName::getScTokens( // after, a resulting error must be reset. FormulaError nErr = pArray->GetCodeError(); aCompiler.CompileTokenArray(); + getScDocument().CheckLinkFormulaNeedingCheck( *pArray); pArray->DelRPN(); pArray->SetCodeError(nErr); -- cgit v1.2.3