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