ooo-build r13855 - in trunk: . patches/vba



Author: pflin
Date: Tue Sep  9 06:30:26 2008
New Revision: 13855
URL: http://svn.gnome.org/viewvc/ooo-build?rev=13855&view=rev

Log:
2008-09-09  Fong Lin  <pflin novell com>
	* patches/vba/vba-worksheetfunctions-fix.diff: Change ScCompiler
    ::HasMethod into ScCompiler::IsEnglishSymbol.



Modified:
   trunk/ChangeLog
   trunk/patches/vba/vba-worksheetfunctions-fix.diff

Modified: trunk/patches/vba/vba-worksheetfunctions-fix.diff
==============================================================================
--- trunk/patches/vba/vba-worksheetfunctions-fix.diff	(original)
+++ trunk/patches/vba/vba-worksheetfunctions-fix.diff	Tue Sep  9 06:30:26 2008
@@ -1,53 +1,61 @@
---- sc/inc/compiler.hxx.orig	2008-08-27 11:34:35.000000000 +0800
-+++ sc/inc/compiler.hxx	2008-08-28 10:50:22.000000000 +0800
-@@ -620,6 +620,9 @@ public:
- 
-     BOOL HasModifiedRange();
- 
-+ 	// Check if it is a valid function name
-+ 	static BOOL HasMethod( const String& rName ); 
-+ 
-     /// If the character is allowed as first character in sheet names or references
-     static inline BOOL IsCharWordChar( String const & rStr,
-                                        xub_StrLen nPos,
---- sc/source/core/tool/compiler.cxx.orig	2008-08-27 11:34:35.000000000 +0800
-+++ sc/source/core/tool/compiler.cxx	2008-08-28 10:49:14.000000000 +0800
-@@ -698,6 +698,33 @@ void ScCompiler::SetGrammar( const ScGra
-         SetRefConvention( eConv );
+--- sc/inc/compiler.hxx.orig	2008-09-09 10:14:46.000000000 +0800
++++ sc/inc/compiler.hxx	2008-09-09 10:18:16.000000000 +0800
+@@ -546,6 +546,9 @@ public:
+      */
+     static OpCodeMapPtr GetOpCodeMap( const sal_Int32 nLanguage );
+ 
++    // Check if it is a valid english function name
++    static bool IsEnglishSymbol( const String& rName ); 
++
+     //! _either_ CompileForFAP _or_ AutoCorrection, _not_ both
+     void            SetCompileForFAP( BOOL bVal )
+                         { bCompileForFAP = bVal; bIgnoreErrors = bVal; }
+--- sc/source/core/tool/compiler.cxx.orig	2008-09-09 10:14:46.000000000 +0800
++++ sc/source/core/tool/compiler.cxx	2008-09-09 10:21:51.000000000 +0800
+@@ -598,6 +598,33 @@ OpCode ScCompiler::GetEnglishOpCode( con
+     return bFound ? (*iLook).second : OpCode(ocNone);
  }
  
 +// static
-+BOOL ScCompiler::HasMethod( const String& rName )
++bool ScCompiler::IsEnglishSymbol( const String& rName )
 +{
-+	// function names are always case-insensitive
-+	String aUpper( ScGlobal::pCharClass->upper( rName ) );
++    // function names are always case-insensitive
++    String aUpper( ScGlobal::pCharClass->upper( rName ) );
 +
-+	// 1. built-in function name
++    // 1. built-in function name
 +    OpCode eOp = ScCompiler::GetEnglishOpCode( aUpper );
 +    if ( eOp != ocNone )
 +    {
-+        return TRUE;
++        return true;
++    }
++    // 2. old add in functions
++    USHORT nIndex;
++    if ( ScGlobal::GetFuncCollection()->SearchFunc( aUpper, nIndex ) )
++    {
++        return true;
 +    }
-+	// 2. old add in functions
-+	USHORT nIndex;
-+	if ( ScGlobal::GetFuncCollection()->SearchFunc( aUpper, nIndex ) )
-+	{
-+		return TRUE;
-+	}
 +
-+	// 3. new (uno) add in functions
-+	String aIntName(ScGlobal::GetAddInCollection()->FindFunction( aUpper, FALSE ));
-+	if (aIntName.Len())
-+	{
-+		return TRUE;
-+	}
-+	return FALSE;		// no valid function name
++    // 3. new (uno) add in functions
++    String aIntName(ScGlobal::GetAddInCollection()->FindFunction( aUpper, FALSE ));
++    if (aIntName.Len())
++    {
++        return true;
++    }
++    return false;		// no valid function name
 +}
  
+ // static
+ ScCompiler::OpCodeMapPtr ScCompiler::CreateOpCodeMap(
+@@ -693,7 +720,6 @@ void ScCompiler::SetGrammar( const ScGra
+         SetGrammarAndRefConvention( eMyGrammar, eOldGrammar);
+ }
+ 
+-
  void ScCompiler::SetFormulaLanguage( const ScCompiler::OpCodeMapPtr & xMap )
  {
---- sc/source/ui/vba/vbawsfunction.hxx.orig	2008-08-28 10:51:15.000000000 +0800
-+++ sc/source/ui/vba/vbawsfunction.hxx	2008-08-28 10:51:21.000000000 +0800
+     if (xMap.get())
+--- sc/source/ui/vba/vbawsfunction.hxx.orig	2008-09-09 10:14:46.000000000 +0800
++++ sc/source/ui/vba/vbawsfunction.hxx	2008-09-09 10:14:53.000000000 +0800
 @@ -41,7 +41,6 @@ typedef InheritedHelperInterfaceImpl1< o
  
  class ScVbaWSFunction :  public ScVbaWSFunction_BASE
@@ -56,8 +64,8 @@
  public:
  	ScVbaWSFunction( const css::uno::Reference< oo::vba::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext);
  	virtual ~ScVbaWSFunction(){}
---- sc/source/ui/vba/vbawsfunction.cxx.orig	2008-04-11 09:24:09.000000000 +0800
-+++ sc/source/ui/vba/vbawsfunction.cxx	2008-08-28 10:51:52.000000000 +0800
+--- sc/source/ui/vba/vbawsfunction.cxx.orig	2008-09-09 10:14:46.000000000 +0800
++++ sc/source/ui/vba/vbawsfunction.cxx	2008-09-09 14:16:02.000000000 +0800
 @@ -42,13 +42,14 @@
  #include <comphelper/anytostring.hxx>
  
@@ -74,7 +82,7 @@
  }
  
  
-@@ -86,7 +87,25 @@ ScVbaWSFunction::invoke(const rtl::OUStr
+@@ -86,7 +87,24 @@ ScVbaWSFunction::invoke(const rtl::OUStr
  	for ( int count=0; count < aParamTemp.getLength(); ++count )
  		OSL_TRACE("Param[%d] is %s",
  			count, rtl::OUStringToOString( comphelper::anyToString( aParamTemp[count] ), RTL_TEXTENCODING_UTF8 ).getStr()  );
@@ -84,7 +92,6 @@
 +	// MATCH function should alwayse return a double value, but currently if the first argument is XCellRange, MATCH function returns an array instead of a double value. Don't know why?
 +	// To fix this issue in safe, current solution is to convert this array to a double value just for MATCH function.
 +	String aUpper( FunctionName );
-+	OSL_TRACE("Function name is: ", rtl::OUStringToOString( FunctionName, RTL_TEXTENCODING_UTF8 ).getStr()  );
 +	OpCode eOp = ScCompiler::GetEnglishOpCode( aUpper.ToUpperAscii() );
 +	if( eOp == ocMatch )
 +	{
@@ -101,7 +108,7 @@
  }
  
  void SAL_CALL
-@@ -107,7 +126,10 @@ ScVbaWSFunction::hasMethod(const rtl::OU
+@@ -107,7 +125,10 @@ ScVbaWSFunction::hasMethod(const rtl::OU
  	sal_Bool bIsFound = sal_False;
  	try 
  	{
@@ -109,7 +116,7 @@
 +		// the function name contained in the com.sun.star.sheet.FunctionDescription service is alwayse localized.
 +		// but the function name used in WorksheetFunction is a programmatic name (seems English).
 +		// So m_xNameAccess->hasByName( Name ) may fail to find name when a function name has a localized name.
-+		if( ScCompiler::HasMethod( Name ) )
++		if( ScCompiler::IsEnglishSymbol( Name ) )
  			bIsFound = sal_True;
  	}
  	catch( uno::Exception& /*e*/ )



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