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