added clipboard controller

This commit is contained in:
Kai Ahrens 2001-04-25 07:39:16 +00:00
parent e5c425df5b
commit 00e0813206
4 changed files with 46 additions and 20 deletions

View file

@ -2,9 +2,9 @@
*
* $RCSfile: drviews7.cxx,v $
*
* $Revision: 1.11 $
* $Revision: 1.12 $
*
* last change: $Author: ka $ $Date: 2001-04-24 10:15:59 $
* last change: $Author: ka $ $Date: 2001-04-25 08:39:16 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@ -515,6 +515,7 @@ void __EXPORT SdDrawViewShell::GetMenuState( SfxItemSet &rSet )
if( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_CONTEXT ) )
rSet.Put( SfxStringItem( SID_CONTEXT, pDrView->GetStatusText() ) );
// clipboard (paste)
if( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_PASTE ) ||
SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_PASTE2 ) ||
SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_CLIPBOARD_FORMAT_ITEMS ) )
@ -525,6 +526,7 @@ void __EXPORT SdDrawViewShell::GetMenuState( SfxItemSet &rSet )
{
rSet.DisableItem( SID_PASTE );
rSet.DisableItem( SID_PASTE2 );
rSet.DisableItem( SID_CLIPBOARD_FORMAT_ITEMS );
}
else if( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_CLIPBOARD_FORMAT_ITEMS ) )
{
@ -553,8 +555,7 @@ void __EXPORT SdDrawViewShell::GetMenuState( SfxItemSet &rSet )
if( aTestFormat == aSupportedFormats[ n ] )
{
if( ( SOT_FORMATSTR_ID_EMBED_SOURCE == aTestFormat ) ||
( SOT_FORMATSTR_ID_EMBED_SOURCE == aTestFormat ) ||
( SOT_FORMATSTR_ID_EDITENGINE == aTestFormat ) )
( SOT_FORMATSTR_ID_EMBED_SOURCE == aTestFormat ) )
{
aItem.AddClipbrdFormat( aTestFormat );
}
@ -993,6 +994,7 @@ void __EXPORT SdDrawViewShell::GetMenuState( SfxItemSet &rSet )
{
rSet.DisableItem( SID_PASTE );
rSet.DisableItem( SID_PASTE2 );
rSet.DisableItem( SID_CLIPBOARD_FORMAT_ITEMS );
rSet.DisableItem( SID_INSERT_GRAPHIC );
rSet.DisableItem( SID_INSERT_DIAGRAM );
rSet.DisableItem( SID_INSERT_OBJECT );

View file

@ -2,9 +2,9 @@
*
* $RCSfile: drviewse.cxx,v $
*
* $Revision: 1.8 $
* $Revision: 1.9 $
*
* last change: $Author: dl $ $Date: 2001-03-12 07:54:26 $
* last change: $Author: ka $ $Date: 2001-04-25 08:39:16 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@ -708,6 +708,30 @@ void SdDrawViewShell::FuSupport(SfxRequest& rReq)
}
break;
case SID_CLIPBOARD_FORMAT_ITEMS:
{
WaitObject aWait( (Window*)GetActiveWindow() );
TransferableDataHelper aDataHelper( TransferableDataHelper::CreateFromSystemClipboard() );
const SfxItemSet* pReqArgs = rReq.GetArgs();
UINT32 nFormat = 0;
if( pReqArgs )
{
SFX_REQUEST_ARG( rReq, pIsActive, SfxUInt32Item, SID_CLIPBOARD_FORMAT_ITEMS, FALSE );
nFormat = pIsActive->GetValue();
}
if( nFormat && aDataHelper.GetTransferable().is() )
{
sal_Int8 nAction = DND_ACTION_COPY;
pDrView->InsertData( aDataHelper,
pWindow->PixelToLogic( Rectangle( Point(), pWindow->GetOutputSizePixel() ).Center() ),
nAction, FALSE, nFormat );
}
}
break;
case SID_DELETE:
{
if ( pDrView->IsTextEdit() )

View file

@ -2,9 +2,9 @@
*
* $RCSfile: sdview2.cxx,v $
*
* $Revision: 1.10 $
* $Revision: 1.11 $
*
* last change: $Author: dl $ $Date: 2001-04-18 13:31:22 $
* last change: $Author: ka $ $Date: 2001-04-25 08:39:16 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@ -424,7 +424,7 @@ void __EXPORT SdView::DoPaste( Window* pWindow )
{
sal_Int8 nDnDAction = DND_ACTION_COPY;
if( !InsertData( aDataHelper.GetTransferable(), aPos, nDnDAction, FALSE ) )
if( !InsertData( aDataHelper, aPos, nDnDAction, FALSE ) )
{
SdDrawViewShell* pDrViewSh = (SdDrawViewShell*) pDocSh->GetViewShell();
@ -722,17 +722,17 @@ sal_Int8 SdView::ExecuteDrop( const ExecuteDropEvent& rEvt, SdWindow* pWin, USHO
if( !bIsInsideOutlinerView )
{
Point aPos;
SdDrawViewShell* pDrViewSh = (SdDrawViewShell*) pDocSh->GetViewShell();
SdrPage* pPage = NULL;
Point aPos;
SdDrawViewShell* pDrViewSh = (SdDrawViewShell*) pDocSh->GetViewShell();
SdrPage* pPage = NULL;
TransferableDataHelper aDataHelper( rEvt.maDropEvent.Transferable );
if( pWin )
aPos = pWin->PixelToLogic( rEvt.maPosPixel );
//!!!DND if( !( bReturn = FmFormView::Drop(rMEvt, pWin) ) ) )
if( !InsertData( rEvt.maDropEvent.Transferable, aPos, nDropAction, TRUE, 0, nPage, nLayer ) && pViewSh )
if( !InsertData( aDataHelper, aPos, nDropAction, TRUE, 0, nPage, nLayer ) && pViewSh )
{
TransferableDataHelper aDataHelper( rEvt.maDropEvent.Transferable );
String aTmpString1, aTmpString2;
INetBookmark aINetBookmark( aTmpString1, aTmpString2 );

View file

@ -2,9 +2,9 @@
*
* $RCSfile: sdview3.cxx,v $
*
* $Revision: 1.15 $
* $Revision: 1.16 $
*
* last change: $Author: ka $ $Date: 2001-04-03 13:55:29 $
* last change: $Author: ka $ $Date: 2001-04-25 08:39:16 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@ -180,7 +180,7 @@ using namespace ::com::sun::star::datatransfer::clipboard;
|*
\************************************************************************/
BOOL SdView::InsertData( const Reference< XTransferable >& rxTransferable,
BOOL SdView::InsertData( const TransferableDataHelper& rDataHelper,
const Point& rPos, sal_Int8& rDnDAction, BOOL bDrag,
ULONG nFormat, USHORT nPage, USHORT nLayer )
{
@ -188,7 +188,7 @@ BOOL SdView::InsertData( const Reference< XTransferable >& rxTransferable,
nAction = rDnDAction;
bIsDropAllowed = FALSE;
TransferableDataHelper aDataHelper( rxTransferable );
TransferableDataHelper aDataHelper( rDataHelper );
SdrObject* pPickObj = NULL;
SdPage* pPage = NULL;
SdWindow* pWin = pViewSh->GetActiveWindow();
@ -213,8 +213,8 @@ BOOL SdView::InsertData( const Reference< XTransferable >& rxTransferable,
pPage = (SdPage*) pDoc->GetPage( nPage );
// !!!Clipboard
SdTransferable* pOwnData = ( SD_MOD()->pTransferClip == (SdTransferable*) rxTransferable.get() ) ? SD_MOD()->pTransferClip :
( ( SD_MOD()->pTransferDrag == (SdTransferable*) rxTransferable.get() ) ? SD_MOD()->pTransferDrag : NULL );
SdTransferable* pOwnData = ( SD_MOD()->pTransferClip == (SdTransferable*) aDataHelper.GetTransferable().get() ) ? SD_MOD()->pTransferClip :
( ( SD_MOD()->pTransferDrag == (SdTransferable*) aDataHelper.GetTransferable().get() ) ? SD_MOD()->pTransferDrag : NULL );
if( !pOwnData )
{