26#include <osl/diagnose.h>
30#include <document.hxx>
32#include <bitmaps.hlst>
42 mrViewData( *pViewData ),
45 mbMirrorEntries( false ),
46 mbMirrorLevels( false ),
56 mbDontDrawFocus( false )
66 if(
TaskPaneList* pTaskPaneList = pSysWin->GetTaskPaneList() )
67 pTaskPaneList->AddWindow(
this );
79 if(
TaskPaneList* pTaskPaneList = pSysWin->GetTaskPaneList() )
80 pTaskPaneList->RemoveWindow(
this );
119 nInvStart = nEnd + nDiff;
126 nInvEnd = nStart + nDiff;
143 Scroll( nEntryDiff, 0, aRect );
145 Scroll( 0, nEntryDiff, aRect );
161 if ( !pTable )
return nullptr;
168 return pArray ? pArray->
GetEntry( sal::static_int_cast<sal_uInt16>(nLevel), sal::static_int_cast<sal_uInt16>(nEntry) ) :
nullptr;
186 bool bAllHidden =
true;
206 while ( (rnColRowStart > 0) &&
IsHidden( rnColRowStart - 1 ) )
236 size_t nLevelCount = pArray ? pArray->
GetDepth() : 0;
237 return nLevelCount ? (nLevelCount + 1) : 0;
252 size_t nLevel =
static_cast< size_t >( (nLevelPos - nStart) /
SC_OL_BITMAPSIZE );
270 size_t nLevel,
size_t nEntry,
288 rnImagePos = bHidden ?
290 rnStartPos + nEntriesSign;
293 rnImagePos =
mbMirrorEntries ? std::max( rnImagePos, nCenter ) : std::min( rnImagePos, nCenter );
299 rnImagePos = rnStartPos;
302 bool bDoNoCover = !bHidden && nEntry;
307 if ( (nPrevEnd + 1 == nStart) &&
IsHidden( nPrevEnd ) )
313 rnImagePos = rnStartPos;
347 bRet =
GetEntryPos( nLevel, nEntry, nStartPos, nEndPos, nImagePos );
348 rPos =
GetPoint( nLevelPos, nImagePos );
375 if ( !pArray )
return false;
391 if ( (nImagePos <= nEntryMousePos) && (nEntryMousePos < nImagePos +
SC_OL_BITMAPSIZE) )
403 size_t nEntry = pArray->
GetCount( sal::static_int_cast<sal_uInt16>(nLevel) );
409 sal::static_int_cast<sal_uInt16>(nEntry) );
413 if ( (nEnd >= nStartIndex) && (nStart <= nEndIndex) )
416 if (
GetEntryPos( nLevel, nEntry, nStartPos, nEndPos, nImagePos ) )
422 if ( (nStart >= nStartIndex) && (nImagePos <= nEntryMousePos) && (nEntryMousePos < nImagePos +
SC_OL_BITMAPSIZE) )
430 ::std::swap( nStartPos, nEndPos );
431 if ( (nStartPos <= nEntryMousePos) && (nEntryMousePos <= nEndPos) )
446 bool bRet =
ItemHit( rPos, rnLevel, rnEntry, bButton );
447 return bRet && bButton;
453 bool bRet =
ItemHit( rPos, rnLevel, rnEntry, bButton );
454 return bRet && !bButton;
468 rFunc.
ShowOutline(
mbHoriz, sal::static_int_cast<sal_uInt16>(nLevel), sal::static_int_cast<sal_uInt16>(nEntry) );
470 rFunc.
HideOutline(
mbHoriz, sal::static_int_cast<sal_uInt16>(nLevel), sal::static_int_cast<sal_uInt16>(nEntry) );
485 if ( pEntry && !pEntry->
IsHidden() )
502 if ( (rDCEvt.
GetType() == DataChangedEventType::SETTINGS) &&
503 (rDCEvt.
GetFlags() & AllSettingsFlags::STYLE) )
508 Window::DataChanged( rDCEvt );
534 Image GetImage(
const OUString& rId)
536 return Image(StockImage::Yes, rId);
542 const Image& rImage = GetImage(rId);
555 OUString
sId = bPressed ? OUString(RID_BMP_PRESSED) : OUString(RID_BMP_NOTPRESSED);
580 aPos +=
Point( 1, 1 );
628 DrawLineRel( nBorderPos, 0, nBorderPos, nEntryEnd );
631 if ( !pArray )
return;
640 for (
size_t nLevel = 0; nLevel < nLevelCount; ++nLevel )
655 for (
size_t nLevel = 0; nLevel + 1 < nLevelCount; ++nLevel )
658 tools::Long nEntryPos1 = 0, nEntryPos2 = 0, nImagePos = 0;
660 size_t nEntryCount = pArray->
GetCount( sal::static_int_cast<sal_uInt16>(nLevel) );
666 for ( nEntry = 0; nEntry < nEntryCount; ++nEntry )
669 sal::static_int_cast<sal_uInt16>(nEntry) );
674 bool bDraw = (nEnd >= nStartIndex) && (nStart <= nEndIndex);
677 bDraw =
GetEntryPos( nLevel, nEntry, nEntryPos1, nEntryPos2, nImagePos );
681 if ( nStart >= nStartIndex )
682 nEntryPos1 += nEntriesSign;
683 nEntryPos2 -= 2 * nEntriesSign;
687 DrawRectRel( nLinePos, nEntryPos1, nLinePos + nLevelsSign, nEntryPos2 );
689 if ( nEnd <= nEndIndex )
696 nEntry = nEntryCount;
702 sal::static_int_cast<sal_uInt16>(nEntry) );
706 bool bDraw = (nStartIndex <= nStart) && (nStart <= nEndIndex + 1);
709 bDraw =
GetEntryPos( nLevel, nEntry, nEntryPos1, nEntryPos2, nImagePos );
713 OUString sImageId = pEntry->
IsHidden() ? OUString(RID_BMP_PLUS) : OUString(RID_BMP_MINUS);
729static bool lcl_RotateValue(
size_t& rnValue,
size_t nMin,
size_t nMax,
bool bForward )
731 OSL_ENSURE( nMin <= nMax,
"lcl_RotateValue - invalid range" );
732 OSL_ENSURE( nMax <
static_cast< size_t >( -1 ),
"lcl_RotateValue - range overflow" );
736 if ( rnValue < nMax )
746 if ( rnValue > nMin )
768 bool bWrapped =
false;
780 if ( nEntryCount > 0 )
786 if ( !nEntryCount || !bForward )
810 bool bWrapped =
false;
815 if ( nLevelCount > 0 )
828 size_t nNewEntry = 0;
841 bFound = pArray->
GetEntryIndex(nNewLevel, nStart, nNewEntry);
869 bRet |= bWrapInLevel;
872 if ( bForward && bWrapInLevel )
944 size_t nLevel, nEntry;
961 size_t nLevel, nEntry;
970 size_t nLevel, nEntry;
1000 sal_uInt16 nCode = rKCode.
GetCode();
1005 if ( (nCode ==
KEY_TAB) && (bNoMod || bShift) )
1010 else if ( bNoMod && (bUpDownKey || bLeftRightKey) )
1013 if (
mbHoriz == bLeftRightKey )
1022 else if ( bCtrl && (nCode >=
KEY_1) && (nCode <=
KEY_9) )
1024 size_t nLevel =
static_cast< size_t >( nCode -
KEY_1 );
1036 default: Window::KeyInput( rKEvt );
const StyleSettings & GetStyleSettings() const
DataChangedEventType GetType() const
AllSettingsFlags GetFlags() const
Size GetSizePixel() const
const vcl::KeyCode & GetKeyCode() const
sal_uInt16 GetClicks() const
const Point & GetPosPixel() const
void DrawRect(const tools::Rectangle &rRect)
void DrawLine(const Point &rStartPt, const Point &rEndPt)
void DrawImage(const Point &rPos, const Image &rImage, DrawImageFlags nStyle=DrawImageFlags::NONE)
constexpr tools::Long Y() const
constexpr tools::Long X() const
void HideOutline(bool bColumns, sal_uInt16 nLevel, sal_uInt16 nEntry, bool bRecord=true, bool bPaint=true)
void ShowOutline(bool bColumns, sal_uInt16 nLevel, sal_uInt16 nEntry, bool bRecord=true, bool bPaint=true)
void SelectLevel(bool bColumns, sal_uInt16 nLevel, bool bRecord=true)
SC_DLLPUBLIC bool RowFiltered(SCROW nRow, SCTAB nTab, SCROW *pFirstRow=nullptr, SCROW *pLastRow=nullptr) const
SC_DLLPUBLIC bool RowHidden(SCROW nRow, SCTAB nTab, SCROW *pFirstRow=nullptr, SCROW *pLastRow=nullptr) const
SC_DLLPUBLIC ScOutlineTable * GetOutlineTable(SCTAB nTab, bool bCreate=false)
SC_DLLPUBLIC bool ColHidden(SCCOL nCol, SCTAB nTab, SCCOL *pFirstCol=nullptr, SCCOL *pLastCol=nullptr) const
SC_DLLPUBLIC bool IsLayoutRTL(SCTAB nTab) const
size_t GetCount(size_t nLevel) const
ScOutlineEntry * GetEntry(size_t nLevel, size_t nIndex)
bool GetEntryIndex(size_t nLevel, SCCOLROW nPos, size_t &rnIndex) const
bool GetEntryIndexInRange(size_t nLevel, SCCOLROW nBlockStart, SCCOLROW nBlockEnd, size_t &rnIndex) const
SC_DLLPUBLIC SCCOLROW GetStart() const
SC_DLLPUBLIC bool IsHidden() const
SC_DLLPUBLIC bool IsVisible() const
SC_DLLPUBLIC SCCOLROW GetEnd() const
const ScOutlineArray & GetColArray() const
const ScOutlineArray & GetRowArray() const
void DoExpand(size_t nLevel, size_t nEntry) const
Expands the specified entry (does nothing with header entries).
tools::Long mnHeaderSize
Line color for expanded groups.
tools::Long mnHeaderPos
Size of the header area in entry direction.
void HideFocus()
Erases the focus rectangle from the focused button.
void SetEntryAreaClipRegion()
Sets a clip region for the window area without header.
void ImplMoveFocusToVisible(bool bForward)
If the focused entry is invisible, tries to move to visible position.
size_t mnFocusLevel
Focus rectangle on screen.
size_t mnMTLevel
Last position of main area in entry direction.
size_t GetLevelFromPos(tools::Long nLevelPos) const
Returns the level of the passed pixel position.
tools::Long GetHeaderEntryPos() const
Returns the entry position of header images.
void SetHeaderSize(tools::Long nNewSize)
Sets the size of the header area (width/height dep.
tools::Long GetColRowPos(SCCOLROW nColRowIndex) const
Returns the start coordinate of the specified column/row in the window.
void MoveFocusByLevel(bool bForward)
Focuses button in next/previous level.
virtual void MouseMove(const MouseEvent &rMEvt) override
void DrawLineRel(tools::Long nLevelStart, tools::Long nEntryStart, tools::Long nLevelEnd, tools::Long nEntryEnd)
Converts coordinates to real window points and draws the line.
size_t GetLevelCount() const
Returns the count of levels of the outline array.
bool ImplMoveFocusByLevel(bool bForward)
Calculates position of focus button in next/previous level (no paint).
bool IsFirstVisible(SCCOLROW nColRowIndex) const
Returns true, if all columns/rows before nColRowIndex are hidden.
void ShowFocus()
Draws the focus rectangle into the focused button.
void DrawBorderRel(size_t nLevel, size_t nEntry, bool bPressed)
Draws a pressed or unpressed border.
virtual ~ScOutlineWindow() override
bool IsMouseTracking() const
Returns whether mouse tracking mode is active.
bool mbDontDrawFocus
Entry index of focused button.
bool IsHidden(SCCOLROW nColRowIndex) const
Returns true, if the column/row is hidden.
bool IsButtonVisible(size_t nLevel, size_t nEntry) const
Returns true, if the button of the specified entry is visible in the window.
virtual void MouseButtonDown(const MouseEvent &rMEvt) override
bool ImplMoveFocusByTabOrder(bool bForward)
Calculates position of focus button in tab order.
Point GetPoint(tools::Long nLevelPos, tools::Long nEntryPos) const
Returns the point in the window of the specified position.
void ScrollRel(tools::Long nEntryDiff, tools::Long nEntryStart, tools::Long nEntryEnd)
Scrolls the specified range of the window in entry-relative direction.
virtual void GetFocus() override
bool mbMTActive
Mouse tracking: Entry index of active button.
tools::Long mnMainLastPos
First position of main area in entry direction.
virtual void LoseFocus() override
tools::Long GetDepthSize() const
Returns the width/height the window needs to show all levels.
tools::Long mnMainFirstPos
Position of the header area in entry direction.
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.
void DrawRectRel(tools::Long nLevelStart, tools::Long nEntryStart, tools::Long nLevelEnd, tools::Long nEntryEnd)
Converts coordinates to real window points and draws the rectangle.
void DoFunction(size_t nLevel, size_t nEntry) const
Performs an action with the specified item.
bool mbMirrorEntries
true = Horizontal orientation.
bool mbMirrorLevels
true = mirror the order of entries (including header)
bool LineHit(const Point &rPos, size_t &rnLevel, size_t &rnEntry) const
Returns true, if rPos is over the line of an expanded group.
SCTAB GetTab() const
Returns the current sheet index.
tools::Long GetOutputSizeLevel() const
Returns the window size for the level coordinate.
virtual void DataChanged(const DataChangedEvent &rDCEvt) override
bool ImplMoveFocusByEntry(bool bForward, bool bFindVisible)
Calculates index of next/previous focus button in the current level (no paint).
bool ButtonHit(const Point &rPos, size_t &rnLevel, size_t &rnEntry) const
Returns true, if rPos is inside of a button.
ScDocument & GetDoc() const
Returns the calc document.
bool IsFocusButtonVisible() const
Returns true, if the focused button is visible in the window.
bool GetImagePos(size_t nLevel, size_t nEntry, Point &rPos) const
Calculates the absolute position of the image of the specified outline entry.
tools::Rectangle maFocusRect
Mouse tracking: Button currently drawn pressed?
void InitSettings()
Initializes color and image settings.
void StartMouseTracking(size_t nLevel, size_t nEntry)
Starts mouse tracking after click on a button.
ScOutlineWindow(vcl::Window *pParent, ScOutlineMode eMode, ScViewData *pViewData, ScSplitPos eWhich)
Do not redraw focus in next Paint().
bool mbHoriz
Which area in split window.
void DrawImageRel(tools::Long nLevelPos, tools::Long nEntryPos, const OUString &rId)
Draws the specified image unpressed.
size_t mnFocusEntry
Level of focused button.
tools::Long GetOutputSizeEntry() const
Returns the window size for the entry coordinate.
void MoveFocusByTabOrder(bool bForward)
Focuses next/previous button in tab order.
const ScOutlineEntry * GetOutlineEntry(size_t nLevel, size_t nEntry) const
Returns the specified outline entry.
tools::Long GetLevelPos(size_t nLevel) const
Returns the pixel position of the specified level.
virtual void KeyInput(const KeyEvent &rKEvt) override
bool IsFiltered(SCCOLROW nColRowIndex) const
Returns true, if the column/row is filtered.
size_t mnMTEntry
Mouse tracking: Level of active button.
void ScrollPixel(tools::Long nDiff)
Scrolls the window content by the specified amount of pixels.
virtual void Paint(vcl::RenderContext &rRenderContext, const tools::Rectangle &rRect) override
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.
void MoveFocusByEntry(bool bForward)
Focuses next/previous button in the current level.
virtual void dispose() override
ScSplitPos meWhich
View data containing the document.
void EndMouseTracking()
Ends mouse tracking.
bool mbMTPressed
Mouse tracking active?
void GetVisibleRange(SCCOLROW &rnColRowStart, SCCOLROW &rnColRowEnd) const
Returns the currently visible column/row range.
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.
Color maLineColor
true = mirror the order of levels, including the border
void DoCollapse(size_t nLevel, size_t nEntry) const
Collapses the specified entry (does nothing with header entries).
virtual void MouseButtonUp(const MouseEvent &rMEvt) override
const ScOutlineArray * GetOutlineArray() const
Returns the outline array of the corresponding document.
virtual void Resize() override
SCROW GetPosY(ScVSplitPos eWhich, SCTAB nForTab=-1) const
ScDBFunc * GetView() const
SCROW VisibleCellsY(ScVSplitPos eWhichY) const
Point GetScrPos(SCCOL nWhereX, SCROW nWhereY, ScSplitPos eWhich, bool bAllowNeg=false, SCTAB nForTab=-1) const
SCCOL VisibleCellsX(ScHSplitPos eWhichX) const
SCCOL GetPosX(ScHSplitPos eWhich, SCTAB nForTab=-1) const
constexpr tools::Long Height() const
constexpr tools::Long Width() const
const Color & GetFaceColor() const
const Color & GetButtonTextColor() const
sal_uInt16 GetCode() const
sal_uInt16 GetModifier() const
sal_uInt16 GetFullCode() const
virtual void dispose() override
const Wallpaper & GetBackground() const
virtual void EnableRTL(bool bEnable=true)
const AllSettings & GetSettings() const
::OutputDevice const * GetOutDev() const
SystemWindow * GetSystemWindow() const
virtual void Scroll(tools::Long nHorzScroll, tools::Long nVertScroll, ScrollFlags nFlags=ScrollFlags::NONE)
Size GetOutputSizePixel() const
void Invalidate(InvalidateFlags nFlags=InvalidateFlags::NONE)
void InvertTracking(const tools::Rectangle &rRect, ShowTrackFlags nFlags)
constexpr ::Color COL_BLACK(0x00, 0x00, 0x00)
constexpr sal_uInt16 KEY_RETURN
constexpr sal_uInt16 KEY_MOD1
constexpr sal_uInt16 KEY_1
constexpr sal_uInt16 KEY_ADD
constexpr sal_uInt16 KEY_LEFT
constexpr sal_uInt16 KEY_TAB
constexpr sal_uInt16 KEY_UP
constexpr sal_uInt16 KEY_9
constexpr sal_uInt16 KEY_RIGHT
constexpr sal_uInt16 KEY_DOWN
constexpr sal_uInt16 KEY_SPACE
constexpr sal_uInt16 KEY_SUBTRACT
constexpr sal_uInt16 KEY_SHIFT
const tools::Long SC_OL_BITMAPSIZE
const tools::Long SC_OL_POSOFFSET
const size_t SC_OL_HEADERENTRY
constexpr rtl::OUStringConstExpr aLevelBmps[]
const size_t SC_OL_NOLEVEL
static bool lcl_RotateValue(size_t &rnValue, size_t nMin, size_t nMax, bool bForward)
Increments or decrements a value and wraps at the specified limits.
sal_Int32 SCCOLROW
a type capable of holding either SCCOL or SCROW
ScHSplitPos WhichH(ScSplitPos ePos)
ScVSplitPos WhichV(ScSplitPos ePos)