Line data Source code
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 : #ifndef INCLUDED_VCL_INC_SVDATA_HXX
21 : #define INCLUDED_VCL_INC_SVDATA_HXX
22 :
23 : #include "sal/types.h"
24 :
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"
38 :
39 : #include "unotools/options.hxx"
40 :
41 : #include "xconnection.hxx"
42 :
43 : #include "com/sun/star/lang/XComponent.hpp"
44 : #include "com/sun/star/uno/Reference.hxx"
45 :
46 : #include <unordered_map>
47 :
48 : #include <config_version.h>
49 :
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;
95 :
96 : namespace vcl { class DisplayConnection; class SettingsConfigItem; class DeleteOnDeinitBase; }
97 :
98 672 : class LocaleConfigurationListener : public utl::ConfigurationListener
99 : {
100 : public:
101 : virtual void ConfigurationChanged( utl::ConfigurationBroadcaster*, sal_uInt32 ) SAL_OVERRIDE;
102 : };
103 :
104 490 : struct ImplSVAppData
105 : {
106 : enum ImeStatusWindowMode
107 : {
108 : ImeStatusWindowMode_UNKNOWN,
109 : ImeStatusWindowMode_HIDE,
110 : ImeStatusWindowMode_SHOW
111 : };
112 :
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
143 :
144 : /** Controls whether showing any IME status window is toggled on or off.
145 :
146 : Only meaningful if showing IME status windows can be toggled on and off
147 : externally (see Application::CanToggleImeStatusWindow).
148 : */
149 : ImeStatusWindowMode meShowImeStatusWindow;
150 :
151 : DECL_STATIC_LINK( ImplSVAppData, ImplQuitMsg, void* );
152 : };
153 :
154 245 : struct ImplSVGDIData
155 : {
156 : ~ImplSVGDIData();
157 :
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
180 : };
181 :
182 490 : struct ImplSVWinData
183 : {
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 : StartTrackingFlags mnTrackFlags; // tracking flags
199 : StartAutoScrollFlags 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
203 : };
204 :
205 : typedef std::vector< std::pair< OUString, FieldUnit > > FieldUnitStringList;
206 :
207 : struct ImplSVCtrlData
208 : {
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
230 : };
231 :
232 490 : struct ImplSVHelpData
233 : {
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
246 : };
247 :
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 .
252 :
253 245 : struct ImplSVNWFData
254 : {
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 : ::Color maMenuBarHighlightTextColor; // override higlight text color
259 : // in menubar if not transparent
260 : bool mbMenuBarDockingAreaCommonBG:1; // e.g. WinXP default theme
261 : bool mbDockingAreaSeparateTB:1; // individual toolbar backgrounds
262 : // instead of one for docking area
263 : bool mbDockingAreaAvoidTBFrames:1; ///< don't draw frames around the individual toolbars if mbDockingAreaSeparateTB is false
264 : bool mbToolboxDropDownSeparate:1; // two adjacent buttons for
265 : // toolbox dropdown buttons
266 : bool mbFlatMenu:1; // no popup 3D border
267 : bool mbOpenMenuOnF10:1; // on gnome the first menu opens on F10
268 : bool mbNoFocusRects:1; // on Aqua focus rects are not used
269 : bool mbCenteredTabs:1; // on Aqua, tabs are centered
270 : bool mbNoActiveTabTextRaise:1; // on Aqua the text for the selected tab
271 : // should not "jump up" a pixel
272 : bool mbProgressNeedsErase:1; // set true for platforms that should draw the
273 : // window background before drawing the native
274 : // progress bar
275 : bool mbCheckBoxNeedsErase:1; // set true for platforms that should draw the
276 : // window background before drawing the native
277 : // checkbox
278 : bool mbCanDrawWidgetAnySize:1; // set to true currently on gtk
279 :
280 : /// entire drop down listbox resembles a button, no textarea/button parts (as currently on Windows)
281 : bool mbDDListBoxNoTextArea:1;
282 : };
283 :
284 0 : struct BlendFrameCache
285 : {
286 : Size m_aLastSize;
287 : sal_uInt8 m_nLastAlpha;
288 : Color m_aLastColorTopLeft;
289 : Color m_aLastColorTopRight;
290 : Color m_aLastColorBottomRight;
291 : Color m_aLastColorBottomLeft;
292 : BitmapEx m_aLastResult;
293 :
294 0 : BlendFrameCache()
295 : : m_aLastSize(0, 0)
296 : , m_nLastAlpha(0)
297 : , m_aLastColorTopLeft(COL_BLACK)
298 : , m_aLastColorTopRight(COL_BLACK)
299 : , m_aLastColorBottomRight(COL_BLACK)
300 0 : , m_aLastColorBottomLeft(COL_BLACK)
301 : {
302 0 : }
303 : };
304 :
305 245 : struct ImplSVData
306 : {
307 : ImplSVData();
308 :
309 : SalData* mpSalData;
310 : SalInstance* mpDefInst; // Default SalInstance
311 : Application* mpApp; // pApp
312 : VclPtr<WorkWindow> mpDefaultWin; // Default-Window
313 : bool mbDeInit; // Is VCL deinitializing
314 : sal_uLong mnThreadCount; // is VCL MultiThread enabled
315 : ImplConfigData* mpFirstConfigData; // pointer to the first config block
316 : ImplSchedulerData* mpFirstSchedulerData; // list of all running tasks
317 : SalTimer* mpSalTimer; // interface to sal event loop/timers
318 : SalI18NImeStatus* mpImeStatus; // interface to ime status window
319 : SalSystem* mpSalSystem; // SalSystem interface
320 : ResMgr* mpResMgr; // SV-Resource-Manager
321 : sal_uInt64 mnTimerPeriod; // current timer period
322 : sal_uInt32 mnUpdateStack; // Scheduler on stack
323 : ImplSVAppData maAppData; // indepen data for class Application
324 : ImplSVGDIData maGDIData; // indepen data for Output classes
325 : ImplSVWinData maWinData; // indepen data for Windows classes
326 : ImplSVCtrlData maCtrlData; // indepen data for Control classes
327 : ImplSVHelpData maHelpData; // indepen data for Help classes
328 : ImplSVNWFData maNWFData;
329 : UnoWrapperBase* mpUnoWrapper;
330 : VclPtr<vcl::Window> mpIntroWindow; // the splash screen
331 : DockingManager* mpDockingManager;
332 : BlendFrameCache* mpBlendFrameCache;
333 : bool mbIsTestTool;
334 :
335 : oslThreadIdentifier mnMainThreadId;
336 : rtl::Reference< vcl::DisplayConnection > mxDisplayConnection;
337 :
338 : ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > mxAccessBridge;
339 : vcl::SettingsConfigItem* mpSettingsConfigItem;
340 : std::list< vcl::DeleteOnDeinitBase* >* mpDeinitDeleteList;
341 : std::unordered_map< int, OUString >* mpPaperNames;
342 :
343 : Link<> maDeInitHook;
344 : };
345 :
346 : void ImplDeInitSVData();
347 : VCL_PLUGIN_PUBLIC vcl::Window* ImplGetDefaultWindow();
348 : VCL_PLUGIN_PUBLIC ResMgr* ImplGetResMgr();
349 : VCL_PLUGIN_PUBLIC ResId VclResId( sal_Int32 nId ); // throws std::bad_alloc if no res mgr
350 : DockingManager* ImplGetDockingManager();
351 : BlendFrameCache* ImplGetBlendFrameCache();
352 : void ImplWindowAutoMnemonic( vcl::Window* pWindow );
353 :
354 : void ImplUpdateSystemProcessWindow();
355 :
356 : bool ImplCallHotKey( const vcl::KeyCode& rKeyCode );
357 : void ImplFreeHotKeyData();
358 : void ImplFreeEventHookData();
359 :
360 : bool ImplCallPreNotify( NotifyEvent& rEvt );
361 :
362 : VCL_PLUGIN_PUBLIC ImplSVData* ImplGetSVData();
363 : VCL_PLUGIN_PUBLIC void ImplHideSplash();
364 :
365 : bool ImplInitAccessBridge();
366 :
367 : FieldUnitStringList* ImplGetFieldUnits();
368 : FieldUnitStringList* ImplGetCleanedFieldUnits();
369 :
370 : // ImplDelData is used as a "dog tag" by a window when it
371 : // does something that could indirectly destroy the window
372 : // TODO: wild destruction of a window should not be possible
373 :
374 : struct ImplDelData
375 : {
376 : ImplDelData* mpNext;
377 : VclPtr<vcl::Window> mpWindow;
378 : bool mbDel;
379 :
380 : ImplDelData( vcl::Window* pWindow = NULL );
381 : virtual ~ImplDelData();
382 :
383 50497072 : bool IsDead() const
384 : {
385 : DBG_ASSERT( !mbDel, "object deleted while in use !" );
386 50497072 : return mbDel;
387 : }
388 :
389 : private:
390 : void AttachToWindow( const vcl::Window* );
391 :
392 : };
393 :
394 20 : struct ImplFocusDelData : public ImplDelData
395 : {
396 : VclPtr<vcl::Window> mpFocusWin;
397 : };
398 :
399 193260 : struct ImplSVEvent
400 : {
401 : void* mpData;
402 : Link<>* mpLink;
403 : VclPtr<vcl::Window> mpInstanceRef;
404 : VclPtr<vcl::Window> mpWindow;
405 : ImplDelData maDelData;
406 : bool mbCall;
407 : };
408 :
409 : #endif // INCLUDED_VCL_INC_SVDATA_HXX
410 :
411 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|