LCOV - code coverage report
Current view: top level - include/sfx2 - app.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 5 15 33.3 %
Date: 2015-06-13 12:38:46 Functions: 4 12 33.3 %
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             : #ifndef INCLUDED_SFX2_APP_HXX
      20             : #define INCLUDED_SFX2_APP_HXX
      21             : 
      22             : #include <sal/config.h>
      23             : #include <sfx2/dllapi.h>
      24             : #include <sal/types.h>
      25             : #include <tools/errcode.hxx>
      26             : #include <svl/smplhint.hxx>
      27             : #include <svl/poolitem.hxx>
      28             : #include <vcl/image.hxx>
      29             : #include <tools/ref.hxx>
      30             : #include <com/sun/star/uno/Reference.hxx>
      31             : #include <com/sun/star/script/XLibraryContainer.hpp>
      32             : #include <com/sun/star/task/XStatusIndicator.hpp>
      33             : 
      34             : // too many files including sfx2/app.hxx use VCL Application class but don't include the
      35             : // header file because in former times SfxApplication was derived from it
      36             : #include <vcl/svapp.hxx>
      37             : 
      38             : #include <sfx2/shell.hxx>
      39             : 
      40             : class Timer;
      41             : class WorkWindow;
      42             : class ISfxTemplateCommon;
      43             : class BasicManager;
      44             : class DdeService;
      45             : class GenLink;
      46             : class PrinterDialog;
      47             : class Point;
      48             : class Rectangle;
      49             : class AppSettings;
      50             : struct SfxChildWinContextFactory;
      51             : class SfxAppData_Impl;
      52             : class SfxBindings;
      53             : class SfxChildWinFactArr_Impl;
      54             : class SfxChildWindow;
      55             : class SfxDispatcher;
      56             : class SfxEventConfiguration;
      57             : class SfxEventHint;
      58             : class SfxItemSet;
      59             : class SfxMedium;
      60             : class SfxMenuCtrlFactArr_Impl;
      61             : class SfxNewFileDialog;
      62             : class SfxObjectShell;
      63             : class SfxObjectShellArr_Impl;
      64             : class SfxProgress;
      65             : class SfxSlotPool;
      66             : class SfxStbCtrlFactArr_Impl;
      67             : class SfxTbxCtrlFactArr_Impl;
      68             : class SfxViewFrame;
      69             : class SfxViewFrameArr_Impl;
      70             : class SfxViewShell;
      71             : class SfxViewShellArr_Impl;
      72             : class StarBASIC;
      73             : class SfxWorkWindow;
      74             : class SfxFilterMatcher;
      75             : class SfxModule;
      76             : class SfxModule;
      77             : namespace vcl { class Window; }
      78             : struct SfxChildWinFactory;
      79             : struct SfxMenuCtrlFactory;
      80             : struct SfxStbCtrlFactory;
      81             : struct SfxTbxCtrlFactory;
      82             : class SimpleResMgr;
      83             : class ModalDialog;
      84             : class SbxArray;
      85             : class SbxValue;
      86             : 
      87             : namespace sfx2
      88             : {
      89             :     class SvLinkSource;
      90             :     namespace sidebar {
      91             :         class Theme;
      92             :     }
      93             : }
      94             : 
      95           0 : class SfxLinkItem : public SfxPoolItem
      96             : {
      97             :     Link<> aLink;
      98             : public:
      99           0 :     virtual SfxPoolItem*     Clone( SfxItemPool* = 0 ) const SAL_OVERRIDE
     100           0 :     {   return new SfxLinkItem( *this ); }
     101           0 :     virtual bool             operator==( const SfxPoolItem& rL) const SAL_OVERRIDE
     102           0 :     {   return static_cast<const SfxLinkItem&>(rL).aLink == aLink; }
     103           0 :     SfxLinkItem( sal_uInt16 nWhichId, const Link<>& rValue ) : SfxPoolItem( nWhichId )
     104           0 :     {   aLink = rValue; }
     105           0 :     const Link<>&            GetValue() const { return aLink; }
     106             : };
     107             : 
     108             : #ifndef SFX_DECL_OBJECTSHELL_DEFINED
     109             : #define SFX_DECL_OBJECTSHELL_DEFINED
     110             : typedef tools::SvRef<SfxObjectShell> SfxObjectShellRef;
     111             : #endif
     112             : 
     113             : class SfxObjectShellLock;
     114             : 
     115             : class SFX2_DLLPUBLIC SfxApplication: public SfxShell
     116             : {
     117             :     SAL_DLLPRIVATE static SfxApplication* pApp;
     118             : 
     119             :     SfxAppData_Impl*            pAppData_Impl;
     120             : 
     121             :     DECL_DLLPRIVATE_LINK_TYPED( GlobalBasicErrorHdl_Impl, StarBASIC*, bool );
     122             : 
     123             :     static SfxApplication*      Create();
     124             :     void                        SettingsChange( sal_uInt16, const AppSettings & );
     125             :     void                        Quit();
     126             :     void                        Deinitialize();
     127             : 
     128             : public:
     129             :                                 TYPEINFO_OVERRIDE();
     130         208 :                                 SFX_DECL_INTERFACE(SFX_INTERFACE_SFXAPP)
     131             : 
     132             : private:
     133             :     /// SfxInterface initializer.
     134             :     static void InitInterface_Impl();
     135             : 
     136             : public:
     137             : 
     138             :                                 SfxApplication();
     139             :                                 virtual ~SfxApplication();
     140             :     static SfxApplication*      GetOrCreate();
     141    27021697 :     static SfxApplication*      Get() { return pApp;}
     142             : 
     143             :     // Resource Manager
     144             :     static ResMgr*              GetSfxResManager();
     145             : 
     146             :     // DDE
     147             : #if defined( WNT )
     148             :     long                        DdeExecute( const OUString& rCmd );
     149             : #endif
     150             :     bool                        InitializeDde();
     151             :     const DdeService*           GetDdeService() const;
     152             :     DdeService*                 GetDdeService();
     153             : #if defined( WNT )
     154             :     void                        AddDdeTopic( SfxObjectShell* );
     155             : #endif
     156             :     void                        RemoveDdeTopic( SfxObjectShell* );
     157             : 
     158             :     // "static" methods
     159             :     /**
     160             :     * @param pArgs Takes ownership
     161             :     */
     162             :     sal_uIntPtr                       LoadTemplate( SfxObjectShellLock& xDoc, const OUString& rFileName, bool bCopy=true, SfxItemSet* pArgs = 0 );
     163             :     vcl::Window*                     GetTopWindow() const;
     164             : 
     165             :     // members
     166             :     SfxFilterMatcher&           GetFilterMatcher();
     167             :     SfxProgress*                GetProgress() const;
     168             :     const OUString&               GetLastSaveDirectory() const;
     169             :     sal_uInt16                  GetFreeIndex();
     170             :     void                        ReleaseIndex(sal_uInt16 i);
     171             : 
     172             :     // Basic/Scripting
     173             :     static bool                 IsXScriptURL( const OUString& rScriptURL );
     174             :     static OUString             ChooseScript();
     175             :     static void                 MacroOrganizer( sal_Int16 nTabId );
     176             :     static ErrCode              CallBasic( const OUString&, BasicManager*, SbxArray *pArgs, SbxValue *pRet );
     177           0 :     static ErrCode              CallAppBasic( const OUString& i_macroName, SbxArray* i_args = NULL, SbxValue* i_ret = NULL )
     178           0 :                                 { return CallBasic( i_macroName, SfxApplication::GetBasicManager(), i_args, i_ret ); }
     179             :     static BasicManager*        GetBasicManager();
     180             :     com::sun::star::script::XLibraryContainer * GetDialogContainer();
     181             :     com::sun::star::script::XLibraryContainer * GetBasicContainer();
     182             :     static StarBASIC*           GetBasic();
     183             :     sal_uInt16                  SaveBasicAndDialogContainer() const;
     184             : 
     185             :     // misc.
     186             :     bool                        GetOptions(SfxItemSet &);
     187             :     void                        SetOptions(const SfxItemSet &);
     188             :     virtual void                Invalidate(sal_uInt16 nId = 0) SAL_OVERRIDE;
     189             :     void                        NotifyEvent(const SfxEventHint& rEvent, bool bSynchron = true );
     190             :     bool                        IsDowning() const;
     191             :     void                        ResetLastDir();
     192             : 
     193             :     SAL_DLLPRIVATE SfxDispatcher* GetAppDispatcher_Impl();
     194             :     SAL_DLLPRIVATE SfxDispatcher* GetDispatcher_Impl();
     195             : 
     196             :     SAL_DLLPRIVATE void         SetOptions_Impl(const SfxItemSet &);
     197             :     SAL_DLLPRIVATE bool         Initialize_Impl();
     198             : 
     199      298789 :     SAL_DLLPRIVATE SfxAppData_Impl* Get_Impl() const { return pAppData_Impl; }
     200             : 
     201             :     // Object-Factories/global arrays
     202             :     SAL_DLLPRIVATE void         RegisterChildWindow_Impl(SfxModule*, SfxChildWinFactory*);
     203             :     SAL_DLLPRIVATE void         RegisterChildWindowContext_Impl(SfxModule*, sal_uInt16, SfxChildWinContextFactory*);
     204             :     SAL_DLLPRIVATE void         RegisterStatusBarControl_Impl(SfxModule*, SfxStbCtrlFactory*);
     205             :     SAL_DLLPRIVATE void         RegisterMenuControl_Impl(SfxModule*, SfxMenuCtrlFactory*);
     206             :     SAL_DLLPRIVATE void         RegisterToolBoxControl_Impl( SfxModule*, SfxTbxCtrlFactory*);
     207             :     SAL_DLLPRIVATE SfxTbxCtrlFactArr_Impl& GetTbxCtrlFactories_Impl() const;
     208             :     SAL_DLLPRIVATE SfxStbCtrlFactArr_Impl& GetStbCtrlFactories_Impl() const;
     209             :     SAL_DLLPRIVATE SfxMenuCtrlFactArr_Impl& GetMenuCtrlFactories_Impl() const;
     210             :     SAL_DLLPRIVATE SfxChildWinFactArr_Impl& GetChildWinFactories_Impl() const;
     211             :     SAL_DLLPRIVATE SfxViewFrameArr_Impl& GetViewFrames_Impl() const;
     212             :     SAL_DLLPRIVATE SfxViewShellArr_Impl& GetViewShells_Impl() const;
     213             :     SAL_DLLPRIVATE SfxObjectShellArr_Impl& GetObjectShells_Impl() const;
     214             :     SAL_DLLPRIVATE void         SetViewFrame_Impl(SfxViewFrame *pViewFrame);
     215             : 
     216             :     // Slot Methods
     217             :     // TODO/CLEANUP: still needed?
     218             :     SAL_DLLPRIVATE void         NewDocDirectExec_Impl(SfxRequest &);
     219             :     SAL_DLLPRIVATE void         NewDocExec_Impl(SfxRequest &);
     220             :     SAL_DLLPRIVATE void         OpenDocExec_Impl(SfxRequest &);
     221             :     SAL_DLLPRIVATE void         MiscExec_Impl(SfxRequest &);
     222             :     SAL_DLLPRIVATE void         MiscState_Impl(SfxItemSet &);
     223             :     SAL_DLLPRIVATE void         PropExec_Impl(SfxRequest &);
     224             :     SAL_DLLPRIVATE void         PropState_Impl(SfxItemSet &);
     225             :     SAL_DLLPRIVATE void         INetExecute_Impl(SfxRequest &);
     226             :     SAL_DLLPRIVATE void         INetState_Impl(SfxItemSet &);
     227             :     SAL_DLLPRIVATE void         OfaExec_Impl(SfxRequest &);
     228             :     SAL_DLLPRIVATE void         OfaState_Impl(SfxItemSet &);
     229             : 
     230             :     SAL_DLLPRIVATE void         SetProgress_Impl(SfxProgress *);
     231             :     SAL_DLLPRIVATE const OUString& GetLastDir_Impl() const;
     232             :     SAL_DLLPRIVATE void         SetLastDir_Impl( const OUString & );
     233             : 
     234             :     SAL_DLLPRIVATE void         Registrations_Impl();
     235             :     SAL_DLLPRIVATE SfxWorkWindow* GetWorkWindow_Impl(const SfxViewFrame *pFrame=0) const;
     236             : 
     237             :     // TODO/CLEANUP: still needed? -- unclear whether this comment
     238             :     // refers to the GetDisabledSlotList_Impl() method which was
     239             :     // already removed, or the below methods?
     240             :     SAL_DLLPRIVATE SfxSlotPool& GetAppSlotPool_Impl() const;
     241             :     SAL_DLLPRIVATE SfxModule*   GetModule_Impl();
     242             : 
     243             :     static bool loadBrandSvg(const char *pName, BitmapEx &rBitmap, int nWidth);
     244             : 
     245             :     /** loads the application logo as used in the impress slideshow pause screen */
     246             :     static BitmapEx GetApplicationLogo(long nWidth);
     247             : 
     248             :     /** this Theme contains Images so must be deleted before DeInitVCL */
     249             :     sfx2::sidebar::Theme & GetSidebarTheme();
     250             : };
     251             : 
     252    81802528 : inline SfxApplication* SfxGetpApp()
     253             : {
     254    81802528 :     return SfxApplication::GetOrCreate();
     255             : }
     256             : 
     257             : #endif
     258             : 
     259             : 
     260             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11