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, tools::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 #ifndef IOS
646  comphelper::ProfileZone aZone("VCL idle re-paint");
647 
648  // save paint events until layout is done
649  if (IsSystemWindow() && static_cast<const SystemWindow*>(this)->hasPendingLayout())
650  {
651  mpWindowImpl->mpFrameData->maPaintIdle.Start();
652  return;
653  }
654 
655  // save paint events until resizing or initial sizing done
656  if (mpWindowImpl->mbFrame &&
657  mpWindowImpl->mpFrameData->maResizeIdle.IsActive())
658  {
659  mpWindowImpl->mpFrameData->maPaintIdle.Start();
660  }
661  else if ( mpWindowImpl->mbReallyVisible )
662  {
663  ImplCallOverlapPaint();
665  mpWindowImpl->mpFrameData->maPaintIdle.IsActive())
666  mpWindowImpl->mpFrameData->maPaintIdle.Stop();
667  }
668 #endif
669 }
670 
671 IMPL_LINK_NOARG(Window, ImplHandleResizeTimerHdl, Timer *, void)
672 {
673  comphelper::ProfileZone aZone("VCL idle resize");
674 
675  if( mpWindowImpl->mbReallyVisible )
676  {
677  ImplCallResize();
678  if( mpWindowImpl->mpFrameData->maPaintIdle.IsActive() )
679  {
680  mpWindowImpl->mpFrameData->maPaintIdle.Stop();
681  mpWindowImpl->mpFrameData->maPaintIdle.Invoke( nullptr );
682  }
683  }
684 }
685 
687 {
688  // set PAINTCHILDREN for all parent windows till the first OverlapWindow
689  if ( !ImplIsOverlapWindow() )
690  {
691  vcl::Window* pTempWindow = this;
693  do
694  {
695  pTempWindow = pTempWindow->ImplGetParent();
696  if ( pTempWindow->mpWindowImpl->mnPaintFlags & ImplPaintFlags::PaintChildren )
697  break;
698  pTempWindow->mpWindowImpl->mnPaintFlags |= ImplPaintFlags::PaintChildren | nTranspPaint;
699  if( ! pTempWindow->IsPaintTransparent() )
700  nTranspPaint = ImplPaintFlags::NONE;
701  }
702  while ( !pTempWindow->ImplIsOverlapWindow() );
703  }
704 
705  // set Paint-Flags
706  mpWindowImpl->mnPaintFlags |= ImplPaintFlags::Paint;
707  if ( nFlags & InvalidateFlags::Children )
709  if ( !(nFlags & InvalidateFlags::NoErase) )
710  mpWindowImpl->mnPaintFlags |= ImplPaintFlags::Erase;
711 
712  if ( !pRegion )
713  mpWindowImpl->mnPaintFlags |= ImplPaintFlags::PaintAll;
714  else if ( !(mpWindowImpl->mnPaintFlags & ImplPaintFlags::PaintAll) )
715  {
716  // if not everything has to be redrawn, add the region to it
717  mpWindowImpl->maInvalidateRegion.Union( *pRegion );
718  }
719 
720  // Handle transparent windows correctly: invalidate must be done on the first opaque parent
722  && ImplGetParent() )
723  {
724  vcl::Window *pParent = ImplGetParent();
725  while( pParent && pParent->IsPaintTransparent() )
726  pParent = pParent->ImplGetParent();
727  if( pParent )
728  {
729  vcl::Region *pChildRegion;
730  if ( mpWindowImpl->mnPaintFlags & ImplPaintFlags::PaintAll )
731  // invalidate the whole child window region in the parent
732  pChildRegion = ImplGetWinChildClipRegion();
733  else
734  // invalidate the same region in the parent that has to be repainted in the child
735  pChildRegion = &mpWindowImpl->maInvalidateRegion;
736 
737  nFlags |= InvalidateFlags::Children; // paint should also be done on all children
738  nFlags &= ~InvalidateFlags::NoErase; // parent should paint and erase to create proper background
739  pParent->ImplInvalidateFrameRegion( pChildRegion, nFlags );
740  }
741  }
742 
743  if ( !mpWindowImpl->mpFrameData->maPaintIdle.IsActive() )
744  mpWindowImpl->mpFrameData->maPaintIdle.Start();
745 }
746 
748 {
749  vcl::Region aRegion = rRegion;
750 
751  ImplClipBoundaries( aRegion, true, true );
752  if ( !aRegion.IsEmpty() )
754 
755  // now we invalidate the overlapping windows
756  vcl::Window* pTempWindow = mpWindowImpl->mpFirstOverlap;
757  while ( pTempWindow )
758  {
759  if ( pTempWindow->IsVisible() )
760  pTempWindow->ImplInvalidateOverlapFrameRegion( rRegion );
761 
762  pTempWindow = pTempWindow->mpWindowImpl->mpNext;
763  }
764 }
765 
767 {
768  if ( mpWindowImpl->mbOverlapWin )
769  mpWindowImpl->mpFrameWindow->ImplInvalidateOverlapFrameRegion( rRegion );
770  else
771  {
772  if( ImplGetParent() )
774  }
775 }
776 
777 void Window::ImplInvalidate( const vcl::Region* pRegion, InvalidateFlags nFlags )
778 {
779  // check what has to be redrawn
780  bool bInvalidateAll = !pRegion;
781 
782  // take Transparent-Invalidate into account
783  vcl::Window* pOpaqueWindow = this;
784  if ( (mpWindowImpl->mbPaintTransparent && !(nFlags & InvalidateFlags::NoTransparent)) || (nFlags & InvalidateFlags::Transparent) )
785  {
786  vcl::Window* pTempWindow = pOpaqueWindow->ImplGetParent();
787  while ( pTempWindow )
788  {
789  if ( !pTempWindow->IsPaintTransparent() )
790  {
791  pOpaqueWindow = pTempWindow;
792  nFlags |= InvalidateFlags::Children;
793  bInvalidateAll = false;
794  break;
795  }
796 
797  if ( pTempWindow->ImplIsOverlapWindow() )
798  break;
799 
800  pTempWindow = pTempWindow->ImplGetParent();
801  }
802  }
803 
804  // assemble region
805  InvalidateFlags nOrgFlags = nFlags;
807  {
808  if ( GetStyle() & WB_CLIPCHILDREN )
809  nFlags |= InvalidateFlags::NoChildren;
810  else
811  nFlags |= InvalidateFlags::Children;
812  }
813  if ( (nFlags & InvalidateFlags::NoChildren) && mpWindowImpl->mpFirstChild )
814  bInvalidateAll = false;
815  if ( bInvalidateAll )
816  ImplInvalidateFrameRegion( nullptr, nFlags );
817  else
818  {
820  vcl::Region aRegion( aRect );
821  if ( pRegion )
822  {
823  // RTL: remirror region before intersecting it
824  if ( ImplIsAntiparallel() )
825  {
826  const OutputDevice *pOutDev = GetOutDev();
827 
828  vcl::Region aRgn( *pRegion );
829  pOutDev->ReMirror( aRgn );
830  aRegion.Intersect( aRgn );
831  }
832  else
833  aRegion.Intersect( *pRegion );
834  }
835  ImplClipBoundaries( aRegion, true, true );
836  if ( nFlags & InvalidateFlags::NoChildren )
837  {
838  nFlags &= ~InvalidateFlags::Children;
839  if ( !(nFlags & InvalidateFlags::NoClipChildren) )
840  {
841  if ( nOrgFlags & InvalidateFlags::NoChildren )
842  ImplClipAllChildren( aRegion );
843  else
844  {
845  if ( ImplClipChildren( aRegion ) )
846  nFlags |= InvalidateFlags::Children;
847  }
848  }
849  }
850  if ( !aRegion.IsEmpty() )
851  ImplInvalidateFrameRegion( &aRegion, nFlags ); // transparency is handled here, pOpaqueWindow not required
852  }
853 
854  if ( nFlags & InvalidateFlags::Update )
855  pOpaqueWindow->PaintImmediately(); // start painting at the opaque parent
856 }
857 
859  tools::Long nHorzScroll, tools::Long nVertScroll,
860  bool bChildren )
861 {
863  {
864  vcl::Region aTempRegion = mpWindowImpl->maInvalidateRegion;
865  aTempRegion.Intersect( rRect );
866  aTempRegion.Move( nHorzScroll, nVertScroll );
867  mpWindowImpl->maInvalidateRegion.Union( aTempRegion );
868  }
869 
870  if ( bChildren && (mpWindowImpl->mnPaintFlags & ImplPaintFlags::PaintChildren) )
871  {
872  vcl::Window* pWindow = mpWindowImpl->mpFirstChild;
873  while ( pWindow )
874  {
875  pWindow->ImplMoveInvalidateRegion( rRect, nHorzScroll, nVertScroll, true );
876  pWindow = pWindow->mpWindowImpl->mpNext;
877  }
878  }
879 }
880 
882  tools::Long nHorzScroll, tools::Long nVertScroll,
883  bool bChildren )
884 {
885  // also shift Paint-Region when paints need processing
886  ImplMoveInvalidateRegion( rRect, nHorzScroll, nVertScroll, bChildren );
887  // Paint-Region should be shifted, as drawn by the parents
888  if ( ImplIsOverlapWindow() )
889  return;
890 
891  vcl::Region aPaintAllRegion;
892  vcl::Window* pPaintAllWindow = this;
893  do
894  {
895  pPaintAllWindow = pPaintAllWindow->ImplGetParent();
896  if ( pPaintAllWindow->mpWindowImpl->mnPaintFlags & ImplPaintFlags::PaintAllChildren )
897  {
898  if ( pPaintAllWindow->mpWindowImpl->mnPaintFlags & ImplPaintFlags::PaintAll )
899  {
900  aPaintAllRegion.SetEmpty();
901  break;
902  }
903  else
904  aPaintAllRegion.Union( pPaintAllWindow->mpWindowImpl->maInvalidateRegion );
905  }
906  }
907  while ( !pPaintAllWindow->ImplIsOverlapWindow() );
908  if ( !aPaintAllRegion.IsEmpty() )
909  {
910  aPaintAllRegion.Move( nHorzScroll, nVertScroll );
912  if ( bChildren )
913  nPaintFlags |= InvalidateFlags::Children;
914  ImplInvalidateFrameRegion( &aPaintAllRegion, nPaintFlags );
915  }
916 }
917 
919 {
920  if ( !pRegion )
921  mpWindowImpl->maInvalidateRegion.SetEmpty();
922  else
923  {
924  // when all child windows have to be drawn we need to invalidate them before doing so
925  if ( (mpWindowImpl->mnPaintFlags & ImplPaintFlags::PaintAllChildren) && mpWindowImpl->mpFirstChild )
926  {
927  vcl::Region aChildRegion = mpWindowImpl->maInvalidateRegion;
928  if ( mpWindowImpl->mnPaintFlags & ImplPaintFlags::PaintAll )
929  {
931  aChildRegion = aRect;
932  }
933  vcl::Window* pChild = mpWindowImpl->mpFirstChild;
934  while ( pChild )
935  {
937  pChild = pChild->mpWindowImpl->mpNext;
938  }
939  }
940  if ( mpWindowImpl->mnPaintFlags & ImplPaintFlags::PaintAll )
941  {
943  mpWindowImpl->maInvalidateRegion = aRect;
944  }
945  mpWindowImpl->maInvalidateRegion.Exclude( *pRegion );
946  }
947  mpWindowImpl->mnPaintFlags &= ~ImplPaintFlags::PaintAll;
948 
949  if ( nFlags & ValidateFlags::Children )
950  {
951  vcl::Window* pChild = mpWindowImpl->mpFirstChild;
952  while ( pChild )
953  {
954  pChild->ImplValidateFrameRegion( pRegion, nFlags );
955  pChild = pChild->mpWindowImpl->mpNext;
956  }
957  }
958 }
959 
961 {
962  // assemble region
963  bool bValidateAll = true;
965  if ( GetStyle() & WB_CLIPCHILDREN )
966  nFlags |= ValidateFlags::NoChildren;
967  else
968  nFlags |= ValidateFlags::Children;
969  if ( (nFlags & ValidateFlags::NoChildren) && mpWindowImpl->mpFirstChild )
970  bValidateAll = false;
971  if ( bValidateAll )
972  ImplValidateFrameRegion( nullptr, nFlags );
973  else
974  {
976  vcl::Region aRegion( aRect );
977  ImplClipBoundaries( aRegion, true, true );
978  if ( nFlags & ValidateFlags::NoChildren )
979  {
980  nFlags &= ~ValidateFlags::Children;
981  if ( ImplClipChildren( aRegion ) )
982  nFlags |= ValidateFlags::Children;
983  }
984  if ( !aRegion.IsEmpty() )
985  ImplValidateFrameRegion( &aRegion, nFlags );
986  }
987 }
988 
990 {
991  if ( !mpWindowImpl->mbReallyVisible )
992  return;
993 
994  bool bFlush = false;
995  if ( mpWindowImpl->mpFrameWindow->mpWindowImpl->mbPaintFrame )
996  {
997  Point aPoint( 0, 0 );
998  vcl::Region aRegion( tools::Rectangle( aPoint, Size( mnOutWidth, mnOutHeight ) ) );
1000  if ( mpWindowImpl->mbFrame || (mpWindowImpl->mpBorderWindow && mpWindowImpl->mpBorderWindow->mpWindowImpl->mbFrame) )
1001  bFlush = true;
1002  }
1003 
1004  // an update changes the OverlapWindow, such that for later paints
1005  // not too much has to be drawn, if ALLCHILDREN etc. is set
1007  pWindow->ImplCallOverlapPaint();
1008 
1009  if ( bFlush )
1010  Flush();
1011 }
1012 
1013 void Window::PrePaint(vcl::RenderContext& /*rRenderContext*/)
1014 {
1015 }
1016 
1017 void Window::PostPaint(vcl::RenderContext& /*rRenderContext*/)
1018 {
1019 }
1020 
1021 void Window::Paint(vcl::RenderContext& /*rRenderContext*/, const tools::Rectangle& rRect)
1022 {
1023  CallEventListeners(VclEventId::WindowPaint, const_cast<tools::Rectangle *>(&rRect));
1024 }
1025 
1026 void Window::SetPaintTransparent( bool bTransparent )
1027 {
1028  // transparency is not useful for frames as the background would have to be provided by a different frame
1029  if( bTransparent && mpWindowImpl->mbFrame )
1030  return;
1031 
1032  if ( mpWindowImpl->mpBorderWindow )
1033  mpWindowImpl->mpBorderWindow->SetPaintTransparent( bTransparent );
1034 
1035  mpWindowImpl->mbPaintTransparent = bTransparent;
1036 }
1037 
1039 {
1040 
1041  if ( mpWindowImpl->mpBorderWindow )
1042  mpWindowImpl->mpBorderWindow->SetWindowRegionPixel();
1043  else if( mpWindowImpl->mbFrame )
1044  {
1045  mpWindowImpl->maWinRegion = vcl::Region(true);
1046  mpWindowImpl->mbWinRegion = false;
1047  mpWindowImpl->mpFrame->ResetClipRegion();
1048  }
1049  else
1050  {
1051  if ( mpWindowImpl->mbWinRegion )
1052  {
1053  mpWindowImpl->maWinRegion = vcl::Region(true);
1054  mpWindowImpl->mbWinRegion = false;
1055  ImplSetClipFlag();
1056 
1057  if ( IsReallyVisible() )
1058  {
1060  vcl::Region aRegion( aRect );
1062  }
1063  }
1064  }
1065 }
1066 
1068 {
1069 
1070  if ( mpWindowImpl->mpBorderWindow )
1071  mpWindowImpl->mpBorderWindow->SetWindowRegionPixel( rRegion );
1072  else if( mpWindowImpl->mbFrame )
1073  {
1074  if( !rRegion.IsNull() )
1075  {
1076  mpWindowImpl->maWinRegion = rRegion;
1077  mpWindowImpl->mbWinRegion = ! rRegion.IsEmpty();
1078 
1079  if( mpWindowImpl->mbWinRegion )
1080  {
1081  // set/update ClipRegion
1082  RectangleVector aRectangles;
1083  mpWindowImpl->maWinRegion.GetRegionRectangles(aRectangles);
1084  mpWindowImpl->mpFrame->BeginSetClipRegion(aRectangles.size());
1085 
1086  for (auto const& rectangle : aRectangles)
1087  {
1088  mpWindowImpl->mpFrame->UnionClipRegion(
1089  rectangle.Left(),
1090  rectangle.Top(),
1091  rectangle.GetWidth(), // orig nWidth was ((R - L) + 1), same as GetWidth does
1092  rectangle.GetHeight()); // same for height
1093  }
1094 
1095  mpWindowImpl->mpFrame->EndSetClipRegion();
1096 
1097  //long nX;
1098  //long nY;
1099  //long nWidth;
1100  //long nHeight;
1101  //sal_uLong nRectCount;
1102  //ImplRegionInfo aInfo;
1103  //sal_Bool bRegionRect;
1104 
1105  //nRectCount = mpWindowImpl->maWinRegion.GetRectCount();
1106  //mpWindowImpl->mpFrame->BeginSetClipRegion( nRectCount );
1107  //bRegionRect = mpWindowImpl->maWinRegion.ImplGetFirstRect( aInfo, nX, nY, nWidth, nHeight );
1108  //while ( bRegionRect )
1109  //{
1110  // mpWindowImpl->mpFrame->UnionClipRegion( nX, nY, nWidth, nHeight );
1111  // bRegionRect = mpWindowImpl->maWinRegion.ImplGetNextRect( aInfo, nX, nY, nWidth, nHeight );
1112  //}
1113  //mpWindowImpl->mpFrame->EndSetClipRegion();
1114  }
1115  else
1117  }
1118  else
1120  }
1121  else
1122  {
1123  if ( rRegion.IsNull() )
1124  {
1125  if ( mpWindowImpl->mbWinRegion )
1126  {
1127  mpWindowImpl->maWinRegion = vcl::Region(true);
1128  mpWindowImpl->mbWinRegion = false;
1129  ImplSetClipFlag();
1130  }
1131  }
1132  else
1133  {
1134  mpWindowImpl->maWinRegion = rRegion;
1135  mpWindowImpl->mbWinRegion = true;
1136  ImplSetClipFlag();
1137  }
1138 
1139  if ( IsReallyVisible() )
1140  {
1142  vcl::Region aRegion( aRect );
1144  }
1145  }
1146 }
1147 
1149 {
1150 
1151  if ( mpWindowImpl->mpPaintRegion )
1152  {
1153  vcl::Region aRegion = *mpWindowImpl->mpPaintRegion;
1154  aRegion.Move( -mnOutOffX, -mnOutOffY );
1155  return PixelToLogic( aRegion );
1156  }
1157  else
1158  {
1159  vcl::Region aPaintRegion(true);
1160  return aPaintRegion;
1161  }
1162 }
1163 
1165 {
1167  return;
1168 
1169  ImplInvalidate( nullptr, nFlags );
1170  LogicInvalidate(nullptr);
1171 }
1172 
1174 {
1176  return;
1177 
1178  OutputDevice *pOutDev = GetOutDev();
1179  tools::Rectangle aRect = pOutDev->ImplLogicToDevicePixel( rRect );
1180  if ( !aRect.IsEmpty() )
1181  {
1182  vcl::Region aRegion( aRect );
1183  ImplInvalidate( &aRegion, nFlags );
1184  tools::Rectangle aLogicRectangle(rRect);
1185  LogicInvalidate(&aLogicRectangle);
1186  }
1187 }
1188 
1189 void Window::Invalidate( const vcl::Region& rRegion, InvalidateFlags nFlags )
1190 {
1192  return;
1193 
1194  if ( rRegion.IsNull() )
1195  {
1196  ImplInvalidate( nullptr, nFlags );
1197  LogicInvalidate(nullptr);
1198  }
1199  else
1200  {
1201  vcl::Region aRegion = ImplPixelToDevicePixel( LogicToPixel( rRegion ) );
1202  if ( !aRegion.IsEmpty() )
1203  {
1204  ImplInvalidate( &aRegion, nFlags );
1205  tools::Rectangle aLogicRectangle = rRegion.GetBoundRect();
1206  LogicInvalidate(&aLogicRectangle);
1207  }
1208  }
1209 }
1210 
1212 {
1213  if(pRectangle)
1214  {
1215  tools::Rectangle aRect = GetOutDev()->ImplLogicToDevicePixel( *pRectangle );
1216  PixelInvalidate(&aRect);
1217  }
1218  else
1219  PixelInvalidate(nullptr);
1220 }
1221 
1223 {
1225  return;
1226 
1227  Size aSize = GetSizePixel();
1228  if (aSize.IsEmpty())
1229  return;
1230 
1231  if (const vcl::ILibreOfficeKitNotifier* pNotifier = GetLOKNotifier())
1232  {
1233  // In case we are routing the window, notify the client
1234  std::vector<vcl::LOKPayloadItem> aPayload;
1235  if (pRectangle)
1236  aPayload.emplace_back("rectangle", pRectangle->toString());
1237  else
1238  {
1239  const tools::Rectangle aRect(Point(0, 0), aSize);
1240  aPayload.emplace_back("rectangle", aRect.toString());
1241  }
1242 
1243  pNotifier->notifyWindow(GetLOKWindowId(), "invalidate", aPayload);
1244  }
1245  // Added for dialog items. Pass invalidation to the parent window.
1246  else if (VclPtr<vcl::Window> pParent = GetParentWithLOKNotifier())
1247  {
1249  pParent->PixelInvalidate(&aRect);
1250  }
1251 }
1252 
1254 {
1256  return;
1257 
1258  ImplValidate();
1259 }
1260 
1262 {
1263 
1264  if ( !mpWindowImpl->mbReallyVisible )
1265  return false;
1266 
1267  if ( mpWindowImpl->mpFrameWindow->mpWindowImpl->mbPaintFrame )
1268  return true;
1269 
1270  if ( mpWindowImpl->mnPaintFlags & ImplPaintFlags::Paint )
1271  return true;
1272 
1273  if ( !ImplIsOverlapWindow() )
1274  {
1275  const vcl::Window* pTempWindow = this;
1276  do
1277  {
1278  pTempWindow = pTempWindow->ImplGetParent();
1279  if ( pTempWindow->mpWindowImpl->mnPaintFlags & (ImplPaintFlags::PaintChildren | ImplPaintFlags::PaintAllChildren) )
1280  return true;
1281  }
1282  while ( !pTempWindow->ImplIsOverlapWindow() );
1283  }
1284 
1285  return false;
1286 }
1287 
1289 {
1290  if ( mpWindowImpl->mpBorderWindow )
1291  {
1292  mpWindowImpl->mpBorderWindow->PaintImmediately();
1293  return;
1294  }
1295 
1296  if ( !mpWindowImpl->mbReallyVisible )
1297  return;
1298 
1299  bool bFlush = false;
1300  if ( mpWindowImpl->mpFrameWindow->mpWindowImpl->mbPaintFrame )
1301  {
1302  Point aPoint( 0, 0 );
1303  vcl::Region aRegion( tools::Rectangle( aPoint, Size( mnOutWidth, mnOutHeight ) ) );
1305  if ( mpWindowImpl->mbFrame || (mpWindowImpl->mpBorderWindow && mpWindowImpl->mpBorderWindow->mpWindowImpl->mbFrame) )
1306  bFlush = true;
1307  }
1308 
1309  // First we should skip all windows which are Paint-Transparent
1310  vcl::Window* pUpdateWindow = this;
1311  vcl::Window* pWindow = pUpdateWindow;
1312  while ( !pWindow->ImplIsOverlapWindow() )
1313  {
1314  if ( !pWindow->mpWindowImpl->mbPaintTransparent )
1315  {
1316  pUpdateWindow = pWindow;
1317  break;
1318  }
1319  pWindow = pWindow->ImplGetParent();
1320  }
1321  // In order to limit drawing, an update only draws the window which
1322  // has PAINTALLCHILDREN set
1323  pWindow = pUpdateWindow;
1324  do
1325  {
1326  if ( pWindow->mpWindowImpl->mnPaintFlags & ImplPaintFlags::PaintAllChildren )
1327  pUpdateWindow = pWindow;
1328  if ( pWindow->ImplIsOverlapWindow() )
1329  break;
1330  pWindow = pWindow->ImplGetParent();
1331  }
1332  while ( pWindow );
1333 
1334  // if there is something to paint, trigger a Paint
1335  if ( pUpdateWindow->mpWindowImpl->mnPaintFlags & (ImplPaintFlags::Paint | ImplPaintFlags::PaintChildren) )
1336  {
1337  VclPtr<vcl::Window> xWindow(this);
1338 
1339  // trigger an update also for system windows on top of us,
1340  // otherwise holes would remain
1341  vcl::Window* pUpdateOverlapWindow = ImplGetFirstOverlapWindow()->mpWindowImpl->mpFirstOverlap;
1342  while ( pUpdateOverlapWindow )
1343  {
1344  pUpdateOverlapWindow->PaintImmediately();
1345  pUpdateOverlapWindow = pUpdateOverlapWindow->mpWindowImpl->mpNext;
1346  }
1347 
1348  pUpdateWindow->ImplCallPaint(nullptr, pUpdateWindow->mpWindowImpl->mnPaintFlags);
1349 
1350  if (comphelper::LibreOfficeKit::isActive() && pUpdateWindow->GetParentDialog())
1351  pUpdateWindow->LogicInvalidate(nullptr);
1352 
1353  if (xWindow->IsDisposed())
1354  return;
1355 
1356  bFlush = true;
1357  }
1358 
1359  if ( bFlush )
1360  Flush();
1361 }
1362 
1363 void Window::ImplPaintToDevice( OutputDevice* i_pTargetOutDev, const Point& i_rPos )
1364 {
1365  // Special drawing when called through LOKit
1366  // TODO: Move to its own method
1368  {
1369  VclPtrInstance<VirtualDevice> pDevice(*i_pTargetOutDev);
1370 
1371  Size aSize(GetOutputSizePixel());
1372  pDevice->SetOutputSizePixel(aSize);
1373 
1374  vcl::Font aCopyFont = GetFont();
1375  pDevice->SetFont(aCopyFont);
1376 
1377  pDevice->SetTextColor(GetTextColor());
1378  if (IsLineColor())
1379  pDevice->SetLineColor(GetLineColor());
1380  else
1381  pDevice->SetLineColor();
1382 
1383  if (IsFillColor())
1384  pDevice->SetFillColor(GetFillColor());
1385  else
1386  pDevice->SetFillColor();
1387 
1388  if (IsTextLineColor())
1389  pDevice->SetTextLineColor(GetTextLineColor());
1390  else
1391  pDevice->SetTextLineColor();
1392 
1393  if (IsOverlineColor())
1394  pDevice->SetOverlineColor(GetOverlineColor());
1395  else
1396  pDevice->SetOverlineColor();
1397 
1398  if (IsTextFillColor())
1399  pDevice->SetTextFillColor(GetTextFillColor());
1400  else
1401  pDevice->SetTextFillColor();
1402 
1403  pDevice->SetTextAlign(GetTextAlign());
1404  pDevice->SetRasterOp(GetRasterOp());
1405 
1406  tools::Rectangle aPaintRect(Point(), GetOutputSizePixel());
1407 
1408  vcl::Region aClipRegion(GetClipRegion());
1409  pDevice->SetClipRegion();
1410  aClipRegion.Intersect(aPaintRect);
1411  pDevice->SetClipRegion(aClipRegion);
1412 
1414  Erase(*pDevice);
1415 
1416  pDevice->SetMapMode(GetMapMode());
1417 
1419 
1420  i_pTargetOutDev->DrawOutDev(i_rPos, aSize, Point(), pDevice->PixelToLogic(aSize), *pDevice);
1421 
1422  // get rid of virtual device now so they don't pile up during recursive calls
1423  pDevice.disposeAndClear();
1424 
1425 
1426  for( vcl::Window* pChild = mpWindowImpl->mpFirstChild; pChild; pChild = pChild->mpWindowImpl->mpNext )
1427  {
1428  if( pChild->mpWindowImpl->mpFrame == mpWindowImpl->mpFrame && pChild->IsVisible() )
1429  {
1430  tools::Long nDeltaX = pChild->mnOutOffX - mnOutOffX;
1431  tools::Long nDeltaY = pChild->mnOutOffY - mnOutOffY;
1432 
1433  Point aPos( i_rPos );
1434  aPos += Point(nDeltaX, nDeltaY);
1435 
1436  pChild->ImplPaintToDevice( i_pTargetOutDev, aPos );
1437  }
1438  }
1439  return;
1440  }
1441 
1442 
1443  bool bRVisible = mpWindowImpl->mbReallyVisible;
1444  mpWindowImpl->mbReallyVisible = mpWindowImpl->mbVisible;
1445  bool bDevOutput = mbDevOutput;
1446  mbDevOutput = true;
1447 
1448  const OutputDevice *pOutDev = GetOutDev();
1449  tools::Long nOldDPIX = pOutDev->GetDPIX();
1450  tools::Long nOldDPIY = pOutDev->GetDPIY();
1451  mnDPIX = i_pTargetOutDev->GetDPIX();
1452  mnDPIY = i_pTargetOutDev->GetDPIY();
1453  bool bOutput = IsOutputEnabled();
1454  EnableOutput();
1455 
1456  SAL_WARN_IF( GetMapMode().GetMapUnit() != MapUnit::MapPixel, "vcl.window", "MapMode must be PIXEL based" );
1457  if ( GetMapMode().GetMapUnit() != MapUnit::MapPixel )
1458  return;
1459 
1460  // preserve graphicsstate
1461  Push();
1462  vcl::Region aClipRegion( GetClipRegion() );
1463  SetClipRegion();
1464 
1465  GDIMetaFile* pOldMtf = GetConnectMetaFile();
1466  GDIMetaFile aMtf;
1467  SetConnectMetaFile( &aMtf );
1468 
1469  // put a push action to metafile
1470  Push();
1471  // copy graphics state to metafile
1472  vcl::Font aCopyFont = GetFont();
1473  if( nOldDPIX != mnDPIX || nOldDPIY != mnDPIY )
1474  {
1475  aCopyFont.SetFontHeight( aCopyFont.GetFontHeight() * mnDPIY / nOldDPIY );
1476  aCopyFont.SetAverageFontWidth( aCopyFont.GetAverageFontWidth() * mnDPIX / nOldDPIX );
1477  }
1478  SetFont( aCopyFont );
1480  if( IsLineColor() )
1482  else
1483  SetLineColor();
1484  if( IsFillColor() )
1486  else
1487  SetFillColor();
1488  if( IsTextLineColor() )
1490  else
1491  SetTextLineColor();
1492  if( IsOverlineColor() )
1494  else
1495  SetOverlineColor();
1496  if( IsTextFillColor() )
1498  else
1499  SetTextFillColor();
1501  SetRasterOp( GetRasterOp() );
1502  if( IsRefPoint() )
1503  SetRefPoint( GetRefPoint() );
1504  else
1505  SetRefPoint();
1507 
1509  tools::Rectangle aPaintRect(Point(0, 0), GetOutputSizePixel());
1510  aClipRegion.Intersect( aPaintRect );
1511  SetClipRegion( aClipRegion );
1512 
1513  // do the actual paint
1514 
1515  // background
1517  {
1518  Erase(*this);
1519  }
1520  // foreground
1521  Paint(*this, aPaintRect);
1522  // put a pop action to metafile
1523  Pop();
1524 
1525  SetConnectMetaFile( pOldMtf );
1526  EnableOutput( bOutput );
1527  mpWindowImpl->mbReallyVisible = bRVisible;
1528 
1529  // paint metafile to VDev
1530  VclPtrInstance<VirtualDevice> pMaskedDevice(*i_pTargetOutDev,
1533 
1534  pMaskedDevice->SetOutputSizePixel( GetOutputSizePixel() );
1535  pMaskedDevice->EnableRTL( IsRTLEnabled() );
1536  aMtf.WindStart();
1537  aMtf.Play( pMaskedDevice );
1538  BitmapEx aBmpEx( pMaskedDevice->GetBitmapEx( Point( 0, 0 ), aPaintRect.GetSize() ) );
1539  i_pTargetOutDev->DrawBitmapEx( i_rPos, aBmpEx );
1540  // get rid of virtual device now so they don't pile up during recursive calls
1541  pMaskedDevice.disposeAndClear();
1542 
1543  for( vcl::Window* pChild = mpWindowImpl->mpFirstChild; pChild; pChild = pChild->mpWindowImpl->mpNext )
1544  {
1545  if( pChild->mpWindowImpl->mpFrame == mpWindowImpl->mpFrame && pChild->IsVisible() )
1546  {
1547  tools::Long nDeltaX = pChild->mnOutOffX - mnOutOffX;
1548 
1549  if( pOutDev->HasMirroredGraphics() )
1550  nDeltaX = mnOutWidth - nDeltaX - pChild->mnOutWidth;
1551  tools::Long nDeltaY = pChild->GetOutOffYPixel() - GetOutOffYPixel();
1552  Point aPos( i_rPos );
1553  Point aDelta( nDeltaX, nDeltaY );
1554  aPos += aDelta;
1555  pChild->ImplPaintToDevice( i_pTargetOutDev, aPos );
1556  }
1557  }
1558 
1559  // restore graphics state
1560  Pop();
1561 
1562  EnableOutput( bOutput );
1563  mpWindowImpl->mbReallyVisible = bRVisible;
1564  mbDevOutput = bDevOutput;
1565  mnDPIX = nOldDPIX;
1566  mnDPIY = nOldDPIY;
1567 }
1568 
1569 void Window::PaintToDevice(OutputDevice* pDev, const Point& rPos)
1570 {
1571  SAL_WARN_IF( pDev->HasMirroredGraphics(), "vcl.window", "PaintToDevice to mirroring graphics" );
1572  SAL_WARN_IF( pDev->IsRTLEnabled(), "vcl.window", "PaintToDevice to mirroring device" );
1573 
1574  vcl::Window* pRealParent = nullptr;
1575  if( ! mpWindowImpl->mbVisible )
1576  {
1577  vcl::Window* pTempParent = ImplGetDefaultWindow();
1578  pTempParent->EnableChildTransparentMode();
1579  pRealParent = GetParent();
1580  SetParent( pTempParent );
1581  // trigger correct visibility flags for children
1582  Show();
1583  Hide();
1584  }
1585 
1586  bool bVisible = mpWindowImpl->mbVisible;
1587  mpWindowImpl->mbVisible = true;
1588 
1589  if( mpWindowImpl->mpBorderWindow )
1590  mpWindowImpl->mpBorderWindow->ImplPaintToDevice( pDev, rPos );
1591  else
1592  ImplPaintToDevice( pDev, rPos );
1593 
1594  mpWindowImpl->mbVisible = bVisible;
1595 
1596  if( pRealParent )
1597  SetParent( pRealParent );
1598 }
1599 
1600 void Window::Erase(vcl::RenderContext& rRenderContext)
1601 {
1603  return;
1604 
1605  bool bNativeOK = false;
1606 
1608 
1609  if (aCtrlPart == ControlPart::Entire && IsControlBackground())
1610  {
1611  // nothing to do here; background is drawn in corresponding drawNativeControl implementation
1612  bNativeOK = true;
1613  }
1614  else if (aCtrlPart != ControlPart::NONE && ! IsControlBackground())
1615  {
1616  tools::Rectangle aCtrlRegion(Point(), GetOutputSizePixel());
1618 
1619  if (IsEnabled())
1620  nState |= ControlState::ENABLED;
1621 
1622  bNativeOK = rRenderContext.DrawNativeControl(ControlType::WindowBackground, aCtrlPart, aCtrlRegion,
1623  nState, ImplControlValue(), OUString());
1624  }
1625 
1626  if (mbBackground && !bNativeOK)
1627  {
1628  RasterOp eRasterOp = GetRasterOp();
1629  if (eRasterOp != RasterOp::OverPaint)
1631  rRenderContext.DrawWallpaper(0, 0, mnOutWidth, mnOutHeight, maBackground);
1632  if (eRasterOp != RasterOp::OverPaint)
1633  rRenderContext.SetRasterOp(eRasterOp);
1634  }
1635 
1636  if (mpAlphaVDev)
1637  mpAlphaVDev->Erase();
1638 }
1639 
1641  tools::Long nHorzScroll, tools::Long nVertScroll, ScrollFlags nFlags )
1642 {
1643  if ( !IsDeviceOutputNecessary() )
1644  return;
1645 
1646  nHorzScroll = ImplLogicWidthToDevicePixel( nHorzScroll );
1647  nVertScroll = ImplLogicHeightToDevicePixel( nVertScroll );
1648 
1649  if ( !nHorzScroll && !nVertScroll )
1650  return;
1651 
1652  if ( mpWindowImpl->mpCursor )
1653  mpWindowImpl->mpCursor->ImplSuspend();
1654 
1655  ScrollFlags nOrgFlags = nFlags;
1656  if ( !(nFlags & (ScrollFlags::Children | ScrollFlags::NoChildren)) )
1657  {
1658  if ( GetStyle() & WB_CLIPCHILDREN )
1659  nFlags |= ScrollFlags::NoChildren;
1660  else
1661  nFlags |= ScrollFlags::Children;
1662  }
1663 
1664  vcl::Region aInvalidateRegion;
1665  bool bScrollChildren(nFlags & ScrollFlags::Children);
1666 
1667  if ( !mpWindowImpl->mpFirstChild )
1668  bScrollChildren = false;
1669 
1670  OutputDevice *pOutDev = GetOutDev();
1671 
1672  // RTL: check if this window requires special action
1673  bool bReMirror = ImplIsAntiparallel();
1674 
1675  tools::Rectangle aRectMirror( rRect );
1676  if( bReMirror )
1677  {
1678  // make sure the invalidate region of this window is
1679  // computed in the same coordinate space as the one from the overlap windows
1680  pOutDev->ReMirror( aRectMirror );
1681  }
1682 
1683  // adapt paint areas
1684  ImplMoveAllInvalidateRegions( aRectMirror, nHorzScroll, nVertScroll, bScrollChildren );
1685 
1686  ImplCalcOverlapRegion( aRectMirror, aInvalidateRegion, !bScrollChildren, false );
1687 
1688  // if the scrolling on the device is performed in the opposite direction
1689  // then move the overlaps in that direction to compute the invalidate region
1690  // on the correct side, i.e., revert nHorzScroll
1691  if (!aInvalidateRegion.IsEmpty())
1692  {
1693  aInvalidateRegion.Move(bReMirror ? -nHorzScroll : nHorzScroll, nVertScroll);
1694  }
1695 
1696  tools::Rectangle aDestRect(aRectMirror);
1697  aDestRect.Move(bReMirror ? -nHorzScroll : nHorzScroll, nVertScroll);
1698  vcl::Region aWinInvalidateRegion(aRectMirror);
1699  if (!SupportsDoubleBuffering())
1700  {
1701  // There will be no CopyArea() call below, so invalidate the
1702  // whole visible area, not only the smaller one that was just
1703  // scrolled in.
1704  aWinInvalidateRegion.Exclude(aDestRect);
1705  }
1706 
1707  aInvalidateRegion.Union(aWinInvalidateRegion);
1708 
1709  Point aPoint( mnOutOffX, mnOutOffY );
1710  vcl::Region aRegion( tools::Rectangle( aPoint, Size( mnOutWidth, mnOutHeight ) ) );
1711  if ( nFlags & ScrollFlags::Clip )
1712  aRegion.Intersect( rRect );
1713  if ( mpWindowImpl->mbWinRegion )
1714  aRegion.Intersect( ImplPixelToDevicePixel( mpWindowImpl->maWinRegion ) );
1715 
1716  aRegion.Exclude( aInvalidateRegion );
1717 
1718  ImplClipBoundaries( aRegion, false, true );
1719  if ( !bScrollChildren )
1720  {
1721  if ( nOrgFlags & ScrollFlags::NoChildren )
1722  ImplClipAllChildren( aRegion );
1723  else
1724  ImplClipChildren( aRegion );
1725  }
1726  if ( mbClipRegion && (nFlags & ScrollFlags::UseClipRegion) )
1727  aRegion.Intersect( maRegion );
1728  if ( !aRegion.IsEmpty() )
1729  {
1730  if ( mpWindowImpl->mpWinData )
1731  {
1732  if ( mpWindowImpl->mbFocusVisible )
1733  ImplInvertFocus( *mpWindowImpl->mpWinData->mpFocusRect );
1734  if ( mpWindowImpl->mbTrackVisible && (mpWindowImpl->mpWinData->mnTrackFlags & ShowTrackFlags::TrackWindow) )
1735  InvertTracking( *mpWindowImpl->mpWinData->mpTrackRect, mpWindowImpl->mpWinData->mnTrackFlags );
1736  }
1737 #ifndef IOS
1738  // This seems completely unnecessary with tiled rendering, and
1739  // causes the "AquaSalGraphics::copyArea() for non-layered
1740  // graphics" message. Presumably we should bypass this on all
1741  // platforms when dealing with a "window" that uses tiled
1742  // rendering at the moment. Unclear how to figure that out,
1743  // though. Also unclear whether we actually could just not
1744  // create a "frame window", whatever that exactly is, in the
1745  // tiled rendering case, or at least for platforms where tiles
1746  // rendering is all there is.
1747 
1748  SalGraphics* pGraphics = ImplGetFrameGraphics();
1749  // The invalidation area contains the area what would be copied here,
1750  // so avoid copying in case of double buffering.
1751  if (pGraphics && !SupportsDoubleBuffering())
1752  {
1753  if( bReMirror )
1754  {
1755  pOutDev->ReMirror( aRegion );
1756  }
1757 
1758  pOutDev->SelectClipRegion( aRegion, pGraphics );
1759  pGraphics->CopyArea( rRect.Left()+nHorzScroll, rRect.Top()+nVertScroll,
1760  rRect.Left(), rRect.Top(),
1761  rRect.GetWidth(), rRect.GetHeight(),
1762  *this );
1763  }
1764 #endif
1765  if ( mpWindowImpl->mpWinData )
1766  {
1767  if ( mpWindowImpl->mbFocusVisible )
1768  ImplInvertFocus( *mpWindowImpl->mpWinData->mpFocusRect );
1769  if ( mpWindowImpl->mbTrackVisible && (mpWindowImpl->mpWinData->mnTrackFlags & ShowTrackFlags::TrackWindow) )
1770  InvertTracking( *mpWindowImpl->mpWinData->mpTrackRect, mpWindowImpl->mpWinData->mnTrackFlags );
1771  }
1772  }
1773 
1774  if ( !aInvalidateRegion.IsEmpty() )
1775  {
1776  // RTL: the invalidate region for this windows is already computed in frame coordinates
1777  // so it has to be re-mirrored before calling the Paint-handler
1778  mpWindowImpl->mnPaintFlags |= ImplPaintFlags::CheckRtl;
1779 
1780  if ( !bScrollChildren )
1781  {
1782  if ( nOrgFlags & ScrollFlags::NoChildren )
1783  ImplClipAllChildren( aInvalidateRegion );
1784  else
1785  ImplClipChildren( aInvalidateRegion );
1786  }
1788  }
1789 
1790  if ( bScrollChildren )
1791  {
1792  vcl::Window* pWindow = mpWindowImpl->mpFirstChild;
1793  while ( pWindow )
1794  {
1795  Point aPos = pWindow->GetPosPixel();
1796  aPos += Point( nHorzScroll, nVertScroll );
1797  pWindow->SetPosPixel( aPos );
1798 
1799  pWindow = pWindow->mpWindowImpl->mpNext;
1800  }
1801  }
1802 
1803  if ( nFlags & ScrollFlags::Update )
1804  PaintImmediately();
1805 
1806  if ( mpWindowImpl->mpCursor )
1807  mpWindowImpl->mpCursor->ImplResume();
1808 }
1809 
1810 } /* namespace vcl */
1811 
1812 
1813 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual Point GetPosPixel() const
Definition: window.cxx:2789
SAL_DLLPRIVATE void ImplMoveInvalidateRegion(const tools::Rectangle &rRect, tools::Long nHorzScroll, tools::Long nVertScroll, bool bChildren)
Definition: paint.cxx:858
void EnableOutput(bool bEnable=true)
Point TopLeft() const
vcl::Region GetClipRegion() const
const Color & GetTextColor() const
Definition: outdev.hxx:1132
The child windows are invalidated, too.
bool IsControlBackground() const
Definition: window2.cxx:1087
void SetDigitLanguage(LanguageType)
tools::Rectangle m_aPaintRect
Definition: paint.cxx:170
const Wallpaper & GetBackground() const
Definition: outdev.hxx:642
SAL_DLLPRIVATE SalGraphics * ImplGetFrameGraphics() const
Definition: window.cxx:1274
vcl::LOKWindowId GetLOKWindowId() const
Definition: window.cxx:3225
bool bVisible
SAL_DLLPRIVATE bool ImplIsRecordLayout() const
Definition: outdev.cxx:638
bool IsNull() const
Definition: region.hxx:102
PaintBufferGuard(ImplFrameData *pFrameData, vcl::Window *pWindow)
Definition: paint.cxx:45
tools::Long AdjustRight(tools::Long nHorzMoveDelta)
The parent window is invalidated, too.
const Point & GetRefPoint() const
Definition: outdev.hxx:433
virtual void ImplPaintToDevice(::OutputDevice *pTargetOutDev, const Point &rPos)
Definition: paint.cxx:1363
void SetAverageFontWidth(tools::Long nWidth)
Definition: font/font.cxx:677
void Move(tools::Long nHorzMove, tools::Long nVertMove)
Definition: region.cxx:414
const Color & GetHighlightTextColor() const
InvalidateFlags
Definition: window.hxx:212
const Color & GetTextLineColor() const
Definition: outdev.hxx:1141
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:645
void InvertTracking(const tools::Rectangle &rRect, ShowTrackFlags nFlags)
Definition: window2.cxx:158
ValidateFlags
Definition: window.hxx:236
ImplPaintFlags GetPaintFlags() const
Definition: paint.cxx:198
long Long
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:1150
bool IsOutputEnabled() const
Definition: outdev.hxx:599
ParentClipMode GetParentClipMode() const
sal_uInt8 GetLuminance() const
const Color & GetFaceColor() const
bool IsTextLineColor() const
Definition: outdev.hxx:1142
void Flush() override
Definition: window.cxx:2939
tools::Long GetOutOffXPixel() const
Definition: outdev.hxx:444
vcl::Region maRegion
Definition: outdev.hxx:358
vcl::Region maInvalidateRegion
Definition: window.h:289
virtual Size GetSizePixel() const
Definition: window.cxx:2400
SAL_DLLPRIVATE WindowImpl * ImplGetWindowImpl() const
Definition: window.hxx:563
tools::Long mnOutOffY
Output offset for device output in pixel (pseudo window offset within window system's frames) ...
Definition: outdev.hxx:342
ComplexTextLayoutFlags GetLayoutMode() const
Definition: outdev.hxx:609
const MapMode & GetMapMode() const
Definition: outdev.hxx:1681
sal_Int32 mnDPIY
Definition: outdev.hxx:346
void SetTextFillColor()
Definition: text.cxx:701
tools::Long GetWidth() const
vcl::Region GetPaintRegion() const
Definition: paint.cxx:1148
void SetLayoutMode(ComplexTextLayoutFlags nTextLayoutMode)
void SetPop()
Definition: paint.cxx:178
GDIMetaFile * GetConnectMetaFile() const
Definition: outdev.hxx:414
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:208
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:989
tools::Rectangle GetBoundRect() const
Definition: region.cxx:1214
void PaintImmediately()
Definition: paint.cxx:1288
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:546
Dialog * GetParentDialog() const
Definition: window2.cxx:982
const Color & GetHighlightColor() const
Color GetBackgroundColor() const override
Definition: window.cxx:588
SAL_DLLPRIVATE void ImplInvalidateFrameRegion(const vcl::Region *pRegion, InvalidateFlags nFlags)
Definition: paint.cxx:686
bool GetRestoreCursor() const
Definition: paint.cxx:194
tools::Long GetFontHeight() const
Definition: font/font.cxx:676
ImplFrameData * mpFrameData
Definition: window.h:404
tools::Long mnOutOffY
Definition: window.h:410
bool SelectClipRegion(const vcl::Region &, SalGraphics *pGraphics=nullptr)
SAL_DLLPRIVATE bool ImplIsOverlapWindow() const
Definition: window2.cxx:926
std::vector< tools::Rectangle > RectangleVector
Definition: region.hxx:37
The invalidated area is painted with the background color/pattern.
SAL_DLLPRIVATE void ImplMoveAllInvalidateRegions(const tools::Rectangle &rRect, tools::Long nHorzScroll, tools::Long nVertScroll, bool bChildren)
Definition: paint.cxx:881
void DrawWallpaper(const tools::Rectangle &rRect, const Wallpaper &rWallpaper)
Definition: wallpaper.cxx:42
bool IsEmpty() const
const Color & GetOverlineColor() const
Definition: outdev.hxx:1146
Color GetTextFillColor() const
Definition: text.cxx:759
void SetBackground()
ScrollFlags
Definition: window.hxx:248
void SetOutOffYPixel(tools::Long nOutOffY)
Definition: outdev.cxx:314
SAL_DLLPRIVATE void ReMirror(Point &rPoint) const
Definition: outdev.cxx:601
tools::Long Left() const
VclPtr< vcl::Window > GetParentWithLOKNotifier()
Find the nearest parent with LOK Notifier; can be itself if this Window has LOK notifier set...
Definition: window.cxx:3230
SAL_DLLPRIVATE void ImplInvalidate(const vcl::Region *rRegion, InvalidateFlags nFlags)
Definition: paint.cxx:777
const BorderLinePrimitive2D *pCandidateB assert(pCandidateA)
SAL_DLLPRIVATE void ImplInvalidateParentFrameRegion(vcl::Region &rRegion)
Definition: paint.cxx:766
const vcl::Font & GetFont() const
Definition: outdev.hxx:648
RasterOp
Definition: vclenum.hxx:194
tools::Long mnOutOffX
Definition: window.h:409
SAL_DLLPRIVATE void ImplClipBoundaries(vcl::Region &rRegion, bool bThis, bool bOverlaps)
void Hide()
Definition: window.hxx:945
bool mbBackground
Definition: outdev.hxx:375
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:3036
void SetWindowRegionPixel()
Definition: paint.cxx:1038
void Play(GDIMetaFile &rMtf)
Definition: gdimtf.cxx:325
SAL_DLLPRIVATE void ImplValidate()
Definition: paint.cxx:960
static Color HSBtoRGB(sal_uInt16 nHue, sal_uInt16 nSaturation, sal_uInt16 nBrightness)
tools::Long AdjustBottom(tools::Long nVertMoveDelta)
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:1137
bool IsEmpty() const
Definition: region.cxx:228
void SetLineColor()
void PaintToDevice(::OutputDevice *pDevice, const Point &rPos)
Definition: paint.cxx:1569
void SetRefPoint()
Definition: outdev.cxx:273
virtual void PrePaint(vcl::RenderContext &rRenderContext)
Definition: paint.cxx:1013
void SetConnectMetaFile(GDIMetaFile *pMtf)
Definition: outdev.cxx:203
bool IsRTLEnabled() const
Definition: outdev.hxx:1360
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:366
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:674
bool IsDark() const
bool IsLineColor() const
Definition: outdev.hxx:630
void DrawSelectionBackground(const tools::Rectangle &rRect, sal_uInt16 highlight, bool bChecked, bool bDrawBorder)
Definition: window.cxx:3430
void SetEmpty()
Definition: region.cxx:1417
virtual void EnableRTL(bool bEnable=true) override
Definition: virdev.cxx:385
void SetParent(vcl::Window *pNewParent)
Definition: stacking.cxx:835
bool SetOutputSizePixel(const Size &rNewSize, bool bErase=true)
Definition: virdev.cxx:397
virtual void ApplySettings(vcl::RenderContext &rRenderContext)
Definition: window.cxx:3834
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:1164
SAL_DLLPRIVATE bool ImplIsAntiparallel() const
Definition: outdev.cxx:585
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:633
std::unique_ptr< vcl::Region > m_pChildRegion
Definition: paint.cxx:168
void CopyArea(tools::Long nDestX, tools::Long nDestY, tools::Long nSrcX, tools::Long nSrcY, tools::Long nSrcWidth, tools::Long nSrcHeight, const OutputDevice &rOutDev)
SAL_DLLPRIVATE void PopPaintHelper(PaintHelper const *pHelper)
Definition: paint.cxx:519
tools::Long mnOutHeight
Definition: outdev.hxx:344
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:629
SAL_DLLPRIVATE tools::Long ImplLogicWidthToDevicePixel(tools::Long nWidth) const
Convert a logical width to a width in units of device pixels.
Definition: map.cxx:344
void SetTextColor(const Color &rColor)
Definition: text.cxx:666
bool HasPaintEvent() const
Definition: paint.cxx:1261
std::unique_ptr< WindowImpl > mpWindowImpl
Definition: window.hxx:519
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:1222
void Intersect(const tools::Rectangle &rRegion)
Definition: region.cxx:584
void Validate()
Definition: paint.cxx:1253
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.
SAL_DLLPRIVATE void ImplScroll(const tools::Rectangle &rRect, tools::Long nHorzScroll, tools::Long nVertScroll, ScrollFlags nFlags)
Definition: paint.cxx:1640
const AllSettings & GetSettings() const
Definition: outdev.hxx:417
void SetPaintTransparent(bool bTransparent)
Definition: paint.cxx:1026
Size GetOutputSizePixel() const
Definition: outdev.hxx:440
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
tools::Long Top() const
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
tools::Long GetOutOffYPixel() const
Definition: outdev.hxx:445
tools::Long AdjustTop(tools::Long nVertMoveDelta)
MapUnit GetMapUnit()
AllSettings maSettings
Definition: window.h:408
Point PixelToLogic(const Point &rDevicePt) const
Definition: map.cxx:1049
Point LogicToPixel(const Point &rLogicPt) const
Definition: map.cxx:828
SAL_DLLPRIVATE void ImplValidateFrameRegion(const vcl::Region *rRegion, ValidateFlags nFlags)
Definition: paint.cxx:918
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
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:528
void Erase()
Definition: wallpaper.cxx:103
def rectangle(l)
bool IsRefPoint() const
Definition: outdev.hxx:434
bool mbClipRegion
Definition: outdev.hxx:374
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:747
LanguageType GetDigitLanguage() const
Definition: outdev.hxx:612
SAL_DLLPRIVATE vcl::Region * ImplGetWinChildClipRegion()
tools::Rectangle m_aPaintRect
Definition: window.h:411
bool IsVisible() const
Definition: window2.cxx:1102
bool mbInitClipRegion
Definition: outdev.hxx:385
const ::std::vector< Color > ImpSvNumberformatScan::StandardColor COL_WHITE
::OutputDevice const * GetOutDev() const
Definition: window.cxx:578
void EnableChildTransparentMode(bool bEnable=true)
Definition: window2.cxx:1022
void SetRasterOp(RasterOp eRasterOp)
void SetOutOffXPixel(tools::Long nOutOffX)
Definition: outdev.cxx:309
SAL_DLLPRIVATE void PushPaintHelper(PaintHelper *pHelper, vcl::RenderContext &rRenderContext)
Definition: paint.cxx:475
virtual void Paint(vcl::RenderContext &rRenderContext, const tools::Rectangle &rRect)
Definition: paint.cxx:1021
const char * name
const ::std::vector< Color > ImpSvNumberformatScan::StandardColor COL_BLACK
RasterOp GetRasterOp() const
Definition: outdev.hxx:615
virtual void DrawOutDev(const Point &rDestPt, const Size &rDestSize, const Point &rSrcPt, const Size &rSrcSize)
Definition: outdev.cxx:343
ShowTrackFlags mnTrackFlags
Definition: window.h:116
SAL_DLLPRIVATE bool ImplSetClipFlag(bool bSysObjOnlySmaller=false)
bool IsDisposed() const
Definition: window.cxx:142
tools::Long mnOutWidth
Definition: outdev.hxx:343
void SetFontHeight(tools::Long nHeight)
Definition: font/font.cxx:675
bool IsBitmap() const
Definition: wall.cxx:249
SAL_DLLPRIVATE bool ImplClipChildren(vcl::Region &rRegion) const
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:406
tools::Long GetHeight() const
bool mbDevOutput
Definition: outdev.hxx:377
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).
void Move(tools::Long nHorzMoveDelta, tools::Long nVertMoveDelta)
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:3220
tools::Long mnOutOffX
Output offset for device output in pixel (pseudo window offset within window system's frames) ...
Definition: outdev.hxx:340
tools::Long AdjustLeft(tools::Long nHorzMoveDelta)
#define SAL_WARN(area, stream)
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:507
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:1211
bool IsFillColor() const
Definition: outdev.hxx:635
if(!pCandidateA->getEnd().equal(pCandidateB->getStart()))
vcl::Region m_aPaintRegion
Definition: paint.cxx:171
virtual void PostPaint(vcl::RenderContext &rRenderContext)
Definition: paint.cxx:1017
bool IsOverlineColor() const
Definition: outdev.hxx:1147
void CallEventListeners(VclEventId nEvent, void *pData=nullptr)
Definition: event.cxx:217
bool IsReallyVisible() const
Definition: window2.cxx:1107
void SetRestoreCursor(bool bRestoreCursor)
Definition: paint.cxx:190
ImplPaintFlags mnPaintFlags
Definition: window.h:298
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, tools::Long nCornerRadius=0, Color const *pPaintColor=nullptr)
Definition: paint.cxx:323
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:600
void Push(PushFlags nFlags=PushFlags::ALL)
Definition: outdevstate.cxx:60
SAL_DLLPRIVATE tools::Long ImplLogicHeightToDevicePixel(tools::Long nHeight) const
Convert a logical height to a height in units of device pixels.
Definition: map.cxx:352
bool SupportsDoubleBuffering() const
Can the widget derived from this Window do the double-buffering via RenderContext properly...
Definition: window.cxx:3844
SAL_DLLPRIVATE sal_Int32 GetDPIY() const
Get the output device's DPI y-axis value.
Definition: outdev.hxx:508
The child windows are not invalidated.
bool m_bRestoreCursor
Definition: paint.cxx:174
sal_Int32 h
WinBits const WB_CLIPCHILDREN
sal_Int32 nState
tools::Long GetAverageFontWidth() const
Definition: font/font.cxx:678
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:502
void SetTextAlign(TextAlign eAlign)
Definition: text.cxx:767
const Color & GetFillColor() const
Definition: outdev.hxx:634
Wallpaper maBackground
Definition: window.h:407
void Show(bool bVisible=true, ShowFlags nFlags=ShowFlags::NONE)
Definition: window.cxx:2186