LCOV - code coverage report
Current view: top level - include/sfx2/sidebar - SidebarToolBox.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 1 1 100.0 %
Date: 2015-06-13 12:38:46 Functions: 5 5 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       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/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      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 .
      18             :  */
      19             : #ifndef INCLUDED_SFX2_SIDEBAR_SIDEBARTOOLBOX_HXX
      20             : #define INCLUDED_SFX2_SIDEBAR_SIDEBARTOOLBOX_HXX
      21             : 
      22             : #include <sfx2/dllapi.h>
      23             : #include <sfx2/sidebar/SidebarToolBox.hxx>
      24             : #include <vcl/toolbox.hxx>
      25             : #include <com/sun/star/frame/XDispatch.hpp>
      26             : #include <com/sun/star/frame/XFrame.hpp>
      27             : #include <com/sun/star/frame/XToolbarController.hpp>
      28             : #include <com/sun/star/util/URL.hpp>
      29             : #include <map>
      30             : 
      31             : 
      32             : namespace sfx2 { namespace sidebar {
      33             : 
      34             : /** The sidebar tool box has two responsibilities:
      35             :     1. Coordinated location, size, and other states with its parent
      36             :        background window.
      37             :     2. Create and handle tool bar controller for its items.
      38             : */
      39             : class SFX2_DLLPUBLIC SidebarToolBox : public ToolBox
      40             : {
      41             : public:
      42             :     SidebarToolBox(vcl::Window* pParentWindow);
      43             :     virtual ~SidebarToolBox();
      44             :     virtual void dispose() SAL_OVERRIDE;
      45             : 
      46             :     using ToolBox::InsertItem;
      47             :     virtual void InsertItem(const OUString& rCommand,
      48             :             const css::uno::Reference<css::frame::XFrame>& rFrame,
      49             :             ToolBoxItemBits nBits = ToolBoxItemBits::NONE,
      50             :             const Size& rRequestedSize = Size(),
      51             :             sal_uInt16 nPos = TOOLBOX_APPEND) SAL_OVERRIDE;
      52             : 
      53             :     virtual void Paint (vcl::RenderContext& rRenderContext, const Rectangle& rRect) SAL_OVERRIDE;
      54             : 
      55             :     virtual bool Notify (NotifyEvent& rEvent) SAL_OVERRIDE;
      56             : 
      57             :     css::uno::Reference<css::frame::XToolbarController> GetControllerForItemId(const sal_uInt16 nItemId) const;
      58             :     sal_uInt16 GetItemIdForSubToolbarName (const OUString& rsCOmmandName) const;
      59             : 
      60             :     void SetController(const sal_uInt16 nItemId,
      61             :                        const css::uno::Reference<css::frame::XToolbarController>& rxController,
      62             :                        const OUString& rsCommandName);
      63             : 
      64             : private:
      65             :     Image maItemSeparator;
      66             : 
      67      105666 :     class ItemDescriptor
      68             :     {
      69             :     public:
      70             :         css::uno::Reference<css::frame::XToolbarController> mxController;
      71             :         css::util::URL maURL;
      72             :         rtl::OUString msCurrentCommand;
      73             :     };
      74             : 
      75             :     typedef std::map<sal_uInt16, ItemDescriptor> ControllerContainer;
      76             :     ControllerContainer maControllers;
      77             :     bool mbAreHandlersRegistered;
      78             : 
      79             :     DECL_LINK_TYPED(DropDownClickHandler, ToolBox*, void);
      80             :     DECL_LINK_TYPED(ClickHandler, ToolBox*, void);
      81             :     DECL_LINK_TYPED(DoubleClickHandler, ToolBox*, void);
      82             :     DECL_LINK_TYPED(SelectHandler, ToolBox*, void);
      83             : 
      84             :     void CreateController(const sal_uInt16 nItemId,
      85             :                           const css::uno::Reference<css::frame::XFrame>& rxFrame,
      86             :                           const sal_Int32 nItemWidth = 0);
      87             :     void RegisterHandlers();
      88             : };
      89             : 
      90             : 
      91             : } } // end of namespace sfx2::sidebar
      92             : 
      93             : #endif
      94             : 
      95             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11