update emoji autocorrect entries from po-files
[LibreOffice.git] / svtools / source / brwbox / datwin.hxx
blob5a1ade0ff0aea1092ee9454c335b70012bf875a4
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 INCLUDED_SVTOOLS_SOURCE_BRWBOX_DATWIN_HXX
21 #define INCLUDED_SVTOOLS_SOURCE_BRWBOX_DATWIN_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>
32 #define MIN_COLUMNWIDTH 2
34 typedef ::std::vector< Rectangle* > RectangleList;
38 class ButtonFrame
40 Rectangle aRect;
41 Rectangle aInnerRect;
42 OUString aText;
43 bool bPressed;
44 bool bCurs;
45 bool m_bDrawDisabled;
47 public:
48 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 ,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 );
68 class BrowserColumn
70 sal_uInt16 _nId;
71 sal_uLong _nOriginalWidth;
72 sal_uLong _nWidth;
73 Image _aImage;
74 OUString _aTitle;
75 bool _bFrozen;
77 public:
78 BrowserColumn( sal_uInt16 nItemId, const Image &rImage,
79 const OUString& 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 OUString& Title() { return _aTitle; }
88 bool IsFrozen() const { return _bFrozen; }
89 void Freeze( bool bFreeze = true ) { _bFrozen = bFreeze; }
91 void Draw( BrowseBox& rBox, OutputDevice& rDev,
92 const Point& rPos, bool bCurs );
94 void SetWidth(sal_uLong nNewWidthPixel, const Fraction& rCurrentZoom);
95 void ZoomChanged(const Fraction& rNewZoom);
100 class BrowserDataWin
101 :public Control
102 ,public DragSourceHelper
103 ,public DropTargetHelper
105 public:
106 VclPtr<BrowserHeader> pHeaderBar; // only for BrowserMode::HEADERBAR_NEW
107 VclPtr<vcl::Window> pEventWin; // Window of forwarded events
108 VclPtr<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
114 OUString aRealRowCount; // to show in 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; // 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 currently
132 sal_uInt16 nUpdateLock; // lock count, dont call Control::Update()!
133 short nCursorHidden; // new counter for DoHide/ShowCursor
135 long m_nDragRowDividerLimit;
136 long m_nDragRowDividerOffset;
138 public:
139 BrowserDataWin( BrowseBox* pParent );
140 virtual ~BrowserDataWin();
141 virtual void dispose() SAL_OVERRIDE;
143 virtual void DataChanged( const DataChangedEvent& rDCEvt ) SAL_OVERRIDE;
144 virtual void Paint(vcl::RenderContext& rRenderContext, const Rectangle& rRect) SAL_OVERRIDE;
145 virtual void RequestHelp( const HelpEvent& rHEvt ) SAL_OVERRIDE;
146 virtual void Command( const CommandEvent& rEvt ) SAL_OVERRIDE;
147 virtual void MouseButtonDown( const MouseEvent& rEvt ) SAL_OVERRIDE;
148 virtual void MouseMove( const MouseEvent& rEvt ) SAL_OVERRIDE;
149 DECL_LINK_TYPED( RepeatedMouseMove, Timer *, void );
151 virtual void MouseButtonUp( const MouseEvent& rEvt ) SAL_OVERRIDE;
152 virtual void KeyInput( const KeyEvent& rEvt ) SAL_OVERRIDE;
153 virtual void Tracking( const TrackingEvent& rTEvt ) SAL_OVERRIDE;
155 // DropTargetHelper overridables
156 virtual sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt ) SAL_OVERRIDE;
157 virtual sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt ) SAL_OVERRIDE;
159 // DragSourceHelper overridables
160 virtual void StartDrag( sal_Int8 _nAction, const Point& _rPosPixel ) SAL_OVERRIDE;
163 BrowseEvent CreateBrowseEvent( const Point& rPosPixel );
164 void Repaint();
165 BrowseBox* GetParent() const
166 { return static_cast<BrowseBox*>( Window::GetParent() ); }
167 const OUString& GetRealRowCount() const { return aRealRowCount; }
169 void SetUpdateMode( bool bMode );
170 bool GetUpdateMode() const { return bUpdateMode; }
171 void EnterUpdateLock() { ++nUpdateLock; }
172 void LeaveUpdateLock();
173 void Update();
174 void DoOutstandingInvalidations();
175 void Invalidate( sal_uInt16 nFlags = 0 ) SAL_OVERRIDE;
176 void Invalidate( const Rectangle& rRect, sal_uInt16 nFlags = 0 ) SAL_OVERRIDE;
177 void Invalidate( const vcl::Region& rRegion, sal_uInt16 nFlags = 0 ) SAL_OVERRIDE
178 { Control::Invalidate( rRegion, nFlags ); }
180 protected:
181 void StartRowDividerDrag( const Point& _rStartPos );
182 bool ImplRowDividerHitTest( const BrowserMouseEvent& _rEvent );
187 inline void BrowserDataWin::Repaint()
189 if ( GetUpdateMode() )
190 Update();
191 Invalidate(Rectangle(Point(), GetOutputSizePixel()));
196 class BrowserScrollBar: public ScrollBar
198 sal_uLong _nTip;
199 sal_uLong _nLastPos;
200 VclPtr<BrowserDataWin> _pDataWin;
202 public:
203 BrowserScrollBar( vcl::Window* pParent, WinBits nStyle,
204 BrowserDataWin *pDataWin )
205 : ScrollBar( pParent, nStyle ),
206 _nTip( 0 ),
207 _nLastPos( ULONG_MAX ),
208 _pDataWin( pDataWin )
210 virtual ~BrowserScrollBar();
211 virtual void dispose() SAL_OVERRIDE;
212 //ScrollBar( vcl::Window* pParent, const ResId& rResId );
214 virtual void Tracking( const TrackingEvent& rTEvt ) SAL_OVERRIDE;
215 virtual void EndScroll() SAL_OVERRIDE;
220 void InitSettings_Impl( vcl::Window *pWin,
221 bool bFont = true, bool bForeground = true, bool bBackground = true );
225 #endif
227 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */