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