diff options
-rw-r--r-- | vcl/inc/svdata.hxx | 229 | ||||
-rw-r--r-- | vcl/source/app/svapp.cxx | 22 | ||||
-rw-r--r-- | vcl/source/app/svdata.cxx | 10 |
3 files changed, 126 insertions, 135 deletions
diff --git a/vcl/inc/svdata.hxx b/vcl/inc/svdata.hxx index c82bace99b0b..ded416e534e7 100644 --- a/vcl/inc/svdata.hxx +++ b/vcl/inc/svdata.hxx @@ -34,9 +34,11 @@ #include "salwtype.hxx" #include "displayconnectiondispatch.hxx" +#include <list> #include <unordered_map> #include <boost/functional/hash.hpp> +struct ImplPostEventData; struct ImplTimerData; struct ImplIdleData; struct ImplConfigData; @@ -97,6 +99,8 @@ public: typedef std::vector<Link<VclWindowEvent&,bool> > SVAppKeyListeners; +typedef std::pair<VclPtr<vcl::Window>, ImplPostEventData *> ImplPostEventPair; + struct ImplSVAppData { enum ImeStatusWindowMode @@ -106,40 +110,41 @@ struct ImplSVAppData ImeStatusWindowMode_SHOW }; - AllSettings* mpSettings; // Application settings - LocaleConfigurationListener* mpCfgListener; - VclEventListeners* mpEventListeners; // listeners for vcl events (eg, extended toolkit) - SVAppKeyListeners* mpKeyListeners; // listeners for key events only (eg, extended toolkit) - ImplAccelManager* mpAccelMgr; // Accelerator Manager - OUString* mpAppName; // Application name - OUString* mpAppFileName; // Abs. Application FileName - OUString* mpDisplayName; // Application Display Name - OUString* mpToolkitName; // Toolkit Name - Help* mpHelp; // Application help + AllSettings* mpSettings = nullptr; // Application settings + LocaleConfigurationListener* mpCfgListener = nullptr; + VclEventListeners* mpEventListeners = nullptr; // listeners for vcl events (eg, extended toolkit) + SVAppKeyListeners* mpKeyListeners = nullptr; // listeners for key events only (eg, extended toolkit) + std::list<ImplPostEventPair> maPostedEventList; + ImplAccelManager* mpAccelMgr = nullptr; // Accelerator Manager + OUString* mpAppName = nullptr; // Application name + OUString* mpAppFileName = nullptr; // Abs. Application FileName + OUString* mpDisplayName = nullptr; // Application Display Name + OUString* mpToolkitName = nullptr; // Toolkit Name + Help* mpHelp = nullptr; // Application help VclPtr<PopupMenu> mpActivePopupMenu; // Actives Popup-Menu (in Execute) VclPtr<ImplWheelWindow> mpWheelWindow; // WheelWindow - ImplHotKey* mpFirstHotKey; // HotKey-Verwaltung - ImplEventHook* mpFirstEventHook; // Event-Hooks - sal_uInt64 mnLastInputTime; // GetLastInputTime() - sal_uInt16 mnDispatchLevel; // DispatchLevel - sal_uInt16 mnModalMode; // ModalMode Count - SystemWindowFlags mnSysWinMode; // Mode, when SystemWindows should be created - bool mbInAppMain; // is Application::Main() on stack - bool mbInAppExecute; // is Application::Execute() on stack - bool mbAppQuit; // is Application::Quit() called - bool mbSettingsInit; // true: Settings are initialized - Application::DialogCancelMode meDialogCancel; // true: All Dialog::Execute() calls will be terminated immediately with return false + ImplHotKey* mpFirstHotKey = nullptr; // HotKey-Verwaltung + ImplEventHook* mpFirstEventHook = nullptr; // Event-Hooks + sal_uInt64 mnLastInputTime = 0; // GetLastInputTime() + sal_uInt16 mnDispatchLevel = 0; // DispatchLevel + sal_uInt16 mnModalMode = 0; // ModalMode Count + SystemWindowFlags mnSysWinMode = SystemWindowFlags(0); // Mode, when SystemWindows should be created + bool mbInAppMain = false; // is Application::Main() on stack + bool mbInAppExecute = false; // is Application::Execute() on stack + bool mbAppQuit = false; // is Application::Quit() called + bool mbSettingsInit = false; // true: Settings are initialized + Application::DialogCancelMode meDialogCancel = Application::DialogCancelMode::Off; // true: All Dialog::Execute() calls will be terminated immediately with return false /** Controls whether showing any IME status window is toggled on or off. Only meaningful if showing IME status windows can be toggled on and off externally (see Application::CanToggleImeStatusWindow). */ - ImeStatusWindowMode meShowImeStatusWindow; + ImeStatusWindowMode meShowImeStatusWindow = ImeStatusWindowMode_UNKNOWN; - SvFileStream* mpEventTestInput; - Idle* mpEventTestingIdle; - int mnEventTestLimit; + SvFileStream* mpEventTestInput = nullptr; + Idle* mpEventTestingIdle = nullptr; + int mnEventTestLimit = 0; DECL_STATIC_LINK(ImplSVAppData, ImplQuitMsg, void*, void); DECL_STATIC_LINK(ImplSVAppData, ImplPrepareExitMsg, void*, void); @@ -161,19 +166,19 @@ struct ImplSVGDIData VclPtr<OutputDevice> mpLastPrnGraphics; // Last OutputDevice with a InfoPrinter Graphics VclPtr<VirtualDevice> mpFirstVirDev; // First VirtualDevice VclPtr<VirtualDevice> mpLastVirDev; // Last VirtualDevice - OpenGLContext* mpFirstContext; // First OpenGLContext - OpenGLContext* mpLastContext; // Last OpenGLContext + OpenGLContext* mpFirstContext = nullptr; // First OpenGLContext + OpenGLContext* mpLastContext = nullptr; // Last OpenGLContext VclPtr<Printer> mpFirstPrinter; // First Printer VclPtr<Printer> mpLastPrinter; // Last Printer - ImplPrnQueueList* mpPrinterQueueList; // List of all printer queue - PhysicalFontCollection* mpScreenFontList; // Screen-Font-List - ImplFontCache* mpScreenFontCache; // Screen-Font-Cache - ImplDirectFontSubstitution* mpDirectFontSubst; // Font-Substitutons defined in Tools->Options->Fonts - GraphicConverter* mpGrfConverter; // Converter for graphics - long mnAppFontX; // AppFont X-Numenator for 40/tel Width - long mnAppFontY; // AppFont Y-Numenator for 80/tel Height - bool mbFontSubChanged; // true: FontSubstitution was changed between Begin/End - bool mbNativeFontConfig; // true: do not override UI font + ImplPrnQueueList* mpPrinterQueueList = nullptr; // List of all printer queue + PhysicalFontCollection* mpScreenFontList = nullptr; // Screen-Font-List + ImplFontCache* mpScreenFontCache = nullptr; // Screen-Font-Cache + ImplDirectFontSubstitution* mpDirectFontSubst = nullptr; // Font-Substitutons defined in Tools->Options->Fonts + GraphicConverter* mpGrfConverter = nullptr; // Converter for graphics + long mnAppFontX = 0; // AppFont X-Numenator for 40/tel Width + long mnAppFontY = 0; // AppFont Y-Numenator for 80/tel Height + bool mbFontSubChanged = false; // true: FontSubstitution was changed between Begin/End + bool mbNativeFontConfig = false; // true: do not override UI font }; struct ImplSVWinData @@ -188,56 +193,56 @@ struct ImplSVWinData VclPtr<Dialog> mpLastExecuteDlg; // First Dialog that is in Execute VclPtr<vcl::Window> mpExtTextInputWin; // Window, which is in ExtTextInput VclPtr<vcl::Window> mpTrackWin; // window, that is in tracking mode - AutoTimer* mpTrackTimer; // tracking timer - ImageList* mpMsgBoxImgList; // ImageList for MessageBox + AutoTimer* mpTrackTimer = nullptr; // tracking timer + ImageList* mpMsgBoxImgList = nullptr; // ImageList for MessageBox VclPtr<vcl::Window> mpAutoScrollWin; // window, that is in AutoScrollMode mode VclPtr<vcl::Window> mpLastWheelWindow; // window, that last received a mouse wheel event SalWheelMouseEvent maLastWheelEvent; // the last received mouse whell event - StartTrackingFlags mnTrackFlags; // tracking flags - StartAutoScrollFlags mnAutoScrollFlags; // auto scroll flags - bool mbNoDeactivate; // true: do not execute Deactivate - bool mbNoSaveFocus; // true: menus must not save/restore focus + StartTrackingFlags mnTrackFlags = StartTrackingFlags::NONE; // tracking flags + StartAutoScrollFlags mnAutoScrollFlags = StartAutoScrollFlags::NONE; // auto scroll flags + bool mbNoDeactivate = false; // true: do not execute Deactivate + bool mbNoSaveFocus = false; // true: menus must not save/restore focus }; typedef std::vector< std::pair< OUString, FieldUnit > > FieldUnitStringList; struct ImplSVCtrlData { - ImageList* mpCheckImgList; // ImageList for CheckBoxes - ImageList* mpRadioImgList; // ImageList for RadioButtons - ImageList* mpPinImgList; // ImageList for PIN - ImageList* mpSplitHPinImgList; // ImageList for Horizontale SplitWindows - ImageList* mpSplitVPinImgList; // ImageList for Vertikale SplitWindows (PIN's) - Image* mpDisclosurePlus; - Image* mpDisclosureMinus; - ImplTBDragMgr* mpTBDragMgr; // DragMgr for ToolBox - sal_uInt16 mnCheckStyle; // CheckBox-Style for ImageList-Update - sal_uInt16 mnRadioStyle; // Radio-Style for ImageList-Update - sal_uLong mnLastCheckFColor; // Letzte FaceColor fuer CheckImage - sal_uLong mnLastCheckWColor; // Letzte WindowColor fuer CheckImage - sal_uLong mnLastCheckLColor; // Letzte LightColor fuer CheckImage - sal_uLong mnLastRadioFColor; // Letzte FaceColor fuer RadioImage - sal_uLong mnLastRadioWColor; // Letzte WindowColor fuer RadioImage - sal_uLong mnLastRadioLColor; // Letzte LightColor fuer RadioImage - FieldUnitStringList* mpFieldUnitStrings; // list with field units - FieldUnitStringList* mpCleanUnitStrings; // same list but with some "fluff" like spaces removed + ImageList* mpCheckImgList = nullptr; // ImageList for CheckBoxes + ImageList* mpRadioImgList = nullptr; // ImageList for RadioButtons + ImageList* mpPinImgList = nullptr; // ImageList for PIN + ImageList* mpSplitHPinImgList = nullptr; // ImageList for Horizontale SplitWindows + ImageList* mpSplitVPinImgList = nullptr; // ImageList for Vertikale SplitWindows (PIN's) + Image* mpDisclosurePlus = nullptr; + Image* mpDisclosureMinus = nullptr; + ImplTBDragMgr* mpTBDragMgr = nullptr; // DragMgr for ToolBox + sal_uInt16 mnCheckStyle = 0; // CheckBox-Style for ImageList-Update + sal_uInt16 mnRadioStyle = 0; // Radio-Style for ImageList-Update + sal_uLong mnLastCheckFColor = 0; // Letzte FaceColor fuer CheckImage + sal_uLong mnLastCheckWColor = 0; // Letzte WindowColor fuer CheckImage + sal_uLong mnLastCheckLColor = 0; // Letzte LightColor fuer CheckImage + sal_uLong mnLastRadioFColor = 0; // Letzte FaceColor fuer RadioImage + sal_uLong mnLastRadioWColor = 0; // Letzte WindowColor fuer RadioImage + sal_uLong mnLastRadioLColor = 0; // Letzte LightColor fuer RadioImage + FieldUnitStringList* mpFieldUnitStrings = nullptr; // list with field units + FieldUnitStringList* mpCleanUnitStrings = nullptr; // same list but with some "fluff" like spaces removed }; struct ImplSVHelpData { - bool mbContextHelp; // is ContextHelp enabled - bool mbExtHelp; // is ExtendedHelp enabled - bool mbExtHelpMode; // is in ExtendedHelp Mode - bool mbOldBalloonMode; // BalloonMode, before ExtHelpMode started - bool mbBalloonHelp; // is BalloonHelp enabled - bool mbQuickHelp; // is QuickHelp enabled - bool mbSetKeyboardHelp; // tiphelp was activated by keyboard - bool mbKeyboardHelp; // tiphelp was activated by keyboard - bool mbAutoHelpId; // generate HelpIds - bool mbRequestingHelp; // In Window::RequestHelp + bool mbContextHelp = false; // is ContextHelp enabled + bool mbExtHelp = false; // is ExtendedHelp enabled + bool mbExtHelpMode = false; // is in ExtendedHelp Mode + bool mbOldBalloonMode = false; // BalloonMode, before ExtHelpMode started + bool mbBalloonHelp = false; // is BalloonHelp enabled + bool mbQuickHelp = false; // is QuickHelp enabled + bool mbSetKeyboardHelp = false; // tiphelp was activated by keyboard + bool mbKeyboardHelp = false; // tiphelp was activated by keyboard + bool mbAutoHelpId = true; // generate HelpIds + bool mbRequestingHelp = false; // In Window::RequestHelp VclPtr<HelpTextWindow> mpHelpWin; // HelpWindow - sal_uInt64 mnLastHelpHideTime; // ticks of last show + sal_uInt64 mnLastHelpHideTime = 0; // ticks of last show }; // "NWF" means "Native Widget Framework" and was the term used for the @@ -247,38 +252,38 @@ struct ImplSVHelpData struct ImplSVNWFData { - int mnStatusBarLowerRightOffset; // amount in pixel to avoid in the lower righthand corner - int mnMenuFormatBorderX; // horizontal inner popup menu border - int mnMenuFormatBorderY; // vertical inner popup menu border - int mnMenuSeparatorBorderX; // gap at each side of separator - ::Color maMenuBarHighlightTextColor; // override higlight text color + int mnStatusBarLowerRightOffset = 0; // amount in pixel to avoid in the lower righthand corner + int mnMenuFormatBorderX = 0; // horizontal inner popup menu border + int mnMenuFormatBorderY = 0; // vertical inner popup menu border + int mnMenuSeparatorBorderX = 0; // gap at each side of separator + ::Color maMenuBarHighlightTextColor = Color( COL_TRANSPARENT ); // override higlight text color // in menubar if not transparent - bool mbMenuBarDockingAreaCommonBG; // e.g. WinXP default theme - bool mbDockingAreaSeparateTB; // individual toolbar backgrounds + bool mbMenuBarDockingAreaCommonBG = false; // e.g. WinXP default theme + bool mbDockingAreaSeparateTB = false; // individual toolbar backgrounds // instead of one for docking area - bool mbDockingAreaAvoidTBFrames; ///< don't draw frames around the individual toolbars if mbDockingAreaSeparateTB is false - bool mbToolboxDropDownSeparate; // two adjacent buttons for + bool mbDockingAreaAvoidTBFrames = false; ///< don't draw frames around the individual toolbars if mbDockingAreaSeparateTB is false + bool mbToolboxDropDownSeparate = false; // two adjacent buttons for // toolbox dropdown buttons - bool mbFlatMenu; // no popup 3D border - bool mbOpenMenuOnF10; // on gnome the first menu opens on F10 - bool mbNoFocusRects; // on Aqua/Gtk3 use native focus rendering, except for flat buttons - bool mbNoFocusRectsForFlatButtons; // on Gtk3 native focusing is also preferred for flat buttons - bool mbCenteredTabs; // on Aqua, tabs are centered - bool mbNoActiveTabTextRaise; // on Aqua the text for the selected tab + bool mbFlatMenu = false; // no popup 3D border + bool mbOpenMenuOnF10 = false; // on gnome the first menu opens on F10 + bool mbNoFocusRects = false; // on Aqua/Gtk3 use native focus rendering, except for flat buttons + bool mbNoFocusRectsForFlatButtons = false; // on Gtk3 native focusing is also preferred for flat buttons + bool mbCenteredTabs = false; // on Aqua, tabs are centered + bool mbNoActiveTabTextRaise = false; // on Aqua the text for the selected tab // should not "jump up" a pixel - bool mbProgressNeedsErase; // set true for platforms that should draw the + bool mbProgressNeedsErase = false; // set true for platforms that should draw the // window background before drawing the native // progress bar - bool mbCheckBoxNeedsErase; // set true for platforms that should draw the + bool mbCheckBoxNeedsErase = false; // set true for platforms that should draw the // window background before drawing the native // checkbox - bool mbCanDrawWidgetAnySize; // set to true currently on gtk + bool mbCanDrawWidgetAnySize = false; // set to true currently on gtk /// entire drop down listbox resembles a button, no textarea/button parts (as currently on Windows) - bool mbDDListBoxNoTextArea; - bool mbEnableAccel; // whether or not accelerators are shown - bool mbAutoAccel; // whether accelerators are only shown when Alt is held down - bool mbRolloverMenubar; // theming engine supports rollover in menubar + bool mbDDListBoxNoTextArea = false; + bool mbEnableAccel = true; // whether or not accelerators are shown + bool mbAutoAccel = false; // whether accelerators are only shown when Alt is held down + bool mbRolloverMenubar = false; // theming engine supports rollover in menubar }; struct BlendFrameCache @@ -304,38 +309,36 @@ struct BlendFrameCache struct ImplSVData { - ImplSVData(); - - SalData* mpSalData; - SalInstance* mpDefInst; // Default SalInstance - Application* mpApp; // pApp + SalData* mpSalData = nullptr; + SalInstance* mpDefInst = nullptr; // Default SalInstance + Application* mpApp = nullptr; // pApp VclPtr<WorkWindow> mpDefaultWin; // Default-Window - bool mbDeInit; // Is VCL deinitializing - ImplSchedulerData* mpFirstSchedulerData; // list of all running tasks - SalTimer* mpSalTimer; // interface to sal event loop/timers - SalI18NImeStatus* mpImeStatus; // interface to ime status window - SalSystem* mpSalSystem; // SalSystem interface - ResMgr* mpResMgr; // SV-Resource-Manager - sal_uInt64 mnTimerPeriod; // current timer period + bool mbDeInit = false; // Is VCL deinitializing + ImplSchedulerData* mpFirstSchedulerData = nullptr; // list of all running tasks + SalTimer* mpSalTimer = nullptr; // interface to sal event loop/timers + SalI18NImeStatus* mpImeStatus = nullptr; // interface to ime status window + SalSystem* mpSalSystem = nullptr; // SalSystem interface + ResMgr* mpResMgr = nullptr; // SV-Resource-Manager + sal_uInt64 mnTimerPeriod = 0; // current timer period ImplSVAppData maAppData; // indepen data for class Application ImplSVGDIData maGDIData; // indepen data for Output classes ImplSVWinData maWinData; // indepen data for Windows classes ImplSVCtrlData maCtrlData; // indepen data for Control classes ImplSVHelpData maHelpData; // indepen data for Help classes ImplSVNWFData maNWFData; - UnoWrapperBase* mpUnoWrapper; + UnoWrapperBase* mpUnoWrapper = nullptr; VclPtr<vcl::Window> mpIntroWindow; // the splash screen - DockingManager* mpDockingManager; - BlendFrameCache* mpBlendFrameCache; - vcl::CommandInfoProvider* mpCommandInfoProvider; + DockingManager* mpDockingManager = nullptr; + BlendFrameCache* mpBlendFrameCache = nullptr; + vcl::CommandInfoProvider* mpCommandInfoProvider = nullptr; - oslThreadIdentifier mnMainThreadId; + oslThreadIdentifier mnMainThreadId = 0; rtl::Reference< vcl::DisplayConnectionDispatch > mxDisplayConnection; css::uno::Reference< css::lang::XComponent > mxAccessBridge; - vcl::SettingsConfigItem* mpSettingsConfigItem; - std::list< vcl::DeleteOnDeinitBase* >* mpDeinitDeleteList; - std::unordered_map< int, OUString >* mpPaperNames; + vcl::SettingsConfigItem* mpSettingsConfigItem = nullptr; + std::list< vcl::DeleteOnDeinitBase* >* mpDeinitDeleteList = nullptr; + std::unordered_map< int, OUString >* mpPaperNames = nullptr; Link<LinkParamNone*,void> maDeInitHook; }; diff --git a/vcl/source/app/svapp.cxx b/vcl/source/app/svapp.cxx index becfa0f9b0e9..b394c5302f5f 100644 --- a/vcl/source/app/svapp.cxx +++ b/vcl/source/app/svapp.cxx @@ -187,10 +187,6 @@ struct ImplPostEventData ~ImplPostEventData() {} }; -typedef ::std::pair< VclPtr<vcl::Window>, ImplPostEventData* > ImplPostEventPair; - -static ::std::list< ImplPostEventPair > aPostedEventList; - Application* GetpApp() { ImplSVData* pSVData = ImplGetSVData(); @@ -917,7 +913,7 @@ ImplSVEvent * Application::PostKeyEvent( sal_uLong nEvent, vcl::Window *pWin, Ke if( nEventId ) { pPostEventData->mnEventId = nEventId; - aPostedEventList.push_back( ImplPostEventPair( pWin, pPostEventData ) ); + ImplGetSVData()->maAppData.maPostedEventList.push_back( ImplPostEventPair( pWin, pPostEventData ) ); } else delete pPostEventData; @@ -950,7 +946,7 @@ ImplSVEvent * Application::PostMouseEvent( sal_uLong nEvent, vcl::Window *pWin, if( nEventId ) { pPostEventData->mnEventId = nEventId; - aPostedEventList.push_back( ImplPostEventPair( pWin, pPostEventData ) ); + ImplGetSVData()->maAppData.maPostedEventList.push_back( ImplPostEventPair( pWin, pPostEventData ) ); } else delete pPostEventData; @@ -1015,14 +1011,15 @@ IMPL_STATIC_LINK( Application, PostEventHandler, void*, pCallData, void ) ImplWindowFrameProc( pData->mpWin.get()->mpWindowImpl->mpFrameWindow.get(), nEvent, pEventData ); // remove this event from list of posted events, watch for destruction of internal data - ::std::list< ImplPostEventPair >::iterator aIter( aPostedEventList.begin() ); + auto svdata = ImplGetSVData(); + ::std::list< ImplPostEventPair >::iterator aIter( svdata->maAppData.maPostedEventList.begin() ); - while( aIter != aPostedEventList.end() ) + while( aIter != svdata->maAppData.maPostedEventList.end() ) { if( nEventId == (*aIter).second->mnEventId ) { delete (*aIter).second; - aIter = aPostedEventList.erase( aIter ); + aIter = svdata->maAppData.maPostedEventList.erase( aIter ); } else ++aIter; @@ -1034,9 +1031,10 @@ void Application::RemoveMouseAndKeyEvents( vcl::Window* pWin ) const SolarMutexGuard aGuard; // remove all events for specific window, watch for destruction of internal data - ::std::list< ImplPostEventPair >::iterator aIter( aPostedEventList.begin() ); + auto svdata = ImplGetSVData(); + ::std::list< ImplPostEventPair >::iterator aIter( svdata->maAppData.maPostedEventList.begin() ); - while( aIter != aPostedEventList.end() ) + while( aIter != svdata->maAppData.maPostedEventList.end() ) { if( pWin == (*aIter).first ) { @@ -1044,7 +1042,7 @@ void Application::RemoveMouseAndKeyEvents( vcl::Window* pWin ) RemoveUserEvent( (*aIter).second->mnEventId ); delete (*aIter).second; - aIter = aPostedEventList.erase( aIter ); + aIter = svdata->maAppData.maPostedEventList.erase( aIter ); } else ++aIter; diff --git a/vcl/source/app/svdata.cxx b/vcl/source/app/svdata.cxx index b43f00ca332a..74fd791ca193 100644 --- a/vcl/source/app/svdata.cxx +++ b/vcl/source/app/svdata.cxx @@ -79,16 +79,6 @@ SalSystem* ImplGetSalSystem() return pSVData->mpSalSystem; } -ImplSVData::ImplSVData() -{ - // init global instance data - memset( this, 0, sizeof( ImplSVData ) ); - maHelpData.mbAutoHelpId = true; - maNWFData.maMenuBarHighlightTextColor = Color( COL_TRANSPARENT ); - maNWFData.mbEnableAccel = true; - maNWFData.mbAutoAccel = false; -} - ImplSVGDIData::~ImplSVGDIData() { // FIXME: deliberately leak any remaining OutputDevice |