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