update credits
[LibreOffice.git] / svtools / source / brwbox / datwin.hxx
blobb66822750d162d1025cf41327629cb08bc774f4f
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef _SFXDATWIN_HXX
21 #define _SFXDATWIN_HXX
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>
30 //===================================================================
32 #define MIN_COLUMNWIDTH 2
34 typedef ::std::vector< Rectangle* > RectangleList;
36 //===================================================================
38 class ButtonFrame
40 Rectangle aRect;
41 Rectangle aInnerRect;
42 String aText;
43 sal_Bool bPressed;
44 sal_Bool bCurs;
45 sal_Bool m_bDrawDisabled;
47 public:
48 ButtonFrame( const Point& rPt, const Size& rSz,
49 const String &rText,
50 sal_Bool bPress,
51 sal_Bool bCursor,
52 sal_Bool _bDrawDisabled)
53 :aRect( rPt, rSz )
54 ,aInnerRect( Point( aRect.Left()+1, aRect.Top()+1 ),
55 Size( aRect.GetWidth()-2, aRect.GetHeight()-2 ) )
56 ,aText(rText)
57 ,bPressed(bPress)
58 ,bCurs(bCursor)
59 ,m_bDrawDisabled(_bDrawDisabled)
63 void Draw( OutputDevice& rDev );
66 //===================================================================
68 class BrowserColumn
70 sal_uInt16 _nId;
71 sal_uLong _nOriginalWidth;
72 sal_uLong _nWidth;
73 Image _aImage;
74 String _aTitle;
75 sal_Bool _bFrozen;
77 public:
78 BrowserColumn( sal_uInt16 nItemId, const Image &rImage,
79 const String& rTitle, sal_uLong nWidthPixel, const Fraction& rCurrentZoom );
80 virtual ~BrowserColumn();
82 sal_uInt16 GetId() const { return _nId; }
84 sal_uLong Width() { return _nWidth; }
85 Image& GetImage() { return _aImage; }
86 String& Title() { return _aTitle; }
88 sal_Bool IsFrozen() const { return _bFrozen; }
89 void Freeze( sal_Bool bFreeze = sal_True ) { _bFrozen = bFreeze; }
91 virtual void Draw( BrowseBox& rBox, OutputDevice& rDev,
92 const Point& rPos, sal_Bool bCurs );
94 void SetWidth(sal_uLong nNewWidthPixel, const Fraction& rCurrentZoom);
95 void ZoomChanged(const Fraction& rNewZoom);
98 //===================================================================
100 class BrowserDataWin
101 :public Control
102 ,public DragSourceHelper
103 ,public DropTargetHelper
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 sal_Bool* pDtorNotify;
110 AutoTimer aMouseTimer; // recalls MouseMove on dragging out
111 MouseEvent aRepeatEvt; // a MouseEvent to repeat
112 Point aLastMousePos; // verhindert pseudo-MouseMoves
114 String aRealRowCount; // zur Anzeige im VScrollBar
116 RectangleList aInvalidRegion; // invalidated Rectangles during !UpdateMode
117 bool bInPaint; // TRUE while in Paint
118 bool bInCommand; // TRUE while in Command
119 bool bNoScrollBack; // nur vorwaerts scrollen
120 bool bNoHScroll; // kein horizontaler Scrollbar
121 bool bNoVScroll; // no vertical scrollbar
122 bool bAutoHScroll; // autohide horizontaler Scrollbar
123 bool bAutoVScroll; // autohide horizontaler Scrollbar
124 bool bUpdateMode; // nicht SV-UpdateMode wegen 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; // Rekursionsschutz
129 bool bHadRecursion; // Rekursion war aufgetreten
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 conuter for DoHide/ShowCursor
135 long m_nDragRowDividerLimit;
136 long m_nDragRowDividerOffset;
138 public:
139 BrowserDataWin( BrowseBox* pParent );
140 ~BrowserDataWin();
142 virtual void DataChanged( const DataChangedEvent& rDCEvt );
143 virtual void Paint( const Rectangle& rRect );
144 virtual void RequestHelp( const HelpEvent& rHEvt );
145 virtual void Command( const CommandEvent& rEvt );
146 virtual void MouseButtonDown( const MouseEvent& rEvt );
147 virtual void MouseMove( const MouseEvent& rEvt );
148 DECL_LINK( RepeatedMouseMove, void * );
150 virtual void MouseButtonUp( const MouseEvent& rEvt );
151 virtual void KeyInput( const KeyEvent& rEvt );
152 virtual void Tracking( const TrackingEvent& rTEvt );
154 // DropTargetHelper overridables
155 virtual sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt );
156 virtual sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt );
158 // DragSourceHelper overridables
159 virtual void StartDrag( sal_Int8 _nAction, const Point& _rPosPixel );
162 BrowseEvent CreateBrowseEvent( const Point& rPosPixel );
163 void Repaint();
164 BrowseBox* GetParent() const
165 { return (BrowseBox*) Window::GetParent(); }
166 const String& GetRealRowCount() const { return aRealRowCount; }
168 void SetUpdateMode( sal_Bool bMode );
169 bool GetUpdateMode() const { return bUpdateMode; }
170 void EnterUpdateLock() { ++nUpdateLock; }
171 void LeaveUpdateLock();
172 void Update();
173 void DoOutstandingInvalidations();
174 void Invalidate( sal_uInt16 nFlags = 0 );
175 void Invalidate( const Rectangle& rRect, sal_uInt16 nFlags = 0 );
176 void Invalidate( const Region& rRegion, sal_uInt16 nFlags = 0 )
177 { Control::Invalidate( rRegion, nFlags ); }
179 protected:
180 void StartRowDividerDrag( const Point& _rStartPos );
181 sal_Bool ImplRowDividerHitTest( const BrowserMouseEvent& _rEvent );
184 //-------------------------------------------------------------------
186 inline void BrowserDataWin::Repaint()
188 if ( GetUpdateMode() )
189 Update();
190 Paint( Rectangle( Point(), GetOutputSizePixel() ) );
193 //===================================================================
195 class BrowserScrollBar: public ScrollBar
197 sal_uLong _nTip;
198 sal_uLong _nLastPos;
199 BrowserDataWin* _pDataWin;
201 public:
202 BrowserScrollBar( Window* pParent, WinBits nStyle,
203 BrowserDataWin *pDataWin )
204 : ScrollBar( pParent, nStyle ),
205 _nTip( 0 ),
206 _nLastPos( ULONG_MAX ),
207 _pDataWin( pDataWin )
209 //ScrollBar( Window* pParent, const ResId& rResId );
211 virtual void Tracking( const TrackingEvent& rTEvt );
212 virtual void EndScroll();
215 //===================================================================
217 void InitSettings_Impl( Window *pWin,
218 sal_Bool bFont = sal_True, sal_Bool bForeground = sal_True, sal_Bool bBackground = sal_True );
220 //===================================================================
222 #endif
224 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */