sc/source/ui/app/drwtrans.cxx | 31 +++++++++++++++++++------------ sc/source/ui/inc/drwtrans.hxx | 2 ++ 2 files changed, 21 insertions(+), 12 deletions(-)
New commits: commit 272e92b99ced5e70403a2133e627a5f91807a6fb Author: Kohei Yoshida <[email protected]> Date: Fri Jun 13 15:43:45 2014 -0400 Extract common method. Change-Id: I0b1368110a228a835108ab7958b97be086bec7a6 diff --git a/sc/source/ui/app/drwtrans.cxx b/sc/source/ui/app/drwtrans.cxx index 1396857..bd80dac 100644 --- a/sc/source/ui/app/drwtrans.cxx +++ b/sc/source/ui/app/drwtrans.cxx @@ -335,12 +335,8 @@ void ScDrawTransferObj::AddSupportedFormats() AddFormat( SOT_FORMATSTR_ID_OBJECTDESCRIPTOR ); AddFormat( SOT_FORMAT_GDIMETAFILE ); - if ( !aOleData.GetTransferable().is() ) - { - SdrOle2Obj* pObj = GetSingleObject(); - if ( pObj && pObj->GetObjRef().is() ) - aOleData = TransferableDataHelper( new SvEmbedTransferHelper( pObj->GetObjRef(), pObj->GetGraphic(), pObj->GetAspect() ) ) ; - } + CreateOLEData(); + if ( aOleData.GetTransferable().is() ) { // get format list from object snapshot @@ -379,12 +375,7 @@ bool ScDrawTransferObj::GetData( const css::datatransfer::DataFlavor& rFlavor, c if ( bOleObj && nFormat != SOT_FORMAT_GDIMETAFILE ) { - if ( !aOleData.GetTransferable().is() ) - { - SdrOle2Obj* pObj = GetSingleObject(); - if ( pObj && pObj->GetObjRef().is() ) - aOleData = TransferableDataHelper( new SvEmbedTransferHelper( pObj->GetObjRef(), pObj->GetGraphic(), pObj->GetAspect() ) ) ; - } + CreateOLEData(); if( aOleData.GetTransferable().is() && aOleData.HasFormat( rFlavor ) ) { @@ -715,6 +706,22 @@ SdrOle2Obj* ScDrawTransferObj::GetSingleObject() return NULL; } +void ScDrawTransferObj::CreateOLEData() +{ + if (aOleData.GetTransferable().is()) + // Already created. + return; + + SdrOle2Obj* pObj = GetSingleObject(); + if (!pObj || !pObj->GetObjRef().is()) + // No OLE object present. + return; + + aOleData = TransferableDataHelper( + new SvEmbedTransferHelper( + pObj->GetObjRef(), pObj->GetGraphic(), pObj->GetAspect())); +} + // initialize aDocShellRef with a live document from the ClipDoc diff --git a/sc/source/ui/inc/drwtrans.hxx b/sc/source/ui/inc/drwtrans.hxx index 8893b19..55a7301 100644 --- a/sc/source/ui/inc/drwtrans.hxx +++ b/sc/source/ui/inc/drwtrans.hxx @@ -67,6 +67,8 @@ private: void InitDocShell(); SdrOle2Obj* GetSingleObject(); + void CreateOLEData(); + public: ScDrawTransferObj( SdrModel* pClipModel, ScDocShell* pContainerShell, const TransferableObjectDescriptor& rDesc ); _______________________________________________ Libreoffice-commits mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
