diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-09-08 10:54:30 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-09-08 12:15:16 +0200 |
commit | f120e21012d1fcdaf9862d3818a43f37d3d0fb0b (patch) | |
tree | 5e2137817229e30f0708cb3c0d03016a990cdea7 /sc | |
parent | 1af5f6e8d1bdec9bd2f14d0f5f8fad9c0fdead2b (diff) |
convert pEntryLists to std::array<std::unique_ptr<...
Change-Id: Ibe5d97c7a5138f1fd47cb2419c33b8f78ff1559c
Reviewed-on: https://gerrit.libreoffice.org/42094
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/ui/dbgui/pfiltdlg.cxx | 18 | ||||
-rw-r--r-- | sc/source/ui/inc/pfiltdlg.hxx | 5 |
2 files changed, 11 insertions, 12 deletions
diff --git a/sc/source/ui/dbgui/pfiltdlg.cxx b/sc/source/ui/dbgui/pfiltdlg.cxx index aab52b766df9..4b28bd0c202d 100644 --- a/sc/source/ui/dbgui/pfiltdlg.cxx +++ b/sc/source/ui/dbgui/pfiltdlg.cxx @@ -74,9 +74,6 @@ ScPivotFilterDlg::ScPivotFilterDlg(vcl::Window* pParent, const SfxItemSet& rArgS get(m_pBtnUnique, "unique"); get(m_pFtDbArea, "dbarea"); - for (sal_uInt16 i=0; i<=MAXCOL; i++) - pEntryLists[i] = nullptr; - Init( rArgSet ); } @@ -87,8 +84,7 @@ ScPivotFilterDlg::~ScPivotFilterDlg() void ScPivotFilterDlg::dispose() { - for (sal_uInt16 i=0; i<=MAXCOL; i++) - delete pEntryLists[i]; + for (auto& a : m_pEntryLists) a.reset(); delete pOutItem; m_pLbField1.clear(); @@ -305,7 +301,7 @@ void ScPivotFilterDlg::UpdateValueList( sal_uInt16 nList ) if ( pDoc && nFieldSelPos ) { SCCOL nColumn = theQueryData.nCol1 + static_cast<SCCOL>(nFieldSelPos) - 1; - if (!pEntryLists[nColumn]) + if (!m_pEntryLists[nColumn]) { WaitObject aWaiter( this ); @@ -315,12 +311,12 @@ void ScPivotFilterDlg::UpdateValueList( sal_uInt16 nList ) nFirstRow++; bool bHasDates = false; bool bCaseSens = m_pBtnCase->IsChecked(); - pEntryLists[nColumn] = new std::vector<ScTypedStrData>; + m_pEntryLists[nColumn].reset( new std::vector<ScTypedStrData> ); pDoc->GetFilterEntriesArea( - nColumn, nFirstRow, nLastRow, nTab, bCaseSens, *pEntryLists[nColumn], bHasDates); + nColumn, nFirstRow, nLastRow, nTab, bCaseSens, *m_pEntryLists[nColumn], bHasDates); } - std::vector<ScTypedStrData>* pColl = pEntryLists[nColumn]; + std::vector<ScTypedStrData>* pColl = m_pEntryLists[nColumn].get(); std::vector<ScTypedStrData>::const_iterator it = pColl->begin(), itEnd = pColl->end(); for (; it != itEnd; ++it) { @@ -522,8 +518,8 @@ IMPL_LINK( ScPivotFilterDlg, CheckBoxHdl, Button*, pBox, void ) if (pBox == m_pBtnCase) // value lists { - for (sal_uInt16 i=0; i<=MAXCOL; i++) - DELETEZ( pEntryLists[i] ); + for (auto& a : m_pEntryLists) + a.reset(); OUString aCurVal1 = m_pEdVal1->GetText(); OUString aCurVal2 = m_pEdVal2->GetText(); diff --git a/sc/source/ui/inc/pfiltdlg.hxx b/sc/source/ui/inc/pfiltdlg.hxx index d54468a15870..74df89df5bc0 100644 --- a/sc/source/ui/inc/pfiltdlg.hxx +++ b/sc/source/ui/inc/pfiltdlg.hxx @@ -28,6 +28,9 @@ #include <vcl/combobox.hxx> #include "address.hxx" #include "queryparam.hxx" +#include <array> +#include <memory> +#include <vector> class ScViewData; class ScDocument; @@ -78,7 +81,7 @@ private: VclPtr<ListBox> aFieldLbArr[3]; VclPtr<ListBox> aCondLbArr[3]; - std::vector<ScTypedStrData>* pEntryLists[MAXCOLCOUNT]; + std::array<std::unique_ptr<std::vector<ScTypedStrData>>, MAXCOLCOUNT> m_pEntryLists; private: void Init ( const SfxItemSet& rArgSet ); |