Bump version to 6.4-15
[LibreOffice.git] / include / sfx2 / sidebar / SidebarToolBox.hxx
blob75aece3e344db4da211aaf93d79ca44b57afbec0
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
19 #ifndef INCLUDED_SFX2_SIDEBAR_SIDEBARTOOLBOX_HXX
20 #define INCLUDED_SFX2_SIDEBAR_SIDEBARTOOLBOX_HXX
22 #include <sfx2/dllapi.h>
23 #include <vcl/toolbox.hxx>
24 #include <map>
26 namespace com::sun::star::frame { class XToolbarController; }
28 namespace sfx2 { namespace sidebar {
30 /** The sidebar tool box has two responsibilities:
31 1. Coordinated location, size, and other states with its parent
32 background window.
33 2. Create and handle tool bar controller for its items.
35 class SFX2_DLLPUBLIC SidebarToolBox : public ToolBox
37 public:
38 SidebarToolBox(vcl::Window* pParentWindow);
39 virtual ~SidebarToolBox() override;
40 virtual void dispose() override;
42 virtual ToolBoxButtonSize GetDefaultButtonSize() const;
44 using ToolBox::InsertItem;
45 virtual void InsertItem(const OUString& rCommand,
46 const css::uno::Reference<css::frame::XFrame>& rFrame,
47 ToolBoxItemBits nBits,
48 const Size& rRequestedSize,
49 ImplToolItems::size_type nPos = APPEND) override;
51 virtual bool EventNotify(NotifyEvent& rEvent) override;
52 virtual void KeyInput( const KeyEvent& rKEvt ) override;
54 void SetController(const sal_uInt16 nItemId,
55 const css::uno::Reference<css::frame::XToolbarController>& rxController);
57 css::uno::Reference<css::frame::XToolbarController> GetFirstController();
59 void InitToolBox(VclBuilder::stringmap& rMap);
61 protected:
62 typedef std::map<sal_uInt16, css::uno::Reference<css::frame::XToolbarController>> ControllerContainer;
63 ControllerContainer maControllers;
64 bool mbAreHandlersRegistered;
65 bool mbUseDefaultButtonSize;
67 DECL_LINK(DropDownClickHandler, ToolBox*, void);
68 DECL_LINK(ClickHandler, ToolBox*, void);
69 DECL_LINK(DoubleClickHandler, ToolBox*, void);
70 DECL_LINK(SelectHandler, ToolBox*, void);
71 DECL_LINK(ChangedIconSizeHandler, LinkParamNone*, void );
73 css::uno::Reference<css::frame::XToolbarController> GetControllerForItemId(const sal_uInt16 nItemId) const;
75 void CreateController(const sal_uInt16 nItemId,
76 const css::uno::Reference<css::frame::XFrame>& rxFrame,
77 const sal_Int32 nItemWidth);
78 void RegisterHandlers();
82 } } // end of namespace sfx2::sidebar
84 #endif
86 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */