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