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("vcl::Window pSVData->mpWinData->mpTrackTimer");
257 
258  if ( nFlags & StartTrackingFlags::ScrollRepeat )
260  else
262  pSVData->mpWinData->mpTrackTimer->SetInvokeHandler( LINK( this, Window, ImplTrackTimerHdl ) );
263  pSVData->mpWinData->mpTrackTimer->Start();
264  }
265 
266  pSVData->mpWinData->mpTrackWin = this;
267  pSVData->mpWinData->mnTrackFlags = nFlags;
268  CaptureMouse();
269 }
270 
271 void Window::EndTracking( TrackingEventFlags nFlags )
272 {
273  ImplSVData* pSVData = ImplGetSVData();
274 
275  if ( pSVData->mpWinData->mpTrackWin.get() != this )
276  return;
277 
278  if ( pSVData->mpWinData->mpTrackTimer )
279  {
280  delete pSVData->mpWinData->mpTrackTimer;
281  pSVData->mpWinData->mpTrackTimer = nullptr;
282  }
283 
284  pSVData->mpWinData->mpTrackWin = nullptr;
286  ReleaseMouse();
287 
288  // call EndTracking if required
289  if (!mpWindowImpl || !mpWindowImpl->mpFrameData)
290  return;
291 
292  Point aMousePos( mpWindowImpl->mpFrameData->mnLastMouseX, mpWindowImpl->mpFrameData->mnLastMouseY );
293  if( GetOutDev()->ImplIsAntiparallel() )
294  {
295  // re-mirror frame pos at pChild
296  const OutputDevice *pOutDev = GetOutDev();
297  pOutDev->ReMirror( aMousePos );
298  }
299 
300  MouseEvent aMEvt( ImplFrameToOutput( aMousePos ),
301  mpWindowImpl->mpFrameData->mnClickCount, MouseEventModifiers::NONE,
302  mpWindowImpl->mpFrameData->mnMouseCode,
303  mpWindowImpl->mpFrameData->mnMouseCode );
304  TrackingEvent aTEvt( aMEvt, nFlags | TrackingEventFlags::End );
305  // CompatTracking effectively
306  if (!mpWindowImpl || mpWindowImpl->mbInDispose)
307  return Window::Tracking( aTEvt );
308  else
309  return Tracking( aTEvt );
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 = 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  nNewPos = o3tl::saturating_cast<tools::Long>(fVal);
592  }
593 
594  pScrl->DoScroll( nNewPos );
595 
596 }
597 
598 bool Window::HandleScrollCommand( const CommandEvent& rCmd,
599  ScrollBar* pHScrl, ScrollBar* pVScrl )
600 {
601  bool bRet = false;
602 
603  if ( pHScrl || pVScrl )
604  {
605  switch( rCmd.GetCommand() )
606  {
608  {
610  if ( pHScrl )
611  {
612  if ( (pHScrl->GetVisibleSize() < pHScrl->GetRangeMax()) &&
613  pHScrl->IsEnabled() && pHScrl->IsInputEnabled() && ! pHScrl->IsInModalMode() )
614  nFlags |= StartAutoScrollFlags::Horz;
615  }
616  if ( pVScrl )
617  {
618  if ( (pVScrl->GetVisibleSize() < pVScrl->GetRangeMax()) &&
619  pVScrl->IsEnabled() && pVScrl->IsInputEnabled() && ! pVScrl->IsInModalMode() )
620  nFlags |= StartAutoScrollFlags::Vert;
621  }
622 
623  if ( nFlags != StartAutoScrollFlags::NONE )
624  {
625  StartAutoScroll( nFlags );
626  bRet = true;
627  }
628  }
629  break;
630 
632  {
633  const CommandWheelData* pData = rCmd.GetWheelData();
634 
635  if ( pData && (CommandWheelMode::SCROLL == pData->GetMode()) )
636  {
637  if (!pData->IsDeltaPixel())
638  {
639  double nScrollLines = pData->GetScrollLines();
640  double nLines;
641  if ( nScrollLines == COMMAND_WHEEL_PAGESCROLL )
642  {
643  if ( pData->GetDelta() < 0 )
644  nLines = double(-LONG_MAX);
645  else
646  nLines = double(LONG_MAX);
647  }
648  else
649  nLines = pData->GetNotchDelta() * nScrollLines;
650  if ( nLines )
651  {
652  ImplHandleScroll( nullptr,
653  0L,
654  pData->IsHorz() ? pHScrl : pVScrl,
655  nLines );
656  bRet = true;
657  }
658  }
659  else
660  {
661  // Mobile / touch scrolling section
662  const Point & deltaPoint = rCmd.GetMousePosPixel();
663 
664  double deltaXInPixels = double(deltaPoint.X());
665  double deltaYInPixels = double(deltaPoint.Y());
666  Size winSize = GetOutputSizePixel();
667 
668  if(pHScrl)
669  {
670  double visSizeX = double(pHScrl->GetVisibleSize());
671  double ratioX = deltaXInPixels / double(winSize.getWidth());
672  tools::Long deltaXInLogic = tools::Long(visSizeX * ratioX);
673  // Touch need to work by pixels. Did not apply this to
674  // Android, as android code may require adaptations
675  // to work with this scrolling code
676 #ifndef IOS
677  tools::Long lineSizeX = pHScrl->GetLineSize();
678 
679  if(lineSizeX)
680  {
681  deltaXInLogic /= lineSizeX;
682  }
683  else
684  {
685  deltaXInLogic = 0;
686  }
687 #endif
688  if ( deltaXInLogic)
689  {
690 #ifndef IOS
691  bool const isMultiplyByLineSize = true;
692 #else
693  bool const isMultiplyByLineSize = false;
694 #endif
695  lcl_HandleScrollHelper( pHScrl, deltaXInLogic, isMultiplyByLineSize );
696  bRet = true;
697  }
698  }
699  if(pVScrl)
700  {
701  double visSizeY = double(pVScrl->GetVisibleSize());
702  double ratioY = deltaYInPixels / double(winSize.getHeight());
703  tools::Long deltaYInLogic = tools::Long(visSizeY * ratioY);
704 
705  // Touch need to work by pixels. Did not apply this to
706  // Android, as android code may require adaptations
707  // to work with this scrolling code
708 #ifndef IOS
709  tools::Long lineSizeY = pVScrl->GetLineSize();
710  if(lineSizeY)
711  {
712  deltaYInLogic /= lineSizeY;
713  }
714  else
715  {
716  deltaYInLogic = 0;
717  }
718 #endif
719  if ( deltaYInLogic )
720  {
721 #ifndef IOS
722  bool const isMultiplyByLineSize = true;
723 #else
724  bool const isMultiplyByLineSize = false;
725 #endif
726  lcl_HandleScrollHelper( pVScrl, deltaYInLogic, isMultiplyByLineSize );
727 
728  bRet = true;
729  }
730  }
731  }
732  }
733  }
734  break;
735 
737  {
738  if (pVScrl)
739  {
740  const CommandGestureData* pData = rCmd.GetGestureData();
742  {
743  mpWindowImpl->mpFrameData->mnTouchPanPosition = pVScrl->GetThumbPos();
744  }
746  {
747  tools::Long nOriginalPosition = mpWindowImpl->mpFrameData->mnTouchPanPosition;
748  pVScrl->DoScroll(nOriginalPosition + (pData->mfOffset / pVScrl->GetVisibleSize()));
749  }
751  {
752  mpWindowImpl->mpFrameData->mnTouchPanPosition = -1;
753  }
754  bRet = true;
755  }
756  break;
757  }
758 
760  {
761  const CommandScrollData* pData = rCmd.GetAutoScrollData();
762  if ( pData && (pData->GetDeltaX() || pData->GetDeltaY()) )
763  {
764  ImplHandleScroll( pHScrl, pData->GetDeltaX(),
765  pVScrl, pData->GetDeltaY() );
766  bRet = true;
767  }
768  }
769  break;
770 
771  default:
772  break;
773  }
774  }
775 
776  return bRet;
777 }
778 
779 // Note that when called for CommandEventId::Wheel above, despite its name,
780 // pVScrl isn't necessarily the vertical scroll bar. Depending on
781 // whether the scroll is horizontal or vertical, it is either the
782 // horizontal or vertical scroll bar. nY is correspondingly either
783 // the horizontal or vertical scroll amount.
784 
785 void Window::ImplHandleScroll( ScrollBar* pHScrl, double nX,
786  ScrollBar* pVScrl, double nY )
787 {
788  lcl_HandleScrollHelper( pHScrl, nX, true );
789  lcl_HandleScrollHelper( pVScrl, nY, true );
790 }
791 
792 DockingManager* Window::GetDockingManager()
793 {
794  return ImplGetDockingManager();
795 }
796 
797 void Window::EnableDocking( bool bEnable )
798 {
799  // update list of dockable windows
800  if( bEnable )
801  ImplGetDockingManager()->AddWindow( this );
802  else
804 }
805 
806 // retrieves the list of owner draw decorated windows for this window hierarchy
807 ::std::vector<VclPtr<vcl::Window> >& Window::ImplGetOwnerDrawList()
808 {
809  return ImplGetTopmostFrameWindow()->mpWindowImpl->mpFrameData->maOwnerDrawList;
810 }
811 
812 void Window::SetHelpId( const OString& rHelpId )
813 {
814  mpWindowImpl->maHelpId = rHelpId;
815 }
816 
817 const OString& Window::GetHelpId() const
818 {
819  return mpWindowImpl->maHelpId;
820 }
821 
822 // --------- old inline methods ---------------
823 
824 vcl::Window* Window::ImplGetWindow() const
825 {
826  if ( mpWindowImpl->mpClientWindow )
827  return mpWindowImpl->mpClientWindow;
828  else
829  return const_cast<vcl::Window*>(this);
830 }
831 
832 ImplFrameData* Window::ImplGetFrameData()
833 {
834  return mpWindowImpl ? mpWindowImpl->mpFrameData : nullptr;
835 }
836 
837 SalFrame* Window::ImplGetFrame() const
838 {
839  return mpWindowImpl ? mpWindowImpl->mpFrame : nullptr;
840 }
841 
842 weld::Window* Window::GetFrameWeld() const
843 {
844  SalFrame* pFrame = ImplGetFrame();
845  return pFrame ? pFrame->GetFrameWeld() : nullptr;
846 }
847 
848 vcl::Window* Window::GetFrameWindow() const
849 {
850  SalFrame* pFrame = ImplGetFrame();
851  return pFrame ? pFrame->GetWindow() : nullptr;
852 }
853 
854 vcl::Window* Window::ImplGetParent() const
855 {
856  return mpWindowImpl ? mpWindowImpl->mpParent.get() : nullptr;
857 }
858 
859 vcl::Window* Window::ImplGetClientWindow() const
860 {
861  return mpWindowImpl ? mpWindowImpl->mpClientWindow.get() : nullptr;
862 }
863 
864 vcl::Window* Window::ImplGetBorderWindow() const
865 {
866  return mpWindowImpl ? mpWindowImpl->mpBorderWindow.get() : nullptr;
867 }
868 
869 vcl::Window* Window::ImplGetFirstOverlapWindow()
870 {
871  if (!mpWindowImpl)
872  {
873  return nullptr;
874  }
875 
876  if ( mpWindowImpl->mbOverlapWin )
877  return this;
878  else
879  return mpWindowImpl->mpOverlapWindow;
880 }
881 
882 const vcl::Window* Window::ImplGetFirstOverlapWindow() const
883 {
884  if (!mpWindowImpl)
885  {
886  return nullptr;
887  }
888 
889  if ( mpWindowImpl->mbOverlapWin )
890  return this;
891  else
892  return mpWindowImpl->mpOverlapWindow;
893 }
894 
895 vcl::Window* Window::ImplGetFrameWindow() const
896 {
897  return mpWindowImpl ? mpWindowImpl->mpFrameWindow.get() : nullptr;
898 }
899 
900 bool Window::IsDockingWindow() const
901 {
902  return mpWindowImpl && mpWindowImpl->mbDockWin;
903 }
904 
905 bool Window::ImplIsFloatingWindow() const
906 {
907  return mpWindowImpl && mpWindowImpl->mbFloatWin;
908 }
909 
910 bool Window::ImplIsSplitter() const
911 {
912  return mpWindowImpl && mpWindowImpl->mbSplitter;
913 }
914 
915 bool Window::ImplIsPushButton() const
916 {
917  return mpWindowImpl && mpWindowImpl->mbPushButton;
918 }
919 
920 bool Window::ImplIsOverlapWindow() const
921 {
922  return mpWindowImpl && mpWindowImpl->mbOverlapWin;
923 }
924 
925 void Window::ImplSetMouseTransparent( bool bTransparent )
926 {
927  if (mpWindowImpl)
928  mpWindowImpl->mbMouseTransparent = bTransparent;
929 }
930 
931 Point Window::ImplOutputToFrame( const Point& rPos )
932 {
933  return Point( rPos.X()+GetOutDev()->mnOutOffX, rPos.Y()+GetOutDev()->mnOutOffY );
934 }
935 
936 Point Window::ImplFrameToOutput( const Point& rPos )
937 {
938  return Point( rPos.X()-GetOutDev()->mnOutOffX, rPos.Y()-GetOutDev()->mnOutOffY );
939 }
940 
941 void Window::SetCompoundControl( bool bCompound )
942 {
943  if (mpWindowImpl)
944  mpWindowImpl->mbCompoundControl = bCompound;
945 }
946 
947 WinBits Window::GetStyle() const
948 {
949  return mpWindowImpl ? mpWindowImpl->mnStyle : 0;
950 }
951 
952 WinBits Window::GetPrevStyle() const
953 {
954  return mpWindowImpl ? mpWindowImpl->mnPrevStyle : 0;
955 }
956 
957 WindowExtendedStyle Window::GetExtendedStyle() const
958 {
959  return mpWindowImpl ? mpWindowImpl->mnExtendedStyle : WindowExtendedStyle::NONE;
960 }
961 
962 void Window::SetType( WindowType nType )
963 {
964  if (mpWindowImpl)
965  mpWindowImpl->mnType = nType;
966 }
967 
968 WindowType Window::GetType() const
969 {
970  if (mpWindowImpl)
971  return mpWindowImpl->mnType;
972  else
973  return WindowType::NONE;
974 }
975 
976 Dialog* Window::GetParentDialog() const
977 {
978  const vcl::Window *pWindow = this;
979 
980  while( pWindow )
981  {
982  if( pWindow->IsDialog() )
983  break;
984 
985  pWindow = pWindow->GetParent();
986  }
987 
988  return const_cast<Dialog *>(dynamic_cast<const Dialog*>(pWindow));
989 }
990 
991 bool Window::IsSystemWindow() const
992 {
993  return mpWindowImpl && mpWindowImpl->mbSysWin;
994 }
995 
996 bool Window::IsDialog() const
997 {
998  return mpWindowImpl && mpWindowImpl->mbDialog;
999 }
1000 
1001 bool Window::IsMenuFloatingWindow() const
1002 {
1003  return mpWindowImpl && mpWindowImpl->mbMenuFloatingWindow;
1004 }
1005 
1006 bool Window::IsToolbarFloatingWindow() const
1007 {
1008  return mpWindowImpl && mpWindowImpl->mbToolbarFloatingWindow;
1009 }
1010 
1011 void Window::EnableAllResize()
1012 {
1013  mpWindowImpl->mbAllResize = true;
1014 }
1015 
1016 void Window::EnableChildTransparentMode( bool bEnable )
1017 {
1018  mpWindowImpl->mbChildTransparent = bEnable;
1019 }
1020 
1021 bool Window::IsChildTransparentModeEnabled() const
1022 {
1023  return mpWindowImpl && mpWindowImpl->mbChildTransparent;
1024 }
1025 
1026 bool Window::IsMouseTransparent() const
1027 {
1028  return mpWindowImpl && mpWindowImpl->mbMouseTransparent;
1029 }
1030 
1031 bool Window::IsPaintTransparent() const
1032 {
1033  return mpWindowImpl && mpWindowImpl->mbPaintTransparent;
1034 }
1035 
1036 void Window::SetDialogControlStart( bool bStart )
1037 {
1038  mpWindowImpl->mbDlgCtrlStart = bStart;
1039 }
1040 
1041 bool Window::IsDialogControlStart() const
1042 {
1043  return mpWindowImpl && mpWindowImpl->mbDlgCtrlStart;
1044 }
1045 
1046 void Window::SetDialogControlFlags( DialogControlFlags nFlags )
1047 {
1048  mpWindowImpl->mnDlgCtrlFlags = nFlags;
1049 }
1050 
1051 DialogControlFlags Window::GetDialogControlFlags() const
1052 {
1053  return mpWindowImpl->mnDlgCtrlFlags;
1054 }
1055 
1056 const InputContext& Window::GetInputContext() const
1057 {
1058  return mpWindowImpl->maInputContext;
1059 }
1060 
1061 bool Window::IsControlFont() const
1062 {
1063  return bool(mpWindowImpl->mpControlFont);
1064 }
1065 
1066 const Color& Window::GetControlForeground() const
1067 {
1068  return mpWindowImpl->maControlForeground;
1069 }
1070 
1071 bool Window::IsControlForeground() const
1072 {
1073  return mpWindowImpl->mbControlForeground;
1074 }
1075 
1076 const Color& Window::GetControlBackground() const
1077 {
1078  return mpWindowImpl->maControlBackground;
1079 }
1080 
1081 bool Window::IsControlBackground() const
1082 {
1083  return mpWindowImpl->mbControlBackground;
1084 }
1085 
1086 bool Window::IsInPaint() const
1087 {
1088  return mpWindowImpl && mpWindowImpl->mbInPaint;
1089 }
1090 
1091 vcl::Window* Window::GetParent() const
1092 {
1093  return mpWindowImpl ? mpWindowImpl->mpRealParent.get() : nullptr;
1094 }
1095 
1096 bool Window::IsVisible() const
1097 {
1098  return mpWindowImpl && mpWindowImpl->mbVisible;
1099 }
1100 
1101 bool Window::IsReallyVisible() const
1102 {
1103  return mpWindowImpl && mpWindowImpl->mbReallyVisible;
1104 }
1105 
1106 bool Window::IsReallyShown() const
1107 {
1108  return mpWindowImpl && mpWindowImpl->mbReallyShown;
1109 }
1110 
1111 bool Window::IsInInitShow() const
1112 {
1113  return mpWindowImpl->mbInInitShow;
1114 }
1115 
1116 bool Window::IsEnabled() const
1117 {
1118  return mpWindowImpl && !mpWindowImpl->mbDisabled;
1119 }
1120 
1121 bool Window::IsInputEnabled() const
1122 {
1123  return mpWindowImpl && !mpWindowImpl->mbInputDisabled;
1124 }
1125 
1126 bool Window::IsAlwaysEnableInput() const
1127 {
1128  return mpWindowImpl->meAlwaysInputMode == AlwaysInputEnabled;
1129 }
1130 
1131 ActivateModeFlags Window::GetActivateMode() const
1132 {
1133  return mpWindowImpl->mnActivateMode;
1134 
1135 }
1136 
1137 bool Window::IsAlwaysOnTopEnabled() const
1138 {
1139  return mpWindowImpl->mbAlwaysOnTop;
1140 }
1141 
1142 bool Window::IsDefaultPos() const
1143 {
1144  return mpWindowImpl->mbDefPos;
1145 }
1146 
1147 bool Window::IsDefaultSize() const
1148 {
1149  return mpWindowImpl->mbDefSize;
1150 }
1151 
1152 Point Window::GetOffsetPixelFrom(const vcl::Window& rWindow) const
1153 {
1154  return Point(GetOutOffXPixel() - rWindow.GetOutOffXPixel(), GetOutOffYPixel() - rWindow.GetOutOffYPixel());
1155 }
1156 
1157 void Window::EnablePaint( bool bEnable )
1158 {
1159  mpWindowImpl->mbPaintDisabled = !bEnable;
1160 }
1161 
1162 bool Window::IsPaintEnabled() const
1163 {
1164  return !mpWindowImpl->mbPaintDisabled;
1165 }
1166 
1167 bool Window::IsUpdateMode() const
1168 {
1169  return !mpWindowImpl->mbNoUpdate;
1170 }
1171 
1172 void Window::SetParentUpdateMode( bool bUpdate )
1173 {
1174  mpWindowImpl->mbNoParentUpdate = !bUpdate;
1175 }
1176 
1177 bool Window::IsActive() const
1178 {
1179  return mpWindowImpl->mbActive;
1180 }
1181 
1182 GetFocusFlags Window::GetGetFocusFlags() const
1183 {
1184  return mpWindowImpl->mnGetFocusFlags;
1185 }
1186 
1187 bool Window::IsCompoundControl() const
1188 {
1189  return mpWindowImpl && mpWindowImpl->mbCompoundControl;
1190 }
1191 
1192 bool Window::IsWait() const
1193 {
1194  return (mpWindowImpl->mnWaitCount != 0);
1195 }
1196 
1197 vcl::Cursor* Window::GetCursor() const
1198 {
1199  if (!mpWindowImpl)
1200  return nullptr;
1201  return mpWindowImpl->mpCursor;
1202 }
1203 
1204 const Fraction& Window::GetZoom() const
1205 {
1206  return mpWindowImpl->maZoom;
1207 }
1208 
1209 bool Window::IsZoom() const
1210 {
1211  return mpWindowImpl->maZoom.GetNumerator() != mpWindowImpl->maZoom.GetDenominator();
1212 }
1213 
1214 void Window::SetHelpText( const OUString& rHelpText )
1215 {
1216  mpWindowImpl->maHelpText = rHelpText;
1217  mpWindowImpl->mbHelpTextDynamic = true;
1218 }
1219 
1220 void Window::SetQuickHelpText( const OUString& rHelpText )
1221 {
1222  if (mpWindowImpl)
1223  mpWindowImpl->maQuickHelpText = rHelpText;
1224 }
1225 
1226 const OUString& Window::GetQuickHelpText() const
1227 {
1228  return mpWindowImpl->maQuickHelpText;
1229 }
1230 
1231 bool Window::IsCreatedWithToolkit() const
1232 {
1233  return mpWindowImpl->mbCreatedWithToolkit;
1234 }
1235 
1236 void Window::SetCreatedWithToolkit( bool b )
1237 {
1238  mpWindowImpl->mbCreatedWithToolkit = b;
1239 }
1240 
1241 PointerStyle Window::GetPointer() const
1242 {
1243  return mpWindowImpl->maPointer;
1244 }
1245 
1246 VCLXWindow* Window::GetWindowPeer() const
1247 {
1248  return mpWindowImpl ? mpWindowImpl->mpVCLXWindow : nullptr;
1249 }
1250 
1251 void Window::SetPosPixel( const Point& rNewPos )
1252 {
1253  setPosSizePixel( rNewPos.X(), rNewPos.Y(), 0, 0, PosSizeFlags::Pos );
1254 }
1255 
1256 void Window::SetSizePixel( const Size& rNewSize )
1257 {
1258  setPosSizePixel( 0, 0, rNewSize.Width(), rNewSize.Height(),
1260 }
1261 
1262 void Window::SetPosSizePixel( const Point& rNewPos, const Size& rNewSize )
1263 {
1264  setPosSizePixel( rNewPos.X(), rNewPos.Y(),
1265  rNewSize.Width(), rNewSize.Height());
1266 }
1267 
1268 void Window::SetOutputSizePixel( const Size& rNewSize )
1269 {
1270  SetSizePixel( Size( rNewSize.Width()+mpWindowImpl->mnLeftBorder+mpWindowImpl->mnRightBorder,
1271  rNewSize.Height()+mpWindowImpl->mnTopBorder+mpWindowImpl->mnBottomBorder ) );
1272 }
1273 
1274 //When a widget wants to renegotiate layout, get toplevel parent dialog and call
1275 //resize on it. Mark all intermediate containers (or container-alike) widgets
1276 //as dirty for the size remains unchanged, but layout changed circumstances
1277 namespace
1278 {
1279  bool queue_ungrouped_resize(vcl::Window const *pOrigWindow)
1280  {
1281  bool bSomeoneCares = false;
1282 
1283  vcl::Window *pWindow = pOrigWindow->GetParent();
1284  if (pWindow)
1285  {
1286  if (isContainerWindow(*pWindow))
1287  {
1288  bSomeoneCares = true;
1289  }
1290  else if (pWindow->GetType() == WindowType::TABCONTROL)
1291  {
1292  bSomeoneCares = true;
1293  }
1294  pWindow->queue_resize();
1295  }
1296 
1297  return bSomeoneCares;
1298  }
1299 }
1300 
1301 void Window::InvalidateSizeCache()
1302 {
1303  WindowImpl *pWindowImpl = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow->mpWindowImpl.get() : mpWindowImpl.get();
1304  pWindowImpl->mnOptimalWidthCache = -1;
1305  pWindowImpl->mnOptimalHeightCache = -1;
1306 }
1307 
1308 static bool HasParentDockingWindow(const vcl::Window* pWindow)
1309 {
1310  while( pWindow )
1311  {
1312  if( pWindow->IsDockingWindow() )
1313  return true;
1314 
1315  pWindow = pWindow->GetParent();
1316  }
1317 
1318  return false;
1319 }
1320 
1321 void Window::queue_resize(StateChangedType eReason)
1322 {
1323  if (isDisposed())
1324  return;
1325 
1326  bool bSomeoneCares = queue_ungrouped_resize(this);
1327 
1328  if (eReason != StateChangedType::Visible)
1329  {
1330  InvalidateSizeCache();
1331  }
1332 
1333  WindowImpl *pWindowImpl = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow->mpWindowImpl.get() : mpWindowImpl.get();
1334  if (pWindowImpl->m_xSizeGroup && pWindowImpl->m_xSizeGroup->get_mode() != VclSizeGroupMode::NONE)
1335  {
1336  std::set<VclPtr<vcl::Window> > &rWindows = pWindowImpl->m_xSizeGroup->get_widgets();
1337  for (VclPtr<vcl::Window> const & pOther : rWindows)
1338  {
1339  if (pOther == this)
1340  continue;
1341  queue_ungrouped_resize(pOther);
1342  }
1343  }
1344 
1345  if (bSomeoneCares && !isDisposed())
1346  {
1347  //fdo#57090 force a resync of the borders of the borderwindow onto this
1348  //window in case they have changed
1349  vcl::Window* pBorderWindow = ImplGetBorderWindow();
1350  if (pBorderWindow)
1351  pBorderWindow->Resize();
1352  }
1353  if (VclPtr<vcl::Window> pParent = GetParentWithLOKNotifier())
1354  {
1355  Size aSize = GetSizePixel();
1356  if (!aSize.IsEmpty() && !pParent->IsInInitShow()
1357  && (GetParentDialog() || HasParentDockingWindow(this)))
1358  LogicInvalidate(nullptr);
1359  }
1360 }
1361 
1362 namespace
1363 {
1364  VclAlign toAlign(std::u16string_view rValue)
1365  {
1366  VclAlign eRet = VclAlign::Fill;
1367 
1368  if (rValue == u"fill")
1369  eRet = VclAlign::Fill;
1370  else if (rValue == u"start")
1371  eRet = VclAlign::Start;
1372  else if (rValue == u"end")
1373  eRet = VclAlign::End;
1374  else if (rValue == u"center")
1375  eRet = VclAlign::Center;
1376  return eRet;
1377  }
1378 }
1379 
1380 bool Window::set_font_attribute(const OString &rKey, const OUString &rValue)
1381 {
1382  if (rKey == "weight")
1383  {
1384  vcl::Font aFont(GetControlFont());
1385  if (rValue == "thin")
1386  aFont.SetWeight(WEIGHT_THIN);
1387  else if (rValue == "ultralight")
1389  else if (rValue == "light")
1390  aFont.SetWeight(WEIGHT_LIGHT);
1391  else if (rValue == "book")
1392  aFont.SetWeight(WEIGHT_SEMILIGHT);
1393  else if (rValue == "normal")
1394  aFont.SetWeight(WEIGHT_NORMAL);
1395  else if (rValue == "medium")
1396  aFont.SetWeight(WEIGHT_MEDIUM);
1397  else if (rValue == "semibold")
1398  aFont.SetWeight(WEIGHT_SEMIBOLD);
1399  else if (rValue == "bold")
1400  aFont.SetWeight(WEIGHT_BOLD);
1401  else if (rValue == "ultrabold")
1402  aFont.SetWeight(WEIGHT_ULTRABOLD);
1403  else
1404  aFont.SetWeight(WEIGHT_BLACK);
1405  SetControlFont(aFont);
1406  }
1407  else if (rKey == "style")
1408  {
1409  vcl::Font aFont(GetControlFont());
1410  if (rValue == "normal")
1411  aFont.SetItalic(ITALIC_NONE);
1412  else if (rValue == "oblique")
1413  aFont.SetItalic(ITALIC_OBLIQUE);
1414  else if (rValue == "italic")
1415  aFont.SetItalic(ITALIC_NORMAL);
1416  SetControlFont(aFont);
1417  }
1418  else if (rKey == "underline")
1419  {
1420  vcl::Font aFont(GetControlFont());
1422  SetControlFont(aFont);
1423  }
1424  else if (rKey == "size")
1425  {
1426  vcl::Font aFont(GetControlFont());
1427  sal_Int32 nHeight = rValue.toInt32() / 1000;
1428  aFont.SetFontHeight(nHeight);
1429  SetControlFont(aFont);
1430  }
1431  else
1432  {
1433  SAL_INFO("vcl.layout", "unhandled font attribute: " << rKey);
1434  return false;
1435  }
1436  return true;
1437 }
1438 
1439 bool Window::set_property(const OString &rKey, const OUString &rValue)
1440 {
1441  if ((rKey == "label") || (rKey == "title") || (rKey == "text") )
1442  {
1443  SetText(BuilderUtils::convertMnemonicMarkup(rValue));
1444  }
1445  else if (rKey == "visible")
1446  Show(toBool(rValue));
1447  else if (rKey == "sensitive")
1448  Enable(toBool(rValue));
1449  else if (rKey == "resizable")
1450  {
1451  WinBits nBits = GetStyle();
1452  nBits &= ~WB_SIZEABLE;
1453  if (toBool(rValue))
1454  nBits |= WB_SIZEABLE;
1455  SetStyle(nBits);
1456  }
1457  else if (rKey == "xalign")
1458  {
1459  WinBits nBits = GetStyle();
1460  nBits &= ~(WB_LEFT | WB_CENTER | WB_RIGHT);
1461 
1462  float f = rValue.toFloat();
1463  assert(f == 0.0 || f == 1.0 || f == 0.5);
1464  if (f == 0.0)
1465  nBits |= WB_LEFT;
1466  else if (f == 1.0)
1467  nBits |= WB_RIGHT;
1468  else if (f == 0.5)
1469  nBits |= WB_CENTER;
1470 
1471  SetStyle(nBits);
1472  }
1473  else if (rKey == "justification")
1474  {
1475  WinBits nBits = GetStyle();
1476  nBits &= ~(WB_LEFT | WB_CENTER | WB_RIGHT);
1477 
1478  if (rValue == "left")
1479  nBits |= WB_LEFT;
1480  else if (rValue == "right")
1481  nBits |= WB_RIGHT;
1482  else if (rValue == "center")
1483  nBits |= WB_CENTER;
1484 
1485  SetStyle(nBits);
1486  }
1487  else if (rKey == "yalign")
1488  {
1489  WinBits nBits = GetStyle();
1490  nBits &= ~(WB_TOP | WB_VCENTER | WB_BOTTOM);
1491 
1492  float f = rValue.toFloat();
1493  assert(f == 0.0 || f == 1.0 || f == 0.5);
1494  if (f == 0.0)
1495  nBits |= WB_TOP;
1496  else if (f == 1.0)
1497  nBits |= WB_BOTTOM;
1498  else if (f == 0.5)
1499  nBits |= WB_VCENTER;
1500 
1501  SetStyle(nBits);
1502  }
1503  else if (rKey == "wrap")
1504  {
1505  WinBits nBits = GetStyle();
1506  nBits &= ~WB_WORDBREAK;
1507  if (toBool(rValue))
1508  nBits |= WB_WORDBREAK;
1509  SetStyle(nBits);
1510  }
1511  else if (rKey == "height-request")
1512  set_height_request(rValue.toInt32());
1513  else if (rKey == "width-request")
1514  set_width_request(rValue.toInt32());
1515  else if (rKey == "hexpand")
1516  set_hexpand(toBool(rValue));
1517  else if (rKey == "vexpand")
1518  set_vexpand(toBool(rValue));
1519  else if (rKey == "halign")
1520  set_halign(toAlign(rValue));
1521  else if (rKey == "valign")
1522  set_valign(toAlign(rValue));
1523  else if (rKey == "tooltip-markup")
1524  SetQuickHelpText(rValue);
1525  else if (rKey == "tooltip-text")
1526  SetQuickHelpText(rValue);
1527  else if (rKey == "border-width")
1528  set_border_width(rValue.toInt32());
1529  else if (rKey == "margin-start" || rKey == "margin-left")
1530  {
1531  assert(rKey == "margin-start" && "margin-left deprecated in favor of margin-start");
1532  set_margin_start(rValue.toInt32());
1533  }
1534  else if (rKey == "margin-end" || rKey == "margin-right")
1535  {
1536  assert(rKey == "margin-end" && "margin-right deprecated in favor of margin-end");
1537  set_margin_end(rValue.toInt32());
1538  }
1539  else if (rKey == "margin-top")
1540  set_margin_top(rValue.toInt32());
1541  else if (rKey == "margin-bottom")
1542  set_margin_bottom(rValue.toInt32());
1543  else if (rKey == "hscrollbar-policy")
1544  {
1545  WinBits nBits = GetStyle();
1546  nBits &= ~(WB_AUTOHSCROLL|WB_HSCROLL);
1547  if (rValue == "always")
1548  nBits |= WB_HSCROLL;
1549  else if (rValue == "automatic")
1550  nBits |= WB_AUTOHSCROLL;
1551  SetStyle(nBits);
1552  }
1553  else if (rKey == "vscrollbar-policy")
1554  {
1555  WinBits nBits = GetStyle();
1556  nBits &= ~(WB_AUTOVSCROLL|WB_VSCROLL);
1557  if (rValue == "always")
1558  nBits |= WB_VSCROLL;
1559  else if (rValue == "automatic")
1560  nBits |= WB_AUTOVSCROLL;
1561  SetStyle(nBits);
1562  }
1563  else if (rKey == "accessible-name")
1564  {
1565  SetAccessibleName(rValue);
1566  }
1567  else if (rKey == "accessible-description")
1568  {
1569  SetAccessibleDescription(rValue);
1570  }
1571  else if (rKey == "accessible-role")
1572  {
1573  sal_Int16 role = BuilderUtils::getRoleFromName(rValue.toUtf8());
1574  if (role != com::sun::star::accessibility::AccessibleRole::UNKNOWN)
1575  SetAccessibleRole(role);
1576  }
1577  else if (rKey == "use-markup")
1578  {
1579  //https://live.gnome.org/GnomeGoals/RemoveMarkupInMessages
1580  SAL_WARN_IF(toBool(rValue), "vcl.layout", "Use pango attributes instead of mark-up");
1581  }
1582  else if (rKey == "has-focus")
1583  {
1584  if (toBool(rValue))
1585  GrabFocus();
1586  }
1587  else if (rKey == "can-focus")
1588  {
1589  WinBits nBits = GetStyle();
1590  nBits &= ~(WB_TABSTOP|WB_NOTABSTOP);
1591  if (toBool(rValue))
1592  nBits |= WB_TABSTOP;
1593  else
1594  nBits |= WB_NOTABSTOP;
1595  SetStyle(nBits);
1596  }
1597  else
1598  {
1599  SAL_INFO("vcl.layout", "unhandled property: " << rKey);
1600  return false;
1601  }
1602  return true;
1603 }
1604 
1605 void Window::set_height_request(sal_Int32 nHeightRequest)
1606 {
1607  if (!mpWindowImpl)
1608  return;
1609 
1610  WindowImpl *pWindowImpl = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow->mpWindowImpl.get() : mpWindowImpl.get();
1611 
1612  if ( pWindowImpl->mnHeightRequest != nHeightRequest )
1613  {
1614  pWindowImpl->mnHeightRequest = nHeightRequest;
1615  queue_resize();
1616  }
1617 }
1618 
1619 void Window::set_width_request(sal_Int32 nWidthRequest)
1620 {
1621  if (!mpWindowImpl)
1622  return;
1623 
1624  WindowImpl *pWindowImpl = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow->mpWindowImpl.get() : mpWindowImpl.get();
1625 
1626  if ( pWindowImpl->mnWidthRequest != nWidthRequest )
1627  {
1628  pWindowImpl->mnWidthRequest = nWidthRequest;
1629  queue_resize();
1630  }
1631 }
1632 
1633 Size Window::get_ungrouped_preferred_size() const
1634 {
1635  Size aRet(get_width_request(), get_height_request());
1636  if (aRet.Width() == -1 || aRet.Height() == -1)
1637  {
1638  //cache gets blown away by queue_resize
1639  WindowImpl *pWindowImpl = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow->mpWindowImpl.get() : mpWindowImpl.get();
1640  if (pWindowImpl->mnOptimalWidthCache == -1 || pWindowImpl->mnOptimalHeightCache == -1)
1641  {
1642  Size aOptimal(GetOptimalSize());
1643  pWindowImpl->mnOptimalWidthCache = aOptimal.Width();
1644  pWindowImpl->mnOptimalHeightCache = aOptimal.Height();
1645  }
1646 
1647  if (aRet.Width() == -1)
1648  aRet.setWidth( pWindowImpl->mnOptimalWidthCache );
1649  if (aRet.Height() == -1)
1650  aRet.setHeight( pWindowImpl->mnOptimalHeightCache );
1651  }
1652  return aRet;
1653 }
1654 
1655 Size Window::get_preferred_size() const
1656 {
1657  Size aRet(get_ungrouped_preferred_size());
1658 
1659  WindowImpl *pWindowImpl = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow->mpWindowImpl.get() : mpWindowImpl.get();
1660  if (pWindowImpl->m_xSizeGroup)
1661  {
1662  const VclSizeGroupMode eMode = pWindowImpl->m_xSizeGroup->get_mode();
1663  if (eMode != VclSizeGroupMode::NONE)
1664  {
1665  const bool bIgnoreInHidden = pWindowImpl->m_xSizeGroup->get_ignore_hidden();
1666  const std::set<VclPtr<vcl::Window> > &rWindows = pWindowImpl->m_xSizeGroup->get_widgets();
1667  for (auto const& window : rWindows)
1668  {
1669  const vcl::Window *pOther = window;
1670  if (pOther == this)
1671  continue;
1672  if (bIgnoreInHidden && !pOther->IsVisible())
1673  continue;
1674  Size aOtherSize = pOther->get_ungrouped_preferred_size();
1675  if (eMode == VclSizeGroupMode::Both || eMode == VclSizeGroupMode::Horizontal)
1676  aRet.setWidth( std::max(aRet.Width(), aOtherSize.Width()) );
1677  if (eMode == VclSizeGroupMode::Both || eMode == VclSizeGroupMode::Vertical)
1678  aRet.setHeight( std::max(aRet.Height(), aOtherSize.Height()) );
1679  }
1680  }
1681  }
1682 
1683  return aRet;
1684 }
1685 
1686 VclAlign Window::get_halign() const
1687 {
1688  WindowImpl *pWindowImpl = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow->mpWindowImpl.get() : mpWindowImpl.get();
1689  return pWindowImpl->meHalign;
1690 }
1691 
1692 void Window::set_halign(VclAlign eAlign)
1693 {
1694  WindowImpl *pWindowImpl = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow->mpWindowImpl.get() : mpWindowImpl.get();
1695  pWindowImpl->meHalign = eAlign;
1696 }
1697 
1698 VclAlign Window::get_valign() const
1699 {
1700  WindowImpl *pWindowImpl = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow->mpWindowImpl.get() : mpWindowImpl.get();
1701  return pWindowImpl->meValign;
1702 }
1703 
1704 void Window::set_valign(VclAlign eAlign)
1705 {
1706  WindowImpl *pWindowImpl = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow->mpWindowImpl.get() : mpWindowImpl.get();
1707  pWindowImpl->meValign = eAlign;
1708 }
1709 
1710 bool Window::get_hexpand() const
1711 {
1712  WindowImpl *pWindowImpl = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow->mpWindowImpl.get() : mpWindowImpl.get();
1713  return pWindowImpl->mbHexpand;
1714 }
1715 
1716 void Window::set_hexpand(bool bExpand)
1717 {
1718  WindowImpl *pWindowImpl = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow->mpWindowImpl.get() : mpWindowImpl.get();
1719  pWindowImpl->mbHexpand = bExpand;
1720 }
1721 
1722 bool Window::get_vexpand() const
1723 {
1724  WindowImpl *pWindowImpl = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow->mpWindowImpl.get() : mpWindowImpl.get();
1725  return pWindowImpl->mbVexpand;
1726 }
1727 
1728 void Window::set_vexpand(bool bExpand)
1729 {
1730  WindowImpl *pWindowImpl = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow->mpWindowImpl.get() : mpWindowImpl.get();
1731  pWindowImpl->mbVexpand = bExpand;
1732 }
1733 
1734 bool Window::get_expand() const
1735 {
1736  WindowImpl *pWindowImpl = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow->mpWindowImpl.get() : mpWindowImpl.get();
1737  return pWindowImpl->mbExpand;
1738 }
1739 
1740 void Window::set_expand(bool bExpand)
1741 {
1742  WindowImpl *pWindowImpl = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow->mpWindowImpl.get() : mpWindowImpl.get();
1743  pWindowImpl->mbExpand = bExpand;
1744 }
1745 
1746 VclPackType Window::get_pack_type() const
1747 {
1748  WindowImpl *pWindowImpl = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow->mpWindowImpl.get() : mpWindowImpl.get();
1749  return pWindowImpl->mePackType;
1750 }
1751 
1752 void Window::set_pack_type(VclPackType ePackType)
1753 {
1754  WindowImpl *pWindowImpl = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow->mpWindowImpl.get() : mpWindowImpl.get();
1755  pWindowImpl->mePackType = ePackType;
1756 }
1757 
1758 sal_Int32 Window::get_padding() const
1759 {
1760  WindowImpl *pWindowImpl = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow->mpWindowImpl.get() : mpWindowImpl.get();
1761  return pWindowImpl->mnPadding;
1762 }
1763 
1764 void Window::set_padding(sal_Int32 nPadding)
1765 {
1766  WindowImpl *pWindowImpl = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow->mpWindowImpl.get() : mpWindowImpl.get();
1767  pWindowImpl->mnPadding = nPadding;
1768 }
1769 
1770 bool Window::get_fill() const
1771 {
1772  WindowImpl *pWindowImpl = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow->mpWindowImpl.get() : mpWindowImpl.get();
1773  return pWindowImpl->mbFill;
1774 }
1775 
1776 void Window::set_fill(bool bFill)
1777 {
1778  WindowImpl *pWindowImpl = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow->mpWindowImpl.get() : mpWindowImpl.get();
1779  pWindowImpl->mbFill = bFill;
1780 }
1781 
1782 sal_Int32 Window::get_grid_width() const
1783 {
1784  WindowImpl *pWindowImpl = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow->mpWindowImpl.get() : mpWindowImpl.get();
1785  return pWindowImpl->mnGridWidth;
1786 }
1787 
1788 void Window::set_grid_width(sal_Int32 nCols)
1789 {
1790  WindowImpl *pWindowImpl = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow->mpWindowImpl.get() : mpWindowImpl.get();
1791  pWindowImpl->mnGridWidth = nCols;
1792 }
1793 
1794 sal_Int32 Window::get_grid_left_attach() const
1795 {
1796  WindowImpl *pWindowImpl = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow->mpWindowImpl.get() : mpWindowImpl.get();
1797  return pWindowImpl->mnGridLeftAttach;
1798 }
1799 
1800 void Window::set_grid_left_attach(sal_Int32 nAttach)
1801 {
1802  WindowImpl *pWindowImpl = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow->mpWindowImpl.get() : mpWindowImpl.get();
1803  pWindowImpl->mnGridLeftAttach = nAttach;
1804 }
1805 
1806 sal_Int32 Window::get_grid_height() const
1807 {
1808  WindowImpl *pWindowImpl = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow->mpWindowImpl.get() : mpWindowImpl.get();
1809  return pWindowImpl->mnGridHeight;
1810 }
1811 
1812 void Window::set_grid_height(sal_Int32 nRows)
1813 {
1814  WindowImpl *pWindowImpl = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow->mpWindowImpl.get() : mpWindowImpl.get();
1815  pWindowImpl->mnGridHeight = nRows;
1816 }
1817 
1818 sal_Int32 Window::get_grid_top_attach() const
1819 {
1820  WindowImpl *pWindowImpl = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow->mpWindowImpl.get() : mpWindowImpl.get();
1821  return pWindowImpl->mnGridTopAttach;
1822 }
1823 
1824 void Window::set_grid_top_attach(sal_Int32 nAttach)
1825 {
1826  WindowImpl *pWindowImpl = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow->mpWindowImpl.get() : mpWindowImpl.get();
1827  pWindowImpl->mnGridTopAttach = nAttach;
1828 }
1829 
1830 void Window::set_border_width(sal_Int32 nBorderWidth)
1831 {
1832  WindowImpl *pWindowImpl = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow->mpWindowImpl.get() : mpWindowImpl.get();
1833  pWindowImpl->mnBorderWidth = nBorderWidth;
1834 }
1835 
1836 sal_Int32 Window::get_border_width() const
1837 {
1838  WindowImpl *pWindowImpl = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow->mpWindowImpl.get() : mpWindowImpl.get();
1839  return pWindowImpl->mnBorderWidth;
1840 }
1841 
1842 void Window::set_margin_start(sal_Int32 nWidth)
1843 {
1844  WindowImpl *pWindowImpl = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow->mpWindowImpl.get() : mpWindowImpl.get();
1845  if (pWindowImpl->mnMarginLeft != nWidth)
1846  {
1847  pWindowImpl->mnMarginLeft = nWidth;
1848  queue_resize();
1849  }
1850 }
1851 
1852 sal_Int32 Window::get_margin_start() const
1853 {
1854  WindowImpl *pWindowImpl = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow->mpWindowImpl.get() : mpWindowImpl.get();
1855  return pWindowImpl->mnMarginLeft;
1856 }
1857 
1858 void Window::set_margin_end(sal_Int32 nWidth)
1859 {
1860  WindowImpl *pWindowImpl = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow->mpWindowImpl.get() : mpWindowImpl.get();
1861  if (pWindowImpl->mnMarginRight != nWidth)
1862  {
1863  pWindowImpl->mnMarginRight = nWidth;
1864  queue_resize();
1865  }
1866 }
1867 
1868 sal_Int32 Window::get_margin_end() const
1869 {
1870  WindowImpl *pWindowImpl = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow->mpWindowImpl.get() : mpWindowImpl.get();
1871  return pWindowImpl->mnMarginRight;
1872 }
1873 
1874 void Window::set_margin_top(sal_Int32 nWidth)
1875 {
1876  WindowImpl *pWindowImpl = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow->mpWindowImpl.get() : mpWindowImpl.get();
1877  if (pWindowImpl->mnMarginTop != nWidth)
1878  {
1879  pWindowImpl->mnMarginTop = nWidth;
1880  queue_resize();
1881  }
1882 }
1883 
1884 sal_Int32 Window::get_margin_top() const
1885 {
1886  WindowImpl *pWindowImpl = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow->mpWindowImpl.get() : mpWindowImpl.get();
1887  return pWindowImpl->mnMarginTop;
1888 }
1889 
1890 void Window::set_margin_bottom(sal_Int32 nWidth)
1891 {
1892  WindowImpl *pWindowImpl = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow->mpWindowImpl.get() : mpWindowImpl.get();
1893  if (pWindowImpl->mnMarginBottom != nWidth)
1894  {
1895  pWindowImpl->mnMarginBottom = nWidth;
1896  queue_resize();
1897  }
1898 }
1899 
1900 sal_Int32 Window::get_margin_bottom() const
1901 {
1902  WindowImpl *pWindowImpl = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow->mpWindowImpl.get() : mpWindowImpl.get();
1903  return pWindowImpl->mnMarginBottom;
1904 }
1905 
1906 sal_Int32 Window::get_height_request() const
1907 {
1908  WindowImpl *pWindowImpl = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow->mpWindowImpl.get() : mpWindowImpl.get();
1909  return pWindowImpl->mnHeightRequest;
1910 }
1911 
1912 sal_Int32 Window::get_width_request() const
1913 {
1914  WindowImpl *pWindowImpl = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow->mpWindowImpl.get() : mpWindowImpl.get();
1915  return pWindowImpl->mnWidthRequest;
1916 }
1917 
1918 bool Window::get_secondary() const
1919 {
1920  WindowImpl *pWindowImpl = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow->mpWindowImpl.get() : mpWindowImpl.get();
1921  return pWindowImpl->mbSecondary;
1922 }
1923 
1924 void Window::set_secondary(bool bSecondary)
1925 {
1926  WindowImpl *pWindowImpl = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow->mpWindowImpl.get() : mpWindowImpl.get();
1927  pWindowImpl->mbSecondary = bSecondary;
1928 }
1929 
1930 bool Window::get_non_homogeneous() const
1931 {
1932  WindowImpl *pWindowImpl = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow->mpWindowImpl.get() : mpWindowImpl.get();
1933  return pWindowImpl->mbNonHomogeneous;
1934 }
1935 
1936 void Window::set_non_homogeneous(bool bNonHomogeneous)
1937 {
1938  WindowImpl *pWindowImpl = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow->mpWindowImpl.get() : mpWindowImpl.get();
1939  pWindowImpl->mbNonHomogeneous = bNonHomogeneous;
1940 }
1941 
1942 void Window::add_to_size_group(const std::shared_ptr<VclSizeGroup>& xGroup)
1943 {
1944  WindowImpl *pWindowImpl = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow->mpWindowImpl.get() : mpWindowImpl.get();
1945  //To-Do, multiple groups
1946  pWindowImpl->m_xSizeGroup = xGroup;
1947  pWindowImpl->m_xSizeGroup->insert(this);
1948  if (VclSizeGroupMode::NONE != pWindowImpl->m_xSizeGroup->get_mode())
1949  queue_resize();
1950 }
1951 
1952 void Window::remove_from_all_size_groups()
1953 {
1954  WindowImpl *pWindowImpl = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow->mpWindowImpl.get() : mpWindowImpl.get();
1955  //To-Do, multiple groups
1956  if (pWindowImpl->m_xSizeGroup)
1957  {
1958  if (VclSizeGroupMode::NONE != pWindowImpl->m_xSizeGroup->get_mode())
1959  queue_resize();
1960  pWindowImpl->m_xSizeGroup->erase(this);
1961  pWindowImpl->m_xSizeGroup.reset();
1962  }
1963 }
1964 
1965 void Window::add_mnemonic_label(FixedText *pLabel)
1966 {
1967  std::vector<VclPtr<FixedText> >& v = mpWindowImpl->m_aMnemonicLabels;
1968  if (std::find(v.begin(), v.end(), VclPtr<FixedText>(pLabel)) != v.end())
1969  return;
1970  v.emplace_back(pLabel);
1971  pLabel->set_mnemonic_widget(this);
1972 }
1973 
1974 void Window::remove_mnemonic_label(FixedText *pLabel)
1975 {
1976  std::vector<VclPtr<FixedText> >& v = mpWindowImpl->m_aMnemonicLabels;
1977  auto aFind = std::find(v.begin(), v.end(), VclPtr<FixedText>(pLabel));
1978  if (aFind == v.end())
1979  return;
1980  v.erase(aFind);
1981  pLabel->set_mnemonic_widget(nullptr);
1982 }
1983 
1984 const std::vector<VclPtr<FixedText> >& Window::list_mnemonic_labels() const
1985 {
1986  return mpWindowImpl->m_aMnemonicLabels;
1987 }
1988 
1989 } /* namespace vcl */
1990 
1991 void InvertFocusRect(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect)
1992 {
1993  const int nBorder = 1;
1994  rRenderContext.Invert(tools::Rectangle(Point(rRect.Left(), rRect.Top()), Size(rRect.GetWidth(), nBorder)), InvertFlags::N50);
1995  rRenderContext.Invert(tools::Rectangle(Point(rRect.Left(), rRect.Bottom()-nBorder+1), Size(rRect.GetWidth(), nBorder)), InvertFlags::N50);
1996  rRenderContext.Invert(tools::Rectangle(Point(rRect.Left(), rRect.Top()+nBorder), Size(nBorder, rRect.GetHeight()-(nBorder*2))), InvertFlags::N50);
1997  rRenderContext.Invert(tools::Rectangle(Point(rRect.Right()-nBorder+1, rRect.Top()+nBorder), Size(nBorder, rRect.GetHeight()-(nBorder*2))), InvertFlags::N50);
1998 }
1999 
2000 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
static bool toBool(std::string_view rValue)
Definition: builder.cxx:89
OutDevType GetOutDevType() const
Definition: outdev.hxx:402
bool IsInputEnabled() const
Definition: window2.cxx:1121
tools::Long GetOutOffYPixel() const
Definition: window3.cxx:124
void set_mnemonic_widget(vcl::Window *pWindow)
Definition: fixed.cxx:406
static bool HasParentDockingWindow(const vcl::Window *pWindow)
Definition: window2.cxx:1308
sal_Int32 mnPadding
Definition: window.h:301
void SetFontSize(const Size &)
Definition: font/font.cxx:127
bool mbHexpand
Definition: window.h:311
tools::Long GetRangeMax() const
Definition: scrbar.hxx:118
VclPtr< vcl::Window > mpFocusWin
Definition: svdata.hxx:253
void EndAutoScroll()
Definition: window2.cxx:332
sal_Int32 mnGridWidth
Definition: window.h:305
bool mbVexpand
Definition: window.h:311
VclPackType mePackType
Definition: window.h:300
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:412
constexpr tools::Long Left() const
sal_Int32 mnOptimalHeightCache
Definition: window.h:265
ImplSVAppData maAppData
Definition: svdata.hxx:396
long Long
constexpr::Color COL_TRANSPARENT(ColorTransparency, 0xFF, 0xFF, 0xFF, 0xFF)
void disposeAndClear()
Definition: vclptr.hxx:200
bool mbNonHomogeneous
Definition: window.h:311
WEIGHT_THIN
sal_Int64 n
static sal_Int32 GetScrollRepeat()
sal_Int32 mnHeightRequest
Definition: window.h:263
constexpr std::enable_if_t< std::is_floating_point_v< F > &&std::is_integral_v< I >, I > saturating_cast(F f)
WinBits const WB_RIGHT
WEIGHT_BLACK
void SetWeight(FontWeight)
Definition: font/font.cxx:225
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:277
tools::Long GetDeltaX() const
WEIGHT_BOLD
bool mbSecondary
Definition: window.h:311
StateChangedType
Definition: window.hxx:289
constexpr tools::Long Width() const
HashMap_OWString_Interface aMap
sal_Int64 WinBits
void SetBackground()
Definition: background.cxx:27
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:665
LINESTYLE_NONE
sal_Int32 mnMarginRight
Definition: window.h:308
WinBits const WB_HSCROLL
void EndTracking(TrackingEventFlags nFlags=TrackingEventFlags::NONE)
Definition: window2.cxx:271
VclSizeGroupMode
Definition: vclenum.hxx:261
sal_Int32 mnWidthRequest
Definition: window.h:262
virtual weld::Window * GetFrameWeld() const
constexpr tools::Long GetWidth() const
virtual void queue_resize(StateChangedType eReason=StateChangedType::Layout)
Definition: window2.cxx:1321
Mode eMode
void SetUnderline(FontLineStyle)
Definition: font/font.cxx:255
AutoTimer * mpTrackTimer
Definition: svdata.hxx:260
bool mbFill
Definition: window.h:311
bool IsDeltaPixel() const
GetFocusFlags
Definition: window.hxx:311
bool isContainerWindow(const vcl::Window &rWindow)
Definition: layout.hxx:815
VclPtr< ImplWheelWindow > mpWheelWindow
Definition: svdata.hxx:151
bool IsDockingWindow() const
Definition: window2.cxx:900
DialogControlFlags
Definition: window.hxx:331
double GetScrollLines() const
std::optional< tools::Rectangle > mpTrackRect
Definition: window.h:112
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:267
Size get_ungrouped_preferred_size() const
Definition: window2.cxx:1633
WEIGHT_SEMILIGHT
OUString convertMnemonicMarkup(std::u16string_view rIn)
Definition: builder.cxx:2225
VclPackType
Definition: vclenum.hxx:220
bool IsEmpty() const
sal_Int32 mnOptimalWidthCache
Definition: window.h:264
tools::Long FRound(double fVal)
ITALIC_OBLIQUE
VclAlign meValign
Definition: window.h:299
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:309
ShowTrackFlags
Definition: window.hxx:247
constexpr tools::Long Right() const
Some things multiple-inherit from VclAbstractDialog and OutputDevice, so we need to use virtual inher...
Definition: outdev.hxx:168
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:996
void SetTextColor(const Color &rColor)
Definition: text.cxx:688
double const mfOffset
std::unique_ptr< WindowImpl > mpWindowImpl
Definition: window.hxx:483
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:3590
void AddWindow(const vcl::Window *pWin)
Definition: dockmgr.cxx:386
virtual void Resize()
Definition: window.cxx:1835
IMPL_LINK(Window, ImplTrackTimerHdl, Timer *, pTimer, void)
Definition: window2.cxx:220
void Merge(const Font &rFont)
Definition: font/font.cxx:308
const Size & GetFontSize() const
Definition: font/font.cxx:832
constexpr tools::Long Top() const
const CommandGestureData * GetGestureData() const
TrackingEventFlags
Definition: vclenum.hxx:401
WEIGHT_ULTRABOLD
VclAlign meHalign
Definition: window.h:298
ITALIC_NONE
void SetTimeout(sal_uInt64 nTimeoutMs)
Definition: timer.cxx:90
#define COMMAND_WHEEL_PAGESCROLL
void GrabFocus()
Definition: window.cxx:2976
vcl::Window * GetParent() const
Definition: window2.cxx:1091
VclPtr< vcl::Window > mpTrackWin
Definition: svdata.hxx:259
WinBits const WB_LEFT
VclPtr< vcl::Window > mpBorderWindow
Definition: window.h:227
const long LONG_MAX
tools::Long GetThumbPos() const
Definition: scrbar.hxx:122
bool mbExpand
Definition: window.h:311
constexpr tools::Long Bottom() const
const Point & GetMousePosPixel() const
SAL_WARN_UNUSED_RESULT Point LogicToPixel(const Point &rLogicPt) const
Definition: map.cxx:878
tools::Long const nBorder
WinBits const WB_SIZEABLE
float v
tools::Long DoScroll(tools::Long nNewPos)
Definition: scrbar.cxx:1302
A SalFrame is a system window (e.g. an X11 window).
Definition: salframe.hxx:114
sal_Int32 mnGridLeftAttach
Definition: window.h:303
void RemoveWindow(const vcl::Window *pWin)
Definition: dockmgr.cxx:394
sal_Int32 GetDenominator() const
DockingManager * ImplGetDockingManager()
Definition: svdata.cxx:299
WindowType
#define SAL_WARN_IF(condition, area, stream)
constexpr tools::Long Height() const
ITALIC_NORMAL
bool IsVisible() const
Definition: window2.cxx:1096
VclPtr< vcl::Window > mpAutoScrollWin
Definition: svdata.hxx:262
#define SAL_INFO(area, stream)
sal_Int32 mnMarginBottom
Definition: window.h:310
sal_Int32 mnBorderWidth
Definition: window.h:306
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:618
sal_Int32 GetNumerator() const
void SetInvokeHandler(const Link< Timer *, void > &rLink)
Definition: timer.hxx:56
std::optional< tools::Rectangle > mpFocusRect
Definition: window.h:110
WinBits const WB_AUTOHSCROLL
tools::Long AdjustHeight(tools::Long n)
ShowTrackFlags mnTrackFlags
Definition: window.h:113
PointerStyle
Definition: ptrstyle.hxx:25
WinBits const WB_TABSTOP
void SetFontHeight(tools::Long nHeight)
Definition: font/font.cxx:833
void SetItalic(FontItalic)
Definition: font/font.cxx:237
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:386
sal_Int16 getRoleFromName(const OString &roleName)
Definition: builder.cxx:2306
void setHeight(tools::Long nHeight)
sal_Int32 mnGridTopAttach
Definition: window.h:304
WindowType GetType() const
Definition: window2.cxx:968
tools::Long GetVisibleSize() const
Definition: scrbar.hxx:128
tools::Long GetDelta() const
VclAlign
Definition: vclenum.hxx:212
WinBits const WB_CENTER
reference_type * get() const
Get the body.
Definition: vclptr.hxx:143
bool IsEnabled() const
Definition: window2.cxx:1116
Definition: timer.hxx:26
void(* f)(TrueTypeTable *)
Definition: ttcr.cxx:482
StartTrackingFlags mnTrackFlags
Definition: svdata.hxx:266
tools::Long GetOutOffXPixel() const
Definition: window3.cxx:123
WinBits const WB_WORDBREAK
void InvertFocusRect(vcl::RenderContext &rRenderContext, const tools::Rectangle &rRect)
Definition: window2.cxx:1991
WinBits const WB_NOTABSTOP
bool isDisposed() const
sal_Int32 mnMarginLeft
Definition: window.h:307
vcl::Window * GetWindow() const
Definition: salframe.hxx:299
sal_Int32 mnGridHeight
Definition: window.h:302
static sal_Int32 GetButtonStartRepeat()
ImplSVWinData * mpWinData
Definition: svdata.hxx:399
constexpr tools::Long GetHeight() const