LCOV - code coverage report
Current view: top level - sfx2/source/appl - appdata.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 32 32 100.0 %
Date: 2014-11-03 Functions: 10 10 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             : #include <tools/config.hxx>
      21             : #include <svl/stritem.hxx>
      22             : 
      23             : #include <osl/mutex.hxx>
      24             : 
      25             : #include <vcl/menu.hxx>
      26             : #include <vcl/msgbox.hxx>
      27             : #include <vcl/wrkwin.hxx>
      28             : #include <comphelper/processfactory.hxx>
      29             : 
      30             : #include <sfx2/viewfrm.hxx>
      31             : #include "appdata.hxx"
      32             : #include <sfx2/dispatch.hxx>
      33             : #include <sfx2/event.hxx>
      34             : #include "sfxtypes.hxx"
      35             : #include <sfx2/doctempl.hxx>
      36             : #include "arrdecl.hxx"
      37             : #include <sfx2/docfac.hxx>
      38             : #include <sfx2/docfile.hxx>
      39             : #include <sfx2/request.hxx>
      40             : #include <sfx2/sidebar/Theme.hxx>
      41             : #include "app.hrc"
      42             : #include <sfx2/sfxresid.hxx>
      43             : #include "objshimp.hxx"
      44             : #include "imestatuswindow.hxx"
      45             : #include "appbaslib.hxx"
      46             : 
      47             : #include <basic/basicmanagerrepository.hxx>
      48             : #include <basic/basmgr.hxx>
      49             : 
      50             : using ::basic::BasicManagerRepository;
      51             : using ::basic::BasicManagerCreationListener;
      52             : using ::com::sun::star::uno::Reference;
      53             : using ::com::sun::star::frame::XModel;
      54             : using ::com::sun::star::uno::XInterface;
      55             : 
      56             : class SfxBasicManagerCreationListener : public ::basic::BasicManagerCreationListener
      57             : {
      58             : private:
      59             :     SfxAppData_Impl& m_rAppData;
      60             : 
      61             : public:
      62         303 :     SfxBasicManagerCreationListener( SfxAppData_Impl& _rAppData ) :m_rAppData( _rAppData ) { }
      63             : 
      64             :     virtual ~SfxBasicManagerCreationListener();
      65             : 
      66             :     virtual void onBasicManagerCreated( const Reference< XModel >& _rxForDocument, BasicManager& _rBasicManager ) SAL_OVERRIDE;
      67             : };
      68             : 
      69         336 : SfxBasicManagerCreationListener::~SfxBasicManagerCreationListener()
      70             : {
      71         336 : }
      72             : 
      73        3808 : void SfxBasicManagerCreationListener::onBasicManagerCreated( const Reference< XModel >& _rxForDocument, BasicManager& _rBasicManager )
      74             : {
      75        3808 :     if ( _rxForDocument == NULL )
      76         166 :         m_rAppData.OnApplicationBasicManagerCreated( _rBasicManager );
      77        3808 : }
      78             : 
      79         303 : SfxAppData_Impl::SfxAppData_Impl( SfxApplication* )
      80             :     : pDdeService( 0 )
      81             :     , pDocTopics( 0 )
      82             :     , pTriggerTopic(0)
      83             :     , pDdeService2(0)
      84             :     , pFactArr(0)
      85         303 :     , pTopFrames( new SfxFrameArr_Impl )
      86             :     , pMatcher( 0 )
      87             : #if HAVE_FEATURE_SCRIPTING
      88             :     , pBasicResMgr( 0 )
      89             : #endif
      90             :     , pSvtResMgr( 0 )
      91             :     , m_pToolsErrorHdl(0)
      92             :     , m_pSoErrorHdl(0)
      93             : #if HAVE_FEATURE_SCRIPTING
      94             :     , m_pSbxErrorHdl(0)
      95             : #endif
      96             :     , pAppDispatch(NULL)
      97             :     , pTemplates( 0 )
      98             :     , pPool(0)
      99             :     , pSaveOptions( 0 )
     100             :     , pHelpOptions( 0 )
     101             :     , pProgress(0)
     102             :     , nDocModalMode(0)
     103             :     , nAutoTabPageId(0)
     104             :     , nRescheduleLocks(0)
     105             :     , nInReschedule(0)
     106         303 :     , m_xImeStatusWindow(new sfx2::appl::ImeStatusWindow(comphelper::getProcessComponentContext()))
     107             :     , pTbxCtrlFac(0)
     108             :     , pStbCtrlFac(0)
     109             :     , pMenuCtrlFac(0)
     110             :     , pViewFrames(0)
     111             :     , pViewShells(0)
     112             :     , pObjShells(0)
     113             :     , pSfxResManager(0)
     114             :     , pOfaResMgr(0)
     115         303 :     , pBasicManager( new SfxBasicManagerHolder )
     116         303 :     , pBasMgrListener( new SfxBasicManagerCreationListener( *this ) )
     117             :     , pViewFrame( 0 )
     118             :     , pSlotPool( 0 )
     119             :     , pAppDispat( 0 )
     120             :     , pInterfaces( 0 )
     121             :     , nDocNo(0)
     122             :     , nInterfaces( 0 )
     123             :     , bDispatcherLocked( false )
     124             :     , bDowning( true )
     125             :     , bInQuit( false )
     126             :     , bInvalidateOnUnlock( false )
     127        1515 :     , bODFVersionWarningLater( false )
     128             : 
     129             : {
     130             : #if HAVE_FEATURE_SCRIPTING
     131         303 :     BasicManagerRepository::registerCreationListener( *pBasMgrListener );
     132             : #endif
     133         303 : }
     134             : 
     135         336 : SfxAppData_Impl::~SfxAppData_Impl()
     136             : {
     137         168 :     DeInitDDE();
     138         168 :     delete pTopFrames;
     139         168 :     delete pBasicManager;
     140             : 
     141             : #if HAVE_FEATURE_SCRIPTING
     142         168 :     BasicManagerRepository::revokeCreationListener( *pBasMgrListener );
     143         168 :     delete pBasMgrListener;
     144             : #endif
     145         168 : }
     146             : 
     147           8 : SfxDocumentTemplates* SfxAppData_Impl::GetDocumentTemplates()
     148             : {
     149           8 :     if ( !pTemplates )
     150           6 :         pTemplates = new SfxDocumentTemplates;
     151             :     else
     152           2 :         pTemplates->ReInitFromComponent();
     153           8 :     return pTemplates;
     154             : }
     155             : 
     156         166 : void SfxAppData_Impl::OnApplicationBasicManagerCreated( BasicManager& _rBasicManager )
     157             : {
     158             : #if !HAVE_FEATURE_SCRIPTING
     159             :     (void) _rBasicManager;
     160             : #else
     161         166 :     pBasicManager->reset( &_rBasicManager );
     162             : 
     163             :     // global constants, additionally to the ones already added by createApplicationBasicManager:
     164             :     // ThisComponent
     165         166 :     Reference< XInterface > xCurrentComponent = SfxObjectShell::GetCurrentComponent();
     166         166 :     _rBasicManager.SetGlobalUNOConstant( "ThisComponent", makeAny( xCurrentComponent ) );
     167             : #endif
     168        1117 : }
     169             : 
     170             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10