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 SC_HDRCONT_HXX
21 : #define SC_HDRCONT_HXX
22 :
23 : #include <vcl/window.hxx>
24 : #include <vcl/seleng.hxx>
25 : #include "address.hxx"
26 :
27 : #define HDR_SIZE_OPTIMUM 0xFFFF
28 :
29 :
30 : // Size of the sliders
31 : #define HDR_SLIDERSIZE 2
32 :
33 : class ScHeaderControl : public Window
34 : {
35 : private:
36 : SelectionEngine* pSelEngine;
37 : Font aNormFont;
38 : Font aBoldFont;
39 : sal_Bool bBoldSet;
40 :
41 : sal_Bool bVertical; // Vertical = Row header
42 :
43 : long nWidth;
44 : long nSmallWidth;
45 : long nBigWidth;
46 :
47 : SCCOLROW nSize;
48 :
49 : SCCOLROW nMarkStart;
50 : SCCOLROW nMarkEnd;
51 : sal_Bool bMarkRange;
52 :
53 : sal_Bool bDragging; // Change size
54 : SCCOLROW nDragNo;
55 : long nDragStart;
56 : long nDragPos;
57 : sal_Bool bDragMoved;
58 :
59 : sal_Bool bIgnoreMove;
60 :
61 : long GetScrPos( SCCOLROW nEntryNo );
62 : SCCOLROW GetMousePos( const MouseEvent& rMEvt, sal_Bool& rBorder );
63 : bool IsSelectionAllowed(SCCOLROW nPos) const;
64 : void ShowDragHelp();
65 :
66 : void DoPaint( SCCOLROW nStart, SCCOLROW nEnd );
67 :
68 : void DrawShadedRect( long nStart, long nEnd, const Color& rBaseColor );
69 :
70 : protected:
71 : // Overloaded by Window
72 :
73 : virtual void Paint( const Rectangle& rRect );
74 :
75 : virtual void MouseMove( const MouseEvent& rMEvt );
76 : virtual void MouseButtonUp( const MouseEvent& rMEvt );
77 : virtual void MouseButtonDown( const MouseEvent& rMEvt );
78 : virtual void Tracking( const TrackingEvent& rTEvt );
79 :
80 : virtual void RequestHelp( const HelpEvent& rHEvt );
81 :
82 : // new methods
83 :
84 : virtual SCCOLROW GetPos() = 0; // current position (Scrolling)
85 : virtual sal_uInt16 GetEntrySize( SCCOLROW nEntryNo ) = 0; // width / height (Pixel)
86 : virtual String GetEntryText( SCCOLROW nEntryNo ) = 0;
87 :
88 : virtual SCCOLROW GetHiddenCount( SCCOLROW nEntryNo );
89 : virtual sal_Bool IsLayoutRTL();
90 : virtual sal_Bool IsMirrored();
91 :
92 : virtual void SetEntrySize( SCCOLROW nPos, sal_uInt16 nNewWidth ) = 0;
93 : virtual void HideEntries( SCCOLROW nStart, SCCOLROW nEnd ) = 0;
94 :
95 : virtual void SetMarking( sal_Bool bSet );
96 : virtual void SelectWindow();
97 : virtual sal_Bool IsDisabled();
98 : virtual sal_Bool ResizeAllowed();
99 : virtual String GetDragHelp( long nVal );
100 :
101 : virtual void DrawInvert( long nDragPos );
102 : virtual void Command( const CommandEvent& rCEvt );
103 :
104 : public:
105 : ScHeaderControl( Window* pParent, SelectionEngine* pSelectionEngine,
106 : SCCOLROW nNewSize, bool bNewVertical );
107 : ~ScHeaderControl();
108 :
109 0 : void SetIgnoreMove(sal_Bool bSet) { bIgnoreMove = bSet; }
110 :
111 : void StopMarking();
112 :
113 : void SetMark( sal_Bool bNewSet, SCCOLROW nNewStart, SCCOLROW nNewEnd );
114 :
115 0 : long GetWidth() const { return nWidth; }
116 0 : long GetSmallWidth() const { return nSmallWidth; }
117 0 : long GetBigWidth() const { return nBigWidth; }
118 : void SetWidth( long nNew );
119 : };
120 :
121 :
122 :
123 : #endif
124 :
125 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|