LibreOffice Module sc (master) 1
olinewin.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#pragma once
21
22#include <vcl/window.hxx>
23#include "viewdata.hxx"
24
25class ScOutlineEntry;
26class ScOutlineArray;
27
29
33{
34private:
37 bool mbHoriz;
40
46
47 size_t mnMTLevel;
48 size_t mnMTEntry;
51
53 size_t mnFocusLevel;
54 size_t mnFocusEntry;
56
57public:
59 vcl::Window* pParent,
60 ScOutlineMode eMode,
61 ScViewData* pViewData,
62 ScSplitPos eWhich );
63 virtual ~ScOutlineWindow() override;
64 virtual void dispose() override;
65
67 void SetHeaderSize( tools::Long nNewSize );
70
72 void ScrollPixel( tools::Long nDiff );
73
74 using Window::ShowFocus;
75
76private:
78 void InitSettings();
79
81 ScDocument& GetDoc() const { return mrViewData.GetDocument(); }
83 SCTAB GetTab() const { return mrViewData.GetTabNo(); }
85 const ScOutlineArray* GetOutlineArray() const;
87 const ScOutlineEntry* GetOutlineEntry( size_t nLevel, size_t nEntry ) const;
88
90 bool IsHidden( SCCOLROW nColRowIndex ) const;
92 bool IsFiltered( SCCOLROW nColRowIndex ) const;
94 bool IsFirstVisible( SCCOLROW nColRowIndex ) const;
96 void GetVisibleRange( SCCOLROW& rnColRowStart, SCCOLROW& rnColRowEnd ) const;
97
99 Point GetPoint( tools::Long nLevelPos, tools::Long nEntryPos ) const;
102 tools::Long nLevelStart, tools::Long nEntryStart,
103 tools::Long nLevelEnd, tools::Long nEntryEnd ) const;
104
109
111 size_t GetLevelCount() const;
113 tools::Long GetLevelPos( size_t nLevel ) const;
115 size_t GetLevelFromPos( tools::Long nLevelPos ) const;
116
118 tools::Long GetColRowPos( SCCOLROW nColRowIndex ) const;
123 bool GetEntryPos(
124 size_t nLevel, size_t nEntry,
125 tools::Long& rnStartPos, tools::Long& rnEndPos, tools::Long& rnImagePos ) const;
130 bool GetImagePos( size_t nLevel, size_t nEntry, Point& rPos ) const;
132 bool IsButtonVisible( size_t nLevel, size_t nEntry ) const;
133
136 bool ItemHit( const Point& rPos, size_t& rnLevel, size_t& rnEntry, bool& rbButton ) const;
139 bool ButtonHit( const Point& rPos, size_t& rnLevel, size_t& rnEntry ) const;
142 bool LineHit( const Point& rPos, size_t& rnLevel, size_t& rnEntry ) const;
143
147 void DoFunction( size_t nLevel, size_t nEntry ) const;
149 void DoExpand( size_t nLevel, size_t nEntry ) const;
151 void DoCollapse( size_t nLevel, size_t nEntry ) const;
152
154 bool IsFocusButtonVisible() const;
155
159 bool ImplMoveFocusByEntry( bool bForward, bool bFindVisible );
162 bool ImplMoveFocusByLevel( bool bForward );
166 bool ImplMoveFocusByTabOrder( bool bForward );
167
169 void ImplMoveFocusToVisible( bool bForward );
170
172 void MoveFocusByEntry( bool bForward );
174 void MoveFocusByLevel( bool bForward );
176 void MoveFocusByTabOrder( bool bForward );
177
179 void StartMouseTracking( size_t nLevel, size_t nEntry );
181 bool IsMouseTracking() const { return mbMTActive; }
183 void EndMouseTracking();
184
188 void DrawLineRel(
189 tools::Long nLevelStart, tools::Long nEntryStart,
190 tools::Long nLevelEnd, tools::Long nEntryEnd );
192 void DrawRectRel(
193 tools::Long nLevelStart, tools::Long nEntryStart,
194 tools::Long nLevelEnd, tools::Long nEntryEnd );
196 void DrawImageRel(tools::Long nLevelPos, tools::Long nEntryPos, const OUString& rId);
198 void DrawBorderRel(size_t nLevel, size_t nEntry, bool bPressed);
199
201 void ShowFocus();
203 void HideFocus();
204
206 void ScrollRel( tools::Long nEntryDiff, tools::Long nEntryStart, tools::Long nEntryEnd );
207
208protected:
209 virtual void Paint( vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect ) override;
210
211 virtual void Resize() override;
212 virtual void GetFocus() override;
213 virtual void LoseFocus() override;
214
215 virtual void MouseMove( const MouseEvent& rMEvt ) override;
216 virtual void MouseButtonUp( const MouseEvent& rMEvt ) override;
217 virtual void MouseButtonDown( const MouseEvent& rMEvt ) override;
218
219 virtual void KeyInput( const KeyEvent& rKEvt ) override;
220
221public:
222 virtual void DataChanged( const DataChangedEvent& rDCEvt ) override;
223};
224
225/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
The window left of or above the spreadsheet containing the outline groups and controls to expand/coll...
Definition: olinewin.hxx:33
void DoExpand(size_t nLevel, size_t nEntry) const
Expands the specified entry (does nothing with header entries).
Definition: olinewin.cxx:475
tools::Long mnHeaderSize
Line color for expanded groups.
Definition: olinewin.hxx:42
tools::Long mnHeaderPos
Size of the header area in entry direction.
Definition: olinewin.hxx:43
void HideFocus()
Erases the focus rectangle from the focused button.
Definition: olinewin.cxx:591
void SetEntryAreaClipRegion()
Sets a clip region for the window area without header.
Definition: olinewin.cxx:513
void ImplMoveFocusToVisible(bool bForward)
If the focused entry is invisible, tries to move to visible position.
Definition: olinewin.cxx:880
size_t mnFocusLevel
Focus rectangle on screen.
Definition: olinewin.hxx:53
ScViewData & mrViewData
Definition: olinewin.hxx:35
size_t mnMTLevel
Last position of main area in entry direction.
Definition: olinewin.hxx:47
size_t GetLevelFromPos(tools::Long nLevelPos) const
Returns the level of the passed pixel position.
Definition: olinewin.cxx:247
tools::Long GetHeaderEntryPos() const
Returns the entry position of header images.
Definition: olinewin.cxx:264
void SetHeaderSize(tools::Long nNewSize)
Sets the size of the header area (width/height dep.
Definition: olinewin.cxx:84
tools::Long GetColRowPos(SCCOLROW nColRowIndex) const
Returns the start coordinate of the specified column/row in the window.
Definition: olinewin.cxx:256
void MoveFocusByLevel(bool bForward)
Focuses button in next/previous level.
Definition: olinewin.cxx:897
virtual void MouseMove(const MouseEvent &rMEvt) override
Definition: olinewin.cxx:940
void DrawLineRel(tools::Long nLevelStart, tools::Long nEntryStart, tools::Long nLevelEnd, tools::Long nEntryEnd)
Converts coordinates to real window points and draws the line.
Definition: olinewin.cxx:520
size_t GetLevelCount() const
Returns the count of levels of the outline array.
Definition: olinewin.cxx:233
bool ImplMoveFocusByLevel(bool bForward)
Calculates position of focus button in next/previous level (no paint).
Definition: olinewin.cxx:804
bool IsFirstVisible(SCCOLROW nColRowIndex) const
Returns true, if all columns/rows before nColRowIndex are hidden.
Definition: olinewin.cxx:184
void ShowFocus()
Draws the focus rectangle into the focused button.
Definition: olinewin.cxx:566
void DrawBorderRel(size_t nLevel, size_t nEntry, bool bPressed)
Draws a pressed or unpressed border.
Definition: olinewin.cxx:550
virtual ~ScOutlineWindow() override
Definition: olinewin.cxx:70
bool IsMouseTracking() const
Returns whether mouse tracking mode is active.
Definition: olinewin.hxx:181
bool mbDontDrawFocus
Entry index of focused button.
Definition: olinewin.hxx:55
bool IsHidden(SCCOLROW nColRowIndex) const
Returns true, if the column/row is hidden.
Definition: olinewin.cxx:171
bool IsButtonVisible(size_t nLevel, size_t nEntry) const
Returns true, if the button of the specified entry is visible in the window.
Definition: olinewin.cxx:354
virtual void MouseButtonDown(const MouseEvent &rMEvt) override
Definition: olinewin.cxx:968
bool ImplMoveFocusByTabOrder(bool bForward)
Calculates position of focus button in tab order.
Definition: olinewin.cxx:855
Point GetPoint(tools::Long nLevelPos, tools::Long nEntryPos) const
Returns the point in the window of the specified position.
Definition: olinewin.cxx:210
void ScrollRel(tools::Long nEntryDiff, tools::Long nEntryStart, tools::Long nEntryEnd)
Scrolls the specified range of the window in entry-relative direction.
Definition: olinewin.cxx:139
virtual void GetFocus() override
Definition: olinewin.cxx:911
bool mbMTActive
Mouse tracking: Entry index of active button.
Definition: olinewin.hxx:49
tools::Long mnMainLastPos
First position of main area in entry direction.
Definition: olinewin.hxx:45
virtual void LoseFocus() override
Definition: olinewin.cxx:917
tools::Long GetDepthSize() const
Returns the width/height the window needs to show all levels.
Definition: olinewin.cxx:99
tools::Long mnMainFirstPos
Position of the header area in entry direction.
Definition: olinewin.hxx:44
bool GetEntryPos(size_t nLevel, size_t nEntry, tools::Long &rnStartPos, tools::Long &rnEndPos, tools::Long &rnImagePos) const
Calculates the coordinates the outline entry takes in the window.
Definition: olinewin.cxx:269
void DrawRectRel(tools::Long nLevelStart, tools::Long nEntryStart, tools::Long nLevelEnd, tools::Long nEntryEnd)
Converts coordinates to real window points and draws the rectangle.
Definition: olinewin.cxx:526
void DoFunction(size_t nLevel, size_t nEntry) const
Performs an action with the specified item.
Definition: olinewin.cxx:457
bool mbMirrorEntries
true = Horizontal orientation.
Definition: olinewin.hxx:38
bool mbMirrorLevels
true = mirror the order of entries (including header)
Definition: olinewin.hxx:39
bool LineHit(const Point &rPos, size_t &rnLevel, size_t &rnEntry) const
Returns true, if rPos is over the line of an expanded group.
Definition: olinewin.cxx:450
SCTAB GetTab() const
Returns the current sheet index.
Definition: olinewin.hxx:83
tools::Long GetOutputSizeLevel() const
Returns the window size for the level coordinate.
Definition: olinewin.cxx:221
virtual void DataChanged(const DataChangedEvent &rDCEvt) override
Definition: olinewin.cxx:500
bool ImplMoveFocusByEntry(bool bForward, bool bFindVisible)
Calculates index of next/previous focus button in the current level (no paint).
Definition: olinewin.cxx:762
bool ButtonHit(const Point &rPos, size_t &rnLevel, size_t &rnEntry) const
Returns true, if rPos is inside of a button.
Definition: olinewin.cxx:443
ScDocument & GetDoc() const
Returns the calc document.
Definition: olinewin.hxx:81
bool IsFocusButtonVisible() const
Returns true, if the focused button is visible in the window.
Definition: olinewin.cxx:757
bool GetImagePos(size_t nLevel, size_t nEntry, Point &rPos) const
Calculates the absolute position of the image of the specified outline entry.
Definition: olinewin.cxx:336
tools::Rectangle maFocusRect
Mouse tracking: Button currently drawn pressed?
Definition: olinewin.hxx:52
void InitSettings()
Initializes color and image settings.
Definition: olinewin.cxx:150
void StartMouseTracking(size_t nLevel, size_t nEntry)
Starts mouse tracking after click on a button.
Definition: olinewin.cxx:925
ScOutlineWindow(vcl::Window *pParent, ScOutlineMode eMode, ScViewData *pViewData, ScSplitPos eWhich)
Do not redraw focus in next Paint().
Definition: olinewin.cxx:40
bool mbHoriz
Which area in split window.
Definition: olinewin.hxx:37
void DrawImageRel(tools::Long nLevelPos, tools::Long nEntryPos, const OUString &rId)
Draws the specified image unpressed.
Definition: olinewin.cxx:540
size_t mnFocusEntry
Level of focused button.
Definition: olinewin.hxx:54
tools::Long GetOutputSizeEntry() const
Returns the window size for the entry coordinate.
Definition: olinewin.cxx:227
void MoveFocusByTabOrder(bool bForward)
Focuses next/previous button in tab order.
Definition: olinewin.cxx:904
const ScOutlineEntry * GetOutlineEntry(size_t nLevel, size_t nEntry) const
Returns the specified outline entry.
Definition: olinewin.cxx:165
tools::Long GetLevelPos(size_t nLevel) const
Returns the pixel position of the specified level.
Definition: olinewin.cxx:240
virtual void KeyInput(const KeyEvent &rKEvt) override
Definition: olinewin.cxx:993
bool IsFiltered(SCCOLROW nColRowIndex) const
Returns true, if the column/row is filtered.
Definition: olinewin.cxx:178
size_t mnMTEntry
Mouse tracking: Level of active button.
Definition: olinewin.hxx:48
void ScrollPixel(tools::Long nDiff)
Scrolls the window content by the specified amount of pixels.
Definition: olinewin.cxx:107
virtual void Paint(vcl::RenderContext &rRenderContext, const tools::Rectangle &rRect) override
Definition: olinewin.cxx:617
bool ItemHit(const Point &rPos, size_t &rnLevel, size_t &rnEntry, bool &rbButton) const
Returns true, if rPos is inside of a button or over the line of an expanded group.
Definition: olinewin.cxx:372
void MoveFocusByEntry(bool bForward)
Focuses next/previous button in the current level.
Definition: olinewin.cxx:890
virtual void dispose() override
Definition: olinewin.cxx:75
ScSplitPos meWhich
View data containing the document.
Definition: olinewin.hxx:36
void EndMouseTracking()
Ends mouse tracking.
Definition: olinewin.cxx:933
bool mbMTPressed
Mouse tracking active?
Definition: olinewin.hxx:50
void GetVisibleRange(SCCOLROW &rnColRowStart, SCCOLROW &rnColRowEnd) const
Returns the currently visible column/row range.
Definition: olinewin.cxx:192
tools::Rectangle GetRectangle(tools::Long nLevelStart, tools::Long nEntryStart, tools::Long nLevelEnd, tools::Long nEntryEnd) const
Returns the rectangle in the window of the specified position.
Definition: olinewin.cxx:215
Color maLineColor
true = mirror the order of levels, including the border
Definition: olinewin.hxx:41
void DoCollapse(size_t nLevel, size_t nEntry) const
Collapses the specified entry (does nothing with header entries).
Definition: olinewin.cxx:482
virtual void MouseButtonUp(const MouseEvent &rMEvt) override
Definition: olinewin.cxx:955
const ScOutlineArray * GetOutlineArray() const
Returns the outline array of the corresponding document.
Definition: olinewin.cxx:158
virtual void Resize() override
Definition: olinewin.cxx:489
SCTAB GetTabNo() const
Definition: viewdata.hxx:395
ScDocument & GetDocument() const
Definition: viewdata.hxx:380
long Long
ScOutlineMode
Definition: olinewin.hxx:28
@ SC_OUTLINE_HOR
Definition: olinewin.hxx:28
@ SC_OUTLINE_VER
Definition: olinewin.hxx:28
sal_Int32 SCCOLROW
a type capable of holding either SCCOL or SCROW
Definition: types.hxx:23
sal_Int16 SCTAB
Definition: types.hxx:22
ScSplitPos
Definition: viewdata.hxx:44