LibreOffice Module vcl (master)  1
window2.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 <limits.h>
21 
23 #include <sal/log.hxx>
24 
25 #include <tools/helpers.hxx>
26 
27 #include <vcl/toolkit/dialog.hxx>
28 #include <vcl/event.hxx>
29 #include <vcl/toolkit/fixed.hxx>
30 #include <vcl/layout.hxx>
31 #include <vcl/timer.hxx>
32 #include <vcl/window.hxx>
33 #include <vcl/scrbar.hxx>
34 #include <vcl/dockwin.hxx>
35 #include <vcl/settings.hxx>
36 #include <vcl/builder.hxx>
37 
38 #include <window.h>
39 #include <svdata.hxx>
40 #include <salgdi.hxx>
41 #include <salframe.hxx>
42 #include <scrwnd.hxx>
43 
44 #include <com/sun/star/accessibility/AccessibleRelation.hpp>
45 #include <com/sun/star/accessibility/AccessibleRole.hpp>
46 
47 using namespace com::sun::star;
48 
49 namespace vcl {
50 
51 void Window::ShowFocus( const tools::Rectangle& rRect )
52 {
53  if( mpWindowImpl->mbInShowFocus )
54  return;
55  mpWindowImpl->mbInShowFocus = true;
56 
57  ImplWinData* pWinData = ImplGetWinData();
58 
59  // native themeing suggest not to use focus rects
60  if( ! ( mpWindowImpl->mbUseNativeFocus &&
61  IsNativeWidgetEnabled() ) )
62  {
63  if ( !mpWindowImpl->mbInPaint )
64  {
65  if ( mpWindowImpl->mbFocusVisible )
66  {
67  if ( *pWinData->mpFocusRect == rRect )
68  {
69  mpWindowImpl->mbInShowFocus = false;
70  return;
71  }
72 
73  ImplInvertFocus( *pWinData->mpFocusRect );
74  }
75 
76  ImplInvertFocus( rRect );
77  }
78  pWinData->mpFocusRect = rRect;
79  mpWindowImpl->mbFocusVisible = true;
80  }
81  else
82  {
83  if( ! mpWindowImpl->mbNativeFocusVisible )
84  {
85  mpWindowImpl->mbNativeFocusVisible = true;
86  if ( !mpWindowImpl->mbInPaint )
87  Invalidate();
88  }
89  }
90  mpWindowImpl->mbInShowFocus = false;
91 }
92 
93 void Window::HideFocus()
94 {
95 
96  if( mpWindowImpl->mbInHideFocus )
97  return;
98  mpWindowImpl->mbInHideFocus = true;
99 
100  // native themeing can suggest not to use focus rects
101  if( ! ( mpWindowImpl->mbUseNativeFocus &&
102  IsNativeWidgetEnabled() ) )
103  {
104  if ( !mpWindowImpl->mbFocusVisible )
105  {
106  mpWindowImpl->mbInHideFocus = false;
107  return;
108  }
109 
110  if ( !mpWindowImpl->mbInPaint )
111  ImplInvertFocus( *ImplGetWinData()->mpFocusRect );
112  mpWindowImpl->mbFocusVisible = false;
113  }
114  else
115  {
116  if( mpWindowImpl->mbNativeFocusVisible )
117  {
118  mpWindowImpl->mbNativeFocusVisible = false;
119  if ( !mpWindowImpl->mbInPaint )
120  Invalidate();
121  }
122  }
123  mpWindowImpl->mbInHideFocus = false;
124 }
125 
126 void Window::ShowTracking( const tools::Rectangle& rRect, ShowTrackFlags nFlags )
127 {
128  ImplWinData* pWinData = ImplGetWinData();
129 
130  if ( !mpWindowImpl->mbInPaint || !(nFlags & ShowTrackFlags::TrackWindow) )
131  {
132  if ( mpWindowImpl->mbTrackVisible )
133  {
134  if ( (*pWinData->mpTrackRect == rRect) &&
135  (pWinData->mnTrackFlags == nFlags) )
136  return;
137 
138  InvertTracking( *pWinData->mpTrackRect, pWinData->mnTrackFlags );
139  }
140 
141  InvertTracking( rRect, nFlags );
142  }
143 
144  pWinData->mpTrackRect = rRect;
145  pWinData->mnTrackFlags = nFlags;
146  mpWindowImpl->mbTrackVisible = true;
147 }
148 
149 void Window::HideTracking()
150 {
151  if ( mpWindowImpl->mbTrackVisible )
152  {
153  ImplWinData* pWinData = ImplGetWinData();
154  if ( !mpWindowImpl->mbInPaint || !(pWinData->mnTrackFlags & ShowTrackFlags::TrackWindow) )
155  InvertTracking( *pWinData->mpTrackRect, pWinData->mnTrackFlags );
156  mpWindowImpl->mbTrackVisible = false;
157  }
158 }
159 
160 void Window::InvertTracking( const tools::Rectangle& rRect, ShowTrackFlags nFlags )
161 {
162  OutputDevice *pOutDev = GetOutDev();
163  tools::Rectangle aRect( pOutDev->ImplLogicToDevicePixel( rRect ) );
164 
165  if ( aRect.IsEmpty() )
166  return;
167  aRect.Justify();
168 
169  SalGraphics* pGraphics;
170 
171  if ( nFlags & ShowTrackFlags::TrackWindow )
172  {
173  if ( !GetOutDev()->IsDeviceOutputNecessary() )
174  return;
175 
176  // we need a graphics
177  if ( !GetOutDev()->mpGraphics )
178  {
179  if ( !pOutDev->AcquireGraphics() )
180  return;
181  }
182 
183  if ( GetOutDev()->mbInitClipRegion )
184  GetOutDev()->InitClipRegion();
185 
186  if ( GetOutDev()->mbOutputClipped )
187  return;
188 
189  pGraphics = GetOutDev()->mpGraphics;
190  }
191  else
192  {
193  pGraphics = ImplGetFrameGraphics();
194 
195  if ( nFlags & ShowTrackFlags::Clip )
196  {
197  vcl::Region aRegion( GetOutputRectPixel() );
198  ImplClipBoundaries( aRegion, false, false );
199  pOutDev->SelectClipRegion( aRegion, pGraphics );
200  }
201  }
202 
203  ShowTrackFlags nStyle = nFlags & ShowTrackFlags::StyleMask;
204  if ( nStyle == ShowTrackFlags::Object )
205  pGraphics->Invert( aRect.Left(), aRect.Top(), aRect.GetWidth(), aRect.GetHeight(), SalInvert::TrackFrame, *GetOutDev() );
206  else if ( nStyle == ShowTrackFlags::Split )
207  pGraphics->Invert( aRect.Left(), aRect.Top(), aRect.GetWidth(), aRect.GetHeight(), SalInvert::N50, *GetOutDev() );
208  else
209  {
210  tools::Long nBorder = 1;
211  if ( nStyle == ShowTrackFlags::Big )
212  nBorder = 5;
213  pGraphics->Invert( aRect.Left(), aRect.Top(), aRect.GetWidth(), nBorder, SalInvert::N50, *GetOutDev() );
214  pGraphics->Invert( aRect.Left(), aRect.Bottom()-nBorder+1, aRect.GetWidth(), nBorder, SalInvert::N50, *GetOutDev() );
215  pGraphics->Invert( aRect.Left(), aRect.Top()+nBorder, nBorder, aRect.GetHeight()-(nBorder*2), SalInvert::N50, *GetOutDev() );
216  pGraphics->Invert( aRect.Right()-nBorder+1, aRect.Top()+nBorder, nBorder, aRect.GetHeight()-(nBorder*2), SalInvert::N50, *GetOutDev() );
217  }
218 }
219 
220 IMPL_LINK( Window, ImplTrackTimerHdl, Timer*, pTimer, void )
221 {
222  ImplSVData* pSVData = ImplGetSVData();
223 
224  // if Button-Repeat we have to change the timeout
226  pTimer->SetTimeout( GetSettings().GetMouseSettings().GetButtonRepeat() );
227 
228  // create Tracking-Event
229  Point aMousePos( mpWindowImpl->mpFrameData->mnLastMouseX, mpWindowImpl->mpFrameData->mnLastMouseY );
230  if( GetOutDev()->ImplIsAntiparallel() )
231  {
232  // re-mirror frame pos at pChild
233  const OutputDevice *pOutDev = GetOutDev();
234  pOutDev->ReMirror( aMousePos );
235  }
236  MouseEvent aMEvt( ImplFrameToOutput( aMousePos ),
237  mpWindowImpl->mpFrameData->mnClickCount, MouseEventModifiers::NONE,
238  mpWindowImpl->mpFrameData->mnMouseCode,
239  mpWindowImpl->mpFrameData->mnMouseCode );
241  Tracking( aTEvt );
242 }
243 
244 void Window::StartTracking( StartTrackingFlags nFlags )
245 {
246  ImplSVData* pSVData = ImplGetSVData();
247 
248  if ( pSVData->mpWinData->mpTrackWin.get() != this )
249  {
250  if ( pSVData->mpWinData->mpTrackWin )
252  }
253 
255  {
256  pSVData->mpWinData->mpTrackTimer = new AutoTimer;
257 
258  if ( nFlags & StartTrackingFlags::ScrollRepeat )
260  else
262  pSVData->mpWinData->mpTrackTimer->SetInvokeHandler( LINK( this, Window, ImplTrackTimerHdl ) );
263  pSVData->mpWinData->mpTrackTimer->SetDebugName( "vcl::Window pSVData->mpWinData->mpTrackTimer" );
264  pSVData->mpWinData->mpTrackTimer->Start();
265  }
266 
267  pSVData->mpWinData->mpTrackWin = this;
268  pSVData->mpWinData->mnTrackFlags = nFlags;
269  CaptureMouse();
270 }
271 
272 void Window::EndTracking( TrackingEventFlags nFlags )
273 {
274  ImplSVData* pSVData = ImplGetSVData();
275 
276  if ( pSVData->mpWinData->mpTrackWin.get() != this )
277  return;
278 
279  if ( pSVData->mpWinData->mpTrackTimer )
280  {
281  delete pSVData->mpWinData->mpTrackTimer;
282  pSVData->mpWinData->mpTrackTimer = nullptr;
283  }
284 
285  pSVData->mpWinData->mpTrackWin = nullptr;
287  ReleaseMouse();
288 
289  // call EndTracking if required
290  {
291  Point aMousePos( mpWindowImpl->mpFrameData->mnLastMouseX, mpWindowImpl->mpFrameData->mnLastMouseY );
292  if( GetOutDev()->ImplIsAntiparallel() )
293  {
294  // re-mirror frame pos at pChild
295  const OutputDevice *pOutDev = GetOutDev();
296  pOutDev->ReMirror( aMousePos );
297  }
298 
299  MouseEvent aMEvt( ImplFrameToOutput( aMousePos ),
300  mpWindowImpl->mpFrameData->mnClickCount, MouseEventModifiers::NONE,
301  mpWindowImpl->mpFrameData->mnMouseCode,
302  mpWindowImpl->mpFrameData->mnMouseCode );
303  TrackingEvent aTEvt( aMEvt, nFlags | TrackingEventFlags::End );
304  // CompatTracking effectively
305  if (!mpWindowImpl || mpWindowImpl->mbInDispose)
306  return Window::Tracking( aTEvt );
307  else
308  return Tracking( aTEvt );
309  }
310 }
311 
312 bool Window::IsTracking() const
313 {
314  return (ImplGetSVData()->mpWinData->mpTrackWin == this);
315 }
316 
317 void Window::StartAutoScroll( StartAutoScrollFlags nFlags )
318 {
319  ImplSVData* pSVData = ImplGetSVData();
320 
321  if ( pSVData->mpWinData->mpAutoScrollWin.get() != this )
322  {
323  if ( pSVData->mpWinData->mpAutoScrollWin )
325  }
326 
327  pSVData->mpWinData->mpAutoScrollWin = this;
328  pSVData->mpWinData->mnAutoScrollFlags = nFlags;
330 }
331 
332 void Window::EndAutoScroll()
333 {
334  ImplSVData* pSVData = ImplGetSVData();
335 
336  if ( pSVData->mpWinData->mpAutoScrollWin.get() == this )
337  {
338  pSVData->mpWinData->mpAutoScrollWin = nullptr;
340  pSVData->maAppData.mpWheelWindow->ImplStop();
342  }
343 }
344 
345 VclPtr<vcl::Window> Window::SaveFocus()
346 {
347  ImplSVData* pSVData = ImplGetSVData();
348  if ( pSVData->mpWinData->mpFocusWin )
349  {
350  return pSVData->mpWinData->mpFocusWin;
351  }
352  else
353  return nullptr;
354 }
355 
356 void Window::EndSaveFocus(const VclPtr<vcl::Window>& xFocusWin)
357 {
358  if (xFocusWin && !xFocusWin->isDisposed())
359  {
360  xFocusWin->GrabFocus();
361  }
362 }
363 
364 void Window::SetZoom( const Fraction& rZoom )
365 {
366  if ( mpWindowImpl && mpWindowImpl->maZoom != rZoom )
367  {
368  mpWindowImpl->maZoom = rZoom;
369  CompatStateChanged( StateChangedType::Zoom );
370  }
371 }
372 
373 void Window::SetZoomedPointFont(vcl::RenderContext& rRenderContext, const vcl::Font& rFont)
374 {
375  const Fraction& rZoom = GetZoom();
376  if (rZoom.GetNumerator() != rZoom.GetDenominator())
377  {
378  vcl::Font aFont(rFont);
379  Size aSize = aFont.GetFontSize();
380  aSize.setWidth( FRound(double(aSize.Width() * rZoom)) );
381  aSize.setHeight( FRound(double(aSize.Height() * rZoom)) );
382  aFont.SetFontSize(aSize);
383  SetPointFont(rRenderContext, aFont);
384  }
385  else
386  {
387  SetPointFont(rRenderContext, rFont);
388  }
389 }
390 
391 tools::Long Window::CalcZoom( tools::Long nCalc ) const
392 {
393 
394  const Fraction& rZoom = GetZoom();
395  if ( rZoom.GetNumerator() != rZoom.GetDenominator() )
396  {
397  double n = double(nCalc * rZoom);
398  nCalc = FRound( n );
399  }
400  return nCalc;
401 }
402 
403 void Window::SetControlFont()
404 {
405  if (mpWindowImpl && mpWindowImpl->mpControlFont)
406  {
407  mpWindowImpl->mpControlFont.reset();
408  CompatStateChanged(StateChangedType::ControlFont);
409  }
410 }
411 
412 void Window::SetControlFont(const vcl::Font& rFont)
413 {
414  if (rFont == vcl::Font())
415  {
416  SetControlFont();
417  return;
418  }
419 
420  if (mpWindowImpl->mpControlFont)
421  {
422  if (*mpWindowImpl->mpControlFont == rFont)
423  return;
424  *mpWindowImpl->mpControlFont = rFont;
425  }
426  else
427  mpWindowImpl->mpControlFont.reset( new vcl::Font(rFont) );
428 
429  CompatStateChanged(StateChangedType::ControlFont);
430 }
431 
432 vcl::Font Window::GetControlFont() const
433 {
434  if (mpWindowImpl->mpControlFont)
435  return *mpWindowImpl->mpControlFont;
436  else
437  {
438  vcl::Font aFont;
439  return aFont;
440  }
441 }
442 
443 void Window::ApplyControlFont(vcl::RenderContext& rRenderContext, const vcl::Font& rFont)
444 {
445  vcl::Font aFont(rFont);
446  if (IsControlFont())
447  aFont.Merge(GetControlFont());
448  SetZoomedPointFont(rRenderContext, aFont);
449 }
450 
451 void Window::SetControlForeground()
452 {
453  if (mpWindowImpl->mbControlForeground)
454  {
455  mpWindowImpl->maControlForeground = COL_TRANSPARENT;
456  mpWindowImpl->mbControlForeground = false;
457  CompatStateChanged(StateChangedType::ControlForeground);
458  }
459 }
460 
461 void Window::SetControlForeground(const Color& rColor)
462 {
463  if (rColor.IsTransparent())
464  {
465  if (mpWindowImpl->mbControlForeground)
466  {
467  mpWindowImpl->maControlForeground = COL_TRANSPARENT;
468  mpWindowImpl->mbControlForeground = false;
469  CompatStateChanged(StateChangedType::ControlForeground);
470  }
471  }
472  else
473  {
474  if (mpWindowImpl->maControlForeground != rColor)
475  {
476  mpWindowImpl->maControlForeground = rColor;
477  mpWindowImpl->mbControlForeground = true;
478  CompatStateChanged(StateChangedType::ControlForeground);
479  }
480  }
481 }
482 
483 void Window::ApplyControlForeground(vcl::RenderContext& rRenderContext, const Color& rDefaultColor)
484 {
485  Color aTextColor(rDefaultColor);
486  if (IsControlForeground())
487  aTextColor = GetControlForeground();
488  rRenderContext.SetTextColor(aTextColor);
489 }
490 
491 void Window::SetControlBackground()
492 {
493  if (mpWindowImpl->mbControlBackground)
494  {
495  mpWindowImpl->maControlBackground = COL_TRANSPARENT;
496  mpWindowImpl->mbControlBackground = false;
497  CompatStateChanged(StateChangedType::ControlBackground);
498  }
499 }
500 
501 void Window::SetControlBackground(const Color& rColor)
502 {
503  if (rColor.IsTransparent())
504  {
505  if (mpWindowImpl->mbControlBackground)
506  {
507  mpWindowImpl->maControlBackground = COL_TRANSPARENT;
508  mpWindowImpl->mbControlBackground = false;
509  CompatStateChanged(StateChangedType::ControlBackground);
510  }
511  }
512  else
513  {
514  if (mpWindowImpl->maControlBackground != rColor)
515  {
516  mpWindowImpl->maControlBackground = rColor;
517  mpWindowImpl->mbControlBackground = true;
518  CompatStateChanged(StateChangedType::ControlBackground);
519  }
520  }
521 }
522 
523 void Window::ApplyControlBackground(vcl::RenderContext& rRenderContext, const Color& rDefaultColor)
524 {
525  Color aColor(rDefaultColor);
526  if (IsControlBackground())
527  aColor = GetControlBackground();
528  rRenderContext.SetBackground(aColor);
529 }
530 
531 Size Window::CalcWindowSize( const Size& rOutSz ) const
532 {
533  Size aSz = rOutSz;
534  aSz.AdjustWidth(mpWindowImpl->mnLeftBorder+mpWindowImpl->mnRightBorder );
535  aSz.AdjustHeight(mpWindowImpl->mnTopBorder+mpWindowImpl->mnBottomBorder );
536  return aSz;
537 }
538 
539 Size Window::CalcOutputSize( const Size& rWinSz ) const
540 {
541  Size aSz = rWinSz;
542  aSz.AdjustWidth( -(mpWindowImpl->mnLeftBorder+mpWindowImpl->mnRightBorder) );
543  aSz.AdjustHeight( -(mpWindowImpl->mnTopBorder+mpWindowImpl->mnBottomBorder) );
544  return aSz;
545 }
546 
547 vcl::Font Window::GetDrawPixelFont(OutputDevice const * pDev) const
548 {
549  vcl::Font aFont = GetPointFont(*GetOutDev());
550  Size aFontSize = aFont.GetFontSize();
551  MapMode aPtMapMode(MapUnit::MapPoint);
552  aFontSize = pDev->LogicToPixel( aFontSize, aPtMapMode );
553  aFont.SetFontSize( aFontSize );
554  return aFont;
555 }
556 
557 tools::Long Window::GetDrawPixel( OutputDevice const * pDev, tools::Long nPixels ) const
558 {
559  tools::Long nP = nPixels;
560  if ( pDev->GetOutDevType() != OUTDEV_WINDOW )
561  {
562  MapMode aMap( MapUnit::Map100thMM );
563  Size aSz( nP, 0 );
564  aSz = PixelToLogic( aSz, aMap );
565  aSz = pDev->LogicToPixel( aSz, aMap );
566  nP = aSz.Width();
567  }
568  return nP;
569 }
570 
571 static void lcl_HandleScrollHelper( ScrollBar* pScrl, double nN, bool isMultiplyByLineSize )
572 {
573  if ( !pScrl || !nN || !pScrl->IsEnabled() || !pScrl->IsInputEnabled() || pScrl->IsInModalMode() )
574  return;
575 
576  tools::Long nNewPos = pScrl->GetThumbPos();
577 
578  if ( nN == double(-LONG_MAX) )
579  nNewPos += pScrl->GetPageSize();
580  else if ( nN == double(LONG_MAX) )
581  nNewPos -= pScrl->GetPageSize();
582  else
583  {
584  // allowing both chunked and continuous scrolling
585  if(isMultiplyByLineSize){
586  nN*=pScrl->GetLineSize();
587  }
588 
589  const double fVal = nNewPos - nN;
590 
591  if ( !o3tl::convertsToAtLeast(fVal, LONG_MIN) )
592  nNewPos = LONG_MIN;
593  else if ( !o3tl::convertsToAtMost(fVal, LONG_MAX) )
594  nNewPos = LONG_MAX;
595  else
596  nNewPos = static_cast<tools::Long>(fVal);
597  }
598 
599  pScrl->DoScroll( nNewPos );
600 
601 }
602 
603 bool Window::HandleScrollCommand( const CommandEvent& rCmd,
604  ScrollBar* pHScrl, ScrollBar* pVScrl )
605 {
606  bool bRet = false;
607 
608  if ( pHScrl || pVScrl )
609  {
610  switch( rCmd.GetCommand() )
611  {
613  {
615  if ( pHScrl )
616  {
617  if ( (pHScrl->GetVisibleSize() < pHScrl->GetRangeMax()) &&
618  pHScrl->IsEnabled() && pHScrl->IsInputEnabled() && ! pHScrl->IsInModalMode() )
619  nFlags |= StartAutoScrollFlags::Horz;
620  }
621  if ( pVScrl )
622  {
623  if ( (pVScrl->GetVisibleSize() < pVScrl->GetRangeMax()) &&
624  pVScrl->IsEnabled() && pVScrl->IsInputEnabled() && ! pVScrl->IsInModalMode() )
625  nFlags |= StartAutoScrollFlags::Vert;
626  }
627 
628  if ( nFlags != StartAutoScrollFlags::NONE )
629  {
630  StartAutoScroll( nFlags );
631  bRet = true;
632  }
633  }
634  break;
635 
637  {
638  const CommandWheelData* pData = rCmd.GetWheelData();
639 
640  if ( pData && (CommandWheelMode::SCROLL == pData->GetMode()) )
641  {
642  if (!pData->IsDeltaPixel())
643  {
644  double nScrollLines = pData->GetScrollLines();
645  double nLines;
646  if ( nScrollLines == COMMAND_WHEEL_PAGESCROLL )
647  {
648  if ( pData->GetDelta() < 0 )
649  nLines = double(-LONG_MAX);
650  else
651  nLines = double(LONG_MAX);
652  }
653  else
654  nLines = pData->GetNotchDelta() * nScrollLines;
655  if ( nLines )
656  {
657  ImplHandleScroll( nullptr,
658  0L,
659  pData->IsHorz() ? pHScrl : pVScrl,
660  nLines );
661  bRet = true;
662  }
663  }
664  else
665  {
666  // Mobile / touch scrolling section
667  const Point & deltaPoint = rCmd.GetMousePosPixel();
668 
669  double deltaXInPixels = double(deltaPoint.X());
670  double deltaYInPixels = double(deltaPoint.Y());
671  Size winSize = GetOutputSizePixel();
672 
673  if(pHScrl)
674  {
675  double visSizeX = double(pHScrl->GetVisibleSize());
676  double ratioX = deltaXInPixels / double(winSize.getWidth());
677  tools::Long deltaXInLogic = tools::Long(visSizeX * ratioX);
678  // Touch need to work by pixels. Did not apply this to
679  // Android, as android code may require adaptations
680  // to work with this scrolling code
681 #ifndef IOS
682  tools::Long lineSizeX = pHScrl->GetLineSize();
683 
684  if(lineSizeX)
685  {
686  deltaXInLogic /= lineSizeX;
687  }
688  else
689  {
690  deltaXInLogic = 0;
691  }
692 #endif
693  if ( deltaXInLogic)
694  {
695 #ifndef IOS
696  bool const isMultiplyByLineSize = true;
697 #else
698  bool const isMultiplyByLineSize = false;
699 #endif
700  lcl_HandleScrollHelper( pHScrl, deltaXInLogic, isMultiplyByLineSize );
701  bRet = true;
702  }
703  }
704  if(pVScrl)
705  {
706  double visSizeY = double(pVScrl->GetVisibleSize());
707  double ratioY = deltaYInPixels / double(winSize.getHeight());
708  tools::Long deltaYInLogic = tools::Long(visSizeY * ratioY);
709 
710  // Touch need to work by pixels. Did not apply this to
711  // Android, as android code may require adaptations
712  // to work with this scrolling code
713 #ifndef IOS
714  tools::Long lineSizeY = pVScrl->GetLineSize();
715  if(lineSizeY)
716  {
717  deltaYInLogic /= lineSizeY;
718  }
719  else
720  {
721  deltaYInLogic = 0;
722  }
723 #endif
724  if ( deltaYInLogic )
725  {
726 #ifndef IOS
727  bool const isMultiplyByLineSize = true;
728 #else
729  bool const isMultiplyByLineSize = false;
730 #endif
731  lcl_HandleScrollHelper( pVScrl, deltaYInLogic, isMultiplyByLineSize );
732 
733  bRet = true;
734  }
735  }
736  }
737  }
738  }
739  break;
740 
742  {
743  if (pVScrl)
744  {
745  const CommandGestureData* pData = rCmd.GetGestureData();
747  {
748  mpWindowImpl->mpFrameData->mnTouchPanPosition = pVScrl->GetThumbPos();
749  }
751  {
752  tools::Long nOriginalPosition = mpWindowImpl->mpFrameData->mnTouchPanPosition;
753  pVScrl->DoScroll(nOriginalPosition + (pData->mfOffset / pVScrl->GetVisibleSize()));
754  }
756  {
757  mpWindowImpl->mpFrameData->mnTouchPanPosition = -1;
758  }
759  bRet = true;
760  }
761  break;
762  }
763 
765  {
766  const CommandScrollData* pData = rCmd.GetAutoScrollData();
767  if ( pData && (pData->GetDeltaX() || pData->GetDeltaY()) )
768  {
769  ImplHandleScroll( pHScrl, pData->GetDeltaX(),
770  pVScrl, pData->GetDeltaY() );
771  bRet = true;
772  }
773  }
774  break;
775 
776  default:
777  break;
778  }
779  }
780 
781  return bRet;
782 }
783 
784 // Note that when called for CommandEventId::Wheel above, despite its name,
785 // pVScrl isn't necessarily the vertical scroll bar. Depending on
786 // whether the scroll is horizontal or vertical, it is either the
787 // horizontal or vertical scroll bar. nY is correspondingly either
788 // the horizontal or vertical scroll amount.
789 
790 void Window::ImplHandleScroll( ScrollBar* pHScrl, double nX,
791  ScrollBar* pVScrl, double nY )
792 {
793  lcl_HandleScrollHelper( pHScrl, nX, true );
794  lcl_HandleScrollHelper( pVScrl, nY, true );
795 }
796 
797 DockingManager* Window::GetDockingManager()
798 {
799  return ImplGetDockingManager();
800 }
801 
802 void Window::EnableDocking( bool bEnable )
803 {
804  // update list of dockable windows
805  if( bEnable )
806  ImplGetDockingManager()->AddWindow( this );
807  else
809 }
810 
811 // retrieves the list of owner draw decorated windows for this window hierarchy
812 ::std::vector<VclPtr<vcl::Window> >& Window::ImplGetOwnerDrawList()
813 {
814  return ImplGetTopmostFrameWindow()->mpWindowImpl->mpFrameData->maOwnerDrawList;
815 }
816 
817 void Window::SetHelpId( const OString& rHelpId )
818 {
819  mpWindowImpl->maHelpId = rHelpId;
820 }
821 
822 const OString& Window::GetHelpId() const
823 {
824  return mpWindowImpl->maHelpId;
825 }
826 
827 // --------- old inline methods ---------------
828 
829 vcl::Window* Window::ImplGetWindow() const
830 {
831  if ( mpWindowImpl->mpClientWindow )
832  return mpWindowImpl->mpClientWindow;
833  else
834  return const_cast<vcl::Window*>(this);
835 }
836 
837 ImplFrameData* Window::ImplGetFrameData()
838 {
839  return mpWindowImpl ? mpWindowImpl->mpFrameData : nullptr;
840 }
841 
842 SalFrame* Window::ImplGetFrame() const
843 {
844  return mpWindowImpl ? mpWindowImpl->mpFrame : nullptr;
845 }
846 
847 weld::Window* Window::GetFrameWeld() const
848 {
849  SalFrame* pFrame = ImplGetFrame();
850  return pFrame ? pFrame->GetFrameWeld() : nullptr;
851 }
852 
853 vcl::Window* Window::GetFrameWindow() const
854 {
855  SalFrame* pFrame = ImplGetFrame();
856  return pFrame ? pFrame->GetWindow() : nullptr;
857 }
858 
859 vcl::Window* Window::ImplGetParent() const
860 {
861  return mpWindowImpl ? mpWindowImpl->mpParent.get() : nullptr;
862 }
863 
864 vcl::Window* Window::ImplGetClientWindow() const
865 {
866  return mpWindowImpl ? mpWindowImpl->mpClientWindow.get() : nullptr;
867 }
868 
869 vcl::Window* Window::ImplGetBorderWindow() const
870 {
871  return mpWindowImpl ? mpWindowImpl->mpBorderWindow.get() : nullptr;
872 }
873 
874 vcl::Window* Window::ImplGetFirstOverlapWindow()
875 {
876  if (!mpWindowImpl)
877  {
878  return nullptr;
879  }
880 
881  if ( mpWindowImpl->mbOverlapWin )
882  return this;
883  else
884  return mpWindowImpl->mpOverlapWindow;
885 }
886 
887 const vcl::Window* Window::ImplGetFirstOverlapWindow() const
888 {
889  if (!mpWindowImpl)
890  {
891  return nullptr;
892  }
893 
894  if ( mpWindowImpl->mbOverlapWin )
895  return this;
896  else
897  return mpWindowImpl->mpOverlapWindow;
898 }
899 
900 vcl::Window* Window::ImplGetFrameWindow() const
901 {
902  return mpWindowImpl ? mpWindowImpl->mpFrameWindow.get() : nullptr;
903 }
904 
905 bool Window::IsDockingWindow() const
906 {
907  return mpWindowImpl && mpWindowImpl->mbDockWin;
908 }
909 
910 bool Window::ImplIsFloatingWindow() const
911 {
912  return mpWindowImpl && mpWindowImpl->mbFloatWin;
913 }
914 
915 bool Window::ImplIsSplitter() const
916 {
917  return mpWindowImpl && mpWindowImpl->mbSplitter;
918 }
919 
920 bool Window::ImplIsPushButton() const
921 {
922  return mpWindowImpl && mpWindowImpl->mbPushButton;
923 }
924 
925 bool Window::ImplIsOverlapWindow() const
926 {
927  return mpWindowImpl && mpWindowImpl->mbOverlapWin;
928 }
929 
930 void Window::ImplSetMouseTransparent( bool bTransparent )
931 {
932  if (mpWindowImpl)
933  mpWindowImpl->mbMouseTransparent = bTransparent;
934 }
935 
936 Point Window::ImplOutputToFrame( const Point& rPos )
937 {
938  return Point( rPos.X()+GetOutDev()->mnOutOffX, rPos.Y()+GetOutDev()->mnOutOffY );
939 }
940 
941 Point Window::ImplFrameToOutput( const Point& rPos )
942 {
943  return Point( rPos.X()-GetOutDev()->mnOutOffX, rPos.Y()-GetOutDev()->mnOutOffY );
944 }
945 
946 void Window::SetCompoundControl( bool bCompound )
947 {
948  if (mpWindowImpl)
949  mpWindowImpl->mbCompoundControl = bCompound;
950 }
951 
952 WinBits Window::GetStyle() const
953 {
954  return mpWindowImpl ? mpWindowImpl->mnStyle : 0;
955 }
956 
957 WinBits Window::GetPrevStyle() const
958 {
959  return mpWindowImpl ? mpWindowImpl->mnPrevStyle : 0;
960 }
961 
962 WindowExtendedStyle Window::GetExtendedStyle() const
963 {
964  return mpWindowImpl ? mpWindowImpl->mnExtendedStyle : WindowExtendedStyle::NONE;
965 }
966 
967 void Window::SetType( WindowType nType )
968 {
969  if (mpWindowImpl)
970  mpWindowImpl->mnType = nType;
971 }
972 
973 WindowType Window::GetType() const
974 {
975  if (mpWindowImpl)
976  return mpWindowImpl->mnType;
977  else
978  return WindowType::NONE;
979 }
980 
981 Dialog* Window::GetParentDialog() const
982 {
983  const vcl::Window *pWindow = this;
984 
985  while( pWindow )
986  {
987  if( pWindow->IsDialog() )
988  break;
989 
990  pWindow = pWindow->GetParent();
991  }
992 
993  return const_cast<Dialog *>(dynamic_cast<const Dialog*>(pWindow));
994 }
995 
996 bool Window::IsSystemWindow() const
997 {
998  return mpWindowImpl && mpWindowImpl->mbSysWin;
999 }
1000 
1001 bool Window::IsDialog() const
1002 {
1003  return mpWindowImpl && mpWindowImpl->mbDialog;
1004 }
1005 
1006 bool Window::IsMenuFloatingWindow() const
1007 {
1008  return mpWindowImpl && mpWindowImpl->mbMenuFloatingWindow;
1009 }
1010 
1011 bool Window::IsToolbarFloatingWindow() const
1012 {
1013  return mpWindowImpl && mpWindowImpl->mbToolbarFloatingWindow;
1014 }
1015 
1016 void Window::EnableAllResize()
1017 {
1018  mpWindowImpl->mbAllResize = true;
1019 }
1020 
1021 void Window::EnableChildTransparentMode( bool bEnable )
1022 {
1023  mpWindowImpl->mbChildTransparent = bEnable;
1024 }
1025 
1026 bool Window::IsChildTransparentModeEnabled() const
1027 {
1028  return mpWindowImpl && mpWindowImpl->mbChildTransparent;
1029 }
1030 
1031 bool Window::IsMouseTransparent() const
1032 {
1033  return mpWindowImpl && mpWindowImpl->mbMouseTransparent;
1034 }
1035 
1036 bool Window::IsPaintTransparent() const
1037 {
1038  return mpWindowImpl && mpWindowImpl->mbPaintTransparent;
1039 }
1040 
1041 void Window::SetDialogControlStart( bool bStart )
1042 {
1043  mpWindowImpl->mbDlgCtrlStart = bStart;
1044 }
1045 
1046 bool Window::IsDialogControlStart() const
1047 {
1048  return mpWindowImpl && mpWindowImpl->mbDlgCtrlStart;
1049 }
1050 
1051 void Window::SetDialogControlFlags( DialogControlFlags nFlags )
1052 {
1053  mpWindowImpl->mnDlgCtrlFlags = nFlags;
1054 }
1055 
1056 DialogControlFlags Window::GetDialogControlFlags() const
1057 {
1058  return mpWindowImpl->mnDlgCtrlFlags;
1059 }
1060 
1061 const InputContext& Window::GetInputContext() const
1062 {
1063  return mpWindowImpl->maInputContext;
1064 }
1065 
1066 bool Window::IsControlFont() const
1067 {
1068  return bool(mpWindowImpl->mpControlFont);
1069 }
1070 
1071 const Color& Window::GetControlForeground() const
1072 {
1073  return mpWindowImpl->maControlForeground;
1074 }
1075 
1076 bool Window::IsControlForeground() const
1077 {
1078  return mpWindowImpl->mbControlForeground;
1079 }
1080 
1081 const Color& Window::GetControlBackground() const
1082 {
1083  return mpWindowImpl->maControlBackground;
1084 }
1085 
1086 bool Window::IsControlBackground() const
1087 {
1088  return mpWindowImpl->mbControlBackground;
1089 }
1090 
1091 bool Window::IsInPaint() const
1092 {
1093  return mpWindowImpl && mpWindowImpl->mbInPaint;
1094 }
1095 
1096 vcl::Window* Window::GetParent() const
1097 {
1098  return mpWindowImpl ? mpWindowImpl->mpRealParent.get() : nullptr;
1099 }
1100 
1101 bool Window::IsVisible() const
1102 {
1103  return mpWindowImpl && mpWindowImpl->mbVisible;
1104 }
1105 
1106 bool Window::IsReallyVisible() const
1107 {
1108  return mpWindowImpl && mpWindowImpl->mbReallyVisible;
1109 }
1110 
1111 bool Window::IsReallyShown() const
1112 {
1113  return mpWindowImpl && mpWindowImpl->mbReallyShown;
1114 }
1115 
1116 bool Window::IsInInitShow() const
1117 {
1118  return mpWindowImpl->mbInInitShow;
1119 }
1120 
1121 bool Window::IsEnabled() const
1122 {
1123  return mpWindowImpl && !mpWindowImpl->mbDisabled;
1124 }
1125 
1126 bool Window::IsInputEnabled() const
1127 {
1128  return mpWindowImpl && !mpWindowImpl->mbInputDisabled;
1129 }
1130 
1131 bool Window::IsAlwaysEnableInput() const
1132 {
1133  return mpWindowImpl->meAlwaysInputMode == AlwaysInputEnabled;
1134 }
1135 
1136 ActivateModeFlags Window::GetActivateMode() const
1137 {
1138  return mpWindowImpl->mnActivateMode;
1139 
1140 }
1141 
1142 bool Window::IsAlwaysOnTopEnabled() const
1143 {
1144  return mpWindowImpl->mbAlwaysOnTop;
1145 }
1146 
1147 bool Window::IsDefaultPos() const
1148 {
1149  return mpWindowImpl->mbDefPos;
1150 }
1151 
1152 bool Window::IsDefaultSize() const
1153 {
1154  return mpWindowImpl->mbDefSize;
1155 }
1156 
1157 Point Window::GetOffsetPixelFrom(const vcl::Window& rWindow) const
1158 {
1159  return Point(GetOutOffXPixel() - rWindow.GetOutOffXPixel(), GetOutOffYPixel() - rWindow.GetOutOffYPixel());
1160 }
1161 
1162 void Window::EnablePaint( bool bEnable )
1163 {
1164  mpWindowImpl->mbPaintDisabled = !bEnable;
1165 }
1166 
1167 bool Window::IsPaintEnabled() const
1168 {
1169  return !mpWindowImpl->mbPaintDisabled;
1170 }
1171 
1172 bool Window::IsUpdateMode() const
1173 {
1174  return !mpWindowImpl->mbNoUpdate;
1175 }
1176 
1177 void Window::SetParentUpdateMode( bool bUpdate )
1178 {
1179  mpWindowImpl->mbNoParentUpdate = !bUpdate;
1180 }
1181 
1182 bool Window::IsActive() const
1183 {
1184  return mpWindowImpl->mbActive;
1185 }
1186 
1187 GetFocusFlags Window::GetGetFocusFlags() const
1188 {
1189  return mpWindowImpl->mnGetFocusFlags;
1190 }
1191 
1192 bool Window::IsCompoundControl() const
1193 {
1194  return mpWindowImpl->mbCompoundControl;
1195 }
1196 
1197 bool Window::IsWait() const
1198 {
1199  return (mpWindowImpl->mnWaitCount != 0);
1200 }
1201 
1202 vcl::Cursor* Window::GetCursor() const
1203 {
1204  if (!mpWindowImpl)
1205  return nullptr;
1206  return mpWindowImpl->mpCursor;
1207 }
1208 
1209 const Fraction& Window::GetZoom() const
1210 {
1211  return mpWindowImpl->maZoom;
1212 }
1213 
1214 bool Window::IsZoom() const
1215 {
1216  return mpWindowImpl->maZoom.GetNumerator() != mpWindowImpl->maZoom.GetDenominator();
1217 }
1218 
1219 void Window::SetHelpText( const OUString& rHelpText )
1220 {
1221  mpWindowImpl->maHelpText = rHelpText;
1222  mpWindowImpl->mbHelpTextDynamic = true;
1223 }
1224 
1225 void Window::SetQuickHelpText( const OUString& rHelpText )
1226 {
1227  if (mpWindowImpl)
1228  mpWindowImpl->maQuickHelpText = rHelpText;
1229 }
1230 
1231 const OUString& Window::GetQuickHelpText() const
1232 {
1233  return mpWindowImpl->maQuickHelpText;
1234 }
1235 
1236 bool Window::IsCreatedWithToolkit() const
1237 {
1238  return mpWindowImpl->mbCreatedWithToolkit;
1239 }
1240 
1241 void Window::SetCreatedWithToolkit( bool b )
1242 {
1243  mpWindowImpl->mbCreatedWithToolkit = b;
1244 }
1245 
1246 PointerStyle Window::GetPointer() const
1247 {
1248  return mpWindowImpl->maPointer;
1249 }
1250 
1251 VCLXWindow* Window::GetWindowPeer() const
1252 {
1253  return mpWindowImpl ? mpWindowImpl->mpVCLXWindow : nullptr;
1254 }
1255 
1256 void Window::SetPosPixel( const Point& rNewPos )
1257 {
1258  setPosSizePixel( rNewPos.X(), rNewPos.Y(), 0, 0, PosSizeFlags::Pos );
1259 }
1260 
1261 void Window::SetSizePixel( const Size& rNewSize )
1262 {
1263  setPosSizePixel( 0, 0, rNewSize.Width(), rNewSize.Height(),
1265 }
1266 
1267 void Window::SetPosSizePixel( const Point& rNewPos, const Size& rNewSize )
1268 {
1269  setPosSizePixel( rNewPos.X(), rNewPos.Y(),
1270  rNewSize.Width(), rNewSize.Height());
1271 }
1272 
1273 void Window::SetOutputSizePixel( const Size& rNewSize )
1274 {
1275  SetSizePixel( Size( rNewSize.Width()+mpWindowImpl->mnLeftBorder+mpWindowImpl->mnRightBorder,
1276  rNewSize.Height()+mpWindowImpl->mnTopBorder+mpWindowImpl->mnBottomBorder ) );
1277 }
1278 
1279 //When a widget wants to renegotiate layout, get toplevel parent dialog and call
1280 //resize on it. Mark all intermediate containers (or container-alike) widgets
1281 //as dirty for the size remains unchanged, but layout changed circumstances
1282 namespace
1283 {
1284  bool queue_ungrouped_resize(vcl::Window const *pOrigWindow)
1285  {
1286  bool bSomeoneCares = false;
1287 
1288  vcl::Window *pWindow = pOrigWindow->GetParent();
1289  if (pWindow)
1290  {
1291  if (isContainerWindow(*pWindow))
1292  {
1293  bSomeoneCares = true;
1294  }
1295  else if (pWindow->GetType() == WindowType::TABCONTROL)
1296  {
1297  bSomeoneCares = true;
1298  }
1299  pWindow->queue_resize();
1300  }
1301 
1302  return bSomeoneCares;
1303  }
1304 }
1305 
1306 void Window::InvalidateSizeCache()
1307 {
1308  WindowImpl *pWindowImpl = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow->mpWindowImpl.get() : mpWindowImpl.get();
1309  pWindowImpl->mnOptimalWidthCache = -1;
1310  pWindowImpl->mnOptimalHeightCache = -1;
1311 }
1312 
1313 static bool HasParentDockingWindow(const vcl::Window* pWindow)
1314 {
1315  while( pWindow )
1316  {
1317  if( pWindow->IsDockingWindow() )
1318  return true;
1319 
1320  pWindow = pWindow->GetParent();
1321  }
1322 
1323  return false;
1324 }
1325 
1326 void Window::queue_resize(StateChangedType eReason)
1327 {
1328  if (isDisposed())
1329  return;
1330 
1331  bool bSomeoneCares = queue_ungrouped_resize(this);
1332 
1333  if (eReason != StateChangedType::Visible)
1334  {
1335  InvalidateSizeCache();
1336  }
1337 
1338  WindowImpl *pWindowImpl = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow->mpWindowImpl.get() : mpWindowImpl.get();
1339  if (pWindowImpl->m_xSizeGroup && pWindowImpl->m_xSizeGroup->get_mode() != VclSizeGroupMode::NONE)
1340  {
1341  std::set<VclPtr<vcl::Window> > &rWindows = pWindowImpl->m_xSizeGroup->get_widgets();
1342  for (VclPtr<vcl::Window> const & pOther : rWindows)
1343  {
1344  if (pOther == this)
1345  continue;
1346  queue_ungrouped_resize(pOther);
1347  }
1348  }
1349 
1350  if (bSomeoneCares && !isDisposed())
1351  {
1352  //fdo#57090 force a resync of the borders of the borderwindow onto this
1353  //window in case they have changed
1354  vcl::Window* pBorderWindow = ImplGetBorderWindow();
1355  if (pBorderWindow)
1356  pBorderWindow->Resize();
1357  }
1358  if (VclPtr<vcl::Window> pParent = GetParentWithLOKNotifier())
1359  {
1360  Size aSize = GetSizePixel();
1361  if (!aSize.IsEmpty() && !pParent->IsInInitShow()
1362  && (GetParentDialog() || HasParentDockingWindow(this)))
1363  LogicInvalidate(nullptr);
1364  }
1365 }
1366 
1367 namespace
1368 {
1369  VclAlign toAlign(std::u16string_view rValue)
1370  {
1371  VclAlign eRet = VclAlign::Fill;
1372 
1373  if (rValue == u"fill")
1374  eRet = VclAlign::Fill;
1375  else if (rValue == u"start")
1376  eRet = VclAlign::Start;
1377  else if (rValue == u"end")
1378  eRet = VclAlign::End;
1379  else if (rValue == u"center")
1380  eRet = VclAlign::Center;
1381  return eRet;
1382  }
1383 }
1384 
1385 bool Window::set_font_attribute(const OString &rKey, const OUString &rValue)
1386 {
1387  if (rKey == "weight")
1388  {
1389  vcl::Font aFont(GetControlFont());
1390  if (rValue == "thin")
1391  aFont.SetWeight(WEIGHT_THIN);
1392  else if (rValue == "ultralight")
1394  else if (rValue == "light")
1395  aFont.SetWeight(WEIGHT_LIGHT);
1396  else if (rValue == "book")
1397  aFont.SetWeight(WEIGHT_SEMILIGHT);
1398  else if (rValue == "normal")
1399  aFont.SetWeight(WEIGHT_NORMAL);
1400  else if (rValue == "medium")
1401  aFont.SetWeight(WEIGHT_MEDIUM);
1402  else if (rValue == "semibold")
1403  aFont.SetWeight(WEIGHT_SEMIBOLD);
1404  else if (rValue == "bold")
1405  aFont.SetWeight(WEIGHT_BOLD);
1406  else if (rValue == "ultrabold")
1407  aFont.SetWeight(WEIGHT_ULTRABOLD);
1408  else
1409  aFont.SetWeight(WEIGHT_BLACK);
1410  SetControlFont(aFont);
1411  }
1412  else if (rKey == "style")
1413  {
1414  vcl::Font aFont(GetControlFont());
1415  if (rValue == "normal")
1416  aFont.SetItalic(ITALIC_NONE);
1417  else if (rValue == "oblique")
1418  aFont.SetItalic(ITALIC_OBLIQUE);
1419  else if (rValue == "italic")
1420  aFont.SetItalic(ITALIC_NORMAL);
1421  SetControlFont(aFont);
1422  }
1423  else if (rKey == "underline")
1424  {
1425  vcl::Font aFont(GetControlFont());
1427  SetControlFont(aFont);
1428  }
1429  else if (rKey == "size")
1430  {
1431  vcl::Font aFont(GetControlFont());
1432  sal_Int32 nHeight = rValue.toInt32() / 1000;
1433  aFont.SetFontHeight(nHeight);
1434  SetControlFont(aFont);
1435  }
1436  else
1437  {
1438  SAL_INFO("vcl.layout", "unhandled font attribute: " << rKey);
1439  return false;
1440  }
1441  return true;
1442 }
1443 
1444 bool Window::set_property(const OString &rKey, const OUString &rValue)
1445 {
1446  if ((rKey == "label") || (rKey == "title") || (rKey == "text") )
1447  {
1448  SetText(BuilderUtils::convertMnemonicMarkup(rValue));
1449  }
1450  else if (rKey == "visible")
1451  Show(toBool(rValue));
1452  else if (rKey == "sensitive")
1453  Enable(toBool(rValue));
1454  else if (rKey == "resizable")
1455  {
1456  WinBits nBits = GetStyle();
1457  nBits &= ~WB_SIZEABLE;
1458  if (toBool(rValue))
1459  nBits |= WB_SIZEABLE;
1460  SetStyle(nBits);
1461  }
1462  else if (rKey == "xalign")
1463  {
1464  WinBits nBits = GetStyle();
1465  nBits &= ~(WB_LEFT | WB_CENTER | WB_RIGHT);
1466 
1467  float f = rValue.toFloat();
1468  assert(f == 0.0 || f == 1.0 || f == 0.5);
1469  if (f == 0.0)
1470  nBits |= WB_LEFT;
1471  else if (f == 1.0)
1472  nBits |= WB_RIGHT;
1473  else if (f == 0.5)
1474  nBits |= WB_CENTER;
1475 
1476  SetStyle(nBits);
1477  }
1478  else if (rKey == "justification")
1479  {
1480  WinBits nBits = GetStyle();
1481  nBits &= ~(WB_LEFT | WB_CENTER | WB_RIGHT);
1482 
1483  if (rValue == "left")
1484  nBits |= WB_LEFT;
1485  else if (rValue == "right")
1486  nBits |= WB_RIGHT;
1487  else if (rValue == "center")
1488  nBits |= WB_CENTER;
1489 
1490  SetStyle(nBits);
1491  }
1492  else if (rKey == "yalign")
1493  {
1494  WinBits nBits = GetStyle();
1495  nBits &= ~(WB_TOP | WB_VCENTER | WB_BOTTOM);
1496 
1497  float f = rValue.toFloat();
1498  assert(f == 0.0 || f == 1.0 || f == 0.5);
1499  if (f == 0.0)
1500  nBits |= WB_TOP;
1501  else if (f == 1.0)
1502  nBits |= WB_BOTTOM;
1503  else if (f == 0.5)
1504  nBits |= WB_CENTER;
1505 
1506  SetStyle(nBits);
1507  }
1508  else if (rKey == "wrap")
1509  {
1510  WinBits nBits = GetStyle();
1511  nBits &= ~WB_WORDBREAK;
1512  if (toBool(rValue))
1513  nBits |= WB_WORDBREAK;
1514  SetStyle(nBits);
1515  }
1516  else if (rKey == "height-request")
1517  set_height_request(rValue.toInt32());
1518  else if (rKey == "width-request")
1519  set_width_request(rValue.toInt32());
1520  else if (rKey == "hexpand")
1521  set_hexpand(toBool(rValue));
1522  else if (rKey == "vexpand")
1523  set_vexpand(toBool(rValue));
1524  else if (rKey == "halign")
1525  set_halign(toAlign(rValue));
1526  else if (rKey == "valign")
1527  set_valign(toAlign(rValue));
1528  else if (rKey == "tooltip-markup")
1529  SetQuickHelpText(rValue);
1530  else if (rKey == "tooltip-text")
1531  SetQuickHelpText(rValue);
1532  else if (rKey == "border-width")
1533  set_border_width(rValue.toInt32());
1534  else if (rKey == "margin-start" || rKey == "margin-left")
1535  {
1536  assert(rKey == "margin-start" && "margin-left deprecated in favor of margin-start");
1537  set_margin_start(rValue.toInt32());
1538  }
1539  else if (rKey == "margin-end" || rKey == "margin-right")
1540  {
1541  assert(rKey == "margin-end" && "margin-right deprecated in favor of margin-end");
1542  set_margin_end(rValue.toInt32());
1543  }
1544  else if (rKey == "margin-top")
1545  set_margin_top(rValue.toInt32());
1546  else if (rKey == "margin-bottom")
1547  set_margin_bottom(rValue.toInt32());
1548  else if (rKey == "hscrollbar-policy")
1549  {
1550  WinBits nBits = GetStyle();
1551  nBits &= ~(WB_AUTOHSCROLL|WB_HSCROLL);
1552  if (rValue == "always")
1553  nBits |= WB_HSCROLL;
1554  else if (rValue == "automatic")
1555  nBits |= WB_AUTOHSCROLL;
1556  SetStyle(nBits);
1557  }
1558  else if (rKey == "vscrollbar-policy")
1559  {
1560  WinBits nBits = GetStyle();
1561  nBits &= ~(WB_AUTOVSCROLL|WB_VSCROLL);
1562  if (rValue == "always")
1563  nBits |= WB_VSCROLL;
1564  else if (rValue == "automatic")
1565  nBits |= WB_AUTOVSCROLL;
1566  SetStyle(nBits);
1567  }
1568  else if (rKey == "accessible-name")
1569  {
1570  SetAccessibleName(rValue);
1571  }
1572  else if (rKey == "accessible-description")
1573  {
1574  SetAccessibleDescription(rValue);
1575  }
1576  else if (rKey == "accessible-role")
1577  {
1578  sal_Int16 role = BuilderUtils::getRoleFromName(rValue.toUtf8());
1579  if (role != com::sun::star::accessibility::AccessibleRole::UNKNOWN)
1580  SetAccessibleRole(role);
1581  }
1582  else if (rKey == "use-markup")
1583  {
1584  //https://live.gnome.org/GnomeGoals/RemoveMarkupInMessages
1585  SAL_WARN_IF(toBool(rValue), "vcl.layout", "Use pango attributes instead of mark-up");
1586  }
1587  else if (rKey == "has-focus")
1588  {
1589  if (toBool(rValue))
1590  GrabFocus();
1591  }
1592  else if (rKey == "can-focus")
1593  {
1594  WinBits nBits = GetStyle();
1595  nBits &= ~(WB_TABSTOP|WB_NOTABSTOP);
1596  if (toBool(rValue))
1597  nBits |= WB_TABSTOP;
1598  else
1599  nBits |= WB_NOTABSTOP;
1600  SetStyle(nBits);
1601  }
1602  else
1603  {
1604  SAL_INFO("vcl.layout", "unhandled property: " << rKey);
1605  return false;
1606  }
1607  return true;
1608 }
1609 
1610 void Window::set_height_request(sal_Int32 nHeightRequest)
1611 {
1612  if (!mpWindowImpl)
1613  return;
1614 
1615  WindowImpl *pWindowImpl = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow->mpWindowImpl.get() : mpWindowImpl.get();
1616 
1617  if ( pWindowImpl->mnHeightRequest != nHeightRequest )
1618  {
1619  pWindowImpl->mnHeightRequest = nHeightRequest;
1620  queue_resize();
1621  }
1622 }
1623 
1624 void Window::set_width_request(sal_Int32 nWidthRequest)
1625 {
1626  if (!mpWindowImpl)
1627  return;
1628 
1629  WindowImpl *pWindowImpl = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow->mpWindowImpl.get() : mpWindowImpl.get();
1630 
1631  if ( pWindowImpl->mnWidthRequest != nWidthRequest )
1632  {
1633  pWindowImpl->mnWidthRequest = nWidthRequest;
1634  queue_resize();
1635  }
1636 }
1637 
1638 Size Window::get_ungrouped_preferred_size() const
1639 {
1640  Size aRet(get_width_request(), get_height_request());
1641  if (aRet.Width() == -1 || aRet.Height() == -1)
1642  {
1643  //cache gets blown away by queue_resize
1644  WindowImpl *pWindowImpl = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow->mpWindowImpl.get() : mpWindowImpl.get();
1645  if (pWindowImpl->mnOptimalWidthCache == -1 || pWindowImpl->mnOptimalHeightCache == -1)
1646  {
1647  Size aOptimal(GetOptimalSize());
1648  pWindowImpl->mnOptimalWidthCache = aOptimal.Width();
1649  pWindowImpl->mnOptimalHeightCache = aOptimal.Height();
1650  }
1651 
1652  if (aRet.Width() == -1)
1653  aRet.setWidth( pWindowImpl->mnOptimalWidthCache );
1654  if (aRet.Height() == -1)
1655  aRet.setHeight( pWindowImpl->mnOptimalHeightCache );
1656  }
1657  return aRet;
1658 }
1659 
1660 Size Window::get_preferred_size() const
1661 {
1662  Size aRet(get_ungrouped_preferred_size());
1663 
1664  WindowImpl *pWindowImpl = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow->mpWindowImpl.get() : mpWindowImpl.get();
1665  if (pWindowImpl->m_xSizeGroup)
1666  {
1667  const VclSizeGroupMode eMode = pWindowImpl->m_xSizeGroup->get_mode();
1668  if (eMode != VclSizeGroupMode::NONE)
1669  {
1670  const bool bIgnoreInHidden = pWindowImpl->m_xSizeGroup->get_ignore_hidden();
1671  const std::set<VclPtr<vcl::Window> > &rWindows = pWindowImpl->m_xSizeGroup->get_widgets();
1672  for (auto const& window : rWindows)
1673  {
1674  const vcl::Window *pOther = window;
1675  if (pOther == this)
1676  continue;
1677  if (bIgnoreInHidden && !pOther->IsVisible())
1678  continue;
1679  Size aOtherSize = pOther->get_ungrouped_preferred_size();
1680  if (eMode == VclSizeGroupMode::Both || eMode == VclSizeGroupMode::Horizontal)
1681  aRet.setWidth( std::max(aRet.Width(), aOtherSize.Width()) );
1682  if (eMode == VclSizeGroupMode::Both || eMode == VclSizeGroupMode::Vertical)
1683  aRet.setHeight( std::max(aRet.Height(), aOtherSize.Height()) );
1684  }
1685  }
1686  }
1687 
1688  return aRet;
1689 }
1690 
1691 VclAlign Window::get_halign() const
1692 {
1693  WindowImpl *pWindowImpl = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow->mpWindowImpl.get() : mpWindowImpl.get();
1694  return pWindowImpl->meHalign;
1695 }
1696 
1697 void Window::set_halign(VclAlign eAlign)
1698 {
1699  WindowImpl *pWindowImpl = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow->mpWindowImpl.get() : mpWindowImpl.get();
1700  pWindowImpl->meHalign = eAlign;
1701 }
1702 
1703 VclAlign Window::get_valign() const
1704 {
1705  WindowImpl *pWindowImpl = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow->mpWindowImpl.get() : mpWindowImpl.get();
1706  return pWindowImpl->meValign;
1707 }
1708 
1709 void Window::set_valign(VclAlign eAlign)
1710 {
1711  WindowImpl *pWindowImpl = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow->mpWindowImpl.get() : mpWindowImpl.get();
1712  pWindowImpl->meValign = eAlign;
1713 }
1714 
1715 bool Window::get_hexpand() const
1716 {
1717  WindowImpl *pWindowImpl = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow->mpWindowImpl.get() : mpWindowImpl.get();
1718  return pWindowImpl->mbHexpand;
1719 }
1720 
1721 void Window::set_hexpand(bool bExpand)
1722 {
1723  WindowImpl *pWindowImpl = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow->mpWindowImpl.get() : mpWindowImpl.get();
1724  pWindowImpl->mbHexpand = bExpand;
1725 }
1726 
1727 bool Window::get_vexpand() const
1728 {
1729  WindowImpl *pWindowImpl = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow->mpWindowImpl.get() : mpWindowImpl.get();
1730  return pWindowImpl->mbVexpand;
1731 }
1732 
1733 void Window::set_vexpand(bool bExpand)
1734 {
1735  WindowImpl *pWindowImpl = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow->mpWindowImpl.get() : mpWindowImpl.get();
1736  pWindowImpl->mbVexpand = bExpand;
1737 }
1738 
1739 bool Window::get_expand() const
1740 {
1741  WindowImpl *pWindowImpl = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow->mpWindowImpl.get() : mpWindowImpl.get();
1742  return pWindowImpl->mbExpand;
1743 }
1744 
1745 void Window::set_expand(bool bExpand)
1746 {
1747  WindowImpl *pWindowImpl = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow->mpWindowImpl.get() : mpWindowImpl.get();
1748  pWindowImpl->mbExpand = bExpand;
1749 }
1750 
1751 VclPackType Window::get_pack_type() const
1752 {
1753  WindowImpl *pWindowImpl = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow->mpWindowImpl.get() : mpWindowImpl.get();
1754  return pWindowImpl->mePackType;
1755 }
1756 
1757 void Window::set_pack_type(VclPackType ePackType)
1758 {
1759  WindowImpl *pWindowImpl = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow->mpWindowImpl.get() : mpWindowImpl.get();
1760  pWindowImpl->mePackType = ePackType;
1761 }
1762 
1763 sal_Int32 Window::get_padding() const
1764 {
1765  WindowImpl *pWindowImpl = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow->mpWindowImpl.get() : mpWindowImpl.get();
1766  return pWindowImpl->mnPadding;
1767 }
1768 
1769 void Window::set_padding(sal_Int32 nPadding)
1770 {
1771  WindowImpl *pWindowImpl = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow->mpWindowImpl.get() : mpWindowImpl.get();
1772  pWindowImpl->mnPadding = nPadding;
1773 }
1774 
1775 bool Window::get_fill() const
1776 {
1777  WindowImpl *pWindowImpl = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow->mpWindowImpl.get() : mpWindowImpl.get();
1778  return pWindowImpl->mbFill;
1779 }
1780 
1781 void Window::set_fill(bool bFill)
1782 {
1783  WindowImpl *pWindowImpl = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow->mpWindowImpl.get() : mpWindowImpl.get();
1784  pWindowImpl->mbFill = bFill;
1785 }
1786 
1787 sal_Int32 Window::get_grid_width() const
1788 {
1789  WindowImpl *pWindowImpl = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow->mpWindowImpl.get() : mpWindowImpl.get();
1790  return pWindowImpl->mnGridWidth;
1791 }
1792 
1793 void Window::set_grid_width(sal_Int32 nCols)
1794 {
1795  WindowImpl *pWindowImpl = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow->mpWindowImpl.get() : mpWindowImpl.get();
1796  pWindowImpl->mnGridWidth = nCols;
1797 }
1798 
1799 sal_Int32 Window::get_grid_left_attach() const
1800 {
1801  WindowImpl *pWindowImpl = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow->mpWindowImpl.get() : mpWindowImpl.get();
1802  return pWindowImpl->mnGridLeftAttach;
1803 }
1804 
1805 void Window::set_grid_left_attach(sal_Int32 nAttach)
1806 {
1807  WindowImpl *pWindowImpl = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow->mpWindowImpl.get() : mpWindowImpl.get();
1808  pWindowImpl->mnGridLeftAttach = nAttach;
1809 }
1810 
1811 sal_Int32 Window::get_grid_height() const
1812 {
1813  WindowImpl *pWindowImpl = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow->mpWindowImpl.get() : mpWindowImpl.get();
1814  return pWindowImpl->mnGridHeight;
1815 }
1816 
1817 void Window::set_grid_height(sal_Int32 nRows)
1818 {
1819  WindowImpl *pWindowImpl = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow->mpWindowImpl.get() : mpWindowImpl.get();
1820  pWindowImpl->mnGridHeight = nRows;
1821 }
1822 
1823 sal_Int32 Window::get_grid_top_attach() const
1824 {
1825  WindowImpl *pWindowImpl = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow->mpWindowImpl.get() : mpWindowImpl.get();
1826  return pWindowImpl->mnGridTopAttach;
1827 }
1828 
1829 void Window::set_grid_top_attach(sal_Int32 nAttach)
1830 {
1831  WindowImpl *pWindowImpl = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow->mpWindowImpl.get() : mpWindowImpl.get();
1832  pWindowImpl->mnGridTopAttach = nAttach;
1833 }
1834 
1835 void Window::set_border_width(sal_Int32 nBorderWidth)
1836 {
1837  WindowImpl *pWindowImpl = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow->mpWindowImpl.get() : mpWindowImpl.get();
1838  pWindowImpl->mnBorderWidth = nBorderWidth;
1839 }
1840 
1841 sal_Int32 Window::get_border_width() const
1842 {
1843  WindowImpl *pWindowImpl = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow->mpWindowImpl.get() : mpWindowImpl.get();
1844  return pWindowImpl->mnBorderWidth;
1845 }
1846 
1847 void Window::set_margin_start(sal_Int32 nWidth)
1848 {
1849  WindowImpl *pWindowImpl = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow->mpWindowImpl.get() : mpWindowImpl.get();
1850  if (pWindowImpl->mnMarginLeft != nWidth)
1851  {
1852  pWindowImpl->mnMarginLeft = nWidth;
1853  queue_resize();
1854  }
1855 }
1856 
1857 sal_Int32 Window::get_margin_start() const
1858 {
1859  WindowImpl *pWindowImpl = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow->mpWindowImpl.get() : mpWindowImpl.get();
1860  return pWindowImpl->mnMarginLeft;
1861 }
1862 
1863 void Window::set_margin_end(sal_Int32 nWidth)
1864 {
1865  WindowImpl *pWindowImpl = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow->mpWindowImpl.get() : mpWindowImpl.get();
1866  if (pWindowImpl->mnMarginRight != nWidth)
1867  {
1868  pWindowImpl->mnMarginRight = nWidth;
1869  queue_resize();
1870  }
1871 }
1872 
1873 sal_Int32 Window::get_margin_end() const
1874 {
1875  WindowImpl *pWindowImpl = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow->mpWindowImpl.get() : mpWindowImpl.get();
1876  return pWindowImpl->mnMarginRight;
1877 }
1878 
1879 void Window::set_margin_top(sal_Int32 nWidth)
1880 {
1881  WindowImpl *pWindowImpl = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow->mpWindowImpl.get() : mpWindowImpl.get();
1882  if (pWindowImpl->mnMarginTop != nWidth)
1883  {
1884  pWindowImpl->mnMarginTop = nWidth;
1885  queue_resize();
1886  }
1887 }
1888 
1889 sal_Int32 Window::get_margin_top() const
1890 {
1891  WindowImpl *pWindowImpl = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow->mpWindowImpl.get() : mpWindowImpl.get();
1892  return pWindowImpl->mnMarginTop;
1893 }
1894 
1895 void Window::set_margin_bottom(sal_Int32 nWidth)
1896 {
1897  WindowImpl *pWindowImpl = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow->mpWindowImpl.get() : mpWindowImpl.get();
1898  if (pWindowImpl->mnMarginBottom != nWidth)
1899  {
1900  pWindowImpl->mnMarginBottom = nWidth;
1901  queue_resize();
1902  }
1903 }
1904 
1905 sal_Int32 Window::get_margin_bottom() const
1906 {
1907  WindowImpl *pWindowImpl = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow->mpWindowImpl.get() : mpWindowImpl.get();
1908  return pWindowImpl->mnMarginBottom;
1909 }
1910 
1911 sal_Int32 Window::get_height_request() const
1912 {
1913  WindowImpl *pWindowImpl = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow->mpWindowImpl.get() : mpWindowImpl.get();
1914  return pWindowImpl->mnHeightRequest;
1915 }
1916 
1917 sal_Int32 Window::get_width_request() const
1918 {
1919  WindowImpl *pWindowImpl = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow->mpWindowImpl.get() : mpWindowImpl.get();
1920  return pWindowImpl->mnWidthRequest;
1921 }
1922 
1923 bool Window::get_secondary() const
1924 {
1925  WindowImpl *pWindowImpl = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow->mpWindowImpl.get() : mpWindowImpl.get();
1926  return pWindowImpl->mbSecondary;
1927 }
1928 
1929 void Window::set_secondary(bool bSecondary)
1930 {
1931  WindowImpl *pWindowImpl = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow->mpWindowImpl.get() : mpWindowImpl.get();
1932  pWindowImpl->mbSecondary = bSecondary;
1933 }
1934 
1935 bool Window::get_non_homogeneous() const
1936 {
1937  WindowImpl *pWindowImpl = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow->mpWindowImpl.get() : mpWindowImpl.get();
1938  return pWindowImpl->mbNonHomogeneous;
1939 }
1940 
1941 void Window::set_non_homogeneous(bool bNonHomogeneous)
1942 {
1943  WindowImpl *pWindowImpl = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow->mpWindowImpl.get() : mpWindowImpl.get();
1944  pWindowImpl->mbNonHomogeneous = bNonHomogeneous;
1945 }
1946 
1947 void Window::add_to_size_group(const std::shared_ptr<VclSizeGroup>& xGroup)
1948 {
1949  WindowImpl *pWindowImpl = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow->mpWindowImpl.get() : mpWindowImpl.get();
1950  //To-Do, multiple groups
1951  pWindowImpl->m_xSizeGroup = xGroup;
1952  pWindowImpl->m_xSizeGroup->insert(this);
1953  if (VclSizeGroupMode::NONE != pWindowImpl->m_xSizeGroup->get_mode())
1954  queue_resize();
1955 }
1956 
1957 void Window::remove_from_all_size_groups()
1958 {
1959  WindowImpl *pWindowImpl = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow->mpWindowImpl.get() : mpWindowImpl.get();
1960  //To-Do, multiple groups
1961  if (pWindowImpl->m_xSizeGroup)
1962  {
1963  if (VclSizeGroupMode::NONE != pWindowImpl->m_xSizeGroup->get_mode())
1964  queue_resize();
1965  pWindowImpl->m_xSizeGroup->erase(this);
1966  pWindowImpl->m_xSizeGroup.reset();
1967  }
1968 }
1969 
1970 void Window::add_mnemonic_label(FixedText *pLabel)
1971 {
1972  std::vector<VclPtr<FixedText> >& v = mpWindowImpl->m_aMnemonicLabels;
1973  if (std::find(v.begin(), v.end(), VclPtr<FixedText>(pLabel)) != v.end())
1974  return;
1975  v.emplace_back(pLabel);
1976  pLabel->set_mnemonic_widget(this);
1977 }
1978 
1979 void Window::remove_mnemonic_label(FixedText *pLabel)
1980 {
1981  std::vector<VclPtr<FixedText> >& v = mpWindowImpl->m_aMnemonicLabels;
1982  auto aFind = std::find(v.begin(), v.end(), VclPtr<FixedText>(pLabel));
1983  if (aFind == v.end())
1984  return;
1985  v.erase(aFind);
1986  pLabel->set_mnemonic_widget(nullptr);
1987 }
1988 
1989 const std::vector<VclPtr<FixedText> >& Window::list_mnemonic_labels() const
1990 {
1991  return mpWindowImpl->m_aMnemonicLabels;
1992 }
1993 
1994 } /* namespace vcl */
1995 
1996 void InvertFocusRect(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect)
1997 {
1998  const int nBorder = 1;
1999  rRenderContext.Invert(tools::Rectangle(Point(rRect.Left(), rRect.Top()), Size(rRect.GetWidth(), nBorder)), InvertFlags::N50);
2000  rRenderContext.Invert(tools::Rectangle(Point(rRect.Left(), rRect.Bottom()-nBorder+1), Size(rRect.GetWidth(), nBorder)), InvertFlags::N50);
2001  rRenderContext.Invert(tools::Rectangle(Point(rRect.Left(), rRect.Top()+nBorder), Size(nBorder, rRect.GetHeight()-(nBorder*2))), InvertFlags::N50);
2002  rRenderContext.Invert(tools::Rectangle(Point(rRect.Right()-nBorder+1, rRect.Top()+nBorder), Size(nBorder, rRect.GetHeight()-(nBorder*2))), InvertFlags::N50);
2003 }
2004 
2005 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
static bool toBool(std::string_view rValue)
Definition: builder.cxx:89
OutDevType GetOutDevType() const
Definition: outdev.hxx:395
bool IsInputEnabled() const
Definition: window2.cxx:1126
tools::Long GetOutOffYPixel() const
Definition: window3.cxx:124
void set_mnemonic_widget(vcl::Window *pWindow)
Definition: fixed.cxx:404
static bool HasParentDockingWindow(const vcl::Window *pWindow)
Definition: window2.cxx:1313
sal_Int32 mnPadding
Definition: window.h:302
void SetFontSize(const Size &)
Definition: font/font.cxx:125
bool mbHexpand
Definition: window.h:312
tools::Long GetRangeMax() const
Definition: scrbar.hxx:118
VclPtr< vcl::Window > mpFocusWin
Definition: svdata.hxx:248
void EndAutoScroll()
Definition: window2.cxx:332
sal_Int32 mnGridWidth
Definition: window.h:306
bool mbVexpand
Definition: window.h:312
VclPackType mePackType
Definition: window.h:301
void setWidth(tools::Long nWidth)
void ImplStop()
Definition: scrwnd.cxx:98
void Invert(tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight, SalInvert nFlags, const OutputDevice &rOutDev)
StartAutoScrollFlags
Definition: window.hxx:277
StartTrackingFlags
Definition: window.hxx:263
std::unique_ptr< ContentProperties > pData
bool IsTransparent() const
WindowExtendedStyle
Definition: window.hxx:425
sal_Int32 mnOptimalHeightCache
Definition: window.h:266
ImplSVAppData maAppData
Definition: svdata.hxx:391
long Long
constexpr::Color COL_TRANSPARENT(ColorTransparency, 0xFF, 0xFF, 0xFF, 0xFF)
void disposeAndClear()
Definition: vclptr.hxx:200
bool mbNonHomogeneous
Definition: window.h:312
WEIGHT_THIN
sal_Int64 n
static sal_Int32 GetScrollRepeat()
sal_Int32 mnHeightRequest
Definition: window.h:264
WinBits const WB_RIGHT
WEIGHT_BLACK
void SetWeight(FontWeight)
Definition: font/font.cxx:223
tools::Long GetDeltaY() const
WinBits const WB_AUTOVSCROLL
WEIGHT_SEMIBOLD
tools::Long GetLineSize() const
Definition: scrbar.hxx:124
WinBits const WB_VSCROLL
const CommandWheelData * GetWheelData() const
const CommandScrollData * GetAutoScrollData() const
WEIGHT_LIGHT
GestureEventType const meEventType
bool IsHorz() const
bool SelectClipRegion(const vcl::Region &, SalGraphics *pGraphics=nullptr)
std::shared_ptr< VclSizeGroup > m_xSizeGroup
Definition: window.h:278
tools::Long GetDeltaX() const
WEIGHT_BOLD
bool mbSecondary
Definition: window.h:312
StateChangedType
Definition: window.hxx:289
constexpr tools::Long Width() const
HashMap_OWString_Interface aMap
sal_Int64 WinBits
void SetBackground()
void Invert(const tools::Rectangle &rRect, InvertFlags nFlags=InvertFlags::NONE)
Definition: rect.cxx:149
WinBits const WB_BOTTOM
WinBits const WB_TOP
SAL_DLLPRIVATE void ReMirror(Point &rPoint) const
Definition: outdev.cxx:614
tools::Long Left() const
LINESTYLE_NONE
sal_Int32 mnMarginRight
Definition: window.h:309
WinBits const WB_HSCROLL
void EndTracking(TrackingEventFlags nFlags=TrackingEventFlags::NONE)
Definition: window2.cxx:272
tools::Long Bottom() const
VclSizeGroupMode
Definition: vclenum.hxx:263
sal_Int32 mnWidthRequest
Definition: window.h:263
virtual weld::Window * GetFrameWeld() const
constexpr tools::Long GetWidth() const
virtual void queue_resize(StateChangedType eReason=StateChangedType::Layout)
Definition: window2.cxx:1326
Mode eMode
void SetUnderline(FontLineStyle)
Definition: font/font.cxx:253
AutoTimer * mpTrackTimer
Definition: svdata.hxx:255
bool mbFill
Definition: window.h:312
bool IsDeltaPixel() const
GetFocusFlags
Definition: window.hxx:311
bool isContainerWindow(const vcl::Window &rWindow)
Definition: layout.hxx:835
void SetDebugName(const char *pDebugName)
Definition: task.hxx:82
VclPtr< ImplWheelWindow > mpWheelWindow
Definition: svdata.hxx:146
bool IsDockingWindow() const
Definition: window2.cxx:905
DialogControlFlags
Definition: window.hxx:344
double GetScrollLines() const
std::optional< tools::Rectangle > mpTrackRect
Definition: window.h:113
static void lcl_HandleScrollHelper(ScrollBar *pScrl, double nN, bool isMultiplyByLineSize)
Definition: window2.cxx:571
ImplSVData * ImplGetSVData()
Definition: svdata.cxx:75
An auto-timer is a multi-shot timer re-emitting itself at interval until destroyed or stopped...
Definition: timer.hxx:66
GraphicsSharedPtr mpGraphics
tools::Long GetPageSize() const
Definition: scrbar.hxx:126
StartAutoScrollFlags mnAutoScrollFlags
Definition: svdata.hxx:262
Size get_ungrouped_preferred_size() const
Definition: window2.cxx:1638
WEIGHT_SEMILIGHT
VclPackType
Definition: vclenum.hxx:222
bool IsEmpty() const
sal_Int32 mnOptimalWidthCache
Definition: window.h:265
tools::Long FRound(double fVal)
ITALIC_OBLIQUE
VclAlign meValign
Definition: window.h:300
virtual bool AcquireGraphics() const =0
Acquire a graphics device that the output device uses to draw on.
tools::Long GetNotchDelta() const
CommandWheelMode GetMode() const
WinBits const WB_VCENTER
WEIGHT_MEDIUM
sal_Int32 mnMarginTop
Definition: window.h:310
ShowTrackFlags
Definition: window.hxx:247
Some things multiple-inherit from VclAbstractDialog and OutputDevice, so we need to use virtual inher...
Definition: outdev.hxx:162
WEIGHT_NORMAL
CommandEventId GetCommand() const
virtual void Start(bool bStartTimer=true) override
Schedules the task for execution.
Definition: timer.cxx:83
ActivateModeFlags
Definition: window.hxx:158
LINESTYLE_SINGLE
WEIGHT_ULTRALIGHT
bool IsDialog() const
Definition: window2.cxx:1001
void SetTextColor(const Color &rColor)
Definition: text.cxx:662
double const mfOffset
std::unique_ptr< WindowImpl > mpWindowImpl
Definition: window.hxx:496
bool IsInModalMode() const
A window is in modal mode if one of its children or subchildren is a running modal window (a modal di...
Definition: window.cxx:3576
void AddWindow(const vcl::Window *pWin)
Definition: dockmgr.cxx:386
virtual void Resize()
Definition: window.cxx:1825
IMPL_LINK(Window, ImplTrackTimerHdl, Timer *, pTimer, void)
Definition: window2.cxx:220
void Merge(const Font &rFont)
Definition: font/font.cxx:306
const Size & GetFontSize() const
Definition: font/font.cxx:830
std::enable_if_t< std::is_floating_point_v< F > &&std::is_integral_v< I >, bool > convertsToAtMost(F value, I max)
const CommandGestureData * GetGestureData() const
TrackingEventFlags
Definition: vclenum.hxx:403
WEIGHT_ULTRABOLD
VclAlign meHalign
Definition: window.h:299
ITALIC_NONE
tools::Long Top() const
void SetTimeout(sal_uInt64 nTimeoutMs)
Definition: timer.cxx:90
#define COMMAND_WHEEL_PAGESCROLL
void GrabFocus()
Definition: window.cxx:2965
vcl::Window * GetParent() const
Definition: window2.cxx:1096
VclPtr< vcl::Window > mpTrackWin
Definition: svdata.hxx:254
WinBits const WB_LEFT
VclPtr< vcl::Window > mpBorderWindow
Definition: window.h:228
const long LONG_MAX
OUString convertMnemonicMarkup(const OUString &rIn)
Definition: builder.cxx:2223
tools::Long GetThumbPos() const
Definition: scrbar.hxx:122
bool mbExpand
Definition: window.h:312
const Point & GetMousePosPixel() const
SAL_WARN_UNUSED_RESULT Point LogicToPixel(const Point &rLogicPt) const
Definition: map.cxx:835
tools::Long const nBorder
WinBits const WB_SIZEABLE
float v
tools::Long DoScroll(tools::Long nNewPos)
Definition: scrbar.cxx:1303
A SalFrame is a system window (e.g. an X11 window).
Definition: salframe.hxx:112
sal_Int32 mnGridLeftAttach
Definition: window.h:304
void RemoveWindow(const vcl::Window *pWin)
Definition: dockmgr.cxx:394
sal_Int32 GetDenominator() const
DockingManager * ImplGetDockingManager()
Definition: svdata.cxx:300
WindowType
#define SAL_WARN_IF(condition, area, stream)
constexpr tools::Long Height() const
ITALIC_NORMAL
bool IsVisible() const
Definition: window2.cxx:1101
VclPtr< vcl::Window > mpAutoScrollWin
Definition: svdata.hxx:257
#define SAL_INFO(area, stream)
sal_Int32 mnMarginBottom
Definition: window.h:311
sal_Int32 mnBorderWidth
Definition: window.h:307
tools::Long AdjustWidth(tools::Long n)
static VclPtr< reference_type > Create(Arg &&...arg)
A construction helper for VclPtr.
Definition: vclptr.hxx:127
void SetPointFont(OutputDevice &rDevice, const vcl::Font &rFont)
Definition: weldutils.cxx:616
std::enable_if_t< std::is_floating_point_v< F > &&std::is_integral_v< I >, bool > convertsToAtLeast(F value, I min)
sal_Int32 GetNumerator() const
void SetInvokeHandler(const Link< Timer *, void > &rLink)
Definition: timer.hxx:56
std::optional< tools::Rectangle > mpFocusRect
Definition: window.h:111
WinBits const WB_AUTOHSCROLL
tools::Long AdjustHeight(tools::Long n)
ShowTrackFlags mnTrackFlags
Definition: window.h:114
PointerStyle
Definition: ptrstyle.hxx:25
WinBits const WB_TABSTOP
void SetFontHeight(tools::Long nHeight)
Definition: font/font.cxx:831
void SetItalic(FontItalic)
Definition: font/font.cxx:235
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:376
sal_Int16 getRoleFromName(const OString &roleName)
Definition: builder.cxx:2304
void setHeight(tools::Long nHeight)
sal_Int32 mnGridTopAttach
Definition: window.h:305
WindowType GetType() const
Definition: window2.cxx:973
tools::Long GetVisibleSize() const
Definition: scrbar.hxx:128
tools::Long GetDelta() const
VclAlign
Definition: vclenum.hxx:214
WinBits const WB_CENTER
reference_type * get() const
Get the body.
Definition: vclptr.hxx:143
bool IsEnabled() const
Definition: window2.cxx:1121
Definition: timer.hxx:26
void(* f)(TrueTypeTable *)
Definition: ttcr.cxx:482
StartTrackingFlags mnTrackFlags
Definition: svdata.hxx:261
tools::Long GetOutOffXPixel() const
Definition: window3.cxx:123
WinBits const WB_WORDBREAK
void InvertFocusRect(vcl::RenderContext &rRenderContext, const tools::Rectangle &rRect)
Definition: window2.cxx:1996
WinBits const WB_NOTABSTOP
bool isDisposed() const
tools::Long Right() const
sal_Int32 mnMarginLeft
Definition: window.h:308
vcl::Window * GetWindow() const
Definition: salframe.hxx:297
sal_Int32 mnGridHeight
Definition: window.h:303
static sal_Int32 GetButtonStartRepeat()
ImplSVWinData * mpWinData
Definition: svdata.hxx:394
constexpr tools::Long GetHeight() const