diff options
author | jp <jp@openoffice.org> | 2001-07-05 14:23:17 +0000 |
---|---|---|
committer | jp <jp@openoffice.org> | 2001-07-05 14:23:17 +0000 |
commit | 2ab2e9bd39f6178016a665be2331150bcba071c7 (patch) | |
tree | 3cf2a5021118ed350534a2c81398dec1c5008533 /sw | |
parent | 19ce22b044f9a311079661131adbee2e27cbcb5e (diff) |
changes for TF_DATA
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/ui/cctrl/popbox.cxx | 50 | ||||
-rw-r--r-- | sw/source/ui/inc/condedit.hxx | 20 | ||||
-rw-r--r-- | sw/source/ui/inc/navipi.hxx | 11 | ||||
-rw-r--r-- | sw/source/ui/inc/popbox.hxx | 19 | ||||
-rw-r--r-- | sw/source/ui/utlui/condedit.cxx | 89 |
5 files changed, 102 insertions, 87 deletions
diff --git a/sw/source/ui/cctrl/popbox.cxx b/sw/source/ui/cctrl/popbox.cxx index 2513e9bb66f6..fd8bdd4c9761 100644 --- a/sw/source/ui/cctrl/popbox.cxx +++ b/sw/source/ui/cctrl/popbox.cxx @@ -2,9 +2,9 @@ * * $RCSfile: popbox.cxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: os $ $Date: 2001-07-05 10:07:03 $ + * last change: $Author: jp $ $Date: 2001-07-05 15:23:17 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -65,18 +65,27 @@ #pragma hdrstop -#include "cmdid.h" -#include "swtypes.hxx" -#include "segmentc.hxx" +#ifndef _CMDID_H +#include <cmdid.h> +#endif +#ifndef _SWTYPES_HXX +#include <swtypes.hxx> +#endif -#include "popbox.hxx" +#ifndef _POPBOX_HXX +#include <popbox.hxx> +#endif +#ifndef _NAVIPI_HXX +#include <navipi.hxx> +#endif // --- class SwHelpToolBox --------------------------------------------- -SwHelpToolBox::SwHelpToolBox( Window* pParent, const ResId& rResId ) : - ToolBox( pParent, rResId ) +SwHelpToolBox::SwHelpToolBox( SwNavigationPI* pParent, const ResId& rResId ) + : ToolBox( pParent, rResId ), + DropTargetHelper( this ) { } @@ -87,9 +96,9 @@ void SwHelpToolBox::MouseButtonDown(const MouseEvent &rEvt) // Dessen Returnwert entscheidet ueber andere Verarbeitung // Doppelclickhandler nur, wenn nicht auf einen Button geclickt wurde if(rEvt.GetButtons() == MOUSE_RIGHT && - 0 == GetItemId(rEvt.GetPosPixel())) { + 0 == GetItemId(rEvt.GetPosPixel())) + { aRightClickLink.Call((MouseEvent *)&rEvt); - return; } else ToolBox::MouseButtonDown(rEvt); @@ -99,7 +108,8 @@ void SwHelpToolBox::MouseButtonDown(const MouseEvent &rEvt) long SwHelpToolBox::DoubleClick( ToolBox* pCaller ) { // kein Doppelklick auf einen Button - if(0 == pCaller->GetCurItemId() && aDoubleClickLink.Call(0)) return TRUE; + if( 0 == pCaller->GetCurItemId() && aDoubleClickLink.Call(0) ) + return TRUE; return FALSE; } @@ -110,16 +120,14 @@ long SwHelpToolBox::DoubleClick( ToolBox* pCaller ) SwHelpToolBox::~SwHelpToolBox() {} +sal_Int8 SwHelpToolBox::AcceptDrop( const AcceptDropEvent& rEvt ) +{ + return ((SwNavigationPI*)GetParent())->AcceptDrop( rEvt ); +} -//BOOL SwHelpToolBox::Drop( const DropEvent& rEvt) -//{ -// return GetParent()->Drop(rEvt); -//} - - -//BOOL SwHelpToolBox::QueryDrop( DropEvent& rEvt) -//{ -// return GetParent()->QueryDrop(rEvt); -//} +sal_Int8 SwHelpToolBox::ExecuteDrop( const ExecuteDropEvent& rEvt ) +{ + return ((SwNavigationPI*)GetParent())->ExecuteDrop( rEvt ); +} diff --git a/sw/source/ui/inc/condedit.hxx b/sw/source/ui/inc/condedit.hxx index f85f495f5084..853a065fa2d9 100644 --- a/sw/source/ui/inc/condedit.hxx +++ b/sw/source/ui/inc/condedit.hxx @@ -2,9 +2,9 @@ * * $RCSfile: condedit.hxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: os $ $Date: 2001-07-05 10:06:18 $ + * last change: $Author: jp $ $Date: 2001-07-05 15:20:38 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -64,23 +64,29 @@ #ifndef _EDIT_HXX //autogen #include <vcl/edit.hxx> #endif +#ifndef _TRANSFER_HXX +#include <svtools/transfer.hxx> +#endif -class DropEvent; /*-------------------------------------------------------------------- Beschreibung: --------------------------------------------------------------------*/ -class ConditionEdit : public Edit +class ConditionEdit : public Edit, public DropTargetHelper { - BOOL bBrackets; + BOOL bBrackets, bEnableDrop; -// virtual BOOL QueryDrop( DropEvent& rEvt ); + virtual sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt ); + virtual sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt ); public: ConditionEdit( Window* pParent, const ResId& rResId ); - inline void ShowBrackets(BOOL bShow) { bBrackets = bShow; } + inline void ShowBrackets(BOOL bShow) { bBrackets = bShow; } + + inline void SetDropEnable( BOOL bFlag ) { bEnableDrop = bFlag; } + inline BOOL IsDropEnable() const { return bEnableDrop; } }; diff --git a/sw/source/ui/inc/navipi.hxx b/sw/source/ui/inc/navipi.hxx index bdc2a6090fef..e432e6588d51 100644 --- a/sw/source/ui/inc/navipi.hxx +++ b/sw/source/ui/inc/navipi.hxx @@ -2,9 +2,9 @@ * * $RCSfile: navipi.hxx,v $ * - * $Revision: 1.6 $ + * $Revision: 1.7 $ * - * last change: $Author: os $ $Date: 2001-07-03 14:55:55 $ + * last change: $Author: jp $ $Date: 2001-07-05 15:20:38 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -183,10 +183,6 @@ protected: virtual BOOL Close(); virtual void Resize(); -// virtual sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt ); -// virtual sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt ); - sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt ); - sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt ); // zum App-Ende rechtzeitig ObjectShellLock loslassen virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); @@ -214,6 +210,9 @@ public: void SetRegionDropMode(USHORT nNewMode); BOOL IsInDrag() const; + sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt ); + sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt ); + BOOL IsGlobalDoc() const; BOOL IsGlobalMode() const {return bGlobalMode;} diff --git a/sw/source/ui/inc/popbox.hxx b/sw/source/ui/inc/popbox.hxx index e6c7e412fc48..47662627e069 100644 --- a/sw/source/ui/inc/popbox.hxx +++ b/sw/source/ui/inc/popbox.hxx @@ -2,9 +2,9 @@ * * $RCSfile: popbox.hxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: os $ $Date: 2001-07-05 10:06:18 $ + * last change: $Author: jp $ $Date: 2001-07-05 15:20:38 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -62,21 +62,26 @@ #define _POPBOX_HXX -#ifndef _TOOLBOX_HXX //autogen +#ifndef _TOOLBOX_HXX #include <vcl/toolbox.hxx> #endif +#ifndef _TRANSFER_HXX +#include <svtools/transfer.hxx> +#endif + +class SwNavigationPI; -class SwHelpToolBox: public ToolBox +class SwHelpToolBox: public ToolBox, public DropTargetHelper { Link aDoubleClickLink; Link aRightClickLink; // Link bekommt MouseEvent als Parameter !!! protected: virtual void MouseButtonDown(const MouseEvent &rEvt); virtual long DoubleClick(ToolBox *); -// virtual BOOL Drop( const DropEvent& rEvt); -// virtual BOOL QueryDrop( DropEvent& rEvt); + virtual sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt ); + virtual sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt ); public: - SwHelpToolBox(Window* pParent, const ResId &); + SwHelpToolBox(SwNavigationPI* pParent, const ResId &); ~SwHelpToolBox(); void SetDoubleClickLink(const Link &); // inline void SetRightClickLink(const Link &); // inline diff --git a/sw/source/ui/utlui/condedit.cxx b/sw/source/ui/utlui/condedit.cxx index c188de0a8724..43826dbe2ef3 100644 --- a/sw/source/ui/utlui/condedit.cxx +++ b/sw/source/ui/utlui/condedit.cxx @@ -2,9 +2,9 @@ * * $RCSfile: condedit.cxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: os $ $Date: 2001-07-05 10:07:03 $ + * last change: $Author: jp $ $Date: 2001-07-05 15:22:34 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -66,12 +66,6 @@ #ifndef _OFF_APP_HXX //autogen #include <offmgr/app.hxx> #endif -#ifndef _SV_EVENT_HXX //autogen -#include <vcl/event.hxx> -#endif -#ifndef _SV_DRAG_HXX //autogen -#include <vcl/drag.hxx> -#endif #ifndef _SOT_FORMATS_HXX //autogen #include <sot/formats.hxx> #endif @@ -88,61 +82,64 @@ Beschreibung: --------------------------------------------------------------------*/ -ConditionEdit::ConditionEdit( Window* pParent, const ResId& rResId ) : - Edit( pParent, rResId ), - bBrackets(TRUE) +ConditionEdit::ConditionEdit( Window* pParent, const ResId& rResId ) + : Edit( pParent, rResId ), + DropTargetHelper( this ), + bBrackets( TRUE ), bEnableDrop( TRUE ) { -// EnableDrop(); } /*-------------------------------------------------------------------- Beschreibung: Drop moeglich, bzw Format bekannt? --------------------------------------------------------------------*/ -/*BOOL ConditionEdit::QueryDrop( DropEvent& rDEvt ) +sal_Int8 ConditionEdit::AcceptDrop( const AcceptDropEvent& rEvt ) { - rDEvt.SetAction(DROP_COPY); - - if (DragServer::HasFormat(0, SOT_FORMATSTR_ID_SBA_FIELDDATAEXCHANGE )) + sal_Int8 nRet = DND_ACTION_NONE; + if( bEnableDrop && ( DND_ACTION_COPY & rEvt.mnAction ) ) { - BOOL bString = FALSE; + DataFlavorExVector& rDFE = GetDataFlavorExVector(); + DataFlavorExVector::iterator aIter( rDFE.begin() ), aEnd( rDFE.end() ); - for (USHORT nItem = 0; nItem < DragServer::GetItemCount(); nItem++) + while( aIter != aEnd ) { - if (DragServer::HasFormat(nItem, FORMAT_STRING)) + if( SOT_FORMATSTR_ID_SBA_FIELDDATAEXCHANGE == (*aIter++).mnSotId ) { - bString = TRUE; - break; + nRet = DND_ACTION_COPY; + aIter = aEnd; } } - if (!bString) // String reinpacken, um DD-Cursor zu erhalten + } + return nRet; +} + +sal_Int8 ConditionEdit::ExecuteDrop( const ExecuteDropEvent& rEvt ) +{ + sal_Int8 nRet = DND_ACTION_NONE; + if( bEnableDrop ) + { + String sTxt; + TransferableDataHelper aData( rEvt.maDropEvent.Transferable ); + if( aData.GetString( SOT_FORMATSTR_ID_SBA_FIELDDATAEXCHANGE, sTxt ) && + sTxt.Len() ) { - if (DragServer::HasFormat(0, SOT_FORMATSTR_ID_SBA_FIELDDATAEXCHANGE)) - { - USHORT nLen = (USHORT)DragServer::GetDataLen(0, SOT_FORMATSTR_ID_SBA_FIELDDATAEXCHANGE) - 1; - DBG_ASSERT(!(nLen%2), "not a UniString") - String sTxt; - sal_Unicode *pTxt = sTxt.AllocBuffer(nLen / 2); - - DragServer::PasteData(0, pTxt, nLen, SOT_FORMATSTR_ID_SBA_FIELDDATAEXCHANGE); - - String sDBName; - if (bBrackets) - sDBName += '['; - sDBName += sTxt.GetToken(0, DB_DD_DELIM); - sDBName += '.'; - sDBName += sTxt.GetToken(1, DB_DD_DELIM); - sDBName += '.'; - sDBName += sTxt.GetToken(3, DB_DD_DELIM); // ColumnName - if (bBrackets) - sDBName += ']'; - DragServer::CopyString(sDBName); - } + String sDBName; + if (bBrackets) + sDBName += '['; + sDBName += sTxt.GetToken(0, DB_DD_DELIM); + sDBName += '.'; + sDBName += sTxt.GetToken(1, DB_DD_DELIM); + sDBName += '.'; + sDBName += sTxt.GetToken(3, DB_DD_DELIM); // ColumnName + if (bBrackets) + sDBName += ']'; + + SetText( sDBName ); + + nRet = DND_ACTION_COPY; } } - - return Edit::QueryDrop( rDEvt ); + return nRet; } -*/ |