summaryrefslogtreecommitdiff
path: root/sfx2
diff options
context:
space:
mode:
authorPeter Burow <pb@openoffice.org>2001-06-18 08:54:01 +0000
committerPeter Burow <pb@openoffice.org>2001-06-18 08:54:01 +0000
commit052d33c7428c6c2e8a96fd8dcbb020658c4471cc (patch)
treee491983e6db7891db49ab59cdee91e7586345945 /sfx2
parentb17410068799aa23866ef0b430d82501bbdad29c (diff)
fix: #88014# new d&d
Diffstat (limited to 'sfx2')
-rw-r--r--sfx2/inc/docvor.hxx22
-rw-r--r--sfx2/source/doc/docvor.cxx314
2 files changed, 223 insertions, 113 deletions
diff --git a/sfx2/inc/docvor.hxx b/sfx2/inc/docvor.hxx
index a3568128ffdc..dd57433f88fa 100644
--- a/sfx2/inc/docvor.hxx
+++ b/sfx2/inc/docvor.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: docvor.hxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: mba $ $Date: 2000-12-08 14:58:49 $
+ * last change: $Author: pb $ $Date: 2001-06-18 09:52:42 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -97,7 +97,6 @@ friend class SfxOrganizeDlg_Impl;
protected:
virtual BOOL EditingEntry( SvLBoxEntry* pEntry, Selection & );
virtual BOOL EditedEntry( SvLBoxEntry* pEntry, const String& rNewText );
- virtual BOOL NotifyQueryDrop(SvLBoxEntry *);
virtual BOOL NotifyMoving(SvLBoxEntry *pSource,
SvLBoxEntry* pTarget,
SvLBoxEntry *&pNewParent, ULONG &);
@@ -106,12 +105,23 @@ protected:
SvLBoxEntry *&pNewParent, ULONG &);
virtual void RequestingChilds( SvLBoxEntry* pParent );
virtual long ExpandingHdl();
- virtual BOOL Drop( const DropEvent& rEvt );
- virtual BOOL QueryDrop( DropEvent& rEvt );
- virtual DragDropMode NotifyBeginDrag(SvLBoxEntry *);
virtual BOOL Select( SvLBoxEntry* pEntry, BOOL bSelect=TRUE );
virtual void Command( const CommandEvent& rCEvt );
+#ifndef TF_SVDATA
+ // old d&d
+ virtual DragDropMode NotifyBeginDrag(SvLBoxEntry *);
+ virtual BOOL NotifyQueryDrop(SvLBoxEntry *);
+ virtual BOOL QueryDrop( DropEvent& rEvt );
+ virtual BOOL Drop( const DropEvent& rEvt );
+#else
+ // new d&d
+ virtual DragDropMode NotifyStartDrag( TransferDataContainer&, SvLBoxEntry* );
+ virtual BOOL NotifyAcceptDrop( SvLBoxEntry* );
+ virtual sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt );
+ virtual sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt );
+#endif
+
public:
enum DataEnum {
VIEW_TEMPLATES,
diff --git a/sfx2/source/doc/docvor.cxx b/sfx2/source/doc/docvor.cxx
index 13ef2799ebf4..f7330ce8183f 100644
--- a/sfx2/source/doc/docvor.cxx
+++ b/sfx2/source/doc/docvor.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: docvor.cxx,v $
*
- * $Revision: 1.7 $
+ * $Revision: 1.8 $
*
- * last change: $Author: dv $ $Date: 2001-04-05 14:01:54 $
+ * last change: $Author: pb $ $Date: 2001-06-18 09:54:01 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -73,9 +73,11 @@
#ifndef _SV_MSGBOX_HXX //autogen
#include <vcl/msgbox.hxx>
#endif
+#ifndef TF_SVDATA
#ifndef _SV_DRAG_HXX //autogen
#include <vcl/drag.hxx>
#endif
+#endif
#ifndef _SV_PRINT_HXX //autogen
#include <vcl/print.hxx>
#endif
@@ -104,9 +106,6 @@
#include "sfxtypes.hxx"
#include "app.hxx"
#include "dispatch.hxx"
-#if SUPD<613//MUSTINI
-#include "inimgr.hxx"
-#endif
#include "sfxresid.hxx"
#include "iodlg.hxx"
#include "doc.hrc"
@@ -122,7 +121,7 @@
#endif
static const char cDelim = ':';
-BOOL SfxOrganizeListBox_Impl::bDropMoveOk=TRUE;
+BOOL SfxOrganizeListBox_Impl::bDropMoveOk = TRUE;
//=========================================================================
@@ -419,7 +418,7 @@ Path::Path(SvLBox *pBox, SvLBoxEntry *pEntry) :
return;
SvLBoxEntry *pParent = pBox->GetParent(pEntry);
do {
- pData->aUS.Insert(pBox->GetModel()->GetRelPos(pEntry), 0);
+ pData->aUS.Insert((USHORT)pBox->GetModel()->GetRelPos(pEntry), 0);
if(0 == pParent)
break;
pEntry = pParent;
@@ -451,67 +450,6 @@ void SfxOrganizeListBox_Impl::Command( const CommandEvent& rCEvt )
SvTreeListBox::Command(rCEvt);
}
-BOOL SfxOrganizeListBox_Impl::NotifyQueryDrop(SvLBoxEntry *pEntry)
-
-/* [Beschreibung]
-
- QueryDrop-Handler (SV); Funktionsweise kann der Wahrheits,
- tabelle unten entnommen werden.
-
-
- B D C1 C2 C3
-
- Quelle 0 1 2 3 4
- Ziel
- 0 - +*** - - -
- 1 - +*** [-]* + -
- 2 - - [-] p=p +** -
- 3 - - - p=p +** p=p && pp=pp +
- 4 - - - - p=p && pp=pp +
- ----
- * Problem Move; logische Bereiche koennen nicht geloescht werden
- ** p = Parent -> p=p: identische Parents
- pp = ParentParent
- *** geht bei Vorlagen
-*/
-{
- if(!pEntry)
- return FALSE;
- SvLBox *pSource = GetSourceView();
- SvLBoxEntry *pSourceEntry = pSource->FirstSelected();
- if(pEntry == pSourceEntry)
- return FALSE;
- USHORT nSourceLevel = pSource->GetModel()->GetDepth(pSourceEntry);
- if(VIEW_FILES == ((SfxOrganizeListBox_Impl *)pSource)->GetViewType())
- ++nSourceLevel;
- USHORT nTargetLevel = GetModel()->GetDepth(pEntry);
- if(VIEW_FILES == GetViewType())
- ++nTargetLevel;
- Path aSource(pSource, pSourceEntry);
- Path aTarget(this, pEntry);
- const USHORT SL = ((SfxOrganizeListBox_Impl *)pSource)->GetDocLevel();
- const USHORT TL = GetDocLevel();
-
- return( (nSourceLevel == 1 && nTargetLevel == 0 &&
- VIEW_TEMPLATES ==
- ((SfxOrganizeListBox_Impl *)pSource)->GetViewType()) ||
- (nSourceLevel == 1 && nTargetLevel == 1 &&
- VIEW_TEMPLATES ==
- ((SfxOrganizeListBox_Impl *)pSource)->GetViewType() &&
- VIEW_TEMPLATES == GetViewType()) ||
- (nSourceLevel == 3 && nTargetLevel == 1) ||
- (nSourceLevel == 3 && nTargetLevel == 2 &&
- aSource[1+SL] == aTarget[1+TL]) ||
- (nSourceLevel == 3 && nTargetLevel == 3 &&
- aSource[1+SL] == aTarget[1+TL]) ||
- (nSourceLevel == 4 && nTargetLevel == 3 &&
- aSource[1+SL] == aTarget[1+TL] &&
- aSource[2+SL] == aTarget[2+TL]) ||
- (nSourceLevel == 4 && nTargetLevel == 4 &&
- aSource[1+SL] == aTarget[1+TL] &&
- aSource[2+SL] == aTarget[2+TL]));
-}
-
//-------------------------------------------------------------------------
SvLBoxEntry *GetIndices_Impl(SvLBox *pBox,
@@ -573,29 +511,6 @@ BOOL SfxOrganizeListBox_Impl::Select( SvLBoxEntry* pEntry, BOOL bSelect )
return SvTreeListBox::Select(pEntry,bSelect);
}
-DragDropMode SfxOrganizeListBox_Impl::NotifyBeginDrag(SvLBoxEntry *pSourceEntry)
-/* [Beschreibung]
-
- Was fuer DragActions sind an dieser Stelle erlaubt.
- Fuer Dokumentinhalte darf nur kopiert, nicht verschoben werden.
-*/
-{
- USHORT nSourceLevel = GetModel()->GetDepth(pSourceEntry);
- if(VIEW_FILES == GetViewType())
- ++nSourceLevel;
- if(nSourceLevel>=2)
- {
- bDropMoveOk=FALSE;
- return GetDragDropMode();
- }
- else
- {
- bDropMoveOk=TRUE;
- return GetDragDropMode();
- }
-
-}
-
//-------------------------------------------------------------------------
BOOL SfxOrganizeListBox_Impl::IsStandard_Impl( SvLBoxEntry *pEntry) const
@@ -1037,6 +952,124 @@ BOOL SfxOrganizeListBox_Impl::EditedEntry(SvLBoxEntry* pEntry, const String& rTe
//-------------------------------------------------------------------------
+#ifndef TF_SVDATA
+
+DragDropMode SfxOrganizeListBox_Impl::NotifyBeginDrag(SvLBoxEntry *pSourceEntry)
+/* [Beschreibung]
+
+ Was fuer DragActions sind an dieser Stelle erlaubt.
+ Fuer Dokumentinhalte darf nur kopiert, nicht verschoben werden.
+*/
+{
+ USHORT nSourceLevel = GetModel()->GetDepth(pSourceEntry);
+ if(VIEW_FILES == GetViewType())
+ ++nSourceLevel;
+ if(nSourceLevel>=2)
+ {
+ bDropMoveOk=FALSE;
+ return GetDragDropMode();
+ }
+ else
+ {
+ bDropMoveOk=TRUE;
+ return GetDragDropMode();
+ }
+
+}
+
+//-------------------------------------------------------------------------
+
+BOOL SfxOrganizeListBox_Impl::NotifyQueryDrop(SvLBoxEntry *pEntry)
+
+/* [Beschreibung]
+
+ QueryDrop-Handler (SV); Funktionsweise kann der Wahrheits,
+ tabelle unten entnommen werden.
+
+
+ B D C1 C2 C3
+
+ Quelle 0 1 2 3 4
+ Ziel
+ 0 - +*** - - -
+ 1 - +*** [-]* + -
+ 2 - - [-] p=p +** -
+ 3 - - - p=p +** p=p && pp=pp +
+ 4 - - - - p=p && pp=pp +
+ ----
+ * Problem Move; logische Bereiche koennen nicht geloescht werden
+ ** p = Parent -> p=p: identische Parents
+ pp = ParentParent
+ *** geht bei Vorlagen
+*/
+{
+ if(!pEntry)
+ return FALSE;
+ SvLBox *pSource = GetSourceView();
+ SvLBoxEntry *pSourceEntry = pSource->FirstSelected();
+ if(pEntry == pSourceEntry)
+ return FALSE;
+ USHORT nSourceLevel = pSource->GetModel()->GetDepth(pSourceEntry);
+ if(VIEW_FILES == ((SfxOrganizeListBox_Impl *)pSource)->GetViewType())
+ ++nSourceLevel;
+ USHORT nTargetLevel = GetModel()->GetDepth(pEntry);
+ if(VIEW_FILES == GetViewType())
+ ++nTargetLevel;
+ Path aSource(pSource, pSourceEntry);
+ Path aTarget(this, pEntry);
+ const USHORT SL = ((SfxOrganizeListBox_Impl *)pSource)->GetDocLevel();
+ const USHORT TL = GetDocLevel();
+
+ return( (nSourceLevel == 1 && nTargetLevel == 0 &&
+ VIEW_TEMPLATES ==
+ ((SfxOrganizeListBox_Impl *)pSource)->GetViewType()) ||
+ (nSourceLevel == 1 && nTargetLevel == 1 &&
+ VIEW_TEMPLATES ==
+ ((SfxOrganizeListBox_Impl *)pSource)->GetViewType() &&
+ VIEW_TEMPLATES == GetViewType()) ||
+ (nSourceLevel == 3 && nTargetLevel == 1) ||
+ (nSourceLevel == 3 && nTargetLevel == 2 &&
+ aSource[1+SL] == aTarget[1+TL]) ||
+ (nSourceLevel == 3 && nTargetLevel == 3 &&
+ aSource[1+SL] == aTarget[1+TL]) ||
+ (nSourceLevel == 4 && nTargetLevel == 3 &&
+ aSource[1+SL] == aTarget[1+TL] &&
+ aSource[2+SL] == aTarget[2+TL]) ||
+ (nSourceLevel == 4 && nTargetLevel == 4 &&
+ aSource[1+SL] == aTarget[1+TL] &&
+ aSource[2+SL] == aTarget[2+TL]));
+}
+
+//-------------------------------------------------------------------------
+
+BOOL SfxOrganizeListBox_Impl::QueryDrop( DropEvent& rEvt )
+
+/* [Beschreibung]
+
+ QueryDrop Handler; wird verwendet, um in der Dokumentenansicht weitere
+ Dokumente per Drag&Drop hinzuf"ugen zu k"onnen
+ (SV-Handler)
+
+ [Returnwert]
+
+ BOOL Erfolg oder Mi"serfolg
+
+ [Querverweise]
+ <SfxOrganizeListBox_Impl::Drop(DropEvent& rEvt)>
+*/
+
+{
+
+/* if(rEvt.GetAction()==DROP_MOVE && !bDropMoveOk)
+ return FALSE;*/
+ if( rEvt.IsDefaultAction() )
+ rEvt.SetAction( DROP_COPY );
+ return eViewType == VIEW_FILES && DragServer::HasFormat(0, FORMAT_FILE)
+ ? TRUE : SvTreeListBox::QueryDrop(rEvt);
+}
+
+//-------------------------------------------------------------------------
+
BOOL SfxOrganizeListBox_Impl::Drop( const DropEvent& rEvt )
/* [Beschreibung]
@@ -1070,32 +1103,97 @@ BOOL SfxOrganizeListBox_Impl::Drop( const DropEvent& rEvt )
//-------------------------------------------------------------------------
-BOOL SfxOrganizeListBox_Impl::QueryDrop( DropEvent& rEvt )
+#else // TF_SVDATA
-/* [Beschreibung]
+DragDropMode SfxOrganizeListBox_Impl::NotifyStartDrag( TransferDataContainer&, SvLBoxEntry* pEntry )
+{
+ USHORT nSourceLevel = GetModel()->GetDepth( pEntry );
+ if ( VIEW_FILES == GetViewType() )
+ ++nSourceLevel;
+ if ( nSourceLevel >= 2 )
+ bDropMoveOk = FALSE;
+ else
+ bDropMoveOk = TRUE;
- QueryDrop Handler; wird verwendet, um in der Dokumentenansicht weitere
- Dokumente per Drag&Drop hinzuf"ugen zu k"onnen
- (SV-Handler)
+ return GetDragDropMode();
+}
- [Returnwert]
+//-------------------------------------------------------------------------
- BOOL Erfolg oder Mi"serfolg
+BOOL SfxOrganizeListBox_Impl::NotifyAcceptDrop( SvLBoxEntry* pEntry )
+{
+ if(!pEntry)
+ return FALSE;
+ SvLBox *pSource = GetSourceView();
+ SvLBoxEntry *pSourceEntry = pSource->FirstSelected();
+ if(pEntry == pSourceEntry)
+ return FALSE;
+ USHORT nSourceLevel = pSource->GetModel()->GetDepth(pSourceEntry);
+ if(VIEW_FILES == ((SfxOrganizeListBox_Impl *)pSource)->GetViewType())
+ ++nSourceLevel;
+ USHORT nTargetLevel = GetModel()->GetDepth(pEntry);
+ if(VIEW_FILES == GetViewType())
+ ++nTargetLevel;
+ Path aSource(pSource, pSourceEntry);
+ Path aTarget(this, pEntry);
+ const USHORT SL = ((SfxOrganizeListBox_Impl *)pSource)->GetDocLevel();
+ const USHORT TL = GetDocLevel();
- [Querverweise]
- <SfxOrganizeListBox_Impl::Drop(DropEvent& rEvt)>
-*/
+ return( (nSourceLevel == 1 && nTargetLevel == 0 &&
+ VIEW_TEMPLATES ==
+ ((SfxOrganizeListBox_Impl *)pSource)->GetViewType()) ||
+ (nSourceLevel == 1 && nTargetLevel == 1 &&
+ VIEW_TEMPLATES ==
+ ((SfxOrganizeListBox_Impl *)pSource)->GetViewType() &&
+ VIEW_TEMPLATES == GetViewType()) ||
+ (nSourceLevel == 3 && nTargetLevel == 1) ||
+ (nSourceLevel == 3 && nTargetLevel == 2 &&
+ aSource[1+SL] == aTarget[1+TL]) ||
+ (nSourceLevel == 3 && nTargetLevel == 3 &&
+ aSource[1+SL] == aTarget[1+TL]) ||
+ (nSourceLevel == 4 && nTargetLevel == 3 &&
+ aSource[1+SL] == aTarget[1+TL] &&
+ aSource[2+SL] == aTarget[2+TL]) ||
+ (nSourceLevel == 4 && nTargetLevel == 4 &&
+ aSource[1+SL] == aTarget[1+TL] &&
+ aSource[2+SL] == aTarget[2+TL]));
+}
+
+//-------------------------------------------------------------------------
+sal_Int8 SfxOrganizeListBox_Impl::AcceptDrop( const AcceptDropEvent& rEvt )
{
+ sal_Bool bAccept = ( eViewType == VIEW_FILES && IsDropFormatSupported( SOT_FORMAT_FILE ) );
+ if ( bAccept )
+ return rEvt.mnAction;
+ else
+ return SvTreeListBox::AcceptDrop( rEvt );
+}
-/* if(rEvt.GetAction()==DROP_MOVE && !bDropMoveOk)
- return FALSE;*/
- if( rEvt.IsDefaultAction() )
- rEvt.SetAction( DROP_COPY );
- return eViewType == VIEW_FILES && DragServer::HasFormat(0, FORMAT_FILE)
- ? TRUE : SvTreeListBox::QueryDrop(rEvt);
+//-------------------------------------------------------------------------
+
+sal_Int8 SfxOrganizeListBox_Impl::ExecuteDrop( const ExecuteDropEvent& rEvt )
+{
+ TransferableDataHelper aHelper( rEvt.maDropEvent.Transferable );
+ sal_uInt32 nFormatCount = aHelper.GetFormatCount();
+ BOOL bSuccess = FALSE;
+ for ( sal_uInt32 i = 0; i < nFormatCount; ++i )
+ {
+ String aFileName;
+ SotFormatStringId nId = aHelper.GetFormat(i);
+
+ if ( SOT_FORMAT_FILE == nId && aHelper.GetString( nId, aFileName ) )
+ {
+ INetURLObject aObj( aFileName, INET_PROT_FILE );
+ bSuccess |= pMgr->InsertFile( this, aObj.GetMainURL() );
+ }
+ }
+ bDropMoveOk = TRUE;
+ return bSuccess ? rEvt.mnAction : SvTreeListBox::ExecuteDrop( rEvt );
}
+#endif // TF_SVDATA
+
//-------------------------------------------------------------------------
inline USHORT SfxOrganizeListBox_Impl::GetDocLevel() const
@@ -1315,7 +1413,9 @@ SfxOrganizeListBox_Impl::SfxOrganizeListBox_Impl(
// SetDragOptions(DROP_COPY);
SetEntryHeight( 16 );
SetSelectionMode(SINGLE_SELECTION);
+#ifndef TF_SVDATA
EnableDrop();
+#endif
GetModel()->SetSortMode(SortNone); // Bug in SvTools 303
}