summaryrefslogtreecommitdiff
path: root/embeddedobj
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2017-01-20 13:35:32 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2017-01-23 07:56:34 +0200
commit4f5b22b93a53c52a46ebdd5ce479086f8df20e22 (patch)
treef3c4c53f258c64485f342e0fb236744eb55da0f2 /embeddedobj
parentdb0f4ecd009f34e431b895c874c34d75186b3272 (diff)
use rtl::Reference in OCommonEmbeddedObject
instead of manual acquire/release Change-Id: Ie641f72687a05e1cd3cf697d551f9c6d21ac4487
Diffstat (limited to 'embeddedobj')
-rw-r--r--embeddedobj/source/commonembedding/embedobj.cxx34
-rw-r--r--embeddedobj/source/commonembedding/inplaceobj.cxx2
-rw-r--r--embeddedobj/source/commonembedding/miscobj.cxx40
-rw-r--r--embeddedobj/source/commonembedding/persistence.cxx53
-rw-r--r--embeddedobj/source/commonembedding/specialobject.cxx2
-rw-r--r--embeddedobj/source/commonembedding/visobj.cxx12
-rw-r--r--embeddedobj/source/inc/commonembobj.hxx3
7 files changed, 70 insertions, 76 deletions
diff --git a/embeddedobj/source/commonembedding/embedobj.cxx b/embeddedobj/source/commonembedding/embedobj.cxx
index 5142871421ff..881a75b09dd0 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 a4e298a4d35f..1b618553806c 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 fa020e92f7b2..eb29ac43eff4 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 036dc026735d..d7dfd4ebe925 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 e1c73f896f8e..5de49e704d53 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 87a7f3933af3..98ebda348dd3 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 174e110b3d10..3440a6187b77 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;