1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 <com/sun/star/frame/XDispatch.hpp>
25 #include <com/sun/star/frame/XFrame.hpp>
26 #include <com/sun/star/frame/XToolbarController.hpp>
27 #include <com/sun/star/util/URL.hpp>
30 namespace cssu
= ::com::sun::star::uno
;
32 namespace sfx2
{ namespace sidebar
{
34 /** The sidebar tool box has two responsibilities:
35 1. Coordinated location, size, and other states with its parent
37 2. Create and handle tool bar controller for its items.
39 class SFX2_DLLPUBLIC SidebarToolBox
43 SidebarToolBox(Window
* pParentWindow
);
44 virtual ~SidebarToolBox (void);
46 using ToolBox::InsertItem
;
47 virtual void InsertItem(const OUString
& rCommand
,
48 const com::sun::star::uno::Reference
<com::sun::star::frame::XFrame
>& rFrame
,
49 ToolBoxItemBits nBits
= 0,
50 const Size
& rRequestedSize
= Size(),
51 sal_uInt16 nPos
= TOOLBOX_APPEND
);
53 virtual void Paint (const Rectangle
& rRect
);
55 virtual long Notify (NotifyEvent
& rEvent
);
57 cssu::Reference
<css::frame::XToolbarController
> GetControllerForItemId (
58 const sal_uInt16 nItemId
) const;
59 sal_uInt16
GetItemIdForSubToolbarName (
60 const ::rtl::OUString
& rsCOmmandName
) const;
63 const sal_uInt16 nItemId
,
64 const cssu::Reference
<css::frame::XToolbarController
>& rxController
,
65 const ::rtl::OUString
& rsCommandName
);
68 Image maItemSeparator
;
72 cssu::Reference
<css::frame::XToolbarController
> mxController
;
74 rtl::OUString msCurrentCommand
;
76 typedef ::std::map
<sal_uInt16
, ItemDescriptor
> ControllerContainer
;
77 ControllerContainer maControllers
;
78 bool mbAreHandlersRegistered
;
80 DECL_LINK(DropDownClickHandler
, ToolBox
*);
81 DECL_LINK(ClickHandler
, ToolBox
*);
82 DECL_LINK(DoubleClickHandler
, ToolBox
*);
83 DECL_LINK(SelectHandler
, ToolBox
*);
84 DECL_LINK(ActivateToolBox
, ToolBox
*);
85 DECL_LINK(DeactivateToolBox
, ToolBox
*);
87 void CreateController (
88 const sal_uInt16 nItemId
,
89 const cssu::Reference
<css::frame::XFrame
>& rxFrame
,
90 const sal_Int32 nItemWidth
= 0);
91 void RegisterHandlers (void);
95 } } // end of namespace sfx2::sidebar
99 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */