summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorBjoern Michaelsen <bjoern.michaelsen@canonical.com>2015-03-26 15:55:37 +0100
committerBjoern Michaelsen <bjoern.michaelsen@canonical.com>2015-03-26 16:07:01 +0100
commit63fccb1101cacd7887a5f7a094fd376d164e3d73 (patch)
tree5b121d6d7887764d60dc90a4f17e3a36c890aab5 /sw
parent2bfc2c4a2cbc86ec193fdb30ab0f4f4fab01790d (diff)
remove copypasta
Change-Id: Ieed83781b89ff18f870ad8c64ca00d306b097aea
Diffstat (limited to 'sw')
-rw-r--r--sw/source/core/unocore/unoframe.cxx37
1 files changed, 2 insertions, 35 deletions
diff --git a/sw/source/core/unocore/unoframe.cxx b/sw/source/core/unocore/unoframe.cxx
index 6a3ffd19d4bf..6a5b6d8b67c4 100644
--- a/sw/source/core/unocore/unoframe.cxx
+++ b/sw/source/core/unocore/unoframe.cxx
@@ -3592,41 +3592,8 @@ void SwXTextEmbeddedObject::removeEventListener(const uno::Reference< lang::XEve
uno::Reference< lang::XComponent > SwXTextEmbeddedObject::getEmbeddedObject(void) throw( uno::RuntimeException, std::exception )
{
- uno::Reference< lang::XComponent > xRet;
- SwFrmFmt* pFmt = GetFrmFmt();
- if(pFmt)
- {
- SwDoc* pDoc = pFmt->GetDoc();
- const SwFmtCntnt* pCnt = &pFmt->GetCntnt();
- OSL_ENSURE( pCnt->GetCntntIdx() &&
- pDoc->GetNodes()[ pCnt->GetCntntIdx()->
- GetIndex() + 1 ]->GetOLENode(), "kein OLE-Node?");
-
- SwOLENode* pOleNode = pDoc->GetNodes()[ pCnt->GetCntntIdx()
- ->GetIndex() + 1 ]->GetOLENode();
- uno::Reference < embed::XEmbeddedObject > xIP = pOleNode->GetOLEObj().GetOleRef();
- if ( svt::EmbeddedObjectRef::TryRunningState( xIP ) )
- {
- // TODO/LATER: the listener registered after client creation should be able to handle scaling, after that the client is not necessary here
- if ( pDoc->GetDocShell() )
- pDoc->GetDocShell()->GetIPClient( svt::EmbeddedObjectRef( xIP, embed::Aspects::MSOLE_CONTENT ) );
-
- xRet = uno::Reference < lang::XComponent >( xIP->getComponent(), uno::UNO_QUERY );
- uno::Reference< util::XModifyBroadcaster > xBrdcst( xRet, uno::UNO_QUERY);
- uno::Reference< frame::XModel > xModel( xRet, uno::UNO_QUERY);
- if( xBrdcst.is() && xModel.is() )
- {
- SwXOLEListener* pListener = SwIterator<SwXOLEListener,SwFmt>( *pFmt ).First();
- //create a new one if the OLE object doesn't have one already
- if( !pListener )
- {
- uno::Reference< util::XModifyListener > xOLEListener = new SwXOLEListener(*pFmt, xModel);
- xBrdcst->addModifyListener( xOLEListener );
- }
- }
- }
- }
- return xRet;
+ uno::Reference<embed::XEmbeddedObject> xObj(getExtendedControlOverEmbeddedObject());
+ return xObj.is() ? uno::Reference<lang::XComponent>(xObj->getComponent(), uno::UNO_QUERY) : nullptr;
}
uno::Reference< embed::XEmbeddedObject > SAL_CALL SwXTextEmbeddedObject::getExtendedControlOverEmbeddedObject()