[Libreoffice-commits] core.git: 18 commits - comphelper/source connectivity/source dbaccess/source embeddedobj/source extensions/source forms/source fpicker/source include/comphelper include/sfx2 include/svtools include/svx sc/source sfx2/source stoc/source svtools/source svx/source
Noel Grandin
noel.grandin at collabora.co.uk
Mon Jan 23 05:57:37 UTC 2017
comphelper/source/property/propmultiplex.cxx | 25 --
connectivity/source/drivers/mork/MResultSet.cxx | 25 --
connectivity/source/drivers/mork/MResultSet.hxx | 3
dbaccess/source/ui/browser/sbagrid.cxx | 37 +--
dbaccess/source/ui/inc/sbagrid.hxx | 3
embeddedobj/source/commonembedding/embedobj.cxx | 34 +--
embeddedobj/source/commonembedding/inplaceobj.cxx | 2
embeddedobj/source/commonembedding/miscobj.cxx | 40 +--
embeddedobj/source/commonembedding/persistence.cxx | 53 ++---
embeddedobj/source/commonembedding/specialobject.cxx | 2
embeddedobj/source/commonembedding/visobj.cxx | 12 -
embeddedobj/source/general/docholder.cxx | 19 -
embeddedobj/source/inc/commonembobj.hxx | 3
embeddedobj/source/inc/docholder.hxx | 3
extensions/source/bibliography/loadlisteneradapter.cxx | 25 --
extensions/source/bibliography/loadlisteneradapter.hxx | 8
extensions/source/propctrlr/submissionhandler.cxx | 13 -
extensions/source/propctrlr/submissionhandler.hxx | 5
forms/source/component/DatabaseForm.cxx | 20 -
forms/source/component/DatabaseForm.hxx | 3
fpicker/source/office/fpsmartcontent.cxx | 20 -
fpicker/source/office/fpsmartcontent.hxx | 4
include/comphelper/propmultiplex.hxx | 5
include/sfx2/ipclient.hxx | 3
include/svtools/ruler.hxx | 3
include/svx/svdotext.hxx | 3
sc/source/ui/app/seltrans.cxx | 42 +---
sc/source/ui/inc/cellsh.hxx | 10
sc/source/ui/inc/seltrans.hxx | 9
sc/source/ui/view/cellsh.cxx | 15 -
sc/source/ui/view/cellsh1.cxx | 5
sfx2/source/appl/appdata.cxx | 2
sfx2/source/appl/appinit.cxx | 7
sfx2/source/inc/appdata.hxx | 2
sfx2/source/view/ipclient.cxx | 174 ++++++++---------
stoc/source/corereflection/base.hxx | 11 -
stoc/source/corereflection/crbase.cxx | 11 -
svtools/source/control/ruler.cxx | 14 -
svtools/source/misc/transfer.cxx | 19 -
svtools/source/uno/unoimap.cxx | 65 ++----
svx/source/svdraw/svdotxln.cxx | 2
41 files changed, 330 insertions(+), 431 deletions(-)
New commits:
commit 8777c3482dd1baf6ab0d79adbb524c32d1e0e349
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date: Fri Jan 20 15:09:18 2017 +0200
use rtl::Reference in SvUnoImageMap
instead of manual acquire/release
Change-Id: Ia17a1cca542ef0008fe32f2dbfcfce1ecd3161a2
diff --git a/svtools/source/uno/unoimap.cxx b/svtools/source/uno/unoimap.cxx
index 691df2d..c8cf5248 100644
--- a/svtools/source/uno/unoimap.cxx
+++ b/svtools/source/uno/unoimap.cxx
@@ -32,6 +32,7 @@
#include <cppuhelper/weakagg.hxx>
#include <cppuhelper/implbase.hxx>
#include <cppuhelper/supportsservice.hxx>
+#include <algorithm>
#include <list>
#include <osl/mutex.hxx>
#include <vcl/svapp.hxx>
@@ -513,7 +514,6 @@ class SvUnoImageMap : public WeakImplHelper< XIndexContainer, XServiceInfo, XUno
public:
explicit SvUnoImageMap( const SvEventDescription* pSupportedMacroItems );
SvUnoImageMap( const ImageMap& rMap, const SvEventDescription* pSupportedMacroItems );
- virtual ~SvUnoImageMap() override;
bool fillImageMap( ImageMap& rMap ) const;
/// @throws IllegalArgumentException
@@ -544,7 +544,7 @@ public:
private:
OUString maName;
- std::list< SvUnoImageMapObject* > maObjectList;
+ std::list< rtl::Reference<SvUnoImageMapObject> > maObjectList;
};
UNO3_GETIMPLEMENTATION_IMPL( SvUnoImageMap );
@@ -561,19 +561,8 @@ SvUnoImageMap::SvUnoImageMap( const ImageMap& rMap, const SvEventDescription* pS
for( std::size_t nPos = 0; nPos < nCount; nPos++ )
{
IMapObject* pMapObject = rMap.GetIMapObject( nPos );
- SvUnoImageMapObject* pUnoObj = new SvUnoImageMapObject( *pMapObject, pSupportedMacroItems );
- pUnoObj->acquire();
- maObjectList.push_back( pUnoObj );
- }
-}
-
-SvUnoImageMap::~SvUnoImageMap()
-{
- std::list< SvUnoImageMapObject* >::iterator aIter = maObjectList.begin();
- const std::list< SvUnoImageMapObject* >::iterator aEnd = maObjectList.end();
- while( aIter != aEnd )
- {
- (*aIter++)->release();
+ rtl::Reference<SvUnoImageMapObject> xUnoObj = new SvUnoImageMapObject( *pMapObject, pSupportedMacroItems );
+ maObjectList.push_back( xUnoObj );
}
}
@@ -591,24 +580,20 @@ SvUnoImageMapObject* SvUnoImageMap::getObject( const Any& aElement )
}
// XIndexContainer
-void SAL_CALL SvUnoImageMap::insertByIndex( sal_Int32 Index, const Any& Element )
+void SAL_CALL SvUnoImageMap::insertByIndex( sal_Int32 nIndex, const Any& Element )
throw( IllegalArgumentException, IndexOutOfBoundsException, WrappedTargetException, RuntimeException, std::exception )
{
SvUnoImageMapObject* pObject = getObject( Element );
const sal_Int32 nCount = maObjectList.size();
- if( nullptr == pObject || Index > nCount )
+ if( nullptr == pObject || nIndex > nCount )
throw IndexOutOfBoundsException();
- pObject->acquire();
-
- if( Index == nCount )
+ if( nIndex == nCount )
maObjectList.push_back( pObject );
else
{
- std::list< SvUnoImageMapObject* >::iterator aIter = maObjectList.begin();
- for( sal_Int32 n = 0; n < Index; n++ )
- ++aIter;
-
+ auto aIter = maObjectList.begin();
+ std::advance(aIter, nIndex);
maObjectList.insert( aIter, pObject );
}
}
@@ -621,34 +606,27 @@ void SAL_CALL SvUnoImageMap::removeByIndex( sal_Int32 nIndex ) throw(IndexOutOfB
if( nCount - 1 == nIndex )
{
- maObjectList.back()->release();
maObjectList.pop_back();
}
else
{
- std::list< SvUnoImageMapObject* >::iterator aIter = maObjectList.begin();
+ auto aIter = maObjectList.begin();
std::advance(aIter, nIndex);
-
- (*aIter)->release();
maObjectList.erase( aIter );
}
}
// XIndexReplace
-void SAL_CALL SvUnoImageMap::replaceByIndex( sal_Int32 Index, const Any& Element ) throw(IllegalArgumentException, IndexOutOfBoundsException, WrappedTargetException, RuntimeException, std::exception)
+void SAL_CALL SvUnoImageMap::replaceByIndex( sal_Int32 nIndex, const Any& Element ) throw(IllegalArgumentException, IndexOutOfBoundsException, WrappedTargetException, RuntimeException, std::exception)
{
SvUnoImageMapObject* pObject = getObject( Element );
const sal_Int32 nCount = maObjectList.size();
- if( nullptr == pObject || Index >= nCount )
+ if( nullptr == pObject || nIndex >= nCount )
throw IndexOutOfBoundsException();
- std::list< SvUnoImageMapObject* >::iterator aIter = maObjectList.begin();
- for( sal_Int32 n = 0; n < Index; n++ )
- ++aIter;
-
- (*aIter)->release();
+ auto aIter = maObjectList.begin();
+ std::advance(aIter, nIndex);
*aIter = pObject;
- pObject->acquire();
}
// XIndexAccess
@@ -657,17 +635,16 @@ sal_Int32 SAL_CALL SvUnoImageMap::getCount( ) throw(RuntimeException, std::exce
return maObjectList.size();
}
-Any SAL_CALL SvUnoImageMap::getByIndex( sal_Int32 Index ) throw(IndexOutOfBoundsException, WrappedTargetException, RuntimeException, std::exception)
+Any SAL_CALL SvUnoImageMap::getByIndex( sal_Int32 nIndex ) throw(IndexOutOfBoundsException, WrappedTargetException, RuntimeException, std::exception)
{
const sal_Int32 nCount = maObjectList.size();
- if( Index >= nCount )
+ if( nIndex >= nCount )
throw IndexOutOfBoundsException();
- std::list< SvUnoImageMapObject* >::iterator aIter = maObjectList.begin();
- for( sal_Int32 n = 0; n < Index; n++ )
- ++aIter;
+ auto aIter = maObjectList.begin();
+ std::advance(aIter, nIndex);
- Reference< XPropertySet > xObj( *aIter );
+ Reference< XPropertySet > xObj( aIter->get() );
return makeAny( xObj );
}
@@ -708,8 +685,8 @@ bool SvUnoImageMap::fillImageMap( ImageMap& rMap ) const
rMap.SetName( maName );
- std::list< SvUnoImageMapObject* >::const_iterator aIter = maObjectList.begin();
- const std::list< SvUnoImageMapObject* >::const_iterator aEnd = maObjectList.end();
+ auto aIter = maObjectList.begin();
+ auto const aEnd = maObjectList.end();
while( aIter != aEnd )
{
IMapObject* pNewMapObject = (*aIter)->createIMapObject();
commit 71d9f5df23ad3d7de80f86162217c599f84e5dae
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date: Fri Jan 20 15:04:15 2017 +0200
use rtl::Reference in TransferableDataHelper_Impl
instead of manual acquire/release
Change-Id: I0d7d71a76c84f61f87399d7b7d93be0e50ccae16
diff --git a/svtools/source/misc/transfer.cxx b/svtools/source/misc/transfer.cxx
index 08195e6..5e417a7 100644
--- a/svtools/source/misc/transfer.cxx
+++ b/svtools/source/misc/transfer.cxx
@@ -1104,10 +1104,9 @@ void TransferableClipboardNotifier::dispose()
struct TransferableDataHelper_Impl
{
::osl::Mutex maMutex;
- TransferableClipboardNotifier* mpClipboardListener;
+ rtl::Reference<TransferableClipboardNotifier> mxClipboardListener;
TransferableDataHelper_Impl()
- :mpClipboardListener( nullptr )
{
}
};
@@ -1152,7 +1151,7 @@ TransferableDataHelper& TransferableDataHelper::operator=( const TransferableDat
{
::osl::MutexGuard aGuard(mxImpl->maMutex);
- const bool bWasClipboardListening = (nullptr != mxImpl->mpClipboardListener);
+ const bool bWasClipboardListening = mxImpl->mxClipboardListener.is();
if (bWasClipboardListening)
StopClipboardListening();
@@ -1173,7 +1172,7 @@ TransferableDataHelper& TransferableDataHelper::operator=(TransferableDataHelper
{
::osl::MutexGuard aGuard(mxImpl->maMutex);
- const bool bWasClipboardListening = (nullptr != mxImpl->mpClipboardListener);
+ const bool bWasClipboardListening = mxImpl->mxClipboardListener.is();
if (bWasClipboardListening)
StopClipboardListening();
@@ -2078,21 +2077,19 @@ bool TransferableDataHelper::StartClipboardListening( )
StopClipboardListening( );
- mxImpl->mpClipboardListener = new TransferableClipboardNotifier(mxClipboard, *this, mxImpl->maMutex);
- mxImpl->mpClipboardListener->acquire();
+ mxImpl->mxClipboardListener = new TransferableClipboardNotifier(mxClipboard, *this, mxImpl->maMutex);
- return mxImpl->mpClipboardListener->isListening();
+ return mxImpl->mxClipboardListener->isListening();
}
void TransferableDataHelper::StopClipboardListening( )
{
::osl::MutexGuard aGuard(mxImpl->maMutex);
- if (mxImpl->mpClipboardListener)
+ if (mxImpl->mxClipboardListener.is())
{
- mxImpl->mpClipboardListener->dispose();
- mxImpl->mpClipboardListener->release();
- mxImpl->mpClipboardListener = nullptr;
+ mxImpl->mxClipboardListener->dispose();
+ mxImpl->mxClipboardListener.clear();
}
}
commit 6f1123d3ddd6108f486964182f92854db9a13a7e
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date: Fri Jan 20 15:02:32 2017 +0200
use rtl::Reference in Ruler
instead of manual acquire/release
Change-Id: I7815a0a3c01fce57b4798ac1dbf501e20444c61d
diff --git a/include/svtools/ruler.hxx b/include/svtools/ruler.hxx
index 1c5b0cd..aa2fc2c 100644
--- a/include/svtools/ruler.hxx
+++ b/include/svtools/ruler.hxx
@@ -21,6 +21,7 @@
#define INCLUDED_SVTOOLS_RULER_HXX
#include <svtools/svtdllapi.h>
+#include <rtl/ref.hxx>
#include <tools/link.hxx>
#include <tools/fract.hxx>
#include <vcl/window.hxx>
@@ -660,7 +661,7 @@ private:
std::unique_ptr<RulerSelection> mxCurrentHitTest;
std::unique_ptr<RulerSelection> mxPreviousHitTest;
- SvtRulerAccessible* pAccContext;
+ rtl::Reference<SvtRulerAccessible> mxAccContext;
SVT_DLLPRIVATE void ImplVDrawLine(vcl::RenderContext& rRenderContext, long nX1, long nY1, long nX2, long nY2 );
SVT_DLLPRIVATE void ImplVDrawRect(vcl::RenderContext& rRenderContext, long nX1, long nY1, long nX2, long nY2 );
diff --git a/svtools/source/control/ruler.cxx b/svtools/source/control/ruler.cxx
index 25fa30a..0981bc1 100644
--- a/svtools/source/control/ruler.cxx
+++ b/svtools/source/control/ruler.cxx
@@ -283,7 +283,6 @@ void Ruler::ImplInit( WinBits nWinBits )
aDefSize.Width() = nDefHeight;
SetOutputSizePixel( aDefSize );
SetType(WINDOW_RULER);
- pAccContext = nullptr;
}
Ruler::Ruler( vcl::Window* pParent, WinBits nWinStyle ) :
@@ -334,11 +333,7 @@ void Ruler::dispose()
mpSaveData = nullptr;
delete mpDragData;
mpDragData = nullptr;
- if( pAccContext )
- {
- pAccContext->release();
- pAccContext = nullptr;
- }
+ mxAccContext.clear();
Window::dispose();
}
@@ -2827,10 +2822,9 @@ uno::Reference< XAccessible > Ruler::CreateAccessible()
{
aStr = SvtResId(STR_SVT_ACC_RULER_VERT_NAME);
}
- pAccContext = new SvtRulerAccessible( xAccParent, *this, aStr );
- pAccContext->acquire();
- this->SetAccessible(pAccContext);
- return pAccContext;
+ mxAccContext = new SvtRulerAccessible( xAccParent, *this, aStr );
+ this->SetAccessible(mxAccContext.get());
+ return mxAccContext.get();
}
else
return uno::Reference< XAccessible >();
commit bbd8c94967a4d227be46c1e777efd5b4bcf95429
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date: Fri Jan 20 15:02:10 2017 +0200
use rtl::Reference in stoc
instead of manual acquire/release
Change-Id: I626ad9875528fa76d8f781b07cc86e149032ecb1
diff --git a/stoc/source/corereflection/base.hxx b/stoc/source/corereflection/base.hxx
index 79d5592..5f4676e 100644
--- a/stoc/source/corereflection/base.hxx
+++ b/stoc/source/corereflection/base.hxx
@@ -34,6 +34,7 @@
#include <cppuhelper/component.hxx>
#include <cppuhelper/typeprovider.hxx>
#include <rtl/ustring.hxx>
+#include <rtl/ref.hxx>
#include "lrucache.hxx"
@@ -143,7 +144,8 @@ public:
class IdlClassImpl
: public ::cppu::WeakImplHelper< css::reflection::XIdlClass >
{
- IdlReflectionServiceImpl * _pReflection;
+ rtl::Reference<IdlReflectionServiceImpl>
+ m_xReflection;
OUString _aName;
css::uno::TypeClass _eTypeClass;
@@ -154,7 +156,7 @@ public:
typelib_TypeDescription * getTypeDescr() const
{ return _pTypeDescr; }
IdlReflectionServiceImpl * getReflection() const
- { return _pReflection; }
+ { return m_xReflection.get(); }
// Ctor
IdlClassImpl( IdlReflectionServiceImpl * pReflection,
@@ -327,7 +329,8 @@ public:
class IdlMemberImpl
: public ::cppu::WeakImplHelper< css::reflection::XIdlMember >
{
- IdlReflectionServiceImpl * _pReflection;
+ rtl::Reference<IdlReflectionServiceImpl>
+ m_xReflection;
OUString _aName;
typelib_TypeDescription * _pTypeDescr;
@@ -338,7 +341,7 @@ protected:
public:
IdlReflectionServiceImpl * getReflection() const
- { return _pReflection; }
+ { return m_xReflection.get(); }
typelib_TypeDescription * getTypeDescr() const
{ return _pTypeDescr; }
typelib_TypeDescription * getDeclTypeDescr() const
diff --git a/stoc/source/corereflection/crbase.cxx b/stoc/source/corereflection/crbase.cxx
index aa8fded..a1deec9 100644
--- a/stoc/source/corereflection/crbase.cxx
+++ b/stoc/source/corereflection/crbase.cxx
@@ -52,13 +52,11 @@ ClassNameList g_aClassNames;
IdlClassImpl::IdlClassImpl( IdlReflectionServiceImpl * pReflection,
const OUString & rName, typelib_TypeClass eTypeClass,
typelib_TypeDescription * pTypeDescr )
- : _pReflection( pReflection )
+ : m_xReflection( pReflection )
, _aName( rName )
, _eTypeClass( (TypeClass)eTypeClass )
, _pTypeDescr( pTypeDescr )
{
- if (_pReflection)
- _pReflection->acquire();
if (_pTypeDescr)
{
typelib_typedescription_acquire( _pTypeDescr );
@@ -77,8 +75,7 @@ IdlClassImpl::~IdlClassImpl()
{
if (_pTypeDescr)
typelib_typedescription_release( _pTypeDescr );
- if (_pReflection)
- _pReflection->release();
+ m_xReflection.clear();
#ifdef TEST_LIST_CLASSES
ClassNameList::iterator iFind( std::find( g_aClassNames.begin(), g_aClassNames.end(), _aName ) );
@@ -231,12 +228,11 @@ Reference< XIdlArray > IdlClassImpl::getArray()
IdlMemberImpl::IdlMemberImpl( IdlReflectionServiceImpl * pReflection, const OUString & rName,
typelib_TypeDescription * pTypeDescr,
typelib_TypeDescription * pDeclTypeDescr )
- : _pReflection( pReflection )
+ : m_xReflection( pReflection )
, _aName( rName )
, _pTypeDescr( pTypeDescr )
, _pDeclTypeDescr( pDeclTypeDescr )
{
- _pReflection->acquire();
typelib_typedescription_acquire( _pTypeDescr );
if (! _pTypeDescr->bComplete)
typelib_typedescription_complete( &_pTypeDescr );
@@ -249,7 +245,6 @@ IdlMemberImpl::~IdlMemberImpl()
{
typelib_typedescription_release( _pDeclTypeDescr );
typelib_typedescription_release( _pTypeDescr );
- _pReflection->release();
}
// XIdlMember
commit ca958f886c660ce096ef59cef808fbf46b116e3c
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date: Fri Jan 20 14:54:06 2017 +0200
use rtl::Reference in SfxInPlaceClient
instead of manual acquire/release
Change-Id: I4ebbdbcbd619991c3dae0733b797f310903f96e6
diff --git a/include/sfx2/ipclient.hxx b/include/sfx2/ipclient.hxx
index 0615ca6..23ec5e4 100644
--- a/include/sfx2/ipclient.hxx
+++ b/include/sfx2/ipclient.hxx
@@ -25,6 +25,7 @@
#include <com/sun/star/uno/Reference.h>
#include <com/sun/star/embed/Aspects.hpp>
#include <com/sun/star/embed/XEmbeddedObject.hpp>
+#include <rtl/ref.hxx>
#include <tools/gen.hxx>
@@ -41,7 +42,7 @@ class SFX2_DLLPUBLIC SfxInPlaceClient
{
friend class SfxInPlaceClient_Impl;
- SfxInPlaceClient_Impl* m_pImp;
+ rtl::Reference<SfxInPlaceClient_Impl> m_xImp;
SfxViewShell* m_pViewSh;
VclPtr<vcl::Window> m_pEditWin;
diff --git a/sfx2/source/view/ipclient.cxx b/sfx2/source/view/ipclient.cxx
index 69b16c0..5d29f65 100644
--- a/sfx2/source/view/ipclient.cxx
+++ b/sfx2/source/view/ipclient.cxx
@@ -599,18 +599,17 @@ IMPL_LINK_NOARG(SfxInPlaceClient_Impl, TimerHdl, Timer *, void)
SfxInPlaceClient::SfxInPlaceClient( SfxViewShell* pViewShell, vcl::Window *pDraw, sal_Int64 nAspect ) :
- m_pImp( new SfxInPlaceClient_Impl ),
+ m_xImp( new SfxInPlaceClient_Impl ),
m_pViewSh( pViewShell ),
m_pEditWin( pDraw )
{
- m_pImp->acquire();
- m_pImp->m_pClient = this;
- m_pImp->m_nAspect = nAspect;
- m_pImp->m_aScaleWidth = m_pImp->m_aScaleHeight = Fraction(1,1);
- m_pImp->m_xClient = static_cast< embed::XEmbeddedClient* >( m_pImp );
+ m_xImp->m_pClient = this;
+ m_xImp->m_nAspect = nAspect;
+ m_xImp->m_aScaleWidth = m_xImp->m_aScaleHeight = Fraction(1,1);
+ m_xImp->m_xClient = static_cast< embed::XEmbeddedClient* >( m_xImp.get() );
pViewShell->NewIPClient_Impl(this);
- m_pImp->m_aTimer.SetTimeout( SFX_CLIENTACTIVATE_TIMEOUT );
- m_pImp->m_aTimer.SetTimeoutHdl( LINK( m_pImp, SfxInPlaceClient_Impl, TimerHdl ) );
+ m_xImp->m_aTimer.SetTimeout( SFX_CLIENTACTIVATE_TIMEOUT );
+ m_xImp->m_aTimer.SetTimeoutHdl( LINK( m_xImp.get(), SfxInPlaceClient_Impl, TimerHdl ) );
}
@@ -619,14 +618,13 @@ SfxInPlaceClient::~SfxInPlaceClient()
m_pViewSh->IPClientGone_Impl(this);
// deleting the client before storing the object means discarding all changes
- m_pImp->m_bStoreObject = false;
+ m_xImp->m_bStoreObject = false;
SetObject(nullptr);
- m_pImp->m_pClient = nullptr;
+ m_xImp->m_pClient = nullptr;
- // the next call will destroy m_pImp if no other reference to it exists
- m_pImp->m_xClient.clear();
- m_pImp->release();
+ // the next call will destroy m_xImp if no other reference to it exists
+ m_xImp->m_xClient.clear();
// TODO/LATER:
// the class is not intended to be used in multithreaded environment;
@@ -639,7 +637,7 @@ void SfxInPlaceClient::SetObjectState( sal_Int32 nState )
{
if ( GetObject().is() )
{
- if ( m_pImp->m_nAspect == embed::Aspects::MSOLE_ICON
+ if ( m_xImp->m_nAspect == embed::Aspects::MSOLE_ICON
&& ( nState == embed::EmbedStates::UI_ACTIVE || nState == embed::EmbedStates::INPLACE_ACTIVE ) )
{
OSL_FAIL( "Iconified object should not be activated inplace!\n" );
@@ -659,31 +657,31 @@ void SfxInPlaceClient::SetObjectState( sal_Int32 nState )
sal_Int64 SfxInPlaceClient::GetObjectMiscStatus() const
{
if ( GetObject().is() )
- return GetObject()->getStatus( m_pImp->m_nAspect );
+ return GetObject()->getStatus( m_xImp->m_nAspect );
return 0;
}
const uno::Reference < embed::XEmbeddedObject >& SfxInPlaceClient::GetObject() const
{
- return m_pImp->m_xObject;
+ return m_xImp->m_xObject;
}
void SfxInPlaceClient::SetObject( const uno::Reference < embed::XEmbeddedObject >& rObject )
{
- if ( m_pImp->m_xObject.is() && rObject != m_pImp->m_xObject )
+ if ( m_xImp->m_xObject.is() && rObject != m_xImp->m_xObject )
{
- DBG_ASSERT( GetObject()->getClientSite() == m_pImp->m_xClient, "Wrong ClientSite!" );
- if ( GetObject()->getClientSite() == m_pImp->m_xClient )
+ DBG_ASSERT( GetObject()->getClientSite() == m_xImp->m_xClient, "Wrong ClientSite!" );
+ if ( GetObject()->getClientSite() == m_xImp->m_xClient )
{
if ( GetObject()->getCurrentState() != embed::EmbedStates::LOADED )
SetObjectState( embed::EmbedStates::RUNNING );
- m_pImp->m_xObject->removeEventListener( uno::Reference < document::XEventListener >( m_pImp->m_xClient, uno::UNO_QUERY ) );
- m_pImp->m_xObject->removeStateChangeListener( uno::Reference < embed::XStateChangeListener >( m_pImp->m_xClient, uno::UNO_QUERY ) );
+ m_xImp->m_xObject->removeEventListener( uno::Reference < document::XEventListener >( m_xImp->m_xClient, uno::UNO_QUERY ) );
+ m_xImp->m_xObject->removeStateChangeListener( uno::Reference < embed::XStateChangeListener >( m_xImp->m_xClient, uno::UNO_QUERY ) );
try
{
- m_pImp->m_xObject->setClientSite( nullptr );
+ m_xImp->m_xObject->setClientSite( nullptr );
}
catch( uno::Exception& )
{
@@ -696,37 +694,37 @@ void SfxInPlaceClient::SetObject( const uno::Reference < embed::XEmbeddedObject
// sometimes applications reconnect clients on shutting down because it happens in their Paint methods
return;
- m_pImp->m_xObject = rObject;
+ m_xImp->m_xObject = rObject;
if ( rObject.is() )
{
// as soon as an object was connected to a client it has to be checked whether the object wants
// to be activated
- rObject->addStateChangeListener( uno::Reference < embed::XStateChangeListener >( m_pImp->m_xClient, uno::UNO_QUERY ) );
- rObject->addEventListener( uno::Reference < document::XEventListener >( m_pImp->m_xClient, uno::UNO_QUERY ) );
+ rObject->addStateChangeListener( uno::Reference < embed::XStateChangeListener >( m_xImp->m_xClient, uno::UNO_QUERY ) );
+ rObject->addEventListener( uno::Reference < document::XEventListener >( m_xImp->m_xClient, uno::UNO_QUERY ) );
try
{
- rObject->setClientSite( m_pImp->m_xClient );
+ rObject->setClientSite( m_xImp->m_xClient );
}
catch( uno::Exception& )
{
OSL_FAIL( "Can not set the client site!\n" );
}
- m_pImp->m_aTimer.Start();
+ m_xImp->m_aTimer.Start();
}
else
- m_pImp->m_aTimer.Stop();
+ m_xImp->m_aTimer.Stop();
}
bool SfxInPlaceClient::SetObjArea( const Rectangle& rArea )
{
- if( rArea != m_pImp->m_aObjArea )
+ if( rArea != m_xImp->m_aObjArea )
{
- m_pImp->m_aObjArea = rArea;
- m_pImp->SizeHasChanged();
+ m_xImp->m_aObjArea = rArea;
+ m_xImp->SizeHasChanged();
Invalidate();
return true;
@@ -738,26 +736,26 @@ bool SfxInPlaceClient::SetObjArea( const Rectangle& rArea )
const Rectangle& SfxInPlaceClient::GetObjArea() const
{
- return m_pImp->m_aObjArea;
+ return m_xImp->m_aObjArea;
}
Rectangle SfxInPlaceClient::GetScaledObjArea() const
{
- Rectangle aRealObjArea( m_pImp->m_aObjArea );
- aRealObjArea.SetSize( Size( Fraction( aRealObjArea.GetWidth() ) * m_pImp->m_aScaleWidth,
- Fraction( aRealObjArea.GetHeight() ) * m_pImp->m_aScaleHeight ) );
+ Rectangle aRealObjArea( m_xImp->m_aObjArea );
+ aRealObjArea.SetSize( Size( Fraction( aRealObjArea.GetWidth() ) * m_xImp->m_aScaleWidth,
+ Fraction( aRealObjArea.GetHeight() ) * m_xImp->m_aScaleHeight ) );
return aRealObjArea;
}
void SfxInPlaceClient::SetSizeScale( const Fraction & rScaleWidth, const Fraction & rScaleHeight )
{
- if ( m_pImp->m_aScaleWidth != rScaleWidth || m_pImp->m_aScaleHeight != rScaleHeight )
+ if ( m_xImp->m_aScaleWidth != rScaleWidth || m_xImp->m_aScaleHeight != rScaleHeight )
{
- m_pImp->m_aScaleWidth = rScaleWidth;
- m_pImp->m_aScaleHeight = rScaleHeight;
+ m_xImp->m_aScaleWidth = rScaleWidth;
+ m_xImp->m_aScaleHeight = rScaleHeight;
- m_pImp->SizeHasChanged();
+ m_xImp->SizeHasChanged();
// TODO/LATER: Invalidate seems to trigger (wrong) recalculations of the ObjArea, so it's better
// not to call it here, but maybe it sounds reasonable to do so.
@@ -768,13 +766,13 @@ void SfxInPlaceClient::SetSizeScale( const Fraction & rScaleWidth, const Fractio
void SfxInPlaceClient::SetObjAreaAndScale( const Rectangle& rArea, const Fraction& rScaleWidth, const Fraction& rScaleHeight )
{
- if( rArea != m_pImp->m_aObjArea || m_pImp->m_aScaleWidth != rScaleWidth || m_pImp->m_aScaleHeight != rScaleHeight )
+ if( rArea != m_xImp->m_aObjArea || m_xImp->m_aScaleWidth != rScaleWidth || m_xImp->m_aScaleHeight != rScaleHeight )
{
- m_pImp->m_aObjArea = rArea;
- m_pImp->m_aScaleWidth = rScaleWidth;
- m_pImp->m_aScaleHeight = rScaleHeight;
+ m_xImp->m_aObjArea = rArea;
+ m_xImp->m_aScaleWidth = rScaleWidth;
+ m_xImp->m_aScaleHeight = rScaleHeight;
- m_pImp->SizeHasChanged();
+ m_xImp->SizeHasChanged();
Invalidate();
}
@@ -783,13 +781,13 @@ void SfxInPlaceClient::SetObjAreaAndScale( const Rectangle& rArea, const Fractio
const Fraction& SfxInPlaceClient::GetScaleWidth() const
{
- return m_pImp->m_aScaleWidth;
+ return m_xImp->m_aScaleWidth;
}
const Fraction& SfxInPlaceClient::GetScaleHeight() const
{
- return m_pImp->m_aScaleHeight;
+ return m_xImp->m_aScaleHeight;
}
@@ -798,9 +796,9 @@ void SfxInPlaceClient::Invalidate()
// TODO/LATER: do we need both?
// the object area is provided in logical coordinates of the window but without scaling applied
- Rectangle aRealObjArea( m_pImp->m_aObjArea );
- aRealObjArea.SetSize( Size( Fraction( aRealObjArea.GetWidth() ) * m_pImp->m_aScaleWidth,
- Fraction( aRealObjArea.GetHeight() ) * m_pImp->m_aScaleHeight ) );
+ Rectangle aRealObjArea( m_xImp->m_aObjArea );
+ aRealObjArea.SetSize( Size( Fraction( aRealObjArea.GetWidth() ) * m_xImp->m_aScaleWidth,
+ Fraction( aRealObjArea.GetHeight() ) * m_xImp->m_aScaleHeight ) );
m_pEditWin->Invalidate( aRealObjArea );
ViewChanged();
@@ -810,7 +808,7 @@ void SfxInPlaceClient::Invalidate()
bool SfxInPlaceClient::IsObjectUIActive() const
{
try {
- return ( m_pImp->m_xObject.is() && ( m_pImp->m_xObject->getCurrentState() == embed::EmbedStates::UI_ACTIVE ) );
+ return ( m_xImp->m_xObject.is() && ( m_xImp->m_xObject->getCurrentState() == embed::EmbedStates::UI_ACTIVE ) );
}
catch( uno::Exception& )
{}
@@ -824,12 +822,12 @@ bool SfxInPlaceClient::IsObjectInPlaceActive() const
try {
return(
(
- m_pImp->m_xObject.is() &&
- (m_pImp->m_xObject->getCurrentState() == embed::EmbedStates::INPLACE_ACTIVE)
+ m_xImp->m_xObject.is() &&
+ (m_xImp->m_xObject->getCurrentState() == embed::EmbedStates::INPLACE_ACTIVE)
) ||
(
- m_pImp->m_xObject.is() &&
- (m_pImp->m_xObject->getCurrentState() == embed::EmbedStates::UI_ACTIVE)
+ m_xImp->m_xObject.is() &&
+ (m_xImp->m_xObject->getCurrentState() == embed::EmbedStates::UI_ACTIVE)
)
);
}
@@ -857,7 +855,7 @@ SfxInPlaceClient* SfxInPlaceClient::GetClient( SfxObjectShell* pDoc, const css::
sal_Int64 SfxInPlaceClient::GetAspect() const
{
- return m_pImp->m_nAspect;
+ return m_xImp->m_nAspect;
}
ErrCode SfxInPlaceClient::DoVerb( long nVerb )
@@ -865,14 +863,14 @@ ErrCode SfxInPlaceClient::DoVerb( long nVerb )
SfxErrorContext aEc( ERRCTX_SO_DOVERB, m_pViewSh->GetWindow(), RID_SO_ERRCTX );
ErrCode nError = ERRCODE_NONE;
- if ( m_pImp->m_xObject.is() )
+ if ( m_xImp->m_xObject.is() )
{
bool bSaveCopyAs = false;
if ( nVerb == -8 ) // "Save Copy as..."
{
- svt::EmbeddedObjectRef::TryRunningState( m_pImp->m_xObject );
+ svt::EmbeddedObjectRef::TryRunningState( m_xImp->m_xObject );
// TODO/LATER: this special verb should disappear when outplace activation is completely available
- uno::Reference< frame::XModel > xEmbModel( m_pImp->m_xObject->getComponent(), uno::UNO_QUERY );
+ uno::Reference< frame::XModel > xEmbModel( m_xImp->m_xObject->getComponent(), uno::UNO_QUERY );
if ( xEmbModel.is() )
{
bSaveCopyAs = true;
@@ -905,11 +903,11 @@ ErrCode SfxInPlaceClient::DoVerb( long nVerb )
if ( !bSaveCopyAs )
{
- if ( m_pImp->m_nAspect == embed::Aspects::MSOLE_ICON )
+ if ( m_xImp->m_nAspect == embed::Aspects::MSOLE_ICON )
{
// the common persistence is supported by objects and links
- uno::Reference< embed::XEmbeddedOleObject > xEmbeddedOleObject( m_pImp->m_xObject, uno::UNO_QUERY );
+ uno::Reference< embed::XEmbeddedOleObject > xEmbeddedOleObject( m_xImp->m_xObject, uno::UNO_QUERY );
if ( xEmbeddedOleObject.is() && (nVerb == embed::EmbedVerbs::MS_OLEVERB_PRIMARY || nVerb == embed::EmbedVerbs::MS_OLEVERB_OPEN || nVerb == embed::EmbedVerbs::MS_OLEVERB_SHOW ))
nVerb = embed::EmbedVerbs::MS_OLEVERB_SHOW;
@@ -926,9 +924,9 @@ ErrCode SfxInPlaceClient::DoVerb( long nVerb )
m_pViewSh->GetViewFrame()->GetFrame().LockResize_Impl(true);
try
{
- m_pImp->m_xObject->setClientSite( m_pImp->m_xClient );
+ m_xImp->m_xObject->setClientSite( m_xImp->m_xClient );
- m_pImp->m_xObject->doVerb( nVerb );
+ m_xImp->m_xObject->doVerb( nVerb );
}
catch ( embed::UnreachableStateException& )
{
@@ -937,20 +935,20 @@ ErrCode SfxInPlaceClient::DoVerb( long nVerb )
// a workaround for the default verb, usually makes sense for alien objects
try
{
- m_pImp->m_xObject->doVerb( -9 ); // open own view, a workaround verb that is not visible
+ m_xImp->m_xObject->doVerb( -9 ); // open own view, a workaround verb that is not visible
- if ( m_pImp->m_xObject->getCurrentState() == embed::EmbedStates::UI_ACTIVE )
+ if ( m_xImp->m_xObject->getCurrentState() == embed::EmbedStates::UI_ACTIVE )
{
// the object was converted to OOo object
- awt::Size aSize = m_pImp->m_xObject->getVisualAreaSize( m_pImp->m_nAspect );
- MapMode aObjectMap( VCLUnoHelper::UnoEmbed2VCLMapUnit( m_pImp->m_xObject->getMapUnit( m_pImp->m_nAspect ) ) );
+ awt::Size aSize = m_xImp->m_xObject->getVisualAreaSize( m_xImp->m_nAspect );
+ MapMode aObjectMap( VCLUnoHelper::UnoEmbed2VCLMapUnit( m_xImp->m_xObject->getMapUnit( m_xImp->m_nAspect ) ) );
MapMode aClientMap( GetEditWin()->GetMapMode().GetMapUnit() );
Size aNewSize = GetEditWin()->LogicToLogic( Size( aSize.Width, aSize.Height ), &aObjectMap, &aClientMap );
Rectangle aScaledArea = GetScaledObjArea();
- m_pImp->m_aObjArea.SetSize( aNewSize );
- m_pImp->m_aScaleWidth = Fraction( aScaledArea.GetWidth(), aNewSize.Width() );
- m_pImp->m_aScaleHeight = Fraction( aScaledArea.GetHeight(), aNewSize.Height() );
+ m_xImp->m_aObjArea.SetSize( aNewSize );
+ m_xImp->m_aScaleWidth = Fraction( aScaledArea.GetWidth(), aNewSize.Width() );
+ m_xImp->m_aScaleHeight = Fraction( aScaledArea.GetHeight(), aNewSize.Height() );
}
}
catch (uno::Exception const& e)
@@ -990,10 +988,10 @@ ErrCode SfxInPlaceClient::DoVerb( long nVerb )
void SfxInPlaceClient::VisAreaChanged()
{
- uno::Reference < embed::XInplaceObject > xObj( m_pImp->m_xObject, uno::UNO_QUERY );
- uno::Reference < embed::XInplaceClient > xClient( m_pImp->m_xClient, uno::UNO_QUERY );
+ uno::Reference < embed::XInplaceObject > xObj( m_xImp->m_xObject, uno::UNO_QUERY );
+ uno::Reference < embed::XInplaceClient > xClient( m_xImp->m_xClient, uno::UNO_QUERY );
if ( xObj.is() && xClient.is() )
- m_pImp->SizeHasChanged();
+ m_xImp->SizeHasChanged();
}
void SfxInPlaceClient::ObjectAreaChanged()
@@ -1022,9 +1020,9 @@ void SfxInPlaceClient::DeactivateObject()
{
try
{
- m_pImp->m_bUIActive = false;
+ m_xImp->m_bUIActive = false;
bool bHasFocus = false;
- uno::Reference< frame::XModel > xModel( m_pImp->m_xObject->getComponent(), uno::UNO_QUERY );
+ uno::Reference< frame::XModel > xModel( m_xImp->m_xObject->getComponent(), uno::UNO_QUERY );
if ( xModel.is() )
{
uno::Reference< frame::XController > xController = xModel->getCurrentController();
@@ -1037,21 +1035,21 @@ void SfxInPlaceClient::DeactivateObject()
m_pViewSh->GetViewFrame()->GetFrame().LockResize_Impl(true);
- if ( (m_pImp->m_xObject->getStatus( m_pImp->m_nAspect ) & embed::EmbedMisc::MS_EMBED_ACTIVATEWHENVISIBLE) ||
- svt::EmbeddedObjectRef::IsGLChart(m_pImp->m_xObject) )
+ if ( (m_xImp->m_xObject->getStatus( m_xImp->m_nAspect ) & embed::EmbedMisc::MS_EMBED_ACTIVATEWHENVISIBLE) ||
+ svt::EmbeddedObjectRef::IsGLChart(m_xImp->m_xObject) )
{
- m_pImp->m_xObject->changeState( embed::EmbedStates::INPLACE_ACTIVE );
+ m_xImp->m_xObject->changeState( embed::EmbedStates::INPLACE_ACTIVE );
if (bHasFocus)
m_pViewSh->GetWindow()->GrabFocus();
}
else
{
// the links should not stay in running state for long time because of locking
- uno::Reference< embed::XLinkageSupport > xLink( m_pImp->m_xObject, uno::UNO_QUERY );
+ uno::Reference< embed::XLinkageSupport > xLink( m_xImp->m_xObject, uno::UNO_QUERY );
if ( xLink.is() && xLink->isLink() )
- m_pImp->m_xObject->changeState( embed::EmbedStates::LOADED );
+ m_xImp->m_xObject->changeState( embed::EmbedStates::LOADED );
else
- m_pImp->m_xObject->changeState( embed::EmbedStates::RUNNING );
+ m_xImp->m_xObject->changeState( embed::EmbedStates::RUNNING );
}
SfxViewFrame* pFrame = m_pViewSh->GetViewFrame();
@@ -1070,18 +1068,18 @@ void SfxInPlaceClient::ResetObject()
{
try
{
- m_pImp->m_bUIActive = false;
- if ( (m_pImp->m_xObject->getStatus( m_pImp->m_nAspect ) & embed::EmbedMisc::MS_EMBED_ACTIVATEWHENVISIBLE) ||
- svt::EmbeddedObjectRef::IsGLChart(m_pImp->m_xObject) )
- m_pImp->m_xObject->changeState( embed::EmbedStates::INPLACE_ACTIVE );
+ m_xImp->m_bUIActive = false;
+ if ( (m_xImp->m_xObject->getStatus( m_xImp->m_nAspect ) & embed::EmbedMisc::MS_EMBED_ACTIVATEWHENVISIBLE) ||
+ svt::EmbeddedObjectRef::IsGLChart(m_xImp->m_xObject) )
+ m_xImp->m_xObject->changeState( embed::EmbedStates::INPLACE_ACTIVE );
else
{
// the links should not stay in running state for long time because of locking
- uno::Reference< embed::XLinkageSupport > xLink( m_pImp->m_xObject, uno::UNO_QUERY );
+ uno::Reference< embed::XLinkageSupport > xLink( m_xImp->m_xObject, uno::UNO_QUERY );
if ( xLink.is() && xLink->isLink() )
- m_pImp->m_xObject->changeState( embed::EmbedStates::LOADED );
+ m_xImp->m_xObject->changeState( embed::EmbedStates::LOADED );
else
- m_pImp->m_xObject->changeState( embed::EmbedStates::RUNNING );
+ m_xImp->m_xObject->changeState( embed::EmbedStates::RUNNING );
}
}
catch (css::uno::Exception& )
@@ -1091,7 +1089,7 @@ void SfxInPlaceClient::ResetObject()
bool SfxInPlaceClient::IsUIActive()
{
- return m_pImp->m_bUIActive;
+ return m_xImp->m_bUIActive;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 9605f1cd1375fc56e3a3ec76fa04e5a7a3caa70f
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date: Fri Jan 20 14:49:42 2017 +0200
use rtl::Reference in SfxAppData_Impl
instead of manual acquire/release
Change-Id: Id8c1b2dbb9acb0861f71f05a83842f357edfc1e8
diff --git a/sfx2/source/appl/appdata.cxx b/sfx2/source/appl/appdata.cxx
index e60ec8a..b4a5ff4 100644
--- a/sfx2/source/appl/appdata.cxx
+++ b/sfx2/source/appl/appdata.cxx
@@ -40,6 +40,7 @@
#include <sfx2/docfile.hxx>
#include <sfx2/request.hxx>
#include <sfx2/sidebar/Theme.hxx>
+#include <sfx2/unoctitm.hxx>
#include "app.hrc"
#include <sfx2/sfxresid.hxx>
#include "objshimp.hxx"
@@ -99,7 +100,6 @@ SfxAppData_Impl::SfxAppData_Impl( SfxApplication* )
#if HAVE_FEATURE_SCRIPTING
, m_pSbxErrorHdl(nullptr)
#endif
- , pAppDispatch(nullptr)
, pTemplates( nullptr )
, pPool(nullptr)
, pProgress(nullptr)
diff --git a/sfx2/source/appl/appinit.cxx b/sfx2/source/appl/appinit.cxx
index c380879..93f6349 100644
--- a/sfx2/source/appl/appinit.cxx
+++ b/sfx2/source/appl/appinit.cxx
@@ -112,8 +112,8 @@ void SAL_CALL SfxTerminateListener_Impl::notifyTermination( const EventObject& a
SfxApplication* pApp = SfxGetpApp();
pApp->Broadcast( SfxHint( SfxHintId::Deinitializing ) );
- pApp->Get_Impl()->pAppDispatch->ReleaseAll();
- pApp->Get_Impl()->pAppDispatch->release();
+ pApp->Get_Impl()->mxAppDispatch->ReleaseAll();
+ pApp->Get_Impl()->mxAppDispatch.clear();
css::uno::Reference< css::uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext();
css::uno::Reference< css::document::XDocumentEventListener > xGlobalBroadcaster(css::frame::theGlobalEventBroadcaster::get(xContext), css::uno::UNO_QUERY_THROW);
@@ -205,8 +205,7 @@ void SfxApplication::Initialize_Impl()
Reference < XDesktop2 > xDesktop = Desktop::create ( ::comphelper::getProcessComponentContext() );
xDesktop->addTerminateListener( new SfxTerminateListener_Impl() );
- pImpl->pAppDispatch = new SfxStatusDispatcher;
- pImpl->pAppDispatch->acquire();
+ pImpl->mxAppDispatch = new SfxStatusDispatcher;
// SV-Look
Help::EnableContextHelp();
diff --git a/sfx2/source/inc/appdata.hxx b/sfx2/source/inc/appdata.hxx
index bc98e98..29b6bfd 100644
--- a/sfx2/source/inc/appdata.hxx
+++ b/sfx2/source/inc/appdata.hxx
@@ -93,7 +93,7 @@ public:
#if HAVE_FEATURE_SCRIPTING
SfxErrorHandler *m_pSbxErrorHdl;
#endif
- SfxStatusDispatcher* pAppDispatch;
+ rtl::Reference<SfxStatusDispatcher> mxAppDispatch;
SfxDocumentTemplates* pTemplates;
// global pointers
commit 87a8d05946cb63ff421c14b961ce74fa75bbf083
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date: Fri Jan 20 14:44:58 2017 +0200
use rtl::Reference in CellShell_Impl
instead of manual acquire/release
Change-Id: I4fde1277c023101e5331e3dad4f0243bd8ac8e3f
diff --git a/sc/source/ui/inc/cellsh.hxx b/sc/source/ui/inc/cellsh.hxx
index 5b0c7d1..5a3ee9ed 100644
--- a/sc/source/ui/inc/cellsh.hxx
+++ b/sc/source/ui/inc/cellsh.hxx
@@ -30,6 +30,7 @@
#include "formatsh.hxx"
#include "address.hxx"
#include <vcl/window.hxx>
+#include <rtl/ref.hxx>
class SvxClipboardFormatItem;
class TransferableDataHelper;
@@ -38,15 +39,12 @@ class AbstractScLinkedAreaDlg;
struct CellShell_Impl
{
- TransferableClipboardListener* m_pClipEvtLstnr;
+ rtl::Reference<TransferableClipboardListener>
+ m_xClipEvtLstnr;
VclPtr<AbstractScLinkedAreaDlg> m_pLinkedDlg;
SfxRequest* m_pRequest;
- CellShell_Impl() :
- m_pClipEvtLstnr( nullptr ),
- m_pLinkedDlg(),
- m_pRequest( nullptr ) {}
-
+ CellShell_Impl();
~CellShell_Impl();
};
diff --git a/sc/source/ui/view/cellsh.cxx b/sc/source/ui/view/cellsh.cxx
index b0a49e2..c82c380 100644
--- a/sc/source/ui/view/cellsh.cxx
+++ b/sc/source/ui/view/cellsh.cxx
@@ -87,15 +87,15 @@ ScCellShell::ScCellShell(ScViewData* pData, VclPtr<vcl::Window> frameWin) :
ScCellShell::~ScCellShell()
{
- if ( pImpl->m_pClipEvtLstnr )
+ if ( pImpl->m_xClipEvtLstnr.is() )
{
- pImpl->m_pClipEvtLstnr->RemoveListener( GetViewData()->GetActiveWin() );
+ pImpl->m_xClipEvtLstnr->RemoveListener( GetViewData()->GetActiveWin() );
// The listener may just now be waiting for the SolarMutex and call the link
// afterwards, in spite of RemoveListener. So the link has to be reset, too.
- pImpl->m_pClipEvtLstnr->ClearCallbackLink();
+ pImpl->m_xClipEvtLstnr->ClearCallbackLink();
- pImpl->m_pClipEvtLstnr->release();
+ pImpl->m_xClipEvtLstnr.clear();
}
pImpl->m_pLinkedDlg.disposeAndClear();
@@ -556,13 +556,12 @@ void ScCellShell::GetClipState( SfxItemSet& rSet )
// SID_PASTE_SPECIAL
// SID_CLIPBOARD_FORMAT_ITEMS
- if ( !pImpl->m_pClipEvtLstnr )
+ if ( !pImpl->m_xClipEvtLstnr.is() )
{
// create listener
- pImpl->m_pClipEvtLstnr = new TransferableClipboardListener( LINK( this, ScCellShell, ClipboardChanged ) );
- pImpl->m_pClipEvtLstnr->acquire();
+ pImpl->m_xClipEvtLstnr = new TransferableClipboardListener( LINK( this, ScCellShell, ClipboardChanged ) );
vcl::Window* pWin = GetViewData()->GetActiveWin();
- pImpl->m_pClipEvtLstnr->AddListener( pWin );
+ pImpl->m_xClipEvtLstnr->AddListener( pWin );
// get initial state
TransferableDataHelper aDataHelper( TransferableDataHelper::CreateFromSystemClipboard( pWin ) );
diff --git a/sc/source/ui/view/cellsh1.cxx b/sc/source/ui/view/cellsh1.cxx
index f661f34..c0d4d4f 100644
--- a/sc/source/ui/view/cellsh1.cxx
+++ b/sc/source/ui/view/cellsh1.cxx
@@ -45,6 +45,7 @@
#include <vcl/builderfactory.hxx>
#include <unotools/localedatawrapper.hxx>
#include <editeng/editview.hxx>
+#include <svtools/cliplistener.hxx>
#include "cellsh.hxx"
#include "sc.hrc"
@@ -2986,6 +2987,10 @@ IMPL_LINK_NOARG(ScCellShell, DialogClosed, Dialog&, void)
ExecuteExternalSource( sFile, sFilter, sOptions, sSource, nRefresh, *(pImpl->m_pRequest) );
}
+CellShell_Impl::CellShell_Impl() :
+ m_pLinkedDlg(),
+ m_pRequest( nullptr ) {}
+
CellShell_Impl::~CellShell_Impl()
{
}
commit a232712f39ab6bc91f9f531d0861dd2096998c79
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date: Fri Jan 20 14:37:39 2017 +0200
use rtl::Reference in ScSelectionTransferObj
instead of manual acquire/release
Change-Id: I056fc3767f2e7b3ffacdd930e9a8e3b71c32620e
diff --git a/sc/source/ui/app/seltrans.cxx b/sc/source/ui/app/seltrans.cxx
index 6b7eee2..08a4229 100644
--- a/sc/source/ui/app/seltrans.cxx
+++ b/sc/source/ui/app/seltrans.cxx
@@ -141,9 +141,7 @@ ScSelectionTransferObj* ScSelectionTransferObj::CreateFromView( ScTabView* pView
ScSelectionTransferObj::ScSelectionTransferObj( ScTabView* pSource, ScSelectionTransferMode eNewMode ) :
pView( pSource ),
- eMode( eNewMode ),
- pCellData( nullptr ),
- pDrawData( nullptr )
+ eMode( eNewMode )
{
//! store range for StillValid
}
@@ -168,16 +166,8 @@ void ScSelectionTransferObj::ForgetView()
pView = nullptr;
eMode = SC_SELTRANS_INVALID;
- if (pCellData)
- {
- pCellData->release();
- pCellData = nullptr;
- }
- if (pDrawData)
- {
- pDrawData->release();
- pDrawData = nullptr;
- }
+ mxCellData.clear();
+ mxDrawData.clear();
}
void ScSelectionTransferObj::AddSupportedFormats()
@@ -258,7 +248,7 @@ void ScSelectionTransferObj::AddSupportedFormats()
void ScSelectionTransferObj::CreateCellData()
{
- OSL_ENSURE( !pCellData, "CreateCellData twice" );
+ OSL_ENSURE( !mxCellData.is(), "CreateCellData twice" );
if ( pView )
{
ScViewData& rViewData = pView->GetViewData();
@@ -306,19 +296,18 @@ void ScSelectionTransferObj::CreateCellData()
pTransferObj->SetDragSource( pDocSh, aNewMark );
- pCellData = pTransferObj;
- pCellData->acquire(); // keep ref count up - released in ForgetView
+ mxCellData = pTransferObj;
}
else
delete pClipDoc;
}
}
- OSL_ENSURE( pCellData, "can't create CellData" );
+ OSL_ENSURE( mxCellData.is(), "can't create CellData" );
}
void ScSelectionTransferObj::CreateDrawData()
{
- OSL_ENSURE( !pDrawData, "CreateDrawData twice" );
+ OSL_ENSURE( !mxDrawData.is(), "CreateDrawData twice" );
if ( pView )
{
// similar to ScDrawView::BeginDrag
@@ -356,27 +345,26 @@ void ScSelectionTransferObj::CreateDrawData()
pTransferObj->SetDrawPersist( aPersistRef ); // keep persist for ole objects alive
pTransferObj->SetDragSource( pDrawView ); // copies selection
- pDrawData = pTransferObj;
- pDrawData->acquire(); // keep ref count up - released in ForgetView
+ mxDrawData = pTransferObj;
}
}
- OSL_ENSURE( pDrawData, "can't create DrawData" );
+ OSL_ENSURE( mxDrawData.is(), "can't create DrawData" );
}
ScTransferObj* ScSelectionTransferObj::GetCellData()
{
- if ( !pCellData && ( eMode == SC_SELTRANS_CELL || eMode == SC_SELTRANS_CELLS ) )
+ if ( !mxCellData.is() && ( eMode == SC_SELTRANS_CELL || eMode == SC_SELTRANS_CELLS ) )
CreateCellData();
- return pCellData;
+ return mxCellData.get();
}
ScDrawTransferObj* ScSelectionTransferObj::GetDrawData()
{
- if ( !pDrawData && ( eMode == SC_SELTRANS_DRAW_BITMAP || eMode == SC_SELTRANS_DRAW_GRAPHIC ||
- eMode == SC_SELTRANS_DRAW_BOOKMARK || eMode == SC_SELTRANS_DRAW_OLE ||
- eMode == SC_SELTRANS_DRAW_OTHER ) )
+ if ( !mxDrawData.is() && ( eMode == SC_SELTRANS_DRAW_BITMAP || eMode == SC_SELTRANS_DRAW_GRAPHIC ||
+ eMode == SC_SELTRANS_DRAW_BOOKMARK || eMode == SC_SELTRANS_DRAW_OLE ||
+ eMode == SC_SELTRANS_DRAW_OTHER ) )
CreateDrawData();
- return pDrawData;
+ return mxDrawData.get();
}
bool ScSelectionTransferObj::GetData(
diff --git a/sc/source/ui/inc/seltrans.hxx b/sc/source/ui/inc/seltrans.hxx
index 438818b..cb757fb 100644
--- a/sc/source/ui/inc/seltrans.hxx
+++ b/sc/source/ui/inc/seltrans.hxx
@@ -21,6 +21,7 @@
#define INCLUDED_SC_SOURCE_UI_INC_SELTRANS_HXX
#include <svtools/transfer.hxx>
+#include <rtl/ref.hxx>
class ScTabView;
class ScTransferObj;
@@ -41,10 +42,10 @@ enum ScSelectionTransferMode
class ScSelectionTransferObj : public TransferableHelper
{
private:
- ScTabView* pView;
- ScSelectionTransferMode eMode;
- ScTransferObj* pCellData;
- ScDrawTransferObj* pDrawData;
+ ScTabView* pView;
+ ScSelectionTransferMode eMode;
+ rtl::Reference<ScTransferObj> mxCellData;
+ rtl::Reference<ScDrawTransferObj> mxDrawData;
ScSelectionTransferObj( ScTabView* pSource, ScSelectionTransferMode eNewMode );
void CreateCellData();
commit 8abcd0c38707a61fe5175840f19c2d0a9f8825ee
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date: Fri Jan 20 13:55:21 2017 +0200
use tools::SvRef in ImpSdrObjTextLinkUserData
since the field is SvRefBase-derived
Change-Id: Ie84c48daf93e3805b2db240a497a8496779fe750
diff --git a/include/svx/svdotext.hxx b/include/svx/svdotext.hxx
index 1790e48..3a8ddca 100644
--- a/include/svx/svdotext.hxx
+++ b/include/svx/svdotext.hxx
@@ -32,6 +32,7 @@
#include <svx/svxdllapi.h>
#include <drawinglayer/primitive2d/baseprimitive2d.hxx>
#include <svx/svdpagv.hxx>
+#include <rtl/ref.hxx>
// forward declarations
@@ -105,7 +106,7 @@ class ImpSdrObjTextLinkUserData : public SdrObjUserData
OUString aFileName; // Name des referenzierten Dokuments
OUString aFilterName; // ggf. ein Filter
DateTime aFileDate0; // Unnoetiges neuladen vermeiden
- std::unique_ptr<ImpSdrObjTextLink>
+ tools::SvRef<ImpSdrObjTextLink>
pLink;
rtl_TextEncoding eCharSet;
diff --git a/svx/source/svdraw/svdotxln.cxx b/svx/source/svdraw/svdotxln.cxx
index e6d4d4f..5568347 100644
--- a/svx/source/svdraw/svdotxln.cxx
+++ b/svx/source/svdraw/svdotxln.cxx
@@ -257,7 +257,7 @@ void SdrTextObj::ImpLinkAnmeldung()
ImpSdrObjTextLinkUserData* pData=GetLinkUserData();
sfx2::LinkManager* pLinkManager=pModel!=nullptr ? pModel->GetLinkManager() : nullptr;
if (pLinkManager!=nullptr && pData!=nullptr && pData->pLink==nullptr) { // don't register twice
- pData->pLink.reset( new ImpSdrObjTextLink(this) );
+ pData->pLink = new ImpSdrObjTextLink(this);
pLinkManager->InsertFileLink(*pData->pLink,OBJECT_CLIENT_FILE,pData->aFileName,
!pData->aFilterName.isEmpty() ?
&pData->aFilterName : nullptr);
commit dc3377528186f4f111553530fa0ffd7f64711f64
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date: Fri Jan 20 13:47:21 2017 +0200
use rtl::Reference in ODatabaseForm
rather than manual acquire/release
Change-Id: Ic5f013b7e4cafc597c659c61fbf568adccfd806a
diff --git a/forms/source/component/DatabaseForm.cxx b/forms/source/component/DatabaseForm.cxx
index d61c7a7..dfa7224 100644
--- a/forms/source/component/DatabaseForm.cxx
+++ b/forms/source/component/DatabaseForm.cxx
@@ -258,7 +258,6 @@ ODatabaseForm::ODatabaseForm(const Reference<XComponentContext>& _rxContext)
,m_aErrorListeners(m_aMutex)
,m_aResetListeners( *this, m_aMutex )
,m_aPropertyBagHelper( *this )
- ,m_pAggregatePropertyMultiplexer(nullptr)
,m_aParameterManager( m_aMutex, _rxContext )
,m_aFilterManager()
,m_pLoadTimer(nullptr)
@@ -294,7 +293,6 @@ ODatabaseForm::ODatabaseForm( const ODatabaseForm& _cloneSource )
,m_aErrorListeners( m_aMutex )
,m_aResetListeners( *this, m_aMutex )
,m_aPropertyBagHelper( *this )
- ,m_pAggregatePropertyMultiplexer( nullptr )
,m_aParameterManager( m_aMutex, _cloneSource.m_xContext )
,m_aFilterManager()
,m_pLoadTimer( nullptr )
@@ -392,10 +390,9 @@ void ODatabaseForm::impl_construct()
// listen for the properties, important for Parameters
if ( m_xAggregateSet.is() )
{
- m_pAggregatePropertyMultiplexer = new OPropertyChangeMultiplexer(this, m_xAggregateSet, false);
- m_pAggregatePropertyMultiplexer->acquire();
- m_pAggregatePropertyMultiplexer->addProperty(PROPERTY_COMMAND);
- m_pAggregatePropertyMultiplexer->addProperty(PROPERTY_ACTIVE_CONNECTION);
+ m_xAggregatePropertyMultiplexer = new OPropertyChangeMultiplexer(this, m_xAggregateSet, false);
+ m_xAggregatePropertyMultiplexer->addProperty(PROPERTY_COMMAND);
+ m_xAggregatePropertyMultiplexer->addProperty(PROPERTY_ACTIVE_CONNECTION);
}
{
@@ -429,11 +426,10 @@ ODatabaseForm::~ODatabaseForm()
m_aWarnings.setExternalWarnings( nullptr );
- if (m_pAggregatePropertyMultiplexer)
+ if (m_xAggregatePropertyMultiplexer.is())
{
- m_pAggregatePropertyMultiplexer->dispose();
- m_pAggregatePropertyMultiplexer->release();
- m_pAggregatePropertyMultiplexer = nullptr;
+ m_xAggregatePropertyMultiplexer->dispose();
+ m_xAggregatePropertyMultiplexer.clear();
}
}
@@ -1252,8 +1248,8 @@ bool ODatabaseForm::executeRowSet(::osl::ResettableMutexGuard& _rClearForNotifie
void ODatabaseForm::disposing()
{
- if (m_pAggregatePropertyMultiplexer)
- m_pAggregatePropertyMultiplexer->dispose();
+ if (m_xAggregatePropertyMultiplexer.is())
+ m_xAggregatePropertyMultiplexer->dispose();
if (m_bLoaded)
unload();
diff --git a/forms/source/component/DatabaseForm.hxx b/forms/source/component/DatabaseForm.hxx
index 683e51a..f041f51 100644
--- a/forms/source/component/DatabaseForm.hxx
+++ b/forms/source/component/DatabaseForm.hxx
@@ -73,6 +73,7 @@
#include <cppuhelper/implbase12.hxx>
#include <cppuhelper/implbase4.hxx>
#include <cppuhelper/implbase7.hxx>
+#include <rtl/ref.hxx>
namespace com { namespace sun { namespace star { namespace sdbc {
class SQLException;
@@ -173,7 +174,7 @@ class ODatabaseForm :public OFormComponents
PropertyBagHelper m_aPropertyBagHelper;
::dbtools::WarningsContainer m_aWarnings;
- OPropertyChangeMultiplexer* m_pAggregatePropertyMultiplexer;
+ rtl::Reference<OPropertyChangeMultiplexer> m_xAggregatePropertyMultiplexer;
// Management of the Control Groups
rtl::Reference<OGroupManager> m_pGroupManager;
::dbtools::ParameterManager m_aParameterManager;
commit 9c6bdac80b9f61d224a239317f2558ddd7e1744d
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date: Fri Jan 20 13:43:25 2017 +0200
use rtl::Reference in SubmissionPropertyHandler
rather than manual acquire/release
Change-Id: I3276361153591a3af8c6b00b478365b2700dedf5
diff --git a/extensions/source/propctrlr/submissionhandler.cxx b/extensions/source/propctrlr/submissionhandler.cxx
index f523cc7..ed0b5d3 100644
--- a/extensions/source/propctrlr/submissionhandler.cxx
+++ b/extensions/source/propctrlr/submissionhandler.cxx
@@ -93,7 +93,6 @@ namespace pcr
SubmissionPropertyHandler::SubmissionPropertyHandler( const Reference< XComponentContext >& _rxContext )
:EditPropertyHandler_Base( _rxContext )
,OPropertyChangeListener( m_aMutex )
- ,m_pPropChangeMultiplexer( nullptr )
{
}
@@ -236,11 +235,10 @@ namespace pcr
void SubmissionPropertyHandler::onNewComponent()
{
- if ( m_pPropChangeMultiplexer )
+ if ( m_xPropChangeMultiplexer.is() )
{
- m_pPropChangeMultiplexer->dispose();
- m_pPropChangeMultiplexer->release();
- m_pPropChangeMultiplexer = nullptr;
+ m_xPropChangeMultiplexer->dispose();
+ m_xPropChangeMultiplexer.clear();
}
EditPropertyHandler_Base::onNewComponent();
@@ -254,9 +252,8 @@ namespace pcr
{
m_pHelper.reset( new SubmissionHelper( m_aMutex, m_xComponent, xDocument ) );
- m_pPropChangeMultiplexer = new OPropertyChangeMultiplexer( this, m_xComponent );
- m_pPropChangeMultiplexer->acquire();
- m_pPropChangeMultiplexer->addProperty( PROPERTY_BUTTONTYPE );
+ m_xPropChangeMultiplexer = new OPropertyChangeMultiplexer( this, m_xComponent );
+ m_xPropChangeMultiplexer->addProperty( PROPERTY_BUTTONTYPE );
}
}
diff --git a/extensions/source/propctrlr/submissionhandler.hxx b/extensions/source/propctrlr/submissionhandler.hxx
index 63bcbb3..f0408e4 100644
--- a/extensions/source/propctrlr/submissionhandler.hxx
+++ b/extensions/source/propctrlr/submissionhandler.hxx
@@ -25,6 +25,7 @@
#include <com/sun/star/xforms/XSubmission.hpp>
#include <comphelper/propmultiplex.hxx>
+#include <rtl/ref.hxx>
namespace comphelper
{
@@ -68,8 +69,8 @@ namespace pcr
class SubmissionPropertyHandler : public EditPropertyHandler_Base, public ::comphelper::OPropertyChangeListener
{
private:
- ::std::unique_ptr< SubmissionHelper > m_pHelper;
- ::comphelper::OPropertyChangeMultiplexer* m_pPropChangeMultiplexer;
+ ::std::unique_ptr< SubmissionHelper > m_pHelper;
+ rtl::Reference<::comphelper::OPropertyChangeMultiplexer> m_xPropChangeMultiplexer;
public:
explicit SubmissionPropertyHandler(
commit 32f4f3b52ad491ab83a67dfe57ea4f27d66b39a7
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date: Fri Jan 20 13:41:26 2017 +0200
use rtl::Reference in bib::OComponentListener
rather than manual acquire/release
Change-Id: Ib4b52fb4a85223f974e9905bc3d02eb839150030
diff --git a/extensions/source/bibliography/loadlisteneradapter.cxx b/extensions/source/bibliography/loadlisteneradapter.cxx
index d25c7f0..7b6f35a 100644
--- a/extensions/source/bibliography/loadlisteneradapter.cxx
+++ b/extensions/source/bibliography/loadlisteneradapter.cxx
@@ -32,31 +32,16 @@ namespace bib
OComponentListener::~OComponentListener()
{
- {
- ::osl::MutexGuard aGuard( m_rMutex );
- if ( m_pAdapter )
- m_pAdapter->dispose();
- }
+ ::osl::MutexGuard aGuard( m_rMutex );
+ if ( m_xAdapter.is() )
+ m_xAdapter->dispose();
}
void OComponentListener::setAdapter( OComponentAdapterBase* pAdapter )
{
- {
- ::osl::MutexGuard aGuard( m_rMutex );
- if ( m_pAdapter )
- {
- m_pAdapter->release();
- m_pAdapter = nullptr;
- }
- }
-
- if ( pAdapter )
- {
- ::osl::MutexGuard aGuard( m_rMutex );
- m_pAdapter = pAdapter;
- m_pAdapter->acquire();
- }
+ ::osl::MutexGuard aGuard( m_rMutex );
+ m_xAdapter = pAdapter;
}
OComponentAdapterBase::OComponentAdapterBase( const Reference< XComponent >& _rxComp )
diff --git a/extensions/source/bibliography/loadlisteneradapter.hxx b/extensions/source/bibliography/loadlisteneradapter.hxx
index 47458a6..d61756c 100644
--- a/extensions/source/bibliography/loadlisteneradapter.hxx
+++ b/extensions/source/bibliography/loadlisteneradapter.hxx
@@ -24,6 +24,7 @@
#include <com/sun/star/lang/XComponent.hpp>
#include <cppuhelper/implbase.hxx>
#include <com/sun/star/form/XLoadable.hpp>
+#include <rtl/ref.hxx>
namespace bib
@@ -37,12 +38,11 @@ namespace bib
friend class OComponentAdapterBase;
private:
- OComponentAdapterBase* m_pAdapter;
- ::osl::Mutex& m_rMutex;
+ rtl::Reference<OComponentAdapterBase> m_xAdapter;
+ ::osl::Mutex& m_rMutex;
protected:
explicit OComponentListener( ::osl::Mutex& _rMutex )
- :m_pAdapter( nullptr )
- ,m_rMutex( _rMutex )
+ :m_rMutex( _rMutex )
{
}
commit 2bbf21aaded0c0623ee802e746dbf6b11d58d396
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date: Fri Jan 20 13:37:37 2017 +0200
use rtl::Reference in DocumentHolder
instead of manual acquire/release
Change-Id: Id795dca5ff9e392fa2649f4721a73ce3ffd6de2c
diff --git a/embeddedobj/source/general/docholder.cxx b/embeddedobj/source/general/docholder.cxx
index d465c21..506ec44 100644
--- a/embeddedobj/source/general/docholder.cxx
+++ b/embeddedobj/source/general/docholder.cxx
@@ -149,7 +149,6 @@ static void InsertMenu_Impl( const uno::Reference< container::XIndexContainer >&
DocumentHolder::DocumentHolder( const uno::Reference< uno::XComponentContext >& xContext,
OCommonEmbeddedObject* pEmbObj )
: m_pEmbedObj( pEmbObj ),
- m_pInterceptor( nullptr ),
m_xContext( xContext ),
m_bReadOnly( false ),
m_bWaitForClose( false ),
@@ -200,10 +199,10 @@ DocumentHolder::~DocumentHolder()
} catch( const uno::Exception& ) {}
}
- if ( m_pInterceptor )
+ if ( m_xInterceptor.is() )
{
- m_pInterceptor->DisconnectDocHolder();
- m_pInterceptor->release();
+ m_xInterceptor->DisconnectDocHolder();
+ m_xInterceptor.clear();
}
if ( !m_bDesktopTerminated )
@@ -837,17 +836,15 @@ uno::Reference< frame::XFrame > const & DocumentHolder::GetDocFrame()
uno::Reference< frame::XDispatchProviderInterception > xInterception( m_xFrame, uno::UNO_QUERY );
if ( xInterception.is() )
{
- if ( m_pInterceptor )
+ if ( m_xInterceptor.is() )
{
- m_pInterceptor->DisconnectDocHolder();
- m_pInterceptor->release();
- m_pInterceptor = nullptr;
+ m_xInterceptor->DisconnectDocHolder();
+ m_xInterceptor.clear();
}
- m_pInterceptor = new Interceptor( this );
- m_pInterceptor->acquire();
+ m_xInterceptor = new Interceptor( this );
- xInterception->registerDispatchProviderInterceptor( m_pInterceptor );
+ xInterception->registerDispatchProviderInterceptor( m_xInterceptor.get() );
// register interceptor from outside
if ( m_xOutplaceInterceptor.is() )
diff --git a/embeddedobj/source/inc/docholder.hxx b/embeddedobj/source/inc/docholder.hxx
index 7e8ca8f..048680c 100644
--- a/embeddedobj/source/inc/docholder.hxx
+++ b/embeddedobj/source/inc/docholder.hxx
@@ -36,6 +36,7 @@
#include <com/sun/star/frame/XLayoutManager.hpp>
#include <com/sun/star/uno/XComponentContext.hpp>
#include <cppuhelper/implbase.hxx>
+#include <rtl/ref.hxx>
class OCommonEmbeddedObject;
class Interceptor;
@@ -53,7 +54,7 @@ private:
OCommonEmbeddedObject* m_pEmbedObj;
- Interceptor* m_pInterceptor;
+ rtl::Reference<Interceptor> m_xInterceptor;
css::uno::Reference< css::frame::XDispatchProviderInterceptor > m_xOutplaceInterceptor;
css::uno::Reference< css::uno::XComponentContext > m_xContext;
commit 4f5b22b93a53c52a46ebdd5ce479086f8df20e22
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date: Fri Jan 20 13:35:32 2017 +0200
use rtl::Reference in OCommonEmbeddedObject
instead of manual acquire/release
Change-Id: Ie641f72687a05e1cd3cf697d551f9c6d21ac4487
diff --git a/embeddedobj/source/commonembedding/embedobj.cxx b/embeddedobj/source/commonembedding/embedobj.cxx
index 5142871..881a75b0 100644
--- a/embeddedobj/source/commonembedding/embedobj.cxx
+++ b/embeddedobj/source/commonembedding/embedobj.cxx
@@ -83,7 +83,7 @@ sal_Int32 OCommonEmbeddedObject::ConvertVerbToState_Impl( sal_Int32 nVerb )
void OCommonEmbeddedObject::Deactivate()
{
- uno::Reference< util::XModifiable > xModif( m_pDocHolder->GetComponent(), uno::UNO_QUERY );
+ uno::Reference< util::XModifiable > xModif( m_xDocHolder->GetComponent(), uno::UNO_QUERY );
// no need to lock for the initialization
uno::Reference< embed::XEmbeddedClient > xClientSite = m_xClientSite;
@@ -108,7 +108,7 @@ void OCommonEmbeddedObject::Deactivate()
}
}
- m_pDocHolder->CloseFrame();
+ m_xDocHolder->CloseFrame();
xClientSite->visibilityChanged( false );
}
@@ -166,7 +166,7 @@ void OCommonEmbeddedObject::SwitchStateTo_Impl( sal_Int32 nNextState )
if ( m_bIsLink )
{
- m_pDocHolder->SetComponent( LoadLink_Impl(), m_bReadOnly );
+ m_xDocHolder->SetComponent( LoadLink_Impl(), m_bReadOnly );
}
else
{
@@ -179,7 +179,7 @@ void OCommonEmbeddedObject::SwitchStateTo_Impl( sal_Int32 nNextState )
if ( !m_xObjectStorage.is() )
throw io::IOException(); //TODO: access denied
- m_pDocHolder->SetComponent( LoadDocumentFromStorage_Impl(), m_bReadOnly );
+ m_xDocHolder->SetComponent( LoadDocumentFromStorage_Impl(), m_bReadOnly );
}
else
{
@@ -194,11 +194,11 @@ void OCommonEmbeddedObject::SwitchStateTo_Impl( sal_Int32 nNextState )
if ( xChild.is() )
xChild->setParent( m_xParent );
- m_pDocHolder->SetComponent( xDocument, m_bReadOnly );
+ m_xDocHolder->SetComponent( xDocument, m_bReadOnly );
}
}
- if ( !m_pDocHolder->GetComponent().is() )
+ if ( !m_xDocHolder->GetComponent().is() )
throw embed::UnreachableStateException(); //TODO: can't open document
m_nObjectState = nNextState;
@@ -213,11 +213,11 @@ void OCommonEmbeddedObject::SwitchStateTo_Impl( sal_Int32 nNextState )
{
if ( nNextState == embed::EmbedStates::LOADED )
{
- m_nClonedMapUnit = m_pDocHolder->GetMapUnit( embed::Aspects::MSOLE_CONTENT );
- m_bHasClonedSize = m_pDocHolder->GetExtent( embed::Aspects::MSOLE_CONTENT, &m_aClonedSize );
+ m_nClonedMapUnit = m_xDocHolder->GetMapUnit( embed::Aspects::MSOLE_CONTENT );
+ m_bHasClonedSize = m_xDocHolder->GetExtent( embed::Aspects::MSOLE_CONTENT, &m_aClonedSize );
// actually frame should not exist at this point
- m_pDocHolder->CloseDocument( false, false );
+ m_xDocHolder->CloseDocument( false, false );
m_nObjectState = nNextState;
}
@@ -250,7 +250,7 @@ void OCommonEmbeddedObject::SwitchStateTo_Impl( sal_Int32 nNextState )
// dispatch provider may not be provided
uno::Reference< frame::XDispatchProvider > xContainerDP = xInplaceClient->getInplaceDispatchProvider();
- bool bOk = m_pDocHolder->ShowInplace( xClientWindowPeer, aRectangleToShow, xContainerDP );
+ bool bOk = m_xDocHolder->ShowInplace( xClientWindowPeer, aRectangleToShow, xContainerDP );
m_nObjectState = nNextState;
if ( !bOk )
{
@@ -267,7 +267,7 @@ void OCommonEmbeddedObject::SwitchStateTo_Impl( sal_Int32 nNextState )
throw embed::WrongStateException(); //TODO: client site is not set!
// create frame and load document in the frame
- m_pDocHolder->Show();
+ m_xDocHolder->Show();
m_xClientSite->visibilityChanged( true );
m_nObjectState = nNextState;
@@ -324,13 +324,13 @@ void OCommonEmbeddedObject::SwitchStateTo_Impl( sal_Int32 nNextState )
// the container. Locking the LM will prevent flicker.
xContainerLM->lock();
xInplaceClient->activatingUI();
- bool bOk = m_pDocHolder->ShowUI( xContainerLM, xContainerDP, aModuleName );
+ bool bOk = m_xDocHolder->ShowUI( xContainerLM, xContainerDP, aModuleName );
xContainerLM->unlock();
if ( bOk )
{
m_nObjectState = nNextState;
- m_pDocHolder->ResizeHatchWindow();
+ m_xDocHolder->ResizeHatchWindow();
}
else
{
@@ -371,12 +371,12 @@ void OCommonEmbeddedObject::SwitchStateTo_Impl( sal_Int32 nNextState )
bool bOk = false;
if ( xContainerLM.is() )
- bOk = m_pDocHolder->HideUI( xContainerLM );
+ bOk = m_xDocHolder->HideUI( xContainerLM );
if ( bOk )
{
m_nObjectState = nNextState;
- m_pDocHolder->ResizeHatchWindow();
+ m_xDocHolder->ResizeHatchWindow();
xInplaceClient->deactivatedUI();
}
else
@@ -449,7 +449,7 @@ void SAL_CALL OCommonEmbeddedObject::changeState( sal_Int32 nNewState )
{
// if active object is activated again, bring its window to top
if ( m_nObjectState == embed::EmbedStates::ACTIVE )
- m_pDocHolder->Show();
+ m_xDocHolder->Show();
return;
}
@@ -681,7 +681,7 @@ void SAL_CALL OCommonEmbeddedObject::setParent( const css::uno::Reference< css::
m_xParent = xParent;
if ( m_nObjectState != -1 && m_nObjectState != embed::EmbedStates::LOADED )
{
- uno::Reference < container::XChild > xChild( m_pDocHolder->GetComponent(), uno::UNO_QUERY );
+ uno::Reference < container::XChild > xChild( m_xDocHolder->GetComponent(), uno::UNO_QUERY );
if ( xChild.is() )
xChild->setParent( xParent );
}
diff --git a/embeddedobj/source/commonembedding/inplaceobj.cxx b/embeddedobj/source/commonembedding/inplaceobj.cxx
index a4e298a..1b61855 100644
--- a/embeddedobj/source/commonembedding/inplaceobj.cxx
+++ b/embeddedobj/source/commonembedding/inplaceobj.cxx
@@ -55,7 +55,7 @@ void SAL_CALL OCommonEmbeddedObject::setObjectRectangles( const awt::Rectangle&
// the clip rectangle changes view only in case interception is also changed
if ( !RectanglesEqual( m_aOwnRectangle, aPosRect )
|| ( !RectanglesEqual( m_aClipRectangle, aPosRect ) && !RectanglesEqual( aOldRectToShow, aNewRectToShow ) ) )
- m_pDocHolder->PlaceFrame( aNewRectToShow );
+ m_xDocHolder->PlaceFrame( aNewRectToShow );
m_aOwnRectangle = aPosRect;
m_aClipRectangle = aClipRect;
diff --git a/embeddedobj/source/commonembedding/miscobj.cxx b/embeddedobj/source/commonembedding/miscobj.cxx
index fa020e9..eb29ac4 100644
--- a/embeddedobj/source/commonembedding/miscobj.cxx
+++ b/embeddedobj/source/commonembedding/miscobj.cxx
@@ -43,8 +43,7 @@ using namespace ::com::sun::star;
OCommonEmbeddedObject::OCommonEmbeddedObject( const uno::Reference< uno::XComponentContext >& rxContext,
const uno::Sequence< beans::NamedValue >& aObjProps )
-: m_pDocHolder( nullptr )
-, m_pInterfaceContainer( nullptr )
+: m_pInterfaceContainer( nullptr )
, m_bReadOnly( false )
, m_bDisposed( false )
, m_bClosed( false )
@@ -70,8 +69,7 @@ OCommonEmbeddedObject::OCommonEmbeddedObject(
const uno::Sequence< beans::NamedValue >& aObjProps,
const uno::Sequence< beans::PropertyValue >& aMediaDescr,
const uno::Sequence< beans::PropertyValue >& aObjectDescr )
-: m_pDocHolder( nullptr )
-, m_pInterfaceContainer( nullptr )
+: m_pInterfaceContainer( nullptr )
, m_bReadOnly( false )
, m_bDisposed( false )
, m_bClosed( false )
@@ -99,8 +97,7 @@ void OCommonEmbeddedObject::CommonInit_Impl( const uno::Sequence< beans::NamedVa
if ( !m_xContext.is() )
throw uno::RuntimeException();
- m_pDocHolder = new DocumentHolder( m_xContext, this );
- m_pDocHolder->acquire();
+ m_xDocHolder = new DocumentHolder( m_xContext, this );
// parse configuration entries
// TODO/LATER: in future UI names can be also provided here
@@ -256,13 +253,13 @@ void OCommonEmbeddedObject::LinkInit_Impl(
CommonInit_Impl( aObjectProps );
if ( xDispatchInterceptor.is() )
- m_pDocHolder->SetOutplaceDispatchInterceptor( xDispatchInterceptor );
+ m_xDocHolder->SetOutplaceDispatchInterceptor( xDispatchInterceptor );
}
OCommonEmbeddedObject::~OCommonEmbeddedObject()
{
- if ( m_pInterfaceContainer || m_pDocHolder )
+ if ( m_pInterfaceContainer || m_xDocHolder.is() )
{
m_refCount++;
try {
@@ -278,16 +275,15 @@ OCommonEmbeddedObject::~OCommonEmbeddedObject()
} catch( const uno::Exception& ) {}
try {
- if ( m_pDocHolder )
+ if ( m_xDocHolder.is() )
{
- m_pDocHolder->CloseFrame();
+ m_xDocHolder->CloseFrame();
try {
- m_pDocHolder->CloseDocument( true, true );
+ m_xDocHolder->CloseDocument( true, true );
} catch ( const uno::Exception& ) {}
- m_pDocHolder->FreeOffice();
+ m_xDocHolder->FreeOffice();
- m_pDocHolder->release();
- m_pDocHolder = nullptr;
+ m_xDocHolder.clear();
}
} catch( const uno::Exception& ) {}
}
@@ -449,7 +445,7 @@ uno::Reference< util::XCloseable > SAL_CALL OCommonEmbeddedObject::getComponent(
static_cast< ::cppu::OWeakObject* >(this) );
}
- return uno::Reference< util::XCloseable >( m_pDocHolder->GetComponent(), uno::UNO_QUERY );
+ return uno::Reference< util::XCloseable >( m_xDocHolder->GetComponent(), uno::UNO_QUERY );
}
@@ -537,29 +533,27 @@ void SAL_CALL OCommonEmbeddedObject::close( sal_Bool bDeliverOwnership )
// the exception will be thrown otherwise in addition to exception the object must register itself
// as termination listener and listen for document events
- if ( m_pDocHolder )
+ if ( m_xDocHolder.is() )
{
- m_pDocHolder->CloseFrame();
+ m_xDocHolder->CloseFrame();
try {
- m_pDocHolder->CloseDocument( bDeliverOwnership, bDeliverOwnership );
+ m_xDocHolder->CloseDocument( bDeliverOwnership, bDeliverOwnership );
}
catch( const uno::Exception& )
{
if ( bDeliverOwnership )
{
- m_pDocHolder->release();
- m_pDocHolder = nullptr;
+ m_xDocHolder.clear();
m_bClosed = true;
}
throw;
}
- m_pDocHolder->FreeOffice();
+ m_xDocHolder->FreeOffice();
- m_pDocHolder->release();
- m_pDocHolder = nullptr;
+ m_xDocHolder.clear();
}
// TODO: for now the storage will be disposed by the object, but after the document
diff --git a/embeddedobj/source/commonembedding/persistence.cxx b/embeddedobj/source/commonembedding/persistence.cxx
index 036dc02..d7dfd4e 100644
--- a/embeddedobj/source/commonembedding/persistence.cxx
+++ b/embeddedobj/source/commonembedding/persistence.cxx
@@ -259,7 +259,7 @@ void OCommonEmbeddedObject::SwitchOwnPersistence( const uno::Reference< embed::X
// the linked document should not be switched
if ( !m_bIsLink )
{
- uno::Reference< document::XStorageBasedDocument > xDoc( m_pDocHolder->GetComponent(), uno::UNO_QUERY );
+ uno::Reference< document::XStorageBasedDocument > xDoc( m_xDocHolder->GetComponent(), uno::UNO_QUERY );
if ( xDoc.is() )
SwitchDocToStorage_Impl( xDoc, m_xObjectStorage );
}
@@ -580,8 +580,8 @@ uno::Reference< io::XInputStream > OCommonEmbeddedObject::StoreDocumentToTempStr
uno::Reference< frame::XStorable > xStorable;
{
osl::MutexGuard aGuard( m_aMutex );
- if ( m_pDocHolder )
- xStorable.set( m_pDocHolder->GetComponent(), uno::UNO_QUERY );
+ if ( m_xDocHolder.is() )
+ xStorable.set( m_xDocHolder->GetComponent(), uno::UNO_QUERY );
}
if( !xStorable.is() )
@@ -625,7 +625,7 @@ void OCommonEmbeddedObject::SaveObject_Impl()
{
// check whether the component is modified,
// if not there is no need for storing
- uno::Reference< util::XModifiable > xModifiable( m_pDocHolder->GetComponent(), uno::UNO_QUERY );
+ uno::Reference< util::XModifiable > xModifiable( m_xDocHolder->GetComponent(), uno::UNO_QUERY );
if ( xModifiable.is() && !xModifiable->isModified() )
return;
}
@@ -760,8 +760,8 @@ void OCommonEmbeddedObject::StoreDocToStorage_Impl(
uno::Reference< document::XStorageBasedDocument > xDoc;
{
osl::MutexGuard aGuard( m_aMutex );
- if ( m_pDocHolder )
- xDoc.set( m_pDocHolder->GetComponent(), uno::UNO_QUERY );
+ if ( m_xDocHolder.is() )
+ xDoc.set( m_xDocHolder->GetComponent(), uno::UNO_QUERY );
}
OUString aBaseURL = GetBaseURLFrom_Impl(rMediaArgs, rObjArgs);
@@ -876,7 +876,7 @@ uno::Reference< util::XCloseable > OCommonEmbeddedObject::CreateTempDocFromLink_
SAL_WARN( "embeddedobj.common", "Can not retrieve storage media type!" );
}
- if ( m_pDocHolder->GetComponent().is() )
+ if ( m_xDocHolder->GetComponent().is() )
{
aTempMediaDescr.realloc( 4 );
@@ -1020,7 +1020,7 @@ void SAL_CALL OCommonEmbeddedObject::setPersistentEntry(
{
uno::Reference< frame::XDispatchProviderInterceptor > xDispatchInterceptor;
if ( lObjArgs[nObjInd].Value >>= xDispatchInterceptor )
- m_pDocHolder->SetOutplaceDispatchInterceptor( xDispatchInterceptor );
+ m_xDocHolder->SetOutplaceDispatchInterceptor( xDispatchInterceptor );
}
else if ( lObjArgs[nObjInd].Name == "DefaultParentBaseURL" )
{
@@ -1053,7 +1053,7 @@ void SAL_CALL OCommonEmbeddedObject::setPersistentEntry(
uno::Sequence< beans::NamedValue > aOutFramePropsTyped;
if ( lObjArgs[nObjInd].Value >>= aOutFrameProps )
{
- m_pDocHolder->SetOutplaceFrameProperties( aOutFrameProps );
+ m_xDocHolder->SetOutplaceFrameProperties( aOutFrameProps );
}
else if ( lObjArgs[nObjInd].Value >>= aOutFramePropsTyped )
{
@@ -1066,7 +1066,7 @@ void SAL_CALL OCommonEmbeddedObject::setPersistentEntry(
{
*pProp <<= *pTypedProp;
}
- m_pDocHolder->SetOutplaceFrameProperties( aOutFrameProps );
+ m_xDocHolder->SetOutplaceFrameProperties( aOutFrameProps );
}
else
SAL_WARN( "embeddedobj.common", "OCommonEmbeddedObject::setPersistentEntry: illegal type for argument 'OutplaceFrameProperties'!" );
@@ -1102,8 +1102,8 @@ void SAL_CALL OCommonEmbeddedObject::setPersistentEntry(
}
else
{
- m_pDocHolder->SetComponent( InitNewDocument_Impl(), m_bReadOnly );
- if ( !m_pDocHolder->GetComponent().is() )
+ m_xDocHolder->SetComponent( InitNewDocument_Impl(), m_bReadOnly );
+ if ( !m_xDocHolder->GetComponent().is() )
throw io::IOException(); // TODO: can not create document
m_nObjectState = embed::EmbedStates::RUNNING;
@@ -1126,16 +1126,16 @@ void SAL_CALL OCommonEmbeddedObject::setPersistentEntry(
TransferMediaType( m_xRecoveryStorage, m_xObjectStorage );
// TODO:
- m_pDocHolder->SetComponent( InitNewDocument_Impl(), m_bReadOnly );
+ m_xDocHolder->SetComponent( InitNewDocument_Impl(), m_bReadOnly );
- if ( !m_pDocHolder->GetComponent().is() )
+ if ( !m_xDocHolder->GetComponent().is() )
throw io::IOException(); // TODO: can not create document
m_nObjectState = embed::EmbedStates::RUNNING;
}
else if ( nEntryConnectionMode == embed::EntryInitModes::MEDIA_DESCRIPTOR_INIT )
{
- m_pDocHolder->SetComponent( CreateDocFromMediaDescr_Impl( lArguments ), m_bReadOnly );
+ m_xDocHolder->SetComponent( CreateDocFromMediaDescr_Impl( lArguments ), m_bReadOnly );
m_nObjectState = embed::EmbedStates::RUNNING;
}
//else if ( nEntryConnectionMode == embed::EntryInitModes::TRANSFERABLE_INIT )
@@ -1472,7 +1472,7 @@ void SAL_CALL OCommonEmbeddedObject::saveCompleted( sal_Bool bUseNew )
SwitchOwnPersistence( m_xNewParentStorage, m_xNewObjectStorage, m_aNewEntryName );
m_aDocMediaDescriptor = m_aNewDocMediaDescriptor;
- uno::Reference< util::XModifiable > xModif( m_pDocHolder->GetComponent(), uno::UNO_QUERY );
+ uno::Reference< util::XModifiable > xModif( m_xDocHolder->GetComponent(), uno::UNO_QUERY );
if ( xModif.is() )
xModif->setModified( false );
@@ -1588,14 +1588,14 @@ void SAL_CALL OCommonEmbeddedObject::storeOwn()
PostEvent_Impl( "OnSave" );
- SAL_WARN_IF( !m_pDocHolder->GetComponent().is(), "embeddedobj.common", "If an object is activated or in running state it must have a document!" );
- if ( !m_pDocHolder->GetComponent().is() )
+ SAL_WARN_IF( !m_xDocHolder->GetComponent().is(), "embeddedobj.common", "If an object is activated or in running state it must have a document!" );
+ if ( !m_xDocHolder->GetComponent().is() )
throw uno::RuntimeException();
if ( m_bIsLink )
{
// TODO: just store the document to its location
- uno::Reference< frame::XStorable > xStorable( m_pDocHolder->GetComponent(), uno::UNO_QUERY );
+ uno::Reference< frame::XStorable > xStorable( m_xDocHolder->GetComponent(), uno::UNO_QUERY );
if ( !xStorable.is() )
throw uno::RuntimeException(); // TODO
@@ -1641,7 +1641,7 @@ void SAL_CALL OCommonEmbeddedObject::storeOwn()
aGuard.reset();
}
- uno::Reference< util::XModifiable > xModif( m_pDocHolder->GetComponent(), uno::UNO_QUERY );
+ uno::Reference< util::XModifiable > xModif( m_xDocHolder->GetComponent(), uno::UNO_QUERY );
if ( xModif.is() )
xModif->setModified( false );
@@ -1749,8 +1749,7 @@ void SAL_CALL OCommonEmbeddedObject::reload(
uno::Sequence< beans::NamedValue > aObject = aHelper.GetObjectPropsByFilter( m_aLinkFilterName );
// TODO/LATER: probably the document holder could be cleaned explicitly as in the destructor
- m_pDocHolder->release();
- m_pDocHolder = nullptr;
+ m_xDocHolder.clear();
LinkInit_Impl( aObject, lArguments, lObjArgs );
}
@@ -1764,7 +1763,7 @@ void SAL_CALL OCommonEmbeddedObject::reload(
{
uno::Reference< frame::XDispatchProviderInterceptor > xDispatchInterceptor;
if ( lObjArgs[nObjInd].Value >>= xDispatchInterceptor )
- m_pDocHolder->SetOutplaceDispatchInterceptor( xDispatchInterceptor );
+ m_xDocHolder->SetOutplaceDispatchInterceptor( xDispatchInterceptor );
break;
}
@@ -1870,7 +1869,7 @@ void SAL_CALL OCommonEmbeddedObject::breakLink( const uno::Reference< embed::XSt
// TODO/LATER: handle the case when temp doc can not be created
// the document is a new embedded object so it must be marked as modified
uno::Reference< util::XCloseable > xDocument = CreateTempDocFromLink_Impl();
- uno::Reference< util::XModifiable > xModif( m_pDocHolder->GetComponent(), uno::UNO_QUERY );
+ uno::Reference< util::XModifiable > xModif( m_xDocHolder->GetComponent(), uno::UNO_QUERY );
if ( !xModif.is() )
throw uno::RuntimeException();
try
@@ -1880,8 +1879,8 @@ void SAL_CALL OCommonEmbeddedObject::breakLink( const uno::Reference< embed::XSt
catch( const uno::Exception& )
{}
- m_pDocHolder->SetComponent( xDocument, m_bReadOnly );
- SAL_WARN_IF( !m_pDocHolder->GetComponent().is(), "embeddedobj.common", "If document can't be created, an exception must be thrown!" );
+ m_xDocHolder->SetComponent( xDocument, m_bReadOnly );
+ SAL_WARN_IF( !m_xDocHolder->GetComponent().is(), "embeddedobj.common", "If document can't be created, an exception must be thrown!" );
if ( m_nObjectState == embed::EmbedStates::LOADED )
{
@@ -1890,7 +1889,7 @@ void SAL_CALL OCommonEmbeddedObject::breakLink( const uno::Reference< embed::XSt
StateChangeNotification_Impl( false, embed::EmbedStates::LOADED, m_nObjectState, aGuard );
}
else if ( m_nObjectState == embed::EmbedStates::ACTIVE )
- m_pDocHolder->Show();
+ m_xDocHolder->Show();
m_bIsLink = false;
m_aLinkFilterName.clear();
diff --git a/embeddedobj/source/commonembedding/specialobject.cxx b/embeddedobj/source/commonembedding/specialobject.cxx
index e1c73f8..5de49e7 100644
--- a/embeddedobj/source/commonembedding/specialobject.cxx
+++ b/embeddedobj/source/commonembedding/specialobject.cxx
@@ -187,7 +187,7 @@ void SAL_CALL OSpecialEmbeddedObject::doVerb( sal_Int32 nVerbID )
if ( nVerbID == -7 )
{
- uno::Reference < ui::dialogs::XExecutableDialog > xDlg( m_pDocHolder->GetComponent(), uno::UNO_QUERY );
+ uno::Reference < ui::dialogs::XExecutableDialog > xDlg( m_xDocHolder->GetComponent(), uno::UNO_QUERY );
if ( xDlg.is() )
xDlg->execute();
else
diff --git a/embeddedobj/source/commonembedding/visobj.cxx b/embeddedobj/source/commonembedding/visobj.cxx
index 87a7f39..98ebda3 100644
--- a/embeddedobj/source/commonembedding/visobj.cxx
+++ b/embeddedobj/source/commonembedding/visobj.cxx
@@ -60,7 +60,7 @@ void SAL_CALL OCommonEmbeddedObject::setVisualAreaSize( sal_Int64 nAspect, const
bBackToLoaded = m_bIsLink;
}
- bool bSuccess = m_pDocHolder->SetExtent( nAspect, aSize );
+ bool bSuccess = m_xDocHolder->SetExtent( nAspect, aSize );
if ( bBackToLoaded )
changeState( embed::EmbedStates::LOADED );
@@ -98,7 +98,7 @@ awt::Size SAL_CALL OCommonEmbeddedObject::getVisualAreaSize( sal_Int64 nAspect )
}
awt::Size aResult;
- bool bSuccess = m_pDocHolder->GetExtent( nAspect, &aResult );
+ bool bSuccess = m_xDocHolder->GetExtent( nAspect, &aResult );
if ( bBackToLoaded )
changeState( embed::EmbedStates::LOADED );
@@ -139,7 +139,7 @@ sal_Int32 SAL_CALL OCommonEmbeddedObject::getMapUnit( sal_Int64 nAspect )
bBackToLoaded = m_bIsLink;
}
- sal_Int32 nResult = m_pDocHolder->GetMapUnit( nAspect );
+ sal_Int32 nResult = m_xDocHolder->GetMapUnit( nAspect );
if ( bBackToLoaded )
changeState( embed::EmbedStates::LOADED );
@@ -185,19 +185,19 @@ embed::VisualRepresentation SAL_CALL OCommonEmbeddedObject::getPreferredVisualRe
bBackToLoaded = m_bIsLink;
}
- SAL_WARN_IF( !m_pDocHolder->GetComponent().is(), "embeddedobj.common", "Running or Active object has no component!" );
+ SAL_WARN_IF( !m_xDocHolder->GetComponent().is(), "embeddedobj.common", "Running or Active object has no component!" );
// TODO: return for the aspect of the document
embed::VisualRepresentation aVisualRepresentation;
- uno::Reference< embed::XVisualObject > xVisualObject( m_pDocHolder->GetComponent(), uno::UNO_QUERY );
+ uno::Reference< embed::XVisualObject > xVisualObject( m_xDocHolder->GetComponent(), uno::UNO_QUERY );
if( xVisualObject.is())
{
aVisualRepresentation = xVisualObject->getPreferredVisualRepresentation( nAspect );
}
else
{
- uno::Reference< datatransfer::XTransferable > xTransferable( m_pDocHolder->GetComponent(), uno::UNO_QUERY );
+ uno::Reference< datatransfer::XTransferable > xTransferable( m_xDocHolder->GetComponent(), uno::UNO_QUERY );
if (!xTransferable.is() )
throw uno::RuntimeException();
diff --git a/embeddedobj/source/inc/commonembobj.hxx b/embeddedobj/source/inc/commonembobj.hxx
index 174e110..3440a61 100644
--- a/embeddedobj/source/inc/commonembobj.hxx
+++ b/embeddedobj/source/inc/commonembobj.hxx
@@ -39,6 +39,7 @@
#include <com/sun/star/util/XCloseable.hpp>
#include <com/sun/star/chart2/XDefaultSizeTransmitter.hpp>
#include <cppuhelper/weak.hxx>
+#include <rtl/ref.hxx>
namespace com { namespace sun { namespace star {
namespace embed {
@@ -82,7 +83,7 @@ class OCommonEmbeddedObject : public css::embed::XEmbeddedObject
protected:
::osl::Mutex m_aMutex;
- DocumentHolder* m_pDocHolder;
+ rtl::Reference<DocumentHolder> m_xDocHolder;
::cppu::OMultiTypeInterfaceContainerHelper* m_pInterfaceContainer;
commit db0f4ecd009f34e431b895c874c34d75186b3272
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date: Fri Jan 20 13:25:02 2017 +0200
use rtl::Reference in SbaXGridControl
instead of manual acquire/release
Change-Id: Ie103377d89419648d5f1d786933030b6f6166515
diff --git a/dbaccess/source/ui/browser/sbagrid.cxx b/dbaccess/source/ui/browser/sbagrid.cxx
index 606fc7d..ed16039 100644
--- a/dbaccess/source/ui/browser/sbagrid.cxx
+++ b/dbaccess/source/ui/browser/sbagrid.cxx
@@ -207,8 +207,8 @@ void SAL_CALL SbaXGridControl::createPeer(const Reference< css::awt::XToolkit >
aIter != m_aStatusMultiplexer.end();
++aIter)
{
- if ((*aIter).second && (*aIter).second->getLength())
- xDisp->addStatusListener((*aIter).second, (*aIter).first);
+ if ((*aIter).second.is() && (*aIter).second->getLength())
+ xDisp->addStatusListener((*aIter).second.get(), (*aIter).first);
}
}
@@ -224,24 +224,23 @@ void SAL_CALL SbaXGridControl::addStatusListener( const Reference< XStatusListen
::osl::MutexGuard aGuard( GetMutex() );
if ( _rxListener.is() )
{
- SbaXStatusMultiplexer*& pMultiplexer = m_aStatusMultiplexer[ _rURL ];
- if ( !pMultiplexer )
+ rtl::Reference<SbaXStatusMultiplexer>& xMultiplexer = m_aStatusMultiplexer[ _rURL ];
+ if ( !xMultiplexer.is() )
{
- pMultiplexer = new SbaXStatusMultiplexer( *this, GetMutex() );
- pMultiplexer->acquire();
+ xMultiplexer = new SbaXStatusMultiplexer( *this, GetMutex() );
}
- pMultiplexer->addInterface( _rxListener );
+ xMultiplexer->addInterface( _rxListener );
if ( getPeer().is() )
{
- if ( 1 == pMultiplexer->getLength() )
+ if ( 1 == xMultiplexer->getLength() )
{ // the first external listener for this URL
Reference< XDispatch > xDisp( getPeer(), UNO_QUERY );
- xDisp->addStatusListener( pMultiplexer, _rURL );
+ xDisp->addStatusListener( xMultiplexer.get(), _rURL );
}
else
{ // already have other listeners for this URL
- _rxListener->statusChanged( pMultiplexer->getLastEvent() );
+ _rxListener->statusChanged( xMultiplexer->getLastEvent() );
}
}
}
@@ -251,19 +250,18 @@ void SAL_CALL SbaXGridControl::removeStatusListener(const Reference< css::frame:
{
::osl::MutexGuard aGuard( GetMutex() );
- SbaXStatusMultiplexer*& pMultiplexer = m_aStatusMultiplexer[_rURL];
- if (!pMultiplexer)
+ rtl::Reference<SbaXStatusMultiplexer>& xMultiplexer = m_aStatusMultiplexer[_rURL];
+ if (!xMultiplexer.is())
{
- pMultiplexer = new SbaXStatusMultiplexer(*this,GetMutex());
- pMultiplexer->acquire();
+ xMultiplexer = new SbaXStatusMultiplexer(*this,GetMutex());
}
- if (getPeer().is() && pMultiplexer->getLength() == 1)
+ if (getPeer().is() && xMultiplexer->getLength() == 1)
{
Reference< css::frame::XDispatch > xDisp(getPeer(), UNO_QUERY);
- xDisp->removeStatusListener(pMultiplexer, _rURL);
+ xDisp->removeStatusListener(xMultiplexer.get(), _rURL);
}
- pMultiplexer->removeInterface( _rxListener );
+ xMultiplexer->removeInterface( _rxListener );
}
void SAL_CALL SbaXGridControl::dispose() throw( RuntimeException, std::exception )
@@ -277,11 +275,10 @@ void SAL_CALL SbaXGridControl::dispose() throw( RuntimeException, std::exception
aIter != m_aStatusMultiplexer.end();
++aIter)
{
- if ((*aIter).second)
+ if ((*aIter).second.is())
{
(*aIter).second->disposeAndClear(aEvt);
- (*aIter).second->release();
- (*aIter).second = nullptr;
+ (*aIter).second.clear();
}
}
StatusMultiplexerArray().swap(m_aStatusMultiplexer);
diff --git a/dbaccess/source/ui/inc/sbagrid.hxx b/dbaccess/source/ui/inc/sbagrid.hxx
index 550c3f3..e9f5c22 100644
--- a/dbaccess/source/ui/inc/sbagrid.hxx
+++ b/dbaccess/source/ui/inc/sbagrid.hxx
@@ -30,6 +30,7 @@
#include <comphelper/uno3.hxx>
#include "sbamultiplex.hxx"
#include <svx/dataaccessdescriptor.hxx>
+#include <rtl/ref.hxx>
#include <map>
#include <queue>
@@ -53,7 +54,7 @@ namespace dbaui
:public FmXGridControl
,public css::frame::XDispatch
{
- typedef std::map<css::util::URL, SbaXStatusMultiplexer*, SbaURLCompare> StatusMultiplexerArray;
+ typedef std::map<css::util::URL, rtl::Reference<SbaXStatusMultiplexer>, SbaURLCompare> StatusMultiplexerArray;
StatusMultiplexerArray m_aStatusMultiplexer;
public:
commit b395d9fd82cbc551d561c7a7ffe1751f5a35e339
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date: Fri Jan 20 13:18:44 2017 +0200
use rtl::Reference in OResultSet
instead of manual acquire/release
Change-Id: I8baa2e7ac64445ea69d4b62566a89b6e42307e51
diff --git a/connectivity/source/drivers/mork/MResultSet.cxx b/connectivity/source/drivers/mork/MResultSet.cxx
index 50e5b47..7ce0643 100644
--- a/connectivity/source/drivers/mork/MResultSet.cxx
+++ b/connectivity/source/drivers/mork/MResultSet.cxx
@@ -78,7 +78,6 @@ OResultSet::OResultSet(OCommonStatement* pStmt, const std::shared_ptr< connectiv
,m_pSQLIterator( _pSQLIterator )
,m_pParseTree( _pSQLIterator->getParseTree() )
,m_aQueryHelper(pStmt->getOwnConnection()->getColumnAlias())
- ,m_pTable(nullptr)
,m_CurrentRowCount(0)
,m_nParamIndex(0)
,m_bIsAlwaysFalseQuery(false)
@@ -106,11 +105,7 @@ void OResultSet::disposing()
m_xColumns = nullptr;
m_xParamColumns = nullptr;
m_pKeySet = nullptr;
- if(m_pTable)
- {
- m_pTable->release();
- m_pTable = nullptr;
- }
+ m_xTable.clear();
}
Any SAL_CALL OResultSet::queryInterface( const Type & rType ) throw(RuntimeException, std::exception)
@@ -133,7 +128,7 @@ Any SAL_CALL OResultSet::queryInterface( const Type & rType ) throw(RuntimeExcep
void OResultSet::methodEntry()
{
checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
- if ( !m_pTable )
+ if ( !m_xTable.is() )
{
OSL_FAIL( "OResultSet::methodEntry: looks like we're disposed, but how is this possible?" );
throw DisposedException( OUString(), *this );
@@ -244,7 +239,7 @@ Reference< XResultSetMetaData > SAL_CALL OResultSet::getMetaData( ) throw(SQLEx
if(!m_xMetaData.is())
m_xMetaData = new OResultSetMetaData(
- m_pSQLIterator->getSelectColumns(), m_pSQLIterator->getTables().begin()->first ,m_pTable,determineReadOnly());
+ m_pSQLIterator->getSelectColumns(), m_pSQLIterator->getTables().begin()->first, m_xTable.get(), determineReadOnly());
return m_xMetaData;
}
@@ -1001,7 +996,7 @@ void OResultSet::fillRowData()
return;
}
- OUString aStr( m_pTable->getName() );
+ OUString aStr( m_xTable->getName() );
m_aQueryHelper.setAddressbook( aStr );
sal_Int32 rv = m_aQueryHelper.executeQuery(pConnection, queryExpression);
@@ -1068,15 +1063,14 @@ void SAL_CALL OResultSet::executeQuery() throw(css::sdbc::SQLException,
{
ResultSetEntryGuard aGuard( *this );
- OSL_ENSURE( m_pTable, "Need a Table object");
- if(!m_pTable)
+ OSL_ENSURE( m_xTable.is(), "Need a Table object");
+ if(!m_xTable.is())
{
const OSQLTables& rTabs = m_pSQLIterator->getTables();
if (rTabs.empty() || !rTabs.begin()->second.is())
m_pStatement->getOwnConnection()->throwSQLException( STR_QUERY_TOO_COMPLEX, *this );
- m_pTable = static_cast< OTable* > ((rTabs.begin()->second).get());
-
+ m_xTable = static_cast< OTable* > ((rTabs.begin()->second).get());
}
m_nRowPos = 0;
@@ -1752,9 +1746,8 @@ bool OResultSet::determineReadOnly()
void OResultSet::setTable(OTable* _rTable)
{
- m_pTable = _rTable;
- m_pTable->acquire();
- m_xTableColumns = m_pTable->getColumns();
+ m_xTable = _rTable;
+ m_xTableColumns = m_xTable->getColumns();
if(m_xTableColumns.is())
m_aColumnNames = m_xTableColumns->getElementNames();
}
diff --git a/connectivity/source/drivers/mork/MResultSet.hxx b/connectivity/source/drivers/mork/MResultSet.hxx
index a05b1b6..081352a 100644
--- a/connectivity/source/drivers/mork/MResultSet.hxx
+++ b/connectivity/source/drivers/mork/MResultSet.hxx
@@ -34,6 +34,7 @@
#include <cppuhelper/compbase.hxx>
#include <comphelper/proparrhlp.hxx>
#include <tools/gen.hxx>
+#include <rtl/ref.hxx>
#include "MStatement.hxx"
#include "MQueryHelper.hxx"
#include <connectivity/CommonTools.hxx>
@@ -215,7 +216,7 @@ namespace connectivity
protected:
//MQuery m_aQuery;
MQueryHelper m_aQueryHelper;
- OTable* m_pTable;
+ rtl::Reference<OTable> m_xTable;
sal_Int32 m_CurrentRowCount;
css::uno::Reference< css::container::XNameAccess >
m_xTableColumns;
commit 017911facd7bf66bd8743e1d3357c2808dcd1bba
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date: Fri Jan 20 13:11:21 2017 +0200
use rtl::Reference in OPropertyChangeListener
instead of manual acquire/release
Change-Id: Ie80253b5a59a3e3fcd52f98d9c26bcde42fe985a
diff --git a/comphelper/source/property/propmultiplex.cxx b/comphelper/source/property/propmultiplex.cxx
index 4a50e8c..e10d85a 100644
--- a/comphelper/source/property/propmultiplex.cxx
+++ b/comphelper/source/property/propmultiplex.cxx
@@ -31,8 +31,8 @@ using namespace ::com::sun::star::beans;
OPropertyChangeListener::~OPropertyChangeListener()
{
- if (m_pAdapter)
- m_pAdapter->dispose();
+ if (m_xAdapter.is())
+ m_xAdapter->dispose();
}
@@ -45,29 +45,18 @@ void OPropertyChangeListener::_disposing(const EventObject&)
void OPropertyChangeListener::disposeAdapter()
{
- if ( m_pAdapter )
- m_pAdapter->dispose();
+ if ( m_xAdapter.is() )
+ m_xAdapter->dispose();
// will automatically set a new adapter
- OSL_ENSURE( !m_pAdapter, "OPropertyChangeListener::disposeAdapter: what did dispose do?" );
+ OSL_ENSURE( !m_xAdapter.is(), "OPropertyChangeListener::disposeAdapter: what did dispose do?" );
}
void OPropertyChangeListener::setAdapter(OPropertyChangeMultiplexer* pAdapter)
{
- if (m_pAdapter)
- {
- ::osl::MutexGuard aGuard(m_rMutex);
- m_pAdapter->release();
- m_pAdapter = nullptr;
- }
-
- if (pAdapter)
- {
- ::osl::MutexGuard aGuard(m_rMutex);
- m_pAdapter = pAdapter;
- m_pAdapter->acquire();
- }
+ ::osl::MutexGuard aGuard(m_rMutex);
+ m_xAdapter = pAdapter;
}
OPropertyChangeMultiplexer::OPropertyChangeMultiplexer(OPropertyChangeListener* _pListener, const Reference< XPropertySet>& _rxSet, bool _bAutoReleaseSet)
diff --git a/include/comphelper/propmultiplex.hxx b/include/comphelper/propmultiplex.hxx
index 628a809..94edcda 100644
--- a/include/comphelper/propmultiplex.hxx
+++ b/include/comphelper/propmultiplex.hxx
@@ -23,6 +23,7 @@
#include <comphelper/propstate.hxx>
#include <cppuhelper/implbase.hxx>
#include <comphelper/comphelperdllapi.h>
+#include <rtl/ref.hxx>
//= property helper classes
@@ -42,12 +43,12 @@ namespace comphelper
{
friend class OPropertyChangeMultiplexer;
- OPropertyChangeMultiplexer* m_pAdapter;
+ rtl::Reference<OPropertyChangeMultiplexer> m_xAdapter;
::osl::Mutex& m_rMutex;
public:
OPropertyChangeListener(::osl::Mutex& _rMutex)
- : m_pAdapter(nullptr), m_rMutex(_rMutex) { }
+ : m_rMutex(_rMutex) { }
virtual ~OPropertyChangeListener();
/// @throws css::uno::RuntimeException
commit 45e591e237ef294ffd1a0f4a51122a748fd1460a
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date: Fri Jan 20 13:08:37 2017 +0200
use rtl:Reference in SmartContent
instead of storing both a raw pointer and an uno::Reference
Change-Id: Ia7a177ed9adcd9d413c86490b57036b0bd80f76d
... etc. - the rest is truncated
More information about the Libreoffice-commits
mailing list