xref: /AOO41X/main/desktop/source/deployment/manager/dp_commandenvironments.hxx (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir 
28*cdf0e10cSrcweir #if ! defined INCLUDED_DP_COMMANDENVIRONMENTS_HXX
29*cdf0e10cSrcweir #define INCLUDED_DP_COMMANDENVIRONMENTS_HXX
30*cdf0e10cSrcweir 
31*cdf0e10cSrcweir 
32*cdf0e10cSrcweir #include "cppuhelper/compbase3.hxx"
33*cdf0e10cSrcweir //#include "cppuhelper/implbase2.hxx"
34*cdf0e10cSrcweir #include "ucbhelper/content.hxx"
35*cdf0e10cSrcweir #include "com/sun/star/uno/Type.hxx"
36*cdf0e10cSrcweir 
37*cdf0e10cSrcweir 
38*cdf0e10cSrcweir namespace css = ::com::sun::star;
39*cdf0e10cSrcweir 
40*cdf0e10cSrcweir namespace dp_manager {
41*cdf0e10cSrcweir 
42*cdf0e10cSrcweir 
43*cdf0e10cSrcweir 
44*cdf0e10cSrcweir /**
45*cdf0e10cSrcweir    This command environment is to be used when an extension is temporarily
46*cdf0e10cSrcweir    stored in the "tmp" repository. It prevents all kind of user interaction.
47*cdf0e10cSrcweir  */
48*cdf0e10cSrcweir class BaseCommandEnv
49*cdf0e10cSrcweir     : public ::cppu::WeakImplHelper3< css::ucb::XCommandEnvironment,
50*cdf0e10cSrcweir                                       css::task::XInteractionHandler,
51*cdf0e10cSrcweir                                       css::ucb::XProgressHandler >
52*cdf0e10cSrcweir {
53*cdf0e10cSrcweir protected:
54*cdf0e10cSrcweir     css::uno::Reference< css::uno::XComponentContext > m_xContext;
55*cdf0e10cSrcweir     css::uno::Reference< css::task::XInteractionHandler> m_forwardHandler;
56*cdf0e10cSrcweir 
57*cdf0e10cSrcweir     void handle_(bool approve, bool abort,
58*cdf0e10cSrcweir                  css::uno::Reference< css::task::XInteractionRequest> const & xRequest );
59*cdf0e10cSrcweir public:
60*cdf0e10cSrcweir     virtual ~BaseCommandEnv();
61*cdf0e10cSrcweir     BaseCommandEnv();
62*cdf0e10cSrcweir     BaseCommandEnv(
63*cdf0e10cSrcweir         css::uno::Reference< css::task::XInteractionHandler> const & handler);
64*cdf0e10cSrcweir 
65*cdf0e10cSrcweir     // XCommandEnvironment
66*cdf0e10cSrcweir     virtual css::uno::Reference<css::task::XInteractionHandler > SAL_CALL
67*cdf0e10cSrcweir     getInteractionHandler() throw (css::uno::RuntimeException);
68*cdf0e10cSrcweir     virtual css::uno::Reference<css::ucb::XProgressHandler >
69*cdf0e10cSrcweir     SAL_CALL getProgressHandler() throw (css::uno::RuntimeException);
70*cdf0e10cSrcweir 
71*cdf0e10cSrcweir     // XInteractionHandler
72*cdf0e10cSrcweir     virtual void SAL_CALL handle(
73*cdf0e10cSrcweir         css::uno::Reference<css::task::XInteractionRequest > const & xRequest )
74*cdf0e10cSrcweir         throw (css::uno::RuntimeException);
75*cdf0e10cSrcweir 
76*cdf0e10cSrcweir     // XProgressHandler
77*cdf0e10cSrcweir     virtual void SAL_CALL push( css::uno::Any const & Status )
78*cdf0e10cSrcweir         throw (css::uno::RuntimeException);
79*cdf0e10cSrcweir     virtual void SAL_CALL update( css::uno::Any const & Status )
80*cdf0e10cSrcweir         throw (css::uno::RuntimeException);
81*cdf0e10cSrcweir     virtual void SAL_CALL pop() throw (css::uno::RuntimeException);
82*cdf0e10cSrcweir };
83*cdf0e10cSrcweir 
84*cdf0e10cSrcweir class TmpRepositoryCommandEnv : public BaseCommandEnv
85*cdf0e10cSrcweir {
86*cdf0e10cSrcweir public:
87*cdf0e10cSrcweir     TmpRepositoryCommandEnv();
88*cdf0e10cSrcweir     TmpRepositoryCommandEnv(css::uno::Reference< css::task::XInteractionHandler> const & handler);
89*cdf0e10cSrcweir 
90*cdf0e10cSrcweir // XInteractionHandler
91*cdf0e10cSrcweir     virtual void SAL_CALL handle(
92*cdf0e10cSrcweir         css::uno::Reference<css::task::XInteractionRequest > const & xRequest )
93*cdf0e10cSrcweir         throw (css::uno::RuntimeException);
94*cdf0e10cSrcweir 
95*cdf0e10cSrcweir };
96*cdf0e10cSrcweir 
97*cdf0e10cSrcweir /** this class is for use in XPackageManager::synchronize.
98*cdf0e10cSrcweir 
99*cdf0e10cSrcweir     It handles particular license cases.
100*cdf0e10cSrcweir  */
101*cdf0e10cSrcweir class LicenseCommandEnv : public BaseCommandEnv
102*cdf0e10cSrcweir {
103*cdf0e10cSrcweir private:
104*cdf0e10cSrcweir     ::rtl::OUString m_repository;
105*cdf0e10cSrcweir     bool m_bSuppressLicense;
106*cdf0e10cSrcweir public:
107*cdf0e10cSrcweir     LicenseCommandEnv(){};
108*cdf0e10cSrcweir     LicenseCommandEnv(
109*cdf0e10cSrcweir         css::uno::Reference< css::task::XInteractionHandler> const & handler,
110*cdf0e10cSrcweir         bool bSuppressLicense,
111*cdf0e10cSrcweir         ::rtl::OUString const & repository);
112*cdf0e10cSrcweir 
113*cdf0e10cSrcweir // XInteractionHandler
114*cdf0e10cSrcweir     virtual void SAL_CALL handle(
115*cdf0e10cSrcweir         css::uno::Reference<css::task::XInteractionRequest > const & xRequest )
116*cdf0e10cSrcweir         throw (css::uno::RuntimeException);
117*cdf0e10cSrcweir 
118*cdf0e10cSrcweir };
119*cdf0e10cSrcweir 
120*cdf0e10cSrcweir /** this class is for use in XPackageManager::checkPrerequisites
121*cdf0e10cSrcweir 
122*cdf0e10cSrcweir     It always prohibits a license interaction
123*cdf0e10cSrcweir  */
124*cdf0e10cSrcweir class NoLicenseCommandEnv : public BaseCommandEnv
125*cdf0e10cSrcweir {
126*cdf0e10cSrcweir 
127*cdf0e10cSrcweir public:
128*cdf0e10cSrcweir     NoLicenseCommandEnv(){};
129*cdf0e10cSrcweir     NoLicenseCommandEnv(css::uno::Reference< css::task::XInteractionHandler> const & handler);
130*cdf0e10cSrcweir 
131*cdf0e10cSrcweir // XInteractionHandler
132*cdf0e10cSrcweir     virtual void SAL_CALL handle(
133*cdf0e10cSrcweir         css::uno::Reference<css::task::XInteractionRequest > const & xRequest )
134*cdf0e10cSrcweir         throw (css::uno::RuntimeException);
135*cdf0e10cSrcweir 
136*cdf0e10cSrcweir };
137*cdf0e10cSrcweir 
138*cdf0e10cSrcweir /* For use in XExtensionManager::addExtension in the call to
139*cdf0e10cSrcweir    XPackage::checkPrerequisites
140*cdf0e10cSrcweir    It prevents all user interactions. The license is always accepted.
141*cdf0e10cSrcweir    It remembers if there was a platform or a dependency exception in
142*cdf0e10cSrcweir    the member m_bException. if there was any other exception then m_bUnknownException
143*cdf0e10cSrcweir    is set.
144*cdf0e10cSrcweir 
145*cdf0e10cSrcweir  */
146*cdf0e10cSrcweir class SilentCheckPrerequisitesCommandEnv : public BaseCommandEnv
147*cdf0e10cSrcweir {
148*cdf0e10cSrcweir public:
149*cdf0e10cSrcweir     SilentCheckPrerequisitesCommandEnv();
150*cdf0e10cSrcweir     // XInteractionHandler
151*cdf0e10cSrcweir     virtual void SAL_CALL handle(
152*cdf0e10cSrcweir         css::uno::Reference<css::task::XInteractionRequest > const & xRequest )
153*cdf0e10cSrcweir         throw (css::uno::RuntimeException);
154*cdf0e10cSrcweir 
155*cdf0e10cSrcweir     // Set to true if a PlatformException or a DependencyException were handled.
156*cdf0e10cSrcweir     css::uno::Any m_Exception;
157*cdf0e10cSrcweir     // Set to true if an unknown exception was handled.
158*cdf0e10cSrcweir     css::uno::Any m_UnknownException;
159*cdf0e10cSrcweir };
160*cdf0e10cSrcweir 
161*cdf0e10cSrcweir // class NoExceptionCommandEnv : public BaseCommandEnv
162*cdf0e10cSrcweir // {
163*cdf0e10cSrcweir //     css::uno::Type m_type;
164*cdf0e10cSrcweir // public:
165*cdf0e10cSrcweir //     NoExceptionCommandEnv::NoExceptionCommandEnv(){};
166*cdf0e10cSrcweir //     NoExceptionCommandEnv::NoExceptionCommandEnv(
167*cdf0e10cSrcweir //         css::uno::Reference< css::task::XInteractionHandler> const & handler,
168*cdf0e10cSrcweir //         css::uno::Type const & type);
169*cdf0e10cSrcweir 
170*cdf0e10cSrcweir // // XInteractionHandler
171*cdf0e10cSrcweir //     virtual void SAL_CALL handle(
172*cdf0e10cSrcweir //         css::uno::Reference<css::task::XInteractionRequest > const & xRequest )
173*cdf0e10cSrcweir //         throw (css::uno::RuntimeException);
174*cdf0e10cSrcweir 
175*cdf0e10cSrcweir // };
176*cdf0e10cSrcweir 
177*cdf0e10cSrcweir }
178*cdf0e10cSrcweir 
179*cdf0e10cSrcweir 
180*cdf0e10cSrcweir 
181*cdf0e10cSrcweir 
182*cdf0e10cSrcweir #endif
183*cdf0e10cSrcweir 
184