LibreOffice Module vcl (master) 1
svapp.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19
20#include <config_features.h>
21
22#include <osl/file.hxx>
23#include <osl/thread.hxx>
24#include <osl/module.hxx>
25#include <rtl/ustrbuf.hxx>
26
27#include <sal/log.hxx>
28
29#include <tools/debug.hxx>
30#include <tools/time.hxx>
31#include <tools/stream.hxx>
32#include <tools/json_writer.hxx>
33
35#include <unotools/resmgr.hxx>
38
40#include <vcl/dialoghelper.hxx>
41#include <vcl/lok.hxx>
43#include <vcl/settings.hxx>
44#include <vcl/keycod.hxx>
45#include <vcl/event.hxx>
46#include <vcl/vclevent.hxx>
47#include <vcl/virdev.hxx>
48#include <vcl/wrkwin.hxx>
49#include <vcl/svapp.hxx>
50#include <vcl/cvtgrf.hxx>
52#include <vcl/timer.hxx>
53#include <vcl/scheduler.hxx>
55
56#include <salinst.hxx>
57#include <salframe.hxx>
58#include <salsys.hxx>
59#include <svdata.hxx>
61#include <window.h>
62#include <accmgr.hxx>
63#include <strings.hrc>
64#include <strings.hxx>
65#if OSL_DEBUG_LEVEL > 0
66#include <schedulerimpl.hxx>
67#endif
68
69#include <com/sun/star/uno/Reference.h>
70#include <com/sun/star/awt/XToolkit.hpp>
71#include <comphelper/lok.hxx>
73#include <osl/process.h>
74
75#include <cassert>
76#include <limits>
77#include <string_view>
78#include <utility>
79#include <thread>
80
81using namespace ::com::sun::star;
82using namespace ::com::sun::star::uno;
83
84namespace {
85void InitSettings(ImplSVData* pSVData);
86}
87
88// keycodes handled internally by VCL
90{
103#ifdef UNX
104 ,
116#endif
117};
118
119extern "C" {
120 typedef UnoWrapperBase* (*FN_TkCreateUnoWrapper)();
121}
122
124{
131
132 ImplPostEventData(VclEventId nEvent, vcl::Window* pWin, const KeyEvent& rKeyEvent)
133 : mpWin(pWin)
134 , mnEventId(nullptr)
135 , mnEvent(nEvent)
136 , maKeyEvent(rKeyEvent)
137 {}
138 ImplPostEventData(VclEventId nEvent, vcl::Window* pWin, const MouseEvent& rMouseEvent)
139 : mpWin(pWin)
140 , mnEventId(nullptr)
141 , maMouseEvent(rMouseEvent)
142 , mnEvent(nEvent)
143 {}
144 ImplPostEventData(VclEventId nEvent, vcl::Window* pWin, const GestureEventPan& rGestureEvent)
145 : mpWin(pWin)
146 , mnEventId(nullptr)
147 , mnEvent(nEvent)
148 , maGestureEvent(rGestureEvent)
149 {}
150};
151
153{
154 ImplSVData* pSVData = ImplGetSVData();
155 if ( !pSVData )
156 return nullptr;
157 return pSVData->mpApp;
158}
159
161{
162 // useful for themes at least, perhaps extensions too
163 OUString aVar("LIBO_VERSION"), aValue(LIBO_VERSION_DOTTED);
164 osl_setEnvironment(aVar.pData, aValue.pData);
165
166 ImplGetSVData()->mpApp = this;
167 m_pCallbackData = nullptr;
168 m_pCallback = nullptr;
169}
170
172{
174 ImplGetSVData()->mpApp = nullptr;
175}
176
178{
179 SAL_WARN("vcl", "Application is a base class and should be overridden.");
180 return EXIT_SUCCESS;
181}
182
184{
186
187 // call the close handler of the application window
188 if ( pAppWin )
189 return pAppWin->Close();
190 else
191 return true;
192}
193
195{
196}
197
199{
200}
201
203{
204}
205
207{
208}
209
211{
212 return static_cast<sal_uInt16>(osl_getCommandArgCount());
213}
214
215OUString Application::GetCommandLineParam( sal_uInt16 nParam )
216{
217 OUString aParam;
218 osl_getCommandArg( nParam, &aParam.pData );
219 return aParam;
220}
221
223{
224 ImplSVData* pSVData = ImplGetSVData();
225 SAL_WARN_IF( !pSVData->maAppData.mxAppFileName, "vcl", "AppFileName should be set to something after SVMain!" );
226 if ( pSVData->maAppData.mxAppFileName )
227 return *pSVData->maAppData.mxAppFileName;
228
229 /*
230 * provide a fallback for people without initialized vcl here (like setup
231 * in responsefile mode)
232 */
233 OUString aAppFileName;
234 OUString aExeFileName;
235 osl_getExecutableFile(&aExeFileName.pData);
236
237 // convert path to native file format
238 osl::FileBase::getSystemPathFromFileURL(aExeFileName, aAppFileName);
239
240 return aAppFileName;
241}
242
244{
245 switch ( nCategory )
246 {
247 // System has precedence (so do nothing)
250 break;
251 default:
252 Abort("Unknown Error");
253 break;
254 }
255}
256
257void Application::Abort( const OUString& rErrorText )
258{
259 //HACK: Dump core iff --norestore command line argument is given (assuming
260 // this process is run by developers who are interested in cores, vs. end
261 // users who are not):
262#if OSL_DEBUG_LEVEL > 0
263 bool dumpCore = true;
264#else
265 bool dumpCore = false;
266 sal_uInt16 n = GetCommandLineParamCount();
267 for (sal_uInt16 i = 0; i != n; ++i) {
268 if (GetCommandLineParam(i) == "--norestore") {
269 dumpCore = true;
270 break;
271 }
272 }
273#endif
274
275 SalAbort( rErrorText, dumpCore );
276}
277
279{
281}
282
284{
285 if( i >= GetReservedKeyCodeCount() )
286 return nullptr;
287 else
288 return &ReservedKeys[i];
289}
290
291IMPL_STATIC_LINK_NOARG( ImplSVAppData, ImplEndAllPopupsMsg, void*, void )
292{
293 ImplSVData* pSVData = ImplGetSVData();
294 while (pSVData->mpWinData->mpFirstFloat)
296}
297
298IMPL_STATIC_LINK_NOARG( ImplSVAppData, ImplEndAllDialogsMsg, void*, void )
299{
301 while (pAppWindow)
302 {
303 vcl::EndAllDialogs(pAppWindow);
304 pAppWindow = Application::GetNextTopLevelWindow(pAppWindow);
305 }
306}
307
309{
310 Application::PostUserEvent( LINK( nullptr, ImplSVAppData, ImplEndAllDialogsMsg ) );
311}
312
314{
315 Application::PostUserEvent( LINK( nullptr, ImplSVAppData, ImplEndAllPopupsMsg ) );
316}
317
319 const OUString& /*rAction*/,
320 const std::vector<vcl::LOKPayloadItem>& /*rPayload = std::vector<LOKPayloadItem>()*/) const
321{
322}
323
324void Application::libreOfficeKitViewCallback(int nType, const char* pPayload) const
325{
327 return;
328
329 if (m_pCallback)
330 {
332 }
333}
334
335
336namespace
337{
338 VclPtr<vcl::Window> GetEventWindow()
339 {
341 while (xWin)
342 {
343 if (xWin->IsVisible())
344 break;
345 xWin.reset(Application::GetNextTopLevelWindow(xWin));
346 }
347 return xWin;
348 }
349
350 bool InjectKeyEvent(SvStream& rStream)
351 {
352 VclPtr<vcl::Window> xWin(GetEventWindow());
353 if (!xWin)
354 return false;
355
356 // skip the first available cycle and insert on the next one when we
357 // are trying the initial event, flagged by a triggered but undeleted
358 // mpEventTestingIdle
359 ImplSVData* pSVData = ImplGetSVData();
360 if (pSVData->maAppData.mpEventTestingIdle)
361 {
362 delete pSVData->maAppData.mpEventTestingIdle;
363 pSVData->maAppData.mpEventTestingIdle = nullptr;
364 return false;
365 }
366
367 sal_uInt16 nCode, nCharCode;
368 rStream.ReadUInt16(nCode);
369 rStream.ReadUInt16(nCharCode);
370 if (!rStream.good())
371 return false;
372
373 KeyEvent aVCLKeyEvt(nCharCode, nCode);
375 Application::PostKeyEvent(VclEventId::WindowKeyUp, xWin.get(), &aVCLKeyEvt);
376 return true;
377 }
378
379 void CloseDialogsAndQuit()
380 {
383 Application::PostUserEvent( LINK( nullptr, ImplSVAppData, ImplPrepareExitMsg ) );
384 }
385}
386
387IMPL_LINK_NOARG(ImplSVAppData, VclEventTestingHdl, Timer *, void)
388{
390 {
391 mpEventTestingIdle->Start();
392 }
393 else
394 {
395 Application::PostUserEvent( LINK( nullptr, ImplSVAppData, ImplVclEventTestingHdl ) );
396 }
397}
398
399IMPL_STATIC_LINK_NOARG( ImplSVAppData, ImplVclEventTestingHdl, void*, void )
400{
401 ImplSVData* pSVData = ImplGetSVData();
402 SAL_INFO("vcl.eventtesting", "EventTestLimit is " << pSVData->maAppData.mnEventTestLimit);
403 if (pSVData->maAppData.mnEventTestLimit == 0)
404 {
405 delete pSVData->maAppData.mpEventTestInput;
406 SAL_INFO("vcl.eventtesting", "Event Limit reached, exiting" << pSVData->maAppData.mnEventTestLimit);
407 CloseDialogsAndQuit();
408 }
409 else
410 {
411 if (InjectKeyEvent(*pSVData->maAppData.mpEventTestInput))
412 --pSVData->maAppData.mnEventTestLimit;
413 if (!pSVData->maAppData.mpEventTestInput->good())
414 {
415 SAL_INFO("vcl.eventtesting", "Event Input exhausted, exit next cycle");
416 pSVData->maAppData.mnEventTestLimit = 0;
417 }
418 Application::PostUserEvent( LINK( nullptr, ImplSVAppData, ImplVclEventTestingHdl ) );
419 }
420}
421
422IMPL_STATIC_LINK_NOARG( ImplSVAppData, ImplPrepareExitMsg, void*, void )
423{
424 //now close top level frames
425 (void)GetpApp()->QueryExit();
426}
427
429{
430 ImplSVData* pSVData = ImplGetSVData();
431 pSVData->maAppData.mbInAppExecute = true;
432 pSVData->maAppData.mbAppQuit = false;
433
435 {
436 pSVData->maAppData.mnEventTestLimit = 50;
437 pSVData->maAppData.mpEventTestingIdle = new Idle("eventtesting");
438 pSVData->maAppData.mpEventTestingIdle->SetInvokeHandler(LINK(&(pSVData->maAppData), ImplSVAppData, VclEventTestingHdl));
440 pSVData->maAppData.mpEventTestInput = new SvFileStream("eventtesting", StreamMode::READ);
442 }
443
444 int nExitCode = 0;
445 if (!pSVData->mpDefInst->DoExecute(nExitCode))
446 {
448 {
449 SAL_WARN("vcl.schedule", "Can't omit DoExecute when running on system event loop!");
450 std::abort();
451 }
452 while (!pSVData->maAppData.mbAppQuit)
454 }
455
456 pSVData->maAppData.mbInAppExecute = false;
457
458 GetpApp()->Shutdown();
459}
460
461static bool ImplYield(bool i_bWait, bool i_bAllEvents)
462{
463 ImplSVData* pSVData = ImplGetSVData();
464
465 SAL_INFO("vcl.schedule", "Enter ImplYield: " << (i_bWait ? "wait" : "no wait") <<
466 ": " << (i_bAllEvents ? "all events" : "one event"));
467
468 // there's a data race here on WNT only because ImplYield may be
469 // called without SolarMutex; but the only remaining use of mnDispatchLevel
470 // is in OSX specific code
471 pSVData->maAppData.mnDispatchLevel++;
472
473 // do not wait for events if application was already quit; in that
474 // case only dispatch events already available
475 bool bProcessedEvent = pSVData->mpDefInst->DoYield(
476 i_bWait && !pSVData->maAppData.mbAppQuit, i_bAllEvents );
477
478 pSVData->maAppData.mnDispatchLevel--;
479
480 DBG_TESTSOLARMUTEX(); // must be locked on return from Yield
481
482 SAL_INFO("vcl.schedule", "Leave ImplYield with return " << bProcessedEvent );
483 return bProcessedEvent;
484}
485
486bool Application::Reschedule( bool i_bAllEvents )
487{
488 static const bool bAbort = Application::IsOnSystemEventLoop();
489 if (bAbort)
490 {
491 SAL_WARN("vcl.schedule", "Application::Reschedule(" << i_bAllEvents << ")");
492 std::abort();
493 }
494 return ImplYield(false, i_bAllEvents);
495}
496
498{
500}
501
503{
504 int nSanity = 1;
505 while (ImplYield(false, true))
506 {
507 if (0 == ++nSanity % 1000)
508 {
509 SAL_WARN("vcl.schedule", "ProcessEventsToIdle: " << nSanity);
510 }
511 }
512#if OSL_DEBUG_LEVEL > 0
513 // If we yield from a non-main thread we just can guarantee that all idle
514 // events were processed at some point, but our check can't prevent further
515 // processing in the main thread, which may add new events, so skip it.
516 const ImplSVData* pSVData = ImplGetSVData();
517 if ( !pSVData->mpDefInst->IsMainThread() )
518 return;
519 for (int nTaskPriority = 0; nTaskPriority < PRIO_COUNT; ++nTaskPriority)
520 {
521 const ImplSchedulerData* pSchedulerData = pSVData->maSchedCtx.mpFirstSchedulerData[nTaskPriority];
522 while (pSchedulerData)
523 {
524 assert(!pSchedulerData->mbInScheduler);
525 if (pSchedulerData->mpTask)
526 {
527 Idle *pIdle = dynamic_cast<Idle*>(pSchedulerData->mpTask);
528 if (pIdle && pIdle->IsActive())
529 {
530 SAL_WARN("vcl.schedule",
531 "Unprocessed Idle: "
532 << pIdle << " "
533 << (pIdle->GetDebugName() ? pIdle->GetDebugName() : "(nullptr)"));
534 }
535 }
536 pSchedulerData = pSchedulerData->mpNext;
537 }
538 }
539#endif
540}
541
542extern "C" {
544SAL_DLLPUBLIC_EXPORT void unit_lok_process_events_to_idle()
545{
546 const SolarMutexGuard aGuard;
548}
549}
550
552{
553 static const bool bAbort = Application::IsOnSystemEventLoop();
554 if (bAbort)
555 {
556 SAL_WARN("vcl.schedule", "Application::Yield()");
557 std::abort();
558 }
559 ImplYield(true, false);
560}
561
562IMPL_STATIC_LINK_NOARG( ImplSVAppData, ImplQuitMsg, void*, void )
563{
564 assert(ImplGetSVData()->maAppData.mbAppQuit);
566}
567
569{
571 Application::PostUserEvent( LINK( nullptr, ImplSVAppData, ImplQuitMsg ) );
572}
573
575{
576 ImplSVData* pSVData = ImplGetSVData();
577 return *(pSVData->mpDefInst->GetYieldMutex());
578}
579
581{
582 return ImplGetSVData()->mnMainThreadId == osl::Thread::getCurrentIdentifier();
583}
584
586{
587 ImplSVData* pSVData = ImplGetSVData();
588 return pSVData->mpDefInst->ReleaseYieldMutexAll();
589}
590
591void Application::AcquireSolarMutex( sal_uInt32 nCount )
592{
593 ImplSVData* pSVData = ImplGetSVData();
595}
596
598{
599 ImplSVData* pSVData = ImplGetSVData();
600 return pSVData && pSVData->maAppData.mbInAppMain;
601}
602
604{
606}
607
609{
611}
612
614{
615 return (ImplGetSVData()->maAppData.mnModalMode != 0);
616}
617
619{
621}
622
624{
626}
627
629{
630 return (tools::Time::GetSystemTicks()-ImplGetSVData()->maAppData.mnLastInputTime);
631}
632
634{
635 ImplSVData* pSVData = ImplGetSVData();
636
637 // If mouse was captured, or if in tracking- or in select-mode of a floatingwindow (e.g. menus
638 // or pulldown toolboxes) another window should be created
639 // D&D active !!!
640 return pSVData->mpWinData->mpCaptureWin || pSVData->mpWinData->mpTrackWin
641 || pSVData->mpWinData->mpFirstFloat || nImplSysDialog;
642}
643
645{
646}
647
649{
651 if( ! pWindow )
652 pWindow = ImplGetDefaultWindow();
653 if( pWindow )
654 {
655 ImplSVData* pSVData = ImplGetSVData();
656 if ( !pSVData->maAppData.mbSettingsInit )
657 {
658 // side effect: ImplUpdateGlobalSettings does an ImplGetFrame()->UpdateSettings
659 pWindow->ImplUpdateGlobalSettings( *pSVData->maAppData.mxSettings );
660 pSVData->maAppData.mbSettingsInit = true;
661 }
662 // side effect: ImplUpdateGlobalSettings does an ImplGetFrame()->UpdateSettings
663 pWindow->ImplUpdateGlobalSettings( rSettings, false );
664 }
665}
666
667void Application::SetSettings( const AllSettings& rSettings )
668{
669 const SolarMutexGuard aGuard;
670
671 ImplSVData* pSVData = ImplGetSVData();
672 if ( !pSVData->maAppData.mxSettings )
673 {
674 InitSettings(pSVData);
675 *pSVData->maAppData.mxSettings = rSettings;
676 }
677 else
678 {
679 AllSettings aOldSettings = *pSVData->maAppData.mxSettings;
680 if (aOldSettings.GetUILanguageTag().getLanguageType() != rSettings.GetUILanguageTag().getLanguageType() &&
681 pSVData->mbResLocaleSet)
682 {
683 pSVData->mbResLocaleSet = false;
684 }
685 *pSVData->maAppData.mxSettings = rSettings;
686 AllSettingsFlags nChangeFlags = aOldSettings.GetChangeFlags( *pSVData->maAppData.mxSettings );
687 if ( bool(nChangeFlags) )
688 {
689 DataChangedEvent aDCEvt( DataChangedEventType::SETTINGS, &aOldSettings, nChangeFlags );
690
691 // notify data change handler
693
694 // Update all windows
695 vcl::Window* pFirstFrame = pSVData->maFrameData.mpFirstFrame;
696 // Reset data that needs to be re-calculated
697 tools::Long nOldDPIX = 0;
698 tools::Long nOldDPIY = 0;
699 if ( pFirstFrame )
700 {
701 nOldDPIX = pFirstFrame->GetOutDev()->GetDPIX();
702 nOldDPIY = pFirstFrame->GetOutDev()->GetDPIY();
704 }
705 vcl::Window* pFrame = pFirstFrame;
706 while ( pFrame )
707 {
708 // call UpdateSettings from ClientWindow in order to prevent updating data twice
709 vcl::Window* pClientWin = pFrame;
710 while ( pClientWin->ImplGetClientWindow() )
711 pClientWin = pClientWin->ImplGetClientWindow();
712 pClientWin->UpdateSettings( rSettings, true );
713
714 vcl::Window* pTempWin = pFrame->mpWindowImpl->mpFrameData->mpFirstOverlap;
715 while ( pTempWin )
716 {
717 // call UpdateSettings from ClientWindow in order to prevent updating data twice
718 pClientWin = pTempWin;
719 while ( pClientWin->ImplGetClientWindow() )
720 pClientWin = pClientWin->ImplGetClientWindow();
721 pClientWin->UpdateSettings( rSettings, true );
722 pTempWin = pTempWin->mpWindowImpl->mpNextOverlap;
723 }
724
725 pFrame = pFrame->mpWindowImpl->mpFrameData->mpNextFrame;
726 }
727
728 // if DPI resolution for screen output was changed set the new resolution for all
729 // screen compatible VirDev's
730 pFirstFrame = pSVData->maFrameData.mpFirstFrame;
731 if ( pFirstFrame )
732 {
733 if ( (pFirstFrame->GetOutDev()->GetDPIX() != nOldDPIX) ||
734 (pFirstFrame->GetOutDev()->GetDPIY() != nOldDPIY) )
735 {
736 VirtualDevice* pVirDev = pSVData->maGDIData.mpFirstVirDev;
737 while ( pVirDev )
738 {
739 if ( pVirDev->mbScreenComp &&
740 (pVirDev->GetDPIX() == nOldDPIX) &&
741 (pVirDev->GetDPIY() == nOldDPIY) )
742 {
743 pVirDev->SetDPIX( pFirstFrame->GetOutDev()->GetDPIX() );
744 pVirDev->SetDPIY( pFirstFrame->GetOutDev()->GetDPIY() );
745 if ( pVirDev->IsMapModeEnabled() )
746 {
747 MapMode aMapMode = pVirDev->GetMapMode();
748 pVirDev->SetMapMode();
749 pVirDev->SetMapMode( aMapMode );
750 }
751 }
752
753 pVirDev = pVirDev->mpNext;
754 }
755 }
756 }
757 }
758 }
759}
760
762{
763 ImplSVData* pSVData = ImplGetSVData();
764 if ( !pSVData->maAppData.mxSettings )
765 {
766 InitSettings(pSVData);
767 }
768
769 return *(pSVData->maAppData.mxSettings);
770}
771
772namespace {
773
774void InitSettings(ImplSVData* pSVData)
775{
776 assert(!pSVData->maAppData.mxSettings && "initialization should not happen twice!");
777
778 pSVData->maAppData.mxSettings.emplace();
780 {
782 pSVData->maAppData.mxSettings->GetSysLocale().GetOptions().AddListener( pSVData->maAppData.mpCfgListener );
783 }
784}
785
786}
787
789{
790 ImplSVData* pSVData = ImplGetSVData();
791 vcl::Window* pFrame = pSVData->maFrameData.mpFirstFrame;
792 while ( pFrame )
793 {
794 pFrame->NotifyAllChildren( rDCEvt );
795
796 vcl::Window* pSysWin = pFrame->mpWindowImpl->mpFrameData->mpFirstOverlap;
797 while ( pSysWin )
798 {
799 pSysWin->NotifyAllChildren( rDCEvt );
800 pSysWin = pSysWin->mpWindowImpl->mpNextOverlap;
801 }
802
803 pFrame = pFrame->mpWindowImpl->mpFrameData->mpNextFrame;
804 }
805}
806
808{
809 ImplSVData* pSVData = ImplGetSVData();
811
813}
814
816{
817 ImplSVData* pSVData = ImplGetSVData();
818 pSVData->maAppData.maEventListeners.Call( rEvent );
819}
820
822{
823 ImplSVData* pSVData = ImplGetSVData();
824 pSVData->maAppData.maEventListeners.addListener( rEventListener );
825}
826
828{
829 ImplSVData* pSVData = ImplGetSVData();
830 pSVData->maAppData.maEventListeners.removeListener( rEventListener );
831}
832
834{
835 ImplSVData* pSVData = ImplGetSVData();
836 pSVData->maAppData.maKeyListeners.push_back( rKeyListener );
837}
838
840{
841 ImplSVData* pSVData = ImplGetSVData();
842 auto & rVec = pSVData->maAppData.maKeyListeners;
843 rVec.erase( std::remove(rVec.begin(), rVec.end(), rKeyListener ), rVec.end() );
844}
845
846bool Application::HandleKey( VclEventId nEvent, vcl::Window *pWin, KeyEvent* pKeyEvent )
847{
848 // let listeners process the key event
849 VclWindowEvent aEvent( pWin, nEvent, static_cast<void *>(pKeyEvent) );
850
851 ImplSVData* pSVData = ImplGetSVData();
852
853 if ( pSVData->maAppData.maKeyListeners.empty() )
854 return false;
855
856 bool bProcessed = false;
857 // Copy the list, because this can be destroyed when calling a Link...
858 std::vector<Link<VclWindowEvent&,bool>> aCopy( pSVData->maAppData.maKeyListeners );
859 for ( const Link<VclWindowEvent&,bool>& rLink : aCopy )
860 {
861 if( rLink.Call( aEvent ) )
862 {
863 bProcessed = true;
864 break;
865 }
866 }
867 return bProcessed;
868}
869
871{
872 const SolarMutexGuard aGuard;
873 ImplSVEvent * nEventId = nullptr;
874
875 if( pWin && pKeyEvent )
876 {
877 std::unique_ptr<ImplPostEventData> pPostEventData(new ImplPostEventData( nEvent, pWin, *pKeyEvent ));
878
879 nEventId = PostUserEvent(
880 LINK( nullptr, Application, PostEventHandler ),
881 pPostEventData.get() );
882
883 if( nEventId )
884 {
885 pPostEventData->mnEventId = nEventId;
886 ImplGetSVData()->maAppData.maPostedEventList.emplace_back( pWin, pPostEventData.release() );
887 }
888 }
889
890 return nEventId;
891}
892
894 GestureEventPan const * pGestureEvent)
895{
896 const SolarMutexGuard aGuard;
897 ImplSVEvent * nEventId = nullptr;
898
899 if (pWin && pGestureEvent)
900 {
901 Point aTransformedPosition(pGestureEvent->mnX, pGestureEvent->mnY);
902
903 aTransformedPosition.AdjustX(pWin->GetOutOffXPixel());
904 aTransformedPosition.AdjustY(pWin->GetOutOffYPixel());
905
906 const GestureEventPan aGestureEvent(
907 sal_Int32(aTransformedPosition.X()),
908 sal_Int32(aTransformedPosition.Y()),
909 pGestureEvent->meEventType,
910 pGestureEvent->mnOffset,
911 pGestureEvent->meOrientation
912 );
913
914 std::unique_ptr<ImplPostEventData> pPostEventData(new ImplPostEventData(nEvent, pWin, aGestureEvent));
915
916 nEventId = PostUserEvent(
917 LINK( nullptr, Application, PostEventHandler ),
918 pPostEventData.get());
919
920 if (nEventId)
921 {
922 pPostEventData->mnEventId = nEventId;
923 ImplGetSVData()->maAppData.maPostedEventList.emplace_back(pWin, pPostEventData.release());
924 }
925 }
926
927 return nEventId;
928}
929
931{
932 bool bSuccess = false;
933 SalMouseEvent aMouseEvent;
934
935 if (!pWindow)
936 return false;
937
938 if (!pEvent)
939 return false;
940
941 aMouseEvent.mnTime = tools::Time::GetSystemTicks();
942 aMouseEvent.mnX = pEvent->GetPosPixel().X();
943 aMouseEvent.mnY = pEvent->GetPosPixel().Y();
944 aMouseEvent.mnCode = pEvent->GetButtons() | pEvent->GetModifier();
945
946 switch (nEvent)
947 {
949 aMouseEvent.mnButton = 0;
950 bSuccess = ImplLOKHandleMouseEvent(pWindow, NotifyEventType::MOUSEMOVE, false,
951 aMouseEvent.mnX, aMouseEvent.mnY,
952 aMouseEvent.mnTime, aMouseEvent.mnCode,
953 ImplGetMouseMoveMode(&aMouseEvent),
954 pEvent->GetClicks());
955 break;
956
958 aMouseEvent.mnButton = pEvent->GetButtons();
960 aMouseEvent.mnX, aMouseEvent.mnY,
961 aMouseEvent.mnTime,
962#ifdef MACOSX
963 aMouseEvent.mnButton |
964 (aMouseEvent.mnCode & (KEY_SHIFT | KEY_MOD1 | KEY_MOD2 | KEY_MOD3)),
965#else
966 aMouseEvent.mnButton |
967 (aMouseEvent.mnCode & (KEY_SHIFT | KEY_MOD1 | KEY_MOD2)),
968#endif
969 ImplGetMouseButtonMode(&aMouseEvent),
970 pEvent->GetClicks());
971 break;
972
974 aMouseEvent.mnButton = pEvent->GetButtons();
976 aMouseEvent.mnX, aMouseEvent.mnY,
977 aMouseEvent.mnTime,
978#ifdef MACOSX
979 aMouseEvent.mnButton |
980 (aMouseEvent.mnCode & (KEY_SHIFT | KEY_MOD1 | KEY_MOD2 | KEY_MOD3)),
981#else
982 aMouseEvent.mnButton |
983 (aMouseEvent.mnCode & (KEY_SHIFT | KEY_MOD1 | KEY_MOD2)),
984#endif
985 ImplGetMouseButtonMode(&aMouseEvent),
986 pEvent->GetClicks());
987 break;
988
989 default:
990 SAL_WARN( "vcl.layout", "Application::HandleMouseEvent unknown event (" << static_cast<int>(nEvent) << ")" );
991 break;
992 }
993
994 return bSuccess;
995}
996
997
999{
1000 const SolarMutexGuard aGuard;
1001 ImplSVEvent * nEventId = nullptr;
1002
1003 if( pWin && pMouseEvent )
1004 {
1005 Point aTransformedPos( pMouseEvent->GetPosPixel() );
1006
1007 // LOK uses (0, 0) as the origin of all windows; don't offset.
1009 {
1010 aTransformedPos.AdjustX(pWin->GetOutOffXPixel());
1011 aTransformedPos.AdjustY(pWin->GetOutOffYPixel());
1012 }
1013
1014 const MouseEvent aTransformedEvent( aTransformedPos, pMouseEvent->GetClicks(), pMouseEvent->GetMode(),
1015 pMouseEvent->GetButtons(), pMouseEvent->GetModifier() );
1016
1017 std::unique_ptr<ImplPostEventData> pPostEventData(new ImplPostEventData( nEvent, pWin, aTransformedEvent ));
1018
1019 nEventId = PostUserEvent(
1020 LINK( nullptr, Application, PostEventHandler ),
1021 pPostEventData.get() );
1022
1023 if( nEventId )
1024 {
1025 pPostEventData->mnEventId = nEventId;
1026 ImplGetSVData()->maAppData.maPostedEventList.emplace_back( pWin, pPostEventData.release() );
1027 }
1028 }
1029
1030 return nEventId;
1031}
1032
1033
1034IMPL_STATIC_LINK( Application, PostEventHandler, void*, pCallData, void )
1035{
1036 const SolarMutexGuard aGuard;
1037 ImplPostEventData* pData = static_cast< ImplPostEventData * >( pCallData );
1038 const void* pEventData;
1039 SalEvent nEvent;
1040 ImplSVEvent * const nEventId = pData->mnEventId;
1041
1042 switch( pData->mnEvent )
1043 {
1046 pEventData = &pData->maMouseEvent;
1047 break;
1048
1051 pEventData = &pData->maMouseEvent;
1052 break;
1053
1056 pEventData = &pData->maMouseEvent;
1057 break;
1058
1061 pEventData = &pData->maKeyEvent;
1062 break;
1063
1065 nEvent = SalEvent::ExternalKeyUp;
1066 pEventData = &pData->maKeyEvent;
1067 break;
1068
1071 pEventData = &pData->maGestureEvent;
1072 break;
1073
1074 default:
1075 nEvent = SalEvent::NONE;
1076 pEventData = nullptr;
1077 break;
1078 }
1079
1080 if( pData->mpWin && pData->mpWin->mpWindowImpl->mpFrameWindow && pEventData )
1081 ImplWindowFrameProc( pData->mpWin->mpWindowImpl->mpFrameWindow.get(), nEvent, pEventData );
1082
1083 // remove this event from list of posted events, watch for destruction of internal data
1084 auto svdata = ImplGetSVData();
1085 ::std::vector< ImplPostEventPair >::iterator aIter( svdata->maAppData.maPostedEventList.begin() );
1086
1087 while( aIter != svdata->maAppData.maPostedEventList.end() )
1088 {
1089 if( nEventId == (*aIter).second->mnEventId )
1090 {
1091 delete (*aIter).second;
1092 aIter = svdata->maAppData.maPostedEventList.erase( aIter );
1093 }
1094 else
1095 ++aIter;
1096 }
1097}
1098
1100{
1101 const SolarMutexGuard aGuard;
1102
1103 // remove all events for specific window, watch for destruction of internal data
1104 auto svdata = ImplGetSVData();
1105 ::std::vector< ImplPostEventPair >::iterator aIter( svdata->maAppData.maPostedEventList.begin() );
1106
1107 while( aIter != svdata->maAppData.maPostedEventList.end() )
1108 {
1109 if( pWin == (*aIter).first )
1110 {
1111 if( (*aIter).second->mnEventId )
1112 RemoveUserEvent( (*aIter).second->mnEventId );
1113
1114 delete (*aIter).second;
1115 aIter = svdata->maAppData.maPostedEventList.erase( aIter );
1116 }
1117 else
1118 ++aIter;
1119 }
1120}
1121
1123 bool bReferenceLink )
1124{
1125 vcl::Window* pDefWindow = ImplGetDefaultWindow();
1126 if ( pDefWindow == nullptr )
1127 return nullptr;
1128
1129 std::unique_ptr<ImplSVEvent> pSVEvent(new ImplSVEvent);
1130 pSVEvent->mpData = pCaller;
1131 pSVEvent->maLink = rLink;
1132 pSVEvent->mpWindow = nullptr;
1133 pSVEvent->mbCall = true;
1134 if (bReferenceLink)
1135 {
1136 SolarMutexGuard aGuard;
1137 pSVEvent->mpInstanceRef = static_cast<vcl::Window *>(rLink.GetInstance());
1138 }
1139
1140 auto pTmpEvent = pSVEvent.get();
1141 if (!pDefWindow->ImplGetFrame()->PostEvent( std::move(pSVEvent) ))
1142 return nullptr;
1143 return pTmpEvent;
1144}
1145
1147{
1148 if(nUserEvent)
1149 {
1150 SAL_WARN_IF( nUserEvent->mpWindow, "vcl",
1151 "Application::RemoveUserEvent(): Event is send to a window" );
1152 SAL_WARN_IF( !nUserEvent->mbCall, "vcl",
1153 "Application::RemoveUserEvent(): Event is already removed" );
1154
1155 nUserEvent->mpWindow.clear();
1156 nUserEvent->mpInstanceRef.clear();
1157 nUserEvent->mbCall = false;
1158 }
1159}
1160
1162{
1164}
1165
1167{
1168 return ImplGetDefaultWindow()->GetOutDev();
1169}
1170
1172{
1173 ImplSVData* pSVData = ImplGetSVData();
1174 return pSVData->maFrameData.mpFirstFrame;
1175}
1176
1178{
1179 return pWindow->mpWindowImpl->mpFrameData->mpNextFrame;
1180}
1181
1183{
1184 tools::Long nRet = 0;
1185 ImplSVData* pSVData = ImplGetSVData();
1186 vcl::Window *pWin = pSVData ? pSVData->maFrameData.mpFirstFrame.get() : nullptr;
1187 while( pWin )
1188 {
1189 if( pWin->ImplGetWindow()->IsTopWindow() )
1190 nRet++;
1191 pWin = pWin->mpWindowImpl->mpFrameData->mpNextFrame;
1192 }
1193 return nRet;
1194}
1195
1197{
1198 tools::Long nIdx = 0;
1199 ImplSVData* pSVData = ImplGetSVData();
1200 vcl::Window *pWin = pSVData ? pSVData->maFrameData.mpFirstFrame.get() : nullptr;
1201 while( pWin )
1202 {
1203 if( pWin->ImplGetWindow()->IsTopWindow() )
1204 {
1205 if( nIdx == nIndex )
1206 return pWin->ImplGetWindow();
1207 else
1208 nIdx++;
1209 }
1210 pWin = pWin->mpWindowImpl->mpFrameData->mpNextFrame;
1211 }
1212 return nullptr;
1213}
1214
1216{
1218 while( pWin )
1219 {
1220 if( pWin->IsTopWindow() )
1221 return pWin;
1222 pWin = pWin->mpWindowImpl->mpParent;
1223 }
1224 return nullptr;
1225}
1226
1227void Application::SetAppName( const OUString& rUniqueName )
1228{
1229 ImplSVData* pSVData = ImplGetSVData();
1230 pSVData->maAppData.mxAppName = rUniqueName;
1231}
1232
1234{
1235 ImplSVData* pSVData = ImplGetSVData();
1236 if ( pSVData->maAppData.mxAppName )
1237 return *(pSVData->maAppData.mxAppName);
1238 else
1239 return OUString();
1240}
1241
1242enum {hwAll=0, hwEnv=1, hwUI=2};
1243
1244static OUString Localize(TranslateId aId, const bool bLocalize)
1245{
1246 if (bLocalize)
1247 return VclResId(aId);
1248 else
1249 return Translate::get(aId, Translate::Create("vcl", LanguageTag("en-US")));
1250}
1251
1253{
1254 ImplSVData* pSVData = ImplGetSVData();
1255 OUString aVersion;
1256 if (pSVData && pSVData->mpDefInst)
1257 aVersion = pSVData->mpDefInst->getOSVersion();
1258 else
1259 aVersion = "-";
1260 return aVersion;
1261}
1262
1263OUString Application::GetHWOSConfInfo(const int bSelection, const bool bLocalize)
1264{
1265 OUStringBuffer aDetails;
1266
1267 const auto appendDetails = [&aDetails](std::u16string_view sep, auto&& val) {
1268 if (!aDetails.isEmpty() && !sep.empty())
1269 aDetails.append(sep);
1270 aDetails.append(std::move(val));
1271 };
1272
1273 if (bSelection != hwUI) {
1274 appendDetails(u"; ", Localize(SV_APP_CPUTHREADS, bLocalize)
1275 + OUString::number(std::thread::hardware_concurrency()));
1276
1277 OUString aVersion = GetOSVersion();
1278
1279 appendDetails(u"; ", Localize(SV_APP_OSVERSION, bLocalize) + aVersion);
1280 }
1281
1282 if (bSelection != hwEnv) {
1283 appendDetails(u"; ", Localize(SV_APP_UIRENDER, bLocalize));
1284#if HAVE_FEATURE_SKIA
1286 {
1287 switch(SkiaHelper::renderMethodToUse())
1288 {
1289 case SkiaHelper::RenderVulkan:
1290 appendDetails(u"", Localize(SV_APP_SKIA_VULKAN, bLocalize));
1291 break;
1292 case SkiaHelper::RenderMetal:
1293 appendDetails(u"", Localize(SV_APP_SKIA_METAL, bLocalize));
1294 break;
1295 case SkiaHelper::RenderRaster:
1296 appendDetails(u"", Localize(SV_APP_SKIA_RASTER, bLocalize));
1297 break;
1298 }
1299 }
1300 else
1301#endif
1302 appendDetails(u"", Localize(SV_APP_DEFAULT, bLocalize));
1303
1304#if (defined LINUX || defined _WIN32 || defined MACOSX || defined __FreeBSD__ || defined EMSCRIPTEN)
1305 appendDetails(u"; ", SV_APP_VCLBACKEND + GetToolkitName());
1306#endif
1307 }
1308
1309 return aDetails.makeStringAndClear();
1310}
1311
1312void Application::SetDisplayName( const OUString& rName )
1313{
1314 ImplSVData* pSVData = ImplGetSVData();
1315 pSVData->maAppData.mxDisplayName = rName;
1316}
1317
1319{
1320 ImplSVData* pSVData = ImplGetSVData();
1321 if ( pSVData->maAppData.mxDisplayName )
1322 return *(pSVData->maAppData.mxDisplayName);
1323 else if (pSVData->maFrameData.mpAppWin)
1324 return pSVData->maFrameData.mpAppWin->GetText();
1325 else
1326 return OUString();
1327}
1328
1330{
1331 SalSystem* pSys = ImplGetSalSystem();
1332 return pSys ? pSys->GetDisplayScreenCount() : 0;
1333}
1334
1336{
1337 SalSystem* pSys = ImplGetSalSystem();
1338 return pSys == nullptr || pSys->IsUnifiedDisplay();
1339}
1340
1342{
1343 SalSystem* pSys = ImplGetSalSystem();
1344 return pSys ? pSys->GetDisplayBuiltInScreen() : 0;
1345}
1346
1348{
1349 // This is really unpleasant, in theory we could have multiple
1350 // external displays etc.
1351 int nExternal(0);
1352 switch (GetDisplayBuiltInScreen())
1353 {
1354 case 0:
1355 nExternal = 1;
1356 break;
1357 case 1:
1358 nExternal = 0;
1359 break;
1360 default:
1361 // When the built-in display is neither 0 nor 1
1362 // then place the full-screen presentation on the
1363 // first available screen.
1364 nExternal = 0;
1365 break;
1366 }
1367 return nExternal;
1368}
1369
1371{
1372 SalSystem* pSys = ImplGetSalSystem();
1373 if (!pSys)
1374 {
1375 SAL_WARN("vcl", "Requesting screen size/pos for screen #" << nScreen << " failed");
1376 assert(false);
1377 return tools::Rectangle();
1378 }
1379 tools::Rectangle aRect = pSys->GetDisplayScreenPosSizePixel(nScreen);
1380 if (aRect.GetHeight() == 0)
1381 SAL_WARN("vcl", "Requesting screen size/pos for screen #" << nScreen << " returned 0 height.");
1382 return aRect;
1383}
1384
1385namespace {
1386tools::Long calcDistSquare( const Point& i_rPoint, const tools::Rectangle& i_rRect )
1387{
1388 const Point aRectCenter( (i_rRect.Left() + i_rRect.Right())/2,
1389 (i_rRect.Top() + i_rRect.Bottom())/ 2 );
1390 const tools::Long nDX = aRectCenter.X() - i_rPoint.X();
1391 const tools::Long nDY = aRectCenter.Y() - i_rPoint.Y();
1392 return nDX*nDX + nDY*nDY;
1393}
1394}
1395
1396unsigned int Application::GetBestScreen( const tools::Rectangle& i_rRect )
1397{
1398 if( !IsUnifiedDisplay() )
1399 return GetDisplayBuiltInScreen();
1400
1401 const unsigned int nScreens = GetScreenCount();
1402 unsigned int nBestMatchScreen = 0;
1403 unsigned long nOverlap = 0;
1404 for( unsigned int i = 0; i < nScreens; i++ )
1405 {
1406 const tools::Rectangle aCurScreenRect( GetScreenPosSizePixel( i ) );
1407 // if a screen contains the rectangle completely it is obviously the best screen
1408 if( aCurScreenRect.Contains( i_rRect ) )
1409 return i;
1410 // next the screen which contains most of the area of the rect is the best
1411 tools::Rectangle aIntersection( aCurScreenRect.GetIntersection( i_rRect ) );
1412 if( ! aIntersection.IsEmpty() )
1413 {
1414 const unsigned long nCurOverlap( aIntersection.GetWidth() * aIntersection.GetHeight() );
1415 if( nCurOverlap > nOverlap )
1416 {
1417 nOverlap = nCurOverlap;
1418 nBestMatchScreen = i;
1419 }
1420 }
1421 }
1422 if( nOverlap > 0 )
1423 return nBestMatchScreen;
1424
1425 // finally the screen which center is nearest to the rect is the best
1426 const Point aCenter( (i_rRect.Left() + i_rRect.Right())/2,
1427 (i_rRect.Top() + i_rRect.Bottom())/2 );
1428 tools::Long nDist = std::numeric_limits<tools::Long>::max();
1429 for( unsigned int i = 0; i < nScreens; i++ )
1430 {
1431 const tools::Rectangle aCurScreenRect( GetScreenPosSizePixel( i ) );
1432 const tools::Long nCurDist( calcDistSquare( aCenter, aCurScreenRect ) );
1433 if( nCurDist < nDist )
1434 {
1435 nBestMatchScreen = i;
1436 nDist = nCurDist;
1437 }
1438 }
1439 return nBestMatchScreen;
1440}
1441
1443{
1444 ImplSVData* pSVData = ImplGetSVData();
1445
1446 if ( !pSVData->maAppData.mpAccelMgr )
1447 pSVData->maAppData.mpAccelMgr = new ImplAccelManager();
1448 return pSVData->maAppData.mpAccelMgr->InsertAccel( pAccel );
1449}
1450
1452{
1453 ImplSVData* pSVData = ImplGetSVData();
1454
1455 if ( pSVData->maAppData.mpAccelMgr )
1456 pSVData->maAppData.mpAccelMgr->RemoveAccel( pAccel );
1457}
1458
1460{
1461 ImplGetSVData()->maAppData.mpHelp = pHelp;
1462}
1463
1465{
1466 ImplSVData* pSVData = ImplGetSVData();
1467 if (pSVData && pSVData->mpDefInst)
1468 pSVData->mpDefInst->updateMainThread();
1469}
1470
1472{
1473 return ImplGetSVData()->maAppData.mpHelp;
1474}
1475
1477{
1478 ImplSVData* pSVData = ImplGetSVData();
1479 if ( pSVData->maAppData.mxToolkitName )
1480 return *(pSVData->maAppData.mxToolkitName);
1481 else
1482 return OUString();
1483}
1484
1486{
1487 ImplSVData* pSVData = ImplGetSVData();
1488 // find some useful dialog parent
1489
1490 // always use the topmost parent of the candidate
1491 // window to avoid using dialogs or floaters
1492 // as DefDialogParent
1493
1494 // current focus frame
1495 vcl::Window *pWin = pSVData->mpWinData->mpFocusWin;
1496 if (pWin && !pWin->IsMenuFloatingWindow())
1497 {
1498 while (pWin->mpWindowImpl && pWin->mpWindowImpl->mpParent)
1499 pWin = pWin->mpWindowImpl->mpParent;
1500
1501 // check for corrupted window hierarchy, #122232#, may be we now crash somewhere else
1502 if (!pWin->mpWindowImpl)
1503 {
1504 OSL_FAIL( "Window hierarchy corrupted!" );
1505 pSVData->mpWinData->mpFocusWin = nullptr; // avoid further access
1506 return nullptr;
1507 }
1508
1509 if ((pWin->mpWindowImpl->mnStyle & WB_INTROWIN) == 0)
1510 {
1511 return pWin->mpWindowImpl->mpFrameWindow->ImplGetWindow();
1512 }
1513 }
1514
1515 // last active application frame
1516 pWin = pSVData->maFrameData.mpActiveApplicationFrame;
1517 if (pWin)
1518 {
1519 return pWin->mpWindowImpl->mpFrameWindow->ImplGetWindow();
1520 }
1521
1522 // first visible top window (may be totally wrong...)
1523 pWin = pSVData->maFrameData.mpFirstFrame;
1524 while (pWin)
1525 {
1526 if( pWin->ImplGetWindow()->IsTopWindow() &&
1527 pWin->mpWindowImpl->mbReallyVisible &&
1528 (pWin->mpWindowImpl->mnStyle & WB_INTROWIN) == 0
1529 )
1530 {
1531 while( pWin->mpWindowImpl->mpParent )
1532 pWin = pWin->mpWindowImpl->mpParent;
1533 return pWin->mpWindowImpl->mpFrameWindow->ImplGetWindow();
1534 }
1535 pWin = pWin->mpWindowImpl->mpFrameData->mpNextFrame;
1536 }
1537
1538 // use the desktop
1539 return nullptr;
1540}
1541
1543{
1545 return pWindow ? pWindow->GetFrameWeld() : nullptr;
1546}
1547
1549{
1551}
1552
1554{
1556}
1557
1559{
1561}
1562
1564{
1566}
1567
1569{
1571}
1572
1573css::uno::Reference< css::awt::XToolkit > Application::GetVCLToolkit()
1574{
1575 css::uno::Reference< css::awt::XToolkit > xT;
1577 if ( pWrapper )
1578 xT = pWrapper->GetVCLToolkit();
1579 return xT;
1580}
1581
1582#ifdef DISABLE_DYNLOADING
1583
1584extern "C" { UnoWrapperBase* CreateUnoWrapper(); }
1585
1586#else
1587
1588extern "C" { static void thisModule() {} }
1589
1590#endif
1591
1593{
1594 ImplSVData* pSVData = ImplGetSVData();
1595 static bool bAlreadyTriedToCreate = false;
1596 if ( !pSVData->mpUnoWrapper && bCreateIfNotExist && !bAlreadyTriedToCreate )
1597 {
1598#ifndef DISABLE_DYNLOADING
1599 osl::Module aTkLib;
1600 aTkLib.loadRelative(&thisModule, TK_DLL_NAME);
1601 if (aTkLib.is())
1602 {
1603 FN_TkCreateUnoWrapper fnCreateWrapper = reinterpret_cast<FN_TkCreateUnoWrapper>(aTkLib.getFunctionSymbol("CreateUnoWrapper"));
1604 if ( fnCreateWrapper )
1605 {
1606 pSVData->mpUnoWrapper = fnCreateWrapper();
1607 }
1608 aTkLib.release();
1609 }
1610 SAL_WARN_IF( !pSVData->mpUnoWrapper, "vcl", "UnoWrapper could not be created!" );
1611#else
1612 pSVData->mpUnoWrapper = CreateUnoWrapper();
1613#endif
1614 bAlreadyTriedToCreate = true;
1615 }
1616 return pSVData->mpUnoWrapper;
1617}
1618
1620{
1621 ImplSVData* pSVData = ImplGetSVData();
1622 SAL_WARN_IF( pSVData->mpUnoWrapper, "vcl", "SetUnoWrapper: Wrapper already exists" );
1623 pSVData->mpUnoWrapper = pWrapper;
1624}
1625
1626css::uno::Reference< css::awt::XDisplayConnection > Application::GetDisplayConnection()
1627{
1628 ImplSVData* pSVData = ImplGetSVData();
1629
1630 if( !pSVData->mxDisplayConnection.is() )
1631 {
1633 pSVData->mxDisplayConnection->start();
1634 }
1635
1636 return pSVData->mxDisplayConnection;
1637}
1638
1640{
1641 ImplGetSVData()->maGDIData.mxGrfConverter->SetFilterHdl( rLink );
1642}
1643
1645{
1647}
1648
1649void Application::EnableHeadlessMode( bool dialogsAreFatal )
1650{
1653 assert(eOldMode == DialogCancelMode::Off || GetDialogCancelMode() == eNewMode);
1654 if (eOldMode != eNewMode)
1655 SetDialogCancelMode( eNewMode );
1656}
1657
1659{
1661}
1662
1664{
1666}
1667
1669{
1671}
1672
1674{
1675 EnableHeadlessMode(true);
1677}
1678
1679static bool bEventTestingMode = false;
1680
1682{
1683 return bEventTestingMode;
1684}
1685
1687{
1688 bEventTestingMode = true;
1689}
1690
1691static bool bSafeMode = false;
1692
1694{
1695 return bSafeMode;
1696}
1697
1699{
1700 bSafeMode = true;
1701}
1702
1703void Application::ShowNativeErrorBox(const OUString& sTitle ,
1704 const OUString& sMessage)
1705{
1707 sTitle,
1708 sMessage);
1710 SAL_WARN( "vcl", "ShowNativeMessageBox returned " << btn);
1711 }
1712}
1713
1715{
1717 {
1718 static const OUString aNone("none");
1719 return aNone;
1720 }
1721 else
1722 return SalGetDesktopEnvironment();
1723}
1724
1725void Application::AddToRecentDocumentList(const OUString& rFileUrl, const OUString& rMimeType, const OUString& rDocumentService)
1726{
1727 ImplSVData* pSVData = ImplGetSVData();
1728 pSVData->mpDefInst->AddToRecentDocumentList(rFileUrl, rMimeType, rDocumentService);
1729}
1730
1732{
1733// Disable MSAA bridge on UNIX
1734#if defined UNX
1735 return true;
1736#else
1737 bool bRet = ImplInitAccessBridge();
1738
1739 if( !bRet )
1740 {
1741 // disable accessibility if the user chooses to continue
1743 MiscSettings aMisc = aSettings.GetMiscSettings();
1744 aMisc.SetEnableATToolSupport( false );
1745 aSettings.SetMiscSettings( aMisc );
1746 Application::SetSettings( aSettings );
1747 }
1748 return bRet;
1749#endif // !UNX
1750}
1751
1752// MT: AppEvent was in oldsv.cxx, but is still needed...
1753void Application::AppEvent( const ApplicationEvent& /*rAppEvent*/ )
1754{
1755}
1756
1758{
1759 ImplSVData* pSVData = ImplGetSVData();
1760 return pSVData->mpDefInst->hasNativeFileSelection();
1761}
1762
1763Reference< ui::dialogs::XFilePicker2 >
1764Application::createFilePicker( const Reference< uno::XComponentContext >& xSM )
1765{
1766 ImplSVData* pSVData = ImplGetSVData();
1767 return pSVData->mpDefInst->createFilePicker( xSM );
1768}
1769
1770Reference< ui::dialogs::XFolderPicker2 >
1771Application::createFolderPicker( const Reference< uno::XComponentContext >& xSM )
1772{
1773 ImplSVData* pSVData = ImplGetSVData();
1774 return pSVData->mpDefInst->createFolderPicker( xSM );
1775}
1776
1778 ImplSVData * pSVData = ImplGetSVData();
1779 assert(!pSVData->maDeInitHook.IsSet());
1780 pSVData->maDeInitHook = hook;
1781 // Fake this for VCLXToolkit ctor instantiated from
1782 // postprocess/CppunitTest_services.mk:
1783 pSVData->maAppData.mbInAppMain = true;
1784}
1785
1786namespace vcl::lok {
1787
1789 LibreOfficeKitPollCallback pPollCallback,
1790 LibreOfficeKitWakeCallback pWakeCallback,
1791 void *pData) {
1792
1793 ImplSVData * pSVData = ImplGetSVData();
1794 if (pSVData)
1795 {
1796 pSVData->mpPollCallback = pPollCallback;
1797 pSVData->mpWakeCallback = pWakeCallback;
1798 pSVData->mpPollClosure = pData;
1799 }
1800}
1801
1803{
1804 ImplSVData * pSVData = ImplGetSVData();
1805 if (!pSVData)
1806 return;
1807
1808 // Not hyper-elegant - but in the case of Android & unipoll we need to detach
1809 // this thread from the JVM's clutches to avoid a crash closing document
1810 if (pSVData->mpPollClosure && pSVData->mpDefInst)
1811 pSVData->mpDefInst->releaseMainThread();
1812
1813 // Just set mpPollClosure to null as that is what calling this means, that the callback data
1814 // points to an object that no longer exists. In particular, don't set
1815 // pSVData->mpPollCallback to nullptr as that is used to detect whether Unipoll is in use in
1816 // isUnipoll().
1817 pSVData->mpPollClosure = nullptr;
1818}
1819
1821{
1822 ImplSVData * pSVData = ImplGetSVData();
1823 return pSVData && pSVData->mpPollCallback != nullptr;
1824}
1825
1827{
1828 ImplSVData * pSVData = ImplGetSVData();
1829 auto& rCache = pSVData->maGDIData.maScaleCache;
1830 // Normally the cache size is set to 10, scale according to the number of users.
1831 rCache.setMaxSize(count * 10);
1832}
1833
1834void dumpState(rtl::OStringBuffer &rState)
1835{
1836 ImplSVData* pSVData = ImplGetSVData();
1837 if (!pSVData)
1838 return;
1839
1840 rState.append("\nWindows:\t");
1841 rState.append(static_cast<sal_Int32>(Application::GetTopWindowCount()));
1842
1844 while (pWin)
1845 {
1848
1849 rState.append("\n\tWindow: ");
1850 rState.append(props.extractAsOString());
1851
1853 }
1854}
1855
1856} // namespace lok, namespace vcl
1857
1858/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
AnyEventRef aEvent
void SetMiscSettings(const MiscSettings &rSet)
SAL_DLLPRIVATE AllSettingsFlags GetChangeFlags(const AllSettings &rSettings) const
const MiscSettings & GetMiscSettings() const
const LanguageTag & GetUILanguageTag() const
const LocaleDataWrapper & GetLocaleDataWrapper() const
An application can be notified of a number of different events:
Definition: svapp.hxx:116
Base class used mainly for the LibreOffice Desktop class.
Definition: svapp.hxx:234
static void AddEventListener(const Link< VclSimpleEvent &, void > &rEventListener)
Add a VCL event listener to the application.
Definition: svapp.cxx:821
static bool IsDialogCancelEnabled()
Determines if dialog cancel mode is enabled.
Definition: svapp.cxx:1558
static void ImplCallEventListeners(VclSimpleEvent &rEvent)
Send event to all VCL application event listeners.
Definition: svapp.cxx:815
static void EndAllDialogs()
Cancel all open dialogs.
Definition: svapp.cxx:308
static sal_uInt16 GetCommandLineParamCount()
Gets the number of command line parameters passed to the application.
Definition: svapp.cxx:210
static SAL_DLLPRIVATE unsigned int GetBestScreen(const tools::Rectangle &)
Get the "best" screen.
Definition: svapp.cxx:1396
static void Execute()
Run the main event processing loop until it is quit by Quit().
Definition: svapp.cxx:428
static void SetDialogCancelMode(DialogCancelMode mode)
Sets the dialog cancel mode for headless environments.
Definition: svapp.cxx:1553
static bool IsBitmapRendering()
Determines if bitmap rendering is enabled.
Definition: svapp.cxx:1668
static tools::Long GetTopWindowCount()
Return the number of top-level windows being used by the application.
Definition: svapp.cxx:1182
virtual void OverrideSystemSettings(AllSettings &rSettings)
Sets user settings in settings object to override system settings.
Definition: svapp.cxx:644
static unsigned int GetDisplayBuiltInScreen()
Get the built-in screen.
Definition: svapp.cxx:1341
static OUString GetAppFileName()
Get the name of the file used to start the application.
Definition: svapp.cxx:222
LibreOfficeKitCallback m_pCallback
Definition: svapp.hxx:1353
static bool LOKHandleMouseEvent(VclEventId nEvent, vcl::Window *pWin, const MouseEvent *pEvent)
Definition: svapp.cxx:930
virtual void Init()
Initialize the application itself.
Definition: svapp.cxx:198
static bool HandleKey(VclEventId nEvent, vcl::Window *pWin, KeyEvent *pKeyEvent)
Handle keypress event.
Definition: svapp.cxx:846
static css::uno::Reference< css::awt::XDisplayConnection > GetDisplayConnection()
Definition: svapp.cxx:1626
static vcl::Window * GetTopWindow(tools::Long nIndex)
Get the nth top window.
Definition: svapp.cxx:1196
static bool IsMainThread()
Queries whether we are in main thread.
Definition: svapp.cxx:580
static void AddToRecentDocumentList(const OUString &rFileUrl, const OUString &rMimeType, const OUString &rDocumentService)
Add a file to the system shells recent document list if there is any.
Definition: svapp.cxx:1725
static bool IsInModalMode()
Queries whether application has a modal dialog active.
Definition: svapp.cxx:613
static bool IsOnSystemEventLoop()
Returns true, if the VCL plugin runs on the system event loop.
Definition: svapp.cxx:497
static void Yield()
Process the next event.
Definition: svapp.cxx:551
static void SetAppName(const OUString &rUniqueName)
Set the application's name.
Definition: svapp.cxx:1227
static void MergeSystemSettings(AllSettings &rSettings)
Set the settings object to the platform/desktop environment system settings.
Definition: svapp.cxx:648
static ImplSVEvent * PostKeyEvent(VclEventId nEvent, vcl::Window *pWin, KeyEvent const *pKeyEvent)
Send keypress event.
Definition: svapp.cxx:870
static void setDeInitHook(Link< LinkParamNone *, void > const &hook)
Definition: svapp.cxx:1777
static css::uno::Reference< css::ui::dialogs::XFilePicker2 > createFilePicker(const css::uno::Reference< css::uno::XComponentContext > &rServiceManager)
Create a platform specific file picker, if one is available, otherwise return an empty reference.
Definition: svapp.cxx:1764
static size_t GetReservedKeyCodeCount()
Get the number of reserved key codes used by the application.
Definition: svapp.cxx:278
static void ImplCallEventListenersApplicationDataChanged(void *pData)
Send event to all VCL application event listeners.
Definition: svapp.cxx:807
static unsigned int GetScreenCount()
Get the number of screens available for the display.
Definition: svapp.cxx:1329
static const vcl::KeyCode * GetReservedKeyCode(size_t i)
Get the reserved key code.
Definition: svapp.cxx:283
static void SetDisplayName(const OUString &rDisplayName)
Set the default name of the application for message dialogs and printing.
Definition: svapp.cxx:1312
static OutputDevice * GetDefaultDevice()
Get the default "device" (in this case the default window).
Definition: svapp.cxx:1166
static css::uno::Reference< css::ui::dialogs::XFolderPicker2 > createFolderPicker(const css::uno::Reference< css::uno::XComponentContext > &rServiceManager)
Create a platform specific folder picker, if one is available, otherwise return an empty reference.
Definition: svapp.cxx:1771
static css::uno::Reference< css::awt::XToolkit > GetVCLToolkit()
Gets the VCL toolkit.
Definition: svapp.cxx:1573
static ImplSVEvent * PostGestureEvent(VclEventId nEvent, vcl::Window *pWin, GestureEventPan const *pGestureEvent)
Definition: svapp.cxx:893
static SystemWindowFlags GetSystemWindowMode()
Get the system window mode of dialogs.
Definition: svapp.cxx:1568
static void UpdateMainThread()
Update main thread identifier.
Definition: svapp.cxx:1464
static OUString GetToolkitName()
Get the toolkit's name.
Definition: svapp.cxx:1476
virtual void Exception(ExceptionCategory nCategory)
Handles an error.
Definition: svapp.cxx:243
static OUString GetHWOSConfInfo(const int bSelection=0, bool bLocalize=true)
Get useful OS, Hardware and configuration information, cf.
Definition: svapp.cxx:1263
virtual bool QueryExit()
Exit from the application.
Definition: svapp.cxx:183
static DialogCancelMode GetDialogCancelMode()
Gets the dialog cancel mode for headless environments.
Definition: svapp.cxx:1548
static void Abort(const OUString &rErrorText)
Ends the program prematurely with an error message.
Definition: svapp.cxx:257
static OUString GetOSVersion()
Get the OS version based on the OS specific implementation.
Definition: svapp.cxx:1252
virtual ~Application()
Virtual destructor for Application class.
Definition: svapp.cxx:171
static bool hasNativeFileSelection()
Do we have a native / system file selector available?
Definition: svapp.cxx:1757
static void SetSystemWindowMode(SystemWindowFlags nMode)
Make a dialog box a system window or not.
Definition: svapp.cxx:1563
static OUString GetDisplayName()
Get the default name of the application for message dialogs and printing.
Definition: svapp.cxx:1318
virtual void Shutdown()
Definition: svapp.cxx:194
static vcl::Window * GetNextTopLevelWindow(vcl::Window const *pWindow)
Get the next top level window.
Definition: svapp.cxx:1177
static void ShowNativeErrorBox(const OUString &sTitle, const OUString &sMessage)
Definition: svapp.cxx:1703
static bool InsertAccel(Accelerator *pAccel)
Insert accelerator.
Definition: svapp.cxx:1442
static const AllSettings & GetSettings()
Gets the application's settings.
Definition: svapp.cxx:761
static void EnableHeadlessMode(bool dialogsAreFatal)
Enables headless mode.
Definition: svapp.cxx:1649
static void RemoveAccel(Accelerator const *pAccel)
Remove accelerator.
Definition: svapp.cxx:1451
static bool IsUnifiedDisplay()
Determines if the screens that make up a display are separate or form one large display area.
Definition: svapp.cxx:1335
static comphelper::SolarMutex & GetSolarMutex()
Get the Solar Mutex for this thread.
Definition: svapp.cxx:574
static ImplSVEvent * PostUserEvent(const Link< void *, void > &rLink, void *pCaller=nullptr, bool bReferenceLink=false)
Post a user event to the default window.
Definition: svapp.cxx:1122
virtual void notifyWindow(vcl::LOKWindowId nLOKWindowId, const OUString &rAction, const std::vector< vcl::LOKPayloadItem > &rPayload=std::vector< vcl::LOKPayloadItem >()) const override
Definition: svapp.cxx:318
static void RemoveUserEvent(ImplSVEvent *nUserEvent)
Remove user event based on event ID.
Definition: svapp.cxx:1146
virtual int Main()
Pure virtual entrypoint to the application.
Definition: svapp.cxx:177
static void EndAllPopups()
Cancel all open popups.
Definition: svapp.cxx:313
static bool IsUICaptured()
Definition: svapp.cxx:633
static const OUString & GetDesktopEnvironment()
Get the desktop environment the process is currently running in.
Definition: svapp.cxx:1714
static sal_uInt32 ReleaseSolarMutex()
Release Solar Mutex(es) for this thread.
Definition: svapp.cxx:585
virtual void DeInit()
Deinitialized the application itself.
Definition: svapp.cxx:206
static void SetFilterHdl(const Link< ConvertData &, bool > &rLink)
Setup a new graphics filter.
Definition: svapp.cxx:1639
static bool IsInExecute()
Queries whether the application is in the event loop.
Definition: svapp.cxx:603
static void Quit()
Quit the program.
Definition: svapp.cxx:568
static ImplSVEvent * PostMouseEvent(VclEventId nEvent, vcl::Window *pWin, MouseEvent const *pMouseEvent)
Send mouse event.
Definition: svapp.cxx:998
static bool IsEventTestingModeEnabled()
Determines if event testing mode is enabled.
Definition: svapp.cxx:1681
static void EnableEventTestingMode()
Enables event testing mode.
Definition: svapp.cxx:1686
static bool IsSafeModeEnabled()
Determines if safe mode is enabled.
Definition: svapp.cxx:1693
static void EnableConsoleOnly()
Enable Console Only mode.
Definition: svapp.cxx:1673
static unsigned int GetDisplayExternalScreen()
Get the display's external screen.
Definition: svapp.cxx:1347
static void RemoveKeyListener(const Link< VclWindowEvent &, bool > &rKeyListener)
Remove a keypress listener from the application.
Definition: svapp.cxx:839
virtual void libreOfficeKitViewCallback(int nType, const char *pPayload) const override
Definition: svapp.cxx:324
static void SetSettings(const AllSettings &rSettings)
Sets the application's settings and notifies all windows of the change.
Definition: svapp.cxx:667
static void SetHelp(Help *pHelp=nullptr)
Sets up help.
Definition: svapp.cxx:1459
static void RemoveMouseAndKeyEvents(vcl::Window *pWin)
Remove mouse and keypress events from a window... any also zoom and scroll events if the platform sup...
Definition: svapp.cxx:1099
static bool IsInMain()
Queries whether the application is in "main", i.e.
Definition: svapp.cxx:597
static bool Reschedule(bool bHandleAllCurrentEvents=false)
Attempt to process current pending event(s)
Definition: svapp.cxx:486
static bool AnyInput(VclInputFlags nType=VCL_INPUT_ANY)
Determine if there are any pending input events.
Definition: svapp.cxx:623
static Help * GetHelp()
Gets the application's help.
Definition: svapp.cxx:1471
void * m_pCallbackData
Definition: svapp.hxx:1352
static void EnableBitmapRendering()
Enable software-only bitmap rendering.
Definition: svapp.cxx:1663
static sal_uInt16 GetDispatchLevel()
Return how many events are being dispatched.
Definition: svapp.cxx:618
virtual void AppEvent(const ApplicationEvent &rAppEvent)
Definition: svapp.cxx:1753
static vcl::Window * GetFocusWindow()
Get the currently focused window.
Definition: svapp.cxx:1161
static weld::Window * GetDefDialogParent()
Get the default parent window for dialog boxes.
Definition: svapp.cxx:1542
virtual void InitFinished()
Finish initialization of the application.
Definition: svapp.cxx:202
static tools::Rectangle GetScreenPosSizePixel(unsigned int nScreen)
Get a screen's rectangular area.
Definition: svapp.cxx:1370
static void EnableSafeMode()
Set safe mode to enabled.
Definition: svapp.cxx:1698
static OUString GetCommandLineParam(sal_uInt16 nParam)
Gets a particular command line parameter.
Definition: svapp.cxx:215
static void RemoveEventListener(const Link< VclSimpleEvent &, void > &rEventListener)
Remove a VCL event listener from the application.
Definition: svapp.cxx:827
static vcl::Window * GetActiveTopWindow()
Get the "active" top window.
Definition: svapp.cxx:1215
static bool IsHeadlessModeEnabled()
Determines if headless mode is enabled.
Definition: svapp.cxx:1658
static void AcquireSolarMutex(sal_uInt32 nCount)
Acquire Solar Mutex(es) for this thread.
Definition: svapp.cxx:591
static bool IsQuit()
Has Quit() been called?
Definition: svapp.cxx:608
static const LocaleDataWrapper & GetAppLocaleDataWrapper()
Get the application's locale data wrapper.
Definition: svapp.cxx:1644
static OUString GetAppName()
Get the application's name.
Definition: svapp.cxx:1233
static sal_uInt64 GetLastInputInterval()
The interval from the last time that input was received.
Definition: svapp.cxx:628
static void NotifyAllWindows(DataChangedEvent &rDCEvt)
Notify all windows that the application has changed data.
Definition: svapp.cxx:788
Application()
Default constructor for Application class.
Definition: svapp.cxx:160
static void AddKeyListener(const Link< VclWindowEvent &, bool > &rKeyListener)
Add a keypress listener to the application.
Definition: svapp.cxx:833
static vcl::Window * GetFirstTopLevelWindow()
Get the first top-level window of the application.
Definition: svapp.cxx:1171
static SAL_DLLPRIVATE vcl::Window * GetDefDialogParent()
Definition: svapp.cxx:1485
void EndPopupMode(FloatWinPopupEndFlags nFlags=FloatWinPopupEndFlags::NONE)
Definition: floatwin.cxx:949
PanningOrientation meOrientation
GestureEventPanType meEventType
Definition: help.hxx:61
An idle is a timer to be scheduled immediately.
Definition: idle.hxx:35
virtual void Start(bool bStartTimer=true) override
Schedules the task for execution.
Definition: idle.cxx:34
bool InsertAccel(Accelerator *pAccel)
Definition: accmgr.cxx:30
void RemoveAccel(Accelerator const *pAccel)
Definition: accmgr.cxx:46
LanguageType getLanguageType(bool bResolveSystem=true) const
MouseEventModifiers GetMode() const
Definition: event.hxx:124
sal_uInt16 GetModifier() const
Definition: event.hxx:156
sal_uInt16 GetClicks() const
Definition: event.hxx:126
sal_uInt16 GetButtons() const
Definition: event.hxx:147
const Point & GetPosPixel() const
Definition: event.hxx:123
Some things multiple-inherit from VclAbstractDialog and OutputDevice, so we need to use virtual inher...
Definition: outdev.hxx:171
SAL_DLLPRIVATE sal_Int32 GetDPIX() const
Get the output device's DPI x-axis value.
Definition: outdev.hxx:386
SAL_DLLPRIVATE sal_Int32 GetDPIY() const
Get the output device's DPI y-axis value.
Definition: outdev.hxx:392
void SetMapMode()
Definition: map.cxx:654
SAL_DLLPRIVATE void SetDPIY(sal_Int32 nDPIY)
Definition: outdev.hxx:395
const MapMode & GetMapMode() const
Definition: outdev.hxx:1558
SAL_DLLPRIVATE void SetDPIX(sal_Int32 nDPIX)
Definition: outdev.hxx:394
bool IsMapModeEnabled() const
Definition: outdev.hxx:1552
virtual bool PostEvent(std::unique_ptr< ImplSVEvent > pData)=0
virtual bool AnyInput(VclInputFlags nType)=0
virtual void AddToRecentDocumentList(const OUString &rFileUrl, const OUString &rMimeType, const OUString &rDocumentService)=0
virtual void DoQuit()
Definition: salvtables.cxx:180
virtual bool IsMainThread() const =0
virtual OUString getOSVersion()
get information about underlying versions
Definition: salinst.hxx:207
void AcquireYieldMutex(sal_uInt32 nCount=1)
Definition: salvtables.cxx:149
virtual void updateMainThread()
Set the app's (somewhat) magic/main-thread to this one.
Definition: salinst.hxx:202
sal_uInt32 ReleaseYieldMutexAll()
Definition: salvtables.cxx:147
virtual bool hasNativeFileSelection() const
Definition: salinst.hxx:189
virtual bool DoExecute(int &nExitCode)
Definition: salvtables.cxx:172
virtual css::uno::Reference< css::ui::dialogs::XFolderPicker2 > createFolderPicker(const css::uno::Reference< css::uno::XComponentContext > &)
Definition: salinst.hxx:193
virtual css::uno::Reference< css::ui::dialogs::XFilePicker2 > createFilePicker(const css::uno::Reference< css::uno::XComponentContext > &)
Definition: salinst.hxx:191
virtual bool DoYield(bool bWait, bool bHandleAllCurrentEvents)=0
Wait for the next event (if bWait) and dispatch it, includes posted events, and timers.
comphelper::SolarMutex * GetYieldMutex()
Definition: salvtables.cxx:145
virtual void releaseMainThread()
Disconnect that - good for detaching from the JavaVM on Android.
Definition: salinst.hxx:204
virtual unsigned int GetDisplayScreenCount()=0
virtual bool IsUnifiedDisplay()
Definition: salsys.hxx:48
virtual tools::Rectangle GetDisplayScreenPosSizePixel(unsigned int nScreen)=0
virtual int ShowNativeMessageBox(const OUString &rTitle, const OUString &rMessage)=0
virtual unsigned int GetDisplayBuiltInScreen()
Definition: salsys.hxx:55
static void ProcessEventsToIdle()
Process all events until none is pending.
Definition: svapp.cxx:502
bool good() const
SvStream & ReadUInt16(sal_uInt16 &rUInt16)
virtual OUString GetText() const override
Definition: syswin.cxx:1057
bool IsActive() const
Definition: task.hxx:101
void SetPriority(TaskPriority ePriority)
Definition: scheduler.cxx:597
const char * GetDebugName() const
Definition: task.hxx:82
Definition: timer.hxx:27
void SetInvokeHandler(const Link< Timer *, void > &rLink)
Definition: timer.hxx:56
static void SetUnoWrapper(UnoWrapperBase *pWrapper)
Sets the application's UNO Wrapper object.
Definition: svapp.cxx:1619
static UnoWrapperBase * GetUnoWrapper(bool bCreateIfNotExists=true)
Get the application's UNO wrapper object.
Definition: svapp.cxx:1592
virtual css::uno::Reference< css::awt::XToolkit > GetVCLToolkit()=0
void removeListener(const Link< VclSimpleEvent &, void > &rListener)
Definition: vclevent.cxx:68
void Call(VclSimpleEvent &rEvent) const
Definition: vclevent.cxx:26
void addListener(const Link< VclSimpleEvent &, void > &rListener)
Definition: vclevent.cxx:62
void clear()
Definition: vclptr.hxx:190
reference_type * get() const
Get the body.
Definition: vclptr.hxx:143
void release() const
bool mbScreenComp
Definition: virdev.hxx:52
VclPtr< VirtualDevice > mpNext
Definition: virdev.hxx:50
virtual bool Close() override
Definition: wrkwin.cxx:240
void setMaxSize(size_t nMaxSize)
constexpr tools::Long GetWidth() const
bool Contains(const Point &rPOINT) const
tools::Rectangle GetIntersection(const tools::Rectangle &rRect) const
constexpr tools::Long Top() const
constexpr tools::Long Right() const
constexpr tools::Long GetHeight() const
constexpr tools::Long Left() const
constexpr tools::Long Bottom() const
constexpr bool IsEmpty() const
static sal_uInt64 GetSystemTicks()
static bool IsFuzzing()
static SAL_DLLPRIVATE void ImplInitAppFontData(vcl::Window const *pWindow)
Definition: window.cxx:1183
tools::Long GetOutOffXPixel() const
Definition: window3.cxx:123
tools::Long GetOutOffYPixel() const
Definition: window3.cxx:124
void UpdateSettings(const AllSettings &rSettings, bool bChild=false)
::OutputDevice const * GetOutDev() const
Definition: window.cxx:567
std::unique_ptr< WindowImpl > mpWindowImpl
Definition: window.hxx:484
SalFrame * ImplGetFrame() const
Definition: window2.cxx:867
virtual void DumpAsPropertyTree(tools::JsonWriter &)
Dumps itself and potentially its children to a property tree, to be written easily to JSON.
Definition: window.cxx:3363
bool IsTopWindow() const
Definition: stacking.cxx:608
weld::Window * GetFrameWeld() const
Definition: window2.cxx:872
SAL_DLLPRIVATE void ImplUpdateGlobalSettings(AllSettings &rSettings, bool bCallHdl=true) const
vcl::Window * ImplGetWindow() const
if this is a proxy return the client, otherwise itself
Definition: window2.cxx:854
void NotifyAllChildren(DataChangedEvent &rDCEvt)
Definition: event.cxx:40
bool IsMenuFloatingWindow() const
Definition: window2.cxx:1031
SAL_DLLPRIVATE vcl::Window * ImplGetClientWindow() const
Definition: window2.cxx:889
int nCount
#define DBG_TESTSOLARMUTEX()
float u
ExceptionCategory
VclInputFlags
Definition: inputtypes.hxx:25
sal_Int32 nIndex
sal_Int64 n
constexpr sal_uInt16 KEY_0
Definition: keycodes.hxx:45
constexpr sal_uInt16 KEY_F2
Definition: keycodes.hxx:84
constexpr sal_uInt16 KEY_6
Definition: keycodes.hxx:51
constexpr sal_uInt16 KEY_8
Definition: keycodes.hxx:53
constexpr sal_uInt16 KEY_MOD2
Definition: keycodes.hxx:32
constexpr sal_uInt16 KEY_MOD1
Definition: keycodes.hxx:31
constexpr sal_uInt16 KEY_7
Definition: keycodes.hxx:52
constexpr sal_uInt16 KEY_1
Definition: keycodes.hxx:46
constexpr sal_uInt16 KEY_ADD
Definition: keycodes.hxx:127
constexpr sal_uInt16 KEY_F4
Definition: keycodes.hxx:86
constexpr sal_uInt16 KEY_4
Definition: keycodes.hxx:49
constexpr sal_uInt16 KEY_F6
Definition: keycodes.hxx:88
constexpr sal_uInt16 KEY_F10
Definition: keycodes.hxx:92
constexpr sal_uInt16 KEY_5
Definition: keycodes.hxx:50
constexpr sal_uInt16 KEY_F1
Definition: keycodes.hxx:83
constexpr sal_uInt16 KEY_9
Definition: keycodes.hxx:54
constexpr sal_uInt16 KEY_3
Definition: keycodes.hxx:48
constexpr sal_uInt16 KEY_MOD3
Definition: keycodes.hxx:33
constexpr sal_uInt16 KEY_2
Definition: keycodes.hxx:47
constexpr sal_uInt16 KEY_SHIFT
Definition: keycodes.hxx:30
#define SAL_WARN_IF(condition, area, stream)
#define SAL_WARN(area, stream)
#define SAL_INFO(area, stream)
#define SAL_N_ELEMENTS(arr)
std::unique_ptr< sal_Int32[]> pData
sal_uInt16 nCode
VCL_DLLPUBLIC bool isVCLSkiaEnabled()
std::locale Create(std::string_view aPrefixName, const LanguageTag &rLocale)
OUString get(TranslateId sContextAndId, const std::locale &loc)
int i
dictionary props
long Long
void registerPollCallbacks(LibreOfficeKitPollCallback pPollCallback, LibreOfficeKitWakeCallback pWakeCallback, void *pData)
Definition: svapp.cxx:1788
void numberOfViewsChanged(int count)
Definition: svapp.cxx:1826
bool isUnipoll()
Definition: svapp.cxx:1820
void unregisterPollCallbacks()
Definition: svapp.cxx:1802
void dumpState(rtl::OStringBuffer &rState)
Definition: svapp.cxx:1834
void EndAllDialogs(vcl::Window const *pParent)
Definition: dialog.cxx:1199
sal_uInt32 LOKWindowId
int nImplSysDialog
Definition: print.cxx:56
ConversionMode mode
QPRO_FUNC_TYPE nType
void SalAbort(const OUString &rErrorText, bool bDumpCore)
Definition: salplug.cxx:368
const OUString & SalGetDesktopEnvironment()
Definition: salplug.cxx:409
const int SALSYSTEM_SHOWNATIVEMSGBOX_BTN_OK
Definition: salsys.hxx:28
SalEvent
Definition: salwtype.hxx:46
@ ExternalGesture
@ ExternalKeyInput
@ ExternalMouseButtonDown
@ ExternalMouseMove
@ ExternalMouseButtonUp
AllSettingsFlags
Definition: settings.hxx:674
OUString sMessage
#define SV_APP_VCLBACKEND
Definition: strings.hxx:13
VclEventId mnEvent
Definition: svapp.cxx:128
ImplSVEvent * mnEventId
Definition: svapp.cxx:126
ImplPostEventData(VclEventId nEvent, vcl::Window *pWin, const GestureEventPan &rGestureEvent)
Definition: svapp.cxx:144
ImplPostEventData(VclEventId nEvent, vcl::Window *pWin, const KeyEvent &rKeyEvent)
Definition: svapp.cxx:132
KeyEvent maKeyEvent
Definition: svapp.cxx:129
ImplPostEventData(VclEventId nEvent, vcl::Window *pWin, const MouseEvent &rMouseEvent)
Definition: svapp.cxx:138
GestureEventPan maGestureEvent
Definition: svapp.cxx:130
MouseEvent maMouseEvent
Definition: svapp.cxx:127
VclPtr< vcl::Window > mpWin
Definition: svapp.cxx:125
SystemWindowFlags mnSysWinMode
Definition: svdata.hxx:156
std::optional< OUString > mxDisplayName
Definition: svdata.hxx:148
std::vector< Link< VclWindowEvent &, bool > > maKeyListeners
Definition: svdata.hxx:143
sal_uInt16 mnDispatchLevel
Definition: svdata.hxx:154
SvFileStream * mpEventTestInput
Definition: svdata.hxx:165
std::vector< ImplPostEventPair > maPostedEventList
Definition: svdata.hxx:144
std::optional< OUString > mxAppFileName
Definition: svdata.hxx:147
Idle * mpEventTestingIdle
Definition: svdata.hxx:166
std::optional< AllSettings > mxSettings
Definition: svdata.hxx:139
std::optional< OUString > mxToolkitName
Definition: svdata.hxx:149
DialogCancelMode meDialogCancel
Definition: svdata.hxx:161
VclEventListeners maEventListeners
Definition: svdata.hxx:141
LocaleConfigurationListener * mpCfgListener
Definition: svdata.hxx:140
int mnEventTestLimit
Definition: svdata.hxx:167
bool mbRenderToBitmaps
Definition: svdata.hxx:162
bool m_bUseSystemLoop
Definition: svdata.hxx:163
std::optional< OUString > mxAppName
Definition: svdata.hxx:146
ImplAccelManager * mpAccelMgr
Definition: svdata.hxx:145
Help * mpHelp
Definition: svdata.hxx:150
bool mbInAppMain
Definition: svdata.hxx:157
bool mbSettingsInit
Definition: svdata.hxx:160
volatile bool mbAppQuit
Definition: svdata.hxx:159
bool mbInAppExecute
Definition: svdata.hxx:158
ImplSchedulerContext maSchedCtx
Definition: svdata.hxx:399
ImplSVFrameData maFrameData
Definition: svdata.hxx:402
bool mbResLocaleSet
Definition: svdata.hxx:397
void * mpPollClosure
Definition: svdata.hxx:431
oslThreadIdentifier mnMainThreadId
Definition: svdata.hxx:412
UnoWrapperBase * mpUnoWrapper
Definition: svdata.hxx:407
SalInstance * mpDefInst
Definition: svdata.hxx:392
LibreOfficeKitPollCallback mpPollCallback
Definition: svdata.hxx:429
rtl::Reference< vcl::DisplayConnectionDispatch > mxDisplayConnection
Definition: svdata.hxx:413
ImplSVGDIData maGDIData
Definition: svdata.hxx:401
Application * mpApp
Definition: svdata.hxx:393
Link< LinkParamNone *, void > maDeInitHook
Definition: svdata.hxx:426
ImplSVWinData * mpWinData
Definition: svdata.hxx:403
ImplSVAppData maAppData
Definition: svdata.hxx:400
LibreOfficeKitWakeCallback mpWakeCallback
Definition: svdata.hxx:430
bool mbCall
Definition: svdata.hxx:466
VclPtr< vcl::Window > mpWindow
Definition: svdata.hxx:465
VclPtr< vcl::Window > mpInstanceRef
Definition: svdata.hxx:464
VclPtr< WorkWindow > mpAppWin
Definition: svdata.hxx:247
VclPtr< vcl::Window > mpFirstFrame
Definition: svdata.hxx:245
VclPtr< vcl::Window > mpActiveApplicationFrame
Definition: svdata.hxx:246
lru_scale_cache maScaleCache
Definition: svdata.hxx:231
std::unique_ptr< GraphicConverter > mxGrfConverter
Definition: svdata.hxx:233
VclPtr< VirtualDevice > mpFirstVirDev
Definition: svdata.hxx:225
VclPtr< FloatingWindow > mpFirstFloat
Definition: svdata.hxx:258
VclPtr< vcl::Window > mpFocusWin
Definition: svdata.hxx:255
VclPtr< vcl::Window > mpCaptureWin
Definition: svdata.hxx:256
VclPtr< vcl::Window > mpTrackWin
Definition: svdata.hxx:261
ImplSchedulerData * mpFirstSchedulerData[PRIO_COUNT]
list of all active tasks per priority
Definition: svdata.hxx:375
ImplSchedulerData * mpNext
Pointer to the next element in list.
bool mbInScheduler
Is the Task currently processed / on the stack?
Task * mpTask
Pointer to VCL Task instance.
sal_uInt16 mnButton
Definition: salwtype.hxx:117
@ hwUI
Definition: svapp.cxx:1242
@ hwAll
Definition: svapp.cxx:1242
@ hwEnv
Definition: svapp.cxx:1242
IMPL_LINK_NOARG(ImplSVAppData, VclEventTestingHdl, Timer *, void)
Definition: svapp.cxx:387
Application * GetpApp()
Definition: svapp.cxx:152
static bool bEventTestingMode
Definition: svapp.cxx:1679
vcl::KeyCode const ReservedKeys[]
Definition: svapp.cxx:90
static bool ImplYield(bool i_bWait, bool i_bAllEvents)
Definition: svapp.cxx:461
bool InitAccessBridge()
Definition: svapp.cxx:1731
SAL_DLLPUBLIC_EXPORT void unit_lok_process_events_to_idle()
used by unit tests that test only via the LOK API
Definition: svapp.cxx:544
UnoWrapperBase *(* FN_TkCreateUnoWrapper)()
Definition: svapp.cxx:120
IMPL_STATIC_LINK_NOARG(ImplSVAppData, ImplEndAllPopupsMsg, void *, void)
Definition: svapp.cxx:291
static bool bSafeMode
Definition: svapp.cxx:1691
static OUString Localize(TranslateId aId, const bool bLocalize)
Definition: svapp.cxx:1244
static void thisModule()
Definition: svapp.cxx:1588
IMPL_STATIC_LINK(Application, PostEventHandler, void *, pCallData, void)
Definition: svapp.cxx:1034
DialogCancelMode
Definition: svapp.hxx:212
@ Silent
silently cancel any dialogs
@ Fatal
cancel any dialogs by std::abort
@ Off
do not automatically cancel dialogs
SystemWindowFlags
Definition: svapp.hxx:87
SalSystem * ImplGetSalSystem()
Definition: svdata.cxx:80
ImplSVData * ImplGetSVData()
Definition: svdata.cxx:76
void ImplDeInitSVData()
Definition: svdata.cxx:88
vcl::Window * ImplGetDefaultWindow()
Returns either the application window, or the default GL context window.
Definition: svdata.cxx:211
OUString VclResId(TranslateId aId)
Definition: svdata.cxx:260
#define PRIO_COUNT
Definition: task.hxx:40
@ HIGH_IDLE
Important idle events to be run before processing drawing events.
TOOLKIT_DLLPUBLIC UnoWrapperBase * CreateUnoWrapper()
VclEventId
Definition: vclevent.hxx:38
@ WindowMouseButtonDown
@ WindowGestureEvent
@ ApplicationDataChanged
@ WindowMouseButtonUp
MouseEventModifiers ImplGetMouseButtonMode(SalMouseEvent const *pEvent)
Definition: winproc.cxx:2306
MouseEventModifiers ImplGetMouseMoveMode(SalMouseEvent const *pEvent)
Definition: winproc.cxx:2294
bool ImplLOKHandleMouseEvent(const VclPtr< vcl::Window > &xWindow, NotifyEventType nEvent, bool, tools::Long nX, tools::Long nY, sal_uInt64, sal_uInt16 nCode, MouseEventModifiers nMode, sal_uInt16 nClicks)
Definition: winproc.cxx:808
bool ImplWindowFrameProc(vcl::Window *_pWindow, SalEvent nEvent, const void *pEvent)
Definition: winproc.cxx:2653
WinBits const WB_INTROWIN
Definition: wintypes.hxx:170