LCOV - code coverage report
Current view: top level - svtools/source/brwbox - datwin.hxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 19 22 86.4 %
Date: 2014-11-03 Functions: 13 15 86.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_SVTOOLS_SOURCE_BRWBOX_DATWIN_HXX
      21             : #define INCLUDED_SVTOOLS_SOURCE_BRWBOX_DATWIN_HXX
      22             : 
      23             : #include <svtools/brwbox.hxx>
      24             : #include <svtools/brwhead.hxx>
      25             : #include <vcl/timer.hxx>
      26             : #include <vcl/image.hxx>
      27             : #include <svtools/transfer.hxx>
      28             : #include <vector>
      29             : 
      30             : 
      31             : 
      32             : #define MIN_COLUMNWIDTH  2
      33             : 
      34             : typedef ::std::vector< Rectangle* > RectangleList;
      35             : 
      36             : 
      37             : 
      38          72 : class ButtonFrame
      39             : {
      40             :     Rectangle   aRect;
      41             :     Rectangle   aInnerRect;
      42             :     OUString    aText;
      43             :     bool        bPressed;
      44             :     bool        bCurs;
      45             :     bool        m_bDrawDisabled;
      46             : 
      47             : public:
      48          72 :                ButtonFrame( const Point& rPt, const Size& rSz,
      49             :                             const OUString &rText,
      50             :                             bool bPress,
      51             :                             bool bCursor,
      52             :                             bool _bDrawDisabled)
      53             :                 :aRect( rPt, rSz )
      54         144 :                 ,aInnerRect( Point( aRect.Left()+1, aRect.Top()+1 ),
      55         144 :                             Size( aRect.GetWidth()-2, aRect.GetHeight()-2 ) )
      56             :                 ,aText(rText)
      57             :                 ,bPressed(bPress)
      58             :                 ,bCurs(bCursor)
      59         360 :                 ,m_bDrawDisabled(_bDrawDisabled)
      60             :             {
      61          72 :             }
      62             : 
      63             :     void    Draw( OutputDevice& rDev );
      64             : };
      65             : 
      66             : 
      67             : 
      68             : class BrowserColumn
      69             : {
      70             :     sal_uInt16          _nId;
      71             :     sal_uLong           _nOriginalWidth;
      72             :     sal_uLong           _nWidth;
      73             :     Image               _aImage;
      74             :     OUString            _aTitle;
      75             :     bool                _bFrozen;
      76             : 
      77             : public:
      78             :                         BrowserColumn( sal_uInt16 nItemId, const Image &rImage,
      79             :                                         const OUString& rTitle, sal_uLong nWidthPixel, const Fraction& rCurrentZoom );
      80             :     virtual            ~BrowserColumn();
      81             : 
      82        3996 :     sal_uInt16          GetId() const { return _nId; }
      83             : 
      84        3861 :     sal_uLong           Width() { return _nWidth; }
      85             :     Image&              GetImage() { return _aImage; }
      86          56 :     OUString&           Title() { return _aTitle; }
      87             : 
      88        4502 :     bool                IsFrozen() const { return _bFrozen; }
      89          68 :     void                Freeze( bool bFreeze = true ) { _bFrozen = bFreeze; }
      90             : 
      91             :     virtual void        Draw( BrowseBox& rBox, OutputDevice& rDev,
      92             :                               const Point& rPos, bool bCurs  );
      93             : 
      94             :     void                SetWidth(sal_uLong nNewWidthPixel, const Fraction& rCurrentZoom);
      95             :     void                ZoomChanged(const Fraction& rNewZoom);
      96             : };
      97             : 
      98             : 
      99             : 
     100             : class BrowserDataWin
     101             :             :public Control
     102             :             ,public DragSourceHelper
     103             :             ,public DropTargetHelper
     104             : {
     105             : public:
     106             :     BrowserHeader*  pHeaderBar;     // only for BROWSER_HEADERBAR_NEW
     107             :     vcl::Window*         pEventWin;      // Window of forwarded events
     108             :     ScrollBarBox*   pCornerWin;     // Window in the corner btw the ScrollBars
     109             :     bool            bInDtor;
     110             :     AutoTimer       aMouseTimer;    // recalls MouseMove on dragging out
     111             :     MouseEvent      aRepeatEvt;     // a MouseEvent to repeat
     112             :     Point           aLastMousePos;  // prevents pseudo-MouseMoves
     113             : 
     114             :     OUString        aRealRowCount;  // to show in VScrollBar
     115             : 
     116             :     RectangleList   aInvalidRegion; // invalidated Rectangles during !UpdateMode
     117             :     bool            bInPaint;       // TRUE while in Paint
     118             :     bool            bInCommand;     // TRUE while in Command
     119             :     bool            bNoScrollBack;  // only scroll forward
     120             :     bool            bNoHScroll;     // no horizontal scrollbar
     121             :     bool            bNoVScroll;     // no vertical scrollbar
     122             :     bool            bAutoHScroll;   // autohide horizontaler Scrollbar
     123             :     bool            bAutoVScroll;   // autohide horizontaler Scrollbar
     124             :     bool            bUpdateMode;    // not SV-UpdateMode because of Invalidate()
     125             :     bool            bAutoSizeLastCol; // last column always fills up window
     126             :     bool            bResizeOnPaint;   // outstanding resize-event
     127             :     bool            bUpdateOnUnlock;  // Update() while locked
     128             :     bool            bInUpdateScrollbars;  // prevents recursions
     129             :     bool            bHadRecursion;        // a recursion occurred
     130             :     bool            bOwnDataChangedHdl;   // dont change colors in DataChanged
     131             :     bool            bCallingDropCallback; // we're in a callback to AcceptDrop or ExecuteDrop curently
     132             :     sal_uInt16          nUpdateLock;    // lock count, dont call Control::Update()!
     133             :     short           nCursorHidden;  // new counter for DoHide/ShowCursor
     134             : 
     135             :     long            m_nDragRowDividerLimit;
     136             :     long            m_nDragRowDividerOffset;
     137             : 
     138             : public:
     139             :                     BrowserDataWin( BrowseBox* pParent );
     140             :                     virtual ~BrowserDataWin();
     141             : 
     142             :     virtual void    DataChanged( const DataChangedEvent& rDCEvt ) SAL_OVERRIDE;
     143             :     virtual void    Paint( const Rectangle& rRect ) SAL_OVERRIDE;
     144             :     virtual void    RequestHelp( const HelpEvent& rHEvt ) SAL_OVERRIDE;
     145             :     virtual void    Command( const CommandEvent& rEvt ) SAL_OVERRIDE;
     146             :     virtual void    MouseButtonDown( const MouseEvent& rEvt ) SAL_OVERRIDE;
     147             :     virtual void    MouseMove( const MouseEvent& rEvt ) SAL_OVERRIDE;
     148             :                     DECL_LINK( RepeatedMouseMove, void * );
     149             : 
     150             :     virtual void    MouseButtonUp( const MouseEvent& rEvt ) SAL_OVERRIDE;
     151             :     virtual void    KeyInput( const KeyEvent& rEvt ) SAL_OVERRIDE;
     152             :     virtual void    Tracking( const TrackingEvent& rTEvt ) SAL_OVERRIDE;
     153             : 
     154             :     // DropTargetHelper overridables
     155             :     virtual sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt ) SAL_OVERRIDE;
     156             :     virtual sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt ) SAL_OVERRIDE;
     157             : 
     158             :     // DragSourceHelper overridables
     159             :     virtual void    StartDrag( sal_Int8 _nAction, const Point& _rPosPixel ) SAL_OVERRIDE;
     160             : 
     161             : 
     162             :     BrowseEvent     CreateBrowseEvent( const Point& rPosPixel );
     163             :     void            Repaint();
     164         208 :     BrowseBox*      GetParent() const
     165         208 :                          { return static_cast<BrowseBox*>( Window::GetParent() ); }
     166           0 :     const OUString& GetRealRowCount() const { return aRealRowCount; }
     167             : 
     168             :     void            SetUpdateMode( bool bMode );
     169         752 :     bool            GetUpdateMode() const { return bUpdateMode; }
     170           2 :     void            EnterUpdateLock() { ++nUpdateLock; }
     171             :     void            LeaveUpdateLock();
     172             :     void            Update();
     173             :     void            DoOutstandingInvalidations();
     174             :     void            Invalidate( sal_uInt16 nFlags = 0 ) SAL_OVERRIDE;
     175             :     void            Invalidate( const Rectangle& rRect, sal_uInt16 nFlags = 0 ) SAL_OVERRIDE;
     176           0 :     void            Invalidate( const vcl::Region& rRegion, sal_uInt16 nFlags = 0 ) SAL_OVERRIDE
     177           0 :                     { Control::Invalidate( rRegion, nFlags ); }
     178             : 
     179             : protected:
     180             :     void            StartRowDividerDrag( const Point& _rStartPos );
     181             :     bool            ImplRowDividerHitTest( const BrowserMouseEvent& _rEvent );
     182             : };
     183             : 
     184             : 
     185             : 
     186             : inline void BrowserDataWin::Repaint()
     187             : {
     188             :     if ( GetUpdateMode() )
     189             :         Update();
     190             :     Paint( Rectangle( Point(), GetOutputSizePixel() ) );
     191             : }
     192             : 
     193             : 
     194             : 
     195         248 : class BrowserScrollBar: public ScrollBar
     196             : {
     197             :     sal_uLong           _nTip;
     198             :     sal_uLong           _nLastPos;
     199             :     BrowserDataWin* _pDataWin;
     200             : 
     201             : public:
     202         124 :                     BrowserScrollBar( vcl::Window* pParent, WinBits nStyle,
     203             :                                       BrowserDataWin *pDataWin )
     204             :                     :   ScrollBar( pParent, nStyle ),
     205             :                         _nTip( 0 ),
     206             :                         _nLastPos( ULONG_MAX ),
     207         124 :                         _pDataWin( pDataWin )
     208         124 :                     {}
     209             :                     //ScrollBar( vcl::Window* pParent, const ResId& rResId );
     210             : 
     211             :     virtual void    Tracking( const TrackingEvent& rTEvt ) SAL_OVERRIDE;
     212             :     virtual void    EndScroll() SAL_OVERRIDE;
     213             : };
     214             : 
     215             : 
     216             : 
     217             : void InitSettings_Impl( vcl::Window *pWin,
     218             :          bool bFont = true, bool bForeground = true, bool bBackground = true );
     219             : 
     220             : 
     221             : 
     222             : #endif
     223             : 
     224             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10