[Libreoffice-commits] core.git: Branch 'libreoffice-4-2' - sc/source

Kohei Yoshida kohei.yoshida at collabora.com
Sat May 31 09:37:24 PDT 2014


 sc/source/ui/StatisticsDialogs/AnalysisOfVarianceDialog.cxx       |    2 
 sc/source/ui/StatisticsDialogs/DescriptiveStatisticsDialog.cxx    |    7 ++-
 sc/source/ui/StatisticsDialogs/ExponentialSmoothingDialog.cxx     |    2 
 sc/source/ui/StatisticsDialogs/MatrixComparisonGenerator.cxx      |    2 
 sc/source/ui/StatisticsDialogs/MovingAverageDialog.cxx            |    2 
 sc/source/ui/StatisticsDialogs/TableFillingAndNavigationTools.cxx |   22 +++++-----
 sc/source/ui/inc/TableFillingAndNavigationTools.hxx               |   14 +++---
 7 files changed, 27 insertions(+), 24 deletions(-)

New commits:
commit bdf33526442f4a601e6d2a80a4ec3c690b12c3fa
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date:   Fri May 30 14:47:49 2014 -0400

    fdo#79174: Use 3D address when the input and output are on different sheets.
    
    Also some cleanup, mostly to avoid storing separate address convention object,
    which is not really necessary.
    
    (cherry picked from commit 0ab538885d818a7b3706df48a625e2523a8ebbdf)
    
    Conflicts:
    	sc/source/ui/StatisticsDialogs/AnalysisOfVarianceDialog.cxx
    	sc/source/ui/StatisticsDialogs/FTestDialog.cxx
    	sc/source/ui/StatisticsDialogs/TTestDialog.cxx
    	sc/source/ui/StatisticsDialogs/TableFillingAndNavigationTools.cxx
    	sc/source/ui/inc/TableFillingAndNavigationTools.hxx
    
    Change-Id: Id3e104043f08b6786de2e91d69361557b83890f9
    Reviewed-on: https://gerrit.libreoffice.org/9578
    Tested-by: Markus Mohrhard <markus.mohrhard at googlemail.com>
    Reviewed-by: Markus Mohrhard <markus.mohrhard at googlemail.com>

diff --git a/sc/source/ui/StatisticsDialogs/AnalysisOfVarianceDialog.cxx b/sc/source/ui/StatisticsDialogs/AnalysisOfVarianceDialog.cxx
index 0dc9971..920ca3c 100644
--- a/sc/source/ui/StatisticsDialogs/AnalysisOfVarianceDialog.cxx
+++ b/sc/source/ui/StatisticsDialogs/AnalysisOfVarianceDialog.cxx
@@ -106,7 +106,7 @@ ScRange ScAnalysisOfVarianceDialog::ApplyOutput(ScDocShell* pDocShell)
 {
     AddressWalkerWriter output(mOutputAddress, pDocShell, mDocument,
             formula::FormulaGrammar::mergeToGrammar( formula::FormulaGrammar::GRAM_ENGLISH, mAddressDetails.eConv));
-    FormulaTemplate aTemplate(mDocument, mAddressDetails);
+    FormulaTemplate aTemplate(mDocument);
 
     output.writeBoldString(SC_STRLOAD(RID_STATISTICS_DLGS, STR_ANOVA_SINGLE_FACTOR_LABEL));
     output.nextRow();
diff --git a/sc/source/ui/StatisticsDialogs/DescriptiveStatisticsDialog.cxx b/sc/source/ui/StatisticsDialogs/DescriptiveStatisticsDialog.cxx
index 1687773..e81d06b 100644
--- a/sc/source/ui/StatisticsDialogs/DescriptiveStatisticsDialog.cxx
+++ b/sc/source/ui/StatisticsDialogs/DescriptiveStatisticsDialog.cxx
@@ -85,7 +85,7 @@ ScRange ScDescriptiveStatisticsDialog::ApplyOutput(ScDocShell* pDocShell)
 {
     AddressWalkerWriter aOutput(mOutputAddress, pDocShell, mDocument,
             formula::FormulaGrammar::mergeToGrammar( formula::FormulaGrammar::GRAM_ENGLISH, mAddressDetails.eConv));
-    FormulaTemplate aTemplate(mDocument, mAddressDetails);
+    FormulaTemplate aTemplate(mDocument);
 
     boost::scoped_ptr<DataRangeIterator> pIterator;
     if (mGroupedBy == BY_COLUMN)
@@ -95,6 +95,9 @@ ScRange ScDescriptiveStatisticsDialog::ApplyOutput(ScDocShell* pDocShell)
 
     aOutput.nextColumn();
 
+    // Use explicit sheet name in case the input and output are on different sheets.
+    bool b3DAddress = mInputRange.aStart.Tab() != mOutputAddress.Tab();
+
     // Write column/row labels
     for( ; pIterator->hasNext(); pIterator->next() )
     {
@@ -129,7 +132,7 @@ ScRange ScDescriptiveStatisticsDialog::ApplyOutput(ScDocShell* pDocShell)
         for(sal_Int32 i = 0; lclCalcDefinitions[i].aFormula != NULL; i++)
         {
             aTemplate.setTemplate(lclCalcDefinitions[i].aFormula);
-            aTemplate.applyRange(strWildcardRange, pIterator->get());
+            aTemplate.applyRange(strWildcardRange, pIterator->get(), b3DAddress);
             aOutput.writeFormula(aTemplate.getTemplate());
             aOutput.nextRow();
         }
diff --git a/sc/source/ui/StatisticsDialogs/ExponentialSmoothingDialog.cxx b/sc/source/ui/StatisticsDialogs/ExponentialSmoothingDialog.cxx
index 6b20afd..37eadfb 100644
--- a/sc/source/ui/StatisticsDialogs/ExponentialSmoothingDialog.cxx
+++ b/sc/source/ui/StatisticsDialogs/ExponentialSmoothingDialog.cxx
@@ -54,7 +54,7 @@ ScRange ScExponentialSmoothingDialog::ApplyOutput(ScDocShell* pDocShell)
 {
     AddressWalkerWriter output(mOutputAddress, pDocShell, mDocument,
             formula::FormulaGrammar::mergeToGrammar( formula::FormulaGrammar::GRAM_ENGLISH, mAddressDetails.eConv));
-    FormulaTemplate aTemplate(mDocument, mAddressDetails);
+    FormulaTemplate aTemplate(mDocument);
 
     // Smoothing factor
     double aSmoothingFactor = mpSmoothingFactor->GetValue() / 100.0;
diff --git a/sc/source/ui/StatisticsDialogs/MatrixComparisonGenerator.cxx b/sc/source/ui/StatisticsDialogs/MatrixComparisonGenerator.cxx
index a5e5001..b02856f 100644
--- a/sc/source/ui/StatisticsDialogs/MatrixComparisonGenerator.cxx
+++ b/sc/source/ui/StatisticsDialogs/MatrixComparisonGenerator.cxx
@@ -76,7 +76,7 @@ ScRange ScMatrixComparisonGenerator::ApplyOutput(ScDocShell* pDocShell)
 {
     AddressWalkerWriter output(mOutputAddress, pDocShell, mDocument,
             formula::FormulaGrammar::mergeToGrammar( formula::FormulaGrammar::GRAM_ENGLISH, mAddressDetails.eConv));
-    FormulaTemplate aTemplate(mDocument, mAddressDetails);
+    FormulaTemplate aTemplate(mDocument);
 
     SCTAB inTab = mInputRange.aStart.Tab();
 
diff --git a/sc/source/ui/StatisticsDialogs/MovingAverageDialog.cxx b/sc/source/ui/StatisticsDialogs/MovingAverageDialog.cxx
index 85466de..759e42e 100644
--- a/sc/source/ui/StatisticsDialogs/MovingAverageDialog.cxx
+++ b/sc/source/ui/StatisticsDialogs/MovingAverageDialog.cxx
@@ -54,7 +54,7 @@ ScRange ScMovingAverageDialog::ApplyOutput(ScDocShell* pDocShell)
 {
     AddressWalkerWriter output(mOutputAddress, pDocShell, mDocument,
             formula::FormulaGrammar::mergeToGrammar( formula::FormulaGrammar::GRAM_ENGLISH, mAddressDetails.eConv));
-    FormulaTemplate aTemplate(mDocument, mAddressDetails);
+    FormulaTemplate aTemplate(mDocument);
 
     boost::scoped_ptr<DataRangeIterator> pIterator;
     if (mGroupedBy == BY_COLUMN)
diff --git a/sc/source/ui/StatisticsDialogs/TableFillingAndNavigationTools.cxx b/sc/source/ui/StatisticsDialogs/TableFillingAndNavigationTools.cxx
index c6935fe..31e7240 100644
--- a/sc/source/ui/StatisticsDialogs/TableFillingAndNavigationTools.cxx
+++ b/sc/source/ui/StatisticsDialogs/TableFillingAndNavigationTools.cxx
@@ -18,10 +18,7 @@
 
 #include "TableFillingAndNavigationTools.hxx"
 
-FormulaTemplate::FormulaTemplate(ScDocument* aDocument, ScAddress::Details aAddressDetails) :
-    mDocument(aDocument),
-    mAddressDetails(aAddressDetails)
-{}
+FormulaTemplate::FormulaTemplate(ScDocument* pDoc) : mpDoc(pDoc) {}
 
 void FormulaTemplate::setTemplate(OUString aTemplate)
 {
@@ -33,27 +30,30 @@ void FormulaTemplate::setTemplate(const char* aTemplate)
     mTemplate = OUString::createFromAscii(aTemplate);
 }
 
-OUString& FormulaTemplate::getTemplate()
+const OUString& FormulaTemplate::getTemplate()
 {
     return mTemplate;
 }
 
-void FormulaTemplate::applyRange(OUString aVariable, ScRange aRange)
+void FormulaTemplate::applyRange(const OUString& aVariable, const ScRange& aRange, bool b3D)
 {
-    OUString aString = aRange.Format(SCR_ABS, mDocument, mAddressDetails);
+    sal_uInt16 nFlag = b3D ? SCR_ABS_3D : SCR_ABS;
+    OUString aString = aRange.Format(nFlag, mpDoc, mpDoc->GetAddressConvention());
     mTemplate = mTemplate.replaceAll(aVariable, aString);
 }
 
-void FormulaTemplate::applyRangeList(OUString aVariable, ScRangeList aRangeList)
+void FormulaTemplate::applyRangeList(const OUString& aVariable, const ScRangeList& aRangeList, bool b3D)
 {
+    sal_uInt16 nFlag = b3D ? SCR_ABS_3D : SCR_ABS;
     OUString aString;
-    aRangeList.Format(aString, SCR_ABS, mDocument);
+    aRangeList.Format(aString, nFlag, mpDoc, mpDoc->GetAddressConvention());
     mTemplate = mTemplate.replaceAll(aVariable, aString);
 }
 
-void FormulaTemplate::applyAddress(OUString aVariable, ScAddress aAddress)
+void FormulaTemplate::applyAddress(const OUString& aVariable, const ScAddress& aAddress, bool b3D)
 {
-    OUString aString = aAddress.Format(SCR_ABS, mDocument, mAddressDetails);
+    sal_uInt16 nFlag = b3D ? SCA_ABS_3D : SCA_ABS;
+    OUString aString = aAddress.Format(nFlag, mpDoc, mpDoc->GetAddressConvention());
     mTemplate = mTemplate.replaceAll(aVariable, aString);
 }
 
diff --git a/sc/source/ui/inc/TableFillingAndNavigationTools.hxx b/sc/source/ui/inc/TableFillingAndNavigationTools.hxx
index ea9a309..d4bac06 100644
--- a/sc/source/ui/inc/TableFillingAndNavigationTools.hxx
+++ b/sc/source/ui/inc/TableFillingAndNavigationTools.hxx
@@ -25,17 +25,17 @@ class FormulaTemplate
 {
 private:
     OUString            mTemplate;
-    ScDocument*         mDocument;
-    ScAddress::Details  mAddressDetails;
+    ScDocument*         mpDoc;
+
 public:
-    FormulaTemplate(ScDocument* aDocument, ScAddress::Details aAddressDetails);
+    FormulaTemplate(ScDocument* pDoc);
 
     void        setTemplate(OUString aTemplate);
     void        setTemplate(const char* aTemplate);
-    OUString&   getTemplate();
-    void        applyRange(OUString aVariable, ScRange aRange);
-    void        applyRangeList(OUString aVariable, ScRangeList aRangeList);
-    void        applyAddress(OUString aVariable, ScAddress aAddress);
+    const OUString& getTemplate();
+    void        applyRange(const OUString& aVariable, const ScRange& aRange, bool b3D = true);
+    void        applyRangeList(const OUString& aVariable, const ScRangeList& aRangeList, bool b3D = true);
+    void        applyAddress(const OUString& aVariable, const ScAddress& aAddress, bool b3D = true);
     void        applyString(OUString aVariable, OUString aValue);
     void        applyNumber(OUString aVariable, sal_Int32 aValue);
 };


More information about the Libreoffice-commits mailing list