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