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