LCOV - code coverage report
Current view: top level - sfx2/source/inc - workwin.hxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 32 0.0 %
Date: 2014-04-14 Functions: 0 18 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             : #ifndef INCLUDED_SFX2_SOURCE_INC_WORKWIN_HXX
      20             : #define INCLUDED_SFX2_SOURCE_INC_WORKWIN_HXX
      21             : 
      22             : #include <vector>
      23             : #include <deque>
      24             : #include <com/sun/star/frame/XDispatch.hpp>
      25             : #include <com/sun/star/frame/XFrame.hpp>
      26             : #include <com/sun/star/ui/XUIElement.hpp>
      27             : #include <com/sun/star/task/XStatusIndicator.hpp>
      28             : #include <com/sun/star/frame/XLayoutManagerListener.hpp>
      29             : #include <cppuhelper/implbase2.hxx>
      30             : #include <cppuhelper/propshlp.hxx>
      31             : 
      32             : #include <rtl/ustring.hxx>
      33             : #include <osl/mutex.hxx>
      34             : 
      35             : #include <sfx2/sfx.hrc>
      36             : #include <sfx2/childwin.hxx>
      37             : #include <sfx2/shell.hxx>
      38             : #include <sfx2/ctrlitem.hxx>
      39             : #include <sfx2/viewfrm.hxx>
      40             : 
      41             : class SfxSplitWindow;
      42             : class SfxWorkWindow;
      43             : 
      44             : 
      45             : // This struct makes all relevant Informationen available of Toolboxes
      46             : 
      47           0 : struct SfxObjectBar_Impl
      48             : {
      49             :     sal_uInt16        nId;   // Resource - and ConfigId of Toolbox
      50             :     sal_uInt16        nMode; // special visibility flags
      51             :     sal_uInt16        nPos;
      52             :     sal_uInt16        nIndex;
      53             :     bool          bDestroy;
      54             :     OUString          aName;
      55             :     SfxInterface*     pIFace;
      56             : 
      57           0 :     SfxObjectBar_Impl() :
      58             :         nId(0),
      59             :         nMode(0),
      60             :         nPos(0),
      61             :         nIndex(0),
      62             :         bDestroy(false),
      63           0 :         pIFace(0)
      64           0 :     {}
      65             : };
      66             : 
      67             : 
      68             : // This struct makes all relevant Informationen available of the status bar
      69             : 
      70             : struct SfxStatBar_Impl
      71             : {
      72             :     sal_uInt16                  nId;
      73             :     bool                    bOn;
      74             :     bool                    bTemp;
      75             : 
      76           0 :     SfxStatBar_Impl() :
      77             :         nId(0),
      78             :         bOn(true),
      79           0 :         bTemp(false)
      80           0 :     {}
      81             : };
      82             : 
      83             : 
      84             : 
      85             : #define CHILD_NOT_VISIBLE   0
      86             : #define CHILD_ACTIVE       1    // not disabled through HidePopups
      87             : #define CHILD_NOT_HIDDEN   2    // not disabled through HideChildWindow
      88             : #define CHILD_FITS_IN      4    // not too large for output size of the parent
      89             : #define CHILD_VISIBLE       (CHILD_NOT_HIDDEN | CHILD_ACTIVE | CHILD_FITS_IN)
      90             : 
      91             : struct SfxChild_Impl
      92             : {
      93             :     Window*                         pWin;
      94             :     Size                            aSize;
      95             :     SfxChildAlignment               eAlign;
      96             :     sal_uInt16                          nVisible;
      97             :     bool                            bResize;
      98             :     bool                            bCanGetFocus;
      99             :     bool                            bSetFocus;
     100             : 
     101           0 :     SfxChild_Impl( Window& rChild, const Size& rSize,
     102             :                    SfxChildAlignment eAlignment, bool bIsVisible ):
     103             :         pWin(&rChild), aSize(rSize), eAlign(eAlignment), bResize(false),
     104           0 :         bCanGetFocus( false ), bSetFocus( false )
     105             :     {
     106           0 :         nVisible = bIsVisible ? CHILD_VISIBLE : CHILD_NOT_VISIBLE;
     107           0 :     }
     108             : };
     109             : 
     110           0 : struct SfxChildWin_Impl
     111             : {
     112             :     sal_uInt16                         nSaveId;       // the ChildWindow-Id
     113             :     sal_uInt16                         nInterfaceId;  // the current context
     114             :     sal_uInt16                         nId;           // current Id
     115             :     SfxChildWindow*                 pWin;
     116             :     bool                            bCreate;
     117             :     SfxChildWinInfo                 aInfo;
     118             :     SfxChild_Impl*                 pCli;          // != 0 at direct Children
     119             :     sal_uInt16                          nVisibility;
     120             :     bool                            bEnable;
     121             :     bool                            bDisabled;
     122             : 
     123           0 :     SfxChildWin_Impl( sal_uInt32 nID ) :
     124             :         nSaveId((sal_uInt16) (nID & 0xFFFF) ),
     125           0 :         nInterfaceId((sal_uInt16) (nID >> 16)),
     126             :         nId(nSaveId),
     127             :         pWin(0),
     128             :         bCreate(false),
     129             :         pCli(0),
     130             :         nVisibility( sal_False ),
     131             :         bEnable( true ),
     132           0 :         bDisabled( false )
     133           0 :     {}
     134             : };
     135             : 
     136             : enum SfxChildIdentifier
     137             : {
     138             :     SFX_CHILDWIN_STATBAR,
     139             :     SFX_CHILDWIN_OBJECTBAR,
     140             :     SFX_CHILDWIN_DOCKINGWINDOW,
     141             :     SFX_CHILDWIN_SPLITWINDOW
     142             : };
     143             : 
     144             : enum SfxDockingConfig
     145             : {
     146             :     SFX_SETDOCKINGRECTS,
     147             :     SFX_ALIGNDOCKINGWINDOW,
     148             :     SFX_TOGGLEFLOATMODE,
     149             :     SFX_MOVEDOCKINGWINDOW
     150             : };
     151             : 
     152             : typedef std::vector<SfxChild_Impl*> SfxChildList_Impl;
     153             : typedef std::vector<SfxChildWin_Impl*> SfxChildWindows_Impl;
     154             : 
     155             : 
     156             : struct SfxObjectBarList_Impl
     157             : {
     158             :     std::deque<SfxObjectBar_Impl>   aArr;
     159             :     sal_uInt16                  nAct;
     160             : 
     161             :     SfxObjectBar_Impl       operator[] ( sal_uInt16 n )
     162             :                             { return aArr[n]; }
     163             :     SfxObjectBar_Impl       Actual()
     164             :                             { return aArr[nAct]; }
     165             : };
     166             : 
     167             : #define SFX_SPLITWINDOWS_LEFT   0
     168             : #define SFX_SPLITWINDOWS_TOP    2
     169             : #define SFX_SPLITWINDOWS_RIGHT  1
     170             : #define SFX_SPLITWINDOWS_BOTTOM 3
     171             : #define SFX_SPLITWINDOWS_MAX    4
     172             : 
     173             : 
     174             : 
     175             : class LayoutManagerListener : public ::cppu::WeakImplHelper2<
     176             :                                          css::frame::XLayoutManagerListener,
     177             :                                          css::lang::XComponent >
     178             : {
     179             :     public:
     180             :         LayoutManagerListener( SfxWorkWindow* pWrkWin );
     181             :         virtual ~LayoutManagerListener();
     182             : 
     183             :         void setFrame( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame );
     184             : 
     185             : 
     186             :         //  XComponent
     187             : 
     188             :         virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     189             :         virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     190             :         virtual void SAL_CALL dispose() throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     191             : 
     192             : 
     193             :         //  XEventListener
     194             : 
     195             :         virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& aEvent ) throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     196             : 
     197             : 
     198             :         // XLayoutManagerEventListener
     199             : 
     200             :         virtual void SAL_CALL layoutEvent( const ::com::sun::star::lang::EventObject& aSource, ::sal_Int16 eLayoutEvent, const ::com::sun::star::uno::Any& aInfo ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     201             : 
     202             :     private:
     203             :         bool                                                                m_bHasFrame;
     204             :         SfxWorkWindow*                                                          m_pWrkWin;
     205             :         ::com::sun::star::uno::WeakReference< ::com::sun::star::frame::XFrame > m_xFrame;
     206             :         OUString                                                           m_aLayoutManagerPropName;
     207             : };
     208             : 
     209             : class SfxWorkWindow
     210             : {
     211             :     friend class LayoutManagerListener;
     212             : 
     213             : protected:
     214             :     std::vector<sal_uInt16> aSortedList;
     215             :     SfxStatBar_Impl         aStatBar;
     216             :     std::vector< SfxObjectBar_Impl > aObjBarList;
     217             :     Rectangle               aClientArea;
     218             :     Rectangle               aUpperClientArea;
     219             :     SfxWorkWindow*          pParent;
     220             :     SfxSplitWindow*         pSplit[SFX_SPLITWINDOWS_MAX];
     221             :     SfxChildList_Impl       aChildren;
     222             :     SfxChildWindows_Impl    aChildWins;
     223             :     SfxBindings*            pBindings;
     224             :     Window*                 pWorkWin;
     225             :     SfxShell*               pConfigShell;
     226             :     Window*                 pActiveChild;
     227             :     sal_uInt16                  nUpdateMode;
     228             :     sal_uInt16                  nChildren;
     229             :     sal_uInt16                  nOrigMode;
     230             :     bool                    bSorted : 1;
     231             :     bool                    bDockingAllowed : 1;
     232             :     bool                    bInternalDockingAllowed : 1;
     233             :     bool                    bAllChildrenVisible : 1;
     234             :     bool                    bIsFullScreen : 1;
     235             :     bool                    bShowStatusBar : 1;
     236             :     sal_Int32               m_nLock;
     237             :     OUString           m_aStatusBarResName;
     238             :     OUString           m_aLayoutManagerPropName;
     239             :     OUString           m_aTbxTypeName;
     240             :     OUString           m_aProgressBarResName;
     241             :     ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > m_xLayoutManagerListener;
     242             : 
     243             : protected:
     244             :     void                    CreateChildWin_Impl(SfxChildWin_Impl*,bool);
     245             :     void                    RemoveChildWin_Impl(SfxChildWin_Impl*);
     246             :     void                    Sort_Impl();
     247             :     SfxChild_Impl*          FindChild_Impl( const Window& rWindow ) const;
     248             :     virtual bool            RequestTopToolSpacePixel_Impl( SvBorder aBorder );
     249             :     virtual Rectangle       GetTopRect_Impl();
     250             :     SvBorder                Arrange_Impl();
     251             :     virtual void            SaveStatus_Impl(SfxChildWindow*, const SfxChildWinInfo&);
     252             :     static bool         IsPluginMode( SfxObjectShell* pObjShell );
     253             : 
     254             : public:
     255             :                             SfxWorkWindow( Window *pWin, SfxBindings& rBindings, SfxWorkWindow* pParent = NULL);
     256             :     virtual                 ~SfxWorkWindow();
     257           0 :     SfxBindings&            GetBindings()
     258           0 :                             { return *pBindings; }
     259           0 :     Window*                 GetWindow() const
     260           0 :                             { return pWorkWin; }
     261             :     Rectangle               GetFreeArea( bool bAutoHide ) const;
     262           0 :     void                    SetDockingAllowed(bool bSet)
     263           0 :                             { bDockingAllowed = bSet; }
     264           0 :     void                    SetInternalDockingAllowed(bool bSet)
     265           0 :                             { bInternalDockingAllowed = bSet; }
     266           0 :     bool                    IsDockingAllowed() const
     267           0 :                             { return bDockingAllowed; }
     268           0 :     bool                    IsInternalDockingAllowed() const
     269           0 :                             { return bInternalDockingAllowed; }
     270           0 :     SfxWorkWindow*          GetParent_Impl() const
     271           0 :                             { return pParent; }
     272             : 
     273             :     // Methods for all Child windows
     274             :     void                    DataChanged_Impl( const DataChangedEvent& rDCEvt );
     275             :     void                    ReleaseChild_Impl( Window& rWindow );
     276             :     SfxChild_Impl*          RegisterChild_Impl( Window& rWindow, SfxChildAlignment eAlign, bool bCanGetFocus=false );
     277             :     void                    ShowChildren_Impl();
     278             :     void                    HideChildren_Impl();
     279             :     bool                    PrepareClose_Impl();
     280             :     virtual void            ArrangeChildren_Impl( sal_Bool bForce = sal_True );
     281             :     void                    DeleteControllers_Impl();
     282             :     void                    HidePopups_Impl(bool bHide, bool bParent=false, sal_uInt16 nId=0);
     283             :     void                    ConfigChild_Impl(SfxChildIdentifier,
     284             :                                              SfxDockingConfig, sal_uInt16);
     285             :     void                    MakeChildrenVisible_Impl( bool bVis );
     286             :     void                    ArrangeAutoHideWindows( SfxSplitWindow *pSplit );
     287             :     bool                    IsAutoHideMode( const SfxSplitWindow *pSplit );
     288             :     void                    EndAutoShow_Impl( Point aPos );
     289           0 :     void                    SetFullScreen_Impl( bool bSet ) { bIsFullScreen = bSet; }
     290             :     bool                    IsFullScreen_Impl() const { return bIsFullScreen; }
     291             : 
     292             :     // Methods for Objectbars
     293             :     virtual void            UpdateObjectBars_Impl();
     294             :     void                    ResetObjectBars_Impl();
     295             :     void                    SetObjectBar_Impl( sal_uInt16 nPos, sal_uInt32 nResId,
     296             :                                     SfxInterface *pIFace, const OUString* pName=0 );
     297             :     bool                    KnowsObjectBar_Impl( sal_uInt16 nPos ) const;
     298             :     bool                    IsVisible_Impl();
     299             :     void                    MakeVisible_Impl( bool );
     300             :     void                    SetObjectBarVisibility_Impl( sal_uInt16 nVis );
     301             :     bool                    IsContainer_Impl() const;
     302             :     void                    Lock_Impl( bool );
     303             : 
     304             :     // Methods for ChildWindows
     305             :     void                    UpdateChildWindows_Impl();
     306             :     void                    ResetChildWindows_Impl();
     307             :     void                    SetChildWindowVisible_Impl( sal_uInt32, bool, sal_uInt16 );
     308             :     void                    ToggleChildWindow_Impl(sal_uInt16,bool);
     309             :     bool                    HasChildWindow_Impl(sal_uInt16);
     310             :     bool                    KnowsChildWindow_Impl(sal_uInt16);
     311             :     void                    ShowChildWindow_Impl(sal_uInt16, bool bVisible, bool bSetFocus);
     312             :     void                    SetChildWindow_Impl(sal_uInt16, bool bOn, bool bSetFocus);
     313             :     SfxChildWindow*         GetChildWindow_Impl(sal_uInt16);
     314             :     virtual void            InitializeChild_Impl(SfxChildWin_Impl*);
     315             :     SfxSplitWindow*         GetSplitWindow_Impl(SfxChildAlignment);
     316             : 
     317             :     bool                    IsVisible_Impl( sal_uInt16 nMode ) const;
     318             :     bool                    IsFloating( sal_uInt16 nId );
     319             :     void                    SetActiveChild_Impl( Window *pChild );
     320             :     virtual bool            ActivateNextChild_Impl( sal_Bool bForward = sal_True );
     321             :     bool                    AllowChildWindowCreation_Impl( const SfxChildWin_Impl& i_rCW ) const;
     322             : 
     323             :     // Methods for StatusBar
     324             :     void                    ResetStatusBar_Impl();
     325             :     void                    SetStatusBar_Impl(sal_uInt32 nResId, SfxShell *pShell, SfxBindings& );
     326             :     void                    UpdateStatusBar_Impl();
     327             :     ::com::sun::star::uno::Reference< ::com::sun::star::task::XStatusIndicator > GetStatusIndicator();
     328             :     ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > GetFrameInterface();
     329             : };
     330             : 
     331           0 : class SfxFrameWorkWin_Impl : public SfxWorkWindow
     332             : {
     333             :     SfxFrame*           pMasterFrame;
     334             :     SfxFrame*           pFrame;
     335             : public:
     336             :                         SfxFrameWorkWin_Impl( Window* pWin, SfxFrame* pFrm, SfxFrame* pMaster );
     337             :     virtual void        ArrangeChildren_Impl( sal_Bool bForce = sal_True ) SAL_OVERRIDE;
     338             :     virtual void        UpdateObjectBars_Impl() SAL_OVERRIDE;
     339             :     virtual Rectangle   GetTopRect_Impl() SAL_OVERRIDE;
     340             : };
     341             : 
     342             : 
     343             : #endif
     344             : 
     345             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10