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
551void VclBuilderContainer::disposeBuilder()
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 aItems.emplace_back("unique_id", this->get_id().toUtf8());
770 if (!GetText().isEmpty())
771 aItems.emplace_back("title", GetText().toUtf8());
772
773 if (const vcl::ILibreOfficeKitNotifier* pNotifier = GetLOKNotifier())
774 {
775 pNotifier->notifyWindow(GetLOKWindowId(), "created", aItems);
776 pNotifier->notifyWindow(GetLOKWindowId(), "created", aItems);
777 }
778 else
779 {
780 vcl::ILibreOfficeKitNotifier* pViewShell = mpDialogImpl->m_aInstallLOKNotifierHdl.Call(nullptr);
781 if (pViewShell)
782 {
783 SetLOKNotifier(pViewShell);
784 pViewShell->notifyWindow(GetLOKWindowId(), "created", aItems);
785 }
786 }
787 }
788
789 if ( !HasChildPathFocus() || HasFocus() )
791 if ( !(GetStyle() & WB_CLOSEABLE) )
792 {
793 if ( ImplGetCancelButton( this ) || ImplGetOKButton( this ) )
794 {
795 if ( ImplGetBorderWindow() )
796 static_cast<ImplBorderWindow*>(ImplGetBorderWindow())->SetCloseButton();
797 }
798 }
799
800 ImplMouseAutoPos( this );
801 }
802 else if (nType == StateChangedType::Text)
803 {
804 const vcl::ILibreOfficeKitNotifier* pNotifier = GetLOKNotifier();
805 if (pNotifier && bTunnelingEnabled)
806 {
807 std::vector<vcl::LOKPayloadItem> aPayload;
808 aPayload.emplace_back("title", GetText().toUtf8());
809 pNotifier->notifyWindow(GetLOKWindowId(), "title_changed", aPayload);
810 }
811 }
812
814
816 {
818 Invalidate();
819 }
820
822 {
823 const vcl::ILibreOfficeKitNotifier* pNotifier = GetLOKNotifier();
824 if (pNotifier && bTunnelingEnabled)
825 {
826 std::vector<vcl::LOKPayloadItem> aPayload;
827 aPayload.emplace_back("title", GetText().toUtf8());
828 pNotifier->notifyWindow(GetLOKWindowId(), IsVisible()? OUString("show"): OUString("hide"), aPayload);
829 }
830 }
831}
832
834{
836
837 if ( (rDCEvt.GetType() == DataChangedEventType::SETTINGS) &&
838 (rDCEvt.GetFlags() & AllSettingsFlags::STYLE) )
839 {
841 Invalidate();
842 }
843}
844
846{
847 VclPtr<vcl::Window> xWindow = this;
849 if ( xWindow->isDisposed() )
850 return false;
851
852 if ( mpWindowImpl->mxWindowPeer.is() && IsCreatedWithToolkit() && !IsInExecute() )
853 return false;
854
855 // If there's a cancel button with a custom handler, then always give it a chance to
856 // handle Dialog::Close
857 PushButton* pCustomCancelButton;
858 PushButton* pCancelButton = dynamic_cast<PushButton*>(get_widget_for_response(RET_CANCEL));
859 if (!mbInClose && pCancelButton && pCancelButton->GetClickHdl().IsSet())
860 pCustomCancelButton = pCancelButton;
861 else
862 pCustomCancelButton = nullptr;
863
864 mbInClose = true;
865
866 if (pCustomCancelButton)
867 {
868 pCustomCancelButton->Click();
869 if (xWindow->isDisposed())
870 return true;
871 mbInClose = false;
872 return false;
873 }
874
875 if ( !(GetStyle() & WB_CLOSEABLE) )
876 {
877 bool bRet = true;
878 PushButton* pButton = ImplGetCancelButton( this );
879 if ( pButton )
880 pButton->Click();
881 else
882 {
883 pButton = ImplGetOKButton( this );
884 if ( pButton )
885 pButton->Click();
886 else
887 bRet = false;
888 }
889 if ( xWindow->isDisposed() )
890 return true;
891 return bRet;
892 }
893
894 if (IsInExecute() || mpDialogImpl->maEndCtx.isSet())
895 {
896 EndDialog();
897 mbInClose = false;
898 return true;
899 }
900 else
901 {
902 mbInClose = false;
903 return SystemWindow::Close();
904 }
905}
906
908{
909 setDeferredProperties();
910
911 if (IsInExecute() || mpDialogImpl->maEndCtx.isSet())
912 {
913#ifdef DBG_UTIL
914 SAL_WARN( "vcl", "Dialog::StartExecuteModal() is called in Dialog::StartExecuteModal(): "
915 << ImplGetDialogText(this) );
916#endif
917 return false;
918 }
919
920 ImplSVData* pSVData = ImplGetSVData();
921
922 const bool bKitActive = comphelper::LibreOfficeKit::isActive();
923
924 const bool bModal = GetType() != WindowType::MODELESSDIALOG;
925
926 if (bModal)
927 {
928 if (bKitActive && !GetLOKNotifier())
929 SetLOKNotifier(mpDialogImpl->m_aInstallLOKNotifierHdl.Call(nullptr));
930
932 {
934 break;
936 if (bModal && GetLOKNotifier())
937 {
938 // check if there's already some dialog being ::Execute()d
939 const bool bDialogExecuting = std::any_of(pSVData->mpWinData->mpExecuteDialogs.begin(),
940 pSVData->mpWinData->mpExecuteDialogs.end(),
941 [](const Dialog* pDialog) {
942 return pDialog->IsInSyncExecute();
943 });
944 if (!(bDialogExecuting && IsInSyncExecute()))
945 break;
946 else
947 SAL_WARN("lok.dialog", "Dialog \"" << ImplGetDialogText(this) << "\" is being synchronously executed over an existing synchronously executing dialog.");
948 }
949
951 { // helps starbasic unit tests show their errors
952 std::cerr << "Dialog \"" << ImplGetDialogText(this)
953 << "\"cancelled in silent mode";
954 }
955
956 SAL_INFO(
957 "vcl",
958 "Dialog \"" << ImplGetDialogText(this)
959 << "\"cancelled in silent mode");
960 return false;
961
963 return false;
964
965 default: // default cannot happen
967 std::abort();
968 }
969
970#ifdef DBG_UTIL
971 vcl::Window* pParent = GetParent();
972 if ( pParent )
973 {
974 pParent = pParent->ImplGetFirstOverlapWindow();
975 if (pParent)
976 {
977 SAL_WARN_IF( !pParent->IsReallyVisible(), "vcl",
978 "Dialog::StartExecuteModal() - Parent not visible" );
979 SAL_WARN_IF( !pParent->IsInputEnabled(), "vcl",
980 "Dialog::StartExecuteModal() - Parent input disabled, use another parent to ensure modality!" );
981 SAL_WARN_IF( pParent->IsInModalMode(), "vcl",
982 "Dialog::StartExecuteModal() - Parent already modally disabled, use another parent to ensure modality!" );
983 }
984 }
985#endif
986
987 // link all dialogs which are being executed
988 pSVData->mpWinData->mpExecuteDialogs.push_back(this);
989
990 // stop capturing, in order to have control over the dialog
991 if (pSVData->mpWinData->mpTrackWin)
993 if (pSVData->mpWinData->mpCaptureWin)
995 EnableInput();
996 }
997
998 mbInExecute = true;
999 // no real modality in LibreOfficeKit
1000 if (!bKitActive && bModal)
1001 SetModalInputMode(true);
1002
1003 // FIXME: no layouting, workaround some clipping issues
1005
1006 css::uno::Reference< css::uno::XComponentContext > xContext(
1008 bool bForceFocusAndToFront(officecfg::Office::Common::View::NewDocumentHandling::ForceFocusAndToFront::get());
1009 ShowFlags showFlags = bForceFocusAndToFront ? ShowFlags::ForegroundTask : ShowFlags::NONE;
1010 Show(true, showFlags);
1011
1012 if (bModal)
1013 pSVData->maAppData.mnModalMode++;
1014
1015 css::uno::Reference<css::frame::XGlobalEventBroadcaster> xEventBroadcaster(
1016 css::frame::theGlobalEventBroadcaster::get(xContext), css::uno::UNO_SET_THROW);
1017 css::document::DocumentEvent aObject;
1018 aObject.EventName = "DialogExecute";
1019 xEventBroadcaster->documentEventOccured(aObject);
1020 if (bModal)
1021 UITestLogger::getInstance().log(Concat2View("Open Modal " + get_id()));
1022 else
1023 UITestLogger::getInstance().log(Concat2View("Open Modeless " + get_id()));
1024
1025 bool bTunnelingEnabled = mpDialogImpl->m_bLOKTunneling;
1026 if (comphelper::LibreOfficeKit::isActive() && bTunnelingEnabled)
1027 {
1028 if (const vcl::ILibreOfficeKitNotifier* pNotifier = GetLOKNotifier())
1029 {
1030 // Dialog boxes don't get the Resize call and they
1031 // can have invalid size at 'created' message above.
1032 // If there is no difference, the client should detect it and ignore us,
1033 // otherwise, this should make sure that the window has the correct size.
1034 std::vector<vcl::LOKPayloadItem> aItems;
1035 aItems.emplace_back("size", GetSizePixel().toString());
1036 aItems.emplace_back("unique_id", this->get_id().toUtf8());
1037 pNotifier->notifyWindow(GetLOKWindowId(), "size_changed", aItems);
1038 }
1039 }
1040
1041 return true;
1042}
1043
1045{
1046 ImplSVData* pSVData = ImplGetSVData();
1047 pSVData->maAppData.mnModalMode--;
1048}
1049
1051{
1052 VclPtr<vcl::Window> xWindow = this;
1053
1054 mbInSyncExecute = true;
1055 comphelper::ScopeGuard aGuard([&]() {
1056 mbInSyncExecute = false;
1057 });
1058
1059 if ( !ImplStartExecute() )
1060 return 0;
1061
1062 // Yield util EndDialog is called or dialog gets destroyed
1063 // (the latter should not happen, but better safe than sorry
1064 while ( !xWindow->isDisposed() && mbInExecute && !Application::IsQuit() )
1066
1068#ifdef DBG_UTIL
1069 assert (!mpDialogParent || !mpDialogParent->isDisposed());
1070#endif
1071 if ( !xWindow->isDisposed() )
1072 xWindow.clear();
1073 else
1074 {
1075 OSL_FAIL( "Dialog::Execute() - Dialog destroyed in Execute()" );
1076 }
1077
1078 assert(mpDialogImpl);
1079
1080 if (mpDialogImpl)
1081 {
1082 tools::Long nRet = mpDialogImpl->mnResult;
1083 mpDialogImpl->mnResult = -1;
1084
1085 return static_cast<short>(nRet);
1086 }
1087 else
1088 {
1089 SAL_WARN( "vcl", "Dialog::Execute() : missing mpDialogImpl " );
1090 return 0;
1091 }
1092}
1093
1094// virtual
1096{
1097 const bool bModal = GetType() != WindowType::MODELESSDIALOG;
1098 if (!ImplStartExecute())
1099 {
1100 rCtx.mxOwner.disposeAndClear();
1101 rCtx.mxOwnerDialogController.reset();
1102 rCtx.mxOwnerSelf.reset();
1103 return false;
1104 }
1105
1106 mpDialogImpl->maEndCtx = rCtx;
1107 mpDialogImpl->mbStartedModal = bModal;
1108
1109 return true;
1110}
1111
1113{
1114 ImplSVData* pSVData = ImplGetSVData();
1115 auto& rExecuteDialogs = pSVData->mpWinData->mpExecuteDialogs;
1116
1117 // remove dialog from the list of dialogs which are being executed
1118 rExecuteDialogs.erase(std::remove_if(rExecuteDialogs.begin(), rExecuteDialogs.end(), [this](VclPtr<Dialog>& dialog){ return dialog.get() == this; }), rExecuteDialogs.end());
1119}
1120
1122{
1123 if (!mbInExecute || isDisposed())
1124 return;
1125
1126 const bool bModal = GetType() != WindowType::MODELESSDIALOG;
1127
1128 Hide();
1129
1131 {
1132 if(const vcl::ILibreOfficeKitNotifier* pNotifier = GetLOKNotifier())
1133 {
1134 pNotifier->notifyWindow(GetLOKWindowId(), "close");
1136 }
1137 }
1138
1139 if (bModal)
1140 {
1141 SetModalInputMode(false);
1142
1144
1145 // set focus to previous modal dialog if it is modal for
1146 // the same frame parent (or NULL)
1147 ImplSVData* pSVData = ImplGetSVData();
1148 if (!pSVData->mpWinData->mpExecuteDialogs.empty())
1149 {
1150 VclPtr<Dialog> pPrevious = pSVData->mpWinData->mpExecuteDialogs.back();
1151
1152 vcl::Window* pFrameParent = ImplGetFrameWindow()->ImplGetParent();
1153 vcl::Window* pPrevFrameParent = pPrevious->ImplGetFrameWindow()? pPrevious->ImplGetFrameWindow()->ImplGetParent(): nullptr;
1154 if( ( !pFrameParent && !pPrevFrameParent ) ||
1155 ( pFrameParent && pPrevFrameParent && pFrameParent->ImplGetFrame() == pPrevFrameParent->ImplGetFrame() )
1156 )
1157 {
1158 pPrevious->GrabFocus();
1159 }
1160 }
1161 }
1162
1163 mpDialogImpl->mnResult = nResult;
1164
1165 if ( mpDialogImpl->mbStartedModal )
1167
1168 // coverity[check_after_deref] - ImplEndExecuteModal might trigger destruction of mpDialogImpl
1169 if ( mpDialogImpl && mpDialogImpl->maEndCtx.isSet() )
1170 {
1171 auto fn = std::move(mpDialogImpl->maEndCtx.maEndDialogFn);
1172 // std::move leaves maEndDialogFn in a valid state with unspecified
1173 // value. For the SwSyncBtnDlg case gcc and msvc left maEndDialogFn
1174 // unset, but clang left maEndDialogFn at its original value, keeping
1175 // an extra reference to the DialogController in its lambda giving
1176 // an inconsistent lifecycle for the dialog. Force it to be unset.
1177 mpDialogImpl->maEndCtx.maEndDialogFn = nullptr;
1178 fn(nResult);
1179 }
1180
1181 if ( mpDialogImpl && mpDialogImpl->mbStartedModal )
1182 {
1183 mpDialogImpl->mbStartedModal = false;
1184 mpDialogImpl->mnResult = -1;
1185 }
1186 mbInExecute = false;
1187
1188 if ( mpDialogImpl )
1189 {
1190 // Destroy ourselves (if we have a context with VclPtr owner)
1191 std::shared_ptr<weld::DialogController> xOwnerDialogController = std::move(mpDialogImpl->maEndCtx.mxOwnerDialogController);
1192 std::shared_ptr<weld::Dialog> xOwnerSelf = std::move(mpDialogImpl->maEndCtx.mxOwnerSelf);
1193 mpDialogImpl->maEndCtx.mxOwner.disposeAndClear();
1194 xOwnerDialogController.reset();
1195 xOwnerSelf.reset();
1196 }
1197}
1198
1199namespace vcl
1200{
1201 void EndAllDialogs( vcl::Window const * pParent )
1202 {
1203 ImplSVData* pSVData = ImplGetSVData();
1204 auto& rExecuteDialogs = pSVData->mpWinData->mpExecuteDialogs;
1205
1206 for (auto it = rExecuteDialogs.rbegin(); it != rExecuteDialogs.rend(); ++it)
1207 {
1208 if (!pParent || pParent->IsWindowOrChild(*it, true))
1209 {
1210 (*it)->EndDialog();
1211 (*it)->PostUserEvent(Link<void*, void>());
1212 }
1213 }
1214 }
1215
1217 {
1218 if (Dialog* pDialog = dynamic_cast<Dialog*>(pWindow))
1219 {
1220 pDialog->EnableInput();
1221 }
1222 }
1223
1225 {
1226 if (Dialog* pDialog = dynamic_cast<Dialog*>(pWindow))
1227 pDialog->Close();
1228 else if (FloatingWindow* pFloatWin = dynamic_cast<FloatingWindow*>(pWindow))
1230 }
1231}
1232
1233void Dialog::SetModalInputMode( bool bModal )
1234{
1235 if ( bModal == mbModalMode )
1236 return;
1237
1238 ImplGetFrame()->SetModal(bModal);
1239
1240 if (GetParent())
1241 {
1242 SalFrame* pFrame = GetParent()->ImplGetFrame();
1243 pFrame->NotifyModalHierarchy(bModal);
1244 }
1245
1246 ImplSetModalInputMode(bModal);
1247}
1248
1250{
1251 if ( bModal == mbModalMode )
1252 return;
1253
1254 // previously Execute()'d dialog - the one below the top-most one
1255 VclPtr<Dialog> pPrevious;
1256 ImplSVData* pSVData = ImplGetSVData();
1257 auto& rExecuteDialogs = pSVData->mpWinData->mpExecuteDialogs;
1258 if (rExecuteDialogs.size() > 1)
1259 pPrevious = rExecuteDialogs[rExecuteDialogs.size() - 2];
1260
1261 mbModalMode = bModal;
1262 if ( bModal )
1263 {
1264 // Disable the prev Modal Dialog, because our dialog must close at first,
1265 // before the other dialog can be closed (because the other dialog
1266 // is on stack since our dialog returns)
1267 if (pPrevious && !pPrevious->IsWindowOrChild(this, true))
1268 pPrevious->EnableInput(false, this);
1269
1270 // determine next overlap dialog parent
1271 vcl::Window* pParent = GetParent();
1272 if ( pParent )
1273 {
1274 // #103716# dialogs should always be modal to the whole frame window
1275 // #115933# disable the whole frame hierarchy, useful if our parent
1276 // is a modeless dialog
1277 mpDialogParent = pParent->mpWindowImpl->mpFrameWindow;
1279 }
1280 }
1281 else
1282 {
1283 if ( mpDialogParent )
1284 {
1285 // #115933# re-enable the whole frame hierarchy again (see above)
1286 // note that code in getfocus assures that we do not accidentally enable
1287 // windows that were disabled before
1289 }
1290
1291 // Enable the prev Modal Dialog
1292 if (pPrevious && !pPrevious->IsWindowOrChild(this, true))
1293 {
1294 pPrevious->EnableInput(true, this);
1295
1296 // ensure continued modality of prev dialog
1297 // do not change modality counter
1298
1299 // #i119994# need find the last modal dialog before reactive it
1300 if (pPrevious->IsModalInputMode() || !pPrevious->IsWindowOrChild(this, true))
1301 {
1302 pPrevious->ImplSetModalInputMode(false);
1303 pPrevious->ImplSetModalInputMode(true);
1304 }
1305 }
1306 }
1307}
1308
1310{
1311 vcl::Window* pFocusControl = nullptr;
1312 vcl::Window* pFirstOverlapWindow = ImplGetFirstOverlapWindow();
1313
1314 // find focus control, even if the dialog has focus
1315 if (!HasFocus() && pFirstOverlapWindow && pFirstOverlapWindow->mpWindowImpl)
1316 {
1317 // prefer a child window which had focus before
1318 pFocusControl = ImplGetFirstOverlapWindow()->mpWindowImpl->mpLastFocusWindow;
1319 // find the control out of the dialog control
1320 if ( pFocusControl )
1321 pFocusControl = ImplFindDlgCtrlWindow( pFocusControl );
1322 }
1323 // no control had the focus before or the control is not
1324 // part of the tab-control, now give focus to the
1325 // first control in the tab-control
1326 if ( !pFocusControl ||
1327 !(pFocusControl->GetStyle() & WB_TABSTOP) ||
1328 !isVisibleInLayout(pFocusControl) ||
1329 !isEnabledInLayout(pFocusControl) || !pFocusControl->IsInputEnabled() )
1330 {
1331 pFocusControl = ImplGetDlgWindow( 0, GetDlgWindowType::First );
1332 }
1333
1334 return pFocusControl;
1335}
1336
1338{
1339 vcl::Window* pFocusControl = GetFirstControlForFocus();
1340 if ( pFocusControl )
1341 pFocusControl->ImplControlFocus( GetFocusFlags::Init );
1342}
1343
1344void Dialog::GetDrawWindowBorder( sal_Int32& rLeftBorder, sal_Int32& rTopBorder, sal_Int32& rRightBorder, sal_Int32& rBottomBorder ) const
1345{
1347 aImplWin->GetBorder( rLeftBorder, rTopBorder, rRightBorder, rBottomBorder );
1348}
1349
1350void Dialog::Draw( OutputDevice* pDev, const Point& rPos, SystemTextColorFlags )
1351{
1352 Point aPos = pDev->LogicToPixel( rPos );
1353 Size aSize = GetSizePixel();
1354
1355 Wallpaper aWallpaper = GetBackground();
1356 if ( !aWallpaper.IsBitmap() )
1358
1359 pDev->Push();
1360 pDev->SetMapMode();
1361 pDev->SetLineColor();
1362
1363 if ( aWallpaper.IsBitmap() )
1364 pDev->DrawBitmapEx( aPos, aSize, aWallpaper.GetBitmap() );
1365 else
1366 {
1367 pDev->SetFillColor( aWallpaper.GetColor() );
1368 pDev->DrawRect( tools::Rectangle( aPos, aSize ) );
1369 }
1370
1371 if (!( GetStyle() & WB_NOBORDER ))
1372 {
1374 aImplWin->SetText( GetText() );
1375 aImplWin->setPosSizePixel( aPos.X(), aPos.Y(), aSize.Width(), aSize.Height() );
1376 aImplWin->SetDisplayActive( true );
1377 aImplWin->InitView();
1378
1379 aImplWin->Draw( pDev, aPos );
1380 }
1381
1382 pDev->Pop();
1383}
1384
1386{
1387 if (IsInClose())
1388 return;
1390}
1391
1393{
1395
1397 return;
1398
1399 bool bTunnelingEnabled = mpDialogImpl->m_bLOKTunneling;
1400 const vcl::ILibreOfficeKitNotifier* pNotifier = GetLOKNotifier();
1401 if (pNotifier && bTunnelingEnabled)
1402 {
1403 std::vector<vcl::LOKPayloadItem> aItems;
1404 aItems.emplace_back("size", GetSizePixel().toString());
1405 aItems.emplace_back("unique_id", this->get_id().toUtf8());
1406 pNotifier->notifyWindow(GetLOKWindowId(), "size_changed", aItems);
1407 }
1408}
1409
1410bool Dialog::set_property(const OString &rKey, const OUString &rValue)
1411{
1412 if (rKey == "border-width")
1413 set_border_width(rValue.toInt32());
1414 else
1415 return SystemWindow::set_property(rKey, rValue);
1416 return true;
1417}
1418
1420{
1422}
1423
1424IMPL_LINK(Dialog, ResponseHdl, Button*, pButton, void)
1425{
1426 auto aFind = mpDialogImpl->maResponses.find(pButton);
1427 if (aFind == mpDialogImpl->maResponses.end())
1428 return;
1429 short nResponse = aFind->second;
1430 if (nResponse == RET_HELP)
1431 {
1433 if (!pFocusWin || comphelper::LibreOfficeKit::isActive())
1434 pFocusWin = pButton;
1436 pFocusWin->RequestHelp(aEvt);
1437 return;
1438 }
1439 EndDialog(nResponse);
1440}
1441
1442void Dialog::add_button(PushButton* pButton, int response, bool bTransferOwnership)
1443{
1444 if (bTransferOwnership)
1445 mpDialogImpl->maOwnedButtons.push_back(pButton);
1446 mpDialogImpl->maResponses[pButton] = response;
1447 switch (pButton->GetType())
1448 {
1450 {
1451 if (!pButton->GetClickHdl().IsSet())
1452 pButton->SetClickHdl(LINK(this, Dialog, ResponseHdl));
1453 break;
1454 }
1455 //insist that the response ids match the default actions for those
1456 //widgets, and leave their default handlers in place
1458 assert(mpDialogImpl->get_response(pButton) == RET_OK);
1459 break;
1461 assert(mpDialogImpl->get_response(pButton) == RET_CANCEL || mpDialogImpl->get_response(pButton) == RET_CLOSE);
1462 break;
1464 assert(mpDialogImpl->get_response(pButton) == RET_HELP);
1465 break;
1466 default:
1467 SAL_WARN("vcl.layout", "The type of widget " <<
1468 pButton->GetHelpId() << " is currently not handled");
1469 break;
1470 }
1471}
1472
1474{
1475 //copy explicit responses
1476 std::map<VclPtr<vcl::Window>, short> aResponses(mpDialogImpl->maResponses);
1477
1478 if (mpActionArea)
1479 {
1480 //add implicit responses
1482 pChild = pChild->GetWindow(GetWindowType::Next))
1483 {
1484 if (aResponses.find(pChild) != aResponses.end())
1485 continue;
1486 switch (pChild->GetType())
1487 {
1489 aResponses[pChild] = RET_OK;
1490 break;
1492 aResponses[pChild] = RET_CANCEL;
1493 break;
1495 aResponses[pChild] = RET_HELP;
1496 break;
1497 default:
1498 break;
1499 }
1500 }
1501 }
1502
1503 for (const auto& a : aResponses)
1504 {
1505 if (a.second == response)
1506 return a.first;
1507 }
1508
1509 return nullptr;
1510}
1511
1513{
1514 //copy explicit responses
1515 std::map<VclPtr<vcl::Window>, short> aResponses(mpDialogImpl->maResponses);
1516
1517 if (mpActionArea)
1518 {
1519 //add implicit responses
1521 pChild = pChild->GetWindow(GetWindowType::Next))
1522 {
1523 if (aResponses.find(pChild) != aResponses.end())
1524 continue;
1525 switch (pChild->GetType())
1526 {
1528 aResponses[pChild] = RET_OK;
1529 break;
1531 aResponses[pChild] = RET_CANCEL;
1532 break;
1534 aResponses[pChild] = RET_HELP;
1535 break;
1536 default:
1537 break;
1538 }
1539 }
1540 }
1541
1542 for (const auto& a : aResponses)
1543 {
1544 if (a.first->GetStyle() & WB_DEFBUTTON)
1545 {
1546 return a.second;
1547 }
1548 }
1549 return RET_CANCEL;
1550}
1551
1553{
1554 //copy explicit responses
1555 std::map<VclPtr<vcl::Window>, short> aResponses(mpDialogImpl->maResponses);
1556
1557 if (mpActionArea)
1558 {
1559 //add implicit responses
1561 pChild = pChild->GetWindow(GetWindowType::Next))
1562 {
1563 if (aResponses.find(pChild) != aResponses.end())
1564 continue;
1565 switch (pChild->GetType())
1566 {
1568 aResponses[pChild] = RET_OK;
1569 break;
1571 aResponses[pChild] = RET_CANCEL;
1572 break;
1574 aResponses[pChild] = RET_HELP;
1575 break;
1576 default:
1577 break;
1578 }
1579 }
1580 }
1581
1582 for (auto& a : aResponses)
1583 {
1584 if (a.second == response)
1585 {
1586 a.first->SetStyle(a.first->GetStyle() | WB_DEFBUTTON);
1587 a.first->GrabFocus();
1588 }
1589 else
1590 {
1591 a.first->SetStyle(a.first->GetStyle() & ~WB_DEFBUTTON);
1592 }
1593 }
1594}
1595
1596VclBuilderContainer::VclBuilderContainer()
1597{
1598}
1599
1600void VclBuilderContainer::setDeferredProperties()
1601{
1602 if (!m_pUIBuilder)
1603 return;
1604 m_pUIBuilder->setDeferredProperties();
1605}
1606
1607VclBuilderContainer::~VclBuilderContainer()
1608{
1609}
1610
1612{
1614 {
1615 css::uno::Reference< css::uno::XComponentContext > xContext(
1617 css::uno::Reference<css::frame::XGlobalEventBroadcaster> xEventBroadcaster(css::frame::theGlobalEventBroadcaster::get(xContext), css::uno::UNO_SET_THROW);
1618 css::document::DocumentEvent aObject;
1619 aObject.EventName = "ModelessDialogVisible";
1620 xEventBroadcaster->documentEventOccured(aObject);
1621 }
1623}
1624
1626{
1627 if (mpDialogImpl && mpDialogImpl->m_aPopupMenuHdl.Call(rCEvt))
1628 return;
1629 SystemWindow::Command(rCEvt);
1630}
1631
1633{
1634 std::stack<std::vector<VclPtr<vcl::Window>>> m_aBusyStack;
1635};
1636
1638 : m_xImpl(std::make_unique<TopLevelWindowLockerImpl>())
1639{
1640}
1641
1643{
1644 // lock any toplevel windows from being closed until busy is over
1645 std::vector<VclPtr<vcl::Window>> aTopLevels;
1647 while (pTopWin)
1648 {
1649 vcl::Window* pCandidate = pTopWin;
1650 if (pCandidate->GetType() == WindowType::BORDERWINDOW)
1651 pCandidate = pCandidate->GetWindow(GetWindowType::FirstChild);
1652 // tdf#125266 ignore HelpTextWindows
1653 if (pCandidate &&
1654 pCandidate->GetType() != WindowType::HELPTEXTWINDOW &&
1655 pCandidate->GetType() != WindowType::FLOATINGWINDOW &&
1656 pCandidate->GetFrameWeld() != pIgnore)
1657 {
1658 aTopLevels.push_back(pCandidate);
1659 }
1660 pTopWin = Application::GetNextTopLevelWindow(pTopWin);
1661 }
1662 for (auto& a : aTopLevels)
1663 {
1664 a->IncModalCount();
1665 a->ImplGetFrame()->NotifyModalHierarchy(true);
1666 }
1667 m_xImpl->m_aBusyStack.push(aTopLevels);
1668}
1669
1671{
1672 // unlock locked toplevel windows from being closed now busy is over
1673 for (auto& a : m_xImpl->m_aBusyStack.top())
1674 {
1675 if (a->isDisposed())
1676 continue;
1677 a->DecModalCount();
1678 a->ImplGetFrame()->NotifyModalHierarchy(false);
1679 }
1680 m_xImpl->m_aBusyStack.pop();
1681}
1682
1684{
1685 return !m_xImpl->m_aBusyStack.empty();
1686}
1687
1689{
1690}
1691
1693{
1695 rJsonWriter.put("title", GetText());
1696 if (vcl::Window* pActionArea = get_action_area())
1697 {
1698 if (!pActionArea->IsVisible())
1699 rJsonWriter.put("collapsed", true);
1700 }
1701
1702 OUString sDialogId = OStringToOUString(GetHelpId(), RTL_TEXTENCODING_ASCII_US);
1703 sal_Int32 nStartPos = sDialogId.lastIndexOf('/');
1704 nStartPos = nStartPos >= 0 ? nStartPos + 1 : 0;
1705 rJsonWriter.put("dialogid", sDialogId.copy(nStartPos));
1706
1707 {
1708 auto aResponses = rJsonWriter.startArray("responses");
1709 for (const auto& rResponse : mpDialogImpl->maResponses)
1710 {
1711 auto aResponse = rJsonWriter.startStruct();
1712 rJsonWriter.put("id", rResponse.first->get_id());
1713 rJsonWriter.put("response", rResponse.second);
1714 }
1715 }
1716
1717 vcl::Window* pFocusControl = GetFirstControlForFocus();
1718 if (pFocusControl)
1719 rJsonWriter.put("init_focus_id", pFocusControl->get_id());
1720}
1721
1722/* 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:1581
static DialogCancelMode GetDialogCancelMode()
Gets the dialog cancel mode for headless environments.
Definition: svapp.cxx:1561
static vcl::Window * GetNextTopLevelWindow(vcl::Window const *pWindow)
Get the next top level window.
Definition: svapp.cxx:1190
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:1184
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:1611
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:1419
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:1410
int get_default_response() const
Definition: dialog.cxx:1512
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:1692
virtual void DataChanged(const DataChangedEvent &rDCEvt) override
Definition: dialog.cxx:833
bool mbModalMode
Definition: dialog.hxx:58
virtual void settingOptimalLayoutSize(Window *pBox) override
Definition: dialog.cxx:608
void ImplSetModalInputMode(bool bModal)
Definition: dialog.cxx:1249
bool ImplStartExecute()
Definition: dialog.cxx:907
bool mbInExecute
Definition: dialog.hxx:55
short Execute()
Definition: dialog.cxx:1050
virtual void Command(const CommandEvent &rCEvt) override
Definition: dialog.cxx:1625
bool StartExecuteAsync(VclAbstractDialog::AsyncContext &rCtx)
Commence execution of a modal dialog, disposes owner on failure.
Definition: dialog.cxx:1095
static void ImplEndExecuteModal()
Definition: dialog.cxx:1044
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:1337
virtual ~Dialog() override
Definition: dialog.cxx:616
bool mbInClose
Definition: dialog.hxx:57
virtual void Resize() override
Definition: dialog.cxx:1392
vcl::Window * GetFirstControlForFocus()
Definition: dialog.cxx:1309
vcl::Window * get_widget_for_response(int nResponse)
Definition: dialog.cxx:1473
virtual void ApplySettings(vcl::RenderContext &rRenderContext) override
Definition: dialog.cxx:497
void EndDialog(tools::Long nResult=RET_CANCEL)
Definition: dialog.cxx:1121
virtual bool Close() override
Definition: dialog.cxx:845
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:1350
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:1385
tools::Long mnMousePositioned
Definition: dialog.hxx:54
void SetModalInputMode(bool bModal)
Definition: dialog.cxx:1233
SAL_DLLPRIVATE void RemoveFromDlgList()
Definition: dialog.cxx:1112
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:1552
VclPtr< VclButtonBox > mpActionArea
Definition: dialog.hxx:61
void add_button(PushButton *pButton, int nResponse, bool bTransferOwnership)
Definition: dialog.cxx:1442
SAL_DLLPRIVATE Dialog(const Dialog &)=delete
static SAL_DLLPRIVATE vcl::Window * GetDefDialogParent()
Definition: svapp.cxx:1498
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:1344
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:170
void DrawBitmapEx(const Point &rDestPt, const BitmapEx &rBitmapEx)
Definition: bitmapex.cxx:33
void DrawRect(const tools::Rectangle &rRect)
Definition: rect.cxx:50
void SetLineColor()
Definition: line.cxx:37
void SetMapMode()
Definition: map.cxx:610
void SetFillColor()
Definition: fill.cxx:29
SAL_WARN_UNUSED_RESULT Point LogicToPixel(const Point &rLogicPt) const
Definition: map.cxx:892
void Push(vcl::PushFlags nFlags=vcl::PushFlags::ALL)
Definition: stack.cxx:32
void SetBackground()
Definition: background.cxx:27
void Pop()
Definition: stack.cxx:91
bool IsNativeControlSupported(ControlType nType, ControlPart nPart) const
Query the platform layer for control support.
SAL_DLLPRIVATE bool ImplIsDefButton() const
Definition: button.cxx:1251
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:1683
void incBusy(const weld::Widget *pIgnore)
Definition: dialog.cxx:1642
void log(std::u16string_view rString)
Definition: logger.cxx:181
static UITestLogger & getInstance()
Definition: logger.cxx:611
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:2639
bool IsReallyVisible() const
Definition: window2.cxx:1138
vcl::Window * GetParent() const
Definition: window2.cxx:1128
virtual void RequestHelp(const HelpEvent &rHEvt)
Definition: window.cxx:1873
virtual void StateChanged(StateChangedType nStateChange)
Definition: window.cxx:1944
SAL_DLLPRIVATE bool ImplIsPushButton() const
Definition: window2.cxx:952
bool IsInputEnabled() const
Definition: window2.cxx:1158
void SetLOKNotifier(const vcl::ILibreOfficeKitNotifier *pNotifier, bool bParent=false)
Interface to register for dialog / window tunneling.
Definition: window.cxx:3185
void DecModalCount()
Definition: window.cxx:3617
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:3011
void EndTracking(TrackingEventFlags nFlags=TrackingEventFlags::NONE)
Definition: window2.cxx:293
const OUString & get_id() const
Get the ID of the window.
Definition: window.cxx:3936
WindowType GetType() const
Definition: window2.cxx:1005
virtual void Command(const CommandEvent &rCEvt)
Definition: window.cxx:1927
vcl::Window * GetWindow(GetWindowType nType) const
Definition: stacking.cxx:1035
void set_border_width(sal_Int32 nBorderWidth)
Definition: window2.cxx:1874
SAL_DLLPRIVATE vcl::Window * ImplGetBorderWindow() const
Definition: window2.cxx:901
void GrabFocus()
Definition: window.cxx:2983
ImplSVEvent * PostUserEvent(const Link< void *, void > &rLink, void *pCaller=nullptr, bool bReferenceLink=false)
Definition: event.cxx:339
bool HasFocus() const
Definition: window.cxx:2988
void ReleaseLOKNotifier()
Indicate that LOK is not going to use this dialog any more.
Definition: window.cxx:3223
bool IsCreatedWithToolkit() const
Definition: window2.cxx:1268
WinBits GetStyle() const
Definition: window2.cxx:984
const AllSettings & GetSettings() const
Definition: window3.cxx:129
void Show(bool bVisible=true, ShowFlags nFlags=ShowFlags::NONE)
Definition: window.cxx:2191
const OString & GetHelpId() const
Definition: window2.cxx:854
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:891
SAL_DLLPRIVATE vcl::Window * ImplGetFirstOverlapWindow()
Definition: window2.cxx:906
VclPtr< vcl::Window > GetParentWithLOKNotifier()
Find the nearest parent with LOK Notifier; can be itself if this Window has LOK notifier set.
Definition: window.cxx:3265
const vcl::ILibreOfficeKitNotifier * GetLOKNotifier() const
Definition: window.cxx:3255
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:3598
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:3260
SalFrame * ImplGetFrame() const
Definition: window2.cxx:874
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:3365
virtual Size GetSizePixel() const
Definition: window.cxx:2406
Size GetOutputSizePixel() const
Definition: window3.cxx:89
bool IsControlBackground() const
Definition: window2.cxx:1118
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:1483
const Color & GetControlBackground() const
Definition: window2.cxx:1113
virtual void Activate()
Definition: window.cxx:1841
bool IsWindowOrChild(const vcl::Window *pWindow, bool bSystemWindow=false) const
Definition: stacking.cxx:1123
bool IsVisible() const
Definition: window2.cxx:1133
void IncModalCount()
Definition: window.cxx:3603
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:879
void CallEventListeners(VclEventId nEvent, void *pData=nullptr)
Definition: event.cxx:219
virtual void SetText(const OUString &rStr)
Definition: window.cxx:3033
virtual OUString GetText() const
Definition: window.cxx:3062
vcl::Window * ImplGetWindow() const
if this is a proxy return the client, otherwise itself
Definition: window2.cxx:861
SAL_DLLPRIVATE vcl::Window * ImplGetFrameWindow() const
Definition: window2.cxx:932
SAL_DLLPRIVATE void ImplInit(vcl::Window *pParent, WinBits nStyle, SystemParentData *pSystemParentData)
Definition: window.cxx:942
void EnableChildTransparentMode(bool bEnable=true)
Definition: window2.cxx:1053
void EnableInput(bool bEnable=true, bool bChild=true)
Definition: window.cxx:2497
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:1424
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:1224
void EndAllDialogs(vcl::Window const *pParent)
Definition: dialog.cxx:1201
void EnableDialogInput(vcl::Window *pWindow)
Definition: dialog.cxx:1216
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:403
ImplSVWinData * mpWinData
Definition: svdata.hxx:404
ImplSVAppData maAppData
Definition: svdata.hxx:401
VclPtr< vcl::Window > mpIntroWindow
Definition: svdata.hxx:409
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:1634
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:86
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:213
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