xref: /AOO41X/main/vcl/inc/svdata.hxx (revision d3553c6b68aef63d45d1605bdabbc6fea7b9e42f)
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 //IAccessibility2 Implementation 2009-----
186 	long m_bEnableAccessInterface;
187 //-----IAccessibility2 Implementation 2009
188                             DECL_STATIC_LINK( ImplSVAppData, ImplQuitMsg, void* );
189 
190 };
191 
192 
193 // -----------------
194 // - ImplSVGDIData -
195 // -----------------
196 
197 struct ImplSVGDIData
198 {
199     OutputDevice*           mpFirstWinGraphics; // First OutputDevice with a Frame Graphics
200     OutputDevice*           mpLastWinGraphics;  // Last OutputDevice with a Frame Graphics
201     OutputDevice*           mpFirstVirGraphics; // First OutputDevice with a VirtualDevice Graphics
202     OutputDevice*           mpLastVirGraphics;  // Last OutputDevice with a VirtualDevice Graphics
203     OutputDevice*           mpFirstPrnGraphics; // First OutputDevice with a InfoPrinter Graphics
204     OutputDevice*           mpLastPrnGraphics;  // Last OutputDevice with a InfoPrinter Graphics
205     VirtualDevice*          mpFirstVirDev;      // First VirtualDevice
206     VirtualDevice*          mpLastVirDev;       // Last VirtualDevice
207     Printer*                mpFirstPrinter;     // First Printer
208     Printer*                mpLastPrinter;      // Last Printer
209     ImplPrnQueueList*       mpPrinterQueueList; // List of all printer queue
210     ImplDevFontList*        mpScreenFontList;   // Screen-Font-List
211     ImplFontCache*          mpScreenFontCache;  // Screen-Font-Cache
212     ImplDirectFontSubstitution* mpDirectFontSubst;// Font-Substitutons defined in Tools->Options->Fonts
213     GraphicConverter*       mpGrfConverter;     // Converter for graphics
214     long                    mnRealAppFontX;     // AppFont X-Numenator for 40/tel Width
215     long                    mnAppFontX;         // AppFont X-Numenator for 40/tel Width + DialogScaleX
216     long                    mnAppFontY;         // AppFont Y-Numenator for 80/tel Height
217     sal_Bool                    mbFontSubChanged;   // sal_True: FontSubstitution wurde zwischen Begin/End geaendert
218     utl::DefaultFontConfiguration* mpDefaultFontConfiguration;
219     utl::FontSubstConfiguration* mpFontSubstConfiguration;
220     bool                    mbNativeFontConfig; // true: do not override UI font
221     bool                    mbNoXORClipping;    // true: do not use XOR to achieve clipping effects
222 };
223 
224 
225 // -----------------
226 // - ImplSVWinData -
227 // -----------------
228 
229 struct ImplSVWinData
230 {
231     Window*                 mpFirstFrame;       // First FrameWindow
232     Window*                 mpDefDialogParent;  // Default Dialog Parent
233     WorkWindow*             mpAppWin;           // Application-Window
234     Window*                 mpFocusWin;         // window, that has the focus
235     Window*                 mpActiveApplicationFrame; // the last active application frame, can be used as DefModalDialogParent if no focuswin set
236     Window*                 mpCaptureWin;       // window, that has the mouse capture
237     Window*                 mpLastDeacWin;      // Window, that need a deactivate (FloatingWindow-Handling)
238     DbgWindow*              mpDbgWin;           // debug window
239     FloatingWindow*         mpFirstFloat;       // First FloatingWindow in PopupMode
240     Dialog*                 mpLastExecuteDlg;   // Erster Dialog, der sich in Execute befindet
241     Window*                 mpExtTextInputWin;  // Window, which is in ExtTextInput
242     Window*                 mpTrackWin;         // window, that is in tracking mode
243     AutoTimer*              mpTrackTimer;       // tracking timer
244     ImageList*              mpMsgBoxImgList;    // ImageList for MessageBox
245     ImageList*              mpMsgBoxHCImgList;  // ImageList for MessageBox (high contrast mode)
246     Window*                 mpAutoScrollWin;    // window, that is in AutoScrollMode mode
247     sal_uInt16                  mnTrackFlags;       // tracking flags
248     sal_uInt16                  mnAutoScrollFlags;  // auto scroll flags
249     sal_Bool                    mbNoDeactivate;     // sal_True: keine Deactivate durchfuehren
250 	sal_Bool					mbNoSaveFocus;		// sal_True: menues must not save/restore focus
251     sal_Bool                    mbNoSaveBackground; // sal_True: save background is unnecessary or even less performant
252 };
253 
254 
255 // ------------------
256 // - ImplSVCtrlData -
257 // ------------------
258 
259 typedef std::vector< std::pair< String, FieldUnit > > FieldUnitStringList;
260 
261 struct ImplSVCtrlData
262 {
263     ImageList*              mpCheckImgList;     // ImageList for CheckBoxes
264     ImageList*              mpRadioImgList;     // ImageList for RadioButtons
265     ImageList*              mpPinImgList;       // ImageList for PIN
266     ImageList*              mpSplitHPinImgList; // ImageList for Horizontale SplitWindows
267     ImageList*              mpSplitVPinImgList; // ImageList for Vertikale SplitWindows (PIN's)
268     ImageList*              mpSplitHArwImgList; // ImageList for Horizontale SplitWindows (Arrows)
269     ImageList*              mpSplitVArwImgList; // ImageList for Vertikale SplitWindows (Arrows)
270     Image*                  mpDisclosurePlus;
271     Image*                  mpDisclosurePlusHC;
272     Image*                  mpDisclosureMinus;
273     Image*                  mpDisclosureMinusHC;
274     ImplTBDragMgr*          mpTBDragMgr;        // DragMgr for ToolBox
275     sal_uInt16                  mnCheckStyle;       // CheckBox-Style for ImageList-Update
276     sal_uInt16                  mnRadioStyle;       // Radio-Style for ImageList-Update
277     sal_uLong                   mnLastCheckFColor;  // Letzte FaceColor fuer CheckImage
278     sal_uLong                   mnLastCheckWColor;  // Letzte WindowColor fuer CheckImage
279     sal_uLong                   mnLastCheckWTextColor;  // Letzte WindowTextColor fuer CheckImage
280     sal_uLong                   mnLastCheckLColor;  // Letzte LightColor fuer CheckImage
281     sal_uLong                   mnLastRadioFColor;  // Letzte FaceColor fuer RadioImage
282     sal_uLong                   mnLastRadioWColor;  // Letzte WindowColor fuer RadioImage
283     sal_uLong                   mnLastRadioLColor;  // Letzte LightColor fuer RadioImage
284     FieldUnitStringList*    mpFieldUnitStrings; // list with field units
285     FieldUnitStringList*    mpCleanUnitStrings; // same list but with some "fluff" like spaces removed
286 };
287 
288 
289 // ------------------
290 // - ImplSVHelpData -
291 // ------------------
292 
293 struct ImplSVHelpData
294 {
295     sal_Bool                    mbContextHelp       : 1;    // is ContextHelp enabled
296     sal_Bool                    mbExtHelp           : 1;    // is ExtendedHelp enabled
297     sal_Bool                    mbExtHelpMode       : 1;    // is in ExtendedHelp Mode
298     sal_Bool                    mbOldBalloonMode    : 1;    // BallonMode, befor ExtHelpMode started
299     sal_Bool                    mbBalloonHelp       : 1;    // is BalloonHelp enabled
300     sal_Bool                    mbQuickHelp         : 1;    // is QuickHelp enabled
301     sal_Bool                    mbSetKeyboardHelp   : 1;    // tiphelp was activated by keyboard
302     sal_Bool                    mbKeyboardHelp      : 1;    // tiphelp was activated by keyboard
303     sal_Bool                    mbAutoHelpId        : 1;    // generate HelpIds
304     sal_Bool                    mbRequestingHelp    : 1;    // In Window::RequestHelp
305     HelpTextWindow*         mpHelpWin;                  // HelpWindow
306     sal_uLong                   mnLastHelpHideTime;         // ticks of last show
307 };
308 
309 struct ImplSVNWFData
310 {
311     bool                    mbMenuBarDockingAreaCommonBG; // e.g. WinXP default theme
312     bool                    mbDockingAreaSeparateTB;      // individual toolbar backgrounds
313                                                           // instead of one for docking area
314     bool                    mbToolboxDropDownSeparate;    // two adjacent buttons for
315                                                           // toolbox dropdown buttons
316     int                     mnMenuFormatExtraBorder;      // inner popup menu border
317     bool                    mbFlatMenu;                   // no popup 3D border
318     Color                   maMenuBarHighlightTextColor;  // override higlight text color
319                                                           // in menubar if not transparent
320     bool                    mbOpenMenuOnF10;              // on gnome the first menu opens on F10
321     bool                    mbNoFocusRects;               // on Aqua focus rects are not used
322     bool                    mbNoBoldTabFocus;             // on Aqua and Gnome the focused tab has not bold text
323     bool                    mbCenteredTabs;               // on Aqua, tabs are centered
324     bool                    mbNoActiveTabTextRaise;       // on Aqua the text for the selected tab
325                                                           // should not "jump up" a pixel
326     bool                    mbProgressNeedsErase;         // set true for platforms that should draw the
327                                                           // window background before drawing the native
328                                                           // progress bar
329     bool                    mbCheckBoxNeedsErase;         // set true for platforms that should draw the
330                                                           // window background before drawing the native
331                                                           // checkbox
332     bool                    mbScrollbarJumpPage;          // true for "jump to here" behavior
333     int                     mnStatusBarLowerRightOffset;  // amount in pixel to avoid in the lower righthand corner
334     bool                    mbCanDrawWidgetAnySize;       // set to true currently on gtk
335 };
336 
337 
338 // --------------
339 // - ImplSVData -
340 // --------------
341 
342 struct ImplSVData
343 {
344     void*                   mpSalData;          // SalData
345     SalInstance*            mpDefInst;          // Default SalInstance
346     Application*            mpApp;              // pApp
347     WorkWindow*             mpDefaultWin;       // Default-Window
348     sal_Bool                    mbDeInit;             // Is VCL deinitializing
349     sal_uLong                   mnThreadCount;      // is VCL MultiThread enabled
350     ImplConfigData*         mpFirstConfigData;  // Zeiger auf ersten Config-Block
351     ImplTimerData*          mpFirstTimerData;   // list of all running timers
352     SalTimer*				mpSalTimer;			// interface to sal event loop/timers
353     SalI18NImeStatus*		mpImeStatus;		// interface to ime status window
354     SalSystem*				mpSalSystem;		// SalSystem interface
355     ResMgr*                 mpResMgr;           // SV-Resource-Manager
356     sal_uLong                   mnTimerPeriod;      // current timer period
357     sal_uLong                   mnTimerUpdate;      // TimerCallbackProcs on stack
358     sal_Bool                    mbNotAllTimerCalled;// sal_True: Es muessen noch Timer abgearbeitet werden
359     sal_Bool                    mbNoCallTimer;      // sal_True: No Timeout calls
360     ImplSVAppData           maAppData;          // indepen data for class Application
361     ImplSVGDIData           maGDIData;          // indepen data for Output classes
362     ImplSVWinData           maWinData;          // indepen data for Windows classes
363     ImplSVCtrlData          maCtrlData;         // indepen data for Control classes
364     ImplSVHelpData          maHelpData;         // indepen data for Help classes
365     ImplSVNWFData           maNWFData;
366     UnoWrapperBase*         mpUnoWrapper;
367     Window*                 mpIntroWindow;      // the splash screen
368     DockingManager*         mpDockingManager;
369     sal_Bool                    mbIsTestTool;
370 
371     vos::OThread::TThreadIdentifier                     mnMainThreadId;
372     rtl::Reference< vcl::DisplayConnection >            mxDisplayConnection;
373 
374     ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > mxAccessBridge;
375     com::sun::star::uno::Reference< com::sun::star::frame::XSessionManagerClient > xSMClient;
376     ::vcl::SettingsConfigItem*			mpSettingsConfigItem;
377     std::list< vcl::DeleteOnDeinitBase* >*   mpDeinitDeleteList;
378     std::hash_map< int, rtl::OUString >*     mpPaperNames;
379 };
380 
381 void        ImplInitSVData();
382 void        ImplDeInitSVData();
383 void        ImplDestroySVData();
384 Window*     ImplGetDefaultWindow();
385 VCL_PLUGIN_PUBLIC ResMgr*     ImplGetResMgr();
386 VCL_PLUGIN_PUBLIC ResId VclResId( sal_Int32 nId ); // throws std::bad_alloc if no res mgr
387 DockingManager*     ImplGetDockingManager();
388 void        ImplWindowAutoMnemonic( Window* pWindow );
389 
390 void        ImplUpdateSystemProcessWindow();
391 Window*     ImplFindWindow( const SalFrame* pFrame, Point& rSalFramePos );
392 
393 // SVAPP.CXX
394 sal_Bool        ImplCallHotKey( const KeyCode& rKeyCode );
395 void        ImplFreeHotKeyData();
396 void        ImplFreeEventHookData();
397 
398 // WINPROC.CXX
399 long        ImplCallPreNotify( NotifyEvent& rEvt );
400 long        ImplCallEvent( NotifyEvent& rEvt );
401 
402 extern VCL_PLUGIN_PUBLIC ImplSVData* pImplSVData;
403 inline VCL_PLUGIN_PUBLIC ImplSVData* ImplGetSVData() { return pImplSVData; }
404 inline ImplSVData* ImplGetAppSVData() { return ImplGetSVData(); }
405 
406 bool ImplInitAccessBridge( sal_Bool bAllowCancel, sal_Bool &rCancelled );
407 
408 FieldUnitStringList* ImplGetFieldUnits();
409 FieldUnitStringList* ImplGetCleanedFieldUnits();
410 
411 
412 // -----------------------------------------------------------------------
413 
414 // -----------------
415 // - ImplSVEmpyStr -
416 // -----------------
417 
418 // Empty-SV-String
419 
420 inline const String& ImplGetSVEmptyStr()
421     { return String::EmptyString(); }
422 inline const ByteString& ImplGetSVEmptyByteStr()
423     { return ByteString::EmptyString(); }
424 
425 // -----------------------------------------------------------------------
426 
427 // ----------------------
428 // - struct ImplDelData -
429 // ----------------------
430 // ImplDelData is used as a "dog tag" by a window when it
431 // does something that could indirectly destroy the window
432 // TODO: wild destruction of a window should not be possible
433 
434 struct ImplDelData
435 {
436     ImplDelData*    mpNext;
437     const Window*   mpWindow;
438     sal_Bool            mbDel;
439 
440                     ImplDelData( const Window* pWindow = NULL )
441                     : mpNext( NULL ), mpWindow( NULL ), mbDel( sal_False )
442                     { if( pWindow ) AttachToWindow( pWindow ); }
443 
444     virtual         ~ImplDelData();
445 
446     bool            IsDead() const
447     {
448         DBG_ASSERT( mbDel == sal_False, "object deleted while in use !" );
449         return (mbDel!=sal_False);
450     }
451     sal_Bool /*deprecated */IsDelete() const { return (sal_Bool)IsDead(); }
452 
453 private:
454     void            AttachToWindow( const Window* );
455 };
456 
457 // ---------------
458 // - ImplSVEvent -
459 // ---------------
460 
461 struct ImplSVEvent
462 {
463     sal_uLong               mnEvent;
464     void*               mpData;
465     Link*               mpLink;
466     Window*             mpWindow;
467     ImplDelData         maDelData;
468     sal_Bool                mbCall;
469 };
470 
471 #endif  // _SV_SVDATA_HXX
472