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