svtools/source/misc/embedtransfer.cxx | 5 +++++ sw/source/core/uibase/dochdl/swdtflvr.cxx | 18 ++++++++++++++++++ 2 files changed, 23 insertions(+)
New commits: commit 4ab54cf64ff194fa2f53f2f0d2512a4fc267674c Author: Muthu Subramanian <muthu.subramanian.karunani...@ericsson.com> Date: Fri Oct 10 22:58:00 2014 +0530 Enable copy-paste of charts/ole as bitmaps. Cherry-picked from 6296c64fb0ed8bce61eb6303920f952eda65de71 Change-Id: I0e074da34ff1a11c223994dcf373bf60af7cd271 Reviewed-on: https://gerrit.libreoffice.org/11911 Reviewed-by: Caolán McNamara <caol...@redhat.com> Tested-by: Caolán McNamara <caol...@redhat.com> diff --git a/svtools/source/misc/embedtransfer.cxx b/svtools/source/misc/embedtransfer.cxx index 7792f84..7c99085 100644 --- a/svtools/source/misc/embedtransfer.cxx +++ b/svtools/source/misc/embedtransfer.cxx @@ -76,6 +76,7 @@ void SvEmbedTransferHelper::AddSupportedFormats() AddFormat( SOT_FORMATSTR_ID_EMBED_SOURCE ); AddFormat( SOT_FORMATSTR_ID_OBJECTDESCRIPTOR ); AddFormat( FORMAT_GDIMETAFILE ); + AddFormat( FORMAT_BITMAP ); } @@ -169,6 +170,10 @@ bool SvEmbedTransferHelper::GetData( const css::datatransfer::DataFlavor& rFlavo SetAny( aAny, rFlavor ); bRet = true; } + else if ( ( nFormat == FORMAT_BITMAP || nFormat == SOT_FORMATSTR_ID_PNG ) && m_pGraphic ) + { + bRet = SetBitmapEx( m_pGraphic->GetBitmapEx(), rFlavor ); + } else if ( m_xObj.is() && :: svt::EmbeddedObjectRef::TryRunningState( m_xObj ) ) { uno::Reference< datatransfer::XTransferable > xTransferable( m_xObj->getComponent(), uno::UNO_QUERY ); diff --git a/sw/source/core/uibase/dochdl/swdtflvr.cxx b/sw/source/core/uibase/dochdl/swdtflvr.cxx index 3cdd21a..3db9338 100644 --- a/sw/source/core/uibase/dochdl/swdtflvr.cxx +++ b/sw/source/core/uibase/dochdl/swdtflvr.cxx @@ -495,6 +495,7 @@ bool SwTransferable::GetData( const DataFlavor& rFlavor, const OUString& rDestDo // the following solution will be used in the case when the object can not generate the image // TODO/LATER: in future the transferhelper must probably be created based on object and the replacement stream + // TODO: Block not required now, SvEmbedTransferHelper should be able to handle GDIMetaFile format if ( nFormat == SOT_FORMAT_GDIMETAFILE ) { pOLEGraph = FindOLEReplacementGraphic(); @@ -828,6 +829,23 @@ int SwTransferable::PrepareForCopy( bool bIsCut ) AddFormat( SOT_FORMATSTR_ID_OBJECTDESCRIPTOR ); AddFormat( FORMAT_GDIMETAFILE ); + + // Fetch the formats supported via embedtransferhelper as well + sal_Int64 nAspect = embed::Aspects::MSOLE_CONTENT; + uno::Reference < embed::XEmbeddedObject > xObj = FindOLEObj( nAspect ); + const Graphic* pOLEGraph = FindOLEReplacementGraphic(); + if( xObj.is() ) + { + TransferableDataHelper aD( new SvEmbedTransferHelper( xObj, pOLEGraph, nAspect ) ); + if ( aD.GetTransferable().is() ) + { + DataFlavorExVector aVector( aD.GetDataFlavorExVector() ); + DataFlavorExVector::iterator aIter( aVector.begin() ), aEnd( aVector.end() ); + + while( aIter != aEnd ) + AddFormat( *aIter++ ); + } + } eBufferType = TRNSFR_OLE; } // Is there anything to provide anyway?
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits