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