22 #include <string_view>
29 #include <document.hxx>
31 #include <bitmaps.hlst>
41 mrViewData( *pViewData ),
44 mbMirrorEntries( false ),
45 mbMirrorLevels( false ),
55 mbDontDrawFocus( false )
65 if(
TaskPaneList* pTaskPaneList = pSysWin->GetTaskPaneList() )
66 pTaskPaneList->AddWindow(
this );
78 if(
TaskPaneList* pTaskPaneList = pSysWin->GetTaskPaneList() )
79 pTaskPaneList->RemoveWindow(
this );
118 nInvStart = nEnd + nDiff;
125 nInvEnd = nStart + nDiff;
142 Scroll( nEntryDiff, 0, aRect );
144 Scroll( 0, nEntryDiff, aRect );
160 if ( !pTable )
return nullptr;
167 return pArray ? pArray->
GetEntry( sal::static_int_cast<sal_uInt16>(nLevel), sal::static_int_cast<sal_uInt16>(nEntry) ) :
nullptr;
185 bool bAllHidden =
true;
205 while ( (rnColRowStart > 0) &&
IsHidden( rnColRowStart - 1 ) )
211 return mbHoriz ?
Point( nEntryPos, nLevelPos ) : Point( nLevelPos, nEntryPos );
235 size_t nLevelCount = pArray ? pArray->
GetDepth() : 0;
236 return nLevelCount ? (nLevelCount + 1) : 0;
251 size_t nLevel =
static_cast< size_t >( (nLevelPos - nStart) /
SC_OL_BITMAPSIZE );
269 size_t nLevel,
size_t nEntry,
287 rnImagePos = bHidden ?
289 rnStartPos + nEntriesSign;
292 rnImagePos =
mbMirrorEntries ? std::max( rnImagePos, nCenter ) : std::min( rnImagePos, nCenter );
298 rnImagePos = rnStartPos;
301 bool bDoNoCover = !bHidden && nEntry;
306 if ( (nPrevEnd + 1 == nStart) &&
IsHidden( nPrevEnd ) )
312 rnImagePos = rnStartPos;
329 for (
SCCOLROW nRow = nStart; (nRow <= nEnd) && !bVisible; ++nRow )
346 bRet =
GetEntryPos( nLevel, nEntry, nStartPos, nEndPos, nImagePos );
347 rPos =
GetPoint( nLevelPos, nImagePos );
374 if ( !pArray )
return false;
390 if ( (nImagePos <= nEntryMousePos) && (nEntryMousePos < nImagePos +
SC_OL_BITMAPSIZE) )
402 size_t nEntry = pArray->
GetCount( sal::static_int_cast<sal_uInt16>(nLevel) );
408 sal::static_int_cast<sal_uInt16>(nEntry) );
412 if ( (nEnd >= nStartIndex) && (nStart <= nEndIndex) )
415 if (
GetEntryPos( nLevel, nEntry, nStartPos, nEndPos, nImagePos ) )
421 if ( (nStart >= nStartIndex) && (nImagePos <= nEntryMousePos) && (nEntryMousePos < nImagePos +
SC_OL_BITMAPSIZE) )
429 ::std::swap( nStartPos, nEndPos );
430 if ( (nStartPos <= nEntryMousePos) && (nEntryMousePos <= nEndPos) )
445 bool bRet =
ItemHit( rPos, rnLevel, rnEntry, bButton );
446 return bRet && bButton;
452 bool bRet =
ItemHit( rPos, rnLevel, rnEntry, bButton );
453 return bRet && !bButton;
467 rFunc.
ShowOutline(
mbHoriz, sal::static_int_cast<sal_uInt16>(nLevel), sal::static_int_cast<sal_uInt16>(nEntry) );
469 rFunc.
HideOutline(
mbHoriz, sal::static_int_cast<sal_uInt16>(nLevel), sal::static_int_cast<sal_uInt16>(nEntry) );
484 if ( pEntry && !pEntry->
IsHidden() )
501 if ( (rDCEvt.
GetType() == DataChangedEventType::SETTINGS) &&
502 (rDCEvt.
GetFlags() & AllSettingsFlags::STYLE) )
507 Window::DataChanged( rDCEvt );
533 Image GetImage(
const OUString& rId)
535 return Image(StockImage::Yes, rId);
541 const Image& rImage = GetImage(rId);
554 OUString
sId = bPressed ? OUString(RID_BMP_PRESSED) : OUString(RID_BMP_NOTPRESSED);
579 aPos +=
Point( 1, 1 );
627 DrawLineRel( nBorderPos, 0, nBorderPos, nEntryEnd );
630 if ( !pArray )
return;
639 for (
size_t nLevel = 0; nLevel < nLevelCount; ++nLevel )
654 for (
size_t nLevel = 0; nLevel + 1 < nLevelCount; ++nLevel )
657 tools::Long nEntryPos1 = 0, nEntryPos2 = 0, nImagePos = 0;
659 size_t nEntryCount = pArray->
GetCount( sal::static_int_cast<sal_uInt16>(nLevel) );
665 for ( nEntry = 0; nEntry < nEntryCount; ++nEntry )
668 sal::static_int_cast<sal_uInt16>(nEntry) );
673 bool bDraw = (nEnd >= nStartIndex) && (nStart <= nEndIndex);
676 bDraw =
GetEntryPos( nLevel, nEntry, nEntryPos1, nEntryPos2, nImagePos );
680 if ( nStart >= nStartIndex )
681 nEntryPos1 += nEntriesSign;
682 nEntryPos2 -= 2 * nEntriesSign;
686 DrawRectRel( nLinePos, nEntryPos1, nLinePos + nLevelsSign, nEntryPos2 );
688 if ( nEnd <= nEndIndex )
695 nEntry = nEntryCount;
701 sal::static_int_cast<sal_uInt16>(nEntry) );
705 bool bDraw = (nStartIndex <= nStart) && (nStart <= nEndIndex + 1);
708 bDraw =
GetEntryPos( nLevel, nEntry, nEntryPos1, nEntryPos2, nImagePos );
712 OUString sImageId = pEntry->
IsHidden() ? OUString(RID_BMP_PLUS) : OUString(RID_BMP_MINUS);
728 static bool lcl_RotateValue(
size_t& rnValue,
size_t nMin,
size_t nMax,
bool bForward )
730 OSL_ENSURE( nMin <= nMax,
"lcl_RotateValue - invalid range" );
731 OSL_ENSURE( nMax < static_cast< size_t >( -1 ),
"lcl_RotateValue - range overflow" );
735 if ( rnValue < nMax )
745 if ( rnValue > nMin )
767 bool bWrapped =
false;
779 if ( nEntryCount > 0 )
785 if ( !nEntryCount || !bForward )
809 bool bWrapped =
false;
814 if ( nLevelCount > 0 )
827 size_t nNewEntry = 0;
840 bFound = pArray->
GetEntryIndex(nNewLevel, nStart, nNewEntry);
868 bRet |= bWrapInLevel;
871 if ( bForward && bWrapInLevel )
943 size_t nLevel, nEntry;
960 size_t nLevel, nEntry;
969 size_t nLevel, nEntry;
1004 if ( (nCode ==
KEY_TAB) && (bNoMod || bShift) )
1009 else if ( bNoMod && (bUpDownKey || bLeftRightKey) )
1012 if (
mbHoriz == bLeftRightKey )
1021 else if ( bCtrl && (nCode >=
KEY_1) && (nCode <=
KEY_9) )
1023 size_t nLevel =
static_cast< size_t >( nCode -
KEY_1 );
1035 default: Window::KeyInput( rKEvt );
Size GetSizePixel() const
bool mbMirrorEntries
true = Horizontal orientation.
const Wallpaper & GetBackground() const
size_t mnMTLevel
Last position of main area in entry direction.
bool IsButtonVisible(size_t nLevel, size_t nEntry) const
Returns true, if the button of the specified entry is visible in the window.
SystemWindow * GetSystemWindow() const
ScVSplitPos WhichV(ScSplitPos ePos)
constexpr sal_uInt16 KEY_MOD1
void DrawImage(const Point &rPos, const Image &rImage, DrawImageFlags nStyle=DrawImageFlags::NONE)
bool mbMirrorLevels
true = mirror the order of entries (including header)
SC_DLLPUBLIC bool IsHidden() const
const ScOutlineArray * GetOutlineArray() const
Returns the outline array of the corresponding document.
void ScrollPixel(tools::Long nDiff)
Scrolls the window content by the specified amount of pixels.
virtual void dispose() override
bool mbHoriz
Which area in split window.
void DrawLineRel(tools::Long nLevelStart, tools::Long nEntryStart, tools::Long nLevelEnd, tools::Long nEntryEnd)
Converts coordinates to real window points and draws the line.
void SetHeaderSize(tools::Long nNewSize)
Sets the size of the header area (width/height dep.
SC_DLLPUBLIC SCCOLROW GetEnd() const
void InvertTracking(const tools::Rectangle &rRect, ShowTrackFlags nFlags)
const size_t SC_OL_HEADERENTRY
size_t mnFocusLevel
Focus rectangle on screen.
tools::Long GetColRowPos(SCCOLROW nColRowIndex) const
Returns the start coordinate of the specified column/row in the window.
const StyleSettings & GetStyleSettings() const
ScHSplitPos WhichH(ScSplitPos ePos)
const Color & GetFaceColor() const
void ScrollRel(tools::Long nEntryDiff, tools::Long nEntryStart, tools::Long nEntryEnd)
Scrolls the specified range of the window in entry-relative direction.
bool ImplMoveFocusByEntry(bool bForward, bool bFindVisible)
Calculates index of next/previous focus button in the current level (no paint).
ScOutlineEntry * GetEntry(size_t nLevel, size_t nIndex)
sal_uInt16 GetCode() const
bool ImplMoveFocusByTabOrder(bool bForward)
Calculates position of focus button in tab order.
DataChangedEventType GetType() const
bool IsHidden(SCCOLROW nColRowIndex) const
Returns true, if the column/row is hidden.
void DoCollapse(size_t nLevel, size_t nEntry) const
Collapses the specified entry (does nothing with header entries).
virtual void Resize() override
bool IsMouseTracking() const
Returns whether mouse tracking mode is active.
size_t mnMTEntry
Mouse tracking: Level of active button.
constexpr sal_uInt16 KEY_SPACE
void EndMouseTracking()
Ends mouse tracking.
virtual void dispose() override
constexpr sal_uInt16 KEY_ADD
const tools::Long SC_OL_POSOFFSET
Color maLineColor
true = mirror the order of levels, including the border
SCCOL GetPosX(ScHSplitPos eWhich, SCTAB nForTab=-1) const
void DrawBorderRel(size_t nLevel, size_t nEntry, bool bPressed)
Draws a pressed or unpressed border.
constexpr sal_uInt16 KEY_UP
void ShowOutline(bool bColumns, sal_uInt16 nLevel, sal_uInt16 nEntry, bool bRecord=true, bool bPaint=true)
bool GetEntryIndex(size_t nLevel, SCCOLROW nPos, size_t &rnIndex) const
constexpr sal_uInt16 KEY_9
sal_uInt16 GetClicks() const
bool LineHit(const Point &rPos, size_t &rnLevel, size_t &rnEntry) const
Returns true, if rPos is over the line of an expanded group.
bool GetEntryIndexInRange(size_t nLevel, SCCOLROW nBlockStart, SCCOLROW nBlockEnd, size_t &rnIndex) const
tools::Long GetDepthSize() const
Returns the width/height the window needs to show all levels.
bool GetImagePos(size_t nLevel, size_t nEntry, Point &rPos) const
Calculates the absolute position of the image of the specified outline entry.
void SetEntryAreaClipRegion()
Sets a clip region for the window area without header.
sal_Int32 SCCOLROW
a type capable of holding either SCCOL or SCROW
void DrawRectRel(tools::Long nLevelStart, tools::Long nEntryStart, tools::Long nLevelEnd, tools::Long nEntryEnd)
Converts coordinates to real window points and draws the rectangle.
SCCOL VisibleCellsX(ScHSplitPos eWhichX) const
constexpr sal_uInt16 KEY_1
tools::Long mnMainFirstPos
Position of the header area in entry direction.
AllSettingsFlags GetFlags() const
size_t mnFocusEntry
Level of focused button.
Point GetPoint(tools::Long nLevelPos, tools::Long nEntryPos) const
Returns the point in the window of the specified position.
bool ButtonHit(const Point &rPos, size_t &rnLevel, size_t &rnEntry) const
Returns true, if rPos is inside of a button.
virtual void LoseFocus() override
void DoFunction(size_t nLevel, size_t nEntry) const
Performs an action with the specified item.
sal_uInt16 GetModifier() const
bool mbMTActive
Mouse tracking: Entry index of active button.
void GetVisibleRange(SCCOLROW &rnColRowStart, SCCOLROW &rnColRowEnd) const
Returns the currently visible column/row range.
SCROW GetPosY(ScVSplitPos eWhich, SCTAB nForTab=-1) const
void DrawLine(const Point &rStartPt, const Point &rEndPt)
tools::Long GetHeaderEntryPos() const
Returns the entry position of header images.
void DrawRect(const tools::Rectangle &rRect)
SCROW VisibleCellsY(ScVSplitPos eWhichY) const
bool IsFiltered(SCCOLROW nColRowIndex) const
Returns true, if the column/row is filtered.
constexpr sal_uInt16 KEY_DOWN
void MoveFocusByEntry(bool bForward)
Focuses next/previous button in the current level.
SC_DLLPUBLIC bool ColHidden(SCCOL nCol, SCTAB nTab, SCCOL *pFirstCol=nullptr, SCCOL *pLastCol=nullptr) const
void HideFocus()
Erases the focus rectangle from the focused button.
virtual void GetFocus() override
Point GetScrPos(SCCOL nWhereX, SCROW nWhereY, ScSplitPos eWhich, bool bAllowNeg=false, SCTAB nForTab=-1) const
virtual void MouseButtonDown(const MouseEvent &rMEvt) override
SC_DLLPUBLIC SCCOLROW GetStart() const
size_t GetLevelFromPos(tools::Long nLevelPos) const
Returns the level of the passed pixel position.
bool RowFiltered(SCROW nRow, SCTAB nTab, SCROW *pFirstRow=nullptr, SCROW *pLastRow=nullptr) const
virtual void DataChanged(const DataChangedEvent &rDCEvt) override
const ScOutlineArray & GetRowArray() const
tools::Long GetOutputSizeLevel() const
Returns the window size for the level coordinate.
const ScOutlineArray & GetColArray() const
size_t GetCount(size_t nLevel) const
virtual void Invalidate(InvalidateFlags nFlags=InvalidateFlags::NONE)
tools::Rectangle maFocusRect
Mouse tracking: Button currently drawn pressed?
virtual void MouseMove(const MouseEvent &rMEvt) override
tools::Long Width() const
size_t GetLevelCount() const
Returns the count of levels of the outline array.
tools::Long mnMainLastPos
First position of main area in entry direction.
virtual void Paint(vcl::RenderContext &rRenderContext, const tools::Rectangle &rRect) override
const AllSettings & GetSettings() const
Size GetOutputSizePixel() const
void SelectLevel(bool bColumns, sal_uInt16 nLevel, bool bRecord=true)
ScDocument & GetDoc() const
Returns the calc document.
tools::Long mnHeaderPos
Size of the header area in entry direction.
const tools::Long SC_OL_BITMAPSIZE
virtual ~ScOutlineWindow() override
void ShowFocus()
Draws the focus rectangle into the focused button.
constexpr sal_uInt16 KEY_RETURN
ScOutlineWindow(vcl::Window *pParent, ScOutlineMode eMode, ScViewData *pViewData, ScSplitPos eWhich)
Do not redraw focus in next Paint().
ScDBFunc * GetView() const
constexpr sal_uInt16 KEY_RIGHT
const size_t SC_OL_NOLEVEL
bool mbDontDrawFocus
Entry index of focused button.
bool IsFirstVisible(SCCOLROW nColRowIndex) const
Returns true, if all columns/rows before nColRowIndex are hidden.
const vcl::KeyCode & GetKeyCode() const
bool mbMTPressed
Mouse tracking active?
bool ImplMoveFocusByLevel(bool bForward)
Calculates position of focus button in next/previous level (no paint).
bool IsFocusButtonVisible() const
Returns true, if the focused button is visible in the window.
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.
constexpr sal_uInt16 KEY_SUBTRACT
void HideOutline(bool bColumns, sal_uInt16 nLevel, sal_uInt16 nEntry, bool bRecord=true, bool bPaint=true)
tools::Long mnHeaderSize
Line color for expanded groups.
virtual void Scroll(tools::Long nHorzScroll, tools::Long nVertScroll, ScrollFlags nFlags=ScrollFlags::NONE)
void InitSettings()
Initializes color and image settings.
const Color & GetButtonTextColor() const
void DrawImageRel(tools::Long nLevelPos, tools::Long nEntryPos, const OUString &rId)
Draws the specified image unpressed.
virtual void EnableRTL(bool bEnable=true) override
SC_DLLPUBLIC ScOutlineTable * GetOutlineTable(SCTAB nTab, bool bCreate=false)
tools::Long Height() const
tools::Long GetLevelPos(size_t nLevel) const
Returns the pixel position of the specified level.
ScSplitPos meWhich
View data containing the document.
void StartMouseTracking(size_t nLevel, size_t nEntry)
Starts mouse tracking after click on a button.
const ::std::vector< Color > ImpSvNumberformatScan::StandardColor COL_BLACK
SCTAB GetTab() const
Returns the current sheet index.
const Point & GetPosPixel() const
sal_uInt16 GetFullCode() const
SC_DLLPUBLIC bool IsLayoutRTL(SCTAB nTab) const
SC_DLLPUBLIC bool RowHidden(SCROW nRow, SCTAB nTab, SCROW *pFirstRow=nullptr, SCROW *pLastRow=nullptr) const
void MoveFocusByTabOrder(bool bForward)
Focuses next/previous button in tab order.
const std::u16string_view aLevelBmps[]
void MoveFocusByLevel(bool bForward)
Focuses button in next/previous level.
void DoExpand(size_t nLevel, size_t nEntry) const
Expands the specified entry (does nothing with header entries).
tools::Long GetOutputSizeEntry() const
Returns the window size for the entry coordinate.
constexpr sal_uInt16 KEY_LEFT
const ScOutlineEntry * GetOutlineEntry(size_t nLevel, size_t nEntry) const
Returns the specified outline entry.
constexpr sal_uInt16 KEY_SHIFT
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.
virtual void KeyInput(const KeyEvent &rKEvt) override
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.
virtual void MouseButtonUp(const MouseEvent &rMEvt) override
SC_DLLPUBLIC bool IsVisible() const
constexpr sal_uInt16 KEY_TAB
void ImplMoveFocusToVisible(bool bForward)
If the focused entry is invisible, tries to move to visible position.
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.