ooo-build r11524 - in trunk: . patches/src680



Author: pmladek
Date: Thu Feb  7 16:53:19 2008
New Revision: 11524
URL: http://svn.gnome.org/viewvc/ooo-build?rev=11524&view=rev

Log:
2008-02-07  Kohei Yoshida  <kyoshida novell com>

	* patches/src680/sc-localized-arg-separator.diff: allow comma as a cell
	  separators in functions; n#358558



Added:
   trunk/patches/src680/sc-localized-arg-separator.diff
Modified:
   trunk/ChangeLog
   trunk/patches/src680/apply

Modified: trunk/patches/src680/apply
==============================================================================
--- trunk/patches/src680/apply	(original)
+++ trunk/patches/src680/apply	Thu Feb  7 16:53:19 2008
@@ -1598,6 +1598,12 @@
 
 writerfilter-source-resourcemodel-util_cxx.diff
 
+[ CalcFixes ]
+
+# Allow comma as a cell separators in functions
+# The patch depends on the cws-xmlfilter03 stuff
+sc-localized-arg-separator.diff, n#358558, kohei
+
 [ OOXSTLport5 ]
 SectionOwner => hmth
 

Added: trunk/patches/src680/sc-localized-arg-separator.diff
==============================================================================
--- (empty file)
+++ trunk/patches/src680/sc-localized-arg-separator.diff	Thu Feb  7 16:53:19 2008
@@ -0,0 +1,796 @@
+Only in sc: Debug
+diff -urp --exclude=CVS --exclude=unxlngi6.pro --exclude=sc.vpj sc.clean/inc/compiler.hxx sc/inc/compiler.hxx
+--- sc.clean/inc/compiler.hxx	2008-02-05 11:16:54.000000000 -0500
++++ sc/inc/compiler.hxx	2008-02-06 14:13:41.000000000 -0500
+@@ -236,26 +236,6 @@ typedef ::std::hash_map< String, String,
+ class SC_DLLPUBLIC ScCompiler
+ {
+ public:
+-	struct Convention
+-	{
+-		const ScAddress::Convention meConv;
+-		const ULONG*   				mpCharTable;
+-
+-
+-		Convention( ScAddress::Convention eConvP );
+-        virtual ~Convention();
+-
+-		virtual void MakeRefStr( rtl::OUStringBuffer&	rBuffer,
+-								 const ScCompiler&		rCompiler,
+-								 const ComplRefData&	rRef,
+-								 BOOL bSingleRef ) const = 0;
+-		virtual ::com::sun::star::i18n::ParseResult
+-					parseAnyToken( const String& rFormula,
+-								   xub_StrLen nSrcPos,
+-								   const CharClass* pCharClass) const = 0;
+-	};
+-    friend struct Convention;
+-
+     /** Mappings from strings to OpCodes and vice versa. */
+     class OpCodeMap
+     {
+@@ -362,6 +342,30 @@ private:
+     typedef ::boost::shared_ptr< const OpCodeMap > OpCodeMapPtr;
+     typedef ::boost::shared_ptr< OpCodeMap > NonConstOpCodeMapPtr;
+ 
++    struct Convention
++    {
++        const ScAddress::Convention meConv;
++        const ULONG*                mpCharTable;
++
++
++        Convention( ScAddress::Convention eConvP );
++        virtual ~Convention();
++
++        virtual void MakeRefStr( rtl::OUStringBuffer&   rBuffer,
++                                 const ScCompiler&      rCompiler,
++                                 const ComplRefData&    rRef,
++                                 BOOL bSingleRef ) const = 0;
++        virtual ::com::sun::star::i18n::ParseResult
++                    parseAnyToken( const String& rFormula,
++                                   xub_StrLen nSrcPos,
++                                   const CharClass* pCharClass) const = 0;
++
++        virtual const String& GetSymbol( const OpCodeMapPtr& rpMap, OpCode e ) const = 0;
++
++        virtual OpCode GetOpCode( const OpCodeMapPtr& rpMap, const String& rName ) const = 0;
++    };
++    friend struct Convention;
++
+ private:
+ 
+     static NonConstOpCodeMapPtr  mxSymbolsODFF;                          // ODFF symbols
+@@ -539,7 +543,8 @@ public:
+     const ScDocument* GetDoc() const { return pDoc; }
+     const ScAddress& GetPos() const { return aPos; }
+ 
+-    static const String& GetStringFromOpCode( OpCode eOpCode, bool bEnglish = false );
++    static const String& GetStringFromOpCode( OpCode eOpCode, bool bEnglish = false, 
++                                              ScAddress::Convention eConv = ScAddress::CONV_OOO );
+ 
+ 	ScToken* CreateStringFromToken( String& rFormula, ScToken* pToken,
+ 									BOOL bAllowArrAdvance = FALSE );
+diff -urp --exclude=CVS --exclude=unxlngi6.pro --exclude=sc.vpj sc.clean/inc/global.hxx sc/inc/global.hxx
+--- sc.clean/inc/global.hxx	2008-02-05 11:16:54.000000000 -0500
++++ sc/inc/global.hxx	2008-02-06 19:27:01.000000000 -0500
+@@ -712,11 +712,11 @@ public:
+     void        InitArgumentInfo() const;
+ 
+     /** Returns a semicolon separated list of all parameter names. */
+-    String  GetParamList        () const;
++    String  GetParamList        ( ScAddress::Convention eConv = ScAddress::CONV_OOO ) const;
+     /** Returns the full function siganture: "FUNCTIONNAME( parameter list )". */
+-	String	GetSignature		() const;
++	String	GetSignature		( ScAddress::Convention eConv = ScAddress::CONV_OOO) const;
+     /** Returns the function siganture with parameters from the passed string array. */
+-	String	GetFormulaString	( String** aArgArr ) const;
++	String	GetFormulaString	( String** aArgArr, ScAddress::Convention eConv = ScAddress::CONV_OOO ) const;
+ 
+ 	USHORT		nFIndex;		// eindeutiger Funktionsindex
+ 	USHORT		nCategory;		// Kategorie
+@@ -786,6 +786,7 @@ class ScFormulaUtil
+ public:
+ 	static BOOL					GetNextFunc( const String&	rFormula,
+ 											 BOOL			bBack,
++                                             ScAddress::Convention eConv,
+ 											 xub_StrLen&	rFStart, // Ein- und Ausgabe
+ 											 xub_StrLen*	pFEnd = NULL,
+ 											 const ScFuncDesc**	ppFDesc = NULL,
+@@ -794,21 +795,27 @@ public:
+ 	static const ScFuncDesc*	GetDefaultFuncDesc();
+ 
+ 	static xub_StrLen			GetFunctionStart( const String& rFormula, xub_StrLen nStart,
+-													BOOL bBack, String* pFuncName = NULL );
++												  BOOL bBack, 
++                                                  ScAddress::Convention eConv,
++                                                  String* pFuncName = NULL );
+ 
+-	static xub_StrLen			GetFunctionEnd	( const String& rFormula, xub_StrLen nStart );
++	static xub_StrLen			GetFunctionEnd	( const String& rFormula, xub_StrLen nStart,
++                                                  ScAddress::Convention eConv );
+ 
+ 	static xub_StrLen			GetArgStart		( const String& rFormula, xub_StrLen nStart,
+-												  USHORT nArg );
++												  USHORT nArg,
++                                                  ScAddress::Convention eConv );
+ 
+ 	static String**				GetArgStrings	( const String&	rFormula,
+ 												  xub_StrLen	nFuncPos,
+-												  USHORT		nArgs );
++												  USHORT		nArgs,
++                                                  ScAddress::Convention eConv );
+ 
+ 	static void					FillArgStrings	( const String&	rFormula,
+ 												  xub_StrLen	nFuncPos,
+ 												  USHORT		nArgs,
+-												  String**		pArgs );
++												  String**		pArgs,
++                                                  ScAddress::Convention eConv );
+ };
+ 
+ //==================================================================
+Only in sc: sc.diff
+diff -urp --exclude=CVS --exclude=unxlngi6.pro --exclude=sc.vpj sc.clean/source/core/data/global.cxx sc/source/core/data/global.cxx
+--- sc.clean/source/core/data/global.cxx	2008-02-05 11:16:59.000000000 -0500
++++ sc/source/core/data/global.cxx	2008-02-06 19:52:06.000000000 -0500
+@@ -1061,22 +1061,23 @@ const ScFuncDesc* ScFormulaUtil::GetDefa
+ 
+ BOOL ScFormulaUtil::GetNextFunc( const String&	rFormula,
+ 								 BOOL			bBack,
++                                 ScAddress::Convention eConv,
+ 								 xub_StrLen&	rFStart,   // Ein- und Ausgabe
+ 								 xub_StrLen*	pFEnd, 	   // = NULL
+ 								 const ScFuncDesc**	ppFDesc,   // = NULL
+-								 String***		pppArgs )  // = NULL
++								 String***		pppArgs )   // = NULL
+ {
+ 	BOOL		bFound = FALSE;
+ 	xub_StrLen	nOldStart = rFStart;
+ 	String		aFname;
+ 
+-	rFStart = GetFunctionStart( rFormula, rFStart, bBack, ppFDesc ? &aFname : NULL );
++	rFStart = GetFunctionStart( rFormula, rFStart, bBack, eConv, ppFDesc ? &aFname : NULL );
+ 	bFound  = ( rFStart != FUNC_NOTFOUND );
+ 
+ 	if ( bFound )
+ 	{
+ 		if ( pFEnd )
+-			*pFEnd = GetFunctionEnd( rFormula, rFStart );
++			*pFEnd = GetFunctionEnd( rFormula, rFStart, eConv );
+ 
+ 		if ( ppFDesc )
+ 		{
+@@ -1085,7 +1086,7 @@ BOOL ScFormulaUtil::GetNextFunc( const S
+ 			if ( *ppFDesc )
+ 			{
+ 				if (pppArgs)
+-					*pppArgs = GetArgStrings( rFormula, rFStart, (*ppFDesc)->nArgCount );
++					*pppArgs = GetArgStrings( rFormula, rFStart, (*ppFDesc)->nArgCount, eConv );
+ 			}
+ 			else
+ 			{
+@@ -1104,7 +1105,8 @@ BOOL ScFormulaUtil::GetNextFunc( const S
+ void ScFormulaUtil::FillArgStrings( const String&	rFormula,
+ 									xub_StrLen		nFuncPos,
+ 									USHORT			nArgs,
+-									String**		aArgArr )
++									String**		aArgArr,
++                                    ScAddress::Convention eConv )
+ {
+ 	if ( !aArgArr ) return;
+ 
+@@ -1115,22 +1117,22 @@ void ScFormulaUtil::FillArgStrings( cons
+ 
+ 	for ( i=0; i<nArgs && !bLast; i++ )
+ 	{
+-		nStart = GetArgStart( rFormula, nFuncPos, i );
++		nStart = GetArgStart( rFormula, nFuncPos, i, eConv );
+ 
+ 		if ( i+1<nArgs ) // letztes Argument?
+ 		{
+-			nEnd = GetArgStart( rFormula, nFuncPos, i+1 );
++			nEnd = GetArgStart( rFormula, nFuncPos, i+1, eConv );
+ 
+ 			if ( nEnd != nStart )
+-				aArgArr[i] = new String( rFormula.Copy( nStart, nEnd-1-nStart ) );
++                aArgArr[i] = new String( rFormula.Copy( nStart, nEnd-1-nStart ) );
+ 			else
+ 				aArgArr[i] = new String, bLast = TRUE;
+ 		}
+ 		else
+ 		{
+-			nEnd = GetFunctionEnd( rFormula, nFuncPos )-1;
++			nEnd = GetFunctionEnd( rFormula, nFuncPos, eConv )-1;
+ 			if ( nStart < nEnd )
+-				aArgArr[i] = new String( rFormula.Copy( nStart, nEnd-nStart ) );
++                aArgArr[i] = new String( rFormula.Copy( nStart, nEnd-nStart ) );
+ 			else
+ 				aArgArr[i] = new String;
+ 		}
+@@ -1145,13 +1147,14 @@ void ScFormulaUtil::FillArgStrings( cons
+ 
+ String** ScFormulaUtil::GetArgStrings( const String& rFormula,
+ 									   xub_StrLen nFuncPos,
+-									   USHORT nArgs )
++									   USHORT nArgs,
++                                       ScAddress::Convention eConv )
+ {
+ 	String** aArgArr = NULL;
+ 	if (nArgs)
+ 	{
+ 		aArgArr = new String*[nArgs];
+-		FillArgStrings( rFormula, nFuncPos, nArgs, aArgArr );
++		FillArgStrings( rFormula, nFuncPos, nArgs, aArgArr, eConv );
+ 	}
+ 	return aArgArr;
+ }
+@@ -1174,6 +1177,7 @@ inline BOOL IsFormulaText( const String&
+ xub_StrLen ScFormulaUtil::GetFunctionStart( const String&	rFormula,
+ 										xub_StrLen		nStart,
+ 										BOOL			bBack,
++                                        ScAddress::Convention eConv,
+ 										String*			pFuncName )
+ {
+ 	xub_StrLen nStrLen = rFormula.Len();
+@@ -1265,8 +1269,10 @@ xub_StrLen ScFormulaUtil::GetFunctionSta
+ 
+ //------------------------------------------------------------------------
+ 
+-xub_StrLen	ScFormulaUtil::GetFunctionEnd( const String& rStr, xub_StrLen nStart )
++xub_StrLen	ScFormulaUtil::GetFunctionEnd( const String& rStr, xub_StrLen nStart,
++                                           ScAddress::Convention eConv )
+ {
++    const sal_Unicode sep = ScCompiler::GetStringFromOpCode(ocSep, false, eConv).GetChar(0);
+ 	xub_StrLen nStrLen = rStr.Len();
+ 
+ 	if ( nStrLen < nStart )
+@@ -1298,7 +1304,7 @@ xub_StrLen	ScFormulaUtil::GetFunctionEnd
+ 				nStart--;	// einen zu weit gelesen
+ 			}
+ 		}
+-		else if ( c == ';' )
++		else if ( c == sep )
+ 		{
+ 			if ( nParCount == 0 )
+ 			{
+@@ -1314,8 +1320,11 @@ xub_StrLen	ScFormulaUtil::GetFunctionEnd
+ 
+ //------------------------------------------------------------------
+ 
+-xub_StrLen ScFormulaUtil::GetArgStart( const String& rStr, xub_StrLen nStart, USHORT nArg )
++xub_StrLen ScFormulaUtil::GetArgStart( const String& rStr, xub_StrLen nStart, USHORT nArg,
++                                       ScAddress::Convention eConv )
+ {
++    const sal_Unicode sep = ScCompiler::GetStringFromOpCode(ocSep, false, eConv).GetChar(0);
++
+ 	xub_StrLen nStrLen = rStr.Len();
+ 
+ 	if ( nStrLen < nStart )
+@@ -1344,7 +1353,7 @@ xub_StrLen ScFormulaUtil::GetArgStart( c
+ 			nParCount--;
+ 			bFound = ( nParCount == 0 );
+ 		}
+-		else if ( c == ';' )
++		else if ( c == sep )
+ 		{
+ 			if ( nParCount == 1 )
+ 			{
+@@ -1702,8 +1711,10 @@ void ScFuncDesc::InitArgumentInfo() cons
+ 
+ //------------------------------------------------------------------------
+ 
+-String ScFuncDesc::GetParamList() const
++String ScFuncDesc::GetParamList( ScAddress::Convention eConv ) const
+ {
++    const String& sep = ScCompiler::GetStringFromOpCode(ocSep, false, eConv);
++
+     String aSig;
+ 
+     if ( nArgCount > 0 )
+@@ -1714,7 +1725,10 @@ String ScFuncDesc::GetParamList() const
+             {
+                 aSig += *(aDefArgNames[i]);
+                 if ( i != nArgCount-1 )
+-                    aSig.AppendAscii(RTL_CONSTASCII_STRINGPARAM( "; " ));
++                {
++                    aSig.Append(sep);
++                    aSig.AppendAscii(RTL_CONSTASCII_STRINGPARAM( " " ));
++                }
+             }
+         }
+         else
+@@ -1723,14 +1737,17 @@ String ScFuncDesc::GetParamList() const
+             for ( USHORT nArg = 0; nArg < nFix; nArg++ )
+             {
+                 aSig += *(aDefArgNames[nArg]);
+-                aSig.AppendAscii(RTL_CONSTASCII_STRINGPARAM( "; " ));
++                aSig.Append(sep);
++                aSig.AppendAscii(RTL_CONSTASCII_STRINGPARAM( " " ));
+             }
+             aSig += *(aDefArgNames[nFix]);
+             aSig += '1';
+-            aSig.AppendAscii(RTL_CONSTASCII_STRINGPARAM( "; " ));
++            aSig.Append(sep);
++            aSig.AppendAscii(RTL_CONSTASCII_STRINGPARAM( " " ));
+             aSig += *(aDefArgNames[nFix]);
+             aSig += '2';
+-            aSig.AppendAscii(RTL_CONSTASCII_STRINGPARAM( "; ... " ));
++            aSig.Append(sep);
++            aSig.AppendAscii(RTL_CONSTASCII_STRINGPARAM( " ... " ));
+         }
+     }
+ 
+@@ -1739,7 +1756,7 @@ String ScFuncDesc::GetParamList() const
+ 
+ //------------------------------------------------------------------------
+ 
+-String ScFuncDesc::GetSignature() const
++String ScFuncDesc::GetSignature( ScAddress::Convention eConv ) const
+ {
+ 	String aSig;
+ 
+@@ -1747,7 +1764,7 @@ String ScFuncDesc::GetSignature() const
+ 	{
+ 		aSig = *pFuncName;
+ 
+-        String aParamList( GetParamList() );
++        String aParamList( GetParamList(eConv) );
+         if( aParamList.Len() )
+         {
+ 			aSig.AppendAscii(RTL_CONSTASCII_STRINGPARAM( "( " ));
+@@ -1763,8 +1780,10 @@ String ScFuncDesc::GetSignature() const
+ 
+ //------------------------------------------------------------------------
+ 
+-String ScFuncDesc::GetFormulaString( String** aArgArr ) const
++String ScFuncDesc::GetFormulaString( String** aArgArr, ScAddress::Convention eConv ) const
+ {
++    const String& sep = ScCompiler::GetStringFromOpCode(ocSep, false, eConv);
++
+ 	String aFormula;
+ 
+ 	if(pFuncName)
+@@ -1787,7 +1806,7 @@ String ScFuncDesc::GetFormulaString( Str
+ 					{
+ 						bLastArg = !( aArgArr[i+1]->Len() > 0 );
+ 						if ( !bLastArg )
+-							aFormula += ';';
++							aFormula += sep;
+ 					}
+ 				}
+ 			}
+diff -urp --exclude=CVS --exclude=unxlngi6.pro --exclude=sc.vpj sc.clean/source/core/tool/compiler.cxx sc/source/core/tool/compiler.cxx
+--- sc.clean/source/core/tool/compiler.cxx	2008-02-05 11:16:59.000000000 -0500
++++ sc/source/core/tool/compiler.cxx	2008-02-06 19:53:12.000000000 -0500
+@@ -439,6 +439,7 @@ void ScCompiler::SetCompileEnglish( BOOL
+         if (!pCharClassEnglish)
+             InitCharClassEnglish();
+         pCharClass = pCharClassEnglish;
++        SetRefConvention(ScAddress::CONV_OOO); // hack!  when compiling English, it's most likely handling ODF formula syntax.
+     }
+     else
+     {
+@@ -928,7 +929,7 @@ for (i = 97; i < 123; i++)
+ /* ) */     t[41] |=   SC_COMPILER_C_WORD;
+ /* * */     t[42] |=   SC_COMPILER_C_WORD;
+ /* + */     t[43] |=   SC_COMPILER_C_WORD;
+-#if 0 /* this really needs to be locale specific. */
++#if 1 /* this really needs to be locale specific. */
+ /* , */     t[44]  =   SC_COMPILER_C_CHAR | SC_COMPILER_C_WORD_SEP | SC_COMPILER_C_VALUE_SEP;
+ #else
+ /* , */     t[44] |=   SC_COMPILER_C_WORD;
+@@ -980,6 +981,20 @@ struct Convention_A1 : public ScCompiler
+         return pCharClass->parseAnyToken( rFormula,
+                 nSrcPos, nStartFlags, aAddAllowed, nContFlags, aAddAllowed );
+     }
++
++    virtual const String& GetSymbol( const ScCompiler::OpCodeMapPtr& rpMap, OpCode e ) const
++    {
++        return rpMap->getSymbol(e);
++    }
++
++    virtual OpCode GetOpCode( const ScCompiler::OpCodeMapPtr& rpMap, const String& rName ) const
++    {
++        const ScOpCodeHashMap* pHashMap = rpMap->getHashMap();
++        ScOpCodeHashMap::const_iterator itr = pHashMap->find(rName);
++        if (itr == pHashMap->end())
++            return ocNone;
++        return itr->second;
++    }
+ };
+ 
+ String Convention_A1::MakeColStr( SCCOL nCol )
+@@ -1232,6 +1247,8 @@ static const ScCompiler::Convention *pCo
+ 
+ struct ConventionXL
+ {
++    static const String maSep;
++
+     static bool GetDocAndTab( const ScCompiler& rComp,
+                               const SingleRefData& rRef,
+                               String& rDocName,
+@@ -1316,6 +1333,8 @@ struct ConventionXL
+     }
+ };
+ 
++const String ConventionXL::maSep = String::CreateFromAscii(",");
++
+ struct ConventionXL_A1 : public Convention_A1, public ConventionXL
+ {
+     ConventionXL_A1() : Convention_A1( ScAddress::CONV_XL_A1 ) { }
+@@ -1389,6 +1408,36 @@ struct ConventionXL_A1 : public Conventi
+             MakeRowStr( rBuf, aRef.Ref2.nRow );
+         }
+     }
++
++    virtual const String& GetSymbol( const ScCompiler::OpCodeMapPtr& rpMap, OpCode e ) const
++    {
++        switch (e)
++        {
++            case ocSep:
++                return ConventionXL::maSep;
++        }
++        return rpMap->getSymbol(e);
++    }
++
++    virtual OpCode GetOpCode( const ScCompiler::OpCodeMapPtr& rpMap, const String& rName ) const
++    {
++        const ScOpCodeHashMap* pHashMap = rpMap->getHashMap();
++        ScOpCodeHashMap::const_iterator itr = pHashMap->find(rName);
++        if (itr == pHashMap->end())
++        {
++            if (rName.Equals(ConventionXL::maSep))
++                // TODO: Don't do this!
++                return ocSep;
++            return ocNone;
++        }
++
++        switch (itr->second)
++        {
++            case ocSep:
++                return ocNone;
++        }
++        return itr->second;
++    }
+ };
+ 
+ static const ConventionXL_A1 ConvXL_A1;
+@@ -1508,6 +1557,36 @@ struct ConventionXL_R1C1 : public ScComp
+         return pCharClass->parseAnyToken( rFormula,
+                 nSrcPos, nStartFlags, aAddAllowed, nContFlags, aAddAllowed );
+     }
++
++    virtual const String& GetSymbol( const ScCompiler::OpCodeMapPtr& rpMap, OpCode e ) const
++    {
++        switch (e)
++        {
++            case ocSep:
++                return ConventionXL::maSep;
++        }
++        return rpMap->getSymbol(e);
++    }
++
++    virtual OpCode GetOpCode( const ScCompiler::OpCodeMapPtr& rpMap, const String& rName ) const
++    {
++        const ScOpCodeHashMap* pHashMap = rpMap->getHashMap();
++        ScOpCodeHashMap::const_iterator itr = pHashMap->find(rName);
++        if (itr == pHashMap->end())
++        {
++            if (rName.Equals(ConventionXL::maSep))
++                // TODO: Don't do this!
++                return ocSep;
++            return ocNone;
++        }
++
++        switch (itr->second)
++        {
++            case ocSep:
++                return ocNone;
++        }
++        return itr->second;
++    }
+ };
+ 
+ static const ConventionXL_R1C1 ConvXL_R1C1;
+@@ -1539,7 +1618,12 @@ ScCompiler::ScCompiler( ScDocument* pDoc
+     if (NULL != pDoc)
+         SetRefConvention( pDoc->GetAddressConvention() );
+     else
+-        SetRefConvention( pConvOOO_A1 );
++    {
++        if ( ScGlobal::pLocale->Language.equalsAscii("en") && ScGlobal::pLocale->Country.equalsAscii("US") )
++            SetRefConvention( pConvXL_A1 );
++        else
++            SetRefConvention( pConvOOO_A1 );
++    }
+ 
+     nMaxTab = pDoc ? pDoc->GetTableCount() - 1 : 0;
+     pStack = NULL;
+@@ -1570,7 +1654,12 @@ ScCompiler::ScCompiler(ScDocument* pDocu
+     if (NULL != pDoc)
+         SetRefConvention( pDoc->GetAddressConvention() );
+     else
+-        SetRefConvention( pConvOOO_A1 );
++    {
++        if ( ScGlobal::pLocale->Language.equalsAscii("en") && ScGlobal::pLocale->Country.equalsAscii("US") )
++            SetRefConvention( pConvXL_A1 );
++        else
++            SetRefConvention( pConvOOO_A1 );
++    }
+ 
+     nMaxTab = pDoc ? pDoc->GetTableCount() - 1 : 0;
+     pStack = NULL;
+@@ -1970,13 +2059,14 @@ xub_StrLen ScCompiler::NextSymbol()
+ 
+ BOOL ScCompiler::IsOpCode( const String& rName )
+ {
+-    ScOpCodeHashMap::const_iterator iLook( mxSymbols->getHashMap()->find( rName));
+-    BOOL bFound = (iLook != mxSymbols->getHashMap()->end());
+-    if (bFound)
++    bool bFound = false;
++    OpCode oc = pConv->GetOpCode(mxSymbols, rName);
++    if (oc != ocNone)
+     {
+         ScRawToken aToken;
+-        aToken.SetOpCode( (*iLook).second );
++        aToken.SetOpCode(oc);
+         pRawToken = aToken.Clone();
++        bFound = true;
+     }
+     else
+     {
+@@ -5001,9 +5091,17 @@ ScRangeData* ScCompiler::UpdateMoveTab( 
+ }
+ 
+ 
+-const String& ScCompiler::GetStringFromOpCode( OpCode eOpCode, bool bEnglish )
++const String& ScCompiler::GetStringFromOpCode( OpCode eOpCode, bool bEnglish, ScAddress::Convention eConv )
+ {
+-    return bEnglish ? mxSymbolsEnglish->getSymbol( eOpCode ) : mxSymbolsNative->getSymbol( eOpCode );
++    const ScCompiler::Convention* pConv = pConvOOO_A1; // default
++    switch (eConv)
++    {
++        case ScAddress::CONV_XL_A1:     pConv = pConvXL_A1;     break;
++        case ScAddress::CONV_XL_R1C1:   pConv = pConvXL_R1C1;   break;
++        // more case likely to follow in the future....
++    }
++    OpCodeMapPtr mxSymbols = bEnglish ? mxSymbolsEnglish : mxSymbolsNative;
++    return pConv->GetSymbol( mxSymbols, eOpCode );
+ }
+ 
+ ScToken* ScCompiler::CreateStringFromToken( String& rFormula, ScToken* pTokenP,
+@@ -5046,7 +5144,7 @@ ScToken* ScCompiler::CreateStringFromTok
+     else if( eOp >= ocInternalBegin && eOp <= ocInternalEnd )
+         rBuffer.appendAscii( pInternal[ eOp - ocInternalBegin ] );
+     else if( (USHORT) eOp < mxSymbolsNative->getSymbolCount())        // Keyword:
+-        rBuffer.append(mxSymbols->getSymbol(eOp));
++        rBuffer.append( pConv->GetSymbol(mxSymbols, eOp) );
+     else
+     {
+         DBG_ERROR("Unbekannter OpCode");
+diff -urp --exclude=CVS --exclude=unxlngi6.pro --exclude=sc.vpj sc.clean/source/filter/inc/fdumper.hxx sc/source/filter/inc/fdumper.hxx
+--- sc.clean/source/filter/inc/fdumper.hxx	2008-02-05 11:16:59.000000000 -0500
++++ sc/source/filter/inc/fdumper.hxx	2008-02-05 16:47:29.000000000 -0500
+@@ -36,7 +36,7 @@
+ #ifndef SC_FDUMPER_HXX
+ #define SC_FDUMPER_HXX
+ 
+-#define SCF_INCL_DUMPER (OSL_DEBUG_LEVEL > 0)
++#define SCF_INCL_DUMPER (OSL_DEBUG_LEVEL > 0) && 0
+ 
+ #if SCF_INCL_DUMPER
+ 
+diff -urp --exclude=CVS --exclude=unxlngi6.pro --exclude=sc.vpj sc.clean/source/ui/docshell/docsh.cxx sc/source/ui/docshell/docsh.cxx
+--- sc.clean/source/ui/docshell/docsh.cxx	2008-02-05 11:16:58.000000000 -0500
++++ sc/source/ui/docshell/docsh.cxx	2008-02-06 17:44:49.000000000 -0500
+@@ -2198,6 +2198,10 @@ ScDocShell::ScDocShell( SfxObjectCreateM
+ 	:	SfxObjectShell( eMode ),
+ 		__SCDOCSHELL_INIT
+ {
++    // Set appropriate address convention.
++    if (ScGlobal::pLocale->Language.equalsAscii("en") && ScGlobal::pLocale->Country.equalsAscii("US"))
++        aDocument.SetAddressConvention(ScAddress::CONV_XL_A1);
++
+ 	RTL_LOGFILE_CONTEXT_AUTHOR ( aLog, "sc", "nn93723", "ScDocShell::ScDocShell" );
+ 
+ 	SetPool( &SC_MOD()->GetPool() );
+diff -urp --exclude=CVS --exclude=unxlngi6.pro --exclude=sc.vpj sc.clean/source/ui/formdlg/formula.cxx sc/source/ui/formdlg/formula.cxx
+--- sc.clean/source/ui/formdlg/formula.cxx	2008-02-05 11:16:58.000000000 -0500
++++ sc/source/ui/formdlg/formula.cxx	2008-02-06 19:56:24.000000000 -0500
+@@ -306,7 +306,7 @@ ScFormulaDlg::ScFormulaDlg( SfxBindings*
+ 
+ 			xub_StrLen nFStart = 0;
+ 			xub_StrLen nFEnd   = 0;
+-			if ( ScFormulaUtil::GetNextFunc( aFormula, FALSE, nFStart, &nFEnd) )
++			if ( ScFormulaUtil::GetNextFunc( aFormula, FALSE, pDoc->GetAddressConvention(), nFStart, &nFEnd, NULL, NULL ) )
+ 			{
+ 				pScMod->InputReplaceSelection( aFormula );
+ 				pScMod->InputSetSelection( nFStart, nFEnd );
+@@ -523,7 +523,7 @@ void ScFormulaDlg::FillControls()
+ 	const ScFuncDesc*		pOldFuncDesc=pFuncDesc;
+ 	BOOL			bTestFlag=FALSE;
+ 
+-	if ( ScFormulaUtil::GetNextFunc( aFormula, FALSE,
++	if ( ScFormulaUtil::GetNextFunc( aFormula, FALSE, pDoc->GetAddressConvention(),
+ 									 nNextFStart, &nNextFEnd, &pFuncDesc, &pArgArr ) )
+ 	{
+ 		bTestFlag=(pOldFuncDesc!=pFuncDesc);
+@@ -564,7 +564,7 @@ void ScFormulaDlg::FillControls()
+ 
+ 		if(bTestFlag) aScParaWin.SetArgCount(nArgs,nOffset);
+ 		USHORT nActiv=0;
+-		xub_StrLen nArgPos=ScFormulaUtil::GetArgStart( aFormula, nFStart, 0 );
++		xub_StrLen nArgPos=ScFormulaUtil::GetArgStart( aFormula, nFStart, 0, pDoc->GetAddressConvention() );
+ 		xub_StrLen nEditPos=(xub_StrLen) pMEdit->GetSelection().Min();
+ 		BOOL	bFlag=FALSE;
+ 
+@@ -595,11 +595,11 @@ void ScFormulaDlg::FillControls()
+ 	}
+ 		//	Test, ob vorne/hinten noch mehr Funktionen sind
+ 
+-	xub_StrLen nTempStart = ScFormulaUtil::GetArgStart( aFormula, nFStart, 0 );
+-	BOOL bNext = ScFormulaUtil::GetNextFunc( aFormula, FALSE, nTempStart );
++	xub_StrLen nTempStart = ScFormulaUtil::GetArgStart( aFormula, nFStart, 0, pDoc->GetAddressConvention() );
++	BOOL bNext = ScFormulaUtil::GetNextFunc( aFormula, FALSE, pDoc->GetAddressConvention(), nTempStart );
+ 	nTempStart=(xub_StrLen)pMEdit->GetSelection().Min();
+ 	pData->SetFStart(nTempStart);
+-	BOOL bPrev = ScFormulaUtil::GetNextFunc( aFormula, TRUE, nTempStart );
++	BOOL bPrev = ScFormulaUtil::GetNextFunc( aFormula, TRUE, pDoc->GetAddressConvention(), nTempStart );
+ 	aBtnBackward.Enable(bPrev);
+ 	aBtnForward.Enable(bNext);
+ }
+@@ -809,7 +809,7 @@ void ScFormulaDlg::UpdateFunctionDesc()
+ 		{
+             pDesc->InitArgumentInfo();      // full argument info is needed
+ 
+-			String aSig = pDesc->GetSignature();
++			String aSig = pDesc->GetSignature(pDoc->GetAddressConvention());
+ 
+ 			aFtFuncName.SetText( aSig );
+ 			if(pDesc->pFuncDesc)
+@@ -819,7 +819,7 @@ void ScFormulaDlg::UpdateFunctionDesc()
+ 			ResizeArgArr( pDesc );
+ 
+ 			if ( pArgArr && pArgArr[0] && pArgArr[0]->Len() )		// noch Argumente da?
+-				aSig = pDesc->GetFormulaString( pArgArr );			// fuer Eingabezeile
++				aSig = pDesc->GetFormulaString( pArgArr, pDoc->GetAddressConvention() );			// fuer Eingabezeile
+ 			//@ pScMod->InputReplaceSelection( aSig );
+ 		}
+ 	}
+@@ -899,7 +899,7 @@ void ScFormulaDlg::EditThisFunc(xub_StrL
+ 
+ 	//@bFound = ScFormulaUtil::GetNextFunc( aFormula, FALSE, nNextFStart, &nNextFEnd, &pFuncDesc );
+ 
+-	bFound = ScFormulaUtil::GetNextFunc( aFormula, FALSE, nNextFStart, &nNextFEnd);
++	bFound = ScFormulaUtil::GetNextFunc( aFormula, FALSE, pDoc->GetAddressConvention(), nNextFStart, &nNextFEnd);
+ 	if ( bFound )
+ 	{
+ 		xub_StrLen nFEnd;
+@@ -959,15 +959,15 @@ void ScFormulaDlg::EditNextFunc( BOOL bF
+ 	BOOL bFound;
+ 	if ( bForward )
+ 	{
+-		nNextFStart	= ScFormulaUtil::GetArgStart( aFormula, nFStart, 0 );
++		nNextFStart	= ScFormulaUtil::GetArgStart( aFormula, nFStart, 0, pDoc->GetAddressConvention() );
+ 		//@bFound = ScFormulaUtil::GetNextFunc( aFormula, FALSE, nNextFStart, &nNextFEnd, &pFuncDesc );
+-		bFound = ScFormulaUtil::GetNextFunc( aFormula, FALSE, nNextFStart, &nNextFEnd);
++		bFound = ScFormulaUtil::GetNextFunc( aFormula, FALSE, pDoc->GetAddressConvention(), nNextFStart, &nNextFEnd);
+ 	}
+ 	else
+ 	{
+ 		nNextFStart	= nFStart;
+ 		//@bFound = ScFormulaUtil::GetNextFunc( aFormula, TRUE, nNextFStart, &nNextFEnd, &pFuncDesc );
+-		bFound = ScFormulaUtil::GetNextFunc( aFormula, TRUE, nNextFStart, &nNextFEnd);
++		bFound = ScFormulaUtil::GetNextFunc( aFormula, TRUE, pDoc->GetAddressConvention(), nNextFStart, &nNextFEnd);
+ 	}
+ 
+ 	if ( bFound )
+@@ -1012,8 +1012,8 @@ void ScFormulaDlg::EditFuncParas(xub_Str
+ 
+ 		nArgs = pFuncDesc->nArgCount;
+ 
+-		xub_StrLen nArgPos=ScFormulaUtil::GetArgStart( aFormula, nFStart, 0 );
+-		pArgArr = ScFormulaUtil::GetArgStrings( aFormula, nFStart, pFuncDesc->nArgCount );
++		xub_StrLen nArgPos=ScFormulaUtil::GetArgStart( aFormula, nFStart, 0, pDoc->GetAddressConvention() );
++		pArgArr = ScFormulaUtil::GetArgStrings( aFormula, nFStart, pFuncDesc->nArgCount, pDoc->GetAddressConvention() );
+ 
+ 		USHORT nActiv=aScParaWin.GetSliderPos();
+ 		BOOL	bFlag=FALSE;
+@@ -1068,8 +1068,6 @@ BOOL ScFormulaDlg::CalcValue( const Stri
+ 		{
+ 			ScFormulaCell* pFCell = new ScFormulaCell( pDoc, aCursorPos, rStrExp );
+ 
+-			ScCompiler*	pCompi=new ScCompiler( pDoc, aCursorPos, *(pFCell->GetCode()));
+-
+ 			// #35521# HACK! um bei ColRowNames kein #REF! zu bekommen,
+ 			// wenn ein Name eigentlich als Bereich in die Gesamt-Formel
+ 			// eingefuegt wird, bei der Einzeldarstellung aber als
+@@ -1129,7 +1127,6 @@ BOOL ScFormulaDlg::CalcValue( const Stri
+ 			}
+ 
+ 			delete pFCell;
+-			delete pCompi;
+ 		}
+ 		else
+ 			bResult = FALSE;
+@@ -1143,7 +1140,7 @@ void ScFormulaDlg::UpdateValues()
+ 	ScModule* pScMod = SC_MOD();
+ 	String aStrResult;
+ 
+-	if ( CalcValue( pFuncDesc->GetFormulaString( pArgArr ), aStrResult ) )
++	if ( CalcValue( pFuncDesc->GetFormulaString( pArgArr, pDoc->GetAddressConvention() ), aStrResult ) )
+ 		aWndResult.SetValue( aStrResult );
+ 
+ 	aStrResult.Erase();
+@@ -1206,7 +1203,7 @@ IMPL_LINK( ScFormulaDlg, FxHdl, ScParaWi
+ 		xub_StrLen nFormulaStrPos = pData->GetFStart();
+ 
+ 		String aFormula = pScMod->InputGetFormulaStr();
+-		xub_StrLen n1 = ScFormulaUtil::GetArgStart( aFormula, nFormulaStrPos, nEdFocus+pData->GetOffset() );
++		xub_StrLen n1 = ScFormulaUtil::GetArgStart( aFormula, nFormulaStrPos, nEdFocus+pData->GetOffset(), pDoc->GetAddressConvention() );
+ 
+ 		pData->SetEdFocus( nEdFocus );
+ 		pData->SaveValues();
+@@ -1335,7 +1332,7 @@ IMPL_LINK( ScFormulaDlg, FormulaCursorHd
+ 
+ 		if(nFStart<nPos)
+ 		{
+-			xub_StrLen nPos1=ScFormulaUtil::GetFunctionEnd(aString,nFStart);
++			xub_StrLen nPos1=ScFormulaUtil::GetFunctionEnd(aString, nFStart, pDoc->GetAddressConvention());
+ 
+ 			if(nPos1>nPos || nPos1==STRING_NOTFOUND)
+ 			{
+@@ -1356,7 +1353,7 @@ IMPL_LINK( ScFormulaDlg, FormulaCursorHd
+ 				}
+ 				if(nCount==0)
+ 				{
+-					nFStart=ScFormulaUtil::GetFunctionStart(aString,n,TRUE);
++					nFStart = ScFormulaUtil::GetFunctionStart( aString, n, TRUE, pDoc->GetAddressConvention() );
+ 					EditThisFunc(nFStart);
+ 				}
+ 				else
+@@ -1382,7 +1379,7 @@ void ScFormulaDlg::UpdateSelection()
+ 
+ 	pScMod->InputSetSelection((xub_StrLen)aFuncSel.Min(),(xub_StrLen)aFuncSel.Max());
+ 
+-	pScMod->InputReplaceSelection( pFuncDesc->GetFormulaString( pArgArr ) );
++	pScMod->InputReplaceSelection( pFuncDesc->GetFormulaString( pArgArr, pDoc->GetAddressConvention() ) );
+ 	pMEdit->SetText(pScMod->InputGetFormulaStr());
+ 	xub_StrLen PrivStart, PrivEnd;
+ 	pScMod->InputGetSelection( PrivStart, PrivEnd);
+@@ -1392,7 +1389,7 @@ void ScFormulaDlg::UpdateSelection()
+ 	nArgs = pFuncDesc->nArgCount;
+ 
+ 	String aFormula=pMEdit->GetText();
+-	xub_StrLen nArgPos=ScFormulaUtil::GetArgStart( aFormula,PrivStart,0);
++	xub_StrLen nArgPos=ScFormulaUtil::GetArgStart( aFormula, PrivStart, 0, pDoc->GetAddressConvention() );
+ 
+ 	USHORT nPos=aScParaWin.GetActiveLine();
+ 
+@@ -1648,6 +1645,8 @@ void ScFormulaDlg::UpdateTokenArray( con
+ 
+ xub_StrLen ScFormulaDlg::GetFunctionPos(xub_StrLen nPos)
+ {
++    const sal_Unicode sep = ScCompiler::GetStringFromOpCode(ocSep, false, pDoc->GetAddressConvention()).GetChar(0);
++
+ 	xub_StrLen nTokPos=1;
+ 	xub_StrLen nOldTokPos=1;
+ 	xub_StrLen nFuncPos=STRING_NOTFOUND;    //@ Testweise
+@@ -1673,7 +1672,7 @@ xub_StrLen ScFormulaDlg::GetFunctionPos(
+ 
+ 			if(eOp==ocPush || eOp==ocSpaces)
+ 			{
+-				xub_StrLen n1=aFormString.Search(';',nTokPos);
++				xub_StrLen n1=aFormString.Search(sep, nTokPos);
+ 				xub_StrLen n2=aFormString.Search(')',nTokPos);
+ 				xub_StrLen nXXX=nTokPos;
+ 				if(n1<n2)
+@@ -1903,7 +1902,7 @@ IMPL_LINK( ScFormulaDlg, FuncSelHdl, ScF
+ 		{
+             pDesc->InitArgumentInfo();      // full argument info is needed
+ 
+-			String aSig = pDesc->GetSignature();
++			String aSig = pDesc->GetSignature(pDoc->GetAddressConvention());
+ 			if(pDesc->pFuncName)
+ 				aFtHeadLine.SetText( *(pDesc->pFuncName) );
+ 			else



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]