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