diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-09-18 09:57:26 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-09-18 15:19:04 +0200 |
commit | 5d86154f49d713dada4aaa541755076cfeefa2c6 (patch) | |
tree | 25c34f4a032526de9798e6f3a69a76d993d739db /sd/source | |
parent | 469892f65d9717fcee7996a040b32d713a83b412 (diff) |
loplugin:unusedfields improve search for unused collection fields
look for collection-like fields that are never added to, and are
therefore effectively unused
Change-Id: Id52c5500ea5e3d2436fb5915aebb86278bf2d925
Reviewed-on: https://gerrit.libreoffice.org/60661
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sd/source')
-rw-r--r-- | sd/source/ui/dlg/RemoteDialogClientBox.cxx | 26 | ||||
-rw-r--r-- | sd/source/ui/dlg/RemoteDialogClientBox.hxx | 3 | ||||
-rw-r--r-- | sd/source/ui/view/viewshel.cxx | 93 |
3 files changed, 36 insertions, 86 deletions
diff --git a/sd/source/ui/dlg/RemoteDialogClientBox.cxx b/sd/source/ui/dlg/RemoteDialogClientBox.cxx index 41066418063a..b421f13f3630 100644 --- a/sd/source/ui/dlg/RemoteDialogClientBox.cxx +++ b/sd/source/ui/dlg/RemoteDialogClientBox.cxx @@ -65,7 +65,6 @@ ClientBox::ClientBox( vcl::Window* pParent, WinBits nStyle ) : m_bHasActive( false ), m_bNeedsRecalc( true ), m_bAdjustActive( false ), - m_bInDelete( false ), m_nActive( 0 ), m_nTopIndex( 0 ), m_nActiveHeight( 0 ), @@ -118,11 +117,6 @@ ClientBox::~ClientBox() void ClientBox::dispose() { - if ( ! m_bInDelete ) - DeleteRemoved(); - - m_bInDelete = true; - m_vEntries.clear(); m_xRemoveListener.clear(); @@ -185,20 +179,6 @@ void ClientBox::CalcActiveHeight() return ::tools::Rectangle( aPos, aSize ); } -void ClientBox::DeleteRemoved() -{ - const ::osl::MutexGuard aGuard( m_entriesMutex ); - - m_bInDelete = true; - - if ( ! m_vRemovedEntries.empty() ) - { - m_vRemovedEntries.clear(); - } - - m_bInDelete = false; -} - long ClientBox::GetActiveEntryIndex() { if ( m_bHasActive ) @@ -469,9 +449,6 @@ bool ClientBox::HandleCursorKey( sal_uInt16 nKeyCode ) void ClientBox::Paint(vcl::RenderContext& rRenderContext, const ::tools::Rectangle &/*rPaintRect*/) { - if (!m_bInDelete) - DeleteRemoved(); - if (m_bNeedsRecalc) RecalcAll(); @@ -576,9 +553,6 @@ void ClientBox::MouseButtonDown( const MouseEvent& rMEvt ) bool ClientBox::EventNotify( NotifyEvent& rNEvt ) { - if ( !m_bInDelete ) - DeleteRemoved(); - bool bHandled = false; if ( rNEvt.GetType() == MouseNotifyEvent::KEYINPUT ) diff --git a/sd/source/ui/dlg/RemoteDialogClientBox.hxx b/sd/source/ui/dlg/RemoteDialogClientBox.hxx index bdaa5cf77f4a..c839165a79cc 100644 --- a/sd/source/ui/dlg/RemoteDialogClientBox.hxx +++ b/sd/source/ui/dlg/RemoteDialogClientBox.hxx @@ -87,7 +87,6 @@ class ClientBox : public Control bool m_bHasActive : 1; bool m_bNeedsRecalc : 1; bool m_bAdjustActive : 1; - bool m_bInDelete : 1; //Must be guarded together with m_vEntries to ensure a valid index at all times. //Use m_entriesMutex as guard. long m_nActive; @@ -112,14 +111,12 @@ class ClientBox : public Control //while new entries are added / removed in a separate thread. mutable ::osl::Mutex m_entriesMutex; std::vector< TClientBoxEntry > m_vEntries; - std::vector< TClientBoxEntry > m_vRemovedEntries; void CalcActiveHeight(); long GetTotalHeight() const; void SetupScrollBar(); void DrawRow(vcl::RenderContext& rRenderContext, const ::tools::Rectangle& rRect, const TClientBoxEntry& rEntry); bool HandleCursorKey( sal_uInt16 nKeyCode ); - void DeleteRemoved(); DECL_LINK( ScrollHdl, ScrollBar*, void ); DECL_LINK( DeauthoriseHdl, Button*, void ); diff --git a/sd/source/ui/view/viewshel.cxx b/sd/source/ui/view/viewshel.cxx index 7537c3e8ab31..ddcd4dc0b344 100644 --- a/sd/source/ui/view/viewshel.cxx +++ b/sd/source/ui/view/viewshel.cxx @@ -102,15 +102,10 @@ class ViewShellObjectBarFactory { public: explicit ViewShellObjectBarFactory (::sd::ViewShell& rViewShell); - virtual ~ViewShellObjectBarFactory() override; virtual SfxShell* CreateShell( ::sd::ShellId nId ) override; virtual void ReleaseShell (SfxShell* pShell) override; private: ::sd::ViewShell& mrViewShell; - /** This cache holds the already created object bars. - */ - typedef ::std::map< ::sd::ShellId,SfxShell*> ShellCache; - ShellCache maShellCache; }; } // end of anonymous namespace @@ -1637,64 +1632,48 @@ ViewShellObjectBarFactory::ViewShellObjectBarFactory ( { } -ViewShellObjectBarFactory::~ViewShellObjectBarFactory() -{ - for (ShellCache::iterator aI(maShellCache.begin()); - aI!=maShellCache.end(); - ++aI) - { - delete aI->second; - } -} - SfxShell* ViewShellObjectBarFactory::CreateShell( ::sd::ShellId nId ) { SfxShell* pShell = nullptr; - ShellCache::iterator aI (maShellCache.find(nId)); - if (aI == maShellCache.end() || aI->second==nullptr) + ::sd::View* pView = mrViewShell.GetView(); + switch (nId) { - ::sd::View* pView = mrViewShell.GetView(); - switch (nId) - { - case ToolbarId::Bezier_Toolbox_Sd: - pShell = new ::sd::BezierObjectBar(&mrViewShell, pView); - break; - - case ToolbarId::Draw_Text_Toolbox_Sd: - pShell = new ::sd::TextObjectBar( - &mrViewShell, mrViewShell.GetDoc()->GetPool(), pView); - break; - - case ToolbarId::Draw_Graf_Toolbox: - pShell = new ::sd::GraphicObjectBar(&mrViewShell, pView); - break; - - case ToolbarId::Draw_Media_Toolbox: - pShell = new ::sd::MediaObjectBar(&mrViewShell, pView); - break; - - case ToolbarId::Draw_Table_Toolbox: - pShell = ::sd::ui::table::CreateTableObjectBar( mrViewShell, pView ); - break; - - case ToolbarId::Svx_Extrusion_Bar: - pShell = new svx::ExtrusionBar( - &mrViewShell.GetViewShellBase()); - break; - - case ToolbarId::Svx_Fontwork_Bar: - pShell = new svx::FontworkBar( - &mrViewShell.GetViewShellBase()); - break; - - default: - pShell = nullptr; - break; - } + case ToolbarId::Bezier_Toolbox_Sd: + pShell = new ::sd::BezierObjectBar(&mrViewShell, pView); + break; + + case ToolbarId::Draw_Text_Toolbox_Sd: + pShell = new ::sd::TextObjectBar( + &mrViewShell, mrViewShell.GetDoc()->GetPool(), pView); + break; + + case ToolbarId::Draw_Graf_Toolbox: + pShell = new ::sd::GraphicObjectBar(&mrViewShell, pView); + break; + + case ToolbarId::Draw_Media_Toolbox: + pShell = new ::sd::MediaObjectBar(&mrViewShell, pView); + break; + + case ToolbarId::Draw_Table_Toolbox: + pShell = ::sd::ui::table::CreateTableObjectBar( mrViewShell, pView ); + break; + + case ToolbarId::Svx_Extrusion_Bar: + pShell = new svx::ExtrusionBar( + &mrViewShell.GetViewShellBase()); + break; + + case ToolbarId::Svx_Fontwork_Bar: + pShell = new svx::FontworkBar( + &mrViewShell.GetViewShellBase()); + break; + + default: + pShell = nullptr; + break; } - else - pShell = aI->second; return pShell; } |