merge the formfield patch from ooo-build
[ooovba.git] / sd / source / ui / framework / configuration / GenericConfigurationChangeRequest.cxx
blobbb62ac4cb8378bb7098fe841cc0475d24c7dcbf8
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: GenericConfigurationChangeRequest.cxx,v $
10 * $Revision: 1.4 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #include "precompiled_sd.hxx"
33 #include "GenericConfigurationChangeRequest.hxx"
35 #include "framework/FrameworkHelper.hxx"
37 using namespace ::com::sun::star;
38 using namespace ::com::sun::star::uno;
39 using namespace ::com::sun::star::drawing::framework;
41 using ::rtl::OUString;
43 namespace sd { namespace framework {
45 GenericConfigurationChangeRequest::GenericConfigurationChangeRequest (
46 const Reference<XResourceId>& rxResourceId,
47 const Mode eMode) throw(::com::sun::star::lang::IllegalArgumentException)
48 : GenericConfigurationChangeRequestInterfaceBase(MutexOwner::maMutex),
49 mxResourceId(rxResourceId),
50 meMode(eMode)
52 if ( ! rxResourceId.is() || rxResourceId->getResourceURL().getLength()==0)
53 throw ::com::sun::star::lang::IllegalArgumentException();
59 GenericConfigurationChangeRequest::~GenericConfigurationChangeRequest (void) throw()
66 void SAL_CALL GenericConfigurationChangeRequest::execute (
67 const Reference<XConfiguration>& rxConfiguration)
68 throw (RuntimeException)
70 if (rxConfiguration.is())
72 switch (meMode)
74 case Activation:
75 rxConfiguration->addResource(mxResourceId);
76 break;
78 case Deactivation:
79 rxConfiguration->removeResource(mxResourceId);
80 break;
88 OUString SAL_CALL GenericConfigurationChangeRequest::getName (void)
89 throw (RuntimeException)
91 return OUString::createFromAscii("GenericConfigurationChangeRequest ")
92 + OUString::createFromAscii(meMode==Activation ? "activate " : "deactivate ")
93 + FrameworkHelper::ResourceIdToString(mxResourceId);
99 void SAL_CALL GenericConfigurationChangeRequest::setName (const OUString& rsName)
100 throw (RuntimeException)
102 (void)rsName;
103 // Ignored.
106 } } // end of namespace sd::framework