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/shl.hxx"
29 : #include "tools/link.hxx"
30 : #include "tools/fldunit.hxx"
31 : #include "tools/color.hxx"
32 : #include "tools/debug.hxx"
33 :
34 : #include "vcl/vclevent.hxx"
35 : #include "vcl/bitmapex.hxx"
36 : #include "tools/solar.h"
37 : #include "vcl/svapp.hxx"
38 : #include "vcl/dllapi.h"
39 :
40 : #include "unotools/options.hxx"
41 :
42 : #include "xconnection.hxx"
43 :
44 : #include "com/sun/star/lang/XComponent.hpp"
45 : #include "com/sun/star/uno/Reference.hxx"
46 :
47 : #include <boost/unordered_map.hpp>
48 :
49 : #include <config_version.h>
50 :
51 : struct ImplTimerData;
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 KeyCode;
67 : class NotifyEvent;
68 : class Timer;
69 : class AutoTimer;
70 : class Help;
71 : class ImageList;
72 : class Image;
73 : class PopupMenu;
74 : class Application;
75 : class OutputDevice;
76 : 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 :
95 : namespace vcl { class DisplayConnection; class SettingsConfigItem; class DeleteOnDeinitBase; }
96 :
97 0 : class LocaleConfigurationListener : public utl::ConfigurationListener
98 : {
99 : public:
100 : virtual void ConfigurationChanged( utl::ConfigurationBroadcaster*, sal_uInt32 ) SAL_OVERRIDE;
101 : };
102 :
103 : struct ImplSVAppData
104 : {
105 : enum ImeStatusWindowMode
106 : {
107 : ImeStatusWindowMode_UNKNOWN,
108 : ImeStatusWindowMode_HIDE,
109 : ImeStatusWindowMode_SHOW
110 : };
111 :
112 : AllSettings* mpSettings; // Application settings
113 : LocaleConfigurationListener* mpCfgListener;
114 : VclEventListeners* mpEventListeners; // listeners for vcl events (eg, extended toolkit)
115 : VclEventListeners* mpKeyListeners; // listeners for key events only (eg, extended toolkit)
116 : ImplAccelManager* mpAccelMgr; // Accelerator Manager
117 : OUString* mpAppName; // Application name
118 : OUString* mpAppFileName; // Abs. Application FileName
119 : OUString* mpDisplayName; // Application Display Name
120 : OUString* mpFontPath; // Additional Fontpath
121 : Help* mpHelp; // Application help
122 : PopupMenu* mpActivePopupMenu; // Actives Popup-Menu (in Execute)
123 : ImplIdleMgr* mpIdleMgr; // Idle-Manager
124 : ImplWheelWindow* mpWheelWindow; // WheelWindow
125 : ImplHotKey* mpFirstHotKey; // HotKey-Verwaltung
126 : ImplEventHook* mpFirstEventHook; // Event-Hooks
127 : VclEventListeners2* mpPostYieldListeners; // post yield listeners
128 : sal_uLong mnLastInputTime; // GetLastInputTime()
129 : sal_uInt16 mnDispatchLevel; // DispatchLevel
130 : sal_uInt16 mnModalMode; // ModalMode Count
131 : sal_uInt16 mnModalDialog; // ModalDialog Count
132 : sal_uInt16 mnAccessCount; // AccessHdl Count
133 : sal_uInt16 mnSysWinMode; // Mode, when SystemWindows should be created
134 : sal_uInt16 mnLayout; // --- RTL-Flags --- currently not used, only for testing
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 : long mnDefaultLayoutBorder; // default value in pixel for layout distances used
144 : // in window arrangers
145 :
146 : /** Controls whether showing any IME status window is toggled on or off.
147 :
148 : Only meaningful if showing IME status windows can be toggled on and off
149 : externally (see Application::CanToggleImeStatusWindow).
150 : */
151 : ImeStatusWindowMode meShowImeStatusWindow;
152 :
153 : DECL_STATIC_LINK( ImplSVAppData, ImplQuitMsg, void* );
154 : };
155 :
156 : struct ImplSVGDIData
157 : {
158 : OutputDevice* mpFirstWinGraphics; // First OutputDevice with a Frame Graphics
159 : OutputDevice* mpLastWinGraphics; // Last OutputDevice with a Frame Graphics
160 : OutputDevice* mpFirstVirGraphics; // First OutputDevice with a VirtualDevice Graphics
161 : OutputDevice* mpLastVirGraphics; // Last OutputDevice with a VirtualDevice Graphics
162 : OutputDevice* mpFirstPrnGraphics; // First OutputDevice with a InfoPrinter Graphics
163 : OutputDevice* mpLastPrnGraphics; // Last OutputDevice with a InfoPrinter Graphics
164 : VirtualDevice* mpFirstVirDev; // First VirtualDevice
165 : VirtualDevice* mpLastVirDev; // Last VirtualDevice
166 : Printer* mpFirstPrinter; // First Printer
167 : Printer* mpLastPrinter; // Last Printer
168 : ImplPrnQueueList* mpPrinterQueueList; // List of all printer queue
169 : PhysicalFontCollection* mpScreenFontList; // Screen-Font-List
170 : ImplFontCache* mpScreenFontCache; // Screen-Font-Cache
171 : ImplDirectFontSubstitution* mpDirectFontSubst;// Font-Substitutons defined in Tools->Options->Fonts
172 : GraphicConverter* mpGrfConverter; // Converter for graphics
173 : long mnRealAppFontX; // AppFont X-Numenator for 40/tel Width
174 : long mnAppFontX; // AppFont X-Numenator for 40/tel Width + DialogScaleX
175 : long mnAppFontY; // AppFont Y-Numenator for 80/tel Height
176 : bool mbFontSubChanged; // true: FontSubstitution was changed between Begin/End
177 : bool mbNativeFontConfig; // true: do not override UI font
178 : };
179 :
180 : struct ImplSVWinData
181 : {
182 : Window* mpFirstFrame; // First FrameWindow
183 : Window* mpDefDialogParent; // Default Dialog Parent
184 : WorkWindow* mpAppWin; // Application-Window
185 : Window* mpFocusWin; // window, that has the focus
186 : Window* mpActiveApplicationFrame; // the last active application frame, can be used as DefModalDialogParent if no focuswin set
187 : Window* mpCaptureWin; // window, that has the mouse capture
188 : Window* mpLastDeacWin; // Window, that need a deactivate (FloatingWindow-Handling)
189 : FloatingWindow* mpFirstFloat; // First FloatingWindow in PopupMode
190 : Dialog* mpLastExecuteDlg; // First Dialog that is in Execute
191 : Window* mpExtTextInputWin; // Window, which is in ExtTextInput
192 : Window* mpTrackWin; // window, that is in tracking mode
193 : AutoTimer* mpTrackTimer; // tracking timer
194 : ImageList* mpMsgBoxImgList; // ImageList for MessageBox
195 : Window* mpAutoScrollWin; // window, that is in AutoScrollMode mode
196 : sal_uInt16 mnTrackFlags; // tracking flags
197 : sal_uInt16 mnAutoScrollFlags; // auto scroll flags
198 : bool mbNoDeactivate; // true: do not execute Deactivate
199 : bool mbNoSaveFocus; // true: menus must not save/restore focus
200 : bool mbNoSaveBackground; // true: save background is unnecessary or even less performant
201 : };
202 :
203 : typedef std::vector< std::pair< OUString, FieldUnit > > FieldUnitStringList;
204 :
205 : struct ImplSVCtrlData
206 : {
207 : ImageList* mpCheckImgList; // ImageList for CheckBoxes
208 : ImageList* mpRadioImgList; // ImageList for RadioButtons
209 : ImageList* mpPinImgList; // ImageList for PIN
210 : ImageList* mpSplitHPinImgList; // ImageList for Horizontale SplitWindows
211 : ImageList* mpSplitVPinImgList; // ImageList for Vertikale SplitWindows (PIN's)
212 : ImageList* mpSplitHArwImgList; // ImageList for Horizontale SplitWindows (Arrows)
213 : ImageList* mpSplitVArwImgList; // ImageList for Vertikale SplitWindows (Arrows)
214 : Image* mpDisclosurePlus;
215 : Image* mpDisclosureMinus;
216 : ImplTBDragMgr* mpTBDragMgr; // DragMgr for ToolBox
217 : sal_uInt16 mnCheckStyle; // CheckBox-Style for ImageList-Update
218 : sal_uInt16 mnRadioStyle; // Radio-Style for ImageList-Update
219 : sal_uLong mnLastCheckFColor; // Letzte FaceColor fuer CheckImage
220 : sal_uLong mnLastCheckWColor; // Letzte WindowColor fuer CheckImage
221 : sal_uLong mnLastCheckWTextColor; // Letzte WindowTextColor fuer CheckImage
222 : sal_uLong mnLastCheckLColor; // Letzte LightColor fuer CheckImage
223 : sal_uLong mnLastRadioFColor; // Letzte FaceColor fuer RadioImage
224 : sal_uLong mnLastRadioWColor; // Letzte WindowColor fuer RadioImage
225 : sal_uLong mnLastRadioLColor; // Letzte LightColor fuer RadioImage
226 : FieldUnitStringList* mpFieldUnitStrings; // list with field units
227 : FieldUnitStringList* mpCleanUnitStrings; // same list but with some "fluff" like spaces removed
228 : };
229 :
230 : struct ImplSVHelpData
231 : {
232 : bool mbContextHelp : 1; // is ContextHelp enabled
233 : bool mbExtHelp : 1; // is ExtendedHelp enabled
234 : bool mbExtHelpMode : 1; // is in ExtendedHelp Mode
235 : bool mbOldBalloonMode : 1; // BallonMode, befor ExtHelpMode started
236 : bool mbBalloonHelp : 1; // is BalloonHelp enabled
237 : bool mbQuickHelp : 1; // is QuickHelp enabled
238 : bool mbSetKeyboardHelp : 1; // tiphelp was activated by keyboard
239 : bool mbKeyboardHelp : 1; // tiphelp was activated by keyboard
240 : bool mbAutoHelpId : 1; // generate HelpIds
241 : bool mbRequestingHelp : 1; // In Window::RequestHelp
242 : HelpTextWindow* mpHelpWin; // HelpWindow
243 : sal_uLong mnLastHelpHideTime; // ticks of last show
244 : };
245 :
246 : // "NWF" means "Native Widget Framework" and was the term used for the
247 : // idea that StarView/OOo "widgets" should *look* (and feel) like the
248 : // "native widgets" on each platform, even if not at all implemented
249 : // using them. See http://people.redhat.com/dcbw/ooo-nwf.html .
250 :
251 1 : struct ImplSVNWFData
252 : {
253 : int mnStatusBarLowerRightOffset; // amount in pixel to avoid in the lower righthand corner
254 : int mnMenuFormatBorderX; // horizontal inner popup menu border
255 : int mnMenuFormatBorderY; // vertical inner popup menu border
256 : ::Color maMenuBarHighlightTextColor; // override higlight text color
257 : // in menubar if not transparent
258 : bool mbMenuBarDockingAreaCommonBG:1; // e.g. WinXP default theme
259 : bool mbDockingAreaSeparateTB:1; // individual toolbar backgrounds
260 : // instead of one for docking area
261 : bool mbDockingAreaAvoidTBFrames:1; ///< don't draw frames around the individual toolbars if mbDockingAreaSeparateTB is false
262 : bool mbToolboxDropDownSeparate:1; // two adjacent buttons for
263 : // toolbox dropdown buttons
264 : bool mbFlatMenu:1; // no popup 3D border
265 : bool mbOpenMenuOnF10:1; // on gnome the first menu opens on F10
266 : bool mbNoFocusRects:1; // on Aqua focus rects are not used
267 : bool mbCenteredTabs:1; // on Aqua, tabs are centered
268 : bool mbNoActiveTabTextRaise:1; // on Aqua the text for the selected tab
269 : // should not "jump up" a pixel
270 : bool mbProgressNeedsErase:1; // set true for platforms that should draw the
271 : // window background before drawing the native
272 : // progress bar
273 : bool mbCheckBoxNeedsErase:1; // set true for platforms that should draw the
274 : // window background before drawing the native
275 : // checkbox
276 : bool mbCanDrawWidgetAnySize:1; // set to true currently on gtk
277 :
278 : /// entire drop down listbox resembles a button, no textarea/button parts (as currently on Windows)
279 : bool mbDDListBoxNoTextArea:1;
280 : };
281 :
282 0 : struct BlendFrameCache
283 : {
284 : Size m_aLastSize;
285 : sal_uInt8 m_nLastAlpha;
286 : Color m_aLastColorTopLeft;
287 : Color m_aLastColorTopRight;
288 : Color m_aLastColorBottomRight;
289 : Color m_aLastColorBottomLeft;
290 : BitmapEx m_aLastResult;
291 :
292 0 : BlendFrameCache()
293 : : m_aLastSize(0, 0)
294 : , m_nLastAlpha(0)
295 : , m_aLastColorTopLeft(COL_BLACK)
296 : , m_aLastColorTopRight(COL_BLACK)
297 : , m_aLastColorBottomRight(COL_BLACK)
298 0 : , m_aLastColorBottomLeft(COL_BLACK)
299 : {
300 0 : }
301 : };
302 :
303 2 : struct ImplSVData
304 : {
305 : SalData* mpSalData;
306 : SalInstance* mpDefInst; // Default SalInstance
307 : Application* mpApp; // pApp
308 : WorkWindow* mpDefaultWin; // Default-Window
309 : bool mbDeInit; // Is VCL deinitializing
310 : sal_uLong mnThreadCount; // is VCL MultiThread enabled
311 : ImplConfigData* mpFirstConfigData; // Zeiger auf ersten Config-Block
312 : ImplTimerData* mpFirstTimerData; // list of all running timers
313 : SalTimer* mpSalTimer; // interface to sal event loop/timers
314 : SalI18NImeStatus* mpImeStatus; // interface to ime status window
315 : SalSystem* mpSalSystem; // SalSystem interface
316 : ResMgr* mpResMgr; // SV-Resource-Manager
317 : sal_uLong mnTimerPeriod; // current timer period
318 : sal_uLong mnTimerUpdate; // TimerCallbackProcs on stack
319 : bool mbNotAllTimerCalled;// true: Es muessen noch Timer abgearbeitet werden
320 : bool mbNoCallTimer; // true: No Timeout calls
321 : ImplSVAppData maAppData; // indepen data for class Application
322 : ImplSVGDIData maGDIData; // indepen data for Output classes
323 : ImplSVWinData maWinData; // indepen data for Windows classes
324 : ImplSVCtrlData maCtrlData; // indepen data for Control classes
325 : ImplSVHelpData maHelpData; // indepen data for Help classes
326 : ImplSVNWFData maNWFData;
327 : UnoWrapperBase* mpUnoWrapper;
328 : Window* mpIntroWindow; // the splash screen
329 : DockingManager* mpDockingManager;
330 : BlendFrameCache* mpBlendFrameCache;
331 : bool mbIsTestTool;
332 :
333 : oslThreadIdentifier mnMainThreadId;
334 : rtl::Reference< vcl::DisplayConnection > mxDisplayConnection;
335 :
336 : ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > mxAccessBridge;
337 : ::vcl::SettingsConfigItem* mpSettingsConfigItem;
338 : std::list< vcl::DeleteOnDeinitBase* >* mpDeinitDeleteList;
339 : boost::unordered_map< int, OUString >* mpPaperNames;
340 : };
341 :
342 : void ImplInitSVData();
343 : void ImplDeInitSVData();
344 : void ImplDestroySVData();
345 : Window* ImplGetDefaultWindow();
346 : VCL_PLUGIN_PUBLIC ResMgr* ImplGetResMgr();
347 : VCL_PLUGIN_PUBLIC ResId VclResId( sal_Int32 nId ); // throws std::bad_alloc if no res mgr
348 : DockingManager* ImplGetDockingManager();
349 : BlendFrameCache* ImplGetBlendFrameCache();
350 : void ImplWindowAutoMnemonic( Window* pWindow );
351 :
352 : void ImplUpdateSystemProcessWindow();
353 : Window* ImplFindWindow( const SalFrame* pFrame, Point& rSalFramePos );
354 :
355 : bool ImplCallHotKey( const KeyCode& rKeyCode );
356 : void ImplFreeHotKeyData();
357 : void ImplFreeEventHookData();
358 :
359 : bool ImplCallPreNotify( NotifyEvent& rEvt );
360 :
361 : extern VCL_PLUGIN_PUBLIC ImplSVData* pImplSVData;
362 17 : inline VCL_PLUGIN_PUBLIC ImplSVData* ImplGetSVData() { return pImplSVData; }
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 : const Window* mpWindow;
378 : bool mbDel;
379 :
380 0 : ImplDelData( const Window* pWindow = NULL )
381 0 : : mpNext( NULL ), mpWindow( NULL ), mbDel( false )
382 0 : { if( pWindow ) AttachToWindow( pWindow ); }
383 :
384 : virtual ~ImplDelData();
385 :
386 0 : bool IsDead() const
387 : {
388 : DBG_ASSERT( mbDel == false, "object deleted while in use !" );
389 0 : return mbDel;
390 : }
391 :
392 : private:
393 : void AttachToWindow( const Window* );
394 : };
395 :
396 0 : struct ImplSVEvent
397 : {
398 : sal_uLong mnEvent;
399 : void* mpData;
400 : Link* mpLink;
401 : Window* mpWindow;
402 : ImplDelData maDelData;
403 : bool mbCall;
404 : };
405 :
406 : #endif // INCLUDED_VCL_INC_SVDATA_HXX
407 :
408 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|