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