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, const OUString& rID, const OUString& rUIXMLDescription)
575 : SystemWindow(WindowType::DIALOG, "vcl::Dialog maLayoutIdle")
576 , mnInitFlag(InitFlag::Default)
577{
578 ImplLOKNotifier(pParent);
580 loadUI(pParent, rID, 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 {
930#ifdef IOS
931 // gh#5908 handle pasting disallowed clipboard contents on iOS
932 // When another app owns the current clipboard contents, pasting
933 // will display a "allow or disallow" dialog. If the disallow
934 // option is selected, the data from the UIPasteboard will be
935 // garbage and we will find ourselves here. Since calling
936 // SetLOKNotifier() with a nullptr aborts in an assert(), fix
937 // the crash by failing gracefully.
938 return false;
939#else
940 SetLOKNotifier(mpDialogImpl->m_aInstallLOKNotifierHdl.Call(nullptr));
941#endif
942 }
943
945 {
947 break;
949 if (bModal && GetLOKNotifier())
950 {
951 // check if there's already some dialog being ::Execute()d
952 const bool bDialogExecuting = std::any_of(pSVData->mpWinData->mpExecuteDialogs.begin(),
953 pSVData->mpWinData->mpExecuteDialogs.end(),
954 [](const Dialog* pDialog) {
955 return pDialog->IsInSyncExecute();
956 });
957 if (!(bDialogExecuting && IsInSyncExecute()))
958 break;
959 else
960 SAL_WARN("lok.dialog", "Dialog \"" << ImplGetDialogText(this) << "\" is being synchronously executed over an existing synchronously executing dialog.");
961 }
962
964 { // helps starbasic unit tests show their errors
965 std::cerr << "Dialog \"" << ImplGetDialogText(this)
966 << "\"cancelled in silent mode";
967 }
968
969 SAL_INFO(
970 "vcl",
971 "Dialog \"" << ImplGetDialogText(this)
972 << "\"cancelled in silent mode");
973 return false;
974
976 return false;
977
978 default: // default cannot happen
980 std::abort();
981 }
982
983#ifdef DBG_UTIL
984 vcl::Window* pParent = GetParent();
985 if ( pParent )
986 {
987 pParent = pParent->ImplGetFirstOverlapWindow();
988 if (pParent)
989 {
990 SAL_WARN_IF( !pParent->IsReallyVisible(), "vcl",
991 "Dialog::StartExecuteModal() - Parent not visible" );
992 SAL_WARN_IF( !pParent->IsInputEnabled(), "vcl",
993 "Dialog::StartExecuteModal() - Parent input disabled, use another parent to ensure modality!" );
994 SAL_WARN_IF( pParent->IsInModalMode(), "vcl",
995 "Dialog::StartExecuteModal() - Parent already modally disabled, use another parent to ensure modality!" );
996 }
997 }
998#endif
999
1000 // link all dialogs which are being executed
1001 pSVData->mpWinData->mpExecuteDialogs.push_back(this);
1002
1003 // stop capturing, in order to have control over the dialog
1004 if (pSVData->mpWinData->mpTrackWin)
1006 if (pSVData->mpWinData->mpCaptureWin)
1007 pSVData->mpWinData->mpCaptureWin->ReleaseMouse();
1008 EnableInput();
1009 }
1010
1011 mbInExecute = true;
1012 // no real modality in LibreOfficeKit
1013 if (!bKitActive && bModal)
1014 SetModalInputMode(true);
1015
1016 // FIXME: no layouting, workaround some clipping issues
1018
1019 css::uno::Reference< css::uno::XComponentContext > xContext(
1021 bool bForceFocusAndToFront(officecfg::Office::Common::View::NewDocumentHandling::ForceFocusAndToFront::get());
1022 ShowFlags showFlags = bForceFocusAndToFront ? ShowFlags::ForegroundTask : ShowFlags::NONE;
1023 Show(true, showFlags);
1024
1025 if (bModal)
1026 pSVData->maAppData.mnModalMode++;
1027
1028 css::uno::Reference<css::frame::XGlobalEventBroadcaster> xEventBroadcaster(
1029 css::frame::theGlobalEventBroadcaster::get(xContext), css::uno::UNO_SET_THROW);
1030 css::document::DocumentEvent aObject;
1031 aObject.EventName = "DialogExecute";
1032 xEventBroadcaster->documentEventOccured(aObject);
1033 if (bModal)
1034 UITestLogger::getInstance().log(Concat2View("Open Modal " + get_id()));
1035 else
1036 UITestLogger::getInstance().log(Concat2View("Open Modeless " + get_id()));
1037
1038 bool bTunnelingEnabled = mpDialogImpl->m_bLOKTunneling;
1039 if (comphelper::LibreOfficeKit::isActive() && bTunnelingEnabled)
1040 {
1041 if (const vcl::ILibreOfficeKitNotifier* pNotifier = GetLOKNotifier())
1042 {
1043 // Dialog boxes don't get the Resize call and they
1044 // can have invalid size at 'created' message above.
1045 // If there is no difference, the client should detect it and ignore us,
1046 // otherwise, this should make sure that the window has the correct size.
1047 std::vector<vcl::LOKPayloadItem> aItems;
1048 aItems.emplace_back("size", GetSizePixel().toString());
1049 aItems.emplace_back("unique_id", this->get_id().toUtf8());
1050 pNotifier->notifyWindow(GetLOKWindowId(), "size_changed", aItems);
1051 }
1052 }
1053
1054 return true;
1055}
1056
1058{
1059 ImplSVData* pSVData = ImplGetSVData();
1060 pSVData->maAppData.mnModalMode--;
1061}
1062
1064{
1065 VclPtr<vcl::Window> xWindow = this;
1066
1067 mbInSyncExecute = true;
1068 comphelper::ScopeGuard aGuard([&]() {
1069 mbInSyncExecute = false;
1070 });
1071
1072 if ( !ImplStartExecute() )
1073 return 0;
1074
1075 // Yield util EndDialog is called or dialog gets destroyed
1076 // (the latter should not happen, but better safe than sorry
1077 while ( !xWindow->isDisposed() && mbInExecute && !Application::IsQuit() )
1079
1081#ifdef DBG_UTIL
1082 assert (!mpDialogParent || !mpDialogParent->isDisposed());
1083#endif
1084 if ( !xWindow->isDisposed() )
1085 xWindow.clear();
1086 else
1087 {
1088 OSL_FAIL( "Dialog::Execute() - Dialog destroyed in Execute()" );
1089 }
1090
1091 assert(mpDialogImpl);
1092
1093 if (mpDialogImpl)
1094 {
1095 tools::Long nRet = mpDialogImpl->mnResult;
1096 mpDialogImpl->mnResult = -1;
1097
1098 return static_cast<short>(nRet);
1099 }
1100 else
1101 {
1102 SAL_WARN( "vcl", "Dialog::Execute() : missing mpDialogImpl " );
1103 return 0;
1104 }
1105}
1106
1107// virtual
1109{
1110 const bool bModal = GetType() != WindowType::MODELESSDIALOG;
1111 if (!ImplStartExecute())
1112 {
1113 rCtx.mxOwner.disposeAndClear();
1114 rCtx.mxOwnerDialogController.reset();
1115 rCtx.mxOwnerSelf.reset();
1116 return false;
1117 }
1118
1119 mpDialogImpl->maEndCtx = rCtx;
1120 mpDialogImpl->mbStartedModal = bModal;
1121
1122 return true;
1123}
1124
1126{
1127 ImplSVData* pSVData = ImplGetSVData();
1128 auto& rExecuteDialogs = pSVData->mpWinData->mpExecuteDialogs;
1129
1130 // remove dialog from the list of dialogs which are being executed
1131 rExecuteDialogs.erase(std::remove_if(rExecuteDialogs.begin(), rExecuteDialogs.end(), [this](VclPtr<Dialog>& dialog){ return dialog.get() == this; }), rExecuteDialogs.end());
1132}
1133
1135{
1136 if (!mbInExecute || isDisposed())
1137 return;
1138
1139 const bool bModal = GetType() != WindowType::MODELESSDIALOG;
1140
1141 Hide();
1142
1144 {
1145 if(const vcl::ILibreOfficeKitNotifier* pNotifier = GetLOKNotifier())
1146 {
1147 if (mpDialogImpl->m_bLOKTunneling)
1148 pNotifier->notifyWindow(GetLOKWindowId(), "close");
1150 }
1151 }
1152
1153 if (bModal)
1154 {
1155 SetModalInputMode(false);
1156
1158
1159 // set focus to previous modal dialog if it is modal for
1160 // the same frame parent (or NULL)
1161 ImplSVData* pSVData = ImplGetSVData();
1162 if (!pSVData->mpWinData->mpExecuteDialogs.empty())
1163 {
1164 VclPtr<Dialog> pPrevious = pSVData->mpWinData->mpExecuteDialogs.back();
1165
1166 vcl::Window* pFrameParent = ImplGetFrameWindow()->ImplGetParent();
1167 vcl::Window* pPrevFrameParent = pPrevious->ImplGetFrameWindow()? pPrevious->ImplGetFrameWindow()->ImplGetParent(): nullptr;
1168 if( ( !pFrameParent && !pPrevFrameParent ) ||
1169 ( pFrameParent && pPrevFrameParent && pFrameParent->ImplGetFrame() == pPrevFrameParent->ImplGetFrame() )
1170 )
1171 {
1172 pPrevious->GrabFocus();
1173 }
1174 }
1175 }
1176
1177 mpDialogImpl->mnResult = nResult;
1178
1179 if ( mpDialogImpl->mbStartedModal )
1181
1182 // coverity[check_after_deref] - ImplEndExecuteModal might trigger destruction of mpDialogImpl
1183 if ( mpDialogImpl && mpDialogImpl->maEndCtx.isSet() )
1184 {
1185 auto fn = std::move(mpDialogImpl->maEndCtx.maEndDialogFn);
1186 // std::move leaves maEndDialogFn in a valid state with unspecified
1187 // value. For the SwSyncBtnDlg case gcc and msvc left maEndDialogFn
1188 // unset, but clang left maEndDialogFn at its original value, keeping
1189 // an extra reference to the DialogController in its lambda giving
1190 // an inconsistent lifecycle for the dialog. Force it to be unset.
1191 mpDialogImpl->maEndCtx.maEndDialogFn = nullptr;
1192 fn(nResult);
1193 }
1194
1195 if ( mpDialogImpl && mpDialogImpl->mbStartedModal )
1196 {
1197 mpDialogImpl->mbStartedModal = false;
1198 mpDialogImpl->mnResult = -1;
1199 }
1200 mbInExecute = false;
1201
1202 if ( mpDialogImpl )
1203 {
1204 // Destroy ourselves (if we have a context with VclPtr owner)
1205 std::shared_ptr<weld::DialogController> xOwnerDialogController = std::move(mpDialogImpl->maEndCtx.mxOwnerDialogController);
1206 std::shared_ptr<weld::Dialog> xOwnerSelf = std::move(mpDialogImpl->maEndCtx.mxOwnerSelf);
1207 mpDialogImpl->maEndCtx.mxOwner.disposeAndClear();
1208 xOwnerDialogController.reset();
1209 xOwnerSelf.reset();
1210 }
1211}
1212
1213namespace vcl
1214{
1215 void EndAllDialogs( vcl::Window const * pParent )
1216 {
1217 ImplSVData* pSVData = ImplGetSVData();
1218 auto& rExecuteDialogs = pSVData->mpWinData->mpExecuteDialogs;
1219
1220 for (auto it = rExecuteDialogs.rbegin(); it != rExecuteDialogs.rend(); ++it)
1221 {
1222 if (!pParent || pParent->IsWindowOrChild(*it, true))
1223 {
1224 (*it)->EndDialog();
1225 (*it)->PostUserEvent(Link<void*, void>());
1226 }
1227 }
1228 }
1229
1231 {
1232 if (Dialog* pDialog = dynamic_cast<Dialog*>(pWindow))
1233 {
1234 pDialog->EnableInput();
1235 }
1236 }
1237
1239 {
1240 if (Dialog* pDialog = dynamic_cast<Dialog*>(pWindow))
1241 pDialog->Close();
1242 else if (FloatingWindow* pFloatWin = dynamic_cast<FloatingWindow*>(pWindow))
1244 }
1245}
1246
1247void Dialog::SetModalInputMode( bool bModal )
1248{
1249 if ( bModal == mbModalMode )
1250 return;
1251
1252 ImplGetFrame()->SetModal(bModal);
1253
1254 if (GetParent())
1255 {
1256 SalFrame* pFrame = GetParent()->ImplGetFrame();
1257 pFrame->NotifyModalHierarchy(bModal);
1258 }
1259
1260 ImplSetModalInputMode(bModal);
1261}
1262
1264{
1265 if ( bModal == mbModalMode )
1266 return;
1267
1268 // previously Execute()'d dialog - the one below the top-most one
1269 VclPtr<Dialog> pPrevious;
1270 ImplSVData* pSVData = ImplGetSVData();
1271 auto& rExecuteDialogs = pSVData->mpWinData->mpExecuteDialogs;
1272 if (rExecuteDialogs.size() > 1)
1273 pPrevious = rExecuteDialogs[rExecuteDialogs.size() - 2];
1274
1275 mbModalMode = bModal;
1276 if ( bModal )
1277 {
1278 // Disable the prev Modal Dialog, because our dialog must close at first,
1279 // before the other dialog can be closed (because the other dialog
1280 // is on stack since our dialog returns)
1281 if (pPrevious && !pPrevious->IsWindowOrChild(this, true))
1282 pPrevious->EnableInput(false, this);
1283
1284 // determine next overlap dialog parent
1285 vcl::Window* pParent = GetParent();
1286 if ( pParent )
1287 {
1288 // #103716# dialogs should always be modal to the whole frame window
1289 // #115933# disable the whole frame hierarchy, useful if our parent
1290 // is a modeless dialog
1291 mpDialogParent = pParent->mpWindowImpl->mpFrameWindow;
1293 }
1294 }
1295 else
1296 {
1297 if ( mpDialogParent )
1298 {
1299 // #115933# re-enable the whole frame hierarchy again (see above)
1300 // note that code in getfocus assures that we do not accidentally enable
1301 // windows that were disabled before
1303 }
1304
1305 // Enable the prev Modal Dialog
1306 if (pPrevious && !pPrevious->IsWindowOrChild(this, true))
1307 {
1308 pPrevious->EnableInput(true, this);
1309
1310 // ensure continued modality of prev dialog
1311 // do not change modality counter
1312
1313 // #i119994# need find the last modal dialog before reactive it
1314 if (pPrevious->IsModalInputMode() || !pPrevious->IsWindowOrChild(this, true))
1315 {
1316 pPrevious->ImplSetModalInputMode(false);
1317 pPrevious->ImplSetModalInputMode(true);
1318 }
1319 }
1320 }
1321}
1322
1324{
1325 vcl::Window* pFocusControl = nullptr;
1326 vcl::Window* pFirstOverlapWindow = ImplGetFirstOverlapWindow();
1327
1328 // find focus control, even if the dialog has focus
1329 if (!HasFocus() && pFirstOverlapWindow && pFirstOverlapWindow->mpWindowImpl)
1330 {
1331 // prefer a child window which had focus before
1332 pFocusControl = ImplGetFirstOverlapWindow()->mpWindowImpl->mpLastFocusWindow;
1333 // find the control out of the dialog control
1334 if ( pFocusControl )
1335 pFocusControl = ImplFindDlgCtrlWindow( pFocusControl );
1336 }
1337 // no control had the focus before or the control is not
1338 // part of the tab-control, now give focus to the
1339 // first control in the tab-control
1340 if ( !pFocusControl ||
1341 !(pFocusControl->GetStyle() & WB_TABSTOP) ||
1342 !isVisibleInLayout(pFocusControl) ||
1343 !isEnabledInLayout(pFocusControl) || !pFocusControl->IsInputEnabled() )
1344 {
1345 pFocusControl = ImplGetDlgWindow( 0, GetDlgWindowType::First );
1346 }
1347
1348 return pFocusControl;
1349}
1350
1352{
1353 vcl::Window* pFocusControl = GetFirstControlForFocus();
1354 if ( pFocusControl )
1355 pFocusControl->ImplControlFocus( GetFocusFlags::Init );
1356}
1357
1358void Dialog::GetDrawWindowBorder( sal_Int32& rLeftBorder, sal_Int32& rTopBorder, sal_Int32& rRightBorder, sal_Int32& rBottomBorder ) const
1359{
1361 aImplWin->GetBorder( rLeftBorder, rTopBorder, rRightBorder, rBottomBorder );
1362}
1363
1365{
1366 Point aPos = pDev->LogicToPixel( rPos );
1367 Size aSize = GetSizePixel();
1368
1369 Wallpaper aWallpaper = GetBackground();
1370 if ( !aWallpaper.IsBitmap() )
1372
1373 pDev->Push();
1374 pDev->SetMapMode();
1375 pDev->SetLineColor();
1376
1377 if ( aWallpaper.IsBitmap() )
1378 pDev->DrawBitmapEx( aPos, aSize, aWallpaper.GetBitmap() );
1379 else
1380 {
1381 pDev->SetFillColor( aWallpaper.GetColor() );
1382 pDev->DrawRect( tools::Rectangle( aPos, aSize ) );
1383 }
1384
1385 if (!( GetStyle() & WB_NOBORDER ))
1386 {
1388 aImplWin->SetText( GetText() );
1389 aImplWin->setPosSizePixel( aPos.X(), aPos.Y(), aSize.Width(), aSize.Height() );
1390 aImplWin->SetDisplayActive( true );
1391 aImplWin->InitView();
1392
1393 aImplWin->Draw( pDev, aPos );
1394 }
1395
1396 pDev->Pop();
1397}
1398
1400{
1401 if (IsInClose())
1402 return;
1404}
1405
1407{
1409
1411 return;
1412
1413 bool bTunnelingEnabled = mpDialogImpl->m_bLOKTunneling;
1414 const vcl::ILibreOfficeKitNotifier* pNotifier = GetLOKNotifier();
1415 if (pNotifier && bTunnelingEnabled)
1416 {
1417 std::vector<vcl::LOKPayloadItem> aItems;
1418 aItems.emplace_back("size", GetSizePixel().toString());
1419 aItems.emplace_back("unique_id", this->get_id().toUtf8());
1420 pNotifier->notifyWindow(GetLOKWindowId(), "size_changed", aItems);
1421 }
1422}
1423
1424bool Dialog::set_property(const OUString &rKey, const OUString &rValue)
1425{
1426 if (rKey == "border-width")
1427 set_border_width(rValue.toInt32());
1428 else
1429 return SystemWindow::set_property(rKey, rValue);
1430 return true;
1431}
1432
1434{
1436}
1437
1438IMPL_LINK(Dialog, ResponseHdl, Button*, pButton, void)
1439{
1440 auto aFind = mpDialogImpl->maResponses.find(pButton);
1441 if (aFind == mpDialogImpl->maResponses.end())
1442 return;
1443 short nResponse = aFind->second;
1444 if (nResponse == RET_HELP)
1445 {
1447 if (!pFocusWin || comphelper::LibreOfficeKit::isActive())
1448 pFocusWin = pButton;
1450 pFocusWin->RequestHelp(aEvt);
1451 return;
1452 }
1453 EndDialog(nResponse);
1454}
1455
1456void Dialog::add_button(PushButton* pButton, int response, bool bTransferOwnership)
1457{
1458 if (bTransferOwnership)
1459 mpDialogImpl->maOwnedButtons.push_back(pButton);
1460 mpDialogImpl->maResponses[pButton] = response;
1461 switch (pButton->GetType())
1462 {
1464 {
1465 if (!pButton->GetClickHdl().IsSet())
1466 pButton->SetClickHdl(LINK(this, Dialog, ResponseHdl));
1467 break;
1468 }
1469 //insist that the response ids match the default actions for those
1470 //widgets, and leave their default handlers in place
1472 assert(mpDialogImpl->get_response(pButton) == RET_OK);
1473 break;
1475 assert(mpDialogImpl->get_response(pButton) == RET_CANCEL || mpDialogImpl->get_response(pButton) == RET_CLOSE);
1476 break;
1478 assert(mpDialogImpl->get_response(pButton) == RET_HELP);
1479 break;
1480 default:
1481 SAL_WARN("vcl.layout", "The type of widget " <<
1482 pButton->GetHelpId() << " is currently not handled");
1483 break;
1484 }
1485}
1486
1488{
1489 //copy explicit responses
1490 std::map<VclPtr<vcl::Window>, short> aResponses(mpDialogImpl->maResponses);
1491
1492 if (mpActionArea)
1493 {
1494 //add implicit responses
1496 pChild = pChild->GetWindow(GetWindowType::Next))
1497 {
1498 if (aResponses.find(pChild) != aResponses.end())
1499 continue;
1500 switch (pChild->GetType())
1501 {
1503 aResponses[pChild] = RET_OK;
1504 break;
1506 aResponses[pChild] = RET_CANCEL;
1507 break;
1509 aResponses[pChild] = RET_HELP;
1510 break;
1511 default:
1512 break;
1513 }
1514 }
1515 }
1516
1517 for (const auto& a : aResponses)
1518 {
1519 if (a.second == response)
1520 return a.first;
1521 }
1522
1523 return nullptr;
1524}
1525
1527{
1528 //copy explicit responses
1529 std::map<VclPtr<vcl::Window>, short> aResponses(mpDialogImpl->maResponses);
1530
1531 if (mpActionArea)
1532 {
1533 //add implicit responses
1535 pChild = pChild->GetWindow(GetWindowType::Next))
1536 {
1537 if (aResponses.find(pChild) != aResponses.end())
1538 continue;
1539 switch (pChild->GetType())
1540 {
1542 aResponses[pChild] = RET_OK;
1543 break;
1545 aResponses[pChild] = RET_CANCEL;
1546 break;
1548 aResponses[pChild] = RET_HELP;
1549 break;
1550 default:
1551 break;
1552 }
1553 }
1554 }
1555
1556 for (const auto& a : aResponses)
1557 {
1558 if (a.first->GetStyle() & WB_DEFBUTTON)
1559 {
1560 return a.second;
1561 }
1562 }
1563 return RET_CANCEL;
1564}
1565
1567{
1568 //copy explicit responses
1569 std::map<VclPtr<vcl::Window>, short> aResponses(mpDialogImpl->maResponses);
1570
1571 if (mpActionArea)
1572 {
1573 //add implicit responses
1575 pChild = pChild->GetWindow(GetWindowType::Next))
1576 {
1577 if (aResponses.find(pChild) != aResponses.end())
1578 continue;
1579 switch (pChild->GetType())
1580 {
1582 aResponses[pChild] = RET_OK;
1583 break;
1585 aResponses[pChild] = RET_CANCEL;
1586 break;
1588 aResponses[pChild] = RET_HELP;
1589 break;
1590 default:
1591 break;
1592 }
1593 }
1594 }
1595
1596 for (auto& a : aResponses)
1597 {
1598 if (a.second == response)
1599 {
1600 a.first->SetStyle(a.first->GetStyle() | WB_DEFBUTTON);
1601 a.first->GrabFocus();
1602 }
1603 else
1604 {
1605 a.first->SetStyle(a.first->GetStyle() & ~WB_DEFBUTTON);
1606 }
1607 }
1608}
1609
1610VclBuilderContainer::VclBuilderContainer()
1611{
1612}
1613
1614void VclBuilderContainer::setDeferredProperties()
1615{
1616 if (!m_pUIBuilder)
1617 return;
1618 m_pUIBuilder->setDeferredProperties();
1619}
1620
1621VclBuilderContainer::~VclBuilderContainer()
1622{
1623}
1624
1626{
1628 {
1629 css::uno::Reference< css::uno::XComponentContext > xContext(
1631 css::uno::Reference<css::frame::XGlobalEventBroadcaster> xEventBroadcaster(css::frame::theGlobalEventBroadcaster::get(xContext), css::uno::UNO_SET_THROW);
1632 css::document::DocumentEvent aObject;
1633 aObject.EventName = "ModelessDialogVisible";
1634 xEventBroadcaster->documentEventOccured(aObject);
1635 }
1637}
1638
1640{
1641 if (mpDialogImpl && mpDialogImpl->m_aPopupMenuHdl.Call(rCEvt))
1642 return;
1643 SystemWindow::Command(rCEvt);
1644}
1645
1647{
1648 std::stack<std::vector<VclPtr<vcl::Window>>> m_aBusyStack;
1649};
1650
1652 : m_xImpl(std::make_unique<TopLevelWindowLockerImpl>())
1653{
1654}
1655
1657{
1658 // lock any toplevel windows from being closed until busy is over
1659 std::vector<VclPtr<vcl::Window>> aTopLevels;
1661 while (pTopWin)
1662 {
1663 vcl::Window* pCandidate = pTopWin;
1664 if (pCandidate->GetType() == WindowType::BORDERWINDOW)
1665 pCandidate = pCandidate->GetWindow(GetWindowType::FirstChild);
1666 // tdf#125266 ignore HelpTextWindows
1667 if (pCandidate &&
1668 pCandidate->GetType() != WindowType::HELPTEXTWINDOW &&
1669 pCandidate->GetType() != WindowType::FLOATINGWINDOW &&
1670 pCandidate->GetFrameWeld() != pIgnore)
1671 {
1672 aTopLevels.push_back(pCandidate);
1673 }
1674 pTopWin = Application::GetNextTopLevelWindow(pTopWin);
1675 }
1676 for (auto& a : aTopLevels)
1677 {
1678 a->IncModalCount();
1679 a->ImplGetFrame()->NotifyModalHierarchy(true);
1680 }
1681 m_xImpl->m_aBusyStack.push(aTopLevels);
1682}
1683
1685{
1686 // unlock locked toplevel windows from being closed now busy is over
1687 for (auto& a : m_xImpl->m_aBusyStack.top())
1688 {
1689 if (a->isDisposed())
1690 continue;
1691 a->DecModalCount();
1692 a->ImplGetFrame()->NotifyModalHierarchy(false);
1693 }
1694 m_xImpl->m_aBusyStack.pop();
1695}
1696
1698{
1699 return !m_xImpl->m_aBusyStack.empty();
1700}
1701
1703{
1704}
1705
1707{
1709 rJsonWriter.put("title", GetText());
1710 if (vcl::Window* pActionArea = get_action_area())
1711 {
1712 if (!pActionArea->IsVisible())
1713 rJsonWriter.put("collapsed", true);
1714 }
1715
1716 OUString sDialogId = GetHelpId();
1717 sal_Int32 nStartPos = sDialogId.lastIndexOf('/');
1718 nStartPos = nStartPos >= 0 ? nStartPos + 1 : 0;
1719 rJsonWriter.put("dialogid", sDialogId.copy(nStartPos));
1720
1721 {
1722 auto aResponses = rJsonWriter.startArray("responses");
1723 for (const auto& rResponse : mpDialogImpl->maResponses)
1724 {
1725 auto aResponse = rJsonWriter.startStruct();
1726 rJsonWriter.put("id", rResponse.first->get_id());
1727 rJsonWriter.put("response", rResponse.second);
1728 }
1729 }
1730
1731 vcl::Window* pFocusControl = GetFirstControlForFocus();
1732 if (pFocusControl)
1733 rJsonWriter.put("init_focus_id", pFocusControl->get_id());
1734}
1735
1736/* 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:428
static SystemWindowFlags GetSystemWindowMode()
Get the system window mode of dialogs.
Definition: svapp.cxx:1449
static DialogCancelMode GetDialogCancelMode()
Gets the dialog cancel mode for headless environments.
Definition: svapp.cxx:1429
static vcl::Window * GetNextTopLevelWindow(vcl::Window const *pWindow)
Get the next top level window.
Definition: svapp.cxx:1067
static vcl::Window * GetFocusWindow()
Get the currently focused window.
Definition: svapp.cxx:1038
static bool IsQuit()
Has Quit() been called?
Definition: svapp.cxx:485
static vcl::Window * GetFirstTopLevelWindow()
Get the first top-level window of the application.
Definition: svapp.cxx:1061
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:1625
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:1433
bool IsInExecute() const
Definition: dialog.hxx:125
virtual void PixelInvalidate(const tools::Rectangle *pRectangle) override
Notification about some rectangle of the output device got invalidated.
Definition: dialog.cxx:400
int get_default_response() const
Definition: dialog.cxx:1526
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:1706
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:1263
bool ImplStartExecute()
Definition: dialog.cxx:907
bool mbInExecute
Definition: dialog.hxx:55
short Execute()
Definition: dialog.cxx:1063
virtual void Command(const CommandEvent &rCEvt) override
Definition: dialog.cxx:1639
bool StartExecuteAsync(VclAbstractDialog::AsyncContext &rCtx)
Commence execution of a modal dialog, disposes owner on failure.
Definition: dialog.cxx:1108
static void ImplEndExecuteModal()
Definition: dialog.cxx:1057
bool IsInSyncExecute() const
Definition: dialog.hxx:127
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:1351
virtual ~Dialog() override
Definition: dialog.cxx:616
bool mbInClose
Definition: dialog.hxx:57
virtual void Resize() override
Definition: dialog.cxx:1406
vcl::Window * GetFirstControlForFocus()
Definition: dialog.cxx:1323
vcl::Window * get_widget_for_response(int nResponse)
Definition: dialog.cxx:1487
virtual void ApplySettings(vcl::RenderContext &rRenderContext) override
Definition: dialog.cxx:497
void EndDialog(tools::Long nResult=RET_CANCEL)
Definition: dialog.cxx:1134
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:1364
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:1399
virtual bool set_property(const OUString &rKey, const OUString &rValue) override
Definition: dialog.cxx:1424
tools::Long mnMousePositioned
Definition: dialog.hxx:54
void SetModalInputMode(bool bModal)
Definition: dialog.cxx:1247
SAL_DLLPRIVATE void RemoveFromDlgList()
Definition: dialog.cxx:1125
virtual void StateChanged(StateChangedType nStateChange) override
Definition: dialog.cxx:755
VclButtonBox * get_action_area()
Definition: dialog.hxx:119
void set_default_response(int nResponse)
Definition: dialog.cxx:1566
VclPtr< VclButtonBox > mpActionArea
Definition: dialog.hxx:61
void add_button(PushButton *pButton, int nResponse, bool bTransferOwnership)
Definition: dialog.cxx:1456
SAL_DLLPRIVATE Dialog(const Dialog &)=delete
static SAL_DLLPRIVATE vcl::Window * GetDefDialogParent()
Definition: svapp.cxx:1366
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:1358
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:597
void SetFillColor()
Definition: fill.cxx:29
SAL_WARN_UNUSED_RESULT Point LogicToPixel(const Point &rLogicPt) const
Definition: map.cxx:879
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.
constexpr tools::Long Y() const
constexpr tools::Long X() const
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:409
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:1051
void loadUI(vcl::Window *pParent, const OUString &rID, const OUString &rUIXMLDescription, const css::uno::Reference< css::frame::XFrame > &rFrame=css::uno::Reference< css::frame::XFrame >())
Definition: syswin.cxx:90
virtual void queue_resize(StateChangedType eReason=StateChangedType::Layout) override
Definition: syswin.cxx:981
virtual bool EventNotify(NotifyEvent &rNEvt) override
Definition: syswin.cxx:176
SAL_DLLPRIVATE void DoInitialLayout()
Definition: syswin.cxx:1090
bool isLayoutEnabled() const
Definition: syswin.cxx:998
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:993
std::unique_ptr< TopLevelWindowLockerImpl > m_xImpl
bool isBusy() const
Definition: dialog.cxx:1697
void incBusy(const weld::Widget *pIgnore)
Definition: dialog.cxx:1656
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:277
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(std::u16string_view pPropName, const OUString &rPropValue)
ScopedJsonWriterStruct startStruct()
ScopedJsonWriterArray startArray(std::string_view)
virtual void notifyWindow(vcl::LOKWindowId nLOKWindowId, const OUString &rAction, const std::vector< LOKPayloadItem > &rPayload=std::vector< LOKPayloadItem >()) const =0
Callbacks.
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:2635
bool IsReallyVisible() const
Definition: window2.cxx:1133
vcl::Window * GetParent() const
Definition: window2.cxx:1123
virtual void RequestHelp(const HelpEvent &rHEvt)
Definition: window.cxx:1869
virtual void StateChanged(StateChangedType nStateChange)
Definition: window.cxx:1940
SAL_DLLPRIVATE bool ImplIsPushButton() const
Definition: window2.cxx:957
bool IsInputEnabled() const
Definition: window2.cxx:1153
void SetLOKNotifier(const vcl::ILibreOfficeKitNotifier *pNotifier, bool bParent=false)
Interface to register for dialog / window tunneling.
Definition: window.cxx:3178
void DecModalCount()
Definition: window.cxx:3616
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:3004
void EndTracking(TrackingEventFlags nFlags=TrackingEventFlags::NONE)
Definition: window2.cxx:293
const OUString & get_id() const
Get the ID of the window.
Definition: window.cxx:3935
WindowType GetType() const
Definition: window2.cxx:1000
virtual void Command(const CommandEvent &rCEvt)
Definition: window.cxx:1923
vcl::Window * GetWindow(GetWindowType nType) const
Definition: stacking.cxx:1036
void set_border_width(sal_Int32 nBorderWidth)
Definition: window2.cxx:1869
SAL_DLLPRIVATE vcl::Window * ImplGetBorderWindow() const
Definition: window2.cxx:906
void GrabFocus()
Definition: window.cxx:2976
ImplSVEvent * PostUserEvent(const Link< void *, void > &rLink, void *pCaller=nullptr, bool bReferenceLink=false)
Definition: event.cxx:339
bool HasFocus() const
Definition: window.cxx:2981
void ReleaseLOKNotifier()
Indicate that LOK is not going to use this dialog any more.
Definition: window.cxx:3214
bool IsCreatedWithToolkit() const
Definition: window2.cxx:1263
WinBits GetStyle() const
Definition: window2.cxx:979
const AllSettings & GetSettings() const
Definition: window3.cxx:129
void Show(bool bVisible=true, ShowFlags nFlags=ShowFlags::NONE)
Definition: window.cxx:2187
const OUString & GetHelpId() const
Definition: window2.cxx:859
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:896
SAL_DLLPRIVATE vcl::Window * ImplGetFirstOverlapWindow()
Definition: window2.cxx:911
VclPtr< vcl::Window > GetParentWithLOKNotifier()
Find the nearest parent with LOK Notifier; can be itself if this Window has LOK notifier set.
Definition: window.cxx:3256
const vcl::ILibreOfficeKitNotifier * GetLOKNotifier() const
Definition: window.cxx:3246
void Hide()
Definition: window.hxx:879
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:3597
void SetPointerPosPixel(const Point &rPos)
Definition: mouse.cxx:511
std::unique_ptr< WindowImpl > mpWindowImpl
Definition: window.hxx:484
vcl::LOKWindowId GetLOKWindowId() const
Definition: window.cxx:3251
SalFrame * ImplGetFrame() const
Definition: window2.cxx:879
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:3356
virtual Size GetSizePixel() const
Definition: window.cxx:2402
Size GetOutputSizePixel() const
Definition: window3.cxx:89
bool IsControlBackground() const
Definition: window2.cxx:1113
virtual void DataChanged(const DataChangedEvent &rDCEvt)
Definition: event.cxx:36
Point GetPointerPosPixel()
Definition: mouse.cxx:540
const Color & GetControlBackground() const
Definition: window2.cxx:1108
virtual void Activate()
Definition: window.cxx:1837
bool IsWindowOrChild(const vcl::Window *pWindow, bool bSystemWindow=false) const
Definition: stacking.cxx:1124
bool IsVisible() const
Definition: window2.cxx:1128
void IncModalCount()
Definition: window.cxx:3602
virtual void ImplAdjustNWFSizes()
Definition: window3.cxx:28
void Invalidate(InvalidateFlags nFlags=InvalidateFlags::NONE)
Definition: paint.cxx:1143
weld::Window * GetFrameWeld() const
Definition: window2.cxx:884
void CallEventListeners(VclEventId nEvent, void *pData=nullptr)
Definition: event.cxx:219
virtual void SetText(const OUString &rStr)
Definition: window.cxx:3026
virtual OUString GetText() const
Definition: window.cxx:3055
vcl::Window * ImplGetWindow() const
if this is a proxy return the client, otherwise itself
Definition: window2.cxx:866
virtual bool set_property(const OUString &rKey, const OUString &rValue)
Definition: window2.cxx:1478
SAL_DLLPRIVATE vcl::Window * ImplGetFrameWindow() const
Definition: window2.cxx:937
SAL_DLLPRIVATE void ImplInit(vcl::Window *pParent, WinBits nStyle, SystemParentData *pSystemParentData)
Definition: window.cxx:941
void EnableChildTransparentMode(bool bEnable=true)
Definition: window2.cxx:1048
void EnableInput(bool bEnable=true, bool bChild=true)
Definition: window.cxx:2493
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:1438
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:2992
bool isVisibleInLayout(const vcl::Window *pWindow)
Definition: layout.cxx:2979
bool isContainerWindow(const vcl::Window &rWindow)
Definition: layout.hxx:817
#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:1238
void EndAllDialogs(vcl::Window const *pParent)
Definition: dialog.cxx:1215
void EnableDialogInput(vcl::Window *pWindow)
Definition: dialog.cxx:1230
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:160
ImplSVFrameData maFrameData
Definition: svdata.hxx:399
ImplSVWinData * mpWinData
Definition: svdata.hxx:400
ImplSVAppData maAppData
Definition: svdata.hxx:397
VclPtr< vcl::Window > mpIntroWindow
Definition: svdata.hxx:405
VclPtr< WorkWindow > mpAppWin
Definition: svdata.hxx:243
VclPtr< vcl::Window > mpCaptureWin
Definition: svdata.hxx:252
VclPtr< vcl::Window > mpTrackWin
Definition: svdata.hxx:257
std::vector< VclPtr< Dialog > > mpExecuteDialogs
Stack of dialogs that are Execute()'d - the last one is the top most one.
Definition: svdata.hxx:255
std::stack< std::vector< VclPtr< vcl::Window > > > m_aBusyStack
Definition: dialog.cxx:1648
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:90
ImplSVData * ImplGetSVData()
Definition: svdata.cxx:77
ShowFlags
Definition: vclenum.hxx:346
@ RET_HELP
Definition: vclenum.hxx:212
@ RET_OK
Definition: vclenum.hxx:206
@ RET_CLOSE
Definition: vclenum.hxx:211
@ RET_CANCEL
Definition: vclenum.hxx:205
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