SidebarToolBox.cxx (edc7f530) | SidebarToolBox.cxx (d46a1e42) |
---|---|
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 --- 14 unchanged lines hidden (view full) --- 23 24#include "sfx2/sidebar/SidebarToolBox.hxx" 25#include "ToolBoxBackground.hxx" 26#include "sfx2/sidebar/ControllerFactory.hxx" 27#include "sfx2/sidebar/Theme.hxx" 28#include "sfx2/sidebar/Tools.hxx" 29 30#include <vcl/gradient.hxx> | 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 --- 14 unchanged lines hidden (view full) --- 23 24#include "sfx2/sidebar/SidebarToolBox.hxx" 25#include "ToolBoxBackground.hxx" 26#include "sfx2/sidebar/ControllerFactory.hxx" 27#include "sfx2/sidebar/Theme.hxx" 28#include "sfx2/sidebar/Tools.hxx" 29 30#include <vcl/gradient.hxx> |
31#include <toolkit/helper/vclunohelper.hxx> |
|
31#include <svtools/miscopt.hxx> 32#include <framework/imageproducer.hxx> 33#include <com/sun/star/frame/XSubToolbarController.hpp> 34 35 36using namespace ::com::sun::star; 37using namespace ::com::sun::star::uno; 38using ::rtl::OUString; --- 11 unchanged lines hidden (view full) --- 50 maItemSeparator(Theme::GetImage(Theme::Image_ToolBoxItemSeparator)) 51{ 52 SetBackground(Wallpaper()); 53 SetPaintTransparent(true); 54 55 if (rxFrame.is()) 56 { 57 const sal_uInt16 nItemCount (GetItemCount()); | 32#include <svtools/miscopt.hxx> 33#include <framework/imageproducer.hxx> 34#include <com/sun/star/frame/XSubToolbarController.hpp> 35 36 37using namespace ::com::sun::star; 38using namespace ::com::sun::star::uno; 39using ::rtl::OUString; --- 11 unchanged lines hidden (view full) --- 51 maItemSeparator(Theme::GetImage(Theme::Image_ToolBoxItemSeparator)) 52{ 53 SetBackground(Wallpaper()); 54 SetPaintTransparent(true); 55 56 if (rxFrame.is()) 57 { 58 const sal_uInt16 nItemCount (GetItemCount()); |
58 for (sal_uInt16 nItemIndex=0; nItemIndex<nItemCount; ++nItemIndex) 59 CreateController(GetItemId(nItemIndex), rxFrame); | 59 if (nItemCount == 1) 60 { 61 // When there is only one item then make that as wide as 62 // the tool box. 63 CreateController(GetItemId(0), rxFrame, GetSizePixel().Width()); 64 } 65 else 66 for (sal_uInt16 nItemIndex=0; nItemIndex<nItemCount; ++nItemIndex) 67 CreateController(GetItemId(nItemIndex), rxFrame, 0); |
60 UpdateIcons(rxFrame); 61 62 SetSizePixel(CalcWindowSizePixel()); 63 64 SetDropdownClickHdl(LINK(this, SidebarToolBox, DropDownClickHandler)); 65 SetClickHdl(LINK(this, SidebarToolBox, ClickHandler)); 66 SetDoubleClickHdl(LINK(this, SidebarToolBox, DoubleClickHandler)); 67 SetSelectHdl(LINK(this, SidebarToolBox, SelectHandler)); --- 146 unchanged lines hidden (view full) --- 214 return ToolBox::Notify(rEvent); 215} 216 217 218 219 220void SidebarToolBox::CreateController ( 221 const sal_uInt16 nItemId, | 68 UpdateIcons(rxFrame); 69 70 SetSizePixel(CalcWindowSizePixel()); 71 72 SetDropdownClickHdl(LINK(this, SidebarToolBox, DropDownClickHandler)); 73 SetClickHdl(LINK(this, SidebarToolBox, ClickHandler)); 74 SetDoubleClickHdl(LINK(this, SidebarToolBox, DoubleClickHandler)); 75 SetSelectHdl(LINK(this, SidebarToolBox, SelectHandler)); --- 146 unchanged lines hidden (view full) --- 222 return ToolBox::Notify(rEvent); 223} 224 225 226 227 228void SidebarToolBox::CreateController ( 229 const sal_uInt16 nItemId, |
222 const cssu::Reference<css::frame::XFrame>& rxFrame) | 230 const cssu::Reference<css::frame::XFrame>& rxFrame, 231 const sal_Int32 nItemWidth) |
223{ 224 ItemDescriptor aDescriptor; 225 226 const OUString sCommandName (GetItemCommand(nItemId)); 227 228 aDescriptor.mxController = sfx2::sidebar::ControllerFactory::CreateToolBoxController( 229 this, 230 nItemId, 231 sCommandName, | 232{ 233 ItemDescriptor aDescriptor; 234 235 const OUString sCommandName (GetItemCommand(nItemId)); 236 237 aDescriptor.mxController = sfx2::sidebar::ControllerFactory::CreateToolBoxController( 238 this, 239 nItemId, 240 sCommandName, |
232 rxFrame); 233 aDescriptor.maURL = sfx2::sidebar::Tools::GetURL(sCommandName); 234 aDescriptor.msCurrentCommand = sCommandName; 235 aDescriptor.mxDispatch = sfx2::sidebar::Tools::GetDispatch(rxFrame, aDescriptor.maURL); | 241 rxFrame, 242 VCLUnoHelper::GetInterface(this), 243 nItemWidth); 244 if (aDescriptor.mxController.is()) 245 { 246 aDescriptor.maURL = sfx2::sidebar::Tools::GetURL(sCommandName); 247 aDescriptor.msCurrentCommand = sCommandName; |
236 | 248 |
237 if (aDescriptor.mxController.is() && aDescriptor.mxDispatch.is()) | |
238 maControllers.insert(::std::make_pair(nItemId, aDescriptor)); | 249 maControllers.insert(::std::make_pair(nItemId, aDescriptor)); |
250 } |
|
239} 240 241 242 243 244Reference<frame::XToolbarController> SidebarToolBox::GetControllerForItemId (const sal_uInt16 nItemId) const 245{ 246 ControllerContainer::const_iterator iController (maControllers.find(nItemId)); --- 126 unchanged lines hidden --- | 251} 252 253 254 255 256Reference<frame::XToolbarController> SidebarToolBox::GetControllerForItemId (const sal_uInt16 nItemId) const 257{ 258 ControllerContainer::const_iterator iController (maControllers.find(nItemId)); --- 126 unchanged lines hidden --- |