/src/libreoffice/sc/source/ui/inc/hdrcont.hxx
Line | Count | Source |
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 | | #pragma once |
21 | | |
22 | | #include <vcl/window.hxx> |
23 | | #include <vcl/timer.hxx> |
24 | | #include <types.hxx> |
25 | | |
26 | 0 | #define HDR_SIZE_OPTIMUM 0xFFFF |
27 | | |
28 | | // Size of the sliders |
29 | 0 | #define HDR_SLIDERSIZE 2 |
30 | | |
31 | | class ScTabView; |
32 | | class SelectionEngine; |
33 | | |
34 | | class ScHeaderControl : public vcl::Window |
35 | | { |
36 | | private: |
37 | | SelectionEngine* pSelEngine; |
38 | | Timer aShowHelpTimer; |
39 | | vcl::Font aNormFont; |
40 | | vcl::Font aBoldFont; |
41 | | vcl::Font aAutoFilterFont; |
42 | | bool bBoldSet; |
43 | | bool bAutoFilterSet; |
44 | | |
45 | | bool bVertical; // Vertical = Row header |
46 | | |
47 | | tools::Long nWidth; |
48 | | tools::Long nSmallWidth; |
49 | | tools::Long nBigWidth; |
50 | | |
51 | | SCCOLROW nSize; |
52 | | |
53 | | SCCOLROW nMarkStart; |
54 | | SCCOLROW nMarkEnd; |
55 | | bool bMarkRange; |
56 | | |
57 | | bool bDragging; // Resizing |
58 | | SCCOLROW nDragNo; |
59 | | tools::Long nDragStart; |
60 | | tools::Long nDragPos; |
61 | | void* nTipVisible; |
62 | | bool bDragMoved; |
63 | | |
64 | | bool bIgnoreMove; |
65 | | |
66 | | bool bInRefMode; |
67 | | |
68 | | tools::Long mnDefaultFontHeight = 0L; |
69 | | |
70 | | tools::Long GetScrPos( SCCOLROW nEntryNo ) const; |
71 | | SCCOLROW GetMousePos(const Point& rPos, bool& rBorder) const; |
72 | | bool IsSelectionAllowed(SCCOLROW nPos) const; |
73 | | void ShowDragHelp(); |
74 | | void HideDragHelp(); |
75 | | |
76 | | void DoPaint( SCCOLROW nStart, SCCOLROW nEnd ); |
77 | | |
78 | | DECL_LINK(ShowDragHelpHdl, Timer*, void); |
79 | | |
80 | | protected: |
81 | | ScTabView* pTabView; |
82 | | |
83 | | // Window overrides |
84 | | |
85 | | virtual void Paint( vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect ) override; |
86 | | |
87 | | virtual void MouseMove( const MouseEvent& rMEvt ) override; |
88 | | virtual void MouseButtonUp( const MouseEvent& rMEvt ) override; |
89 | | virtual void MouseButtonDown( const MouseEvent& rMEvt ) override; |
90 | | virtual void Tracking( const TrackingEvent& rTEvt ) override; |
91 | | |
92 | | virtual void RequestHelp( const HelpEvent& rHEvt ) override; |
93 | | |
94 | | // new methods |
95 | | |
96 | | virtual SCCOLROW GetPos() const = 0; // current position (Scrolling) |
97 | | virtual sal_uInt16 GetEntrySize( SCCOLROW nEntryNo ) const = 0; // width / height (Pixel) |
98 | | virtual OUString GetEntryText( SCCOLROW nEntryNo ) const = 0; |
99 | | |
100 | | virtual SCCOLROW GetHiddenCount( SCCOLROW nEntryNo ) const; |
101 | | virtual bool IsLayoutRTL() const; |
102 | | |
103 | | virtual void SetEntrySize( SCCOLROW nPos, sal_uInt16 nNewWidth ) = 0; |
104 | | virtual void HideEntries( SCCOLROW nStart, SCCOLROW nEnd ) = 0; |
105 | | |
106 | | virtual void SetMarking( bool bSet ); |
107 | | virtual void SelectWindow(); |
108 | | virtual bool IsDisabled() const; |
109 | | virtual bool ResizeAllowed() const; |
110 | | virtual OUString GetDragHelp( tools::Long nVal ); |
111 | | |
112 | | virtual void DrawInvert( tools::Long nDragPos ); |
113 | | virtual void Command( const CommandEvent& rCEvt ) override; |
114 | | virtual void dispose() override; |
115 | | |
116 | | public: |
117 | | ScHeaderControl( vcl::Window* pParent, SelectionEngine* pSelectionEngine, |
118 | | SCCOLROW nNewSize, bool bNewVertical, ScTabView* pTab ); |
119 | | virtual ~ScHeaderControl() override; |
120 | | |
121 | 0 | void SetIgnoreMove(bool bSet) { bIgnoreMove = bSet; } |
122 | | |
123 | | void StopMarking(); |
124 | | |
125 | | void SetMark( bool bNewSet, SCCOLROW nNewStart, SCCOLROW nNewEnd ); |
126 | | |
127 | 0 | tools::Long GetWidth() const { return nWidth; } |
128 | 0 | tools::Long GetSmallWidth() const { return nSmallWidth; } |
129 | 0 | tools::Long GetBigWidth() const { return nBigWidth; } |
130 | | void SetWidth( tools::Long nNew ); |
131 | | void GetMarkRange(SCCOLROW& rStart, SCCOLROW& rEnd) const; |
132 | | }; |
133 | | |
134 | | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |