xref: /aoo42x/main/sc/source/ui/inc/hdrcont.hxx (revision 38d50f7b)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef SC_HDRCONT_HXX
25 #define SC_HDRCONT_HXX
26 
27 #include <vcl/window.hxx>
28 #ifndef _SELENG_HXX //autogen
29 #include <vcl/seleng.hxx>
30 #endif
31 #include "address.hxx"
32 
33 // ---------------------------------------------------------------------------
34 
35 
36 #define HDR_HORIZONTAL		0
37 #define HDR_VERTICAL		1
38 
39 #define HDR_SIZE_OPTIMUM	0xFFFF
40 
41 
42 									// Groesse des Sliders
43 #define HDR_SLIDERSIZE		2
44 
45 class ScHeaderControl : public Window
46 {
47 private:
48 	SelectionEngine*	pSelEngine;
49 	Font				aNormFont;
50 	Font				aBoldFont;
51 	sal_Bool				bBoldSet;
52 
53 	sal_uInt16			nFlags;
54 	sal_Bool			bVertical;				// Vertikal = Zeilenheader
55 
56 	long			nWidth;
57 	long			nSmallWidth;
58 	long			nBigWidth;
59 
60 	SCCOLROW		nSize;
61 
62 	SCCOLROW		nMarkStart;
63 	SCCOLROW		nMarkEnd;
64 	sal_Bool			bMarkRange;
65 
66 	sal_Bool			bDragging;				// Groessen aendern
67 	SCCOLROW		nDragNo;
68 	long			nDragStart;
69 	long			nDragPos;
70 	sal_Bool			bDragMoved;
71 
72 	sal_Bool			bIgnoreMove;
73 
74 	long			GetScrPos( SCCOLROW nEntryNo );
75 	SCCOLROW		GetMousePos( const MouseEvent& rMEvt, sal_Bool& rBorder );
76     bool            IsSelectionAllowed(SCCOLROW nPos) const;
77 	void			ShowDragHelp();
78 
79 	void			DoPaint( SCCOLROW nStart, SCCOLROW nEnd );
80 
81     void            DrawShadedRect( long nStart, long nEnd, const Color& rBaseColor );
82 
83 protected:
84 					//	von Window ueberladen
85 
86 	virtual void	Paint( const Rectangle& rRect );
87 
88 	virtual void	MouseMove( const MouseEvent& rMEvt );
89 	virtual void	MouseButtonUp( const MouseEvent& rMEvt );
90 	virtual void	MouseButtonDown( const MouseEvent& rMEvt );
91 	virtual void	Tracking( const TrackingEvent& rTEvt );
92 
93 	virtual void	RequestHelp( const HelpEvent& rHEvt );
94 
95 					//	neue Methoden
96 
97 	virtual SCCOLROW	GetPos() = 0;								// aktuelle Position (Scrolling)
98 	virtual sal_uInt16	GetEntrySize( SCCOLROW nEntryNo ) = 0;		// Breite / Hoehe (Pixel)
99 	virtual String	GetEntryText( SCCOLROW nEntryNo ) = 0;
100 
101 	virtual SCCOLROW GetHiddenCount( SCCOLROW nEntryNo );
102 	virtual sal_Bool	IsLayoutRTL();
103 	virtual sal_Bool	IsMirrored();
104 
105 	virtual void	SetEntrySize( SCCOLROW nPos, sal_uInt16 nNewWidth ) = 0;
106 	virtual void	HideEntries( SCCOLROW nStart, SCCOLROW nEnd ) = 0;
107 
108 	virtual void	SetMarking( sal_Bool bSet );
109 	virtual void	SelectWindow();
110 	virtual sal_Bool	IsDisabled();
111 	virtual sal_Bool	ResizeAllowed();
112 	virtual String	GetDragHelp( long nVal );
113 
114 	virtual void	DrawInvert( long nDragPos );
115 	virtual void	Command( const CommandEvent& rCEvt );
116 
117 public:
118 			ScHeaderControl( Window* pParent, SelectionEngine* pSelectionEngine,
119 								SCCOLROW nNewSize, sal_uInt16 nNewFlags );
120 			~ScHeaderControl();
121 
SetIgnoreMove(sal_Bool bSet)122 	void	SetIgnoreMove(sal_Bool bSet)			{ bIgnoreMove = bSet; }
123 
124 	void	StopMarking();
125 
126 	void	SetMark( sal_Bool bNewSet, SCCOLROW nNewStart, SCCOLROW nNewEnd );
127 
GetWidth() const128 	long	GetWidth() const					{ return nWidth; }
GetSmallWidth() const129 	long	GetSmallWidth() const				{ return nSmallWidth; }
GetBigWidth() const130 	long	GetBigWidth() const					{ return nBigWidth; }
131 	void	SetWidth( long nNew );
132 };
133 
134 
135 
136 #endif
137 
138