LibreOffice Module sc (master)  1
hdrcont.hxx
Go to the documentation of this file.
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 <types.hxx>
25 
26 #define HDR_SIZE_OPTIMUM 0xFFFF
27 
28 // Size of the sliders
29 #define HDR_SLIDERSIZE 2
30 
31 class ScTabView;
32 class SelectionEngine;
33 
35 {
36 private:
40  bool bBoldSet;
41 
42  bool bVertical; // Vertical = Row header
43 
47 
49 
52  bool bMarkRange;
53 
54  bool bDragging; // Resizing
58  void* nTipVisible;
59  bool bDragMoved;
60 
62 
63  bool bInRefMode;
64 
65  tools::Long GetScrPos( SCCOLROW nEntryNo ) const;
66  SCCOLROW GetMousePos( const MouseEvent& rMEvt, bool& rBorder ) const;
67  bool IsSelectionAllowed(SCCOLROW nPos) const;
68  void ShowDragHelp();
69 
70  void DoPaint( SCCOLROW nStart, SCCOLROW nEnd );
71 
72 protected:
74 
75  // Window overrides
76 
77  virtual void Paint( vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect ) override;
78 
79  virtual void MouseMove( const MouseEvent& rMEvt ) override;
80  virtual void MouseButtonUp( const MouseEvent& rMEvt ) override;
81  virtual void MouseButtonDown( const MouseEvent& rMEvt ) override;
82  virtual void Tracking( const TrackingEvent& rTEvt ) override;
83 
84  virtual void RequestHelp( const HelpEvent& rHEvt ) override;
85 
86  // new methods
87 
88  virtual SCCOLROW GetPos() const = 0; // current position (Scrolling)
89  virtual sal_uInt16 GetEntrySize( SCCOLROW nEntryNo ) const = 0; // width / height (Pixel)
90  virtual OUString GetEntryText( SCCOLROW nEntryNo ) const = 0;
91 
92  virtual SCCOLROW GetHiddenCount( SCCOLROW nEntryNo ) const;
93  virtual bool IsLayoutRTL() const;
94  virtual bool IsMirrored() const;
95 
96  virtual void SetEntrySize( SCCOLROW nPos, sal_uInt16 nNewWidth ) = 0;
97  virtual void HideEntries( SCCOLROW nStart, SCCOLROW nEnd ) = 0;
98 
99  virtual void SetMarking( bool bSet );
100  virtual void SelectWindow();
101  virtual bool IsDisabled() const;
102  virtual bool ResizeAllowed() const;
103  virtual OUString GetDragHelp( tools::Long nVal );
104 
105  virtual void DrawInvert( tools::Long nDragPos );
106  virtual void Command( const CommandEvent& rCEvt ) override;
107 
108 public:
109  ScHeaderControl( vcl::Window* pParent, SelectionEngine* pSelectionEngine,
110  SCCOLROW nNewSize, bool bNewVertical, ScTabView* pTab );
111  virtual ~ScHeaderControl() override;
112 
113  void SetIgnoreMove(bool bSet) { bIgnoreMove = bSet; }
114 
115  void StopMarking();
116 
117  void SetMark( bool bNewSet, SCCOLROW nNewStart, SCCOLROW nNewEnd );
118 
119  tools::Long GetWidth() const { return nWidth; }
121  tools::Long GetBigWidth() const { return nBigWidth; }
122  void SetWidth( tools::Long nNew );
123  void GetMarkRange(SCCOLROW& rStart, SCCOLROW& rEnd) const;
124 };
125 
126 #endif
127 
128 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
bool bIgnoreMove
Definition: hdrcont.hxx:61
ScHeaderControl(vcl::Window *pParent, SelectionEngine *pSelectionEngine, SCCOLROW nNewSize, bool bNewVertical, ScTabView *pTab)
Definition: hdrcont.cxx:47
SCCOLROW nDragNo
Definition: hdrcont.hxx:55
tools::Long nWidth
Definition: hdrcont.hxx:44
virtual bool IsDisabled() const
Definition: hdrcont.cxx:978
void * nTipVisible
Definition: hdrcont.hxx:58
tools::Long GetBigWidth() const
Definition: hdrcont.hxx:121
virtual bool IsMirrored() const
Definition: hdrcont.cxx:973
void SetIgnoreMove(bool bSet)
Definition: hdrcont.hxx:113
long Long
tools::Long GetScrPos(SCCOLROW nEntryNo) const
Definition: hdrcont.cxx:174
tools::Long nSmallWidth
Definition: hdrcont.hxx:45
void SetMark(bool bNewSet, SCCOLROW nNewStart, SCCOLROW nNewEnd)
Definition: hdrcont.cxx:131
void GetMarkRange(SCCOLROW &rStart, SCCOLROW &rEnd) const
Definition: hdrcont.cxx:1005
bool IsSelectionAllowed(SCCOLROW nPos) const
Definition: hdrcont.cxx:564
SCCOLROW nSize
Definition: hdrcont.hxx:48
virtual void DrawInvert(tools::Long nDragPos)
Definition: hdrcont.cxx:992
virtual void MouseButtonUp(const MouseEvent &rMEvt) override
Definition: hdrcont.cxx:697
SelectionEngine * pSelEngine
Definition: hdrcont.hxx:37
void StopMarking()
Definition: hdrcont.cxx:883
tools::Long nDragStart
Definition: hdrcont.hxx:56
virtual OUString GetDragHelp(tools::Long nVal)
Definition: hdrcont.cxx:996
tools::Long GetWidth() const
Definition: hdrcont.hxx:119
sal_Int32 SCCOLROW
a type capable of holding either SCCOL or SCROW
Definition: types.hxx:24
virtual void Tracking(const TrackingEvent &rTEvt) override
Definition: hdrcont.cxx:813
void DoPaint(SCCOLROW nStart, SCCOLROW nEnd)
Definition: hdrcont.cxx:112
SCCOLROW nMarkEnd
Definition: hdrcont.hxx:51
virtual bool IsLayoutRTL() const
Definition: hdrcont.cxx:968
virtual void RequestHelp(const HelpEvent &rHEvt) override
Definition: hdrcont.cxx:946
virtual void SetMarking(bool bSet)
Definition: hdrcont.cxx:1001
virtual SCCOLROW GetHiddenCount(SCCOLROW nEntryNo) const
Definition: hdrcont.cxx:957
void ShowDragHelp()
Definition: hdrcont.cxx:905
SCCOLROW GetMousePos(const MouseEvent &rMEvt, bool &rBorder) const
Definition: hdrcont.cxx:524
void SetWidth(tools::Long nNew)
Definition: hdrcont.cxx:94
SCCOLROW nMarkStart
Definition: hdrcont.hxx:50
virtual void Command(const CommandEvent &rCEvt) override
Definition: hdrcont.cxx:826
ScTabView * pTabView
Definition: hdrcont.hxx:73
virtual SCCOLROW GetPos() const =0
vcl::Font aNormFont
Definition: hdrcont.hxx:38
virtual ~ScHeaderControl() override
Definition: hdrcont.cxx:108
virtual void HideEntries(SCCOLROW nStart, SCCOLROW nEnd)=0
vcl::Font aBoldFont
Definition: hdrcont.hxx:39
virtual bool ResizeAllowed() const
Definition: hdrcont.cxx:983
virtual sal_uInt16 GetEntrySize(SCCOLROW nEntryNo) const =0
virtual void MouseButtonDown(const MouseEvent &rMEvt) override
Definition: hdrcont.cxx:603
tools::Long nDragPos
Definition: hdrcont.hxx:57
virtual void Paint(vcl::RenderContext &rRenderContext, const tools::Rectangle &rRect) override
Definition: hdrcont.cxx:204
virtual void MouseMove(const MouseEvent &rMEvt) override
Definition: hdrcont.cxx:759
virtual void SetEntrySize(SCCOLROW nPos, sal_uInt16 nNewWidth)=0
tools::Long GetSmallWidth() const
Definition: hdrcont.hxx:120
virtual OUString GetEntryText(SCCOLROW nEntryNo) const =0
virtual void SelectWindow()
Definition: hdrcont.cxx:988
tools::Long nBigWidth
Definition: hdrcont.hxx:46