Update ooo320-m1
[ooovba.git] / tools / source / fsys / comdep.hxx
blob44c5f79a4a1dfa2d8cbe0d35f1ca291e6e156d9c
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: comdep.hxx,v $
10 * $Revision: 1.6 $
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 _COMDEP_HXX
32 #define _COMDEP_HXX
34 #include <tools/fsys.hxx>
36 #define ACCESSDELIM(e) ( (e == FSYS_STYLE_MAC) ? ":" : \
37 ( ( e == FSYS_STYLE_VFAT || e == FSYS_STYLE_HPFS || \
38 e == FSYS_STYLE_FAT ) || e == FSYS_STYLE_NTFS ) \
39 ? "\\" : "/" )
40 #define ACCESSDELIM_C(e)(char)\
41 ( (e == FSYS_STYLE_MAC) ? ':' : \
42 ( ( e == FSYS_STYLE_VFAT || e == FSYS_STYLE_HPFS || \
43 e == FSYS_STYLE_FAT ) || e == FSYS_STYLE_NTFS ) \
44 ? '\\' : '/' )
45 #define SEARCHDELIM(e) ( (e == FSYS_STYLE_SYSV || e == FSYS_STYLE_BSD) ? ":" \
46 : ";" )
47 #define SEARCHDELIM_C(e)(char)\
48 ( (e == FSYS_STYLE_SYSV || e == FSYS_STYLE_BSD) ? ':' \
49 : ';' )
50 #define ACTPARENT(e) ( (e == FSYS_STYLE_MAC) ? ":" : ".." )
51 #define ACTCURRENT(e) ( (e == FSYS_STYLE_MAC) ? "" : "." )
53 #if defined UNX
54 #include "unx.hxx"
55 #elif defined WNT
56 #include "wntmsc.hxx"
57 #elif defined OS2
58 #include "os2.hxx"
59 #endif
61 //--------------------------------------------------------------------
63 #ifndef LINUX
64 DIR *opendir( const char* pPfad );
65 dirent *readdir( DIR *pDir );
66 int closedir( DIR *pDir );
67 char *volumeid( const char* pPfad );
68 #endif
70 //--------------------------------------------------------------------
72 struct DirReader_Impl
74 Dir* pDir;
75 DIR* pDosDir;
76 dirent* pDosEntry;
77 DirEntry* pParent;
78 String aPath;
79 ByteString aBypass;
80 BOOL bReady;
81 BOOL bInUse;
83 DirReader_Impl( Dir &rDir )
84 : pDir( &rDir ),
85 pDosEntry( 0 ),
86 pParent( 0 ),
87 aPath( GUI2FSYS(rDir.GetFull()) ),
88 bReady ( FALSE ),
89 bInUse( FALSE )
91 #ifndef BOOTSTRAP
92 // Redirection
93 FSysRedirector::DoRedirect( aPath );
94 #endif
96 // nur den String der Memer-Var nehmen!
98 #if defined(UNX) || defined(OS2) //for further exlpanation see DirReader_Impl::Read() in unx.cxx
99 pDosDir = NULL;
100 #else
101 aBypass = ByteString(aPath, osl_getThreadTextEncoding());
102 pDosDir = opendir( (char*) aBypass.GetBuffer() );
103 #endif
105 // Parent f"ur die neuen DirEntries ermitteln
106 pParent = pDir->GetFlag() == FSYS_FLAG_NORMAL ||
107 pDir->GetFlag() == FSYS_FLAG_ABSROOT
108 ? pDir
109 : pDir->GetParent();
113 ~DirReader_Impl()
114 { if( pDosDir ) closedir( pDosDir ); }
116 // die folgenden sind systemabh"angig implementiert
117 USHORT Init(); // initialisiert, liest ggf. devices
118 USHORT Read(); // liest 1 Eintrag, F2ugt ein falls ok
121 //--------------------------------------------------------------------
123 struct FileCopier_Impl
125 FSysAction nActions; // was zu tun ist (Copy/Move/recur)
126 Link aErrorLink; // bei Fehlern zu rufen
127 ErrCode eErr; // aktueller Fehlercode im Error-Handler
128 const DirEntry* pErrSource; // fuer Error-Handler falls Source-Fehler
129 const DirEntry* pErrTarget; // fuer Error-Handler falls Target-Fehler
131 FileCopier_Impl()
132 : nActions( 0 ), eErr( 0 ),
133 pErrSource( 0 ), pErrTarget( 0 )
135 FileCopier_Impl( const FileCopier_Impl &rOrig )
136 : nActions( rOrig.nActions ), eErr( 0 ),
137 pErrSource( 0 ), pErrTarget( 0 )
140 FileCopier_Impl& operator=( const FileCopier_Impl &rOrig )
142 nActions = rOrig.nActions;
143 eErr = 0; pErrSource = 0; pErrTarget = 0;
144 return *this;
148 //--------------------------------------------------------------------
150 #if defined WNT || defined OS2
151 BOOL IsRedirectable_Impl( const ByteString &rPath );
152 #else
153 #define IsRedirectable_Impl( rPath ) TRUE
154 #endif
156 //--------------------------------------------------------------------
159 #endif