LCOV - code coverage report
Current view: top level - usr/local/src/libreoffice/include/vcl - splitwin.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 3 6 50.0 %
Date: 2013-07-09 Functions: 3 6 50.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 _SV_SPLITWIN_HXX
      21             : #define _SV_SPLITWIN_HXX
      22             : 
      23             : #include <tools/solar.h>
      24             : #include <vcl/dllapi.h>
      25             : #include <vcl/dockwin.hxx>
      26             : 
      27             : class Wallpaper;
      28             : struct ImplSplitSet;
      29             : 
      30             : // -----------------------
      31             : // - SplitWindowItemBits -
      32             : // -----------------------
      33             : 
      34             : typedef sal_uInt16 SplitWindowItemBits;
      35             : 
      36             : // -------------------------------
      37             : // - Bits fuer SplitWindow-Items -
      38             : // -------------------------------
      39             : 
      40             : #define SWIB_FIXED                  ((SplitWindowItemBits)0x0001)
      41             : #define SWIB_RELATIVESIZE           ((SplitWindowItemBits)0x0002)
      42             : #define SWIB_PERCENTSIZE            ((SplitWindowItemBits)0x0004)
      43             : #define SWIB_COLSET                 ((SplitWindowItemBits)0x0008)
      44             : #define SWIB_INVISIBLE              ((SplitWindowItemBits)0x0010)
      45             : 
      46             : // ---------------------
      47             : // - SplitWindow-Types -
      48             : // ---------------------
      49             : 
      50             : #define SPLITWINDOW_APPEND          ((sal_uInt16)0xFFFF)
      51             : #define SPLITWINDOW_ITEM_NOTFOUND   ((sal_uInt16)0xFFFF)
      52             : 
      53             : // ---------------
      54             : // - SplitWindow -
      55             : // ---------------
      56             : 
      57             : class VCL_DLLPUBLIC SplitWindow : public DockingWindow
      58             : {
      59             : private:
      60             :     ImplSplitSet*       mpMainSet;
      61             :     ImplSplitSet*       mpBaseSet;
      62             :     ImplSplitSet*       mpSplitSet;
      63             :     long*               mpLastSizes;
      64             :     Rectangle           maDragRect;
      65             :     long                mnDX;
      66             :     long                mnDY;
      67             :     long                mnLeftBorder;
      68             :     long                mnTopBorder;
      69             :     long                mnRightBorder;
      70             :     long                mnBottomBorder;
      71             :     long                mnMaxSize;
      72             :     long                mnMouseOff;
      73             :     long                mnMStartPos;
      74             :     long                mnMSplitPos;
      75             :     WinBits             mnWinStyle;
      76             :     WindowAlign         meAlign;
      77             :     sal_uInt16              mnSplitTest;
      78             :     sal_uInt16              mnSplitPos;
      79             :     sal_uInt16              mnMouseModifier;
      80             :     sal_Bool                mbDragFull:1,
      81             :                         mbHorz:1,
      82             :                         mbBottomRight:1,
      83             :                         mbCalc:1,
      84             :                         mbRecalc:1,
      85             :                         mbInvalidate:1,
      86             :                         mbSizeable:1,
      87             :                         mbBorder:1,
      88             :                         mbAutoHide:1,
      89             :                         mbFadeIn:1,
      90             :                         mbFadeOut:1,
      91             :                         mbAutoHideIn:1,
      92             :                         mbAutoHideDown:1,
      93             :                         mbFadeInDown:1,
      94             :                         mbFadeOutDown:1,
      95             :                         mbAutoHidePressed:1,
      96             :                         mbFadeInPressed:1,
      97             :                         mbFadeOutPressed:1,
      98             :                         mbFadeNoButtonMode:1,
      99             :                         mbNoAlign:1;
     100             :     Link                maStartSplitHdl;
     101             :     Link                maSplitHdl;
     102             :     Link                maSplitResizeHdl;
     103             :     Link                maAutoHideHdl;
     104             :     Link                maFadeInHdl;
     105             :     Link                maFadeOutHdl;
     106             : 
     107             :     using Window::ImplInit;
     108             :     SAL_DLLPRIVATE void ImplInit( Window* pParent, WinBits nStyle );
     109             :     SAL_DLLPRIVATE void ImplInitSettings();
     110             :     SAL_DLLPRIVATE void ImplCalcLayout();
     111             :     SAL_DLLPRIVATE void ImplUpdate();
     112             :     SAL_DLLPRIVATE void ImplSetWindowSize( long nDelta );
     113             :     SAL_DLLPRIVATE void ImplSplitMousePos( Point& rMousePos );
     114             :     SAL_DLLPRIVATE void ImplGetButtonRect( Rectangle& rRect, long nEx, sal_Bool bTest ) const;
     115             :     SAL_DLLPRIVATE void ImplGetAutoHideRect( Rectangle& rRect, sal_Bool bTest = sal_False ) const;
     116             :     SAL_DLLPRIVATE void ImplGetFadeInRect( Rectangle& rRect, sal_Bool bTest = sal_False ) const;
     117             :     SAL_DLLPRIVATE void ImplGetFadeOutRect( Rectangle& rRect, sal_Bool bTest = sal_False ) const;
     118             :     SAL_DLLPRIVATE void ImplDrawButtonRect( const Rectangle& rRect, long nSize );
     119             :     SAL_DLLPRIVATE void ImplDrawAutoHide( sal_Bool bInPaint );
     120             :     SAL_DLLPRIVATE void ImplDrawFadeIn( sal_Bool bInPaint );
     121             :     SAL_DLLPRIVATE void ImplDrawFadeOut( sal_Bool bInPaint );
     122             :     SAL_DLLPRIVATE void ImplNewAlign();
     123             :     SAL_DLLPRIVATE void ImplDrawGrip( const Rectangle& rRect, sal_Bool bHorz, sal_Bool bLeft );
     124             :     SAL_DLLPRIVATE void ImplDrawFadeArrow( const Point& rPt, sal_Bool bHorz, sal_Bool bLeft );
     125             :     SAL_DLLPRIVATE void ImplStartSplit( const MouseEvent& rMEvt );
     126             : 
     127             :     static SAL_DLLPRIVATE void ImplDrawBorder( SplitWindow* pWin );
     128             :     static SAL_DLLPRIVATE void ImplDrawBorderLine( SplitWindow* pWin );
     129             :     static SAL_DLLPRIVATE void ImplCalcSet2( SplitWindow* pWindow, ImplSplitSet* pSet, sal_Bool bHide,
     130             :                                              sal_Bool bRows, sal_Bool bDown = sal_True );
     131             :     static SAL_DLLPRIVATE void ImplDrawBack( SplitWindow* pWindow, ImplSplitSet* pSet );
     132             :     static SAL_DLLPRIVATE void ImplDrawBack( SplitWindow* pWindow, const Rectangle& rRect,
     133             :                                              const Wallpaper* pWall, const Bitmap* pBitmap );
     134             :     static SAL_DLLPRIVATE sal_uInt16 ImplTestSplit( ImplSplitSet* pSet, const Point& rPos,
     135             :                                                 long& rMouseOff, ImplSplitSet** ppFoundSet, sal_uInt16& rFoundPos,
     136             :                                                 sal_Bool bRows, sal_Bool bDown = sal_True );
     137             :     static SAL_DLLPRIVATE sal_uInt16 ImplTestSplit( SplitWindow* pWindow, const Point& rPos,
     138             :                                                 long& rMouseOff, ImplSplitSet** ppFoundSet, sal_uInt16& rFoundPos );
     139             :     static SAL_DLLPRIVATE void ImplDrawSplitTracking( SplitWindow* pThis, const Point& rPos );
     140             : 
     141             :     // Copy assignment is forbidden and not implemented.
     142             :     SAL_DLLPRIVATE      SplitWindow (const SplitWindow &);
     143             :     SAL_DLLPRIVATE      SplitWindow & operator= (const SplitWindow &);
     144             : public:
     145             :                         SplitWindow( Window* pParent, WinBits nStyle = 0 );
     146             :                         ~SplitWindow();
     147             : 
     148             :     virtual void        StartSplit();
     149             :     virtual void        Split();
     150             :     virtual void        SplitResize();
     151             :     virtual void        AutoHide();
     152             :     virtual void        FadeIn();
     153             :     virtual void        FadeOut();
     154             : 
     155             :     virtual void        MouseButtonDown( const MouseEvent& rMEvt );
     156             :     virtual void        MouseMove( const MouseEvent& rMEvt );
     157             :     virtual void        Tracking( const TrackingEvent& rTEvt );
     158             :     virtual void        Paint( const Rectangle& rRect );
     159             :     virtual void        Move();
     160             :     virtual void        Resize();
     161             :     virtual void        RequestHelp( const HelpEvent& rHEvt );
     162             :     virtual void        StateChanged( StateChangedType nType );
     163             :     virtual void        DataChanged( const DataChangedEvent& rDCEvt );
     164             :     virtual long        PreNotify( NotifyEvent& rNEvt );
     165             : 
     166             :     void                InsertItem( sal_uInt16 nId, Window* pWindow, long nSize,
     167             :                                     sal_uInt16 nPos = SPLITWINDOW_APPEND, sal_uInt16 nSetId = 0,
     168             :                                     SplitWindowItemBits nBits = 0 );
     169             :     void                InsertItem( sal_uInt16 nId, long nSize,
     170             :                                     sal_uInt16 nPos = SPLITWINDOW_APPEND, sal_uInt16 nSetId = 0,
     171             :                                     SplitWindowItemBits nBits = 0 );
     172             :     void                RemoveItem( sal_uInt16 nId, sal_Bool bHide = sal_True );
     173             :     void                Clear();
     174             : 
     175             :     void                SplitItem( sal_uInt16 nId, long nNewSize,
     176             :                                    sal_Bool bPropSmall = sal_False,
     177             :                                    sal_Bool bPropGreat = sal_False );
     178             :     void                SetItemSize( sal_uInt16 nId, long nNewSize );
     179             :     long                GetItemSize( sal_uInt16 nId ) const;
     180             :     /** Set a range that limits the (variable part of the) size with an
     181             :         upper and a lower bound (both are valid values themselves.)
     182             :         @param nId
     183             :             Id of the item for which the size limits are set.
     184             :         @param aRange
     185             :             Values of -1 define missing bounds, thus setting a range (-1,-1)
     186             :             (the default) removes the size limitiation.
     187             :     */
     188             :     void                SetItemSizeRange (sal_uInt16 nId, const Range aRange);
     189             :     /** Return the current size limits for the specified item.
     190             :     */
     191             :     long                GetItemSize( sal_uInt16 nId, SplitWindowItemBits nBits ) const;
     192             :     sal_uInt16              GetSet( sal_uInt16 nId ) const;
     193             :     sal_uInt16              GetItemId( Window* pWindow ) const;
     194             :     sal_uInt16              GetItemId( const Point& rPos ) const;
     195             :     sal_uInt16              GetItemPos( sal_uInt16 nId, sal_uInt16 nSetId = 0 ) const;
     196             :     sal_uInt16              GetItemId( sal_uInt16 nPos, sal_uInt16 nSetId = 0 ) const;
     197             :     sal_uInt16              GetItemCount( sal_uInt16 nSetId = 0 ) const;
     198             :     sal_Bool                IsItemValid( sal_uInt16 nId ) const;
     199             : 
     200             :     sal_Bool                IsNoAlign() const { return mbNoAlign; }
     201             :     void                SetAlign( WindowAlign eNewAlign = WINDOWALIGN_TOP );
     202       13668 :     WindowAlign         GetAlign() const { return meAlign; }
     203         387 :     sal_Bool                IsHorizontal() const { return mbHorz; }
     204             : 
     205             :     sal_Bool                IsSplitting() const { return IsTracking(); }
     206             : 
     207           0 :     void                SetMaxSizePixel( long nNewMaxSize ) { mnMaxSize = nNewMaxSize; }
     208             :     long                GetMaxSizePixel() const { return mnMaxSize; }
     209             : 
     210             :     Size                CalcLayoutSizePixel( const Size& aNewSize );
     211             : 
     212             :     void                ShowAutoHideButton( sal_Bool bShow = sal_True );
     213        4328 :     sal_Bool                IsAutoHideButtonVisible() const { return mbAutoHide; }
     214             :     void                ShowFadeInHideButton( sal_Bool bShow = sal_True );
     215             :     void                ShowFadeInButton( sal_Bool bShow = sal_True ) { ShowFadeInHideButton( bShow ); }
     216             :     sal_Bool                IsFadeInButtonVisible() const { return mbFadeIn; }
     217             :     void                ShowFadeOutButton( sal_Bool bShow = sal_True );
     218             :     sal_Bool                IsFadeOutButtonVisible() const { return mbFadeOut; }
     219             :     long                GetFadeInSize() const;
     220           0 :     sal_Bool                IsFadeNoButtonMode() const { return mbFadeNoButtonMode; }
     221             : 
     222             :     void                SetAutoHideState( sal_Bool bAutoHide );
     223             :     sal_Bool                GetAutoHideState() const { return mbAutoHideIn; }
     224             : 
     225             :     void                SetStartSplitHdl( const Link& rLink ) { maStartSplitHdl = rLink; }
     226             :     const Link&         GetStartSplitHdl() const { return maStartSplitHdl; }
     227           0 :     void                SetSplitHdl( const Link& rLink ) { maSplitHdl = rLink; }
     228             :     const Link&         GetSplitHdl() const { return maSplitHdl; }
     229             :     void                SetSplitResizeHdl( const Link& rLink ) { maSplitResizeHdl = rLink; }
     230             :     const Link&         GetSplitResizeHdl() const { return maSplitResizeHdl; }
     231             :     void                SetAutoHideHdl( const Link& rLink ) { maAutoHideHdl = rLink; }
     232             :     const Link&         GetAutoHideHdl() const { return maAutoHideHdl; }
     233             :     void                SetFadeInHdl( const Link& rLink ) { maFadeInHdl = rLink; }
     234             :     const Link&         GetFadeInHdl() const { return maFadeInHdl; }
     235             :     void                SetFadeOutHdl( const Link& rLink ) { maFadeOutHdl = rLink; }
     236             :     const Link&         GetFadeOutHdl() const { return maFadeOutHdl; }
     237             : };
     238             : 
     239             : #endif  // _SV_SPLITWIN_HXX
     240             : 
     241             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10