summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2017-02-27 16:39:25 +0100
committerTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2017-03-30 23:52:42 +0200
commitb213492f09a52a283a05ebd774b804cc551070d3 (patch)
treed88f3696024c5d5e3592785f2f2c14624350ae24
parent2f73e9dad81780c8dcb4ac9b42fe682677fbadf5 (diff)
fix warnings, clean-up and remove unused thing
Change-Id: Ia2061663fe1ee87bc37d9a20766ef0363caa21be
-rw-r--r--sc/inc/PivotChartDataSequence.hxx5
-rw-r--r--sc/source/ui/unoobj/PivotChartDataProvider.cxx120
-rw-r--r--sc/source/ui/unoobj/PivotChartDataSequence.cxx19
3 files changed, 34 insertions, 110 deletions
diff --git a/sc/inc/PivotChartDataSequence.hxx b/sc/inc/PivotChartDataSequence.hxx
index c3f6dd254b1a..c6655bbc3995 100644
--- a/sc/inc/PivotChartDataSequence.hxx
+++ b/sc/inc/PivotChartDataSequence.hxx
@@ -78,7 +78,8 @@ struct PivotChartItem
class PivotChartDataSequence : public PivotChartDataSequence_Base, public SfxListener
{
public:
- explicit PivotChartDataSequence(ScDocument* pDocument, OUString const & sPivotTableName, OUString const & sID, std::vector<PivotChartItem> const & rColumnData);
+ explicit PivotChartDataSequence(ScDocument* pDocument, OUString const & sPivotTableName, OUString const & sID,
+ std::vector<PivotChartItem> const & rData);
virtual ~PivotChartDataSequence() override;
PivotChartDataSequence(const PivotChartDataSequence&) = delete;
@@ -163,7 +164,7 @@ private:
ScDocument* m_pDocument;
OUString m_sPivotTableName;
OUString m_aID;
- std::vector<PivotChartItem> m_aColumnData;
+ std::vector<PivotChartItem> m_aData;
css::uno::Sequence<OUString> m_aShortSideLabels;
css::uno::Sequence<OUString> m_aLongSideLabels;
SfxItemPropertySet m_aPropSet;
diff --git a/sc/source/ui/unoobj/PivotChartDataProvider.cxx b/sc/source/ui/unoobj/PivotChartDataProvider.cxx
index d3be6e49a837..c5b9e40a6929 100644
--- a/sc/source/ui/unoobj/PivotChartDataProvider.cxx
+++ b/sc/source/ui/unoobj/PivotChartDataProvider.cxx
@@ -209,78 +209,25 @@ void PivotChartDataProvider::setLabeledDataSequence(uno::Reference<chart2::data:
xResult->setLabel(uno::Reference<chart2::data::XDataSequence>(pLabelSequence.release()));
}
-
-enum class ArrangeDirection
-{
- COLUMNS,
- ROWS
-};
-
-void lclArrange(std::vector<std::vector<PivotChartItem>>& rResult,
- std::vector<std::vector<OUString>>& rInput,
- std::vector<OUString>& rPath,
- size_t index, ArrangeDirection eDirection)
+uno::Reference<chart2::data::XDataSource> PivotChartDataProvider::createPivotChartCategoriesDataSource(
+ OUString const & rRangeRepresentation,
+ bool bOrientCol)
{
- if (index >= rInput.size() - 1)
- {
- if (eDirection == ArrangeDirection::COLUMNS)
- {
- for (OUString const & rLabel : rInput[index])
- {
- rPath[index] = rLabel;
-
- size_t i = 0;
- rResult.resize(rPath.size());
- for (auto it = rPath.begin(); it != rPath.end(); ++it)
- {
- OUString const & rEach = *it;
- rResult[i].push_back(PivotChartItem(rEach));
- i++;
- }
- }
- }
- else if (eDirection == ArrangeDirection::ROWS)
- {
- size_t i = 0;
- for (OUString const & rLabel : rInput[index])
- {
- rResult.resize(rInput[index].size());
+ uno::Reference<chart2::data::XDataSource> xDataSource;
+ uno::Reference<uno::XComponentContext> xContext(comphelper::getProcessComponentContext());
- rPath[index] = rLabel;
+ if (!xContext.is())
+ return xDataSource;
- for (auto it = rPath.begin(); it != rPath.end(); ++it)
- {
- OUString const & rEach = *it;
- rResult[i].push_back(PivotChartItem(rEach));
- }
- i++;
- }
- }
- }
- else
- {
- for (OUString const & rLabel : rInput[index])
- {
- rPath[index] = rLabel;
- lclArrange(rResult, rInput, rPath, index + 1, eDirection);
- }
- }
-}
+ std::vector<uno::Reference<chart2::data::XLabeledDataSequence>> aLabeledSequences;
-void PivotChartDataProvider::createCategories(
- ScDPSaveData* pSaveData, bool bOrientCol,
- uno::Reference<uno::XComponentContext>& xContext,
- std::vector<uno::Reference<chart2::data::XLabeledDataSequence>>& rOutLabeledSequences)
-{
- ArrangeDirection eDirection = bOrientCol ? ArrangeDirection::COLUMNS
- : ArrangeDirection::ROWS;
if (bOrientCol)
{
for (std::vector<PivotChartItem> const & rCategories : m_aCategoriesColumnOrientation)
{
uno::Reference<chart2::data::XLabeledDataSequence> xResult = createLabeledDataSequence(xContext);
setLabeledDataSequenceValues(xResult, "categories", "Categories", rCategories);
- rOutLabeledSequences.push_back(xResult);
+ aLabeledSequences.push_back(xResult);
}
}
else
@@ -289,27 +236,11 @@ void PivotChartDataProvider::createCategories(
{
uno::Reference<chart2::data::XLabeledDataSequence> xResult = createLabeledDataSequence(xContext);
setLabeledDataSequenceValues(xResult, "categories", "Categories", rCategories);
- rOutLabeledSequences.push_back(xResult);
+ aLabeledSequences.push_back(xResult);
}
}
-}
-
-uno::Reference<chart2::data::XDataSource> PivotChartDataProvider::createPivotChartCategoriesDataSource(OUString const & aRangeRepresentation, bool bOrientCol)
-{
- uno::Reference<chart2::data::XDataSource> xDataSource;
- uno::Reference<uno::XComponentContext> xContext(comphelper::getProcessComponentContext());
- if (!xContext.is())
- return xDataSource;
-
- std::vector<uno::Reference<chart2::data::XLabeledDataSequence>> aLabeledSequences;
- ScDPCollection* pDPs = m_pDocument->GetDPCollection();
- ScDPObject* pDPObject = pDPs->GetByName(m_sPivotTableName);
- ScDPSaveData* pSaveData = pDPObject->GetSaveData();
-
- createCategories(pSaveData, bOrientCol, xContext, aLabeledSequences);
-
- xDataSource.set(new PivotChartDataSource(aRangeRepresentation, aLabeledSequences));
+ xDataSource.set(new PivotChartDataSource(rRangeRepresentation, aLabeledSequences));
return xDataSource;
}
@@ -348,9 +279,6 @@ uno::Reference<chart2::data::XDataSource> PivotChartDataProvider::createPivotCha
sheet::DataPilotFieldOrientation_HIDDEN));
long nDimPos = ScUnoHelpFunctions::GetLongProperty(xDimProp, SC_UNO_DP_POSITION);
- bool bIsDataLayout = ScUnoHelpFunctions::GetBoolProperty(xDimProp, SC_UNO_DP_ISDATALAYOUT);
- bool bHasHiddenMember = ScUnoHelpFunctions::GetBoolProperty(xDimProp, SC_UNO_DP_HAS_HIDDEN_MEMBER);
- sal_Int32 nNumberFormat = ScUnoHelpFunctions::GetLongProperty(xDimProp, SC_UNO_DP_NUMBERFO);
if (eDimOrient != sheet::DataPilotFieldOrientation_HIDDEN)
{
@@ -370,12 +298,10 @@ uno::Reference<chart2::data::XDataSource> PivotChartDataProvider::createPivotCha
{
uno::Reference<uno::XInterface> xLevel = ScUnoHelpFunctions::AnyToInterface(xLevels->getByIndex(nLev));
- uno::Reference<container::XNamed> xLevNam(xLevel, uno::UNO_QUERY);
+ uno::Reference<container::XNamed> xLevName(xLevel, uno::UNO_QUERY);
uno::Reference<sheet::XDataPilotMemberResults> xLevRes(xLevel, uno::UNO_QUERY );
- if (xLevNam.is() && xLevRes.is())
+ if (xLevName.is() && xLevRes.is())
{
- OUString aName = xLevNam->getName();
-
switch (eDimOrient)
{
case sheet::DataPilotFieldOrientation_COLUMN:
@@ -392,7 +318,7 @@ uno::Reference<chart2::data::XDataSource> PivotChartDataProvider::createPivotCha
if (!(rMember.Flags & sheet::MemberResultFlags::CONTINUE))
sValue = rMember.Caption;
- if (nDimPos >= m_aLabels[i].size())
+ if (size_t(nDimPos) >= m_aLabels[i].size())
m_aLabels[i].resize(nDimPos + 1);
m_aLabels[i][nDimPos] = PivotChartItem(sValue);
@@ -415,11 +341,11 @@ uno::Reference<chart2::data::XDataSource> PivotChartDataProvider::createPivotCha
if (!(rMember.Flags & sheet::MemberResultFlags::CONTINUE))
sValue = rMember.Caption;
- if (nDimPos >= m_aCategoriesColumnOrientation.size())
+ if (size_t(nDimPos) >= m_aCategoriesColumnOrientation.size())
m_aCategoriesColumnOrientation.resize(nDimPos + 1);
m_aCategoriesColumnOrientation[nDimPos].push_back(PivotChartItem(sValue));
- if (nDimPos >= m_aCategoriesRowOrientation[i].size())
+ if (size_t(nDimPos) >= m_aCategoriesRowOrientation[i].size())
m_aCategoriesRowOrientation[i].resize(nDimPos + 1);
m_aCategoriesRowOrientation[i][nDimPos] = PivotChartItem(sValue);
@@ -459,7 +385,6 @@ uno::Reference<chart2::data::XDataSource> PivotChartDataProvider::createPivotCha
for (uno::Sequence<sheet::DataResult> const & xDataResults : xDataResultsSequence)
{
-
size_t nIndex = 0;
for (sheet::DataResult const & rDataResult : xDataResults)
{
@@ -536,26 +461,23 @@ uno::Sequence<beans::PropertyValue> SAL_CALL PivotChartDataProvider::detectArgum
return aArguments;
}
-sal_Bool SAL_CALL PivotChartDataProvider::createDataSequenceByRangeRepresentationPossible(const OUString& aRangeRepresentation)
+sal_Bool SAL_CALL PivotChartDataProvider::createDataSequenceByRangeRepresentationPossible(const OUString& /*aRangeRepresentation*/)
{
SolarMutexGuard aGuard;
- if (!m_pDocument)
- return false;
- return true;
+ return false;
}
uno::Reference< chart2::data::XDataSequence > SAL_CALL
- PivotChartDataProvider::createDataSequenceByRangeRepresentation(const OUString& aRangeRepresentation)
+ PivotChartDataProvider::createDataSequenceByRangeRepresentation(const OUString& /*aRangeRepresentation*/)
{
SolarMutexGuard aGuard;
uno::Reference<chart2::data::XDataSequence> xResult;
-
return xResult;
}
uno::Reference<chart2::data::XDataSequence> SAL_CALL
- PivotChartDataProvider::createDataSequenceByValueArray(const OUString& aRole,
- const OUString& aRangeRepresentation)
+ PivotChartDataProvider::createDataSequenceByValueArray(const OUString& /*aRole*/,
+ const OUString& /*aRangeRepresentation*/)
{
return uno::Reference<chart2::data::XDataSequence>();
}
diff --git a/sc/source/ui/unoobj/PivotChartDataSequence.cxx b/sc/source/ui/unoobj/PivotChartDataSequence.cxx
index c30f514ce58c..477d1cbc0603 100644
--- a/sc/source/ui/unoobj/PivotChartDataSequence.cxx
+++ b/sc/source/ui/unoobj/PivotChartDataSequence.cxx
@@ -38,11 +38,12 @@ const SfxItemPropertyMapEntry* lcl_GetDataSequencePropertyMap()
return aDataSequencePropertyMap_Impl;
}
-PivotChartDataSequence::PivotChartDataSequence(ScDocument* pDocument, OUString const & sPivotTableName, OUString const & sID, std::vector<PivotChartItem> const & rColumnData)
+PivotChartDataSequence::PivotChartDataSequence(ScDocument* pDocument, OUString const & sPivotTableName, OUString const & sID,
+ std::vector<PivotChartItem> const & rData)
: m_pDocument(pDocument)
, m_sPivotTableName(sPivotTableName)
, m_aID(sID)
- , m_aColumnData(rColumnData)
+ , m_aData(rData)
, m_aShortSideLabels()
, m_aLongSideLabels()
, m_aPropSet(lcl_GetDataSequencePropertyMap())
@@ -74,10 +75,10 @@ uno::Sequence<uno::Any> SAL_CALL PivotChartDataSequence::getData()
if (!m_pDocument)
throw uno::RuntimeException();
- uno::Sequence<uno::Any> aSeq(m_aColumnData.size());
+ uno::Sequence<uno::Any> aSeq(m_aData.size());
size_t i = 0;
- for (PivotChartItem const & rItem : m_aColumnData)
+ for (PivotChartItem const & rItem : m_aData)
{
if (rItem.m_bIsValue)
aSeq[i] = uno::makeAny<double>(rItem.m_fValue);
@@ -96,10 +97,10 @@ uno::Sequence<double> SAL_CALL PivotChartDataSequence::getNumericalData()
if (!m_pDocument)
throw uno::RuntimeException();
- uno::Sequence<double> aSeq(m_aColumnData.size());
+ uno::Sequence<double> aSeq(m_aData.size());
size_t i = 0;
- for (PivotChartItem const & rItem : m_aColumnData)
+ for (PivotChartItem const & rItem : m_aData)
{
aSeq[i] = rItem.m_fValue;
i++;
@@ -115,10 +116,10 @@ uno::Sequence<OUString> SAL_CALL PivotChartDataSequence::getTextualData()
if (!m_pDocument)
throw uno::RuntimeException();
- uno::Sequence<OUString> aSeq(m_aColumnData.size());
+ uno::Sequence<OUString> aSeq(m_aData.size());
size_t i = 0;
- for (PivotChartItem const & rItem : m_aColumnData)
+ for (PivotChartItem const & rItem : m_aData)
{
if (!rItem.m_bIsValue)
aSeq[i] = rItem.m_aString;
@@ -162,7 +163,7 @@ uno::Reference<util::XCloneable> SAL_CALL PivotChartDataSequence::createClone()
SolarMutexGuard aGuard;
std::unique_ptr<PivotChartDataSequence> pClone;
- pClone.reset(new PivotChartDataSequence(m_pDocument, m_sPivotTableName, m_aID, m_aColumnData));
+ pClone.reset(new PivotChartDataSequence(m_pDocument, m_sPivotTableName, m_aID, m_aData));
pClone->setRole(m_aRole);
pClone->setShortSideLabels(m_aShortSideLabels);
pClone->setLongSideLabels(m_aLongSideLabels);