Version 5.2.6.1, tag libreoffice-5.2.6.1
[LibreOffice.git] / sc / source / ui / inc / hdrcont.hxx
blobd2bcbe7f7fbe1ff6d091e862f842e9d5219e3402
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_SC_SOURCE_UI_INC_HDRCONT_HXX
21 #define INCLUDED_SC_SOURCE_UI_INC_HDRCONT_HXX
23 #include <vcl/window.hxx>
24 #include <vcl/seleng.hxx>
25 #include "address.hxx"
27 #define HDR_SIZE_OPTIMUM 0xFFFF
29 // Size of the sliders
30 #define HDR_SLIDERSIZE 2
32 class ScTabView;
34 class ScHeaderControl : public vcl::Window
36 private:
37 SelectionEngine* pSelEngine;
38 vcl::Font aNormFont;
39 vcl::Font aBoldFont;
40 bool bBoldSet;
42 bool bVertical; // Vertical = Row header
44 long nWidth;
45 long nSmallWidth;
46 long nBigWidth;
48 SCCOLROW nSize;
50 SCCOLROW nMarkStart;
51 SCCOLROW nMarkEnd;
52 bool bMarkRange;
54 bool bDragging; // Resizing
55 SCCOLROW nDragNo;
56 long nDragStart;
57 long nDragPos;
58 bool bDragMoved;
60 bool bIgnoreMove;
62 bool bInRefMode;
64 long GetScrPos( SCCOLROW nEntryNo ) const;
65 SCCOLROW GetMousePos( const MouseEvent& rMEvt, bool& rBorder ) const;
66 bool IsSelectionAllowed(SCCOLROW nPos) const;
67 void ShowDragHelp();
69 void DoPaint( SCCOLROW nStart, SCCOLROW nEnd );
71 void DrawShadedRect( long nStart, long nEnd, const Color& rBaseColor );
73 protected:
74 ScTabView* pTabView;
76 // Window overrides
78 virtual void Paint( vcl::RenderContext& rRenderContext, const Rectangle& rRect ) override;
80 virtual void MouseMove( const MouseEvent& rMEvt ) override;
81 virtual void MouseButtonUp( const MouseEvent& rMEvt ) override;
82 virtual void MouseButtonDown( const MouseEvent& rMEvt ) override;
83 virtual void Tracking( const TrackingEvent& rTEvt ) override;
85 virtual void RequestHelp( const HelpEvent& rHEvt ) override;
87 // new methods
89 virtual SCCOLROW GetPos() const = 0; // current position (Scrolling)
90 virtual sal_uInt16 GetEntrySize( SCCOLROW nEntryNo ) const = 0; // width / height (Pixel)
91 virtual OUString GetEntryText( SCCOLROW nEntryNo ) const = 0;
93 virtual SCCOLROW GetHiddenCount( SCCOLROW nEntryNo ) const;
94 virtual bool IsLayoutRTL() const;
95 virtual bool IsMirrored() const;
97 virtual void SetEntrySize( SCCOLROW nPos, sal_uInt16 nNewWidth ) = 0;
98 virtual void HideEntries( SCCOLROW nStart, SCCOLROW nEnd ) = 0;
100 virtual void SetMarking( bool bSet );
101 virtual void SelectWindow();
102 virtual bool IsDisabled() const;
103 virtual bool ResizeAllowed() const;
104 virtual OUString GetDragHelp( long nVal );
106 virtual void DrawInvert( long nDragPos );
107 virtual void Command( const CommandEvent& rCEvt ) override;
109 public:
110 ScHeaderControl( vcl::Window* pParent, SelectionEngine* pSelectionEngine,
111 SCCOLROW nNewSize, bool bNewVertical, ScTabView* pTab );
112 virtual ~ScHeaderControl();
114 void SetIgnoreMove(bool bSet) { bIgnoreMove = bSet; }
116 void StopMarking();
118 void SetMark( bool bNewSet, SCCOLROW nNewStart, SCCOLROW nNewEnd );
120 long GetWidth() const { return nWidth; }
121 long GetSmallWidth() const { return nSmallWidth; }
122 long GetBigWidth() const { return nBigWidth; }
123 void SetWidth( long nNew );
126 #endif
128 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */