bump product version to 6.3.0.0.beta1
[LibreOffice.git] / svtools / source / brwbox / datwin.hxx
blob27edfba52de7251e1666a4d21d00cf9fd687cc2a
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 <vcl/transfer.hxx>
28 #include <memory>
29 #include <vector>
32 #define MIN_COLUMNWIDTH 2
35 class ButtonFrame
37 tools::Rectangle const aRect;
38 tools::Rectangle const aInnerRect;
39 OUString const aText;
40 bool const m_bDrawDisabled;
42 public:
43 ButtonFrame( const Point& rPt, const Size& rSz,
44 const OUString &rText,
45 bool _bDrawDisabled)
46 :aRect( rPt, rSz )
47 ,aInnerRect( Point( aRect.Left()+1, aRect.Top()+1 ),
48 Size( aRect.GetWidth()-2, aRect.GetHeight()-2 ) )
49 ,aText(rText)
50 ,m_bDrawDisabled(_bDrawDisabled)
54 void Draw( OutputDevice& rDev );
58 class BrowserColumn final
60 sal_uInt16 const _nId;
61 sal_uLong _nOriginalWidth;
62 sal_uLong _nWidth;
63 OUString _aTitle;
64 bool _bFrozen;
66 public:
67 BrowserColumn( sal_uInt16 nItemId,
68 const OUString& rTitle, sal_uLong nWidthPixel, const Fraction& rCurrentZoom );
69 ~BrowserColumn();
71 sal_uInt16 GetId() const { return _nId; }
73 sal_uLong Width() { return _nWidth; }
74 OUString& Title() { return _aTitle; }
76 bool IsFrozen() const { return _bFrozen; }
77 void Freeze() { _bFrozen = true; }
79 void Draw( BrowseBox const & rBox, OutputDevice& rDev,
80 const Point& rPos );
82 void SetWidth(sal_uLong nNewWidthPixel, const Fraction& rCurrentZoom);
83 void ZoomChanged(const Fraction& rNewZoom);
87 class BrowserDataWin
88 :public Control
89 ,public DragSourceHelper
90 ,public DropTargetHelper
92 public:
93 VclPtr<BrowserHeader> pHeaderBar; // only for BrowserMode::HEADERBAR_NEW
94 VclPtr<ScrollBarBox> pCornerWin; // Window in the corner btw the ScrollBars
95 bool bInDtor;
96 AutoTimer aMouseTimer; // recalls MouseMove on dragging out
97 MouseEvent aRepeatEvt; // a MouseEvent to repeat
98 Point aLastMousePos; // prevents pseudo-MouseMoves
100 OUString aRealRowCount; // to show in VScrollBar
102 std::vector<tools::Rectangle> aInvalidRegion; // invalidated Rectangles during !UpdateMode
103 bool bInPaint; // TRUE while in Paint
104 bool bInCommand; // TRUE while in Command
105 bool bNoHScroll; // no horizontal scrollbar
106 bool bNoVScroll; // no vertical scrollbar
107 bool bAutoHScroll; // autohide horizontaler Scrollbar
108 bool bAutoVScroll; // autohide horizontaler Scrollbar
109 bool bUpdateMode; // not SV-UpdateMode because of Invalidate()
110 bool bAutoSizeLastCol; // last column always fills up window
111 bool bResizeOnPaint; // outstanding resize-event
112 bool bUpdateOnUnlock; // Update() while locked
113 bool bInUpdateScrollbars; // prevents recursions
114 bool bHadRecursion; // a recursion occurred
115 bool bCallingDropCallback; // we're in a callback to AcceptDrop or ExecuteDrop currently
116 sal_uInt16 nUpdateLock; // lock count, don't call Control::Update()!
117 short nCursorHidden; // new counter for DoHide/ShowCursor
119 long m_nDragRowDividerLimit;
120 long m_nDragRowDividerOffset;
122 public:
123 explicit BrowserDataWin( BrowseBox* pParent );
124 virtual ~BrowserDataWin() override;
125 virtual void dispose() override;
127 virtual void DataChanged( const DataChangedEvent& rDCEvt ) override;
128 virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect) override;
129 virtual void RequestHelp( const HelpEvent& rHEvt ) override;
130 virtual void Command( const CommandEvent& rEvt ) override;
131 virtual void MouseButtonDown( const MouseEvent& rEvt ) override;
132 virtual void MouseMove( const MouseEvent& rEvt ) override;
133 DECL_LINK( RepeatedMouseMove, Timer *, void );
135 virtual void MouseButtonUp( const MouseEvent& rEvt ) override;
136 virtual void KeyInput( const KeyEvent& rEvt ) override;
137 virtual void Tracking( const TrackingEvent& rTEvt ) override;
139 // DropTargetHelper overridables
140 virtual sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt ) override;
141 virtual sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt ) override;
143 // DragSourceHelper overridables
144 virtual void StartDrag( sal_Int8 _nAction, const Point& _rPosPixel ) override;
147 BrowseEvent CreateBrowseEvent( const Point& rPosPixel );
148 BrowseBox* GetParent() const
149 { return static_cast<BrowseBox*>( Window::GetParent() ); }
150 const OUString& GetRealRowCount() const { return aRealRowCount; }
152 void SetUpdateMode( bool bMode );
153 bool GetUpdateMode() const { return bUpdateMode; }
154 void EnterUpdateLock() { ++nUpdateLock; }
155 void LeaveUpdateLock();
156 void Update();
157 void DoOutstandingInvalidations();
158 void Invalidate( InvalidateFlags nFlags = InvalidateFlags::NONE ) override;
159 void Invalidate( const tools::Rectangle& rRect, InvalidateFlags nFlags = InvalidateFlags::NONE ) override;
160 using Control::Invalidate;
162 protected:
163 void StartRowDividerDrag( const Point& _rStartPos );
164 bool ImplRowDividerHitTest( const BrowserMouseEvent& _rEvent );
168 class BrowserScrollBar: public ScrollBar
170 sal_uLong _nLastPos;
171 VclPtr<BrowserDataWin> _pDataWin;
173 public:
174 BrowserScrollBar( vcl::Window* pParent, WinBits nStyle,
175 BrowserDataWin *pDataWin )
176 : ScrollBar( pParent, nStyle ),
177 _nLastPos( ULONG_MAX ),
178 _pDataWin( pDataWin )
180 virtual ~BrowserScrollBar() override;
181 virtual void dispose() override;
182 //ScrollBar( vcl::Window* pParent, const ResId& rResId );
184 virtual void Tracking( const TrackingEvent& rTEvt ) override;
185 virtual void EndScroll() override;
189 void InitSettings_Impl( vcl::Window *pWin );
192 #endif
194 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */