Kaydet (Commit) 1e81e82a authored tarafından Tomaž Vajngerl's avatar Tomaž Vajngerl

StatisticsDialogs: 3D addressing, add size to DataRangeIterator

Automatic filling of addesses always use 3D addresses, with this
commit 3D addressing can be turned of to simplify formulas when
this is possible.

Add size of the current range to DataRangeIterator.

Change-Id: I5c95cfe1617258221fa1a6adf1561e5eeee13c68
üst 9e428d1b
......@@ -18,7 +18,10 @@
#include "TableFillingAndNavigationTools.hxx"
FormulaTemplate::FormulaTemplate(ScDocument* pDoc) : mpDoc(pDoc) {}
FormulaTemplate::FormulaTemplate(ScDocument* pDoc)
: mpDoc(pDoc)
, mbUse3D(true)
{}
void FormulaTemplate::setTemplate(const OUString& aTemplate)
{
......@@ -35,24 +38,25 @@ const OUString& FormulaTemplate::getTemplate()
RangeReplacementMap::iterator itRange;
for (itRange = mRangeReplacementMap.begin(); itRange != mRangeReplacementMap.end(); ++itRange)
{
applyRange(itRange->first, itRange->second);
applyRange(itRange->first, itRange->second, mbUse3D);
}
AddressReplacementMap::iterator itAddress;
for (itAddress = mAddressReplacementMap.begin(); itAddress != mAddressReplacementMap.end(); ++itAddress)
{
applyAddress(itAddress->first, itAddress->second);
applyAddress(itAddress->first, itAddress->second, mbUse3D);
}
return mTemplate;
}
void FormulaTemplate::autoReplaceRange(const OUString& aVariable, const ScRange& rRange)
{
mRangeReplacementMap.insert ( std::pair<OUString, ScRange>(aVariable, rRange) );
mRangeReplacementMap[aVariable] = rRange;
}
void FormulaTemplate::autoReplaceAddress(const OUString& aVariable, ScAddress aAddress)
{
mAddressReplacementMap.insert ( std::pair<OUString, ScAddress>(aVariable, aAddress) );
mAddressReplacementMap[aVariable] = aAddress;
}
void FormulaTemplate::applyRange(const OUString& aVariable, const ScRange& aRange, bool b3D)
......@@ -306,6 +310,11 @@ ScRange DataRangeByColumnIterator::get()
);
}
size_t DataRangeByColumnIterator::size()
{
return mInputRange.aEnd.Row() - mInputRange.aStart.Row() + 1;
}
void DataRangeByColumnIterator::reset()
{
mCol = mInputRange.aStart.Col();
......@@ -342,6 +351,11 @@ ScRange DataRangeByRowIterator::get()
);
}
size_t DataRangeByRowIterator::size()
{
return mInputRange.aEnd.Col() - mInputRange.aStart.Col() + 1;
}
void DataRangeByRowIterator::reset()
{
mRow = mInputRange.aStart.Row();
......@@ -352,4 +366,5 @@ DataCellIterator DataRangeByRowIterator::iterateCells()
return DataCellIterator(get(), true);
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
......@@ -26,6 +26,7 @@ class FormulaTemplate
private:
OUString mTemplate;
ScDocument* mpDoc;
bool mbUse3D;
typedef std::map<OUString, ScRange> RangeReplacementMap;
typedef std::map<OUString, ScAddress> AddressReplacementMap;
......@@ -42,6 +43,7 @@ public:
void autoReplaceRange(const OUString& aVariable, const ScRange& rRange);
void autoReplaceAddress(const OUString& aVariable, ScAddress aAddress);
void autoReplaceUses3D(bool bUse3D = true) { mbUse3D = bUse3D; }
void applyRange(const OUString& aVariable, const ScRange& aRange, bool b3D = true);
void applyRangeList(const OUString& aVariable, const ScRangeList& aRangeList, bool b3D = true);
......@@ -121,8 +123,10 @@ public:
virtual bool hasNext() = 0;
virtual ScRange get() = 0;
virtual size_t size() = 0;
virtual void next() = 0;
virtual void reset() = 0;
sal_Int32 index();
virtual DataCellIterator iterateCells() = 0;
......@@ -139,6 +143,7 @@ public:
virtual bool hasNext() override;
virtual void next() override;
virtual ScRange get() override;
virtual size_t size() override;
virtual void reset() override;
virtual DataCellIterator iterateCells() override;
};
......@@ -154,6 +159,7 @@ public:
virtual bool hasNext() override;
virtual void next() override;
virtual ScRange get() override;
virtual size_t size() override;
virtual void reset() override;
virtual DataCellIterator iterateCells() override;
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment