LCOV - code coverage report
Current view: top level - include/vcl - floatwin.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 5 12 41.7 %
Date: 2015-06-13 12:38:46 Functions: 5 12 41.7 %
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_FLOATWIN_HXX
      21             : #define INCLUDED_VCL_FLOATWIN_HXX
      22             : 
      23             : #include <tools/solar.h>
      24             : #include <vcl/dllapi.h>
      25             : #include <vcl/syswin.hxx>
      26             : #include <o3tl/typed_flags_set.hxx>
      27             : 
      28             : class ToolBox;
      29             : 
      30             : 
      31             : // - FloatingWindow-Types -
      32             : 
      33             : 
      34             : enum class FloatWinPopupFlags
      35             : {
      36             :     NONE                 = 0x000000,
      37             :     AllowTearOff         = 0x000001,
      38             :     AnimationSlide       = 0x000002,
      39             :     NoAutoArrange        = 0x000004,
      40             :     NoAnimation          = 0x000008,
      41             :     Down                 = 0x000010,
      42             :     Up                   = 0x000020,
      43             :     Left                 = 0x000040,
      44             :     Right                = 0x000080,
      45             :     NoFocusClose         = 0x000100,
      46             :     NoKeyClose           = 0x000200,
      47             :     NoMouseClose         = 0x000400,
      48             :     NoMouseRectClose     = 0x000800,
      49             :     AllMouseButtonClose  = 0x001000,
      50             :     NoAppFocusClose      = 0x002000,
      51             :     NewLevel             = 0x004000,
      52             :     NoMouseUpClose       = 0x008000,
      53             :     GrabFocus            = 0x010000,
      54             :     NoHorzPlacement      = 0x020000,
      55             : };
      56             : namespace o3tl
      57             : {
      58             :     template<> struct typed_flags<FloatWinPopupFlags> : is_typed_flags<FloatWinPopupFlags, 0x03ffff> {};
      59             : }
      60             : 
      61             : enum class FloatWinPopupEndFlags
      62             : {
      63             :     NONE              = 0x00,
      64             :     Cancel            = 0x01,
      65             :     TearOff           = 0x02,
      66             :     DontCallHdl       = 0x04,
      67             :     CloseAll          = 0x08,
      68             : };
      69             : namespace o3tl
      70             : {
      71             :     template<> struct typed_flags<FloatWinPopupEndFlags> : is_typed_flags<FloatWinPopupEndFlags, 0x0f> {};
      72             : }
      73             : 
      74             : enum class FloatWinTitleType
      75             : {
      76             :     Unknown                  = 0,
      77             :     Normal                   = 1,
      78             :     TearOff                  = 2,
      79             :     Popup                    = 3,
      80             :     NONE                     = 4,
      81             : };
      82             : 
      83             : enum HitTest
      84             : {
      85             :     HITTEST_OUTSIDE,
      86             :     HITTEST_WINDOW,
      87             :     HITTEST_RECT
      88             : };
      89             : 
      90             : // - FloatingWindow -
      91             : 
      92             : class VCL_DLLPUBLIC FloatingWindow : public SystemWindow
      93             : {
      94             :     class   ImplData;
      95             : private:
      96             :     VclPtr<FloatingWindow>  mpNextFloat;
      97             :     VclPtr<vcl::Window>     mpFirstPopupModeWin;
      98             :     ImplData*       mpImplData;
      99             :     Rectangle       maFloatRect;
     100             :     ImplSVEvent *   mnPostId;
     101             :     FloatWinPopupFlags   mnPopupModeFlags;
     102             :     FloatWinTitleType    mnTitle;
     103             :     FloatWinTitleType    mnOldTitle;
     104             :     bool            mbInPopupMode;
     105             :     bool            mbPopupMode;
     106             :     bool            mbPopupModeCanceled;
     107             :     bool            mbPopupModeTearOff;
     108             :     bool            mbMouseDown;
     109             :     bool            mbOldSaveBackMode;
     110             :     bool            mbGrabFocus;    // act as key input window, although focus is not set
     111             :     bool            mbInCleanUp;
     112             :     Link<>          maPopupModeEndHdl;
     113             : 
     114             :     SAL_DLLPRIVATE void    ImplCallPopupModeEnd();
     115             :     DECL_DLLPRIVATE_LINK(  ImplEndPopupModeHdl, void* );
     116             :     virtual void setPosSizeOnContainee(Size aSize, Window &rBox) SAL_OVERRIDE;
     117             : 
     118             :                            FloatingWindow (const FloatingWindow &) SAL_DELETED_FUNCTION;
     119             :                            FloatingWindow & operator= (const FloatingWindow &) SAL_DELETED_FUNCTION;
     120             : 
     121             : protected:
     122             :     using Window::ImplInit;
     123             :     SAL_DLLPRIVATE void    ImplInit( vcl::Window* pParent, WinBits nStyle );
     124             :     SAL_DLLPRIVATE void    ImplInitSettings();
     125             : 
     126             :     virtual void ApplySettings(vcl::RenderContext& rRenderContext) SAL_OVERRIDE;
     127             : 
     128             : public:
     129             :     SAL_DLLPRIVATE FloatingWindow*  ImplFloatHitTest( vcl::Window* pReference, const Point& rPos, HitTest& rHitTest );
     130             :     SAL_DLLPRIVATE FloatingWindow*  ImplFindLastLevelFloat();
     131             :     SAL_DLLPRIVATE bool             ImplIsFloatPopupModeWindow( const vcl::Window* pWindow );
     132           0 :     SAL_DLLPRIVATE void             ImplSetMouseDown() { mbMouseDown = true; }
     133           0 :     SAL_DLLPRIVATE bool             ImplIsMouseDown() const  { return mbMouseDown; }
     134             :     SAL_DLLPRIVATE static Point     ImplCalcPos( vcl::Window* pWindow,
     135             :                                                  const Rectangle& rRect, FloatWinPopupFlags nFlags,
     136             :                                                  sal_uInt16& rArrangeIndex );
     137             :     SAL_DLLPRIVATE void             ImplEndPopupMode( FloatWinPopupEndFlags nFlags = FloatWinPopupEndFlags::NONE, sal_uLong nFocusId = 0 );
     138             :     SAL_DLLPRIVATE Rectangle&       ImplGetItemEdgeClipRect();
     139           0 :     SAL_DLLPRIVATE bool             ImplIsInPrivatePopupMode() const { return mbInPopupMode; }
     140             :     virtual        void             doDeferredInit(WinBits nBits) SAL_OVERRIDE;
     141             : 
     142             : public:
     143             :     explicit        FloatingWindow(vcl::Window* pParent, WinBits nStyle = WB_STDFLOATWIN);
     144             :     explicit        FloatingWindow(vcl::Window* pParent, const OString& rID, const OUString& rUIXMLDescription,
     145             :                                    const css::uno::Reference<css::frame::XFrame> &rFrame = css::uno::Reference<css::frame::XFrame>());
     146             :     virtual         ~FloatingWindow();
     147             :     virtual void    dispose() SAL_OVERRIDE;
     148             : 
     149             :     virtual bool    Notify( NotifyEvent& rNEvt ) SAL_OVERRIDE;
     150             :     virtual void    StateChanged( StateChangedType nType ) SAL_OVERRIDE;
     151             :     virtual void    DataChanged( const DataChangedEvent& rDCEvt ) SAL_OVERRIDE;
     152             : 
     153             :     virtual void    PopupModeEnd();
     154             : 
     155             :     void            SetTitleType( FloatWinTitleType nTitle );
     156         100 :     FloatWinTitleType GetTitleType() const { return mnTitle; }
     157             : 
     158             :     void            StartPopupMode( const Rectangle& rRect, FloatWinPopupFlags nFlags = FloatWinPopupFlags::NONE );
     159             :     void            StartPopupMode( ToolBox* pBox, FloatWinPopupFlags nFlags = FloatWinPopupFlags::NONE  );
     160             :     void            EndPopupMode( FloatWinPopupEndFlags nFlags = FloatWinPopupEndFlags::NONE );
     161             :     void            AddPopupModeWindow( vcl::Window* pWindow );
     162           0 :     FloatWinPopupFlags GetPopupModeFlags() const { return mnPopupModeFlags; }
     163           0 :     void            SetPopupModeFlags( FloatWinPopupFlags nFlags ) { mnPopupModeFlags = nFlags; }
     164        3318 :     bool            IsInPopupMode() const { return mbPopupMode; }
     165           8 :     bool            IsInCleanUp() const { return mbInCleanUp; }
     166           2 :     bool            IsPopupModeCanceled() const { return mbPopupModeCanceled; }
     167           0 :     bool            IsPopupModeTearOff() const { return mbPopupModeTearOff; }
     168             : 
     169        3290 :     void            SetPopupModeEndHdl( const Link<>& rLink ) { maPopupModeEndHdl = rLink; }
     170             :     const Link<>&   GetPopupModeEndHdl() const  { return maPopupModeEndHdl; }
     171             : 
     172           0 :     bool            GrabsFocus() const { return mbGrabFocus; }
     173             : 
     174             :     static Point    CalcFloatingPosition( vcl::Window* pWindow, const Rectangle& rRect, FloatWinPopupFlags nFlags, sal_uInt16& rArrangeIndex );
     175             : };
     176             : 
     177             : #endif // INCLUDED_VCL_FLOATWIN_HXX
     178             : 
     179             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11