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 DBACCESS_DOCERRORHANDLING_HXX
29 #define DBACCESS_DOCERRORHANDLING_HXX
30 
31 /** === begin UNO includes === **/
32 #include <com/sun/star/frame/XModel.hpp>
33 #include <com/sun/star/task/XInteractionHandler.hpp>
34 /** === end UNO includes === **/
35 
36 namespace comphelper {
37     class ComponentContext;
38 }
39 
40 #include <memory>
41 
42 //........................................................................
43 namespace dbmm
44 {
45 //........................................................................
46 
47 	//====================================================================
48 	//= DocumentErrorHandling
49 	//====================================================================
50     struct InteractionHandler_Data;
51     /** wraps common operations with an interaction handler.
52     */
53     class InteractionHandler
54     {
55     public:
56         /** creates an interaction handler by instantiating a css.task.InteractionHandler
57             component at the given component context, or using the given document's interaction handler,
58             if one is specified in the document's media descriptor.
59         */
60         InteractionHandler( const ::comphelper::ComponentContext& _rContext, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& _rxDocument );
61 
62         /** destructor
63         */
64         ~InteractionHandler();
65 
66         /** requests a document password
67             @param _rDocumentName
68                 the document name
69             @param _io_rPassword
70                 the initial password on method entry, the password as entered by the user on method leave
71             @return
72                 <TRUE/> if and only if the user entered a password, and confirmed with OK, <FALSE/>
73                 if the user aborted the request.
74         */
75         bool    requestDocumentPassword(
76                     const ::rtl::OUString& _rDocumentName,
77                           ::rtl::OUString& _io_rPassword
78                 );
79 
80         /** reports the given error (usually an exception caught on the caller's side)
81             to the user
82         */
83         void    reportError(
84                     const ::com::sun::star::uno::Any& _rError
85                 );
86 
87     private:
88         ::std::auto_ptr< InteractionHandler_Data >  m_pData;
89     };
90 
91 //........................................................................
92 } // namespace dbmm
93 //........................................................................
94 
95 #endif // DBACCESS_DOCERRORHANDLING_HXX
96