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