SidebarPanelBase.cxx (f120fe41) SidebarPanelBase.cxx (a5761a6e)
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

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

37
38
39namespace sfx2 { namespace sidebar {
40
41Reference<ui::XUIElement> SidebarPanelBase::Create (
42 const ::rtl::OUString& rsResourceURL,
43 const cssu::Reference<css::frame::XFrame>& rxFrame,
44 Window* pWindow,
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

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

37
38
39namespace sfx2 { namespace sidebar {
40
41Reference<ui::XUIElement> SidebarPanelBase::Create (
42 const ::rtl::OUString& rsResourceURL,
43 const cssu::Reference<css::frame::XFrame>& rxFrame,
44 Window* pWindow,
45 const ::boost::function<void(void)>& rMenuProvider,
46 const css::ui::LayoutSize& rLayoutSize)
47{
48 Reference<ui::XUIElement> xUIElement (
49 new SidebarPanelBase(
50 rsResourceURL,
51 rxFrame,
52 pWindow,
45 const css::ui::LayoutSize& rLayoutSize)
46{
47 Reference<ui::XUIElement> xUIElement (
48 new SidebarPanelBase(
49 rsResourceURL,
50 rxFrame,
51 pWindow,
53 rMenuProvider,
54 rLayoutSize));
55 return xUIElement;
56}
57
58
59
60
61SidebarPanelBase::SidebarPanelBase (
62 const ::rtl::OUString& rsResourceURL,
63 const cssu::Reference<css::frame::XFrame>& rxFrame,
64 Window* pWindow,
52 rLayoutSize));
53 return xUIElement;
54}
55
56
57
58
59SidebarPanelBase::SidebarPanelBase (
60 const ::rtl::OUString& rsResourceURL,
61 const cssu::Reference<css::frame::XFrame>& rxFrame,
62 Window* pWindow,
65 const ::boost::function<void(void)>& rMenuProvider,
66 const css::ui::LayoutSize& rLayoutSize)
67 : SidebarPanelBaseInterfaceBase(m_aMutex),
68 mxFrame(rxFrame),
69 mpControl(pWindow),
70 msResourceURL(rsResourceURL),
63 const css::ui::LayoutSize& rLayoutSize)
64 : SidebarPanelBaseInterfaceBase(m_aMutex),
65 mxFrame(rxFrame),
66 mpControl(pWindow),
67 msResourceURL(rsResourceURL),
71 maMenuProvider(rMenuProvider),
72 maLayoutSize(rLayoutSize)
73{
68 maLayoutSize(rLayoutSize)
69{
74 OSL_TRACE("SidebarPanelBase created at %x", this);
70 // OSL_TRACE("SidebarPanelBase created at %x", this);
75
76 if (mxFrame.is())
77 {
78 cssu::Reference<css::ui::XContextChangeEventMultiplexer> xMultiplexer (
79 css::ui::ContextChangeEventMultiplexer::get(
80 ::comphelper::getProcessComponentContext()));
81 if (xMultiplexer.is())
82 xMultiplexer->addContextChangeEventListener(this, mxFrame->getController());
83 }
84 if (mpControl != NULL)
85 mpControl->Show();
86}
87
88
89
90
91SidebarPanelBase::~SidebarPanelBase (void)
92{
71
72 if (mxFrame.is())
73 {
74 cssu::Reference<css::ui::XContextChangeEventMultiplexer> xMultiplexer (
75 css::ui::ContextChangeEventMultiplexer::get(
76 ::comphelper::getProcessComponentContext()));
77 if (xMultiplexer.is())
78 xMultiplexer->addContextChangeEventListener(this, mxFrame->getController());
79 }
80 if (mpControl != NULL)
81 mpControl->Show();
82}
83
84
85
86
87SidebarPanelBase::~SidebarPanelBase (void)
88{
93 OSL_TRACE("SidebarPanelBase destroyed at %x", this);
94}
95
96
97
98
99void SAL_CALL SidebarPanelBase::disposing (void)
100 throw (cssu::RuntimeException)
101{
89}
90
91
92
93
94void SAL_CALL SidebarPanelBase::disposing (void)
95 throw (cssu::RuntimeException)
96{
102 OSL_TRACE("SidebarPanelBase disposing at %x", this);
103
104 if (mpControl != NULL)
105 {
106 delete mpControl;
107 mpControl = NULL;
108 }
109
110 if (mxFrame.is())
111 {

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

118 }
119}
120
121
122
123
124void SidebarPanelBase::SetControl (::Window* pControl)
125{
97 if (mpControl != NULL)
98 {
99 delete mpControl;
100 mpControl = NULL;
101 }
102
103 if (mxFrame.is())
104 {

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

111 }
112}
113
114
115
116
117void SidebarPanelBase::SetControl (::Window* pControl)
118{
126 OSL_TRACE("setting control of SidebarPanelBase at %x to %x", this, pControl);
127 mpControl = pControl;
128}
129
130
131
132
133::Window* SidebarPanelBase::GetControl (void) const
134{
135 return mpControl;
136}
137
138
139
140
141// XContextChangeEventListener
142void SAL_CALL SidebarPanelBase::notifyContextChangeEvent (
143 const ui::ContextChangeEventObject& rEvent)
144 throw (cssu::RuntimeException)
145{
119 mpControl = pControl;
120}
121
122
123
124
125::Window* SidebarPanelBase::GetControl (void) const
126{
127 return mpControl;
128}
129
130
131
132
133// XContextChangeEventListener
134void SAL_CALL SidebarPanelBase::notifyContextChangeEvent (
135 const ui::ContextChangeEventObject& rEvent)
136 throw (cssu::RuntimeException)
137{
146 OSL_TRACE("SidebarPanelBase notified at %x with control at %x", this, mpControl);
147
148 IContextChangeReceiver* pContextChangeReceiver
149 = dynamic_cast<IContextChangeReceiver*>(mpControl);
150 if (pContextChangeReceiver != NULL)
151 {
152 const EnumContext aContext(
153 EnumContext::GetApplicationEnum(rEvent.ApplicationName),
154 EnumContext::GetContextEnum(rEvent.ContextName));
155 pContextChangeReceiver->HandleContextChange(aContext);

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

160
161
162void SAL_CALL SidebarPanelBase::disposing (
163 const css::lang::EventObject& rEvent)
164 throw (cssu::RuntimeException)
165{
166 (void)rEvent;
167
138 IContextChangeReceiver* pContextChangeReceiver
139 = dynamic_cast<IContextChangeReceiver*>(mpControl);
140 if (pContextChangeReceiver != NULL)
141 {
142 const EnumContext aContext(
143 EnumContext::GetApplicationEnum(rEvent.ApplicationName),
144 EnumContext::GetContextEnum(rEvent.ContextName));
145 pContextChangeReceiver->HandleContextChange(aContext);

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

150
151
152void SAL_CALL SidebarPanelBase::disposing (
153 const css::lang::EventObject& rEvent)
154 throw (cssu::RuntimeException)
155{
156 (void)rEvent;
157
168 OSL_TRACE("SidebarPanelBase disposing(e) at %x", this);
169
170 mxFrame = NULL;
171 mpControl = NULL;
172}
173
174
175
176
177cssu::Reference<css::frame::XFrame> SAL_CALL SidebarPanelBase::getFrame (void)

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

255 }
256
257 return ui::LayoutSize(0,0,0);
258}
259
260
261
262
158 mxFrame = NULL;
159 mpControl = NULL;
160}
161
162
163
164
165cssu::Reference<css::frame::XFrame> SAL_CALL SidebarPanelBase::getFrame (void)

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

243 }
244
245 return ui::LayoutSize(0,0,0);
246}
247
248
249
250
263void SAL_CALL SidebarPanelBase::showMenu (void)
264 throw(cssu::RuntimeException)
265{
266 if (maMenuProvider)
267 maMenuProvider();
268}
269
270
271
272
273sal_Bool SAL_CALL SidebarPanelBase::isContextSupported (
274 const ::rtl::OUString& rsApplicationName,
275 const ::rtl::OUString& rsContextName)
276 throw(cssu::RuntimeException)
277{
278 (void)rsApplicationName;
279 (void)rsContextName;
280
281 return sal_True;
282}
283
284
285} } // end of namespace sfx2::sidebar
251} } // end of namespace sfx2::sidebar