1*b1cdbd2cSJim Jagielski /**************************************************************
2*b1cdbd2cSJim Jagielski  *
3*b1cdbd2cSJim Jagielski  * Licensed to the Apache Software Foundation (ASF) under one
4*b1cdbd2cSJim Jagielski  * or more contributor license agreements.  See the NOTICE file
5*b1cdbd2cSJim Jagielski  * distributed with this work for additional information
6*b1cdbd2cSJim Jagielski  * regarding copyright ownership.  The ASF licenses this file
7*b1cdbd2cSJim Jagielski  * to you under the Apache License, Version 2.0 (the
8*b1cdbd2cSJim Jagielski  * "License"); you may not use this file except in compliance
9*b1cdbd2cSJim Jagielski  * with the License.  You may obtain a copy of the License at
10*b1cdbd2cSJim Jagielski  *
11*b1cdbd2cSJim Jagielski  *   http://www.apache.org/licenses/LICENSE-2.0
12*b1cdbd2cSJim Jagielski  *
13*b1cdbd2cSJim Jagielski  * Unless required by applicable law or agreed to in writing,
14*b1cdbd2cSJim Jagielski  * software distributed under the License is distributed on an
15*b1cdbd2cSJim Jagielski  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*b1cdbd2cSJim Jagielski  * KIND, either express or implied.  See the License for the
17*b1cdbd2cSJim Jagielski  * specific language governing permissions and limitations
18*b1cdbd2cSJim Jagielski  * under the License.
19*b1cdbd2cSJim Jagielski  *
20*b1cdbd2cSJim Jagielski  *************************************************************/
21*b1cdbd2cSJim Jagielski 
22*b1cdbd2cSJim Jagielski 
23*b1cdbd2cSJim Jagielski 
24*b1cdbd2cSJim Jagielski #ifndef SD_FRAMEWORK_GENERIC_CONFIGURATTION_CHANGE_REQUEST_HXX
25*b1cdbd2cSJim Jagielski #define SD_FRAMEWORK_GENERIC_CONFIGURATTION_CHANGE_REQUEST_HXX
26*b1cdbd2cSJim Jagielski 
27*b1cdbd2cSJim Jagielski #include "MutexOwner.hxx"
28*b1cdbd2cSJim Jagielski #include <com/sun/star/drawing/framework/XConfigurationChangeRequest.hpp>
29*b1cdbd2cSJim Jagielski #include <com/sun/star/container/XNamed.hpp>
30*b1cdbd2cSJim Jagielski #include <com/sun/star/drawing/framework/XConfiguration.hpp>
31*b1cdbd2cSJim Jagielski #include <com/sun/star/drawing/framework/XResourceId.hpp>
32*b1cdbd2cSJim Jagielski #include <com/sun/star/lang/IllegalArgumentException.hpp>
33*b1cdbd2cSJim Jagielski #include <com/sun/star/beans/PropertyValues.hpp>
34*b1cdbd2cSJim Jagielski #include <cppuhelper/compbase2.hxx>
35*b1cdbd2cSJim Jagielski 
36*b1cdbd2cSJim Jagielski namespace css = ::com::sun::star;
37*b1cdbd2cSJim Jagielski 
38*b1cdbd2cSJim Jagielski namespace {
39*b1cdbd2cSJim Jagielski 
40*b1cdbd2cSJim Jagielski typedef ::cppu::WeakComponentImplHelper2 <
41*b1cdbd2cSJim Jagielski       ::com::sun::star::drawing::framework::XConfigurationChangeRequest,
42*b1cdbd2cSJim Jagielski       ::com::sun::star::container::XNamed
43*b1cdbd2cSJim Jagielski     > GenericConfigurationChangeRequestInterfaceBase;
44*b1cdbd2cSJim Jagielski 
45*b1cdbd2cSJim Jagielski } // end of anonymous namespace.
46*b1cdbd2cSJim Jagielski 
47*b1cdbd2cSJim Jagielski 
48*b1cdbd2cSJim Jagielski namespace sd { namespace framework {
49*b1cdbd2cSJim Jagielski 
50*b1cdbd2cSJim Jagielski /** This implementation of the XConfigurationChangeRequest interface
51*b1cdbd2cSJim Jagielski     represents a single explicit request for a configuration change.  On its
52*b1cdbd2cSJim Jagielski     execution it may result in other, implicit, configuration changes.  For
53*b1cdbd2cSJim Jagielski     example this is the case when the deactivation of a unique resource is
54*b1cdbd2cSJim Jagielski     requested: the resources linked to it have to be deactivated as well.
55*b1cdbd2cSJim Jagielski */
56*b1cdbd2cSJim Jagielski class GenericConfigurationChangeRequest
57*b1cdbd2cSJim Jagielski     : private MutexOwner,
58*b1cdbd2cSJim Jagielski       public GenericConfigurationChangeRequestInterfaceBase
59*b1cdbd2cSJim Jagielski {
60*b1cdbd2cSJim Jagielski public:
61*b1cdbd2cSJim Jagielski     /** This enum specified whether the activation or deactivation of a
62*b1cdbd2cSJim Jagielski         resource is requested.
63*b1cdbd2cSJim Jagielski     */
64*b1cdbd2cSJim Jagielski     enum Mode { Activation, Deactivation };
65*b1cdbd2cSJim Jagielski 
66*b1cdbd2cSJim Jagielski     /** Create a new object that represents the request for activation or
67*b1cdbd2cSJim Jagielski         deactivation of the specified resource.
68*b1cdbd2cSJim Jagielski         @param rxsResourceId
69*b1cdbd2cSJim Jagielski             Id of the resource that is to be activated or deactivated.
70*b1cdbd2cSJim Jagielski         @param eMode
71*b1cdbd2cSJim Jagielski             The mode specifies whether to activate or to deactivate the
72*b1cdbd2cSJim Jagielski             resource.
73*b1cdbd2cSJim Jagielski     */
74*b1cdbd2cSJim Jagielski 	GenericConfigurationChangeRequest (
75*b1cdbd2cSJim Jagielski         const ::com::sun::star::uno::Reference<com::sun::star::drawing::framework::XResourceId>&
76*b1cdbd2cSJim Jagielski             rxResourceId,
77*b1cdbd2cSJim Jagielski         const Mode eMode)
78*b1cdbd2cSJim Jagielski         throw (::com::sun::star::lang::IllegalArgumentException);
79*b1cdbd2cSJim Jagielski 
80*b1cdbd2cSJim Jagielski 	virtual ~GenericConfigurationChangeRequest (void) throw();
81*b1cdbd2cSJim Jagielski 
82*b1cdbd2cSJim Jagielski 
83*b1cdbd2cSJim Jagielski     // XConfigurationChangeOperation
84*b1cdbd2cSJim Jagielski 
85*b1cdbd2cSJim Jagielski     /** The requested configuration change is executed on the given
86*b1cdbd2cSJim Jagielski         configuration.  Additionally to the explicitly requested change
87*b1cdbd2cSJim Jagielski         other changes have to be made as well.  See class description for an
88*b1cdbd2cSJim Jagielski         example.
89*b1cdbd2cSJim Jagielski         @param rxConfiguration
90*b1cdbd2cSJim Jagielski             The configuration to which the requested change is made.
91*b1cdbd2cSJim Jagielski     */
92*b1cdbd2cSJim Jagielski     virtual void SAL_CALL execute (
93*b1cdbd2cSJim Jagielski         const ::com::sun::star::uno::Reference<
94*b1cdbd2cSJim Jagielski             com::sun::star::drawing::framework::XConfiguration>& rxConfiguration)
95*b1cdbd2cSJim Jagielski         throw (::com::sun::star::uno::RuntimeException);
96*b1cdbd2cSJim Jagielski 
97*b1cdbd2cSJim Jagielski 
98*b1cdbd2cSJim Jagielski     // XNamed
99*b1cdbd2cSJim Jagielski 
100*b1cdbd2cSJim Jagielski     /** Return a human readable string representation.  This is used for
101*b1cdbd2cSJim Jagielski         debugging purposes.
102*b1cdbd2cSJim Jagielski     */
103*b1cdbd2cSJim Jagielski     virtual ::rtl::OUString SAL_CALL getName (void)
104*b1cdbd2cSJim Jagielski         throw (::com::sun::star::uno::RuntimeException);
105*b1cdbd2cSJim Jagielski 
106*b1cdbd2cSJim Jagielski     /** This call is ignored because the XNamed interface is (mis)used to
107*b1cdbd2cSJim Jagielski         give access to a human readable name for debugging purposes.
108*b1cdbd2cSJim Jagielski     */
109*b1cdbd2cSJim Jagielski     virtual void SAL_CALL setName (const ::rtl::OUString& rName)
110*b1cdbd2cSJim Jagielski         throw (::com::sun::star::uno::RuntimeException);
111*b1cdbd2cSJim Jagielski 
112*b1cdbd2cSJim Jagielski private:
113*b1cdbd2cSJim Jagielski     const css::uno::Reference<css::drawing::framework::XResourceId> mxResourceId;
114*b1cdbd2cSJim Jagielski     const Mode meMode;
115*b1cdbd2cSJim Jagielski };
116*b1cdbd2cSJim Jagielski 
117*b1cdbd2cSJim Jagielski } } // end of namespace sd::framework
118*b1cdbd2cSJim Jagielski 
119*b1cdbd2cSJim Jagielski #endif
120