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



Author: kyoshida
Date: Fri Mar 20 23:42:35 2009
New Revision: 15595
URL: http://svn.gnome.org/viewvc/ooo-build?rev=15595&view=rev

Log:
2009-03-20  Kohei Yoshida  <kyoshida novell com>

	* patches/dev300/chart-formula-syntax.diff:
	* patches/dev300/apply: got chart to work again when the formula syntax
	is set to non-default syntax (i.e. Excel A1 and R1C1). (n#487350)


Added:
   trunk/patches/dev300/chart-formula-syntax.diff
Modified:
   trunk/ChangeLog
   trunk/patches/dev300/apply

Modified: trunk/patches/dev300/apply
==============================================================================
--- trunk/patches/dev300/apply	(original)
+++ trunk/patches/dev300/apply	Fri Mar 20 23:42:35 2009
@@ -2025,8 +2025,6 @@
 
 [ CalcFixes  > dev300-m42 > ooo310-m1]
 # Support PHONETIC function to display asian phonetic guide.
-# FIXME: update by pmladek for ooo310-m2; Kohei, please review sc/inc/cell.hxx
-#        they started to define the inline method inside the class definition, ...
 calc-formula-asian-phonetic.diff, i#80764, i#80765, i#80766, kohei
 
 [ CalcFixes ]
@@ -2049,6 +2047,9 @@
 # Display references when entering input mode, even when the separators are not ';'.
 calc-formula-variable-separators-ref-display.diff, n#469395, kohei
 
+# Fix chart breakage for non-default formula syntax (Excel A1 and R1C1).
+chart-formula-syntax.diff, n#487350, 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/chart-formula-syntax.diff
==============================================================================
--- (empty file)
+++ trunk/patches/dev300/chart-formula-syntax.diff	Fri Mar 20 23:42:35 2009
@@ -0,0 +1,154 @@
+diff --git sc/inc/reftokenhelper.hxx sc/inc/reftokenhelper.hxx
+index b1159cc..d7b335f 100644
+--- sc/inc/reftokenhelper.hxx
++++ sc/inc/reftokenhelper.hxx
+@@ -56,7 +56,8 @@ public:
+      * The source range may consist of multiple ranges separated by ';'s. 
+      */
+     static void compileRangeRepresentation(
+-        ::std::vector<ScSharedTokenRef>& rRefTokens, const ::rtl::OUString& rRangeStr, ScDocument* pDoc);
++        ::std::vector<ScSharedTokenRef>& rRefTokens, const ::rtl::OUString& rRangeStr, ScDocument* pDoc,
++        ::formula::FormulaGrammar::Grammar eGrammar = ::formula::FormulaGrammar::GRAM_ENGLISH);
+ 
+     static bool getRangeFromToken(ScRange& rRange, const ScSharedTokenRef& pToken, bool bExternal = false);
+ 
+diff --git sc/source/core/data/documen5.cxx sc/source/core/data/documen5.cxx
+index 19f6b09..a921945 100644
+--- sc/source/core/data/documen5.cxx
++++ sc/source/core/data/documen5.cxx
+@@ -130,6 +130,7 @@ void lcl_SetChartRanges( const uno::Reference< chart2::XChartDocument >& xChartD
+ 
+             if( xLabel.is())
+             {
++                // the range string must be in Calc A1 format.
+                 uno::Reference< chart2::data::XDataSequence > xNewSeq(
+                     xDataProvider->createDataSequenceByRangeRepresentation( rRanges[nRange++] ));
+                 
+@@ -145,6 +146,7 @@ void lcl_SetChartRanges( const uno::Reference< chart2::XChartDocument >& xChartD
+ 
+             if( xValues.is())
+             {
++                // the range string must be in Calc A1 format.
+                 uno::Reference< chart2::data::XDataSequence > xNewSeq(
+                     xDataProvider->createDataSequenceByRangeRepresentation( rRanges[nRange++] ));
+                 
+@@ -391,7 +393,7 @@ void ScDocument::GetChartRanges( const String& rChartName, ::std::vector< ScRang
+         for( sal_Int32 nN=0; nN<aRangeStrings.getLength(); nN++ )
+         {
+             ScRangeList aRanges;
+-            aRanges.Parse( aRangeStrings[nN], pSheetNameDoc );
++            aRanges.Parse( aRangeStrings[nN], pSheetNameDoc, SCA_VALID, pSheetNameDoc->GetAddressConvention() );
+             rRangesVector.push_back(aRanges);
+         }
+     }
+@@ -407,8 +409,8 @@ void ScDocument::SetChartRanges( const String& rChartName, const ::std::vector<
+         for( sal_Int32 nN=0; nN<nCount; nN++ )
+         {
+             ScRangeList aScRangeList( rRangesVector[nN] );
+-            String sRangeStr;
+-            aScRangeList.Format( sRangeStr, SCR_ABS_3D, this, GetAddressConvention() );
++            String sRangeStr; // This range must be in Calc A1 format.
++            aScRangeList.Format( sRangeStr, SCR_ABS_3D, this );
+             aRangeStrings[nN]=sRangeStr;
+         }
+         lcl_SetChartRanges( xChartDoc, aRangeStrings );
+diff --git sc/source/core/tool/reftokenhelper.cxx sc/source/core/tool/reftokenhelper.cxx
+index 8ecb44a..0e07819 100644
+--- sc/source/core/tool/reftokenhelper.cxx
++++ sc/source/core/tool/reftokenhelper.cxx
+@@ -49,7 +49,7 @@ using ::std::auto_ptr;
+ using ::rtl::OUString;
+ 
+ void ScRefTokenHelper::compileRangeRepresentation(
+-    vector<ScSharedTokenRef>& rRefTokens, const OUString& rRangeStr, ScDocument* pDoc)
++    vector<ScSharedTokenRef>& rRefTokens, const OUString& rRangeStr, ScDocument* pDoc, FormulaGrammar::Grammar eGrammar)
+ {
+     const sal_Unicode cSep = ';';
+     const sal_Unicode cQuote = '\'';
+@@ -63,7 +63,7 @@ void ScRefTokenHelper::compileRangeRepresentation(
+             break;
+         
+         ScCompiler aCompiler(pDoc, ScAddress(0,0,0));
+-        aCompiler.SetGrammar(FormulaGrammar::GRAM_ENGLISH);
++        aCompiler.SetGrammar(eGrammar);
+         auto_ptr<ScTokenArray> pArray(aCompiler.CompileString(aToken));
+ 
+         // There should only be one reference per range token.
+diff --git sc/source/ui/drawfunc/fuins2.cxx sc/source/ui/drawfunc/fuins2.cxx
+index f2562a3..22b46b9 100644
+--- sc/source/ui/drawfunc/fuins2.cxx
++++ sc/source/ui/drawfunc/fuins2.cxx
+@@ -167,8 +167,10 @@ void lcl_ChartInit( const uno::Reference < embed::XEmbeddedObject >& xObj, ScVie
+             if ( aRangeListRef->Count() )
+             {
+                 pScDoc->LimitChartIfAll( aRangeListRef );               // limit whole columns/rows to used area
++
++                // update string from modified ranges.  The ranges must be in the current formula syntax.
+                 String aTmpStr;                            
+-                aRangeListRef->Format( aTmpStr, SCR_ABS_3D, pScDoc, pScDoc->GetAddressConvention() );   // update string from changed ranges
++                aRangeListRef->Format( aTmpStr, SCR_ABS_3D, pScDoc, pScDoc->GetAddressConvention() );
+                 aRangeString = aTmpStr;
+ 
+                 ScChartPositioner aChartPositioner( pScDoc, aRangeListRef );
+diff --git sc/source/ui/unoobj/chart2uno.cxx sc/source/ui/unoobj/chart2uno.cxx
+index 8bbd382..d9c2698 100644
+--- sc/source/ui/unoobj/chart2uno.cxx
++++ sc/source/ui/unoobj/chart2uno.cxx
+@@ -1057,7 +1057,7 @@ void lcl_SeperateOneRowRange(ScRange aR, const ScAddress& rPos, ScRangeListRef&
+     }
+ 
+     vector<ScSharedTokenRef> aTokens;
+-    ScRefTokenHelper::compileRangeRepresentation(aTokens, aRangeRepresentation, m_pDocument);
++    ScRefTokenHelper::compileRangeRepresentation(aTokens, aRangeRepresentation, m_pDocument, m_pDocument->GetGrammar());
+     return !aTokens.empty();
+ }
+ 
+@@ -1451,7 +1451,7 @@ ScChart2DataProvider::createDataSource(
+     }
+ 
+     vector<ScSharedTokenRef> aRefTokens;
+-    ScRefTokenHelper::compileRangeRepresentation(aRefTokens, aRangeRepresentation, m_pDocument);
++    ScRefTokenHelper::compileRangeRepresentation(aRefTokens, aRangeRepresentation, m_pDocument, m_pDocument->GetGrammar());
+     if (aRefTokens.empty())
+         // Invalid range representation.  Bail out.
+         throw lang::IllegalArgumentException();
+@@ -2184,7 +2184,7 @@ uno::Sequence< beans::PropertyValue > SAL_CALL ScChart2DataProvider::detectArgum
+         return false;
+ 
+     vector<ScSharedTokenRef> aTokens;
+-    ScRefTokenHelper::compileRangeRepresentation(aTokens, aRangeRepresentation, m_pDocument);
++    ScRefTokenHelper::compileRangeRepresentation(aTokens, aRangeRepresentation, m_pDocument, m_pDocument->GetGrammar());
+     return !aTokens.empty();
+ }
+ 
+@@ -2201,6 +2201,12 @@ uno::Reference< chart2::data::XDataSequence > SAL_CALL
+     if(!m_pDocument || (aRangeRepresentation.getLength() == 0))
+         return xResult;
+ 
++    // Note: the range representation must be in Calc A1 format.  The import 
++    // filters use this method to pass data ranges, and they have no idea what
++    // the current formula syntax is.  In the future we should add another
++    // method to allow the client code to directly pass tokens representing
++    // ranges.
++
+     vector<ScSharedTokenRef> aRefTokens;
+     ScRefTokenHelper::compileRangeRepresentation(aRefTokens, aRangeRepresentation, m_pDocument);
+     if (aRefTokens.empty())
+@@ -2246,7 +2252,7 @@ rtl::OUString SAL_CALL ScChart2DataProvider::convertRangeToXML( const rtl::OUStr
+         return aRet;
+ 
+     vector<ScSharedTokenRef> aRefTokens;
+-    ScRefTokenHelper::compileRangeRepresentation(aRefTokens, sRangeRepresentation, m_pDocument);
++    ScRefTokenHelper::compileRangeRepresentation(aRefTokens, sRangeRepresentation, m_pDocument, m_pDocument->GetGrammar());
+     if (aRefTokens.empty())
+         throw lang::IllegalArgumentException();
+ 
+@@ -2405,7 +2411,7 @@ void ScChart2DataProvider::detectRangesFromDataSource(vector<ScSharedTokenRef>&
+     {
+         const OUString& rRangeRep = *itr;
+         vector<ScSharedTokenRef> aTokens;
+-        ScRefTokenHelper::compileRangeRepresentation(aTokens, rRangeRep, m_pDocument);
++        ScRefTokenHelper::compileRangeRepresentation(aTokens, rRangeRep, m_pDocument, m_pDocument->GetGrammar());
+ 
+         CollectRefTokens func;
+         func = for_each(aTokens.begin(), aTokens.end(), func);



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