[Libreoffice-commits] .: Branch 'libreoffice-3-5' - sc/source

Kohei Yoshida kohei at kemper.freedesktop.org
Wed Jan 4 21:26:33 PST 2012


 sc/source/core/data/documen5.cxx              |    4 ++--
 sc/source/core/tool/charthelper.cxx           |    2 --
 sc/source/core/tool/rangeutl.cxx              |   13 +++++++------
 sc/source/filter/excel/xichart.cxx            |    2 +-
 sc/source/filter/xml/XMLTableShapeResizer.cxx |    4 ++--
 sc/source/ui/unoobj/chart2uno.cxx             |   10 ++--------
 6 files changed, 14 insertions(+), 21 deletions(-)

New commits:
commit 0c47ce165d56c13abea1e78f4feeed6c3dd3f59b
Author: Kohei Yoshida <kohei.yoshida at suse.com>
Date:   Thu Jan 5 00:25:40 2012 -0500

    Removed the restriction to always pass Calc A1 formatted data ranges.
    
    This change also fixes the bug where changing data series ranges was
    impossible to do when the formula syntax was not Calc A1.

diff --git a/sc/source/core/data/documen5.cxx b/sc/source/core/data/documen5.cxx
index 4a1c2b4..f19a067 100644
--- a/sc/source/core/data/documen5.cxx
+++ b/sc/source/core/data/documen5.cxx
@@ -297,8 +297,8 @@ void ScDocument::SetChartRanges( const rtl::OUString& rChartName, const ::std::v
         for( sal_Int32 nN=0; nN<nCount; nN++ )
         {
             ScRangeList aScRangeList( rRangesVector[nN] );
-            rtl::OUString sRangeStr; // This range must be in Calc A1 format.
-            aScRangeList.Format( sRangeStr, SCR_ABS_3D, this );
+            rtl::OUString sRangeStr;
+            aScRangeList.Format( sRangeStr, SCR_ABS_3D, this, GetAddressConvention() );
             aRangeStrings[nN]=sRangeStr;
         }
         ScChartHelper::SetChartRanges( xChartDoc, aRangeStrings );
diff --git a/sc/source/core/tool/charthelper.cxx b/sc/source/core/tool/charthelper.cxx
index e1f0500..6cd84f1 100644
--- a/sc/source/core/tool/charthelper.cxx
+++ b/sc/source/core/tool/charthelper.cxx
@@ -248,7 +248,6 @@ void ScChartHelper::SetChartRanges( const uno::Reference< chart2::XChartDocument
 
             if( xLabel.is())
             {
-                // the range string must be in Calc A1 format.
                 uno::Reference< chart2::data::XDataSequence > xNewSeq(
                     xDataProvider->createDataSequenceByRangeRepresentation( rRanges[nRange++] ));
 
@@ -264,7 +263,6 @@ void ScChartHelper::SetChartRanges( const uno::Reference< chart2::XChartDocument
 
             if( xValues.is())
             {
-                // the range string must be in Calc A1 format.
                 uno::Reference< chart2::data::XDataSequence > xNewSeq(
                     xDataProvider->createDataSequenceByRangeRepresentation( rRanges[nRange++] ));
 
diff --git a/sc/source/core/tool/rangeutl.cxx b/sc/source/core/tool/rangeutl.cxx
index 5e1db5d..572ff17 100644
--- a/sc/source/core/tool/rangeutl.cxx
+++ b/sc/source/core/tool/rangeutl.cxx
@@ -834,13 +834,13 @@ static void lcl_appendCellAddress(
         rBuf.append(sal_Unicode('.'));
 
         String aAddr;
-        rCell.Format(aAddr, SCA_ABS, NULL, ::formula::FormulaGrammar::CONV_OOO);
+        rCell.Format(aAddr, SCA_ABS, NULL, pDoc->GetAddressConvention());
         rBuf.append(aAddr);
     }
     else
     {
         String aAddr;
-        rCell.Format(aAddr, SCA_ABS_3D, pDoc, ::formula::FormulaGrammar::CONV_OOO);
+        rCell.Format(aAddr, SCA_ABS_3D, pDoc, pDoc->GetAddressConvention());
         rBuf.append(aAddr);
     }
 }
@@ -869,7 +869,7 @@ static void lcl_appendCellRangeAddress(
         rBuf.append(sal_Unicode('.'));
 
         String aAddr;
-        rCell1.Format(aAddr, SCA_ABS, NULL, ::formula::FormulaGrammar::CONV_OOO);
+        rCell1.Format(aAddr, SCA_ABS, NULL, pDoc->GetAddressConvention());
         rBuf.append(aAddr);
 
         rBuf.appendAscii(":");
@@ -881,7 +881,7 @@ static void lcl_appendCellRangeAddress(
             rBuf.append(sal_Unicode('.'));
         }
 
-        rCell2.Format(aAddr, SCA_ABS, NULL, ::formula::FormulaGrammar::CONV_OOO);
+        rCell2.Format(aAddr, SCA_ABS, NULL, pDoc->GetAddressConvention());
         rBuf.append(aAddr);
     }
     else
@@ -890,7 +890,7 @@ static void lcl_appendCellRangeAddress(
         aRange.aStart = rCell1;
         aRange.aEnd   = rCell2;
         String aAddr;
-        aRange.Format(aAddr, SCR_ABS_3D, pDoc, ::formula::FormulaGrammar::CONV_OOO);
+        aRange.Format(aAddr, SCR_ABS_3D, pDoc, pDoc->GetAddressConvention());
         rBuf.append(aAddr);
     }
 }
@@ -898,7 +898,8 @@ static void lcl_appendCellRangeAddress(
 void ScRangeStringConverter::GetStringFromXMLRangeString( OUString& rString, const OUString& rXMLRange, ScDocument* pDoc )
 {
     FormulaGrammar::AddressConvention eConv = pDoc->GetAddressConvention();
-    const sal_Unicode cSep = ' ', cSepNew = ';';
+    const sal_Unicode cSep = ' ';
+    const sal_Unicode cSepNew = ScCompiler::GetNativeSymbol(ocSep).GetChar(0);
     const sal_Unicode cQuote = '\'';
 
     OUStringBuffer aRetStr;
diff --git a/sc/source/filter/excel/xichart.cxx b/sc/source/filter/excel/xichart.cxx
index 5ae9215..8cf884d 100644
--- a/sc/source/filter/excel/xichart.cxx
+++ b/sc/source/filter/excel/xichart.cxx
@@ -847,7 +847,7 @@ Reference< XDataSequence > XclImpChSourceLink::CreateDataSequence( const OUStrin
     if( xDataProv.is() && mxTokenArray )
     {
         ScCompiler aComp( GetDocPtr(), ScAddress(), *mxTokenArray );
-        aComp.SetGrammar( ::formula::FormulaGrammar::GRAM_ENGLISH );
+        aComp.SetGrammar(GetDoc().GetGrammar());
         OUStringBuffer aRangeRep;
         aComp.CreateStringFromTokenArray( aRangeRep );
         try
diff --git a/sc/source/filter/xml/XMLTableShapeResizer.cxx b/sc/source/filter/xml/XMLTableShapeResizer.cxx
index 2007b78..6bf445f 100644
--- a/sc/source/filter/xml/XMLTableShapeResizer.cxx
+++ b/sc/source/filter/xml/XMLTableShapeResizer.cxx
@@ -79,7 +79,6 @@ void ScMyOLEFixer::CreateChartListener(ScDocument* pDoc,
     }
 
     OUString aRangeStr;
-    // This one returns ranges with ';' as the separators.
     ScRangeStringConverter::GetStringFromXMLRangeString(aRangeStr, rRangeList, pDoc);
     if (!aRangeStr.getLength())
     {
@@ -96,8 +95,9 @@ void ScMyOLEFixer::CreateChartListener(ScDocument* pDoc,
     SAL_WNODEPRECATED_DECLARATIONS_PUSH
     auto_ptr< vector<ScTokenRef> > pRefTokens(new vector<ScTokenRef>);
     SAL_WNODEPRECATED_DECLARATIONS_POP
+        const sal_Unicode cSep = ScCompiler::GetNativeSymbol(ocSep).GetChar(0);
     ScRefTokenHelper::compileRangeRepresentation(
-        *pRefTokens, aRangeStr, pDoc, ';', formula::FormulaGrammar::GRAM_ENGLISH);
+        *pRefTokens, aRangeStr, pDoc, cSep, pDoc->GetGrammar());
     if (!pRefTokens->empty())
     {
         ScChartListener* pCL(new ScChartListener(rName, pDoc, pRefTokens.release()));
diff --git a/sc/source/ui/unoobj/chart2uno.cxx b/sc/source/ui/unoobj/chart2uno.cxx
index dcdffbe..3fa4ccf 100644
--- a/sc/source/ui/unoobj/chart2uno.cxx
+++ b/sc/source/ui/unoobj/chart2uno.cxx
@@ -2076,16 +2076,10 @@ 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, with English
-    // function names and ';' as the union operator in case of multiple
-    // ranges. 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<ScTokenRef> aRefTokens;
+    const sal_Unicode cSep = ScCompiler::GetNativeSymbol(ocSep).GetChar(0);
     ScRefTokenHelper::compileRangeRepresentation(
-        aRefTokens, aRangeRepresentation, m_pDocument, ';', FormulaGrammar::GRAM_ENGLISH);
+        aRefTokens, aRangeRepresentation, m_pDocument, cSep, m_pDocument->GetGrammar());
     if (aRefTokens.empty())
         return xResult;
 


More information about the Libreoffice-commits mailing list