merge the formfield patch from ooo-build
[ooovba.git] / framework / inc / loadstate.h
blobbdcf84182039cae801b25f0f8c4a17d3983abb5e
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: loadstate.h,v $
10 * $Revision: 1.3 $
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 __FRAMEWORK_LOADSTATE_H_
32 #define __FRAMEWORK_LOADSTATE_H_
34 //_________________________________________________________________________________________________________________
35 // includes
36 //_________________________________________________________________________________________________________________
38 #include <com/sun/star/ucb/InteractiveIOException.hpp>
39 #include <com/sun/star/ucb/InteractiveAugmentedIOException.hpp>
41 //_________________________________________________________________________________________________________________
42 // namespace
43 //_________________________________________________________________________________________________________________
45 namespace framework{
47 //_______________________________________________________________________
48 /**
49 These enum values specify all possible results of a load request.
50 It doesn't matter, if this load operation used dispatch() or loadComponentFromURL().
51 The meaning is everytime the same.
53 enum ELoadState
55 E_UNSPECIFIED = 0, // indicates the operation was not already started
56 E_SUCCESS = 1, // the load request was successfull
57 E_IOERROR = 2, // there was an io error internaly
58 E_INTERACTION = 3, // there was an interaction, which couldn't be handled (doesn't include IO interactions => see E_IOERROR before)
59 E_FAILED = 4 // for unknown or unspecified errors
62 //_______________________________________________________________________
63 /**
64 Helper, which provides some functionality to identify the reason for
65 a failed load request and can describe it.
67 class LoadStateHelper
69 public:
71 //_________________________________
72 /**
73 @short checks if the given interaction request was an io error
74 @descr This information can be used to throw
75 a suitable IOException. (e.g. loadComponentFromURL())
77 @param aRequest
78 the original interaction request, which may produced
79 the failed load request
81 @param rReason
82 in case this Method returns <TRUE/> the referred string object
83 will be used to set the original message of the
84 aborted io exception on it.
85 If method returns <FALSE/> rReason was not used.
87 @return [boolean]
88 <TRUE/> in case it was an IO error
89 <FALSE/> in case it wasn't an IO error or interaction was not used
91 static sal_Bool wasIOError( const css::uno::Any& aRequest ,
92 rtl::OUString& rReason )
94 if ( ! aRequest.hasValue() )
95 return sal_False;
97 css::ucb::InteractiveIOException exIOInteractive ;
98 css::ucb::InteractiveAugmentedIOException exIOAugmented ;
100 if (aRequest>>=exIOInteractive)
102 rReason = exIOInteractive.Message;
103 return sal_True;
106 if (aRequest>>=exIOAugmented)
108 rReason = exIOAugmented.Message;
109 return sal_True;
112 return sal_False;
116 } // namespace framework
118 #endif // #ifndef __FRAMEWORK_LOADSTATE_H_