diff options
author | obo <obo@openoffice.org> | 2010-06-21 15:06:39 +0200 |
---|---|---|
committer | obo <obo@openoffice.org> | 2010-06-21 15:06:39 +0200 |
commit | c4dc32be8a0e1e1c9661d405404052b1f5709623 (patch) | |
tree | 39a7a7aeca9bc90595270db2917ab8f6940f0978 /sw | |
parent | 2e08b6be7ef70c1eae7db47edd5b0a642250f10a (diff) | |
parent | f53587ad3f2ab1052ffd303751bb6aebf64c32bf (diff) |
CWS-TOOLING: integrate CWS mtclip01
Diffstat (limited to 'sw')
-rw-r--r-- | sw/inc/swmodule.hxx | 2 | ||||
-rw-r--r-- | sw/source/ui/app/swmodule.cxx | 1 | ||||
-rw-r--r-- | sw/source/ui/dochdl/swdtflvr.cxx | 109 | ||||
-rw-r--r-- | sw/source/ui/inc/swdtflvr.hxx | 1 | ||||
-rw-r--r-- | sw/source/ui/uiview/srcview.cxx | 14 |
5 files changed, 59 insertions, 68 deletions
diff --git a/sw/inc/swmodule.hxx b/sw/inc/swmodule.hxx index 8ad108513297..c8e601143877 100644 --- a/sw/inc/swmodule.hxx +++ b/sw/inc/swmodule.hxx @@ -133,7 +133,7 @@ protected: public: // public Data - used for internal Clipboard / Drag & Drop / XSelection - SwTransferable *pClipboard, *pDragDrop, *pXSelection; + SwTransferable *pDragDrop, *pXSelection; TYPEINFO(); SFX_DECL_INTERFACE(SW_INTERFACE_MODULE) diff --git a/sw/source/ui/app/swmodule.cxx b/sw/source/ui/app/swmodule.cxx index 4bf8238ade61..3f1c4665c6e3 100644 --- a/sw/source/ui/app/swmodule.cxx +++ b/sw/source/ui/app/swmodule.cxx @@ -207,7 +207,6 @@ SwModule::SwModule( SfxObjectFactory* pWebFact, pView(0), bAuthorInitialised(sal_False), bEmbeddedLoadSave( sal_False ), - pClipboard( 0 ), pDragDrop( 0 ), pXSelection( 0 ) { diff --git a/sw/source/ui/dochdl/swdtflvr.cxx b/sw/source/ui/dochdl/swdtflvr.cxx index 704172b21074..8220c7ee2c8d 100644 --- a/sw/source/ui/dochdl/swdtflvr.cxx +++ b/sw/source/ui/dochdl/swdtflvr.cxx @@ -300,9 +300,7 @@ SwTransferable::~SwTransferable() SwModule* pMod = SW_MOD(); if(pMod) { - if ( pMod->pClipboard == this ) - pMod->pClipboard = 0; - else if ( pMod->pDragDrop == this ) + if ( pMod->pDragDrop == this ) pMod->pDragDrop = 0; else if ( pMod->pXSelection == this ) pMod->pXSelection = 0; @@ -338,9 +336,7 @@ static SwDoc * lcl_GetDoc(SwDocFac & rDocFac) void SwTransferable::ObjectReleased() { SwModule *pMod = SW_MOD(); - if( this == pMod->pClipboard ) - pMod->pClipboard = 0; - else if( this == pMod->pDragDrop ) + if( this == pMod->pDragDrop ) pMod->pDragDrop = 0; else if( this == pMod->pXSelection ) pMod->pXSelection = 0; @@ -1013,7 +1009,6 @@ int SwTransferable::Copy( BOOL bIsCut ) int nRet = PrepareForCopy( bIsCut ); if ( nRet ) { - SW_MOD()->pClipboard = this; CopyToClipboard( &pWrtShell->GetView().GetEditWin() ); } return nRet; @@ -1035,7 +1030,6 @@ int SwTransferable::CalculateAndCopy() eBufferType = TRNSFR_DOCUMENT; AddFormat( FORMAT_STRING ); - SW_MOD()->pClipboard = this; CopyToClipboard( &pWrtShell->GetView().GetEditWin() ); return 1; @@ -1086,7 +1080,6 @@ int SwTransferable::CopyGlossary( SwTextBlocks& rGlossary, PrepareOLE( aObjDesc ); AddFormat( SOT_FORMATSTR_ID_OBJECTDESCRIPTOR ); - SW_MOD()->pClipboard = this; CopyToClipboard( &pWrtShell->GetView().GetEditWin() ); return 1; @@ -1104,20 +1097,14 @@ BOOL SwTransferable::IsPaste( const SwWrtShell& rSh, // Check the common case first: We can always paste our own data! // #106503#: If _only_ the internal format can be pasted, this check will // yield 'true', while the one below would give a (wrong) result 'false'. - bool bIsPaste = ( SW_MOD()->pClipboard != NULL ); + + bool bIsPaste = ( GetSwTransferable( rData ) != NULL ); // if it's not our own data, we need to have a closer look: if( ! bIsPaste ) { // determine the proper paste action, and return true if we find one uno::Reference<XTransferable> xTransferable( rData.GetXTransferable() ); - uno::Reference<XUnoTunnel> xTunnel( xTransferable, UNO_QUERY ); - if ( xTunnel.is() ) - { - sal_Int64 nHandle = xTunnel->getSomething( getUnoTunnelId() ); - if ( nHandle ) - return TRUE; - } USHORT nDestination = SwTransferable::GetSotDestination( rSh ); USHORT nSourceOptions = @@ -1153,36 +1140,27 @@ int SwTransferable::Paste( SwWrtShell& rSh, TransferableDataHelper& rData ) nDestination = SwTransferable::GetSotDestination( rSh ); ULONG nFormat = 0; - if( SW_MOD()->pClipboard ) + if( GetSwTransferable( rData ) ) + { nAction = EXCHG_OUT_ACTION_INSERT_PRIVATE; + } else { - uno::Reference<XUnoTunnel> xTunnel( rData.GetTransferable(), UNO_QUERY ); - if ( xTunnel.is() ) - { - sal_Int64 nHandle = xTunnel->getSomething( getUnoTunnelId() ); - if ( nHandle ) - nAction = EXCHG_OUT_ACTION_INSERT_PRIVATE; - } - - if ( !nAction ) - { - USHORT nSourceOptions = - (( EXCHG_DEST_DOC_TEXTFRAME == nDestination || - EXCHG_DEST_SWDOC_FREE_AREA == nDestination || - EXCHG_DEST_DOC_TEXTFRAME_WEB == nDestination || - EXCHG_DEST_SWDOC_FREE_AREA_WEB == nDestination ) - ? EXCHG_IN_ACTION_COPY - : EXCHG_IN_ACTION_MOVE); - uno::Reference<XTransferable> xTransferable( rData.GetXTransferable() ); - nAction = SotExchange::GetExchangeAction( - rData.GetDataFlavorExVector(), - nDestination, - nSourceOptions, /* ?? */ - EXCHG_IN_ACTION_DEFAULT, /* ?? */ - nFormat, nEventAction, 0, - lcl_getTransferPointer ( xTransferable ) ); - } + USHORT nSourceOptions = + (( EXCHG_DEST_DOC_TEXTFRAME == nDestination || + EXCHG_DEST_SWDOC_FREE_AREA == nDestination || + EXCHG_DEST_DOC_TEXTFRAME_WEB == nDestination || + EXCHG_DEST_SWDOC_FREE_AREA_WEB == nDestination ) + ? EXCHG_IN_ACTION_COPY + : EXCHG_IN_ACTION_MOVE); + uno::Reference<XTransferable> xTransferable( rData.GetXTransferable() ); + nAction = SotExchange::GetExchangeAction( + rData.GetDataFlavorExVector(), + nDestination, + nSourceOptions, /* ?? */ + EXCHG_IN_ACTION_DEFAULT, /* ?? */ + nFormat, nEventAction, 0, + lcl_getTransferPointer ( xTransferable ) ); } // special case for tables from draw application @@ -1245,7 +1223,7 @@ int SwTransferable::PasteData( TransferableDataHelper& rData, } } } - else if( ( !pMod->pClipboard || bIsPasteFmt ) && + else if( ( !GetSwTransferable( rData ) || bIsPasteFmt ) && !rSh.IsTableMode() && rSh.HasSelection() ) { // dann die Selektionen loeschen @@ -1273,14 +1251,14 @@ int SwTransferable::PasteData( TransferableDataHelper& rData, // <-- } - SwTransferable *pTrans=0, *pTunneledTrans=0; - uno::Reference<XUnoTunnel> xTunnel( rData.GetTransferable(), UNO_QUERY ); - if ( xTunnel.is() ) - { - sal_Int64 nHandle = xTunnel->getSomething( getUnoTunnelId() ); - if ( nHandle ) - pTunneledTrans = (SwTransferable*) (sal_IntPtr) nHandle; - } + SwTransferable *pTrans=0, *pTunneledTrans=GetSwTransferable( rData ); +// uno::Reference<XUnoTunnel> xTunnel( rData.GetTransferable(), UNO_QUERY ); +// if ( xTunnel.is() ) +// { +// sal_Int64 nHandle = xTunnel->getSomething( getUnoTunnelId() ); +// if ( nHandle ) +// pTunneledTrans = (SwTransferable*) (sal_IntPtr) nHandle; +// } if( pPt && ( bPasteSelection ? 0 != ( pTrans = pMod->pXSelection ) : 0 != ( pTrans = pMod->pDragDrop) )) @@ -1289,7 +1267,7 @@ int SwTransferable::PasteData( TransferableDataHelper& rData, nRet = pTrans->PrivateDrop( rSh, *pPt, DND_ACTION_MOVE == nDropAction, bPasteSelection ); } - else if( !pPt && ( pTunneledTrans || 0 != ( pTunneledTrans = pMod->pClipboard ) ) && + else if( !pPt && pTunneledTrans && EXCHG_OUT_ACTION_INSERT_PRIVATE == nAction ) { // then internal paste @@ -2816,7 +2794,7 @@ int SwTransferable::PasteFormat( SwWrtShell& rSh, int nRet = 0; ULONG nPrivateFmt = FORMAT_PRIVATE; - SwTransferable *pClipboard = SW_MOD()->pClipboard; + SwTransferable *pClipboard = GetSwTransferable( rData ); if( pClipboard && ((TRNSFR_DOCUMENT|TRNSFR_GRAPHIC|TRNSFR_OLE) & pClipboard->eBufferType )) nPrivateFmt = SOT_FORMATSTR_ID_EMBED_SOURCE; @@ -2912,7 +2890,7 @@ int SwTransferable::PasteSpecial( SwWrtShell& rSh, TransferableDataHelper& rData USHORT nDest = SwTransferable::GetSotDestination( rSh ); - SwTransferable *pClipboard = SW_MOD()->pClipboard; + SwTransferable *pClipboard = GetSwTransferable( rData ); if( pClipboard ) { aDesc = pClipboard->aObjDesc; @@ -2978,7 +2956,8 @@ void SwTransferable::FillClipFmtItem( const SwWrtShell& rSh, SvxClipboardFmtItem & rToFill ) { USHORT nDest = SwTransferable::GetSotDestination( rSh ); - SwTransferable *pClipboard = SW_MOD()->pClipboard; + + SwTransferable *pClipboard = GetSwTransferable( rData ); if( pClipboard ) { USHORT nResId; @@ -3634,6 +3613,22 @@ sal_Int64 SwTransferable::getSomething( const Sequence< sal_Int8 >& rId ) throw( return nRet; } +SwTransferable* SwTransferable::GetSwTransferable( const TransferableDataHelper& rData ) +{ + SwTransferable* pSwTransferable = NULL; + + uno::Reference<XUnoTunnel> xTunnel( rData.GetTransferable(), UNO_QUERY ); + if ( xTunnel.is() ) + { + sal_Int64 nHandle = xTunnel->getSomething( getUnoTunnelId() ); + if ( nHandle ) + pSwTransferable = (SwTransferable*) (sal_IntPtr) nHandle; + } + + return pSwTransferable; + +} + /* */ // ----------------------------------------------------------------------- diff --git a/sw/source/ui/inc/swdtflvr.hxx b/sw/source/ui/inc/swdtflvr.hxx index a239f13f1ec2..041b55d9c6db 100644 --- a/sw/source/ui/inc/swdtflvr.hxx +++ b/sw/source/ui/inc/swdtflvr.hxx @@ -91,6 +91,7 @@ class SwTransferable : public TransferableHelper void DeleteSelection(); // helper methods for the paste + static SwTransferable* GetSwTransferable( const TransferableDataHelper& rData ); static void SetSelInShell( SwWrtShell& , BOOL , const Point* ); static BOOL _CheckForURLOrLNKFile( TransferableDataHelper& rData, String& rFileName, String* pTitle = 0 ); diff --git a/sw/source/ui/uiview/srcview.cxx b/sw/source/ui/uiview/srcview.cxx index c7c52e3f53ff..801ecba22c73 100644 --- a/sw/source/ui/uiview/srcview.cxx +++ b/sw/source/ui/uiview/srcview.cxx @@ -599,15 +599,11 @@ void SwSrcView::GetState(SfxItemSet& rSet) break; case SID_PASTE: { - BOOL bDisable = 0 == SW_MOD()->pClipboard; - if( bDisable ) - { - TransferableDataHelper aDataHelper( - TransferableDataHelper::CreateFromSystemClipboard( - &aEditWin) ); - bDisable = !aDataHelper.GetXTransferable().is() || - 0 == aDataHelper.GetFormatCount(); - } + TransferableDataHelper aDataHelper( + TransferableDataHelper::CreateFromSystemClipboard( + &aEditWin) ); + BOOL bDisable = !aDataHelper.GetXTransferable().is() || + 0 == aDataHelper.GetFormatCount(); if( bDisable ) rSet.DisableItem(nWhich); } |