Commits

Anonymous committed b1908d7

CWS-TOOLING: integrate CWS metropatch01_DEV300

  • Participants
  • Parent commits 5c5d176

Comments (0)

Files changed (15)

framework/source/uielement/menubarmanager.cxx

 		    {
 			    sal_Bool            bCheckmark( sal_False );
 			    sal_Bool            bMenuItemEnabled( m_pVCLMenu->IsItemEnabled( pMenuItemHandler->nItemId ));
+                sal_Bool            bEnabledItem( Event.IsEnabled );
                 rtl::OUString       aItemText;
                 status::Visibility  aVisibilityStatus;
 
+                #ifdef UNIX
+                // #b6673979# enable some slots hardly, because UNIX clipboard does not notify all changes
+                // Can be removed if follow up task will be fixed directly within applications.
+                if (
+                    ( pMenuItemHandler->aMenuItemURL.equalsAscii (".uno:Paste"         ) ) ||
+                    ( pMenuItemHandler->aMenuItemURL.equalsAscii (".uno:PasteSpecial"  ) ) ||
+                    ( pMenuItemHandler->aMenuItemURL.equalsAscii (".uno:PasteClipboard") )      // special for draw/impress
+                   )
+                    bEnabledItem = sal_True;
+                #endif
+            
                 // Enable/disable item
-			    if ( Event.IsEnabled != bMenuItemEnabled )
-			        m_pVCLMenu->EnableItem( pMenuItemHandler->nItemId, Event.IsEnabled );
+			    if ( bEnabledItem != bMenuItemEnabled )
+			        m_pVCLMenu->EnableItem( pMenuItemHandler->nItemId, bEnabledItem );
 
 			    if ( Event.State >>= bCheckmark )
                 {

sc/source/ui/app/drwtrans.cxx

     SdrPageView* pPv = aView.ShowSdrPage(aView.GetModel()->GetPage(0));
     aView.MarkAllObj(pPv);
     aSrcSize = aView.GetAllMarkedRect().GetSize();
+
+    if ( bOleObj )              // single OLE object
+    {
+		SdrOle2Obj* pObj = GetSingleObject();
+    	if ( pObj && pObj->GetObjRef().is() )
+            SvEmbedTransferHelper::FillTransferableObjectDescriptor( aObjDesc, pObj->GetObjRef(), pObj->GetGraphic(), pObj->GetAspect() );
+    }
+
     aObjDesc.maSize = aSrcSize;
+    PrepareOLE( aObjDesc );
 
     //
     // remember a unique ID of the source document
     {
         if ( nFormat == SOT_FORMATSTR_ID_LINKSRCDESCRIPTOR || nFormat == SOT_FORMATSTR_ID_OBJECTDESCRIPTOR )
         {
-            if ( bOleObj )              // single OLE object
-            {
-				SdrOle2Obj* pObj = GetSingleObject();
-            	if ( pObj && pObj->GetObjRef().is() )
-                    SvEmbedTransferHelper::FillTransferableObjectDescriptor( aObjDesc, pObj->GetObjRef(), pObj->GetGraphic(), pObj->GetAspect() );
-            }
-
             bOK = SetTransferableObjectDescriptor( aObjDesc, rFlavor );
         }
         else if ( nFormat == SOT_FORMATSTR_ID_DRAWING )

sc/source/ui/app/transobj.cxx

 
 	Rectangle aMMRect = pDoc->GetMMRect( nCol1,nRow1, nCol2,nRow2, nTab1 );
     aObjDesc.maSize = aMMRect.GetSize();
+    PrepareOLE( aObjDesc );
 }
 
 ScTransferObj::~ScTransferObj()

sc/source/ui/view/viewfun3.cxx

 				//	If it's a Writer object, insert RTF instead of OLE
 
 				BOOL bDoRtf = FALSE;
-				SotStorageStreamRef xStm;
 				TransferableObjectDescriptor aObjDesc;
-				if( aDataHelper.GetTransferableObjectDescriptor( SOT_FORMATSTR_ID_OBJECTDESCRIPTOR, aObjDesc ) &&
-					aDataHelper.GetSotStorageStream( SOT_FORMATSTR_ID_EMBED_SOURCE, xStm ) )
+				if( aDataHelper.GetTransferableObjectDescriptor( SOT_FORMATSTR_ID_OBJECTDESCRIPTOR, aObjDesc ) )
 				{
-					SotStorageRef xStore( new SotStorage( *xStm ) );
 					bDoRtf = ( ( aObjDesc.maClassName == SvGlobalName( SO3_SW_CLASSID ) ||
 								 aObjDesc.maClassName == SvGlobalName( SO3_SWWEB_CLASSID ) )
 							   && aDataHelper.HasFormat( SOT_FORMAT_RTF ) );
 			{
 				//	If it's a Writer object, insert RTF instead of OLE
 				BOOL bDoRtf = FALSE;
-				SotStorageStreamRef xStm;
 				TransferableObjectDescriptor aObjDesc;
-				if( aDataHelper.GetTransferableObjectDescriptor( SOT_FORMATSTR_ID_OBJECTDESCRIPTOR, aObjDesc ) &&
-					aDataHelper.GetSotStorageStream( SOT_FORMATSTR_ID_EMBED_SOURCE, xStm ) )
+				if( aDataHelper.GetTransferableObjectDescriptor( SOT_FORMATSTR_ID_OBJECTDESCRIPTOR, aObjDesc ) )
 				{
-					SotStorageRef xStore( new SotStorage( *xStm ) );
 					bDoRtf = ( ( aObjDesc.maClassName == SvGlobalName( SO3_SW_CLASSID ) ||
 								 aObjDesc.maClassName == SvGlobalName( SO3_SWWEB_CLASSID ) )
 							   && aDataHelper.HasFormat( SOT_FORMAT_RTF ) );

sc/source/ui/view/viewfun5.cxx

 					// try to get the replacement image from the clipboard
 					Graphic aGraphic;
 					ULONG nGrFormat = 0;
-					if( aDataHelper.GetGraphic( SOT_FORMATSTR_ID_SVXB, aGraphic ) )
+// (wg. Selection Manager bei Trustet Solaris)
+#ifndef SOLARIS
+/*
+                    if( aDataHelper.GetGraphic( SOT_FORMATSTR_ID_SVXB, aGraphic ) )
 						nGrFormat = SOT_FORMATSTR_ID_SVXB;
 					else if( aDataHelper.GetGraphic( FORMAT_GDIMETAFILE, aGraphic ) )
 						nGrFormat = SOT_FORMAT_GDIMETAFILE;
 					else if( aDataHelper.GetGraphic( FORMAT_BITMAP, aGraphic ) )
 						nGrFormat = SOT_FORMAT_BITMAP;
-					
+*/
+#endif
+
 					// insert replacement image ( if there is one ) into the object helper
 					if ( nGrFormat )
 					{
 							::comphelper::getProcessServiceFactory()->createInstance( ::rtl::OUString(
 											RTL_CONSTASCII_USTRINGPARAM("com.sun.star.embed.MSOLEObjectSystemCreator") ) ),
 							uno::UNO_QUERY_THROW );
-	
+
 						embed::InsertedObjectInfo aInfo = xClipboardCreator->createInstanceInitFromClipboard(
 															xTmpStor,
 															::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "DummyName" ) ),
 															uno::Sequence< beans::PropertyValue >() );
-	
+
 						// TODO/LATER: in future InsertedObjectInfo will be used to get container related information
 						// for example whether the object should be an iconified one
 						xObj = aInfo.Object;
 				{
 					// try to get the replacement image from the clipboard
 					Graphic aGraphic;
-					ULONG nGrFormat = 0;
+                    ULONG nGrFormat = 0;
+
+// (wg. Selection Manager bei Trustet Solaris)
+#ifndef SOLARIS
 					if( aDataHelper.GetGraphic( SOT_FORMATSTR_ID_SVXB, aGraphic ) )
 						nGrFormat = SOT_FORMATSTR_ID_SVXB;
 					else if( aDataHelper.GetGraphic( FORMAT_GDIMETAFILE, aGraphic ) )
 						nGrFormat = SOT_FORMAT_GDIMETAFILE;
 					else if( aDataHelper.GetGraphic( FORMAT_BITMAP, aGraphic ) )
 						nGrFormat = SOT_FORMAT_BITMAP;
-					
+#endif
+
 					// insert replacement image ( if there is one ) into the object helper
 					if ( nGrFormat )
 					{

sd/source/ui/app/sdxfer.cxx

 {
 	delete mpObjDesc;
 	mpObjDesc = new TransferableObjectDescriptor( rObjDesc );
+    PrepareOLE( rObjDesc );
 }
 
 // -----------------------------------------------------------------------------

sd/source/ui/view/sdview3.cxx

 					// try to get the replacement image from the clipboard
 					Graphic aGraphic;
 					ULONG nGrFormat = 0;
-					if( aDataHelper.GetGraphic( SOT_FORMATSTR_ID_SVXB, aGraphic ) )
+
+// (wg. Selection Manager bei Trustet Solaris)
+#ifndef SOLARIS
+/*
+                    if( aDataHelper.GetGraphic( SOT_FORMATSTR_ID_SVXB, aGraphic ) )
 						nGrFormat = SOT_FORMATSTR_ID_SVXB;
 					else if( aDataHelper.GetGraphic( FORMAT_GDIMETAFILE, aGraphic ) )
 						nGrFormat = SOT_FORMAT_GDIMETAFILE;
 					else if( aDataHelper.GetGraphic( FORMAT_BITMAP, aGraphic ) )
 						nGrFormat = SOT_FORMAT_BITMAP;
+*/
+#endif
 
 					// insert replacement image ( if there is one ) into the object helper
 					if ( nGrFormat )
 					// try to get the replacement image from the clipboard
 					Graphic aGraphic;
 					ULONG nGrFormat = 0;
-					if( aDataHelper.GetGraphic( SOT_FORMATSTR_ID_SVXB, aGraphic ) )
+
+// (wg. Selection Manager bei Trustet Solaris)
+#ifndef SOLARIS
+                    if( aDataHelper.GetGraphic( SOT_FORMATSTR_ID_SVXB, aGraphic ) )
 						nGrFormat = SOT_FORMATSTR_ID_SVXB;
 					else if( aDataHelper.GetGraphic( FORMAT_GDIMETAFILE, aGraphic ) )
 						nGrFormat = SOT_FORMAT_GDIMETAFILE;
 					else if( aDataHelper.GetGraphic( FORMAT_BITMAP, aGraphic ) )
 						nGrFormat = SOT_FORMAT_BITMAP;
+#endif
 
 					// insert replacement image ( if there is one ) into the object helper
 					if ( nGrFormat )

sfx2/source/menu/mnuitem.cxx

 				GetId() >= SID_OBJECTMENU0 && GetId() < SID_OBJECTMENU_LAST;
 
 	// enabled/disabled-Flag pauschal korrigieren
+
+#ifdef UNIX
+	if (nSID == SID_PASTE)
+		pOwnMenu->EnableItem( GetId(), TRUE );
+	else
+#endif
 	pOwnMenu->EnableItem( GetId(), bIsObjMenu
 				? 0 != pOwnMenu->GetSVMenu()->GetPopupMenu( GetId() )
 				: eState != SFX_ITEM_DISABLED );

svtools/inc/svtools/transfer.hxx

 	mutable ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboard >	mxClipboard;
 	::com::sun::star::uno::Reference< ::com::sun::star::frame::XTerminateListener >				        mxTerminateListener;
 	DataFlavorExVector*																			        mpFormats;
+    TransferableObjectDescriptor*                                                                       mpObjDesc;
 	void*																						        mpDummy1;
-	void*																						        mpDummy2;
 
 protected:
 	inline const ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboard >&
 
 					    TransferableHelper();
 
+    void                PrepareOLE( const TransferableObjectDescriptor& rObjDesc );
+
 	void			    CopyToClipboard( Window *pWindow ) const;
 	void			    CopyToSelection( Window *pWindow ) const;
 	void			    StartDrag( Window* pWindow, sal_Int8 nDragSourceActions,
 	::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable >			mxTransfer;
 	::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboard >	mxClipboard;
 	DataFlavorExVector*																			mpFormats;
-	void*                                                                                       mpDummy2;
+    TransferableObjectDescriptor*                                                               mpObjDesc;
 	TransferableDataHelper_Impl*                                                                mpImpl;
 	void*																						mpDummy4;
 
 	void                CopyAnyData( ULONG nFormatId, const sal_Char* pData, ULONG nLen );
 
 	sal_Bool            HasAnyData() const;
-    
+
     using TransferableHelper::StartDrag;
 	void                StartDrag( Window* pWindow, sal_Int8 nDragSourceActions,
 				                   const Link& rCallbck,

svtools/source/misc/embedtransfer.cxx

 , m_pGraphic( pGraphic ? new Graphic( *pGraphic ) : NULL )
 , m_nAspect( nAspect )
 {
+    if( xObj.is() )
+    {
+        TransferableObjectDescriptor aObjDesc;
+
+        FillTransferableObjectDescriptor( aObjDesc, m_xObj, NULL, m_nAspect );
+        PrepareOLE( aObjDesc );
+    }
 }
 
 // -----------------------------------------------------------------------------

svtools/source/misc/transfer.cxx

 #include <svtools/wmf.hxx>
 #include <svtools/imap.hxx>
 #include <svtools/transfer.hxx>
+#include <cstdio>
 
 // --------------
 // - Namespaces -
 SvStream& operator>>( SvStream& rIStm, TransferableObjectDescriptor& rObjDesc )
 {
 	sal_uInt32  nSize, nViewAspect, nSig1, nSig2;
-	
+
 	rIStm >> nSize;
 	rIStm >> rObjDesc.maClassName;
 	rIStm >> nViewAspect;
 	rIStm.ReadByteString( rObjDesc.maTypeName, gsl_getSystemTextEncoding() );
 	rIStm.ReadByteString( rObjDesc.maDisplayName, gsl_getSystemTextEncoding() );
     rIStm >> nSig1 >> nSig2;
-    
+
     rObjDesc.mnViewAspect = static_cast< sal_uInt16 >( nViewAspect );
-    
+
     // don't use width/height info from external objects
     if( ( TOD_SIG1 != nSig1 ) || ( TOD_SIG2 != nSig2 ) )
     {
 {
 	const sal_uInt32    nFirstPos = rOStm.Tell(), nViewAspect = rObjDesc.mnViewAspect;
 	const sal_uInt32    nSig1 = TOD_SIG1, nSig2 = TOD_SIG2;
-	
+
 	rOStm.SeekRel( 4 );
 	rOStm << rObjDesc.maClassName;
 	rOStm << nViewAspect;
 	return rOStm;
 }
 
+// -----------------------------------------------------------------------------
+
+static ::rtl::OUString ImplGetParameterString( const TransferableObjectDescriptor& rObjDesc )
+{
+    const ::rtl::OUString   aChar( ::rtl::OUString::createFromAscii( "\"" ) );
+    const ::rtl::OUString   aClassName( rObjDesc.maClassName.GetHexName() );
+    ::rtl::OUString         aParams;
+
+    if( aClassName.getLength() )
+    {
+        aParams += ::rtl::OUString::createFromAscii( ";classname=\"" );
+        aParams += aClassName;
+        aParams += aChar;
+    }
+
+    if( rObjDesc.maTypeName.Len() )
+    {
+        aParams += ::rtl::OUString::createFromAscii( ";typename=\"" );
+        aParams += rObjDesc.maTypeName;
+        aParams += aChar;
+    }
+
+    if( rObjDesc.maDisplayName.Len() )
+    {
+        aParams += ::rtl::OUString::createFromAscii( ";displayname=\"" );
+        aParams += rObjDesc.maDisplayName;
+        aParams += aChar;
+    }
+
+    aParams += ::rtl::OUString::createFromAscii( ";viewaspect=\"" );
+    aParams += ::rtl::OUString::valueOf( static_cast< sal_Int32 >( rObjDesc.mnViewAspect ) );
+    aParams += aChar;
+
+    aParams += ::rtl::OUString::createFromAscii( ";width=\"" );
+    aParams += ::rtl::OUString::valueOf( rObjDesc.maSize.Width() );
+    aParams += aChar;
+
+    aParams += ::rtl::OUString::createFromAscii( ";height=\"" );
+    aParams += ::rtl::OUString::valueOf( rObjDesc.maSize.Height() );
+    aParams += aChar;
+
+    aParams += ::rtl::OUString::createFromAscii( ";posx=\"" );
+    aParams += ::rtl::OUString::valueOf( rObjDesc.maDragStartPos.X() );
+    aParams += aChar;
+
+    aParams += ::rtl::OUString::createFromAscii( ";posy=\"" );
+    aParams += ::rtl::OUString::valueOf( rObjDesc.maDragStartPos.X() );
+    aParams += aChar;
+
+    return aParams;
+}
+
+// -----------------------------------------------------------------------------
+
+static void ImplSetParameterString( TransferableObjectDescriptor& rObjDesc, const DataFlavorEx& rFlavorEx )
+{
+    Reference< XMultiServiceFactory >       xFact( ::comphelper::getProcessServiceFactory() );
+    Reference< XMimeContentTypeFactory >    xMimeFact;
+
+    try
+    {
+        if( xFact.is() )
+        {
+            xMimeFact = Reference< XMimeContentTypeFactory >( xFact->createInstance( ::rtl::OUString::createFromAscii(
+                                                              "com.sun.star.datatransfer.MimeContentTypeFactory" ) ),
+                                                              UNO_QUERY );
+        }
+
+        if( xMimeFact.is() )
+        {
+            Reference< XMimeContentType > xMimeType( xMimeFact->createMimeContentType( rFlavorEx.MimeType ) );
+
+            if( xMimeType.is() )
+            {
+                const ::rtl::OUString aClassNameString( ::rtl::OUString::createFromAscii( "classname" ) );
+                const ::rtl::OUString aTypeNameString( ::rtl::OUString::createFromAscii( "typename" ) );
+                const ::rtl::OUString aDisplayNameString( ::rtl::OUString::createFromAscii( "displayname" ) );
+                const ::rtl::OUString aViewAspectString( ::rtl::OUString::createFromAscii( "viewaspect" ) );
+                const ::rtl::OUString aWidthString( ::rtl::OUString::createFromAscii( "width" ) );
+                const ::rtl::OUString aHeightString( ::rtl::OUString::createFromAscii( "height" ) );
+                const ::rtl::OUString aPosXString( ::rtl::OUString::createFromAscii( "posx" ) );
+                const ::rtl::OUString aPosYString( ::rtl::OUString::createFromAscii( "posy" ) );
+
+                if( xMimeType->hasParameter( aClassNameString ) )
+                {
+                    rObjDesc.maClassName.MakeId( xMimeType->getParameterValue( aClassNameString ) );
+                }
+
+                if( xMimeType->hasParameter( aTypeNameString ) )
+                {
+                    rObjDesc.maTypeName = xMimeType->getParameterValue( aTypeNameString );
+                }
+
+                if( xMimeType->hasParameter( aDisplayNameString ) )
+                {
+                    rObjDesc.maDisplayName = xMimeType->getParameterValue( aDisplayNameString );
+                }
+
+                if( xMimeType->hasParameter( aViewAspectString ) )
+                {
+                    rObjDesc.mnViewAspect = static_cast< sal_uInt16 >( xMimeType->getParameterValue( aViewAspectString ).toInt32() );
+                }
+
+                if( xMimeType->hasParameter( aWidthString ) )
+                {
+                    rObjDesc.maSize.Width() = xMimeType->getParameterValue( aWidthString ).toInt32();
+                }
+
+                if( xMimeType->hasParameter( aHeightString ) )
+                {
+                    rObjDesc.maSize.Height() = xMimeType->getParameterValue( aHeightString ).toInt32();
+                }
+
+                if( xMimeType->hasParameter( aPosXString ) )
+                {
+                    rObjDesc.maDragStartPos.X() = xMimeType->getParameterValue( aPosXString ).toInt32();
+                }
+
+                if( xMimeType->hasParameter( aPosYString ) )
+                {
+                    rObjDesc.maDragStartPos.Y() = xMimeType->getParameterValue( aPosYString ).toInt32();
+                }
+            }
+        }
+    }
+    catch( const ::com::sun::star::uno::Exception& )
+    {
+    }
+}
+
 // -----------------------------------------
 // - TransferableHelper::TerminateListener -
 // -----------------------------------------
 // ----------------------
 
 TransferableHelper::TransferableHelper() :
-	mpFormats( new DataFlavorExVector )
+	mpFormats( new DataFlavorExVector ),
+    mpObjDesc( NULL )
 {
 }
 
 
 TransferableHelper::~TransferableHelper()
 {
+    delete mpObjDesc;
 	delete mpFormats;
 }
 
             // if any is not yet filled, use standard format
             if( !maAny.hasValue() )
                 GetData( rFlavor );
-		}
+
+#ifdef DEBUG
+            if( maAny.hasValue() && ::com::sun::star::uno::TypeClass_STRING != maAny.getValueType().getTypeClass() )
+                fprintf( stderr, "TransferableHelper delivers sequence of data [ %s ]\n", ByteString( String( rFlavor.MimeType), RTL_TEXTENCODING_ASCII_US ).GetBuffer() );
+#endif
+        }
 		catch( const ::com::sun::star::uno::Exception& )
 		{
 		}
 {
 	const ::vos::OGuard aGuard( Application::GetSolarMutex() );
 
-
-
-
 	try
 	{
 		if( !mpFormats->size() )
 	sal_uInt32						nCurPos = 0;
 
     while( aIter != aEnd )
+    {
     	aRet[ nCurPos++ ] = *aIter++;
+    }
 
 	return aRet;
 }
     sal_Bool                        bAdd = sal_True;
 
 	while( aIter != aEnd )
-
 	{
-
         if( TransferableDataHelper::IsEqual( *aIter, rFlavor ) )
         {
+            // update MimeType for SOT_FORMATSTR_ID_OBJECTDESCRIPTOR in every case
+            if( ( SOT_FORMATSTR_ID_OBJECTDESCRIPTOR == aIter->mnSotId ) && mpObjDesc )
+            {
+                DataFlavor aObjDescFlavor;
+
+                SotExchange::GetFormatDataFlavor( SOT_FORMATSTR_ID_OBJECTDESCRIPTOR, aObjDescFlavor );
+                aIter->MimeType = aObjDescFlavor.MimeType;
+                aIter->MimeType += ::ImplGetParameterString( *mpObjDesc );
+
+#ifdef DEBUG
+                fprintf( stderr, "TransferableHelper exchanged objectdescriptor [ %s ]\n",
+                         ByteString( String( aIter->MimeType), RTL_TEXTENCODING_ASCII_US ).GetBuffer() );
+#endif
+            }
+
             aIter = aEnd;
             bAdd = sal_False;
         }
 
     if( bAdd )
     {
-    	DataFlavorEx aFlavorEx;
+    	DataFlavorEx   aFlavorEx;
+        DataFlavor     aObjDescFlavor;
 
 		aFlavorEx.MimeType = rFlavor.MimeType;
 		aFlavorEx.HumanPresentableName = rFlavor.HumanPresentableName;
 		aFlavorEx.DataType = rFlavor.DataType;
 		aFlavorEx.mnSotId = SotExchange::RegisterFormat( rFlavor );
 
+        if( ( SOT_FORMATSTR_ID_OBJECTDESCRIPTOR == aFlavorEx.mnSotId ) && mpObjDesc )
+            aFlavorEx.MimeType += ::ImplGetParameterString( *mpObjDesc );
+
 		mpFormats->push_back( aFlavorEx );
 
 		if( FORMAT_BITMAP == aFlavorEx.mnSotId )
 sal_Bool TransferableHelper::SetTransferableObjectDescriptor( const TransferableObjectDescriptor& rDesc,
 															  const ::com::sun::star::datatransfer::DataFlavor& )
 {
+    PrepareOLE( rDesc );
+
 	SvMemoryStream aMemStm( 1024, 1024 );
 
 	aMemStm << rDesc;
     aMemStm.SetVersion( SOFFICE_FILEFORMAT_50 );
 	aMemStm << rFileList;
 
-	maAny <<= Sequence< sal_Int8 >( static_cast< const sal_Int8* >( aMemStm.GetData() ), aMemStm.Seek( STREAM_SEEK_TO_END ) );
+	maAny <<= Sequence< sal_Int8 >( static_cast< const sal_Int8* >( aMemStm.GetData() ),
+                                       aMemStm.Seek( STREAM_SEEK_TO_END ) );
 
 	return( maAny.hasValue() );
 }
 
 // -----------------------------------------------------------------------------
 
+void TransferableHelper::PrepareOLE( const TransferableObjectDescriptor& rObjDesc )
+{
+    delete mpObjDesc;
+    mpObjDesc = new TransferableObjectDescriptor( rObjDesc );
+
+    if( HasFormat( SOT_FORMATSTR_ID_OBJECTDESCRIPTOR ) )
+        AddFormat( SOT_FORMATSTR_ID_OBJECTDESCRIPTOR );
+}
+
+// -----------------------------------------------------------------------------
+
 void TransferableHelper::CopyToClipboard( Window *pWindow ) const
 {
 	DBG_ASSERT( pWindow, "Window pointer is NULL" );
 // - TransferableDataHelper -
 // --------------------------
 
-TransferableDataHelper::TransferableDataHelper()
-    :mpFormats( new DataFlavorExVector )
-    ,mpImpl( new TransferableDataHelper_Impl )
+TransferableDataHelper::TransferableDataHelper() :
+    mpFormats( new DataFlavorExVector ),
+    mpObjDesc( new TransferableObjectDescriptor ),
+    mpImpl( new TransferableDataHelper_Impl )
 {
 }
 
 // -----------------------------------------------------------------------------
 
-TransferableDataHelper::TransferableDataHelper( const Reference< ::com::sun::star::datatransfer::XTransferable >& rxTransferable )
-    :mxTransfer( rxTransferable )
-	,mpFormats( new DataFlavorExVector )
-    ,mpImpl( new TransferableDataHelper_Impl )
+TransferableDataHelper::TransferableDataHelper( const Reference< ::com::sun::star::datatransfer::XTransferable >& rxTransferable ) :
+    mxTransfer( rxTransferable ),
+    mpFormats( new DataFlavorExVector ),
+    mpObjDesc( new TransferableObjectDescriptor ),
+    mpImpl( new TransferableDataHelper_Impl )
 {
 	InitFormats();
 }
 
 // -----------------------------------------------------------------------------
 
-TransferableDataHelper::TransferableDataHelper( const TransferableDataHelper& rDataHelper )
-    :mxTransfer( rDataHelper.mxTransfer )
-	,mxClipboard( rDataHelper.mxClipboard )
-	,mpFormats( new DataFlavorExVector( *rDataHelper.mpFormats ) )
-    ,mpImpl( new TransferableDataHelper_Impl )
+TransferableDataHelper::TransferableDataHelper( const TransferableDataHelper& rDataHelper ) :
+    mxTransfer( rDataHelper.mxTransfer ),
+    mxClipboard( rDataHelper.mxClipboard ),
+	mpFormats( new DataFlavorExVector( *rDataHelper.mpFormats ) ),
+    mpObjDesc( new TransferableObjectDescriptor( *rDataHelper.mpObjDesc ) ),
+    mpImpl( new TransferableDataHelper_Impl )
 {
 }
 
         ::osl::MutexGuard aGuard( mpImpl->maMutex );
 
         bool bWasClipboardListening = ( NULL != mpImpl->mpClipboardListener );
+
         if ( bWasClipboardListening )
             StopClipboardListening();
 
         mxTransfer = rDataHelper.mxTransfer;
 		delete mpFormats, mpFormats = new DataFlavorExVector( *rDataHelper.mpFormats );
-
+        delete mpObjDesc, mpObjDesc = new TransferableObjectDescriptor( *rDataHelper.mpObjDesc );
 		mxClipboard = rDataHelper.mxClipboard;
 
         if ( bWasClipboardListening )
     {
         ::osl::MutexGuard aGuard( mpImpl->maMutex );
 	    delete mpFormats, mpFormats = NULL;
+        delete mpObjDesc, mpObjDesc = NULL;
     }
     delete mpImpl;
 }
             {
                 rDataFlavorExVector[ rDataFlavorExVector.size() - 1 ].mnSotId = SOT_FORMAT_FILE_LIST;
             }
+            else if( xMimeType.is() && xMimeType->getFullMediaType().equalsIgnoreAsciiCase( ::rtl::OUString::createFromAscii( "application/x-openoffice-objectdescriptor-xml" ) ) )
+            {
+                rDataFlavorExVector[ rDataFlavorExVector.size() - 1 ].mnSotId = SOT_FORMATSTR_ID_OBJECTDESCRIPTOR;
+            }
 	    }
     }
 	catch( const ::com::sun::star::uno::Exception& )
     ::osl::MutexGuard aGuard( mpImpl->maMutex );
 
     mpFormats->clear();
+    delete mpObjDesc, mpObjDesc = new TransferableObjectDescriptor;
+
     if( mxTransfer.is() )
+    {
         TransferableDataHelper::FillDataFlavorExVector( mxTransfer->getTransferDataFlavors(), *mpFormats );
+
+        DataFlavorExVector::iterator aIter( mpFormats->begin() ), aEnd( mpFormats->end() );
+
+        while( aIter != aEnd )
+        {
+            if( SOT_FORMATSTR_ID_OBJECTDESCRIPTOR == aIter->mnSotId )
+            {
+                ImplSetParameterString( *mpObjDesc, *aIter );
+                aIter = aEnd;
+            }
+            else
+                ++aIter;
+        }
+    }
 }
 
 // -----------------------------------------------------------------------------
 
 // -----------------------------------------------------------------------------
 
-sal_Bool TransferableDataHelper::GetTransferableObjectDescriptor( const ::com::sun::star::datatransfer::DataFlavor& rFlavor, TransferableObjectDescriptor& rDesc )
+sal_Bool TransferableDataHelper::GetTransferableObjectDescriptor( const ::com::sun::star::datatransfer::DataFlavor&, TransferableObjectDescriptor& rDesc )
 {
-	SotStorageStreamRef xStm;
-	sal_Bool			bRet = GetSotStorageStream( rFlavor, xStm );
-
-	if( bRet )
-	{
-		*xStm >> rDesc;
-		bRet = ( xStm->GetError() == ERRCODE_NONE );
-	}
-
-	return bRet;
+    rDesc = *mpObjDesc;
+    return true;
 }
 
 // -----------------------------------------------------------------------------
 
 sal_Bool TransferableDataHelper::GetSequence( const DataFlavor& rFlavor, Sequence< sal_Int8 >& rSeq )
 {
-	const Any aAny( GetAny( rFlavor ) );
+#ifdef DEBUG
+    fprintf( stderr, "TransferableDataHelper requests sequence of data\n" );
+#endif
+
+    const Any aAny( GetAny( rFlavor ) );
 	return( aAny.hasValue() && ( aAny >>= rSeq ) );
 }
 
 
 sal_Bool TransferableDataHelper::GetSotStorageStream( SotFormatStringId nFormat, SotStorageStreamRef& rxStream )
 {
-	DataFlavor aFlavor;
+    DataFlavor aFlavor;
 	return( SotExchange::GetFormatDataFlavor( nFormat, aFlavor ) && GetSotStorageStream( aFlavor, rxStream ) );
 }
 
 	sal_Bool				bRet = GetSequence( rFlavor, aSeq );
 
 	if( bRet )
-
 	{
 		rxStream = new SotStorageStream( String() );
 		rxStream->Write( aSeq.getConstArray(), aSeq.getLength() );

svx/source/mnuctrls/clipboardctl.cxx

             GetToolBox().SetItemBits( GetId(), GetToolBox().GetItemBits( GetId() ) & ~TIB_DROPDOWN );
         GetToolBox().Invalidate( GetToolBox().GetItemRect( GetId() ) );
     }
+    #ifdef UNIX
+    // #b6673979# enable some slots hardly, because UNIX clipboard does not notify all changes
+    // Can be removed if follow up task will be fixed directly within applications.
+    else
+    if ( SID_PASTE == nSID )
+    {
+        bDisabled = false;
+        GetToolBox().EnableItem( GetId(), true );
+    }
+    #endif
     else
     {
         // enable the item as a whole

sw/source/ui/dochdl/swdtflvr.cxx

 								INetURLObject::WAS_ENCODED,
 			   					INetURLObject::DECODE_UNAMBIGUOUS );
 		}
+
+        PrepareOLE( aObjDesc );
 	}
 }
 
         if (pOrigGrf && !pOrigGrf->GetBitmap().IsEmpty())
 		  AddFormat( SOT_FORMATSTR_ID_SVXB );
 
+        PrepareOLE( aObjDesc );
 		AddFormat( SOT_FORMATSTR_ID_OBJECTDESCRIPTOR );
+
         // --> OD 2005-02-09 #119353# - robust
         const Graphic* pGrf = pWrtShell->GetGraphic();
         if( pGrf && pGrf->IsSupportedGraphic() )
 		pWrtShell->Copy( pDoc );
 
 		AddFormat( SOT_FORMATSTR_ID_EMBED_SOURCE );
+
+        PrepareOLE( aObjDesc );
 		AddFormat( SOT_FORMATSTR_ID_OBJECTDESCRIPTOR );
-		AddFormat( FORMAT_GDIMETAFILE );
+
+        AddFormat( FORMAT_GDIMETAFILE );
 		eBufferType = TRNSFR_OLE;
 	}
 	//Gibt es ueberhaupt etwas zum bereitstellen?
 
 		//Wenn's einer braucht OLE'n wir ihm was.
 		AddFormat( SOT_FORMATSTR_ID_EMBED_SOURCE );
-		AddFormat( SOT_FORMATSTR_ID_OBJECTDESCRIPTOR );
 
 		//RTF vor das Metafile von OLE stellen, weil mit weniger verlusten
 		//behaftet.
 		Size aSz( OLESIZE );
 		aObjDesc.maSize = OutputDevice::LogicToLogic( aSz, MAP_TWIP, MAP_100TH_MM );
 
+        PrepareOLE( aObjDesc );
+        AddFormat( SOT_FORMATSTR_ID_OBJECTDESCRIPTOR );
+
 		delete pWait;
 	}
 	else
 
 	//Wenn's einer braucht OLE'n wir ihm was.
 	AddFormat( SOT_FORMATSTR_ID_EMBED_SOURCE );
-	AddFormat( SOT_FORMATSTR_ID_OBJECTDESCRIPTOR );
-	AddFormat( FORMAT_RTF );
+    AddFormat( FORMAT_RTF );
 	AddFormat( SOT_FORMATSTR_ID_HTML );
 	AddFormat( FORMAT_STRING );
 
 	Size aSz( OLESIZE );
 	aObjDesc.maSize = OutputDevice::LogicToLogic( aSz, MAP_TWIP, MAP_100TH_MM );
 
+    PrepareOLE( aObjDesc );
+    AddFormat( SOT_FORMATSTR_ID_OBJECTDESCRIPTOR );
+
 	SW_MOD()->pClipboard = this;
 	CopyToClipboard( &pWrtShell->GetView().GetEditWin() );
 
 			// try to get the replacement image from the clipboard
 			Graphic aGraphic;
 			ULONG nGrFormat = 0;
-			if( rData.GetGraphic( SOT_FORMATSTR_ID_SVXB, aGraphic ) )
+
+// (wg. Selection Manager bei Trustet Solaris)
+#ifndef SOLARIS
+/*
+            if( rData.GetGraphic( SOT_FORMATSTR_ID_SVXB, aGraphic ) )
 				nGrFormat = SOT_FORMATSTR_ID_SVXB;
 			else if( rData.GetGraphic( FORMAT_GDIMETAFILE, aGraphic ) )
 				nGrFormat = SOT_FORMAT_GDIMETAFILE;
 			else if( rData.GetGraphic( FORMAT_BITMAP, aGraphic ) )
 				nGrFormat = SOT_FORMAT_BITMAP;
+*/
+#endif
 
 			// insert replacement image ( if there is one ) into the object helper
 			if ( nGrFormat )
 	else if( nsSelectionType::SEL_OLE == nSelection )
 	{
 		AddFormat( SOT_FORMATSTR_ID_EMBED_SOURCE );
+        PrepareOLE( aObjDesc );
 		AddFormat( SOT_FORMATSTR_ID_OBJECTDESCRIPTOR );
 		AddFormat( FORMAT_GDIMETAFILE );
 		eBufferType = TRNSFR_OLE;
 			eBufferType = (TransferBufferType)(TRNSFR_TABELLE | eBufferType);
 
 		AddFormat( SOT_FORMATSTR_ID_EMBED_SOURCE );
-		AddFormat( SOT_FORMATSTR_ID_OBJECTDESCRIPTOR );
 
 		//RTF vor das Metafile von OLE stellen, weil mit weniger verlusten
 		//behaftet.
 		aObjDesc.maDragStartPos = rSttPos;
 		aObjDesc.maSize = OutputDevice::LogicToLogic( Size( OLESIZE ),
 												MAP_TWIP, MAP_100TH_MM );
+        PrepareOLE( aObjDesc );
+        AddFormat( SOT_FORMATSTR_ID_OBJECTDESCRIPTOR );
 	}
 	else if( nSelection & nsSelectionType::SEL_TXT && !pWrtShell->HasMark() )
 	{

vcl/unx/gtk/window/gtkframe.cxx

             gtk_widget_hide( m_pWindow );
             if( m_pIMHandler )
                 m_pIMHandler->focusChanged( false );
+            // flush here; there may be a very seldom race between
+            // the display connection used for clipboard and our connection
+            Flush();
         }
         CallCallback( SALEVENT_RESIZE, NULL );
     }

vcl/unx/source/window/salframe.cxx

                 XUngrabPointer( GetXDisplay(),
                                 CurrentTime );
         }
+        // flush here; there may be a very seldom race between
+        // the display connection used for clipboard and our connection
+        Flush();
 	}
 }