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