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