xref: /AOO41X/main/svx/source/sidebar/ContextChangeEventMultiplexer.cxx (revision 22de8995e98e3a56ca408d1c38158e9063b52d2e)
1*22de8995SAndre Fischer /**************************************************************
2*22de8995SAndre Fischer  *
3*22de8995SAndre Fischer  * Licensed to the Apache Software Foundation (ASF) under one
4*22de8995SAndre Fischer  * or more contributor license agreements.  See the NOTICE file
5*22de8995SAndre Fischer  * distributed with this work for additional information
6*22de8995SAndre Fischer  * regarding copyright ownership.  The ASF licenses this file
7*22de8995SAndre Fischer  * to you under the Apache License, Version 2.0 (the
8*22de8995SAndre Fischer  * "License"); you may not use this file except in compliance
9*22de8995SAndre Fischer  * with the License.  You may obtain a copy of the License at
10*22de8995SAndre Fischer  *
11*22de8995SAndre Fischer  *   http://www.apache.org/licenses/LICENSE-2.0
12*22de8995SAndre Fischer  *
13*22de8995SAndre Fischer  * Unless required by applicable law or agreed to in writing,
14*22de8995SAndre Fischer  * software distributed under the License is distributed on an
15*22de8995SAndre Fischer  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*22de8995SAndre Fischer  * KIND, either express or implied.  See the License for the
17*22de8995SAndre Fischer  * specific language governing permissions and limitations
18*22de8995SAndre Fischer  * under the License.
19*22de8995SAndre Fischer  *
20*22de8995SAndre Fischer  *************************************************************/
21*22de8995SAndre Fischer 
22*22de8995SAndre Fischer #include "precompiled_svx.hxx"
23*22de8995SAndre Fischer #include <com/sun/star/ui/ContextChangeEventObject.hpp>
24*22de8995SAndre Fischer #include <com/sun/star/ui/XContextChangeEventMultiplexer.hpp>
25*22de8995SAndre Fischer #include <com/sun/star/ui/ContextChangeEventMultiplexer.hpp>
26*22de8995SAndre Fischer #include <comphelper/processfactory.hxx>
27*22de8995SAndre Fischer #include "svx/sidebar/ContextChangeEventMultiplexer.hxx"
28*22de8995SAndre Fischer #include <boost/scoped_ptr.hpp>
29*22de8995SAndre Fischer 
30*22de8995SAndre Fischer 
31*22de8995SAndre Fischer using namespace css;
32*22de8995SAndre Fischer using namespace cssu;
33*22de8995SAndre Fischer 
34*22de8995SAndre Fischer #define A2S(pString) (::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(pString)))
35*22de8995SAndre Fischer 
36*22de8995SAndre Fischer const ::rtl::OUString ContextChangeEventMultiplexer::Application_Impress (A2S("impress"));
37*22de8995SAndre Fischer 
38*22de8995SAndre Fischer const ::rtl::OUString ContextChangeEventMultiplexer::Context_TextEdit (A2S("text-edit"));
39*22de8995SAndre Fischer const ::rtl::OUString ContextChangeEventMultiplexer::Context_Default (A2S("default"));
40*22de8995SAndre Fischer 
41*22de8995SAndre Fischer 
42*22de8995SAndre Fischer void ContextChangeEventMultiplexer::NotifyContextChange (
43*22de8995SAndre Fischer     const cssu::Reference<css::frame::XController>& rxController,
44*22de8995SAndre Fischer     const ::rtl::OUString& rsApplicationName,
45*22de8995SAndre Fischer     const ::rtl::OUString& rsContextName)
46*22de8995SAndre Fischer {
47*22de8995SAndre Fischer     const css::ui::ContextChangeEventObject aEvent(
48*22de8995SAndre Fischer             rxController,
49*22de8995SAndre Fischer             rsApplicationName,
50*22de8995SAndre Fischer             rsContextName);
51*22de8995SAndre Fischer 
52*22de8995SAndre Fischer     cssu::Reference<css::ui::XContextChangeEventMultiplexer> xMultiplexer (
53*22de8995SAndre Fischer         css::ui::ContextChangeEventMultiplexer::get(
54*22de8995SAndre Fischer             ::comphelper::getProcessComponentContext()));
55*22de8995SAndre Fischer     if (xMultiplexer.is())
56*22de8995SAndre Fischer         xMultiplexer->broadcastContextChangeEvent(aEvent, rxController);
57*22de8995SAndre Fischer }
58