summaryrefslogtreecommitdiff
path: root/sfx2
diff options
context:
space:
mode:
authorgt <gt@openoffice.org>2001-09-05 06:59:33 +0000
committergt <gt@openoffice.org>2001-09-05 06:59:33 +0000
commit13a3ac4b9b4d2b8274624a318c9f199fae8a82b7 (patch)
tree0a37378cd810705e0334665d77d62d2a0702efa1 /sfx2
parentda96df7606a1bbad1b874a0376c39482f809727e (diff)
#90729# ExecuteDrop asynchronous and enabled DEL-key
Diffstat (limited to 'sfx2')
-rw-r--r--sfx2/source/dialog/templdlg.cxx58
-rw-r--r--sfx2/source/inc/templdgi.hxx15
2 files changed, 57 insertions, 16 deletions
diff --git a/sfx2/source/dialog/templdlg.cxx b/sfx2/source/dialog/templdlg.cxx
index 63c7c0284b89..10938944c3e8 100644
--- a/sfx2/source/dialog/templdlg.cxx
+++ b/sfx2/source/dialog/templdlg.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: templdlg.cxx,v $
*
- * $Revision: 1.10 $
+ * $Revision: 1.11 $
*
- * last change: $Author: mba $ $Date: 2001-08-15 16:47:49 $
+ * last change: $Author: gt $ $Date: 2001-09-05 07:58:46 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -287,6 +287,9 @@ sal_Int8 DropListBox_Impl::AcceptDrop( const AcceptDropEvent& rEvt )
sal_Int8 DropListBox_Impl::ExecuteDrop( const ExecuteDropEvent& rEvt )
{
+// rEvt.maDropEvent.Context->acceptDrop( DND_ACTION_NONE );
+// rEvt.maDropEvent.Context->dropComplete( TRUE );
+
sal_Int8 nRet = DND_ACTION_NONE;
SfxObjectShell* pDocShell = pDialog->GetObjectShell();
TransferableDataHelper aHelper( rEvt.maDropEvent.Transferable );
@@ -309,13 +312,7 @@ sal_Int8 DropListBox_Impl::ExecuteDrop( const ExecuteDropEvent& rEvt )
if ( pEntry && pEntry != pPreDropEntry )
ShowTargetEmphasis( pEntry, FALSE );
- if ( pEntry )
- {
- pDialog->SelectStyle( GetEntryText( pEntry ) );
- pDialog->ActionSelect( SID_STYLE_UPDATE_BY_EXAMPLE );
- }
- else
- pDialog->ActionSelect( SID_STYLE_NEW_BY_EXAMPLE );
+ PostUserEvent( LINK( this, DropListBox_Impl, OnAsyncExecuteDrop ), pEntry );
bFormatFound = sal_True;
nRet = rEvt.mnAction;
@@ -325,13 +322,52 @@ sal_Int8 DropListBox_Impl::ExecuteDrop( const ExecuteDropEvent& rEvt )
}
if ( !bFormatFound )
- ErrorHandler::HandleError( ERRCODE_IO_WRONGFORMAT );
+ PostUserEvent( LINK( this, DropListBox_Impl, OnAsyncExecuteError ) );
}
-
return nRet;
}
+
+IMPL_LINK( DropListBox_Impl, OnAsyncExecuteDrop, SvLBoxEntry*, pEntry )
+{
+ if ( pEntry )
+ {
+ pDialog->SelectStyle( GetEntryText( pEntry ) );
+ pDialog->ActionSelect( SID_STYLE_UPDATE_BY_EXAMPLE );
+ }
+ else
+ pDialog->ActionSelect( SID_STYLE_NEW_BY_EXAMPLE );
+
+ return 0;
+}
+
+
+IMPL_LINK( DropListBox_Impl, OnAsyncExecuteError, void*, NOTINTERESTEDIN )
+{
+ ErrorHandler::HandleError( ERRCODE_IO_WRONGFORMAT );
+
+ return 0;
+}
+
+
+long DropListBox_Impl::Notify( NotifyEvent& rNEvt )
+{
+ if( pDialog->bCanDel && rNEvt.GetType() == EVENT_KEYINPUT )
+ {
+ const KeyCode& rKeyCode = rNEvt.GetKeyEvent()->GetKeyCode();
+
+ if( KEY_DELETE == rKeyCode.GetCode() && !rKeyCode.GetModifier() )
+ {
+ pDialog->DeleteHdl( NULL );
+ return 1;
+ }
+ }
+
+ return SvTreeListBox::Notify( rNEvt );
+}
+
+
//-------------------------------------------------------------------------
diff --git a/sfx2/source/inc/templdgi.hxx b/sfx2/source/inc/templdgi.hxx
index c8a903ae0db2..df4eb28af94e 100644
--- a/sfx2/source/inc/templdgi.hxx
+++ b/sfx2/source/inc/templdgi.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: templdgi.hxx,v $
*
- * $Revision: 1.4 $
+ * $Revision: 1.5 $
*
- * last change: $Author: dv $ $Date: 2001-07-26 12:09:13 $
+ * last change: $Author: gt $ $Date: 2001-09-05 07:59:33 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -107,6 +107,9 @@ class SfxDockingWindow;
class DropListBox_Impl : public SvTreeListBox
{
+private:
+ DECL_LINK( OnAsyncExecuteDrop, SvLBoxEntry* );
+ DECL_LINK( OnAsyncExecuteError, void* );
protected:
SvLBoxEntry* pPreDropEntry;
SfxCommonTemplateDialog_Impl* pDialog;
@@ -120,12 +123,14 @@ public:
SvTreeListBox( pParent, nWinBits ), pDialog( pD ), pPreDropEntry( NULL )
{}
- virtual void MouseButtonDown( const MouseEvent& rMEvt );
+ virtual void MouseButtonDown( const MouseEvent& rMEvt );
virtual sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt );
virtual sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt );
- USHORT GetModifier() const { return nModifier; }
- SvLBoxEntry* GetPreDropEntry() const { return pPreDropEntry; }
+ USHORT GetModifier() const { return nModifier; }
+ SvLBoxEntry* GetPreDropEntry() const { return pPreDropEntry; }
+
+ virtual long Notify( NotifyEvent& rNEvt );
};
// class SfxActionListBox ------------------------------------------------