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