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 #include "precompiled_svx.hxx" 23 #include <com/sun/star/ui/ContextChangeEventObject.hpp> 24 #include <com/sun/star/ui/XContextChangeEventMultiplexer.hpp> 25 #include <com/sun/star/ui/ContextChangeEventMultiplexer.hpp> 26 #include <comphelper/processfactory.hxx> 27 #include "svx/sidebar/ContextChangeEventMultiplexer.hxx" 28 #include <boost/scoped_ptr.hpp> 29 30 31 using namespace css; 32 using namespace cssu; 33 34 #define A2S(pString) (::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(pString))) 35 36 const ::rtl::OUString ContextChangeEventMultiplexer::Application_Impress (A2S("impress")); 37 38 const ::rtl::OUString ContextChangeEventMultiplexer::Context_TextEdit (A2S("text-edit")); 39 const ::rtl::OUString ContextChangeEventMultiplexer::Context_Default (A2S("default")); 40 41 42 void ContextChangeEventMultiplexer::NotifyContextChange ( 43 const cssu::Reference<css::frame::XController>& rxController, 44 const ::rtl::OUString& rsApplicationName, 45 const ::rtl::OUString& rsContextName) 46 { 47 const css::ui::ContextChangeEventObject aEvent( 48 rxController, 49 rsApplicationName, 50 rsContextName); 51 52 cssu::Reference<css::ui::XContextChangeEventMultiplexer> xMultiplexer ( 53 css::ui::ContextChangeEventMultiplexer::get( 54 ::comphelper::getProcessComponentContext())); 55 if (xMultiplexer.is()) 56 xMultiplexer->broadcastContextChangeEvent(aEvent, rxController); 57 } 58