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