xref: /trunk/main/sc/source/ui/inc/hdrcont.hxx (revision 2bbc22fdbb9d0784c9b09109be527af188d1c266)
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 #ifndef SC_HDRCONT_HXX
23 #define SC_HDRCONT_HXX
24 
25 #include <vcl/window.hxx>
26 #ifndef _SELENG_HXX //autogen
27 #include <vcl/seleng.hxx>
28 #endif
29 #include "address.hxx"
30 
31 // ---------------------------------------------------------------------------
32 
33 #define HDR_HORIZONTAL      0
34 #define HDR_VERTICAL        1
35 
36 #define HDR_SIZE_OPTIMUM    0xFFFF
37 
38 #define HDR_SLIDERSIZE      2 // Groesse des Sliders
39 
40 class ScHeaderControl : public Window
41 {
42 private:
43     SelectionEngine*    pSelEngine;
44     Font                aNormFont;
45     Font                aBoldFont;
46     sal_Bool                bBoldSet;
47 
48     sal_uInt16          nFlags;
49     sal_Bool            bVertical; // Vertikal = Zeilenheader
50 
51     long            nWidth;
52     long            nSmallWidth;
53     long            nBigWidth;
54 
55     SCCOLROW        nSize;
56 
57     SCCOLROW        nMarkStart;
58     SCCOLROW        nMarkEnd;
59     sal_Bool            bMarkRange;
60 
61     sal_Bool            bDragging; // Groessen aendern
62     SCCOLROW        nDragNo;
63     long            nDragStart;
64     long            nDragPos;
65     sal_Bool            bDragMoved;
66 
67     sal_Bool            bIgnoreMove;
68 
69     long            GetScrPos( SCCOLROW nEntryNo );
70     SCCOLROW        GetMousePos( const MouseEvent& rMEvt, sal_Bool& rBorder );
71     bool            IsSelectionAllowed(SCCOLROW nPos) const;
72     void            ShowDragHelp();
73 
74     void            DoPaint( SCCOLROW nStart, SCCOLROW nEnd );
75 
76 protected:
77 // von Window ueberladen
78 
79     virtual void    Paint( const Rectangle& rRect );
80 
81     virtual void    MouseMove( const MouseEvent& rMEvt );
82     virtual void    MouseButtonUp( const MouseEvent& rMEvt );
83     virtual void    MouseButtonDown( const MouseEvent& rMEvt );
84     virtual void    Tracking( const TrackingEvent& rTEvt );
85 
86     virtual void    RequestHelp( const HelpEvent& rHEvt );
87 
88 // new methods
89 
90     virtual SCCOLROW    GetPos() = 0;                               // aktuelle Position (Scrolling)
91     virtual sal_uInt16  GetEntrySize( SCCOLROW nEntryNo ) = 0;      // Width / Height (pixel)
92     virtual String  GetEntryText( SCCOLROW nEntryNo ) = 0;
93 
94     virtual SCCOLROW GetHiddenCount( SCCOLROW nEntryNo );
95     virtual sal_Bool    IsLayoutRTL();
96     virtual sal_Bool    IsMirrored();
97 
98     virtual void    SetEntrySize( SCCOLROW nPos, sal_uInt16 nNewWidth ) = 0;
99     virtual void    HideEntries( SCCOLROW nStart, SCCOLROW nEnd ) = 0;
100 
101     virtual void    SetMarking( sal_Bool bSet );
102     virtual void    SelectWindow();
103     virtual sal_Bool    IsDisabled();
104     virtual sal_Bool    ResizeAllowed();
105     virtual String  GetDragHelp( long nVal );
106 
107     virtual void    DrawInvert( long nDragPos );
108     virtual void    Command( const CommandEvent& rCEvt );
109 
110 public:
111             ScHeaderControl( Window* pParent, SelectionEngine* pSelectionEngine,
112                                 SCCOLROW nNewSize, sal_uInt16 nNewFlags );
113             ~ScHeaderControl();
114 
SetIgnoreMove(sal_Bool bSet)115     void    SetIgnoreMove(sal_Bool bSet)            { bIgnoreMove = bSet; }
116 
117     void    StopMarking();
118 
119     void    SetMark( sal_Bool bNewSet, SCCOLROW nNewStart, SCCOLROW nNewEnd );
120 
GetWidth() const121     long    GetWidth() const                    { return nWidth; }
GetSmallWidth() const122     long    GetSmallWidth() const               { return nSmallWidth; }
GetBigWidth() const123     long    GetBigWidth() const                 { return nBigWidth; }
124     void    SetWidth( long nNew );
125 };
126 
127 #endif
128 
129 /* vim: set noet sw=4 ts=4: */
130