#92083# Add cut/copy/Form... to control's context menu

This commit is contained in:
Thomas Benisch 2001-10-17 09:17:18 +00:00
parent 164b4c6569
commit 612e021fc6
7 changed files with 140 additions and 38 deletions

View File

@ -2,9 +2,9 @@
*
* $RCSfile: basidesh.hrc,v $
*
* $Revision: 1.3 $
* $Revision: 1.4 $
*
* last change: $Author: tbe $ $Date: 2001-08-03 15:13:19 $
* last change: $Author: tbe $ $Date: 2001-10-17 10:10:54 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@ -96,6 +96,7 @@
#define RID_DLG_LIBS ( RID_BASICIDE_START + 40 )
#define RID_IMG_LOCKED ( RID_BASICIDE_START + 41 )
#define RID_DLG_NEWLIB ( RID_BASICIDE_START + 42 )
#define RID_POPUP_DLGED ( RID_BASICIDE_START + 62 )
#define RID_STR_CANNOTCLOSE ( RID_BASICIDE_START + 13 )
#define RID_STR_IDENAME ( RID_BASICIDE_START + 14 )

View File

@ -2,9 +2,9 @@
*
* $RCSfile: baside3.cxx,v $
*
* $Revision: 1.18 $
* $Revision: 1.19 $
*
* last change: $Author: tbe $ $Date: 2001-09-25 09:08:45 $
* last change: $Author: tbe $ $Date: 2001-10-17 10:12:29 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@ -94,6 +94,10 @@
#include <idetemp.hxx>
#include <helpid.hrc>
#ifndef _SVDVIEW_HXX
#include <svx/svdview.hxx>
#endif
#ifndef _COMPHELPER_PROCESSFACTORY_HXX_
#include <comphelper/processfactory.hxx>
#endif
@ -237,6 +241,17 @@ void DialogWindow::Command( const CommandEvent& rCEvt )
{
HandleScrollCommand( rCEvt, GetHScrollBar(), GetVScrollBar() );
}
else if ( rCEvt.GetCommand() == COMMAND_CONTEXTMENU )
{
Point aPos( rCEvt.IsMouseEvent() ? rCEvt.GetMousePosPixel() : Point(1,1) );
BasicIDEShell* pIDEShell = IDE_DLL()->GetShell();
SfxViewFrame* pViewFrame = pIDEShell ? pIDEShell->GetViewFrame() : NULL;
SfxDispatcher* pDispatcher = pViewFrame ? pViewFrame->GetDispatcher() : NULL;
if ( pDispatcher )
{
pDispatcher->ExecutePopup( IDEResId(RID_POPUP_DLGED), this, &aPos );
}
}
else
IDEBaseWindow::Command( rCEvt );
}
@ -282,13 +297,19 @@ void __EXPORT DialogWindow::GetState( SfxItemSet& rSet )
switch ( nWh )
{
case SID_PASTE:
{
if ( !pEditor->IsPasteAllowed() )
rSet.DisableItem( nWh );
}
break;
case SID_CUT:
case SID_COPY:
case SID_DELETE:
case SID_BACKSPACE:
{
// Object selektiert?
// any object selected?
if ( !pEditor->GetView()->HasMarkedObj() )
rSet.DisableItem( nWh );
}
break;
case SID_REDO:

View File

@ -2,9 +2,9 @@
*
* $RCSfile: basidesh.cxx,v $
*
* $Revision: 1.16 $
* $Revision: 1.17 $
*
* last change: $Author: tbe $ $Date: 2001-10-10 16:22:03 $
* last change: $Author: tbe $ $Date: 2001-10-17 10:12:29 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@ -136,6 +136,7 @@ SFX_IMPL_INTERFACE( BasicIDEShell, SfxViewShell, IDEResId( RID_STR_IDENAME ) )
| SFX_VISIBILITY_FULLSCREEN | SFX_VISIBILITY_CLIENT, IDEResId( RID_BASICIDE_OBJECTBAR ) );
SFX_CHILDWINDOW_REGISTRATION( SID_SEARCH_DLG );
SFX_FEATURED_CHILDWINDOW_REGISTRATION(SID_SHOW_BROWSER, BASICIDE_UI_FEATURE_SHOW_BROWSER);
SFX_POPUPMENU_REGISTRATION( IDEResId( RID_POPUP_DLGED ) );
}

View File

@ -2,9 +2,9 @@
*
* $RCSfile: basidesh.src,v $
*
* $Revision: 1.41 $
* $Revision: 1.42 $
*
* last change: $Author: kz $ $Date: 2001-10-11 21:15:36 $
* last change: $Author: tbe $ $Date: 2001-10-17 10:12:29 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@ -2784,6 +2784,20 @@ Menu RID_POPUP_TABBAR
};
};
};
Menu RID_POPUP_DLGED
{
DefaultItemId = SID_SHOW_BROWSER ;
ItemList =
{
MenuItem
{
Identifier = SID_SHOW_BROWSER ;
HelpId = SID_SHOW_BROWSER ;
Text = "Eigenschaften..." ;
Text [ ENGLISH ] = "Properties..." ;
};
};
};
ImageList RID_IMGLST_OBJECTS
{
ImageBitmap = Bitmap { FILE = "images.bmp" ; };

View File

@ -2,9 +2,9 @@
*
* $RCSfile: dlged.cxx,v $
*
* $Revision: 1.17 $
* $Revision: 1.18 $
*
* last change: $Author: tbe $ $Date: 2001-09-25 11:06:10 $
* last change: $Author: tbe $ $Date: 2001-10-17 10:14:13 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@ -83,6 +83,13 @@
#include "dlgedclip.hxx"
#endif
#ifndef _BASCTL_DLGEDDEF_HXX
#include <dlgeddef.hxx>
#endif
#include <basidesh.hxx>
#include <iderdll.hxx>
#ifndef _SV_SCRBAR_HXX
#include <vcl/scrbar.hxx>
#endif
@ -95,6 +102,22 @@
#include <svtools/itempool.hxx>
#endif
#ifndef _SFXVIEWFRM_HXX
#include <sfx2/viewfrm.hxx>
#endif
#ifndef _SVX_SVXIDS_HRC
#include <svx/svxids.hrc>
#endif
#ifndef _XMLSCRIPT_XML_HELPER_HXX_
#include <xmlscript/xml_helper.hxx>
#endif
#ifndef _XMLSCRIPT_XMLDLG_IMEXP_HXX_
#include <xmlscript/xmldlg_imexp.hxx>
#endif
#ifndef _COM_SUN_STAR_BEANS_PROPERTYVALUE_HPP_
#include <com/sun/star/beans/PropertyValue.hpp>
#endif
@ -119,18 +142,6 @@
#include <comphelper/processfactory.hxx>
#endif
#ifndef _XMLSCRIPT_XML_HELPER_HXX_
#include <xmlscript/xml_helper.hxx>
#endif
#ifndef _XMLSCRIPT_XMLDLG_IMEXP_HXX_
#include <xmlscript/xmldlg_imexp.hxx>
#endif
#ifndef _BASCTL_DLGEDDEF_HXX
#include <dlgeddef.hxx>
#endif
using namespace comphelper;
using namespace ::com::sun::star;
@ -827,6 +838,42 @@ void DlgEditor::Delete()
//----------------------------------------------------------------------------
BOOL DlgEditor::IsPasteAllowed() const
{
BOOL bIsPasteAllowed = FALSE;
// get clipboard
Reference< datatransfer::clipboard::XClipboard > xClipboard = GetWindow()->GetClipboard();
if ( xClipboard.is() )
{
// get clipboard content
const sal_uInt32 nRef = Application::ReleaseSolarMutex();
Reference< datatransfer::XTransferable > xTransf = xClipboard->getContents();
Application::AcquireSolarMutex( nRef );
if ( xTransf.is() )
{
if ( xTransf->isDataFlavorSupported( m_ClipboardDataFlavors[0] ) )
{
bIsPasteAllowed = TRUE;
}
}
}
return bIsPasteAllowed;
}
//----------------------------------------------------------------------------
void DlgEditor::ShowProperties()
{
BasicIDEShell* pIDEShell = IDE_DLL()->GetShell();
SfxViewFrame* pViewFrame = pIDEShell ? pIDEShell->GetViewFrame() : NULL;
if ( pViewFrame && !pViewFrame->HasChildWindow( SID_SHOW_BROWSER ) )
pViewFrame->ToggleChildWindow( SID_SHOW_BROWSER );
}
//----------------------------------------------------------------------------
BOOL DlgEditor::IsModified() const
{
return pSdrModel->IsChanged() || bDialogModelChanged;

View File

@ -2,9 +2,9 @@
*
* $RCSfile: dlgedfunc.cxx,v $
*
* $Revision: 1.4 $
* $Revision: 1.5 $
*
* last change: $Author: tbe $ $Date: 2001-04-10 15:14:45 $
* last change: $Author: tbe $ $Date: 2001-10-17 10:14:13 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@ -83,6 +83,7 @@
#include <vcl/seleng.hxx>
#endif
//----------------------------------------------------------------------------
IMPL_LINK_INLINE_START( DlgEdFunc, ScrollTimeout, Timer *, pTimer )
@ -230,18 +231,26 @@ BOOL DlgEdFuncInsert::MouseButtonDown( const MouseEvent& rMEvt )
#endif
pWindow->CaptureMouse();
SdrHdl* pHdl = pView->HitHandle(aPos, *pWindow);
if ( rMEvt.IsLeft() && rMEvt.GetClicks() == 1 )
{
SdrHdl* pHdl = pView->HitHandle(aPos, *pWindow);
// if selected object was hit, drag object
if ( pHdl!=NULL || pView->IsMarkedHit(aPos, nHitLog) )
pView->BegDragObj(aPos, (OutputDevice*) NULL, pHdl, nDrgLog);
else
if ( pView->HasMarkedObj() )
pView->UnmarkAll();
// if selected object was hit, drag object
if ( pHdl!=NULL || pView->IsMarkedHit(aPos, nHitLog) )
pView->BegDragObj(aPos, (OutputDevice*) NULL, pHdl, nDrgLog);
else if ( pView->HasMarkedObj() )
pView->UnmarkAll();
// if no action, create object
if ( rMEvt.IsLeft() && !pView->IsAction() )
pView->BegCreateObj(aPos);
// if no action, create object
if ( !pView->IsAction() )
pView->BegCreateObj(aPos);
}
else if ( rMEvt.IsLeft() && rMEvt.GetClicks() == 2 )
{
// if object was hit, show property browser
if ( pView->IsMarkedHit(aPos, nHitLog) )
pParent->ShowProperties();
}
return TRUE;
}
@ -349,7 +358,7 @@ BOOL DlgEdFuncSelect::MouseButtonDown( const MouseEvent& rMEvt )
USHORT nHitLog = USHORT ( pWindow->PixelToLogic(Size(3,0)).Width() );
Point aMDPos = pWindow->PixelToLogic( rMEvt.GetPosPixel() );
if ( rMEvt.IsLeft() )
if ( rMEvt.IsLeft() && rMEvt.GetClicks() == 1 )
{
#ifdef MAC
pWindow->GrabFocus();
@ -393,6 +402,12 @@ BOOL DlgEdFuncSelect::MouseButtonDown( const MouseEvent& rMEvt )
}
}
}
else if ( rMEvt.IsLeft() && rMEvt.GetClicks() == 2 )
{
// if object was hit, show property browser
if ( pView->IsMarkedHit(aMDPos, nHitLog) )
pParent->ShowProperties();
}
return TRUE;
}

View File

@ -2,9 +2,9 @@
*
* $RCSfile: dlged.hxx,v $
*
* $Revision: 1.7 $
* $Revision: 1.8 $
*
* last change: $Author: tbe $ $Date: 2001-09-25 11:05:22 $
* last change: $Author: tbe $ $Date: 2001-10-17 10:17:18 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@ -179,6 +179,9 @@ public:
void Copy();
void Paste();
void Delete();
BOOL IsPasteAllowed() const;
void ShowProperties();
void PrintData( Printer*, const String& rTitle ); // not working yet
};