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

Eike Rathke erack at redhat.com
Tue May 3 20:59:15 UTC 2016


 offapi/com/sun/star/sheet/NameToken.idl |    2 +-
 sc/source/core/tool/token.cxx           |   13 +++++--------
 sc/source/ui/unoobj/tokenuno.cxx        |    3 +--
 3 files changed, 7 insertions(+), 11 deletions(-)

New commits:
commit fac5f2af5190e6da9bedfcdf02426be59ad99166
Author: Eike Rathke <erack at redhat.com>
Date:   Tue May 3 22:48:14 2016 +0200

    NameToken with Sheet instead of boolean Global
    
    ... to transport an actual sheet number for other-sheet-local names
    within names when importing OOXML.
    
    Change-Id: I00f2ffe07271c1c2a8ce9e10514e10872396f566

diff --git a/offapi/com/sun/star/sheet/NameToken.idl b/offapi/com/sun/star/sheet/NameToken.idl
index 04f6ed2..9b66038 100644
--- a/offapi/com/sun/star/sheet/NameToken.idl
+++ b/offapi/com/sun/star/sheet/NameToken.idl
@@ -20,7 +20,7 @@ struct NameToken
 {
     long Index;
 
-    boolean Global;
+    long Sheet;
 };
 
 
diff --git a/sc/source/core/tool/token.cxx b/sc/source/core/tool/token.cxx
index fd16ada..11005ea 100644
--- a/sc/source/core/tool/token.cxx
+++ b/sc/source/core/tool/token.cxx
@@ -1219,14 +1219,11 @@ bool ScTokenArray::AddFormulaToken(
                         rToken.Data >>= aTokenData;
                         if ( eOpCode == ocName )
                         {
-                            /* TODO: new token type with sheet number */
-                            if (aTokenData.Global)
-                                AddRangeName(aTokenData.Index, -1);
-                            else
-                                bError = true;
-                            /* FIXME: resolve the non-global case to the
-                             * current position's sheet as it implicitly was
-                             * before, currently this is broken. */
+                            SAL_WARN_IF( aTokenData.Sheet < -1 || std::numeric_limits<sal_Int16>::max() < aTokenData.Sheet,
+                                    "sc.core",
+                                    "ScTokenArray::AddFormulaToken - NameToken.Sheet out of limits: " << aTokenData.Sheet);
+                            sal_Int16 nSheet = static_cast<sal_Int16>(aTokenData.Sheet);
+                            AddRangeName(aTokenData.Index, nSheet);
                         }
                         else if (eOpCode == ocDBArea)
                             AddDBRange(aTokenData.Index);
diff --git a/sc/source/ui/unoobj/tokenuno.cxx b/sc/source/ui/unoobj/tokenuno.cxx
index b1800ce..b8b80de 100644
--- a/sc/source/ui/unoobj/tokenuno.cxx
+++ b/sc/source/ui/unoobj/tokenuno.cxx
@@ -422,8 +422,7 @@ bool ScTokenConversion::ConvertToTokenSequence( const ScDocument& rDoc,
                     {
                         sheet::NameToken aNameToken;
                         aNameToken.Index = static_cast<sal_Int32>( rToken.GetIndex() );
-                        /* FIXME: we need a new token with sheet number */
-                        aNameToken.Global = (rToken.GetSheet() < 0);
+                        aNameToken.Sheet = rToken.GetSheet();
                         rAPI.Data <<= aNameToken;
                     }
                     break;


More information about the Libreoffice-commits mailing list