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