summaryrefslogtreecommitdiff
path: root/forms
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2017-01-26 10:11:49 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2017-01-26 10:23:56 +0000
commitb98811106b3c657b0147c8cb7988899e2ed6ba54 (patch)
tree37f5d8b231de40ef8761a4f4136a04939307e5ff /forms
parenta49cbc58933c30d82bab458f2ed5af622bea4690 (diff)
use rtl::Reference in OImageControlModel
instead of storing both a raw pointer and an uno::Reference Change-Id: If0e1380815e93015249cc19bc66b40befbfab50e Reviewed-on: https://gerrit.libreoffice.org/33570 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'forms')
-rw-r--r--forms/source/component/ImageControl.cxx9
-rw-r--r--forms/source/component/ImageControl.hxx6
2 files changed, 6 insertions, 9 deletions
diff --git a/forms/source/component/ImageControl.cxx b/forms/source/component/ImageControl.cxx
index 966bbb15e658..a519f9c31724 100644
--- a/forms/source/component/ImageControl.cxx
+++ b/forms/source/component/ImageControl.cxx
@@ -130,7 +130,6 @@ Sequence<Type> OImageControlModel::_getTypes()
OImageControlModel::OImageControlModel(const Reference<XComponentContext>& _rxFactory)
:OBoundControlModel( _rxFactory, VCL_CONTROLMODEL_IMAGECONTROL, FRM_SUN_CONTROL_IMAGECONTROL, false, false, false )
// use the old control name for compytibility reasons
- ,m_pImageProducer( nullptr )
,m_bExternalGraphic( true )
,m_bReadOnly( false )
,m_sImageURL()
@@ -146,7 +145,6 @@ OImageControlModel::OImageControlModel(const Reference<XComponentContext>& _rxFa
OImageControlModel::OImageControlModel( const OImageControlModel* _pOriginal, const Reference< XComponentContext >& _rxFactory )
:OBoundControlModel( _pOriginal, _rxFactory )
// use the old control name for compytibility reasons
- ,m_pImageProducer( nullptr )
,m_bExternalGraphic( true )
,m_bReadOnly( _pOriginal->m_bReadOnly )
,m_sImageURL( _pOriginal->m_sImageURL )
@@ -166,9 +164,8 @@ OImageControlModel::OImageControlModel( const OImageControlModel* _pOriginal, co
void OImageControlModel::implConstruct()
{
- m_pImageProducer = new ImageProducer;
- m_xImageProducer = m_pImageProducer;
- m_pImageProducer->SetDoneHdl( LINK( this, OImageControlModel, OnImageImportDone ) );
+ m_xImageProducer = new ImageProducer;
+ m_xImageProducer->SetDoneHdl( LINK( this, OImageControlModel, OnImageImportDone ) );
}
@@ -615,7 +612,7 @@ void OImageControlModel::doSetControlValue( const Any& _rValue )
if ( bStartProduction )
{
// start production
- Reference< XImageProducer > xProducer = m_xImageProducer;
+ rtl::Reference< ImageProducer > xProducer = m_xImageProducer;
{
// release our mutex once (it's acquired in the calling method!), as starting the image production may
// result in the locking of the solar mutex (unfortunately the default implementation of our aggregate,
diff --git a/forms/source/component/ImageControl.hxx b/forms/source/component/ImageControl.hxx
index 0a8da10c194d..596cdb22a119 100644
--- a/forms/source/component/ImageControl.hxx
+++ b/forms/source/component/ImageControl.hxx
@@ -28,6 +28,7 @@
#include <com/sun/star/graphic/XGraphicObject.hpp>
#include <comphelper/propmultiplex.hxx>
#include <cppuhelper/implbase2.hxx>
+#include <rtl/ref.hxx>
using namespace comphelper;
@@ -46,8 +47,7 @@ class OImageControlModel
:public OImageControlModel_Base
,public OBoundControlModel
{
- css::uno::Reference< css::awt::XImageProducer> m_xImageProducer;
- ImageProducer* m_pImageProducer;
+ rtl::Reference<ImageProducer> m_xImageProducer;
bool m_bExternalGraphic;
bool m_bReadOnly;
OUString m_sImageURL;
@@ -59,7 +59,7 @@ protected:
// UNO Anbindung
virtual css::uno::Sequence< css::uno::Type> _getTypes() override;
- inline ImageProducer* GetImageProducer() { return m_pImageProducer; }
+ inline ImageProducer* GetImageProducer() { return m_xImageProducer.get(); }
public:
DECLARE_DEFAULT_LEAF_XTOR( OImageControlModel );