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 
688 {
689  const char* m_aType;
690  int const m_nPriority;
691 };
692 
693 static int getButtonPriority(const OString &rType)
694 {
695  static const size_t N_TYPES = 6;
696  static const ButtonOrder aDiscardCancelSave[N_TYPES] =
697  {
698  { "/discard", 0 },
699  { "/cancel", 1 },
700  { "/no", 2 },
701  { "/save", 3 },
702  { "/yes", 3 },
703  { "/ok", 3 }
704  };
705 
706  static const ButtonOrder aSaveDiscardCancel[N_TYPES] =
707  {
708  { "/save", 0 },
709  { "/yes", 0 },
710  { "/ok", 0 },
711  { "/discard", 1 },
712  { "/no", 1 },
713  { "/cancel", 2 }
714  };
715 
716  const ButtonOrder* pOrder = &aDiscardCancelSave[0];
717 
718  const OUString &rEnv = Application::GetDesktopEnvironment();
719 
720  if (rEnv.equalsIgnoreAsciiCase("windows") ||
721  rEnv.equalsIgnoreAsciiCase("tde") ||
722  rEnv.startsWithIgnoreAsciiCase("kde"))
723  {
724  pOrder = &aSaveDiscardCancel[0];
725  }
726 
727  for (size_t i = 0; i < N_TYPES; ++i, ++pOrder)
728  {
729  if (rType.endsWith(pOrder->m_aType))
730  return pOrder->m_nPriority;
731  }
732 
733  return -1;
734 }
735 
737 {
739 public:
740  explicit sortButtons(bool bVerticalContainer)
741  : m_bVerticalContainer(bVerticalContainer)
742  {
743  }
744  bool operator()(const vcl::Window *pA, const vcl::Window *pB) const;
745 };
746 
747 bool sortButtons::operator()(const vcl::Window *pA, const vcl::Window *pB) const
748 {
749  //sort into two groups of pack start and pack end
750  VclPackType ePackA = pA->get_pack_type();
751  VclPackType ePackB = pB->get_pack_type();
752  if (ePackA < ePackB)
753  return true;
754  if (ePackA > ePackB)
755  return false;
756  bool bPackA = pA->get_secondary();
757  bool bPackB = pB->get_secondary();
759  {
760  //for horizontal boxes group secondaries before primaries
761  if (bPackA > bPackB)
762  return true;
763  if (bPackA < bPackB)
764  return false;
765  }
766  else
767  {
768  //for vertical boxes group secondaries after primaries
769  if (bPackA < bPackB)
770  return true;
771  if (bPackA > bPackB)
772  return false;
773  }
774 
775  //now order within groups according to platform rules
777 }
778 
780 {
781  std::vector<vcl::Window*> aChilds;
782  for (vcl::Window* pChild = GetWindow(GetWindowType::FirstChild); pChild;
783  pChild = pChild->GetWindow(GetWindowType::Next))
784  {
785  aChilds.push_back(pChild);
786  }
787 
788  //sort child order within parent so that we match the platform
789  //button order
790  std::stable_sort(aChilds.begin(), aChilds.end(), sortButtons(m_bVerticalContainer));
791  BuilderUtils::reorderWithinParent(aChilds, true);
792 }
793 
794 struct GridEntry
795 {
797  sal_Int32 nSpanWidth;
798  sal_Int32 nSpanHeight;
799  int x;
800  int y;
802  : pChild(nullptr)
803  , nSpanWidth(0)
804  , nSpanHeight(0)
805  , x(-1)
806  , y(-1)
807  {
808  }
809 };
810 
811 typedef boost::multi_array<GridEntry, 2> array_type;
812 
813 static array_type assembleGrid(const VclGrid &rGrid);
814 static bool isNullGrid(const array_type& A);
815 static void calcMaxs(const array_type &A, std::vector<VclGrid::Value> &rWidths, std::vector<VclGrid::Value> &rHeights);
816 
817 array_type assembleGrid(const VclGrid &rGrid)
818 {
819  array_type A;
820 
821  for (vcl::Window* pChild = rGrid.GetWindow(GetWindowType::FirstChild); pChild;
822  pChild = pChild->GetWindow(GetWindowType::Next))
823  {
824  sal_Int32 nLeftAttach = std::max<sal_Int32>(pChild->get_grid_left_attach(), 0);
825  sal_Int32 nWidth = pChild->get_grid_width();
826  sal_Int32 nMaxXPos = nLeftAttach+nWidth-1;
827 
828  sal_Int32 nTopAttach = std::max<sal_Int32>(pChild->get_grid_top_attach(), 0);
829  sal_Int32 nHeight = pChild->get_grid_height();
830  sal_Int32 nMaxYPos = nTopAttach+nHeight-1;
831 
832  sal_Int32 nCurrentMaxXPos = A.shape()[0]-1;
833  sal_Int32 nCurrentMaxYPos = A.shape()[1]-1;
834  if (nMaxXPos > nCurrentMaxXPos || nMaxYPos > nCurrentMaxYPos)
835  {
836  nCurrentMaxXPos = std::max(nMaxXPos, nCurrentMaxXPos);
837  nCurrentMaxYPos = std::max(nMaxYPos, nCurrentMaxYPos);
838  A.resize(boost::extents[nCurrentMaxXPos+1][nCurrentMaxYPos+1]);
839  }
840 
841  GridEntry &rEntry = A[nLeftAttach][nTopAttach];
842  rEntry.pChild = pChild;
843  rEntry.nSpanWidth = nWidth;
844  rEntry.nSpanHeight = nHeight;
845  rEntry.x = nLeftAttach;
846  rEntry.y = nTopAttach;
847 
848  for (sal_Int32 nSpanX = 0; nSpanX < nWidth; ++nSpanX)
849  {
850  for (sal_Int32 nSpanY = 0; nSpanY < nHeight; ++nSpanY)
851  {
852  GridEntry &rSpan = A[nLeftAttach+nSpanX][nTopAttach+nSpanY];
853  rSpan.x = nLeftAttach;
854  rSpan.y = nTopAttach;
855  }
856  }
857  }
858 
859  //see if we have any empty rows/cols
860  sal_Int32 nMaxX = A.shape()[0];
861  sal_Int32 nMaxY = A.shape()[1];
862 
863  std::vector<bool> aNonEmptyCols(nMaxX);
864  std::vector<bool> aNonEmptyRows(nMaxY);
865 
866  for (sal_Int32 x = 0; x < nMaxX; ++x)
867  {
868  for (sal_Int32 y = 0; y < nMaxY; ++y)
869  {
870  const GridEntry &rEntry = A[x][y];
871  const vcl::Window *pChild = rEntry.pChild;
872  if (pChild && pChild->IsVisible())
873  {
874  aNonEmptyCols[x] = true;
875  if (rGrid.get_column_homogeneous())
876  {
877  for (sal_Int32 nSpanX = 1; nSpanX < rEntry.nSpanWidth; ++nSpanX)
878  aNonEmptyCols[x+nSpanX] = true;
879  }
880  aNonEmptyRows[y] = true;
881  if (rGrid.get_row_homogeneous())
882  {
883  for (sal_Int32 nSpanY = 1; nSpanY < rEntry.nSpanHeight; ++nSpanY)
884  aNonEmptyRows[y+nSpanY] = true;
885  }
886  }
887  }
888  }
889 
890  if (!rGrid.get_column_homogeneous())
891  {
892  //reduce the spans of elements that span empty columns
893  for (sal_Int32 x = 0; x < nMaxX; ++x)
894  {
895  std::set<GridEntry*> candidates;
896  for (sal_Int32 y = 0; y < nMaxY; ++y)
897  {
898  if (aNonEmptyCols[x])
899  continue;
900  GridEntry &rSpan = A[x][y];
901  //cell x/y is spanned by the widget at cell rSpan.x/rSpan.y,
902  //just points back to itself if there's no cell spanning
903  if ((rSpan.x == -1) || (rSpan.y == -1))
904  {
905  //there is no entry for this cell, i.e. this is a cell
906  //with no widget in it, or spanned by any other widget
907  continue;
908  }
909  GridEntry &rEntry = A[rSpan.x][rSpan.y];
910  candidates.insert(&rEntry);
911  }
912  for (auto const& candidate : candidates)
913  {
914  GridEntry *pEntry = candidate;
915  --pEntry->nSpanWidth;
916  }
917  }
918  }
919 
920  if (!rGrid.get_row_homogeneous())
921  {
922  //reduce the spans of elements that span empty rows
923  for (sal_Int32 y = 0; y < nMaxY; ++y)
924  {
925  std::set<GridEntry*> candidates;
926  for (sal_Int32 x = 0; x < nMaxX; ++x)
927  {
928  if (aNonEmptyRows[y])
929  continue;
930  GridEntry &rSpan = A[x][y];
931  //cell x/y is spanned by the widget at cell rSpan.x/rSpan.y,
932  //just points back to itself if there's no cell spanning
933  if ((rSpan.x == -1) || (rSpan.y == -1))
934  {
935  //there is no entry for this cell, i.e. this is a cell
936  //with no widget in it, or spanned by any other widget
937  continue;
938  }
939  GridEntry &rEntry = A[rSpan.x][rSpan.y];
940  candidates.insert(&rEntry);
941  }
942  for (auto const& candidate : candidates)
943  {
944  GridEntry *pEntry = candidate;
945  --pEntry->nSpanHeight;
946  }
947  }
948  }
949 
950  sal_Int32 nNonEmptyCols = std::count(aNonEmptyCols.begin(), aNonEmptyCols.end(), true);
951  sal_Int32 nNonEmptyRows = std::count(aNonEmptyRows.begin(), aNonEmptyRows.end(), true);
952 
953  //make new grid without empty rows and columns
954  array_type B(boost::extents[nNonEmptyCols][nNonEmptyRows]);
955  for (sal_Int32 x = 0, x2 = 0; x < nMaxX; ++x)
956  {
957  if (!aNonEmptyCols[x])
958  continue;
959  for (sal_Int32 y = 0, y2 = 0; y < nMaxY; ++y)
960  {
961  if (!aNonEmptyRows[y])
962  continue;
963  GridEntry &rEntry = A[x][y];
964  B[x2][y2++] = rEntry;
965  }
966  ++x2;
967  }
968 
969  return B;
970 }
971 
972 static bool isNullGrid(const array_type &A)
973 {
974  sal_Int32 nMaxX = A.shape()[0];
975  sal_Int32 nMaxY = A.shape()[1];
976 
977  return !nMaxX || !nMaxY;
978 }
979 
980 static void calcMaxs(const array_type &A, std::vector<VclGrid::Value> &rWidths, std::vector<VclGrid::Value> &rHeights)
981 {
982  sal_Int32 nMaxX = A.shape()[0];
983  sal_Int32 nMaxY = A.shape()[1];
984 
985  rWidths.resize(nMaxX);
986  rHeights.resize(nMaxY);
987 
988  //first use the non spanning entries to set default width/heights
989  for (sal_Int32 x = 0; x < nMaxX; ++x)
990  {
991  for (sal_Int32 y = 0; y < nMaxY; ++y)
992  {
993  const GridEntry &rEntry = A[x][y];
994  const vcl::Window *pChild = rEntry.pChild;
995  if (!pChild || !pChild->IsVisible())
996  continue;
997 
998  sal_Int32 nWidth = rEntry.nSpanWidth;
999  sal_Int32 nHeight = rEntry.nSpanHeight;
1000 
1001  for (sal_Int32 nSpanX = 0; nSpanX < nWidth; ++nSpanX)
1002  rWidths[x+nSpanX].m_bExpand |= pChild->get_hexpand();
1003 
1004  for (sal_Int32 nSpanY = 0; nSpanY < nHeight; ++nSpanY)
1005  rHeights[y+nSpanY].m_bExpand |= pChild->get_vexpand();
1006 
1007  if (nWidth == 1 || nHeight == 1)
1008  {
1009  Size aChildSize = VclContainer::getLayoutRequisition(*pChild);
1010  if (nWidth == 1)
1011  rWidths[x].m_nValue = std::max(rWidths[x].m_nValue, aChildSize.Width());
1012  if (nHeight == 1)
1013  rHeights[y].m_nValue = std::max(rHeights[y].m_nValue, aChildSize.Height());
1014  }
1015  }
1016  }
1017 
1018  //now use the spanning entries and split any extra sizes across expanding rows/cols
1019  //where possible
1020  for (sal_Int32 x = 0; x < nMaxX; ++x)
1021  {
1022  for (sal_Int32 y = 0; y < nMaxY; ++y)
1023  {
1024  const GridEntry &rEntry = A[x][y];
1025  const vcl::Window *pChild = rEntry.pChild;
1026  if (!pChild || !pChild->IsVisible())
1027  continue;
1028 
1029  sal_Int32 nWidth = rEntry.nSpanWidth;
1030  sal_Int32 nHeight = rEntry.nSpanHeight;
1031 
1032  if (nWidth == 1 && nHeight == 1)
1033  continue;
1034 
1035  Size aChildSize = VclContainer::getLayoutRequisition(*pChild);
1036 
1037  if (nWidth > 1)
1038  {
1039  sal_Int32 nExistingWidth = 0;
1040  for (sal_Int32 nSpanX = 0; nSpanX < nWidth; ++nSpanX)
1041  nExistingWidth += rWidths[x+nSpanX].m_nValue;
1042 
1043  sal_Int32 nExtraWidth = aChildSize.Width() - nExistingWidth;
1044 
1045  if (nExtraWidth > 0)
1046  {
1047  bool bForceExpandAll = false;
1048  sal_Int32 nExpandables = 0;
1049  for (sal_Int32 nSpanX = 0; nSpanX < nWidth; ++nSpanX)
1050  if (rWidths[x+nSpanX].m_bExpand)
1051  ++nExpandables;
1052  if (nExpandables == 0)
1053  {
1054  nExpandables = nWidth;
1055  bForceExpandAll = true;
1056  }
1057 
1058  for (sal_Int32 nSpanX = 0; nSpanX < nWidth; ++nSpanX)
1059  {
1060  if (rWidths[x+nSpanX].m_bExpand || bForceExpandAll)
1061  rWidths[x+nSpanX].m_nValue += nExtraWidth/nExpandables;
1062  }
1063  }
1064  }
1065 
1066  if (nHeight > 1)
1067  {
1068  sal_Int32 nExistingHeight = 0;
1069  for (sal_Int32 nSpanY = 0; nSpanY < nHeight; ++nSpanY)
1070  nExistingHeight += rHeights[y+nSpanY].m_nValue;
1071 
1072  sal_Int32 nExtraHeight = aChildSize.Height() - nExistingHeight;
1073 
1074  if (nExtraHeight > 0)
1075  {
1076  bool bForceExpandAll = false;
1077  sal_Int32 nExpandables = 0;
1078  for (sal_Int32 nSpanY = 0; nSpanY < nHeight; ++nSpanY)
1079  if (rHeights[y+nSpanY].m_bExpand)
1080  ++nExpandables;
1081  if (nExpandables == 0)
1082  {
1083  nExpandables = nHeight;
1084  bForceExpandAll = true;
1085  }
1086 
1087  for (sal_Int32 nSpanY = 0; nSpanY < nHeight; ++nSpanY)
1088  {
1089  if (rHeights[y+nSpanY].m_bExpand || bForceExpandAll)
1090  rHeights[y+nSpanY].m_nValue += nExtraHeight/nExpandables;
1091  }
1092  }
1093  }
1094  }
1095  }
1096 }
1097 
1098 static bool compareValues(const VclGrid::Value &i, const VclGrid::Value &j)
1099 {
1100  return i.m_nValue < j.m_nValue;
1101 }
1102 
1104 {
1105  VclGrid::Value aRet;
1106  aRet.m_nValue = i.m_nValue + j.m_nValue;
1107  aRet.m_bExpand = i.m_bExpand || j.m_bExpand;
1108  return aRet;
1109 }
1110 
1112 {
1114 }
1115 
1116 Size VclGrid::calculateRequisitionForSpacings(sal_Int32 nRowSpacing, sal_Int32 nColSpacing) const
1117 {
1118  array_type A = assembleGrid(*this);
1119 
1120  if (isNullGrid(A))
1121  return Size();
1122 
1123  std::vector<Value> aWidths;
1124  std::vector<Value> aHeights;
1125  calcMaxs(A, aWidths, aHeights);
1126 
1127  long nTotalWidth = 0;
1128  if (get_column_homogeneous())
1129  {
1130  nTotalWidth = std::max_element(aWidths.begin(), aWidths.end(), compareValues)->m_nValue;
1131  nTotalWidth *= aWidths.size();
1132  }
1133  else
1134  {
1135  nTotalWidth = std::accumulate(aWidths.begin(), aWidths.end(), Value(), accumulateValues).m_nValue;
1136  }
1137 
1138  nTotalWidth += nColSpacing * (aWidths.size()-1);
1139 
1140  long nTotalHeight = 0;
1141  if (get_row_homogeneous())
1142  {
1143  nTotalHeight = std::max_element(aHeights.begin(), aHeights.end(), compareValues)->m_nValue;
1144  nTotalHeight *= aHeights.size();
1145  }
1146  else
1147  {
1148  nTotalHeight = std::accumulate(aHeights.begin(), aHeights.end(), Value(), accumulateValues).m_nValue;
1149  }
1150 
1151  nTotalHeight += nRowSpacing * (aHeights.size()-1);
1152 
1153  return Size(nTotalWidth, nTotalHeight);
1154 }
1155 
1156 void VclGrid::setAllocation(const Size& rAllocation)
1157 {
1158  array_type A = assembleGrid(*this);
1159 
1160  if (isNullGrid(A))
1161  return;
1162 
1163  sal_Int32 nMaxX = A.shape()[0];
1164  sal_Int32 nMaxY = A.shape()[1];
1165 
1166  Size aRequisition;
1167  std::vector<Value> aWidths(nMaxX);
1168  std::vector<Value> aHeights(nMaxY);
1170  {
1171  aRequisition = calculateRequisition();
1172  calcMaxs(A, aWidths, aHeights);
1173  }
1174 
1175  sal_Int32 nColSpacing(get_column_spacing());
1176  sal_Int32 nRowSpacing(get_row_spacing());
1177 
1178  long nAvailableWidth = rAllocation.Width();
1179  if (nMaxX)
1180  nAvailableWidth -= nColSpacing * (nMaxX - 1);
1181  if (get_column_homogeneous())
1182  {
1183  for (sal_Int32 x = 0; x < nMaxX; ++x)
1184  aWidths[x].m_nValue = nAvailableWidth/nMaxX;
1185  }
1186  else if (rAllocation.Width() != aRequisition.Width())
1187  {
1188  sal_Int32 nExpandables = 0;
1189  for (sal_Int32 x = 0; x < nMaxX; ++x)
1190  if (aWidths[x].m_bExpand)
1191  ++nExpandables;
1192  long nExtraWidthForExpanders = nExpandables ? (rAllocation.Width() - aRequisition.Width()) / nExpandables : 0;
1193 
1194  //We don't fit and there is no volunteer to be shrunk
1195  if (!nExpandables && rAllocation.Width() < aRequisition.Width())
1196  {
1197  //first reduce spacing
1198  while (nColSpacing)
1199  {
1200  nColSpacing /= 2;
1201  aRequisition = calculateRequisitionForSpacings(nRowSpacing, nColSpacing);
1202  if (aRequisition.Width() <= rAllocation.Width())
1203  break;
1204  }
1205 
1206  //share out the remaining pain to everyone
1207  long nExtraWidth = (rAllocation.Width() - aRequisition.Width()) / nMaxX;
1208 
1209  for (sal_Int32 x = 0; x < nMaxX; ++x)
1210  aWidths[x].m_nValue += nExtraWidth;
1211  }
1212 
1213  if (nExtraWidthForExpanders)
1214  {
1215  for (sal_Int32 x = 0; x < nMaxX; ++x)
1216  if (aWidths[x].m_bExpand)
1217  aWidths[x].m_nValue += nExtraWidthForExpanders;
1218  }
1219  }
1220 
1221  long nAvailableHeight = rAllocation.Height();
1222  if (nMaxY)
1223  nAvailableHeight -= nRowSpacing * (nMaxY - 1);
1224  if (get_row_homogeneous())
1225  {
1226  for (sal_Int32 y = 0; y < nMaxY; ++y)
1227  aHeights[y].m_nValue = nAvailableHeight/nMaxY;
1228  }
1229  else if (rAllocation.Height() != aRequisition.Height())
1230  {
1231  sal_Int32 nExpandables = 0;
1232  for (sal_Int32 y = 0; y < nMaxY; ++y)
1233  if (aHeights[y].m_bExpand)
1234  ++nExpandables;
1235  long nExtraHeightForExpanders = nExpandables ? (rAllocation.Height() - aRequisition.Height()) / nExpandables : 0;
1236 
1237  //We don't fit and there is no volunteer to be shrunk
1238  if (!nExpandables && rAllocation.Height() < aRequisition.Height())
1239  {
1240  //first reduce spacing
1241  while (nRowSpacing)
1242  {
1243  nRowSpacing /= 2;
1244  aRequisition = calculateRequisitionForSpacings(nRowSpacing, nColSpacing);
1245  if (aRequisition.Height() <= rAllocation.Height())
1246  break;
1247  }
1248 
1249  //share out the remaining pain to everyone
1250  long nExtraHeight = (rAllocation.Height() - aRequisition.Height()) / nMaxY;
1251 
1252  for (sal_Int32 y = 0; y < nMaxY; ++y)
1253  aHeights[y].m_nValue += nExtraHeight;
1254  }
1255 
1256  if (nExtraHeightForExpanders)
1257  {
1258  for (sal_Int32 y = 0; y < nMaxY; ++y)
1259  if (aHeights[y].m_bExpand)
1260  aHeights[y].m_nValue += nExtraHeightForExpanders;
1261  }
1262  }
1263 
1264  Point aAllocPos(0, 0);
1265  for (sal_Int32 x = 0; x < nMaxX; ++x)
1266  {
1267  for (sal_Int32 y = 0; y < nMaxY; ++y)
1268  {
1269  GridEntry &rEntry = A[x][y];
1270  vcl::Window *pChild = rEntry.pChild;
1271  if (pChild)
1272  {
1273  Size aChildAlloc(0, 0);
1274 
1275  sal_Int32 nWidth = rEntry.nSpanWidth;
1276  for (sal_Int32 nSpanX = 0; nSpanX < nWidth; ++nSpanX)
1277  aChildAlloc.AdjustWidth(aWidths[x+nSpanX].m_nValue );
1278  aChildAlloc.AdjustWidth(nColSpacing*(nWidth-1) );
1279 
1280  sal_Int32 nHeight = rEntry.nSpanHeight;
1281  for (sal_Int32 nSpanY = 0; nSpanY < nHeight; ++nSpanY)
1282  aChildAlloc.AdjustHeight(aHeights[y+nSpanY].m_nValue );
1283  aChildAlloc.AdjustHeight(nRowSpacing*(nHeight-1) );
1284 
1285  setLayoutAllocation(*pChild, aAllocPos, aChildAlloc);
1286  }
1287  aAllocPos.AdjustY(aHeights[y].m_nValue + nRowSpacing );
1288  }
1289  aAllocPos.AdjustX(aWidths[x].m_nValue + nColSpacing );
1290  aAllocPos.setY( 0 );
1291  }
1292 }
1293 
1294 boost::property_tree::ptree VclGrid::DumpAsPropertyTree()
1295 {
1296  boost::property_tree::ptree aTree(VclContainer::DumpAsPropertyTree());
1297  aTree.put("type", "grid");
1298  return aTree;
1299 }
1300 
1301 bool toBool(const OUString &rValue)
1302 {
1303  return (!rValue.isEmpty() && (rValue[0] == 't' || rValue[0] == 'T' || rValue[0] == '1'));
1304 }
1305 
1306 bool VclGrid::set_property(const OString &rKey, const OUString &rValue)
1307 {
1308  if (rKey == "row-spacing")
1309  set_row_spacing(rValue.toInt32());
1310  else if (rKey == "column-spacing")
1311  set_column_spacing(rValue.toInt32());
1312  else if (rKey == "row-homogeneous")
1313  m_bRowHomogeneous = toBool(rValue);
1314  else if (rKey == "column-homogeneous")
1315  m_bColumnHomogeneous = toBool(rValue);
1316  else if (rKey == "n-rows")
1317  /*nothing to do*/;
1318  else
1319  return VclContainer::set_property(rKey, rValue);
1320  return true;
1321 }
1322 
1324 {
1325  const WindowImpl* pWindowImpl = ImplGetWindowImpl();
1326 
1327  return pWindowImpl->mpFirstChild;
1328 }
1329 
1331 {
1332  return const_cast<vcl::Window*>(const_cast<const VclBin*>(this)->get_child());
1333 }
1334 
1336 {
1337  const vcl::Window *pChild = get_child();
1338  if (pChild && pChild->IsVisible())
1339  return getLayoutRequisition(*pChild);
1340  return Size(0, 0);
1341 }
1342 
1343 void VclBin::setAllocation(const Size &rAllocation)
1344 {
1345  vcl::Window *pChild = get_child();
1346  if (pChild && pChild->IsVisible())
1347  setLayoutAllocation(*pChild, Point(0, 0), rAllocation);
1348 }
1349 
1351 {
1352  disposeOnce();
1353 }
1354 
1356 {
1357  m_pLabel.clear();
1358  VclBin::dispose();
1359 }
1360 
1361 //To-Do, hook a DecorationView into VclFrame ?
1362 
1364 {
1365  Size aRet(0, 0);
1366 
1367  const vcl::Window *pChild = get_child();
1368  const vcl::Window *pLabel = get_label_widget();
1369 
1370  if (pChild && pChild->IsVisible())
1371  aRet = getLayoutRequisition(*pChild);
1372 
1373  if (pLabel && pLabel->IsVisible())
1374  {
1375  Size aLabelSize = getLayoutRequisition(*pLabel);
1376  aRet.AdjustHeight(aLabelSize.Height() );
1377  aRet.setWidth( std::max(aLabelSize.Width(), aRet.Width()) );
1378  }
1379 
1380  return aRet;
1381 }
1382 
1383 void VclFrame::setAllocation(const Size &rAllocation)
1384 {
1385  //SetBackground( Color(0xFF, 0x00, 0xFF) );
1386 
1387  Size aAllocation(rAllocation);
1388  Point aChildPos;
1389 
1390  vcl::Window *pChild = get_child();
1391  vcl::Window *pLabel = get_label_widget();
1392 
1393  if (pLabel && pLabel->IsVisible())
1394  {
1395  Size aLabelSize = getLayoutRequisition(*pLabel);
1396  aLabelSize.setHeight( std::min(aLabelSize.Height(), aAllocation.Height()) );
1397  aLabelSize.setWidth( std::min(aLabelSize.Width(), aAllocation.Width()) );
1398  setLayoutAllocation(*pLabel, aChildPos, aLabelSize);
1399  aAllocation.AdjustHeight( -(aLabelSize.Height()) );
1400  aChildPos.AdjustY(aLabelSize.Height() );
1401  }
1402 
1403  if (pChild && pChild->IsVisible())
1404  setLayoutAllocation(*pChild, aChildPos, aAllocation);
1405 }
1406 
1407 IMPL_LINK(VclFrame, WindowEventListener, VclWindowEvent&, rEvent, void)
1408 {
1409  if (rEvent.GetId() == VclEventId::ObjectDying)
1410  designate_label(nullptr);
1411 }
1412 
1414 {
1415  assert(!pWindow || pWindow->GetParent() == this);
1416  if (m_pLabel)
1417  m_pLabel->RemoveEventListener(LINK(this, VclFrame, WindowEventListener));
1418  m_pLabel = pWindow;
1419  if (m_pLabel)
1420  m_pLabel->AddEventListener(LINK(this, VclFrame, WindowEventListener));
1421 }
1422 
1424 {
1425  assert(GetChildCount() == 2);
1426  if (m_pLabel)
1427  return m_pLabel;
1428  //The label widget is normally the first (of two) children
1429  const WindowImpl* pWindowImpl = ImplGetWindowImpl();
1430  if (pWindowImpl->mpFirstChild == pWindowImpl->mpLastChild) //no label exists
1431  return nullptr;
1432  return pWindowImpl->mpFirstChild;
1433 }
1434 
1436 {
1437  return const_cast<vcl::Window*>(const_cast<const VclFrame*>(this)->get_label_widget());
1438 }
1439 
1441 {
1442  //The child widget is the normally the last (of two) children
1443  const WindowImpl* pWindowImpl = ImplGetWindowImpl();
1444  assert(GetChildCount() == 2 || pWindowImpl->mbInDispose);
1445  if (!m_pLabel)
1446  return pWindowImpl->mpLastChild;
1447  if (pWindowImpl->mpFirstChild == pWindowImpl->mpLastChild) //only label exists
1448  return nullptr;
1449  return pWindowImpl->mpLastChild;
1450 }
1451 
1453 {
1454  return const_cast<vcl::Window*>(const_cast<const VclFrame*>(this)->get_child());
1455 }
1456 
1457 void VclFrame::set_label(const OUString &rLabel)
1458 {
1459  vcl::Window *pLabel = get_label_widget();
1460  assert(pLabel);
1461  pLabel->SetText(rLabel);
1462 }
1463 
1464 OUString VclFrame::get_label() const
1465 {
1466  const vcl::Window *pLabel = get_label_widget();
1467  assert(pLabel);
1468  return pLabel->GetText();
1469 }
1470 
1472 {
1473  const vcl::Window *pLabel = get_label_widget();
1474  if (pLabel)
1475  return pLabel->GetAccessibleName();
1477 }
1478 
1479 boost::property_tree::ptree VclFrame::DumpAsPropertyTree()
1480 {
1481  boost::property_tree::ptree aTree(VclBin::DumpAsPropertyTree());
1482  aTree.put("type", "frame");
1483  return aTree;
1484 }
1485 
1487 {
1490 
1491  const vcl::Window *pChild = get_child();
1492  if (pChild && pChild->IsVisible())
1493  {
1494  Size aChildSize = getLayoutRequisition(*pChild);
1495  aRet.AdjustWidth(aChildSize.Width() );
1496  aRet.AdjustHeight(aChildSize.Height() );
1497  }
1498 
1499  return aRet;
1500 }
1501 
1502 void VclAlignment::setAllocation(const Size &rAllocation)
1503 {
1504  vcl::Window *pChild = get_child();
1505  if (!pChild || !pChild->IsVisible())
1506  return;
1507 
1508  Point aChildPos(m_nLeftPadding, m_nTopPadding);
1509 
1510  Size aAllocation;
1511  aAllocation.setWidth( rAllocation.Width() - (m_nLeftPadding + m_nRightPadding) );
1512  aAllocation.setHeight( rAllocation.Height() - (m_nTopPadding + m_nBottomPadding) );
1513 
1514  setLayoutAllocation(*pChild, aChildPos, aAllocation);
1515 }
1516 
1517 bool VclAlignment::set_property(const OString &rKey, const OUString &rValue)
1518 {
1519  if (rKey == "bottom-padding")
1520  m_nBottomPadding = rValue.toInt32();
1521  else if (rKey == "left-padding")
1522  m_nLeftPadding = rValue.toInt32();
1523  else if (rKey == "right-padding")
1524  m_nRightPadding = rValue.toInt32();
1525  else if (rKey == "top-padding")
1526  m_nTopPadding = rValue.toInt32();
1527  else
1528  return VclBin::set_property(rKey, rValue);
1529  return true;
1530 }
1531 
1533 {
1535  VclBin::dispose();
1536 }
1537 
1539 {
1540  const WindowImpl* pWindowImpl = ImplGetWindowImpl();
1541 
1542  assert(pWindowImpl->mpFirstChild == m_pDisclosureButton);
1543 
1544  return pWindowImpl->mpFirstChild->GetWindow(GetWindowType::Next);
1545 }
1546 
1548 {
1549  return const_cast<vcl::Window*>(const_cast<const VclExpander*>(this)->get_child());
1550 }
1551 
1553 {
1554  Size aRet(0, 0);
1555 
1556  WindowImpl* pWindowImpl = ImplGetWindowImpl();
1557 
1558  const vcl::Window *pChild = get_child();
1559  const vcl::Window *pLabel = pChild != pWindowImpl->mpLastChild ? pWindowImpl->mpLastChild.get() : nullptr;
1560 
1561  if (pChild && pChild->IsVisible() && m_pDisclosureButton->IsChecked())
1562  aRet = getLayoutRequisition(*pChild);
1563 
1564  Size aExpanderSize = getLayoutRequisition(*m_pDisclosureButton);
1565 
1566  if (pLabel && pLabel->IsVisible())
1567  {
1568  Size aLabelSize = getLayoutRequisition(*pLabel);
1569  aExpanderSize.setHeight( std::max(aExpanderSize.Height(), aLabelSize.Height()) );
1570  aExpanderSize.AdjustWidth(aLabelSize.Width() );
1571  }
1572 
1573  aRet.AdjustHeight(aExpanderSize.Height() );
1574  aRet.setWidth( std::max(aExpanderSize.Width(), aRet.Width()) );
1575 
1576  return aRet;
1577 }
1578 
1579 void VclExpander::setAllocation(const Size &rAllocation)
1580 {
1581  Size aAllocation(rAllocation);
1582  Point aChildPos;
1583 
1584  WindowImpl* pWindowImpl = ImplGetWindowImpl();
1585 
1586  //The label widget is the last (of two) children
1587  vcl::Window *pChild = get_child();
1588  vcl::Window *pLabel = pChild != pWindowImpl->mpLastChild.get() ? pWindowImpl->mpLastChild.get() : nullptr;
1589 
1591  Size aLabelSize;
1592  Size aExpanderSize = aButtonSize;
1593  if (pLabel && pLabel->IsVisible())
1594  {
1595  aLabelSize = getLayoutRequisition(*pLabel);
1596  aExpanderSize.setHeight( std::max(aExpanderSize.Height(), aLabelSize.Height()) );
1597  aExpanderSize.AdjustWidth(aLabelSize.Width() );
1598  }
1599 
1600  aExpanderSize.setHeight( std::min(aExpanderSize.Height(), aAllocation.Height()) );
1601  aExpanderSize.setWidth( std::min(aExpanderSize.Width(), aAllocation.Width()) );
1602 
1603  aButtonSize.setHeight( std::min(aButtonSize.Height(), aExpanderSize.Height()) );
1604  aButtonSize.setWidth( std::min(aButtonSize.Width(), aExpanderSize.Width()) );
1605 
1606  long nExtraExpanderHeight = aExpanderSize.Height() - aButtonSize.Height();
1607  Point aButtonPos(aChildPos.X(), aChildPos.Y() + nExtraExpanderHeight/2);
1608  setLayoutAllocation(*m_pDisclosureButton, aButtonPos, aButtonSize);
1609 
1610  if (pLabel && pLabel->IsVisible())
1611  {
1612  aLabelSize.setHeight( std::min(aLabelSize.Height(), aExpanderSize.Height()) );
1613  aLabelSize.setWidth( std::min(aLabelSize.Width(),
1614  aExpanderSize.Width() - aButtonSize.Width()) );
1615 
1616  long nExtraLabelHeight = aExpanderSize.Height() - aLabelSize.Height();
1617  Point aLabelPos(aChildPos.X() + aButtonSize.Width(), aChildPos.Y() + nExtraLabelHeight/2);
1618  setLayoutAllocation(*pLabel, aLabelPos, aLabelSize);
1619  }
1620 
1621  aAllocation.AdjustHeight( -(aExpanderSize.Height()) );
1622  aChildPos.AdjustY(aExpanderSize.Height() );
1623 
1624  if (pChild && pChild->IsVisible())
1625  {
1627  aAllocation = Size();
1628  setLayoutAllocation(*pChild, aChildPos, aAllocation);
1629  }
1630 }
1631 
1632 bool VclExpander::set_property(const OString &rKey, const OUString &rValue)
1633 {
1634  if (rKey == "expanded")
1635  set_expanded(toBool(rValue));
1636  else if (rKey == "resize-toplevel")
1637  m_bResizeTopLevel = toBool(rValue);
1638  else
1639  return VclBin::set_property(rKey, rValue);
1640  return true;
1641 }
1642 
1644 {
1645  VclBin::StateChanged( nType );
1646 
1647  if (nType == StateChangedType::InitShow)
1648  {
1649  vcl::Window *pChild = get_child();
1650  if (pChild)
1651  pChild->Show(m_pDisclosureButton->IsChecked());
1652  }
1653 }
1654 
1655 IMPL_LINK( VclExpander, ClickHdl, CheckBox&, rBtn, void )
1656 {
1657  vcl::Window *pChild = get_child();
1658  if (pChild)
1659  {
1660  pChild->Show(rBtn.IsChecked());
1661  queue_resize();
1662  Dialog* pResizeDialog = m_bResizeTopLevel ? GetParentDialog() : nullptr;
1663  if (pResizeDialog)
1664  pResizeDialog->setOptimalLayoutSize();
1665  }
1666  maExpandedHdl.Call(*this);
1667 }
1668 
1671  , m_bUserManagedScrolling(false)
1672  , m_pVScroll(VclPtr<ScrollBar>::Create(this, WB_HIDE | WB_VERT))
1673  , m_pHScroll(VclPtr<ScrollBar>::Create(this, WB_HIDE | WB_HORZ))
1674  , m_aScrollBarBox(VclPtr<ScrollBarBox>::Create(this, WB_HIDE))
1675 {
1676  SetType(WindowType::SCROLLWINDOW);
1677 
1678  Link<ScrollBar*,void> aLink( LINK( this, VclScrolledWindow, ScrollBarHdl ) );
1679  m_pVScroll->SetScrollHdl(aLink);
1680  m_pHScroll->SetScrollHdl(aLink);
1681 }
1682 
1684 {
1688  VclBin::dispose();
1689 }
1690 
1692 {
1693  vcl::Window *pChild = get_child();
1694  if (!pChild)
1695  return;
1696 
1697  assert(dynamic_cast<VclViewport*>(pChild) && "scrolledwindow child should be a Viewport");
1698 
1699  pChild = pChild->GetWindow(GetWindowType::FirstChild);
1700 
1701  if (!pChild)
1702  return;
1703 
1704  Point aWinPos(-m_pHScroll->GetThumbPos(), -m_pVScroll->GetThumbPos());
1705  pChild->SetPosPixel(aWinPos);
1706 }
1707 
1709 {
1710  const WindowImpl* pWindowImpl = ImplGetWindowImpl();
1711  assert(GetChildCount() == 4 || pWindowImpl->mbInDispose);
1712  return pWindowImpl->mpLastChild;
1713 }
1714 
1716 {
1717  return const_cast<vcl::Window*>(const_cast<const VclScrolledWindow*>(this)->get_child());
1718 }
1719 
1721 {
1722  Size aRet(0, 0);
1723 
1724  const vcl::Window *pChild = get_child();
1725  if (pChild && pChild->IsVisible())
1726  aRet = getLayoutRequisition(*pChild);
1727 
1728  if (GetStyle() & WB_VSCROLL)
1729  aRet.AdjustWidth(getLayoutRequisition(*m_pVScroll).Width() );
1730 
1731  if (GetStyle() & WB_HSCROLL)
1732  aRet.AdjustHeight(getLayoutRequisition(*m_pHScroll).Height() );
1733 
1734  aRet.AdjustHeight(2);
1735  aRet.AdjustWidth(2);
1736 
1737  return aRet;
1738 }
1739 
1741 {
1742  const vcl::Window *pChild = get_child();
1743  if (!pChild || !pChild->IsVisible())
1744  return;
1745 
1746  Size aOutSize(getVisibleChildSize());
1747 
1748  m_pVScroll->SetRangeMax(rRequest.Height());
1749  m_pVScroll->SetVisibleSize(aOutSize.Height());
1750  m_pVScroll->SetPageSize(16);
1751 
1752  m_pHScroll->SetRangeMax(rRequest.Width());
1753  m_pHScroll->SetVisibleSize(aOutSize.Width());
1754  m_pHScroll->SetPageSize(16);
1755 
1756  m_pVScroll->Scroll();
1757  m_pHScroll->Scroll();
1758 }
1759 
1760 void VclScrolledWindow::doSetAllocation(const Size &rAllocation, bool bRetryOnFailure)
1761 {
1762  Size aChildReq;
1763 
1764  vcl::Window *pChild = get_child();
1765  if (pChild && pChild->IsVisible())
1766  aChildReq = getLayoutRequisition(*pChild);
1767 
1768  long nAvailHeight = rAllocation.Height() - 2;
1769  long nAvailWidth = rAllocation.Width() - 2;
1770  // vert. ScrollBar
1771  if (GetStyle() & WB_AUTOVSCROLL)
1772  {
1773  m_pVScroll->Show(nAvailHeight < aChildReq.Height());
1774  }
1775  else if (m_pVScroll->IsVisible() != bool(GetStyle() & WB_VSCROLL))
1776  m_pVScroll->Show((GetStyle() & WB_VSCROLL) != 0);
1777 
1778  if (m_pVScroll->IsVisible())
1779  nAvailWidth -= getLayoutRequisition(*m_pVScroll).Width();
1780 
1781  // horz. ScrollBar
1782  if (GetStyle() & WB_AUTOHSCROLL)
1783  {
1784  bool bShowHScroll = nAvailWidth < aChildReq.Width();
1785  m_pHScroll->Show(bShowHScroll);
1786 
1787  if (bShowHScroll)
1788  nAvailHeight -= getLayoutRequisition(*m_pHScroll).Height();
1789 
1790  if (GetStyle() & WB_AUTOVSCROLL)
1791  m_pVScroll->Show(nAvailHeight < aChildReq.Height());
1792  }
1793  else if (m_pHScroll->IsVisible() != bool(GetStyle() & WB_HSCROLL))
1794  m_pHScroll->Show((GetStyle() & WB_HSCROLL) != 0);
1795 
1796  Size aInnerSize(rAllocation);
1797  aInnerSize.AdjustWidth(-2);
1798  aInnerSize.AdjustHeight(-2);
1799 
1800  bool bBothVisible = m_pVScroll->IsVisible() && m_pHScroll->IsVisible();
1801  auto nScrollBarWidth = getLayoutRequisition(*m_pVScroll).Width();
1802  auto nScrollBarHeight = getLayoutRequisition(*m_pHScroll).Height();
1803 
1804  if (m_pVScroll->IsVisible())
1805  {
1806  Point aScrollPos(rAllocation.Width() - nScrollBarWidth - 2, 1);
1807  Size aScrollSize(nScrollBarWidth, rAllocation.Height() - 2);
1808  if (bBothVisible)
1809  aScrollSize.AdjustHeight(-nScrollBarHeight);
1810  setLayoutAllocation(*m_pVScroll, aScrollPos, aScrollSize);
1811  aInnerSize.AdjustWidth( -nScrollBarWidth );
1812  }
1813 
1814  if (m_pHScroll->IsVisible())
1815  {
1816  Point aScrollPos(1, rAllocation.Height() - nScrollBarHeight);
1817  Size aScrollSize(rAllocation.Width() - 2, nScrollBarHeight);
1818  if (bBothVisible)
1819  aScrollSize.AdjustWidth(-nScrollBarWidth);
1820  setLayoutAllocation(*m_pHScroll, aScrollPos, aScrollSize);
1821  aInnerSize.AdjustHeight( -nScrollBarHeight );
1822  }
1823 
1824  if (bBothVisible)
1825  {
1826  Point aBoxPos(aInnerSize.Width() + 1, aInnerSize.Height() + 1);
1827  m_aScrollBarBox->SetPosSizePixel(aBoxPos, Size(nScrollBarWidth, nScrollBarHeight));
1828  m_aScrollBarBox->Show();
1829  }
1830  else
1831  {
1832  m_aScrollBarBox->Hide();
1833  }
1834 
1835  if (pChild && pChild->IsVisible())
1836  {
1837  assert(dynamic_cast<VclViewport*>(pChild) && "scrolledwindow child should be a Viewport");
1838 
1840 
1841  setLayoutAllocation(*pChild, Point(1, 1), aInnerSize);
1842 
1843  // tdf#128758 if the layout allocation triggered some callback that
1844  // immediately invalidates the layout by adding scrollbars then
1845  // normally this would simply retrigger layout and another toplevel
1846  // attempt is made later. But the initial layout attempt blocks
1847  // relayouts, so just make another single effort here.
1849  if (nOldBits != nNewBits && bRetryOnFailure)
1850  {
1851  doSetAllocation(rAllocation, false);
1852  return;
1853  }
1854  }
1855 
1857  InitScrollBars(aChildReq);
1858 }
1859 
1860 void VclScrolledWindow::setAllocation(const Size &rAllocation)
1861 {
1862  doSetAllocation(rAllocation, true);
1863 }
1864 
1866 {
1867  Size aRet(GetSizePixel());
1868  if (m_pVScroll->IsVisible())
1869  aRet.AdjustWidth( -(m_pVScroll->GetSizePixel().Width()) );
1870  if (m_pHScroll->IsVisible())
1871  aRet.AdjustHeight( -(m_pHScroll->GetSizePixel().Height()) );
1872  aRet.AdjustHeight(-2);
1873  aRet.AdjustWidth(-2);
1874  return aRet;
1875 }
1876 
1877 bool VclScrolledWindow::set_property(const OString &rKey, const OUString &rValue)
1878 {
1879  bool bRet = VclBin::set_property(rKey, rValue);
1880  m_pVScroll->Show((GetStyle() & WB_VSCROLL) != 0);
1881  m_pHScroll->Show((GetStyle() & WB_HSCROLL) != 0);
1882  return bRet;
1883 }
1884 
1886 {
1887  bool bDone = false;
1888  if ( rNEvt.GetType() == MouseNotifyEvent::COMMAND )
1889  {
1890  const CommandEvent& rCEvt = *rNEvt.GetCommandEvent();
1891  if ( rCEvt.GetCommand() == CommandEventId::Wheel )
1892  {
1893  const CommandWheelData* pData = rCEvt.GetWheelData();
1894  if( !pData->GetModifier() && ( pData->GetMode() == CommandWheelMode::SCROLL ) )
1895  {
1896  bDone = HandleScrollCommand(rCEvt, m_pHScroll, m_pVScroll);
1897  }
1898  }
1899  }
1900 
1901  return bDone || VclBin::EventNotify( rNEvt );
1902 }
1903 
1905 {
1906  VclBin::Paint(rRenderContext, rRect);
1907  DecorationView aDecoView(&rRenderContext);
1908  aDecoView.DrawFrame(tools::Rectangle(Point(0,0), GetSizePixel()));
1909 }
1910 
1911 void VclViewport::setAllocation(const Size &rAllocation)
1912 {
1913  vcl::Window *pChild = get_child();
1914  if (pChild && pChild->IsVisible())
1915  {
1916  Size aReq(getLayoutRequisition(*pChild));
1917  aReq.setWidth( std::max(aReq.Width(), rAllocation.Width()) );
1918  aReq.setHeight( std::max(aReq.Height(), rAllocation.Height()) );
1919  Point aKeepPos(pChild->GetPosPixel());
1921  {
1922  aKeepPos = Point(0, 0);
1923  m_bInitialAllocation = false;
1924  }
1925  setLayoutAllocation(*pChild, aKeepPos, aReq);
1926  }
1927 }
1928 
1930 {
1931  const WindowImpl* pWindowImpl = ImplGetWindowImpl();
1932 
1933  assert(pWindowImpl->mpFirstChild.get() == m_aEventBoxHelper.get());
1934 
1935  return pWindowImpl->mpFirstChild->GetWindow(GetWindowType::Next);
1936 }
1937 
1939 {
1940  return const_cast<vcl::Window*>(const_cast<const VclEventBox*>(this)->get_child());
1941 }
1942 
1943 void VclEventBox::setAllocation(const Size& rAllocation)
1944 {
1945  Point aChildPos(0, 0);
1946  for (vcl::Window *pChild = GetWindow(GetWindowType::FirstChild); pChild; pChild = pChild->GetWindow(GetWindowType::Next))
1947  {
1948  if (!pChild->IsVisible())
1949  continue;
1950  setLayoutAllocation(*pChild, aChildPos, rAllocation);
1951  }
1952 }
1953 
1955 {
1956  Size aRet(0, 0);
1957 
1958  for (const vcl::Window* pChild = get_child(); pChild;
1959  pChild = pChild->GetWindow(GetWindowType::Next))
1960  {
1961  if (!pChild->IsVisible())
1962  continue;
1963  Size aChildSize = getLayoutRequisition(*pChild);
1964  aRet.setWidth( std::max(aRet.Width(), aChildSize.Width()) );
1965  aRet.setHeight( std::max(aRet.Height(), aChildSize.Height()) );
1966  }
1967 
1968  return aRet;
1969 }
1970 
1972 {
1973  //discard events by default to block them reaching children
1974 }
1975 
1977 {
1978  disposeOnce();
1979 }
1980 
1982 {
1983  m_aEventBoxHelper.disposeAndClear();
1984  VclBin::dispose();
1985 }
1986 
1988 {
1989  //sufficient to trigger one widget to trigger all of them
1990  if (!m_aWindows.empty())
1991  {
1992  (*m_aWindows.begin())->queue_resize();
1993  }
1994 }
1995 
1996 void VclSizeGroup::set_ignore_hidden(bool bIgnoreHidden)
1997 {
1998  if (bIgnoreHidden != m_bIgnoreHidden)
1999  {
2000  m_bIgnoreHidden = bIgnoreHidden;
2002  }
2003 }
2004 
2006 {
2007  if (eMode != m_eMode)
2008  {
2009  m_eMode = eMode;
2011  }
2012 
2013 }
2014 
2015 void VclSizeGroup::set_property(const OString &rKey, const OUString &rValue)
2016 {
2017  if (rKey == "ignore-hidden")
2018  set_ignore_hidden(toBool(rValue));
2019  else if (rKey == "mode")
2020  {
2022  if (rValue == "none")
2023  eMode = VclSizeGroupMode::NONE;
2024  else if (rValue == "horizontal")
2026  else if (rValue == "vertical")
2028  else if (rValue == "both")
2029  eMode = VclSizeGroupMode::Both;
2030  else
2031  {
2032  SAL_WARN("vcl.layout", "unknown size group mode" << rValue);
2033  }
2034  set_mode(eMode);
2035  }
2036  else
2037  {
2038  SAL_INFO("vcl.layout", "unhandled property: " << rKey);
2039  }
2040 }
2041 
2043 {
2045 
2046  if (!m_pGrid)
2047  {
2048  VclContainer *pContainer = get_content_area();
2049  assert(pContainer);
2050 
2051  m_pGrid.set( VclPtr<VclGrid>::Create(pContainer) );
2058 
2060  switch (m_eMessageType)
2061  {
2062  case VclMessageType::Info:
2064  break;
2067  break;
2070  break;
2071  case VclMessageType::Error:
2073  break;
2074  }
2078  m_pImage->Show();
2079 
2081 
2082  bool bHasSecondaryText = !m_sSecondaryString.isEmpty();
2083 
2087 
2091 
2097  m_pSecondaryMessage->Show(bHasSecondaryText);
2098 
2099  MessageDialog::SetMessagesWidths(this, m_pPrimaryMessage, bHasSecondaryText ? m_pSecondaryMessage.get() : nullptr);
2100 
2101  VclButtonBox *pButtonBox = get_action_area();
2102  assert(pButtonBox);
2103 
2104  VclPtr<PushButton> pBtn;
2105  short nDefaultResponse = get_default_response();
2106  switch (m_eButtonsType)
2107  {
2108  case VclButtonsType::NONE:
2109  break;
2110  case VclButtonsType::Ok:
2111  pBtn.set( VclPtr<OKButton>::Create(pButtonBox) );
2112  pBtn->SetStyle(pBtn->GetStyle() & WB_DEFBUTTON);
2113  pBtn->Show();
2114  pBtn->set_id("ok");
2115  add_button(pBtn, RET_OK, true);
2116  nDefaultResponse = RET_OK;
2117  break;
2118  case VclButtonsType::Close:
2119  pBtn.set( VclPtr<CloseButton>::Create(pButtonBox) );
2120  pBtn->SetStyle(pBtn->GetStyle() & WB_DEFBUTTON);
2121  pBtn->Show();
2122  pBtn->set_id("close");
2123  add_button(pBtn, RET_CLOSE, true);
2124  nDefaultResponse = RET_CLOSE;
2125  break;
2127  pBtn.set( VclPtr<CancelButton>::Create(pButtonBox) );
2128  pBtn->SetStyle(pBtn->GetStyle() & WB_DEFBUTTON);
2129  pBtn->Show();
2130  pBtn->set_id("cancel");
2131  add_button(pBtn, RET_CANCEL, true);
2132  nDefaultResponse = RET_CANCEL;
2133  break;
2134  case VclButtonsType::YesNo:
2135  pBtn = VclPtr<PushButton>::Create(pButtonBox);
2136  pBtn->SetText(GetStandardText(StandardButtonType::Yes));
2137  pBtn->Show();
2138  pBtn->set_id("yes");
2139  add_button(pBtn, RET_YES, true);
2140 
2141  pBtn.set( VclPtr<PushButton>::Create(pButtonBox) );
2142  pBtn->SetText(GetStandardText(StandardButtonType::No));
2143  pBtn->Show();
2144  pBtn->set_id("no");
2145  add_button(pBtn, RET_NO, true);
2146  nDefaultResponse = RET_NO;
2147  break;
2149  pBtn.set( VclPtr<OKButton>::Create(pButtonBox) );
2150  pBtn->Show();
2151  pBtn->set_id("ok");
2152  add_button(pBtn, RET_OK, true);
2153 
2154  pBtn.set( VclPtr<CancelButton>::Create(pButtonBox) );
2155  pBtn->Show();
2156  pBtn->set_id("cancel");
2157  add_button(pBtn, RET_CANCEL, true);
2158  nDefaultResponse = RET_CANCEL;
2159  break;
2160  }
2161  set_default_response(nDefaultResponse);
2162  pButtonBox->sort_native_button_order();
2163  m_pMessageBox->Show();
2164  m_pGrid->Show();
2165  }
2166 }
2167 
2169 {
2170 #if defined WNT
2171  set_border_width(3);
2172 #else
2173  set_border_width(12);
2174 #endif
2181 }
2182 
2184  : Dialog(pParent, nStyle)
2185  , m_eButtonsType(VclButtonsType::NONE)
2186  , m_eMessageType(VclMessageType::Info)
2187  , m_pOwnedContentArea(nullptr)
2188  , m_pOwnedActionArea(nullptr)
2189  , m_pGrid(nullptr)
2190  , m_pMessageBox(nullptr)
2191  , m_pImage(nullptr)
2192  , m_pPrimaryMessage(nullptr)
2193  , m_pSecondaryMessage(nullptr)
2194 {
2195  SetType(WindowType::MESSBOX);
2196 }
2197 
2199  const OUString &rMessage,
2200  VclMessageType eMessageType,
2201  VclButtonsType eButtonsType)
2202  : Dialog(pParent, WB_MOVEABLE | WB_3DLOOK | WB_CLOSEABLE)
2203  , m_eButtonsType(eButtonsType)
2204  , m_eMessageType(eMessageType)
2205  , m_pGrid(nullptr)
2206  , m_pMessageBox(nullptr)
2207  , m_pImage(nullptr)
2208  , m_pPrimaryMessage(nullptr)
2209  , m_pSecondaryMessage(nullptr)
2210  , m_sPrimaryString(rMessage)
2211 {
2212  SetType(WindowType::MESSBOX);
2215 
2216  switch (m_eMessageType)
2217  {
2218  case VclMessageType::Info:
2220  break;
2223  break;
2226  break;
2227  case VclMessageType::Error:
2229  break;
2230  }
2231 }
2232 
2234 {
2243  Dialog::dispose();
2244 }
2245 
2247 {
2248  disposeOnce();
2249 }
2250 
2252  VclMultiLineEdit *pPrimaryMessage, VclMultiLineEdit *pSecondaryMessage)
2253 {
2254  if (pSecondaryMessage)
2255  {
2256  assert(pPrimaryMessage);
2257  vcl::Font aFont = pParent->GetSettings().GetStyleSettings().GetLabelFont();
2258  aFont.SetFontSize(Size(0, aFont.GetFontSize().Height() * 1.2));
2259  aFont.SetWeight(WEIGHT_BOLD);
2260  pPrimaryMessage->SetControlFont(aFont);
2261  pPrimaryMessage->SetMaxTextWidth(pPrimaryMessage->approximate_char_width() * 44);
2262  pSecondaryMessage->SetMaxTextWidth(pSecondaryMessage->approximate_char_width() * 60);
2263  }
2264  else
2265  pPrimaryMessage->SetMaxTextWidth(pPrimaryMessage->approximate_char_width() * 60);
2266 }
2267 
2268 OUString const & MessageDialog::get_primary_text() const
2269 {
2270  const_cast<MessageDialog*>(this)->setDeferredProperties();
2271 
2272  return m_sPrimaryString;
2273 }
2274 
2275 OUString const & MessageDialog::get_secondary_text() const
2276 {
2277  const_cast<MessageDialog*>(this)->setDeferredProperties();
2278 
2279  return m_sSecondaryString;
2280 }
2281 
2282 bool MessageDialog::set_property(const OString &rKey, const OUString &rValue)
2283 {
2284  if (rKey == "text")
2285  set_primary_text(rValue);
2286  else if (rKey == "secondary-text")
2287  set_secondary_text(rValue);
2288  else if (rKey == "message-type")
2289  {
2291  if (rValue == "info")
2292  eMode = VclMessageType::Info;
2293  else if (rValue == "warning")
2294  eMode = VclMessageType::Warning;
2295  else if (rValue == "question")
2296  eMode = VclMessageType::Question;
2297  else if (rValue == "error")
2298  eMode = VclMessageType::Error;
2299  else
2300  {
2301  SAL_WARN("vcl.layout", "unknown message type mode" << rValue);
2302  }
2303  m_eMessageType = eMode;
2304  }
2305  else if (rKey == "buttons")
2306  {
2308  if (rValue == "none")
2309  eMode = VclButtonsType::NONE;
2310  else if (rValue == "ok")
2311  eMode = VclButtonsType::Ok;
2312  else if (rValue == "cancel")
2313  eMode = VclButtonsType::Cancel;
2314  else if (rValue == "close")
2315  eMode = VclButtonsType::Close;
2316  else if (rValue == "yes-no")
2317  eMode = VclButtonsType::YesNo;
2318  else if (rValue == "ok-cancel")
2319  eMode = VclButtonsType::OkCancel;
2320  else
2321  {
2322  SAL_WARN("vcl.layout", "unknown buttons type mode" << rValue);
2323  }
2324  m_eButtonsType = eMode;
2325  }
2326  else
2327  return Dialog::set_property(rKey, rValue);
2328  return true;
2329 }
2330 
2331 void MessageDialog::set_primary_text(const OUString &rPrimaryString)
2332 {
2333  m_sPrimaryString = rPrimaryString;
2334  if (m_pPrimaryMessage)
2335  {
2339  }
2340 }
2341 
2342 void MessageDialog::set_secondary_text(const OUString &rSecondaryString)
2343 {
2344  m_sSecondaryString = rSecondaryString;
2345  if (m_pSecondaryMessage)
2346  {
2350  }
2351 }
2352 
2354 {
2355  Dialog::StateChanged(nType);
2356  if (nType == StateChangedType::InitShow)
2357  {
2358  // MessageBox should be at least as wide as to see the title
2359  auto nTitleWidth = CalcTitleWidth();
2360  // Extra-Width for Close button
2361  nTitleWidth += mpWindowImpl->mnTopBorder;
2362  if (get_preferred_size().Width() < nTitleWidth)
2363  {
2364  set_width_request(nTitleWidth);
2365  DoInitialLayout();
2366  }
2367  }
2368 }
2369 
2370 VclPaned::VclPaned(vcl::Window *pParent, bool bVertical)
2371  : VclContainer(pParent, WB_HIDE | WB_CLIPCHILDREN)
2372  , m_pSplitter(VclPtr<Splitter>::Create(this, bVertical ? WB_VSCROLL : WB_HSCROLL))
2373  , m_nPosition(-1)
2374 {
2375  m_pSplitter->SetBackground(Wallpaper(Application::GetSettings().GetStyleSettings().GetFaceColor()));
2376  m_pSplitter->Show();
2377 }
2378 
2380 {
2383 }
2384 
2386  : VclPaned(pParent, true)
2387 {
2388  m_pSplitter->SetSplitHdl(LINK(this, VclVPaned, SplitHdl));
2389 }
2390 
2391 IMPL_LINK(VclVPaned, SplitHdl, Splitter*, pSplitter, void)
2392 {
2393  long nSize = pSplitter->GetSplitPosPixel();
2394  Size aSplitterSize(m_pSplitter->GetSizePixel());
2395  Size aAllocation(GetSizePixel());
2396  arrange(aAllocation, nSize, aAllocation.Height() - nSize - aSplitterSize.Height());
2397 }
2398 
2399 void VclVPaned::arrange(const Size& rAllocation, long nFirstHeight, long nSecondHeight)
2400 {
2401  Size aSplitterSize(rAllocation.Width(), getLayoutRequisition(*m_pSplitter).Height());
2402  Size aFirstChildSize(rAllocation.Width(), nFirstHeight);
2403  Size aSecondChildSize(rAllocation.Width(), nSecondHeight);
2404  int nElement = 0;
2405  for (vcl::Window* pChild = GetWindow(GetWindowType::FirstChild); pChild;
2406  pChild = pChild->GetWindow(GetWindowType::Next))
2407  {
2408  if (!pChild->IsVisible())
2409  continue;
2410  if (nElement == 0)
2411  {
2412  Point aSplitterPos(0, aFirstChildSize.Height());
2413  setLayoutAllocation(*m_pSplitter, aSplitterPos, aSplitterSize);
2414  set_position(aSplitterPos.Y() + aSplitterSize.Height() / 2);
2415  }
2416  else if (nElement == 1)
2417  {
2418  Point aChildPos(0, 0);
2419  setLayoutAllocation(*pChild, aChildPos, aFirstChildSize);
2420  }
2421  else if (nElement == 2)
2422  {
2423  Point aChildPos(0, aFirstChildSize.Height() + aSplitterSize.Height());
2424  setLayoutAllocation(*pChild, aChildPos, aSecondChildSize);
2425  }
2426  ++nElement;
2427  }
2428 }
2429 
2430 void VclVPaned::setAllocation(const Size& rAllocation)
2431 {
2432  //supporting "shrink" could be done by adjusting the allowed drag rectangle
2433  m_pSplitter->SetDragRectPixel(tools::Rectangle(Point(0, 0), rAllocation));
2434  Size aSplitterSize(rAllocation.Width(), getLayoutRequisition(*m_pSplitter).Height());
2435  const long nHeight = rAllocation.Height() - aSplitterSize.Height();
2436 
2437  long nFirstHeight = 0;
2438  long nSecondHeight = 0;
2439  bool bFirstCanResize = true;
2440  bool bSecondCanResize = true;
2441  const bool bInitialAllocation = get_position() < 0;
2442  int nElement = 0;
2443  for (const vcl::Window* pChild = GetWindow(GetWindowType::FirstChild); pChild;
2444  pChild = pChild->GetWindow(GetWindowType::Next))
2445  {
2446  if (!pChild->IsVisible())
2447  continue;
2448  if (nElement == 1)
2449  {
2450  if (bInitialAllocation)
2451  nFirstHeight = getLayoutRequisition(*pChild).Height();
2452  else
2453  nFirstHeight = pChild->GetSizePixel().Height();
2454  bFirstCanResize = pChild->get_expand();
2455  }
2456  else if (nElement == 2)
2457  {
2458  if (bInitialAllocation)
2459  nSecondHeight = getLayoutRequisition(*pChild).Height();
2460  else
2461  nSecondHeight = pChild->GetSizePixel().Height();
2462  bSecondCanResize = pChild->get_expand();
2463  }
2464  ++nElement;
2465  }
2466  long nHeightRequest = nFirstHeight + nSecondHeight;
2467  long nHeightDiff = nHeight - nHeightRequest;
2468  if (bFirstCanResize == bSecondCanResize)
2469  nFirstHeight += nHeightDiff/2;
2470  else if (bFirstCanResize)
2471  nFirstHeight += nHeightDiff;
2472  arrange(rAllocation, nFirstHeight, rAllocation.Height() - nFirstHeight - aSplitterSize.Height());
2473 }
2474 
2476 {
2477  Size aRet(0, 0);
2478 
2479  for (const vcl::Window* pChild = GetWindow(GetWindowType::FirstChild); pChild;
2480  pChild = pChild->GetWindow(GetWindowType::Next))
2481  {
2482  if (!pChild->IsVisible())
2483  continue;
2484  Size aChildSize = getLayoutRequisition(*pChild);
2485  aRet.setWidth( std::max(aRet.Width(), aChildSize.Width()) );
2486  aRet.AdjustHeight(aChildSize.Height() );
2487  }
2488 
2489  return aRet;
2490 }
2491 
2493  : VclPaned(pParent, false)
2494 {
2495  m_pSplitter->SetSplitHdl(LINK(this, VclHPaned, SplitHdl));
2496 }
2497 
2498 IMPL_LINK(VclHPaned, SplitHdl, Splitter*, pSplitter, void)
2499 {
2500  long nSize = pSplitter->GetSplitPosPixel();
2501  Size aSplitterSize(m_pSplitter->GetSizePixel());
2502  Size aAllocation(GetSizePixel());
2503  arrange(aAllocation, nSize, aAllocation.Width() - nSize - aSplitterSize.Width());
2504 }
2505 
2506 void VclHPaned::arrange(const Size& rAllocation, long nFirstWidth, long nSecondWidth)
2507 {
2508  Size aSplitterSize(getLayoutRequisition(*m_pSplitter).Width(), rAllocation.Height());
2509  Size aFirstChildSize(nFirstWidth, rAllocation.Height());
2510  Size aSecondChildSize(nSecondWidth, rAllocation.Height());
2511  int nElement = 0;
2512  for (vcl::Window* pChild = GetWindow(GetWindowType::FirstChild); pChild;
2513  pChild = pChild->GetWindow(GetWindowType::Next))
2514  {
2515  if (!pChild->IsVisible())
2516  continue;
2517  if (nElement == 0)
2518  {
2519  Point aSplitterPos(aFirstChildSize.Width(), 0);
2520  setLayoutAllocation(*m_pSplitter, aSplitterPos, aSplitterSize);
2521  set_position(aSplitterPos.X() + aSplitterSize.Width() / 2);
2522  }
2523  else if (nElement == 1)
2524  {
2525  Point aChildPos(0, 0);
2526  setLayoutAllocation(*pChild, aChildPos, aFirstChildSize);
2527  }
2528  else if (nElement == 2)
2529  {
2530  Point aChildPos(aFirstChildSize.Width() + aSplitterSize.Width(), 0);
2531  setLayoutAllocation(*pChild, aChildPos, aSecondChildSize);
2532  }
2533  ++nElement;
2534  }
2535 }
2536 
2537 void VclHPaned::setAllocation(const Size& rAllocation)
2538 {
2539  //supporting "shrink" could be done by adjusting the allowed drag rectangle
2540  m_pSplitter->SetDragRectPixel(tools::Rectangle(Point(0, 0), rAllocation));
2541  Size aSplitterSize(getLayoutRequisition(*m_pSplitter).Width(), rAllocation.Height());
2542  const long nWidth = rAllocation.Width() - aSplitterSize.Width();
2543 
2544  long nFirstWidth = 0;
2545  long nSecondWidth = 0;
2546  bool bFirstCanResize = true;
2547  bool bSecondCanResize = true;
2548  const bool bInitialAllocation = get_position() < 0;
2549  int nElement = 0;
2550  for (const vcl::Window* pChild = GetWindow(GetWindowType::FirstChild); pChild;
2551  pChild = pChild->GetWindow(GetWindowType::Next))
2552  {
2553  if (!pChild->IsVisible())
2554  continue;
2555  if (nElement == 1)
2556  {
2557  if (bInitialAllocation)
2558  nFirstWidth = getLayoutRequisition(*pChild).Width();
2559  else
2560  nFirstWidth = pChild->GetSizePixel().Width();
2561  bFirstCanResize = pChild->get_expand();
2562  }
2563  else if (nElement == 2)
2564  {
2565  if (bInitialAllocation)
2566  nSecondWidth = getLayoutRequisition(*pChild).Width();
2567  else
2568  nSecondWidth = pChild->GetSizePixel().Width();
2569  bSecondCanResize = pChild->get_expand();
2570  }
2571  ++nElement;
2572  }
2573  long nWidthRequest = nFirstWidth + nSecondWidth;
2574  long nWidthDiff = nWidth - nWidthRequest;
2575  if (bFirstCanResize == bSecondCanResize)
2576  nFirstWidth += nWidthDiff/2;
2577  else if (bFirstCanResize)
2578  nFirstWidth += nWidthDiff;
2579  arrange(rAllocation, nFirstWidth, rAllocation.Width() - nFirstWidth - aSplitterSize.Width());
2580 }
2581 
2583 {
2584  Size aRet(0, 0);
2585 
2586  for (const vcl::Window* pChild = GetWindow(GetWindowType::FirstChild); pChild;
2587  pChild = pChild->GetWindow(GetWindowType::Next))
2588  {
2589  if (!pChild->IsVisible())
2590  continue;
2591  Size aChildSize = getLayoutRequisition(*pChild);
2592  aRet.setHeight( std::max(aRet.Height(), aChildSize.Height()) );
2593  aRet.AdjustWidth(aChildSize.Width() );
2594  }
2595 
2596  return aRet;
2597 }
2598 
2600 {
2601  tools::Rectangle aBounds;
2602 
2603  for (const vcl::Window* pChild = rWindow.GetWindow(GetWindowType::FirstChild); pChild;
2604  pChild = pChild->GetWindow(GetWindowType::Next))
2605  {
2606  if (!pChild->IsVisible())
2607  continue;
2608 
2609  tools::Rectangle aChildBounds(pChild->GetPosPixel(), pChild->GetSizePixel());
2610  aBounds.Union(aChildBounds);
2611  }
2612 
2613  if (aBounds.IsEmpty())
2614  return rWindow.GetSizePixel();
2615 
2616  Size aRet(aBounds.GetSize());
2617  Point aTopLeft(aBounds.TopLeft());
2618  aRet.AdjustWidth(aTopLeft.X()*2 );
2619  aRet.AdjustHeight(aTopLeft.Y()*2 );
2620 
2621  return aRet;
2622 }
2623 
2625 {
2626  while (pWindow)
2627  {
2628  pWindow = pWindow->GetParent();
2629  if (!pWindow || !isContainerWindow(*pWindow))
2630  break;
2631  }
2632  return pWindow;
2633 }
2634 
2635 bool isVisibleInLayout(const vcl::Window *pWindow)
2636 {
2637  bool bVisible = true;
2638  while (bVisible)
2639  {
2640  bVisible = pWindow->IsVisible();
2641  pWindow = pWindow->GetParent();
2642  if (!pWindow || !isContainerWindow(*pWindow))
2643  break;
2644  }
2645  return bVisible;
2646 }
2647 
2648 bool isEnabledInLayout(const vcl::Window *pWindow)
2649 {
2650  bool bEnabled = true;
2651  while (bEnabled)
2652  {
2653  bEnabled = pWindow->IsEnabled();
2654  pWindow = pWindow->GetParent();
2655  if (!pWindow || !isContainerWindow(*pWindow))
2656  break;
2657  }
2658  return bEnabled;
2659 }
2660 
2661 bool isLayoutEnabled(const vcl::Window *pWindow)
2662 {
2663  //Child is a container => we're layout enabled
2664  const vcl::Window *pChild = pWindow ? pWindow->GetWindow(GetWindowType::FirstChild) : nullptr;
2665  return pChild && isContainerWindow(*pChild) && !pChild->GetWindow(GetWindowType::Next);
2666 }
2667 
2668 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual Point GetPosPixel() const
Definition: window.cxx:2806
virtual void SetText(const OUString &rStr)
Definition: window.cxx:3030
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:2282
bool m_bColumnHomogeneous
Definition: layout.hxx:309
float approximate_char_width() const
Definition: text.cxx:902
virtual void setAllocation(const Size &rAllocation)=0
int get_column_spacing() const
Definition: layout.hxx:353
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:1306
sal_Int32 get_padding() const
Definition: window2.cxx:1731
void setDeferredProperties()
Definition: builder.hxx:484
static VclGrid::Value accumulateValues(const VclGrid::Value &i, const VclGrid::Value &j)
Definition: layout.cxx:1103
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:1877
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:779
void SetFontSize(const Size &)
Definition: font/font.cxx:117
bool get_vexpand() const
Definition: window2.cxx:1695
bool isVisibleInLayout(const vcl::Window *pWindow)
Definition: layout.cxx:2635
void InitScrollBars(const Size &rRequest)
Definition: layout.cxx:1740
WinBits const WB_NOLABEL
VclPtr< ScrollBar > m_pHScroll
Definition: layout.hxx:525
void set_border_width(sal_Int32 nBorderWidth)
Definition: window2.cxx:1803
virtual void dispose() override
This is intended to be used to clear any locally held references to other Window-subclass objects...
Definition: layout.cxx:2379
virtual bool set_property(const OString &rKey, const OUString &rValue) override
Definition: layout.cxx:1632
sal_Int32 m_nTopPadding
Definition: layout.hxx:458
OUString const & get_secondary_text() const
Definition: layout.cxx:2275
static void SetMessagesWidths(vcl::Window const *pParent, VclMultiLineEdit *pPrimaryMessage, VclMultiLineEdit *pSecondaryMessage)
Definition: layout.cxx:2251
sal_Int32 get_margin_bottom() const
Definition: window2.cxx:1873
long AdjustWidth(long n)
void designate_label(vcl::Window *pWindow)
Definition: layout.cxx:1413
VclButtonsType
Definition: vclenum.hxx:243
long AdjustX(long nHorzMove)
static array_type assembleGrid(const VclGrid &rGrid)
Definition: layout.cxx:817
VclBox * get_content_area()
Definition: dialog.hxx:110
void create_message_area()
Definition: layout.cxx:2042
virtual Size GetOptimalSize() const override
Definition: layout.cxx:41
virtual void setAllocation(const Size &rAllocation) override
Definition: layout.cxx:1383
const CommandEvent * GetCommandEvent() const
Definition: event.hxx:318
virtual void setSecondaryDimension(Size &rSize, long) const =0
VclPtr< vcl::Window > m_pLabel
Definition: layout.hxx:414
void set_grid_left_attach(sal_Int32 nAttach)
Definition: window2.cxx:1773
virtual void setAllocation(const Size &rAllocation) override
Definition: layout.cxx:598
OUString GetStandardText(StandardButtonType eButton)
Definition: stdtext.cxx:93
int const m_nPriority
Definition: layout.cxx:690
long Height() const
bool m_bVerticalContainer
Definition: layout.hxx:70
OUString GetStandardErrorBoxText()
Definition: stdtext.cxx:77
VclPtr< DisclosureButton > m_pDisclosureButton
Definition: layout.hxx:495
virtual void StateChanged(StateChangedType nType) override
Definition: layout.cxx:2353
bool get_hexpand() const
Definition: window2.cxx:1683
static Size getLayoutRequisition(const vcl::Window &rWindow)
Definition: layout.cxx:133
OUString const & get_primary_text() const
Definition: layout.cxx:2268
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:704
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:2364
virtual void setAllocation(const Size &rAllocation) override
Definition: layout.cxx:1502
void EnableCursor(bool bEnable)
Definition: vclmedit.cxx:1477
SAL_DLLPRIVATE WindowImpl * ImplGetWindowImpl() const
Definition: window.hxx:554
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:1294
bool m_bRowHomogeneous
Definition: layout.hxx:308
WinBits const WB_AUTOVSCROLL
void set_row_spacing(int nSpacing)
Definition: layout.hxx:341
virtual Size calculateRequisition() const override
Definition: layout.cxx:1363
GridEntry()
Definition: layout.cxx:801
VclPtr< VclBox > m_pOwnedContentArea
void set_spacing(int nSpacing)
Definition: layout.hxx:80
virtual vcl::Window * get_child() override
Definition: layout.cxx:1452
WinBits const WB_VSCROLL
Info
const CommandWheelData * GetWheelData() const
bool m_bExpand
Definition: layout.hxx:317
VclButtonBoxStyle
Definition: layout.hxx:190
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:957
virtual void dispose() override
This is intended to be used to clear any locally held references to other Window-subclass objects...
Definition: layout.cxx:1683
virtual void setAllocation(const Size &rAllocation) override
Definition: layout.cxx:1579
float x
bool HandleScrollCommand(const CommandEvent &rCmd, ScrollBar *pHScrl, ScrollBar *pVScrl)
Definition: window2.cxx:609
const char * m_aType
Definition: layout.cxx:689
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:1743
static const OUString & GetDesktopEnvironment()
Get the desktop environment the process is currently running in.
Definition: svapp.cxx:1554
sortButtons(bool bVerticalContainer)
Definition: layout.cxx:740
void create_owned_areas()
Definition: layout.cxx:2168
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:1330
bool const m_bVerticalContainer
Definition: layout.cxx:738
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:1981
sal_Int32 get_margin_right() const
Definition: window2.cxx:1841
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:591
virtual void dispose() override
This is intended to be used to clear any locally held references to other Window-subclass objects...
Definition: layout.cxx:1355
bool m_bLayoutDirty
Definition: layout.hxx:63
void set_ignore_hidden(bool bIgnoreHidden)
Definition: layout.cxx:1996
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:811
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:1479
void reorderWithinParent(vcl::Window &rWindow, sal_uInt16 nNewPosition)
Definition: builder.cxx:2484
void Hide()
Definition: window.hxx:932
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:1474
virtual Size calculateRequisition() const override
Definition: layout.cxx:1335
virtual long getSecondaryDimension(const Size &rSize) const =0
static bool compareValues(const VclGrid::Value &i, const VclGrid::Value &j)
Definition: layout.cxx:1098
void set_width_request(sal_Int32 nWidthRequest)
Definition: window2.cxx:1592
virtual OUString GetText() const
Definition: window.cxx:3059
void set_mode(VclSizeGroupMode eMode)
Definition: layout.cxx:2005
VclMessageType
Definition: vclenum.hxx:253
virtual void Command(const CommandEvent &rCEvt) override
Definition: layout.cxx:1971
void * GetEventData() const
void setY(long nY)
std::vector< long > m_aMainGroupDimensions
Definition: layout.hxx:218
bool get_secondary() const
Definition: window2.cxx:1891
WinBits const WB_HIDE
sal_Int32 m_nLeftPadding
Definition: layout.hxx:456
bool m_bResizeTopLevel
Definition: layout.hxx:494
bool isContainerWindow(const vcl::Window &rWindow)
Definition: layout.hxx:822
float y
sal_Int32 get_margin_left() const
Definition: window2.cxx:1825
bool mbInDispose
Definition: window.h:316
Size getLegacyBestSizeForChildren(const vcl::Window &rWindow)
Definition: layout.cxx:2599
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:3354
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:2475
void clear()
Definition: vclptr.hxx:190
bool isEnabledInLayout(const vcl::Window *pWindow)
Definition: layout.cxx:2648
void arrange(const Size &rAllocation, long nFirstHeight, long nSecondHeight)
Definition: layout.cxx:2506
virtual bool set_property(const OString &rKey, const OUString &rValue) override
Definition: dialog.cxx:1332
virtual ~VclFrame() override
Definition: layout.cxx:1350
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:2015
VclPtr< ScrollBarBox > m_aScrollBarBox
Definition: layout.hxx:526
long AdjustY(long nVertMove)
VclPtr< VclButtonBox > m_pOwnedActionArea
void SetMaxTextWidth(long nMaxWidth)
Definition: vclmedit.cxx:1066
VclPtr< ScrollBar > m_pVScroll
Definition: layout.hxx:524
virtual bool EventNotify(NotifyEvent &rNEvt) override
Definition: layout.cxx:1885
int get_default_response() const
Definition: dialog.cxx:1434
bool m_bIgnoreHidden
Definition: layout.hxx:592
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:2430
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:1464
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:1857
virtual bool set_property(const OString &rKey, const OUString &rValue) override
Definition: layout.cxx:1517
#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:1116
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
sal_Int32 nSpanHeight
Definition: layout.cxx:798
CommandEventId GetCommand() const
virtual void setAllocation(const Size &rAllocation) override
Definition: layout.cxx:1156
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:1364
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:1628
VclSizeGroupMode m_eMode
Definition: layout.hxx:593
bool isLayoutEnabled(const vcl::Window *pWindow)
Definition: layout.cxx:2661
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:88
virtual void dispose() override
This is intended to be used to clear any locally held references to other Window-subclass objects...
Definition: layout.cxx:1532
const AllSettings & GetSettings() const
Definition: outdev.hxx:420
virtual Size calculateRequisition() const override
Definition: layout.cxx:564
void SetPaintTransparent(bool bTransparent)
Definition: paint.cxx:1018
Size GetOutputSizePixel() const
Definition: outdev.hxx:441
void SetImage(const Image &rImage)
Definition: fixed.cxx:933
VclPtr< Splitter > m_pSplitter
Definition: layout.hxx:376
bool get_row_homogeneous() const
Definition: layout.hxx:333
virtual bool set_property(const OString &rKey, const OUString &rValue)
Definition: window2.cxx:1420
static void setLayoutPosSize(vcl::Window &rWindow, const Point &rPos, const Size &rSize)
Definition: layout.cxx:46
void reorderWithinParent(sal_uInt16 nNewPosition)
Definition: stacking.cxx:156
VclPackType get_pack_type() const
Definition: window2.cxx:1719
long GetTextHeight() const
Height where any character of the current font fits; in logic coordinates.
Definition: text.cxx:889
vcl::Window * GetParent() const
Definition: window2.cxx:1086
WinBits const WB_LEFT
long X() const
void SetStyle(WinBits nStyle)
Definition: window.cxx:1925
Size GetSize() const
enumrange< T >::Iterator end(enumrange< T >)
bool operator()(const vcl::Window *pA, const vcl::Window *pB) const
Definition: layout.cxx:747
void setOptimalLayoutSize()
Definition: syswin.cxx:1117
void Scroll()
Definition: scrbar.cxx:1294
virtual void SetPosSizePixel(const Point &rNewPos, const Size &rNewSize)
Definition: window2.cxx:1257
vcl::Window * GetWindow(GetWindowType nType) const
Definition: stacking.cxx:1035
void arrange(const Size &rAllocation, long nFirstHeight, long nSecondHeight)
Definition: layout.cxx:2399
Size getVisibleChildSize() const
Definition: layout.cxx:1865
const Point & GetMousePosPixel() const
virtual Size calculateRequisition() const override
Definition: layout.cxx:2582
void set_grid_top_attach(sal_Int32 nAttach)
Definition: window2.cxx:1797
bool m_bInitialAllocation
Definition: layout.hxx:539
SAL_DLLPRIVATE void ImplInit(vcl::Window *pParent, WinBits nStyle, SystemParentData *pSystemParentData)
Definition: window.cxx:931
#define DEFAULT_CHILD_MIN_HEIGHT
Definition: layout.cxx:377
WinBits const WB_3DLOOK
virtual void setAllocation(const Size &rAllocation) override
Definition: layout.cxx:1943
VclScrolledWindow(vcl::Window *pParent)
Definition: layout.cxx:1669
VclButtonBox * get_action_area()
Definition: dialog.hxx:109
void set_id(const OUString &rID)
Sets an ID.
Definition: window.cxx:3878
long CalcTitleWidth() const
Definition: window.cxx:2011
VclPtr< VclGrid > m_pGrid
void AddEventListener(const Link< VclWindowEvent &, void > &rEventListener)
Definition: event.cxx:302
void set_valign(VclAlign eAlign)
Definition: window2.cxx:1677
virtual void setAllocation(const Size &rAllocation) override
Definition: layout.cxx:1343
sal_uInt16 GetChildCount() const
Definition: stacking.cxx:1001
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:2246
virtual vcl::Window * get_child() override
Definition: layout.cxx:1715
virtual vcl::Window * get_child() override
Definition: layout.cxx:1938
VclVPaned(vcl::Window *pParent)
Definition: layout.cxx:2385
void set_hexpand(bool bExpand)
Definition: window2.cxx:1689
WindowType
VclPtr< vcl::Window > pChild
Definition: layout.cxx:796
virtual Size calculateRequisition() const override
Definition: layout.cxx:1720
tools::Rectangle & Union(const tools::Rectangle &rRect)
bool get_column_homogeneous() const
Definition: layout.hxx:337
void set_expanded(bool bExpanded)
Definition: layout.hxx:481
int m_nSpacing
Definition: layout.hxx:71
virtual void setAllocation(const Size &rAllocation) override
Definition: layout.cxx:1911
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:1435
bool IsVisible() const
Definition: window2.cxx:1091
void Create(SwFormatVertOrient &rItem, SvStream &rStrm, sal_uInt16 nVersionAbusedAsSize)
virtual vcl::Window * get_child() override
Definition: layout.cxx:1547
#define SAL_INFO(area, stream)
virtual void setAllocation(const Size &rAllocation) override
Definition: layout.cxx:1860
VclPtr< EventBoxHelper > m_aEventBoxHelper
Definition: layout.hxx:570
void set_column_spacing(int nSpacing)
Definition: layout.hxx:345
virtual Size calculateRequisition() const override
Definition: layout.cxx:1954
void EnableChildTransparentMode(bool bEnable=true)
Definition: window2.cxx:1011
virtual OUString getDefaultAccessibleName() const override
Definition: layout.cxx:1471
virtual void dispose() override
This is intended to be used to clear any locally held references to other Window-subclass objects...
Definition: layout.cxx:2233
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:1552
sal_Int32 nSpanWidth
Definition: layout.cxx:797
virtual void set_content_area(VclBox *pBox)
Definition: dialog.cxx:590
virtual void Paint(vcl::RenderContext &rRenderContext, const tools::Rectangle &rRect)
Definition: paint.cxx:1013
void set_action_area(VclButtonBox *pBox)
Definition: dialog.cxx:579
virtual Size calculateRequisition() const override
Definition: layout.cxx:1111
VclAlign get_valign() const
Definition: window2.cxx:1671
MessageDialog(vcl::Window *pParent, WinBits nStyle)
Definition: layout.cxx:2183
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:1976
virtual OUString getDefaultAccessibleName() const
WinBits const WB_TABSTOP
std::vector< long > m_aSubGroupDimensions
Definition: layout.hxx:219
IMPL_LINK(VclFrame, WindowEventListener, VclWindowEvent &, rEvent, void)
Definition: layout.cxx:1407
sal_Int32 m_nRightPadding
Definition: layout.hxx:457
vcl::Window * getNonLayoutParent(vcl::Window *pWindow)
Definition: layout.cxx:2624
virtual void SetPosSizePixel(const Point &rNewPos, const Size &rNewSize) override
Definition: layout.cxx:138
virtual void StateChanged(StateChangedType nStateChange)
Definition: window.cxx:1903
void doSetAllocation(const Size &rAllocation, bool bRetryOnFailure)
Definition: layout.cxx:1760
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:2342
reference_type * get() const
Get the body.
Definition: vclptr.hxx:143
bool IsEnabled() const
Definition: window2.cxx:1111
#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:2537
WinBits GetStyle() const
Definition: window2.cxx:942
OUString m_sPrimaryString
void set_primary_text(const OUString &rPrimaryString)
Definition: layout.cxx:2331
static int getButtonPriority(const OString &rType)
Definition: layout.cxx:693
static long getMaxNonOutlier(const std::vector< long > &rG, long nAvgDimension)
Definition: layout.cxx:411
long get_position() const
Definition: layout.hxx:383
WinBits const WB_CLOSEABLE
void set_position(long nPosition)
Definition: layout.hxx:384
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:1643
int get_row_spacing() const
Definition: layout.hxx:349
WinBits const WB_HORZ
bool m_bUserManagedScrolling
Definition: layout.hxx:523
void setWidth(long nWidth)
bool m_bHomogeneous
Definition: layout.hxx:69
void set_label(const OUString &rLabel)
Definition: layout.cxx:1457
WinBits const WB_CLIPCHILDREN
WinBits const WB_NOTABSTOP
virtual void Paint(vcl::RenderContext &rRenderContext, const tools::Rectangle &rRect) override
Definition: layout.cxx:1904
virtual void SetPosPixel(const Point &rNewPos)
Definition: window2.cxx:1246
IMPL_LINK_NOARG(VclScrolledWindow, ScrollBarHdl, ScrollBar *, void)
Definition: layout.cxx:1691
VclButtonBoxStyle m_eLayoutStyle
Definition: layout.hxx:215
virtual void SetText(const OUString &rStr) override
Definition: vclmedit.cxx:1111
sal_Int32 get_border_width() const
Definition: window2.cxx:1809
sal_Int32 m_nBottomPadding
Definition: layout.hxx:455
VclPaned(vcl::Window *pParent, bool bVertical)
Definition: layout.cxx:2370
SAL_DLLPRIVATE void DoInitialLayout()
Definition: syswin.cxx:1138
long Y() const
void trigger_queue_resize()
Definition: layout.cxx:1987
VclHPaned(vcl::Window *pParent)
Definition: layout.cxx:2492
static bool isNullGrid(const array_type &A)
Definition: layout.cxx:972
VclAlign get_halign() const
Definition: window2.cxx:1659
static void calcMaxs(const array_type &A, std::vector< VclGrid::Value > &rWidths, std::vector< VclGrid::Value > &rHeights)
Definition: layout.cxx:980
OUString m_sSecondaryString
void Show(bool bVisible=true, ShowFlags nFlags=ShowFlags::NONE)
Definition: window.cxx:2150
bool toBool(const OUString &rValue)
Definition: layout.cxx:1301
virtual bool set_property(const OString &rKey, const OUString &rValue) override
Definition: layout.cxx:347
virtual Size calculateRequisition() const override
Definition: layout.cxx:1486
void setHeight(long nHeight)