1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28 #ifndef _COMDEP_HXX 29 #define _COMDEP_HXX 30 31 #include <tools/fsys.hxx> 32 33 #define ACCESSDELIM(e) ( (e == FSYS_STYLE_MAC) ? ":" : \ 34 ( ( e == FSYS_STYLE_VFAT || e == FSYS_STYLE_HPFS || \ 35 e == FSYS_STYLE_FAT ) || e == FSYS_STYLE_NTFS ) \ 36 ? "\\" : "/" ) 37 #define ACCESSDELIM_C(e)(char)\ 38 ( (e == FSYS_STYLE_MAC) ? ':' : \ 39 ( ( e == FSYS_STYLE_VFAT || e == FSYS_STYLE_HPFS || \ 40 e == FSYS_STYLE_FAT ) || e == FSYS_STYLE_NTFS ) \ 41 ? '\\' : '/' ) 42 #define SEARCHDELIM(e) ( (e == FSYS_STYLE_SYSV || e == FSYS_STYLE_BSD) ? ":" \ 43 : ";" ) 44 #define SEARCHDELIM_C(e)(char)\ 45 ( (e == FSYS_STYLE_SYSV || e == FSYS_STYLE_BSD) ? ':' \ 46 : ';' ) 47 #define ACTPARENT(e) ( (e == FSYS_STYLE_MAC) ? ":" : ".." ) 48 #define ACTCURRENT(e) ( (e == FSYS_STYLE_MAC) ? "" : "." ) 49 50 #if defined UNX 51 #include "unx.hxx" 52 #elif defined WNT 53 #include "wntmsc.hxx" 54 #elif defined OS2 55 #include "os2.hxx" 56 #endif 57 58 //-------------------------------------------------------------------- 59 60 #ifndef LINUX 61 DIR *opendir( const char* pPfad ); 62 dirent *readdir( DIR *pDir ); 63 int closedir( DIR *pDir ); 64 char *volumeid( const char* pPfad ); 65 #endif 66 67 //-------------------------------------------------------------------- 68 69 struct DirReader_Impl 70 { 71 Dir* pDir; 72 DIR* pDosDir; 73 dirent* pDosEntry; 74 DirEntry* pParent; 75 String aPath; 76 ByteString aBypass; 77 sal_Bool bReady; 78 sal_Bool bInUse; 79 80 DirReader_Impl( Dir &rDir ) 81 : pDir( &rDir ), 82 pDosEntry( 0 ), 83 pParent( 0 ), 84 aPath( GUI2FSYS(rDir.GetFull()) ), 85 bReady ( sal_False ), 86 bInUse( sal_False ) 87 { 88 #ifndef BOOTSTRAP 89 // Redirection 90 FSysRedirector::DoRedirect( aPath ); 91 #endif 92 93 // nur den String der Memer-Var nehmen! 94 95 #if defined(UNX) || defined(OS2) //for further exlpanation see DirReader_Impl::Read() in unx.cxx 96 pDosDir = NULL; 97 #else 98 aBypass = ByteString(aPath, osl_getThreadTextEncoding()); 99 pDosDir = opendir( (char*) aBypass.GetBuffer() ); 100 #endif 101 102 // Parent f"ur die neuen DirEntries ermitteln 103 pParent = pDir->GetFlag() == FSYS_FLAG_NORMAL || 104 pDir->GetFlag() == FSYS_FLAG_ABSROOT 105 ? pDir 106 : pDir->GetParent(); 107 108 } 109 110 ~DirReader_Impl() 111 { if( pDosDir ) closedir( pDosDir ); } 112 113 // die folgenden sind systemabh"angig implementiert 114 sal_uInt16 Init(); // initialisiert, liest ggf. devices 115 sal_uInt16 Read(); // liest 1 Eintrag, F2ugt ein falls ok 116 }; 117 118 //-------------------------------------------------------------------- 119 120 struct FileCopier_Impl 121 { 122 FSysAction nActions; // was zu tun ist (Copy/Move/recur) 123 Link aErrorLink; // bei Fehlern zu rufen 124 ErrCode eErr; // aktueller Fehlercode im Error-Handler 125 const DirEntry* pErrSource; // fuer Error-Handler falls Source-Fehler 126 const DirEntry* pErrTarget; // fuer Error-Handler falls Target-Fehler 127 128 FileCopier_Impl() 129 : nActions( 0 ), eErr( 0 ), 130 pErrSource( 0 ), pErrTarget( 0 ) 131 {} 132 FileCopier_Impl( const FileCopier_Impl &rOrig ) 133 : nActions( rOrig.nActions ), eErr( 0 ), 134 pErrSource( 0 ), pErrTarget( 0 ) 135 {} 136 137 FileCopier_Impl& operator=( const FileCopier_Impl &rOrig ) 138 { 139 nActions = rOrig.nActions; 140 eErr = 0; pErrSource = 0; pErrTarget = 0; 141 return *this; 142 } 143 }; 144 145 //-------------------------------------------------------------------- 146 147 #if defined WNT || defined OS2 148 sal_Bool IsRedirectable_Impl( const ByteString &rPath ); 149 #else 150 #define IsRedirectable_Impl( rPath ) sal_True 151 #endif 152 153 //-------------------------------------------------------------------- 154 155 156 #endif 157