ooo-build r15288 - in trunk: . patches/dev300



Author: kyoshida
Date: Wed Feb  4 22:32:29 2009
New Revision: 15288
URL: http://svn.gnome.org/viewvc/ooo-build?rev=15288&view=rev

Log:
2009-02-04  Kohei Yoshida  <kyoshida novell com>

	* patches/dev300/calc-formula-variable-separators-ref-display.diff:
	* patches/dev300/apply: fixed formula tooltips and display of referenced
	ranges in a formula expression, and color-coding of formula expressions
	even when the separators are not ';'.  These things previously failed 
	because the code assumed hard-coded ';' separators. (n#469395)
	


Added:
   trunk/patches/dev300/calc-formula-variable-separators-ref-display.diff
Modified:
   trunk/ChangeLog
   trunk/patches/dev300/apply

Modified: trunk/patches/dev300/apply
==============================================================================
--- trunk/patches/dev300/apply	(original)
+++ trunk/patches/dev300/apply	Wed Feb  4 22:32:29 2009
@@ -1760,6 +1760,9 @@
 calc-formula-variable-separators-svx.diff,       n#447164, i#92056, kohei
 calc-formula-variable-separators-officecfg.diff, n#447164, i#92056, kohei
 
+# Display references when entering input mode, even when the separators are not ';'.
+calc-formula-variable-separators-ref-display.diff, n#469395, kohei
+
 # Squeeze chart's subtitle into the 2nd line of the main title when exporting
 # to xls.
 chart-subtitle-xls-export.diff, i#92357, kohei

Added: trunk/patches/dev300/calc-formula-variable-separators-ref-display.diff
==============================================================================
--- (empty file)
+++ trunk/patches/dev300/calc-formula-variable-separators-ref-display.diff	Wed Feb  4 22:32:29 2009
@@ -0,0 +1,227 @@
+diff --git sc/inc/compiler.hxx sc/inc/compiler.hxx
+index c96da1f..a8bbe7c 100644
+--- sc/inc/compiler.hxx
++++ sc/inc/compiler.hxx
+@@ -353,6 +353,7 @@ public:
+ 
+     static BOOL EnQuote( String& rStr );
+     
++    sal_Unicode GetNativeAddressSymbol( Convention::SpecialSymbolType eType ) const;
+ 
+     // Check if it is a valid english function name
+     bool IsEnglishSymbol( const String& rName ); 
+diff --git sc/source/core/tool/compiler.cxx sc/source/core/tool/compiler.cxx
+index ad87394..5d088b3 100644
+--- sc/source/core/tool/compiler.cxx
++++ sc/source/core/tool/compiler.cxx
+@@ -4984,6 +4984,11 @@ BOOL ScCompiler::EnQuote( String& rStr )
+     return TRUE;
+ }
+ 
++sal_Unicode ScCompiler::GetNativeAddressSymbol( Convention::SpecialSymbolType eType ) const
++{
++    return pConv->getSpecialSymbol(eType);
++}
++
+ void ScCompiler::fillAddInToken(::std::vector< ::com::sun::star::sheet::FormulaOpCodeMapEntry >& _rVec,bool _bIsEnglish) const
+ {
+     // All known AddIn functions.
+diff --git sc/source/core/tool/editutil.cxx sc/source/core/tool/editutil.cxx
+index 31dc996..f6eb148 100644
+--- sc/source/core/tool/editutil.cxx
++++ sc/source/core/tool/editutil.cxx
+@@ -64,12 +64,13 @@
+ #include "patattr.hxx"
+ #include "scmod.hxx"
+ #include "inputopt.hxx"
++#include "compiler.hxx"
+ 
+ // STATIC DATA -----------------------------------------------------------
+ 
+ //	Delimiters zusaetzlich zu EditEngine-Default:
+ 
+-const sal_Char __FAR_DATA ScEditUtil::pCalcDelimiters[] = "=();+-*/^&<>";
++const sal_Char __FAR_DATA ScEditUtil::pCalcDelimiters[] = "=()+-*/^&<>";
+ 
+ 
+ //------------------------------------------------------------------------
+@@ -79,6 +80,7 @@ String ScEditUtil::ModifyDelimiters( const String& rOld )
+ 	String aRet = rOld;
+ 	aRet.EraseAllChars( '_' );	// underscore is used in function argument names
+ 	aRet.AppendAscii( RTL_CONSTASCII_STRINGPARAM( pCalcDelimiters ) );
++    aRet.Append(ScCompiler::GetNativeSymbol(ocSep)); // argument separator is localized.
+ 	return aRet;
+ }
+ 
+diff --git sc/source/ui/app/inputhdl.cxx sc/source/ui/app/inputhdl.cxx
+index 8e4bb2a..2740091 100644
+--- sc/source/ui/app/inputhdl.cxx
++++ sc/source/ui/app/inputhdl.cxx
+@@ -113,14 +113,22 @@ extern USHORT nEditAdjust;		//! Member an ViewData
+ 
+ //==================================================================
+ 
++static sal_Unicode lcl_getSheetSeparator(ScDocument* pDoc)
++{
++    ScCompiler aComp(pDoc, ScAddress());
++    aComp.SetGrammar(pDoc->GetGrammar());
++    return aComp.GetNativeAddressSymbol(ScCompiler::Convention::SHEET_SEPARATOR);
++}
++
+ void ScInputHandler::InitRangeFinder( const String& rFormula )
+ {
+ 	DeleteRangeFinder();
++    ScDocShell* pDocSh = pActiveViewSh->GetViewData()->GetDocShell();
++    ScDocument* pDoc = pDocSh->GetDocument();
++    const sal_Unicode cSheetSep = lcl_getSheetSeparator(pDoc);
+ 
+ 	if ( !pActiveViewSh || !SC_MOD()->GetInputOptions().GetRangeFinder() )
+ 		return;
+-	ScDocShell* pDocSh = pActiveViewSh->GetViewData()->GetDocShell();
+-	ScDocument* pDoc = pDocSh->GetDocument();
+ 
+ //	String aDelimiters = pEngine->GetWordDelimiters();
+ 	String aDelimiters = ScEditUtil::ModifyDelimiters(
+@@ -129,7 +137,7 @@ void ScInputHandler::InitRangeFinder( const String& rFormula )
+ 	xub_StrLen nColon = aDelimiters.Search(':');
+ 	if ( nColon != STRING_NOTFOUND )
+ 		aDelimiters.Erase( nColon, 1 );				// Delimiter ohne Doppelpunkt
+-	xub_StrLen nDot = aDelimiters.Search('.');
++	xub_StrLen nDot = aDelimiters.Search(cSheetSep);
+ 	if ( nDot != STRING_NOTFOUND )
+ 		aDelimiters.Erase( nDot, 1 );				// Delimiter ohne Punkt
+ 
+@@ -702,6 +710,9 @@ void ScInputHandler::ShowTipCursor()
+     HideTip();
+     HideTipBelow();
+     EditView* pActiveView = pTopView ? pTopView : pTableView;
++    ScDocShell* pDocSh = pActiveViewSh->GetViewData()->GetDocShell();
++    const sal_Unicode cSep = ScCompiler::GetNativeSymbol(ocSep).GetChar(0);
++    const sal_Unicode cSheetSep = lcl_getSheetSeparator(pDocSh->GetDocument());
+ 
+     if ( bFormulaMode && pActiveView && pFormulaDataPara && pEngine->GetParagraphCount() == 1 )
+     {
+@@ -731,7 +742,7 @@ void ScInputHandler::ShowTipCursor()
+                 if( nLeftParentPos != STRING_NOTFOUND )
+                 {
+                     sal_Unicode c = aSelText.GetChar( nLeftParentPos-1 );
+-                    if( !(c >= 'A' && c<= 'Z' || c>= 'a' && c<= 'z' ) )
++                    if( !((c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z') ) )
+                         continue;
+                     nNextFStart = aHelper.GetFunctionStart( aSelText, nLeftParentPos, TRUE);
+                     if( aHelper.GetNextFunc( aSelText, FALSE, nNextFStart, &nNextFEnd, &ppFDesc, &aArgs ) )
+@@ -764,8 +775,8 @@ void ScInputHandler::ShowTipCursor()
+                                 }
+                                 if( bFlag )
+                                 {
+-                                    nCountSemicolon = aNew.GetTokenCount(';')-1;
+-                                    nCountDot = aNew.GetTokenCount('.')-1;
++                                    nCountSemicolon = aNew.GetTokenCount(cSep)-1;
++                                    nCountDot = aNew.GetTokenCount(cSheetSep)-1;
+ 
+                                     if( !nCountSemicolon )
+                                     {
+@@ -787,7 +798,7 @@ void ScInputHandler::ShowTipCursor()
+                                             {
+                                                 nStartPosition = i+1;
+                                             }
+-                                            else if( cNext == ';' )
++                                            else if( cNext == cSep )
+                                             {
+                                                 nCount ++;
+                                                 nEndPosition = i;
+@@ -808,7 +819,7 @@ void ScInputHandler::ShowTipCursor()
+                                             {
+                                                 nStartPosition = i+1;
+                                             }
+-                                            else if( cNext == ';' )
++                                            else if( cNext == cSep )
+                                             {
+                                                 nCount ++;
+                                                 nEndPosition = i;
+@@ -818,7 +829,7 @@ void ScInputHandler::ShowTipCursor()
+                                                 }
+                                                 nStartPosition = nEndPosition+1;
+                                             }
+-                                            else if( cNext == '.' )
++                                            else if( cNext == cSheetSep )
+                                             {
+                                                 continue;
+                                             }
+@@ -919,6 +930,9 @@ void ScInputHandler::ShowTipBelow( const String& rText )
+ void ScInputHandler::UseFormulaData()
+ {
+ 	EditView* pActiveView = pTopView ? pTopView : pTableView;
++    ScDocShell* pDocSh = pActiveViewSh->GetViewData()->GetDocShell();
++    const sal_Unicode cSep = ScCompiler::GetNativeSymbol(ocSep).GetChar(0);
++    const sal_Unicode cSheetSep = lcl_getSheetSeparator(pDocSh->GetDocument());
+ 
+ 	//	Formeln duerfen nur 1 Absatz haben
+ 	if ( pActiveView && pFormulaData && pEngine->GetParagraphCount() == 1 )
+@@ -970,7 +984,7 @@ void ScInputHandler::UseFormulaData()
+                     break;
+ 
+                 sal_Unicode c = aFormula.GetChar( nLeftParentPos-1 );
+-                if( !(c >= 'A' && c<= 'Z' || c>= 'a' && c<= 'z' ) )
++                if( !((c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z') ) )
+                     continue;
+                 nNextFStart = aHelper.GetFunctionStart( aFormula, nLeftParentPos, TRUE);
+                 if( aHelper.GetNextFunc( aFormula, FALSE, nNextFStart, &nNextFEnd, &ppFDesc, &aArgs ) )
+@@ -1002,8 +1016,8 @@ void ScInputHandler::UseFormulaData()
+                             }
+                             if( bFlag )
+                             {
+-                                nCountSemicolon = aNew.GetTokenCount(';')-1;
+-                                nCountDot = aNew.GetTokenCount('.')-1;
++                                nCountSemicolon = aNew.GetTokenCount(cSep)-1;
++                                nCountDot = aNew.GetTokenCount(cSheetSep)-1;
+                                 
+                                if( !nCountSemicolon )
+                                {
+@@ -1025,7 +1039,7 @@ void ScInputHandler::UseFormulaData()
+                                         {
+                                             nStartPosition = i+1;
+                                         }
+-                                        else if( cNext == ';' )
++                                        else if( cNext == cSep )
+                                         {
+                                             nCount ++;
+                                             nEndPosition = i;
+@@ -1046,7 +1060,7 @@ void ScInputHandler::UseFormulaData()
+                                         {
+                                             nStartPosition = i+1;
+                                         }
+-                                        else if( cNext == ';' )
++                                        else if( cNext == cSep )
+                                         {
+                                             nCount ++;
+                                             nEndPosition = i;
+@@ -1056,7 +1070,7 @@ void ScInputHandler::UseFormulaData()
+                                             }
+                                             nStartPosition = nEndPosition+1;
+                                         }
+-                                        else if( cNext == '.' )
++                                        else if( cNext == cSheetSep )
+                                         {
+                                             continue;
+                                         }
+@@ -2759,6 +2773,7 @@ BOOL ScInputHandler::IsModalMode( SfxObjectShell* pDocSh )
+ 
+ void ScInputHandler::AddRefEntry()
+ {
++    const sal_Unicode cSep = ScCompiler::GetNativeSymbol(ocSep).GetChar(0);
+ 	UpdateActiveView();
+ 	if (!pTableView && !pTopView)
+ 		return; 							// z.B. FillMode
+@@ -2767,9 +2782,9 @@ void ScInputHandler::AddRefEntry()
+ 
+ 	RemoveSelection();
+ 	if (pTableView)
+-		pTableView->InsertText( ';', FALSE );
++        pTableView->InsertText( cSep, FALSE );
+ 	if (pTopView)
+-		pTopView->InsertText( ';', FALSE );
++        pTopView->InsertText( cSep, FALSE );
+ 
+ 	DataChanged();
+ }



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