diff options
author | Niklas Nebel <nn@openoffice.org> | 2001-04-10 06:54:24 +0000 |
---|---|---|
committer | Niklas Nebel <nn@openoffice.org> | 2001-04-10 06:54:24 +0000 |
commit | bd19faa518c142bbb22dcd236aa45d3819f6aee3 (patch) | |
tree | bb4af16c47acce1f86688c18f9103c60b31c4fb1 /sc | |
parent | 255aeb7b2a1c5586409a6fd033ca9b58ddf6b7f6 (diff) |
#85929# use aOleData, keep persist ref for ole objects
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/ui/app/drwtrans.cxx | 65 |
1 files changed, 61 insertions, 4 deletions
diff --git a/sc/source/ui/app/drwtrans.cxx b/sc/source/ui/app/drwtrans.cxx index e8c1360f9dea..b4f0e2e137eb 100644 --- a/sc/source/ui/app/drwtrans.cxx +++ b/sc/source/ui/app/drwtrans.cxx @@ -2,9 +2,9 @@ * * $RCSfile: drwtrans.cxx,v $ * - * $Revision: 1.8 $ + * $Revision: 1.9 $ * - * last change: $Author: nn $ $Date: 2001-04-06 19:14:48 $ + * last change: $Author: nn $ $Date: 2001-04-10 07:54:24 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -136,6 +136,7 @@ ScDrawTransferObj::ScDrawTransferObj( SdrModel* pClipModel, ScDocShell* pContain if (nSdrObjKind == OBJ_OLE2) { bOleObj = TRUE; + // aOleData is initialized later } // @@ -239,7 +240,12 @@ ScDrawTransferObj::~ScDrawTransferObj() pScMod->ResetDragObject(); } + aOleData = TransferableDataHelper(); // clear before releasing the mutex + aDocShellRef.Clear(); + delete pModel; + aDrawPersistRef.Clear(); // after the model + delete pBookmark; delete pDragSourceView; @@ -282,6 +288,24 @@ void ScDrawTransferObj::AddSupportedFormats() AddFormat( SOT_FORMATSTR_ID_EMBED_SOURCE ); AddFormat( SOT_FORMATSTR_ID_OBJECTDESCRIPTOR ); AddFormat( SOT_FORMAT_GDIMETAFILE ); + + if ( !aOleData.GetTransferable().is() ) + { + SvInPlaceObjectRef xIPObj = GetSingleObject(); + if ( xIPObj.Is() ) + aOleData = TransferableDataHelper( xIPObj->CreateTransferableSnapshot() ); + } + if ( aOleData.GetTransferable().is() ) + { + // get format list from object snapshot + // (this must be after inserting the default formats!) + + DataFlavorExVector aVector( aOleData.GetDataFlavorExVector() ); + DataFlavorExVector::iterator aIter( aVector.begin() ), aEnd( aVector.end() ); + + while( aIter != aEnd ) + AddFormat( *aIter++ ); + } } else // any drawing objects { @@ -298,9 +322,37 @@ void ScDrawTransferObj::AddSupportedFormats() sal_Bool ScDrawTransferObj::GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor ) { - sal_uInt32 nFormat = SotExchange::GetFormat( rFlavor ); - sal_Bool bOK = sal_False; + sal_Bool bOK = sal_False; + + if ( bOleObj ) + { + if ( !aOleData.GetTransferable().is() ) + { + SvInPlaceObjectRef xIPObj = GetSingleObject(); + if ( xIPObj.Is() ) + aOleData = TransferableDataHelper( xIPObj->CreateTransferableSnapshot() ); + } + if( aOleData.GetTransferable().is() && aOleData.HasFormat( rFlavor ) ) + { + ULONG nOldSwapMode; + + if( pModel ) + { + nOldSwapMode = pModel->GetSwapGraphicsMode(); + pModel->SetSwapGraphicsMode( SDR_SWAPGRAPHICSMODE_PURGE ); + } + + bOK = SetAny( aOleData.GetAny( rFlavor ), rFlavor ); + + if( pModel ) + pModel->SetSwapGraphicsMode( nOldSwapMode ); + + return bOK; + } + } + + sal_uInt32 nFormat = SotExchange::GetFormat( rFlavor ); if( HasFormat( nFormat ) ) { if ( nFormat == SOT_FORMATSTR_ID_LINKSRCDESCRIPTOR || nFormat == SOT_FORMATSTR_ID_OBJECTDESCRIPTOR ) @@ -455,6 +507,11 @@ void ScDrawTransferObj::DragFinished( sal_Int8 nDropAction ) TransferableHelper::DragFinished( nDropAction ); } +void ScDrawTransferObj::SetDrawPersist( const SvEmbeddedObjectRef& rRef ) +{ + aDrawPersistRef = rRef; +} + void lcl_InitMarks( SdrMarkView& rDest, const SdrMarkView& rSource, USHORT nTab ) { rDest.ShowPagePgNum( nTab, Point() ); |