LCOV - code coverage report
Current view: top level - svtools/source/brwbox - datwin.hxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 22 0.0 %
Date: 2014-04-14 Functions: 0 15 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_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           0 : class ButtonFrame
      39             : {
      40             :     Rectangle   aRect;
      41             :     Rectangle   aInnerRect;
      42             :     OUString    aText;
      43             :     sal_Bool        bPressed;
      44             :     sal_Bool        bCurs;
      45             :     sal_Bool        m_bDrawDisabled;
      46             : 
      47             : public:
      48           0 :                ButtonFrame( const Point& rPt, const Size& rSz,
      49             :                             const OUString &rText,
      50             :                             sal_Bool bPress,
      51             :                             sal_Bool bCursor,
      52             :                             sal_Bool _bDrawDisabled)
      53             :                 :aRect( rPt, rSz )
      54           0 :                 ,aInnerRect( Point( aRect.Left()+1, aRect.Top()+1 ),
      55           0 :                             Size( aRect.GetWidth()-2, aRect.GetHeight()-2 ) )
      56             :                 ,aText(rText)
      57             :                 ,bPressed(bPress)
      58             :                 ,bCurs(bCursor)
      59           0 :                 ,m_bDrawDisabled(_bDrawDisabled)
      60             :             {
      61           0 :             }
      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             :     sal_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           0 :     sal_uInt16          GetId() const { return _nId; }
      83             : 
      84           0 :     sal_uLong           Width() { return _nWidth; }
      85             :     Image&              GetImage() { return _aImage; }
      86           0 :     OUString&           Title() { return _aTitle; }
      87             : 
      88           0 :     sal_Bool            IsFrozen() const { return _bFrozen; }
      89           0 :     void                Freeze( sal_Bool bFreeze = sal_True ) { _bFrozen = bFreeze; }
      90             : 
      91             :     virtual void        Draw( BrowseBox& rBox, OutputDevice& rDev,
      92             :                               const Point& rPos, sal_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             :     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 occured
     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           0 :     BrowseBox*      GetParent() const
     165           0 :                          { return (BrowseBox*) Window::GetParent(); }
     166           0 :     const OUString& GetRealRowCount() const { return aRealRowCount; }
     167             : 
     168             :     void            SetUpdateMode( sal_Bool bMode );
     169           0 :     bool            GetUpdateMode() const { return bUpdateMode; }
     170           0 :     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 Region& rRegion, sal_uInt16 nFlags = 0 ) SAL_OVERRIDE
     177           0 :                     { Control::Invalidate( rRegion, nFlags ); }
     178             : 
     179             : protected:
     180             :     void            StartRowDividerDrag( const Point& _rStartPos );
     181             :     sal_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           0 : class BrowserScrollBar: public ScrollBar
     196             : {
     197             :     sal_uLong           _nTip;
     198             :     sal_uLong           _nLastPos;
     199             :     BrowserDataWin* _pDataWin;
     200             : 
     201             : public:
     202           0 :                     BrowserScrollBar( Window* pParent, WinBits nStyle,
     203             :                                       BrowserDataWin *pDataWin )
     204             :                     :   ScrollBar( pParent, nStyle ),
     205             :                         _nTip( 0 ),
     206             :                         _nLastPos( ULONG_MAX ),
     207           0 :                         _pDataWin( pDataWin )
     208           0 :                     {}
     209             :                     //ScrollBar( 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( Window *pWin,
     218             :          sal_Bool bFont = sal_True, sal_Bool bForeground = sal_True, sal_Bool bBackground = sal_True );
     219             : 
     220             : 
     221             : 
     222             : #endif
     223             : 
     224             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10