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