SidebarToolBox.cxx (d46a1e42) SidebarToolBox.cxx (8a1a651a)
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

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

43
44
45SidebarToolBox::SidebarToolBox (
46 Window* pParentWindow,
47 const ResId& rResId,
48 const cssu::Reference<css::frame::XFrame>& rxFrame)
49 : ToolBox(pParentWindow, rResId),
50 mbParentIsBorder(false),
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

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

43
44
45SidebarToolBox::SidebarToolBox (
46 Window* pParentWindow,
47 const ResId& rResId,
48 const cssu::Reference<css::frame::XFrame>& rxFrame)
49 : ToolBox(pParentWindow, rResId),
50 mbParentIsBorder(false),
51 maItemSeparator(Theme::GetImage(Theme::Image_ToolBoxItemSeparator))
51 maItemSeparator(Theme::GetImage(Theme::Image_ToolBoxItemSeparator)),
52 maControllers(),
53 mbAreHandlersRegistered(false)
52{
53 SetBackground(Wallpaper());
54 SetPaintTransparent(true);
55
56 if (rxFrame.is())
57 {
58 const sal_uInt16 nItemCount (GetItemCount());
59 if (nItemCount == 1)

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

64 }
65 else
66 for (sal_uInt16 nItemIndex=0; nItemIndex<nItemCount; ++nItemIndex)
67 CreateController(GetItemId(nItemIndex), rxFrame, 0);
68 UpdateIcons(rxFrame);
69
70 SetSizePixel(CalcWindowSizePixel());
71
54{
55 SetBackground(Wallpaper());
56 SetPaintTransparent(true);
57
58 if (rxFrame.is())
59 {
60 const sal_uInt16 nItemCount (GetItemCount());
61 if (nItemCount == 1)

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

66 }
67 else
68 for (sal_uInt16 nItemIndex=0; nItemIndex<nItemCount; ++nItemIndex)
69 CreateController(GetItemId(nItemIndex), rxFrame, 0);
70 UpdateIcons(rxFrame);
71
72 SetSizePixel(CalcWindowSizePixel());
73
72 SetDropdownClickHdl(LINK(this, SidebarToolBox, DropDownClickHandler));
73 SetClickHdl(LINK(this, SidebarToolBox, ClickHandler));
74 SetDoubleClickHdl(LINK(this, SidebarToolBox, DoubleClickHandler));
75 SetSelectHdl(LINK(this, SidebarToolBox, SelectHandler));
76 SetActivateHdl(LINK(this, SidebarToolBox, Activate));
77 SetDeactivateHdl(LINK(this, SidebarToolBox, Deactivate));
74 RegisterHandlers();
78 }
79
80#ifdef DEBUG
81 SetText(A2S("SidebarToolBox"));
82#endif
83}
84
85
86
87
75 }
76
77#ifdef DEBUG
78 SetText(A2S("SidebarToolBox"));
79#endif
80}
81
82
83
84
85SidebarToolBox::SidebarToolBox (Window* pParentWindow)
86 : ToolBox(pParentWindow, 0),
87 mbParentIsBorder(false),
88 maItemSeparator(Theme::GetImage(Theme::Image_ToolBoxItemSeparator)),
89 maControllers(),
90 mbAreHandlersRegistered(false)
91{
92 SetBackground(Wallpaper());
93 SetPaintTransparent(true);
94
95#ifdef DEBUG
96 SetText(A2S("SidebarToolBox"));
97#endif
98}
99
100
101
102
88SidebarToolBox::~SidebarToolBox (void)
89{
90 ControllerContainer aControllers;
91 aControllers.swap(maControllers);
92 for (ControllerContainer::iterator iController(aControllers.begin()), iEnd(aControllers.end());
93 iController!=iEnd;
94 ++iController)
95 {
96 Reference<lang::XComponent> xComponent (iController->second.mxController, UNO_QUERY);
97 if (xComponent.is())
98 xComponent->dispose();
99 }
100
103SidebarToolBox::~SidebarToolBox (void)
104{
105 ControllerContainer aControllers;
106 aControllers.swap(maControllers);
107 for (ControllerContainer::iterator iController(aControllers.begin()), iEnd(aControllers.end());
108 iController!=iEnd;
109 ++iController)
110 {
111 Reference<lang::XComponent> xComponent (iController->second.mxController, UNO_QUERY);
112 if (xComponent.is())
113 xComponent->dispose();
114 }
115
101 SetDropdownClickHdl(Link());
102 SetClickHdl(Link());
103 SetDoubleClickHdl(Link());
104 SetSelectHdl(Link());
105 SetActivateHdl(Link());
106 SetDeactivateHdl(Link());
107
116 if (mbAreHandlersRegistered)
117 {
118 SetDropdownClickHdl(Link());
119 SetClickHdl(Link());
120 SetDoubleClickHdl(Link());
121 SetSelectHdl(Link());
122 SetActivateHdl(Link());
123 SetDeactivateHdl(Link());
124 }
108}
109
110
111
112
113void SidebarToolBox::SetBorderWindow (const Window* pBorderWindow)
114{
115 if (pBorderWindow != GetParent())

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

260 return iController->second.mxController;
261 else
262 return NULL;
263}
264
265
266
267
125}
126
127
128
129
130void SidebarToolBox::SetBorderWindow (const Window* pBorderWindow)
131{
132 if (pBorderWindow != GetParent())

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

277 return iController->second.mxController;
278 else
279 return NULL;
280}
281
282
283
284
285void SidebarToolBox::SetController(
286 const sal_uInt16 nItemId,
287 const cssu::Reference<css::frame::XToolbarController>& rxController,
288 const ::rtl::OUString& rsCommandName)
289{
290 ItemDescriptor aDescriptor;
291 aDescriptor.mxController = rxController;
292 aDescriptor.maURL = sfx2::sidebar::Tools::GetURL(rsCommandName);
293 aDescriptor.msCurrentCommand = rsCommandName;
294
295 ControllerContainer::iterator iController (maControllers.find(nItemId));
296 if (iController != maControllers.end())
297 {
298 Reference<lang::XComponent> xComponent (iController->second.mxController, UNO_QUERY);
299 if (xComponent.is())
300 xComponent->dispose();
301
302 iController->second = aDescriptor;
303 }
304 else
305 {
306 maControllers[nItemId] = aDescriptor;
307 }
308
309 if (rxController.is())
310 RegisterHandlers();
311}
312
313
314
315
268void SidebarToolBox::UpdateIcons (const Reference<frame::XFrame>& rxFrame)
269{
270 const sal_Bool bBigImages (SvtMiscOptions().AreCurrentSymbolsLarge());
271 const bool bIsHighContrastActive (sfx2::sidebar::Theme::IsHighContrastMode());
272
273 for (ControllerContainer::iterator iController(maControllers.begin()), iEnd(maControllers.end());
274 iController!=iEnd;
275 ++iController)

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

298 return iController->first;
299 }
300 }
301 return 0;
302}
303
304
305
316void SidebarToolBox::UpdateIcons (const Reference<frame::XFrame>& rxFrame)
317{
318 const sal_Bool bBigImages (SvtMiscOptions().AreCurrentSymbolsLarge());
319 const bool bIsHighContrastActive (sfx2::sidebar::Theme::IsHighContrastMode());
320
321 for (ControllerContainer::iterator iController(maControllers.begin()), iEnd(maControllers.end());
322 iController!=iEnd;
323 ++iController)

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

346 return iController->first;
347 }
348 }
349 return 0;
350}
351
352
353
354
355void SidebarToolBox::RegisterHandlers (void)
356{
357 if ( ! mbAreHandlersRegistered)
358 {
359 mbAreHandlersRegistered = true;
360 SetDropdownClickHdl(LINK(this, SidebarToolBox, DropDownClickHandler));
361 SetClickHdl(LINK(this, SidebarToolBox, ClickHandler));
362 SetDoubleClickHdl(LINK(this, SidebarToolBox, DoubleClickHandler));
363 SetSelectHdl(LINK(this, SidebarToolBox, SelectHandler));
364 SetActivateHdl(LINK(this, SidebarToolBox, Activate));
365 SetDeactivateHdl(LINK(this, SidebarToolBox, Deactivate));
366 }
367}
368
369
370
371
306IMPL_LINK(SidebarToolBox, DropDownClickHandler, ToolBox*, pToolBox)
307{
308 if (pToolBox != NULL)
309 {
310 Reference<frame::XToolbarController> xController (GetControllerForItemId(pToolBox->GetCurItemId()));
311 if (xController.is())
312 {
313 Reference<awt::XWindow> xWindow = xController->createPopupWindow();

--- 71 unchanged lines hidden ---
372IMPL_LINK(SidebarToolBox, DropDownClickHandler, ToolBox*, pToolBox)
373{
374 if (pToolBox != NULL)
375 {
376 Reference<frame::XToolbarController> xController (GetControllerForItemId(pToolBox->GetCurItemId()));
377 if (xController.is())
378 {
379 Reference<awt::XWindow> xWindow = xController->createPopupWindow();

--- 71 unchanged lines hidden ---