LCOV - code coverage report
Current view: top level - include/sfx2 - titledockwin.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 2 8 25.0 %
Date: 2015-06-13 12:38:46 Functions: 2 5 40.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             : 
      20             : #ifndef INCLUDED_SFX2_TITLEDOCKWIN_HXX
      21             : #define INCLUDED_SFX2_TITLEDOCKWIN_HXX
      22             : 
      23             : #include <sfx2/dllapi.h>
      24             : #include <sfx2/dockwin.hxx>
      25             : 
      26             : #include <vcl/toolbox.hxx>
      27             : #include <vcl/vclptr.hxx>
      28             : #include <tools/svborder.hxx>
      29             : 
      30             : namespace sfx2
      31             : {
      32             :     class SFX2_DLLPUBLIC TitledDockingWindow : public SfxDockingWindow
      33             :     {
      34             :     public:
      35             :         TitledDockingWindow(
      36             :             SfxBindings* i_pBindings, SfxChildWindow* i_pChildWindow,
      37             :             vcl::Window* i_pParent, WinBits i_nStyle = 0
      38             :         );
      39             : 
      40             :         virtual ~TitledDockingWindow();
      41             :         virtual void dispose() SAL_OVERRIDE;
      42             : 
      43             :         /** sets a title to be displayed in the docking window
      44             :         */
      45             :         void        SetTitle( const OUString& i_rTitle );
      46             : 
      47             :         /** adds a drop down item to the toolbox. Usually, this is used to add some kind of menu to the toolbox.
      48             : 
      49             :             @param i_rItemText
      50             :                 the text to display for the item
      51             :             @param i_nHelpId
      52             :                 the help ID for the new toolbox item
      53             :             @param i_rCallback
      54             :                 the callback to invoke when the drop item has been clicked
      55             :             @return
      56             :                 the ID of the newly created toolbox item
      57             :         */
      58           0 :         sal_uInt16  AddDropDownToolBoxItem( const OUString& i_rItemText, const OString& i_nHelpId, const Link<ToolBox *, void>& i_rCallback )
      59             :         {
      60           0 :             return impl_addDropDownToolBoxItem( i_rItemText, i_nHelpId, i_rCallback );
      61             :         }
      62             : 
      63           0 :         void        SetEndDockingHdl( const Link<>& i_rEndDockingHdl ) { m_aEndDockingHdl = i_rEndDockingHdl; }
      64             :         const Link<>& GetEndDockingHdl() const { return m_aEndDockingHdl; }
      65             : 
      66             :         /** resets the toolbox. Upon return, the only item in the toolbox is the closer.
      67             :         */
      68           0 :         void    ResetToolBox()
      69             :         {
      70           0 :             impl_resetToolBox();
      71           0 :         }
      72             : 
      73             :         /** returns the content window, which is to be used as parent window for any content to be displayed
      74             :             in the docking window.
      75             :         */
      76         198 :         vcl::Window&       GetContentWindow()          { return *m_aContentWindow.get(); }
      77             :         const vcl::Window& GetContentWindow() const    { return *m_aContentWindow.get(); }
      78             : 
      79             :         ToolBox&        GetToolBox()        { return *m_aToolbox.get(); }
      80             :         const ToolBox&  GetToolBox() const  { return *m_aToolbox.get(); }
      81             : 
      82             :         /** Return the border that is painted around the inner window as
      83             :             decoration.
      84             :         */
      85          66 :         SvBorder        GetDecorationBorder() const  { return m_aBorder; }
      86             : 
      87             :     protected:
      88             :         // Window overridables
      89             :         virtual void Paint(vcl::RenderContext& rRenderContext, const Rectangle& i_rArea) SAL_OVERRIDE;
      90             :         virtual void Resize() SAL_OVERRIDE;
      91             :         virtual void StateChanged( StateChangedType i_nType ) SAL_OVERRIDE;
      92             :         virtual void DataChanged( const DataChangedEvent& i_rDataChangedEvent ) SAL_OVERRIDE;
      93             :         virtual void SetText( const OUString& i_rText ) SAL_OVERRIDE;
      94             : 
      95             :         // DockingWindow overridables
      96             :         void EndDocking(const Rectangle& rRect, bool bFloatMode) SAL_OVERRIDE;
      97             : 
      98             :         // own overridables
      99             :         virtual void onLayoutDone();
     100             : 
     101             :         virtual void ApplySettings(vcl::RenderContext& rRenderContext) SAL_OVERRIDE;
     102             :     protected:
     103             :         /** internal version of ResetToolBox
     104             :         */
     105             :         void    impl_resetToolBox();
     106             : 
     107             :         /** internal version of AddDropDownToolBoxItem
     108             :         */
     109             :         sal_uInt16  impl_addDropDownToolBoxItem( const OUString& i_rItemText, const OString& i_nHelpId, const Link<ToolBox *, void>& i_rCallback );
     110             : 
     111             :         /** returns the current title.
     112             : 
     113             :             If no title has been set via SetTitle, then the window text (Window::GetText) is returned.
     114             :         */
     115             :         OUString  impl_getTitle() const;
     116             : 
     117             :     private:
     118             :         DECL_LINK_TYPED( OnToolboxItemSelected, ToolBox*, void );
     119             : 
     120             :         void    impl_construct();
     121             :         void    impl_layout();
     122             :         void    impl_scheduleLayout();
     123             : 
     124             :     private:
     125             :         OUString            m_sTitle;
     126             :         VclPtr<ToolBox>     m_aToolbox;
     127             :         VclPtr<Window>      m_aContentWindow;
     128             : 
     129             :         Link<>              m_aEndDockingHdl;
     130             : 
     131             :         /** The border that is painted around the inner window.  The bevel
     132             :             shadow lines are part of the border, so where the border is 0 no
     133             :             such line is painted.
     134             :         */
     135             :         SvBorder            m_aBorder;
     136             : 
     137             :         /** Remember that a layout is pending, i.e. Resize() has been called
     138             :             since the last Paint().
     139             :         */
     140             :         bool                m_bLayoutPending;
     141             : 
     142             :         /** Height of the title bar.  Calculated in impl_layout().
     143             :         */
     144             :         int                 m_nTitleBarHeight;
     145             : 
     146             :     };
     147             : 
     148             : 
     149             : } // namespace sfx2
     150             : 
     151             : 
     152             : #endif // INCLUDED_SFX2_TITLEDOCKWIN_HXX
     153             : 
     154             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11