LibreOffice Module vcl (master)  1
layout.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 
10 #include <com/sun/star/accessibility/AccessibleRole.hpp>
11 #include <o3tl/enumarray.hxx>
12 #include <o3tl/enumrange.hxx>
13 #include <vcl/decoview.hxx>
14 #include <vcl/dialog.hxx>
15 #include <vcl/layout.hxx>
16 #include <vcl/stdtext.hxx>
17 #include <vcl/svapp.hxx>
18 #include <vcl/settings.hxx>
19 #include <messagedialog.hxx>
20 #include <window.h>
21 #include <boost/multi_array.hpp>
22 #include <boost/property_tree/ptree.hpp>
23 #include <vcl/vclmedit.hxx>
24 #include <sal/log.hxx>
25 
28  , m_bLayoutDirty(true)
29 {
30  ImplInit(pParent, nStyle, nullptr);
32  SetPaintTransparent(true);
33  SetBackground();
34 }
35 
37 {
38  return css::accessibility::AccessibleRole::PANEL;
39 }
40 
42 {
43  return calculateRequisition();
44 }
45 
46 void VclContainer::setLayoutPosSize(vcl::Window &rWindow, const Point &rPos, const Size &rSize)
47 {
48  sal_Int32 nBorderWidth = rWindow.get_border_width();
49  sal_Int32 nLeft = rWindow.get_margin_left() + nBorderWidth;
50  sal_Int32 nTop = rWindow.get_margin_top() + nBorderWidth;
51  sal_Int32 nRight = rWindow.get_margin_right() + nBorderWidth;
52  sal_Int32 nBottom = rWindow.get_margin_bottom() + nBorderWidth;
53  Point aPos(rPos.X() + nLeft, rPos.Y() + nTop);
54  Size aSize(rSize.Width() - nLeft - nRight, rSize.Height() - nTop - nBottom);
55  rWindow.SetPosSizePixel(aPos, aSize);
56 }
57 
58 void VclContainer::setLayoutAllocation(vcl::Window &rChild, const Point &rAllocPos, const Size &rChildAlloc)
59 {
60  VclAlign eHalign = rChild.get_halign();
61  VclAlign eValign = rChild.get_valign();
62 
63  //typical case
64  if (eHalign == VclAlign::Fill && eValign == VclAlign::Fill)
65  {
66  setLayoutPosSize(rChild, rAllocPos, rChildAlloc);
67  return;
68  }
69 
70  Point aChildPos(rAllocPos);
71  Size aChildSize(rChildAlloc);
72  Size aChildPreferredSize(getLayoutRequisition(rChild));
73 
74  switch (eHalign)
75  {
76  case VclAlign::Fill:
77  break;
78  case VclAlign::Start:
79  if (aChildPreferredSize.Width() < rChildAlloc.Width())
80  aChildSize.setWidth( aChildPreferredSize.Width() );
81  break;
82  case VclAlign::End:
83  if (aChildPreferredSize.Width() < rChildAlloc.Width())
84  aChildSize.setWidth( aChildPreferredSize.Width() );
85  aChildPos.AdjustX(rChildAlloc.Width() );
86  aChildPos.AdjustX( -(aChildSize.Width()) );
87  break;
88  case VclAlign::Center:
89  if (aChildPreferredSize.Width() < aChildSize.Width())
90  aChildSize.setWidth( aChildPreferredSize.Width() );
91  aChildPos.AdjustX((rChildAlloc.Width() - aChildSize.Width()) / 2 );
92  break;
93  }
94 
95  switch (eValign)
96  {
97  case VclAlign::Fill:
98  break;
99  case VclAlign::Start:
100  if (aChildPreferredSize.Height() < rChildAlloc.Height())
101  aChildSize.setHeight( aChildPreferredSize.Height() );
102  break;
103  case VclAlign::End:
104  if (aChildPreferredSize.Height() < rChildAlloc.Height())
105  aChildSize.setHeight( aChildPreferredSize.Height() );
106  aChildPos.AdjustY(rChildAlloc.Height() );
107  aChildPos.AdjustY( -(aChildSize.Height()) );
108  break;
109  case VclAlign::Center:
110  if (aChildPreferredSize.Height() < aChildSize.Height())
111  aChildSize.setHeight( aChildPreferredSize.Height() );
112  aChildPos.AdjustY((rChildAlloc.Height() - aChildSize.Height()) / 2 );
113  break;
114  }
115 
116  setLayoutPosSize(rChild, aChildPos, aChildSize);
117 }
118 
119 namespace
120 {
121  Size subtractBorder(const vcl::Window &rWindow, const Size& rSize)
122  {
123  sal_Int32 nBorderWidth = rWindow.get_border_width();
124  sal_Int32 nLeft = rWindow.get_margin_left() + nBorderWidth;
125  sal_Int32 nTop = rWindow.get_margin_top() + nBorderWidth;
126  sal_Int32 nRight = rWindow.get_margin_right() + nBorderWidth;
127  sal_Int32 nBottom = rWindow.get_margin_bottom() + nBorderWidth;
128  Size aSize(rSize);
129  return Size(aSize.Width() + nLeft + nRight, aSize.Height() + nTop + nBottom);
130  }
131 }
132 
134 {
135  return subtractBorder(rWindow, rWindow.get_preferred_size());
136 }
137 
138 void VclContainer::SetPosSizePixel(const Point& rAllocPos, const Size& rAllocation)
139 {
140  bool bSizeChanged = rAllocation != GetOutputSizePixel();
141  Window::SetPosSizePixel(rAllocPos, rAllocation);
142  if (m_bLayoutDirty || bSizeChanged)
143  {
144  m_bLayoutDirty = false;
145  setAllocation(rAllocation);
146  }
147 }
148 
149 void VclContainer::SetPosPixel(const Point& rAllocPos)
150 {
151  Point aAllocPos = rAllocPos;
152  sal_Int32 nBorderWidth = get_border_width();
153  aAllocPos.AdjustX(nBorderWidth + get_margin_left() );
154  aAllocPos.AdjustY(nBorderWidth + get_margin_top() );
155 
156  if (aAllocPos != GetPosPixel())
157  Window::SetPosPixel(aAllocPos);
158 }
159 
160 void VclContainer::SetSizePixel(const Size& rAllocation)
161 {
162  Size aAllocation = rAllocation;
163  sal_Int32 nBorderWidth = get_border_width();
164  aAllocation.AdjustWidth( -(nBorderWidth*2 + get_margin_left() + get_margin_right()) );
165  aAllocation.AdjustHeight( -(nBorderWidth*2 + get_margin_top() + get_margin_bottom()) );
166  bool bSizeChanged = aAllocation != GetSizePixel();
167  if (bSizeChanged)
168  Window::SetSizePixel(aAllocation);
169  if (m_bLayoutDirty || bSizeChanged)
170  {
171  m_bLayoutDirty = false;
172  setAllocation(aAllocation);
173  }
174 }
175 
177 {
178  m_bLayoutDirty = true;
179  Window::queue_resize(eReason);
180 }
181 
182 // support for screenshot context menu
184 {
186  {
187  auto pParent = GetParent();
188  if (pParent)
189  {
190  CommandEvent aCEvt(rCEvt.GetMousePosPixel() + GetPosPixel(), rCEvt.GetCommand(), rCEvt.IsMouseEvent(), rCEvt.GetEventData());
191  pParent->Command(aCEvt);
192  return;
193  }
194  }
195 
196  // call parent (do not consume)
197  Window::Command(rCEvt);
198 }
199 
200 void VclBox::accumulateMaxes(const Size &rChildSize, Size &rSize) const
201 {
202  long nSecondaryChildDimension = getSecondaryDimension(rChildSize);
203  long nSecondaryBoxDimension = getSecondaryDimension(rSize);
204  setSecondaryDimension(rSize, std::max(nSecondaryChildDimension, nSecondaryBoxDimension));
205 
206  long nPrimaryChildDimension = getPrimaryDimension(rChildSize);
207  long nPrimaryBoxDimension = getPrimaryDimension(rSize);
208  if (m_bHomogeneous)
209  setPrimaryDimension(rSize, std::max(nPrimaryBoxDimension, nPrimaryChildDimension));
210  else
211  setPrimaryDimension(rSize, nPrimaryBoxDimension + nPrimaryChildDimension);
212 }
213 
215 {
216  sal_uInt16 nVisibleChildren = 0;
217 
218  Size aSize;
219  for (vcl::Window *pChild = GetWindow(GetWindowType::FirstChild); pChild; pChild = pChild->GetWindow(GetWindowType::Next))
220  {
221  if (!pChild->IsVisible())
222  continue;
223  ++nVisibleChildren;
224  Size aChildSize = getLayoutRequisition(*pChild);
225 
226  long nPrimaryDimension = getPrimaryDimension(aChildSize);
227  nPrimaryDimension += pChild->get_padding() * 2;
228  setPrimaryDimension(aChildSize, nPrimaryDimension);
229 
230  accumulateMaxes(aChildSize, aSize);
231  }
232 
233  return finalizeMaxes(aSize, nVisibleChildren);
234 }
235 
236 void VclBox::setAllocation(const Size &rAllocation)
237 {
238  sal_uInt16 nVisibleChildren = 0, nExpandChildren = 0;
239  for (vcl::Window *pChild = GetWindow(GetWindowType::FirstChild); pChild; pChild = pChild->GetWindow(GetWindowType::Next))
240  {
241  if (!pChild->IsVisible())
242  continue;
243  ++nVisibleChildren;
244  bool bExpand = getPrimaryDimensionChildExpand(*pChild);
245  if (bExpand)
246  ++nExpandChildren;
247  }
248 
249  if (!nVisibleChildren)
250  return;
251 
252  long nAllocPrimaryDimension = getPrimaryDimension(rAllocation);
253 
254  long nHomogeneousDimension = 0, nExtraSpace = 0;
255  if (m_bHomogeneous)
256  {
257  nHomogeneousDimension = (nAllocPrimaryDimension -
258  (nVisibleChildren - 1) * m_nSpacing) / nVisibleChildren;
259  }
260  else if (nExpandChildren)
261  {
262  Size aRequisition = calculateRequisition();
263  nExtraSpace = (getPrimaryDimension(rAllocation) - getPrimaryDimension(aRequisition)) / nExpandChildren;
264  }
265 
266  //Split into those we pack from the start onwards, and those we pack from the end backwards
268  for (vcl::Window *pChild = GetWindow(GetWindowType::FirstChild); pChild; pChild = pChild->GetWindow(GetWindowType::Next))
269  {
270  if (!pChild->IsVisible())
271  continue;
272 
273  VclPackType ePacking = pChild->get_pack_type();
274  aWindows[ePacking].push_back(pChild);
275  }
276 
277  //See VclBuilder::sortIntoBestTabTraversalOrder for why they are in visual
278  //order under the parent which requires us to reverse them here to
279  //pack from the end back
280  std::reverse(aWindows[VclPackType::End].begin(),aWindows[VclPackType::End].end());
281 
282  for (VclPackType ePackType : o3tl::enumrange<VclPackType>())
283  {
284  Point aPos(0, 0);
285  if (ePackType == VclPackType::End)
286  {
287  long nPrimaryCoordinate = getPrimaryCoordinate(aPos);
288  setPrimaryCoordinate(aPos, nPrimaryCoordinate + nAllocPrimaryDimension);
289  }
290 
291  for (auto const& window : aWindows[ePackType])
292  {
293  vcl::Window *pChild = window;
294 
295  long nPadding = pChild->get_padding();
296 
297  Size aBoxSize;
298  if (m_bHomogeneous)
299  setPrimaryDimension(aBoxSize, nHomogeneousDimension);
300  else
301  {
302  aBoxSize = getLayoutRequisition(*pChild);
303  long nPrimaryDimension = getPrimaryDimension(aBoxSize);
304  nPrimaryDimension += nPadding * 2;
305  if (getPrimaryDimensionChildExpand(*pChild))
306  nPrimaryDimension += nExtraSpace;
307  setPrimaryDimension(aBoxSize, nPrimaryDimension);
308  }
309  setSecondaryDimension(aBoxSize, getSecondaryDimension(rAllocation));
310 
311  Point aChildPos(aPos);
312  Size aChildSize(aBoxSize);
313  long nPrimaryCoordinate = getPrimaryCoordinate(aPos);
314 
315  bool bFill = pChild->get_fill();
316  if (bFill)
317  {
318  setPrimaryDimension(aChildSize, std::max(static_cast<long>(1),
319  getPrimaryDimension(aBoxSize) - nPadding * 2));
320 
321  setPrimaryCoordinate(aChildPos, nPrimaryCoordinate + nPadding);
322  }
323  else
324  {
325  setPrimaryDimension(aChildSize,
327 
328  setPrimaryCoordinate(aChildPos, nPrimaryCoordinate +
329  (getPrimaryDimension(aBoxSize) - getPrimaryDimension(aChildSize)) / 2);
330  }
331 
332  long nDiff = getPrimaryDimension(aBoxSize) + m_nSpacing;
333  if (ePackType == VclPackType::Start)
334  setPrimaryCoordinate(aPos, nPrimaryCoordinate + nDiff);
335  else
336  {
337  setPrimaryCoordinate(aPos, nPrimaryCoordinate - nDiff);
338  setPrimaryCoordinate(aChildPos, getPrimaryCoordinate(aChildPos) -
339  getPrimaryDimension(aBoxSize));
340  }
341 
342  setLayoutAllocation(*pChild, aChildPos, aChildSize);
343  }
344  }
345 }
346 
347 bool VclBox::set_property(const OString &rKey, const OUString &rValue)
348 {
349  if (rKey == "spacing")
350  set_spacing(rValue.toInt32());
351  else if (rKey == "homogeneous")
352  set_homogeneous(toBool(rValue));
353  else
354  return VclContainer::set_property(rKey, rValue);
355  return true;
356 }
357 
358 boost::property_tree::ptree VclBox::DumpAsPropertyTree()
359 {
360  boost::property_tree::ptree aTree(VclContainer::DumpAsPropertyTree());
361  aTree.put("vertical", m_bVerticalContainer);
362  return aTree;
363 }
364 
366 {
367 #if defined(_WIN32)
368  //fdo#74284 call Boxes Panels, keep then as "Filler" under
369  //at least Linux seeing as that's what Gtk does for GtkBoxes
370  return css::accessibility::AccessibleRole::PANEL;
371 #else
372  return css::accessibility::AccessibleRole::FILLER;
373 #endif
374 }
375 
376 #define DEFAULT_CHILD_MIN_WIDTH 85
377 #define DEFAULT_CHILD_MIN_HEIGHT 27
378 
379 Size VclBox::finalizeMaxes(const Size &rSize, sal_uInt16 nVisibleChildren) const
380 {
381  Size aRet;
382 
383  if (nVisibleChildren)
384  {
385  long nPrimaryDimension = getPrimaryDimension(rSize);
386  if (m_bHomogeneous)
387  nPrimaryDimension *= nVisibleChildren;
388  setPrimaryDimension(aRet, nPrimaryDimension + m_nSpacing * (nVisibleChildren-1));
390  }
391 
392  return aRet;
393 }
394 
396 {
397  Size aRet;
398 
399  long nMainGroupDimension = getPrimaryDimension(rReq.m_aMainGroupSize);
400  long nSubGroupDimension = getPrimaryDimension(rReq.m_aSubGroupSize);
401 
402  setPrimaryDimension(aRet, nMainGroupDimension + nSubGroupDimension);
403 
407 
408  return aRet;
409 }
410 
411 static long getMaxNonOutlier(const std::vector<long> &rG, long nAvgDimension)
412 {
413  long nMaxDimensionNonOutlier = 0;
414  for (auto const& nPrimaryChildDimension : rG)
415  {
416  if (nPrimaryChildDimension < nAvgDimension * 1.5)
417  {
418  nMaxDimensionNonOutlier = std::max(nPrimaryChildDimension,
419  nMaxDimensionNonOutlier);
420  }
421  }
422  return nMaxDimensionNonOutlier;
423 }
424 
425 static std::vector<long> setButtonSizes(const std::vector<long> &rG,
426  const std::vector<bool> &rNonHomogeneous,
427  long nAvgDimension, long nMaxNonOutlier, long nMinWidth)
428 {
429  std::vector<long> aVec;
430  //set everything < 1.5 times the average to the same width, leave the
431  //outliers un-touched
432  std::vector<bool>::const_iterator aJ = rNonHomogeneous.begin();
433  auto nNonOutlierWidth = std::max(nMaxNonOutlier, nMinWidth);
434  for (auto const& nPrimaryChildDimension : rG)
435  {
436  bool bNonHomogeneous = *aJ;
437  if (!bNonHomogeneous && nPrimaryChildDimension < nAvgDimension * 1.5)
438  {
439  aVec.push_back(nNonOutlierWidth);
440  }
441  else
442  {
443  aVec.push_back(std::max(nPrimaryChildDimension, nMinWidth));
444  }
445  ++aJ;
446  }
447  return aVec;
448 }
449 
451 {
452  Requisition aReq;
453 
454  Size aMainGroupSize(DEFAULT_CHILD_MIN_WIDTH, DEFAULT_CHILD_MIN_HEIGHT); //to-do, pull from theme
455  Size aSubGroupSize(DEFAULT_CHILD_MIN_WIDTH, DEFAULT_CHILD_MIN_HEIGHT); //to-do, pull from theme
456 
457  long nMinMainGroupPrimary = getPrimaryDimension(aMainGroupSize);
458  long nMinSubGroupPrimary = getPrimaryDimension(aSubGroupSize);
459  long nMainGroupSecondary = getSecondaryDimension(aMainGroupSize);
460  long nSubGroupSecondary = getSecondaryDimension(aSubGroupSize);
461 
462  bool bIgnoreSecondaryPacking = (m_eLayoutStyle == VclButtonBoxStyle::Spread || m_eLayoutStyle == VclButtonBoxStyle::Center);
463 
464  std::vector<long> aMainGroupSizes;
465  std::vector<bool> aMainGroupNonHomogeneous;
466  std::vector<long> aSubGroupSizes;
467  std::vector<bool> aSubGroupNonHomogeneous;
468 
469  for (const vcl::Window *pChild = GetWindow(GetWindowType::FirstChild); pChild; pChild = pChild->GetWindow(GetWindowType::Next))
470  {
471  if (!pChild->IsVisible())
472  continue;
473  Size aChildSize = getLayoutRequisition(*pChild);
474  if (bIgnoreSecondaryPacking || !pChild->get_secondary())
475  {
476  //set the max secondary dimension
477  nMainGroupSecondary = std::max(nMainGroupSecondary, getSecondaryDimension(aChildSize));
478  //collect the primary dimensions
479  aMainGroupSizes.push_back(getPrimaryDimension(aChildSize));
480  aMainGroupNonHomogeneous.push_back(pChild->get_non_homogeneous());
481  }
482  else
483  {
484  nSubGroupSecondary = std::max(nSubGroupSecondary, getSecondaryDimension(aChildSize));
485  aSubGroupSizes.push_back(getPrimaryDimension(aChildSize));
486  aSubGroupNonHomogeneous.push_back(pChild->get_non_homogeneous());
487  }
488  }
489 
490  if (m_bHomogeneous)
491  {
492  long nMaxMainDimension = aMainGroupSizes.empty() ? 0 :
493  *std::max_element(aMainGroupSizes.begin(), aMainGroupSizes.end());
494  nMaxMainDimension = std::max(nMaxMainDimension, nMinMainGroupPrimary);
495  long nMaxSubDimension = aSubGroupSizes.empty() ? 0 :
496  *std::max_element(aSubGroupSizes.begin(), aSubGroupSizes.end());
497  nMaxSubDimension = std::max(nMaxSubDimension, nMinSubGroupPrimary);
498  long nMaxDimension = std::max(nMaxMainDimension, nMaxSubDimension);
499  aReq.m_aMainGroupDimensions.resize(aMainGroupSizes.size(), nMaxDimension);
500  aReq.m_aSubGroupDimensions.resize(aSubGroupSizes.size(), nMaxDimension);
501  }
502  else
503  {
504  //Ideally set everything to the same size, but find outlier widgets
505  //that are way wider than the average and leave them
506  //at their natural size and set the remainder to share the
507  //max size of the remaining members of the buttonbox
508  long nAccDimension = std::accumulate(aMainGroupSizes.begin(),
509  aMainGroupSizes.end(), 0);
510  nAccDimension = std::accumulate(aSubGroupSizes.begin(),
511  aSubGroupSizes.end(), nAccDimension);
512 
513  size_t nTotalSize = aMainGroupSizes.size() + aSubGroupSizes.size();
514 
515  long nAvgDimension = nTotalSize ? nAccDimension / nTotalSize : 0;
516 
517  long nMaxMainNonOutlier = getMaxNonOutlier(aMainGroupSizes,
518  nAvgDimension);
519  long nMaxSubNonOutlier = getMaxNonOutlier(aSubGroupSizes,
520  nAvgDimension);
521  long nMaxNonOutlier = std::max(nMaxMainNonOutlier, nMaxSubNonOutlier);
522 
523  aReq.m_aMainGroupDimensions = setButtonSizes(aMainGroupSizes,
524  aMainGroupNonHomogeneous,
525  nAvgDimension, nMaxNonOutlier, nMinMainGroupPrimary);
526  aReq.m_aSubGroupDimensions = setButtonSizes(aSubGroupSizes,
527  aSubGroupNonHomogeneous,
528  nAvgDimension, nMaxNonOutlier, nMinSubGroupPrimary);
529  }
530 
531  if (!aReq.m_aMainGroupDimensions.empty())
532  {
533  setSecondaryDimension(aReq.m_aMainGroupSize, nMainGroupSecondary);
535  std::accumulate(aReq.m_aMainGroupDimensions.begin(),
536  aReq.m_aMainGroupDimensions.end(), 0));
537  }
538  if (!aReq.m_aSubGroupDimensions.empty())
539  {
540  setSecondaryDimension(aReq.m_aSubGroupSize, nSubGroupSecondary);
542  std::accumulate(aReq.m_aSubGroupDimensions.begin(),
543  aReq.m_aSubGroupDimensions.end(), 0));
544  }
545 
546  return aReq;
547 }
548 
549 Size VclButtonBox::addSpacing(const Size &rSize, sal_uInt16 nVisibleChildren) const
550 {
551  Size aRet;
552 
553  if (nVisibleChildren)
554  {
555  long nPrimaryDimension = getPrimaryDimension(rSize);
556  setPrimaryDimension(aRet,
557  nPrimaryDimension + m_nSpacing * (nVisibleChildren-1));
559  }
560 
561  return aRet;
562 }
563 
565 {
567  sal_uInt16 nVisibleChildren = aReq.m_aMainGroupDimensions.size() +
568  aReq.m_aSubGroupDimensions.size();
569  return addSpacing(addReqGroups(aReq), nVisibleChildren);
570 }
571 
572 bool VclButtonBox::set_property(const OString &rKey, const OUString &rValue)
573 {
574  if (rKey == "layout-style")
575  {
577  if (rValue == "spread")
578  eStyle = VclButtonBoxStyle::Spread;
579  else if (rValue == "edge")
580  eStyle = VclButtonBoxStyle::Edge;
581  else if (rValue == "start")
582  eStyle = VclButtonBoxStyle::Start;
583  else if (rValue == "end")
584  eStyle = VclButtonBoxStyle::End;
585  else if (rValue == "center")
586  eStyle = VclButtonBoxStyle::Center;
587  else
588  {
589  SAL_WARN("vcl.layout", "unknown layout style " << rValue);
590  }
591  m_eLayoutStyle = eStyle;
592  }
593  else
594  return VclBox::set_property(rKey, rValue);
595  return true;
596 }
597 
598 void VclButtonBox::setAllocation(const Size &rAllocation)
599 {
601 
602  if (aReq.m_aMainGroupDimensions.empty() && aReq.m_aSubGroupDimensions.empty())
603  return;
604 
605  long nAllocPrimaryDimension = getPrimaryDimension(rAllocation);
606 
607  Point aMainGroupPos, aOtherGroupPos;
608  int nSpacing = m_nSpacing;
609 
610  //To-Do, other layout styles
611  switch (m_eLayoutStyle)
612  {
614  if (!aReq.m_aSubGroupDimensions.empty())
615  {
616  long nOtherPrimaryDimension = getPrimaryDimension(
618  setPrimaryCoordinate(aOtherGroupPos,
619  nAllocPrimaryDimension - nOtherPrimaryDimension);
620  }
621  break;
623  if (!aReq.m_aMainGroupDimensions.empty())
624  {
625  long nMainPrimaryDimension = getPrimaryDimension(
627  long nExtraSpace = nAllocPrimaryDimension - nMainPrimaryDimension;
628  nExtraSpace += (aReq.m_aMainGroupDimensions.size()-1) * nSpacing;
629  nSpacing = nExtraSpace/(aReq.m_aMainGroupDimensions.size()+1);
630  setPrimaryCoordinate(aMainGroupPos, nSpacing);
631  }
632  break;
634  if (!aReq.m_aMainGroupDimensions.empty())
635  {
636  long nMainPrimaryDimension = getPrimaryDimension(
638  long nExtraSpace = nAllocPrimaryDimension - nMainPrimaryDimension;
639  setPrimaryCoordinate(aMainGroupPos, nExtraSpace/2);
640  }
641  break;
642  default:
643  SAL_WARN("vcl.layout", "todo unimplemented layout style");
644  [[fallthrough]];
647  if (!aReq.m_aMainGroupDimensions.empty())
648  {
649  long nMainPrimaryDimension = getPrimaryDimension(
651  setPrimaryCoordinate(aMainGroupPos,
652  nAllocPrimaryDimension - nMainPrimaryDimension);
653  }
654  break;
655  }
656 
657  Size aChildSize;
658  setSecondaryDimension(aChildSize, getSecondaryDimension(rAllocation));
659 
660  std::vector<long>::const_iterator aPrimaryI = aReq.m_aMainGroupDimensions.begin();
661  std::vector<long>::const_iterator aSecondaryI = aReq.m_aSubGroupDimensions.begin();
662  bool bIgnoreSecondaryPacking = (m_eLayoutStyle == VclButtonBoxStyle::Spread || m_eLayoutStyle == VclButtonBoxStyle::Center);
663  for (vcl::Window *pChild = GetWindow(GetWindowType::FirstChild); pChild; pChild = pChild->GetWindow(GetWindowType::Next))
664  {
665  if (!pChild->IsVisible())
666  continue;
667 
668  if (bIgnoreSecondaryPacking || !pChild->get_secondary())
669  {
670  long nMainGroupPrimaryDimension = *aPrimaryI++;
671  setPrimaryDimension(aChildSize, nMainGroupPrimaryDimension);
672  setLayoutAllocation(*pChild, aMainGroupPos, aChildSize);
673  long nPrimaryCoordinate = getPrimaryCoordinate(aMainGroupPos);
674  setPrimaryCoordinate(aMainGroupPos, nPrimaryCoordinate + nMainGroupPrimaryDimension + nSpacing);
675  }
676  else
677  {
678  long nSubGroupPrimaryDimension = *aSecondaryI++;
679  setPrimaryDimension(aChildSize, nSubGroupPrimaryDimension);
680  setLayoutAllocation(*pChild, aOtherGroupPos, aChildSize);
681  long nPrimaryCoordinate = getPrimaryCoordinate(aOtherGroupPos);
682  setPrimaryCoordinate(aOtherGroupPos, nPrimaryCoordinate + nSubGroupPrimaryDimension + nSpacing);
683  }
684  }
685 }
686 
687 namespace {
688 
689 struct ButtonOrder
690 {
691  const char* m_aType;
692  int const m_nPriority;
693 };
694 
695 }
696 
697 static int getButtonPriority(const OString &rType)
698 {
699  static const size_t N_TYPES = 6;
700  static const ButtonOrder aDiscardCancelSave[N_TYPES] =
701  {
702  { "/discard", 0 },
703  { "/cancel", 1 },
704  { "/no", 2 },
705  { "/save", 3 },
706  { "/yes", 3 },
707  { "/ok", 3 }
708  };
709 
710  static const ButtonOrder aSaveDiscardCancel[N_TYPES] =
711  {
712  { "/save", 0 },
713  { "/yes", 0 },
714  { "/ok", 0 },
715  { "/discard", 1 },
716  { "/no", 1 },
717  { "/cancel", 2 }
718  };
719 
720  const ButtonOrder* pOrder = &aDiscardCancelSave[0];
721 
722  const OUString &rEnv = Application::GetDesktopEnvironment();
723 
724  if (rEnv.equalsIgnoreAsciiCase("windows") ||
725  rEnv.equalsIgnoreAsciiCase("lxqt") ||
726  rEnv.startsWithIgnoreAsciiCase("plasma"))
727  {
728  pOrder = &aSaveDiscardCancel[0];
729  }
730 
731  for (size_t i = 0; i < N_TYPES; ++i, ++pOrder)
732  {
733  if (rType.endsWith(pOrder->m_aType))
734  return pOrder->m_nPriority;
735  }
736 
737  return -1;
738 }
739 
740 namespace {
741 
742 class sortButtons
743 {
744  bool const m_bVerticalContainer;
745 public:
746  explicit sortButtons(bool bVerticalContainer)
747  : m_bVerticalContainer(bVerticalContainer)
748  {
749  }
750  bool operator()(const vcl::Window *pA, const vcl::Window *pB) const;
751 };
752 
753 }
754 
755 bool sortButtons::operator()(const vcl::Window *pA, const vcl::Window *pB) const
756 {
757  //sort into two groups of pack start and pack end
758  VclPackType ePackA = pA->get_pack_type();
759  VclPackType ePackB = pB->get_pack_type();
760  if (ePackA < ePackB)
761  return true;
762  if (ePackA > ePackB)
763  return false;
764  bool bPackA = pA->get_secondary();
765  bool bPackB = pB->get_secondary();
766  if (!m_bVerticalContainer)
767  {
768  //for horizontal boxes group secondaries before primaries
769  if (bPackA > bPackB)
770  return true;
771  if (bPackA < bPackB)
772  return false;
773  }
774  else
775  {
776  //for vertical boxes group secondaries after primaries
777  if (bPackA < bPackB)
778  return true;
779  if (bPackA > bPackB)
780  return false;
781  }
782 
783  //now order within groups according to platform rules
785 }
786 
788 {
789  std::vector<vcl::Window*> aChilds;
790  for (vcl::Window* pChild = GetWindow(GetWindowType::FirstChild); pChild;
791  pChild = pChild->GetWindow(GetWindowType::Next))
792  {
793  aChilds.push_back(pChild);
794  }
795 
796  //sort child order within parent so that we match the platform
797  //button order
798  std::stable_sort(aChilds.begin(), aChilds.end(), sortButtons(m_bVerticalContainer));
799  BuilderUtils::reorderWithinParent(aChilds, true);
800 }
801 
802 namespace {
803 
804 struct GridEntry
805 {
806  VclPtr<vcl::Window> pChild;
807  sal_Int32 nSpanWidth;
808  sal_Int32 nSpanHeight;
809  int x;
810  int y;
811  GridEntry()
812  : pChild(nullptr)
813  , nSpanWidth(0)
814  , nSpanHeight(0)
815  , x(-1)
816  , y(-1)
817  {
818  }
819 };
820 
821 }
822 
823 typedef boost::multi_array<GridEntry, 2> array_type;
824 
825 static array_type assembleGrid(const VclGrid &rGrid);
826 static bool isNullGrid(const array_type& A);
827 static void calcMaxs(const array_type &A, std::vector<VclGrid::Value> &rWidths, std::vector<VclGrid::Value> &rHeights);
828 
829 array_type assembleGrid(const VclGrid &rGrid)
830 {
831  array_type A;
832 
833  for (vcl::Window* pChild = rGrid.GetWindow(GetWindowType::FirstChild); pChild;
834  pChild = pChild->GetWindow(GetWindowType::Next))
835  {
836  sal_Int32 nLeftAttach = std::max<sal_Int32>(pChild->get_grid_left_attach(), 0);
837  sal_Int32 nWidth = pChild->get_grid_width();
838  sal_Int32 nMaxXPos = nLeftAttach+nWidth-1;
839 
840  sal_Int32 nTopAttach = std::max<sal_Int32>(pChild->get_grid_top_attach(), 0);
841  sal_Int32 nHeight = pChild->get_grid_height();
842  sal_Int32 nMaxYPos = nTopAttach+nHeight-1;
843 
844  sal_Int32 nCurrentMaxXPos = A.shape()[0]-1;
845  sal_Int32 nCurrentMaxYPos = A.shape()[1]-1;
846  if (nMaxXPos > nCurrentMaxXPos || nMaxYPos > nCurrentMaxYPos)
847  {
848  nCurrentMaxXPos = std::max(nMaxXPos, nCurrentMaxXPos);
849  nCurrentMaxYPos = std::max(nMaxYPos, nCurrentMaxYPos);
850  A.resize(boost::extents[nCurrentMaxXPos+1][nCurrentMaxYPos+1]);
851  }
852 
853  GridEntry &rEntry = A[nLeftAttach][nTopAttach];
854  rEntry.pChild = pChild;
855  rEntry.nSpanWidth = nWidth;
856  rEntry.nSpanHeight = nHeight;
857  rEntry.x = nLeftAttach;
858  rEntry.y = nTopAttach;
859 
860  for (sal_Int32 nSpanX = 0; nSpanX < nWidth; ++nSpanX)
861  {
862  for (sal_Int32 nSpanY = 0; nSpanY < nHeight; ++nSpanY)
863  {
864  GridEntry &rSpan = A[nLeftAttach+nSpanX][nTopAttach+nSpanY];
865  rSpan.x = nLeftAttach;
866  rSpan.y = nTopAttach;
867  }
868  }
869  }
870 
871  //see if we have any empty rows/cols
872  sal_Int32 nMaxX = A.shape()[0];
873  sal_Int32 nMaxY = A.shape()[1];
874 
875  std::vector<bool> aNonEmptyCols(nMaxX);
876  std::vector<bool> aNonEmptyRows(nMaxY);
877 
878  for (sal_Int32 x = 0; x < nMaxX; ++x)
879  {
880  for (sal_Int32 y = 0; y < nMaxY; ++y)
881  {
882  const GridEntry &rEntry = A[x][y];
883  const vcl::Window *pChild = rEntry.pChild;
884  if (pChild && pChild->IsVisible())
885  {
886  aNonEmptyCols[x] = true;
887  if (rGrid.get_column_homogeneous())
888  {
889  for (sal_Int32 nSpanX = 1; nSpanX < rEntry.nSpanWidth; ++nSpanX)
890  aNonEmptyCols[x+nSpanX] = true;
891  }
892  aNonEmptyRows[y] = true;
893  if (rGrid.get_row_homogeneous())
894  {
895  for (sal_Int32 nSpanY = 1; nSpanY < rEntry.nSpanHeight; ++nSpanY)
896  aNonEmptyRows[y+nSpanY] = true;
897  }
898  }
899  }
900  }
901 
902  if (!rGrid.get_column_homogeneous())
903  {
904  //reduce the spans of elements that span empty columns
905  for (sal_Int32 x = 0; x < nMaxX; ++x)
906  {
907  std::set<GridEntry*> candidates;
908  for (sal_Int32 y = 0; y < nMaxY; ++y)
909  {
910  if (aNonEmptyCols[x])
911  continue;
912  GridEntry &rSpan = A[x][y];
913  //cell x/y is spanned by the widget at cell rSpan.x/rSpan.y,
914  //just points back to itself if there's no cell spanning
915  if ((rSpan.x == -1) || (rSpan.y == -1))
916  {
917  //there is no entry for this cell, i.e. this is a cell
918  //with no widget in it, or spanned by any other widget
919  continue;
920  }
921  GridEntry &rEntry = A[rSpan.x][rSpan.y];
922  candidates.insert(&rEntry);
923  }
924  for (auto const& candidate : candidates)
925  {
926  GridEntry *pEntry = candidate;
927  --pEntry->nSpanWidth;
928  }
929  }
930  }
931 
932  if (!rGrid.get_row_homogeneous())
933  {
934  //reduce the spans of elements that span empty rows
935  for (sal_Int32 y = 0; y < nMaxY; ++y)
936  {
937  std::set<GridEntry*> candidates;
938  for (sal_Int32 x = 0; x < nMaxX; ++x)
939  {
940  if (aNonEmptyRows[y])
941  continue;
942  GridEntry &rSpan = A[x][y];
943  //cell x/y is spanned by the widget at cell rSpan.x/rSpan.y,
944  //just points back to itself if there's no cell spanning
945  if ((rSpan.x == -1) || (rSpan.y == -1))
946  {
947  //there is no entry for this cell, i.e. this is a cell
948  //with no widget in it, or spanned by any other widget
949  continue;
950  }
951  GridEntry &rEntry = A[rSpan.x][rSpan.y];
952  candidates.insert(&rEntry);
953  }
954  for (auto const& candidate : candidates)
955  {
956  GridEntry *pEntry = candidate;
957  --pEntry->nSpanHeight;
958  }
959  }
960  }
961 
962  sal_Int32 nNonEmptyCols = std::count(aNonEmptyCols.begin(), aNonEmptyCols.end(), true);
963  sal_Int32 nNonEmptyRows = std::count(aNonEmptyRows.begin(), aNonEmptyRows.end(), true);
964 
965  //make new grid without empty rows and columns
966  array_type B(boost::extents[nNonEmptyCols][nNonEmptyRows]);
967  for (sal_Int32 x = 0, x2 = 0; x < nMaxX; ++x)
968  {
969  if (!aNonEmptyCols[x])
970  continue;
971  for (sal_Int32 y = 0, y2 = 0; y < nMaxY; ++y)
972  {
973  if (!aNonEmptyRows[y])
974  continue;
975  GridEntry &rEntry = A[x][y];
976  B[x2][y2++] = rEntry;
977  }
978  ++x2;
979  }
980 
981  return B;
982 }
983 
984 static bool isNullGrid(const array_type &A)
985 {
986  sal_Int32 nMaxX = A.shape()[0];
987  sal_Int32 nMaxY = A.shape()[1];
988 
989  return !nMaxX || !nMaxY;
990 }
991 
992 static void calcMaxs(const array_type &A, std::vector<VclGrid::Value> &rWidths, std::vector<VclGrid::Value> &rHeights)
993 {
994  sal_Int32 nMaxX = A.shape()[0];
995  sal_Int32 nMaxY = A.shape()[1];
996 
997  rWidths.resize(nMaxX);
998  rHeights.resize(nMaxY);
999 
1000  //first use the non spanning entries to set default width/heights
1001  for (sal_Int32 x = 0; x < nMaxX; ++x)
1002  {
1003  for (sal_Int32 y = 0; y < nMaxY; ++y)
1004  {
1005  const GridEntry &rEntry = A[x][y];
1006  const vcl::Window *pChild = rEntry.pChild;
1007  if (!pChild || !pChild->IsVisible())
1008  continue;
1009 
1010  sal_Int32 nWidth = rEntry.nSpanWidth;
1011  sal_Int32 nHeight = rEntry.nSpanHeight;
1012 
1013  for (sal_Int32 nSpanX = 0; nSpanX < nWidth; ++nSpanX)
1014  rWidths[x+nSpanX].m_bExpand |= pChild->get_hexpand();
1015 
1016  for (sal_Int32 nSpanY = 0; nSpanY < nHeight; ++nSpanY)
1017  rHeights[y+nSpanY].m_bExpand |= pChild->get_vexpand();
1018 
1019  if (nWidth == 1 || nHeight == 1)
1020  {
1021  Size aChildSize = VclContainer::getLayoutRequisition(*pChild);
1022  if (nWidth == 1)
1023  rWidths[x].m_nValue = std::max(rWidths[x].m_nValue, aChildSize.Width());
1024  if (nHeight == 1)
1025  rHeights[y].m_nValue = std::max(rHeights[y].m_nValue, aChildSize.Height());
1026  }
1027  }
1028  }
1029 
1030  //now use the spanning entries and split any extra sizes across expanding rows/cols
1031  //where possible
1032  for (sal_Int32 x = 0; x < nMaxX; ++x)
1033  {
1034  for (sal_Int32 y = 0; y < nMaxY; ++y)
1035  {
1036  const GridEntry &rEntry = A[x][y];
1037  const vcl::Window *pChild = rEntry.pChild;
1038  if (!pChild || !pChild->IsVisible())
1039  continue;
1040 
1041  sal_Int32 nWidth = rEntry.nSpanWidth;
1042  sal_Int32 nHeight = rEntry.nSpanHeight;
1043 
1044  if (nWidth == 1 && nHeight == 1)
1045  continue;
1046 
1047  Size aChildSize = VclContainer::getLayoutRequisition(*pChild);
1048 
1049  if (nWidth > 1)
1050  {
1051  sal_Int32 nExistingWidth = 0;
1052  for (sal_Int32 nSpanX = 0; nSpanX < nWidth; ++nSpanX)
1053  nExistingWidth += rWidths[x+nSpanX].m_nValue;
1054 
1055  sal_Int32 nExtraWidth = aChildSize.Width() - nExistingWidth;
1056 
1057  if (nExtraWidth > 0)
1058  {
1059  bool bForceExpandAll = false;
1060  sal_Int32 nExpandables = 0;
1061  for (sal_Int32 nSpanX = 0; nSpanX < nWidth; ++nSpanX)
1062  if (rWidths[x+nSpanX].m_bExpand)
1063  ++nExpandables;
1064  if (nExpandables == 0)
1065  {
1066  nExpandables = nWidth;
1067  bForceExpandAll = true;
1068  }
1069 
1070  for (sal_Int32 nSpanX = 0; nSpanX < nWidth; ++nSpanX)
1071  {
1072  if (rWidths[x+nSpanX].m_bExpand || bForceExpandAll)
1073  rWidths[x+nSpanX].m_nValue += nExtraWidth/nExpandables;
1074  }
1075  }
1076  }
1077 
1078  if (nHeight > 1)
1079  {
1080  sal_Int32 nExistingHeight = 0;
1081  for (sal_Int32 nSpanY = 0; nSpanY < nHeight; ++nSpanY)
1082  nExistingHeight += rHeights[y+nSpanY].m_nValue;
1083 
1084  sal_Int32 nExtraHeight = aChildSize.Height() - nExistingHeight;
1085 
1086  if (nExtraHeight > 0)
1087  {
1088  bool bForceExpandAll = false;
1089  sal_Int32 nExpandables = 0;
1090  for (sal_Int32 nSpanY = 0; nSpanY < nHeight; ++nSpanY)
1091  if (rHeights[y+nSpanY].m_bExpand)
1092  ++nExpandables;
1093  if (nExpandables == 0)
1094  {
1095  nExpandables = nHeight;
1096  bForceExpandAll = true;
1097  }
1098 
1099  for (sal_Int32 nSpanY = 0; nSpanY < nHeight; ++nSpanY)
1100  {
1101  if (rHeights[y+nSpanY].m_bExpand || bForceExpandAll)
1102  rHeights[y+nSpanY].m_nValue += nExtraHeight/nExpandables;
1103  }
1104  }
1105  }
1106  }
1107  }
1108 }
1109 
1110 static bool compareValues(const VclGrid::Value &i, const VclGrid::Value &j)
1111 {
1112  return i.m_nValue < j.m_nValue;
1113 }
1114 
1116 {
1117  VclGrid::Value aRet;
1118  aRet.m_nValue = i.m_nValue + j.m_nValue;
1119  aRet.m_bExpand = i.m_bExpand || j.m_bExpand;
1120  return aRet;
1121 }
1122 
1124 {
1126 }
1127 
1128 Size VclGrid::calculateRequisitionForSpacings(sal_Int32 nRowSpacing, sal_Int32 nColSpacing) const
1129 {
1130  array_type A = assembleGrid(*this);
1131 
1132  if (isNullGrid(A))
1133  return Size();
1134 
1135  std::vector<Value> aWidths;
1136  std::vector<Value> aHeights;
1137  calcMaxs(A, aWidths, aHeights);
1138 
1139  long nTotalWidth = 0;
1140  if (get_column_homogeneous())
1141  {
1142  nTotalWidth = std::max_element(aWidths.begin(), aWidths.end(), compareValues)->m_nValue;
1143  nTotalWidth *= aWidths.size();
1144  }
1145  else
1146  {
1147  nTotalWidth = std::accumulate(aWidths.begin(), aWidths.end(), Value(), accumulateValues).m_nValue;
1148  }
1149 
1150  nTotalWidth += nColSpacing * (aWidths.size()-1);
1151 
1152  long nTotalHeight = 0;
1153  if (get_row_homogeneous())
1154  {
1155  nTotalHeight = std::max_element(aHeights.begin(), aHeights.end(), compareValues)->m_nValue;
1156  nTotalHeight *= aHeights.size();
1157  }
1158  else
1159  {
1160  nTotalHeight = std::accumulate(aHeights.begin(), aHeights.end(), Value(), accumulateValues).m_nValue;
1161  }
1162 
1163  nTotalHeight += nRowSpacing * (aHeights.size()-1);
1164 
1165  return Size(nTotalWidth, nTotalHeight);
1166 }
1167 
1168 void VclGrid::setAllocation(const Size& rAllocation)
1169 {
1170  array_type A = assembleGrid(*this);
1171 
1172  if (isNullGrid(A))
1173  return;
1174 
1175  sal_Int32 nMaxX = A.shape()[0];
1176  sal_Int32 nMaxY = A.shape()[1];
1177 
1178  Size aRequisition;
1179  std::vector<Value> aWidths(nMaxX);
1180  std::vector<Value> aHeights(nMaxY);
1182  {
1183  aRequisition = calculateRequisition();
1184  calcMaxs(A, aWidths, aHeights);
1185  }
1186 
1187  sal_Int32 nColSpacing(get_column_spacing());
1188  sal_Int32 nRowSpacing(get_row_spacing());
1189 
1190  long nAvailableWidth = rAllocation.Width();
1191  if (nMaxX)
1192  nAvailableWidth -= nColSpacing * (nMaxX - 1);
1193  if (get_column_homogeneous())
1194  {
1195  for (sal_Int32 x = 0; x < nMaxX; ++x)
1196  aWidths[x].m_nValue = nAvailableWidth/nMaxX;
1197  }
1198  else if (rAllocation.Width() != aRequisition.Width())
1199  {
1200  sal_Int32 nExpandables = 0;
1201  for (sal_Int32 x = 0; x < nMaxX; ++x)
1202  if (aWidths[x].m_bExpand)
1203  ++nExpandables;
1204  long nExtraWidthForExpanders = nExpandables ? (rAllocation.Width() - aRequisition.Width()) / nExpandables : 0;
1205 
1206  //We don't fit and there is no volunteer to be shrunk
1207  if (!nExpandables && rAllocation.Width() < aRequisition.Width())
1208  {
1209  //first reduce spacing
1210  while (nColSpacing)
1211  {
1212  nColSpacing /= 2;
1213  aRequisition = calculateRequisitionForSpacings(nRowSpacing, nColSpacing);
1214  if (aRequisition.Width() <= rAllocation.Width())
1215  break;
1216  }
1217 
1218  //share out the remaining pain to everyone
1219  long nExtraWidth = (rAllocation.Width() - aRequisition.Width()) / nMaxX;
1220 
1221  for (sal_Int32 x = 0; x < nMaxX; ++x)
1222  aWidths[x].m_nValue += nExtraWidth;
1223  }
1224 
1225  if (nExtraWidthForExpanders)
1226  {
1227  for (sal_Int32 x = 0; x < nMaxX; ++x)
1228  if (aWidths[x].m_bExpand)
1229  aWidths[x].m_nValue += nExtraWidthForExpanders;
1230  }
1231  }
1232 
1233  long nAvailableHeight = rAllocation.Height();
1234  if (nMaxY)
1235  nAvailableHeight -= nRowSpacing * (nMaxY - 1);
1236  if (get_row_homogeneous())
1237  {
1238  for (sal_Int32 y = 0; y < nMaxY; ++y)
1239  aHeights[y].m_nValue = nAvailableHeight/nMaxY;
1240  }
1241  else if (rAllocation.Height() != aRequisition.Height())
1242  {
1243  sal_Int32 nExpandables = 0;
1244  for (sal_Int32 y = 0; y < nMaxY; ++y)
1245  if (aHeights[y].m_bExpand)
1246  ++nExpandables;
1247  long nExtraHeightForExpanders = nExpandables ? (rAllocation.Height() - aRequisition.Height()) / nExpandables : 0;
1248 
1249  //We don't fit and there is no volunteer to be shrunk
1250  if (!nExpandables && rAllocation.Height() < aRequisition.Height())
1251  {
1252  //first reduce spacing
1253  while (nRowSpacing)
1254  {
1255  nRowSpacing /= 2;
1256  aRequisition = calculateRequisitionForSpacings(nRowSpacing, nColSpacing);
1257  if (aRequisition.Height() <= rAllocation.Height())
1258  break;
1259  }
1260 
1261  //share out the remaining pain to everyone
1262  long nExtraHeight = (rAllocation.Height() - aRequisition.Height()) / nMaxY;
1263 
1264  for (sal_Int32 y = 0; y < nMaxY; ++y)
1265  aHeights[y].m_nValue += nExtraHeight;
1266  }
1267 
1268  if (nExtraHeightForExpanders)
1269  {
1270  for (sal_Int32 y = 0; y < nMaxY; ++y)
1271  if (aHeights[y].m_bExpand)
1272  aHeights[y].m_nValue += nExtraHeightForExpanders;
1273  }
1274  }
1275 
1276  Point aAllocPos(0, 0);
1277  for (sal_Int32 x = 0; x < nMaxX; ++x)
1278  {
1279  for (sal_Int32 y = 0; y < nMaxY; ++y)
1280  {
1281  GridEntry &rEntry = A[x][y];
1282  vcl::Window *pChild = rEntry.pChild;
1283  if (pChild)
1284  {
1285  Size aChildAlloc(0, 0);
1286 
1287  sal_Int32 nWidth = rEntry.nSpanWidth;
1288  for (sal_Int32 nSpanX = 0; nSpanX < nWidth; ++nSpanX)
1289  aChildAlloc.AdjustWidth(aWidths[x+nSpanX].m_nValue );
1290  aChildAlloc.AdjustWidth(nColSpacing*(nWidth-1) );
1291 
1292  sal_Int32 nHeight = rEntry.nSpanHeight;
1293  for (sal_Int32 nSpanY = 0; nSpanY < nHeight; ++nSpanY)
1294  aChildAlloc.AdjustHeight(aHeights[y+nSpanY].m_nValue );
1295  aChildAlloc.AdjustHeight(nRowSpacing*(nHeight-1) );
1296 
1297  setLayoutAllocation(*pChild, aAllocPos, aChildAlloc);
1298  }
1299  aAllocPos.AdjustY(aHeights[y].m_nValue + nRowSpacing );
1300  }
1301  aAllocPos.AdjustX(aWidths[x].m_nValue + nColSpacing );
1302  aAllocPos.setY( 0 );
1303  }
1304 }
1305 
1306 boost::property_tree::ptree VclGrid::DumpAsPropertyTree()
1307 {
1308  boost::property_tree::ptree aTree(VclContainer::DumpAsPropertyTree());
1309  aTree.put("type", "grid");
1310  return aTree;
1311 }
1312 
1313 bool toBool(const OUString &rValue)
1314 {
1315  return (!rValue.isEmpty() && (rValue[0] == 't' || rValue[0] == 'T' || rValue[0] == '1'));
1316 }
1317 
1318 bool VclGrid::set_property(const OString &rKey, const OUString &rValue)
1319 {
1320  if (rKey == "row-spacing")
1321  set_row_spacing(rValue.toInt32());
1322  else if (rKey == "column-spacing")
1323  set_column_spacing(rValue.toInt32());
1324  else if (rKey == "row-homogeneous")
1325  m_bRowHomogeneous = toBool(rValue);
1326  else if (rKey == "column-homogeneous")
1327  m_bColumnHomogeneous = toBool(rValue);
1328  else if (rKey == "n-rows")
1329  /*nothing to do*/;
1330  else
1331  return VclContainer::set_property(rKey, rValue);
1332  return true;
1333 }
1334 
1336 {
1337  const WindowImpl* pWindowImpl = ImplGetWindowImpl();
1338 
1339  return pWindowImpl->mpFirstChild;
1340 }
1341 
1343 {
1344  return const_cast<vcl::Window*>(const_cast<const VclBin*>(this)->get_child());
1345 }
1346 
1348 {
1349  const vcl::Window *pChild = get_child();
1350  if (pChild && pChild->IsVisible())
1351  return getLayoutRequisition(*pChild);
1352  return Size(0, 0);
1353 }
1354 
1355 void VclBin::setAllocation(const Size &rAllocation)
1356 {
1357  vcl::Window *pChild = get_child();
1358  if (pChild && pChild->IsVisible())
1359  setLayoutAllocation(*pChild, Point(0, 0), rAllocation);
1360 }
1361 
1363 {
1364  disposeOnce();
1365 }
1366 
1368 {
1369  m_pLabel.clear();
1370  VclBin::dispose();
1371 }
1372 
1373 //To-Do, hook a DecorationView into VclFrame ?
1374 
1376 {
1377  Size aRet(0, 0);
1378 
1379  const vcl::Window *pChild = get_child();
1380  const vcl::Window *pLabel = get_label_widget();
1381 
1382  if (pChild && pChild->IsVisible())
1383  aRet = getLayoutRequisition(*pChild);
1384 
1385  if (pLabel && pLabel->IsVisible())
1386  {
1387  Size aLabelSize = getLayoutRequisition(*pLabel);
1388  aRet.AdjustHeight(aLabelSize.Height() );
1389  aRet.setWidth( std::max(aLabelSize.Width(), aRet.Width()) );
1390  }
1391 
1392  return aRet;
1393 }
1394 
1395 void VclFrame::setAllocation(const Size &rAllocation)
1396 {
1397  //SetBackground( Color(0xFF, 0x00, 0xFF) );
1398 
1399  Size aAllocation(rAllocation);
1400  Point aChildPos;
1401 
1402  vcl::Window *pChild = get_child();
1403  vcl::Window *pLabel = get_label_widget();
1404 
1405  if (pLabel && pLabel->IsVisible())
1406  {
1407  Size aLabelSize = getLayoutRequisition(*pLabel);
1408  aLabelSize.setHeight( std::min(aLabelSize.Height(), aAllocation.Height()) );
1409  aLabelSize.setWidth( std::min(aLabelSize.Width(), aAllocation.Width()) );
1410  setLayoutAllocation(*pLabel, aChildPos, aLabelSize);
1411  aAllocation.AdjustHeight( -(aLabelSize.Height()) );
1412  aChildPos.AdjustY(aLabelSize.Height() );
1413  }
1414 
1415  if (pChild && pChild->IsVisible())
1416  setLayoutAllocation(*pChild, aChildPos, aAllocation);
1417 }
1418 
1419 IMPL_LINK(VclFrame, WindowEventListener, VclWindowEvent&, rEvent, void)
1420 {
1421  if (rEvent.GetId() == VclEventId::ObjectDying)
1422  designate_label(nullptr);
1423 }
1424 
1426 {
1427  assert(!pWindow || pWindow->GetParent() == this);
1428  if (m_pLabel)
1429  m_pLabel->RemoveEventListener(LINK(this, VclFrame, WindowEventListener));
1430  m_pLabel = pWindow;
1431  if (m_pLabel)
1432  m_pLabel->AddEventListener(LINK(this, VclFrame, WindowEventListener));
1433 }
1434 
1436 {
1437  assert(GetChildCount() == 2);
1438  if (m_pLabel)
1439  return m_pLabel;
1440  //The label widget is normally the first (of two) children
1441  const WindowImpl* pWindowImpl = ImplGetWindowImpl();
1442  if (pWindowImpl->mpFirstChild == pWindowImpl->mpLastChild) //no label exists
1443  return nullptr;
1444  return pWindowImpl->mpFirstChild;
1445 }
1446 
1448 {
1449  return const_cast<vcl::Window*>(const_cast<const VclFrame*>(this)->get_label_widget());
1450 }
1451 
1453 {
1454  //The child widget is the normally the last (of two) children
1455  const WindowImpl* pWindowImpl = ImplGetWindowImpl();
1456  assert(GetChildCount() == 2 || pWindowImpl->mbInDispose);
1457  if (!m_pLabel)
1458  return pWindowImpl->mpLastChild;
1459  if (pWindowImpl->mpFirstChild == pWindowImpl->mpLastChild) //only label exists
1460  return nullptr;
1461  return pWindowImpl->mpLastChild;
1462 }
1463 
1465 {
1466  return const_cast<vcl::Window*>(const_cast<const VclFrame*>(this)->get_child());
1467 }
1468 
1469 void VclFrame::set_label(const OUString &rLabel)
1470 {
1471  vcl::Window *pLabel = get_label_widget();
1472  assert(pLabel);
1473  pLabel->SetText(rLabel);
1474 }
1475 
1476 OUString VclFrame::get_label() const
1477 {
1478  const vcl::Window *pLabel = get_label_widget();
1479  assert(pLabel);
1480  return pLabel->GetText();
1481 }
1482 
1484 {
1485  const vcl::Window *pLabel = get_label_widget();
1486  if (pLabel)
1487  return pLabel->GetAccessibleName();
1489 }
1490 
1491 boost::property_tree::ptree VclFrame::DumpAsPropertyTree()
1492 {
1493  boost::property_tree::ptree aTree(VclBin::DumpAsPropertyTree());
1494  aTree.put("type", "frame");
1495  return aTree;
1496 }
1497 
1499 {
1502 
1503  const vcl::Window *pChild = get_child();
1504  if (pChild && pChild->IsVisible())
1505  {
1506  Size aChildSize = getLayoutRequisition(*pChild);
1507  aRet.AdjustWidth(aChildSize.Width() );
1508  aRet.AdjustHeight(aChildSize.Height() );
1509  }
1510 
1511  return aRet;
1512 }
1513 
1514 void VclAlignment::setAllocation(const Size &rAllocation)
1515 {
1516  vcl::Window *pChild = get_child();
1517  if (!pChild || !pChild->IsVisible())
1518  return;
1519 
1520  Point aChildPos(m_nLeftPadding, m_nTopPadding);
1521 
1522  Size aAllocation;
1523  aAllocation.setWidth( rAllocation.Width() - (m_nLeftPadding + m_nRightPadding) );
1524  aAllocation.setHeight( rAllocation.Height() - (m_nTopPadding + m_nBottomPadding) );
1525 
1526  setLayoutAllocation(*pChild, aChildPos, aAllocation);
1527 }
1528 
1529 bool VclAlignment::set_property(const OString &rKey, const OUString &rValue)
1530 {
1531  if (rKey == "bottom-padding")
1532  m_nBottomPadding = rValue.toInt32();
1533  else if (rKey == "left-padding")
1534  m_nLeftPadding = rValue.toInt32();
1535  else if (rKey == "right-padding")
1536  m_nRightPadding = rValue.toInt32();
1537  else if (rKey == "top-padding")
1538  m_nTopPadding = rValue.toInt32();
1539  else
1540  return VclBin::set_property(rKey, rValue);
1541  return true;
1542 }
1543 
1545 {
1547  VclBin::dispose();
1548 }
1549 
1551 {
1552  const WindowImpl* pWindowImpl = ImplGetWindowImpl();
1553 
1554  assert(pWindowImpl->mpFirstChild == m_pDisclosureButton);
1555 
1556  return pWindowImpl->mpFirstChild->GetWindow(GetWindowType::Next);
1557 }
1558 
1560 {
1561  return const_cast<vcl::Window*>(const_cast<const VclExpander*>(this)->get_child());
1562 }
1563 
1565 {
1566  Size aRet(0, 0);
1567 
1568  WindowImpl* pWindowImpl = ImplGetWindowImpl();
1569 
1570  const vcl::Window *pChild = get_child();
1571  const vcl::Window *pLabel = pChild != pWindowImpl->mpLastChild ? pWindowImpl->mpLastChild.get() : nullptr;
1572 
1573  if (pChild && pChild->IsVisible() && m_pDisclosureButton->IsChecked())
1574  aRet = getLayoutRequisition(*pChild);
1575 
1576  Size aExpanderSize = getLayoutRequisition(*m_pDisclosureButton);
1577 
1578  if (pLabel && pLabel->IsVisible())
1579  {
1580  Size aLabelSize = getLayoutRequisition(*pLabel);
1581  aExpanderSize.setHeight( std::max(aExpanderSize.Height(), aLabelSize.Height()) );
1582  aExpanderSize.AdjustWidth(aLabelSize.Width() );
1583  }
1584 
1585  aRet.AdjustHeight(aExpanderSize.Height() );
1586  aRet.setWidth( std::max(aExpanderSize.Width(), aRet.Width()) );
1587 
1588  return aRet;
1589 }
1590 
1591 void VclExpander::setAllocation(const Size &rAllocation)
1592 {
1593  Size aAllocation(rAllocation);
1594  Point aChildPos;
1595 
1596  WindowImpl* pWindowImpl = ImplGetWindowImpl();
1597 
1598  //The label widget is the last (of two) children
1599  vcl::Window *pChild = get_child();
1600  vcl::Window *pLabel = pChild != pWindowImpl->mpLastChild.get() ? pWindowImpl->mpLastChild.get() : nullptr;
1601 
1603  Size aLabelSize;
1604  Size aExpanderSize = aButtonSize;
1605  if (pLabel && pLabel->IsVisible())
1606  {
1607  aLabelSize = getLayoutRequisition(*pLabel);
1608  aExpanderSize.setHeight( std::max(aExpanderSize.Height(), aLabelSize.Height()) );
1609  aExpanderSize.AdjustWidth(aLabelSize.Width() );
1610  }
1611 
1612  aExpanderSize.setHeight( std::min(aExpanderSize.Height(), aAllocation.Height()) );
1613  aExpanderSize.setWidth( std::min(aExpanderSize.Width(), aAllocation.Width()) );
1614 
1615  aButtonSize.setHeight( std::min(aButtonSize.Height(), aExpanderSize.Height()) );
1616  aButtonSize.setWidth( std::min(aButtonSize.Width(), aExpanderSize.Width()) );
1617 
1618  long nExtraExpanderHeight = aExpanderSize.Height() - aButtonSize.Height();
1619  Point aButtonPos(aChildPos.X(), aChildPos.Y() + nExtraExpanderHeight/2);
1620  setLayoutAllocation(*m_pDisclosureButton, aButtonPos, aButtonSize);
1621 
1622  if (pLabel && pLabel->IsVisible())
1623  {
1624  aLabelSize.setHeight( std::min(aLabelSize.Height(), aExpanderSize.Height()) );
1625  aLabelSize.setWidth( std::min(aLabelSize.Width(),
1626  aExpanderSize.Width() - aButtonSize.Width()) );
1627 
1628  long nExtraLabelHeight = aExpanderSize.Height() - aLabelSize.Height();
1629  Point aLabelPos(aChildPos.X() + aButtonSize.Width(), aChildPos.Y() + nExtraLabelHeight/2);
1630  setLayoutAllocation(*pLabel, aLabelPos, aLabelSize);
1631  }
1632 
1633  aAllocation.AdjustHeight( -(aExpanderSize.Height()) );
1634  aChildPos.AdjustY(aExpanderSize.Height() );
1635 
1636  if (pChild && pChild->IsVisible())
1637  {
1639  aAllocation = Size();
1640  setLayoutAllocation(*pChild, aChildPos, aAllocation);
1641  }
1642 }
1643 
1644 bool VclExpander::set_property(const OString &rKey, const OUString &rValue)
1645 {
1646  if (rKey == "expanded")
1647  set_expanded(toBool(rValue));
1648  else if (rKey == "resize-toplevel")
1649  m_bResizeTopLevel = toBool(rValue);
1650  else
1651  return VclBin::set_property(rKey, rValue);
1652  return true;
1653 }
1654 
1656 {
1657  VclBin::StateChanged( nType );
1658 
1659  if (nType == StateChangedType::InitShow)
1660  {
1661  vcl::Window *pChild = get_child();
1662  if (pChild)
1663  pChild->Show(m_pDisclosureButton->IsChecked());
1664  }
1665 }
1666 
1667 IMPL_LINK( VclExpander, ClickHdl, CheckBox&, rBtn, void )
1668 {
1669  vcl::Window *pChild = get_child();
1670  if (pChild)
1671  {
1672  pChild->Show(rBtn.IsChecked());
1673  queue_resize();
1674  Dialog* pResizeDialog = m_bResizeTopLevel ? GetParentDialog() : nullptr;
1675  if (pResizeDialog)
1676  pResizeDialog->setOptimalLayoutSize();
1677  }
1678  maExpandedHdl.Call(*this);
1679 }
1680 
1683  , m_bUserManagedScrolling(false)
1684  , m_eDrawFrameStyle(DrawFrameStyle::NONE)
1685  , m_pVScroll(VclPtr<ScrollBar>::Create(this, WB_HIDE | WB_VERT))
1686  , m_pHScroll(VclPtr<ScrollBar>::Create(this, WB_HIDE | WB_HORZ))
1687  , m_aScrollBarBox(VclPtr<ScrollBarBox>::Create(this, WB_HIDE))
1688 {
1689  SetType(WindowType::SCROLLWINDOW);
1690 
1691  Link<ScrollBar*,void> aLink( LINK( this, VclScrolledWindow, ScrollBarHdl ) );
1692  m_pVScroll->SetScrollHdl(aLink);
1693  m_pHScroll->SetScrollHdl(aLink);
1694 }
1695 
1697 {
1701  VclBin::dispose();
1702 }
1703 
1705 {
1706  vcl::Window *pChild = get_child();
1707  if (!pChild)
1708  return;
1709 
1710  assert(dynamic_cast<VclViewport*>(pChild) && "scrolledwindow child should be a Viewport");
1711 
1712  pChild = pChild->GetWindow(GetWindowType::FirstChild);
1713 
1714  if (!pChild)
1715  return;
1716 
1717  Point aWinPos(-m_pHScroll->GetThumbPos(), -m_pVScroll->GetThumbPos());
1718  pChild->SetPosPixel(aWinPos);
1719 }
1720 
1722 {
1723  const WindowImpl* pWindowImpl = ImplGetWindowImpl();
1724  assert(GetChildCount() == 4 || pWindowImpl->mbInDispose);
1725  return pWindowImpl->mpLastChild;
1726 }
1727 
1729 {
1730  return const_cast<vcl::Window*>(const_cast<const VclScrolledWindow*>(this)->get_child());
1731 }
1732 
1734 {
1735  Size aRet(0, 0);
1736 
1737  const vcl::Window *pChild = get_child();
1738  if (pChild && pChild->IsVisible())
1739  aRet = getLayoutRequisition(*pChild);
1740 
1741  if (GetStyle() & WB_VSCROLL)
1742  aRet.AdjustWidth(getLayoutRequisition(*m_pVScroll).Width() );
1743 
1744  if (GetStyle() & WB_HSCROLL)
1745  aRet.AdjustHeight(getLayoutRequisition(*m_pHScroll).Height() );
1746 
1747  aRet.AdjustHeight(2);
1748  aRet.AdjustWidth(2);
1749 
1750  return aRet;
1751 }
1752 
1754 {
1755  const vcl::Window *pChild = get_child();
1756  if (!pChild || !pChild->IsVisible())
1757  return;
1758 
1759  Size aOutSize(getVisibleChildSize());
1760 
1761  m_pVScroll->SetRangeMax(rRequest.Height());
1762  m_pVScroll->SetVisibleSize(aOutSize.Height());
1763  m_pVScroll->SetPageSize(16);
1764 
1765  m_pHScroll->SetRangeMax(rRequest.Width());
1766  m_pHScroll->SetVisibleSize(aOutSize.Width());
1767  m_pHScroll->SetPageSize(16);
1768 
1769  m_pVScroll->Scroll();
1770  m_pHScroll->Scroll();
1771 }
1772 
1773 void VclScrolledWindow::doSetAllocation(const Size &rAllocation, bool bRetryOnFailure)
1774 {
1775  Size aChildReq;
1776 
1777  vcl::Window *pChild = get_child();
1778  if (pChild && pChild->IsVisible())
1779  aChildReq = getLayoutRequisition(*pChild);
1780 
1781  long nAvailHeight = rAllocation.Height() - 2;
1782  long nAvailWidth = rAllocation.Width() - 2;
1783  // vert. ScrollBar
1784  if (GetStyle() & WB_AUTOVSCROLL)
1785  {
1786  m_pVScroll->Show(nAvailHeight < aChildReq.Height());
1787  }
1788  else if (m_pVScroll->IsVisible() != bool(GetStyle() & WB_VSCROLL))
1789  m_pVScroll->Show((GetStyle() & WB_VSCROLL) != 0);
1790 
1791  if (m_pVScroll->IsVisible())
1792  nAvailWidth -= getLayoutRequisition(*m_pVScroll).Width();
1793 
1794  // horz. ScrollBar
1795  if (GetStyle() & WB_AUTOHSCROLL)
1796  {
1797  bool bShowHScroll = nAvailWidth < aChildReq.Width();
1798  m_pHScroll->Show(bShowHScroll);
1799 
1800  if (bShowHScroll)
1801  nAvailHeight -= getLayoutRequisition(*m_pHScroll).Height();
1802 
1803  if (GetStyle() & WB_AUTOVSCROLL)
1804  m_pVScroll->Show(nAvailHeight < aChildReq.Height());
1805  }
1806  else if (m_pHScroll->IsVisible() != bool(GetStyle() & WB_HSCROLL))
1807  m_pHScroll->Show((GetStyle() & WB_HSCROLL) != 0);
1808 
1809  Size aInnerSize(rAllocation);
1810  aInnerSize.AdjustWidth(-2);
1811  aInnerSize.AdjustHeight(-2);
1812 
1813  bool bBothVisible = m_pVScroll->IsVisible() && m_pHScroll->IsVisible();
1814  auto nScrollBarWidth = getLayoutRequisition(*m_pVScroll).Width();
1815  auto nScrollBarHeight = getLayoutRequisition(*m_pHScroll).Height();
1816 
1817  if (m_pVScroll->IsVisible())
1818  {
1819  Point aScrollPos(rAllocation.Width() - nScrollBarWidth - 2, 1);
1820  Size aScrollSize(nScrollBarWidth, rAllocation.Height() - 2);
1821  if (bBothVisible)
1822  aScrollSize.AdjustHeight(-nScrollBarHeight);
1823  setLayoutAllocation(*m_pVScroll, aScrollPos, aScrollSize);
1824  aInnerSize.AdjustWidth( -nScrollBarWidth );
1825  }
1826 
1827  if (m_pHScroll->IsVisible())
1828  {
1829  Point aScrollPos(1, rAllocation.Height() - nScrollBarHeight);
1830  Size aScrollSize(rAllocation.Width() - 2, nScrollBarHeight);
1831  if (bBothVisible)
1832  aScrollSize.AdjustWidth(-nScrollBarWidth);
1833  setLayoutAllocation(*m_pHScroll, aScrollPos, aScrollSize);
1834  aInnerSize.AdjustHeight( -nScrollBarHeight );
1835  }
1836 
1837  if (bBothVisible)
1838  {
1839  Point aBoxPos(aInnerSize.Width() + 1, aInnerSize.Height() + 1);
1840  m_aScrollBarBox->SetPosSizePixel(aBoxPos, Size(nScrollBarWidth, nScrollBarHeight));
1841  m_aScrollBarBox->Show();
1842  }
1843  else
1844  {
1845  m_aScrollBarBox->Hide();
1846  }
1847 
1848  if (pChild && pChild->IsVisible())
1849  {
1850  assert(dynamic_cast<VclViewport*>(pChild) && "scrolledwindow child should be a Viewport");
1851 
1853 
1854  setLayoutAllocation(*pChild, Point(1, 1), aInnerSize);
1855 
1856  // tdf#128758 if the layout allocation triggered some callback that
1857  // immediately invalidates the layout by adding scrollbars then
1858  // normally this would simply retrigger layout and another toplevel
1859  // attempt is made later. But the initial layout attempt blocks
1860  // relayouts, so just make another single effort here.
1862  if (nOldBits != nNewBits && bRetryOnFailure)
1863  {
1864  doSetAllocation(rAllocation, false);
1865  return;
1866  }
1867  }
1868 
1870  InitScrollBars(aChildReq);
1871 }
1872 
1873 void VclScrolledWindow::setAllocation(const Size &rAllocation)
1874 {
1875  doSetAllocation(rAllocation, true);
1876 }
1877 
1879 {
1880  Size aRet(GetSizePixel());
1881  if (m_pVScroll->IsVisible())
1882  aRet.AdjustWidth( -(m_pVScroll->GetSizePixel().Width()) );
1883  if (m_pHScroll->IsVisible())
1884  aRet.AdjustHeight( -(m_pHScroll->GetSizePixel().Height()) );
1885  aRet.AdjustHeight(-2);
1886  aRet.AdjustWidth(-2);
1887  return aRet;
1888 }
1889 
1890 bool VclScrolledWindow::set_property(const OString &rKey, const OUString &rValue)
1891 {
1892  if (rKey == "shadow-type")
1893  {
1894  // despite the style names, this looks like the best mapping
1895  if (rValue == "in")
1897  else if (rValue == "out")
1899  else if (rValue == "etched-in")
1901  else if (rValue == "etched-out")
1903  else if (rValue == "none")
1905  return true;
1906  }
1907 
1908  bool bRet = VclBin::set_property(rKey, rValue);
1909  m_pVScroll->Show((GetStyle() & WB_VSCROLL) != 0);
1910  m_pHScroll->Show((GetStyle() & WB_HSCROLL) != 0);
1911  return bRet;
1912 }
1913 
1915 {
1916  bool bDone = false;
1917  if ( rNEvt.GetType() == MouseNotifyEvent::COMMAND )
1918  {
1919  const CommandEvent& rCEvt = *rNEvt.GetCommandEvent();
1920  if ( rCEvt.GetCommand() == CommandEventId::Wheel )
1921  {
1922  const CommandWheelData* pData = rCEvt.GetWheelData();
1923  if( !pData->GetModifier() && ( pData->GetMode() == CommandWheelMode::SCROLL ) )
1924  {
1925  bDone = HandleScrollCommand(rCEvt, m_pHScroll, m_pVScroll);
1926  }
1927  }
1928  }
1929 
1930  return bDone || VclBin::EventNotify( rNEvt );
1931 }
1932 
1934 {
1935  VclBin::Paint(rRenderContext, rRect);
1936  DecorationView aDecoView(&rRenderContext);
1938 }
1939 
1940 void VclViewport::setAllocation(const Size &rAllocation)
1941 {
1942  vcl::Window *pChild = get_child();
1943  if (pChild && pChild->IsVisible())
1944  {
1945  Size aReq(getLayoutRequisition(*pChild));
1946  aReq.setWidth( std::max(aReq.Width(), rAllocation.Width()) );
1947  aReq.setHeight( std::max(aReq.Height(), rAllocation.Height()) );
1948  Point aKeepPos(pChild->GetPosPixel());
1950  {
1951  aKeepPos = Point(0, 0);
1952  m_bInitialAllocation = false;
1953  }
1954  setLayoutAllocation(*pChild, aKeepPos, aReq);
1955  }
1956 }
1957 
1959 {
1960  const WindowImpl* pWindowImpl = ImplGetWindowImpl();
1961 
1962  assert(pWindowImpl->mpFirstChild.get() == m_aEventBoxHelper.get());
1963 
1964  return pWindowImpl->mpFirstChild->GetWindow(GetWindowType::Next);
1965 }
1966 
1968 {
1969  return const_cast<vcl::Window*>(const_cast<const VclEventBox*>(this)->get_child());
1970 }
1971 
1972 void VclEventBox::setAllocation(const Size& rAllocation)
1973 {
1974  Point aChildPos(0, 0);
1975  for (vcl::Window *pChild = GetWindow(GetWindowType::FirstChild); pChild; pChild = pChild->GetWindow(GetWindowType::Next))
1976  {
1977  if (!pChild->IsVisible())
1978  continue;
1979  setLayoutAllocation(*pChild, aChildPos, rAllocation);
1980  }
1981 }
1982 
1984 {
1985  Size aRet(0, 0);
1986 
1987  for (const vcl::Window* pChild = get_child(); pChild;
1988  pChild = pChild->GetWindow(GetWindowType::Next))
1989  {
1990  if (!pChild->IsVisible())
1991  continue;
1992  Size aChildSize = getLayoutRequisition(*pChild);
1993  aRet.setWidth( std::max(aRet.Width(), aChildSize.Width()) );
1994  aRet.setHeight( std::max(aRet.Height(), aChildSize.Height()) );
1995  }
1996 
1997  return aRet;
1998 }
1999 
2001 {
2002  //discard events by default to block them reaching children
2003 }
2004 
2006 {
2007  disposeOnce();
2008 }
2009 
2011 {
2012  m_aEventBoxHelper.disposeAndClear();
2013  VclBin::dispose();
2014 }
2015 
2017 {
2018  //sufficient to trigger one widget to trigger all of them
2019  if (!m_aWindows.empty())
2020  {
2021  (*m_aWindows.begin())->queue_resize();
2022  }
2023 }
2024 
2025 void VclSizeGroup::set_ignore_hidden(bool bIgnoreHidden)
2026 {
2027  if (bIgnoreHidden != m_bIgnoreHidden)
2028  {
2029  m_bIgnoreHidden = bIgnoreHidden;
2031  }
2032 }
2033 
2035 {
2036  if (eMode != m_eMode)
2037  {
2038  m_eMode = eMode;
2040  }
2041 
2042 }
2043 
2044 void VclSizeGroup::set_property(const OString &rKey, const OUString &rValue)
2045 {
2046  if (rKey == "ignore-hidden")
2047  set_ignore_hidden(toBool(rValue));
2048  else if (rKey == "mode")
2049  {
2051  if (rValue == "none")
2052  eMode = VclSizeGroupMode::NONE;
2053  else if (rValue == "horizontal")
2055  else if (rValue == "vertical")
2057  else if (rValue == "both")
2058  eMode = VclSizeGroupMode::Both;
2059  else
2060  {
2061  SAL_WARN("vcl.layout", "unknown size group mode" << rValue);
2062  }
2063  set_mode(eMode);
2064  }
2065  else
2066  {
2067  SAL_INFO("vcl.layout", "unhandled property: " << rKey);
2068  }
2069 }
2070 
2072 {
2074 
2075  if (!m_pGrid)
2076  {
2077  VclContainer *pContainer = get_content_area();
2078  assert(pContainer);
2079 
2080  m_pGrid.set( VclPtr<VclGrid>::Create(pContainer) );
2087 
2089  switch (m_eMessageType)
2090  {
2091  case VclMessageType::Info:
2093  break;
2096  break;
2099  break;
2100  case VclMessageType::Error:
2102  break;
2103  }
2107  m_pImage->Show();
2108 
2110 
2111  bool bHasSecondaryText = !m_sSecondaryString.isEmpty();
2112 
2116 
2120 
2126  m_pSecondaryMessage->Show(bHasSecondaryText);
2127 
2128  MessageDialog::SetMessagesWidths(this, m_pPrimaryMessage, bHasSecondaryText ? m_pSecondaryMessage.get() : nullptr);
2129 
2130  VclButtonBox *pButtonBox = get_action_area();
2131  assert(pButtonBox);
2132 
2133  VclPtr<PushButton> pBtn;
2134  short nDefaultResponse = get_default_response();
2135  switch (m_eButtonsType)
2136  {
2137  case VclButtonsType::NONE:
2138  break;
2139  case VclButtonsType::Ok:
2140  pBtn.set( VclPtr<OKButton>::Create(pButtonBox) );
2141  pBtn->SetStyle(pBtn->GetStyle() & WB_DEFBUTTON);
2142  pBtn->Show();
2143  pBtn->set_id("ok");
2144  add_button(pBtn, RET_OK, true);
2145  nDefaultResponse = RET_OK;
2146  break;
2147  case VclButtonsType::Close:
2148  pBtn.set( VclPtr<CloseButton>::Create(pButtonBox) );
2149  pBtn->SetStyle(pBtn->GetStyle() & WB_DEFBUTTON);
2150  pBtn->Show();
2151  pBtn->set_id("close");
2152  add_button(pBtn, RET_CLOSE, true);
2153  nDefaultResponse = RET_CLOSE;
2154  break;
2156  pBtn.set( VclPtr<CancelButton>::Create(pButtonBox) );
2157  pBtn->SetStyle(pBtn->GetStyle() & WB_DEFBUTTON);
2158  pBtn->Show();
2159  pBtn->set_id("cancel");
2160  add_button(pBtn, RET_CANCEL, true);
2161  nDefaultResponse = RET_CANCEL;
2162  break;
2163  case VclButtonsType::YesNo:
2164  pBtn = VclPtr<PushButton>::Create(pButtonBox);
2165  pBtn->SetText(GetStandardText(StandardButtonType::Yes));
2166  pBtn->Show();
2167  pBtn->set_id("yes");
2168  add_button(pBtn, RET_YES, true);
2169 
2170  pBtn.set( VclPtr<PushButton>::Create(pButtonBox) );
2171  pBtn->SetText(GetStandardText(StandardButtonType::No));
2172  pBtn->Show();
2173  pBtn->set_id("no");
2174  add_button(pBtn, RET_NO, true);
2175  nDefaultResponse = RET_NO;
2176  break;
2178  pBtn.set( VclPtr<OKButton>::Create(pButtonBox) );
2179  pBtn->Show();
2180  pBtn->set_id("ok");
2181  add_button(pBtn, RET_OK, true);
2182 
2183  pBtn.set( VclPtr<CancelButton>::Create(pButtonBox) );
2184  pBtn->Show();
2185  pBtn->set_id("cancel");
2186  add_button(pBtn, RET_CANCEL, true);
2187  nDefaultResponse = RET_CANCEL;
2188  break;
2189  }
2190  set_default_response(nDefaultResponse);
2191  pButtonBox->sort_native_button_order();
2192  m_pMessageBox->Show();
2193  m_pGrid->Show();
2194  }
2195 }
2196 
2198 {
2199 #if defined WNT
2200  set_border_width(3);
2201 #else
2202  set_border_width(12);
2203 #endif
2210 }
2211 
2213  : Dialog(pParent, nStyle)
2214  , m_eButtonsType(VclButtonsType::NONE)
2215  , m_eMessageType(VclMessageType::Info)
2216  , m_pOwnedContentArea(nullptr)
2217  , m_pOwnedActionArea(nullptr)
2218  , m_pGrid(nullptr)
2219  , m_pMessageBox(nullptr)
2220  , m_pImage(nullptr)
2221  , m_pPrimaryMessage(nullptr)
2222  , m_pSecondaryMessage(nullptr)
2223 {
2224  SetType(WindowType::MESSBOX);
2225 }
2226 
2228  const OUString &rMessage,
2229  VclMessageType eMessageType,
2230  VclButtonsType eButtonsType)
2231  : Dialog(pParent, WB_MOVEABLE | WB_3DLOOK | WB_CLOSEABLE)
2232  , m_eButtonsType(eButtonsType)
2233  , m_eMessageType(eMessageType)
2234  , m_pGrid(nullptr)
2235  , m_pMessageBox(nullptr)
2236  , m_pImage(nullptr)
2237  , m_pPrimaryMessage(nullptr)
2238  , m_pSecondaryMessage(nullptr)
2239  , m_sPrimaryString(rMessage)
2240 {
2241  SetType(WindowType::MESSBOX);
2244 
2245  switch (m_eMessageType)
2246  {
2247  case VclMessageType::Info:
2249  break;
2252  break;
2255  break;
2256  case VclMessageType::Error:
2258  break;
2259  }
2260 }
2261 
2263 {
2272  Dialog::dispose();
2273 }
2274 
2276 {
2277  disposeOnce();
2278 }
2279 
2281  VclMultiLineEdit *pPrimaryMessage, VclMultiLineEdit *pSecondaryMessage)
2282 {
2283  if (pSecondaryMessage)
2284  {
2285  assert(pPrimaryMessage);
2286  vcl::Font aFont = pParent->GetSettings().GetStyleSettings().GetLabelFont();
2287  aFont.SetFontSize(Size(0, aFont.GetFontSize().Height() * 1.2));
2288  aFont.SetWeight(WEIGHT_BOLD);
2289  pPrimaryMessage->SetControlFont(aFont);
2290  pPrimaryMessage->SetMaxTextWidth(pPrimaryMessage->approximate_char_width() * 44);
2291  pSecondaryMessage->SetMaxTextWidth(pSecondaryMessage->approximate_char_width() * 60);
2292  }
2293  else
2294  pPrimaryMessage->SetMaxTextWidth(pPrimaryMessage->approximate_char_width() * 60);
2295 }
2296 
2297 OUString const & MessageDialog::get_primary_text() const
2298 {
2299  const_cast<MessageDialog*>(this)->setDeferredProperties();
2300 
2301  return m_sPrimaryString;
2302 }
2303 
2304 OUString const & MessageDialog::get_secondary_text() const
2305 {
2306  const_cast<MessageDialog*>(this)->setDeferredProperties();
2307 
2308  return m_sSecondaryString;
2309 }
2310 
2311 bool MessageDialog::set_property(const OString &rKey, const OUString &rValue)
2312 {
2313  if (rKey == "text")
2314  set_primary_text(rValue);
2315  else if (rKey == "secondary-text")
2316  set_secondary_text(rValue);
2317  else if (rKey == "message-type")
2318  {
2320  if (rValue == "info")
2321  eMode = VclMessageType::Info;
2322  else if (rValue == "warning")
2323  eMode = VclMessageType::Warning;
2324  else if (rValue == "question")
2325  eMode = VclMessageType::Question;
2326  else if (rValue == "error")
2327  eMode = VclMessageType::Error;
2328  else
2329  {
2330  SAL_WARN("vcl.layout", "unknown message type mode" << rValue);
2331  }
2332  m_eMessageType = eMode;
2333  }
2334  else if (rKey == "buttons")
2335  {
2337  if (rValue == "none")
2338  eMode = VclButtonsType::NONE;
2339  else if (rValue == "ok")
2340  eMode = VclButtonsType::Ok;
2341  else if (rValue == "cancel")
2342  eMode = VclButtonsType::Cancel;
2343  else if (rValue == "close")
2344  eMode = VclButtonsType::Close;
2345  else if (rValue == "yes-no")
2346  eMode = VclButtonsType::YesNo;
2347  else if (rValue == "ok-cancel")
2348  eMode = VclButtonsType::OkCancel;
2349  else
2350  {
2351  SAL_WARN("vcl.layout", "unknown buttons type mode" << rValue);
2352  }
2353  m_eButtonsType = eMode;
2354  }
2355  else
2356  return Dialog::set_property(rKey, rValue);
2357  return true;
2358 }
2359 
2360 void MessageDialog::set_primary_text(const OUString &rPrimaryString)
2361 {
2362  m_sPrimaryString = rPrimaryString;
2363  if (m_pPrimaryMessage)
2364  {
2368  }
2369 }
2370 
2371 void MessageDialog::set_secondary_text(const OUString &rSecondaryString)
2372 {
2373  m_sSecondaryString = rSecondaryString;
2374  if (m_pSecondaryMessage)
2375  {
2379  }
2380 }
2381 
2383 {
2384  Dialog::StateChanged(nType);
2385  if (nType == StateChangedType::InitShow)
2386  {
2387  // MessageBox should be at least as wide as to see the title
2388  auto nTitleWidth = CalcTitleWidth();
2389  // Extra-Width for Close button
2390  nTitleWidth += mpWindowImpl->mnTopBorder;
2391  if (get_preferred_size().Width() < nTitleWidth)
2392  {
2393  set_width_request(nTitleWidth);
2394  DoInitialLayout();
2395  }
2396  }
2397 }
2398 
2399 VclPaned::VclPaned(vcl::Window *pParent, bool bVertical)
2400  : VclContainer(pParent, WB_HIDE | WB_CLIPCHILDREN)
2401  , m_pSplitter(VclPtr<Splitter>::Create(this, bVertical ? WB_VSCROLL : WB_HSCROLL))
2402  , m_nPosition(-1)
2403 {
2404  m_pSplitter->SetBackground(Wallpaper(Application::GetSettings().GetStyleSettings().GetFaceColor()));
2405  m_pSplitter->Show();
2406 }
2407 
2409 {
2412 }
2413 
2415  : VclPaned(pParent, true)
2416 {
2417  m_pSplitter->SetSplitHdl(LINK(this, VclVPaned, SplitHdl));
2418 }
2419 
2420 IMPL_LINK(VclVPaned, SplitHdl, Splitter*, pSplitter, void)
2421 {
2422  long nSize = pSplitter->GetSplitPosPixel();
2423  Size aSplitterSize(m_pSplitter->GetSizePixel());
2424  Size aAllocation(GetSizePixel());
2425  arrange(aAllocation, nSize, aAllocation.Height() - nSize - aSplitterSize.Height());
2426 }
2427 
2428 void VclVPaned::arrange(const Size& rAllocation, long nFirstHeight, long nSecondHeight)
2429 {
2430  Size aSplitterSize(rAllocation.Width(), getLayoutRequisition(*m_pSplitter).Height());
2431  Size aFirstChildSize(rAllocation.Width(), nFirstHeight);
2432  Size aSecondChildSize(rAllocation.Width(), nSecondHeight);
2433  int nElement = 0;
2434  for (vcl::Window* pChild = GetWindow(GetWindowType::FirstChild); pChild;
2435  pChild = pChild->GetWindow(GetWindowType::Next))
2436  {
2437  if (!pChild->IsVisible())
2438  continue;
2439  if (nElement == 0)
2440  {
2441  Point aSplitterPos(0, aFirstChildSize.Height());
2442  setLayoutAllocation(*m_pSplitter, aSplitterPos, aSplitterSize);
2443  set_position(aSplitterPos.Y() + aSplitterSize.Height() / 2);
2444  }
2445  else if (nElement == 1)
2446  {
2447  Point aChildPos(0, 0);
2448  setLayoutAllocation(*pChild, aChildPos, aFirstChildSize);
2449  }
2450  else if (nElement == 2)
2451  {
2452  Point aChildPos(0, aFirstChildSize.Height() + aSplitterSize.Height());
2453  setLayoutAllocation(*pChild, aChildPos, aSecondChildSize);
2454  }
2455  ++nElement;
2456  }
2457 }
2458 
2459 void VclVPaned::setAllocation(const Size& rAllocation)
2460 {
2461  //supporting "shrink" could be done by adjusting the allowed drag rectangle
2462  m_pSplitter->SetDragRectPixel(tools::Rectangle(Point(0, 0), rAllocation));
2463  Size aSplitterSize(rAllocation.Width(), getLayoutRequisition(*m_pSplitter).Height());
2464  const long nHeight = rAllocation.Height() - aSplitterSize.Height();
2465 
2466  long nFirstHeight = 0;
2467  long nSecondHeight = 0;
2468  bool bFirstCanResize = true;
2469  bool bSecondCanResize = true;
2470  const bool bInitialAllocation = get_position() < 0;
2471  int nElement = 0;
2472  for (const vcl::Window* pChild = GetWindow(GetWindowType::FirstChild); pChild;
2473  pChild = pChild->GetWindow(GetWindowType::Next))
2474  {
2475  if (!pChild->IsVisible())
2476  continue;
2477  if (nElement == 1)
2478  {
2479  if (bInitialAllocation)
2480  nFirstHeight = getLayoutRequisition(*pChild).Height();
2481  else
2482  nFirstHeight = pChild->GetSizePixel().Height();
2483  bFirstCanResize = pChild->get_expand();
2484  }
2485  else if (nElement == 2)
2486  {
2487  if (bInitialAllocation)
2488  nSecondHeight = getLayoutRequisition(*pChild).Height();
2489  else
2490  nSecondHeight = pChild->GetSizePixel().Height();
2491  bSecondCanResize = pChild->get_expand();
2492  }
2493  ++nElement;
2494  }
2495  long nHeightRequest = nFirstHeight + nSecondHeight;
2496  long nHeightDiff = nHeight - nHeightRequest;
2497  if (bFirstCanResize == bSecondCanResize)
2498  nFirstHeight += nHeightDiff/2;
2499  else if (bFirstCanResize)
2500  nFirstHeight += nHeightDiff;
2501  arrange(rAllocation, nFirstHeight, rAllocation.Height() - nFirstHeight - aSplitterSize.Height());
2502 }
2503 
2505 {
2506  Size aRet(0, 0);
2507 
2508  for (const vcl::Window* pChild = GetWindow(GetWindowType::FirstChild); pChild;
2509  pChild = pChild->GetWindow(GetWindowType::Next))
2510  {
2511  if (!pChild->IsVisible())
2512  continue;
2513  Size aChildSize = getLayoutRequisition(*pChild);
2514  aRet.setWidth( std::max(aRet.Width(), aChildSize.Width()) );
2515  aRet.AdjustHeight(aChildSize.Height() );
2516  }
2517 
2518  return aRet;
2519 }
2520 
2522  : VclPaned(pParent, false)
2523 {
2524  m_pSplitter->SetSplitHdl(LINK(this, VclHPaned, SplitHdl));
2525 }
2526 
2527 IMPL_LINK(VclHPaned, SplitHdl, Splitter*, pSplitter, void)
2528 {
2529  long nSize = pSplitter->GetSplitPosPixel();
2530  Size aSplitterSize(m_pSplitter->GetSizePixel());
2531  Size aAllocation(GetSizePixel());
2532  arrange(aAllocation, nSize, aAllocation.Width() - nSize - aSplitterSize.Width());
2533 }
2534 
2535 void VclHPaned::arrange(const Size& rAllocation, long nFirstWidth, long nSecondWidth)
2536 {
2537  Size aSplitterSize(getLayoutRequisition(*m_pSplitter).Width(), rAllocation.Height());
2538  Size aFirstChildSize(nFirstWidth, rAllocation.Height());
2539  Size aSecondChildSize(nSecondWidth, rAllocation.Height());
2540  int nElement = 0;
2541  for (vcl::Window* pChild = GetWindow(GetWindowType::FirstChild); pChild;
2542  pChild = pChild->GetWindow(GetWindowType::Next))
2543  {
2544  if (!pChild->IsVisible())
2545  continue;
2546  if (nElement == 0)
2547  {
2548  Point aSplitterPos(aFirstChildSize.Width(), 0);
2549  setLayoutAllocation(*m_pSplitter, aSplitterPos, aSplitterSize);
2550  set_position(aSplitterPos.X() + aSplitterSize.Width() / 2);
2551  }
2552  else if (nElement == 1)
2553  {
2554  Point aChildPos(0, 0);
2555  setLayoutAllocation(*pChild, aChildPos, aFirstChildSize);
2556  }
2557  else if (nElement == 2)
2558  {
2559  Point aChildPos(aFirstChildSize.Width() + aSplitterSize.Width(), 0);
2560  setLayoutAllocation(*pChild, aChildPos, aSecondChildSize);
2561  }
2562  ++nElement;
2563  }
2564 }
2565 
2566 void VclHPaned::setAllocation(const Size& rAllocation)
2567 {
2568  //supporting "shrink" could be done by adjusting the allowed drag rectangle
2569  m_pSplitter->SetDragRectPixel(tools::Rectangle(Point(0, 0), rAllocation));
2570  Size aSplitterSize(getLayoutRequisition(*m_pSplitter).Width(), rAllocation.Height());
2571  const long nWidth = rAllocation.Width() - aSplitterSize.Width();
2572 
2573  long nFirstWidth = 0;
2574  long nSecondWidth = 0;
2575  bool bFirstCanResize = true;
2576  bool bSecondCanResize = true;
2577  const bool bInitialAllocation = get_position() < 0;
2578  int nElement = 0;
2579  for (const vcl::Window* pChild = GetWindow(GetWindowType::FirstChild); pChild;
2580  pChild = pChild->GetWindow(GetWindowType::Next))
2581  {
2582  if (!pChild->IsVisible())
2583  continue;
2584  if (nElement == 1)
2585  {
2586  if (bInitialAllocation)
2587  nFirstWidth = getLayoutRequisition(*pChild).Width();
2588  else
2589  nFirstWidth = pChild->GetSizePixel().Width();
2590  bFirstCanResize = pChild->get_expand();
2591  }
2592  else if (nElement == 2)
2593  {
2594  if (bInitialAllocation)
2595  nSecondWidth = getLayoutRequisition(*pChild).Width();
2596  else
2597  nSecondWidth = pChild->GetSizePixel().Width();
2598  bSecondCanResize = pChild->get_expand();
2599  }
2600  ++nElement;
2601  }
2602  long nWidthRequest = nFirstWidth + nSecondWidth;
2603  long nWidthDiff = nWidth - nWidthRequest;
2604  if (bFirstCanResize == bSecondCanResize)
2605  nFirstWidth += nWidthDiff/2;
2606  else if (bFirstCanResize)
2607  nFirstWidth += nWidthDiff;
2608  arrange(rAllocation, nFirstWidth, rAllocation.Width() - nFirstWidth - aSplitterSize.Width());
2609 }
2610 
2612 {
2613  Size aRet(0, 0);
2614 
2615  for (const vcl::Window* pChild = GetWindow(GetWindowType::FirstChild); pChild;
2616  pChild = pChild->GetWindow(GetWindowType::Next))
2617  {
2618  if (!pChild->IsVisible())
2619  continue;
2620  Size aChildSize = getLayoutRequisition(*pChild);
2621  aRet.setHeight( std::max(aRet.Height(), aChildSize.Height()) );
2622  aRet.AdjustWidth(aChildSize.Width() );
2623  }
2624 
2625  return aRet;
2626 }
2627 
2629 {
2630  tools::Rectangle aBounds;
2631 
2632  for (const vcl::Window* pChild = rWindow.GetWindow(GetWindowType::FirstChild); pChild;
2633  pChild = pChild->GetWindow(GetWindowType::Next))
2634  {
2635  if (!pChild->IsVisible())
2636  continue;
2637 
2638  tools::Rectangle aChildBounds(pChild->GetPosPixel(), pChild->GetSizePixel());
2639  aBounds.Union(aChildBounds);
2640  }
2641 
2642  if (aBounds.IsEmpty())
2643  return rWindow.GetSizePixel();
2644 
2645  Size aRet(aBounds.GetSize());
2646  Point aTopLeft(aBounds.TopLeft());
2647  aRet.AdjustWidth(aTopLeft.X()*2 );
2648  aRet.AdjustHeight(aTopLeft.Y()*2 );
2649 
2650  return aRet;
2651 }
2652 
2654 {
2655  while (pWindow)
2656  {
2657  pWindow = pWindow->GetParent();
2658  if (!pWindow || !isContainerWindow(*pWindow))
2659  break;
2660  }
2661  return pWindow;
2662 }
2663 
2664 bool isVisibleInLayout(const vcl::Window *pWindow)
2665 {
2666  bool bVisible = true;
2667  while (bVisible)
2668  {
2669  bVisible = pWindow->IsVisible();
2670  pWindow = pWindow->GetParent();
2671  if (!pWindow || !isContainerWindow(*pWindow))
2672  break;
2673  }
2674  return bVisible;
2675 }
2676 
2677 bool isEnabledInLayout(const vcl::Window *pWindow)
2678 {
2679  bool bEnabled = true;
2680  while (bEnabled)
2681  {
2682  bEnabled = pWindow->IsEnabled();
2683  pWindow = pWindow->GetParent();
2684  if (!pWindow || !isContainerWindow(*pWindow))
2685  break;
2686  }
2687  return bEnabled;
2688 }
2689 
2690 bool isLayoutEnabled(const vcl::Window *pWindow)
2691 {
2692  //Child is a container => we're layout enabled
2693  const vcl::Window *pChild = pWindow ? pWindow->GetWindow(GetWindowType::FirstChild) : nullptr;
2694  return pChild && isContainerWindow(*pChild) && !pChild->GetWindow(GetWindowType::Next);
2695 }
2696 
2698 {
2699  if (m_aStartDragHdl.Call(this))
2700  return;
2701 
2703  if (!m_xTransferHelper.is())
2704  return;
2705 
2706  xContainer->StartDrag(this, m_nDragAction);
2707 }
2708 
2709 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual Point GetPosPixel() const
Definition: window.cxx:2803
virtual void SetText(const OUString &rStr)
Definition: window.cxx:3027
virtual boost::property_tree::ptree DumpAsPropertyTree() override
Dumps itself and potentially its children to a property tree, to be written easily to JSON...
Definition: layout.cxx:358
Point TopLeft() const
long Width() const
virtual sal_uInt16 getDefaultAccessibleRole() const override
Definition: layout.cxx:36
Image const & GetStandardInfoBoxImage()
Definition: stdtext.cxx:49
virtual bool set_property(const OString &rKey, const OUString &rValue) override
Definition: layout.cxx:2311
bool m_bColumnHomogeneous
Definition: layout.hxx:310
SAL_DLLPRIVATE float approximate_char_width() const
Definition: text.cxx:903
virtual void setAllocation(const Size &rAllocation)=0
int get_column_spacing() const
Definition: layout.hxx:354
void SetDragRectPixel(const tools::Rectangle &rDragRect, vcl::Window *pRefWin=nullptr)
Definition: split.cxx:445
virtual bool set_property(const OString &rKey, const OUString &rValue) override
Definition: layout.cxx:1318
sal_Int32 get_padding() const
Definition: window2.cxx:1738
void setDeferredProperties()
Definition: builder.hxx:482
static VclGrid::Value accumulateValues(const VclGrid::Value &i, const VclGrid::Value &j)
Definition: layout.cxx:1115
virtual void SetPosPixel(const Point &rAllocPos) override
Definition: layout.cxx:149
virtual bool set_property(const OString &rKey, const OUString &rValue) override
Definition: layout.cxx:1890
static void setLayoutAllocation(vcl::Window &rWindow, const Point &rPos, const Size &rSize)
Definition: layout.cxx:58
Image const & GetStandardWarningBoxImage()
Definition: stdtext.cxx:60
void sort_native_button_order()
Definition: layout.cxx:787
void SetFontSize(const Size &)
Definition: font/font.cxx:117
bool get_vexpand() const
Definition: window2.cxx:1702
bool bVisible
bool isVisibleInLayout(const vcl::Window *pWindow)
Definition: layout.cxx:2664
void InitScrollBars(const Size &rRequest)
Definition: layout.cxx:1753
WinBits const WB_NOLABEL
VclPtr< ScrollBar > m_pHScroll
Definition: layout.hxx:527
void set_border_width(sal_Int32 nBorderWidth)
Definition: window2.cxx:1810
virtual void dispose() override
This is intended to be used to clear any locally held references to other Window-subclass objects...
Definition: layout.cxx:2408
virtual bool set_property(const OString &rKey, const OUString &rValue) override
Definition: layout.cxx:1644
sal_Int32 m_nTopPadding
Definition: layout.hxx:459
OUString const & get_secondary_text() const
Definition: layout.cxx:2304
static void SetMessagesWidths(vcl::Window const *pParent, VclMultiLineEdit *pPrimaryMessage, VclMultiLineEdit *pSecondaryMessage)
Definition: layout.cxx:2280
sal_Int32 get_margin_bottom() const
Definition: window2.cxx:1880
long AdjustWidth(long n)
void designate_label(vcl::Window *pWindow)
Definition: layout.cxx:1425
VclButtonsType
Definition: vclenum.hxx:243
long AdjustX(long nHorzMove)
static array_type assembleGrid(const VclGrid &rGrid)
Definition: layout.cxx:829
VclBox * get_content_area()
Definition: dialog.hxx:110
void create_message_area()
Definition: layout.cxx:2071
virtual Size GetOptimalSize() const override
Definition: layout.cxx:41
virtual void setAllocation(const Size &rAllocation) override
Definition: layout.cxx:1395
const CommandEvent * GetCommandEvent() const
Definition: event.hxx:318
std::unique_ptr< ContentProperties > pData
virtual void setSecondaryDimension(Size &rSize, long) const =0
VclPtr< vcl::Window > m_pLabel
Definition: layout.hxx:415
void set_grid_left_attach(sal_Int32 nAttach)
Definition: window2.cxx:1780
virtual void setAllocation(const Size &rAllocation) override
Definition: layout.cxx:598
uno::Type const m_aType
OUString GetStandardText(StandardButtonType eButton)
Definition: stdtext.cxx:93
long Height() const
signed char sal_Int8
bool m_bVerticalContainer
Definition: layout.hxx:71
void Create(SwFormatVertOrient &rItem, SvStream &rStrm, sal_uInt16 nVersionAbusedAsSize)
OUString GetStandardErrorBoxText()
Definition: stdtext.cxx:77
VclPtr< DisclosureButton > m_pDisclosureButton
Definition: layout.hxx:496
virtual void StateChanged(StateChangedType nType) override
Definition: layout.cxx:2382
bool get_hexpand() const
Definition: window2.cxx:1690
static Size getLayoutRequisition(const vcl::Window &rWindow)
Definition: layout.cxx:133
OUString const & get_primary_text() const
Definition: layout.cxx:2297
VclPtr< VclMultiLineEdit > m_pSecondaryMessage
void disposeAndClear()
Definition: vclptr.hxx:200
const StyleSettings & GetStyleSettings() const
static const AllSettings & GetSettings()
Gets the application's settings.
Definition: svapp.cxx:705
SAL_DLLPRIVATE void disposeOwnedButtons()
Definition: dialog.cxx:376
VclPtr< VclVBox > m_pMessageBox
void DrawFrame(const tools::Rectangle &rRect, const Color &rLeftTopColor, const Color &rRightBottomColor)
Definition: decoview.cxx:848
VclButtonsType m_eButtonsType
virtual Size GetSizePixel() const
Definition: window.cxx:2365
virtual void setAllocation(const Size &rAllocation) override
Definition: layout.cxx:1514
void EnableCursor(bool bEnable)
Definition: vclmedit.cxx:1510
SAL_DLLPRIVATE WindowImpl * ImplGetWindowImpl() const
Definition: window.hxx:555
void SetWeight(FontWeight)
Definition: font/font.cxx:215
virtual boost::property_tree::ptree DumpAsPropertyTree() override
Dumps itself and potentially its children to a property tree, to be written easily to JSON...
Definition: layout.cxx:1306
bool m_bRowHomogeneous
Definition: layout.hxx:309
WinBits const WB_AUTOVSCROLL
void set_row_spacing(int nSpacing)
Definition: layout.hxx:342
virtual Size calculateRequisition() const override
Definition: layout.cxx:1375
VclPtr< VclBox > m_pOwnedContentArea
void set_spacing(int nSpacing)
Definition: layout.hxx:81
virtual vcl::Window * get_child() override
Definition: layout.cxx:1464
WinBits const WB_VSCROLL
Info
const CommandWheelData * GetWheelData() const
bool m_bExpand
Definition: layout.hxx:318
VclButtonBoxStyle
Definition: layout.hxx:191
virtual void dispose() override
This is intended to be used to clear any locally held references to other Window-subclass objects...
Definition: window.cxx:141
void SetType(WindowType nType)
Definition: window2.cxx:963
virtual void dispose() override
This is intended to be used to clear any locally held references to other Window-subclass objects...
Definition: layout.cxx:1696
virtual void setAllocation(const Size &rAllocation) override
Definition: layout.cxx:1591
float x
bool HandleScrollCommand(const CommandEvent &rCmd, ScrollBar *pHScrl, ScrollBar *pVScrl)
Definition: window2.cxx:609
long AdjustHeight(long n)
VclContainer(vcl::Window *pParent, WinBits nStyle=WB_HIDE|WB_CLIPCHILDREN)
Definition: layout.cxx:26
bool get_fill() const
Definition: window2.cxx:1750
static const OUString & GetDesktopEnvironment()
Get the desktop environment the process is currently running in.
Definition: svapp.cxx:1565
void create_owned_areas()
Definition: layout.cxx:2197
NONE
virtual bool getPrimaryDimensionChildExpand(const vcl::Window &rWindow) const =0
OUString GetStandardQueryBoxText()
Definition: stdtext.cxx:88
WEIGHT_BOLD
bool IsEmpty() const
StateChangedType
Definition: window.hxx:311
const sal_uInt8 A
virtual vcl::Window * get_child()
Definition: layout.cxx:1342
rtl::Reference< TransferDataContainer > m_xTransferHelper
Definition: layout.hxx:639
OUString GetAccessibleName() const
sal_Int64 WinBits
virtual void dispose() override
This is intended to be used to clear any locally held references to other Window-subclass objects...
Definition: layout.cxx:2010
sal_Int32 get_margin_right() const
Definition: window2.cxx:1848
void SetBackground()
void SetControlFont()
Definition: window2.cxx:409
virtual void dispose() override
This is intended to be used to clear any locally held references to other Window-subclass objects...
Definition: dialog.cxx:608
std::set< VclPtr< vcl::Window > > m_aWindows
Definition: layout.hxx:593
virtual void dispose() override
This is intended to be used to clear any locally held references to other Window-subclass objects...
Definition: layout.cxx:1367
bool m_bLayoutDirty
Definition: layout.hxx:64
void set_ignore_hidden(bool bIgnoreHidden)
Definition: layout.cxx:2025
const vcl::Font & GetLabelFont() const
virtual Size calculateRequisition() const =0
WinBits const WB_DEFBUTTON
enumrange< T >::Iterator begin(enumrange< T >)
Size addSpacing(const Size &rSize, sal_uInt16 nVisibleChildren) const
Definition: layout.cxx:549
WinBits const WB_VERT
VclMessageType m_eMessageType
WinBits const WB_HSCROLL
bool IsMouseEvent() const
boost::multi_array< GridEntry, 2 > array_type
Definition: layout.cxx:823
virtual boost::property_tree::ptree DumpAsPropertyTree() override
Dumps itself and potentially its children to a property tree, to be written easily to JSON...
Definition: layout.cxx:1491
void reorderWithinParent(vcl::Window &rWindow, sal_uInt16 nNewPosition)
Definition: builder.cxx:2530
void Hide()
Definition: window.hxx:934
virtual long getPrimaryDimension(const Size &rSize) const =0
VclSizeGroupMode
Definition: vclenum.hxx:261
VclPtr< vcl::Window > mpLastChild
Definition: window.h:234
void set_default_response(int nResponse)
Definition: dialog.cxx:1472
virtual Size calculateRequisition() const override
Definition: layout.cxx:1347
Mode eMode
sal_Int8 m_nDragAction
Definition: layout.hxx:640
virtual long getSecondaryDimension(const Size &rSize) const =0
static bool compareValues(const VclGrid::Value &i, const VclGrid::Value &j)
Definition: layout.cxx:1110
void set_width_request(sal_Int32 nWidthRequest)
Definition: window2.cxx:1599
virtual OUString GetText() const
Definition: window.cxx:3056
void set_mode(VclSizeGroupMode eMode)
Definition: layout.cxx:2034
VclMessageType
Definition: vclenum.hxx:253
virtual void Command(const CommandEvent &rCEvt) override
Definition: layout.cxx:2000
void * GetEventData() const
void setY(long nY)
std::vector< long > m_aMainGroupDimensions
Definition: layout.hxx:219
bool get_secondary() const
Definition: window2.cxx:1898
WinBits const WB_HIDE
sal_Int32 m_nLeftPadding
Definition: layout.hxx:457
Link< VclDrawingArea *, bool > m_aStartDragHdl
Definition: layout.hxx:651
bool m_bResizeTopLevel
Definition: layout.hxx:495
bool isContainerWindow(const vcl::Window &rWindow)
Definition: layout.hxx:840
float y
sal_Int32 get_margin_left() const
Definition: window2.cxx:1832
bool mbInDispose
Definition: window.h:316
Size getLegacyBestSizeForChildren(const vcl::Window &rWindow)
Definition: layout.cxx:2628
virtual boost::property_tree::ptree DumpAsPropertyTree()
Dumps itself and potentially its children to a property tree, to be written easily to JSON...
Definition: window.cxx:3353
const OString & GetHelpId() const
Definition: window2.cxx:828
Size finalizeMaxes(const Size &rSize, sal_uInt16 nVisibleChildren) const
Definition: layout.cxx:379
virtual Size calculateRequisition() const override
Definition: layout.cxx:2504
void clear()
Definition: vclptr.hxx:190
bool isEnabledInLayout(const vcl::Window *pWindow)
Definition: layout.cxx:2677
void arrange(const Size &rAllocation, long nFirstHeight, long nSecondHeight)
Definition: layout.cxx:2535
virtual bool set_property(const OString &rKey, const OUString &rValue) override
Definition: dialog.cxx:1330
virtual ~VclFrame() override
Definition: layout.cxx:1362
VclPackType
Definition: vclenum.hxx:221
virtual void setAllocation(const Size &rAllocation) override
Definition: layout.cxx:236
virtual bool EventNotify(NotifyEvent &rNEvt)
Definition: event.cxx:103
void set_property(const OString &rKey, const OUString &rValue)
Definition: layout.cxx:2044
VclPtr< ScrollBarBox > m_aScrollBarBox
Definition: layout.hxx:528
long AdjustY(long nVertMove)
VclPtr< VclButtonBox > m_pOwnedActionArea
void SetMaxTextWidth(long nMaxWidth)
Definition: vclmedit.cxx:1099
DrawFrameStyle m_eDrawFrameStyle
Definition: layout.hxx:525
VclPtr< ScrollBar > m_pVScroll
Definition: layout.hxx:526
virtual bool EventNotify(NotifyEvent &rNEvt) override
Definition: layout.cxx:1914
int get_default_response() const
Definition: dialog.cxx:1432
bool m_bIgnoreHidden
Definition: layout.hxx:594
void SetRangeMax(long nNewRange)
Definition: scrbar.cxx:1334
virtual void SetText(const OUString &rStr) override
Definition: ctrl.cxx:95
virtual void setAllocation(const Size &rAllocation) override
Definition: layout.cxx:2459
void SetVisibleSize(long nNewSize)
Definition: scrbar.cxx:1378
void SetSplitHdl(const Link< Splitter *, void > &rLink)
Definition: split.hxx:99
OUString get_label() const
Definition: layout.cxx:1476
int i
CommandWheelMode GetMode() const
WinBits const WB_VCENTER
virtual void setPrimaryDimension(Size &rSize, long) const =0
virtual void SetSizePixel(const Size &rAllocation) override
Definition: layout.cxx:160
sal_Int32 get_margin_top() const
Definition: window2.cxx:1864
virtual bool set_property(const OString &rKey, const OUString &rValue) override
Definition: layout.cxx:1529
#define DEFAULT_CHILD_MIN_WIDTH
Definition: layout.cxx:376
virtual sal_uInt16 getDefaultAccessibleRole() const override
Definition: layout.cxx:365
Size calculateRequisitionForSpacings(sal_Int32 nRowSpacing, sal_Int32 nColSpacing) const
Definition: layout.cxx:1128
Requisition calculatePrimarySecondaryRequisitions() const
Definition: layout.cxx:450
Image const & GetStandardErrorBoxImage()
Definition: stdtext.cxx:71
Some things multiple-inherit from VclAbstractDialog and OutputDevice, so we need to use virtual inher...
Definition: outdev.hxx:304
CommandEventId GetCommand() const
virtual void setAllocation(const Size &rAllocation) override
Definition: layout.cxx:1168
sal_uInt16 GetModifier() const
virtual void Command(const CommandEvent &rCEvt) override
Definition: layout.cxx:183
bool IsChecked() const
Definition: button.hxx:482
void add_button(PushButton *pButton, int nResponse, bool bTransferOwnership)
Definition: dialog.cxx:1362
std::unique_ptr< WindowImpl > mpWindowImpl
Definition: window.hxx:511
const Size & GetFontSize() const
Definition: font/font.cxx:673
Size get_preferred_size() const
Definition: window2.cxx:1635
VclSizeGroupMode m_eMode
Definition: layout.hxx:595
bool isLayoutEnabled(const vcl::Window *pWindow)
Definition: layout.cxx:2690
MouseNotifyEvent GetType() const
Definition: event.hxx:294
void SetPageSize(long nNewSize)
Definition: scrbar.hxx:125
VclPtr< FixedImage > m_pImage
virtual bool set_property(const OString &rKey, const OUString &rValue) override
Definition: layout.cxx:572
void set_homogeneous(bool bHomogeneous)
Definition: layout.hxx:89
virtual void dispose() override
This is intended to be used to clear any locally held references to other Window-subclass objects...
Definition: layout.cxx:1544
const AllSettings & GetSettings() const
Definition: outdev.hxx:420
virtual Size calculateRequisition() const override
Definition: layout.cxx:564
void SetPaintTransparent(bool bTransparent)
Definition: paint.cxx:1022
Size GetOutputSizePixel() const
Definition: outdev.hxx:441
void SetImage(const Image &rImage)
Definition: fixed.cxx:933
VclPtr< Splitter > m_pSplitter
Definition: layout.hxx:377
bool get_row_homogeneous() const
Definition: layout.hxx:334
virtual bool set_property(const OString &rKey, const OUString &rValue)
Definition: window2.cxx:1427
static void setLayoutPosSize(vcl::Window &rWindow, const Point &rPos, const Size &rSize)
Definition: layout.cxx:46
void reorderWithinParent(sal_uInt16 nNewPosition)
Definition: stacking.cxx:162
VclPackType get_pack_type() const
Definition: window2.cxx:1726
long GetTextHeight() const
Height where any character of the current font fits; in logic coordinates.
Definition: text.cxx:890
vcl::Window * GetParent() const
Definition: window2.cxx:1092
WinBits const WB_LEFT
long X() const
void SetStyle(WinBits nStyle)
Definition: window.cxx:1926
Size GetSize() const
enumrange< T >::Iterator end(enumrange< T >)
void setOptimalLayoutSize()
Definition: syswin.cxx:1117
void Scroll()
Definition: scrbar.cxx:1294
virtual void SetPosSizePixel(const Point &rNewPos, const Size &rNewSize)
Definition: window2.cxx:1263
vcl::Window * GetWindow(GetWindowType nType) const
Definition: stacking.cxx:1046
void arrange(const Size &rAllocation, long nFirstHeight, long nSecondHeight)
Definition: layout.cxx:2428
DrawFrameStyle
Definition: vclenum.hxx:329
Size getVisibleChildSize() const
Definition: layout.cxx:1878
const Point & GetMousePosPixel() const
virtual Size calculateRequisition() const override
Definition: layout.cxx:2611
void set_grid_top_attach(sal_Int32 nAttach)
Definition: window2.cxx:1804
bool m_bInitialAllocation
Definition: layout.hxx:541
SAL_DLLPRIVATE void ImplInit(vcl::Window *pParent, WinBits nStyle, SystemParentData *pSystemParentData)
Definition: window.cxx:932
#define DEFAULT_CHILD_MIN_HEIGHT
Definition: layout.cxx:377
WinBits const WB_3DLOOK
virtual void setAllocation(const Size &rAllocation) override
Definition: layout.cxx:1972
VclScrolledWindow(vcl::Window *pParent)
Definition: layout.cxx:1681
VclButtonBox * get_action_area()
Definition: dialog.hxx:109
void set_id(const OUString &rID)
Sets an ID.
Definition: window.cxx:3877
long CalcTitleWidth() const
Definition: window.cxx:2012
VclPtr< VclGrid > m_pGrid
void AddEventListener(const Link< VclWindowEvent &, void > &rEventListener)
Definition: event.cxx:302
void set_valign(VclAlign eAlign)
Definition: window2.cxx:1684
virtual void setAllocation(const Size &rAllocation) override
Definition: layout.cxx:1355
sal_uInt16 GetChildCount() const
Definition: stacking.cxx:1012
static std::vector< long > setButtonSizes(const std::vector< long > &rG, const std::vector< bool > &rNonHomogeneous, long nAvgDimension, long nMaxNonOutlier, long nMinWidth)
Definition: layout.cxx:425
virtual void StateChanged(StateChangedType nStateChange) override
Definition: dialog.cxx:734
OUString GetStandardInfoBoxText()
Definition: stdtext.cxx:55
virtual ~MessageDialog() override
Definition: layout.cxx:2275
virtual vcl::Window * get_child() override
Definition: layout.cxx:1728
virtual vcl::Window * get_child() override
Definition: layout.cxx:1967
VclVPaned(vcl::Window *pParent)
Definition: layout.cxx:2414
sal_Int32 m_nPosition
void set_hexpand(bool bExpand)
Definition: window2.cxx:1696
WindowType
virtual Size calculateRequisition() const override
Definition: layout.cxx:1733
tools::Rectangle & Union(const tools::Rectangle &rRect)
bool get_column_homogeneous() const
Definition: layout.hxx:338
void set_expanded(bool bExpanded)
Definition: layout.hxx:482
int m_nSpacing
Definition: layout.hxx:72
virtual void setAllocation(const Size &rAllocation) override
Definition: layout.cxx:1940
virtual long getPrimaryCoordinate(const Point &rPos) const =0
Size addReqGroups(const VclButtonBox::Requisition &rReq) const
Definition: layout.cxx:395
vcl::Window * get_label_widget()
Definition: layout.cxx:1447
bool IsVisible() const
Definition: window2.cxx:1097
virtual vcl::Window * get_child() override
Definition: layout.cxx:1559
#define SAL_INFO(area, stream)
virtual void setAllocation(const Size &rAllocation) override
Definition: layout.cxx:1873
virtual void StartDrag(sal_Int8 nAction, const Point &rPosPixel) override
Definition: layout.cxx:2697
VclPtr< EventBoxHelper > m_aEventBoxHelper
Definition: layout.hxx:572
void set_column_spacing(int nSpacing)
Definition: layout.hxx:346
virtual Size calculateRequisition() const override
Definition: layout.cxx:1983
void EnableChildTransparentMode(bool bEnable=true)
Definition: window2.cxx:1017
virtual OUString getDefaultAccessibleName() const override
Definition: layout.cxx:1483
virtual void dispose() override
This is intended to be used to clear any locally held references to other Window-subclass objects...
Definition: layout.cxx:2262
VclPtr< VclMultiLineEdit > m_pPrimaryMessage
virtual void SetText(const OUString &rStr) override
Definition: syswin.cxx:1101
void SetScrollHdl(const Link< ScrollBar *, void > &rLink)
Definition: scrbar.hxx:133
static VclPtr< reference_type > Create(Arg &&...arg)
A construction helper for VclPtr.
Definition: vclptr.hxx:127
virtual void setPrimaryCoordinate(Point &rPos, long) const =0
virtual Size calculateRequisition() const override
Definition: layout.cxx:1564
virtual void set_content_area(VclBox *pBox)
Definition: dialog.cxx:590
virtual void Paint(vcl::RenderContext &rRenderContext, const tools::Rectangle &rRect)
Definition: paint.cxx:1017
void set_action_area(VclButtonBox *pBox)
Definition: dialog.cxx:579
virtual Size calculateRequisition() const override
Definition: layout.cxx:1123
VclAlign get_valign() const
Definition: window2.cxx:1678
MessageDialog(vcl::Window *pParent, WinBits nStyle)
Definition: layout.cxx:2212
WinBits const WB_AUTOHSCROLL
void set(reference_type *pBody)
Definition: vclptr.hxx:148
VclPtr< vcl::Window > mpFirstChild
Definition: window.h:233
virtual ~VclEventBox() override
Definition: layout.cxx:2005
virtual OUString getDefaultAccessibleName() const
WinBits const WB_TABSTOP
std::vector< long > m_aSubGroupDimensions
Definition: layout.hxx:220
IMPL_LINK(VclFrame, WindowEventListener, VclWindowEvent &, rEvent, void)
Definition: layout.cxx:1419
sal_Int32 m_nRightPadding
Definition: layout.hxx:458
vcl::Window * getNonLayoutParent(vcl::Window *pWindow)
Definition: layout.cxx:2653
virtual void SetPosSizePixel(const Point &rNewPos, const Size &rNewSize) override
Definition: layout.cxx:138
virtual void StateChanged(StateChangedType nStateChange)
Definition: window.cxx:1904
void doSetAllocation(const Size &rAllocation, bool bRetryOnFailure)
Definition: layout.cxx:1773
VclAlign
Definition: vclenum.hxx:213
WinBits const WB_CENTER
OUString GetStandardWarningBoxText()
Definition: stdtext.cxx:66
void set_secondary_text(const OUString &rSecondaryString)
Definition: layout.cxx:2371
reference_type * get() const
Get the body.
Definition: vclptr.hxx:143
bool IsEnabled() const
Definition: window2.cxx:1117
#define SAL_WARN(area, stream)
void RemoveEventListener(const Link< VclWindowEvent &, void > &rEventListener)
Definition: event.cxx:307
virtual Size calculateRequisition() const override
Definition: layout.cxx:214
virtual void setAllocation(const Size &rAllocation) override
Definition: layout.cxx:2566
WinBits GetStyle() const
Definition: window2.cxx:948
OUString m_sPrimaryString
void set_primary_text(const OUString &rPrimaryString)
Definition: layout.cxx:2360
static int getButtonPriority(const OString &rType)
Definition: layout.cxx:697
static long getMaxNonOutlier(const std::vector< long > &rG, long nAvgDimension)
Definition: layout.cxx:411
long get_position() const
Definition: layout.hxx:384
WinBits const WB_CLOSEABLE
void set_position(long nPosition)
Definition: layout.hxx:385
WinBits const WB_MOVEABLE
virtual void queue_resize(StateChangedType eReason=StateChangedType::Layout) override
Definition: layout.cxx:176
Image const & GetStandardQueryBoxImage()
Definition: stdtext.cxx:82
void accumulateMaxes(const Size &rChildSize, Size &rSize) const
Definition: layout.cxx:200
virtual void StateChanged(StateChangedType nType) override
Definition: layout.cxx:1655
int get_row_spacing() const
Definition: layout.hxx:350
WinBits const WB_HORZ
bool m_bUserManagedScrolling
Definition: layout.hxx:524
void setWidth(long nWidth)
bool m_bHomogeneous
Definition: layout.hxx:70
void set_label(const OUString &rLabel)
Definition: layout.cxx:1469
WinBits const WB_CLIPCHILDREN
WinBits const WB_NOTABSTOP
virtual void Paint(vcl::RenderContext &rRenderContext, const tools::Rectangle &rRect) override
Definition: layout.cxx:1933
virtual void SetPosPixel(const Point &rNewPos)
Definition: window2.cxx:1252
IMPL_LINK_NOARG(VclScrolledWindow, ScrollBarHdl, ScrollBar *, void)
Definition: layout.cxx:1704
VclButtonBoxStyle m_eLayoutStyle
Definition: layout.hxx:216
virtual void SetText(const OUString &rStr) override
Definition: vclmedit.cxx:1144
sal_Int32 get_border_width() const
Definition: window2.cxx:1816
sal_Int32 m_nBottomPadding
Definition: layout.hxx:456
VclPaned(vcl::Window *pParent, bool bVertical)
Definition: layout.cxx:2399
SAL_DLLPRIVATE void DoInitialLayout()
Definition: syswin.cxx:1138
long Y() const
void trigger_queue_resize()
Definition: layout.cxx:2016
VclHPaned(vcl::Window *pParent)
Definition: layout.cxx:2521
static bool isNullGrid(const array_type &A)
Definition: layout.cxx:984
VclAlign get_halign() const
Definition: window2.cxx:1666
static void calcMaxs(const array_type &A, std::vector< VclGrid::Value > &rWidths, std::vector< VclGrid::Value > &rHeights)
Definition: layout.cxx:992
OUString m_sSecondaryString
void Show(bool bVisible=true, ShowFlags nFlags=ShowFlags::NONE)
Definition: window.cxx:2151
bool toBool(const OUString &rValue)
Definition: layout.cxx:1313
virtual bool set_property(const OString &rKey, const OUString &rValue) override
Definition: layout.cxx:347
virtual Size calculateRequisition() const override
Definition: layout.cxx:1498
void setHeight(long nHeight)