diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-04-19 10:45:32 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-04-19 12:15:44 +0200 |
commit | e6b98044ffe1d376fafc1c06f3159d6a42edee5d (patch) | |
tree | a70acbc7335093f5dff2fa55196d0e618ca1e065 /sfx2 | |
parent | 6c73ca4671958cb066beecade5661e124c497e25 (diff) |
loplugin:inlinefields in SfxSplitWindow
Change-Id: I62ea079e448c871de34d4a48a4e017dd456c7e72
Reviewed-on: https://gerrit.libreoffice.org/36664
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/source/dialog/splitwin.cxx | 41 | ||||
-rw-r--r-- | sfx2/source/inc/splitwin.hxx | 5 |
2 files changed, 22 insertions, 24 deletions
diff --git a/sfx2/source/dialog/splitwin.cxx b/sfx2/source/dialog/splitwin.cxx index a10861ddefaf..e6ee534f67fa 100644 --- a/sfx2/source/dialog/splitwin.cxx +++ b/sfx2/source/dialog/splitwin.cxx @@ -182,7 +182,6 @@ SfxSplitWindow::SfxSplitWindow( vcl::Window* pParent, SfxChildAlignment eAl, : SplitWindow ( pParent, WB_BORDER | WB_SIZEABLE | WB_3DLOOK | WB_HIDE ), eAlign(eAl), pWorkWin(pW), - pDockArr( new SfxDockArr_Impl ), bLocked(false), bPinned(true), pEmptyWin(nullptr), @@ -264,7 +263,7 @@ SfxSplitWindow::SfxSplitWindow( vcl::Window* pParent, SfxChildAlignment eAl, pDock->bNewLine = true; } - pDockArr->insert(pDockArr->begin() + n, std::unique_ptr<SfxDock_Impl>(pDock)); + maDockArr.insert(maDockArr.begin() + n, std::unique_ptr<SfxDock_Impl>(pDock)); } } } @@ -295,7 +294,7 @@ void SfxSplitWindow::dispose() } pEmptyWin.disposeAndClear(); - delete pDockArr; + maDockArr.clear(); pActive.clear(); SplitWindow::dispose(); } @@ -311,7 +310,7 @@ void SfxSplitWindow::SaveConfig_Impl() aWinData.append(','); sal_uInt16 nCount = 0; - for ( auto const & rDock: *pDockArr ) + for ( auto const & rDock: maDockArr ) { if ( rDock->bHide || rDock->pWin ) nCount++; @@ -319,7 +318,7 @@ void SfxSplitWindow::SaveConfig_Impl() aWinData.append(static_cast<sal_Int32>(nCount)); - for ( auto const & rDock: *pDockArr ) + for ( auto const & rDock: maDockArr ) { if ( !rDock->bHide && !rDock->pWin ) continue; @@ -385,10 +384,10 @@ void SfxSplitWindow::Split() std::vector< std::pair< sal_uInt16, long > > aNewOrgSizes; - sal_uInt16 nCount = pDockArr->size(); + sal_uInt16 nCount = maDockArr.size(); for ( sal_uInt16 n=0; n<nCount; n++ ) { - const SfxDock_Impl& rD = *(*pDockArr)[n].get(); + const SfxDock_Impl& rD = *maDockArr[n].get(); if ( rD.pWin ) { const sal_uInt16 nId = rD.nType; @@ -441,10 +440,10 @@ void SfxSplitWindow::InsertWindow( SfxDockingWindow* pDockWin, const Size& rSize bool bNewLine = true; bool bSaveConfig = false; SfxDock_Impl *pFoundDock=nullptr; - sal_uInt16 nCount = pDockArr->size(); + sal_uInt16 nCount = maDockArr.size(); for ( sal_uInt16 n=0; n<nCount; n++ ) { - SfxDock_Impl& rDock = *(*pDockArr)[n].get(); + SfxDock_Impl& rDock = *maDockArr[n].get(); if ( rDock.bNewLine ) { // The window opens a new line @@ -501,7 +500,7 @@ void SfxSplitWindow::InsertWindow( SfxDockingWindow* pDockWin, const Size& rSize // Not found, insert at end pFoundDock = new SfxDock_Impl; pFoundDock->bHide = true; - pDockArr->push_back( std::unique_ptr<SfxDock_Impl>(pFoundDock) ); + maDockArr.push_back( std::unique_ptr<SfxDock_Impl>(pFoundDock) ); pFoundDock->nType = pDockWin->GetType(); nLine++; nPos = 0; @@ -521,17 +520,17 @@ void SfxSplitWindow::InsertWindow( SfxDockingWindow* pDockWin, const Size& rSize void SfxSplitWindow::ReleaseWindow_Impl(SfxDockingWindow *pDockWin, bool bSave) { // The docking window is no longer stored in the internal data. - sal_uInt16 nCount = pDockArr->size(); + sal_uInt16 nCount = maDockArr.size(); for ( sal_uInt16 n=0; n<nCount; n++ ) { - const SfxDock_Impl& rDock = *(*pDockArr)[n].get(); + const SfxDock_Impl& rDock = *maDockArr[n].get(); if ( rDock.nType == pDockWin->GetType() ) { if ( rDock.bNewLine && n<nCount-1 ) - (*pDockArr)[n+1]->bNewLine = true; + maDockArr[n+1]->bNewLine = true; // Window has a position, this we forget - pDockArr->erase(pDockArr->begin() + n); + maDockArr.erase(maDockArr.begin() + n); break; } } @@ -586,14 +585,14 @@ void SfxSplitWindow::InsertWindow( SfxDockingWindow* pDockWin, const Size& rSize // The window must be inserted before the first window so that it has the // same or a greater position than pDockWin. - sal_uInt16 nCount = pDockArr->size(); + sal_uInt16 nCount = maDockArr.size(); sal_uInt16 nLastWindowIdx(0); // If no window is found, a first window is inserted sal_uInt16 nInsertPos = 0; for ( sal_uInt16 n=0; n<nCount; n++ ) { - SfxDock_Impl& rD = *(*pDockArr)[n].get(); + SfxDock_Impl& rD = *maDockArr[n].get(); if (rD.pWin) { @@ -627,7 +626,7 @@ void SfxSplitWindow::InsertWindow( SfxDockingWindow* pDockWin, const Size& rSize nInsertPos = nLastWindowIdx + 1; // ignore all non-windows after the last window } - pDockArr->insert(pDockArr->begin() + nInsertPos, std::unique_ptr<SfxDock_Impl>(pDock)); + maDockArr.insert(maDockArr.begin() + nInsertPos, std::unique_ptr<SfxDock_Impl>(pDock)); InsertWindow_Impl( pDock, rSize, nLine, nPos, bNewLine ); SaveConfig_Impl(); } @@ -741,10 +740,10 @@ void SfxSplitWindow::InsertWindow_Impl( SfxDock_Impl* pDock, { std::vector< std::pair< sal_uInt16, long > > aNewOrgSizes; // get FIXED item sizes - sal_uInt16 nCount = pDockArr->size(); + sal_uInt16 nCount = maDockArr.size(); for ( sal_uInt16 n=0; n<nCount; ++n ) { - const SfxDock_Impl& rD = *(*pDockArr)[n].get(); + const SfxDock_Impl& rD = *maDockArr[n].get(); if ( rD.pWin ) { const sal_uInt16 nId = rD.nType; @@ -797,10 +796,10 @@ void SfxSplitWindow::RemoveWindow( SfxDockingWindow* pDockWin, bool bHide ) pWorkWin->ArrangeAutoHideWindows( this ); } - sal_uInt16 nCount = pDockArr->size(); + sal_uInt16 nCount = maDockArr.size(); for ( sal_uInt16 n=0; n<nCount; n++ ) { - SfxDock_Impl& rDock = *(*pDockArr)[n].get(); + SfxDock_Impl& rDock = *maDockArr[n].get(); if ( rDock.nType == pDockWin->GetType() ) { rDock.pWin = nullptr; diff --git a/sfx2/source/inc/splitwin.hxx b/sfx2/source/inc/splitwin.hxx index 59e3b252383a..fc113acd845a 100644 --- a/sfx2/source/inc/splitwin.hxx +++ b/sfx2/source/inc/splitwin.hxx @@ -38,8 +38,6 @@ struct SfxDock_Impl long nSize; }; -typedef std::vector<std::unique_ptr<SfxDock_Impl> > SfxDockArr_Impl; - class SfxSplitWindow : public SplitWindow { friend class SfxEmptySplitWin_Impl; @@ -47,7 +45,8 @@ friend class SfxEmptySplitWin_Impl; private: SfxChildAlignment eAlign; SfxWorkWindow* pWorkWin; - SfxDockArr_Impl* pDockArr; + std::vector<std::unique_ptr<SfxDock_Impl> > + maDockArr; bool bLocked; bool bPinned; VclPtr<SfxEmptySplitWin_Impl> pEmptyWin; |