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