LCOV - code coverage report
Current view: top level - include/vcl - syswin.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 30 34 88.2 %
Date: 2015-06-13 12:38:46 Functions: 27 31 87.1 %
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_SYSWIN_HXX
      21             : #define INCLUDED_VCL_SYSWIN_HXX
      22             : 
      23             : #include <tools/solar.h>
      24             : #include <vcl/dllapi.h>
      25             : #include <vcl/builder.hxx>
      26             : #include <vcl/window.hxx>
      27             : #include <vcl/idle.hxx>
      28             : 
      29             : class ModalDialog;
      30             : class MenuBar;
      31             : class TaskPaneList;
      32             : class VclContainer;
      33             : 
      34             : // - Icon-Types -
      35             : #define ICON_LO_DEFAULT                 1
      36             : #define ICON_TEXT_DOCUMENT              2
      37             : #define ICON_SPREADSHEET_DOCUMENT       4
      38             : #define ICON_DRAWING_DOCUMENT           6
      39             : #define ICON_PRESENTATION_DOCUMENT      8
      40             : #define ICON_TEMPLATE                   11
      41             : #define ICON_DATABASE_DOCUMENT          12
      42             : #define ICON_MATH_DOCUMENT              13
      43             : #define ICON_MACROLIBRARY               1
      44             : 
      45             : 
      46             : // - WindowStateData -
      47             : 
      48             : 
      49             : #define WINDOWSTATE_MASK_X                  ((sal_uLong)0x00000001)
      50             : #define WINDOWSTATE_MASK_Y                  ((sal_uLong)0x00000002)
      51             : #define WINDOWSTATE_MASK_WIDTH              ((sal_uLong)0x00000004)
      52             : #define WINDOWSTATE_MASK_HEIGHT             ((sal_uLong)0x00000008)
      53             : #define WINDOWSTATE_MASK_STATE              ((sal_uLong)0x00000010)
      54             : #define WINDOWSTATE_MASK_MINIMIZED          ((sal_uLong)0x00000020)
      55             : #define WINDOWSTATE_MASK_MAXIMIZED_X        ((sal_uLong)0x00000100)
      56             : #define WINDOWSTATE_MASK_MAXIMIZED_Y        ((sal_uLong)0x00000200)
      57             : #define WINDOWSTATE_MASK_MAXIMIZED_WIDTH    ((sal_uLong)0x00000400)
      58             : #define WINDOWSTATE_MASK_MAXIMIZED_HEIGHT   ((sal_uLong)0x00000800)
      59             : #define WINDOWSTATE_MASK_POS  (WINDOWSTATE_MASK_X | WINDOWSTATE_MASK_Y)
      60             : #define WINDOWSTATE_MASK_ALL  (WINDOWSTATE_MASK_X | WINDOWSTATE_MASK_Y | WINDOWSTATE_MASK_WIDTH | WINDOWSTATE_MASK_HEIGHT | WINDOWSTATE_MASK_MAXIMIZED_X | WINDOWSTATE_MASK_MAXIMIZED_Y | WINDOWSTATE_MASK_MAXIMIZED_WIDTH | WINDOWSTATE_MASK_MAXIMIZED_HEIGHT | WINDOWSTATE_MASK_STATE | WINDOWSTATE_MASK_MINIMIZED)
      61             : 
      62             : #define WINDOWSTATE_STATE_NORMAL         ((sal_uLong)0x00000001)
      63             : #define WINDOWSTATE_STATE_MINIMIZED      ((sal_uLong)0x00000002)
      64             : #define WINDOWSTATE_STATE_MAXIMIZED      ((sal_uLong)0x00000004)
      65             : #define WINDOWSTATE_STATE_ROLLUP         ((sal_uLong)0x00000008)
      66             : #define WINDOWSTATE_STATE_MAXIMIZED_HORZ ((sal_uLong)0x00000010)
      67             : #define WINDOWSTATE_STATE_MAXIMIZED_VERT ((sal_uLong)0x00000020)
      68             : #define WINDOWSTATE_STATE_SYSTEMMASK     ((sal_uLong)0x0000FFFF)
      69             : 
      70             : class VCL_PLUGIN_PUBLIC WindowStateData
      71             : {
      72             : private:
      73             :     sal_uInt32          mnValidMask;
      74             :     int                 mnX;
      75             :     int                 mnY;
      76             :     unsigned int        mnWidth;
      77             :     unsigned int        mnHeight;
      78             :     int                 mnMaximizedX;
      79             :     int                 mnMaximizedY;
      80             :     unsigned int        mnMaximizedWidth;
      81             :     unsigned int        mnMaximizedHeight;
      82             :     sal_uInt32          mnState;
      83             : 
      84             : public:
      85        9675 :                 WindowStateData()
      86             :                 {
      87        9675 :                     mnValidMask = mnX = mnY = mnWidth = mnHeight = mnState = 0;
      88        9675 :                     mnMaximizedX = mnMaximizedY = mnMaximizedWidth = mnMaximizedHeight = 0;
      89        9675 :                 }
      90             : 
      91       16130 :     void        SetMask( sal_uLong nValidMask ) { mnValidMask = nValidMask; }
      92       35212 :     sal_uInt32  GetMask() const { return mnValidMask; }
      93             : 
      94        9675 :     void         SetX( int nX ) { mnX = nX; }
      95       15877 :     int          GetX() const { return mnX; }
      96        9675 :     void         SetY( int nY ) { mnY = nY; }
      97       15877 :     int          GetY() const { return mnY; }
      98        9675 :     void         SetWidth( unsigned int nWidth ) { mnWidth = nWidth; }
      99       15996 :     unsigned int GetWidth() const { return mnWidth; }
     100        9675 :     void         SetHeight( unsigned int nHeight ) { mnHeight = nHeight; }
     101       15877 :     unsigned int GetHeight() const { return mnHeight; }
     102        9675 :     void         SetState( sal_uInt32 nState ) { mnState = nState; }
     103        9675 :     sal_uInt32   GetState() const { return mnState; }
     104        3220 :     void         SetMaximizedX( int nRX ) { mnMaximizedX = nRX; }
     105       15877 :     int          GetMaximizedX() const { return mnMaximizedX; }
     106        3220 :     void         SetMaximizedY( int nRY ) { mnMaximizedY = nRY; }
     107       15877 :     int          GetMaximizedY() const { return mnMaximizedY; }
     108        6321 :     void         SetMaximizedWidth( unsigned int nRWidth ) { mnMaximizedWidth = nRWidth; }
     109       12776 :     unsigned int GetMaximizedWidth() const { return mnMaximizedWidth; }
     110        6321 :     void         SetMaximizedHeight( unsigned int nRHeight ) { mnMaximizedHeight = nRHeight; }
     111       12776 :     unsigned int GetMaximizedHeight() const { return mnMaximizedHeight; }
     112             : };
     113             : 
     114             : 
     115             : // - SystemWindow-Types -
     116             : 
     117             : 
     118             : enum class MenuBarMode
     119             : {
     120             :     Normal, Hide
     121             : };
     122             : 
     123             : enum class TitleButton
     124             : {
     125             :     Docking        = 1,
     126             :     Hide           = 2,
     127             :     Menu           = 4,
     128             : };
     129             : 
     130             : // - SystemWindow -
     131             : class VCL_DLLPUBLIC SystemWindow
     132             :     : public vcl::Window
     133             :     , public VclBuilderContainer
     134             : {
     135             :     friend class WorkWindow;
     136             :     class ImplData;
     137             : 
     138             : private:
     139             :     MenuBar*        mpMenuBar;
     140             :     Size            maOrgSize;
     141             :     Size            maRollUpOutSize;
     142             :     Size            maMinOutSize;
     143             :     bool            mbPinned;
     144             :     bool            mbRollUp;
     145             :     bool            mbRollFunc;
     146             :     bool            mbDockBtn;
     147             :     bool            mbHideBtn;
     148             :     bool            mbSysChild;
     149             :     bool            mbIsCalculatingInitialLayoutSize;
     150             :     bool            mbInitialLayoutDone;
     151             :     MenuBarMode     mnMenuBarMode;
     152             :     sal_uInt16      mnIcon;
     153             :     ImplData*       mpImplData;
     154             :     Idle            maLayoutIdle;
     155             : protected:
     156             :     bool            mbIsDefferedInit;
     157             :     VclPtr<vcl::Window> mpDialogParent;
     158             : public:
     159             :     using Window::ImplIsInTaskPaneList;
     160             :     SAL_DLLPRIVATE bool ImplIsInTaskPaneList( vcl::Window* pWin );
     161           3 :     SAL_DLLPRIVATE bool isDeferredInit() const { return mbIsDefferedInit; }
     162             : 
     163             : private:
     164             :     SAL_DLLPRIVATE void Init();
     165             :     SAL_DLLPRIVATE void ImplMoveToScreen( long& io_rX, long& io_rY, long i_nWidth, long i_nHeight, vcl::Window* i_pConfigureWin );
     166             :     virtual void setPosSizeOnContainee(Size aSize, Window &rBox);
     167             :     DECL_DLLPRIVATE_LINK_TYPED( ImplHandleLayoutTimerHdl, Idle*, void );
     168             : 
     169             : protected:
     170             :     // Single argument ctors shall be explicit.
     171             :     explicit SystemWindow(WindowType nType);
     172             :     void loadUI(vcl::Window* pParent, const OString& rID, const OUString& rUIXMLDescription, const css::uno::Reference<css::frame::XFrame> &rFrame = css::uno::Reference<css::frame::XFrame>());
     173             : 
     174             :     void     SetWindowStateData( const WindowStateData& rData );
     175             : 
     176             :     virtual void settingOptimalLayoutSize(Window *pBox);
     177             : 
     178             :     SAL_DLLPRIVATE void DoInitialLayout();
     179             : public:
     180             :     virtual         ~SystemWindow();
     181             :     virtual void    dispose() SAL_OVERRIDE;
     182             : 
     183             :     virtual bool    Notify( NotifyEvent& rNEvt ) SAL_OVERRIDE;
     184             :     virtual bool    PreNotify( NotifyEvent& rNEvt ) SAL_OVERRIDE;
     185             : 
     186             :     virtual bool    Close();
     187             :     virtual void    TitleButtonClick( TitleButton nButton );
     188             :     virtual void    Pin();
     189             :     virtual void    Roll();
     190             :     virtual void    Resizing( Size& rSize );
     191             :     virtual void    Resize() SAL_OVERRIDE;
     192             :     virtual Size    GetOptimalSize() const SAL_OVERRIDE;
     193             :     virtual void    queue_resize(StateChangedType eReason = StateChangedType::Layout) SAL_OVERRIDE;
     194             :     bool            isLayoutEnabled() const;
     195             :     void            setOptimalLayoutSize();
     196      401310 :     bool            isCalculatingInitialLayoutSize() const { return mbIsCalculatingInitialLayoutSize; }
     197             : 
     198             :     void            SetIcon( sal_uInt16 nIcon );
     199           0 :     sal_uInt16          GetIcon() const { return mnIcon; }
     200             :     // for systems like MacOSX which can display the URL a document is loaded from
     201             :     // separately from the window title
     202             :     void            SetRepresentedURL( const OUString& );
     203             : 
     204             :     void            EnableSaveBackground( bool bSave = true );
     205             :     bool            IsSaveBackgroundEnabled() const;
     206             : 
     207             :     void            ShowTitleButton( TitleButton nButton, bool bVisible = true );
     208             :     bool            IsTitleButtonVisible( TitleButton nButton ) const;
     209             : 
     210             :     void            SetPin( bool bPin );
     211           0 :     bool            IsPinned() const { return mbPinned; }
     212             : 
     213             :     void            RollUp();
     214             :     void            RollDown();
     215          12 :     bool            IsRollUp() const { return mbRollUp; }
     216             : 
     217           0 :     void            SetRollUpOutputSizePixel( const Size& rSize ) { maRollUpOutSize = rSize; }
     218           0 :     Size            GetRollUpOutputSizePixel() const { return maRollUpOutSize; }
     219             : 
     220             :     void            SetMinOutputSizePixel( const Size& rSize );
     221          13 :     const Size&     GetMinOutputSizePixel() const { return maMinOutSize; }
     222             :     void            SetMaxOutputSizePixel( const Size& rSize );
     223             :     const Size&     GetMaxOutputSizePixel() const;
     224             : 
     225             :     void            SetWindowState(const OString& rStr);
     226             :     OString         GetWindowState(sal_uLong nMask = WINDOWSTATE_MASK_ALL) const;
     227             : 
     228             :     void            SetMenuBar(MenuBar* pMenuBar, const css::uno::Reference<css::frame::XFrame>& rFrame = css::uno::Reference<css::frame::XFrame>());
     229       23878 :     MenuBar*        GetMenuBar() const { return mpMenuBar; }
     230             :     void            SetMenuBarMode( MenuBarMode nMode );
     231             :     MenuBarMode     GetMenuBarMode() const { return mnMenuBarMode; }
     232             : 
     233             :     TaskPaneList*   GetTaskPaneList();
     234             :     void            GetWindowStateData( WindowStateData& rData ) const;
     235             : 
     236             :     virtual void     SetText( const OUString& rStr ) SAL_OVERRIDE;
     237             :     virtual OUString GetText() const SAL_OVERRIDE;
     238             : 
     239             :     /**
     240             :     Returns the screen number the window is on
     241             : 
     242             :     The Display Screen number is counted the same way that
     243             :     <code>Application::GetScreenPosSizePixel</code>,
     244             :     <code>Application::GetDisplayScreenName</code>
     245             :     and of course <code>SystemWindow::SetScreenNumber</code>
     246             :     are counted in.
     247             : 
     248             :     In case the window is positioned on multiple screens the
     249             :     screen number returned will be of the screen containing the
     250             :     upper left pixel of the frame area (that is of the client
     251             :     area on system decorated windows, or the frame area of
     252             :     undecorated resp. owner decorated windows.
     253             : 
     254             :     @returns the screen number
     255             : 
     256             :     @see SystemWindow::SetScreenNumber
     257             :     */
     258             :     unsigned int    GetScreenNumber() const;
     259             :     /**
     260             :     Move the Window to a new screen. The same rules for
     261             :     positioning apply as in <code>SystemWindow::GetScreenNumber</code>
     262             : 
     263             :     The Display Screen number is counted the same way that
     264             :     <code>Application::GetScreenPosSizePixel</code>,
     265             :     <code>Application::GetDisplayScreenName</code>
     266             :     and of course <code>SystemWindow::GetScreenNumber</code>
     267             :     are counted in.
     268             : 
     269             :     @see GetScreenNumber
     270             :     */
     271             :     void            SetScreenNumber( unsigned int nNewScreen );
     272             : 
     273             :     void            SetApplicationID( const OUString &rApplicationID );
     274             : 
     275             :     void SetCloseHdl(const Link<>& rLink);
     276             :     const Link<>& GetCloseHdl() const;
     277             : 
     278      401326 :     SAL_DLLPRIVATE bool hasPendingLayout() const { return maLayoutIdle.IsActive(); }
     279             : 
     280             :     virtual        void    doDeferredInit(WinBits nBits);
     281             : };
     282             : 
     283             : #endif // INCLUDED_VCL_SYSWIN_HXX
     284             : 
     285             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11