LibreOffice Module vcl (master)  1
paint.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 #include <config_features.h>
21 #include <vcl/gdimtf.hxx>
22 #include <vcl/window.hxx>
23 #include <vcl/virdev.hxx>
24 #include <vcl/cursor.hxx>
25 #include <vcl/settings.hxx>
26 #include <vcl/syswin.hxx>
27 
28 #include <sal/types.h>
29 #include <sal/log.hxx>
30 
31 #include <window.h>
32 #include <salgdi.hxx>
33 #include <salframe.hxx>
34 #include <svdata.hxx>
35 #include <comphelper/lok.hxx>
37 #if HAVE_FEATURE_OPENGL
39 #endif
40 
41 // PaintBufferGuard
42 
43 namespace vcl
44 {
46  : mpFrameData(pFrameData),
47  m_pWindow(pWindow),
48  mbBackground(false),
49  mnOutOffX(0),
50  mnOutOffY(0)
51 {
52  if (!pFrameData->mpBuffer)
53  return;
54 
55  // transfer various settings
56  // FIXME: this must disappear as we move to RenderContext only,
57  // the painting must become state-less, so that no actual
58  // vcl::Window setting affects this
59  mbBackground = pFrameData->mpBuffer->IsBackground();
60  if (pWindow->IsBackground())
61  {
62  maBackground = pFrameData->mpBuffer->GetBackground();
63  pFrameData->mpBuffer->SetBackground(pWindow->GetBackground());
64  }
65  //else
66  //SAL_WARN("vcl.window", "the root of the double-buffering hierarchy should not have a transparent background");
67 
68  PushFlags nFlags = PushFlags::NONE;
69  nFlags |= PushFlags::CLIPREGION;
70  nFlags |= PushFlags::FILLCOLOR;
71  nFlags |= PushFlags::FONT;
72  nFlags |= PushFlags::LINECOLOR;
73  nFlags |= PushFlags::MAPMODE;
74  maSettings = pFrameData->mpBuffer->GetSettings();
75  nFlags |= PushFlags::REFPOINT;
76  nFlags |= PushFlags::TEXTCOLOR;
77  nFlags |= PushFlags::TEXTLINECOLOR;
78  nFlags |= PushFlags::OVERLINECOLOR;
79  nFlags |= PushFlags::TEXTFILLCOLOR;
80  nFlags |= PushFlags::TEXTALIGN;
81  nFlags |= PushFlags::RASTEROP;
82  nFlags |= PushFlags::TEXTLAYOUTMODE;
83  nFlags |= PushFlags::TEXTLANGUAGE;
84  pFrameData->mpBuffer->Push(nFlags);
85  pFrameData->mpBuffer->SetClipRegion(pWindow->GetClipRegion());
86  pFrameData->mpBuffer->SetFillColor(pWindow->GetFillColor());
87  pFrameData->mpBuffer->SetFont(pWindow->GetFont());
88  pFrameData->mpBuffer->SetLineColor(pWindow->GetLineColor());
89  pFrameData->mpBuffer->SetMapMode(pWindow->GetMapMode());
90  pFrameData->mpBuffer->SetRefPoint(pWindow->GetRefPoint());
91  pFrameData->mpBuffer->SetSettings(pWindow->GetSettings());
92  pFrameData->mpBuffer->SetTextColor(pWindow->GetTextColor());
93  pFrameData->mpBuffer->SetTextLineColor(pWindow->GetTextLineColor());
94  pFrameData->mpBuffer->SetOverlineColor(pWindow->GetOverlineColor());
95  pFrameData->mpBuffer->SetTextFillColor(pWindow->GetTextFillColor());
96  pFrameData->mpBuffer->SetTextAlign(pWindow->GetTextAlign());
97  pFrameData->mpBuffer->SetRasterOp(pWindow->GetRasterOp());
98  pFrameData->mpBuffer->SetLayoutMode(pWindow->GetLayoutMode());
99  pFrameData->mpBuffer->SetDigitLanguage(pWindow->GetDigitLanguage());
100 
101  mnOutOffX = pFrameData->mpBuffer->GetOutOffXPixel();
102  mnOutOffY = pFrameData->mpBuffer->GetOutOffYPixel();
103  pFrameData->mpBuffer->SetOutOffXPixel(pWindow->GetOutOffXPixel());
104  pFrameData->mpBuffer->SetOutOffYPixel(pWindow->GetOutOffYPixel());
105  pFrameData->mpBuffer->EnableRTL(pWindow->IsRTLEnabled());
106 }
107 
109 {
110  if (!mpFrameData->mpBuffer)
111  return;
112 
113  if (!m_aPaintRect.IsEmpty())
114  {
115  // copy the buffer content to the actual window
116  // export VCL_DOUBLEBUFFERING_AVOID_PAINT=1 to see where we are
117  // painting directly instead of using Invalidate()
118  // [ie. everything you can see was painted directly to the
119  // window either above or in eg. an event handler]
120  if (!getenv("VCL_DOUBLEBUFFERING_AVOID_PAINT"))
121  {
122  // Make sure that the +1 value GetSize() adds to the size is in pixels.
123  Size aPaintRectSize;
124  if (m_pWindow->GetMapMode().GetMapUnit() == MapUnit::MapPixel)
125  {
126  aPaintRectSize = m_aPaintRect.GetSize();
127  }
128  else
129  {
131  aPaintRectSize = m_pWindow->PixelToLogic(aRectanglePixel.GetSize());
132  }
133 
134  m_pWindow->DrawOutDev(m_aPaintRect.TopLeft(), aPaintRectSize, m_aPaintRect.TopLeft(), aPaintRectSize, *mpFrameData->mpBuffer);
135  }
136  }
137 
138  // Restore buffer state.
141 
144  if (mbBackground)
146  else
148 }
149 
151 {
152  m_aPaintRect = rRectangle;
153 }
154 
156 {
157  if (mpFrameData->mpBuffer)
158  return mpFrameData->mpBuffer;
159  else
160  return m_pWindow;
161 }
162 }
163 
165 {
166 private:
168  std::unique_ptr<vcl::Region> m_pChildRegion;
173  bool m_bPop : 1;
176 public:
177  PaintHelper(vcl::Window* pWindow, ImplPaintFlags nPaintFlags);
178  void SetPop()
179  {
180  m_bPop = true;
181  }
182  void SetPaintRect(const tools::Rectangle& rRect)
183  {
184  m_aPaintRect = rRect;
185  }
187  {
188  m_aSelectionRect = rRect;
189  }
190  void SetRestoreCursor(bool bRestoreCursor)
191  {
192  m_bRestoreCursor = bRestoreCursor;
193  }
194  bool GetRestoreCursor() const
195  {
196  return m_bRestoreCursor;
197  }
199  {
200  return m_nPaintFlags;
201  }
203  {
204  return m_aPaintRegion;
205  }
206  void DoPaint(const vcl::Region* pRegion);
207 
209  void StartBufferedPaint();
210 
212  void PaintBuffer();
213 
214  ~PaintHelper();
215 };
216 
218  : m_pWindow(pWindow)
219  , m_nPaintFlags(nPaintFlags)
220  , m_bPop(false)
221  , m_bRestoreCursor(false)
222  , m_bStartedBufferedPaint(false)
223 {
224 }
225 
227 {
228  ImplFrameData* pFrameData = m_pWindow->mpWindowImpl->mpFrameData;
229  assert(!pFrameData->mbInBufferedPaint);
230 
231  pFrameData->mbInBufferedPaint = true;
232  pFrameData->maBufferedRect = tools::Rectangle();
234 }
235 
237 {
238  ImplFrameData* pFrameData = m_pWindow->mpWindowImpl->mpFrameData;
239  assert(pFrameData->mbInBufferedPaint);
241 
242  vcl::PaintBufferGuard aGuard(pFrameData, m_pWindow);
243  aGuard.SetPaintRect(pFrameData->maBufferedRect);
244 }
245 
246 void PaintHelper::DoPaint(const vcl::Region* pRegion)
247 {
248  WindowImpl* pWindowImpl = m_pWindow->ImplGetWindowImpl();
249 
250  vcl::Region* pWinChildClipRegion = m_pWindow->ImplGetWinChildClipRegion();
251  ImplFrameData* pFrameData = m_pWindow->mpWindowImpl->mpFrameData;
252  if (pWindowImpl->mnPaintFlags & ImplPaintFlags::PaintAll || pFrameData->mbInBufferedPaint)
253  {
254  pWindowImpl->maInvalidateRegion = *pWinChildClipRegion;
255  }
256  else
257  {
258  if (pRegion)
259  pWindowImpl->maInvalidateRegion.Union( *pRegion );
260 
261  if (pWindowImpl->mpWinData && pWindowImpl->mbTrackVisible)
262  /* #98602# need to repaint all children within the
263  * tracking rectangle, so the following invert
264  * operation takes places without traces of the previous
265  * one.
266  */
267  pWindowImpl->maInvalidateRegion.Union(*pWindowImpl->mpWinData->mpTrackRect);
268 
270  m_pChildRegion.reset( new vcl::Region(pWindowImpl->maInvalidateRegion) );
271  pWindowImpl->maInvalidateRegion.Intersect(*pWinChildClipRegion);
272  }
273  pWindowImpl->mnPaintFlags = ImplPaintFlags::NONE;
274  if (pWindowImpl->maInvalidateRegion.IsEmpty())
275  return;
276 
277 #if HAVE_FEATURE_OPENGL
278  VCL_GL_INFO("PaintHelper::DoPaint on " <<
279  typeid( *m_pWindow ).name() << " '" << m_pWindow->GetText() << "' begin");
280 #endif
281  // double-buffering: setup the buffer if it does not exist
282  if (!pFrameData->mbInBufferedPaint && m_pWindow->SupportsDoubleBuffering())
284 
285  // double-buffering: if this window does not support double-buffering,
286  // but we are in the middle of double-buffered paint, we might be
287  // losing information
288  if (pFrameData->mbInBufferedPaint && !m_pWindow->SupportsDoubleBuffering())
289  SAL_WARN("vcl.window", "non-double buffered window in the double-buffered hierarchy, painting directly: " << typeid(*m_pWindow.get()).name());
290 
292  {
293  // double-buffering
294  vcl::PaintBufferGuard g(pFrameData, m_pWindow);
295  m_pWindow->ApplySettings(*pFrameData->mpBuffer);
296 
297  m_pWindow->PushPaintHelper(this, *pFrameData->mpBuffer);
298  m_pWindow->Paint(*pFrameData->mpBuffer, m_aPaintRect);
299  pFrameData->maBufferedRect.Union(m_aPaintRect);
300  }
301  else
302  {
303  // direct painting
304  Wallpaper aBackground = m_pWindow->GetBackground();
306  // Restore bitmap background if it was lost.
307  if (aBackground.IsBitmap() && !m_pWindow->GetBackground().IsBitmap())
308  {
309  m_pWindow->SetBackground(aBackground);
310  }
313  }
314 #if HAVE_FEATURE_OPENGL
315  VCL_GL_INFO("PaintHelper::DoPaint end on " <<
316  typeid( *m_pWindow ).name() << " '" << m_pWindow->GetText() << "'");
317 #endif
318 }
319 
320 namespace vcl
321 {
322 
324  const tools::Rectangle& rRect, sal_uInt16 nHighlight,
325  bool bChecked, bool bDrawBorder, bool bDrawExtBorderOnly,
326  Color* pSelectionTextColor, long nCornerRadius, Color const * pPaintColor)
327 {
328  if (rRect.IsEmpty())
329  return;
330 
331  bool bRoundEdges = nCornerRadius > 0;
332 
333  const StyleSettings& rStyles = rRenderContext.GetSettings().GetStyleSettings();
334 
335  // colors used for item highlighting
336  Color aSelectionBorderColor(pPaintColor ? *pPaintColor : rStyles.GetHighlightColor());
337  Color aSelectionFillColor(aSelectionBorderColor);
338 
339  bool bDark = rStyles.GetFaceColor().IsDark();
340  bool bBright = ( rStyles.GetFaceColor() == COL_WHITE );
341 
342  int c1 = aSelectionBorderColor.GetLuminance();
343  int c2 = rWindow.GetBackgroundColor().GetLuminance();
344 
345  if (!bDark && !bBright && std::abs(c2 - c1) < (pPaintColor ? 40 : 75))
346  {
347  // contrast too low
348  sal_uInt16 h, s, b;
349  aSelectionFillColor.RGBtoHSB( h, s, b );
350  if( b > 50 ) b -= 40;
351  else b += 40;
352  aSelectionFillColor = Color::HSBtoRGB( h, s, b );
353  aSelectionBorderColor = aSelectionFillColor;
354  }
355 
356  if (bRoundEdges)
357  {
358  if (aSelectionBorderColor.IsDark())
359  aSelectionBorderColor.IncreaseLuminance(128);
360  else
361  aSelectionBorderColor.DecreaseLuminance(128);
362  }
363 
364  tools::Rectangle aRect(rRect);
365  if (bDrawExtBorderOnly)
366  {
367  aRect.AdjustLeft( -1 );
368  aRect.AdjustTop( -1 );
369  aRect.AdjustRight(1 );
370  aRect.AdjustBottom(1 );
371  }
373 
374  if (bDrawBorder)
375  rRenderContext.SetLineColor(bDark ? COL_WHITE : (bBright ? COL_BLACK : aSelectionBorderColor));
376  else
377  rRenderContext.SetLineColor();
378 
379  sal_uInt16 nPercent = 0;
380  if (!nHighlight)
381  {
382  if (bDark)
383  aSelectionFillColor = COL_BLACK;
384  else
385  nPercent = 80; // just checked (light)
386  }
387  else
388  {
389  if (bChecked && nHighlight == 2)
390  {
391  if (bDark)
392  aSelectionFillColor = COL_LIGHTGRAY;
393  else if (bBright)
394  {
395  aSelectionFillColor = COL_BLACK;
396  rRenderContext.SetLineColor(COL_BLACK);
397  nPercent = 0;
398  }
399  else
400  nPercent = bRoundEdges ? 40 : 20; // selected, pressed or checked ( very dark )
401  }
402  else if (bChecked || nHighlight == 1)
403  {
404  if (bDark)
405  aSelectionFillColor = COL_GRAY;
406  else if (bBright)
407  {
408  aSelectionFillColor = COL_BLACK;
409  rRenderContext.SetLineColor(COL_BLACK);
410  nPercent = 0;
411  }
412  else
413  nPercent = bRoundEdges ? 60 : 35; // selected, pressed or checked ( very dark )
414  }
415  else
416  {
417  if (bDark)
418  aSelectionFillColor = COL_LIGHTGRAY;
419  else if (bBright)
420  {
421  aSelectionFillColor = COL_BLACK;
422  rRenderContext.SetLineColor(COL_BLACK);
423  if (nHighlight == 3)
424  nPercent = 80;
425  else
426  nPercent = 0;
427  }
428  else
429  nPercent = 70; // selected ( dark )
430  }
431  }
432 
433  if (bDark && bDrawExtBorderOnly)
434  {
435  rRenderContext.SetFillColor();
436  if (pSelectionTextColor)
437  *pSelectionTextColor = rStyles.GetHighlightTextColor();
438  }
439  else
440  {
441  rRenderContext.SetFillColor(aSelectionFillColor);
442  if (pSelectionTextColor)
443  {
444  Color aTextColor = rWindow.IsControlBackground() ? rWindow.GetControlForeground() : rStyles.GetButtonTextColor();
445  Color aHLTextColor = rStyles.GetHighlightTextColor();
446  int nTextDiff = std::abs(aSelectionFillColor.GetLuminance() - aTextColor.GetLuminance());
447  int nHLDiff = std::abs(aSelectionFillColor.GetLuminance() - aHLTextColor.GetLuminance());
448  *pSelectionTextColor = (nHLDiff >= nTextDiff) ? aHLTextColor : aTextColor;
449  }
450  }
451 
452  if (bDark)
453  {
454  rRenderContext.DrawRect(aRect);
455  }
456  else
457  {
458  if (bRoundEdges)
459  {
460  tools::Polygon aPoly(aRect, nCornerRadius, nCornerRadius);
461  tools::PolyPolygon aPolyPoly(aPoly);
462  rRenderContext.DrawTransparent(aPolyPoly, nPercent);
463  }
464  else
465  {
466  tools::Polygon aPoly(aRect);
467  tools::PolyPolygon aPolyPoly(aPoly);
468  rRenderContext.DrawTransparent(aPolyPoly, nPercent);
469  }
470  }
471 
472  rRenderContext.Pop(); // LINECOLOR | FILLCOLOR
473 }
474 
476 {
477  pHelper->SetPop();
478 
479  if ( mpWindowImpl->mpCursor )
480  pHelper->SetRestoreCursor(mpWindowImpl->mpCursor->ImplSuspend());
481 
482  mbInitClipRegion = true;
483  mpWindowImpl->mbInPaint = true;
484 
485  // restore Paint-Region
486  vcl::Region &rPaintRegion = pHelper->GetPaintRegion();
487  rPaintRegion = mpWindowImpl->maInvalidateRegion;
488  tools::Rectangle aPaintRect = rPaintRegion.GetBoundRect();
489 
490  // RTL: re-mirror paint rect and region at this window
491  if (ImplIsAntiparallel())
492  {
493  rRenderContext.ReMirror(aPaintRect);
494  rRenderContext.ReMirror(rPaintRegion);
495  }
496  aPaintRect = ImplDevicePixelToLogic(aPaintRect);
497  mpWindowImpl->mpPaintRegion = &rPaintRegion;
498  mpWindowImpl->maInvalidateRegion.SetEmpty();
499 
500  if ((pHelper->GetPaintFlags() & ImplPaintFlags::Erase) && rRenderContext.IsBackground())
501  {
502  if (rRenderContext.IsClipRegion())
503  {
504  vcl::Region aOldRegion = rRenderContext.GetClipRegion();
505  rRenderContext.SetClipRegion();
506  Erase(rRenderContext);
507  rRenderContext.SetClipRegion(aOldRegion);
508  }
509  else
510  Erase(rRenderContext);
511  }
512 
513  // #98943# trigger drawing of toolbox selection after all children are painted
514  if (mpWindowImpl->mbDrawSelectionBackground)
515  pHelper->SetSelectionRect(aPaintRect);
516  pHelper->SetPaintRect(aPaintRect);
517 }
518 
520 {
521  if (mpWindowImpl->mpWinData)
522  {
523  if (mpWindowImpl->mbFocusVisible)
524  ImplInvertFocus(*mpWindowImpl->mpWinData->mpFocusRect);
525  }
526  mpWindowImpl->mbInPaint = false;
527  mbInitClipRegion = true;
528  mpWindowImpl->mpPaintRegion = nullptr;
529  if (mpWindowImpl->mpCursor)
530  mpWindowImpl->mpCursor->ImplResume(pHelper->GetRestoreCursor());
531 }
532 
533 } /* namespace vcl */
534 
536 {
537  WindowImpl* pWindowImpl = m_pWindow->ImplGetWindowImpl();
538  if (m_bPop)
539  {
540  m_pWindow->PopPaintHelper(this);
541  }
542 
543  ImplFrameData* pFrameData = m_pWindow->mpWindowImpl->mpFrameData;
545  {
546  // Paint from the bottom child window and frontward.
547  vcl::Window* pTempWindow = pWindowImpl->mpLastChild;
548  while (pTempWindow)
549  {
550  if (pTempWindow->mpWindowImpl->mbVisible)
551  pTempWindow->ImplCallPaint(m_pChildRegion.get(), m_nPaintFlags);
552  pTempWindow = pTempWindow->mpWindowImpl->mpPrev;
553  }
554  }
555 
556  if ( pWindowImpl->mpWinData && pWindowImpl->mbTrackVisible && (pWindowImpl->mpWinData->mnTrackFlags & ShowTrackFlags::TrackWindow) )
557  /* #98602# need to invert the tracking rect AFTER
558  * the children have painted
559  */
560  m_pWindow->InvertTracking( *pWindowImpl->mpWinData->mpTrackRect, pWindowImpl->mpWinData->mnTrackFlags );
561 
562  // double-buffering: paint in case we created the buffer, the children are
563  // already painted inside
564  if (m_bStartedBufferedPaint && pFrameData->mbInBufferedPaint)
565  {
566  PaintBuffer();
567  pFrameData->mbInBufferedPaint = false;
568  pFrameData->maBufferedRect = tools::Rectangle();
569  }
570 
571  // #98943# draw toolbox selection
572  if( !m_aSelectionRect.IsEmpty() )
574 }
575 
576 namespace vcl {
577 
578 void Window::ImplCallPaint(const vcl::Region* pRegion, ImplPaintFlags nPaintFlags)
579 {
580  // call PrePaint. PrePaint may add to the invalidate region as well as
581  // other parameters used below.
582  PrePaint(*this);
583 
584  mpWindowImpl->mbPaintFrame = false;
585 
586  if (nPaintFlags & ImplPaintFlags::PaintAllChildren)
587  mpWindowImpl->mnPaintFlags |= ImplPaintFlags::Paint | ImplPaintFlags::PaintAllChildren | (nPaintFlags & ImplPaintFlags::PaintAll);
588  if (nPaintFlags & ImplPaintFlags::PaintChildren)
590  if (nPaintFlags & ImplPaintFlags::Erase)
591  mpWindowImpl->mnPaintFlags |= ImplPaintFlags::Erase;
592  if (nPaintFlags & ImplPaintFlags::CheckRtl)
593  mpWindowImpl->mnPaintFlags |= ImplPaintFlags::CheckRtl;
594  if (!mpWindowImpl->mpFirstChild)
595  mpWindowImpl->mnPaintFlags &= ~ImplPaintFlags::PaintAllChildren;
596 
597  if (mpWindowImpl->mbPaintDisabled)
598  {
599  if (mpWindowImpl->mnPaintFlags & ImplPaintFlags::PaintAll)
601  else if ( pRegion )
603 
604  // call PostPaint before returning
605  PostPaint(*this);
606 
607  return;
608  }
609 
610  nPaintFlags = mpWindowImpl->mnPaintFlags & ~ImplPaintFlags::Paint;
611 
612  PaintHelper aHelper(this, nPaintFlags);
613 
614  if (mpWindowImpl->mnPaintFlags & ImplPaintFlags::Paint)
615  aHelper.DoPaint(pRegion);
616  else
617  mpWindowImpl->mnPaintFlags = ImplPaintFlags::NONE;
618 
619  // call PostPaint
620  PostPaint(*this);
621 }
622 
624 {
625  // emit overlapping windows first
626  vcl::Window* pTempWindow = mpWindowImpl->mpFirstOverlap;
627  while ( pTempWindow )
628  {
629  if ( pTempWindow->mpWindowImpl->mbReallyVisible )
630  pTempWindow->ImplCallOverlapPaint();
631  pTempWindow = pTempWindow->mpWindowImpl->mpNext;
632  }
633 
634  // only then ourself
636  {
637  // RTL: notify ImplCallPaint to check for re-mirroring
638  // because we were called from the Sal layer
639  ImplCallPaint(nullptr, mpWindowImpl->mnPaintFlags /*| ImplPaintFlags::CheckRtl */);
640  }
641 }
642 
643 IMPL_LINK_NOARG(Window, ImplHandlePaintHdl, Timer *, void)
644 {
645  comphelper::ProfileZone aZone("VCL idle re-paint");
646 
647  // save paint events until layout is done
648  if (IsSystemWindow() && static_cast<const SystemWindow*>(this)->hasPendingLayout())
649  {
650  mpWindowImpl->mpFrameData->maPaintIdle.Start();
651  return;
652  }
653 
654  // save paint events until resizing or initial sizing done
655  if (mpWindowImpl->mbFrame &&
656  mpWindowImpl->mpFrameData->maResizeIdle.IsActive())
657  {
658  mpWindowImpl->mpFrameData->maPaintIdle.Start();
659  }
660  else if ( mpWindowImpl->mbReallyVisible )
661  {
662  ImplCallOverlapPaint();
664  mpWindowImpl->mpFrameData->maPaintIdle.IsActive())
665  mpWindowImpl->mpFrameData->maPaintIdle.Stop();
666  }
667 }
668 
669 IMPL_LINK_NOARG(Window, ImplHandleResizeTimerHdl, Timer *, void)
670 {
671  comphelper::ProfileZone aZone("VCL idle resize");
672 
673  if( mpWindowImpl->mbReallyVisible )
674  {
675  ImplCallResize();
676  if( mpWindowImpl->mpFrameData->maPaintIdle.IsActive() )
677  {
678  mpWindowImpl->mpFrameData->maPaintIdle.Stop();
679  mpWindowImpl->mpFrameData->maPaintIdle.Invoke( nullptr );
680  }
681  }
682 }
683 
685 {
686  // set PAINTCHILDREN for all parent windows till the first OverlapWindow
687  if ( !ImplIsOverlapWindow() )
688  {
689  vcl::Window* pTempWindow = this;
691  do
692  {
693  pTempWindow = pTempWindow->ImplGetParent();
694  if ( pTempWindow->mpWindowImpl->mnPaintFlags & ImplPaintFlags::PaintChildren )
695  break;
696  pTempWindow->mpWindowImpl->mnPaintFlags |= ImplPaintFlags::PaintChildren | nTranspPaint;
697  if( ! pTempWindow->IsPaintTransparent() )
698  nTranspPaint = ImplPaintFlags::NONE;
699  }
700  while ( !pTempWindow->ImplIsOverlapWindow() );
701  }
702 
703  // set Paint-Flags
704  mpWindowImpl->mnPaintFlags |= ImplPaintFlags::Paint;
705  if ( nFlags & InvalidateFlags::Children )
707  if ( !(nFlags & InvalidateFlags::NoErase) )
708  mpWindowImpl->mnPaintFlags |= ImplPaintFlags::Erase;
709 
710  if ( !pRegion )
711  mpWindowImpl->mnPaintFlags |= ImplPaintFlags::PaintAll;
712  else if ( !(mpWindowImpl->mnPaintFlags & ImplPaintFlags::PaintAll) )
713  {
714  // if not everything has to be redrawn, add the region to it
715  mpWindowImpl->maInvalidateRegion.Union( *pRegion );
716  }
717 
718  // Handle transparent windows correctly: invalidate must be done on the first opaque parent
720  && ImplGetParent() )
721  {
722  vcl::Window *pParent = ImplGetParent();
723  while( pParent && pParent->IsPaintTransparent() )
724  pParent = pParent->ImplGetParent();
725  if( pParent )
726  {
727  vcl::Region *pChildRegion;
728  if ( mpWindowImpl->mnPaintFlags & ImplPaintFlags::PaintAll )
729  // invalidate the whole child window region in the parent
730  pChildRegion = ImplGetWinChildClipRegion();
731  else
732  // invalidate the same region in the parent that has to be repainted in the child
733  pChildRegion = &mpWindowImpl->maInvalidateRegion;
734 
735  nFlags |= InvalidateFlags::Children; // paint should also be done on all children
736  nFlags &= ~InvalidateFlags::NoErase; // parent should paint and erase to create proper background
737  pParent->ImplInvalidateFrameRegion( pChildRegion, nFlags );
738  }
739  }
740 
741  if ( !mpWindowImpl->mpFrameData->maPaintIdle.IsActive() )
742  mpWindowImpl->mpFrameData->maPaintIdle.Start();
743 }
744 
746 {
747  vcl::Region aRegion = rRegion;
748 
749  ImplClipBoundaries( aRegion, true, true );
750  if ( !aRegion.IsEmpty() )
752 
753  // now we invalidate the overlapping windows
754  vcl::Window* pTempWindow = mpWindowImpl->mpFirstOverlap;
755  while ( pTempWindow )
756  {
757  if ( pTempWindow->IsVisible() )
758  pTempWindow->ImplInvalidateOverlapFrameRegion( rRegion );
759 
760  pTempWindow = pTempWindow->mpWindowImpl->mpNext;
761  }
762 }
763 
765 {
766  if ( mpWindowImpl->mbOverlapWin )
767  mpWindowImpl->mpFrameWindow->ImplInvalidateOverlapFrameRegion( rRegion );
768  else
769  {
770  if( ImplGetParent() )
772  }
773 }
774 
775 void Window::ImplInvalidate( const vcl::Region* pRegion, InvalidateFlags nFlags )
776 {
777  // check what has to be redrawn
778  bool bInvalidateAll = !pRegion;
779 
780  // take Transparent-Invalidate into account
781  vcl::Window* pOpaqueWindow = this;
782  if ( (mpWindowImpl->mbPaintTransparent && !(nFlags & InvalidateFlags::NoTransparent)) || (nFlags & InvalidateFlags::Transparent) )
783  {
784  vcl::Window* pTempWindow = pOpaqueWindow->ImplGetParent();
785  while ( pTempWindow )
786  {
787  if ( !pTempWindow->IsPaintTransparent() )
788  {
789  pOpaqueWindow = pTempWindow;
790  nFlags |= InvalidateFlags::Children;
791  bInvalidateAll = false;
792  break;
793  }
794 
795  if ( pTempWindow->ImplIsOverlapWindow() )
796  break;
797 
798  pTempWindow = pTempWindow->ImplGetParent();
799  }
800  }
801 
802  // assemble region
803  InvalidateFlags nOrgFlags = nFlags;
805  {
806  if ( GetStyle() & WB_CLIPCHILDREN )
807  nFlags |= InvalidateFlags::NoChildren;
808  else
809  nFlags |= InvalidateFlags::Children;
810  }
811  if ( (nFlags & InvalidateFlags::NoChildren) && mpWindowImpl->mpFirstChild )
812  bInvalidateAll = false;
813  if ( bInvalidateAll )
814  ImplInvalidateFrameRegion( nullptr, nFlags );
815  else
816  {
818  vcl::Region aRegion( aRect );
819  if ( pRegion )
820  {
821  // RTL: remirror region before intersecting it
822  if ( ImplIsAntiparallel() )
823  {
824  const OutputDevice *pOutDev = GetOutDev();
825 
826  vcl::Region aRgn( *pRegion );
827  pOutDev->ReMirror( aRgn );
828  aRegion.Intersect( aRgn );
829  }
830  else
831  aRegion.Intersect( *pRegion );
832  }
833  ImplClipBoundaries( aRegion, true, true );
834  if ( nFlags & InvalidateFlags::NoChildren )
835  {
836  nFlags &= ~InvalidateFlags::Children;
837  if ( !(nFlags & InvalidateFlags::NoClipChildren) )
838  {
839  if ( nOrgFlags & InvalidateFlags::NoChildren )
840  ImplClipAllChildren( aRegion );
841  else
842  {
843  if ( ImplClipChildren( aRegion ) )
844  nFlags |= InvalidateFlags::Children;
845  }
846  }
847  }
848  if ( !aRegion.IsEmpty() )
849  ImplInvalidateFrameRegion( &aRegion, nFlags ); // transparency is handled here, pOpaqueWindow not required
850  }
851 
852  if ( nFlags & InvalidateFlags::Update )
853  pOpaqueWindow->PaintImmediately(); // start painting at the opaque parent
854 }
855 
857  long nHorzScroll, long nVertScroll,
858  bool bChildren )
859 {
861  {
862  vcl::Region aTempRegion = mpWindowImpl->maInvalidateRegion;
863  aTempRegion.Intersect( rRect );
864  aTempRegion.Move( nHorzScroll, nVertScroll );
865  mpWindowImpl->maInvalidateRegion.Union( aTempRegion );
866  }
867 
868  if ( bChildren && (mpWindowImpl->mnPaintFlags & ImplPaintFlags::PaintChildren) )
869  {
870  vcl::Window* pWindow = mpWindowImpl->mpFirstChild;
871  while ( pWindow )
872  {
873  pWindow->ImplMoveInvalidateRegion( rRect, nHorzScroll, nVertScroll, true );
874  pWindow = pWindow->mpWindowImpl->mpNext;
875  }
876  }
877 }
878 
880  long nHorzScroll, long nVertScroll,
881  bool bChildren )
882 {
883  // also shift Paint-Region when paints need processing
884  ImplMoveInvalidateRegion( rRect, nHorzScroll, nVertScroll, bChildren );
885  // Paint-Region should be shifted, as drawn by the parents
886  if ( ImplIsOverlapWindow() )
887  return;
888 
889  vcl::Region aPaintAllRegion;
890  vcl::Window* pPaintAllWindow = this;
891  do
892  {
893  pPaintAllWindow = pPaintAllWindow->ImplGetParent();
894  if ( pPaintAllWindow->mpWindowImpl->mnPaintFlags & ImplPaintFlags::PaintAllChildren )
895  {
896  if ( pPaintAllWindow->mpWindowImpl->mnPaintFlags & ImplPaintFlags::PaintAll )
897  {
898  aPaintAllRegion.SetEmpty();
899  break;
900  }
901  else
902  aPaintAllRegion.Union( pPaintAllWindow->mpWindowImpl->maInvalidateRegion );
903  }
904  }
905  while ( !pPaintAllWindow->ImplIsOverlapWindow() );
906  if ( !aPaintAllRegion.IsEmpty() )
907  {
908  aPaintAllRegion.Move( nHorzScroll, nVertScroll );
910  if ( bChildren )
911  nPaintFlags |= InvalidateFlags::Children;
912  ImplInvalidateFrameRegion( &aPaintAllRegion, nPaintFlags );
913  }
914 }
915 
917 {
918  if ( !pRegion )
919  mpWindowImpl->maInvalidateRegion.SetEmpty();
920  else
921  {
922  // when all child windows have to be drawn we need to invalidate them before doing so
923  if ( (mpWindowImpl->mnPaintFlags & ImplPaintFlags::PaintAllChildren) && mpWindowImpl->mpFirstChild )
924  {
925  vcl::Region aChildRegion = mpWindowImpl->maInvalidateRegion;
926  if ( mpWindowImpl->mnPaintFlags & ImplPaintFlags::PaintAll )
927  {
929  aChildRegion = aRect;
930  }
931  vcl::Window* pChild = mpWindowImpl->mpFirstChild;
932  while ( pChild )
933  {
935  pChild = pChild->mpWindowImpl->mpNext;
936  }
937  }
938  if ( mpWindowImpl->mnPaintFlags & ImplPaintFlags::PaintAll )
939  {
941  mpWindowImpl->maInvalidateRegion = aRect;
942  }
943  mpWindowImpl->maInvalidateRegion.Exclude( *pRegion );
944  }
945  mpWindowImpl->mnPaintFlags &= ~ImplPaintFlags::PaintAll;
946 
947  if ( nFlags & ValidateFlags::Children )
948  {
949  vcl::Window* pChild = mpWindowImpl->mpFirstChild;
950  while ( pChild )
951  {
952  pChild->ImplValidateFrameRegion( pRegion, nFlags );
953  pChild = pChild->mpWindowImpl->mpNext;
954  }
955  }
956 }
957 
959 {
960  // assemble region
961  bool bValidateAll = true;
963  if ( GetStyle() & WB_CLIPCHILDREN )
964  nFlags |= ValidateFlags::NoChildren;
965  else
966  nFlags |= ValidateFlags::Children;
967  if ( (nFlags & ValidateFlags::NoChildren) && mpWindowImpl->mpFirstChild )
968  bValidateAll = false;
969  if ( bValidateAll )
970  ImplValidateFrameRegion( nullptr, nFlags );
971  else
972  {
974  vcl::Region aRegion( aRect );
975  ImplClipBoundaries( aRegion, true, true );
976  if ( nFlags & ValidateFlags::NoChildren )
977  {
978  nFlags &= ~ValidateFlags::Children;
979  if ( ImplClipChildren( aRegion ) )
980  nFlags |= ValidateFlags::Children;
981  }
982  if ( !aRegion.IsEmpty() )
983  ImplValidateFrameRegion( &aRegion, nFlags );
984  }
985 }
986 
988 {
989  if ( !mpWindowImpl->mbReallyVisible )
990  return;
991 
992  bool bFlush = false;
993  if ( mpWindowImpl->mpFrameWindow->mpWindowImpl->mbPaintFrame )
994  {
995  Point aPoint( 0, 0 );
996  vcl::Region aRegion( tools::Rectangle( aPoint, Size( mnOutWidth, mnOutHeight ) ) );
998  if ( mpWindowImpl->mbFrame || (mpWindowImpl->mpBorderWindow && mpWindowImpl->mpBorderWindow->mpWindowImpl->mbFrame) )
999  bFlush = true;
1000  }
1001 
1002  // an update changes the OverlapWindow, such that for later paints
1003  // not too much has to be drawn, if ALLCHILDREN etc. is set
1005  pWindow->ImplCallOverlapPaint();
1006 
1007  if ( bFlush )
1008  Flush();
1009 }
1010 
1011 void Window::PrePaint(vcl::RenderContext& /*rRenderContext*/)
1012 {
1013 }
1014 
1015 void Window::PostPaint(vcl::RenderContext& /*rRenderContext*/)
1016 {
1017 }
1018 
1019 void Window::Paint(vcl::RenderContext& /*rRenderContext*/, const tools::Rectangle& rRect)
1020 {
1021  CallEventListeners(VclEventId::WindowPaint, const_cast<tools::Rectangle *>(&rRect));
1022 }
1023 
1024 void Window::SetPaintTransparent( bool bTransparent )
1025 {
1026  // transparency is not useful for frames as the background would have to be provided by a different frame
1027  if( bTransparent && mpWindowImpl->mbFrame )
1028  return;
1029 
1030  if ( mpWindowImpl->mpBorderWindow )
1031  mpWindowImpl->mpBorderWindow->SetPaintTransparent( bTransparent );
1032 
1033  mpWindowImpl->mbPaintTransparent = bTransparent;
1034 }
1035 
1037 {
1038 
1039  if ( mpWindowImpl->mpBorderWindow )
1040  mpWindowImpl->mpBorderWindow->SetWindowRegionPixel();
1041  else if( mpWindowImpl->mbFrame )
1042  {
1043  mpWindowImpl->maWinRegion = vcl::Region(true);
1044  mpWindowImpl->mbWinRegion = false;
1045  mpWindowImpl->mpFrame->ResetClipRegion();
1046  }
1047  else
1048  {
1049  if ( mpWindowImpl->mbWinRegion )
1050  {
1051  mpWindowImpl->maWinRegion = vcl::Region(true);
1052  mpWindowImpl->mbWinRegion = false;
1053  ImplSetClipFlag();
1054 
1055  if ( IsReallyVisible() )
1056  {
1058  vcl::Region aRegion( aRect );
1060  }
1061  }
1062  }
1063 }
1064 
1066 {
1067 
1068  if ( mpWindowImpl->mpBorderWindow )
1069  mpWindowImpl->mpBorderWindow->SetWindowRegionPixel( rRegion );
1070  else if( mpWindowImpl->mbFrame )
1071  {
1072  if( !rRegion.IsNull() )
1073  {
1074  mpWindowImpl->maWinRegion = rRegion;
1075  mpWindowImpl->mbWinRegion = ! rRegion.IsEmpty();
1076 
1077  if( mpWindowImpl->mbWinRegion )
1078  {
1079  // set/update ClipRegion
1080  RectangleVector aRectangles;
1081  mpWindowImpl->maWinRegion.GetRegionRectangles(aRectangles);
1082  mpWindowImpl->mpFrame->BeginSetClipRegion(aRectangles.size());
1083 
1084  for (auto const& rectangle : aRectangles)
1085  {
1086  mpWindowImpl->mpFrame->UnionClipRegion(
1087  rectangle.Left(),
1088  rectangle.Top(),
1089  rectangle.GetWidth(), // orig nWidth was ((R - L) + 1), same as GetWidth does
1090  rectangle.GetHeight()); // same for height
1091  }
1092 
1093  mpWindowImpl->mpFrame->EndSetClipRegion();
1094 
1095  //long nX;
1096  //long nY;
1097  //long nWidth;
1098  //long nHeight;
1099  //sal_uLong nRectCount;
1100  //ImplRegionInfo aInfo;
1101  //sal_Bool bRegionRect;
1102 
1103  //nRectCount = mpWindowImpl->maWinRegion.GetRectCount();
1104  //mpWindowImpl->mpFrame->BeginSetClipRegion( nRectCount );
1105  //bRegionRect = mpWindowImpl->maWinRegion.ImplGetFirstRect( aInfo, nX, nY, nWidth, nHeight );
1106  //while ( bRegionRect )
1107  //{
1108  // mpWindowImpl->mpFrame->UnionClipRegion( nX, nY, nWidth, nHeight );
1109  // bRegionRect = mpWindowImpl->maWinRegion.ImplGetNextRect( aInfo, nX, nY, nWidth, nHeight );
1110  //}
1111  //mpWindowImpl->mpFrame->EndSetClipRegion();
1112  }
1113  else
1115  }
1116  else
1118  }
1119  else
1120  {
1121  if ( rRegion.IsNull() )
1122  {
1123  if ( mpWindowImpl->mbWinRegion )
1124  {
1125  mpWindowImpl->maWinRegion = vcl::Region(true);
1126  mpWindowImpl->mbWinRegion = false;
1127  ImplSetClipFlag();
1128  }
1129  }
1130  else
1131  {
1132  mpWindowImpl->maWinRegion = rRegion;
1133  mpWindowImpl->mbWinRegion = true;
1134  ImplSetClipFlag();
1135  }
1136 
1137  if ( IsReallyVisible() )
1138  {
1140  vcl::Region aRegion( aRect );
1142  }
1143  }
1144 }
1145 
1147 {
1148 
1149  if ( mpWindowImpl->mpPaintRegion )
1150  {
1151  vcl::Region aRegion = *mpWindowImpl->mpPaintRegion;
1152  aRegion.Move( -mnOutOffX, -mnOutOffY );
1153  return PixelToLogic( aRegion );
1154  }
1155  else
1156  {
1157  vcl::Region aPaintRegion(true);
1158  return aPaintRegion;
1159  }
1160 }
1161 
1163 {
1165  return;
1166 
1167  ImplInvalidate( nullptr, nFlags );
1168  LogicInvalidate(nullptr);
1169 }
1170 
1172 {
1174  return;
1175 
1176  OutputDevice *pOutDev = GetOutDev();
1177  tools::Rectangle aRect = pOutDev->ImplLogicToDevicePixel( rRect );
1178  if ( !aRect.IsEmpty() )
1179  {
1180  vcl::Region aRegion( aRect );
1181  ImplInvalidate( &aRegion, nFlags );
1182  tools::Rectangle aLogicRectangle(rRect);
1183  LogicInvalidate(&aLogicRectangle);
1184  }
1185 }
1186 
1187 void Window::Invalidate( const vcl::Region& rRegion, InvalidateFlags nFlags )
1188 {
1190  return;
1191 
1192  if ( rRegion.IsNull() )
1193  {
1194  ImplInvalidate( nullptr, nFlags );
1195  LogicInvalidate(nullptr);
1196  }
1197  else
1198  {
1199  vcl::Region aRegion = ImplPixelToDevicePixel( LogicToPixel( rRegion ) );
1200  if ( !aRegion.IsEmpty() )
1201  {
1202  ImplInvalidate( &aRegion, nFlags );
1203  tools::Rectangle aLogicRectangle = rRegion.GetBoundRect();
1204  LogicInvalidate(&aLogicRectangle);
1205  }
1206  }
1207 }
1208 
1210 {
1211  if(pRectangle)
1212  {
1213  tools::Rectangle aRect = GetOutDev()->ImplLogicToDevicePixel( *pRectangle );
1214  PixelInvalidate(&aRect);
1215  }
1216  else
1217  PixelInvalidate(nullptr);
1218 }
1219 
1221 {
1223  return;
1224 
1225  Size aSize = GetSizePixel();
1226  if (aSize.IsEmpty())
1227  return;
1228 
1229  if (const vcl::ILibreOfficeKitNotifier* pNotifier = GetLOKNotifier())
1230  {
1231  // In case we are routing the window, notify the client
1232  std::vector<vcl::LOKPayloadItem> aPayload;
1233  if (pRectangle)
1234  aPayload.emplace_back("rectangle", pRectangle->toString());
1235  else
1236  {
1237  const tools::Rectangle aRect(Point(0, 0), aSize);
1238  aPayload.emplace_back("rectangle", aRect.toString());
1239  }
1240 
1241  pNotifier->notifyWindow(GetLOKWindowId(), "invalidate", aPayload);
1242  }
1243  // Added for dialog items. Pass invalidation to the parent window.
1244  else if (VclPtr<vcl::Window> pParent = GetParentWithLOKNotifier())
1245  {
1247  pParent->PixelInvalidate(&aRect);
1248  }
1249 }
1250 
1252 {
1254  return;
1255 
1256  ImplValidate();
1257 }
1258 
1260 {
1261 
1262  if ( !mpWindowImpl->mbReallyVisible )
1263  return false;
1264 
1265  if ( mpWindowImpl->mpFrameWindow->mpWindowImpl->mbPaintFrame )
1266  return true;
1267 
1268  if ( mpWindowImpl->mnPaintFlags & ImplPaintFlags::Paint )
1269  return true;
1270 
1271  if ( !ImplIsOverlapWindow() )
1272  {
1273  const vcl::Window* pTempWindow = this;
1274  do
1275  {
1276  pTempWindow = pTempWindow->ImplGetParent();
1277  if ( pTempWindow->mpWindowImpl->mnPaintFlags & (ImplPaintFlags::PaintChildren | ImplPaintFlags::PaintAllChildren) )
1278  return true;
1279  }
1280  while ( !pTempWindow->ImplIsOverlapWindow() );
1281  }
1282 
1283  return false;
1284 }
1285 
1287 {
1288  if ( mpWindowImpl->mpBorderWindow )
1289  {
1290  mpWindowImpl->mpBorderWindow->PaintImmediately();
1291  return;
1292  }
1293 
1294  if ( !mpWindowImpl->mbReallyVisible )
1295  return;
1296 
1297  bool bFlush = false;
1298  if ( mpWindowImpl->mpFrameWindow->mpWindowImpl->mbPaintFrame )
1299  {
1300  Point aPoint( 0, 0 );
1301  vcl::Region aRegion( tools::Rectangle( aPoint, Size( mnOutWidth, mnOutHeight ) ) );
1303  if ( mpWindowImpl->mbFrame || (mpWindowImpl->mpBorderWindow && mpWindowImpl->mpBorderWindow->mpWindowImpl->mbFrame) )
1304  bFlush = true;
1305  }
1306 
1307  // First we should skip all windows which are Paint-Transparent
1308  vcl::Window* pUpdateWindow = this;
1309  vcl::Window* pWindow = pUpdateWindow;
1310  while ( !pWindow->ImplIsOverlapWindow() )
1311  {
1312  if ( !pWindow->mpWindowImpl->mbPaintTransparent )
1313  {
1314  pUpdateWindow = pWindow;
1315  break;
1316  }
1317  pWindow = pWindow->ImplGetParent();
1318  }
1319  // In order to limit drawing, an update only draws the window which
1320  // has PAINTALLCHILDREN set
1321  pWindow = pUpdateWindow;
1322  do
1323  {
1324  if ( pWindow->mpWindowImpl->mnPaintFlags & ImplPaintFlags::PaintAllChildren )
1325  pUpdateWindow = pWindow;
1326  if ( pWindow->ImplIsOverlapWindow() )
1327  break;
1328  pWindow = pWindow->ImplGetParent();
1329  }
1330  while ( pWindow );
1331 
1332  // if there is something to paint, trigger a Paint
1333  if ( pUpdateWindow->mpWindowImpl->mnPaintFlags & (ImplPaintFlags::Paint | ImplPaintFlags::PaintChildren) )
1334  {
1335  VclPtr<vcl::Window> xWindow(this);
1336 
1337  // trigger an update also for system windows on top of us,
1338  // otherwise holes would remain
1339  vcl::Window* pUpdateOverlapWindow = ImplGetFirstOverlapWindow()->mpWindowImpl->mpFirstOverlap;
1340  while ( pUpdateOverlapWindow )
1341  {
1342  pUpdateOverlapWindow->PaintImmediately();
1343  pUpdateOverlapWindow = pUpdateOverlapWindow->mpWindowImpl->mpNext;
1344  }
1345 
1346  pUpdateWindow->ImplCallPaint(nullptr, pUpdateWindow->mpWindowImpl->mnPaintFlags);
1347 
1348  if (comphelper::LibreOfficeKit::isActive() && pUpdateWindow->GetParentDialog())
1349  pUpdateWindow->LogicInvalidate(nullptr);
1350 
1351  if (xWindow->IsDisposed())
1352  return;
1353 
1354  bFlush = true;
1355  }
1356 
1357  if ( bFlush )
1358  Flush();
1359 }
1360 
1361 void Window::ImplPaintToDevice( OutputDevice* i_pTargetOutDev, const Point& i_rPos )
1362 {
1363  // Special drawing when called through LOKit
1364  // TODO: Move to its own method
1366  {
1367  VclPtrInstance<VirtualDevice> pDevice(*i_pTargetOutDev);
1368 
1369  Size aSize(GetOutputSizePixel());
1370  pDevice->SetOutputSizePixel(aSize);
1371 
1372  vcl::Font aCopyFont = GetFont();
1373  pDevice->SetFont(aCopyFont);
1374 
1375  pDevice->SetTextColor(GetTextColor());
1376  if (IsLineColor())
1377  pDevice->SetLineColor(GetLineColor());
1378  else
1379  pDevice->SetLineColor();
1380 
1381  if (IsFillColor())
1382  pDevice->SetFillColor(GetFillColor());
1383  else
1384  pDevice->SetFillColor();
1385 
1386  if (IsTextLineColor())
1387  pDevice->SetTextLineColor(GetTextLineColor());
1388  else
1389  pDevice->SetTextLineColor();
1390 
1391  if (IsOverlineColor())
1392  pDevice->SetOverlineColor(GetOverlineColor());
1393  else
1394  pDevice->SetOverlineColor();
1395 
1396  if (IsTextFillColor())
1397  pDevice->SetTextFillColor(GetTextFillColor());
1398  else
1399  pDevice->SetTextFillColor();
1400 
1401  pDevice->SetTextAlign(GetTextAlign());
1402  pDevice->SetRasterOp(GetRasterOp());
1403 
1404  tools::Rectangle aPaintRect(Point(), GetOutputSizePixel());
1405 
1406  vcl::Region aClipRegion(GetClipRegion());
1407  pDevice->SetClipRegion();
1408  aClipRegion.Intersect(aPaintRect);
1409  pDevice->SetClipRegion(aClipRegion);
1410 
1412  Erase(*pDevice);
1413 
1414  pDevice->SetMapMode(GetMapMode());
1415 
1417 
1418  i_pTargetOutDev->DrawOutDev(i_rPos, aSize, Point(), pDevice->PixelToLogic(aSize), *pDevice);
1419 
1420  // get rid of virtual device now so they don't pile up during recursive calls
1421  pDevice.disposeAndClear();
1422 
1423 
1424  for( vcl::Window* pChild = mpWindowImpl->mpFirstChild; pChild; pChild = pChild->mpWindowImpl->mpNext )
1425  {
1426  if( pChild->mpWindowImpl->mpFrame == mpWindowImpl->mpFrame && pChild->IsVisible() )
1427  {
1428  long nDeltaX = pChild->mnOutOffX - mnOutOffX;
1429  long nDeltaY = pChild->mnOutOffY - mnOutOffY;
1430 
1431  Point aPos( i_rPos );
1432  aPos += Point(nDeltaX, nDeltaY);
1433 
1434  pChild->ImplPaintToDevice( i_pTargetOutDev, aPos );
1435  }
1436  }
1437  return;
1438  }
1439 
1440 
1441  bool bRVisible = mpWindowImpl->mbReallyVisible;
1442  mpWindowImpl->mbReallyVisible = mpWindowImpl->mbVisible;
1443  bool bDevOutput = mbDevOutput;
1444  mbDevOutput = true;
1445 
1446  const OutputDevice *pOutDev = GetOutDev();
1447  long nOldDPIX = pOutDev->GetDPIX();
1448  long nOldDPIY = pOutDev->GetDPIY();
1449  mnDPIX = i_pTargetOutDev->GetDPIX();
1450  mnDPIY = i_pTargetOutDev->GetDPIY();
1451  bool bOutput = IsOutputEnabled();
1452  EnableOutput();
1453 
1454  SAL_WARN_IF( GetMapMode().GetMapUnit() != MapUnit::MapPixel, "vcl.window", "MapMode must be PIXEL based" );
1455  if ( GetMapMode().GetMapUnit() != MapUnit::MapPixel )
1456  return;
1457 
1458  // preserve graphicsstate
1459  Push();
1460  vcl::Region aClipRegion( GetClipRegion() );
1461  SetClipRegion();
1462 
1463  GDIMetaFile* pOldMtf = GetConnectMetaFile();
1464  GDIMetaFile aMtf;
1465  SetConnectMetaFile( &aMtf );
1466 
1467  // put a push action to metafile
1468  Push();
1469  // copy graphics state to metafile
1470  vcl::Font aCopyFont = GetFont();
1471  if( nOldDPIX != mnDPIX || nOldDPIY != mnDPIY )
1472  {
1473  aCopyFont.SetFontHeight( aCopyFont.GetFontHeight() * mnDPIY / nOldDPIY );
1474  aCopyFont.SetAverageFontWidth( aCopyFont.GetAverageFontWidth() * mnDPIX / nOldDPIX );
1475  }
1476  SetFont( aCopyFont );
1478  if( IsLineColor() )
1480  else
1481  SetLineColor();
1482  if( IsFillColor() )
1484  else
1485  SetFillColor();
1486  if( IsTextLineColor() )
1488  else
1489  SetTextLineColor();
1490  if( IsOverlineColor() )
1492  else
1493  SetOverlineColor();
1494  if( IsTextFillColor() )
1496  else
1497  SetTextFillColor();
1499  SetRasterOp( GetRasterOp() );
1500  if( IsRefPoint() )
1501  SetRefPoint( GetRefPoint() );
1502  else
1503  SetRefPoint();
1505 
1507  tools::Rectangle aPaintRect(Point(0, 0), GetOutputSizePixel());
1508  aClipRegion.Intersect( aPaintRect );
1509  SetClipRegion( aClipRegion );
1510 
1511  // do the actual paint
1512 
1513  // background
1515  {
1516  Erase(*this);
1517  }
1518  // foreground
1519  Paint(*this, aPaintRect);
1520  // put a pop action to metafile
1521  Pop();
1522 
1523  SetConnectMetaFile( pOldMtf );
1524  EnableOutput( bOutput );
1525  mpWindowImpl->mbReallyVisible = bRVisible;
1526 
1527  // paint metafile to VDev
1528  VclPtrInstance<VirtualDevice> pMaskedDevice(*i_pTargetOutDev,
1531 
1532  pMaskedDevice->SetOutputSizePixel( GetOutputSizePixel() );
1533  pMaskedDevice->EnableRTL( IsRTLEnabled() );
1534  aMtf.WindStart();
1535  aMtf.Play( pMaskedDevice );
1536  BitmapEx aBmpEx( pMaskedDevice->GetBitmapEx( Point( 0, 0 ), aPaintRect.GetSize() ) );
1537  i_pTargetOutDev->DrawBitmapEx( i_rPos, aBmpEx );
1538  // get rid of virtual device now so they don't pile up during recursive calls
1539  pMaskedDevice.disposeAndClear();
1540 
1541  for( vcl::Window* pChild = mpWindowImpl->mpFirstChild; pChild; pChild = pChild->mpWindowImpl->mpNext )
1542  {
1543  if( pChild->mpWindowImpl->mpFrame == mpWindowImpl->mpFrame && pChild->IsVisible() )
1544  {
1545  long nDeltaX = pChild->mnOutOffX - mnOutOffX;
1546 
1547  if( pOutDev->HasMirroredGraphics() )
1548  nDeltaX = mnOutWidth - nDeltaX - pChild->mnOutWidth;
1549  long nDeltaY = pChild->GetOutOffYPixel() - GetOutOffYPixel();
1550  Point aPos( i_rPos );
1551  Point aDelta( nDeltaX, nDeltaY );
1552  aPos += aDelta;
1553  pChild->ImplPaintToDevice( i_pTargetOutDev, aPos );
1554  }
1555  }
1556 
1557  // restore graphics state
1558  Pop();
1559 
1560  EnableOutput( bOutput );
1561  mpWindowImpl->mbReallyVisible = bRVisible;
1562  mbDevOutput = bDevOutput;
1563  mnDPIX = nOldDPIX;
1564  mnDPIY = nOldDPIY;
1565 }
1566 
1567 void Window::PaintToDevice(OutputDevice* pDev, const Point& rPos)
1568 {
1569  SAL_WARN_IF( pDev->HasMirroredGraphics(), "vcl.window", "PaintToDevice to mirroring graphics" );
1570  SAL_WARN_IF( pDev->IsRTLEnabled(), "vcl.window", "PaintToDevice to mirroring device" );
1571 
1572  vcl::Window* pRealParent = nullptr;
1573  if( ! mpWindowImpl->mbVisible )
1574  {
1575  vcl::Window* pTempParent = ImplGetDefaultWindow();
1576  pTempParent->EnableChildTransparentMode();
1577  pRealParent = GetParent();
1578  SetParent( pTempParent );
1579  // trigger correct visibility flags for children
1580  Show();
1581  Hide();
1582  }
1583 
1584  bool bVisible = mpWindowImpl->mbVisible;
1585  mpWindowImpl->mbVisible = true;
1586 
1587  if( mpWindowImpl->mpBorderWindow )
1588  mpWindowImpl->mpBorderWindow->ImplPaintToDevice( pDev, rPos );
1589  else
1590  ImplPaintToDevice( pDev, rPos );
1591 
1592  mpWindowImpl->mbVisible = bVisible;
1593 
1594  if( pRealParent )
1595  SetParent( pRealParent );
1596 }
1597 
1598 void Window::Erase(vcl::RenderContext& rRenderContext)
1599 {
1601  return;
1602 
1603  bool bNativeOK = false;
1604 
1606 
1607  if (aCtrlPart == ControlPart::Entire && IsControlBackground())
1608  {
1609  // nothing to do here; background is drawn in corresponding drawNativeControl implementation
1610  bNativeOK = true;
1611  }
1612  else if (aCtrlPart != ControlPart::NONE && ! IsControlBackground())
1613  {
1614  tools::Rectangle aCtrlRegion(Point(), GetOutputSizePixel());
1616 
1617  if (IsEnabled())
1618  nState |= ControlState::ENABLED;
1619 
1620  bNativeOK = rRenderContext.DrawNativeControl(ControlType::WindowBackground, aCtrlPart, aCtrlRegion,
1621  nState, ImplControlValue(), OUString());
1622  }
1623 
1624  if (mbBackground && !bNativeOK)
1625  {
1626  RasterOp eRasterOp = GetRasterOp();
1627  if (eRasterOp != RasterOp::OverPaint)
1629  rRenderContext.DrawWallpaper(0, 0, mnOutWidth, mnOutHeight, maBackground);
1630  if (eRasterOp != RasterOp::OverPaint)
1631  rRenderContext.SetRasterOp(eRasterOp);
1632  }
1633 
1634  if (mpAlphaVDev)
1635  mpAlphaVDev->Erase();
1636 }
1637 
1639  long nHorzScroll, long nVertScroll, ScrollFlags nFlags )
1640 {
1641  if ( !IsDeviceOutputNecessary() )
1642  return;
1643 
1644  nHorzScroll = ImplLogicWidthToDevicePixel( nHorzScroll );
1645  nVertScroll = ImplLogicHeightToDevicePixel( nVertScroll );
1646 
1647  if ( !nHorzScroll && !nVertScroll )
1648  return;
1649 
1650  if ( mpWindowImpl->mpCursor )
1651  mpWindowImpl->mpCursor->ImplSuspend();
1652 
1653  ScrollFlags nOrgFlags = nFlags;
1654  if ( !(nFlags & (ScrollFlags::Children | ScrollFlags::NoChildren)) )
1655  {
1656  if ( GetStyle() & WB_CLIPCHILDREN )
1657  nFlags |= ScrollFlags::NoChildren;
1658  else
1659  nFlags |= ScrollFlags::Children;
1660  }
1661 
1662  vcl::Region aInvalidateRegion;
1663  bool bScrollChildren(nFlags & ScrollFlags::Children);
1664 
1665  if ( !mpWindowImpl->mpFirstChild )
1666  bScrollChildren = false;
1667 
1668  OutputDevice *pOutDev = GetOutDev();
1669 
1670  // RTL: check if this window requires special action
1671  bool bReMirror = ImplIsAntiparallel();
1672 
1673  tools::Rectangle aRectMirror( rRect );
1674  if( bReMirror )
1675  {
1676  // make sure the invalidate region of this window is
1677  // computed in the same coordinate space as the one from the overlap windows
1678  pOutDev->ReMirror( aRectMirror );
1679  }
1680 
1681  // adapt paint areas
1682  ImplMoveAllInvalidateRegions( aRectMirror, nHorzScroll, nVertScroll, bScrollChildren );
1683 
1684  ImplCalcOverlapRegion( aRectMirror, aInvalidateRegion, !bScrollChildren, false );
1685 
1686  // if the scrolling on the device is performed in the opposite direction
1687  // then move the overlaps in that direction to compute the invalidate region
1688  // on the correct side, i.e., revert nHorzScroll
1689  if (!aInvalidateRegion.IsEmpty())
1690  {
1691  aInvalidateRegion.Move(bReMirror ? -nHorzScroll : nHorzScroll, nVertScroll);
1692  }
1693 
1694  tools::Rectangle aDestRect(aRectMirror);
1695  aDestRect.Move(bReMirror ? -nHorzScroll : nHorzScroll, nVertScroll);
1696  vcl::Region aWinInvalidateRegion(aRectMirror);
1697  if (!SupportsDoubleBuffering())
1698  {
1699  // There will be no CopyArea() call below, so invalidate the
1700  // whole visible area, not only the smaller one that was just
1701  // scrolled in.
1702  aWinInvalidateRegion.Exclude(aDestRect);
1703  }
1704 
1705  aInvalidateRegion.Union(aWinInvalidateRegion);
1706 
1707  Point aPoint( mnOutOffX, mnOutOffY );
1708  vcl::Region aRegion( tools::Rectangle( aPoint, Size( mnOutWidth, mnOutHeight ) ) );
1709  if ( nFlags & ScrollFlags::Clip )
1710  aRegion.Intersect( rRect );
1711  if ( mpWindowImpl->mbWinRegion )
1712  aRegion.Intersect( ImplPixelToDevicePixel( mpWindowImpl->maWinRegion ) );
1713 
1714  aRegion.Exclude( aInvalidateRegion );
1715 
1716  ImplClipBoundaries( aRegion, false, true );
1717  if ( !bScrollChildren )
1718  {
1719  if ( nOrgFlags & ScrollFlags::NoChildren )
1720  ImplClipAllChildren( aRegion );
1721  else
1722  ImplClipChildren( aRegion );
1723  }
1724  if ( mbClipRegion && (nFlags & ScrollFlags::UseClipRegion) )
1725  aRegion.Intersect( maRegion );
1726  if ( !aRegion.IsEmpty() )
1727  {
1728  if ( mpWindowImpl->mpWinData )
1729  {
1730  if ( mpWindowImpl->mbFocusVisible )
1731  ImplInvertFocus( *mpWindowImpl->mpWinData->mpFocusRect );
1732  if ( mpWindowImpl->mbTrackVisible && (mpWindowImpl->mpWinData->mnTrackFlags & ShowTrackFlags::TrackWindow) )
1733  InvertTracking( *mpWindowImpl->mpWinData->mpTrackRect, mpWindowImpl->mpWinData->mnTrackFlags );
1734  }
1735 #ifndef IOS
1736  // This seems completely unnecessary with tiled rendering, and
1737  // causes the "AquaSalGraphics::copyArea() for non-layered
1738  // graphics" message. Presumably we should bypass this on all
1739  // platforms when dealing with a "window" that uses tiled
1740  // rendering at the moment. Unclear how to figure that out,
1741  // though. Also unclear whether we actually could just not
1742  // create a "frame window", whatever that exactly is, in the
1743  // tiled rendering case, or at least for platforms where tiles
1744  // rendering is all there is.
1745 
1746  SalGraphics* pGraphics = ImplGetFrameGraphics();
1747  // The invalidation area contains the area what would be copied here,
1748  // so avoid copying in case of double buffering.
1749  if (pGraphics && !SupportsDoubleBuffering())
1750  {
1751  if( bReMirror )
1752  {
1753  pOutDev->ReMirror( aRegion );
1754  }
1755 
1756  pOutDev->SelectClipRegion( aRegion, pGraphics );
1757  pGraphics->CopyArea( rRect.Left()+nHorzScroll, rRect.Top()+nVertScroll,
1758  rRect.Left(), rRect.Top(),
1759  rRect.GetWidth(), rRect.GetHeight(),
1760  this );
1761  }
1762 #endif
1763  if ( mpWindowImpl->mpWinData )
1764  {
1765  if ( mpWindowImpl->mbFocusVisible )
1766  ImplInvertFocus( *mpWindowImpl->mpWinData->mpFocusRect );
1767  if ( mpWindowImpl->mbTrackVisible && (mpWindowImpl->mpWinData->mnTrackFlags & ShowTrackFlags::TrackWindow) )
1768  InvertTracking( *mpWindowImpl->mpWinData->mpTrackRect, mpWindowImpl->mpWinData->mnTrackFlags );
1769  }
1770  }
1771 
1772  if ( !aInvalidateRegion.IsEmpty() )
1773  {
1774  // RTL: the invalidate region for this windows is already computed in frame coordinates
1775  // so it has to be re-mirrored before calling the Paint-handler
1776  mpWindowImpl->mnPaintFlags |= ImplPaintFlags::CheckRtl;
1777 
1778  if ( !bScrollChildren )
1779  {
1780  if ( nOrgFlags & ScrollFlags::NoChildren )
1781  ImplClipAllChildren( aInvalidateRegion );
1782  else
1783  ImplClipChildren( aInvalidateRegion );
1784  }
1786  }
1787 
1788  if ( bScrollChildren )
1789  {
1790  vcl::Window* pWindow = mpWindowImpl->mpFirstChild;
1791  while ( pWindow )
1792  {
1793  Point aPos = pWindow->GetPosPixel();
1794  aPos += Point( nHorzScroll, nVertScroll );
1795  pWindow->SetPosPixel( aPos );
1796 
1797  pWindow = pWindow->mpWindowImpl->mpNext;
1798  }
1799  }
1800 
1801  if ( nFlags & ScrollFlags::Update )
1802  PaintImmediately();
1803 
1804  if ( mpWindowImpl->mpCursor )
1805  mpWindowImpl->mpCursor->ImplResume();
1806 }
1807 
1808 } /* namespace vcl */
1809 
1810 
1811 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual Point GetPosPixel() const
Definition: window.cxx:2792
void EnableOutput(bool bEnable=true)
Point TopLeft() const
vcl::Region GetClipRegion() const
const Color & GetTextColor() const
Definition: outdev.hxx:1125
The child windows are invalidated, too.
bool IsControlBackground() const
Definition: window2.cxx:1087
long mnOutOffX
Output offset for device output in pixel (pseudo window offset within window system's frames) ...
Definition: outdev.hxx:340
void SetDigitLanguage(LanguageType)
tools::Rectangle m_aPaintRect
Definition: paint.cxx:170
long GetWidth() const
const Wallpaper & GetBackground() const
Definition: outdev.hxx:643
SAL_DLLPRIVATE SalGraphics * ImplGetFrameGraphics() const
Definition: window.cxx:1269
vcl::LOKWindowId GetLOKWindowId() const
Definition: window.cxx:3228
bool bVisible
long GetHeight() const
SAL_DLLPRIVATE bool ImplIsRecordLayout() const
Definition: outdev.cxx:641
void SetAverageFontWidth(long nWidth)
Definition: font/font.cxx:676
bool IsNull() const
Definition: region.hxx:102
PaintBufferGuard(ImplFrameData *pFrameData, vcl::Window *pWindow)
Definition: paint.cxx:45
long GetFontHeight() const
Definition: font/font.cxx:675
The parent window is invalidated, too.
const Point & GetRefPoint() const
Definition: outdev.hxx:434
virtual void ImplPaintToDevice(::OutputDevice *pTargetOutDev, const Point &rPos)
Definition: paint.cxx:1361
const Color & GetHighlightTextColor() const
SAL_DLLPRIVATE void ImplMoveInvalidateRegion(const tools::Rectangle &rRect, long nHorzScroll, long nVertScroll, bool bChildren)
Definition: paint.cxx:856
static void DrawSelectionBackground(vcl::RenderContext &rRenderContext, vcl::Window const &rWindow, const tools::Rectangle &rRect, sal_uInt16 nHighlight, bool bChecked, bool bDrawBorder, bool bDrawExtBorderOnly, Color *pSelectionTextColor=nullptr, long nCornerRadius=0, Color const *pPaintColor=nullptr)
Definition: paint.cxx:323
InvalidateFlags
Definition: window.hxx:212
long mnOutOffY
Output offset for device output in pixel (pseudo window offset within window system's frames) ...
Definition: outdev.hxx:342
const Color & GetTextLineColor() const
Definition: outdev.hxx:1134
void DrawBitmapEx(const Point &rDestPt, const BitmapEx &rBitmapEx)
This is an overloaded member function, provided for convenience. It differs from the above function o...
tools::Rectangle m_aSelectionRect
Definition: paint.cxx:169
void Union(const tools::Rectangle &rRegion)
Definition: region.cxx:508
VclPtr< vcl::Window > m_pWindow
Definition: paint.cxx:167
bool IsBackground() const
Definition: outdev.hxx:646
void InvertTracking(const tools::Rectangle &rRect, ShowTrackFlags nFlags)
Definition: window2.cxx:158
long AdjustLeft(long nHorzMoveDelta)
ValidateFlags
Definition: window.hxx:236
long GetOutOffXPixel() const
Definition: outdev.hxx:445
ImplPaintFlags GetPaintFlags() const
Definition: paint.cxx:198
bool mbInBufferedPaint
PaintHelper is in the process of painting into this buffer.
Definition: window.h:178
void disposeAndClear()
Definition: vclptr.hxx:200
const StyleSettings & GetStyleSettings() const
TextAlign GetTextAlign() const
Definition: outdev.hxx:1143
bool IsOutputEnabled() const
Definition: outdev.hxx:600
ParentClipMode GetParentClipMode() const
sal_uInt8 GetLuminance() const
const Color & GetFaceColor() const
bool IsTextLineColor() const
Definition: outdev.hxx:1135
void Flush() override
Definition: window.cxx:2942
vcl::Region maRegion
Definition: outdev.hxx:359
vcl::Region maInvalidateRegion
Definition: window.h:289
virtual Size GetSizePixel() const
Definition: window.cxx:2395
SAL_DLLPRIVATE WindowImpl * ImplGetWindowImpl() const
Definition: window.hxx:563
ComplexTextLayoutFlags GetLayoutMode() const
Definition: outdev.hxx:610
const MapMode & GetMapMode() const
Definition: outdev.hxx:1677
sal_Int32 mnDPIY
Definition: outdev.hxx:346
void SetTextFillColor()
Definition: text.cxx:701
vcl::Region GetPaintRegion() const
Definition: paint.cxx:1146
void SetLayoutMode(ComplexTextLayoutFlags nTextLayoutMode)
void SetPop()
Definition: paint.cxx:178
GDIMetaFile * GetConnectMetaFile() const
Definition: outdev.hxx:415
ImplWinData * mpWinData
Definition: window.h:224
The invalidated area is updated immediately.
sal_Int32 mnDPIX
Definition: outdev.hxx:345
virtual void SetSettings(const AllSettings &rSettings)
Definition: outdev.cxx:213
The area is invalidated regardless of overlapping child windows.
constexpr::Color COL_LIGHTGRAY(0xC0, 0xC0, 0xC0)
SAL_DLLPRIVATE void ImplClipAllChildren(vcl::Region &rRegion) const
SAL_DLLPRIVATE void ImplUpdateAll()
Definition: paint.cxx:987
tools::Rectangle GetBoundRect() const
Definition: region.cxx:1214
void PaintImmediately()
Definition: paint.cxx:1286
VclPtr< VirtualDevice > mpBuffer
Buffer for the double-buffering.
Definition: window.h:177
SAL_DLLPRIVATE void ImplCallPaint(const vcl::Region *pRegion, ImplPaintFlags nPaintFlags)
Invoke the actual painting.
Definition: paint.cxx:578
void PaintBuffer()
Paint the content of the buffer to the current m_pWindow.
Definition: paint.cxx:236
void SetMapMode()
Definition: map.cxx:654
Dialog * GetParentDialog() const
Definition: window2.cxx:982
const Color & GetHighlightColor() const
Color GetBackgroundColor() const override
Definition: window.cxx:586
SAL_DLLPRIVATE void ImplInvalidateFrameRegion(const vcl::Region *pRegion, InvalidateFlags nFlags)
Definition: paint.cxx:684
bool GetRestoreCursor() const
Definition: paint.cxx:194
ImplFrameData * mpFrameData
Definition: window.h:404
long AdjustBottom(long nVertMoveDelta)
bool SelectClipRegion(const vcl::Region &, SalGraphics *pGraphics=nullptr)
SAL_DLLPRIVATE bool ImplIsOverlapWindow() const
Definition: window2.cxx:926
void Move(long nHorzMoveDelta, long nVertMoveDelta)
std::vector< tools::Rectangle > RectangleVector
Definition: region.hxx:37
The invalidated area is painted with the background color/pattern.
void DrawWallpaper(const tools::Rectangle &rRect, const Wallpaper &rWallpaper)
Definition: wallpaper.cxx:42
bool IsEmpty() const
const Color & GetOverlineColor() const
Definition: outdev.hxx:1139
Color GetTextFillColor() const
Definition: text.cxx:759
void SetBackground()
ScrollFlags
Definition: window.hxx:248
SAL_DLLPRIVATE void ReMirror(Point &rPoint) const
Definition: outdev.cxx:604
VclPtr< vcl::Window > GetParentWithLOKNotifier()
Find the nearest parent with LOK Notifier; can be itself if this Window has LOK notifier set...
Definition: window.cxx:3233
SAL_DLLPRIVATE void ImplInvalidate(const vcl::Region *rRegion, InvalidateFlags nFlags)
Definition: paint.cxx:775
const BorderLinePrimitive2D *pCandidateB assert(pCandidateA)
SAL_DLLPRIVATE void ImplInvalidateParentFrameRegion(vcl::Region &rRegion)
Definition: paint.cxx:764
const vcl::Font & GetFont() const
Definition: outdev.hxx:649
RasterOp
Definition: vclenum.hxx:194
SAL_DLLPRIVATE void ImplClipBoundaries(vcl::Region &rRegion, bool bThis, bool bOverlaps)
void Hide()
Definition: window.hxx:945
bool mbBackground
Definition: outdev.hxx:376
VclPtr< vcl::Window > mpLastChild
Definition: window.h:235
vcl::RenderContext * GetRenderContext()
Returns either the frame's buffer or the window, in case of no buffering.
Definition: paint.cxx:155
PushFlags
Definition: outdevstate.hxx:38
virtual OUString GetText() const
Definition: window.cxx:3039
long Top() const
void SetWindowRegionPixel()
Definition: paint.cxx:1036
void Play(GDIMetaFile &rMtf)
Definition: gdimtf.cxx:325
SAL_DLLPRIVATE void ImplValidate()
Definition: paint.cxx:958
void Move(long nHorzMove, long nVertMove)
Definition: region.cxx:414
static Color HSBtoRGB(sal_uInt16 nHue, sal_uInt16 nSaturation, sal_uInt16 nBrightness)
void SetTextLineColor()
Definition: textline.cxx:800
void DrawRect(const tools::Rectangle &rRect)
Definition: rect.cxx:51
tools::Rectangle maBufferedRect
Rectangle in the buffer that has to be painted to the screen.
Definition: window.h:179
ImplPaintFlags
Definition: window.h:201
const Color & GetControlForeground() const
Definition: window2.cxx:1072
std::optional< tools::Rectangle > mpTrackRect
Definition: window.h:115
bool IsTextFillColor() const
Definition: outdev.hxx:1130
bool IsEmpty() const
Definition: region.cxx:228
void SetLineColor()
void PaintToDevice(::OutputDevice *pDevice, const Point &rPos)
Definition: paint.cxx:1567
void SetRefPoint()
Definition: outdev.cxx:278
virtual void PrePaint(vcl::RenderContext &rRenderContext)
Definition: paint.cxx:1011
void SetConnectMetaFile(GDIMetaFile *pMtf)
Definition: outdev.cxx:208
bool IsRTLEnabled() const
Definition: outdev.hxx:1356
void StartBufferedPaint()
Start buffered paint: set it up to have the same settings as m_pWindow.
Definition: paint.cxx:226
Wallpaper maBackground
Definition: outdev.hxx:367
bool IsEmpty() const
#define VCL_GL_INFO(stream)
Helper to do a SAL_INFO as well as a GL log.
ImplPaintFlags m_nPaintFlags
Definition: paint.cxx:172
bool IsClipRegion() const
Definition: outdev.hxx:675
bool IsDark() const
bool IsLineColor() const
Definition: outdev.hxx:631
void DrawSelectionBackground(const tools::Rectangle &rRect, sal_uInt16 highlight, bool bChecked, bool bDrawBorder)
Definition: window.cxx:3434
void SetEmpty()
Definition: region.cxx:1417
virtual void EnableRTL(bool bEnable=true) override
Definition: virdev.cxx:383
void SetParent(vcl::Window *pNewParent)
Definition: stacking.cxx:835
bool SetOutputSizePixel(const Size &rNewSize, bool bErase=true)
Definition: virdev.cxx:395
virtual void ApplySettings(vcl::RenderContext &rRenderContext)
Definition: window.cxx:3780
void DrawTransparent(const tools::PolyPolygon &rPolyPoly, sal_uInt16 nTransparencePercent)
Any aHelper
SAL_DLLPRIVATE void ImplCallOverlapPaint()
Definition: paint.cxx:623
~PaintHelper()
Definition: paint.cxx:535
virtual void Invalidate(InvalidateFlags nFlags=InvalidateFlags::NONE)
Definition: paint.cxx:1162
SAL_DLLPRIVATE bool ImplIsAntiparallel() const
Definition: outdev.cxx:588
vcl::Region & GetPaintRegion()
Definition: paint.cxx:202
bool m_bPop
Definition: paint.cxx:173
bool m_bStartedBufferedPaint
This PaintHelper started a buffered paint, and should paint it on the screen when being destructed...
Definition: paint.cxx:175
virtual bool HasMirroredGraphics() const
Definition: outdev.cxx:636
std::unique_ptr< vcl::Region > m_pChildRegion
Definition: paint.cxx:168
SAL_DLLPRIVATE void PopPaintHelper(PaintHelper const *pHelper)
Definition: paint.cxx:519
void SetFillColor()
const ::std::vector< Color > ImpSvNumberformatScan::StandardColor COL_GRAY
Some things multiple-inherit from VclAbstractDialog and OutputDevice, so we need to use virtual inher...
Definition: outdev.hxx:302
const Color & GetLineColor() const
Definition: outdev.hxx:630
void SetTextColor(const Color &rColor)
Definition: text.cxx:666
bool HasPaintEvent() const
Definition: paint.cxx:1259
std::unique_ptr< WindowImpl > mpWindowImpl
Definition: window.hxx:519
void SetOutOffYPixel(long nOutOffY)
Definition: outdev.cxx:319
void SetPaintRect(const tools::Rectangle &rRect)
Definition: paint.cxx:182
SAL_DLLPRIVATE vcl::Window * ImplGetParent() const
Definition: window2.cxx:865
virtual void PixelInvalidate(const tools::Rectangle *pRectangle)
Notification about some rectangle of the output device got invalidated.
Definition: paint.cxx:1220
void Intersect(const tools::Rectangle &rRegion)
Definition: region.cxx:584
void Validate()
Definition: paint.cxx:1251
void SetOverlineColor()
Definition: textline.cxx:849
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.
const AllSettings & GetSettings() const
Definition: outdev.hxx:418
void SetPaintTransparent(bool bTransparent)
Definition: paint.cxx:1024
Size GetOutputSizePixel() const
Definition: outdev.hxx:441
MapUnit GetMapUnit() const
Definition: mapmod.cxx:168
Sets up the buffer to have settings matching the window, and restores the original state in the dtor...
Definition: window.h:402
void WindStart()
Definition: gdimtf.cxx:553
ControlPart mnNativeBackground
Definition: window.h:296
vcl::Window * GetParent() const
Definition: window2.cxx:1097
SAL_DLLPRIVATE void ImplCalcOverlapRegion(const tools::Rectangle &rSourceRect, vcl::Region &rRegion, bool bChildren, bool bSiblings)
Size GetSize() const
void SetPaintRect(const tools::Rectangle &rRectangle)
If this is called, then the dtor will also copy rRectangle to the window from the buffer...
Definition: paint.cxx:150
MapUnit GetMapUnit()
AllSettings maSettings
Definition: window.h:408
Point PixelToLogic(const Point &rDevicePt) const
Definition: map.cxx:1186
Point LogicToPixel(const Point &rLogicPt) const
Definition: map.cxx:941
SAL_DLLPRIVATE void ImplValidateFrameRegion(const vcl::Region *rRegion, ValidateFlags nFlags)
Definition: paint.cxx:916
SAL_DLLPRIVATE vcl::Window * ImplGetFirstOverlapWindow()
Definition: window2.cxx:880
A construction helper for a temporary VclPtr.
Definition: vclptr.hxx:275
void SetSelectionRect(const tools::Rectangle &rRect)
Definition: paint.cxx:186
VclPtr< VirtualDevice > mpAlphaVDev
Definition: outdev.hxx:329
void Exclude(const tools::Rectangle &rRegion)
Definition: region.cxx:675
void CopyArea(long nDestX, long nDestY, long nSrcX, long nSrcY, long nSrcWidth, long nSrcHeight, const OutputDevice *pOutDev)
SAL_DLLPRIVATE vcl::Region ImplPixelToDevicePixel(const vcl::Region &rRegion) const
Convert a region in pixel units to a region in device pixel units and coords.
Definition: map.cxx:636
void Erase()
Definition: wallpaper.cxx:103
def rectangle(l)
bool IsRefPoint() const
Definition: outdev.hxx:435
long AdjustRight(long nHorzMoveDelta)
bool mbClipRegion
Definition: outdev.hxx:375
tools::Rectangle & Union(const tools::Rectangle &rRect)
const Color & GetButtonTextColor() const
#define SAL_WARN_IF(condition, area, stream)
void DoPaint(const vcl::Region *pRegion)
Definition: paint.cxx:246
void SetFont(const vcl::Font &rNewFont)
SAL_DLLPRIVATE void ImplInvalidateOverlapFrameRegion(const vcl::Region &rRegion)
Definition: paint.cxx:745
SAL_DLLPRIVATE void ImplMoveAllInvalidateRegions(const tools::Rectangle &rRect, long nHorzScroll, long nVertScroll, bool bChildren)
Definition: paint.cxx:879
LanguageType GetDigitLanguage() const
Definition: outdev.hxx:613
SAL_DLLPRIVATE vcl::Region * ImplGetWinChildClipRegion()
SAL_DLLPRIVATE void ImplScroll(const tools::Rectangle &rRect, long nHorzScroll, long nVertScroll, ScrollFlags nFlags)
Definition: paint.cxx:1638
tools::Rectangle m_aPaintRect
Definition: window.h:411
bool IsVisible() const
Definition: window2.cxx:1102
bool mbInitClipRegion
Definition: outdev.hxx:386
const ::std::vector< Color > ImpSvNumberformatScan::StandardColor COL_WHITE
::OutputDevice const * GetOutDev() const
Definition: window.cxx:576
void EnableChildTransparentMode(bool bEnable=true)
Definition: window2.cxx:1022
void SetRasterOp(RasterOp eRasterOp)
SAL_DLLPRIVATE void PushPaintHelper(PaintHelper *pHelper, vcl::RenderContext &rRenderContext)
Definition: paint.cxx:475
void SetFontHeight(long nHeight)
Definition: font/font.cxx:674
long AdjustTop(long nVertMoveDelta)
virtual void Paint(vcl::RenderContext &rRenderContext, const tools::Rectangle &rRect)
Definition: paint.cxx:1019
const char * name
const ::std::vector< Color > ImpSvNumberformatScan::StandardColor COL_BLACK
long GetOutOffYPixel() const
Definition: outdev.hxx:446
RasterOp GetRasterOp() const
Definition: outdev.hxx:616
virtual void DrawOutDev(const Point &rDestPt, const Size &rDestSize, const Point &rSrcPt, const Size &rSrcSize)
Definition: outdev.cxx:348
SAL_DLLPRIVATE long ImplLogicWidthToDevicePixel(long nWidth) const
Convert a logical width to a width in units of device pixels.
Definition: map.cxx:430
long Left() const
ShowTrackFlags mnTrackFlags
Definition: window.h:116
SAL_DLLPRIVATE bool ImplSetClipFlag(bool bSysObjOnlySmaller=false)
bool IsDisposed() const
Definition: window.cxx:140
SAL_DLLPRIVATE long ImplLogicHeightToDevicePixel(long nHeight) const
Convert a logical height to a height in units of device pixels.
Definition: map.cxx:440
bool IsBitmap() const
Definition: wall.cxx:255
SAL_DLLPRIVATE bool ImplClipChildren(vcl::Region &rRegion) const
long mnOutWidth
Definition: outdev.hxx:343
SAL_DLLPRIVATE tools::Rectangle ImplLogicToDevicePixel(const tools::Rectangle &rLogicRect) const
Convert a logical rectangle to a rectangle in physical device pixel units.
Definition: map.cxx:504
bool mbDevOutput
Definition: outdev.hxx:378
bool IsPaintTransparent() const
Definition: window2.cxx:1037
SAL_DLLPRIVATE void ImplInvertFocus(const tools::Rectangle &rRect)
Definition: mouse.cxx:176
BitmapEx GetBitmapEx(const Point &rSrcPt, const Size &rSize) const
Query extended bitmap (with alpha channel, if available).
reference_type * get() const
Get the body.
Definition: vclptr.hxx:143
bool IsEnabled() const
Definition: window2.cxx:1122
const vcl::ILibreOfficeKitNotifier * GetLOKNotifier() const
Definition: window.cxx:3223
#define SAL_WARN(area, stream)
void SetOutOffXPixel(long nOutOffX)
Definition: outdev.cxx:314
WinBits GetStyle() const
Definition: window2.cxx:953
Definition: timer.hxx:26
SAL_DLLPRIVATE tools::Rectangle ImplDevicePixelToLogic(const tools::Rectangle &rPixelRect) const
Convert a rectangle in physical pixel units to a rectangle in physical pixel units and coords...
Definition: map.cxx:611
virtual void LogicInvalidate(const tools::Rectangle *pRectangle)
Notification about some rectangle of the output device got invalidated.Used for the main document win...
Definition: paint.cxx:1209
bool IsFillColor() const
Definition: outdev.hxx:636
if(!pCandidateA->getEnd().equal(pCandidateB->getStart()))
vcl::Region m_aPaintRegion
Definition: paint.cxx:171
virtual void PostPaint(vcl::RenderContext &rRenderContext)
Definition: paint.cxx:1015
bool IsOverlineColor() const
Definition: outdev.hxx:1140
void CallEventListeners(VclEventId nEvent, void *pData=nullptr)
Definition: event.cxx:217
bool IsReallyVisible() const
Definition: window2.cxx:1107
long GetAverageFontWidth() const
Definition: font/font.cxx:677
void SetRestoreCursor(bool bRestoreCursor)
Definition: paint.cxx:190
ImplPaintFlags mnPaintFlags
Definition: window.h:298
long mnOutHeight
Definition: outdev.hxx:344
rtl::OString toString() const
The parent window is not invalidated.
vcl::Window * ImplGetDefaultWindow()
Returns either the application window, or the default GL context window.
Definition: svdata.cxx:211
IMPL_LINK_NOARG(QuickSelectionEngine_Data, SearchStringTimeout, Timer *, void)
bool IsDeviceOutputNecessary() const
Definition: outdev.hxx:601
void Push(PushFlags nFlags=PushFlags::ALL)
Definition: outdevstate.cxx:60
bool SupportsDoubleBuffering() const
Can the widget derived from this Window do the double-buffering via RenderContext properly...
Definition: window.cxx:3790
SAL_DLLPRIVATE sal_Int32 GetDPIY() const
Get the output device's DPI y-axis value.
Definition: outdev.hxx:509
The child windows are not invalidated.
bool m_bRestoreCursor
Definition: paint.cxx:174
sal_Int32 h
WinBits const WB_CLIPCHILDREN
sal_Int32 nState
PaintHelper(vcl::Window *pWindow, ImplPaintFlags nPaintFlags)
Definition: paint.cxx:217
virtual void SetPosPixel(const Point &rNewPos)
Definition: window2.cxx:1257
VclPtr< vcl::Window > m_pWindow
Definition: window.h:405
bool mbTrackVisible
Definition: window.h:317
SAL_DLLPRIVATE sal_Int32 GetDPIX() const
Get the output device's DPI x-axis value.
Definition: outdev.hxx:503
void SetTextAlign(TextAlign eAlign)
Definition: text.cxx:767
const Color & GetFillColor() const
Definition: outdev.hxx:635
Wallpaper maBackground
Definition: window.h:407
void Show(bool bVisible=true, ShowFlags nFlags=ShowFlags::NONE)
Definition: window.cxx:2181