Re: [Libreoffice] [PATCH] fix for fdo#37880: import of formulas with range names from xlsx fail

2011-06-23 Thread Markus Mohrhard
Pushed it to master after Noel had a look at the uno part.

Kohei can you have a look at the calc part?

2011/6/22 Markus Mohrhard markus.mohrh...@googlemail.com

 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

___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


[Libreoffice] [PATCH] fix for fdo#37880: import of formulas with range names from xlsx fail

2011-06-22 Thread Markus Mohrhard
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.mohrh...@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 voidSetIndex( sal_uInt16 n );
 virtual booloperator==( 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.getsal_Int32();
-if ( eOpCode == ocName || eOpCode == ocDBArea )
+if ( eOpCode == ocDBArea )
 AddToken( formula::FormulaIndexToken( eOpCode, static_castsal_uInt16(nValue) ) );
 else if ( eOpCode == ocSpaces )
 AddToken( formula::FormulaByteToken( ocSpaces, static_castsal_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_castsal_uInt8(mbGlobal); }
 voidFormulaIndexToken::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.mohrh...@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