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

Generated by: LCOV version 1.10