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 #include "precompiled_sd.hxx" 25 26 #include "GenericConfigurationChangeRequest.hxx" 27 28 #include "framework/FrameworkHelper.hxx" 29 30 using namespace ::com::sun::star; 31 using namespace ::com::sun::star::uno; 32 using namespace ::com::sun::star::drawing::framework; 33 34 using ::rtl::OUString; 35 36 namespace sd { namespace framework { 37 GenericConfigurationChangeRequest(const Reference<XResourceId> & rxResourceId,const Mode eMode)38GenericConfigurationChangeRequest::GenericConfigurationChangeRequest ( 39 const Reference<XResourceId>& rxResourceId, 40 const Mode eMode) 41 : GenericConfigurationChangeRequestInterfaceBase(MutexOwner::maMutex), 42 mxResourceId(rxResourceId), 43 meMode(eMode) 44 { 45 if ( ! rxResourceId.is() || rxResourceId->getResourceURL().getLength()==0) 46 throw ::com::sun::star::lang::IllegalArgumentException(); 47 } 48 49 50 51 ~GenericConfigurationChangeRequest(void)52GenericConfigurationChangeRequest::~GenericConfigurationChangeRequest (void) throw() 53 { 54 } 55 56 57 58 execute(const Reference<XConfiguration> & rxConfiguration)59void SAL_CALL GenericConfigurationChangeRequest::execute ( 60 const Reference<XConfiguration>& rxConfiguration) 61 { 62 if (rxConfiguration.is()) 63 { 64 switch (meMode) 65 { 66 case Activation: 67 rxConfiguration->addResource(mxResourceId); 68 break; 69 70 case Deactivation: 71 rxConfiguration->removeResource(mxResourceId); 72 break; 73 } 74 } 75 } 76 77 78 79 getName(void)80OUString SAL_CALL GenericConfigurationChangeRequest::getName (void) 81 { 82 return OUString::createFromAscii("GenericConfigurationChangeRequest ") 83 + OUString::createFromAscii(meMode==Activation ? "activate " : "deactivate ") 84 + FrameworkHelper::ResourceIdToString(mxResourceId); 85 } 86 87 88 89 setName(const OUString & rsName)90void SAL_CALL GenericConfigurationChangeRequest::setName (const OUString& rsName) 91 { 92 (void)rsName; 93 // Ignored. 94 } 95 96 } } // end of namespace sd::framework 97