summaryrefslogtreecommitdiff
path: root/framework
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-01-17 13:14:38 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-01-24 07:58:13 +0100
commit570786e75add710df9bf77fa53b75e22dc29de89 (patch)
tree953a6c06bd0525bfd38bd87959fd1afe58acf81f /framework
parent8eab42ddce2e9a01e65d82e2e5741a7d59fdd6ba (diff)
loplugin:useuniqueptr in LayoutManager
Change-Id: I93383fcb5f0093416914722e25cd0faf70c040eb Reviewed-on: https://gerrit.libreoffice.org/48422 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'framework')
-rw-r--r--framework/inc/services/layoutmanager.hxx4
-rw-r--r--framework/source/layoutmanager/layoutmanager.cxx11
-rw-r--r--framework/source/layoutmanager/toolbarlayoutmanager.cxx7
-rw-r--r--framework/source/layoutmanager/toolbarlayoutmanager.hxx4
4 files changed, 12 insertions, 14 deletions
diff --git a/framework/inc/services/layoutmanager.hxx b/framework/inc/services/layoutmanager.hxx
index 8ef46a21de72..eaecc6fa8e87 100644
--- a/framework/inc/services/layoutmanager.hxx
+++ b/framework/inc/services/layoutmanager.hxx
@@ -165,7 +165,7 @@ namespace framework
/// Reading of settings - shared with ToolbarLayoutManager.
static bool readWindowStateData( const OUString& rName, UIElement& rElementData,
const css::uno::Reference< css::container::XNameAccess > &rPersistentWindowState,
- GlobalSettings* &rGlobalSettings, bool &bInGlobalSettings,
+ std::unique_ptr<GlobalSettings> &rGlobalSettings, bool &bInGlobalSettings,
const css::uno::Reference< css::uno::XComponentContext > &rComponentContext );
private:
@@ -269,7 +269,7 @@ namespace framework
css::uno::Reference< css::ui::XUIElementFactoryManager > m_xUIElementFactoryManager;
css::uno::Reference< css::container::XNameAccess > m_xPersistentWindowState;
css::uno::Reference< css::container::XNameAccess > m_xPersistentWindowStateSupplier;
- GlobalSettings* m_pGlobalSettings;
+ std::unique_ptr<GlobalSettings> m_pGlobalSettings;
OUString m_aModuleIdentifier;
Timer m_aAsyncLayoutTimer;
::cppu::OMultiTypeInterfaceContainerHelper m_aListenerContainer; // container for ALL Listener
diff --git a/framework/source/layoutmanager/layoutmanager.cxx b/framework/source/layoutmanager/layoutmanager.cxx
index 3b3aa1173eba..894f1eafbad0 100644
--- a/framework/source/layoutmanager/layoutmanager.cxx
+++ b/framework/source/layoutmanager/layoutmanager.cxx
@@ -152,7 +152,7 @@ LayoutManager::~LayoutManager()
{
m_aAsyncLayoutTimer.Stop();
setDockingAreaAcceptor(nullptr);
- delete m_pGlobalSettings;
+ m_pGlobalSettings.reset();
}
// Internal helper function
@@ -472,7 +472,7 @@ bool LayoutManager::implts_readWindowStateData( const OUString& aName, UIElement
bool LayoutManager::readWindowStateData( const OUString& aName, UIElement& rElementData,
const Reference< XNameAccess > &rPersistentWindowState,
- GlobalSettings* &rGlobalSettings, bool &bInGlobalSettings,
+ std::unique_ptr<GlobalSettings> &rGlobalSettings, bool &bInGlobalSettings,
const Reference< XComponentContext > &rComponentContext )
{
if ( rPersistentWindowState.is() )
@@ -484,10 +484,10 @@ bool LayoutManager::readWindowStateData( const OUString& aName, UIElement& rElem
GlobalSettings* pGlobalSettings( nullptr );
if ( rGlobalSettings == nullptr )
{
- rGlobalSettings = new GlobalSettings( rComponentContext );
+ rGlobalSettings.reset( new GlobalSettings( rComponentContext ) );
bGetSettingsState = true;
}
- pGlobalSettings = rGlobalSettings;
+ pGlobalSettings = rGlobalSettings.get();
aWriteLock.clear();
try
@@ -2776,8 +2776,7 @@ void SAL_CALL LayoutManager::disposing( const lang::EventObject& rEvent )
m_xDocCfgMgr.clear();
m_xModuleCfgMgr.clear();
m_xFrame.clear();
- delete m_pGlobalSettings;
- m_pGlobalSettings = nullptr;
+ m_pGlobalSettings.reset();
bDisposeAndClear = true;
}
diff --git a/framework/source/layoutmanager/toolbarlayoutmanager.cxx b/framework/source/layoutmanager/toolbarlayoutmanager.cxx
index 7e647307d138..09d16a7ae731 100644
--- a/framework/source/layoutmanager/toolbarlayoutmanager.cxx
+++ b/framework/source/layoutmanager/toolbarlayoutmanager.cxx
@@ -60,7 +60,6 @@ ToolbarLayoutManager::ToolbarLayoutManager(
m_eDockOperation( DOCKOP_ON_COLROW ),
m_ePreviewDetection( PREVIEWFRAME_UNKNOWN ),
m_pAddonOptions( nullptr ),
- m_pGlobalSettings( nullptr ),
m_bComponentAttached( false ),
m_bLayoutDirty( false ),
m_bGlobalSettings( false ),
@@ -75,8 +74,8 @@ ToolbarLayoutManager::ToolbarLayoutManager(
ToolbarLayoutManager::~ToolbarLayoutManager()
{
- delete m_pGlobalSettings;
- delete m_pAddonOptions;
+ m_pGlobalSettings.reset();
+ m_pAddonOptions.reset();
}
// XInterface
@@ -1079,7 +1078,7 @@ void ToolbarLayoutManager::implts_createAddonsToolBars()
{
SolarMutexClearableGuard aWriteLock;
if ( !m_pAddonOptions )
- m_pAddonOptions = new AddonsOptions;
+ m_pAddonOptions.reset( new AddonsOptions );
uno::Reference< ui::XUIElementFactory > xUIElementFactory( m_xUIElementFactoryManager );
uno::Reference< frame::XFrame > xFrame( m_xFrame );
diff --git a/framework/source/layoutmanager/toolbarlayoutmanager.hxx b/framework/source/layoutmanager/toolbarlayoutmanager.hxx
index 263835428eae..def4ea56fedd 100644
--- a/framework/source/layoutmanager/toolbarlayoutmanager.hxx
+++ b/framework/source/layoutmanager/toolbarlayoutmanager.hxx
@@ -277,8 +277,8 @@ class ToolbarLayoutManager : public ::cppu::WeakImplHelper< css::awt::XDockableW
DockingOperation m_eDockOperation;
PreviewFrameDetection m_ePreviewDetection;
- AddonsOptions* m_pAddonOptions;
- GlobalSettings* m_pGlobalSettings;
+ std::unique_ptr<AddonsOptions> m_pAddonOptions;
+ std::unique_ptr<GlobalSettings> m_pGlobalSettings;
bool m_bComponentAttached;
bool m_bLayoutDirty;