update dev300-m57
[ooovba.git] / tools / win / inc / winshell.hxx
blobfb3fa59399c3b24acb28e359b037ebf837075369
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: winshell.hxx,v $
10 * $Revision: 1.5 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef _WINSHELL_HXX
32 #define _WINSHELL_HXX
34 #if defined WNT
36 #include <tools/prewin.h>
37 #include "shutil.h"
38 #include <tools/postwin.h>
40 #include <tools/string.hxx>
42 //----------------------------------------------------------------------------
43 // CItemIDList
44 //----------------------------------------------------------------------------
46 class CItemIDList
48 public:
49 CItemIDList();
50 CItemIDList( const CItemIDList & );
51 CItemIDList( LPCITEMIDLIST );
52 CItemIDList( const String & );
53 CItemIDList( int nFolder );
54 ~CItemIDList();
56 CItemIDList & operator = ( const CItemIDList & );
57 CItemIDList & operator += ( const CItemIDList & );
58 CItemIDList operator + ( const CItemIDList & ) const;
60 int operator == ( const CItemIDList & ) const;
61 int operator != ( const CItemIDList & rIDList ) const
62 { return ! operator == ( rIDList ); };
64 operator LPCITEMIDLIST() const
65 { return m_pidl; };
67 int GetTokenCount() const;
68 CItemIDList GetToken( int nIndex ) const;
69 CItemIDList GetParent( int nLevelFromBottom = 1) const;
70 CItemIDList GetChild( int nLevelFromBottom = 1 ) const;
71 void Split( CItemIDList & rParent, CItemIDList & rChild, int nLevelFromBottom = 1 ) const;
73 CItemIDList operator []( int nIndex ) const
74 { return GetToken( nIndex ); };
76 String GetFilePath() const;
78 BOOL IsValid() const
79 { return m_pidl != NULL && m_pidl->mkid.cb != sizeof(USHORT); }
81 int GetRootID() const
82 { return m_nFolder; }
84 protected:
85 ITEMIDLIST *m_pidl;
86 int m_nFolder;
90 inline CItemIDList CItemIDList::operator + ( const CItemIDList & rIDList ) const
92 CItemIDList aCopy( *this );
93 aCopy += rIDList;
94 return aCopy;
97 //----------------------------------------------------------------------------
98 // Types for CShellFolder
99 //----------------------------------------------------------------------------
101 // Notification Events fuer CShellFolder
103 enum NotificationEvent
105 NotificationEvent_Error,
106 NotificationEvent_Signaled,
107 NotificationEvent_Canceled
110 // Volume information
112 typedef struct _WIN32_VOLUME_DATA
114 TCHAR cDeviceName[MAX_PATH];
115 TCHAR cVolumeName[MAX_PATH];
116 TCHAR cFileSystemName[MAX_PATH];
117 DWORD dwSerialNumber;
118 DWORD dwFileSystemFlags;
119 DWORD nMaxComponentLength;
120 } WIN32_VOLUME_DATA;
122 // Bekannte Class-IDs fuer wichtige Ordner
124 // {871C5380-42A0-1069-A2EA-08002B30309D} Internet Explorer 4.0
125 static const GUID CLSID_IE4 =
126 { 0x871C5380, 0x42A0, 0x1069, { 0xA2, 0xEA, 0x08, 0x00, 0x2B, 0x30, 0x30, 0x9D } };
128 // {208D2C60-3AEA-1069-A2D7-08002B30309D} Netzwerkumgebung
129 static const GUID CLSID_Network =
130 { 0x208D2C60, 0x3AEA, 0x1069, { 0xA2, 0xD7, 0x08, 0x00, 0x2B, 0x30, 0x30, 0x9D } };
132 // {645FF040-5081-101B-9F08-00AA002F954E} Papierkorb
133 static const GUID CLSID_RecycleBin =
134 { 0x645FF040, 0x5081, 0x101B, { 0x9F, 0x08, 0x00, 0xAA, 0x00, 0x2F, 0x95, 0x4E } };
136 // {20D04FE0-3AEA-1069-A2D8-08002B30309D} Arbeitsplatz
137 static const GUID CLSID_MyComputer =
138 { 0x20D04FE0, 0x3AEA, 0x1069, { 0xA2, 0xD8, 0x08, 0x00, 0x2B, 0x30, 0x30, 0x9D } };
140 // {D6277990-4C6A-11CF-8D87-00AA0060F5BF} Geplante Vorgänge
141 static const GUID CLSID_Tasks =
142 { 0xD6277990, 0x4C6A, 0x11CF, { 0x8D, 0x87, 0x00, 0xAA, 0x00, 0x60, 0xF5, 0xBF } };
144 // Fehlt im Header
146 #define SHGDN_INCLUDE_NONFILESYS 0x2000
148 #define CSIDL_UNKNOWN -1
149 #define CSIDL_ROOT -2
150 #define CSIDL_SYSTEM -3
152 // Suchmaske fuer IEnumIDList
154 #define SHCONTF_ALL (SHCONTF_FOLDERS | SHCONTF_NONFOLDERS | SHCONTF_INCLUDEHIDDEN)
156 // SHITEM Prefix Kinds
158 #define SHGII_CONTAINER_MASK 0x70
160 #define SHGII_COMPUTER 0x20
162 #define SHGII_COMPUTER_REMOVABLE 0x22
163 #define SHGII_COMPUTER_FIXED 0x23
164 #define SHGII_COMPUTER_REMOTE 0x24
165 #define SHGII_COMPUTER_CDROM 0x25
166 #define SHGII_COMPUTER_RAMDISK 0x26
167 #define SHGII_COMPUTER_FLOPPY525 0x28
168 #define SHGII_COMPUTER_FLOPPY35 0x29
169 #define SHGII_COMPUTER_NETWORK 0x2A
170 #define SHGII_COMPUTER_REGITEM 0x2E
172 #define SHGII_ROOT 0x10
173 #define SHGII_ROOT_REGITEM 0x1F
175 #define SHGII_NETWORK 0x40
176 #define SHGII_NETWORK_TREE 0x47
177 #define SHGII_NETWORK_SERVER 0x42
178 #define SHGII_NETWORK_DIRECTORY 0x43
179 #define SHGII_NETWORK_PRINTER 0x41
181 #define SHGII_FILESYSTEM 0x30
182 #define SHGII_FILESYSTEM_FILE 0x31
183 #define SHGII_FILESYSTEM_DIRECTORY 0x32
185 #define SHGII_ANCESTOR 0x80
187 #define SHITEMCONTAINER( pidl ) ((pidl)->mkid.abID[0] & SHGII_CONTAINER_MASK)
188 #define SHITEMKIND( pidl ) ((pidl)->mkid.abID[0] & 0x7F)
190 //----------------------------------------------------------------------------
191 // CShellFolderData
192 //----------------------------------------------------------------------------
194 class CShellFolderData
196 protected:
197 CShellFolderData();
198 virtual ~CShellFolderData();
200 IShellFolder *m_pShellFolder;
201 IEnumIDList *m_pEnumIDList;
202 IShellIcon *m_pShellIcon;
203 BOOL m_bIsOpen;
204 HANDLE m_hCancelEvent;
205 DWORD m_dwContentFlags;
208 //----------------------------------------------------------------------------
209 // CShellFolder
210 //----------------------------------------------------------------------------
212 // Ganz "normaler" Ordner basierend auf dem IShellFolder Interface
214 class CShellFolder : public CShellFolderData
216 public:
217 CShellFolder( const CItemIDList & );
218 CShellFolder( const CShellFolder & );
219 CShellFolder( IShellFolder * );
221 // Retrieval of Item IDs
223 virtual BOOL Reset();
225 BOOL GetNextValidID( CItemIDList & );
227 virtual BOOL GetNextID( CItemIDList & );
228 virtual BOOL ValidateID( const CItemIDList & );
230 // Getting information about Items
232 virtual BOOL GetAttributesOf( const CItemIDList &, LPDWORD pdwInOut );
233 virtual BOOL GetNameOf( const CItemIDList &, String & );
235 virtual BOOL GetFileInfo( const CItemIDList &, WIN32_FIND_DATA * );
236 virtual BOOL GetVolumeInfo( const CItemIDList & rIDList, WIN32_VOLUME_DATA * );
238 // Modifying the folder contents
240 virtual BOOL SetNameOf( const CItemIDList &, const String &, CItemIDList & );
241 virtual BOOL DeleteItem( const CItemIDList & );
243 // Comparison of IDs
245 virtual int CompareIDs( const CItemIDList &, const CItemIDList & );
247 // UI Components
249 virtual IContextMenu *GetContextMenu( int nItems, const CItemIDList * );
250 virtual String GetIconLocation( const CItemIDList & );
252 // Notifications
254 virtual NotificationEvent WaitForChanges();
255 virtual void CancelWaitNotifications();
257 protected:
258 CShellFolder() : CShellFolderData() {};
260 void Initialize( IShellFolder *pShellFolder );
261 void Initialize( LPCITEMIDLIST );
264 //----------------------------------------------------------------------------
265 // CFileSystemFolder
266 //----------------------------------------------------------------------------
268 // Reiner !!! Filesystem-Ordner. Benutzt optimierten Notification Mechanismus
270 class CFileSystemFolder : public CShellFolder
272 public:
273 CFileSystemFolder( LPCSTR pszPath );
275 virtual NotificationEvent WaitForChanges();
277 protected:
278 CFileSystemFolder() : CShellFolder() {};
280 void Initialize( LPCTSTR pszPath );
282 TCHAR m_szPath[MAX_PATH];
285 //----------------------------------------------------------------------------
286 // CSpecialFolder
287 //----------------------------------------------------------------------------
289 // Wie SHellFolder, aber andere Konstruktion ueber definierte Junktion-Points
291 class CSpecialFolder : public CShellFolder
293 public:
294 CSpecialFolder( int nFolder );
296 protected:
297 CSpecialFolder() : CShellFolder() {};
299 void Initialize( int nFolder );
301 int m_nFolder;
304 //----------------------------------------------------------------------------
305 // CMyComputerFolder
306 //----------------------------------------------------------------------------
308 // Der MS-Windows "Arbeitsplatz"
310 class CMyComputerFolder : public CSpecialFolder
312 public:
313 CMyComputerFolder() : CSpecialFolder( CSIDL_DRIVES ) {};
316 //----------------------------------------------------------------------------
317 // CVolumesFolder
318 //----------------------------------------------------------------------------
320 // Wie CMyComputersFolder, enthält aber nur die Laufwerke
322 class CVolumesFolder : public CMyComputerFolder
324 public:
325 CVolumesFolder() : CMyComputerFolder() {};
327 virtual BOOL ValidateID( const CItemIDList & );
328 virtual NotificationEvent WaitForChanges();
331 //----------------------------------------------------------------------------
332 // CWorkplaceFolder
333 //----------------------------------------------------------------------------
335 // Wie CMyComputersFolder, enthält aber keine!!! Laufwerke
337 class CWorkplaceFolder : public CMyComputerFolder
339 CWorkplaceFolder() : CMyComputerFolder() {};
341 virtual BOOL ValidateID( const CItemIDList & );
342 virtual NotificationEvent WaitForChanges();
345 //----------------------------------------------------------------------------
346 // CDesktopFolder
347 //----------------------------------------------------------------------------
349 // Der MS-Windows Desktop
351 class CDesktopFolder : public CSpecialFolder
353 public:
354 CDesktopFolder() : CSpecialFolder( CSIDL_DESKTOP ) {};
357 //----------------------------------------------------------------------------
358 // CDesktopAncestorsFolder
359 //----------------------------------------------------------------------------
361 // Wie CDesktopFolder, enthält aber nur Arbeitsplatz und Netzwerk
363 class CDesktopAncestorsFolder : public CDesktopFolder
365 public:
366 CDesktopAncestorsFolder() : CDesktopFolder() {};
368 virtual BOOL ValidateID( const CItemIDList & );
369 virtual NotificationEvent WaitForChanges();
372 //----------------------------------------------------------------------------
373 // CDesktopContentsFolder
374 //----------------------------------------------------------------------------
376 // Wie CDesktopFolder, aber ohne!!! Arbeitsplatz und Netzwerk
378 class CDesktopContentsFolder : public CDesktopFolder
380 public:
381 CDesktopContentsFolder() : CDesktopFolder() {};
383 virtual BOOL ValidateID( const CItemIDList & );
384 virtual NotificationEvent WaitForChanges();
387 #endif
389 #endif // _WINSHELL_HXX