32#include <config_features.h>
36#define STATUSBAR_OFFSET_X STATUSBAR_OFFSET
37#define STATUSBAR_OFFSET_Y 2
38#define STATUSBAR_OFFSET_TEXTY 3
40#define STATUSBAR_PRGS_OFFSET 3
41#define STATUSBAR_PRGS_COUNT 100
42#define STATUSBAR_PRGS_MIN 5
44#define STATUSBAR_MIN_HEIGHT 16
81 if(!mLayoutGlyphsCache.has_value())
83 std::unique_ptr<SalLayout> pSalLayout = outputDevice->
ImplLayout(
85 mLayoutGlyphsCache = pSalLayout ? pSalLayout->GetGlyphs() :
SalLayoutGlyphs();
87 return mLayoutGlyphsCache->IsValid() ? &mLayoutGlyphsCache.value() :
nullptr;
101 if( delta + rTextSize.
Width() > rRectSize.
Width() )
107 nX = rRectSize.
Width()-rTextSize.
Width()-delta;
111 return Point( nX, nY );
127 Window::ImplInit( pParent, nStyle & ~
WB_BORDER,
nullptr );
226 sal_uInt16 nAutoSizeItems;
236 if ( pItem->mbVisible )
243 nOffset = pItem->mnOffset;
255 pItem->mbVisible =
false;
267 if ( !pItem->mbVisible &&
271 pItem->mbVisible =
true;
277 }
while ( bChanged );
309 if ( pItem->mbVisible ) {
311 pItem->mnExtraWidth = nExtraWidth;
312 if ( nExtraWidth2 ) {
313 pItem->mnExtraWidth++;
317 pItem->mnExtraWidth = 0;
321 nX += pItem->mnWidth + pItem->mnExtraWidth + pItem->mnOffset;
349 return sal_uInt16(
nPos);
365 if (aTextRect.
Right() > aTextRect.
Left())
369 sal_Int32
nPos =
aStr.indexOf(
'\n');
396 mpImplData->mpVirDev->SetOutputSizePixel(aTextRectSize);
417 0, -1,
nullptr,
nullptr,
427 0, -1,
nullptr,
nullptr,
476 sal_uInt16 nPercent1, sal_uInt16 nPercent2, sal_uInt16 nPercentCount,
483 tools::Long nFullWidth = (nPrgsWidth + nOffset) * (10000 / nPercentCount);
484 tools::Long nPerc = std::min<sal_uInt16>(nPercent2, 10000);
497 if (pEraseWindow == pWindow)
500 rRenderContext.
Erase(rFramePosSize);
520 rRenderContext.
Pop();
526 sal_uInt16 nPerc1 = nPercent1 / nPercentCount;
527 sal_uInt16 nPerc2 = nPercent2 / nPercentCount;
540 rRenderContext.
Erase(aRect);
545 while (nPerc1 > nPerc2);
547 else if (nPerc1 < nPerc2)
551 if (nPercent2 > 10000)
553 nPerc2 = 10000 / nPercentCount;
554 if (nPerc1 >= nPerc2)
570 while (nPerc1 < nPerc2);
573 if (nPercent2 > 10000)
576 if (((nPercent2 / nPercentCount) & 0x01) == (nPercentCount & 0x01))
580 rRenderContext.
Erase(aRect);
637 bool bNativeOK =
false;
645 aNativeControlRegion, aNativeContentRegion ) ) )
700 sal_uInt16 nItemCount = sal_uInt16(
mvItemList.size() );
715 rRenderContext.
Pop();
729 rRenderContext.
Erase(rRect);
731 for (sal_uInt16
i = 0;
i < nItemCount;
i++)
804 Window::RequestHelp( rHEvt );
809 Window::StateChanged(
nType );
836 pItem->mLayoutGlyphsCache.reset();
843 Window::DataChanged( rDCEvt );
863 pItem->mLayoutGlyphsCache.reset();
891 SAL_WARN_IF( !nItemId,
"vcl",
"StatusBar::InsertItem(): ItemId == 0" );
893 "StatusBar::InsertItem(): ItemId already exists" );
908 pItem->mnId = nItemId;
909 pItem->mnBits = nBits;
911 pItem->mnOffset = nOffset;
912 pItem->mpUserData =
nullptr;
913 pItem->mbVisible =
true;
1008 return static_cast<sal_uInt16
>(
mvItemList.size());
1022 return sal_uInt16(
i );
1131 const bool bOrigOverlapWin = pWindowImpl->
mbOverlapWin;
1153 if ( pItem->
maText == rText )
1162 if (nCharsWidth != -1)
1166 nWidth = nWidth * nCharsWidth + nFudge;
1352 SAL_WARN_IF( nNewPercent > 100,
"vcl",
"StatusBar::SetProgressValue(): nPercent > 100" );
1362 sal_uInt32 nTime_ms = osl_getGlobalTimer();
1393 Window::SetText(rText);
1398 Window::SetText(rText);
1413 Window::SetText(rText);
1428 nCalcWidth += pItem->
mnWidth + nOffset;
1435 tools::Long nProgressHeight = nMinHeight + nBarTextOffset;
1444 aNativeControlRegion, aNativeContentRegion ) )
1446 nProgressHeight = aNativeControlRegion.
GetHeight();
1450 nCalcHeight = nMinHeight+nBarTextOffset;
1451 if( nCalcHeight < nProgressHeight+2 )
1452 nCalcHeight = nProgressHeight+2;
1454 return Size( nCalcWidth, nCalcHeight );
const StyleSettings & GetStyleSettings() const
static Help * GetHelp()
Gets the application's help.
DataChangedEventType GetType() const
AllSettingsFlags GetFlags() const
void DrawFrame(const tools::Rectangle &rRect, const Color &rLeftTopColor, const Color &rRightBottomColor)
void DrawSeparator(const Point &rStart, const Point &rStop, bool bVertical=true)
HelpEventMode GetMode() const
bool KeyboardActivated() const
const Point & GetMousePosPixel() const
virtual OUString GetHelpText(const OUString &aHelpURL, const weld::Widget *pWidget)
static void ShowQuickHelp(vcl::Window *pParent, const tools::Rectangle &rScreenRect, const OUString &rHelpText, QuickHelpFlags nStyle=QuickHelpFlags::NONE)
static void ShowBalloon(vcl::Window *pParent, const Point &rScreenPos, const tools::Rectangle &, const OUString &rHelpText)
sal_uInt16 GetClicks() const
const Point & GetPosPixel() const
Some things multiple-inherit from VclAbstractDialog and OutputDevice, so we need to use virtual inher...
SAL_DLLPRIVATE bool ImplIsRecordLayout() const
void DrawRect(const tools::Rectangle &rRect)
void DrawLine(const Point &rStartPt, const Point &rEndPt)
virtual void DrawOutDev(const Point &rDestPt, const Size &rDestSize, const Point &rSrcPt, const Size &rSrcSize)
tools::Long GetTextWidth(const OUString &rStr, sal_Int32 nIndex=0, sal_Int32 nLen=-1, vcl::text::TextLayoutCache const *=nullptr, SalLayoutGlyphs const *const pLayoutCache=nullptr) const
Width of the text.
void SetTextColor(const Color &rColor)
virtual bool HasMirroredGraphics() const
void Push(vcl::PushFlags nFlags=vcl::PushFlags::ALL)
tools::Long GetTextHeight() const
Height where any character of the current font fits; in logic coordinates.
std::unique_ptr< SalLayout > ImplLayout(const OUString &, sal_Int32 nIndex, sal_Int32 nLen, const Point &rLogicPos=Point(0, 0), tools::Long nLogicWidth=0, KernArraySpan aKernArray=KernArraySpan(), o3tl::span< const sal_Bool > pKashidaArray={}, SalLayoutFlags flags=SalLayoutFlags::NONE, vcl::text::TextLayoutCache const *=nullptr, const SalLayoutGlyphs *pGlyphs=nullptr) const
bool DrawNativeControl(ControlType nType, ControlPart nPart, const tools::Rectangle &rControlRegion, ControlState nState, const ImplControlValue &aValue, const OUString &aCaption, const Color &rBackgroundColor=COL_AUTO)
Request rendering of a particular control and/or part.
void DrawText(const Point &rStartPt, const OUString &rStr, sal_Int32 nIndex=0, sal_Int32 nLen=-1, std::vector< tools::Rectangle > *pVector=nullptr, OUString *pDisplayText=nullptr, const SalLayoutGlyphs *pLayoutCache=nullptr)
const AllSettings & GetSettings() const
void IntersectClipRegion(const tools::Rectangle &rRect)
bool IsNativeControlSupported(ControlType nType, ControlPart nPart) const
Query the platform layer for control support.
constexpr tools::Long Y() const
void setX(tools::Long nX)
void setY(tools::Long nY)
tools::Long AdjustY(tools::Long nVertMove)
tools::Long AdjustX(tools::Long nHorzMove)
constexpr tools::Long X() const
static SalLayoutGlyphsCache * self()
constexpr tools::Long Height() const
void setHeight(tools::Long nHeight)
constexpr tools::Long Width() const
VclPtr< VirtualDevice > mpVirDev
void SetItemText(sal_uInt16 nItemId, const OUString &rText, int nCharsWidth=-1)
void SetAccessibleName(sal_uInt16 nItemId, const OUString &rName)
SAL_DLLPRIVATE void ImplDrawProgress(vcl::RenderContext &rRenderContext, sal_uInt16 nNewPerc)
void StartProgressMode(const OUString &rText)
void * GetItemData(sal_uInt16 nItemId) const
SAL_DLLPRIVATE void PaintSelfAndChildrenImmediately()
virtual void ApplySettings(vcl::RenderContext &rRenderContext) override
void SetItemCommand(sal_uInt16 nItemId, const OUString &rCommand)
tools::Rectangle GetItemRect(sal_uInt16 nItemId) const
const OUString & GetItemText(sal_uInt16 nItemId) const
SAL_DLLPRIVATE sal_uInt16 ImplGetFirstVisiblePos() const
void InsertItem(sal_uInt16 nItemId, sal_uLong nWidth, StatusBarItemBits nBits=StatusBarItemBits::Center|StatusBarItemBits::In, tools::Long nOffset=STATUSBAR_OFFSET, sal_uInt16 nPos=STATUSBAR_APPEND)
tools::Rectangle maPrgsFrameRect
virtual void Resize() override
void SetHelpText(sal_uInt16 nItemId, const OUString &rText)
SAL_DLLPRIVATE tools::Rectangle ImplGetItemRectPos(sal_uInt16 nPos) const
void SetText(const OUString &rText) override
void ShowItem(sal_uInt16 nItemId)
void HideItem(sal_uInt16 nItemId)
StatusBar(vcl::Window *pParent, WinBits nWinStyle=WB_BORDER|WB_RIGHT)
virtual void RequestHelp(const HelpEvent &rHEvt) override
std::unique_ptr< ImplData > mpImplData
sal_uInt32 mnLastProgressPaint_ms
void SetQuickHelpText(sal_uInt16 nItemId, const OUString &rText)
virtual void dispose() override
This is intended to be used to clear any locally held references to other Window-subclass objects.
sal_uInt16 GetItemId(sal_uInt16 nPos) const
sal_uInt16 GetItemCount() const
void RemoveItem(sal_uInt16 nItemId)
virtual void UserDraw(const UserDrawEvent &rUDEvt)
void AdjustItemWidthsForHiDPI()
virtual void DataChanged(const DataChangedEvent &rDCEvt) override
SAL_DLLPRIVATE void ImplInit(vcl::Window *pParent, WinBits nStyle)
sal_uInt16 mnPercentCount
void RedrawItem(sal_uInt16 nItemId)
StatusBarItemBits GetItemBits(sal_uInt16 nItemId) const
SAL_DLLPRIVATE bool ImplIsItemUpdate() const
sal_uInt16 GetItemPos(sal_uInt16 nItemId) const
SAL_DLLPRIVATE void ImplDrawText(vcl::RenderContext &rRenderContext)
OUString GetItemCommand(sal_uInt16 nItemId)
std::vector< std::unique_ptr< ImplStatusItem > > mvItemList
void SetProgressValue(sal_uInt16 nPercent)
virtual void MouseButtonDown(const MouseEvent &rMEvt) override
tools::Long GetItemOffset(sal_uInt16 nItemId) const
Link< StatusBar *, void > maClickHdl
void SetHelpId(sal_uInt16 nItemId, const OUString &rHelpId)
virtual void StateChanged(StateChangedType nType) override
bool IsItemVisible(sal_uInt16 nItemId) const
SAL_DLLPRIVATE void ImplCalcProgressRect()
virtual void Paint(vcl::RenderContext &rRenderContext, const tools::Rectangle &rRect) override
sal_uLong GetItemWidth(sal_uInt16 nItemId) const
Size CalcWindowSizePixel() const
void SetItemData(sal_uInt16 nItemId, void *pNewData)
Link< StatusBar *, void > maDoubleClickHdl
SAL_DLLPRIVATE void ImplFormat()
Point GetItemTextPos(sal_uInt16 nItemId) const
virtual ~StatusBar() override
SAL_DLLPRIVATE void ImplDrawItem(vcl::RenderContext &rRenderContext, bool bOffScreen, sal_uInt16 nPos)
SAL_DLLPRIVATE void ImplInitSettings()
const Color & GetDarkShadowColor() const
const Color & GetWindowColor() const
const Color & GetShadowColor() const
const Color & GetWindowTextColor() const
const vcl::Font & GetToolFont() const
const Color & GetHighlightColor() const
const Color & GetFaceColor() const
const Color & GetButtonTextColor() const
Event to pass information for UserDraw() handling eg. in comboboxes.
static VclPtr< reference_type > Create(Arg &&... arg)
A construction helper for VclPtr.
ControlPart mnNativeBackground
VclPtr< vcl::Window > mpParent
Point AbsoluteScreenToOutputPixel(const Point &rPos) const
Point OutputToScreenPixel(const Point &rPos) const
const Wallpaper & GetBackground() const
tools::Long GetTextWidth(const OUString &rStr, sal_Int32 nIndex=0, sal_Int32 nLen=-1, vcl::text::TextLayoutCache const *=nullptr, SalLayoutGlyphs const *const pLayoutCache=nullptr) const
Width of the text.
float GetDPIScaleFactor() const
bool IsReallyVisible() const
TextAlign GetTextAlign() const
bool IsPaintTransparent() const
virtual void SetSizePixel(const Size &rNewSize)
const Color & GetControlForeground() const
bool IsUpdateMode() const
bool GetNativeControlRegion(ControlType nType, ControlPart nPart, const tools::Rectangle &rControlRegion, ControlState nState, const ImplControlValue &aValue, tools::Rectangle &rNativeBoundingRegion, tools::Rectangle &rNativeContentRegion) const
Query the native control's actual drawing region (including adornment)
tools::Long GetTextHeight() const
Height where any character of the current font fits; in logic coordinates.
virtual void SetOutputSizePixel(const Size &rNewSize)
bool IsControlForeground() const
bool IsNativeControlSupported(ControlType nType, ControlPart nPart) const
Query the platform layer for control support.
::OutputDevice const * GetOutDev() const
const vcl::Font & GetFont() const
SAL_DLLPRIVATE WindowImpl * ImplGetWindowImpl() const
const Color & GetTextColor() const
bool IsRTLEnabled() const
virtual Size GetSizePixel() const
Size GetOutputSizePixel() const
bool IsControlBackground() const
const Color & GetControlBackground() const
OUString GetAccessibleName() const
void Invalidate(InvalidateFlags nFlags=InvalidateFlags::NONE)
Point OutputToAbsoluteScreenPixel(const Point &rPos) const
void CallEventListeners(VclEventId nEvent, void *pData=nullptr)
virtual OUString GetText() const
void ApplyControlFont(vcl::RenderContext &rRenderContext, const vcl::Font &rDefaultFont)
Point ScreenToOutputPixel(const Point &rPos) const
const OUString & GetQuickHelpText() const
const OUString & GetHelpText() const
void EnableChildTransparentMode(bool bEnable=true)
#define SAL_WARN_IF(condition, area, stream)
css::uno::Reference< css::linguistic2::XProofreadingIterator > get(css::uno::Reference< css::uno::XComponentContext > const &context)
#define STATUSBAR_OFFSET_TEXTY
#define STATUSBAR_OFFSET_X
#define STATUSBAR_MIN_HEIGHT
#define STATUSBAR_PRGS_OFFSET
#define STATUSBAR_PRGS_MIN
void DrawProgress(vcl::Window *pWindow, vcl::RenderContext &rRenderContext, const Point &rPos, tools::Long nOffset, tools::Long nPrgsWidth, tools::Long nPrgsHeight, sal_uInt16 nPercent1, sal_uInt16 nPercent2, sal_uInt16 nPercentCount, const tools::Rectangle &rFramePosSize)
#define STATUSBAR_PRGS_COUNT
#define STATUSBAR_OFFSET_Y
static Point ImplGetItemTextPos(const Size &rRectSize, const Size &rTextSize, StatusBarItemBits nStyle)
static tools::Long ImplCalcProgressWidth(sal_uInt16 nMax, tools::Long nSize)
#define STATUSBAR_ITEM_NOTFOUND
int mnStatusBarLowerRightOffset
bool mbProgressNeedsErase
SalLayoutGlyphs * GetTextGlyphs(const OutputDevice *pOutputDevice)
std::optional< SalLayoutGlyphs > mLayoutGlyphsCache
OUString maAccessibleName
ImplSVData * ImplGetSVData()
@ StatusbarAllItemsRemoved
@ NoErase
The invalidated area is painted with the background color/pattern.
@ Transparent
The parent window is invalidated, too.
@ NoClipChildren
The area is invalidated regardless of overlapping child windows.
@ NoChildren
The child windows are not invalidated.