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