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