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 // MARKER(update_precomp.py): autogen include statement, do not remove 29 #include "precompiled_shell.hxx" 30 #include "internal/global.hxx" 31 #include "zipexcptn.hxx" 32 33 //------------------------------------------ 34 /** 35 */ 36 RuntimeException::RuntimeException(int Error) : 37 m_Error(Error) 38 { 39 } 40 41 //------------------------------------------ 42 /** 43 */ 44 RuntimeException::~RuntimeException() throw() 45 { 46 } 47 48 //------------------------------------------ 49 /** 50 */ 51 int RuntimeException::GetErrorCode() const 52 { 53 return m_Error; 54 } 55 56 //------------------------------------------ 57 /** 58 */ 59 ZipException::ZipException(int Error) : 60 RuntimeException(Error) 61 { 62 } 63 64 //------------------------------------------ 65 /** 66 */ 67 const char* ZipException::what() const throw() 68 { 69 return 0; 70 } 71 72 //------------------------------------------ 73 /** 74 */ 75 Win32Exception::Win32Exception(int Error) : 76 RuntimeException(Error), 77 m_MsgBuff(0) 78 { 79 } 80 81 //------------------------------------------ 82 /** 83 */ 84 Win32Exception::~Win32Exception() throw() 85 { 86 #ifndef OS2 87 if (m_MsgBuff) 88 LocalFree(m_MsgBuff); 89 #endif 90 } 91 92 //------------------------------------------ 93 /** 94 */ 95 const char* Win32Exception::what() const throw() 96 { 97 #ifdef OS2 98 return "Win32Exception!"; 99 #else 100 FormatMessage( 101 FORMAT_MESSAGE_ALLOCATE_BUFFER | 102 FORMAT_MESSAGE_FROM_SYSTEM | 103 FORMAT_MESSAGE_IGNORE_INSERTS, 104 NULL, 105 GetErrorCode(), 106 MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language 107 (LPTSTR) &m_MsgBuff, 108 0, 109 NULL); 110 111 return reinterpret_cast<char*>(m_MsgBuff); 112 #endif 113 } 114 115 //------------------------------------------ 116 /** 117 */ 118 ZipContentMissException::ZipContentMissException(int Error) : 119 ZipException(Error) 120 { 121 } 122 123 //------------------------------------------ 124 /** 125 */ 126 AccessViolationException::AccessViolationException(int Error) : 127 Win32Exception(Error) 128 { 129 } 130 131 //------------------------------------------ 132 /** 133 */ 134 IOException::IOException(int Error) : 135 Win32Exception(Error) 136 { 137 } 138