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