LCOV - code coverage report
Current view: top level - vcl/inc - brdwin.hxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 9 0.0 %
Date: 2014-04-14 Functions: 0 9 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 INCLUDED_VCL_INC_BRDWIN_HXX
      21             : #define INCLUDED_VCL_INC_BRDWIN_HXX
      22             : 
      23             : #include <vcl/window.hxx>
      24             : 
      25             : class ImplBorderWindowView;
      26             : 
      27             : #define BORDERWINDOW_STYLE_OVERLAP          ((sal_uInt16)0x0001)
      28             : #define BORDERWINDOW_STYLE_BORDER           ((sal_uInt16)0x0002)
      29             : #define BORDERWINDOW_STYLE_FLOAT            ((sal_uInt16)0x0004)
      30             : #define BORDERWINDOW_STYLE_FRAME            ((sal_uInt16)0x0008)
      31             : #define BORDERWINDOW_STYLE_APP              ((sal_uInt16)0x0010)
      32             : 
      33             : #define BORDERWINDOW_HITTEST_TITLE          ((sal_uInt16)0x0001)
      34             : #define BORDERWINDOW_HITTEST_LEFT           ((sal_uInt16)0x0002)
      35             : #define BORDERWINDOW_HITTEST_MENU           ((sal_uInt16)0x0004)
      36             : #define BORDERWINDOW_HITTEST_TOP            ((sal_uInt16)0x0008)
      37             : #define BORDERWINDOW_HITTEST_RIGHT          ((sal_uInt16)0x0010)
      38             : #define BORDERWINDOW_HITTEST_BOTTOM         ((sal_uInt16)0x0020)
      39             : #define BORDERWINDOW_HITTEST_TOPLEFT        ((sal_uInt16)0x0040)
      40             : #define BORDERWINDOW_HITTEST_TOPRIGHT       ((sal_uInt16)0x0080)
      41             : #define BORDERWINDOW_HITTEST_BOTTOMLEFT     ((sal_uInt16)0x0100)
      42             : #define BORDERWINDOW_HITTEST_BOTTOMRIGHT    ((sal_uInt16)0x0200)
      43             : #define BORDERWINDOW_HITTEST_CLOSE          ((sal_uInt16)0x0400)
      44             : #define BORDERWINDOW_HITTEST_ROLL           ((sal_uInt16)0x0800)
      45             : #define BORDERWINDOW_HITTEST_DOCK           ((sal_uInt16)0x1000)
      46             : #define BORDERWINDOW_HITTEST_HIDE           ((sal_uInt16)0x2000)
      47             : #define BORDERWINDOW_HITTEST_HELP           ((sal_uInt16)0x4000)
      48             : #define BORDERWINDOW_HITTEST_PIN            ((sal_uInt16)0x8000)
      49             : 
      50             : #define BORDERWINDOW_DRAW_TITLE             ((sal_uInt16)0x0001)
      51             : #define BORDERWINDOW_DRAW_BORDER            ((sal_uInt16)0x0002)
      52             : #define BORDERWINDOW_DRAW_FRAME             ((sal_uInt16)0x0004)
      53             : #define BORDERWINDOW_DRAW_CLOSE             ((sal_uInt16)0x0008)
      54             : #define BORDERWINDOW_DRAW_ROLL              ((sal_uInt16)0x0010)
      55             : #define BORDERWINDOW_DRAW_DOCK              ((sal_uInt16)0x0020)
      56             : #define BORDERWINDOW_DRAW_HIDE              ((sal_uInt16)0x0040)
      57             : #define BORDERWINDOW_DRAW_HELP              ((sal_uInt16)0x0080)
      58             : #define BORDERWINDOW_DRAW_PIN               ((sal_uInt16)0x0100)
      59             : #define BORDERWINDOW_DRAW_MENU              ((sal_uInt16)0x0200)
      60             : #define BORDERWINDOW_DRAW_ALL               (BORDERWINDOW_DRAW_TITLE |      \
      61             :                                              BORDERWINDOW_DRAW_BORDER |     \
      62             :                                              BORDERWINDOW_DRAW_FRAME |      \
      63             :                                              BORDERWINDOW_DRAW_CLOSE |      \
      64             :                                              BORDERWINDOW_DRAW_ROLL |       \
      65             :                                              BORDERWINDOW_DRAW_DOCK |       \
      66             :                                              BORDERWINDOW_DRAW_HIDE |       \
      67             :                                              BORDERWINDOW_DRAW_HELP |       \
      68             :                                              BORDERWINDOW_DRAW_PIN  |       \
      69             :                                              BORDERWINDOW_DRAW_MENU)
      70             : 
      71             : #define BORDERWINDOW_TITLE_NORMAL           ((sal_uInt16)0x0001)
      72             : #define BORDERWINDOW_TITLE_SMALL            ((sal_uInt16)0x0002)
      73             : #define BORDERWINDOW_TITLE_TEAROFF          ((sal_uInt16)0x0004)
      74             : #define BORDERWINDOW_TITLE_POPUP            ((sal_uInt16)0x0008)
      75             : #define BORDERWINDOW_TITLE_NONE             ((sal_uInt16)0x0010)
      76             : 
      77             : class ImplBorderWindow : public Window
      78             : {
      79             :     friend class Window;
      80             :     friend class ImplBorderWindowView;
      81             :     friend class ImplSmallBorderWindowView;
      82             :     friend class ImplStdBorderWindowView;
      83             : 
      84             : private:
      85             :     ImplBorderWindowView*   mpBorderView;
      86             :     Window*                 mpMenuBarWindow;
      87             :     long                    mnMinWidth;
      88             :     long                    mnMinHeight;
      89             :     long                    mnMaxWidth;
      90             :     long                    mnMaxHeight;
      91             :     long                    mnRollHeight;
      92             :     long                    mnOrgMenuHeight;
      93             :     sal_uInt16                  mnTitleType;
      94             :     sal_uInt16                  mnBorderStyle;
      95             :     bool                    mbFloatWindow;
      96             :     bool                    mbSmallOutBorder;
      97             :     bool                    mbFrameBorder;
      98             :     bool                    mbPinned;
      99             :     bool                    mbRollUp;
     100             :     bool                    mbMenuHide;
     101             :     bool                    mbDockBtn;
     102             :     bool                    mbHideBtn;
     103             :     bool                    mbMenuBtn;
     104             :     bool                    mbDisplayActive;
     105             : 
     106             :     using Window::ImplInit;
     107             :     void                    ImplInit( Window* pParent,
     108             :                                       WinBits nStyle, sal_uInt16 nTypeStyle,
     109             :                                       SystemParentData* pParentData );
     110             :     void                    ImplInit( Window* pParent,
     111             :                                       WinBits nStyle, sal_uInt16 nTypeStyle,
     112             :                                       const ::com::sun::star::uno::Any& );
     113             : 
     114             :                             // Copy assignment is forbidden and not implemented.
     115             :                             ImplBorderWindow (const ImplBorderWindow &);
     116             :                             ImplBorderWindow& operator= (const ImplBorderWindow &);
     117             : 
     118             : public:
     119             :                             ImplBorderWindow( Window* pParent,
     120             :                                               SystemParentData* pParentData,
     121             :                                               WinBits nStyle = 0,
     122             :                                               sal_uInt16 nTypeStyle = 0 );
     123             :                             ImplBorderWindow( Window* pParent, WinBits nStyle = 0,
     124             :                                               sal_uInt16 nTypeStyle = 0 );
     125             :                             virtual ~ImplBorderWindow();
     126             : 
     127             :     virtual void            MouseMove( const MouseEvent& rMEvt ) SAL_OVERRIDE;
     128             :     virtual void            MouseButtonDown( const MouseEvent& rMEvt ) SAL_OVERRIDE;
     129             :     virtual void            Tracking( const TrackingEvent& rTEvt ) SAL_OVERRIDE;
     130             :     virtual void            Paint( const Rectangle& rRect ) SAL_OVERRIDE;
     131             :     virtual void            Activate() SAL_OVERRIDE;
     132             :     virtual void            Deactivate() SAL_OVERRIDE;
     133             :     virtual void            Resize() SAL_OVERRIDE;
     134             :     virtual void            RequestHelp( const HelpEvent& rHEvt ) SAL_OVERRIDE;
     135             :     virtual void            StateChanged( StateChangedType nType ) SAL_OVERRIDE;
     136             :     virtual void            DataChanged( const DataChangedEvent& rDCEvt ) SAL_OVERRIDE;
     137             : 
     138             :     void                    InitView();
     139             :     void                    UpdateView( bool bNewView, const Size& rNewOutSize );
     140             :     void                    InvalidateBorder();
     141             : 
     142             :     using Window::Draw;
     143             :     void                    Draw( const Rectangle& rRect, OutputDevice* pDev, const Point& rPos );
     144             : 
     145             :     void                    SetDisplayActive( bool bActive );
     146             :     bool                    IsDisplayActive() const { return mbDisplayActive; }
     147             :     void                    SetTitleType( sal_uInt16 nTitleType, const Size& rSize );
     148             :     void                    SetBorderStyle( sal_uInt16 nStyle );
     149           0 :     sal_uInt16                  GetBorderStyle() const { return mnBorderStyle; }
     150             :     void                    SetPin( bool bPin );
     151             :     void                    SetRollUp( bool bRollUp, const Size& rSize );
     152             :     void                    SetCloser();
     153             :     void                    SetDockButton( bool bDockButton );
     154             :     void                    SetHideButton( bool bHideButton );
     155             :     void                    SetMenuButton( bool bMenuButton );
     156             : 
     157             :     void                    UpdateMenuHeight();
     158             :     void                    SetMenuBarWindow( Window* pWindow );
     159             :     void                    SetMenuBarMode( bool bHide );
     160             : 
     161           0 :     void                    SetMinOutputSize( long nWidth, long nHeight )
     162           0 :                                 { mnMinWidth = nWidth; mnMinHeight = nHeight; }
     163           0 :     void                    SetMaxOutputSize( long nWidth, long nHeight )
     164           0 :                                 { mnMaxWidth = nWidth; mnMaxHeight = nHeight; }
     165             : 
     166             :     void                    GetBorder( sal_Int32& rLeftBorder, sal_Int32& rTopBorder,
     167             :                                        sal_Int32& rRightBorder, sal_Int32& rBottomBorder ) const;
     168             :     long                    CalcTitleWidth() const;
     169             : 
     170             :     Rectangle               GetMenuRect() const;
     171             : 
     172             :     virtual Size            GetOptimalSize() const SAL_OVERRIDE;
     173             : };
     174             : 
     175           0 : struct ImplBorderFrameData
     176             : {
     177             :     ImplBorderWindow*       mpBorderWindow;
     178             :     OutputDevice*           mpOutDev;
     179             :     Rectangle               maTitleRect;
     180             :     Rectangle               maPinRect;
     181             :     Rectangle               maCloseRect;
     182             :     Rectangle               maRollRect;
     183             :     Rectangle               maDockRect;
     184             :     Rectangle               maMenuRect;
     185             :     Rectangle               maHideRect;
     186             :     Rectangle               maHelpRect;
     187             :     Point                   maMouseOff;
     188             :     long                    mnWidth;
     189             :     long                    mnHeight;
     190             :     long                    mnTrackX;
     191             :     long                    mnTrackY;
     192             :     long                    mnTrackWidth;
     193             :     long                    mnTrackHeight;
     194             :     sal_Int32               mnLeftBorder;
     195             :     sal_Int32               mnTopBorder;
     196             :     sal_Int32               mnRightBorder;
     197             :     sal_Int32               mnBottomBorder;
     198             :     long                    mnNoTitleTop;
     199             :     long                    mnBorderSize;
     200             :     long                    mnTitleHeight;
     201             :     long                    mnTitleOff;
     202             :     sal_uInt16                  mnHitTest;
     203             :     sal_uInt16                  mnPinState;
     204             :     sal_uInt16                  mnCloseState;
     205             :     sal_uInt16                  mnRollState;
     206             :     sal_uInt16                  mnDockState;
     207             :     sal_uInt16                  mnMenuState;
     208             :     sal_uInt16                  mnHideState;
     209             :     sal_uInt16                  mnHelpState;
     210             :     sal_uInt16                  mnTitleType;
     211             :     bool                    mbFloatWindow;
     212             :     bool                    mbDragFull;
     213             :     bool                    mbTitleClipped;
     214             : };
     215             : 
     216           0 : class ImplBorderWindowView
     217             : {
     218             : public:
     219             :     virtual                 ~ImplBorderWindowView();
     220             : 
     221             :     virtual bool        MouseMove( const MouseEvent& rMEvt );
     222             :     virtual bool        MouseButtonDown( const MouseEvent& rMEvt );
     223             :     virtual bool        Tracking( const TrackingEvent& rTEvt );
     224             :     virtual OUString        RequestHelp( const Point& rPos, Rectangle& rHelpRect );
     225             : 
     226             :     virtual void            Init( OutputDevice* pDev, long nWidth, long nHeight ) = 0;
     227             :     virtual void            GetBorder( sal_Int32& rLeftBorder, sal_Int32& rTopBorder,
     228             :                                        sal_Int32& rRightBorder, sal_Int32& rBottomBorder ) const = 0;
     229             :     virtual long            CalcTitleWidth() const = 0;
     230             :     virtual void            DrawWindow( sal_uInt16 nDrawFlags, OutputDevice* pOutDev = NULL, const Point* pOffset = NULL ) = 0;
     231             :     virtual Rectangle       GetMenuRect() const;
     232             : 
     233             :     void                    ImplInitTitle( ImplBorderFrameData* pData );
     234             :     sal_uInt16              ImplHitTest( ImplBorderFrameData* pData, const Point& rPos );
     235             :     bool                ImplMouseMove( ImplBorderFrameData* pData, const MouseEvent& rMEvt );
     236             :     bool                ImplMouseButtonDown( ImplBorderFrameData* pData, const MouseEvent& rMEvt );
     237             :     bool                ImplTracking( ImplBorderFrameData* pData, const TrackingEvent& rTEvt );
     238             :     OUString                ImplRequestHelp( ImplBorderFrameData* pData, const Point& rPos, Rectangle& rHelpRect );
     239             :     long                    ImplCalcTitleWidth( const ImplBorderFrameData* pData ) const;
     240             : };
     241             : 
     242           0 : class ImplNoBorderWindowView : public ImplBorderWindowView
     243             : {
     244             : public:
     245             :                             ImplNoBorderWindowView( ImplBorderWindow* pBorderWindow );
     246             : 
     247             :     virtual void            Init( OutputDevice* pDev, long nWidth, long nHeight ) SAL_OVERRIDE;
     248             :     virtual void            GetBorder( sal_Int32& rLeftBorder, sal_Int32& rTopBorder,
     249             :                                        sal_Int32& rRightBorder, sal_Int32& rBottomBorder ) const SAL_OVERRIDE;
     250             :     virtual long            CalcTitleWidth() const SAL_OVERRIDE;
     251             :     virtual void            DrawWindow( sal_uInt16 nDrawFlags, OutputDevice* pOutDev, const Point* pOffset ) SAL_OVERRIDE;
     252             : };
     253             : 
     254           0 : class ImplSmallBorderWindowView : public ImplBorderWindowView
     255             : {
     256             :     ImplBorderWindow*       mpBorderWindow;
     257             :     OutputDevice*           mpOutDev;
     258             :     long                    mnWidth;
     259             :     long                    mnHeight;
     260             :     sal_Int32               mnLeftBorder;
     261             :     sal_Int32               mnTopBorder;
     262             :     sal_Int32               mnRightBorder;
     263             :     sal_Int32               mnBottomBorder;
     264             :     bool                    mbNWFBorder;
     265             : 
     266             : public:
     267             :                             ImplSmallBorderWindowView( ImplBorderWindow* pBorderWindow );
     268             : 
     269             :     virtual void            Init( OutputDevice* pOutDev, long nWidth, long nHeight ) SAL_OVERRIDE;
     270             :     virtual void            GetBorder( sal_Int32& rLeftBorder, sal_Int32& rTopBorder,
     271             :                                        sal_Int32& rRightBorder, sal_Int32& rBottomBorder ) const SAL_OVERRIDE;
     272             :     virtual long            CalcTitleWidth() const SAL_OVERRIDE;
     273             :     virtual void            DrawWindow( sal_uInt16 nDrawFlags, OutputDevice* pOutDev, const Point* pOffset ) SAL_OVERRIDE;
     274             : };
     275             : 
     276             : class ImplStdBorderWindowView : public ImplBorderWindowView
     277             : {
     278             :     ImplBorderFrameData     maFrameData;
     279             :     VirtualDevice*          mpATitleVirDev;
     280             :     VirtualDevice*          mpDTitleVirDev;
     281             : 
     282             : public:
     283             :                             ImplStdBorderWindowView( ImplBorderWindow* pBorderWindow );
     284             :                             virtual ~ImplStdBorderWindowView();
     285             : 
     286             :     virtual bool        MouseMove( const MouseEvent& rMEvt ) SAL_OVERRIDE;
     287             :     virtual bool        MouseButtonDown( const MouseEvent& rMEvt ) SAL_OVERRIDE;
     288             :     virtual bool        Tracking( const TrackingEvent& rTEvt ) SAL_OVERRIDE;
     289             :     virtual OUString        RequestHelp( const Point& rPos, Rectangle& rHelpRect ) SAL_OVERRIDE;
     290             :     virtual Rectangle       GetMenuRect() const SAL_OVERRIDE;
     291             : 
     292             :     virtual void            Init( OutputDevice* pDev, long nWidth, long nHeight ) SAL_OVERRIDE;
     293             :     virtual void            GetBorder( sal_Int32& rLeftBorder, sal_Int32& rTopBorder,
     294             :                                        sal_Int32& rRightBorder, sal_Int32& rBottomBorder ) const SAL_OVERRIDE;
     295             :     virtual long            CalcTitleWidth() const SAL_OVERRIDE;
     296             :     virtual void            DrawWindow( sal_uInt16 nDrawFlags, OutputDevice* pOutDev, const Point* pOffset ) SAL_OVERRIDE;
     297             : };
     298             : 
     299             : #endif // INCLUDED_VCL_INC_BRDWIN_HXX
     300             : 
     301             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10