diff options
author | Muthu Subramanian <muthu.subramanian.karunanidhi@ericsson.com> | 2014-10-10 22:58:00 +0530 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2014-11-18 09:40:01 +0000 |
commit | 4ab54cf64ff194fa2f53f2f0d2512a4fc267674c (patch) | |
tree | ddc207635152da32faba17b561acf04881a0b82a | |
parent | 741be800ff7c6e6979c8b816ac2ceb955e7c303d (diff) |
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 <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r-- | svtools/source/misc/embedtransfer.cxx | 5 | ||||
-rw-r--r-- | sw/source/core/uibase/dochdl/swdtflvr.cxx | 18 |
2 files changed, 23 insertions, 0 deletions
diff --git a/svtools/source/misc/embedtransfer.cxx b/svtools/source/misc/embedtransfer.cxx index 7792f84032b0..7c99085e3070 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 3cdd21abb165..3db9338f5085 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? |