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()->maFrameData.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->mpWinData->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->mpWinData->mpExecuteDialogs.begin(),
906  pSVData->mpWinData->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 #endif
939 
940  // link all dialogs which are being executed
941  pSVData->mpWinData->mpExecuteDialogs.push_back(this);
942 
943  // stop capturing, in order to have control over the dialog
944  if (pSVData->mpWinData->mpTrackWin)
946  if (pSVData->mpWinData->mpCaptureWin)
947  pSVData->mpWinData->mpCaptureWin->ReleaseMouse();
948  EnableInput();
949  }
950 
951  mbInExecute = true;
952  // no real modality in LibreOfficeKit
953  if (!bKitActive && bModal)
954  SetModalInputMode(true);
955 
956  // FIXME: no layouting, workaround some clipping issues
958 
959  css::uno::Reference< css::uno::XComponentContext > xContext(
961  bool bForceFocusAndToFront(officecfg::Office::Common::View::NewDocumentHandling::ForceFocusAndToFront::get(xContext));
962  ShowFlags showFlags = bForceFocusAndToFront ? ShowFlags::ForegroundTask : ShowFlags::NONE;
963  Show(true, showFlags);
964 
965  if (bModal)
966  pSVData->maAppData.mnModalMode++;
967 
968  css::uno::Reference<css::frame::XGlobalEventBroadcaster> xEventBroadcaster(
969  css::frame::theGlobalEventBroadcaster::get(xContext), css::uno::UNO_SET_THROW);
970  css::document::DocumentEvent aObject;
971  aObject.EventName = "DialogExecute";
972  xEventBroadcaster->documentEventOccured(aObject);
973  if (bModal)
974  UITestLogger::getInstance().log("Open Modal " + get_id());
975  else
976  UITestLogger::getInstance().log("Open Modeless " + get_id());
977 
979  {
980  if (const vcl::ILibreOfficeKitNotifier* pNotifier = GetLOKNotifier())
981  {
982  // Dialog boxes don't get the Resize call and they
983  // can have invalid size at 'created' message above.
984  // If there is no difference, the client should detect it and ignore us,
985  // otherwise, this should make sure that the window has the correct size.
986  std::vector<vcl::LOKPayloadItem> aItems;
987  aItems.emplace_back("size", GetSizePixel().toString());
988  pNotifier->notifyWindow(GetLOKWindowId(), "size_changed", aItems);
989  }
990  }
991 
992  return true;
993 }
994 
996 {
997  ImplSVData* pSVData = ImplGetSVData();
998  pSVData->maAppData.mnModalMode--;
999 }
1000 
1002 {
1003 // Once the Android app is based on same idea as the iOS one currently
1004 // being developed, no conditional should be needed here. Until then,
1005 // play it safe.
1006 #if HAVE_FEATURE_DESKTOP || defined IOS
1007  VclPtr<vcl::Window> xWindow = this;
1008 
1009  mbInSyncExecute = true;
1010  comphelper::ScopeGuard aGuard([&]() {
1011  mbInSyncExecute = false;
1012  });
1013 
1014  if ( !ImplStartExecute() )
1015  return 0;
1016 
1017  // Yield util EndDialog is called or dialog gets destroyed
1018  // (the latter should not happen, but better safe than sorry
1019  while ( !xWindow->IsDisposed() && mbInExecute )
1021 
1023 #ifdef DBG_UTIL
1024  assert (!mpDialogParent || !mpDialogParent->IsDisposed());
1025 #endif
1026  if ( !xWindow->IsDisposed() )
1027  xWindow.clear();
1028  else
1029  {
1030  OSL_FAIL( "Dialog::Execute() - Dialog destroyed in Execute()" );
1031  }
1032 
1033  long nRet = mpDialogImpl->mnResult;
1034  mpDialogImpl->mnResult = -1;
1035 
1036  return static_cast<short>(nRet);
1037 
1038 #else
1039  return RET_OK;
1040 #endif
1041 }
1042 
1043 // virtual
1045 {
1046  const bool bModal = GetType() != WindowType::MODELESSDIALOG;
1047  if (!ImplStartExecute())
1048  {
1049  rCtx.mxOwner.disposeAndClear();
1050  rCtx.mxOwnerDialogController.reset();
1051  rCtx.mxOwnerSelf.reset();
1052  return false;
1053  }
1054 
1055  mpDialogImpl->maEndCtx = rCtx;
1056  mpDialogImpl->mbStartedModal = bModal;
1057 
1058  return true;
1059 }
1060 
1062 {
1063  ImplSVData* pSVData = ImplGetSVData();
1064  auto& rExecuteDialogs = pSVData->mpWinData->mpExecuteDialogs;
1065 
1066  // remove dialog from the list of dialogs which are being executed
1067  rExecuteDialogs.erase(std::remove_if(rExecuteDialogs.begin(), rExecuteDialogs.end(), [this](VclPtr<Dialog>& dialog){ return dialog.get() == this; }), rExecuteDialogs.end());
1068 }
1069 
1070 void Dialog::EndDialog( long nResult )
1071 {
1072  if (!mbInExecute || IsDisposed())
1073  return;
1074 
1075  const bool bModal = GetType() != WindowType::MODELESSDIALOG;
1076 
1077  Hide();
1078 
1079  if (bModal)
1080  {
1081  SetModalInputMode(false);
1082 
1084 
1085  // set focus to previous modal dialogue if it is modal for
1086  // the same frame parent (or NULL)
1087  ImplSVData* pSVData = ImplGetSVData();
1088  if (!pSVData->mpWinData->mpExecuteDialogs.empty())
1089  {
1090  VclPtr<Dialog> pPrevious = pSVData->mpWinData->mpExecuteDialogs.back();
1091 
1092  vcl::Window* pFrameParent = ImplGetFrameWindow()->ImplGetParent();
1093  vcl::Window* pPrevFrameParent = pPrevious->ImplGetFrameWindow()? pPrevious->ImplGetFrameWindow()->ImplGetParent(): nullptr;
1094  if( ( !pFrameParent && !pPrevFrameParent ) ||
1095  ( pFrameParent && pPrevFrameParent && pFrameParent->ImplGetFrame() == pPrevFrameParent->ImplGetFrame() )
1096  )
1097  {
1098  pPrevious->GrabFocus();
1099  }
1100  }
1101  }
1102 
1103  mpDialogImpl->mnResult = nResult;
1104 
1105  if ( mpDialogImpl->mbStartedModal )
1107 
1108  if ( mpDialogImpl && mpDialogImpl->maEndCtx.isSet() )
1109  {
1110  auto fn = std::move(mpDialogImpl->maEndCtx.maEndDialogFn);
1111  // std::move leaves maEndDialogFn in a valid state with unspecified
1112  // value. For the SwSyncBtnDlg case gcc and msvc left maEndDialogFn
1113  // unset, but clang left maEndDialogFn at its original value, keeping
1114  // an extra reference to the DialogController in its lambda giving
1115  // an inconsistent lifecycle for the dialog. Force it to be unset.
1116  mpDialogImpl->maEndCtx.maEndDialogFn = nullptr;
1117  fn(nResult);
1118  }
1119 
1120  if ( mpDialogImpl && mpDialogImpl->mbStartedModal )
1121  {
1122  mpDialogImpl->mbStartedModal = false;
1123  mpDialogImpl->mnResult = -1;
1124  }
1125  mbInExecute = false;
1126 
1127  if ( mpDialogImpl )
1128  {
1129  // Destroy ourselves (if we have a context with VclPtr owner)
1130  std::shared_ptr<weld::DialogController> xOwnerDialogController = std::move(mpDialogImpl->maEndCtx.mxOwnerDialogController);
1131  std::shared_ptr<weld::Dialog> xOwnerSelf = std::move(mpDialogImpl->maEndCtx.mxOwnerSelf);
1132  mpDialogImpl->maEndCtx.mxOwner.disposeAndClear();
1133  xOwnerDialogController.reset();
1134  xOwnerSelf.reset();
1135  }
1136 }
1137 
1138 void Dialog::EndAllDialogs( vcl::Window const * pParent )
1139 {
1140  ImplSVData* pSVData = ImplGetSVData();
1141  auto& rExecuteDialogs = pSVData->mpWinData->mpExecuteDialogs;
1142 
1143  for (auto it = rExecuteDialogs.rbegin(); it != rExecuteDialogs.rend(); ++it)
1144  {
1145  if (!pParent || pParent->IsWindowOrChild(*it, true))
1146  {
1147  (*it)->EndDialog();
1148  (*it)->PostUserEvent(Link<void*, void>());
1149  }
1150  }
1151 }
1152 
1154 {
1155  ImplSVData* pSVData = ImplGetSVData();
1156  auto& rExecuteDialogs = pSVData->mpWinData->mpExecuteDialogs;
1157  if (!rExecuteDialogs.empty())
1158  return rExecuteDialogs.back();
1159  return nullptr;
1160 }
1161 
1162 void Dialog::SetModalInputMode( bool bModal )
1163 {
1164  if ( bModal == mbModalMode )
1165  return;
1166 
1167  ImplGetFrame()->SetModal(bModal);
1168 
1169  if (GetParent())
1170  {
1171  SalFrame* pFrame = GetParent()->ImplGetFrame();
1172  pFrame->NotifyModalHierarchy(bModal);
1173  }
1174 
1175  ImplSetModalInputMode(bModal);
1176 }
1177 
1179 {
1180  if ( bModal == mbModalMode )
1181  return;
1182 
1183  // previously Execute()'d dialog - the one below the top-most one
1184  VclPtr<Dialog> pPrevious;
1185  ImplSVData* pSVData = ImplGetSVData();
1186  auto& rExecuteDialogs = pSVData->mpWinData->mpExecuteDialogs;
1187  if (rExecuteDialogs.size() > 1)
1188  pPrevious = rExecuteDialogs[rExecuteDialogs.size() - 2];
1189 
1190  mbModalMode = bModal;
1191  if ( bModal )
1192  {
1193  // Disable the prev Modal Dialog, because our dialog must close at first,
1194  // before the other dialog can be closed (because the other dialog
1195  // is on stack since our dialog returns)
1196  if (pPrevious && !pPrevious->IsWindowOrChild(this, true))
1197  pPrevious->EnableInput(false, this);
1198 
1199  // determine next overlap dialog parent
1200  vcl::Window* pParent = GetParent();
1201  if ( pParent )
1202  {
1203  // #103716# dialogs should always be modal to the whole frame window
1204  // #115933# disable the whole frame hierarchy, useful if our parent
1205  // is a modeless dialog
1206  mpDialogParent = pParent->mpWindowImpl->mpFrameWindow;
1208  }
1209  }
1210  else
1211  {
1212  if ( mpDialogParent )
1213  {
1214  // #115933# re-enable the whole frame hierarchy again (see above)
1215  // note that code in getfocus assures that we do not accidentally enable
1216  // windows that were disabled before
1218  }
1219 
1220  // Enable the prev Modal Dialog
1221  if (pPrevious && !pPrevious->IsWindowOrChild(this, true))
1222  {
1223  pPrevious->EnableInput(true, this);
1224 
1225  // ensure continued modality of prev dialog
1226  // do not change modality counter
1227 
1228  // #i119994# need find the last modal dialog before reactive it
1229  if (pPrevious->IsModalInputMode() || !pPrevious->IsWindowOrChild(this, true))
1230  {
1231  pPrevious->ImplSetModalInputMode(false);
1232  pPrevious->ImplSetModalInputMode(true);
1233  }
1234  }
1235  }
1236 }
1237 
1239 {
1240  vcl::Window* pFocusControl;
1241 
1242  // find focus control, even if the dialog has focus
1243  if ( HasFocus() )
1244  pFocusControl = nullptr;
1245  else
1246  {
1247  // prefer a child window which had focus before
1248  pFocusControl = ImplGetFirstOverlapWindow()->mpWindowImpl->mpLastFocusWindow;
1249  // find the control out of the dialog control
1250  if ( pFocusControl )
1251  pFocusControl = ImplFindDlgCtrlWindow( pFocusControl );
1252  }
1253  // no control had the focus before or the control is not
1254  // part of the tab-control, now give focus to the
1255  // first control in the tab-control
1256  if ( !pFocusControl ||
1257  !(pFocusControl->GetStyle() & WB_TABSTOP) ||
1258  !isVisibleInLayout(pFocusControl) ||
1259  !isEnabledInLayout(pFocusControl) || !pFocusControl->IsInputEnabled() )
1260  {
1261  pFocusControl = ImplGetDlgWindow( 0, GetDlgWindowType::First );
1262  }
1263  if ( pFocusControl )
1264  pFocusControl->ImplControlFocus( GetFocusFlags::Init );
1265 }
1266 
1267 void Dialog::GetDrawWindowBorder( sal_Int32& rLeftBorder, sal_Int32& rTopBorder, sal_Int32& rRightBorder, sal_Int32& rBottomBorder ) const
1268 {
1269  ScopedVclPtrInstance<ImplBorderWindow> aImplWin( static_cast<vcl::Window*>(const_cast<Dialog *>(this)), WB_BORDER|WB_STDWORK, BorderWindowStyle::Overlap );
1270  aImplWin->GetBorder( rLeftBorder, rTopBorder, rRightBorder, rBottomBorder );
1271 }
1272 
1273 void Dialog::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, DrawFlags )
1274 {
1275  Point aPos = pDev->LogicToPixel( rPos );
1276  Size aSize = pDev->LogicToPixel( rSize );
1277 
1278  Wallpaper aWallpaper = GetBackground();
1279  if ( !aWallpaper.IsBitmap() )
1280  ImplInitSettings();
1281 
1282  pDev->Push();
1283  pDev->SetMapMode();
1284  pDev->SetLineColor();
1285 
1286  if ( aWallpaper.IsBitmap() )
1287  pDev->DrawBitmapEx( aPos, aSize, aWallpaper.GetBitmap() );
1288  else
1289  {
1290  pDev->SetFillColor( aWallpaper.GetColor() );
1291  pDev->DrawRect( tools::Rectangle( aPos, aSize ) );
1292  }
1293 
1294  if (!( GetStyle() & WB_NOBORDER ))
1295  {
1297  aImplWin->SetText( GetText() );
1298  aImplWin->setPosSizePixel( aPos.X(), aPos.Y(), aSize.Width(), aSize.Height() );
1299  aImplWin->SetDisplayActive( true );
1300  aImplWin->InitView();
1301 
1302  aImplWin->Draw( pDev, aPos );
1303  }
1304 
1305  pDev->Pop();
1306 }
1307 
1309 {
1310  if (IsInClose())
1311  return;
1312  SystemWindow::queue_resize(eReason);
1313 }
1314 
1316 {
1318 
1320  return;
1321 
1322  if (const vcl::ILibreOfficeKitNotifier* pNotifier = GetLOKNotifier())
1323  {
1324  std::vector<vcl::LOKPayloadItem> aItems;
1325  aItems.emplace_back("size", GetSizePixel().toString());
1326  pNotifier->notifyWindow(GetLOKWindowId(), "size_changed", aItems);
1327  }
1328 }
1329 
1330 bool Dialog::set_property(const OString &rKey, const OUString &rValue)
1331 {
1332  if (rKey == "border-width")
1333  set_border_width(rValue.toInt32());
1334  else
1335  return SystemWindow::set_property(rKey, rValue);
1336  return true;
1337 }
1338 
1340 {
1341  return DialogUIObject::create;
1342 }
1343 
1344 IMPL_LINK(Dialog, ResponseHdl, Button*, pButton, void)
1345 {
1346  auto aFind = mpDialogImpl->maResponses.find(pButton);
1347  if (aFind == mpDialogImpl->maResponses.end())
1348  return;
1349  short nResponse = aFind->second;
1350  if (nResponse == RET_HELP)
1351  {
1353  if (!pFocusWin)
1354  pFocusWin = pButton;
1356  pFocusWin->RequestHelp(aEvt);
1357  return;
1358  }
1359  EndDialog(nResponse);
1360 }
1361 
1362 void Dialog::add_button(PushButton* pButton, int response, bool bTransferOwnership)
1363 {
1364  if (bTransferOwnership)
1365  mpDialogImpl->maOwnedButtons.push_back(pButton);
1366  mpDialogImpl->maResponses[pButton] = response;
1367  switch (pButton->GetType())
1368  {
1369  case WindowType::PUSHBUTTON:
1370  {
1371  if (!pButton->GetClickHdl().IsSet())
1372  pButton->SetClickHdl(LINK(this, Dialog, ResponseHdl));
1373  break;
1374  }
1375  //insist that the response ids match the default actions for those
1376  //widgets, and leave their default handlers in place
1377  case WindowType::OKBUTTON:
1378  assert(mpDialogImpl->get_response(pButton) == RET_OK);
1379  break;
1380  case WindowType::CANCELBUTTON:
1381  assert(mpDialogImpl->get_response(pButton) == RET_CANCEL || mpDialogImpl->get_response(pButton) == RET_CLOSE);
1382  break;
1383  case WindowType::HELPBUTTON:
1384  assert(mpDialogImpl->get_response(pButton) == RET_HELP);
1385  break;
1386  default:
1387  SAL_WARN("vcl.layout", "The type of widget " <<
1388  pButton->GetHelpId() << " is currently not handled");
1389  break;
1390  }
1391 }
1392 
1394 {
1395  //copy explicit responses
1396  std::map<VclPtr<vcl::Window>, short> aResponses(mpDialogImpl->maResponses);
1397 
1398  if (mpActionArea)
1399  {
1400  //add implicit responses
1402  pChild = pChild->GetWindow(GetWindowType::Next))
1403  {
1404  if (aResponses.find(pChild) != aResponses.end())
1405  continue;
1406  switch (pChild->GetType())
1407  {
1408  case WindowType::OKBUTTON:
1409  aResponses[pChild] = RET_OK;
1410  break;
1411  case WindowType::CANCELBUTTON:
1412  aResponses[pChild] = RET_CANCEL;
1413  break;
1414  case WindowType::HELPBUTTON:
1415  aResponses[pChild] = RET_HELP;
1416  break;
1417  default:
1418  break;
1419  }
1420  }
1421  }
1422 
1423  for (const auto& a : aResponses)
1424  {
1425  if (a.second == response)
1426  return a.first;
1427  }
1428 
1429  return nullptr;
1430 }
1431 
1433 {
1434  //copy explicit responses
1435  std::map<VclPtr<vcl::Window>, short> aResponses(mpDialogImpl->maResponses);
1436 
1437  if (mpActionArea)
1438  {
1439  //add implicit responses
1441  pChild = pChild->GetWindow(GetWindowType::Next))
1442  {
1443  if (aResponses.find(pChild) != aResponses.end())
1444  continue;
1445  switch (pChild->GetType())
1446  {
1447  case WindowType::OKBUTTON:
1448  aResponses[pChild] = RET_OK;
1449  break;
1450  case WindowType::CANCELBUTTON:
1451  aResponses[pChild] = RET_CANCEL;
1452  break;
1453  case WindowType::HELPBUTTON:
1454  aResponses[pChild] = RET_HELP;
1455  break;
1456  default:
1457  break;
1458  }
1459  }
1460  }
1461 
1462  for (const auto& a : aResponses)
1463  {
1464  if (a.first->GetStyle() & WB_DEFBUTTON)
1465  {
1466  return a.second;
1467  }
1468  }
1469  return RET_CANCEL;
1470 }
1471 
1473 {
1474  //copy explicit responses
1475  std::map<VclPtr<vcl::Window>, short> aResponses(mpDialogImpl->maResponses);
1476 
1477  if (mpActionArea)
1478  {
1479  //add implicit responses
1481  pChild = pChild->GetWindow(GetWindowType::Next))
1482  {
1483  if (aResponses.find(pChild) != aResponses.end())
1484  continue;
1485  switch (pChild->GetType())
1486  {
1487  case WindowType::OKBUTTON:
1488  aResponses[pChild] = RET_OK;
1489  break;
1490  case WindowType::CANCELBUTTON:
1491  aResponses[pChild] = RET_CANCEL;
1492  break;
1493  case WindowType::HELPBUTTON:
1494  aResponses[pChild] = RET_HELP;
1495  break;
1496  default:
1497  break;
1498  }
1499  }
1500  }
1501 
1502  for (auto& a : aResponses)
1503  {
1504  if (a.second == response)
1505  {
1506  a.first->SetStyle(a.first->GetStyle() | WB_DEFBUTTON);
1507  a.first->GrabFocus();
1508  }
1509  else
1510  {
1511  a.first->SetStyle(a.first->GetStyle() & ~WB_DEFBUTTON);
1512  }
1513  }
1514 }
1515 
1517 {
1518 }
1519 
1521 {
1522 }
1523 
1525 {
1526  if (GetType() == WindowType::MODELESSDIALOG)
1527  {
1528  css::uno::Reference< css::uno::XComponentContext > xContext(
1530  css::uno::Reference<css::frame::XGlobalEventBroadcaster> xEventBroadcaster(css::frame::theGlobalEventBroadcaster::get(xContext), css::uno::UNO_SET_THROW);
1531  css::document::DocumentEvent aObject;
1532  aObject.EventName = "ModelessDialogVisible";
1533  xEventBroadcaster->documentEventOccured(aObject);
1534  }
1536 }
1537 
1538 void Dialog::Command(const CommandEvent& rCEvt)
1539 {
1540  if (mpDialogImpl && mpDialogImpl->m_aPopupMenuHdl.Call(rCEvt))
1541  return;
1542  SystemWindow::Command(rCEvt);
1543 }
1544 
1546 {
1547  // lock any toplevel windows from being closed until busy is over
1548  std::vector<VclPtr<vcl::Window>> aTopLevels;
1550  while (pTopWin)
1551  {
1552  vcl::Window* pCandidate = pTopWin;
1553  if (pCandidate->GetType() == WindowType::BORDERWINDOW)
1554  pCandidate = pCandidate->GetWindow(GetWindowType::FirstChild);
1555  // tdf#125266 ignore HelpTextWindows
1556  if (pCandidate &&
1557  pCandidate->GetType() != WindowType::HELPTEXTWINDOW &&
1558  pCandidate->GetType() != WindowType::FLOATINGWINDOW &&
1559  pCandidate->GetFrameWeld() != pIgnore)
1560  {
1561  aTopLevels.push_back(pCandidate);
1562  }
1563  pTopWin = Application::GetNextTopLevelWindow(pTopWin);
1564  }
1565  for (auto& a : aTopLevels)
1566  {
1567  a->IncModalCount();
1568  a->ImplGetFrame()->NotifyModalHierarchy(true);
1569  }
1570  m_aBusyStack.push(aTopLevels);
1571 }
1572 
1574 {
1575  // unlock locked toplevel windows from being closed now busy is over
1576  for (auto& a : m_aBusyStack.top())
1577  {
1578  if (a->IsDisposed())
1579  continue;
1580  a->DecModalCount();
1581  a->ImplGetFrame()->NotifyModalHierarchy(false);
1582  }
1583  m_aBusyStack.pop();
1584 }
1585 
1586 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SAL_DLLPRIVATE void ImplInitDialogData()
Definition: dialog.cxx:382
virtual void SetText(const OUString &rStr)
Definition: window.cxx:3027
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:1082
bool IsInputEnabled() const
Definition: window2.cxx:1122
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:482
vcl::LOKWindowId GetLOKWindowId() const
Definition: window.cxx:3245
OUString sMessage
bool GetAutoMnemonic() const
WinBits const WB_SYSTEMWINDOW
bool isVisibleInLayout(const vcl::Window *pWindow)
Definition: layout.cxx:2664
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:1810
virtual bool EventNotify(NotifyEvent &rNEvt) override
Definition: dialog.cxx:640
virtual void queue_resize(StateChangedType eReason=StateChangedType::Layout) override
Definition: dialog.cxx:1308
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:70
virtual void ImplAdjustNWFSizes()
Definition: window3.cxx:38
long Height() const
void DecModalCount()
Definition: window.cxx:3608
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:1342
std::vector< VclPtr< PushButton > > maOwnedButtons
Definition: dialog.cxx:349
ImplSVAppData maAppData
Definition: svdata.hxx:355
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_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:2365
SAL_DLLPRIVATE vcl::Window * ImplGetFrameWindow() const
Definition: window2.cxx:896
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:3170
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:1077
bool IsCreatedWithToolkit() const
Definition: window2.cxx:1232
bool HasChildPathFocus(bool bSystemWindow=false) const
Definition: window.cxx:3005
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:1339
IMPL_LINK(Dialog, ResponseHdl, Button *, pButton, void)
Definition: dialog.cxx:1344
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:2682
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:3882
void GrabFocusToFirstControl()
Definition: dialog.cxx:1238
VclPtr< vcl::Window > GetParentWithLOKNotifier()
Find the nearest parent with LOK Notifier; can be itself if this Window has LOK notifier set...
Definition: window.cxx:3250
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:508
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:934
AllSettingsFlags GetFlags() const
Definition: event.hxx:349
void set_default_response(int nResponse)
Definition: dialog.cxx:1472
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:3056
static SystemWindowFlags GetSystemWindowMode()
Get the system window mode of dialogs.
Definition: svapp.cxx:1419
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:53
void SetPointerPosPixel(const Point &rPos)
Definition: mouse.cxx:520
void IncModalCount()
Definition: window.cxx:3594
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:840
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:2473
const DialogStyle & GetDialogStyle() const
static vcl::Window * GetFirstTopLevelWindow()
Get the first top-level window of the application.
Definition: svapp.cxx:1055
WinBits const WB_DIALOGCONTROL
ImplSVData * ImplGetSVData()
Definition: svdata.cxx:75
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:214
VclPtr< vcl::Window > mpCaptureWin
Definition: svdata.hxx:211
bool isEnabledInLayout(const vcl::Window *pWindow)
Definition: layout.cxx:2677
void SetActivateMode(ActivateModeFlags nMode)
Definition: window.cxx:2651
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:1330
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:149
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:1044
DrawFlags
Definition: window.hxx:354
uno_Any a
VclPtr< vcl::Window > mpIntroWindow
Definition: svdata.hxx:363
VclAbstractDialog::AsyncContext maEndCtx
Definition: dialog.cxx:353
int get_default_response() const
Definition: dialog.cxx:1432
SystemWindowFlags
Definition: svapp.hxx:92
void SetInstallLOKNotifierHdl(const Link< void *, vcl::ILibreOfficeKitNotifier * > &rLink)
Definition: dialog.cxx:729
#define KEY_ESCAPE
Definition: keycodes.hxx:120
VclPtr< WorkWindow > mpAppWin
Definition: svdata.hxx:202
const Color & GetColor() const
Definition: wall.cxx:204
virtual void Invalidate(InvalidateFlags nFlags=InvalidateFlags::NONE)
Definition: paint.cxx:1160
vcl::Window * get_widget_for_response(int nResponse)
Definition: dialog.cxx:1393
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:1362
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:3589
int content_area_border
Definition: settings.hxx:145
sal_Int32 w
static void EndAllDialogs(vcl::Window const *pParent)
Definition: dialog.cxx:1138
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:499
std::map< VclPtr< vcl::Window >, short > maResponses
Definition: dialog.cxx:350
SAL_DLLPRIVATE bool ImplIsPushButton() const
Definition: window2.cxx:916
MouseNotifyEvent GetType() const
Definition: event.hxx:294
void Activate() override
Definition: dialog.cxx:1524
~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:1427
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:995
static PushButton * ImplGetDefaultButton(Dialog const *pDialog)
Definition: dialog.cxx:278
void GrabFocus()
Definition: window.cxx:2977
vcl::Window * GetParent() const
Definition: window2.cxx:1092
VclPtr< vcl::Window > mpTrackWin
Definition: svdata.hxx:216
static DialogCancelMode GetDialogCancelMode()
Gets the dialog cancel mode for headless environments.
Definition: svapp.cxx:1399
long X() const
WinBits const WB_NOBORDER
long mnMousePositioned
Definition: dialog.hxx:48
vcl::Window * GetWindow(GetWindowType nType) const
Definition: stacking.cxx:1046
short Execute()
Definition: dialog.cxx:1001
InitFlag
Definition: dialog.hxx:37
void disposeBuilder()
Definition: dialog.cxx:538
Point LogicToPixel(const Point &rLogicPt) const
Definition: map.cxx:934
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
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:1315
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:1045
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:1099
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:1061
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:1538
void GetBorder(sal_Int32 &rLeftBorder, sal_Int32 &rTopBorder, sal_Int32 &rRightBorder, sal_Int32 &rBottomBorder) const
Definition: brdwin.cxx:2032
ImplSVFrameData maFrameData
Definition: svdata.hxx:357
bool IsVisible() const
Definition: window2.cxx:1097
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:147
void EnableChildTransparentMode(bool bEnable=true)
Definition: window2.cxx:1017
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:1273
bool IsDisposed() const
Definition: window.cxx:136
WinBits const WB_TABSTOP
static VclPtr< Dialog > GetMostRecentExecutingDialog()
Definition: dialog.cxx:1153
VclPtr< vcl::Window > mpDialogParent
Definition: syswin.hxx:84
bool IsBitmap() const
Definition: wall.cxx:255
WindowType GetType() const
Definition: window2.cxx:969
virtual void StateChanged(StateChangedType nStateChange)
Definition: window.cxx:1904
const vcl::ILibreOfficeKitNotifier * GetLOKNotifier() const
Definition: window.cxx:3240
#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:948
void ReleaseLOKNotifier()
Indicate that LOK is not going to use this dialog any more.
Definition: window.cxx:3208
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:1102
virtual ~VclBuilderContainer()
Definition: dialog.cxx:1520
std::unique_ptr< DialogImpl > mpDialogImpl
Definition: dialog.hxx:47
SAL_DLLPRIVATE bool IsInClose() const
Definition: dialog.hxx:78
bool HasFocus() const
Definition: window.cxx:2982
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:1061
virtual void DataChanged(const DataChangedEvent &rDCEvt) override
Definition: dialog.cxx:799
void ImplSetModalInputMode(bool bModal)
Definition: dialog.cxx:1178
void SetModalInputMode(bool bModal)
Definition: dialog.cxx:1162
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:1267
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:1545
void EndDialog(long nResult=RET_CANCEL)
Definition: dialog.cxx:1070
virtual void DataChanged(const DataChangedEvent &rDCEvt)
Definition: event.cxx:35
OUString toString(OptionInfo const *info)
ImplSVWinData * mpWinData
Definition: svdata.hxx:358
Size bestmaxFrameSizeForScreenSize(const Size &rScreenSize)
Definition: dialog.cxx:690
const Link< Button *, void > & GetClickHdl() const
Definition: button.hxx:71
void Show(bool bVisible=true, ShowFlags nFlags=ShowFlags::NONE)
Definition: window.cxx:2151
typedef void(CALLTYPE *GetFuncDataPtr)(sal_uInt16 &nNo