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 SD_FRAMEWORK_GENERIC_CONFIGURATTION_CHANGE_REQUEST_HXX
29 #define SD_FRAMEWORK_GENERIC_CONFIGURATTION_CHANGE_REQUEST_HXX
30 
31 #include "MutexOwner.hxx"
32 #include <com/sun/star/drawing/framework/XConfigurationChangeRequest.hpp>
33 #include <com/sun/star/container/XNamed.hpp>
34 #include <com/sun/star/drawing/framework/XConfiguration.hpp>
35 #include <com/sun/star/drawing/framework/XResourceId.hpp>
36 #include <com/sun/star/lang/IllegalArgumentException.hpp>
37 #include <com/sun/star/beans/PropertyValues.hpp>
38 #include <cppuhelper/compbase2.hxx>
39 
40 namespace css = ::com::sun::star;
41 
42 namespace {
43 
44 typedef ::cppu::WeakComponentImplHelper2 <
45       ::com::sun::star::drawing::framework::XConfigurationChangeRequest,
46       ::com::sun::star::container::XNamed
47     > GenericConfigurationChangeRequestInterfaceBase;
48 
49 } // end of anonymous namespace.
50 
51 
52 namespace sd { namespace framework {
53 
54 /** This implementation of the XConfigurationChangeRequest interface
55     represents a single explicit request for a configuration change.  On its
56     execution it may result in other, implicit, configuration changes.  For
57     example this is the case when the deactivation of a unique resource is
58     requested: the resources linked to it have to be deactivated as well.
59 */
60 class GenericConfigurationChangeRequest
61     : private MutexOwner,
62       public GenericConfigurationChangeRequestInterfaceBase
63 {
64 public:
65     /** This enum specified whether the activation or deactivation of a
66         resource is requested.
67     */
68     enum Mode { Activation, Deactivation };
69 
70     /** Create a new object that represents the request for activation or
71         deactivation of the specified resource.
72         @param rxsResourceId
73             Id of the resource that is to be activated or deactivated.
74         @param eMode
75             The mode specifies whether to activate or to deactivate the
76             resource.
77     */
78 	GenericConfigurationChangeRequest (
79         const ::com::sun::star::uno::Reference<com::sun::star::drawing::framework::XResourceId>&
80             rxResourceId,
81         const Mode eMode)
82         throw (::com::sun::star::lang::IllegalArgumentException);
83 
84 	virtual ~GenericConfigurationChangeRequest (void) throw();
85 
86 
87     // XConfigurationChangeOperation
88 
89     /** The requested configuration change is executed on the given
90         configuration.  Additionally to the explicitly requested change
91         other changes have to be made as well.  See class description for an
92         example.
93         @param rxConfiguration
94             The configuration to which the requested change is made.
95     */
96     virtual void SAL_CALL execute (
97         const ::com::sun::star::uno::Reference<
98             com::sun::star::drawing::framework::XConfiguration>& rxConfiguration)
99         throw (::com::sun::star::uno::RuntimeException);
100 
101 
102     // XNamed
103 
104     /** Return a human readable string representation.  This is used for
105         debugging purposes.
106     */
107     virtual ::rtl::OUString SAL_CALL getName (void)
108         throw (::com::sun::star::uno::RuntimeException);
109 
110     /** This call is ignored because the XNamed interface is (mis)used to
111         give access to a human readable name for debugging purposes.
112     */
113     virtual void SAL_CALL setName (const ::rtl::OUString& rName)
114         throw (::com::sun::star::uno::RuntimeException);
115 
116 private:
117     const css::uno::Reference<css::drawing::framework::XResourceId> mxResourceId;
118     const Mode meMode;
119 };
120 
121 } } // end of namespace sd::framework
122 
123 #endif
124