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