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

Generated by: LCOV version 1.10