[Libreoffice-commits] core.git: svtools/source sw/source
Muthu Subramanian
muthu.subramanian.karunanidhi at ericsson.com
Tue Jul 22 09:36:26 PDT 2014
svtools/source/misc/embedtransfer.cxx | 5 +++++
sw/source/uibase/dochdl/swdtflvr.cxx | 18 ++++++++++++++++++
2 files changed, 23 insertions(+)
New commits:
commit 6296c64fb0ed8bce61eb6303920f952eda65de71
Author: Muthu Subramanian <muthu.subramanian.karunanidhi at ericsson.com>
Date: Tue Jul 22 22:08:16 2014 +0530
Enable copy-paste of charts/ole as bitmaps.
Adds FORMAT_BITMAP to OLE Objects - to allow charts
to be pasted into non-LibreOffice applications.
Should be safe for all OLE Objects, though.
Change-Id: If18768b82d4bb4415b3a8e00828b2eb5c31eeb15
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/uibase/dochdl/swdtflvr.cxx b/sw/source/uibase/dochdl/swdtflvr.cxx
index 9d33a70..57fb9c7 100644
--- a/sw/source/uibase/dochdl/swdtflvr.cxx
+++ b/sw/source/uibase/dochdl/swdtflvr.cxx
@@ -499,6 +499,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();
@@ -832,6 +833,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?
More information about the Libreoffice-commits
mailing list