LCOV - code coverage report
Current view: top level - vcl/inc - svdata.hxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 15 15 100.0 %
Date: 2014-11-03 Functions: 16 16 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #ifndef INCLUDED_VCL_INC_SVDATA_HXX
      21             : #define INCLUDED_VCL_INC_SVDATA_HXX
      22             : 
      23             : #include "sal/types.h"
      24             : 
      25             : #include <osl/thread.hxx>
      26             : #include <rtl/ref.hxx>
      27             : #include <rtl/ustring.hxx>
      28             : #include "tools/link.hxx"
      29             : #include "tools/fldunit.hxx"
      30             : #include "tools/color.hxx"
      31             : #include "tools/debug.hxx"
      32             : #include "tools/solar.h"
      33             : #include "vcl/bitmapex.hxx"
      34             : #include "vcl/dllapi.h"
      35             : #include "vcl/keycod.hxx"
      36             : #include "vcl/svapp.hxx"
      37             : #include "vcl/vclevent.hxx"
      38             : 
      39             : #include "unotools/options.hxx"
      40             : 
      41             : #include "xconnection.hxx"
      42             : 
      43             : #include "com/sun/star/lang/XComponent.hpp"
      44             : #include "com/sun/star/uno/Reference.hxx"
      45             : 
      46             : #include <boost/unordered_map.hpp>
      47             : 
      48             : #include <config_version.h>
      49             : 
      50             : struct ImplTimerData;
      51             : struct ImplConfigData;
      52             : class ImplDirectFontSubstitution;
      53             : struct ImplHotKey;
      54             : struct ImplEventHook;
      55             : class Point;
      56             : class ResMgr;
      57             : class ImplAccelManager;
      58             : class PhysicalFontCollection;
      59             : class ImplFontCache;
      60             : class HelpTextWindow;
      61             : class ImplTBDragMgr;
      62             : class ImplIdleMgr;
      63             : class FloatingWindow;
      64             : class AllSettings;
      65             : class NotifyEvent;
      66             : class Timer;
      67             : class AutoTimer;
      68             : class Help;
      69             : class ImageList;
      70             : class Image;
      71             : class PopupMenu;
      72             : class Application;
      73             : class OutputDevice;
      74             : namespace vcl { class Window; }
      75             : class SystemWindow;
      76             : class WorkWindow;
      77             : class Dialog;
      78             : class VirtualDevice;
      79             : class Printer;
      80             : class SalFrame;
      81             : class SalInstance;
      82             : class SalSystem;
      83             : class ImplPrnQueueList;
      84             : class UnoWrapperBase;
      85             : class GraphicConverter;
      86             : class ImplWheelWindow;
      87             : class SalTimer;
      88             : class SalI18NImeStatus;
      89             : class DockingManager;
      90             : class VclEventListeners2;
      91             : class SalData;
      92             : 
      93             : namespace vcl { class DisplayConnection; class SettingsConfigItem; class DeleteOnDeinitBase; }
      94             : 
      95         999 : class LocaleConfigurationListener : public utl::ConfigurationListener
      96             : {
      97             : public:
      98             :     virtual void ConfigurationChanged( utl::ConfigurationBroadcaster*, sal_uInt32 ) SAL_OVERRIDE;
      99             : };
     100             : 
     101             : struct ImplSVAppData
     102             : {
     103             :     enum ImeStatusWindowMode
     104             :     {
     105             :         ImeStatusWindowMode_UNKNOWN,
     106             :         ImeStatusWindowMode_HIDE,
     107             :         ImeStatusWindowMode_SHOW
     108             :     };
     109             : 
     110             :     AllSettings*            mpSettings;         // Application settings
     111             :     LocaleConfigurationListener* mpCfgListener;
     112             :     VclEventListeners*      mpEventListeners;   // listeners for vcl events (eg, extended toolkit)
     113             :     VclEventListeners*      mpKeyListeners;     // listeners for key events only (eg, extended toolkit)
     114             :     ImplAccelManager*       mpAccelMgr;         // Accelerator Manager
     115             :     OUString*               mpAppName;          // Application name
     116             :     OUString*               mpAppFileName;      // Abs. Application FileName
     117             :     OUString*               mpDisplayName;      // Application Display Name
     118             :     OUString*               mpFontPath;         // Additional Fontpath
     119             :     Help*                   mpHelp;             // Application help
     120             :     PopupMenu*              mpActivePopupMenu;  // Actives Popup-Menu (in Execute)
     121             :     ImplIdleMgr*            mpIdleMgr;          // Idle-Manager
     122             :     ImplWheelWindow*        mpWheelWindow;      // WheelWindow
     123             :     ImplHotKey*             mpFirstHotKey;      // HotKey-Verwaltung
     124             :     ImplEventHook*          mpFirstEventHook;   // Event-Hooks
     125             :     VclEventListeners2*     mpPostYieldListeners;           // post yield listeners
     126             :     sal_uLong               mnLastInputTime;                // GetLastInputTime()
     127             :     sal_uInt16              mnDispatchLevel;                // DispatchLevel
     128             :     sal_uInt16              mnModalMode;                    // ModalMode Count
     129             :     sal_uInt16              mnModalDialog;                  // ModalDialog Count
     130             :     sal_uInt16              mnAccessCount;                  // AccessHdl Count
     131             :     sal_uInt16              mnSysWinMode;                   // Mode, when SystemWindows should be created
     132             :     sal_uInt16              mnLayout;                       // --- RTL-Flags --- currently not used, only for testing
     133             :     short                   mnDialogScaleX;                 // Scale X-Positions and sizes in Dialogs
     134             :     bool                mbInAppMain;                    // is Application::Main() on stack
     135             :     bool                mbInAppExecute;                 // is Application::Execute() on stack
     136             :     bool                mbAppQuit;                      // is Application::Quit() called
     137             :     bool                mbSettingsInit;                 // true: Settings are initialized
     138             :     bool                mbNoYield;                      // Application::Yield will not wait for events if the queue is empty
     139             :                                                             // essentially that makes it the same as Application::Reschedule
     140             :     Application::DialogCancelMode meDialogCancel;           // true: All Dialog::Execute() calls will be terminated immediately with return false
     141             :     long                    mnDefaultLayoutBorder;          // default value in pixel for layout distances used
     142             :                                                             // in window arrangers
     143             : 
     144             :     /** Controls whether showing any IME status window is toggled on or off.
     145             : 
     146             :         Only meaningful if showing IME status windows can be toggled on and off
     147             :         externally (see Application::CanToggleImeStatusWindow).
     148             :      */
     149             :     ImeStatusWindowMode meShowImeStatusWindow;
     150             : 
     151             :     DECL_STATIC_LINK( ImplSVAppData, ImplQuitMsg, void* );
     152             : };
     153             : 
     154             : struct ImplSVGDIData
     155             : {
     156             :     OutputDevice*           mpFirstWinGraphics; // First OutputDevice with a Frame Graphics
     157             :     OutputDevice*           mpLastWinGraphics;  // Last OutputDevice with a Frame Graphics
     158             :     OutputDevice*           mpFirstVirGraphics; // First OutputDevice with a VirtualDevice Graphics
     159             :     OutputDevice*           mpLastVirGraphics;  // Last OutputDevice with a VirtualDevice Graphics
     160             :     OutputDevice*           mpFirstPrnGraphics; // First OutputDevice with a InfoPrinter Graphics
     161             :     OutputDevice*           mpLastPrnGraphics;  // Last OutputDevice with a InfoPrinter Graphics
     162             :     VirtualDevice*          mpFirstVirDev;      // First VirtualDevice
     163             :     VirtualDevice*          mpLastVirDev;       // Last VirtualDevice
     164             :     Printer*                mpFirstPrinter;     // First Printer
     165             :     Printer*                mpLastPrinter;      // Last Printer
     166             :     ImplPrnQueueList*       mpPrinterQueueList; // List of all printer queue
     167             :     PhysicalFontCollection* mpScreenFontList;   // Screen-Font-List
     168             :     ImplFontCache*          mpScreenFontCache;  // Screen-Font-Cache
     169             :     ImplDirectFontSubstitution* mpDirectFontSubst;// Font-Substitutons defined in Tools->Options->Fonts
     170             :     GraphicConverter*       mpGrfConverter;     // Converter for graphics
     171             :     long                    mnRealAppFontX;     // AppFont X-Numenator for 40/tel Width
     172             :     long                    mnAppFontX;         // AppFont X-Numenator for 40/tel Width + DialogScaleX
     173             :     long                    mnAppFontY;         // AppFont Y-Numenator for 80/tel Height
     174             :     bool                    mbFontSubChanged;   // true: FontSubstitution was changed between Begin/End
     175             :     bool                    mbNativeFontConfig; // true: do not override UI font
     176             : };
     177             : 
     178             : struct ImplSVWinData
     179             : {
     180             :     vcl::Window*                 mpFirstFrame;       // First FrameWindow
     181             :     vcl::Window*                 mpDefDialogParent;  // Default Dialog Parent
     182             :     WorkWindow*             mpAppWin;           // Application-Window
     183             :     vcl::Window*                 mpFocusWin;         // window, that has the focus
     184             :     vcl::Window*                 mpActiveApplicationFrame; // the last active application frame, can be used as DefModalDialogParent if no focuswin set
     185             :     vcl::Window*                 mpCaptureWin;       // window, that has the mouse capture
     186             :     vcl::Window*                 mpLastDeacWin;      // Window, that need a deactivate (FloatingWindow-Handling)
     187             :     FloatingWindow*         mpFirstFloat;       // First FloatingWindow in PopupMode
     188             :     Dialog*                 mpLastExecuteDlg;   // First Dialog that is in Execute
     189             :     vcl::Window*                 mpExtTextInputWin;  // Window, which is in ExtTextInput
     190             :     vcl::Window*                 mpTrackWin;         // window, that is in tracking mode
     191             :     AutoTimer*              mpTrackTimer;       // tracking timer
     192             :     ImageList*              mpMsgBoxImgList;    // ImageList for MessageBox
     193             :     vcl::Window*                 mpAutoScrollWin;    // window, that is in AutoScrollMode mode
     194             :     sal_uInt16              mnTrackFlags;       // tracking flags
     195             :     sal_uInt16              mnAutoScrollFlags;  // auto scroll flags
     196             :     bool                mbNoDeactivate;     // true: do not execute Deactivate
     197             :     bool                mbNoSaveFocus;      // true: menus must not save/restore focus
     198             :     bool                mbNoSaveBackground; // true: save background is unnecessary or even less performant
     199             : };
     200             : 
     201             : typedef std::vector< std::pair< OUString, FieldUnit > > FieldUnitStringList;
     202             : 
     203             : struct ImplSVCtrlData
     204             : {
     205             :     ImageList*              mpCheckImgList;     // ImageList for CheckBoxes
     206             :     ImageList*              mpRadioImgList;     // ImageList for RadioButtons
     207             :     ImageList*              mpPinImgList;       // ImageList for PIN
     208             :     ImageList*              mpSplitHPinImgList; // ImageList for Horizontale SplitWindows
     209             :     ImageList*              mpSplitVPinImgList; // ImageList for Vertikale SplitWindows (PIN's)
     210             :     ImageList*              mpSplitHArwImgList; // ImageList for Horizontale SplitWindows (Arrows)
     211             :     ImageList*              mpSplitVArwImgList; // ImageList for Vertikale SplitWindows (Arrows)
     212             :     Image*                  mpDisclosurePlus;
     213             :     Image*                  mpDisclosureMinus;
     214             :     ImplTBDragMgr*          mpTBDragMgr;        // DragMgr for ToolBox
     215             :     sal_uInt16                  mnCheckStyle;       // CheckBox-Style for ImageList-Update
     216             :     sal_uInt16                  mnRadioStyle;       // Radio-Style for ImageList-Update
     217             :     sal_uLong                   mnLastCheckFColor;  // Letzte FaceColor fuer CheckImage
     218             :     sal_uLong                   mnLastCheckWColor;  // Letzte WindowColor fuer CheckImage
     219             :     sal_uLong                   mnLastCheckWTextColor;  // Letzte WindowTextColor fuer CheckImage
     220             :     sal_uLong                   mnLastCheckLColor;  // Letzte LightColor fuer CheckImage
     221             :     sal_uLong                   mnLastRadioFColor;  // Letzte FaceColor fuer RadioImage
     222             :     sal_uLong                   mnLastRadioWColor;  // Letzte WindowColor fuer RadioImage
     223             :     sal_uLong                   mnLastRadioLColor;  // Letzte LightColor fuer RadioImage
     224             :     FieldUnitStringList*    mpFieldUnitStrings; // list with field units
     225             :     FieldUnitStringList*    mpCleanUnitStrings; // same list but with some "fluff" like spaces removed
     226             : };
     227             : 
     228             : struct ImplSVHelpData
     229             : {
     230             :     bool                    mbContextHelp       : 1;    // is ContextHelp enabled
     231             :     bool                    mbExtHelp           : 1;    // is ExtendedHelp enabled
     232             :     bool                    mbExtHelpMode       : 1;    // is in ExtendedHelp Mode
     233             :     bool                    mbOldBalloonMode    : 1;    // BallonMode, before ExtHelpMode started
     234             :     bool                    mbBalloonHelp       : 1;    // is BalloonHelp enabled
     235             :     bool                    mbQuickHelp         : 1;    // is QuickHelp enabled
     236             :     bool                    mbSetKeyboardHelp   : 1;    // tiphelp was activated by keyboard
     237             :     bool                    mbKeyboardHelp      : 1;    // tiphelp was activated by keyboard
     238             :     bool                    mbAutoHelpId        : 1;    // generate HelpIds
     239             :     bool                    mbRequestingHelp    : 1;    // In Window::RequestHelp
     240             :     HelpTextWindow*         mpHelpWin;                  // HelpWindow
     241             :     sal_uLong                   mnLastHelpHideTime;         // ticks of last show
     242             : };
     243             : 
     244             : // "NWF" means "Native Widget Framework" and was the term used for the
     245             : // idea that StarView/OOo "widgets" should *look* (and feel) like the
     246             : // "native widgets" on each platform, even if not at all implemented
     247             : // using them. See http://people.redhat.com/dcbw/ooo-nwf.html .
     248             : 
     249         373 : struct ImplSVNWFData
     250             : {
     251             :     int                     mnStatusBarLowerRightOffset;    // amount in pixel to avoid in the lower righthand corner
     252             :     int                     mnMenuFormatBorderX;            // horizontal inner popup menu border
     253             :     int                     mnMenuFormatBorderY;            // vertical inner popup menu border
     254             :     ::Color                 maMenuBarHighlightTextColor;    // override higlight text color
     255             :                                                             // in menubar if not transparent
     256             :     bool                    mbMenuBarDockingAreaCommonBG:1; // e.g. WinXP default theme
     257             :     bool                    mbDockingAreaSeparateTB:1;      // individual toolbar backgrounds
     258             :                                                             // instead of one for docking area
     259             :     bool                    mbDockingAreaAvoidTBFrames:1;   ///< don't draw frames around the individual toolbars if mbDockingAreaSeparateTB is false
     260             :     bool                    mbToolboxDropDownSeparate:1;    // two adjacent buttons for
     261             :                                                             // toolbox dropdown buttons
     262             :     bool                    mbFlatMenu:1;                   // no popup 3D border
     263             :     bool                    mbOpenMenuOnF10:1;              // on gnome the first menu opens on F10
     264             :     bool                    mbNoFocusRects:1;               // on Aqua focus rects are not used
     265             :     bool                    mbCenteredTabs:1;               // on Aqua, tabs are centered
     266             :     bool                    mbNoActiveTabTextRaise:1;       // on Aqua the text for the selected tab
     267             :                                                             // should not "jump up" a pixel
     268             :     bool                    mbProgressNeedsErase:1;         // set true for platforms that should draw the
     269             :                                                             // window background before drawing the native
     270             :                                                             // progress bar
     271             :     bool                    mbCheckBoxNeedsErase:1;         // set true for platforms that should draw the
     272             :                                                             // window background before drawing the native
     273             :                                                             // checkbox
     274             :     bool                    mbCanDrawWidgetAnySize:1;       // set to true currently on gtk
     275             : 
     276             :     /// entire drop down listbox resembles a button, no textarea/button parts (as currently on Windows)
     277             :     bool                    mbDDListBoxNoTextArea:1;
     278             : };
     279             : 
     280          15 : struct BlendFrameCache
     281             : {
     282             :     Size m_aLastSize;
     283             :     sal_uInt8 m_nLastAlpha;
     284             :     Color m_aLastColorTopLeft;
     285             :     Color m_aLastColorTopRight;
     286             :     Color m_aLastColorBottomRight;
     287             :     Color m_aLastColorBottomLeft;
     288             :     BitmapEx m_aLastResult;
     289             : 
     290          15 :     BlendFrameCache()
     291             :         : m_aLastSize(0, 0)
     292             :         , m_nLastAlpha(0)
     293             :         , m_aLastColorTopLeft(COL_BLACK)
     294             :         , m_aLastColorTopRight(COL_BLACK)
     295             :         , m_aLastColorBottomRight(COL_BLACK)
     296          15 :         , m_aLastColorBottomLeft(COL_BLACK)
     297             :     {
     298          15 :     }
     299             : };
     300             : 
     301         746 : struct ImplSVData
     302             : {
     303             :     SalData*                mpSalData;
     304             :     SalInstance*            mpDefInst;          // Default SalInstance
     305             :     Application*            mpApp;              // pApp
     306             :     WorkWindow*             mpDefaultWin;       // Default-Window
     307             :     bool                    mbDeInit;             // Is VCL deinitializing
     308             :     sal_uLong                   mnThreadCount;      // is VCL MultiThread enabled
     309             :     ImplConfigData*         mpFirstConfigData;  // Zeiger auf ersten Config-Block
     310             :     ImplTimerData*          mpFirstTimerData;   // list of all running timers
     311             :     SalTimer*               mpSalTimer;         // interface to sal event loop/timers
     312             :     SalI18NImeStatus*       mpImeStatus;        // interface to ime status window
     313             :     SalSystem*              mpSalSystem;        // SalSystem interface
     314             :     ResMgr*                 mpResMgr;           // SV-Resource-Manager
     315             :     sal_uLong                   mnTimerPeriod;      // current timer period
     316             :     sal_uLong                   mnTimerUpdate;      // TimerCallbackProcs on stack
     317             :     bool                    mbNotAllTimerCalled;// true: Es muessen noch Timer abgearbeitet werden
     318             :     bool                    mbNoCallTimer;      // true: No Timeout calls
     319             :     ImplSVAppData           maAppData;          // indepen data for class Application
     320             :     ImplSVGDIData           maGDIData;          // indepen data for Output classes
     321             :     ImplSVWinData           maWinData;          // indepen data for Windows classes
     322             :     ImplSVCtrlData          maCtrlData;         // indepen data for Control classes
     323             :     ImplSVHelpData          maHelpData;         // indepen data for Help classes
     324             :     ImplSVNWFData           maNWFData;
     325             :     UnoWrapperBase*         mpUnoWrapper;
     326             :     vcl::Window*                 mpIntroWindow;      // the splash screen
     327             :     DockingManager*         mpDockingManager;
     328             :     BlendFrameCache*        mpBlendFrameCache;
     329             :     bool                mbIsTestTool;
     330             : 
     331             :     oslThreadIdentifier                     mnMainThreadId;
     332             :     rtl::Reference< vcl::DisplayConnection >            mxDisplayConnection;
     333             : 
     334             :     ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > mxAccessBridge;
     335             :     ::vcl::SettingsConfigItem*          mpSettingsConfigItem;
     336             :     std::list< vcl::DeleteOnDeinitBase* >*   mpDeinitDeleteList;
     337             :     boost::unordered_map< int, OUString >*     mpPaperNames;
     338             : 
     339             :     Link maDeInitHook;
     340             : };
     341             : 
     342             : void        ImplInitSVData();
     343             : void        ImplDeInitSVData();
     344             : void        ImplDestroySVData();
     345             : vcl::Window*     ImplGetDefaultWindow();
     346             : VCL_PLUGIN_PUBLIC ResMgr*     ImplGetResMgr();
     347             : VCL_PLUGIN_PUBLIC ResId VclResId( sal_Int32 nId ); // throws std::bad_alloc if no res mgr
     348             : DockingManager*     ImplGetDockingManager();
     349             : BlendFrameCache*    ImplGetBlendFrameCache();
     350             : void        ImplWindowAutoMnemonic( vcl::Window* pWindow );
     351             : 
     352             : void        ImplUpdateSystemProcessWindow();
     353             : 
     354             : bool        ImplCallHotKey( const vcl::KeyCode& rKeyCode );
     355             : void        ImplFreeHotKeyData();
     356             : void        ImplFreeEventHookData();
     357             : 
     358             : bool        ImplCallPreNotify( NotifyEvent& rEvt );
     359             : 
     360             : extern VCL_PLUGIN_PUBLIC ImplSVData* pImplSVData;
     361    67567254 : inline ImplSVData* ImplGetSVData() { return pImplSVData; }
     362             : VCL_PLUGIN_PUBLIC void ImplHideSplash();
     363             : 
     364             : bool ImplInitAccessBridge();
     365             : 
     366             : FieldUnitStringList* ImplGetFieldUnits();
     367             : FieldUnitStringList* ImplGetCleanedFieldUnits();
     368             : 
     369             : // ImplDelData is used as a "dog tag" by a window when it
     370             : // does something that could indirectly destroy the window
     371             : // TODO: wild destruction of a window should not be possible
     372             : 
     373             : struct ImplDelData
     374             : {
     375             :     ImplDelData*    mpNext;
     376             :     const vcl::Window*   mpWindow;
     377             :     bool            mbDel;
     378             : 
     379    19511604 :                     ImplDelData( const vcl::Window* pWindow = NULL )
     380    19511604 :                     : mpNext( NULL ), mpWindow( NULL ), mbDel( false )
     381    19511604 :                     { if( pWindow ) AttachToWindow( pWindow ); }
     382             : 
     383             :     virtual         ~ImplDelData();
     384             : 
     385    64744308 :     bool            IsDead() const
     386             :     {
     387             :         DBG_ASSERT( mbDel == false, "object deleted while in use !" );
     388    64744308 :         return mbDel;
     389             :     }
     390             : 
     391             : private:
     392             :     void            AttachToWindow( const vcl::Window* );
     393             : };
     394             : 
     395          40 : struct ImplFocusDelData : public ImplDelData
     396             : {
     397             :     vcl::Window*         mpFocusWin;
     398             : };
     399             : 
     400      163822 : struct ImplSVEvent
     401             : {
     402             :     void*               mpData;
     403             :     Link*               mpLink;
     404             :     vcl::Window*             mpWindow;
     405             :     ImplDelData         maDelData;
     406             :     bool                mbCall;
     407             : };
     408             : 
     409             : #endif // INCLUDED_VCL_INC_SVDATA_HXX
     410             : 
     411             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10