LCOV - code coverage report
Current view: top level - libreoffice/sfx2/inc/sfx2 - taskpane.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 4 0.0 %
Date: 2012-12-17 Functions: 0 6 0.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 SFX_TASKPANE_HXX
      21             : #define SFX_TASKPANE_HXX
      22             : 
      23             : #include "sfx2/dllapi.h"
      24             : #include "sfx2/childwin.hxx"
      25             : #include "sfx2/titledockwin.hxx"
      26             : 
      27             : #include <svtools/toolpanel/tabalignment.hxx>
      28             : #include <svtools/toolpanel/tabitemcontent.hxx>
      29             : 
      30             : #include <boost/scoped_ptr.hpp>
      31             : #include <boost/optional.hpp>
      32             : 
      33             : namespace svt
      34             : {
      35             :     class ToolPanelDeck;
      36             : }
      37             : 
      38             : //......................................................................................................................
      39             : namespace sfx2
      40             : {
      41             : //......................................................................................................................
      42             : 
      43             :     //==================================================================================================================
      44             :     //= ITaskPaneToolPanelAccess
      45             :     //==================================================================================================================
      46           0 :     class SAL_NO_VTABLE ITaskPaneToolPanelAccess
      47             :     {
      48             :     public:
      49             :         virtual void ActivateToolPanel( const ::rtl::OUString& i_rPanelURL ) = 0;
      50             : 
      51             :     protected:
      52           0 :         ~ITaskPaneToolPanelAccess() {}
      53             :     };
      54             : 
      55             :     //==================================================================================================================
      56             :     //= TaskPaneWrapper
      57             :     //==================================================================================================================
      58           0 :     class SFX2_DLLPUBLIC TaskPaneWrapper    :public SfxChildWindow
      59             :                                             ,public ITaskPaneToolPanelAccess
      60             :     {
      61             :     public:
      62             :         TaskPaneWrapper(
      63             :             Window* i_pParent,
      64             :             sal_uInt16 i_nId,
      65             :             SfxBindings* i_pBindings,
      66             :             SfxChildWinInfo* i_pInfo
      67             :         );
      68             : 
      69             :         SFX_DECL_CHILDWINDOW( TaskPaneWrapper );
      70             : 
      71             :         // ITaskPaneToolPanelAccess
      72             :         virtual void ActivateToolPanel( const ::rtl::OUString& i_rPanelURL );
      73             :     };
      74             : 
      75             :     //==================================================================================================================
      76             :     //= IToolPanelCompare
      77             :     //==================================================================================================================
      78             :     class SFX2_DLLPUBLIC SAL_NO_VTABLE IToolPanelCompare
      79             :     {
      80             :     public:
      81             :         /** compares to tool panel URLs
      82             :             @return
      83             :                 <ul>
      84             :                 <li>-1 if the tool panel described by i_rLHS should precede the one described by i_rRHS</li>
      85             :                 <li>0 if the two panels have no particular relative order</li>
      86             :                 <li>1 if the tool panel described by i_rLHS should succeed the one described by i_rRHS</li>
      87             : 
      88             :         */
      89             :         virtual short compareToolPanelsURLs(
      90             :                         const ::rtl::OUString& i_rLHS,
      91             :                         const ::rtl::OUString& i_rRHS
      92             :                     ) const = 0;
      93             : 
      94             :     protected:
      95             :         ~IToolPanelCompare() {}
      96             :     };
      97             : 
      98             :     //==================================================================================================================
      99             :     //= ModuleTaskPane
     100             :     //==================================================================================================================
     101             :     class ModuleTaskPane_Impl;
     102             :     /** SFX-less version of a module dependent task pane, filled with tool panels as specified in the respective
     103             :         module's configuration
     104             :     */
     105             :     class SFX2_DLLPUBLIC ModuleTaskPane : public Window
     106             :     {
     107             :     public:
     108             :         /** creates a new instance
     109             :             @param i_rParentWindow
     110             :                 the parent window
     111             :             @param i_rDocumentFrame
     112             :                 the frame to which the task pane belongs. Will be passed to any custom tool panels created
     113             :                 via an XUIElementFactory. Also, it is used to determine the module which the task pane is
     114             :                 responsible for, thus controlling which tool panels are actually available.
     115             :         */
     116             :         ModuleTaskPane(
     117             :             Window& i_rParentWindow,
     118             :             const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& i_rDocumentFrame
     119             :         );
     120             :         /** creates a new instance
     121             :             @param i_rParentWindow
     122             :                 the parent window
     123             :             @param i_rDocumentFrame
     124             :                 the frame to which the task pane belongs. Will be passed to any custom tool panels created
     125             :                 via an XUIElementFactory. Also, it is used to determine the module which the task pane is
     126             :                 responsible for, thus controlling which tool panels are actually available.
     127             :             @param i_rCompare
     128             :                 a comparator for tool panel URLs, which allows controlling the order in which the panels are
     129             :                 added to the tool panel deck.
     130             :         */
     131             :         ModuleTaskPane(
     132             :             Window& i_rParentWindow,
     133             :             const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& i_rDocumentFrame,
     134             :             const IToolPanelCompare& i_rCompare
     135             :         );
     136             :         ~ModuleTaskPane();
     137             : 
     138             :         /** determines whether a given module has any registered tool panels
     139             :         */
     140             :         static bool ModuleHasToolPanels( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& i_rDocumentFrame );
     141             : 
     142             :         /** provides access to the Window aspect of the PanelDeck
     143             : 
     144             :             Be careful with this method. For instance, you're not allowed to insert arbitrary IToolPanel implementations
     145             :             into the deck, as the ModuleTaskPane has certain assumptions about the panel implementations. However,
     146             :             you're allowed to remove and re-insert panels, which have originally been created by the ModuleTaskPane
     147             :             itself.
     148             :         */
     149             :               ::svt::ToolPanelDeck& GetPanelDeck();
     150             :         const ::svt::ToolPanelDeck& GetPanelDeck() const;
     151             : 
     152             :         /** returns the position of the panel with the given resource URL
     153             :         */
     154             :         ::boost::optional< size_t >
     155             :                     GetPanelPos( const ::rtl::OUString& i_rResourceURL );
     156             : 
     157             :         /** returns the resource URL of the panel at the specified position
     158             :         */
     159             :         ::rtl::OUString
     160             :                     GetPanelResourceURL( const size_t i_nPanelPos ) const;
     161             : 
     162             :         /// sets the "classical" layout of the tool panel deck, using drawers
     163             :         void    SetDrawersLayout();
     164             :         /// sets the new layout of the tool panel deck, using tabs
     165             :         void    SetTabsLayout( const ::svt::TabAlignment i_eTabAlignment, const ::svt::TabItemContent i_eTabContent );
     166             : 
     167             :     protected:
     168             :         // Window overridables
     169             :         virtual void Resize();
     170             :         virtual void GetFocus();
     171             : 
     172             :     private:
     173             :         ::boost::scoped_ptr< ModuleTaskPane_Impl >  m_pImpl;
     174             :     };
     175             : 
     176             :     //==================================================================================================================
     177             :     //= TaskPaneController
     178             :     //==================================================================================================================
     179             :     class TaskPaneController_Impl;
     180             :     /** is a helper class for connecting a ModuleTaskPane and a TitledDockingWindow, for clients of the ModuleTaskPane
     181             :         which do not use the TaskPaneDockingWindow
     182             : 
     183             :         The controller will add a drop down menu to the docking window which contains one item for each panel in the
     184             :         panel deck, and allows toggling their visibility.
     185             :     */
     186             :     class SFX2_DLLPUBLIC TaskPaneController
     187             :     {
     188             :     public:
     189             :         TaskPaneController(
     190             :             ModuleTaskPane& i_rTaskPane,
     191             :             TitledDockingWindow& i_rDockingWindow
     192             :         );
     193             :         ~TaskPaneController();
     194             : 
     195             :         /// activates the panel with the given URL
     196             :         void    ActivateToolPanel( const ::rtl::OUString& i_rPanelURL );
     197             : 
     198             :     private:
     199             :         ::boost::scoped_ptr< TaskPaneController_Impl >  m_pImpl;
     200             :     };
     201             : 
     202             :     //==================================================================================================================
     203             :     //= TaskPaneDockingWindow
     204             :     //==================================================================================================================
     205           0 :     class TaskPaneDockingWindow :public TitledDockingWindow
     206             :                                 ,public ITaskPaneToolPanelAccess
     207             :     {
     208             :     public:
     209             :         TaskPaneDockingWindow( SfxBindings* i_pBindings, TaskPaneWrapper& i_rWrapper,
     210             :             Window* i_pParent, WinBits i_nBits );
     211             : 
     212             :         // ITaskPaneToolPanelAccess
     213             :         virtual void    ActivateToolPanel( const ::rtl::OUString& i_rPanelURL );
     214             : 
     215             :     protected:
     216             :         // Window overridables
     217             :         virtual void        GetFocus();
     218             : 
     219             :         // TitledDockingWindow overridables
     220             :         virtual void onLayoutDone();
     221             : 
     222             :     private:
     223             :         ModuleTaskPane      m_aTaskPane;
     224             :         TaskPaneController  m_aPaneController;
     225             :     };
     226             : 
     227             : //......................................................................................................................
     228             : } // namespace sfx2
     229             : //......................................................................................................................
     230             : 
     231             : #endif // SFX_TASKPANE_HXX
     232             : 
     233             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10