LCOV - code coverage report
Current view: top level - sd/source/ui/toolpanel - LayoutMenu.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 1 1 100.0 %
Date: 2012-08-25 Functions: 1 1 100.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 0 -

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : 
      29                 :            : #ifndef SD_TASKPANE_LAYOUT_MENU_HXX
      30                 :            : #define SD_TASKPANE_LAYOUT_MENU_HXX
      31                 :            : 
      32                 :            : #include "taskpane/TaskPaneTreeNode.hxx"
      33                 :            : 
      34                 :            : #include <com/sun/star/frame/XStatusListener.hpp>
      35                 :            : 
      36                 :            : #include "glob.hxx"
      37                 :            : #include "pres.hxx"
      38                 :            : #include <vcl/ctrl.hxx>
      39                 :            : #include <svtools/valueset.hxx>
      40                 :            : #include <svtools/transfer.hxx>
      41                 :            : #include <sfx2/shell.hxx>
      42                 :            : 
      43                 :            : 
      44                 :            : class SfxModule;
      45                 :            : 
      46                 :            : 
      47                 :            : namespace sd {
      48                 :            : class DrawDocShell;
      49                 :            : class ViewShellBase;
      50                 :            : }
      51                 :            : 
      52                 :            : 
      53                 :            : namespace sd { namespace tools {
      54                 :            : class EventMultiplexerEvent;
      55                 :            : } }
      56                 :            : 
      57                 :            : 
      58                 :            : namespace sd { namespace toolpanel {
      59                 :            : 
      60                 :            : class ControlFactory;
      61                 :            : class ToolPanelViewShell;
      62                 :            : 
      63                 :            : 
      64                 :            : class LayoutMenu
      65                 :            :     : public ValueSet,
      66                 :            :       public TreeNode,
      67                 :            :       public SfxShell,
      68                 :            :       public DragSourceHelper,
      69                 :            :       public DropTargetHelper
      70                 :            : {
      71                 :            : public:
      72                 :            :     TYPEINFO();
      73                 :         25 :     SFX_DECL_INTERFACE(SD_IF_SDLAYOUTMENU)
      74                 :            : 
      75                 :            :     /** Create a new layout menu.  Depending on the given flag it
      76                 :            :         displays its own scroll bar or lets a surrounding window
      77                 :            :         handle that.
      78                 :            :         @param i_pParent
      79                 :            :             the parent node in the control tree
      80                 :            :         @param i_rPanelViewShell
      81                 :            :             the view shell of the task pane.
      82                 :            :     */
      83                 :            :     LayoutMenu (
      84                 :            :         TreeNode* i_pParent,
      85                 :            :         ToolPanelViewShell& i_rPanelViewShell);
      86                 :            :     virtual ~LayoutMenu (void);
      87                 :            : 
      88                 :            :     static std::auto_ptr<ControlFactory> CreateControlFactory (
      89                 :            :         ToolPanelViewShell& i_rPanelViewShell );
      90                 :            : 
      91                 :            :     /** Return a numerical value representing the currently selected
      92                 :            :         layout.
      93                 :            :     */
      94                 :            :     AutoLayout GetSelectedAutoLayout (void);
      95                 :            : 
      96                 :            : 
      97                 :            :     // From ILayoutableWindow
      98                 :            :     virtual Size GetPreferredSize (void);
      99                 :            :     virtual sal_Int32 GetPreferredWidth (sal_Int32 nHeight);
     100                 :            :     virtual sal_Int32 GetPreferredHeight (sal_Int32 nWidth);
     101                 :            :     virtual sal_Int32 GetMinimumWidth (void);
     102                 :            :     virtual bool IsResizable (void);
     103                 :            :     virtual ::Window* GetWindow (void);
     104                 :            : 
     105                 :            :     // From ::Window
     106                 :            :     virtual void Paint (const Rectangle& rRect);
     107                 :            :     virtual void Resize (void);
     108                 :            : 
     109                 :            :     /** Show a context menu when the right mouse button is pressed.
     110                 :            :     */
     111                 :            :     virtual void MouseButtonDown (const MouseEvent& rEvent);
     112                 :            : 
     113                 :            :     void Execute (SfxRequest& rRequest);
     114                 :            :     void GetState (SfxItemSet& rItemSet);
     115                 :            : 
     116                 :            :     /** The LayoutMenu does not support some main views.  In this case the
     117                 :            :         LayoutMenu is disabled.  This state is updated in this method.
     118                 :            :         @param eMode
     119                 :            :             On some occasions the edit mode is being switched when this
     120                 :            :             method is called can not (yet) be reliably detected.  Luckily,
     121                 :            :             in these cases the new value is provided by some broadcaster.
     122                 :            :             On other occasions the edit mode is not modified and is also not
     123                 :            :             provided.  Therefore the Unknown value.
     124                 :            :     */
     125                 :            :     enum MasterMode { MM_NORMAL, MM_MASTER, MM_UNKNOWN };
     126                 :            :     void UpdateEnabledState (const MasterMode eMode);
     127                 :            : 
     128                 :            :     // TreeNode overridables
     129                 :            :     virtual TaskPaneShellManager* GetShellManager (void);
     130                 :            : 
     131                 :            :     /** Call this method when the set of displayed layouts is not up-to-date
     132                 :            :         anymore.  It will re-assemple this set according to the current
     133                 :            :         settings.
     134                 :            :     */
     135                 :            :     void InvalidateContent (void);
     136                 :            : 
     137                 :            :     // DragSourceHelper
     138                 :            :     virtual void StartDrag (sal_Int8 nAction, const Point& rPosPixel);
     139                 :            : 
     140                 :            :     // DropTargetHelper
     141                 :            :     virtual sal_Int8 AcceptDrop (const AcceptDropEvent& rEvent);
     142                 :            :     virtual sal_Int8 ExecuteDrop (const ExecuteDropEvent& rEvent);
     143                 :            : 
     144                 :            :     /** The context menu is requested over this Command() method.
     145                 :            :     */
     146                 :            :     virtual void Command (const CommandEvent& rEvent);
     147                 :            : 
     148                 :            :     /** Call Fill() when switching to or from high contrast mode so that the
     149                 :            :         correct set of icons is displayed.
     150                 :            :     */
     151                 :            :     virtual void DataChanged (const DataChangedEvent& rEvent);
     152                 :            : 
     153                 :            :     using Window::GetWindow;
     154                 :            :     using ValueSet::StartDrag;
     155                 :            : 
     156                 :            : private:
     157                 :            :     ViewShellBase& mrBase;
     158                 :            : 
     159                 :            :     TaskPaneShellManager*   mpShellManager;
     160                 :            : 
     161                 :            :     /** Do we use our own scroll bar or is viewport handling done by
     162                 :            :         our parent?
     163                 :            :     */
     164                 :            :     bool mbUseOwnScrollBar;
     165                 :            : 
     166                 :            :     /** If we are asked for the preferred window size, then use this
     167                 :            :         many columns for the calculation.
     168                 :            :     */
     169                 :            :     const int mnPreferredColumnCount;
     170                 :            : 
     171                 :            :     ::com::sun::star::uno::Reference<com::sun::star::frame::XStatusListener> mxListener;
     172                 :            : 
     173                 :            :     bool mbSelectionUpdatePending;
     174                 :            : 
     175                 :            :     bool mbIsMainViewChangePending;
     176                 :            : 
     177                 :            :     /** Calculate the number of displayed rows.  This depends on the given
     178                 :            :         item size, the given number of columns, and the size of the
     179                 :            :         control.  Note that this is not the number of rows managed by the
     180                 :            :         valueset.  This number may be larger.  In that case a vertical
     181                 :            :         scroll bar is displayed.
     182                 :            :     */
     183                 :            :     int CalculateRowCount (const Size& rItemSize, int nColumnCount);
     184                 :            : 
     185                 :            :     /** Fill the value set with the layouts that are applicable to the
     186                 :            :         current main view shell.
     187                 :            :     */
     188                 :            :     void Fill (void);
     189                 :            : 
     190                 :            :     /** Remove all items from the value set.
     191                 :            :     */
     192                 :            :     void Clear (void);
     193                 :            : 
     194                 :            :     /** Assign the given layout to all selected slides of a slide sorter.
     195                 :            :         If no slide sorter is active then this call is ignored.  The slide
     196                 :            :         sorter in the center pane is preferred if the choice exists.
     197                 :            :     */
     198                 :            :     void AssignLayoutToSelectedSlides (AutoLayout aLayout);
     199                 :            : 
     200                 :            :     /** Insert a new page with the given layout.  The page is inserted via
     201                 :            :         the main view shell, i.e. its SID_INSERTPAGE slot is called.  It it
     202                 :            :         does not support this slot then inserting a new page does not take
     203                 :            :         place.  The new page is inserted after the currently active one (the
     204                 :            :         one returned by ViewShell::GetActualPage().)
     205                 :            :     */
     206                 :            :     void InsertPageWithLayout (AutoLayout aLayout);
     207                 :            : 
     208                 :            :     /** Create a request structure that can be used with the SID_INSERTPAGE
     209                 :            :         and SID_MODIFYPAGE slots.  The parameters are set so that the given
     210                 :            :         layout is assigned to the current page of the main view shell.
     211                 :            :         @param nSlotId
     212                 :            :             Supported slots are SID_INSERTPAGE and SID_MODIFYPAGE.
     213                 :            :         @param aLayout
     214                 :            :             Layout of the page to insert or to assign.
     215                 :            :     */
     216                 :            :     SfxRequest CreateRequest (
     217                 :            :         sal_uInt16 nSlotId,
     218                 :            :         AutoLayout aLayout);
     219                 :            : 
     220                 :            :     /** Select the layout that is used by the current page.
     221                 :            :     */
     222                 :            :     void UpdateSelection (void);
     223                 :            : 
     224                 :            :     // internal ctor
     225                 :            :     void    implConstruct( DrawDocShell& rDocumentShell );
     226                 :            : 
     227                 :            :     /** When clicked then set the current page of the view in the center pane.
     228                 :            :     */
     229                 :            :     DECL_LINK(ClickHandler, void *);
     230                 :            :     DECL_LINK(RightClickHandler, MouseEvent*);
     231                 :            :     DECL_LINK(StateChangeHandler, void *);
     232                 :            :     DECL_LINK(EventMultiplexerListener, ::sd::tools::EventMultiplexerEvent*);
     233                 :            : };
     234                 :            : 
     235                 :            : } } // end of namespace ::sd::toolpanel
     236                 :            : 
     237                 :            : #endif
     238                 :            : 
     239                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10