[Libreoffice-commits] core.git: sc/source

Tomaž Vajngerl tomaz.vajngerl at collabora.co.uk
Fri Feb 17 22:41:27 UTC 2017


 sc/source/ui/dbgui/PivotLayoutDialog.cxx        |   25 +++++++++---------------
 sc/source/ui/dbgui/PivotLayoutTreeList.cxx      |    8 +------
 sc/source/ui/dbgui/PivotLayoutTreeListBase.cxx  |    2 -
 sc/source/ui/dbgui/PivotLayoutTreeListData.cxx  |   11 ++--------
 sc/source/ui/dbgui/PivotLayoutTreeListLabel.cxx |   15 ++++----------
 5 files changed, 20 insertions(+), 41 deletions(-)

New commits:
commit e75734dfc530a101cadfe263fc256b12acc3a718
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date:   Sun Feb 12 09:48:38 2017 +0100

    Pivot dialog: use C++11 feat., get rid of using namespace std
    
    Change-Id: Ic3690bf94aac2ec69c074eb4707a765bd932e5b0
    Reviewed-on: https://gerrit.libreoffice.org/34173
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Tomaž Vajngerl <quikee at gmail.com>

diff --git a/sc/source/ui/dbgui/PivotLayoutDialog.cxx b/sc/source/ui/dbgui/PivotLayoutDialog.cxx
index 5503c5e..0e0ed4b 100644
--- a/sc/source/ui/dbgui/PivotLayoutDialog.cxx
+++ b/sc/source/ui/dbgui/PivotLayoutDialog.cxx
@@ -571,32 +571,27 @@ void ScPivotLayoutDialog::ApplySaveData(ScDPSaveData& rSaveData)
 
 void ScPivotLayoutDialog::ApplyLabelData(ScDPSaveData& rSaveData)
 {
-    ScDPLabelDataVector::const_iterator it;
     ScDPLabelDataVector& rLabelDataVector = GetLabelDataVector();
 
-    for (it = rLabelDataVector.begin(); it != rLabelDataVector.end(); ++it)
+    for (std::unique_ptr<ScDPLabelData> const & pLabelData : rLabelDataVector)
     {
-        const ScDPLabelData& rLabelData = *it->get();
-
-        OUString aUnoName = ScDPUtil::createDuplicateDimensionName(rLabelData.maName, rLabelData.mnDupCount);
+        OUString aUnoName = ScDPUtil::createDuplicateDimensionName(pLabelData->maName, pLabelData->mnDupCount);
         ScDPSaveDimension* pSaveDimensions = rSaveData.GetExistingDimensionByName(aUnoName);
 
         if (pSaveDimensions == nullptr)
             continue;
 
-        pSaveDimensions->SetUsedHierarchy(rLabelData.mnUsedHier);
-        pSaveDimensions->SetShowEmpty(rLabelData.mbShowAll);
-        pSaveDimensions->SetRepeatItemLabels(rLabelData.mbRepeatItemLabels);
-        pSaveDimensions->SetSortInfo(&rLabelData.maSortInfo);
-        pSaveDimensions->SetLayoutInfo(&rLabelData.maLayoutInfo);
-        pSaveDimensions->SetAutoShowInfo(&rLabelData.maShowInfo);
+        pSaveDimensions->SetUsedHierarchy(pLabelData->mnUsedHier);
+        pSaveDimensions->SetShowEmpty(pLabelData->mbShowAll);
+        pSaveDimensions->SetRepeatItemLabels(pLabelData->mbRepeatItemLabels);
+        pSaveDimensions->SetSortInfo(&pLabelData->maSortInfo);
+        pSaveDimensions->SetLayoutInfo(&pLabelData->maLayoutInfo);
+        pSaveDimensions->SetAutoShowInfo(&pLabelData->maShowInfo);
 
-        bool bManualSort = (rLabelData.maSortInfo.Mode == DataPilotFieldSortMode::MANUAL);
+        bool bManualSort = (pLabelData->maSortInfo.Mode == DataPilotFieldSortMode::MANUAL);
 
-        std::vector<ScDPLabelData::Member>::const_iterator itMember;
-        for (itMember = rLabelData.maMembers.begin(); itMember != rLabelData.maMembers.end(); ++itMember)
+        for (ScDPLabelData::Member const & rLabelMember : pLabelData->maMembers)
         {
-            const ScDPLabelData::Member& rLabelMember = *itMember;
             ScDPSaveMember* pMember = pSaveDimensions->GetMemberByName(rLabelMember.maName);
 
             if (bManualSort || !rLabelMember.mbVisible || !rLabelMember.mbShowDetails)
diff --git a/sc/source/ui/dbgui/PivotLayoutTreeList.cxx b/sc/source/ui/dbgui/PivotLayoutTreeList.cxx
index 98fd3db0..684b000 100644
--- a/sc/source/ui/dbgui/PivotLayoutTreeList.cxx
+++ b/sc/source/ui/dbgui/PivotLayoutTreeList.cxx
@@ -17,8 +17,6 @@
 #include "pivot.hxx"
 #include "scabstdlg.hxx"
 
-using namespace std;
-
 VCL_BUILDER_FACTORY_ARGS(ScPivotLayoutTreeList,
                          WB_BORDER | WB_TABSTOP | WB_CLIPCHILDREN |
                          WB_FORCE_MAKEVISIBLE)
@@ -53,7 +51,7 @@ bool ScPivotLayoutTreeList::DoubleClickHdl()
 
     ScAbstractDialogFactory* pFactory = ScAbstractDialogFactory::Create();
 
-    vector<ScDPName> aDataFieldNames;
+    std::vector<ScDPName> aDataFieldNames;
     mpParent->PushDataFieldNames(aDataFieldNames);
 
     ScopedVclPtr<AbstractScDPSubtotalDlg> pDialog(
@@ -73,10 +71,8 @@ void ScPivotLayoutTreeList::FillFields(ScPivotFieldVector& rFieldVector)
     Clear();
     maItemValues.clear();
 
-    ScPivotFieldVector::iterator it;
-    for (it = rFieldVector.begin(); it != rFieldVector.end(); ++it)
+    for (ScPivotField& rField : rFieldVector)
     {
-        ScPivotField& rField = *it;
         OUString aLabel = mpParent->GetItem( rField.nCol )->maName;
         ScItemValue* pItemValue = new ScItemValue( aLabel, rField.nCol, rField.nFuncMask );
         maItemValues.push_back(std::unique_ptr<ScItemValue>(pItemValue));
diff --git a/sc/source/ui/dbgui/PivotLayoutTreeListBase.cxx b/sc/source/ui/dbgui/PivotLayoutTreeListBase.cxx
index 1fd79e9..d136318 100644
--- a/sc/source/ui/dbgui/PivotLayoutTreeListBase.cxx
+++ b/sc/source/ui/dbgui/PivotLayoutTreeListBase.cxx
@@ -16,8 +16,6 @@
 #include <svtools/treelistentry.hxx>
 #include "scabstdlg.hxx"
 
-using namespace std;
-
 ScPivotLayoutTreeListBase::ScPivotLayoutTreeListBase(vcl::Window* pParent, WinBits nBits, SvPivotTreeListType eType)
     : SvTreeListBox(pParent, nBits)
     , meType(eType)
diff --git a/sc/source/ui/dbgui/PivotLayoutTreeListData.cxx b/sc/source/ui/dbgui/PivotLayoutTreeListData.cxx
index 8eae041..0b82508 100644
--- a/sc/source/ui/dbgui/PivotLayoutTreeListData.cxx
+++ b/sc/source/ui/dbgui/PivotLayoutTreeListData.cxx
@@ -18,8 +18,6 @@
 #include "scabstdlg.hxx"
 #include "globstr.hrc"
 
-using namespace std;
-
 VCL_BUILDER_FACTORY_ARGS(ScPivotLayoutTreeListData,
                          WB_BORDER | WB_TABSTOP | WB_CLIPCHILDREN |
                          WB_FORCE_MAKEVISIBLE)
@@ -113,11 +111,8 @@ void ScPivotLayoutTreeListData::FillDataField(ScPivotFieldVector& rDataFields)
     Clear();
     maDataItemValues.clear();
 
-    ScPivotFieldVector::iterator it;
-    for (it = rDataFields.begin(); it != rDataFields.end(); ++it)
+    for (ScPivotField& rField : rDataFields)
     {
-        ScPivotField& rField = *it;
-
         if (rField.nCol == PIVOT_DATA_FIELD)
             continue;
 
@@ -144,7 +139,7 @@ void ScPivotLayoutTreeListData::FillDataField(ScPivotFieldVector& rDataFields)
     }
 }
 
-void ScPivotLayoutTreeListData::PushDataFieldNames(vector<ScDPName>& rDataFieldNames)
+void ScPivotLayoutTreeListData::PushDataFieldNames(std::vector<ScDPName>& rDataFieldNames)
 {
     SvTreeListEntry* pLoopEntry;
     for (pLoopEntry = First(); pLoopEntry != nullptr; pLoopEntry = Next(pLoopEntry))
@@ -174,7 +169,7 @@ void ScPivotLayoutTreeListData::InsertEntryForSourceTarget(SvTreeListEntry* pSou
 {
     ScItemValue* pItemValue = static_cast<ScItemValue*>(pSource->GetUserData());
 
-    if(mpParent->IsDataElement(pItemValue->maFunctionData.mnCol))
+    if (mpParent->IsDataElement(pItemValue->maFunctionData.mnCol))
         return;
 
     if (HasEntry(pSource))
diff --git a/sc/source/ui/dbgui/PivotLayoutTreeListLabel.cxx b/sc/source/ui/dbgui/PivotLayoutTreeListLabel.cxx
index 9073faa..3f1fd31 100644
--- a/sc/source/ui/dbgui/PivotLayoutTreeListLabel.cxx
+++ b/sc/source/ui/dbgui/PivotLayoutTreeListLabel.cxx
@@ -17,8 +17,6 @@
 #include "pivot.hxx"
 #include "scabstdlg.hxx"
 
-using namespace std;
-
 VCL_BUILDER_FACTORY_ARGS(ScPivotLayoutTreeListLabel,
                          WB_BORDER | WB_TABSTOP | WB_CLIPCHILDREN |
                          WB_FORCE_MAKEVISIBLE);
@@ -37,21 +35,18 @@ void ScPivotLayoutTreeListLabel::FillLabelFields(ScDPLabelDataVector& rLabelVect
     Clear();
     maItemValues.clear();
 
-    ScDPLabelDataVector::iterator it;
-    for (it = rLabelVector.begin(); it != rLabelVector.end(); ++it)
+    for (std::unique_ptr<ScDPLabelData> const & pLabelData : rLabelVector)
     {
-        const ScDPLabelData& rLabelData = *it->get();
-
-        ScItemValue* pValue = new ScItemValue(rLabelData.maName, rLabelData.mnCol, rLabelData.mnFuncMask);
+        ScItemValue* pValue = new ScItemValue(pLabelData->maName, pLabelData->mnCol, pLabelData->mnFuncMask);
         maItemValues.push_back(std::unique_ptr<ScItemValue>(pValue));
-        if (rLabelData.mbDataLayout)
+        if (pLabelData->mbDataLayout)
         {
             maDataItem = maItemValues.size() - 1;
         }
 
-        if (rLabelData.mnOriginalDim < 0 && !rLabelData.mbDataLayout)
+        if (pLabelData->mnOriginalDim < 0 && !pLabelData->mbDataLayout)
         {
-            SvTreeListEntry* pEntry = InsertEntry(rLabelData.maName);
+            SvTreeListEntry* pEntry = InsertEntry(pLabelData->maName);
             pEntry->SetUserData(pValue);
         }
     }


More information about the Libreoffice-commits mailing list