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