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