[Libreoffice-commits] core.git: Branch 'libreoffice-4-4-0' - sc/source

Markus Mohrhard markus.mohrhard at collabora.co.uk
Tue Jan 13 06:47:58 PST 2015


 sc/source/core/tool/compiler.cxx |   31 ++++++++++++++++++++++++++++---
 1 file changed, 28 insertions(+), 3 deletions(-)

New commits:
commit 6d26deaa4c40f554fb6bc036047564d466b361fd
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date:   Sat Dec 27 06:51:52 2014 +0100

    handle index based external refs in formulas in ooxml import, fdo#85617
    
    (cherry picked from commit 18cccd62fb5b730319878df6fac748d5cdf73f1f)
    
    return after finding the reference
    
    (cherry picked from commit cef36587674b6472471478524e87b1add4109507)
    
    that method is the same as in the base class
    
    (cherry picked from commit 02caf8f2eef75d8b5acb6a4ec40277355c3c6c6e)
    
    remove copy&paste code
    
    (cherry picked from commit 757ce63f7346aea132f11c3d9a328b0a1a776403)
    
    a22b97b0a45d8d840095737638c2ccf68373e27a
    8cb6f59795d9461c0e02ab70d7edd60af1410c1f
    5710856fdb9fb91573de89eeb5a29d3d106ad7a6
    
    Change-Id: Ie4f43f041f5d614b9c2826c74574c854af05c266
    Reviewed-on: https://gerrit.libreoffice.org/13837
    Tested-by: Eike Rathke <erack at redhat.com>
    Reviewed-by: Eike Rathke <erack at redhat.com>
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx
index 37c234a..40f1de7 100644
--- a/sc/source/core/tool/compiler.cxx
+++ b/sc/source/core/tool/compiler.cxx
@@ -986,6 +986,10 @@ struct ConventionOOO_A1_ODF : public ConventionOOO_A1
 
 struct ConventionXL
 {
+    virtual ~ConventionXL()
+    {
+    }
+
     static void GetTab(
         const ScAddress& rPos, const std::vector<OUString>& rTabNames,
         const ScSingleRefData& rRef, OUString& rTabName )
@@ -1100,7 +1104,7 @@ struct ConventionXL
         }
     }
 
-    static void parseExternalDocName( const OUString& rFormula, sal_Int32& rSrcPos )
+    virtual void parseExternalDocName( const OUString& rFormula, sal_Int32& rSrcPos ) const
     {
         sal_Int32 nLen = rFormula.getLength();
         const sal_Unicode* p = rFormula.getStr();
@@ -1236,7 +1240,7 @@ struct ConventionXL_A1 : public Convention_A1, public ConventionXL
                                        sal_Int32 nSrcPos,
                                        const CharClass* pCharClass) const SAL_OVERRIDE
     {
-        ConventionXL::parseExternalDocName(rFormula, nSrcPos);
+        parseExternalDocName(rFormula, nSrcPos);
 
         ParseResult aRet;
         if ( lcl_isValidQuotedText(rFormula, nSrcPos, aRet) )
@@ -1322,6 +1326,27 @@ struct ConventionXL_OOX : public ConventionXL_A1
          * CellStr. */
     }
 
+    virtual void parseExternalDocName(const OUString& rFormula, sal_Int32& rSrcPos) const SAL_OVERRIDE
+    {
+        sal_Int32 nLen = rFormula.getLength();
+        const sal_Unicode* p = rFormula.getStr();
+        for (sal_Int32 i = rSrcPos; i < nLen; ++i)
+        {
+            sal_Unicode c = p[i];
+            if (i == rSrcPos)
+            {
+                // first character must be '['.
+                if (c != '[')
+                    return;
+            }
+            else if (c == ']')
+            {
+                rSrcPos = i + 1;
+                return;
+            }
+        }
+    }
+
     virtual void makeExternalRefStr(
         OUStringBuffer& rBuffer, const ScAddress& rPos, sal_uInt16 nFileId, const OUString& /*rFileName*/,
         const OUString& rTabName, const ScSingleRefData& rRef ) const SAL_OVERRIDE
@@ -1461,7 +1486,7 @@ struct ConventionXL_R1C1 : public ScCompiler::Convention, public ConventionXL
                                sal_Int32 nSrcPos,
                                const CharClass* pCharClass) const SAL_OVERRIDE
     {
-        ConventionXL::parseExternalDocName(rFormula, nSrcPos);
+        parseExternalDocName(rFormula, nSrcPos);
 
         ParseResult aRet;
         if ( lcl_isValidQuotedText(rFormula, nSrcPos, aRet) )


More information about the Libreoffice-commits mailing list