Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 :
21 : #include "GenericConfigurationChangeRequest.hxx"
22 :
23 : #include "framework/FrameworkHelper.hxx"
24 :
25 : using namespace ::com::sun::star;
26 : using namespace ::com::sun::star::uno;
27 : using namespace ::com::sun::star::drawing::framework;
28 :
29 : using ::rtl::OUString;
30 :
31 : namespace sd { namespace framework {
32 :
33 0 : GenericConfigurationChangeRequest::GenericConfigurationChangeRequest (
34 : const Reference<XResourceId>& rxResourceId,
35 : const Mode eMode) throw(::com::sun::star::lang::IllegalArgumentException)
36 : : GenericConfigurationChangeRequestInterfaceBase(MutexOwner::maMutex),
37 : mxResourceId(rxResourceId),
38 0 : meMode(eMode)
39 : {
40 0 : if ( ! rxResourceId.is() || rxResourceId->getResourceURL().isEmpty())
41 0 : throw ::com::sun::star::lang::IllegalArgumentException();
42 0 : }
43 :
44 :
45 :
46 :
47 0 : GenericConfigurationChangeRequest::~GenericConfigurationChangeRequest (void) throw()
48 : {
49 0 : }
50 :
51 :
52 :
53 :
54 0 : void SAL_CALL GenericConfigurationChangeRequest::execute (
55 : const Reference<XConfiguration>& rxConfiguration)
56 : throw (RuntimeException)
57 : {
58 0 : if (rxConfiguration.is())
59 : {
60 0 : switch (meMode)
61 : {
62 : case Activation:
63 0 : rxConfiguration->addResource(mxResourceId);
64 0 : break;
65 :
66 : case Deactivation:
67 0 : rxConfiguration->removeResource(mxResourceId);
68 0 : break;
69 : }
70 : }
71 0 : }
72 :
73 :
74 :
75 :
76 0 : OUString SAL_CALL GenericConfigurationChangeRequest::getName (void)
77 : throw (RuntimeException)
78 : {
79 : return OUString("GenericConfigurationChangeRequest ")
80 0 : + (meMode==Activation ? OUString("activate ") : OUString("deactivate "))
81 0 : + FrameworkHelper::ResourceIdToString(mxResourceId);
82 : }
83 :
84 :
85 :
86 :
87 0 : void SAL_CALL GenericConfigurationChangeRequest::setName (const OUString& rsName)
88 : throw (RuntimeException)
89 : {
90 : (void)rsName;
91 : // Ignored.
92 0 : }
93 :
94 : } } // end of namespace sd::framework
95 :
96 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|