LibreOffice Module vcl (master) 1
status.cxx
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
21#include <sal/log.hxx>
22#include <comphelper/string.hxx>
23#include <vcl/event.hxx>
24#include <vcl/decoview.hxx>
26#include <vcl/svapp.hxx>
27#include <vcl/help.hxx>
28#include <vcl/vcllayout.hxx>
29#include <vcl/status.hxx>
30#include <vcl/virdev.hxx>
31#include <vcl/settings.hxx>
32#include <config_features.h>
33#include <svdata.hxx>
34#include <window.h>
35
36#define STATUSBAR_OFFSET_X STATUSBAR_OFFSET
37#define STATUSBAR_OFFSET_Y 2
38#define STATUSBAR_OFFSET_TEXTY 3
39
40#define STATUSBAR_PRGS_OFFSET 3
41#define STATUSBAR_PRGS_COUNT 100
42#define STATUSBAR_PRGS_MIN 5
43
45{
46public:
47 ImplData();
48
50};
51
53{
54 mpVirDev = nullptr;
55}
56
58{
59 sal_uInt16 mnId;
65 OUString maText;
66 OUString maHelpText;
68 OString maHelpId;
72 OUString maCommand;
73 std::optional<SalLayoutGlyphs> mLayoutGlyphsCache;
74 SalLayoutGlyphs* GetTextGlyphs(const OutputDevice* pOutputDevice);
75};
76
78{
79 if(!mLayoutGlyphsCache.has_value())
80 {
81 std::unique_ptr<SalLayout> pSalLayout = outputDevice->ImplLayout(
82 maText, 0, -1, Point(0, 0), 0, {}, {}, SalLayoutFlags::GlyphItemsOnly);
83 mLayoutGlyphsCache = pSalLayout ? pSalLayout->GetGlyphs() : SalLayoutGlyphs();
84 }
85 return mLayoutGlyphsCache->IsValid() ? &mLayoutGlyphsCache.value() : nullptr;
86}
87
88static tools::Long ImplCalcProgressWidth( sal_uInt16 nMax, tools::Long nSize )
89{
90 return ((nMax*(nSize+(nSize/2)))-(nSize/2)+(STATUSBAR_PRGS_OFFSET*2));
91}
92
93static Point ImplGetItemTextPos( const Size& rRectSize, const Size& rTextSize,
94 StatusBarItemBits nStyle )
95{
96 tools::Long nX;
97 tools::Long nY;
98 tools::Long delta = (rTextSize.Height()/4) + 1;
99 if( delta + rTextSize.Width() > rRectSize.Width() )
100 delta = 0;
101
102 if ( nStyle & StatusBarItemBits::Left )
103 nX = delta;
104 else if ( nStyle & StatusBarItemBits::Right )
105 nX = rRectSize.Width()-rTextSize.Width()-delta;
106 else // StatusBarItemBits::Center
107 nX = (rRectSize.Width()-rTextSize.Width())/2;
108 nY = (rRectSize.Height()-rTextSize.Height())/2 + 1;
109 return Point( nX, nY );
110}
111
113{
115}
116
118{
119 mpImplData.reset(new ImplData);
120
121 // default: RightAlign
122 if ( !(nStyle & (WB_LEFT | WB_RIGHT)) )
123 nStyle |= WB_RIGHT;
124
125 Window::ImplInit( pParent, nStyle & ~WB_BORDER, nullptr );
126
127 // remember WinBits
129 mnCurItemId = 0;
130 mbFormat = true;
131 mbProgressMode = false;
132 mbInUserDraw = false;
133 mbAdjustHiDPI = false;
135 mnDX = 0;
136 mnDY = 0;
137 mnCalcHeight = 0;
139
141
143}
144
147 mnLastProgressPaint_ms(osl_getGlobalTimer())
148{
149 ImplInit( pParent, nStyle );
150}
151
153{
154 disposeOnce();
155}
156
158{
159 // delete all items
160 mvItemList.clear();
161
162 // delete VirtualDevice
163 mpImplData->mpVirDev.disposeAndClear();
164 mpImplData.reset();
165 Window::dispose();
166}
167
169{
170 mbAdjustHiDPI = true;
171}
172
174{
175 rRenderContext.SetLineColor();
176
177 const StyleSettings& rStyleSettings = rRenderContext.GetSettings().GetStyleSettings();
178 ApplyControlFont(rRenderContext, rStyleSettings.GetToolFont());
179
180 Color aColor;
182 aColor = GetControlForeground();
183 else if (GetStyle() & WB_3DLOOK)
184 aColor = rStyleSettings.GetButtonTextColor();
185 else
186 aColor = rStyleSettings.GetWindowTextColor();
187 rRenderContext.SetTextColor(aColor);
188
189 rRenderContext.SetTextFillColor();
190
192 aColor = GetControlBackground();
193 else if (GetStyle() & WB_3DLOOK)
194 aColor = rStyleSettings.GetFaceColor();
195 else
196 aColor = rStyleSettings.GetWindowColor();
197 rRenderContext.SetBackground(aColor);
198
199 // NWF background
200 if (!IsControlBackground() &&
202 {
205 }
206}
207
209{
211
212 mpImplData->mpVirDev->SetFont(GetFont());
213 mpImplData->mpVirDev->SetTextColor(GetTextColor());
214 mpImplData->mpVirDev->SetTextAlign(GetTextAlign());
215 mpImplData->mpVirDev->SetTextFillColor();
216 mpImplData->mpVirDev->SetBackground(GetBackground());
217}
218
220{
221 tools::Long nExtraWidth;
222 tools::Long nExtraWidth2;
223 tools::Long nX;
224 sal_uInt16 nAutoSizeItems;
225 bool bChanged;
226
227 do {
228 // sum up widths
229 nAutoSizeItems = 0;
231 bChanged = false;
232 tools::Long nOffset = 0;
233 for ( const auto & pItem : mvItemList ) {
234 if ( pItem->mbVisible )
235 {
236 if ( pItem->mnBits & StatusBarItemBits::AutoSize ) {
237 nAutoSizeItems++;
238 }
239
240 mnItemsWidth += pItem->mnWidth + nOffset;
241 nOffset = pItem->mnOffset;
242 }
243 }
244
245 if ( mnDX > 0 && mnDX < mnItemsWidth )
246 {
247 // Total width of items is more than available width
248 // Try to hide secondary elements, if any
249 for ( auto & pItem : mvItemList )
250 {
251 if ( pItem->mbVisible && !(pItem->mnBits & StatusBarItemBits::Mandatory) )
252 {
253 pItem->mbVisible = false;
254 bChanged = true;
255 break;
256 }
257 }
258 }
259 else if ( mnDX > mnItemsWidth )
260 {
261 // Width of statusbar is sufficient.
262 // Try to restore hidden items, if any
263 for ( auto & pItem : mvItemList )
264 {
265 if ( !pItem->mbVisible &&
266 !(pItem->mnBits & StatusBarItemBits::Mandatory) &&
267 pItem->mnWidth + nOffset + mnItemsWidth < mnDX )
268 {
269 pItem->mbVisible = true;
270 bChanged = true;
271 break;
272 }
273 }
274 }
275 } while ( bChanged );
276
277 if ( GetStyle() & WB_RIGHT )
278 {
279 // AutoSize isn't computed for right-alignment,
280 // because we show the text that is declared by SetText on the left side
281 nX = mnDX - mnItemsWidth;
282 nExtraWidth = 0;
283 nExtraWidth2 = 0;
284 }
285 else
286 {
288
289 // calling AutoSize is potentially necessary for left-aligned text,
290 if ( nAutoSizeItems && (mnDX > (mnItemsWidth - STATUSBAR_OFFSET)) )
291 {
292 nExtraWidth = (mnDX - mnItemsWidth - 1) / nAutoSizeItems;
293 nExtraWidth2 = (mnDX - mnItemsWidth - 1) % nAutoSizeItems;
294 }
295 else
296 {
297 nExtraWidth = 0;
298 nExtraWidth2 = 0;
299 }
301
304 }
305
306 for (auto & pItem : mvItemList) {
307 if ( pItem->mbVisible ) {
308 if ( pItem->mnBits & StatusBarItemBits::AutoSize ) {
309 pItem->mnExtraWidth = nExtraWidth;
310 if ( nExtraWidth2 ) {
311 pItem->mnExtraWidth++;
312 nExtraWidth2--;
313 }
314 } else {
315 pItem->mnExtraWidth = 0;
316 }
317
318 pItem->mnX = nX;
319 nX += pItem->mnWidth + pItem->mnExtraWidth + pItem->mnOffset;
320 }
321 }
322
323 mbFormat = false;
324}
325
327{
328 tools::Rectangle aRect;
329 ImplStatusItem* pItem = ( nPos < mvItemList.size() ) ? mvItemList[ nPos ].get() : nullptr;
330 if ( pItem && pItem->mbVisible )
331 {
332 aRect.SetLeft( pItem->mnX );
333 aRect.SetRight( aRect.Left() + pItem->mnWidth + pItem->mnExtraWidth );
334 aRect.SetTop( STATUSBAR_OFFSET_Y );
336 }
337
338 return aRect;
339}
340
342{
343 for( size_t nPos = 0; nPos < mvItemList.size(); nPos++ )
344 {
345 ImplStatusItem* pItem = mvItemList[ nPos ].get();
346 if ( pItem->mbVisible )
347 return sal_uInt16(nPos);
348 }
349
350 return SAL_MAX_UINT16;
351}
352
354{
355 // prevent item box from being overwritten
356 tools::Rectangle aTextRect;
357 aTextRect.SetLeft( STATUSBAR_OFFSET_X + 1 );
358 aTextRect.SetTop( mnTextY );
359 if (GetStyle() & WB_RIGHT)
360 aTextRect.SetRight( mnDX - mnItemsWidth - 1 );
361 else
362 aTextRect.SetRight( mnDX - 1 );
363 if (aTextRect.Right() > aTextRect.Left())
364 {
365 // compute position
366 OUString aStr = GetText();
367 sal_Int32 nPos = aStr.indexOf('\n');
368 if (nPos != -1)
369 aStr = aStr.copy(0, nPos);
370
371 aTextRect.SetBottom( aTextRect.Top()+GetTextHeight()+1 );
372
374 }
375}
376
377void StatusBar::ImplDrawItem(vcl::RenderContext& rRenderContext, bool bOffScreen, sal_uInt16 nPos)
378{
380
381 if (aRect.IsEmpty())
382 return;
383
384 // compute output region
385 ImplStatusItem* pItem = mvItemList[nPos].get();
386 tools::Long nW = 1;
387 tools::Rectangle aTextRect(aRect.Left() + nW, aRect.Top() + nW,
388 aRect.Right() - nW, aRect.Bottom() - nW);
389
390 Size aTextRectSize(aTextRect.GetSize());
391
392 if (bOffScreen)
393 {
394 mpImplData->mpVirDev->SetOutputSizePixel(aTextRectSize);
395 }
396 else
397 {
398 vcl::Region aRegion(aTextRect);
399 rRenderContext.SetClipRegion(aRegion);
400 }
401
402 // if the framework code is drawing status, let it do all the work
403 if (!(pItem->mnBits & StatusBarItemBits::UserDraw))
404 {
405 SalLayoutGlyphs* pGlyphs = pItem->GetTextGlyphs(&rRenderContext);
406 Size aTextSize(rRenderContext.GetTextWidth(pItem->maText,0,-1,nullptr,pGlyphs),
407 rRenderContext.GetTextHeight());
408 Point aTextPos = ImplGetItemTextPos(aTextRectSize, aTextSize, pItem->mnBits);
409
410 if (bOffScreen)
411 {
412 mpImplData->mpVirDev->DrawText(
413 aTextPos,
414 pItem->maText,
415 0, -1, nullptr, nullptr,
416 pGlyphs );
417 }
418 else
419 {
420 aTextPos.AdjustX(aTextRect.Left() );
421 aTextPos.AdjustY(aTextRect.Top() );
422 rRenderContext.DrawText(
423 aTextPos,
424 pItem->maText,
425 0, -1, nullptr, nullptr,
426 pGlyphs );
427 }
428 }
429
430 // call DrawItem if necessary
432 {
433 if (bOffScreen)
434 {
435 mbInUserDraw = true;
436 mpImplData->mpVirDev->EnableRTL( IsRTLEnabled() );
437 UserDrawEvent aODEvt(mpImplData->mpVirDev, tools::Rectangle(Point(), aTextRectSize), pItem->mnId);
438 UserDraw(aODEvt);
439 mpImplData->mpVirDev->EnableRTL(false);
440 mbInUserDraw = false;
441 }
442 else
443 {
444 UserDrawEvent aODEvt(&rRenderContext, aTextRect, pItem->mnId);
445 UserDraw(aODEvt);
446 }
447 }
448
449 if (bOffScreen)
450 rRenderContext.DrawOutDev(aTextRect.TopLeft(), aTextRectSize, Point(), aTextRectSize, *mpImplData->mpVirDev);
451 else
452 rRenderContext.SetClipRegion();
453
455 {
456 // draw separator
457 Point aFrom(aRect.TopLeft());
458 aFrom.AdjustX( -4 );
459 aFrom.AdjustY( 1 );
460 Point aTo(aRect.BottomLeft());
461 aTo.AdjustX( -4 );
462 aTo.AdjustY( -1 );
463
464 DecorationView aDecoView(&rRenderContext);
465 aDecoView.DrawSeparator(aFrom, aTo);
466 }
467
468 if (!rRenderContext.ImplIsRecordLayout())
469 CallEventListeners(VclEventId::StatusbarDrawItem, reinterpret_cast<void*>(pItem->mnId));
470}
471
472void DrawProgress(vcl::Window* pWindow, vcl::RenderContext& rRenderContext, const Point& rPos,
473 tools::Long nOffset, tools::Long nPrgsWidth, tools::Long nPrgsHeight,
474 sal_uInt16 nPercent1, sal_uInt16 nPercent2, sal_uInt16 nPercentCount,
475 const tools::Rectangle& rFramePosSize)
476{
478 {
479 bool bNeedErase = ImplGetSVData()->maNWFData.mbProgressNeedsErase;
480
481 tools::Long nFullWidth = (nPrgsWidth + nOffset) * (10000 / nPercentCount);
482 tools::Long nPerc = std::min<sal_uInt16>(nPercent2, 10000);
483 ImplControlValue aValue(nFullWidth * nPerc / 10000);
484 tools::Rectangle aDrawRect(rPos, Size(nFullWidth, nPrgsHeight));
485 tools::Rectangle aControlRegion(aDrawRect);
486
487 if(bNeedErase)
488 {
489 vcl::Window* pEraseWindow = pWindow;
490 while (pEraseWindow->IsPaintTransparent() && !pEraseWindow->ImplGetWindowImpl()->mbFrame)
491 {
492 pEraseWindow = pEraseWindow->ImplGetWindowImpl()->mpParent;
493 }
494
495 if (pEraseWindow == pWindow)
496 {
497 // restore background of pWindow
498 rRenderContext.Erase(rFramePosSize);
499 }
500 else
501 {
502 // restore transparent background
503 Point aTL(pWindow->OutputToAbsoluteScreenPixel(rFramePosSize.TopLeft()));
504 aTL = pEraseWindow->AbsoluteScreenToOutputPixel(aTL);
505 tools::Rectangle aRect(aTL, rFramePosSize.GetSize());
506 pEraseWindow->Invalidate(aRect, InvalidateFlags::NoChildren |
509 pEraseWindow->PaintImmediately();
510 }
511 rRenderContext.Push(vcl::PushFlags::CLIPREGION);
512 rRenderContext.IntersectClipRegion(rFramePosSize);
513 }
514
515 bool bNativeOK = rRenderContext.DrawNativeControl(ControlType::Progress, ControlPart::Entire, aControlRegion,
516 ControlState::ENABLED, aValue, OUString());
517 if (bNeedErase)
518 rRenderContext.Pop();
519 if (bNativeOK)
520 return;
521 }
522
523 // precompute values
524 sal_uInt16 nPerc1 = nPercent1 / nPercentCount;
525 sal_uInt16 nPerc2 = nPercent2 / nPercentCount;
526
527 if (nPerc1 > nPerc2)
528 {
529 // support progress that can also decrease
530
531 // compute rectangle
532 tools::Long nDX = nPrgsWidth + nOffset;
533 tools::Long nLeft = rPos.X() + ((nPerc1 - 1) * nDX);
534 tools::Rectangle aRect(nLeft, rPos.Y(), nLeft + nPrgsWidth, rPos.Y() + nPrgsHeight);
535
536 do
537 {
538 rRenderContext.Erase(aRect);
539 aRect.AdjustLeft( -nDX );
540 aRect.AdjustRight( -nDX );
541 nPerc1--;
542 }
543 while (nPerc1 > nPerc2);
544 }
545 else if (nPerc1 < nPerc2)
546 {
547 // draw Percent rectangle
548 // if Percent2 greater than 100%, adapt values
549 if (nPercent2 > 10000)
550 {
551 nPerc2 = 10000 / nPercentCount;
552 if (nPerc1 >= nPerc2)
553 nPerc1 = nPerc2 - 1;
554 }
555
556 // compute rectangle
557 tools::Long nDX = nPrgsWidth + nOffset;
558 tools::Long nLeft = rPos.X() + (nPerc1 * nDX);
559 tools::Rectangle aRect(nLeft, rPos.Y(), nLeft + nPrgsWidth, rPos.Y() + nPrgsHeight);
560
561 do
562 {
563 rRenderContext.DrawRect(aRect);
564 aRect.AdjustLeft(nDX );
565 aRect.AdjustRight(nDX );
566 nPerc1++;
567 }
568 while (nPerc1 < nPerc2);
569
570 // if greater than 100%, set rectangle to blink
571 if (nPercent2 > 10000)
572 {
573 // define on/off status
574 if (((nPercent2 / nPercentCount) & 0x01) == (nPercentCount & 0x01))
575 {
576 aRect.AdjustLeft( -nDX );
577 aRect.AdjustRight( -nDX );
578 rRenderContext.Erase(aRect);
579 }
580 }
581 }
582}
583
584void StatusBar::ImplDrawProgress(vcl::RenderContext& rRenderContext, sal_uInt16 nPercent2)
585{
587 // bPaint: draw text also, else only update progress
588 rRenderContext.DrawText(maPrgsTxtPos, maPrgsTxt);
589 if (!bNative)
590 {
591 DecorationView aDecoView(&rRenderContext);
593 }
594
597 tools::Long nPrgsHeight = mnPrgsSize;
598 if (bNative)
599 {
600 aPos = maPrgsFrameRect.TopLeft();
601 nPrgsHeight = maPrgsFrameRect.GetHeight();
602 }
603 DrawProgress(this, rRenderContext, aPos, mnPrgsSize / 2, mnPrgsSize, nPrgsHeight,
604 0, nPercent2 * 100, mnPercentCount, maPrgsFrameRect);
605}
606
608{
609 // calculate text size
610 Size aPrgsTxtSize( GetTextWidth( maPrgsTxt ), GetTextHeight() );
612
613 // calculate progress frame
617
618 // calculate size of progress rects
620 sal_uInt16 nMaxPercent = STATUSBAR_PRGS_COUNT;
621
622 tools::Long nMaxWidth = mnDX-STATUSBAR_OFFSET-1;
623
624 // make smaller if there are too many rects
625 while ( maPrgsFrameRect.Left()+ImplCalcProgressWidth( nMaxPercent, mnPrgsSize ) > nMaxWidth )
626 {
627 nMaxPercent--;
628 if ( nMaxPercent <= STATUSBAR_PRGS_MIN )
629 break;
630 }
632
633 // save the divisor for later
634 mnPercentCount = 10000 / nMaxPercent;
635 bool bNativeOK = false;
637 {
638 ImplControlValue aValue;
640 tools::Rectangle aNativeControlRegion, aNativeContentRegion;
641 if( (bNativeOK = GetNativeControlRegion( ControlType::Progress, ControlPart::Entire, aControlRegion,
642 ControlState::ENABLED, aValue,
643 aNativeControlRegion, aNativeContentRegion ) ) )
644 {
645 tools::Long nProgressHeight = aNativeControlRegion.GetHeight();
646 if( nProgressHeight > maPrgsFrameRect.GetHeight() )
647 {
648 tools::Long nDelta = nProgressHeight - maPrgsFrameRect.GetHeight();
649 maPrgsFrameRect.AdjustTop( -(nDelta - nDelta/2) );
650 maPrgsFrameRect.AdjustBottom(nDelta/2 );
651 }
652 maPrgsTxtPos.setY( maPrgsFrameRect.Top() + (nProgressHeight - GetTextHeight())/2 );
653 }
654 }
655 if( ! bNativeOK )
656 maPrgsTxtPos.setY( mnTextY );
657}
658
660{
661 // trigger toolbox only for left mouse button
662 if ( !rMEvt.IsLeft() )
663 return;
664
665 Point aMousePos = rMEvt.GetPosPixel();
666
667 // search for clicked item
668 for ( size_t i = 0; i < mvItemList.size(); ++i )
669 {
670 ImplStatusItem* pItem = mvItemList[ i ].get();
671 // check item for being clicked
672 if ( ImplGetItemRectPos( sal_uInt16(i) ).Contains( aMousePos ) )
673 {
674 mnCurItemId = pItem->mnId;
675 if ( rMEvt.GetClicks() == 2 )
676 DoubleClick();
677 else
678 Click();
679 mnCurItemId = 0;
680
681 // Item found
682 return;
683 }
684 }
685
686 // if there's no item, trigger Click or DoubleClick
687 if ( rMEvt.GetClicks() == 2 )
688 DoubleClick();
689 else
690 Click();
691}
692
693void StatusBar::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect)
694{
695 if (mbFormat)
696 ImplFormat();
697
698 sal_uInt16 nItemCount = sal_uInt16( mvItemList.size() );
699
700 if (mbProgressMode)
701 {
703
704 const StyleSettings& rStyleSettings = rRenderContext.GetSettings().GetStyleSettings();
705 Color aProgressColor = rStyleSettings.GetHighlightColor();
706 if (aProgressColor == rStyleSettings.GetFaceColor())
707 aProgressColor = rStyleSettings.GetDarkShadowColor();
708 rRenderContext.SetLineColor();
709 rRenderContext.SetFillColor(aProgressColor);
710
711 ImplDrawProgress(rRenderContext, mnPercent);
712
713 rRenderContext.Pop();
714 }
715 else
716 {
717 // draw text
718 if (GetStyle() & WB_RIGHT)
719 ImplDrawText(rRenderContext);
720
721 // draw items
722
723 // Do offscreen only when we are not recording layout...
724 bool bOffscreen = !rRenderContext.ImplIsRecordLayout();
725
726 if (!bOffscreen)
727 rRenderContext.Erase(rRect);
728
729 for (sal_uInt16 i = 0; i < nItemCount; i++)
730 ImplDrawItem(rRenderContext, bOffscreen, i);
731 }
732
733 // draw line at the top of the status bar (to visually distinguish it from
734 // shell / docking area)
735 const StyleSettings& rStyleSettings = rRenderContext.GetSettings().GetStyleSettings();
736 rRenderContext.SetLineColor(rStyleSettings.GetShadowColor());
737 rRenderContext.DrawLine(Point(0, 0), Point(mnDX-1, 0));
738}
739
741{
742 // save width and height
743 Size aSize = GetOutputSizePixel();
745 mnDY = aSize.Height();
747
749
750 // provoke re-formatting
751 mbFormat = true;
752
753 if ( mbProgressMode )
755
756 Invalidate();
757}
758
760{
761 // no keyboard help in status bar
762 if( rHEvt.KeyboardActivated() )
763 return;
764
765 sal_uInt16 nItemId = GetItemId( ScreenToOutputPixel( rHEvt.GetMousePosPixel() ) );
766
767 if ( nItemId )
768 {
769 tools::Rectangle aItemRect = GetItemRect( nItemId );
770 Point aPt = OutputToScreenPixel( aItemRect.TopLeft() );
771 aItemRect.SetLeft( aPt.X() );
772 aItemRect.SetTop( aPt.Y() );
773 aPt = OutputToScreenPixel( aItemRect.BottomRight() );
774 aItemRect.SetRight( aPt.X() );
775 aItemRect.SetBottom( aPt.Y() );
776
777 if ( rHEvt.GetMode() & HelpEventMode::BALLOON )
778 {
779 OUString aStr = GetHelpText( nItemId );
780 Help::ShowBalloon( this, aItemRect.Center(), aItemRect, aStr );
781 return;
782 }
783 else if ( rHEvt.GetMode() & HelpEventMode::QUICK )
784 {
785 OUString aStr(GetQuickHelpText(nItemId));
786 // show quickhelp if available
787 if (!aStr.isEmpty())
788 {
789 Help::ShowQuickHelp( this, aItemRect, aStr );
790 return;
791 }
792 aStr = GetItemText( nItemId );
793 // show a quick help if item text doesn't fit
794 if ( GetTextWidth( aStr ) > aItemRect.GetWidth() )
795 {
796 Help::ShowQuickHelp( this, aItemRect, aStr );
797 return;
798 }
799 }
800 }
801
802 Window::RequestHelp( rHEvt );
803}
804
806{
807 Window::StateChanged( nType );
808
810 ImplFormat();
812 Invalidate();
813 else if ( (nType == StateChangedType::Zoom) ||
815 {
816 mbFormat = true;
818 Invalidate();
819 }
821 {
823 Invalidate();
824 }
826 {
828 Invalidate();
829 }
830
831 //invalidate layout cache
832 for (auto & pItem : mvItemList)
833 {
834 pItem->mLayoutGlyphsCache.reset();
835 }
836
837}
838
840{
841 Window::DataChanged( rDCEvt );
842
843 if ( !((rDCEvt.GetType() == DataChangedEventType::DISPLAY )
844 || (rDCEvt.GetType() == DataChangedEventType::FONTS )
846 || ( (rDCEvt.GetType() == DataChangedEventType::SETTINGS)
847 && (rDCEvt.GetFlags() & AllSettingsFlags::STYLE )
848 ))
849 )
850 return;
851
852 mbFormat = true;
854 tools::Long nFudge = GetTextHeight() / 4;
855 for (auto & pItem : mvItemList)
856 {
857 tools::Long nWidth = GetTextWidth( pItem->maText ) + nFudge;
858 if( nWidth > pItem->mnWidth + STATUSBAR_OFFSET )
859 pItem->mnWidth = nWidth + STATUSBAR_OFFSET;
860
861 pItem->mLayoutGlyphsCache.reset();
862 }
863 Size aSize = GetSizePixel();
864 // do not disturb current width, since
865 // CalcWindowSizePixel calculates a minimum width
867 SetSizePixel( aSize );
868 Invalidate();
869}
870
872{
873 maClickHdl.Call( this );
874}
875
877{
878 maDoubleClickHdl.Call( this );
879}
880
882{
883}
884
885void StatusBar::InsertItem( sal_uInt16 nItemId, sal_uLong nWidth,
886 StatusBarItemBits nBits,
887 tools::Long nOffset, sal_uInt16 nPos )
888{
889 SAL_WARN_IF( !nItemId, "vcl", "StatusBar::InsertItem(): ItemId == 0" );
890 SAL_WARN_IF( GetItemPos( nItemId ) != STATUSBAR_ITEM_NOTFOUND, "vcl",
891 "StatusBar::InsertItem(): ItemId already exists" );
892
893 // default: IN and CENTER
895 nBits |= StatusBarItemBits::In;
898
899 // create item
900 if (mbAdjustHiDPI)
901 {
902 nWidth *= GetDPIScaleFactor();
903 }
904 tools::Long nFudge = GetTextHeight()/4;
905 std::unique_ptr<ImplStatusItem> pItem(new ImplStatusItem);
906 pItem->mnId = nItemId;
907 pItem->mnBits = nBits;
908 pItem->mnWidth = static_cast<tools::Long>(nWidth)+nFudge+STATUSBAR_OFFSET;
909 pItem->mnOffset = nOffset;
910 pItem->mpUserData = nullptr;
911 pItem->mbVisible = true;
912
913 // add item to list
914 if ( nPos < mvItemList.size() ) {
915 mvItemList.insert( mvItemList.begin() + nPos, std::move(pItem) );
916 } else {
917 mvItemList.push_back( std::move(pItem) );
918 }
919
920 mbFormat = true;
921 if ( ImplIsItemUpdate() )
922 Invalidate();
923
924 CallEventListeners( VclEventId::StatusbarItemAdded, reinterpret_cast<void*>(nItemId) );
925}
926
927void StatusBar::RemoveItem( sal_uInt16 nItemId )
928{
929 sal_uInt16 nPos = GetItemPos( nItemId );
931 {
932 mvItemList.erase( mvItemList.begin() + nPos );
933
934 mbFormat = true;
935 if ( ImplIsItemUpdate() )
936 Invalidate();
937
938 CallEventListeners( VclEventId::StatusbarItemRemoved, reinterpret_cast<void*>(nItemId) );
939 }
940}
941
942void StatusBar::ShowItem( sal_uInt16 nItemId )
943{
944 sal_uInt16 nPos = GetItemPos( nItemId );
945
947 return;
948
949 ImplStatusItem* pItem = mvItemList[ nPos ].get();
950 if ( !pItem->mbVisible )
951 {
952 pItem->mbVisible = true;
953
954 mbFormat = true;
955 if ( ImplIsItemUpdate() )
956 Invalidate();
957
958 CallEventListeners( VclEventId::StatusbarShowItem, reinterpret_cast<void*>(nItemId) );
959 }
960}
961
962void StatusBar::HideItem( sal_uInt16 nItemId )
963{
964 sal_uInt16 nPos = GetItemPos( nItemId );
965
967 return;
968
969 ImplStatusItem* pItem = mvItemList[ nPos ].get();
970 if ( pItem->mbVisible )
971 {
972 pItem->mbVisible = false;
973
974 mbFormat = true;
975 if ( ImplIsItemUpdate() )
976 Invalidate();
977
978 CallEventListeners( VclEventId::StatusbarHideItem, reinterpret_cast<void*>(nItemId) );
979 }
980}
981
982bool StatusBar::IsItemVisible( sal_uInt16 nItemId ) const
983{
984 sal_uInt16 nPos = GetItemPos( nItemId );
985
987 return mvItemList[ nPos ]->mbVisible;
988 else
989 return false;
990}
991
993{
994 // delete all items
995 mvItemList.clear();
996
997 mbFormat = true;
998 if ( ImplIsItemUpdate() )
999 Invalidate();
1000
1002}
1003
1004sal_uInt16 StatusBar::GetItemCount() const
1005{
1006 return static_cast<sal_uInt16>(mvItemList.size());
1007}
1008
1009sal_uInt16 StatusBar::GetItemId( sal_uInt16 nPos ) const
1010{
1011 if ( nPos < mvItemList.size() )
1012 return mvItemList[ nPos ]->mnId;
1013 return 0;
1014}
1015
1016sal_uInt16 StatusBar::GetItemPos( sal_uInt16 nItemId ) const
1017{
1018 for ( size_t i = 0, n = mvItemList.size(); i < n; ++i ) {
1019 if ( mvItemList[ i ]->mnId == nItemId ) {
1020 return sal_uInt16( i );
1021 }
1022 }
1023
1025}
1026
1027sal_uInt16 StatusBar::GetItemId( const Point& rPos ) const
1028{
1029 if ( !mbFormat )
1030 {
1031 sal_uInt16 nItemCount = GetItemCount();
1032 sal_uInt16 nPos;
1033 for ( nPos = 0; nPos < nItemCount; nPos++ )
1034 {
1035 // get rectangle
1037 if ( aRect.Contains( rPos ) )
1038 return mvItemList[ nPos ]->mnId;
1039 }
1040 }
1041
1042 return 0;
1043}
1044
1045tools::Rectangle StatusBar::GetItemRect( sal_uInt16 nItemId ) const
1046{
1047 tools::Rectangle aRect;
1048
1049 if ( !mbFormat )
1050 {
1051 sal_uInt16 nPos = GetItemPos( nItemId );
1053 {
1054 // get rectangle and subtract frame
1055 aRect = ImplGetItemRectPos( nPos );
1056 tools::Long nW = 1;
1057 aRect.AdjustTop(nW-1 );
1058 aRect.AdjustBottom( -(nW-1) );
1059 aRect.AdjustLeft(nW );
1060 aRect.AdjustRight( -nW );
1061 return aRect;
1062 }
1063 }
1064
1065 return aRect;
1066}
1067
1068Point StatusBar::GetItemTextPos( sal_uInt16 nItemId ) const
1069{
1070 if ( !mbFormat )
1071 {
1072 sal_uInt16 nPos = GetItemPos( nItemId );
1074 {
1075 // get rectangle
1076 ImplStatusItem* pItem = mvItemList[ nPos ].get();
1078 tools::Long nW = 1;
1079 tools::Rectangle aTextRect( aRect.Left()+nW, aRect.Top()+nW,
1080 aRect.Right()-nW, aRect.Bottom()-nW );
1081 Point aPos = ImplGetItemTextPos( aTextRect.GetSize(),
1082 Size( GetTextWidth( pItem->maText ), GetTextHeight() ),
1083 pItem->mnBits );
1084 if ( !mbInUserDraw )
1085 {
1086 aPos.AdjustX(aTextRect.Left() );
1087 aPos.AdjustY(aTextRect.Top() );
1088 }
1089 return aPos;
1090 }
1091 }
1092
1093 return Point();
1094}
1095
1096sal_uLong StatusBar::GetItemWidth( sal_uInt16 nItemId ) const
1097{
1098 sal_uInt16 nPos = GetItemPos( nItemId );
1099
1101 return mvItemList[ nPos ]->mnWidth;
1102
1103 return 0;
1104}
1105
1107{
1108 sal_uInt16 nPos = GetItemPos( nItemId );
1109
1111 return mvItemList[ nPos ]->mnBits;
1112
1114}
1115
1116tools::Long StatusBar::GetItemOffset( sal_uInt16 nItemId ) const
1117{
1118 sal_uInt16 nPos = GetItemPos( nItemId );
1119
1121 return mvItemList[ nPos ]->mnOffset;
1122
1123 return 0;
1124}
1125
1127{
1128 WindowImpl* pWindowImpl = ImplGetWindowImpl();
1129 const bool bOrigOverlapWin = pWindowImpl->mbOverlapWin;
1130 // Temporarily set mbOverlapWin so that any parent windows of StatusBar
1131 // that happen to have accumulated Invalidates are not taken as the root
1132 // paint candidate from which to paint the paint hierarchy. So we limit the
1133 // paint here to this statusbar and its children, disabling the
1134 // optimization to bundle pending paints together and suppressing any
1135 // unexpected side effects of entering parent window paint handlers if this
1136 // call is not from the primordial thread.
1137 pWindowImpl->mbOverlapWin = true;
1139 pWindowImpl->mbOverlapWin = bOrigOverlapWin;
1140}
1141
1142void StatusBar::SetItemText( sal_uInt16 nItemId, const OUString& rText, int nCharsWidth )
1143{
1144 sal_uInt16 nPos = GetItemPos( nItemId );
1145
1147 return;
1148
1149 ImplStatusItem* pItem = mvItemList[ nPos ].get();
1150
1151 if ( pItem->maText == rText )
1152 return;
1153
1154 pItem->maText = rText;
1155
1156 // adjust item width - see also DataChanged()
1157 tools::Long nFudge = GetTextHeight()/4;
1158
1159 tools::Long nWidth;
1160 if (nCharsWidth != -1)
1161 {
1162 nWidth = GetTextWidth("0",0,-1,nullptr,
1163 SalLayoutGlyphsCache::self()->GetLayoutGlyphs(GetOutDev(),"0"));
1164 nWidth = nWidth * nCharsWidth + nFudge;
1165 }
1166 else
1167 {
1168 pItem->mLayoutGlyphsCache.reset();
1169 nWidth = GetTextWidth( pItem->maText,0,-1,nullptr, pItem->GetTextGlyphs(GetOutDev())) + nFudge;
1170 }
1171
1172 if( (nWidth > pItem->mnWidth + STATUSBAR_OFFSET) ||
1173 ((nWidth < pItem->mnWidth) && (mnDX - STATUSBAR_OFFSET) < mnItemsWidth ))
1174 {
1175 pItem->mnWidth = nWidth + STATUSBAR_OFFSET;
1176 ImplFormat();
1177 Invalidate();
1178 }
1179
1180 // re-draw item if StatusBar is visible and UpdateMode active
1181 if ( pItem->mbVisible && !mbFormat && ImplIsItemUpdate() )
1182 {
1184 Invalidate(aRect);
1186 }
1187}
1188
1189const OUString& StatusBar::GetItemText( sal_uInt16 nItemId ) const
1190{
1191 sal_uInt16 nPos = GetItemPos( nItemId );
1192
1193 assert( nPos != STATUSBAR_ITEM_NOTFOUND );
1194
1195 return mvItemList[ nPos ]->maText;
1196}
1197
1198void StatusBar::SetItemCommand( sal_uInt16 nItemId, const OUString& rCommand )
1199{
1200 sal_uInt16 nPos = GetItemPos( nItemId );
1201
1203 {
1204 ImplStatusItem* pItem = mvItemList[ nPos ].get();
1205
1206 if ( pItem->maCommand != rCommand )
1207 pItem->maCommand = rCommand;
1208 }
1209}
1210
1211OUString StatusBar::GetItemCommand( sal_uInt16 nItemId )
1212{
1213 sal_uInt16 nPos = GetItemPos( nItemId );
1214
1216 return mvItemList[ nPos ]->maCommand;
1217
1218 return OUString();
1219}
1220
1221void StatusBar::SetItemData( sal_uInt16 nItemId, void* pNewData )
1222{
1223 sal_uInt16 nPos = GetItemPos( nItemId );
1224
1226 return;
1227
1228 ImplStatusItem* pItem = mvItemList[ nPos ].get();
1229 // invalidate cache
1230 pItem->mLayoutGlyphsCache.reset();
1231 pItem->mpUserData = pNewData;
1232
1233 // call Draw-Item if it's a User-Item
1234 if ( (pItem->mnBits & StatusBarItemBits::UserDraw) && pItem->mbVisible &&
1236 {
1240 }
1241}
1242
1243void* StatusBar::GetItemData( sal_uInt16 nItemId ) const
1244{
1245 sal_uInt16 nPos = GetItemPos( nItemId );
1246
1248 return mvItemList[ nPos ]->mpUserData;
1249
1250 return nullptr;
1251}
1252
1253void StatusBar::RedrawItem(sal_uInt16 nItemId)
1254{
1255 if ( mbFormat )
1256 return;
1257
1258 sal_uInt16 nPos = GetItemPos(nItemId);
1260 return;
1261
1262 ImplStatusItem* pItem = mvItemList[ nPos ].get();
1263 if ((pItem->mnBits & StatusBarItemBits::UserDraw) &&
1264 pItem->mbVisible && ImplIsItemUpdate())
1265 {
1267 Invalidate(aRect);
1269 }
1270}
1271
1272void StatusBar::SetHelpText( sal_uInt16 nItemId, const OUString& rText )
1273{
1274 sal_uInt16 nPos = GetItemPos( nItemId );
1275
1277 mvItemList[ nPos ]->maHelpText = rText;
1278}
1279
1280const OUString& StatusBar::GetHelpText( sal_uInt16 nItemId ) const
1281{
1282 sal_uInt16 nPos = GetItemPos( nItemId );
1283
1284 assert ( nPos != STATUSBAR_ITEM_NOTFOUND );
1285
1286 ImplStatusItem* pItem = mvItemList[ nPos ].get();
1287 if ( pItem->maHelpText.isEmpty() && ( !pItem->maHelpId.isEmpty() || !pItem->maCommand.isEmpty() ))
1288 {
1289 Help* pHelp = Application::GetHelp();
1290 if ( pHelp )
1291 {
1292 if ( !pItem->maCommand.isEmpty() )
1293 pItem->maHelpText = pHelp->GetHelpText( pItem->maCommand, this );
1294 if ( pItem->maHelpText.isEmpty() && !pItem->maHelpId.isEmpty() )
1295 pItem->maHelpText = pHelp->GetHelpText( OStringToOUString( pItem->maHelpId, RTL_TEXTENCODING_UTF8 ), this );
1296 }
1297 }
1298
1299 return pItem->maHelpText;
1300}
1301
1302void StatusBar::SetQuickHelpText( sal_uInt16 nItemId, const OUString& rText )
1303{
1304 sal_uInt16 nPos = GetItemPos( nItemId );
1305
1307 mvItemList[ nPos ]->maQuickHelpText = rText;
1308}
1309
1310const OUString& StatusBar::GetQuickHelpText( sal_uInt16 nItemId ) const
1311{
1312 sal_uInt16 nPos = GetItemPos( nItemId );
1313
1314 assert ( nPos != STATUSBAR_ITEM_NOTFOUND );
1315
1316 ImplStatusItem* pItem = mvItemList[ nPos ].get();
1317 return pItem->maQuickHelpText;
1318}
1319
1320void StatusBar::SetHelpId( sal_uInt16 nItemId, const OString& rHelpId )
1321{
1322 sal_uInt16 nPos = GetItemPos( nItemId );
1323
1325 mvItemList[ nPos ]->maHelpId = rHelpId;
1326}
1327
1328void StatusBar::StartProgressMode( const OUString& rText )
1329{
1330 SAL_WARN_IF( mbProgressMode, "vcl", "StatusBar::StartProgressMode(): progress mode is active" );
1331
1332 mbProgressMode = true;
1333 mnPercent = 0;
1334 maPrgsTxt = rText;
1335
1336 // compute size
1338
1339 // trigger Paint, which draws text and frame
1340 if ( IsReallyVisible() )
1341 {
1342 Invalidate();
1344 }
1345}
1346
1347void StatusBar::SetProgressValue( sal_uInt16 nNewPercent )
1348{
1349 SAL_WARN_IF( !mbProgressMode, "vcl", "StatusBar::SetProgressValue(): no progress mode" );
1350 SAL_WARN_IF( nNewPercent > 100, "vcl", "StatusBar::SetProgressValue(): nPercent > 100" );
1351
1352 bool bInvalidate = mbProgressMode && IsReallyVisible() && (!mnPercent || (mnPercent != nNewPercent));
1353
1354 mnPercent = nNewPercent;
1355
1356 if (bInvalidate)
1357 {
1358 // Rate limit how often we paint, otherwise in some loading scenarios we can spend significant
1359 // time just painting progress bars.
1360 sal_uInt32 nTime_ms = osl_getGlobalTimer();
1361 if ((nTime_ms - mnLastProgressPaint_ms) > 100)
1362 {
1365 mnLastProgressPaint_ms = nTime_ms;
1366 }
1367 }
1368}
1369
1371{
1372 SAL_WARN_IF( !mbProgressMode, "vcl", "StatusBar::EndProgressMode(): no progress mode" );
1373
1374 mbProgressMode = false;
1375 maPrgsTxt.clear();
1376
1377 if ( IsReallyVisible() )
1378 {
1379 Invalidate();
1381 }
1382}
1383
1384void StatusBar::SetText(const OUString& rText)
1385{
1387 {
1388 if (mbFormat)
1389 {
1390 Invalidate();
1391 Window::SetText(rText);
1392 }
1393 else
1394 {
1395 Invalidate();
1396 Window::SetText(rText);
1398 }
1399 }
1400 else if (mbProgressMode)
1401 {
1402 maPrgsTxt = rText;
1403 if (IsReallyVisible())
1404 {
1405 Invalidate();
1407 }
1408 }
1409 else
1410 {
1411 Window::SetText(rText);
1412 }
1413}
1414
1416{
1417 size_t i = 0;
1418 size_t nCount = mvItemList.size();
1419 tools::Long nOffset = 0;
1420 tools::Long nCalcWidth = STATUSBAR_OFFSET_X*2;
1421 tools::Long nCalcHeight;
1422
1423 while ( i < nCount )
1424 {
1425 ImplStatusItem* pItem = mvItemList[ i ].get();
1426 nCalcWidth += pItem->mnWidth + nOffset;
1427 nOffset = pItem->mnOffset;
1428 i++;
1429 }
1430
1431 tools::Long nMinHeight = GetTextHeight();
1432 const tools::Long nBarTextOffset = STATUSBAR_OFFSET_TEXTY*2;
1433 tools::Long nProgressHeight = nMinHeight + nBarTextOffset;
1434
1436 {
1437 ImplControlValue aValue;
1438 tools::Rectangle aControlRegion( Point(), Size( nCalcWidth, nMinHeight ) );
1439 tools::Rectangle aNativeControlRegion, aNativeContentRegion;
1441 aControlRegion, ControlState::ENABLED, aValue,
1442 aNativeControlRegion, aNativeContentRegion ) )
1443 {
1444 nProgressHeight = aNativeControlRegion.GetHeight();
1445 }
1446 }
1447
1448 nCalcHeight = nMinHeight+nBarTextOffset;
1449 if( nCalcHeight < nProgressHeight+2 )
1450 nCalcHeight = nProgressHeight+2;
1451
1452 return Size( nCalcWidth, nCalcHeight );
1453}
1454
1455void StatusBar::SetAccessibleName( sal_uInt16 nItemId, const OUString& rName )
1456{
1457 sal_uInt16 nPos = GetItemPos( nItemId );
1458
1460 {
1461 ImplStatusItem* pItem = mvItemList[ nPos ].get();
1462
1463 if ( pItem->maAccessibleName != rName )
1464 {
1465 pItem->maAccessibleName = rName;
1466 CallEventListeners( VclEventId::StatusbarNameChanged, reinterpret_cast<void*>(pItem->mnId) );
1467 }
1468 }
1469}
1470
1471const OUString& StatusBar::GetAccessibleName( sal_uInt16 nItemId ) const
1472{
1473 sal_uInt16 nPos = GetItemPos( nItemId );
1474
1475 assert ( nPos != STATUSBAR_ITEM_NOTFOUND );
1476
1477 return mvItemList[ nPos ]->maAccessibleName;
1478}
1479
1480/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Text maText
const StyleSettings & GetStyleSettings() const
static Help * GetHelp()
Gets the application's help.
Definition: svapp.cxx:1484
DataChangedEventType GetType() const
Definition: event.hxx:362
AllSettingsFlags GetFlags() const
Definition: event.hxx:363
void DrawFrame(const tools::Rectangle &rRect, const Color &rLeftTopColor, const Color &rRightBottomColor)
Definition: decoview.cxx:811
void DrawSeparator(const Point &rStart, const Point &rStop, bool bVertical=true)
Definition: decoview.cxx:980
HelpEventMode GetMode() const
Definition: event.hxx:208
bool KeyboardActivated() const
Definition: event.hxx:209
const Point & GetMousePosPixel() const
Definition: event.hxx:207
Definition: help.hxx:61
virtual OUString GetHelpText(const OUString &aHelpURL, const weld::Widget *pWidget)
Definition: help.cxx:72
static void ShowQuickHelp(vcl::Window *pParent, const tools::Rectangle &rScreenRect, const OUString &rHelpText, QuickHelpFlags nStyle=QuickHelpFlags::NONE)
Definition: help.cxx:180
static void ShowBalloon(vcl::Window *pParent, const Point &rScreenPos, const tools::Rectangle &, const OUString &rHelpText)
Definition: help.cxx:157
sal_uInt16 GetClicks() const
Definition: event.hxx:126
const Point & GetPosPixel() const
Definition: event.hxx:123
bool IsLeft() const
Definition: event.hxx:149
Some things multiple-inherit from VclAbstractDialog and OutputDevice, so we need to use virtual inher...
Definition: outdev.hxx:170
SAL_DLLPRIVATE bool ImplIsRecordLayout() const
Definition: outdev.cxx:708
void DrawRect(const tools::Rectangle &rRect)
Definition: rect.cxx:50
void DrawLine(const Point &rStartPt, const Point &rEndPt)
Definition: line.cxx:161
void SetLineColor()
Definition: line.cxx:37
virtual void DrawOutDev(const Point &rDestPt, const Size &rDestSize, const Point &rSrcPt, const Size &rSrcSize)
Definition: outdev.cxx:417
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.
Definition: text.cxx:886
void SetTextColor(const Color &rColor)
Definition: text.cxx:716
void SetFillColor()
Definition: fill.cxx:29
virtual bool HasMirroredGraphics() const
Definition: outdev.cxx:703
void SetTextFillColor()
Definition: text.cxx:734
void Erase()
Definition: wallpaper.cxx:96
void Push(vcl::PushFlags nFlags=vcl::PushFlags::ALL)
Definition: stack.cxx:32
tools::Long GetTextHeight() const
Height where any character of the current font fits; in logic coordinates.
Definition: text.cxx:897
void SetBackground()
Definition: background.cxx:27
void Pop()
Definition: stack.cxx:91
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
Definition: text.cxx:1302
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)
Definition: text.cxx:797
const AllSettings & GetSettings() const
Definition: outdev.hxx:288
void IntersectClipRegion(const tools::Rectangle &rRect)
bool IsNativeControlSupported(ControlType nType, ControlPart nPart) const
Query the platform layer for control support.
static SalLayoutGlyphsCache * self()
constexpr tools::Long Height() const
void setHeight(tools::Long nHeight)
constexpr tools::Long Width() const
VclPtr< VirtualDevice > mpVirDev
Definition: status.cxx:49
Point maPrgsTxtPos
Definition: status.hxx:71
bool mbFormat
Definition: status.hxx:83
bool mbInUserDraw
Definition: status.hxx:85
void SetHelpId(sal_uInt16 nItemId, const OString &rHelpId)
Definition: status.cxx:1320
void SetItemText(sal_uInt16 nItemId, const OUString &rText, int nCharsWidth=-1)
Definition: status.cxx:1142
void SetAccessibleName(sal_uInt16 nItemId, const OUString &rName)
Definition: status.cxx:1455
SAL_DLLPRIVATE void ImplDrawProgress(vcl::RenderContext &rRenderContext, sal_uInt16 nNewPerc)
Definition: status.cxx:584
bool mbProgressMode
Definition: status.hxx:84
void StartProgressMode(const OUString &rText)
Definition: status.cxx:1328
void * GetItemData(sal_uInt16 nItemId) const
Definition: status.cxx:1243
SAL_DLLPRIVATE void PaintSelfAndChildrenImmediately()
Definition: status.cxx:1126
virtual void ApplySettings(vcl::RenderContext &rRenderContext) override
Definition: status.cxx:173
tools::Long mnPrgsSize
Definition: status.hxx:73
sal_uInt16 mnPercent
Definition: status.hxx:80
void SetItemCommand(sal_uInt16 nItemId, const OUString &rCommand)
Definition: status.cxx:1198
tools::Rectangle GetItemRect(sal_uInt16 nItemId) const
Definition: status.cxx:1045
const OUString & GetItemText(sal_uInt16 nItemId) const
Definition: status.cxx:1189
tools::Long mnDX
Definition: status.hxx:75
tools::Long mnTextY
Definition: status.hxx:78
SAL_DLLPRIVATE sal_uInt16 ImplGetFirstVisiblePos() const
Definition: status.cxx:341
void InsertItem(sal_uInt16 nItemId, sal_uLong nWidth, StatusBarItemBits nBits=StatusBarItemBits::Center|StatusBarItemBits::In, tools::Long nOffset=STATUSBAR_OFFSET, sal_uInt16 nPos=STATUSBAR_APPEND)
Definition: status.cxx:885
tools::Rectangle maPrgsFrameRect
Definition: status.hxx:72
virtual void Resize() override
Definition: status.cxx:740
void SetHelpText(sal_uInt16 nItemId, const OUString &rText)
Definition: status.cxx:1272
SAL_DLLPRIVATE tools::Rectangle ImplGetItemRectPos(sal_uInt16 nPos) const
Definition: status.cxx:326
tools::Long mnItemsWidth
Definition: status.hxx:74
OUString maPrgsTxt
Definition: status.hxx:70
void SetText(const OUString &rText) override
Definition: status.cxx:1384
void ShowItem(sal_uInt16 nItemId)
Definition: status.cxx:942
void Clear()
Definition: status.cxx:992
sal_uInt16 mnCurItemId
Definition: status.hxx:79
void HideItem(sal_uInt16 nItemId)
Definition: status.cxx:962
StatusBar(vcl::Window *pParent, WinBits nWinStyle=WB_BORDER|WB_RIGHT)
Definition: status.cxx:145
virtual void RequestHelp(const HelpEvent &rHEvt) override
Definition: status.cxx:759
std::unique_ptr< ImplData > mpImplData
Definition: status.hxx:69
sal_uInt32 mnLastProgressPaint_ms
Definition: status.hxx:82
void EndProgressMode()
Definition: status.cxx:1370
void SetQuickHelpText(sal_uInt16 nItemId, const OUString &rText)
Definition: status.cxx:1302
virtual void dispose() override
This is intended to be used to clear any locally held references to other Window-subclass objects.
Definition: status.cxx:157
sal_uInt16 GetItemId(sal_uInt16 nPos) const
Definition: status.cxx:1009
sal_uInt16 GetItemCount() const
Definition: status.cxx:1004
void RemoveItem(sal_uInt16 nItemId)
Definition: status.cxx:927
virtual void UserDraw(const UserDrawEvent &rUDEvt)
Definition: status.cxx:881
void AdjustItemWidthsForHiDPI()
Definition: status.cxx:168
virtual void DataChanged(const DataChangedEvent &rDCEvt) override
Definition: status.cxx:839
SAL_DLLPRIVATE void ImplInit(vcl::Window *pParent, WinBits nStyle)
Definition: status.cxx:117
sal_uInt16 mnPercentCount
Definition: status.hxx:81
void RedrawItem(sal_uInt16 nItemId)
Definition: status.cxx:1253
StatusBarItemBits GetItemBits(sal_uInt16 nItemId) const
Definition: status.cxx:1106
SAL_DLLPRIVATE bool ImplIsItemUpdate() const
Definition: status.cxx:112
sal_uInt16 GetItemPos(sal_uInt16 nItemId) const
Definition: status.cxx:1016
SAL_DLLPRIVATE void ImplDrawText(vcl::RenderContext &rRenderContext)
Definition: status.cxx:353
OUString GetItemCommand(sal_uInt16 nItemId)
Definition: status.cxx:1211
std::vector< std::unique_ptr< ImplStatusItem > > mvItemList
Definition: status.hxx:68
void SetProgressValue(sal_uInt16 nPercent)
Definition: status.cxx:1347
virtual void MouseButtonDown(const MouseEvent &rMEvt) override
Definition: status.cxx:659
tools::Long GetItemOffset(sal_uInt16 nItemId) const
Definition: status.cxx:1116
Link< StatusBar *, void > maClickHdl
Definition: status.hxx:87
void Click()
Definition: status.cxx:871
virtual void StateChanged(StateChangedType nType) override
Definition: status.cxx:805
bool IsItemVisible(sal_uInt16 nItemId) const
Definition: status.cxx:982
SAL_DLLPRIVATE void ImplCalcProgressRect()
Definition: status.cxx:607
virtual void Paint(vcl::RenderContext &rRenderContext, const tools::Rectangle &rRect) override
Definition: status.cxx:693
void DoubleClick()
Definition: status.cxx:876
sal_uLong GetItemWidth(sal_uInt16 nItemId) const
Definition: status.cxx:1096
Size CalcWindowSizePixel() const
Definition: status.cxx:1415
tools::Long mnCalcHeight
Definition: status.hxx:77
void SetItemData(sal_uInt16 nItemId, void *pNewData)
Definition: status.cxx:1221
tools::Long mnDY
Definition: status.hxx:76
Link< StatusBar *, void > maDoubleClickHdl
Definition: status.hxx:88
bool mbAdjustHiDPI
Definition: status.hxx:86
SAL_DLLPRIVATE void ImplFormat()
Definition: status.cxx:219
Point GetItemTextPos(sal_uInt16 nItemId) const
Definition: status.cxx:1068
virtual ~StatusBar() override
Definition: status.cxx:152
SAL_DLLPRIVATE void ImplDrawItem(vcl::RenderContext &rRenderContext, bool bOffScreen, sal_uInt16 nPos)
Definition: status.cxx:377
SAL_DLLPRIVATE void ImplInitSettings()
Definition: status.cxx:208
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.
Definition: event.hxx:222
static VclPtr< reference_type > Create(Arg &&... arg)
A construction helper for VclPtr.
Definition: vclptr.hxx:127
bool mbFrame
Definition: window.h:319
ControlPart mnNativeBackground
Definition: window.h:298
bool mbOverlapWin
Definition: window.h:321
VclPtr< vcl::Window > mpParent
Definition: window.h:235
constexpr Point Center() const
constexpr tools::Long GetWidth() const
bool Contains(const Point &rPOINT) const
constexpr void SetLeft(tools::Long v)
constexpr void SetTop(tools::Long v)
constexpr tools::Long Top() const
constexpr Point TopLeft() const
constexpr void SetRight(tools::Long v)
constexpr Size GetSize() const
constexpr tools::Long Right() const
tools::Long AdjustTop(tools::Long nVertMoveDelta)
tools::Long AdjustRight(tools::Long nHorzMoveDelta)
constexpr void SetBottom(tools::Long v)
constexpr Point BottomRight() const
constexpr tools::Long GetHeight() const
tools::Long AdjustBottom(tools::Long nVertMoveDelta)
tools::Long AdjustLeft(tools::Long nHorzMoveDelta)
constexpr tools::Long Left() const
constexpr tools::Long Bottom() const
constexpr bool IsEmpty() const
constexpr Point BottomLeft() const
Point AbsoluteScreenToOutputPixel(const Point &rPos) const
Definition: window.cxx:2869
Point OutputToScreenPixel(const Point &rPos) const
Definition: window.cxx:2810
const Wallpaper & GetBackground() const
Definition: window3.cxx:63
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.
Definition: window3.cxx:66
float GetDPIScaleFactor() const
Definition: window3.cxx:122
bool IsReallyVisible() const
Definition: window2.cxx:1138
void PaintImmediately()
Definition: paint.cxx:1268
TextAlign GetTextAlign() const
Definition: window3.cxx:128
bool IsPaintTransparent() const
Definition: window2.cxx:1068
virtual void SetSizePixel(const Size &rNewSize)
Definition: window2.cxx:1293
const Color & GetControlForeground() const
Definition: window2.cxx:1103
bool IsUpdateMode() const
Definition: window2.cxx:1204
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)
Definition: window3.cxx:79
tools::Long GetTextHeight() const
Height where any character of the current font fits; in logic coordinates.
Definition: window3.cxx:65
virtual void SetOutputSizePixel(const Size &rNewSize)
Definition: window2.cxx:1305
bool IsControlForeground() const
Definition: window2.cxx:1108
WinBits GetStyle() const
Definition: window2.cxx:984
bool IsNativeControlSupported(ControlType nType, ControlPart nPart) const
Query the platform layer for control support.
Definition: window3.cxx:74
Window(WindowType nType)
Definition: window.cxx:95
::OutputDevice const * GetOutDev() const
Definition: window.cxx:567
const vcl::Font & GetFont() const
Definition: window3.cxx:58
SAL_DLLPRIVATE WindowImpl * ImplGetWindowImpl() const
Definition: window.hxx:528
const Color & GetTextColor() const
Definition: window3.cxx:109
bool IsRTLEnabled() const
Definition: window3.cxx:127
virtual Size GetSizePixel() const
Definition: window.cxx:2406
Size GetOutputSizePixel() const
Definition: window3.cxx:89
bool IsControlBackground() const
Definition: window2.cxx:1118
const Color & GetControlBackground() const
Definition: window2.cxx:1113
OUString GetAccessibleName() const
virtual void Invalidate(InvalidateFlags nFlags=InvalidateFlags::NONE)
Definition: paint.cxx:1143
Point OutputToAbsoluteScreenPixel(const Point &rPos) const
Definition: window.cxx:2859
void CallEventListeners(VclEventId nEvent, void *pData=nullptr)
Definition: event.cxx:219
virtual OUString GetText() const
Definition: window.cxx:3062
void ApplyControlFont(vcl::RenderContext &rRenderContext, const vcl::Font &rDefaultFont)
Definition: window2.cxx:473
Point ScreenToOutputPixel(const Point &rPos) const
Definition: window.cxx:2816
const OUString & GetQuickHelpText() const
Definition: window2.cxx:1263
const OUString & GetHelpText() const
Definition: window.cxx:3097
void EnableChildTransparentMode(bool bEnable=true)
Definition: window2.cxx:1053
int nCount
sal_uInt16 mnId
sal_Int64 n
Environment aTo
Environment aFrom
sal_uInt16 nPos
#define SAL_WARN_IF(condition, area, stream)
aStr
int i
css::uno::Reference< css::linguistic2::XProofreadingIterator > get(css::uno::Reference< css::uno::XComponentContext > const &context)
long Long
QPRO_FUNC_TYPE nType
double mnWidth
sal_uIntPtr sal_uLong
#define STATUSBAR_OFFSET_TEXTY
Definition: status.cxx:38
#define STATUSBAR_OFFSET_X
Definition: status.cxx:36
#define STATUSBAR_PRGS_OFFSET
Definition: status.cxx:40
#define STATUSBAR_PRGS_MIN
Definition: status.cxx:42
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)
Definition: status.cxx:472
#define STATUSBAR_PRGS_COUNT
Definition: status.cxx:41
#define STATUSBAR_OFFSET_Y
Definition: status.cxx:37
static Point ImplGetItemTextPos(const Size &rRectSize, const Size &rTextSize, StatusBarItemBits nStyle)
Definition: status.cxx:93
static tools::Long ImplCalcProgressWidth(sal_uInt16 nMax, tools::Long nSize)
Definition: status.cxx:88
#define STATUSBAR_OFFSET
Definition: status.hxx:61
#define STATUSBAR_ITEM_NOTFOUND
Definition: status.hxx:60
StatusBarItemBits
Definition: status.hxx:42
ImplSVNWFData maNWFData
Definition: svdata.hxx:407
int mnStatusBarLowerRightOffset
Definition: svdata.hxx:319
bool mbProgressNeedsErase
Definition: svdata.hxx:336
SalLayoutGlyphs * GetTextGlyphs(const OutputDevice *pOutputDevice)
Definition: status.cxx:77
OUString maQuickHelpText
Definition: status.cxx:67
tools::Long mnExtraWidth
Definition: status.cxx:63
tools::Long mnOffset
Definition: status.cxx:62
bool mbVisible
Definition: status.cxx:70
void * mpUserData
Definition: status.cxx:69
OUString maHelpText
Definition: status.cxx:66
OUString maText
Definition: status.cxx:65
sal_uInt16 mnId
Definition: status.cxx:59
tools::Long mnWidth
Definition: status.cxx:61
std::optional< SalLayoutGlyphs > mLayoutGlyphsCache
Definition: status.cxx:73
tools::Long mnX
Definition: status.cxx:64
StatusBarItemBits mnBits
Definition: status.cxx:60
OUString maCommand
Definition: status.cxx:72
OString maHelpId
Definition: status.cxx:68
OUString maAccessibleName
Definition: status.cxx:71
ImplSVData * ImplGetSVData()
Definition: svdata.cxx:76
#define SAL_MAX_UINT16
@ StatusbarNameChanged
@ StatusbarAllItemsRemoved
@ StatusbarItemRemoved
@ StatusbarItemAdded
StateChangedType
Definition: window.hxx:291
@ 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.
sal_Int64 WinBits
Definition: wintypes.hxx:109
WindowType
Definition: wintypes.hxx:27
WinBits const WB_3DLOOK
Definition: wintypes.hxx:118
WinBits const WB_RIGHT
Definition: wintypes.hxx:148
WinBits const WB_BORDER
Definition: wintypes.hxx:115
WinBits const WB_LEFT
Definition: wintypes.hxx:146