xref: /aoo41x/main/sc/source/ui/inc/hdrcont.hxx (revision cdf0e10c)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 #ifndef SC_HDRCONT_HXX
29 #define SC_HDRCONT_HXX
30 
31 #include <vcl/window.hxx>
32 #ifndef _SELENG_HXX //autogen
33 #include <vcl/seleng.hxx>
34 #endif
35 #include "address.hxx"
36 
37 // ---------------------------------------------------------------------------
38 
39 
40 #define HDR_HORIZONTAL		0
41 #define HDR_VERTICAL		1
42 
43 #define HDR_SIZE_OPTIMUM	0xFFFF
44 
45 
46 									// Groesse des Sliders
47 #define HDR_SLIDERSIZE		2
48 
49 class ScHeaderControl : public Window
50 {
51 private:
52 	SelectionEngine*	pSelEngine;
53 	Font				aNormFont;
54 	Font				aBoldFont;
55 	sal_Bool				bBoldSet;
56 
57 	sal_uInt16			nFlags;
58 	sal_Bool			bVertical;				// Vertikal = Zeilenheader
59 
60 	long			nWidth;
61 	long			nSmallWidth;
62 	long			nBigWidth;
63 
64 	SCCOLROW		nSize;
65 
66 	SCCOLROW		nMarkStart;
67 	SCCOLROW		nMarkEnd;
68 	sal_Bool			bMarkRange;
69 
70 	sal_Bool			bDragging;				// Groessen aendern
71 	SCCOLROW		nDragNo;
72 	long			nDragStart;
73 	long			nDragPos;
74 	sal_Bool			bDragMoved;
75 
76 	sal_Bool			bIgnoreMove;
77 
78 	long			GetScrPos( SCCOLROW nEntryNo );
79 	SCCOLROW		GetMousePos( const MouseEvent& rMEvt, sal_Bool& rBorder );
80     bool            IsSelectionAllowed(SCCOLROW nPos) const;
81 	void			ShowDragHelp();
82 
83 	void			DoPaint( SCCOLROW nStart, SCCOLROW nEnd );
84 
85     void            DrawShadedRect( long nStart, long nEnd, const Color& rBaseColor );
86 
87 protected:
88 					//	von Window ueberladen
89 
90 	virtual void	Paint( const Rectangle& rRect );
91 
92 	virtual void	MouseMove( const MouseEvent& rMEvt );
93 	virtual void	MouseButtonUp( const MouseEvent& rMEvt );
94 	virtual void	MouseButtonDown( const MouseEvent& rMEvt );
95 	virtual void	Tracking( const TrackingEvent& rTEvt );
96 
97 	virtual void	RequestHelp( const HelpEvent& rHEvt );
98 
99 					//	neue Methoden
100 
101 	virtual SCCOLROW	GetPos() = 0;								// aktuelle Position (Scrolling)
102 	virtual sal_uInt16	GetEntrySize( SCCOLROW nEntryNo ) = 0;		// Breite / Hoehe (Pixel)
103 	virtual String	GetEntryText( SCCOLROW nEntryNo ) = 0;
104 
105 	virtual SCCOLROW GetHiddenCount( SCCOLROW nEntryNo );
106 	virtual sal_Bool	IsLayoutRTL();
107 	virtual sal_Bool	IsMirrored();
108 
109 	virtual void	SetEntrySize( SCCOLROW nPos, sal_uInt16 nNewWidth ) = 0;
110 	virtual void	HideEntries( SCCOLROW nStart, SCCOLROW nEnd ) = 0;
111 
112 	virtual void	SetMarking( sal_Bool bSet );
113 	virtual void	SelectWindow();
114 	virtual sal_Bool	IsDisabled();
115 	virtual sal_Bool	ResizeAllowed();
116 	virtual String	GetDragHelp( long nVal );
117 
118 	virtual void	DrawInvert( long nDragPos );
119 	virtual void	Command( const CommandEvent& rCEvt );
120 
121 public:
122 			ScHeaderControl( Window* pParent, SelectionEngine* pSelectionEngine,
123 								SCCOLROW nNewSize, sal_uInt16 nNewFlags );
124 			~ScHeaderControl();
125 
126 	void	SetIgnoreMove(sal_Bool bSet)			{ bIgnoreMove = bSet; }
127 
128 	void	StopMarking();
129 
130 	void	SetMark( sal_Bool bNewSet, SCCOLROW nNewStart, SCCOLROW nNewEnd );
131 
132 	long	GetWidth() const					{ return nWidth; }
133 	long	GetSmallWidth() const				{ return nSmallWidth; }
134 	long	GetBigWidth() const					{ return nBigWidth; }
135 	void	SetWidth( long nNew );
136 };
137 
138 
139 
140 #endif
141 
142