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