Date: prev next · Thread: first prev next last
2011 Archives by date, by thread · List index


Hi all,

I have fixed the problem behind fdo#37880 (fdo#38204 with similar symptoms
is not yet fixed). When we added local range names we forgot to adjust the
formula uno api(at least the global part of it). We need to save whether we
have a local range name or a global one. We lost this information when we
passed the information to the global part of the formula api and did not
gain them back when we converted them back to the local part of the formula
api.

I think that this is an important fix for 3.4.2 but we shouldn't push it to
the 3-4 branch before Kohei had a look at it. But I'd appreciate any
suggestions around this code before I push it to master.

Regards,
Markus
From 837233152cdae35727f0fbecacc16bd7c0da9912 Mon Sep 17 00:00:00 2001
From: Markus Mohrhard <markus.mohrhard@googlemail.com>
Date: Wed, 22 Jun 2011 15:51:02 +0200
Subject: [PATCH] fix for fdo#37880

we need to save the information if we have a global range name or a
local range name in the uno api too
---
 formula/inc/formula/token.hxx     |   10 ++++++----
 formula/source/core/api/token.cxx |    3 ++-
 2 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/formula/inc/formula/token.hxx b/formula/inc/formula/token.hxx
index fe47cc6..25541af 100644
--- a/formula/inc/formula/token.hxx
+++ b/formula/inc/formula/token.hxx
@@ -302,14 +302,16 @@ class FORMULA_DLLPUBLIC FormulaIndexToken : public FormulaToken
 {
 private:
             sal_uInt16              nIndex;
+            bool mbGlobal;
 public:
-                                FormulaIndexToken( OpCode e, sal_uInt16 n ) :
-                                    FormulaToken(  svIndex, e ), nIndex( n ) {}
+                                FormulaIndexToken( OpCode e, sal_uInt16 n, bool bGlobal = true ) :
+                                    FormulaToken(  svIndex, e ), nIndex( n ), mbGlobal( bGlobal ) 
{}
                                 FormulaIndexToken( const FormulaIndexToken& r ) :
-                                    FormulaToken( r ), nIndex( r.nIndex ) {}
+                                    FormulaToken( r ), nIndex( r.nIndex ), mbGlobal( r.mbGlobal ) 
{}
 
     virtual FormulaToken*       Clone() const { return new FormulaIndexToken(*this); }
-    virtual sal_uInt16              GetIndex() const;
+    virtual sal_uInt16          GetIndex() const;
+    virtual sal_uInt8           GetByte() const;
     virtual void                SetIndex( sal_uInt16 n );
     virtual bool                operator==( const FormulaToken& rToken ) const;
 };
diff --git a/formula/source/core/api/token.cxx b/formula/source/core/api/token.cxx
index 4f92f3e..a150804 100644
--- a/formula/source/core/api/token.cxx
+++ b/formula/source/core/api/token.cxx
@@ -303,7 +303,7 @@ bool FormulaTokenArray::AddFormulaToken(const sheet::FormulaToken& _aToken,Exter
             {
                 // long is svIndex, used for name / database area, or "byte" for spaces
                 sal_Int32 nValue = _aToken.Data.get<sal_Int32>();
-                if ( eOpCode == ocName || eOpCode == ocDBArea )
+                if ( eOpCode == ocDBArea )
                     AddToken( formula::FormulaIndexToken( eOpCode, static_cast<sal_uInt16>(nValue) 
) );
                 else if ( eOpCode == ocSpaces )
                     AddToken( formula::FormulaByteToken( ocSpaces, static_cast<sal_uInt8>(nValue) 
) );
@@ -1347,6 +1347,7 @@ bool FormulaStringOpToken::operator==( const FormulaToken& r ) const
 }
 
 sal_uInt16  FormulaIndexToken::GetIndex() const                  { return nIndex; }
+sal_uInt8   FormulaIndexToken::GetByte() const    {return static_cast<sal_uInt8>(mbGlobal); }
 void    FormulaIndexToken::SetIndex( sal_uInt16 n )              { nIndex = n; }
 bool FormulaIndexToken::operator==( const FormulaToken& r ) const
 {
-- 
1.7.3.4

From 479b3e133aceacb82a4fa9a5e84875d02950387d Mon Sep 17 00:00:00 2001
From: Markus Mohrhard <markus.mohrhard@googlemail.com>
Date: Wed, 22 Jun 2011 16:01:12 +0200
Subject: [PATCH] fix for fdo 37880

we need to save the information if we have a global range name or a
local range name in the uno api too
---
 offapi/UnoApi_offapi.mk                 |    1 +
 offapi/com/sun/star/sheet/NameToken.idl |   53 +++++++++++++++++++++++++++++++
 offapi/com/sun/star/sheet/makefile.mk   |    1 +
 3 files changed, 55 insertions(+), 0 deletions(-)
 create mode 100644 offapi/com/sun/star/sheet/NameToken.idl

diff --git a/offapi/UnoApi_offapi.mk b/offapi/UnoApi_offapi.mk
index ab9c0e5..237cf66 100644
--- a/offapi/UnoApi_offapi.mk
+++ b/offapi/UnoApi_offapi.mk
@@ -2902,6 +2902,7 @@ $(eval $(call gb_UnoApiTarget_add_idlfiles,offapi,\
     offapi/com/sun/star/sheet/MemberResultFlags \
     offapi/com/sun/star/sheet/MoveDirection \
     offapi/com/sun/star/sheet/NamedRangeFlag \
+    offapi/com/sun/star/sheet/NameToken \
     offapi/com/sun/star/sheet/NoConvergenceException \
     offapi/com/sun/star/sheet/PasteOperation \
     offapi/com/sun/star/sheet/RangeSelectionEvent \
diff --git a/offapi/com/sun/star/sheet/NameToken.idl b/offapi/com/sun/star/sheet/NameToken.idl
new file mode 100644
index 0000000..5bd57d6
--- /dev/null
+++ b/offapi/com/sun/star/sheet/NameToken.idl
@@ -0,0 +1,53 @@
+/*
+ * Version: MPL 1.1 / GPLv3+ / LGPLv3+
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License or as specified alternatively below. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Initial Developer of the Original Code is
+ *       Markus Mohrhard <markus.mohrhard@googlemail.com>
+ * Portions created by the Initial Developer are Copyright (C) 2010 the
+ * Initial Developer. All Rights Reserved.
+ *
+ * Major Contributor(s):
+ *
+ * For minor contributions see the git repository.
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
+ * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
+ * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
+ * instead of those above.
+ */
+
+#ifndef __com_sun_star_sheet_NameToken_idl__
+#define __com_sun_star_sheet_NameToken_idl__
+
+//=============================================================================
+
+module com {  module sun {  module star {  module sheet {
+
+//=============================================================================
+
+/** contains the information regarding named tokens
+ */
+struct NameToken
+{
+    long Index;
+
+    boolean Global;
+};
+
+//=============================================================================
+
+}; }; }; };
+
+#endif
+
diff --git a/offapi/com/sun/star/sheet/makefile.mk b/offapi/com/sun/star/sheet/makefile.mk
index 10bb43d..26901cb 100644
--- a/offapi/com/sun/star/sheet/makefile.mk
+++ b/offapi/com/sun/star/sheet/makefile.mk
@@ -166,6 +166,7 @@ IDLFILES=\
     NamedRangeFlag.idl\
     NamedRanges.idl\
     NamedRangesEnumeration.idl\
+    NameToken.idl\
     NoConvergenceException.idl\
     PasteOperation.idl\
     RangeSelectionArguments.idl\
-- 
1.7.3.4

From 1541f1dda2ff4909d9a4d95f1f4d0e03dcba6b14 Mon Sep 17 00:00:00 2001
From: Markus Mohrhard <markus.mohrhard@googlemail.com>
Date: Wed, 22 Jun 2011 15:47:21 +0200
Subject: [PATCH] fix for fdo#37880

we need to save the information if we have a local range name or a
global range name in the uno api too
---
 sc/source/core/tool/token.cxx    |    8 ++++++++
 sc/source/ui/unoobj/tokenuno.cxx |    8 +++++++-
 2 files changed, 15 insertions(+), 1 deletions(-)

diff --git a/sc/source/core/tool/token.cxx b/sc/source/core/tool/token.cxx
index 69017e1..9e8c821 100644
--- a/sc/source/core/tool/token.cxx
+++ b/sc/source/core/tool/token.cxx
@@ -56,6 +56,7 @@ using ::std::vector;
 #include <com/sun/star/sheet/ComplexReference.hpp>
 #include <com/sun/star/sheet/ExternalReference.hpp>
 #include <com/sun/star/sheet/ReferenceFlags.hpp>
+#include <com/sun/star/sheet/NameToken.hpp>
 
 using namespace formula;
 using namespace com::sun::star;
@@ -1174,6 +1175,13 @@ bool ScTokenArray::AddFormulaToken(const 
com::sun::star::sheet::FormulaToken& _a
                         else
                             bError = true;
                     }
+                    else if ( aType.equals( cppu::UnoType<sheet::NameToken>::get() ) )
+                    {
+                        sheet::NameToken aTokenData;
+                        _aToken.Data >>= aTokenData;
+                        if ( eOpCode == ocName )
+                            AddRangeName(aTokenData.Index, aTokenData.Global);
+                    }
                     else if ( aType.equals( cppu::UnoType<sheet::ExternalReference>::get() ) )
                     {
                         sheet::ExternalReference aApiExtRef;
diff --git a/sc/source/ui/unoobj/tokenuno.cxx b/sc/source/ui/unoobj/tokenuno.cxx
index 95e350c..5f89de8 100644
--- a/sc/source/ui/unoobj/tokenuno.cxx
+++ b/sc/source/ui/unoobj/tokenuno.cxx
@@ -37,6 +37,7 @@
 #include <com/sun/star/sheet/ExternalReference.hpp>
 #include <com/sun/star/sheet/ReferenceFlags.hpp>
 #include <com/sun/star/sheet/AddressConvention.hpp>
+#include <com/sun/star/sheet/NameToken.hpp>
 #include <com/sun/star/table/CellAddress.hpp>
 
 #include <svl/itemprop.hxx>
@@ -395,7 +396,12 @@ bool ScTokenConversion::ConvertToTokenSequence( ScDocument& rDoc,
                     }
                     break;
                 case svIndex:
-                    rAPI.Data <<= static_cast<sal_Int32>( rToken.GetIndex() );
+                    {
+                        sheet::NameToken aNameToken;
+                        aNameToken.Index = static_cast<sal_Int32>( rToken.GetIndex() );
+                        aNameToken.Global = static_cast<sal_Bool>( rToken.GetByte() );
+                        rAPI.Data <<= aNameToken;
+                    }
                     break;
                 case svMatrix:
                     if (!ScRangeToSequence::FillMixedArray( rAPI.Data, static_cast<const 
ScToken&>(rToken).GetMatrix(), true))
-- 
1.7.3.4


Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.