ooo-build r14749 - in trunk: . patches/dev300 patches/vba
- From: kyoshida svn gnome org
- To: svn-commits-list gnome org
- Subject: ooo-build r14749 - in trunk: . patches/dev300 patches/vba
- Date: Thu, 4 Dec 2008 23:15:18 +0000 (UTC)
Author: kyoshida
Date: Thu Dec 4 23:15:18 2008
New Revision: 14749
URL: http://svn.gnome.org/viewvc/ooo-build?rev=14749&view=rev
Log:
2008-12-04 Kohei Yoshida <kyoshida novell com>
* patches/dev300/calc-grammar-xls-english-offapi.diff:
* patches/dev300/calc-grammar-xls-english-sc.diff: support additional
grammar type for English Excel formula syntax.
* patches/vba/vba-xls-formula-parser.diff: always parse formulas in the
English Excel formula syntax in VBA. (n#422145)
* patches/dev300/apply: apply these patches.
Added:
trunk/patches/dev300/calc-grammar-xls-english-offapi.diff
trunk/patches/dev300/calc-grammar-xls-english-sc.diff
trunk/patches/vba/vba-xls-formula-parser.diff
Modified:
trunk/ChangeLog
trunk/patches/dev300/apply
Modified: trunk/patches/dev300/apply
==============================================================================
--- trunk/patches/dev300/apply (original)
+++ trunk/patches/dev300/apply Thu Dec 4 23:15:18 2008
@@ -1738,6 +1738,10 @@
# fix core issue in Commandbar
vba-commandbar-fix.diff, n#434214, n#437157, Fong
+# always use English Excel grammar when parsing formulas.
+# (depends on calc-grammar-xls-english-*.diff patches.)
+vba-xls-formula-parser.diff, n#422145, kohei
+
[ VBAObjects < dev300-m36 ]
patch_i92329.diff, i#92329
@@ -1863,6 +1867,10 @@
# Support PHONETIC function to display asian phonetic guide.
calc-formula-asian-phonetic.diff, i#80764, i#80765, i#80766, kohei
+# Support Excel English grammar needed for VBA and (probably) for xlsx filter.
+calc-grammar-xls-english-offapi.diff, kohei
+calc-grammar-xls-english-sc.diff, kohei
+
[ CalcSolver ]
SectionOwner => kohei
Added: trunk/patches/dev300/calc-grammar-xls-english-offapi.diff
==============================================================================
--- (empty file)
+++ trunk/patches/dev300/calc-grammar-xls-english-offapi.diff Thu Dec 4 23:15:18 2008
@@ -0,0 +1,15 @@
+diff --git offapi/com/sun/star/sheet/FormulaLanguage.idl offapi/com/sun/star/sheet/FormulaLanguage.idl
+index 0326520..07a9582 100644
+--- offapi/com/sun/star/sheet/FormulaLanguage.idl
++++ offapi/com/sun/star/sheet/FormulaLanguage.idl
+@@ -63,6 +63,10 @@ constants FormulaLanguage
+ */
+ const long NATIVE = 3;
+
++ /** Function names and operators as used in the English version of
++ Excel.
++ */
++ const long XL_ENGLISH = 4;
+ };
+
+ //=============================================================================
Added: trunk/patches/dev300/calc-grammar-xls-english-sc.diff
==============================================================================
--- (empty file)
+++ trunk/patches/dev300/calc-grammar-xls-english-sc.diff Thu Dec 4 23:15:18 2008
@@ -0,0 +1,101 @@
+diff --git sc/inc/compiler.hxx sc/inc/compiler.hxx
+index 7f95858..bfbe244 100644
+--- sc/inc/compiler.hxx
++++ sc/inc/compiler.hxx
+@@ -398,6 +398,7 @@ private:
+ static NonConstOpCodeMapPtr mxSymbolsPODF; // ODF 1.1 symbols
+ static NonConstOpCodeMapPtr mxSymbolsNative; // native symbols
+ static NonConstOpCodeMapPtr mxSymbolsEnglish; // English symbols
++ static NonConstOpCodeMapPtr mxSymbolsEnglishXL; // English Excel symbols (for VBA formula parsing)
+ static CharClass *pCharClassEnglish; // character classification for en_US locale
+ static const Convention *pConventions[ ScAddress::CONV_LAST ];
+
+@@ -519,6 +520,7 @@ public:
+ private:
+ static void InitSymbolsPODF(); /// only SymbolsPODF, on demand
+ static void InitSymbolsODFF(); /// only SymbolsODFF, on demand
++ static void InitSymbolsEnglishXL(); /// only SymbolsEnglishXL, on demand
+ static void fillFromAddInMap( NonConstOpCodeMapPtr xMap, size_t nSymbolOffset );
+ static void fillFromAddInCollectionUpperName( NonConstOpCodeMapPtr xMap );
+ static void fillFromAddInCollectionEnglishName( NonConstOpCodeMapPtr xMap );
+diff --git sc/inc/grammar.hxx sc/inc/grammar.hxx
+index 91df652..d6dddfa 100644
+--- sc/inc/grammar.hxx
++++ sc/inc/grammar.hxx
+@@ -112,6 +112,16 @@ public:
+ GRAM_NATIVE_XL_R1C1 = ::com::sun::star::sheet::FormulaLanguage::NATIVE |
+ ((ScAddress::CONV_XL_R1C1 +
+ kConventionOffset) << kConventionShift),
++ /// English with Excel A1 reference style.
++ GRAM_ENGLISH_XL_A1 = ::com::sun::star::sheet::FormulaLanguage::XL_ENGLISH |
++ ((ScAddress::CONV_XL_A1 +
++ kConventionOffset) << kConventionShift) |
++ kEnglishBit,
++ /// English with Excel R1C1 reference style.
++ GRAM_ENGLISH_XL_R1C1 = ::com::sun::star::sheet::FormulaLanguage::XL_ENGLISH |
++ ((ScAddress::CONV_XL_R1C1 +
++ kConventionOffset) << kConventionShift) |
++ kEnglishBit,
+ /// Central definition of the default grammar to be used.
+ GRAM_DEFAULT = GRAM_NATIVE_UI,
+
+@@ -162,6 +172,8 @@ public:
+ case GRAM_NATIVE_ODF :
+ case GRAM_NATIVE_XL_A1 :
+ case GRAM_NATIVE_XL_R1C1 :
++ case GRAM_ENGLISH_XL_A1 :
++ case GRAM_ENGLISH_XL_R1C1:
+ return true;
+ default:
+ return extractFormulaLanguage( eGrammar) == GRAM_EXTERNAL;
+diff --git sc/source/core/tool/compiler.cxx sc/source/core/tool/compiler.cxx
+index 8ccb188..ccc9f2f 100644
+--- sc/source/core/tool/compiler.cxx
++++ sc/source/core/tool/compiler.cxx
+@@ -109,6 +109,7 @@ ScCompiler::NonConstOpCodeMapPtr ScCompiler::mxSymbolsODFF;
+ ScCompiler::NonConstOpCodeMapPtr ScCompiler::mxSymbolsPODF;
+ ScCompiler::NonConstOpCodeMapPtr ScCompiler::mxSymbolsNative;
+ ScCompiler::NonConstOpCodeMapPtr ScCompiler::mxSymbolsEnglish;
++ScCompiler::NonConstOpCodeMapPtr ScCompiler::mxSymbolsEnglishXL;
+ CharClass* ScCompiler::pCharClassEnglish = NULL;
+ const ScCompiler::Convention* ScCompiler::pConventions[ ] = { NULL, NULL, NULL, NULL, NULL, NULL };
+
+@@ -474,6 +475,26 @@ void ScCompiler::InitSymbolsODFF()
+ fillFromAddInCollectionUpperName( mxSymbolsODFF);
+ }
+
++void ScCompiler::InitSymbolsEnglishXL()
++{
++ if (mxSymbolsEnglishXL.get())
++ return;
++
++ // Not core
++ mxSymbolsEnglishXL.reset( new OpCodeMap( SC_OPCODE_LAST_OPCODE_ID + 1,
++ false, ScGrammar::GRAM_ENGLISH));
++ ScOpCodeList aOpCodeList( RID_SC_FUNCTION_NAMES_ENGLISH, mxSymbolsEnglishXL );
++
++ fillFromAddInMap( mxSymbolsEnglishXL, offsetof( AddInMap, pEnglish));
++ // Fill from collection for AddIns not already present.
++ fillFromAddInCollectionEnglishName( mxSymbolsEnglishXL);
++
++ // For now, just replace the separators to the Excel English variants.
++ mxSymbolsEnglishXL->putOpCode(sal_Unicode(','), ocSep);
++ mxSymbolsEnglishXL->putOpCode(sal_Unicode(','), ocArrayColSep);
++ mxSymbolsEnglishXL->putOpCode(sal_Unicode(';'), ocArrayRowSep);
++}
++
+ #ifdef erGENERATEMAPPING
+ // Run in en-US UI by calling from within gdb, edit pODFF entries afterwards.
+ void dbg_call_generateMappingODFF()
+@@ -686,6 +707,11 @@ ScCompiler::OpCodeMapPtr ScCompiler::GetOpCodeMap( const sal_Int32 nLanguage )
+ InitSymbolsNative();
+ xMap = mxSymbolsNative;
+ break;
++ case FormulaLanguage::XL_ENGLISH:
++ if (!mxSymbolsEnglishXL)
++ InitSymbolsEnglishXL();
++ xMap = mxSymbolsEnglishXL;
++ break;
+ default:
+ ; // nothing, NULL map returned
+ }
Added: trunk/patches/vba/vba-xls-formula-parser.diff
==============================================================================
--- (empty file)
+++ trunk/patches/vba/vba-xls-formula-parser.diff Thu Dec 4 23:15:18 2008
@@ -0,0 +1,48 @@
+diff --git sc/source/ui/vba/vbarange.cxx sc/source/ui/vba/vbarange.cxx
+index 2aae16d..6b510ff 100644
+--- sc/source/ui/vba/vbarange.cxx
++++ sc/source/ui/vba/vbarange.cxx
+@@ -791,9 +791,10 @@ protected:
+ double aDblValue;
+ if ( aValue >>= sFormula )
+ {
+- // convert to CONV_OOO style formula string because XCell::setFormula
+- // always compile it in CONV_OOO style. Perhaps css.sheet.FormulaParser
+- // should be used in future to directly pass formula tokens.
++ // convert to GRAM_PODF_A1 style grammar because XCell::setFormula
++ // always compile it in that grammar. Perhaps
++ // css.sheet.FormulaParser should be used in future to directly
++ // pass formula tokens when that API stabilizes.
+ if ( m_eGrammar != ScGrammar::GRAM_PODF_A1 && ( sFormula.trim().indexOf('=') == 0 ) )
+ {
+ uno::Reference< uno::XInterface > xIf( xCell, uno::UNO_QUERY_THROW );
+@@ -1459,25 +1460,25 @@ void
+ ScVbaRange::setFormula(const uno::Any &rFormula ) throw (uno::RuntimeException)
+ {
+ // #FIXME converting "=$a$1" e.g. CONV_XL_A1 -> CONV_OOO // results in "=$a$1:a1", temporalily disable conversion
+- setFormulaValue( rFormula, ScGrammar::GRAM_NATIVE_XL_A1 );;
++ setFormulaValue( rFormula, ScGrammar::GRAM_ENGLISH_XL_A1 );;
+ }
+
+ uno::Any
+ ScVbaRange::getFormulaR1C1() throw (::com::sun::star::uno::RuntimeException)
+ {
+- return getFormulaValue( ScGrammar::GRAM_NATIVE_XL_R1C1 );
++ return getFormulaValue( ScGrammar::GRAM_ENGLISH_XL_R1C1 );
+ }
+
+ void
+ ScVbaRange::setFormulaR1C1(const uno::Any& rFormula ) throw (uno::RuntimeException)
+ {
+- setFormulaValue( rFormula, ScGrammar::GRAM_NATIVE_XL_R1C1 );
++ setFormulaValue( rFormula, ScGrammar::GRAM_ENGLISH_XL_R1C1 );
+ }
+
+ uno::Any
+ ScVbaRange::getFormula() throw (::com::sun::star::uno::RuntimeException)
+ {
+- return getFormulaValue( ScGrammar::GRAM_NATIVE_XL_A1 );
++ return getFormulaValue( ScGrammar::GRAM_ENGLISH_XL_A1 );
+ }
+
+ sal_Int32
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]