Branch libreoffice-5-0-4
[LibreOffice.git] / vcl / inc / svdata.hxx
blob5e3282a246eccd905520568bc5859718a104fd5a
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_VCL_INC_SVDATA_HXX
21 #define INCLUDED_VCL_INC_SVDATA_HXX
23 #include "sal/types.h"
25 #include <osl/thread.hxx>
26 #include <rtl/ref.hxx>
27 #include <rtl/ustring.hxx>
28 #include "tools/link.hxx"
29 #include "tools/fldunit.hxx"
30 #include "tools/color.hxx"
31 #include "tools/debug.hxx"
32 #include "tools/solar.h"
33 #include "vcl/bitmapex.hxx"
34 #include "vcl/dllapi.h"
35 #include "vcl/keycod.hxx"
36 #include "vcl/svapp.hxx"
37 #include "vcl/vclevent.hxx"
39 #include "unotools/options.hxx"
41 #include "xconnection.hxx"
43 #include "com/sun/star/lang/XComponent.hpp"
44 #include "com/sun/star/uno/Reference.hxx"
46 #include <unordered_map>
48 #include <config_version.h>
50 struct ImplTimerData;
51 struct ImplIdleData;
52 struct ImplConfigData;
53 class ImplDirectFontSubstitution;
54 struct ImplHotKey;
55 struct ImplEventHook;
56 class Point;
57 class ResMgr;
58 class ImplAccelManager;
59 class PhysicalFontCollection;
60 class ImplFontCache;
61 class HelpTextWindow;
62 class ImplTBDragMgr;
63 class ImplIdleMgr;
64 class FloatingWindow;
65 class AllSettings;
66 class NotifyEvent;
67 class Timer;
68 class AutoTimer;
69 class Idle;
70 class Help;
71 class ImageList;
72 class Image;
73 class PopupMenu;
74 class Application;
75 class OutputDevice;
76 namespace vcl { class Window; }
77 class SystemWindow;
78 class WorkWindow;
79 class Dialog;
80 class VirtualDevice;
81 class Printer;
82 class SalFrame;
83 class SalInstance;
84 class SalSystem;
85 class ImplPrnQueueList;
86 class UnoWrapperBase;
87 class GraphicConverter;
88 class ImplWheelWindow;
89 class SalTimer;
90 class SalI18NImeStatus;
91 class DockingManager;
92 class VclEventListeners2;
93 class SalData;
94 class OpenGLContext;
96 namespace vcl { class DisplayConnection; class SettingsConfigItem; class DeleteOnDeinitBase; }
98 class LocaleConfigurationListener : public utl::ConfigurationListener
100 public:
101 virtual void ConfigurationChanged( utl::ConfigurationBroadcaster*, sal_uInt32 ) SAL_OVERRIDE;
104 struct ImplSVAppData
106 enum ImeStatusWindowMode
108 ImeStatusWindowMode_UNKNOWN,
109 ImeStatusWindowMode_HIDE,
110 ImeStatusWindowMode_SHOW
113 AllSettings* mpSettings; // Application settings
114 LocaleConfigurationListener* mpCfgListener;
115 VclEventListeners* mpEventListeners; // listeners for vcl events (eg, extended toolkit)
116 VclEventListeners* mpKeyListeners; // listeners for key events only (eg, extended toolkit)
117 ImplAccelManager* mpAccelMgr; // Accelerator Manager
118 OUString* mpAppName; // Application name
119 OUString* mpAppFileName; // Abs. Application FileName
120 OUString* mpDisplayName; // Application Display Name
121 OUString* mpFontPath; // Additional Fontpath
122 Help* mpHelp; // Application help
123 PopupMenu* mpActivePopupMenu; // Actives Popup-Menu (in Execute)
124 ImplIdleMgr* mpIdleMgr; // Idle-Manager
125 VclPtr<ImplWheelWindow> mpWheelWindow; // WheelWindow
126 ImplHotKey* mpFirstHotKey; // HotKey-Verwaltung
127 ImplEventHook* mpFirstEventHook; // Event-Hooks
128 VclEventListeners2* mpPostYieldListeners; // post yield listeners
129 sal_uInt64 mnLastInputTime; // GetLastInputTime()
130 sal_uInt16 mnDispatchLevel; // DispatchLevel
131 sal_uInt16 mnModalMode; // ModalMode Count
132 sal_uInt16 mnModalDialog; // ModalDialog Count
133 sal_uInt16 mnAccessCount; // AccessHdl Count
134 SystemWindowFlags mnSysWinMode; // Mode, when SystemWindows should be created
135 short mnDialogScaleX; // Scale X-Positions and sizes in Dialogs
136 bool mbInAppMain; // is Application::Main() on stack
137 bool mbInAppExecute; // is Application::Execute() on stack
138 bool mbAppQuit; // is Application::Quit() called
139 bool mbSettingsInit; // true: Settings are initialized
140 bool mbNoYield; // Application::Yield will not wait for events if the queue is empty
141 // essentially that makes it the same as Application::Reschedule
142 Application::DialogCancelMode meDialogCancel; // true: All Dialog::Execute() calls will be terminated immediately with return false
144 /** Controls whether showing any IME status window is toggled on or off.
146 Only meaningful if showing IME status windows can be toggled on and off
147 externally (see Application::CanToggleImeStatusWindow).
149 ImeStatusWindowMode meShowImeStatusWindow;
151 DECL_STATIC_LINK( ImplSVAppData, ImplQuitMsg, void* );
154 struct ImplSVGDIData
156 ~ImplSVGDIData();
158 VclPtr<OutputDevice> mpFirstWinGraphics; // First OutputDevice with a Frame Graphics
159 VclPtr<OutputDevice> mpLastWinGraphics; // Last OutputDevice with a Frame Graphics
160 VclPtr<OutputDevice> mpFirstVirGraphics; // First OutputDevice with a VirtualDevice Graphics
161 VclPtr<OutputDevice> mpLastVirGraphics; // Last OutputDevice with a VirtualDevice Graphics
162 VclPtr<OutputDevice> mpFirstPrnGraphics; // First OutputDevice with a InfoPrinter Graphics
163 VclPtr<OutputDevice> mpLastPrnGraphics; // Last OutputDevice with a InfoPrinter Graphics
164 VclPtr<VirtualDevice> mpFirstVirDev; // First VirtualDevice
165 VclPtr<VirtualDevice> mpLastVirDev; // Last VirtualDevice
166 OpenGLContext* mpFirstContext; // First OpenGLContext
167 OpenGLContext* mpLastContext; // Last OpenGLContext
168 VclPtr<Printer> mpFirstPrinter; // First Printer
169 VclPtr<Printer> mpLastPrinter; // Last Printer
170 ImplPrnQueueList* mpPrinterQueueList; // List of all printer queue
171 PhysicalFontCollection* mpScreenFontList; // Screen-Font-List
172 ImplFontCache* mpScreenFontCache; // Screen-Font-Cache
173 ImplDirectFontSubstitution* mpDirectFontSubst; // Font-Substitutons defined in Tools->Options->Fonts
174 GraphicConverter* mpGrfConverter; // Converter for graphics
175 long mnRealAppFontX; // AppFont X-Numenator for 40/tel Width
176 long mnAppFontX; // AppFont X-Numenator for 40/tel Width + DialogScaleX
177 long mnAppFontY; // AppFont Y-Numenator for 80/tel Height
178 bool mbFontSubChanged; // true: FontSubstitution was changed between Begin/End
179 bool mbNativeFontConfig; // true: do not override UI font
182 struct ImplSVWinData
184 VclPtr<vcl::Window> mpFirstFrame; // First FrameWindow
185 VclPtr<vcl::Window> mpDefDialogParent; // Default Dialog Parent
186 VclPtr<WorkWindow> mpAppWin; // Application-Window
187 VclPtr<vcl::Window> mpFocusWin; // window, that has the focus
188 VclPtr<vcl::Window> mpActiveApplicationFrame; // the last active application frame, can be used as DefModalDialogParent if no focuswin set
189 VclPtr<vcl::Window> mpCaptureWin; // window, that has the mouse capture
190 VclPtr<vcl::Window> mpLastDeacWin; // Window, that need a deactivate (FloatingWindow-Handling)
191 VclPtr<FloatingWindow> mpFirstFloat; // First FloatingWindow in PopupMode
192 VclPtr<Dialog> mpLastExecuteDlg; // First Dialog that is in Execute
193 VclPtr<vcl::Window> mpExtTextInputWin; // Window, which is in ExtTextInput
194 VclPtr<vcl::Window> mpTrackWin; // window, that is in tracking mode
195 AutoTimer* mpTrackTimer; // tracking timer
196 ImageList* mpMsgBoxImgList; // ImageList for MessageBox
197 VclPtr<vcl::Window> mpAutoScrollWin; // window, that is in AutoScrollMode mode
198 sal_uInt16 mnTrackFlags; // tracking flags
199 sal_uInt16 mnAutoScrollFlags; // auto scroll flags
200 bool mbNoDeactivate; // true: do not execute Deactivate
201 bool mbNoSaveFocus; // true: menus must not save/restore focus
202 bool mbNoSaveBackground; // true: save background is unnecessary or even less performant
205 typedef std::vector< std::pair< OUString, FieldUnit > > FieldUnitStringList;
207 struct ImplSVCtrlData
209 ImageList* mpCheckImgList; // ImageList for CheckBoxes
210 ImageList* mpRadioImgList; // ImageList for RadioButtons
211 ImageList* mpPinImgList; // ImageList for PIN
212 ImageList* mpSplitHPinImgList; // ImageList for Horizontale SplitWindows
213 ImageList* mpSplitVPinImgList; // ImageList for Vertikale SplitWindows (PIN's)
214 ImageList* mpSplitHArwImgList; // ImageList for Horizontale SplitWindows (Arrows)
215 ImageList* mpSplitVArwImgList; // ImageList for Vertikale SplitWindows (Arrows)
216 Image* mpDisclosurePlus;
217 Image* mpDisclosureMinus;
218 ImplTBDragMgr* mpTBDragMgr; // DragMgr for ToolBox
219 sal_uInt16 mnCheckStyle; // CheckBox-Style for ImageList-Update
220 sal_uInt16 mnRadioStyle; // Radio-Style for ImageList-Update
221 sal_uLong mnLastCheckFColor; // Letzte FaceColor fuer CheckImage
222 sal_uLong mnLastCheckWColor; // Letzte WindowColor fuer CheckImage
223 sal_uLong mnLastCheckWTextColor; // Letzte WindowTextColor fuer CheckImage
224 sal_uLong mnLastCheckLColor; // Letzte LightColor fuer CheckImage
225 sal_uLong mnLastRadioFColor; // Letzte FaceColor fuer RadioImage
226 sal_uLong mnLastRadioWColor; // Letzte WindowColor fuer RadioImage
227 sal_uLong mnLastRadioLColor; // Letzte LightColor fuer RadioImage
228 FieldUnitStringList* mpFieldUnitStrings; // list with field units
229 FieldUnitStringList* mpCleanUnitStrings; // same list but with some "fluff" like spaces removed
232 struct ImplSVHelpData
234 bool mbContextHelp : 1; // is ContextHelp enabled
235 bool mbExtHelp : 1; // is ExtendedHelp enabled
236 bool mbExtHelpMode : 1; // is in ExtendedHelp Mode
237 bool mbOldBalloonMode : 1; // BallonMode, before ExtHelpMode started
238 bool mbBalloonHelp : 1; // is BalloonHelp enabled
239 bool mbQuickHelp : 1; // is QuickHelp enabled
240 bool mbSetKeyboardHelp : 1; // tiphelp was activated by keyboard
241 bool mbKeyboardHelp : 1; // tiphelp was activated by keyboard
242 bool mbAutoHelpId : 1; // generate HelpIds
243 bool mbRequestingHelp : 1; // In Window::RequestHelp
244 VclPtr<HelpTextWindow> mpHelpWin; // HelpWindow
245 sal_uInt64 mnLastHelpHideTime; // ticks of last show
248 // "NWF" means "Native Widget Framework" and was the term used for the
249 // idea that StarView/OOo "widgets" should *look* (and feel) like the
250 // "native widgets" on each platform, even if not at all implemented
251 // using them. See http://people.redhat.com/dcbw/ooo-nwf.html .
253 struct ImplSVNWFData
255 int mnStatusBarLowerRightOffset; // amount in pixel to avoid in the lower righthand corner
256 int mnMenuFormatBorderX; // horizontal inner popup menu border
257 int mnMenuFormatBorderY; // vertical inner popup menu border
258 int mnMenuSeparatorBorderX; // gap at each side of separator
259 ::Color maMenuBarHighlightTextColor; // override higlight text color
260 // in menubar if not transparent
261 bool mbMenuBarDockingAreaCommonBG:1; // e.g. WinXP default theme
262 bool mbDockingAreaSeparateTB:1; // individual toolbar backgrounds
263 // instead of one for docking area
264 bool mbDockingAreaAvoidTBFrames:1; ///< don't draw frames around the individual toolbars if mbDockingAreaSeparateTB is false
265 bool mbToolboxDropDownSeparate:1; // two adjacent buttons for
266 // toolbox dropdown buttons
267 bool mbFlatMenu:1; // no popup 3D border
268 bool mbOpenMenuOnF10:1; // on gnome the first menu opens on F10
269 bool mbNoFocusRects:1; // on Aqua/Gtk3 use native focus rendering, except for flat butttons
270 bool mbNoFocusRectsForFlatButtons:1; // on Gtk3 native focusing is also preferred for flat buttons
271 bool mbCenteredTabs:1; // on Aqua, tabs are centered
272 bool mbNoActiveTabTextRaise:1; // on Aqua the text for the selected tab
273 // should not "jump up" a pixel
274 bool mbProgressNeedsErase:1; // set true for platforms that should draw the
275 // window background before drawing the native
276 // progress bar
277 bool mbCheckBoxNeedsErase:1; // set true for platforms that should draw the
278 // window background before drawing the native
279 // checkbox
280 bool mbCanDrawWidgetAnySize:1; // set to true currently on gtk
282 /// entire drop down listbox resembles a button, no textarea/button parts (as currently on Windows)
283 bool mbDDListBoxNoTextArea:1;
286 struct BlendFrameCache
288 Size m_aLastSize;
289 sal_uInt8 m_nLastAlpha;
290 Color m_aLastColorTopLeft;
291 Color m_aLastColorTopRight;
292 Color m_aLastColorBottomRight;
293 Color m_aLastColorBottomLeft;
294 BitmapEx m_aLastResult;
296 BlendFrameCache()
297 : m_aLastSize(0, 0)
298 , m_nLastAlpha(0)
299 , m_aLastColorTopLeft(COL_BLACK)
300 , m_aLastColorTopRight(COL_BLACK)
301 , m_aLastColorBottomRight(COL_BLACK)
302 , m_aLastColorBottomLeft(COL_BLACK)
307 struct ImplSVData
309 ImplSVData();
311 SalData* mpSalData;
312 SalInstance* mpDefInst; // Default SalInstance
313 Application* mpApp; // pApp
314 VclPtr<WorkWindow> mpDefaultWin; // Default-Window
315 bool mbDeInit; // Is VCL deinitializing
316 sal_uLong mnThreadCount; // is VCL MultiThread enabled
317 ImplConfigData* mpFirstConfigData; // pointer to the first config block
318 ImplSchedulerData* mpFirstSchedulerData; // list of all running tasks
319 SalTimer* mpSalTimer; // interface to sal event loop/timers
320 SalI18NImeStatus* mpImeStatus; // interface to ime status window
321 SalSystem* mpSalSystem; // SalSystem interface
322 ResMgr* mpResMgr; // SV-Resource-Manager
323 sal_uInt64 mnTimerPeriod; // current timer period
324 sal_uInt32 mnUpdateStack; // Scheduler on stack
325 ImplSVAppData maAppData; // indepen data for class Application
326 ImplSVGDIData maGDIData; // indepen data for Output classes
327 ImplSVWinData maWinData; // indepen data for Windows classes
328 ImplSVCtrlData maCtrlData; // indepen data for Control classes
329 ImplSVHelpData maHelpData; // indepen data for Help classes
330 ImplSVNWFData maNWFData;
331 UnoWrapperBase* mpUnoWrapper;
332 VclPtr<vcl::Window> mpIntroWindow; // the splash screen
333 DockingManager* mpDockingManager;
334 BlendFrameCache* mpBlendFrameCache;
335 bool mbIsTestTool;
337 oslThreadIdentifier mnMainThreadId;
338 rtl::Reference< vcl::DisplayConnection > mxDisplayConnection;
340 ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > mxAccessBridge;
341 vcl::SettingsConfigItem* mpSettingsConfigItem;
342 std::list< vcl::DeleteOnDeinitBase* >* mpDeinitDeleteList;
343 std::unordered_map< int, OUString >* mpPaperNames;
345 Link<> maDeInitHook;
348 void ImplDeInitSVData();
349 VCL_PLUGIN_PUBLIC vcl::Window* ImplGetDefaultWindow();
350 VCL_PLUGIN_PUBLIC ResMgr* ImplGetResMgr();
351 VCL_PLUGIN_PUBLIC ResId VclResId( sal_Int32 nId ); // throws std::bad_alloc if no res mgr
352 DockingManager* ImplGetDockingManager();
353 BlendFrameCache* ImplGetBlendFrameCache();
354 void ImplWindowAutoMnemonic( vcl::Window* pWindow );
356 void ImplUpdateSystemProcessWindow();
358 bool ImplCallHotKey( const vcl::KeyCode& rKeyCode );
359 void ImplFreeHotKeyData();
360 void ImplFreeEventHookData();
362 bool ImplCallPreNotify( NotifyEvent& rEvt );
364 VCL_PLUGIN_PUBLIC ImplSVData* ImplGetSVData();
365 VCL_PLUGIN_PUBLIC void ImplHideSplash();
367 bool ImplInitAccessBridge();
369 FieldUnitStringList* ImplGetFieldUnits();
370 FieldUnitStringList* ImplGetCleanedFieldUnits();
372 // ImplDelData is used as a "dog tag" by a window when it
373 // does something that could indirectly destroy the window
374 // TODO: wild destruction of a window should not be possible
376 struct ImplDelData
378 ImplDelData* mpNext;
379 VclPtr<vcl::Window> mpWindow;
380 bool mbDel;
382 ImplDelData( vcl::Window* pWindow = NULL );
383 virtual ~ImplDelData();
385 bool IsDead() const
387 DBG_ASSERT( !mbDel, "object deleted while in use !" );
388 return mbDel;
391 private:
392 void AttachToWindow( const vcl::Window* );
396 struct ImplFocusDelData : public ImplDelData
398 VclPtr<vcl::Window> mpFocusWin;
401 struct ImplSVEvent
403 void* mpData;
404 Link<>* mpLink;
405 VclPtr<vcl::Window> mpInstanceRef;
406 VclPtr<vcl::Window> mpWindow;
407 ImplDelData maDelData;
408 bool mbCall;
411 #endif // INCLUDED_VCL_INC_SVDATA_HXX
413 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */