ContextChangeEventMultiplexer.cxx (b9e67834) ContextChangeEventMultiplexer.cxx (95a18594)
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

--- 27 unchanged lines hidden (view full) ---

36using namespace cssu;
37
38#define A2S(pString) (::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(pString)))
39
40void ContextChangeEventMultiplexer::NotifyContextChange (
41 const cssu::Reference<css::frame::XController>& rxController,
42 const ::sfx2::sidebar::EnumContext::Context eContext)
43{
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

--- 27 unchanged lines hidden (view full) ---

36using namespace cssu;
37
38#define A2S(pString) (::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(pString)))
39
40void ContextChangeEventMultiplexer::NotifyContextChange (
41 const cssu::Reference<css::frame::XController>& rxController,
42 const ::sfx2::sidebar::EnumContext::Context eContext)
43{
44 if (rxController.is())
44 if (rxController.is() && rxController->getFrame().is())
45 {
46 const css::ui::ContextChangeEventObject aEvent(
47 rxController,
48 GetModuleName(rxController->getFrame()),
49 ::sfx2::sidebar::EnumContext::GetContextName(eContext));
50
51 cssu::Reference<css::ui::XContextChangeEventMultiplexer> xMultiplexer (
52 css::ui::ContextChangeEventMultiplexer::get(

--- 14 unchanged lines hidden (view full) ---

67 const ::comphelper::ComponentContext aContext (::comphelper::getProcessServiceFactory());
68 const Reference<frame::XModuleManager> xModuleManager (
69 aContext.createComponent("com.sun.star.frame.ModuleManager" ),
70 UNO_QUERY_THROW );
71 return xModuleManager->identify(rxFrame);
72 }
73 catch (const Exception&)
74 {
45 {
46 const css::ui::ContextChangeEventObject aEvent(
47 rxController,
48 GetModuleName(rxController->getFrame()),
49 ::sfx2::sidebar::EnumContext::GetContextName(eContext));
50
51 cssu::Reference<css::ui::XContextChangeEventMultiplexer> xMultiplexer (
52 css::ui::ContextChangeEventMultiplexer::get(

--- 14 unchanged lines hidden (view full) ---

67 const ::comphelper::ComponentContext aContext (::comphelper::getProcessServiceFactory());
68 const Reference<frame::XModuleManager> xModuleManager (
69 aContext.createComponent("com.sun.star.frame.ModuleManager" ),
70 UNO_QUERY_THROW );
71 return xModuleManager->identify(rxFrame);
72 }
73 catch (const Exception&)
74 {
75 DBG_UNHANDLED_EXCEPTION();
75 // An exception typically means that a context change is notified
76 // during initialization or destruction of a view.
77 // Ignore it.
76 }
77 return ::sfx2::sidebar::EnumContext::GetApplicationName(
78 }
79 return ::sfx2::sidebar::EnumContext::GetApplicationName(
78 ::sfx2::sidebar::EnumContext::Application_Other);
80 ::sfx2::sidebar::EnumContext::Application_Unknown);
79}
81}