[Libreoffice-commits] core.git: Branch 'libreoffice-4-3' - sc/source
Kohei Yoshida
kohei.yoshida at collabora.com
Fri May 30 12:01:25 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/FTestDialog.cxx | 2
sc/source/ui/StatisticsDialogs/MatrixComparisonGenerator.cxx | 2
sc/source/ui/StatisticsDialogs/MovingAverageDialog.cxx | 2
sc/source/ui/StatisticsDialogs/TTestDialog.cxx | 2
sc/source/ui/StatisticsDialogs/TableFillingAndNavigationTools.cxx | 22 +++++-----
sc/source/ui/inc/TableFillingAndNavigationTools.hxx | 13 ++---
9 files changed, 28 insertions(+), 26 deletions(-)
New commits:
commit 16e299afa4051affc357fe7990d7632b37c6aea7
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.
Change-Id: Id3e104043f08b6786de2e91d69361557b83890f9
(cherry picked from commit 0ab538885d818a7b3706df48a625e2523a8ebbdf)
diff --git a/sc/source/ui/StatisticsDialogs/AnalysisOfVarianceDialog.cxx b/sc/source/ui/StatisticsDialogs/AnalysisOfVarianceDialog.cxx
index 0961760..a764c13 100644
--- a/sc/source/ui/StatisticsDialogs/AnalysisOfVarianceDialog.cxx
+++ b/sc/source/ui/StatisticsDialogs/AnalysisOfVarianceDialog.cxx
@@ -548,7 +548,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);
if (meFactor == SINGLE_FACTOR)
{
diff --git a/sc/source/ui/StatisticsDialogs/DescriptiveStatisticsDialog.cxx b/sc/source/ui/StatisticsDialogs/DescriptiveStatisticsDialog.cxx
index 3c56be5..0d98e79 100644
--- a/sc/source/ui/StatisticsDialogs/DescriptiveStatisticsDialog.cxx
+++ b/sc/source/ui/StatisticsDialogs/DescriptiveStatisticsDialog.cxx
@@ -84,7 +84,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)
@@ -94,6 +94,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() )
{
@@ -128,7 +131,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 9f2b8e2..091f1a0 100644
--- a/sc/source/ui/StatisticsDialogs/ExponentialSmoothingDialog.cxx
+++ b/sc/source/ui/StatisticsDialogs/ExponentialSmoothingDialog.cxx
@@ -53,7 +53,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/FTestDialog.cxx b/sc/source/ui/StatisticsDialogs/FTestDialog.cxx
index 6f07778..785d475 100644
--- a/sc/source/ui/StatisticsDialogs/FTestDialog.cxx
+++ b/sc/source/ui/StatisticsDialogs/FTestDialog.cxx
@@ -63,7 +63,7 @@ ScRange ScFTestDialog::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> pVariable1Iterator;
if (mGroupedBy == BY_COLUMN)
diff --git a/sc/source/ui/StatisticsDialogs/MatrixComparisonGenerator.cxx b/sc/source/ui/StatisticsDialogs/MatrixComparisonGenerator.cxx
index ca9de24..ac7039a 100644
--- a/sc/source/ui/StatisticsDialogs/MatrixComparisonGenerator.cxx
+++ b/sc/source/ui/StatisticsDialogs/MatrixComparisonGenerator.cxx
@@ -70,7 +70,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 aafe290..2786e53 100644
--- a/sc/source/ui/StatisticsDialogs/MovingAverageDialog.cxx
+++ b/sc/source/ui/StatisticsDialogs/MovingAverageDialog.cxx
@@ -53,7 +53,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/TTestDialog.cxx b/sc/source/ui/StatisticsDialogs/TTestDialog.cxx
index 9e335c9..144be46 100644
--- a/sc/source/ui/StatisticsDialogs/TTestDialog.cxx
+++ b/sc/source/ui/StatisticsDialogs/TTestDialog.cxx
@@ -63,7 +63,7 @@ ScRange ScTTestDialog::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> pVariable1Iterator;
if (mGroupedBy == BY_COLUMN)
diff --git a/sc/source/ui/StatisticsDialogs/TableFillingAndNavigationTools.cxx b/sc/source/ui/StatisticsDialogs/TableFillingAndNavigationTools.cxx
index 51b9541..d448e8f 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(const OUString& aTemplate)
{
@@ -33,7 +30,7 @@ void FormulaTemplate::setTemplate(const char* aTemplate)
mTemplate = OUString::createFromAscii(aTemplate);
}
-OUString& FormulaTemplate::getTemplate()
+const OUString& FormulaTemplate::getTemplate()
{
RangeReplacementMap::iterator itRange;
for (itRange = mRangeReplacementMap.begin(); itRange != mRangeReplacementMap.end(); ++itRange)
@@ -58,22 +55,25 @@ void FormulaTemplate::autoReplaceAddress(const OUString& aVariable, ScAddress aA
mAddressReplacementMap.insert ( std::pair<OUString, ScAddress>(aVariable, aAddress) );
}
-void FormulaTemplate::applyRange(const 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(const OUString& aVariable, const 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(const 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 853fa5a..d45e3a9 100644
--- a/sc/source/ui/inc/TableFillingAndNavigationTools.hxx
+++ b/sc/source/ui/inc/TableFillingAndNavigationTools.hxx
@@ -25,8 +25,7 @@ class FormulaTemplate
{
private:
OUString mTemplate;
- ScDocument* mDocument;
- ScAddress::Details mAddressDetails;
+ ScDocument* mpDoc;
typedef std::map<OUString, ScRange> RangeReplacementMap;
typedef std::map<OUString, ScAddress> AddressReplacementMap;
@@ -35,18 +34,18 @@ private:
RangeReplacementMap mRangeReplacementMap;
public:
- FormulaTemplate(ScDocument* aDocument, ScAddress::Details aAddressDetails);
+ FormulaTemplate(ScDocument* pDoc);
void setTemplate(const OUString& aTemplate);
void setTemplate(const char* aTemplate);
- OUString& getTemplate();
+ const OUString& getTemplate();
void autoReplaceRange(const OUString& aVariable, ScRange aRange);
void autoReplaceAddress(const OUString& aVariable, ScAddress aAddress);
- void applyRange(const OUString& aVariable, ScRange aRange);
- void applyRangeList(const OUString& aVariable, const ScRangeList& aRangeList);
- void applyAddress(const OUString& aVariable, ScAddress aAddress);
+ 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(const OUString& aVariable, const OUString& aValue);
void applyNumber(const OUString& aVariable, sal_Int32 aValue);
};
More information about the Libreoffice-commits
mailing list