1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * This file is part of OpenOffice.org.
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.
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).
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.
26 ************************************************************************/
28 #ifndef __FRAMEWORK_LOADSTATE_H_
29 #define __FRAMEWORK_LOADSTATE_H_
31 //_________________________________________________________________________________________________________________
33 //_________________________________________________________________________________________________________________
35 #include <com/sun/star/ucb/InteractiveIOException.hpp>
36 #include <com/sun/star/ucb/InteractiveAugmentedIOException.hpp>
38 //_________________________________________________________________________________________________________________
40 //_________________________________________________________________________________________________________________
44 //_______________________________________________________________________
46 These enum values specify all possible results of a load request.
47 It doesn't matter, if this load operation used dispatch() or loadComponentFromURL().
48 The meaning is everytime the same.
52 E_UNSPECIFIED
= 0, // indicates the operation was not already started
53 E_SUCCESS
= 1, // the load request was successfull
54 E_IOERROR
= 2, // there was an io error internaly
55 E_INTERACTION
= 3, // there was an interaction, which couldn't be handled (doesn't include IO interactions => see E_IOERROR before)
56 E_FAILED
= 4 // for unknown or unspecified errors
59 //_______________________________________________________________________
61 Helper, which provides some functionality to identify the reason for
62 a failed load request and can describe it.
68 //_________________________________
70 @short checks if the given interaction request was an io error
71 @descr This information can be used to throw
72 a suitable IOException. (e.g. loadComponentFromURL())
75 the original interaction request, which may produced
76 the failed load request
79 in case this Method returns <TRUE/> the referred string object
80 will be used to set the original message of the
81 aborted io exception on it.
82 If method returns <FALSE/> rReason was not used.
85 <TRUE/> in case it was an IO error
86 <FALSE/> in case it wasn't an IO error or interaction was not used
88 static sal_Bool
wasIOError( const css::uno::Any
& aRequest
,
89 rtl::OUString
& rReason
)
91 if ( ! aRequest
.hasValue() )
94 css::ucb::InteractiveIOException exIOInteractive
;
95 css::ucb::InteractiveAugmentedIOException exIOAugmented
;
97 if (aRequest
>>=exIOInteractive
)
99 rReason
= exIOInteractive
.Message
;
103 if (aRequest
>>=exIOAugmented
)
105 rReason
= exIOAugmented
.Message
;
113 } // namespace framework
115 #endif // #ifndef __FRAMEWORK_LOADSTATE_H_