LibreOffice Module vcl (master)  1
dialog.cxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
5  * This Source Code Form is subject to the terms of the Mozilla Public
6  * License, v. 2.0. If a copy of the MPL was not distributed with this
7  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
11  * Licensed to the Apache Software Foundation (ASF) under one or more
12  * contributor license agreements. See the NOTICE file distributed
13  * with this work for additional information regarding copyright
14  * ownership. The ASF licenses this file to you under the Apache
15  * License, Version 2.0 (the "License"); you may not use this file
16  * except in compliance with the License. You may obtain a copy of
17  * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18  */
19 
20 #include <config_feature_desktop.h>
21 
22 #ifdef IOS
23 #include <premac.h>
24 #include <UIKit/UIKit.h>
25 #include <postmac.h>
26 #endif
27 
28 #include <com/sun/star/frame/theGlobalEventBroadcaster.hpp>
29 #include <comphelper/lok.hxx>
32 #include <officecfg/Office/Common.hxx>
33 #include <osl/diagnose.h>
34 
35 #include <svdata.hxx>
36 #include <window.h>
37 #include <brdwin.hxx>
38 
39 #include <rtl/bootstrap.hxx>
40 #include <rtl/strbuf.hxx>
41 #include <sal/log.hxx>
42 
43 #include <vcl/abstdlg.hxx>
44 #include <vcl/accel.hxx>
45 #include <vcl/builder.hxx>
46 #include <vcl/floatwin.hxx>
47 #include <vcl/layout.hxx>
48 #include <vcl/svapp.hxx>
49 #include <vcl/event.hxx>
50 #include <vcl/waitobj.hxx>
51 #include <vcl/wrkwin.hxx>
52 #include <vcl/toolkit/button.hxx>
53 #include <vcl/mnemonic.hxx>
54 #include <vcl/toolkit/dialog.hxx>
55 #include <vcl/dialoghelper.hxx>
56 #include <vcl/settings.hxx>
57 #include <vcl/virdev.hxx>
58 #include <vcl/weld.hxx>
59 #include <vcl/uitest/uiobject.hxx>
60 #include <vcl/uitest/logger.hxx>
62 #include <messagedialog.hxx>
63 #include <salframe.hxx>
64 #include <tools/json_writer.hxx>
65 
66 #include <iostream>
67 #include <utility>
68 
69 static OString ImplGetDialogText( Dialog* pDialog )
70 {
71  OStringBuffer aErrorStr(OUStringToOString(
72  pDialog->GetText(), RTL_TEXTENCODING_UTF8));
73 
74  OUString sMessage;
75  if (MessageDialog* pMessDialog = dynamic_cast<MessageDialog*>(pDialog))
76  {
77  sMessage = pMessDialog->get_primary_text();
78  }
79 
80  if (!sMessage.isEmpty())
81  {
82  aErrorStr.append(", ");
83  aErrorStr.append(OUStringToOString(
84  sMessage, RTL_TEXTENCODING_UTF8));
85  }
86  return aErrorStr.makeStringAndClear();
87 }
88 
89 static bool ImplIsMnemonicCtrl( vcl::Window* pWindow )
90 {
91  if( ! pWindow->GetSettings().GetStyleSettings().GetAutoMnemonic() )
92  return false;
93 
94  if ( (pWindow->GetType() == WindowType::RADIOBUTTON) ||
95  (pWindow->GetType() == WindowType::CHECKBOX) ||
96  (pWindow->GetType() == WindowType::TRISTATEBOX) ||
97  (pWindow->GetType() == WindowType::PUSHBUTTON) )
98  return true;
99 
100  if ( pWindow->GetType() == WindowType::FIXEDTEXT )
101  {
102  FixedText *pText = static_cast<FixedText*>(pWindow);
103  if (pText->get_mnemonic_widget())
104  return true;
105  //This is the legacy pre-layout logic which we retain
106  //until we can be sure we can remove it
107  if (pWindow->GetStyle() & WB_NOLABEL)
108  return false;
109  vcl::Window* pNextWindow = pWindow->GetWindow( GetWindowType::Next );
110  if ( !pNextWindow )
111  return false;
112  pNextWindow = pNextWindow->GetWindow( GetWindowType::Client );
113  return !(!(pNextWindow->GetStyle() & WB_TABSTOP) ||
114  (pNextWindow->GetType() == WindowType::FIXEDTEXT) ||
115  (pNextWindow->GetType() == WindowType::GROUPBOX) ||
116  (pNextWindow->GetType() == WindowType::RADIOBUTTON) ||
117  (pNextWindow->GetType() == WindowType::CHECKBOX) ||
118  (pNextWindow->GetType() == WindowType::TRISTATEBOX) ||
119  (pNextWindow->GetType() == WindowType::PUSHBUTTON));
120  }
121 
122  return false;
123 }
124 
125 // Called by native error dialog popup implementations
127 {
128  ImplSVData* pSVData = ImplGetSVData();
129  if( pSVData->mpIntroWindow )
130  pSVData->mpIntroWindow->Hide();
131 }
132 
134 {
135  const vcl::Window *pLastChild = pChild;
136 
137  if (pChild->GetType() == WindowType::SCROLLWINDOW)
138  pChild = static_cast<const VclScrolledWindow*>(pChild)->get_child();
139  else if (isContainerWindow(*pChild))
140  pChild = pChild->GetWindow(GetWindowType::FirstChild);
141  else
142  pChild = pChild->GetWindow(GetWindowType::Next);
143 
144  while (!pChild)
145  {
146  vcl::Window *pParent = pLastChild->GetParent();
147  if (!pParent)
148  return nullptr;
149  if (pParent == pTopLevel)
150  return nullptr;
151  pLastChild = pParent;
152  pChild = pParent->GetWindow(GetWindowType::Next);
153  }
154 
155  if (isContainerWindow(*pChild))
156  pChild = nextLogicalChildOfParent(pTopLevel, pChild);
157 
158  return const_cast<vcl::Window *>(pChild);
159 }
160 
162 {
163  const vcl::Window *pLastChild = pChild;
164 
165  if (pChild->GetType() == WindowType::SCROLLWINDOW)
166  pChild = static_cast<const VclScrolledWindow*>(pChild)->get_child();
167  else if (isContainerWindow(*pChild))
168  pChild = pChild->GetWindow(GetWindowType::LastChild);
169  else
170  pChild = pChild->GetWindow(GetWindowType::Prev);
171 
172  while (!pChild)
173  {
174  vcl::Window *pParent = pLastChild->GetParent();
175  if (!pParent)
176  return nullptr;
177  if (pParent == pTopLevel)
178  return nullptr;
179  pLastChild = pParent;
180  pChild = pParent->GetWindow(GetWindowType::Prev);
181  }
182 
183  if (isContainerWindow(*pChild))
184  pChild = prevLogicalChildOfParent(pTopLevel, pChild);
185 
186  return const_cast<vcl::Window *>(pChild);
187 }
188 
190 {
191  const vcl::Window *pChild = pTopLevel->GetWindow(GetWindowType::FirstChild);
192  if (pChild && isContainerWindow(*pChild))
193  pChild = nextLogicalChildOfParent(pTopLevel, pChild);
194  return const_cast<vcl::Window *>(pChild);
195 }
196 
198 {
199  const vcl::Window *pChild = pTopLevel->GetWindow(GetWindowType::LastChild);
200  if (pChild && isContainerWindow(*pChild))
201  pChild = prevLogicalChildOfParent(pTopLevel, pChild);
202  return const_cast<vcl::Window *>(pChild);
203 }
204 
205 void Accelerator::GenerateAutoMnemonicsOnHierarchy(const vcl::Window* pWindow)
206 {
207  MnemonicGenerator aMnemonicGenerator;
208  vcl::Window* pGetChild;
209  vcl::Window* pChild;
210 
211  // register the assigned mnemonics
212  pGetChild = pWindow->GetWindow( GetWindowType::FirstChild );
213  while ( pGetChild )
214  {
215  pChild = pGetChild->ImplGetWindow();
216  aMnemonicGenerator.RegisterMnemonic( pChild->GetText() );
217  pGetChild = nextLogicalChildOfParent(pWindow, pGetChild);
218  }
219 
220  // take the Controls of the dialog into account for TabPages
221  if ( pWindow->GetType() == WindowType::TABPAGE )
222  {
223  vcl::Window* pParent = pWindow->GetParent();
224  if (pParent && pParent->GetType() == WindowType::TABCONTROL )
225  pParent = pParent->GetParent();
226 
227  if (pParent && (pParent->GetStyle() & (WB_DIALOGCONTROL | WB_NODIALOGCONTROL)) == WB_DIALOGCONTROL )
228  {
229  pGetChild = pParent->GetWindow( GetWindowType::FirstChild );
230  while ( pGetChild )
231  {
232  pChild = pGetChild->ImplGetWindow();
233  aMnemonicGenerator.RegisterMnemonic( pChild->GetText() );
234  pGetChild = nextLogicalChildOfParent(pWindow, pGetChild);
235  }
236  }
237  }
238 
239  // assign mnemonics to Controls which have none
240  pGetChild = pWindow->GetWindow( GetWindowType::FirstChild );
241  while ( pGetChild )
242  {
243  pChild = pGetChild->ImplGetWindow();
244  if ( ImplIsMnemonicCtrl( pChild ) )
245  {
246  OUString aText = pChild->GetText();
247  OUString aNewText = aMnemonicGenerator.CreateMnemonic( aText );
248  if ( aText != aNewText )
249  pChild->SetText( aNewText );
250  }
251 
252  pGetChild = nextLogicalChildOfParent(pWindow, pGetChild);
253  }
254 }
255 
256 static VclButtonBox* getActionArea(Dialog const *pDialog)
257 {
258  VclButtonBox *pButtonBox = nullptr;
259  if (pDialog->isLayoutEnabled())
260  {
263  while (pChild)
264  {
265  pButtonBox = dynamic_cast<VclButtonBox*>(pChild);
266  if (pButtonBox)
267  break;
268  pChild = pChild->GetWindow(GetWindowType::Prev);
269  }
270  }
271  return pButtonBox;
272 }
273 
275 {
276  VclButtonBox* pButtonBox = getActionArea(pDialog);
277  if (pButtonBox)
278  return pButtonBox->GetWindow(GetWindowType::FirstChild);
279  return pDialog->GetWindow(GetWindowType::FirstChild);
280 }
281 
282 static PushButton* ImplGetDefaultButton( Dialog const * pDialog )
283 {
284  vcl::Window* pChild = getActionAreaButtonList(pDialog);
285  while ( pChild )
286  {
287  if ( pChild->ImplIsPushButton() )
288  {
289  PushButton* pPushButton = static_cast<PushButton*>(pChild);
290  if ( pPushButton->ImplIsDefButton() )
291  return pPushButton;
292  }
293 
294  pChild = pChild->GetWindow( GetWindowType::Next );
295  }
296 
297  return nullptr;
298 }
299 
300 static PushButton* ImplGetOKButton( Dialog const * pDialog )
301 {
302  vcl::Window* pChild = getActionAreaButtonList(pDialog);
303  while ( pChild )
304  {
305  if ( pChild->GetType() == WindowType::OKBUTTON )
306  return static_cast<PushButton*>(pChild);
307 
308  pChild = pChild->GetWindow( GetWindowType::Next );
309  }
310 
311  return nullptr;
312 }
313 
314 static PushButton* ImplGetCancelButton( Dialog const * pDialog )
315 {
316  vcl::Window* pChild = getActionAreaButtonList(pDialog);
317 
318  while ( pChild )
319  {
320  if ( pChild->GetType() == WindowType::CANCELBUTTON )
321  return static_cast<PushButton*>(pChild);
322 
323  pChild = pChild->GetWindow( GetWindowType::Next );
324  }
325 
326  return nullptr;
327 }
328 
329 static void ImplMouseAutoPos( Dialog* pDialog )
330 {
331  MouseSettingsOptions nMouseOptions = pDialog->GetSettings().GetMouseSettings().GetOptions();
332  if ( nMouseOptions & MouseSettingsOptions::AutoCenterPos )
333  {
334  Size aSize = pDialog->GetOutputSizePixel();
335  pDialog->SetPointerPosPixel( Point( aSize.Width()/2, aSize.Height()/2 ) );
336  }
337  else if ( nMouseOptions & MouseSettingsOptions::AutoDefBtnPos )
338  {
339  vcl::Window* pWindow = ImplGetDefaultButton( pDialog );
340  if ( !pWindow )
341  pWindow = ImplGetOKButton( pDialog );
342  if ( !pWindow )
343  pWindow = ImplGetCancelButton( pDialog );
344  if ( !pWindow )
345  pWindow = pDialog;
346  Size aSize = pWindow->GetOutputSizePixel();
347  pWindow->SetPointerPosPixel( Point( aSize.Width()/2, aSize.Height()/2 ) );
348  }
349 }
350 
352 {
353  std::vector<VclPtr<PushButton>> maOwnedButtons;
354  std::map<VclPtr<vcl::Window>, short> maResponses;
361 
362  DialogImpl() : mnResult( -1 ), mbStartedModal( false ), m_bLOKTunneling( true ) {}
363 
364 #ifndef NDEBUG
365  short get_response(vcl::Window *pWindow) const
366  {
367  auto aFind = maResponses.find(pWindow);
368  if (aFind != maResponses.end())
369  return aFind->second;
370  return RET_CANCEL;
371  }
372 #endif
373 
375  {
376  for (VclPtr<PushButton> & pOwnedButton : maOwnedButtons)
377  pOwnedButton.disposeAndClear();
378  }
379 };
380 
382 {
383  for (VclPtr<PushButton> & pOwnedButton : mpDialogImpl->maOwnedButtons)
384  pOwnedButton.disposeAndClear();
385 }
386 
388 {
389  mpWindowImpl->mbDialog = true;
390  mbInExecute = false;
391  mbInSyncExecute = false;
392  mbInClose = false;
393  mbModalMode = false;
396  mnMousePositioned = 0;
397  mpDialogImpl.reset(new DialogImpl);
398 }
399 
401 {
402  if (!mpDialogImpl->m_bLOKTunneling)
403  return;
404 
405  Window::PixelInvalidate(pRectangle);
406 }
407 
409 {
411  if (!pParent && !(nStyle & WB_SYSTEMWINDOW))
412  pParent = ImplGetSVData()->maFrameData.mpAppWin;
413 
414  // If Parent is disabled, then we search for a modal dialog
415  // in this frame
416  if (pParent && (!pParent->IsInputEnabled() || pParent->IsInModalMode()))
417  {
418  ImplSVData* pSVData = ImplGetSVData();
419  auto& rExecuteDialogs = pSVData->mpWinData->mpExecuteDialogs;
420  auto it = std::find_if(rExecuteDialogs.rbegin(), rExecuteDialogs.rend(),
421  [&pParent](VclPtr<Dialog>& rDialogPtr) {
422  return pParent->ImplGetFirstOverlapWindow()->IsWindowOrChild(rDialogPtr, true) &&
423  rDialogPtr->IsReallyVisible() && rDialogPtr->IsEnabled() &&
424  rDialogPtr->IsInputEnabled() && !rDialogPtr->IsInModalMode(); });
425  if (it != rExecuteDialogs.rend())
426  pParent = it->get();
427  }
428 
429  return pParent;
430 }
431 
433 {
434  VclPtrInstance<ImplBorderWindow> pBorderWin( pParent, nStyle, BorderWindowStyle::Frame );
435  ImplInit( pBorderWin, nStyle & ~WB_BORDER, nullptr );
436  pBorderWin->mpWindowImpl->mpClientWindow = this;
437  pBorderWin->GetBorder( mpWindowImpl->mnLeftBorder, mpWindowImpl->mnTopBorder, mpWindowImpl->mnRightBorder, mpWindowImpl->mnBottomBorder );
438  mpWindowImpl->mpBorderWindow = pBorderWin;
439  mpWindowImpl->mpRealParent = pParent;
440 
441  return pBorderWin;
442 }
443 
444 void Dialog::ImplInitDialog( vcl::Window* pParent, WinBits nStyle, InitFlag eFlag )
445 {
447 
448  if ( !(nStyle & WB_NODIALOGCONTROL) )
449  nStyle |= WB_DIALOGCONTROL;
450 
451  // Now, all Dialogs are per default system windows !!!
452  nStyle |= WB_SYSTEMWINDOW;
453 
454  if (InitFlag::NoParent == eFlag)
455  {
456  pParent = nullptr;
457  }
458  else if (!pParent) // parent is NULL: get the default Dialog parent
459  {
460  pParent = Dialog::GetDefaultParent(nStyle);
461  }
462 
463  if ( !pParent || (nStyle & WB_SYSTEMWINDOW) ||
464  (pParent->mpWindowImpl->mpFrameData->mbNeedSysWindow && !(nSysWinMode & SystemWindowFlags::NOAUTOMODE)) ||
465  (nSysWinMode & SystemWindowFlags::DIALOG) )
466  {
467  // create window with a small border ?
468  if ((nStyle & WB_ALLOWMENUBAR) || ((nStyle & (WB_BORDER | WB_NOBORDER | WB_MOVEABLE | WB_SIZEABLE | WB_CLOSEABLE)) == WB_BORDER))
469  {
470  AddBorderWindow(pParent, nStyle);
471  }
472  else
473  {
474  mpWindowImpl->mbFrame = true;
475  mpWindowImpl->mbOverlapWin = true;
476  ImplInit( pParent, (nStyle & (WB_MOVEABLE | WB_SIZEABLE | WB_STANDALONE)) | WB_CLOSEABLE, nullptr );
477  // Now set all style bits
478  mpWindowImpl->mnStyle = nStyle;
479  }
480  }
481  else
482  {
483  VclPtrInstance<ImplBorderWindow> pBorderWin( pParent, nStyle, BorderWindowStyle::Overlap );
484  ImplInit( pBorderWin, nStyle & ~WB_BORDER, nullptr );
485  pBorderWin->mpWindowImpl->mpClientWindow = this;
486  pBorderWin->GetBorder( mpWindowImpl->mnLeftBorder, mpWindowImpl->mnTopBorder, mpWindowImpl->mnRightBorder, mpWindowImpl->mnBottomBorder );
487  mpWindowImpl->mpBorderWindow = pBorderWin;
488  mpWindowImpl->mpRealParent = pParent;
489  }
490 
492 
494 }
495 
497 {
498  if (IsControlBackground())
499  {
500  // user override
502  }
504  {
505  // NWF background
506  mpWindowImpl->mnNativeBackground = ControlPart::BackgroundDialog;
508  }
509  else
510  {
511  // fallback to settings color
512  rRenderContext.SetBackground(GetSettings().GetStyleSettings().GetDialogColor());
513  }
514 }
515 
517 {
518  // user override
519  if (IsControlBackground())
521  // NWF background
523  {
524  mpWindowImpl->mnNativeBackground = ControlPart::BackgroundDialog;
526  }
527  // fallback to settings color
528  else
529  SetBackground(GetSettings().GetStyleSettings().GetDialogColor());
530 }
531 
533 {
534  if (comphelper::LibreOfficeKit::isActive() && pParent)
535  {
536  if (VclPtr<vcl::Window> pWin = pParent->GetParentWithLOKNotifier())
537  {
538  SetLOKNotifier(pWin->GetLOKNotifier());
539  }
540  }
541 }
542 
544  : SystemWindow( nType )
545  , mnInitFlag(InitFlag::Default)
546 {
548 }
549 
551 {
552  if (m_pUIBuilder)
553  m_pUIBuilder->disposeBuilder();
554 }
555 
557 {
558  OUString sShareLayer("$BRAND_BASE_DIR/$BRAND_SHARE_SUBDIR/config/soffice.cfg/");
559  rtl::Bootstrap::expandMacros(sShareLayer);
560  return sShareLayer;
561 }
562 
563 //we can't change sizeable after the fact, so need to defer until we know and then
564 //do the init. Find the real parent stashed in mpDialogParent.
566 {
568  mpDialogParent = nullptr;
569  ImplInitDialog(pParent, nBits | WB_BORDER, mnInitFlag);
570  mbIsDeferredInit = false;
571 }
572 
573 Dialog::Dialog(vcl::Window* pParent, std::u16string_view rID, const OUString& rUIXMLDescription)
575  , mnInitFlag(InitFlag::Default)
576 {
577  ImplLOKNotifier(pParent);
579  loadUI(pParent, OUStringToOString(rID, RTL_TEXTENCODING_UTF8), rUIXMLDescription);
580 }
581 
582 Dialog::Dialog(vcl::Window* pParent, WinBits nStyle, InitFlag eFlag)
584  , mnInitFlag(eFlag)
585 {
586  ImplLOKNotifier(pParent);
588  ImplInitDialog( pParent, nStyle, eFlag );
589 }
590 
592 {
593  mpActionArea.set(pBox);
594  if (pBox)
595  {
596  const DialogStyle& rDialogStyle =
598  pBox->set_border_width(rDialogStyle.action_area_border);
599  }
600 }
601 
603 {
604  mpContentArea.set(pBox);
605 }
606 
608 {
609  const DialogStyle& rDialogStyle =
611  VclBox * pBox2 = static_cast<VclBox*>(pBox);
612  pBox2->set_border_width(rDialogStyle.content_area_border);
613 }
614 
616 {
617  disposeOnce();
618 }
619 
621 {
622  bool bTunnelingEnabled = mpDialogImpl->m_bLOKTunneling;
623 
624  mpDialogImpl.reset();
628 
629  css::uno::Reference< css::uno::XComponentContext > xContext(
631  css::uno::Reference<css::frame::XGlobalEventBroadcaster> xEventBroadcaster(css::frame::theGlobalEventBroadcaster::get(xContext), css::uno::UNO_SET_THROW);
632  css::document::DocumentEvent aObject;
633  aObject.EventName = "DialogClosed";
634  xEventBroadcaster->documentEventOccured(aObject);
635  UITestLogger::getInstance().log(u"Close Dialog");
636 
638  {
639  if(const vcl::ILibreOfficeKitNotifier* pNotifier = GetLOKNotifier())
640  {
641  if (bTunnelingEnabled)
642  pNotifier->notifyWindow(GetLOKWindowId(), "close");
644  }
645  }
646 
648 }
649 
650 IMPL_LINK_NOARG(Dialog, ImplAsyncCloseHdl, void*, void)
651 {
652  Close();
653 }
654 
656 {
657  // first call the base class due to Tab control
658  bool bRet = SystemWindow::EventNotify( rNEvt );
659  if ( !bRet )
660  {
661  if ( rNEvt.GetType() == MouseNotifyEvent::KEYINPUT )
662  {
663  const KeyEvent* pKEvt = rNEvt.GetKeyEvent();
664  vcl::KeyCode aKeyCode = pKEvt->GetKeyCode();
665  sal_uInt16 nKeyCode = aKeyCode.GetCode();
666 
667  if ( (nKeyCode == KEY_ESCAPE) &&
668  ((GetStyle() & WB_CLOSEABLE) || ImplGetCancelButton( this ) || ImplGetOKButton( this )) )
669  {
670  // #i89505# for the benefit of slightly mentally challenged implementations
671  // like e.g. SfxModelessDialog which destroy themselves inside Close()
672  // post this Close asynchronous so we can leave our key handler before
673  // we get destroyed
674  PostUserEvent( LINK( this, Dialog, ImplAsyncCloseHdl ), nullptr, true);
675  return true;
676  }
677  }
678  else if ( rNEvt.GetType() == MouseNotifyEvent::GETFOCUS )
679  {
680  // make sure the dialog is still modal
681  // changing focus between application frames may
682  // have re-enabled input for our parent
683  if( mbInExecute && mbModalMode )
684  {
685  ImplSetModalInputMode( false );
686  ImplSetModalInputMode( true );
687 
688  // #93022# def-button might have changed after show
689  if( !mnMousePositioned )
690  {
691  mnMousePositioned = 1;
692  ImplMouseAutoPos( this );
693  }
694 
695  }
696  }
697  }
698 
699  return bRet;
700 }
701 
702 //What we really want here is something that gives the available width and
703 //height of a users screen, taking away the space taken up the OS
704 //taskbar, menus, etc.
706 {
707 #ifndef IOS
708  tools::Long w = rScreenSize.Width();
709  if (w <= 800)
710  w -= 15;
711  else if (w <= 1024)
712  w -= 65;
713  else
714  w -= 115;
715 
716  tools::Long h = rScreenSize.Height();
717  if (h <= 768)
718  h -= 50;
719  else
720  h -= 100;
721 
722  return Size(std::max<tools::Long>(w, 640 - 15),
723  std::max<tools::Long>(h, 480 - 50));
724 #else
725  // Don't bother with ancient magic numbers of unclear relevance on non-desktop apps anyway. It
726  // seems that at least currently in the iOS app, this function is called just once per dialog,
727  // with a rScreenSize parameter of 1x1 (!). This would lead to always returning 625x430 which is
728  // a bit random and needlessly small on an iPad at least. We want something that closely will
729  // just fit on the display in either orientation.
730 
731  // We ignore the rScreenSize as it will be the dummy 1x1 from iosinst.cxx (see "Totally wrong of course").
732  (void) rScreenSize;
733 
734  const int n = std::min<CGFloat>([[UIScreen mainScreen] bounds].size.width, [[UIScreen mainScreen] bounds].size.height);
735  return Size(n-10, n-10);
736 #endif
737 }
738 
740 {
741  mpDialogImpl->m_aPopupMenuHdl = rLink;
742 }
743 
745 {
746  mpDialogImpl->m_aInstallLOKNotifierHdl = rLink;
747 }
748 
749 void Dialog::SetLOKTunnelingState(bool bEnabled)
750 {
751  mpDialogImpl->m_bLOKTunneling = bEnabled;
752 }
753 
755 {
756  bool bTunnelingEnabled = mpDialogImpl->m_bLOKTunneling;
757 
758  if (nType == StateChangedType::InitShow)
759  {
760  DoInitialLayout();
761 
762  const bool bKitActive = comphelper::LibreOfficeKit::isActive();
763  if (bKitActive && bTunnelingEnabled)
764  {
765  std::vector<vcl::LOKPayloadItem> aItems;
766  aItems.emplace_back("type", "dialog");
767  aItems.emplace_back("size", GetSizePixel().toString());
768  if (!GetText().isEmpty())
769  aItems.emplace_back("title", GetText().toUtf8());
770 
771  if (const vcl::ILibreOfficeKitNotifier* pNotifier = GetLOKNotifier())
772  {
773  pNotifier->notifyWindow(GetLOKWindowId(), "created", aItems);
774  pNotifier->notifyWindow(GetLOKWindowId(), "created", aItems);
775  }
776  else
777  {
778  vcl::ILibreOfficeKitNotifier* pViewShell = mpDialogImpl->m_aInstallLOKNotifierHdl.Call(nullptr);
779  if (pViewShell)
780  {
781  SetLOKNotifier(pViewShell);
782  pViewShell->notifyWindow(GetLOKWindowId(), "created", aItems);
783  }
784  }
785  }
786 
787  if ( !HasChildPathFocus() || HasFocus() )
789  if ( !(GetStyle() & WB_CLOSEABLE) )
790  {
791  if ( ImplGetCancelButton( this ) || ImplGetOKButton( this ) )
792  {
793  if ( ImplGetBorderWindow() )
794  static_cast<ImplBorderWindow*>(ImplGetBorderWindow())->SetCloseButton();
795  }
796  }
797 
798  ImplMouseAutoPos( this );
799  }
800  else if (nType == StateChangedType::Text)
801  {
802  const vcl::ILibreOfficeKitNotifier* pNotifier = GetLOKNotifier();
803  if (pNotifier && bTunnelingEnabled)
804  {
805  std::vector<vcl::LOKPayloadItem> aPayload;
806  aPayload.emplace_back("title", GetText().toUtf8());
807  pNotifier->notifyWindow(GetLOKWindowId(), "title_changed", aPayload);
808  }
809  }
810 
812 
814  {
816  Invalidate();
817  }
818 
819  if (!mbModalMode && nType == StateChangedType::Visible)
820  {
821  const vcl::ILibreOfficeKitNotifier* pNotifier = GetLOKNotifier();
822  if (pNotifier && bTunnelingEnabled)
823  {
824  std::vector<vcl::LOKPayloadItem> aPayload;
825  aPayload.emplace_back("title", GetText().toUtf8());
826  pNotifier->notifyWindow(GetLOKWindowId(), IsVisible()? OUString("show"): OUString("hide"), aPayload);
827  }
828  }
829 }
830 
832 {
833  SystemWindow::DataChanged( rDCEvt );
834 
835  if ( (rDCEvt.GetType() == DataChangedEventType::SETTINGS) &&
836  (rDCEvt.GetFlags() & AllSettingsFlags::STYLE) )
837  {
839  Invalidate();
840  }
841 }
842 
844 {
845  VclPtr<vcl::Window> xWindow = this;
847  if ( xWindow->IsDisposed() )
848  return false;
849 
850  if ( mpWindowImpl->mxWindowPeer.is() && IsCreatedWithToolkit() && !IsInExecute() )
851  return false;
852 
853  // If there's a cancel button with a custom handler, then always give it a chance to
854  // handle Dialog::Close
855  PushButton* pCustomCancelButton;
856  PushButton* pCancelButton = dynamic_cast<PushButton*>(get_widget_for_response(RET_CANCEL));
857  if (!mbInClose && pCancelButton && pCancelButton->GetClickHdl().IsSet())
858  pCustomCancelButton = pCancelButton;
859  else
860  pCustomCancelButton = nullptr;
861 
862  mbInClose = true;
863 
864  if (pCustomCancelButton)
865  {
866  pCustomCancelButton->Click();
867  if (xWindow->IsDisposed())
868  return true;
869  mbInClose = false;
870  return false;
871  }
872 
873  if ( !(GetStyle() & WB_CLOSEABLE) )
874  {
875  bool bRet = true;
876  PushButton* pButton = ImplGetCancelButton( this );
877  if ( pButton )
878  pButton->Click();
879  else
880  {
881  pButton = ImplGetOKButton( this );
882  if ( pButton )
883  pButton->Click();
884  else
885  bRet = false;
886  }
887  if ( xWindow->IsDisposed() )
888  return true;
889  return bRet;
890  }
891 
892  if (IsInExecute() || mpDialogImpl->maEndCtx.isSet())
893  {
894  EndDialog();
895  mbInClose = false;
896  return true;
897  }
898  else
899  {
900  mbInClose = false;
901  return SystemWindow::Close();
902  }
903 }
904 
906 {
908 
909  if (IsInExecute() || mpDialogImpl->maEndCtx.isSet())
910  {
911 #ifdef DBG_UTIL
912  SAL_WARN( "vcl", "Dialog::StartExecuteModal() is called in Dialog::StartExecuteModal(): "
913  << ImplGetDialogText(this) );
914 #endif
915  return false;
916  }
917 
918  ImplSVData* pSVData = ImplGetSVData();
919 
920  const bool bKitActive = comphelper::LibreOfficeKit::isActive();
921 
922  const bool bModal = GetType() != WindowType::MODELESSDIALOG;
923 
924  if (bModal)
925  {
926  if (bKitActive && !GetLOKNotifier())
927  SetLOKNotifier(mpDialogImpl->m_aInstallLOKNotifierHdl.Call(nullptr));
928 
930  {
932  break;
934  if (bModal && GetLOKNotifier())
935  {
936  // check if there's already some dialog being ::Execute()d
937  const bool bDialogExecuting = std::any_of(pSVData->mpWinData->mpExecuteDialogs.begin(),
938  pSVData->mpWinData->mpExecuteDialogs.end(),
939  [](const Dialog* pDialog) {
940  return pDialog->IsInSyncExecute();
941  });
942  if (!(bDialogExecuting && IsInSyncExecute()))
943  break;
944  else
945  SAL_WARN("lok.dialog", "Dialog \"" << ImplGetDialogText(this) << "\" is being synchronously executed over an existing synchronously executing dialog.");
946  }
947 
948  SAL_INFO(
949  "vcl",
950  "Dialog \"" << ImplGetDialogText(this)
951  << "\"cancelled in silent mode");
952  return false;
953  default: // default cannot happen
955  std::abort();
956  }
957 
958 #ifdef DBG_UTIL
959  vcl::Window* pParent = GetParent();
960  if ( pParent )
961  {
962  pParent = pParent->ImplGetFirstOverlapWindow();
963  SAL_WARN_IF( !pParent->IsReallyVisible(), "vcl",
964  "Dialog::StartExecuteModal() - Parent not visible" );
965  SAL_WARN_IF( !pParent->IsInputEnabled(), "vcl",
966  "Dialog::StartExecuteModal() - Parent input disabled, use another parent to ensure modality!" );
967  SAL_WARN_IF( pParent->IsInModalMode(), "vcl",
968  "Dialog::StartExecuteModal() - Parent already modally disabled, use another parent to ensure modality!" );
969  }
970 #endif
971 
972  // link all dialogs which are being executed
973  pSVData->mpWinData->mpExecuteDialogs.push_back(this);
974 
975  // stop capturing, in order to have control over the dialog
976  if (pSVData->mpWinData->mpTrackWin)
978  if (pSVData->mpWinData->mpCaptureWin)
979  pSVData->mpWinData->mpCaptureWin->ReleaseMouse();
980  EnableInput();
981  }
982 
983  mbInExecute = true;
984  // no real modality in LibreOfficeKit
985  if (!bKitActive && bModal)
986  SetModalInputMode(true);
987 
988  // FIXME: no layouting, workaround some clipping issues
990 
991  css::uno::Reference< css::uno::XComponentContext > xContext(
993  bool bForceFocusAndToFront(officecfg::Office::Common::View::NewDocumentHandling::ForceFocusAndToFront::get(xContext));
994  ShowFlags showFlags = bForceFocusAndToFront ? ShowFlags::ForegroundTask : ShowFlags::NONE;
995  Show(true, showFlags);
996 
997  if (bModal)
998  pSVData->maAppData.mnModalMode++;
999 
1000  css::uno::Reference<css::frame::XGlobalEventBroadcaster> xEventBroadcaster(
1001  css::frame::theGlobalEventBroadcaster::get(xContext), css::uno::UNO_SET_THROW);
1002  css::document::DocumentEvent aObject;
1003  aObject.EventName = "DialogExecute";
1004  xEventBroadcaster->documentEventOccured(aObject);
1005  if (bModal)
1006  UITestLogger::getInstance().log(OUString("Open Modal " + get_id()));
1007  else
1008  UITestLogger::getInstance().log(OUString("Open Modeless " + get_id()));
1009 
1010  bool bTunnelingEnabled = mpDialogImpl->m_bLOKTunneling;
1011  if (comphelper::LibreOfficeKit::isActive() && bTunnelingEnabled)
1012  {
1013  if (const vcl::ILibreOfficeKitNotifier* pNotifier = GetLOKNotifier())
1014  {
1015  // Dialog boxes don't get the Resize call and they
1016  // can have invalid size at 'created' message above.
1017  // If there is no difference, the client should detect it and ignore us,
1018  // otherwise, this should make sure that the window has the correct size.
1019  std::vector<vcl::LOKPayloadItem> aItems;
1020  aItems.emplace_back("size", GetSizePixel().toString());
1021  pNotifier->notifyWindow(GetLOKWindowId(), "size_changed", aItems);
1022  }
1023  }
1024 
1025  return true;
1026 }
1027 
1029 {
1030  ImplSVData* pSVData = ImplGetSVData();
1031  pSVData->maAppData.mnModalMode--;
1032 }
1033 
1035 {
1036 // Once the Android app is based on same idea as the iOS one currently
1037 // being developed, no conditional should be needed here. Until then,
1038 // play it safe.
1039 #if HAVE_FEATURE_DESKTOP || defined IOS
1040  VclPtr<vcl::Window> xWindow = this;
1041 
1042  mbInSyncExecute = true;
1043  comphelper::ScopeGuard aGuard([&]() {
1044  mbInSyncExecute = false;
1045  });
1046 
1047  if ( !ImplStartExecute() )
1048  return 0;
1049 
1050  // Yield util EndDialog is called or dialog gets destroyed
1051  // (the latter should not happen, but better safe than sorry
1052  while ( !xWindow->IsDisposed() && mbInExecute )
1054 
1056 #ifdef DBG_UTIL
1058 #endif
1059  if ( !xWindow->IsDisposed() )
1060  xWindow.clear();
1061  else
1062  {
1063  OSL_FAIL( "Dialog::Execute() - Dialog destroyed in Execute()" );
1064  }
1065 
1066  tools::Long nRet = mpDialogImpl->mnResult;
1067  mpDialogImpl->mnResult = -1;
1068 
1069  return static_cast<short>(nRet);
1070 
1071 #else
1072  return RET_OK;
1073 #endif
1074 }
1075 
1076 // virtual
1078 {
1079  const bool bModal = GetType() != WindowType::MODELESSDIALOG;
1080  if (!ImplStartExecute())
1081  {
1082  rCtx.mxOwner.disposeAndClear();
1083  rCtx.mxOwnerDialogController.reset();
1084  rCtx.mxOwnerSelf.reset();
1085  return false;
1086  }
1087 
1088  mpDialogImpl->maEndCtx = rCtx;
1089  mpDialogImpl->mbStartedModal = bModal;
1090 
1091  return true;
1092 }
1093 
1095 {
1096  ImplSVData* pSVData = ImplGetSVData();
1097  auto& rExecuteDialogs = pSVData->mpWinData->mpExecuteDialogs;
1098 
1099  // remove dialog from the list of dialogs which are being executed
1100  rExecuteDialogs.erase(std::remove_if(rExecuteDialogs.begin(), rExecuteDialogs.end(), [this](VclPtr<Dialog>& dialog){ return dialog.get() == this; }), rExecuteDialogs.end());
1101 }
1102 
1104 {
1105  if (!mbInExecute || IsDisposed())
1106  return;
1107 
1108  const bool bModal = GetType() != WindowType::MODELESSDIALOG;
1109 
1110  Hide();
1111 
1113  {
1114  if(const vcl::ILibreOfficeKitNotifier* pNotifier = GetLOKNotifier())
1115  {
1116  pNotifier->notifyWindow(GetLOKWindowId(), "close");
1118  }
1119  }
1120 
1121  if (bModal)
1122  {
1123  SetModalInputMode(false);
1124 
1126 
1127  // set focus to previous modal dialog if it is modal for
1128  // the same frame parent (or NULL)
1129  ImplSVData* pSVData = ImplGetSVData();
1130  if (!pSVData->mpWinData->mpExecuteDialogs.empty())
1131  {
1132  VclPtr<Dialog> pPrevious = pSVData->mpWinData->mpExecuteDialogs.back();
1133 
1134  vcl::Window* pFrameParent = ImplGetFrameWindow()->ImplGetParent();
1135  vcl::Window* pPrevFrameParent = pPrevious->ImplGetFrameWindow()? pPrevious->ImplGetFrameWindow()->ImplGetParent(): nullptr;
1136  if( ( !pFrameParent && !pPrevFrameParent ) ||
1137  ( pFrameParent && pPrevFrameParent && pFrameParent->ImplGetFrame() == pPrevFrameParent->ImplGetFrame() )
1138  )
1139  {
1140  pPrevious->GrabFocus();
1141  }
1142  }
1143  }
1144 
1145  mpDialogImpl->mnResult = nResult;
1146 
1147  if ( mpDialogImpl->mbStartedModal )
1149 
1150  if ( mpDialogImpl && mpDialogImpl->maEndCtx.isSet() )
1151  {
1152  auto fn = std::move(mpDialogImpl->maEndCtx.maEndDialogFn);
1153  // std::move leaves maEndDialogFn in a valid state with unspecified
1154  // value. For the SwSyncBtnDlg case gcc and msvc left maEndDialogFn
1155  // unset, but clang left maEndDialogFn at its original value, keeping
1156  // an extra reference to the DialogController in its lambda giving
1157  // an inconsistent lifecycle for the dialog. Force it to be unset.
1158  mpDialogImpl->maEndCtx.maEndDialogFn = nullptr;
1159  fn(nResult);
1160  }
1161 
1162  if ( mpDialogImpl && mpDialogImpl->mbStartedModal )
1163  {
1164  mpDialogImpl->mbStartedModal = false;
1165  mpDialogImpl->mnResult = -1;
1166  }
1167  mbInExecute = false;
1168 
1169  if ( mpDialogImpl )
1170  {
1171  // Destroy ourselves (if we have a context with VclPtr owner)
1172  std::shared_ptr<weld::DialogController> xOwnerDialogController = std::move(mpDialogImpl->maEndCtx.mxOwnerDialogController);
1173  std::shared_ptr<weld::Dialog> xOwnerSelf = std::move(mpDialogImpl->maEndCtx.mxOwnerSelf);
1174  mpDialogImpl->maEndCtx.mxOwner.disposeAndClear();
1175  xOwnerDialogController.reset();
1176  xOwnerSelf.reset();
1177  }
1178 }
1179 
1180 namespace vcl
1181 {
1182  void EndAllDialogs( vcl::Window const * pParent )
1183  {
1184  ImplSVData* pSVData = ImplGetSVData();
1185  auto& rExecuteDialogs = pSVData->mpWinData->mpExecuteDialogs;
1186 
1187  for (auto it = rExecuteDialogs.rbegin(); it != rExecuteDialogs.rend(); ++it)
1188  {
1189  if (!pParent || pParent->IsWindowOrChild(*it, true))
1190  {
1191  (*it)->EndDialog();
1192  (*it)->PostUserEvent(Link<void*, void>());
1193  }
1194  }
1195  }
1196 
1198  {
1199  if (Dialog* pDialog = dynamic_cast<Dialog*>(pWindow))
1200  {
1201  pDialog->EnableInput();
1202  }
1203  }
1204 
1206  {
1207  if (Dialog* pDialog = dynamic_cast<Dialog*>(pWindow))
1208  pDialog->Close();
1209  else if (FloatingWindow* pFloatWin = dynamic_cast<FloatingWindow*>(pWindow))
1211  }
1212 }
1213 
1214 void Dialog::SetModalInputMode( bool bModal )
1215 {
1216  if ( bModal == mbModalMode )
1217  return;
1218 
1219  ImplGetFrame()->SetModal(bModal);
1220 
1221  if (GetParent())
1222  {
1223  SalFrame* pFrame = GetParent()->ImplGetFrame();
1224  pFrame->NotifyModalHierarchy(bModal);
1225  }
1226 
1227  ImplSetModalInputMode(bModal);
1228 }
1229 
1231 {
1232  if ( bModal == mbModalMode )
1233  return;
1234 
1235  // previously Execute()'d dialog - the one below the top-most one
1236  VclPtr<Dialog> pPrevious;
1237  ImplSVData* pSVData = ImplGetSVData();
1238  auto& rExecuteDialogs = pSVData->mpWinData->mpExecuteDialogs;
1239  if (rExecuteDialogs.size() > 1)
1240  pPrevious = rExecuteDialogs[rExecuteDialogs.size() - 2];
1241 
1242  mbModalMode = bModal;
1243  if ( bModal )
1244  {
1245  // Disable the prev Modal Dialog, because our dialog must close at first,
1246  // before the other dialog can be closed (because the other dialog
1247  // is on stack since our dialog returns)
1248  if (pPrevious && !pPrevious->IsWindowOrChild(this, true))
1249  pPrevious->EnableInput(false, this);
1250 
1251  // determine next overlap dialog parent
1252  vcl::Window* pParent = GetParent();
1253  if ( pParent )
1254  {
1255  // #103716# dialogs should always be modal to the whole frame window
1256  // #115933# disable the whole frame hierarchy, useful if our parent
1257  // is a modeless dialog
1258  mpDialogParent = pParent->mpWindowImpl->mpFrameWindow;
1260  }
1261  }
1262  else
1263  {
1264  if ( mpDialogParent )
1265  {
1266  // #115933# re-enable the whole frame hierarchy again (see above)
1267  // note that code in getfocus assures that we do not accidentally enable
1268  // windows that were disabled before
1270  }
1271 
1272  // Enable the prev Modal Dialog
1273  if (pPrevious && !pPrevious->IsWindowOrChild(this, true))
1274  {
1275  pPrevious->EnableInput(true, this);
1276 
1277  // ensure continued modality of prev dialog
1278  // do not change modality counter
1279 
1280  // #i119994# need find the last modal dialog before reactive it
1281  if (pPrevious->IsModalInputMode() || !pPrevious->IsWindowOrChild(this, true))
1282  {
1283  pPrevious->ImplSetModalInputMode(false);
1284  pPrevious->ImplSetModalInputMode(true);
1285  }
1286  }
1287  }
1288 }
1289 
1291 {
1292  vcl::Window* pFocusControl;
1293 
1294  // find focus control, even if the dialog has focus
1295  if ( HasFocus() )
1296  pFocusControl = nullptr;
1297  else
1298  {
1299  // prefer a child window which had focus before
1300  pFocusControl = ImplGetFirstOverlapWindow()->mpWindowImpl->mpLastFocusWindow;
1301  // find the control out of the dialog control
1302  if ( pFocusControl )
1303  pFocusControl = ImplFindDlgCtrlWindow( pFocusControl );
1304  }
1305  // no control had the focus before or the control is not
1306  // part of the tab-control, now give focus to the
1307  // first control in the tab-control
1308  if ( !pFocusControl ||
1309  !(pFocusControl->GetStyle() & WB_TABSTOP) ||
1310  !isVisibleInLayout(pFocusControl) ||
1311  !isEnabledInLayout(pFocusControl) || !pFocusControl->IsInputEnabled() )
1312  {
1313  pFocusControl = ImplGetDlgWindow( 0, GetDlgWindowType::First );
1314  }
1315  if ( pFocusControl )
1316  pFocusControl->ImplControlFocus( GetFocusFlags::Init );
1317 }
1318 
1319 void Dialog::GetDrawWindowBorder( sal_Int32& rLeftBorder, sal_Int32& rTopBorder, sal_Int32& rRightBorder, sal_Int32& rBottomBorder ) const
1320 {
1321  ScopedVclPtrInstance<ImplBorderWindow> aImplWin( static_cast<vcl::Window*>(const_cast<Dialog *>(this)), WB_BORDER|WB_STDWORK, BorderWindowStyle::Overlap );
1322  aImplWin->GetBorder( rLeftBorder, rTopBorder, rRightBorder, rBottomBorder );
1323 }
1324 
1325 void Dialog::Draw( OutputDevice* pDev, const Point& rPos, DrawFlags )
1326 {
1327  Point aPos = pDev->LogicToPixel( rPos );
1328  Size aSize = GetSizePixel();
1329 
1330  Wallpaper aWallpaper = GetBackground();
1331  if ( !aWallpaper.IsBitmap() )
1332  ImplInitSettings();
1333 
1334  pDev->Push();
1335  pDev->SetMapMode();
1336  pDev->SetLineColor();
1337 
1338  if ( aWallpaper.IsBitmap() )
1339  pDev->DrawBitmapEx( aPos, aSize, aWallpaper.GetBitmap() );
1340  else
1341  {
1342  pDev->SetFillColor( aWallpaper.GetColor() );
1343  pDev->DrawRect( tools::Rectangle( aPos, aSize ) );
1344  }
1345 
1346  if (!( GetStyle() & WB_NOBORDER ))
1347  {
1349  aImplWin->SetText( GetText() );
1350  aImplWin->setPosSizePixel( aPos.X(), aPos.Y(), aSize.Width(), aSize.Height() );
1351  aImplWin->SetDisplayActive( true );
1352  aImplWin->InitView();
1353 
1354  aImplWin->Draw( pDev, aPos );
1355  }
1356 
1357  pDev->Pop();
1358 }
1359 
1361 {
1362  if (IsInClose())
1363  return;
1364  SystemWindow::queue_resize(eReason);
1365 }
1366 
1368 {
1370 
1372  return;
1373 
1374  bool bTunnelingEnabled = mpDialogImpl->m_bLOKTunneling;
1375  const vcl::ILibreOfficeKitNotifier* pNotifier = GetLOKNotifier();
1376  if (pNotifier && bTunnelingEnabled)
1377  {
1378  std::vector<vcl::LOKPayloadItem> aItems;
1379  aItems.emplace_back("size", GetSizePixel().toString());
1380  pNotifier->notifyWindow(GetLOKWindowId(), "size_changed", aItems);
1381  }
1382 }
1383 
1384 bool Dialog::set_property(const OString &rKey, const OUString &rValue)
1385 {
1386  if (rKey == "border-width")
1387  set_border_width(rValue.toInt32());
1388  else
1389  return SystemWindow::set_property(rKey, rValue);
1390  return true;
1391 }
1392 
1394 {
1395  return DialogUIObject::create;
1396 }
1397 
1398 IMPL_LINK(Dialog, ResponseHdl, Button*, pButton, void)
1399 {
1400  auto aFind = mpDialogImpl->maResponses.find(pButton);
1401  if (aFind == mpDialogImpl->maResponses.end())
1402  return;
1403  short nResponse = aFind->second;
1404  if (nResponse == RET_HELP)
1405  {
1407  if (!pFocusWin || comphelper::LibreOfficeKit::isActive())
1408  pFocusWin = pButton;
1410  pFocusWin->RequestHelp(aEvt);
1411  return;
1412  }
1413  EndDialog(nResponse);
1414 }
1415 
1416 void Dialog::add_button(PushButton* pButton, int response, bool bTransferOwnership)
1417 {
1418  if (bTransferOwnership)
1419  mpDialogImpl->maOwnedButtons.push_back(pButton);
1420  mpDialogImpl->maResponses[pButton] = response;
1421  switch (pButton->GetType())
1422  {
1423  case WindowType::PUSHBUTTON:
1424  {
1425  if (!pButton->GetClickHdl().IsSet())
1426  pButton->SetClickHdl(LINK(this, Dialog, ResponseHdl));
1427  break;
1428  }
1429  //insist that the response ids match the default actions for those
1430  //widgets, and leave their default handlers in place
1431  case WindowType::OKBUTTON:
1432  assert(mpDialogImpl->get_response(pButton) == RET_OK);
1433  break;
1434  case WindowType::CANCELBUTTON:
1435  assert(mpDialogImpl->get_response(pButton) == RET_CANCEL || mpDialogImpl->get_response(pButton) == RET_CLOSE);
1436  break;
1437  case WindowType::HELPBUTTON:
1438  assert(mpDialogImpl->get_response(pButton) == RET_HELP);
1439  break;
1440  default:
1441  SAL_WARN("vcl.layout", "The type of widget " <<
1442  pButton->GetHelpId() << " is currently not handled");
1443  break;
1444  }
1445 }
1446 
1448 {
1449  //copy explicit responses
1450  std::map<VclPtr<vcl::Window>, short> aResponses(mpDialogImpl->maResponses);
1451 
1452  if (mpActionArea)
1453  {
1454  //add implicit responses
1456  pChild = pChild->GetWindow(GetWindowType::Next))
1457  {
1458  if (aResponses.find(pChild) != aResponses.end())
1459  continue;
1460  switch (pChild->GetType())
1461  {
1462  case WindowType::OKBUTTON:
1463  aResponses[pChild] = RET_OK;
1464  break;
1465  case WindowType::CANCELBUTTON:
1466  aResponses[pChild] = RET_CANCEL;
1467  break;
1468  case WindowType::HELPBUTTON:
1469  aResponses[pChild] = RET_HELP;
1470  break;
1471  default:
1472  break;
1473  }
1474  }
1475  }
1476 
1477  for (const auto& a : aResponses)
1478  {
1479  if (a.second == response)
1480  return a.first;
1481  }
1482 
1483  return nullptr;
1484 }
1485 
1487 {
1488  //copy explicit responses
1489  std::map<VclPtr<vcl::Window>, short> aResponses(mpDialogImpl->maResponses);
1490 
1491  if (mpActionArea)
1492  {
1493  //add implicit responses
1495  pChild = pChild->GetWindow(GetWindowType::Next))
1496  {
1497  if (aResponses.find(pChild) != aResponses.end())
1498  continue;
1499  switch (pChild->GetType())
1500  {
1501  case WindowType::OKBUTTON:
1502  aResponses[pChild] = RET_OK;
1503  break;
1504  case WindowType::CANCELBUTTON:
1505  aResponses[pChild] = RET_CANCEL;
1506  break;
1507  case WindowType::HELPBUTTON:
1508  aResponses[pChild] = RET_HELP;
1509  break;
1510  default:
1511  break;
1512  }
1513  }
1514  }
1515 
1516  for (const auto& a : aResponses)
1517  {
1518  if (a.first->GetStyle() & WB_DEFBUTTON)
1519  {
1520  return a.second;
1521  }
1522  }
1523  return RET_CANCEL;
1524 }
1525 
1527 {
1528  //copy explicit responses
1529  std::map<VclPtr<vcl::Window>, short> aResponses(mpDialogImpl->maResponses);
1530 
1531  if (mpActionArea)
1532  {
1533  //add implicit responses
1535  pChild = pChild->GetWindow(GetWindowType::Next))
1536  {
1537  if (aResponses.find(pChild) != aResponses.end())
1538  continue;
1539  switch (pChild->GetType())
1540  {
1541  case WindowType::OKBUTTON:
1542  aResponses[pChild] = RET_OK;
1543  break;
1544  case WindowType::CANCELBUTTON:
1545  aResponses[pChild] = RET_CANCEL;
1546  break;
1547  case WindowType::HELPBUTTON:
1548  aResponses[pChild] = RET_HELP;
1549  break;
1550  default:
1551  break;
1552  }
1553  }
1554  }
1555 
1556  for (auto& a : aResponses)
1557  {
1558  if (a.second == response)
1559  {
1560  a.first->SetStyle(a.first->GetStyle() | WB_DEFBUTTON);
1561  a.first->GrabFocus();
1562  }
1563  else
1564  {
1565  a.first->SetStyle(a.first->GetStyle() & ~WB_DEFBUTTON);
1566  }
1567  }
1568 }
1569 
1571 {
1572 }
1573 
1575 {
1576  if (!m_pUIBuilder)
1577  return;
1578  m_pUIBuilder->setDeferredProperties();
1579 }
1580 
1582 {
1583 }
1584 
1586 {
1587  if (GetType() == WindowType::MODELESSDIALOG)
1588  {
1589  css::uno::Reference< css::uno::XComponentContext > xContext(
1591  css::uno::Reference<css::frame::XGlobalEventBroadcaster> xEventBroadcaster(css::frame::theGlobalEventBroadcaster::get(xContext), css::uno::UNO_SET_THROW);
1592  css::document::DocumentEvent aObject;
1593  aObject.EventName = "ModelessDialogVisible";
1594  xEventBroadcaster->documentEventOccured(aObject);
1595  }
1597 }
1598 
1599 void Dialog::Command(const CommandEvent& rCEvt)
1600 {
1601  if (mpDialogImpl && mpDialogImpl->m_aPopupMenuHdl.Call(rCEvt))
1602  return;
1603  SystemWindow::Command(rCEvt);
1604 }
1605 
1607 {
1608  // lock any toplevel windows from being closed until busy is over
1609  std::vector<VclPtr<vcl::Window>> aTopLevels;
1611  while (pTopWin)
1612  {
1613  vcl::Window* pCandidate = pTopWin;
1614  if (pCandidate->GetType() == WindowType::BORDERWINDOW)
1615  pCandidate = pCandidate->GetWindow(GetWindowType::FirstChild);
1616  // tdf#125266 ignore HelpTextWindows
1617  if (pCandidate &&
1618  pCandidate->GetType() != WindowType::HELPTEXTWINDOW &&
1619  pCandidate->GetType() != WindowType::FLOATINGWINDOW &&
1620  pCandidate->GetFrameWeld() != pIgnore)
1621  {
1622  aTopLevels.push_back(pCandidate);
1623  }
1624  pTopWin = Application::GetNextTopLevelWindow(pTopWin);
1625  }
1626  for (auto& a : aTopLevels)
1627  {
1628  a->IncModalCount();
1629  a->ImplGetFrame()->NotifyModalHierarchy(true);
1630  }
1631  m_aBusyStack.push(aTopLevels);
1632 }
1633 
1635 {
1636  // unlock locked toplevel windows from being closed now busy is over
1637  for (auto& a : m_aBusyStack.top())
1638  {
1639  if (a->IsDisposed())
1640  continue;
1641  a->DecModalCount();
1642  a->ImplGetFrame()->NotifyModalHierarchy(false);
1643  }
1644  m_aBusyStack.pop();
1645 }
1646 
1648 {
1649  SystemWindow::DumpAsPropertyTree(rJsonWriter);
1650  rJsonWriter.put("title", GetText());
1651  if (vcl::Window* pActionArea = get_action_area())
1652  {
1653  if (!pActionArea->IsVisible())
1654  rJsonWriter.put("collapsed", "true");
1655  }
1656 
1657  OUString sDialogId = OStringToOUString(GetHelpId(), RTL_TEXTENCODING_ASCII_US);
1658  sal_Int32 nStartPos = sDialogId.lastIndexOf('/');
1659  nStartPos = nStartPos >= 0 ? nStartPos + 1 : 0;
1660  rJsonWriter.put("dialogid", sDialogId.copy(nStartPos));
1661 }
1662 
1663 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SAL_DLLPRIVATE void ImplInitDialogData()
Definition: dialog.cxx:387
virtual void SetText(const OUString &rStr)
Definition: window.cxx:3017
do not automatically cancel dialogs
bool IsWindowOrChild(const vcl::Window *pWindow, bool bSystemWindow=false) const
Definition: stacking.cxx:1123
bool IsControlBackground() const
Definition: window2.cxx:1085
bool IsInputEnabled() const
Definition: window2.cxx:1125
vcl::Window * ImplGetWindow() const
if this is a proxy return the client, otherwise itself
Definition: window2.cxx:833
Point GetPointerPosPixel()
Definition: mouse.cxx:549
const Wallpaper & GetBackground() const
Definition: outdev.hxx:647
void setDeferredProperties()
Definition: dialog.cxx:1574
vcl::LOKWindowId GetLOKWindowId() const
Definition: window.cxx:3235
OUString sMessage
bool GetAutoMnemonic() const
WinBits const WB_SYSTEMWINDOW
bool isVisibleInLayout(const vcl::Window *pWindow)
Definition: layout.cxx:2840
vcl::Window * lastLogicalChildOfParent(const vcl::Window *pTopLevel)
Definition: dialog.cxx:197
WinBits const WB_NOLABEL
void log(std::u16string_view rString)
Definition: logger.cxx:184
void set_border_width(sal_Int32 nBorderWidth)
Definition: window2.cxx:1834
virtual bool EventNotify(NotifyEvent &rNEvt) override
Definition: dialog.cxx:655
virtual void queue_resize(StateChangedType eReason=StateChangedType::Layout) override
Definition: dialog.cxx:1360
void loadUI(vcl::Window *pParent, const OString &rID, const OUString &rUIXMLDescription, const css::uno::Reference< css::frame::XFrame > &rFrame=css::uno::Reference< css::frame::XFrame >())
Definition: syswin.cxx:88
virtual bool Close() override
Definition: dialog.cxx:843
virtual bool EventNotify(NotifyEvent &rNEvt) override
Definition: syswin.cxx:171
virtual ~Dialog() override
Definition: dialog.cxx:615
void SetClickHdl(const Link< Button *, void > &rLink)
Definition: button.hxx:79
virtual void ImplAdjustNWFSizes()
Definition: window3.cxx:35
void EndDialog(tools::Long nResult=RET_CANCEL)
Definition: dialog.cxx:1103
void DecModalCount()
Definition: window.cxx:3595
virtual void PixelInvalidate(const tools::Rectangle *pRectangle) override
Notification about some rectangle of the output device got invalidated.
Definition: dialog.cxx:400
WinBits const WB_NODIALOGCONTROL
void DrawBitmapEx(const Point &rDestPt, const BitmapEx &rBitmapEx)
This is an overloaded member function, provided for convenience. It differs from the above function o...
static vcl::Window * GetDefDialogParent()
Get the default parent window for dialog boxes.
Definition: svapp.cxx:1378
std::vector< VclPtr< PushButton > > maOwnedButtons
Definition: dialog.cxx:353
ImplSVAppData maAppData
Definition: svdata.hxx:391
long Long
void disposeAndClear()
Definition: vclptr.hxx:200
void SetDisplayActive(bool bActive)
Definition: brdwin.cxx:1855
Link< const CommandEvent &, bool > m_aPopupMenuHdl
Definition: dialog.cxx:358
const StyleSettings & GetStyleSettings() const
SAL_DLLPRIVATE void disposeOwnedButtons()
Definition: dialog.cxx:381
bool IsInSyncExecute() const
Definition: dialog.hxx:125
sal_Int64 n
SAL_DLLPRIVATE vcl::Window * ImplGetBorderWindow() const
Definition: window2.cxx:873
std::function< std::unique_ptr< UIObject >vcl::Window *)> FactoryFunction
virtual Size GetSizePixel() const
Definition: window.cxx:2393
SAL_DLLPRIVATE vcl::Window * ImplGetFrameWindow() const
Definition: window2.cxx:899
virtual void Draw(OutputDevice *pDev, const Point &rPos, DrawFlags nFlags) override
Definition: dialog.cxx:1325
static std::unique_ptr< UIObject > create(vcl::Window *pWindow)
void SetLOKNotifier(const vcl::ILibreOfficeKitNotifier *pNotifier, bool bParent=false)
Interface to register for dialog / window tunneling.
Definition: window.cxx:3160
sal_uInt16 GetCode() const
Definition: keycod.hxx:51
Link< void *, vcl::ILibreOfficeKitNotifier * > m_aInstallLOKNotifierHdl
Definition: dialog.cxx:359
DataChangedEventType GetType() const
Definition: event.hxx:356
const KeyEvent * GetKeyEvent() const
Definition: event.hxx:310
ShowFlags
Definition: window.hxx:159
OUString CreateMnemonic(const OUString &rKey)
Definition: mnemonic.cxx:121
const Color & GetControlBackground() const
Definition: window2.cxx:1080
bool IsCreatedWithToolkit() const
Definition: window2.cxx:1235
bool HasChildPathFocus(bool bSystemWindow=false) const
Definition: window.cxx:2995
bool mbStartedModal
Definition: dialog.cxx:356
VclPtr< VclButtonBox > mpActionArea
Definition: dialog.hxx:62
bool IsNativeControlSupported(ControlType nType, ControlPart nPart) const
Query the platform layer for control support.
void SetMapMode()
Definition: map.cxx:516
std::shared_ptr< weld::DialogController > mxOwnerDialogController
Definition: abstdlg.hxx:61
virtual FactoryFunction GetUITestFactory() const override
Definition: dialog.cxx:1393
IMPL_LINK(Dialog, ResponseHdl, Button *, pButton, void)
Definition: dialog.cxx:1398
SAL_DLLPRIVATE vcl::Window * ImplFindDlgCtrlWindow(vcl::Window *pWindow)
Definition: dlgctrl.cxx:1100
StateChangedType
Definition: window.hxx:317
static UITestLogger & getInstance()
Definition: logger.cxx:618
weld::Window * GetFrameWeld() const
Definition: window2.cxx:851
A construction helper for ScopedVclPtr.
Definition: vclptr.hxx:407
sal_Int64 WinBits
void SetBackground()
virtual void dispose() override
This is intended to be used to clear any locally held references to other Window-subclass objects...
Definition: dialog.cxx:620
const OUString & get_id() const
Get the ID of the window.
Definition: window.cxx:3933
void GrabFocusToFirstControl()
Definition: dialog.cxx:1290
VclPtr< vcl::Window > GetParentWithLOKNotifier()
Find the nearest parent with LOK Notifier; can be itself if this Window has LOK notifier set...
Definition: window.cxx:3240
virtual void DumpAsPropertyTree(tools::JsonWriter &)
Dumps itself and potentially its children to a property tree, to be written easily to JSON...
Definition: window.cxx:3340
void EnableDialogInput(vcl::Window *pWindow)
Definition: dialog.cxx:1197
WinBits const WB_DEFBUTTON
static bool ImplIsMnemonicCtrl(vcl::Window *pWindow)
Definition: dialog.cxx:89
static VclButtonBox * getActionArea(Dialog const *pDialog)
Definition: dialog.cxx:256
static void Yield()
Process the next event.
Definition: svapp.cxx:530
const BorderLinePrimitive2D *pCandidateB assert(pCandidateA)
std::shared_ptr< weld::Dialog > mxOwnerSelf
Definition: abstdlg.hxx:63
bool mbModalMode
Definition: dialog.hxx:59
void EndTracking(TrackingEventFlags nFlags=TrackingEventFlags::NONE)
Definition: window2.cxx:270
static PushButton * ImplGetOKButton(Dialog const *pDialog)
Definition: dialog.cxx:300
vcl::Window * nextLogicalChildOfParent(const vcl::Window *pTopLevel, const vcl::Window *pChild)
Definition: dialog.cxx:133
MouseSettingsOptions GetOptions() const
void NotifyModalHierarchy(bool bModal)
Definition: salframe.hxx:300
void Hide()
Definition: window.hxx:948
AllSettingsFlags GetFlags() const
Definition: event.hxx:357
void set_default_response(int nResponse)
Definition: dialog.cxx:1526
bool mbInSyncExecute
Definition: dialog.hxx:57
virtual void Click()
Definition: button.cxx:125
bool IsModalInputMode() const
Definition: dialog.hxx:147
virtual OUString GetText() const
Definition: window.cxx:3046
static SystemWindowFlags GetSystemWindowMode()
Get the system window mode of dialogs.
Definition: svapp.cxx:1455
OString OUStringToOString(std::u16string_view str, ConnectionSettings const *settings)
void CloseTopLevel(vcl::Window *pWindow)
Definition: dialog.cxx:1205
static OString ImplGetDialogText(Dialog *pDialog)
Definition: dialog.cxx:69
SAL_DLLPRIVATE void ImplControlFocus(GetFocusFlags nFlags=GetFocusFlags::NONE)
Definition: dlgctrl.cxx:516
SAL_DLLPRIVATE Dialog(const Dialog &)=delete
MouseSettingsOptions
Definition: settings.hxx:53
void SetPointerPosPixel(const Point &rPos)
Definition: mouse.cxx:520
void IncModalCount()
Definition: window.cxx:3581
SAL_DLLPRIVATE vcl::Window * ImplGetDlgWindow(sal_uInt16 n, GetDlgWindowType nType, sal_uInt16 nStart=0, sal_uInt16 nEnd=0xFFFF, sal_uInt16 *pIndex=nullptr)
Definition: dlgctrl.cxx:205
void DrawRect(const tools::Rectangle &rRect)
Definition: rect.cxx:51
bool isContainerWindow(const vcl::Window &rWindow)
Definition: layout.hxx:840
void ImplInitDialog(vcl::Window *pParent, WinBits nStyle, InitFlag eFlag=InitFlag::Default)
Definition: dialog.cxx:444
vcl::Window * firstLogicalChildOfParent(const vcl::Window *pTopLevel)
Definition: dialog.cxx:189
std::stack< std::vector< VclPtr< vcl::Window > > > m_aBusyStack
Definition: waitobj.hxx:48
virtual bool Close()
Definition: syswin.cxx:266
void EnableInput(bool bEnable=true, bool bChild=true)
Definition: window.cxx:2484
const DialogStyle & GetDialogStyle() const
static vcl::Window * GetFirstTopLevelWindow()
Get the first top-level window of the application.
Definition: svapp.cxx:1073
static OUString GetUIRootDir()
Definition: dialog.cxx:556
WinBits const WB_DIALOGCONTROL
ImplSVData * ImplGetSVData()
Definition: svdata.cxx:74
bool mbInClose
Definition: dialog.hxx:58
void SetLineColor()
const OString & GetHelpId() const
Definition: window2.cxx:826
void ImplHideSplash()
Definition: dialog.cxx:126
VclPtr< VclBox > mpContentArea
Definition: dialog.hxx:63
void clear()
Definition: vclptr.hxx:190
std::vector< VclPtr< Dialog > > mpExecuteDialogs
Stack of dialogs that are Execute()'d - the last one is the top most one.
Definition: svdata.hxx:252
void SetLOKTunnelingState(bool bEnabled)
Definition: dialog.cxx:749
VclPtr< vcl::Window > mpCaptureWin
Definition: svdata.hxx:249
bool isEnabledInLayout(const vcl::Window *pWindow)
Definition: layout.cxx:2853
void SetActivateMode(ActivateModeFlags nMode)
Definition: window.cxx:2626
virtual void ApplySettings(vcl::RenderContext &rRenderContext) override
Definition: dialog.cxx:496
virtual bool set_property(const OString &rKey, const OUString &rValue) override
Definition: dialog.cxx:1384
static vcl::Window * GetDefaultParent(WinBits nStyle)
Definition: dialog.cxx:408
silently cancel any dialogs
static void ImplMouseAutoPos(Dialog *pDialog)
Definition: dialog.cxx:329
sal_uInt16 mnModalMode
Definition: svdata.hxx:149
SAL_DLLPRIVATE VclPtr< vcl::Window > AddBorderWindow(vcl::Window *pParent, WinBits nBits)
Definition: dialog.cxx:432
bool StartExecuteAsync(VclAbstractDialog::AsyncContext &rCtx)
Commence execution of a modal dialog, disposes owner on failure.
Definition: dialog.cxx:1077
DrawFlags
Definition: window.hxx:360
uno_Any a
VclPtr< vcl::Window > mpIntroWindow
Definition: svdata.hxx:399
void EndAllDialogs(vcl::Window const *pParent)
Definition: dialog.cxx:1182
VclAbstractDialog::AsyncContext maEndCtx
Definition: dialog.cxx:357
int get_default_response() const
Definition: dialog.cxx:1486
SystemWindowFlags
Definition: svapp.hxx:87
void SetInstallLOKNotifierHdl(const Link< void *, vcl::ILibreOfficeKitNotifier * > &rLink)
Definition: dialog.cxx:744
VclPtr< WorkWindow > mpAppWin
Definition: svdata.hxx:240
const Color & GetColor() const
Definition: wall.cxx:199
virtual void Invalidate(InvalidateFlags nFlags=InvalidateFlags::NONE)
Definition: paint.cxx:1158
vcl::Window * get_widget_for_response(int nResponse)
Definition: dialog.cxx:1447
bool mbInExecute
Definition: dialog.hxx:56
void SetFillColor()
tools::Long Width() const
Some things multiple-inherit from VclAbstractDialog and OutputDevice, so we need to use virtual inher...
Definition: outdev.hxx:303
float u
void add_button(PushButton *pButton, int nResponse, bool bTransferOwnership)
Definition: dialog.cxx:1416
static vcl::Window * getActionAreaButtonList(Dialog const *pDialog)
Definition: dialog.cxx:274
std::unique_ptr< WindowImpl > mpWindowImpl
Definition: window.hxx:521
bool IsInModalMode() const
A window is in modal mode if one of its children or subchildren is a running modal window (a modal di...
Definition: window.cxx:3576
int content_area_border
Definition: settings.hxx:143
sal_Int32 w
SAL_DLLPRIVATE vcl::Window * ImplGetParent() const
Definition: window2.cxx:863
bool mbIsDeferredInit
Definition: syswin.hxx:115
std::unique_ptr< VclBuilder > m_pUIBuilder
Definition: syswin.hxx:87
std::map< VclPtr< vcl::Window >, short > maResponses
Definition: dialog.cxx:354
SAL_DLLPRIVATE bool ImplIsPushButton() const
Definition: window2.cxx:919
MouseNotifyEvent GetType() const
Definition: event.hxx:302
void Activate() override
Definition: dialog.cxx:1585
~DialogImpl()
Definition: dialog.cxx:374
tools::Long mnResult
Definition: dialog.cxx:355
const AllSettings & GetSettings() const
Definition: outdev.hxx:418
Size GetOutputSizePixel() const
Definition: outdev.hxx:441
bool IsInExecute() const
Definition: dialog.hxx:123
virtual bool set_property(const OString &rKey, const OUString &rValue)
Definition: window2.cxx:1443
void SetPopupMenuHdl(const Link< const CommandEvent &, bool > &rLink)
Definition: dialog.cxx:739
short get_response(vcl::Window *pWindow) const
Definition: dialog.cxx:365
static void ImplEndExecuteModal()
Definition: dialog.cxx:1028
static PushButton * ImplGetDefaultButton(Dialog const *pDialog)
Definition: dialog.cxx:282
void GrabFocus()
Definition: window.cxx:2967
vcl::Window * GetParent() const
Definition: window2.cxx:1095
VclPtr< vcl::Window > mpTrackWin
Definition: svdata.hxx:254
static DialogCancelMode GetDialogCancelMode()
Gets the dialog cancel mode for headless environments.
Definition: svapp.cxx:1435
void put(const char *pPropName, const OUString &rPropValue)
WinBits const WB_NOBORDER
vcl::Window * GetWindow(GetWindowType nType) const
Definition: stacking.cxx:1035
short Execute()
Definition: dialog.cxx:1034
InitFlag
Definition: dialog.hxx:44
void disposeBuilder()
Definition: dialog.cxx:550
Point LogicToPixel(const Point &rLogicPt) const
Definition: map.cxx:800
bool m_bLOKTunneling
Definition: dialog.cxx:360
void ReleaseMouse()
Definition: mouse.cxx:457
static PushButton * ImplGetCancelButton(Dialog const *pDialog)
Definition: dialog.cxx:314
virtual void setPosSizePixel(tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight, PosSizeFlags nFlags=PosSizeFlags::All)
Definition: window.cxx:2657
SAL_DLLPRIVATE void ImplInit(vcl::Window *pParent, WinBits nStyle, SystemParentData *pSystemParentData)
Definition: window.cxx:936
WinBits const WB_SIZEABLE
WinBits const WB_STANDALONE
SAL_DLLPRIVATE vcl::Window * ImplGetFirstOverlapWindow()
Definition: window2.cxx:878
VclButtonBox * get_action_area()
Definition: dialog.hxx:117
A construction helper for a temporary VclPtr.
Definition: vclptr.hxx:275
SalFrame * ImplGetFrame() const
Definition: window2.cxx:846
virtual void Resize() override
Definition: dialog.cxx:1367
A SalFrame is a system window (e.g. an X11 window).
Definition: salframe.hxx:112
const vcl::KeyCode & GetKeyCode() const
Definition: event.hxx:54
static vcl::Window * GetFocusWindow()
Get the currently focused window.
Definition: svapp.cxx:1063
BitmapEx GetBitmap() const
Definition: wall.cxx:242
virtual void dispose() override
This is intended to be used to clear any locally held references to other Window-subclass objects...
Definition: syswin.cxx:101
virtual void StateChanged(StateChangedType nStateChange) override
Definition: dialog.cxx:754
WinBits const WB_STDWORK
virtual void queue_resize(StateChangedType eReason=StateChangedType::Layout) override
Definition: syswin.cxx:994
void Draw(OutputDevice *pDev, const Point &rPos)
Definition: brdwin.cxx:1618
IMPL_LINK_NOARG(Dialog, ImplAsyncCloseHdl, void *, void)
Definition: dialog.cxx:650
vcl::Window * prevLogicalChildOfParent(const vcl::Window *pTopLevel, const vcl::Window *pChild)
Definition: dialog.cxx:161
SAL_DLLPRIVATE bool ImplIsDefButton() const
Definition: button.cxx:1148
virtual void SetModal(bool)
Definition: salframe.hxx:257
static vcl::Window * GetNextTopLevelWindow(vcl::Window const *pWindow)
Get the next top level window.
Definition: svapp.cxx:1079
WindowType
#define SAL_WARN_IF(condition, area, stream)
WinBits const WB_BORDER
bool ImplStartExecute()
Definition: dialog.cxx:905
constexpr sal_uInt16 KEY_ESCAPE
Definition: keycodes.hxx:120
virtual void Command(const CommandEvent &rCEvt) override
Definition: dialog.cxx:1599
void GetBorder(sal_Int32 &rLeftBorder, sal_Int32 &rTopBorder, sal_Int32 &rRightBorder, sal_Int32 &rBottomBorder) const
Definition: brdwin.cxx:1950
ImplSVFrameData maFrameData
Definition: svdata.hxx:393
bool IsVisible() const
Definition: window2.cxx:1100
virtual OUString GetText() const override
Definition: syswin.cxx:1062
ImplSVEvent * PostUserEvent(const Link< void *, void > &rLink, void *pCaller=nullptr, bool bReferenceLink=false)
Definition: event.cxx:332
#define SAL_INFO(area, stream)
int action_area_border
Definition: settings.hxx:145
void EnableChildTransparentMode(bool bEnable=true)
Definition: window2.cxx:1020
virtual void set_content_area(VclBox *pBox)
Definition: dialog.cxx:602
tools::Long Height() const
cancel any dialogs by std::abort
SAL_DLLPRIVATE void ImplInitSettings()
Definition: dialog.cxx:516
VclPtr< VclReferenceBase > mxOwner
Definition: abstdlg.hxx:59
Reference< XComponentContext > getProcessComponentContext()
const MouseSettings & GetMouseSettings() const
void set_action_area(VclButtonBox *pBox)
Definition: dialog.cxx:591
vcl::Window * get_mnemonic_widget() const
Definition: fixed.hxx:75
InitFlag mnInitFlag
Definition: dialog.hxx:60
void set(reference_type *pBody)
Definition: vclptr.hxx:148
virtual void Activate()
Definition: window.cxx:1829
bool IsDisposed() const
Definition: window.cxx:142
WinBits const WB_TABSTOP
VclPtr< vcl::Window > mpDialogParent
Definition: syswin.hxx:116
bool IsBitmap() const
Definition: wall.cxx:250
WindowType GetType() const
Definition: window2.cxx:972
virtual void StateChanged(StateChangedType nStateChange)
Definition: window.cxx:1932
const vcl::ILibreOfficeKitNotifier * GetLOKNotifier() const
Definition: window.cxx:3230
#define SAL_WARN(area, stream)
DialogImpl()
Definition: dialog.cxx:362
WinBits GetStyle() const
Definition: window2.cxx:951
void ReleaseLOKNotifier()
Indicate that LOK is not going to use this dialog any more.
Definition: window.cxx:3198
WinBits const WB_CLOSEABLE
WinBits const WB_MOVEABLE
void CallEventListeners(VclEventId nEvent, void *pData=nullptr)
Definition: event.cxx:216
virtual void Command(const CommandEvent &rCEvt)
Definition: window.cxx:1915
bool IsReallyVisible() const
Definition: window2.cxx:1105
virtual ~VclBuilderContainer()
Definition: dialog.cxx:1581
std::unique_ptr< DialogImpl > mpDialogImpl
Definition: dialog.hxx:54
SAL_DLLPRIVATE bool IsInClose() const
Definition: dialog.hxx:85
bool HasFocus() const
Definition: window.cxx:2972
void Push(PushFlags nFlags=PushFlags::ALL)
Definition: outdevstate.cxx:59
void ImplLOKNotifier(vcl::Window *pParent)
Find and set the LOK notifier according to the pParent.
Definition: dialog.cxx:532
virtual void RequestHelp(const HelpEvent &rHEvt)
Definition: window.cxx:1861
void RegisterMnemonic(const OUString &rKey)
Definition: mnemonic.cxx:81
sal_Int32 h
virtual void doDeferredInit(WinBits nBits) override
Definition: dialog.cxx:565
virtual void Resize() override
Definition: syswin.cxx:1006
bool isLayoutEnabled() const
Definition: syswin.cxx:1011
SAL_DLLPRIVATE void RemoveFromDlgList()
Definition: dialog.cxx:1094
virtual void DataChanged(const DataChangedEvent &rDCEvt) override
Definition: dialog.cxx:831
void ImplSetModalInputMode(bool bModal)
Definition: dialog.cxx:1230
void SetModalInputMode(bool bModal)
Definition: dialog.cxx:1214
void DumpAsPropertyTree(tools::JsonWriter &rJsonWriter) override
Dumps itself and potentially its children to a property tree, to be written easily to JSON...
Definition: dialog.cxx:1647
tools::Long mnMousePositioned
Definition: dialog.hxx:55
SAL_DLLPRIVATE void DoInitialLayout()
Definition: syswin.cxx:1093
void GetDrawWindowBorder(sal_Int32 &rLeftBorder, sal_Int32 &rTopBorder, sal_Int32 &rRightBorder, sal_Int32 &rBottomBorder) const
Definition: dialog.cxx:1319
virtual void settingOptimalLayoutSize(Window *pBox) override
Definition: dialog.cxx:607
WinBits const WB_ALLOWMENUBAR
void incBusy(const weld::Widget *pIgnore)
Definition: dialog.cxx:1606
virtual void DataChanged(const DataChangedEvent &rDCEvt)
Definition: event.cxx:34
OUString toString(OptionInfo const *info)
ImplSVWinData * mpWinData
Definition: svdata.hxx:394
Size bestmaxFrameSizeForScreenSize(const Size &rScreenSize)
Definition: dialog.cxx:705
const Link< Button *, void > & GetClickHdl() const
Definition: button.hxx:80
void Show(bool bVisible=true, ShowFlags nFlags=ShowFlags::NONE)
Definition: window.cxx:2179
typedef void(CALLTYPE *GetFuncDataPtr)(sal_uInt16 &nNo