24#include <officecfg/Office/Common.hxx>
31#include <com/sun/star/frame/XSubToolbarController.hpp>
32#include <com/sun/star/lang/XComponent.hpp>
33#include <com/sun/star/frame/XFrame.hpp>
34#include <com/sun/star/frame/XToolbarController.hpp>
37using namespace css::uno;
40 void lcl_RTLizeCommandURL( OUString& rCommandURL )
42 if (rCommandURL ==
".uno:ParaLeftToRight")
43 rCommandURL =
".uno:ParaRightToLeft";
44 else if (rCommandURL ==
".uno:ParaRightToLeft")
45 rCommandURL =
".uno:ParaLeftToRight";
46 else if (rCommandURL ==
".uno:LeftPara")
47 rCommandURL =
".uno:RightPara";
48 else if (rCommandURL ==
".uno:RightPara")
49 rCommandURL =
".uno:LeftPara";
50 else if (rCommandURL ==
".uno:AlignLeft")
51 rCommandURL =
".uno:AlignRight";
52 else if (rCommandURL ==
".uno:AlignRight")
53 rCommandURL =
".uno:AlignLeft";
61 mbAreHandlersRegistered(false),
62 mbUseDefaultButtonSize(true),
73 auto xFrame(pViewFrm->GetFrame().GetFrameInterface());
79 SetText(OUString(
"SidebarToolBox"));
95 for (
auto const& controller : aControllers)
97 Reference<lang::XComponent> xComponent(controller.second, UNO_QUERY);
99 xComponent->dispose();
121 return static_cast<ToolBoxButtonSize>(officecfg::Office::Common::Misc::SidebarIconSize::get());
125 const css::uno::Reference<css::frame::XFrame>& rFrame,
143 if (rEvent.
GetType() == NotifyEventType::KEYINPUT)
164 const css::uno::Reference<css::frame::XFrame>& rxFrame,
165 const sal_Int32 nItemWidth,
bool bSideBar)
170 this, nItemId, sCommandName, rxFrame, rxFrame->getController(),
179 ControllerContainer::const_iterator iController (
maControllers.find(nItemId));
181 return iController->second;
183 return Reference<frame::XToolbarController>();
200 if (pToolBox !=
nullptr)
202 Reference<frame::XToolbarController>
xController (GetControllerForItemId(pToolBox->GetCurItemId()));
205 Reference<awt::XWindow> xWindow =
xController->createPopupWindow();
214 if (pToolBox ==
nullptr)
217 Reference<frame::XToolbarController>
xController (GetControllerForItemId(pToolBox->GetCurItemId()));
224 if (pToolBox ==
nullptr)
227 Reference<frame::XToolbarController>
xController (GetControllerForItemId(pToolBox->GetCurItemId()));
234 if (pToolBox ==
nullptr)
237 Reference<frame::XToolbarController>
xController (GetControllerForItemId(pToolBox->GetCurItemId()));
239 xController->execute(
static_cast<sal_Int16
>(pToolBox->GetModifier()));
246 if (mbUseDefaultButtonSize)
247 SetToolboxButtonSize(GetDefaultButtonSize());
249 for (
auto const& it : maControllers)
251 Reference<frame::XSubToolbarController>
xController(it.second, UNO_QUERY);
260 OUString aCommandURL = GetItemCommand(it.first);
261 css::uno::Reference<frame::XFrame>
xFrame = pViewFrm->GetFrame().GetFrameInterface();
263 SetItemImage(it.first, aImage);
273 if ((( pDataChangedEvent->GetType() == DataChangedEventType::SETTINGS ) ||
274 ( pDataChangedEvent->GetType() == DataChangedEventType::DISPLAY )) &&
275 ( pDataChangedEvent->GetFlags() & AllSettingsFlags::STYLE ))
277 ChangedIconHandler(
nullptr);
283 for (
const auto& it : rMap)
285 if (it.first ==
"toolbar-style")
287 if (it.second ==
"text")
289 else if (it.second ==
"both-horiz")
291 else if (it.second ==
"both")
297 else if (it.first ==
"icon-size")
300 if (it.second ==
"1" || it.second ==
"2" || it.second ==
"4")
302 else if (it.second ==
"3")
304 else if (it.second ==
"5")
307 else if (it.first ==
"orientation" && it.second ==
"vertical")
317 explicit NotebookbarToolBox(
vcl::Window* pParentWindow)
321 SetToolboxButtonSize(GetDefaultButtonSize());
326 return static_cast<ToolBoxButtonSize>(officecfg::Office::Common::Misc::NotebookbarIconSize::get());
334 static_assert(std::is_same_v<std::remove_pointer_t<VclBuilder::customMakeWidget>,
337 pBox->InitToolBox(rMap);
static bool GetLayoutRTL()
virtual void SetText(const OUString &rStr) override
virtual bool EventNotify(NotifyEvent &rNEvt) override
const vcl::KeyCode & GetKeyCode() const
const KeyEvent * GetKeyEvent() const
NotifyEventType GetType() const
static SAL_WARN_UNUSED_RESULT SfxViewFrame * Current()
constexpr tools::Long Width() const
void RemoveListenerLink(const Link< LinkParamNone *, void > &rLink)
void AddListenerLink(const Link< LinkParamNone *, void > &rLink)
static css::uno::Reference< css::awt::XWindow > GetInterface(vcl::Window *pWindow)
std::map< OUString, OUString > stringmap
sal_uInt16 GetCode() const
void SetPaintTransparent(bool bTransparent)
constexpr sal_uInt16 KEY_ESCAPE
constexpr sal_uInt16 KEY_TAB
#define LINK(Instance, Class, Member)
Image GetImageForCommand(const OUString &rsCommandName, const Reference< frame::XFrame > &rxFrame, vcl::ImageType eImageType)
Reference< XController > xController
Reference< XFrame > xFrame