Kaydet (Commit) b3c449b7 authored tarafından Noel Grandin's avatar Noel Grandin

loplugin:useuniqueptr in impl_getWindowDescriptor

return by value, the usual C++ optimisations will make this efficient

Change-Id: I7f9634b9663605504c69e0381a6ebc9c76061048
Reviewed-on: https://gerrit.libreoffice.org/62645
Tested-by: Jenkins
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst 16fb77b1
......@@ -139,7 +139,7 @@ public:
protected:
using OComponentHelper::disposing;
virtual css::awt::WindowDescriptor* impl_getWindowDescriptor(
virtual css::awt::WindowDescriptor impl_getWindowDescriptor(
const css::uno::Reference< css::awt::XWindowPeer >& xParentPeer
) override;
......
......@@ -349,7 +349,7 @@ protected:
sal_Int32 impl_getHeight() const { return m_nHeight;}
virtual css::awt::WindowDescriptor* impl_getWindowDescriptor(
virtual css::awt::WindowDescriptor impl_getWindowDescriptor(
const css::uno::Reference< css::awt::XWindowPeer >& xParentPeer
);
......
......@@ -364,20 +364,16 @@ void SAL_CALL BaseContainerControl::setVisible ( sal_Bool bVisible )
// protected method
WindowDescriptor* BaseContainerControl::impl_getWindowDescriptor ( const Reference< XWindowPeer > & rParentPeer )
WindowDescriptor BaseContainerControl::impl_getWindowDescriptor ( const Reference< XWindowPeer > & rParentPeer )
{
// - used from "createPeer()" to set the values of a WindowDescriptor!!!
// - if you will change the descriptor-values, you must override this virtual function
// - the caller must release the memory for this dynamical descriptor!!!
WindowDescriptor * aDescriptor = new WindowDescriptor;
aDescriptor->Type = WindowClass_CONTAINER;
aDescriptor->WindowServiceName = "window";
aDescriptor->ParentIndex = -1;
aDescriptor->Parent = rParentPeer;
aDescriptor->Bounds = getPosSize ();
aDescriptor->WindowAttributes = 0;
WindowDescriptor aDescriptor;
aDescriptor.Type = WindowClass_CONTAINER;
aDescriptor.WindowServiceName = "window";
aDescriptor.ParentIndex = -1;
aDescriptor.Parent = rParentPeer;
aDescriptor.Bounds = getPosSize ();
aDescriptor.WindowAttributes = 0;
return aDescriptor;
}
......
......@@ -265,11 +265,11 @@ void SAL_CALL BaseControl::createPeer( const Reference< XToolkit >& xToo
if ( !m_xPeer.is() )
{
// use method "BaseControl::getWindowDescriptor()" to change window attributes!
WindowDescriptor* pDescriptor = impl_getWindowDescriptor( xParentPeer );
WindowDescriptor aDescriptor = impl_getWindowDescriptor( xParentPeer );
if ( m_bVisible )
{
pDescriptor->WindowAttributes |= WindowAttribute::SHOW;
aDescriptor.WindowAttributes |= WindowAttribute::SHOW;
}
// very slow under remote conditions!
......@@ -280,12 +280,9 @@ void SAL_CALL BaseControl::createPeer( const Reference< XToolkit >& xToo
// but first create well known toolkit, if it not exist
xLocalToolkit.set( Toolkit::create(m_xComponentContext), UNO_QUERY_THROW );
}
m_xPeer = xLocalToolkit->createWindow( *pDescriptor );
m_xPeer = xLocalToolkit->createWindow( aDescriptor );
m_xPeerWindow.set( m_xPeer, UNO_QUERY );
// don't forget to release the memory!
delete pDescriptor;
if ( m_xPeerWindow.is() )
{
if ( m_xMultiplexer.is() )
......@@ -700,22 +697,22 @@ void SAL_CALL BaseControl::windowHidden( const EventObject& /*aEvent*/ )
// protected method
WindowDescriptor* BaseControl::impl_getWindowDescriptor( const Reference< XWindowPeer >& xParentPeer )
WindowDescriptor BaseControl::impl_getWindowDescriptor( const Reference< XWindowPeer >& xParentPeer )
{
// - used from "createPeer()" to set the values of an css::awt::WindowDescriptor !!!
// - if you will change the descriptor-values, you must override this virtual function
// - the caller must release the memory for this dynamical descriptor !!!
WindowDescriptor* pDescriptor = new WindowDescriptor;
WindowDescriptor aDescriptor;
pDescriptor->Type = WindowClass_SIMPLE;
pDescriptor->WindowServiceName = "window";
pDescriptor->ParentIndex = -1;
pDescriptor->Parent = xParentPeer;
pDescriptor->Bounds = getPosSize ();
pDescriptor->WindowAttributes = 0;
aDescriptor.Type = WindowClass_SIMPLE;
aDescriptor.WindowServiceName = "window";
aDescriptor.ParentIndex = -1;
aDescriptor.Parent = xParentPeer;
aDescriptor.Bounds = getPosSize ();
aDescriptor.WindowAttributes = 0;
return pDescriptor;
return aDescriptor;
}
// protected method
......
......@@ -369,17 +369,17 @@ Reference< XPropertySetInfo > SAL_CALL FrameControl::getPropertySetInfo()
// BaseControl
WindowDescriptor* FrameControl::impl_getWindowDescriptor( const Reference< XWindowPeer >& xParentPeer )
WindowDescriptor FrameControl::impl_getWindowDescriptor( const Reference< XWindowPeer >& xParentPeer )
{
WindowDescriptor* pDescriptor = new WindowDescriptor;
WindowDescriptor aDescriptor;
pDescriptor->Type = WindowClass_CONTAINER;
pDescriptor->ParentIndex = -1;
pDescriptor->Parent = xParentPeer;
pDescriptor->Bounds = getPosSize ();
pDescriptor->WindowAttributes = 0;
aDescriptor.Type = WindowClass_CONTAINER;
aDescriptor.ParentIndex = -1;
aDescriptor.Parent = xParentPeer;
aDescriptor.Bounds = getPosSize ();
aDescriptor.WindowAttributes = 0;
return pDescriptor;
return aDescriptor;
}
// private method
......
......@@ -353,21 +353,17 @@ const OUString StatusIndicator::impl_getStaticImplementationName()
// protected method
WindowDescriptor* StatusIndicator::impl_getWindowDescriptor( const css::uno::Reference< XWindowPeer >& xParentPeer )
WindowDescriptor StatusIndicator::impl_getWindowDescriptor( const css::uno::Reference< XWindowPeer >& xParentPeer )
{
// - used from "createPeer()" to set the values of an css::awt::WindowDescriptor !!!
// - if you will change the descriptor-values, you must override this virtual function
// - the caller must release the memory for this dynamical descriptor!!!
WindowDescriptor aDescriptor;
WindowDescriptor* pDescriptor = new WindowDescriptor;
aDescriptor.Type = WindowClass_SIMPLE;
aDescriptor.WindowServiceName = "floatingwindow";
aDescriptor.ParentIndex = -1;
aDescriptor.Parent = xParentPeer;
aDescriptor.Bounds = getPosSize ();
pDescriptor->Type = WindowClass_SIMPLE;
pDescriptor->WindowServiceName = "floatingwindow";
pDescriptor->ParentIndex = -1;
pDescriptor->Parent = xParentPeer;
pDescriptor->Bounds = getPosSize ();
return pDescriptor;
return aDescriptor;
}
// protected method
......
......@@ -159,7 +159,7 @@ protected:
// BaseControl
virtual css::awt::WindowDescriptor* impl_getWindowDescriptor(
virtual css::awt::WindowDescriptor impl_getWindowDescriptor(
const css::uno::Reference< css::awt::XWindowPeer >& xParentPeer
) override;
......
......@@ -161,7 +161,7 @@ public:
static const OUString impl_getStaticImplementationName();
protected:
virtual css::awt::WindowDescriptor* impl_getWindowDescriptor(
virtual css::awt::WindowDescriptor impl_getWindowDescriptor(
const css::uno::Reference< css::awt::XWindowPeer >& xParentPeer
) override;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment