QGIS API Documentation 3.36.0-Maidenhead (09951dc0acf)
Loading...
Searching...
No Matches
qgsapplication.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsapplication.h - Accessors for application-wide data
3 --------------------------------------
4 Date : 02-Jan-2006
5 Copyright : (C) 2006 by Tom Elwertowski
6 Email : telwertowski at users dot sourceforge dot net
7 ***************************************************************************
8 * *
9 * This program is free software; you can redistribute it and/or modify *
10 * it under the terms of the GNU General Public License as published by *
11 * the Free Software Foundation; either version 2 of the License, or *
12 * (at your option) any later version. *
13 * *
14 ***************************************************************************/
15#ifndef QGSAPPLICATION_H
16#define QGSAPPLICATION_H
17
18#include "qgis_core.h"
19#include <QApplication>
20#include <QEvent>
21#include <QStringList>
22#include <QColor>
23
24#include <memory>
25#include "qgis_sip.h"
26#include "qgsconfig.h"
29
35class QgsTaskManager;
44class QgsSvgCache;
45class QgsImageCache;
46class QgsSourceCache;
54class QgsMessageLog;
56class QgsAnnotationRegistry;
57class QgsUserProfile;
61class QgsAuthManager;
64class QTranslator;
67class QgsStyleModel;
78class QgsFontManager;
80
95class CORE_EXPORT QgsApplication : public QApplication
96{
97
98#ifdef SIP_RUN
99 % TypeCode
100 // Convert a Python argv list to a conventional C argc count and argv array.
101 static char **qtgui_ArgvToC( PyObject *argvlist, int &argc )
102 {
103 char **argv;
104
105 argc = PyList_GET_SIZE( argvlist );
106
107 // Allocate space for two copies of the argument pointers, plus the
108 // terminating NULL.
109 if ( ( argv = ( char ** )sipMalloc( 2 * ( argc + 1 ) * sizeof( char * ) ) ) == NULL )
110 return NULL;
111
112 // Convert the list.
113 for ( int a = 0; a < argc; ++a )
114 {
115 char *arg;
116 // Get the argument and allocate memory for it.
117 if ( ( arg = PyBytes_AsString( PyList_GET_ITEM( argvlist, a ) ) ) == NULL ||
118 ( argv[a] = ( char * )sipMalloc( strlen( arg ) + 1 ) ) == NULL )
119 return NULL;
120 // Copy the argument and save a pointer to it.
121 strcpy( argv[a], arg );
122 argv[a + argc + 1] = argv[a];
123 }
124
125 argv[argc + argc + 1] = argv[argc] = NULL;
126
127 return argv;
128 }
129
130 // Remove arguments from the Python argv list that have been removed from the
131 // C argv array.
132 static void qtgui_UpdatePyArgv( PyObject *argvlist, int argc, char **argv )
133 {
134 for ( int a = 0, na = 0; a < argc; ++a )
135 {
136 // See if it was removed.
137 if ( argv[na] == argv[a + argc + 1] )
138 ++na;
139 else
140 PyList_SetSlice( argvlist, na, na + 1, NULL );
141 }
142 }
143 % End
144#endif
145
146 Q_OBJECT
147
148 public:
149
163
164 static const char *QGIS_ORGANIZATION_NAME;
165 static const char *QGIS_ORGANIZATION_DOMAIN;
166 static const char *QGIS_APPLICATION_NAME;
167#ifndef SIP_RUN
168
178 QgsApplication( int &argc, char **argv, bool GUIenabled, const QString &profileFolder = QString(), const QString &platformName = "external" );
179#else
180
189 QgsApplication( SIP_PYLIST argv, bool GUIenabled, QString profileFolder = QString(), QString platformName = "external" ) / PostHook = __pyQtQAppHook__ / [( int &argc, char **argv, bool GUIenabled, const QString &profileFolder = QString(), const QString &platformName = "desktop" )];
190 % MethodCode
191 // The Python interface is a list of argument strings that is modified.
192
193 int argc;
194 char **argv;
195
196 // Convert the list.
197 if ( ( argv = qtgui_ArgvToC( a0, argc ) ) == NULL )
198 sipIsErr = 1;
199 else
200 {
201 // Create it now the arguments are right.
202 static int nargc = argc;
203
204 sipCpp = new sipQgsApplication( nargc, argv, a1, *a2, *a3 );
205
206 // Now modify the original list.
207 qtgui_UpdatePyArgv( a0, argc, argv );
208 }
209 % End
210#endif
211
212 ~QgsApplication() override;
213
218 static QgsApplication *instance();
219
227 static void init( QString profileFolder = QString() ) SIP_SKIP;
228
230 bool event( QEvent *event ) override;
231
233 bool notify( QObject *receiver, QEvent *event ) override;
234
236 static void setFileOpenEventReceiver( QObject *receiver );
237
248 static void setThemeName( const QString &themeName );
249
254 static QString resolvePkgPath();
255
263 static QString themeName();
264
272 static void setUITheme( const QString &themeName );
273
280 static QHash<QString, QString> uiThemes();
281
283 static QString authorsFilePath();
284
290 static QString contributorsFilePath();
291
297 static QString developersMapFilePath();
298
300 static QString sponsorsFilePath();
301
303 static QString donorsFilePath();
304
306 static QString serverResourcesPath();
307
311 static QString translatorsFilePath();
312
316 static QString licenceFilePath();
317
319 static QString i18nPath();
320
324 static QString metadataPath();
325
327 static QString qgisMasterDatabaseFilePath();
328
330 static QString qgisSettingsDirPath();
331
333 static QString qgisUserDatabaseFilePath();
334
336 static QString qgisAuthDatabaseFilePath();
337
339 static QString splashPath();
340
342 static QString iconsPath();
343
345 static QString srsDatabaseFilePath();
346
352 static void setSvgPaths( const QStringList &svgPaths );
353
355 static QStringList svgPaths();
356
360 static QStringList layoutTemplatePaths();
361
363 static QMap<QString, QString> systemEnvVars();
364
366 static QString prefixPath();
367
369 static QString pluginPath();
370
372 static QString pkgDataPath();
373
375 static QString activeThemePath();
376
378 static QString defaultThemePath();
379
384 static QString iconPath( const QString &iconFile );
385
393 static QIcon getThemeIcon( const QString &name, const QColor &fillColor = QColor(), const QColor &strokeColor = QColor() );
394
409
416 static QCursor getThemeCursor( Cursor cursor );
417
426 static QPixmap getThemePixmap( const QString &name, const QColor &foreColor = QColor(), const QColor &backColor = QColor(), int size = 16 );
427
429 static QString userStylePath();
430
436 static QRegularExpression shortNameRegularExpression();
437
442 static QString userLoginName();
443
448 static QString userFullName();
449
454 static QString osName();
455
463 static int systemMemorySizeMb();
464
469 static QString platform();
470
471
483 static QString applicationFullName();
484
488 static QString locale();
489
496 static void setLocale( const QLocale &locale );
497
499 static QString userThemesFolder();
500
502 static QString defaultStylePath();
503
505 static QString defaultThemesFolder();
506
508 static QString libraryPath();
509
511 static QString libexecPath();
512
519 static QString qmlImportPath();
520
522 static void setPrefixPath( const QString &prefixPath, bool useDefaultPaths = false );
523
525 static void setPluginPath( const QString &pluginPath );
526
528 static void setPkgDataPath( const QString &pkgDataPath );
529
531 static void setDefaultSvgPaths( const QStringList &pathList );
532
534 static void setAuthDatabaseDirPath( const QString &authDbDirPath );
535
537 static void initQgis();
538
540 static bool createDatabase( QString *errorMessage = nullptr );
541
543 static bool createThemeFolder();
544
546 static void exitQgis();
547
549 static QString appIconPath();
550
553 {
554 XDR = 0, // network, or big-endian, byte order
555 NDR = 1 // little-endian byte order
556 };
557
559 static endian_t endian();
560
575 static QString reportStyleSheet( QgsApplication::StyleSheetType styleSheetType = QgsApplication::StyleSheetType::Qt );
576
581 static QString showSettings();
582
590 static void registerOgrDrivers();
591
593 static QString absolutePathToRelativePath( const QString &apath, const QString &targetPath );
595 static QString relativePathToAbsolutePath( const QString &rpath, const QString &targetPath );
596
598 static bool isRunningFromBuildDir() { return ABISYM( mRunningFromBuildDir ); }
599#if defined(_MSC_VER) && !defined(USING_NMAKE) && !defined(USING_NINJA)
600 static QString cfgIntDir() SIP_SKIP;
601#endif
603 static QString buildSourcePath();
605 static QString buildOutputPath();
606
612 static void skipGdalDriver( const QString &driver );
613
619 static void restoreGdalDriver( const QString &driver );
620
625 static QStringList skippedGdalDrivers();
626
633 static void applyGdalSkippedDrivers();
634
639 static void registerGdalDriversFromSettings();
640
647 static QStringList deferredSkippedGdalDrivers();
648
655 static void setSkippedGdalDrivers( const QStringList &skippedGdalDrivers,
656 const QStringList &deferredSkippedGdalDrivers );
657
661 static int maxThreads();
662
667 static void setMaxThreads( int maxThreads );
668
673 static QgsTaskManager *taskManager();
674
680 Q_DECL_DEPRECATED static QgsSettingsRegistryCore *settingsRegistryCore() SIP_KEEPREFERENCE SIP_DEPRECATED;
681
685 static QgsColorSchemeRegistry *colorSchemeRegistry() SIP_KEEPREFERENCE;
686
690 static QgsPaintEffectRegistry *paintEffectRegistry() SIP_KEEPREFERENCE;
691
695 static QgsRendererRegistry *rendererRegistry() SIP_KEEPREFERENCE;
696
701 static QgsRasterRendererRegistry *rasterRendererRegistry() SIP_SKIP;
702
707 static QgsPointCloudRendererRegistry *pointCloudRendererRegistry() SIP_KEEPREFERENCE;
708
713 static QgsTiledSceneRendererRegistry *tiledSceneRendererRegistry() SIP_KEEPREFERENCE;
714
719 static QgsDataItemProviderRegistry *dataItemProviderRegistry() SIP_KEEPREFERENCE;
720
727 static QgsCoordinateReferenceSystemRegistry *coordinateReferenceSystemRegistry() SIP_KEEPREFERENCE;
728
735 static QgsSvgCache *svgCache();
736
743 static QgsImageCache *imageCache();
744
750 static QgsSourceCache *sourceCache();
751
756 static QgsNetworkContentFetcherRegistry *networkContentFetcherRegistry() SIP_KEEPREFERENCE;
757
762 static QgsValidityCheckRegistry *validityCheckRegistry() SIP_KEEPREFERENCE;
763
767 static QgsSymbolLayerRegistry *symbolLayerRegistry() SIP_KEEPREFERENCE;
768
773 static QgsCalloutRegistry *calloutRegistry() SIP_KEEPREFERENCE;
774
778 static QgsLayoutItemRegistry *layoutItemRegistry() SIP_KEEPREFERENCE;
779
784 static QgsAnnotationItemRegistry *annotationItemRegistry() SIP_KEEPREFERENCE;
785
789 static QgsGpsConnectionRegistry *gpsConnectionRegistry() SIP_KEEPREFERENCE;
790
795 static QgsBabelFormatRegistry *gpsBabelFormatRegistry() SIP_KEEPREFERENCE;
796
800 static QgsPluginLayerRegistry *pluginLayerRegistry() SIP_KEEPREFERENCE;
801
806 static QgsClassificationMethodRegistry *classificationMethodRegistry() SIP_KEEPREFERENCE;
807
812 static QgsBookmarkManager *bookmarkManager();
813
819 static QgsTileDownloadManager *tileDownloadManager() SIP_SKIP;
820
825 static QgsRecentStyleHandler *recentStyleHandler() SIP_KEEPREFERENCE;
826
832 static QgsDatabaseQueryLog *databaseQueryLog() SIP_KEEPREFERENCE;
833
841 static QgsStyleModel *defaultStyleModel();
842
848 static QgsFontManager *fontManager() SIP_KEEPREFERENCE;
849
854 static QgsSensorRegistry *sensorRegistry() SIP_KEEPREFERENCE;
855
859 static QgsMessageLog *messageLog();
860
866 static QgsAuthManager *authManager();
867
872 static QgsProcessingRegistry *processingRegistry();
873
877 static QgsPageSizeRegistry *pageSizeRegistry() SIP_KEEPREFERENCE;
878
883 static QgsAnnotationRegistry *annotationRegistry() SIP_SKIP;
884
889 static QgsActionScopeRegistry *actionScopeRegistry() SIP_KEEPREFERENCE;
890
895 static QgsConnectionRegistry *connectionRegistry();
896
900 static QgsRuntimeProfiler *profiler();
901
907 static QgsNumericFormatRegistry *numericFormatRegistry() SIP_KEEPREFERENCE;
908
912 static QgsFieldFormatterRegistry *fieldFormatterRegistry() SIP_KEEPREFERENCE;
913
917 static Qgs3DRendererRegistry *renderer3DRegistry() SIP_KEEPREFERENCE;
918
923 static Qgs3DSymbolRegistry *symbol3DRegistry() SIP_KEEPREFERENCE;
924
930 static QgsScaleBarRendererRegistry *scaleBarRendererRegistry() SIP_KEEPREFERENCE;
931
936 static QgsProjectStorageRegistry *projectStorageRegistry() SIP_KEEPREFERENCE;
937
942 static QgsLayerMetadataProviderRegistry *layerMetadataProviderRegistry() SIP_KEEPREFERENCE;
943
948 static QgsExternalStorageRegistry *externalStorageRegistry() SIP_KEEPREFERENCE;
949
957 static QgsLocalizedDataPathRegistry *localizedDataPathRegistry() SIP_KEEPREFERENCE;
958
967 static QString nullRepresentation();
968
972 static void setNullRepresentation( const QString &nullRepresentation );
973
980 static QVariantMap customVariables();
981
988 static void setCustomVariables( const QVariantMap &customVariables );
989
994 static void setCustomVariable( const QString &name, const QVariant &value );
995
1005 static int scaleIconSize( int standardSize, bool applyDevicePixelRatio = false );
1006
1015 int maxConcurrentConnectionsPerPool() const;
1016
1022 static void setTranslation( const QString &translation );
1023
1029 QString translation() const;
1030
1036 void collectTranslatableObjects( QgsTranslationContext *translationContext );
1037
1038
1039#ifndef SIP_RUN
1050#endif
1051
1052#ifdef SIP_RUN
1053 SIP_IF_FEATURE( ANDROID )
1054 //dummy method to workaround sip generation issue
1055 bool x11EventFilter( XEvent *event );
1056 SIP_END
1057#endif
1058
1059 signals:
1061 void preNotify( QObject *receiver, QEvent *event, bool *done ) SIP_SKIP;
1062
1067
1068
1073
1081
1082
1089
1090
1091 private:
1092
1093 static void copyPath( const QString &src, const QString &dst );
1094 static QObject *ABISYM( mFileOpenEventReceiver );
1095
1096 static bool ABISYM( mInitialized );
1097
1099 static bool ABISYM( mRunningFromBuildDir );
1100
1103 static int ABISYM( sMaxThreads );
1104
1105 QMap<QString, QIcon> mIconCache;
1106 QMap<Cursor, QCursor> mCursorCache;
1107
1108 QTranslator *mQgisTranslator = nullptr;
1109 QTranslator *mQtTranslator = nullptr;
1110 QTranslator *mQtBaseTranslator = nullptr;
1111
1112 QgsDataItemProviderRegistry *mDataItemProviderRegistry = nullptr;
1113 QgsAuthManager *mAuthManager = nullptr;
1114
1115 struct ApplicationMembers
1116 {
1117 QgsSettingsRegistryCore *mSettingsRegistryCore = nullptr;
1118 QgsCoordinateReferenceSystemRegistry *mCrsRegistry = nullptr;
1119 Qgs3DRendererRegistry *m3DRendererRegistry = nullptr;
1120 Qgs3DSymbolRegistry *m3DSymbolRegistry = nullptr;
1121 QgsActionScopeRegistry *mActionScopeRegistry = nullptr;
1122 QgsAnnotationRegistry *mAnnotationRegistry = nullptr;
1123 QgsColorSchemeRegistry *mColorSchemeRegistry = nullptr;
1124 QgsLocalizedDataPathRegistry *mLocalizedDataPathRegistry = nullptr;
1125 QgsNumericFormatRegistry *mNumericFormatRegistry = nullptr;
1126 QgsFieldFormatterRegistry *mFieldFormatterRegistry = nullptr;
1127 QgsGpsConnectionRegistry *mGpsConnectionRegistry = nullptr;
1128 QgsBabelFormatRegistry *mGpsBabelFormatRegistry = nullptr;
1129 QgsNetworkContentFetcherRegistry *mNetworkContentFetcherRegistry = nullptr;
1130 QgsScaleBarRendererRegistry *mScaleBarRendererRegistry = nullptr;
1131 QgsValidityCheckRegistry *mValidityCheckRegistry = nullptr;
1132 QgsMessageLog *mMessageLog = nullptr;
1133 QgsPaintEffectRegistry *mPaintEffectRegistry = nullptr;
1134 QgsPluginLayerRegistry *mPluginLayerRegistry = nullptr;
1135 QgsClassificationMethodRegistry *mClassificationMethodRegistry = nullptr;
1136 QgsProcessingRegistry *mProcessingRegistry = nullptr;
1137 QgsConnectionRegistry *mConnectionRegistry = nullptr;
1138 QgsProjectStorageRegistry *mProjectStorageRegistry = nullptr;
1139 QgsLayerMetadataProviderRegistry *mLayerMetadataProviderRegistry = nullptr;
1140 QgsExternalStorageRegistry *mExternalStorageRegistry = nullptr;
1141 QgsPageSizeRegistry *mPageSizeRegistry = nullptr;
1142 QgsRasterRendererRegistry *mRasterRendererRegistry = nullptr;
1143 QgsRendererRegistry *mRendererRegistry = nullptr;
1144 QgsPointCloudRendererRegistry *mPointCloudRendererRegistry = nullptr;
1145 QgsTiledSceneRendererRegistry *mTiledSceneRendererRegistry = nullptr;
1146 QgsSvgCache *mSvgCache = nullptr;
1147 QgsImageCache *mImageCache = nullptr;
1148 QgsSourceCache *mSourceCache = nullptr;
1149 QgsSymbolLayerRegistry *mSymbolLayerRegistry = nullptr;
1150 QgsCalloutRegistry *mCalloutRegistry = nullptr;
1151 QgsTaskManager *mTaskManager = nullptr;
1152 QgsLayoutItemRegistry *mLayoutItemRegistry = nullptr;
1153 QgsAnnotationItemRegistry *mAnnotationItemRegistry = nullptr;
1154 QgsSensorRegistry *mSensorRegistry = nullptr;
1155 QgsUserProfileManager *mUserConfigManager = nullptr;
1156 QgsBookmarkManager *mBookmarkManager = nullptr;
1157 QgsTileDownloadManager *mTileDownloadManager = nullptr;
1158 QgsStyleModel *mStyleModel = nullptr;
1159 QgsRecentStyleHandler *mRecentStyleHandler = nullptr;
1160 QgsDatabaseQueryLog *mQueryLogger = nullptr;
1161 QgsFontManager *mFontManager;
1162 QString mNullRepresentation;
1163 QStringList mSvgPathCache;
1164 bool mSvgPathCacheValid = false;
1165
1166 ApplicationMembers();
1167 ~ApplicationMembers();
1168 };
1169
1170 // Applications members which belong to an instance of QgsApplication
1171 ApplicationMembers *mApplicationMembers = nullptr;
1172 // ... but in case QgsApplication is never instantiated (eg with custom designer widgets), we fall back to static members
1173 static ApplicationMembers *sApplicationMembers;
1174
1175 static QgsAuthManager *sAuthManager;
1176
1177 static ApplicationMembers *members();
1178
1179 static void invalidateCaches();
1180
1185 void installTranslators() SIP_SKIP;
1186
1187 friend class TestQgsApplication;
1188};
1189
1190// clazy:excludeall=qstring-allocations
1191
1192#endif
Keeps track of available 3D renderers.
Registry of available 3D symbol classes.
The action scope registry is an application wide registry that contains a list of available action sc...
Registry of available annotation item types.
Extends QApplication to provide access to QGIS specific resources such as theme paths,...
endian_t
Constants for endian-ness.
static const QgsSettingsEntryStringList * settingsSearchPathsForSVG
Settings entry search path for SVG.
static const QgsSettingsEntryBool * settingsLocaleOverrideFlag
Settings entry locale override flag.
void customVariablesChanged()
Emitted whenever a custom global variable changes.
StyleSheetType
The StyleSheetType enum represents the stylesheet type that a widget supports.
@ WebBrowser
StyleSheet for Qt GUI widgets (based on QLabel or QTextBrowser), supports basic CSS and Qt extensions...
static const QgsSettingsEntryString * settingsLocaleGlobalLocale
Settings entry locale global locale.
static const QgsSettingsEntryString * settingsLocaleUserLocale
Settings entry locale user locale.
static const char * QGIS_APPLICATION_NAME
static const char * QGIS_ORGANIZATION_DOMAIN
void preNotify(QObject *receiver, QEvent *event, bool *done)
void localeChanged()
Emitted when project locale has been changed.
static const char * QGIS_ORGANIZATION_NAME
Cursor
The Cursor enum defines constants for QGIS custom cursors.
@ ZoomOut
Zoom out.
@ CrossHair
Precisely identify a point on the canvas.
@ Identify
Identify: obtain information about the object.
@ Select
Select a rectangle.
@ CapturePoint
Select and capture a point or a feature.
@ Sampler
Color/Value picker.
void requestForTranslatableObjects(QgsTranslationContext *translationContext)
Emitted when project strings which require translation are being collected for inclusion in a ....
void nullRepresentationChanged()
This string is used to represent the value NULL throughout QGIS.
static const QgsSettingsEntryBool * settingsLocaleShowGroupSeparator
Settings entry locale show group separator.
static bool isRunningFromBuildDir()
Indicates whether running from build directory (not installed)
Singleton offering an interface to manage the authentication configuration database and to utilize co...
A registry for QgsAbstractBabelFormat GPSBabel formats.
Manages storage of a set of bookmarks.
Registry of available callout classes.
This class manages all known classification methods.
Registry of color schemes.
A registry for saved data provider connections, allowing retrieval of saved connections by name and p...
A registry for known coordinate reference system (CRS) definitions, including any user-defined CRSes.
This class keeps a list of data item providers that may add items to the browser tree.
Handles logging of database queries.
Registry of external storage backends used by QgsExternalResourceWidget.
The QgsFieldFormatterRegistry manages registered classes of QgsFieldFormatter.
Manages available fonts and font installation for a QGIS instance.
A class to register / unregister existing GPS connections such that the information is available to a...
A cache for images derived from raster files.
Registry of layer metadata provider backends.
Registry of available layout item types.
A registry class to hold localized data paths which can be used for basemaps, logos,...
Interface for logging messages from QGIS in GUI independent way.
Registry for temporary fetched files.
The QgsNumericFormatRegistry manages registered classes of QgsNumericFormat.
A registry for known page sizes.
Registry of available paint effects.
A registry of plugin layers types.
Registry of 2D renderers for point clouds.
Registry for various processing components, including providers, algorithms and various parameters an...
Registry of storage backends that QgsProject may use.
Registry for raster renderers.
Handles and tracks style items recently used in the QGIS GUI.
Registry of renderers.
Provides a method of recording run time profiles of operations, allowing easy recording of their over...
The QgsScaleBarRendererRegistry manages registered scalebar renderers.
Registry of available sensor types.
A boolean settings entry.
A string list settings entry.
A string settings entry.
QgsSettingsRegistryCore is used for settings introspection and collects all QgsSettingsEntry instance...
A cache for source strings that returns a local file path containing the source content.
A QAbstractItemModel subclass for showing symbol and color ramp entities contained within a QgsStyle ...
A cache for images / pictures derived from SVG files.
Registry of available symbol layer classes.
Task manager for managing a set of long-running QgsTask tasks.
Tile download manager handles downloads of map tiles for the purpose of map rendering.
Registry of 2D renderers for tiled scenes.
Used for the collecting of strings from projects for translation and creation of ts files.
User profile manager is used to manager list, and manage user profiles on the users machine.
User profile contains information about the user profile folders on the machine.
This class keeps a list of QgsAbstractValidityCheck checks which can be used when performing validity...
#define SIP_DEPRECATED
Definition qgis_sip.h:106
#define SIP_KEEPREFERENCE
Definition qgis_sip.h:86
#define SIP_SKIP
Definition qgis_sip.h:126
#define SIP_IF_FEATURE(feature)
Definition qgis_sip.h:181
#define SIP_END
Definition qgis_sip.h:208
QObject * ABISYM(QgsApplication::mFileOpenEventReceiver)