[Libreoffice-commits] core.git: sc/source

Eike Rathke erack at redhat.com
Thu Oct 27 10:07:42 UTC 2016


 sc/source/filter/inc/defnamesbuffer.hxx |    4 ++--
 sc/source/filter/oox/defnamesbuffer.cxx |   10 ++++++----
 2 files changed, 8 insertions(+), 6 deletions(-)

New commits:
commit e641c1740f36ce11c9f178193f74a53ac7af8465
Author: Eike Rathke <erack at redhat.com>
Date:   Thu Oct 27 12:06:46 2016 +0200

    Resolves: tdf#103530 OOXML: pass ExternalLinkInfo compiling named expressions
    
    Change-Id: If15aa520b93f30b889e5f950185068ef3bdb9235

diff --git a/sc/source/filter/inc/defnamesbuffer.hxx b/sc/source/filter/inc/defnamesbuffer.hxx
index 7cf4fba..7a2417d 100644
--- a/sc/source/filter/inc/defnamesbuffer.hxx
+++ b/sc/source/filter/inc/defnamesbuffer.hxx
@@ -99,8 +99,8 @@ public:
     /** Creates a defined name in the Calc document. */
     void                createNameObject( sal_Int32 nIndex );
     /** Converts the formula string or BIFF token array for this defined name. */
-    void                convertFormula();
-    std::unique_ptr<ScTokenArray> getScTokens();
+    void                convertFormula( const css::uno::Sequence<css::sheet::ExternalLinkInfo>& rExternalLinks );
+    std::unique_ptr<ScTokenArray> getScTokens( const css::uno::Sequence<css::sheet::ExternalLinkInfo>& rExternalLinks );
     /** Returns true, if this defined name is global in the document. */
     inline bool         isGlobalName() const { return mnCalcSheet < 0; }
     /** Returns true, if this defined name is a special builtin name. */
diff --git a/sc/source/filter/oox/defnamesbuffer.cxx b/sc/source/filter/oox/defnamesbuffer.cxx
index 7584055..b03d78b 100644
--- a/sc/source/filter/oox/defnamesbuffer.cxx
+++ b/sc/source/filter/oox/defnamesbuffer.cxx
@@ -322,11 +322,13 @@ void DefinedName::createNameObject( sal_Int32 nIndex )
     mnTokenIndex = nIndex;
 }
 
-std::unique_ptr<ScTokenArray> DefinedName::getScTokens()
+std::unique_ptr<ScTokenArray> DefinedName::getScTokens(
+        const css::uno::Sequence<css::sheet::ExternalLinkInfo>& rExternalLinks )
 {
     ScTokenArray aTokenArray;
     ScCompiler aCompiler(&getScDocument(), ScAddress(0, 0, mnCalcSheet));
     aCompiler.SetGrammar(formula::FormulaGrammar::GRAM_OOXML);
+    aCompiler.SetExternalLinks( rExternalLinks);
     std::unique_ptr<ScTokenArray> pArray(aCompiler.CompileString(maModel.maFormula));
     // Compile the tokens into RPN once to populate information into tokens
     // where necessary, e.g. for TableRef inner reference. RPN can be discarded
@@ -339,7 +341,7 @@ std::unique_ptr<ScTokenArray> DefinedName::getScTokens()
     return pArray;
 }
 
-void DefinedName::convertFormula()
+void DefinedName::convertFormula( const css::uno::Sequence<css::sheet::ExternalLinkInfo>& rExternalLinks )
 {
     // macro function or vba procedure
     if(!mpScRangeData)
@@ -347,7 +349,7 @@ void DefinedName::convertFormula()
 
     // convert and set formula of the defined name
     {
-        std::unique_ptr<ScTokenArray> pTokenArray = getScTokens();
+        std::unique_ptr<ScTokenArray> pTokenArray = getScTokens( rExternalLinks);
         mpScRangeData->SetCode( *pTokenArray );
     }
 
@@ -445,7 +447,7 @@ void DefinedNamesBuffer::finalizeImport()
 
     /*  Now convert all name formulas, so that the formula parser can find all
         names in case of circular dependencies. */
-    maDefNames.forEachMem( &DefinedName::convertFormula );
+    maDefNames.forEachMem( &DefinedName::convertFormula, getExternalLinks().getLinkInfos());
 }
 
 DefinedNameRef DefinedNamesBuffer::getByIndex( sal_Int32 nIndex ) const


More information about the Libreoffice-commits mailing list