LCOV - code coverage report
Current view: top level - sfx2/source/appl - app.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 91 169 53.8 %
Date: 2015-06-13 12:38:46 Functions: 16 32 50.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 <config_features.h>
      21             : 
      22             : #if defined UNX
      23             : #include <limits.h>
      24             : #else // UNX
      25             : #include <stdlib.h>
      26             : #ifndef PATH_MAX
      27             : #define PATH_MAX _MAX_PATH
      28             : #endif
      29             : #endif // UNX
      30             : 
      31             : #include <sfx2/app.hxx>
      32             : #include <sfx2/frame.hxx>
      33             : #include <basic/basrdll.hxx>
      34             : #include <basic/sbmeth.hxx>
      35             : #include <basic/sbmod.hxx>
      36             : #include <svtools/asynclink.hxx>
      37             : #include <svl/stritem.hxx>
      38             : #include <svl/eitem.hxx>
      39             : #include <svl/urlbmk.hxx>
      40             : #include <vcl/msgbox.hxx>
      41             : #include <svtools/sfxecode.hxx>
      42             : #include <svtools/ehdl.hxx>
      43             : 
      44             : #include <svl/svdde.hxx>
      45             : #include <unotools/tempfile.hxx>
      46             : #include <osl/file.hxx>
      47             : #include <com/sun/star/uno/Sequence.hxx>
      48             : #include <com/sun/star/uno/Any.hxx>
      49             : #include <com/sun/star/lang/XInitialization.hpp>
      50             : #include <com/sun/star/frame/XFrameActionListener.hpp>
      51             : #include <com/sun/star/frame/XComponentLoader.hpp>
      52             : #include <com/sun/star/frame/XFrame.hpp>
      53             : #include <com/sun/star/frame/FrameActionEvent.hpp>
      54             : #include <com/sun/star/frame/FrameAction.hpp>
      55             : #include <com/sun/star/loader/XImplementationLoader.hpp>
      56             : #include <com/sun/star/mozilla/XPluginInstance.hpp>
      57             : #include <com/sun/star/frame/XFramesSupplier.hpp>
      58             : #include <com/sun/star/container/XIndexAccess.hpp>
      59             : #include <com/sun/star/beans/XPropertySet.hpp>
      60             : #include <comphelper/processfactory.hxx>
      61             : #include <com/sun/star/uri/UriReferenceFactory.hpp>
      62             : #include <com/sun/star/uri/XVndSunStarScriptUrl.hpp>
      63             : #include <basic/basmgr.hxx>
      64             : #include <toolkit/helper/vclunohelper.hxx>
      65             : #include <vcl/svapp.hxx>
      66             : #include <sfx2/sfxhelp.hxx>
      67             : #include <sfx2/request.hxx>
      68             : #include "sfxtypes.hxx"
      69             : #include <sfx2/sfxresid.hxx>
      70             : #include "arrdecl.hxx"
      71             : #include <sfx2/progress.hxx>
      72             : #include <sfx2/objsh.hxx>
      73             : #include <sfx2/docfac.hxx>
      74             : #include <sfx2/docfile.hxx>
      75             : #include <sfx2/docfilt.hxx>
      76             : #include <sfx2/new.hxx>
      77             : #include <sfx2/bindings.hxx>
      78             : #include <sfx2/dispatch.hxx>
      79             : #include <sfx2/viewsh.hxx>
      80             : #include <sfx2/genlink.hxx>
      81             : #include <sfx2/viewfrm.hxx>
      82             : #include "appdata.hxx"
      83             : #include "openflag.hxx"
      84             : #include "app.hrc"
      85             : #include "virtmenu.hxx"
      86             : #include <sfx2/module.hxx>
      87             : #include <sfx2/event.hxx>
      88             : #include "imestatuswindow.hxx"
      89             : #include "workwin.hxx"
      90             : #include <sfx2/sidebar/Theme.hxx>
      91             : #include <sfx2/tbxctrl.hxx>
      92             : #include <sfx2/sfxdlg.hxx>
      93             : #include <sfx2/stbitem.hxx>
      94             : #include "eventsupplier.hxx"
      95             : #include <sfx2/dockwin.hxx>
      96             : #include "shellimpl.hxx"
      97             : 
      98             : #ifdef DBG_UTIL
      99             : #include <sfx2/mnuitem.hxx>
     100             : #endif
     101             : 
     102             : #include <unotools/saveopt.hxx>
     103             : #include <svtools/helpopt.hxx>
     104             : #include <unotools/pathoptions.hxx>
     105             : #include <unotools/viewoptions.hxx>
     106             : #include <unotools/moduleoptions.hxx>
     107             : #include <unotools/historyoptions.hxx>
     108             : #include <svtools/menuoptions.hxx>
     109             : #include <svtools/miscopt.hxx>
     110             : #include <unotools/useroptions.hxx>
     111             : #include <unotools/securityoptions.hxx>
     112             : #include <unotools/localisationoptions.hxx>
     113             : #include <unotools/fontoptions.hxx>
     114             : #include <unotools/syslocaleoptions.hxx>
     115             : #include <unotools/syslocale.hxx>
     116             : #include <framework/addonsoptions.hxx>
     117             : #include <unotools/extendedsecurityoptions.hxx>
     118             : #include <rtl/instance.hxx>
     119             : #include <rtl/strbuf.hxx>
     120             : #include <boost/scoped_ptr.hpp>
     121             : 
     122             : using namespace ::com::sun::star;
     123             : 
     124             : // Static member
     125             : SfxApplication* SfxApplication::pApp = NULL;
     126             : #if HAVE_FEATURE_SCRIPTING
     127             : static BasicDLL*       pBasic   = NULL;
     128             : #endif
     129             : 
     130             : #if HAVE_FEATURE_DESKTOP
     131             : static SfxHelp*        pSfxHelp = NULL;
     132             : #endif
     133             : 
     134             : namespace
     135             : {
     136             :     class theApplicationMutex
     137             :         : public rtl::Static<osl::Mutex, theApplicationMutex> {};
     138             : }
     139             : 
     140             : #include <framework/imageproducer.hxx>
     141             : #include <framework/sfxhelperfunctions.hxx>
     142             : #include <sfx2/imagemgr.hxx>
     143             : #include "fwkhelper.hxx"
     144             : 
     145    81802528 : SfxApplication* SfxApplication::GetOrCreate()
     146             : {
     147             :     // SFX on demand
     148    81802528 :     ::osl::MutexGuard aGuard(theApplicationMutex::get());
     149    81802528 :     if (!pApp)
     150             :     {
     151             :         SAL_INFO( "sfx.appl", "SfxApplication::SetApp" );
     152             : 
     153         208 :         pApp = new SfxApplication;
     154             : 
     155             :         // at the moment a bug may occur when Initialize_Impl returns FALSE,
     156             :         // but this is only temporary because all code that may cause such
     157             :         // a fault will be moved outside the SFX
     158         208 :         pApp->Initialize_Impl();
     159             : 
     160         208 :         ::framework::SetImageProducer( GetImage );
     161         208 :         ::framework::SetRefreshToolbars( RefreshToolbars );
     162         208 :         ::framework::SetToolBoxControllerCreator( SfxToolBoxControllerFactory );
     163         208 :         ::framework::SetStatusBarControllerCreator( SfxStatusBarControllerFactory );
     164         208 :         ::framework::SetDockingWindowCreator( SfxDockingWindowFactory );
     165         208 :         ::framework::SetIsDockingWindowVisible( IsDockingWindowVisible );
     166         208 :         ::framework::SetActivateToolPanel( &SfxViewFrame::ActivateToolPanel );
     167             : #if HAVE_FEATURE_DESKTOP
     168         208 :         Application::SetHelp( pSfxHelp );
     169         208 :         if ( SvtHelpOptions().IsHelpTips() )
     170         208 :             Help::EnableQuickHelp();
     171             :         else
     172           0 :             Help::DisableQuickHelp();
     173         208 :         if ( SvtHelpOptions().IsHelpTips() && SvtHelpOptions().IsExtendedHelp() )
     174           0 :             Help::EnableBalloonHelp();
     175             :         else
     176         208 :             Help::DisableBalloonHelp();
     177             : #endif
     178             :     }
     179    81802528 :     return pApp;
     180             : }
     181             : 
     182         208 : SfxApplication::SfxApplication()
     183         208 :     : pAppData_Impl( 0 )
     184             : {
     185         208 :     SetName( OUString("StarOffice") );
     186         208 :     SvtViewOptions::AcquireOptions();
     187             : 
     188         208 :     pAppData_Impl = new SfxAppData_Impl( this );
     189         208 :     pAppData_Impl->m_xImeStatusWindow->init();
     190             : 
     191             :     SAL_INFO( "sfx.appl", "{ initialize DDE" );
     192             : 
     193         208 :     bool bOk = InitializeDde();
     194             : 
     195             : #ifdef DBG_UTIL
     196             :     if( !bOk )
     197             :     {
     198             :         OStringBuffer aStr("No DDE-Service possible. Error: ");
     199             :         if( GetDdeService() )
     200             :             aStr.append(static_cast<sal_Int32>(GetDdeService()->GetError()));
     201             :         else
     202             :             aStr.append('?');
     203             :         DBG_ASSERT( false, aStr.getStr() );
     204             :     }
     205             : #else
     206             :     (void)bOk;
     207             : #endif
     208             : 
     209             : #if HAVE_FEATURE_DESKTOP
     210         208 :     pSfxHelp = new SfxHelp;
     211             : #endif
     212             : 
     213             : #if HAVE_FEATURE_SCRIPTING
     214         208 :     pBasic   = new BasicDLL;
     215         208 :     StarBASIC::SetGlobalErrorHdl( LINK( this, SfxApplication, GlobalBasicErrorHdl_Impl ) );
     216             : #endif
     217             :     SAL_INFO( "sfx.appl", "} initialize DDE" );
     218         208 : }
     219             : 
     220         357 : SfxApplication::~SfxApplication()
     221             : {
     222             :     OSL_ENSURE( GetObjectShells_Impl().size() == 0, "Memory leak: some object shells were not removed!" );
     223             : 
     224         119 :     Broadcast( SfxSimpleHint(SFX_HINT_DYING) );
     225             : 
     226         119 :     SfxModule::DestroyModules_Impl();
     227             : 
     228             : #if HAVE_FEATURE_DESKTOP
     229         119 :     delete pSfxHelp;
     230         119 :     Application::SetHelp( NULL );
     231             : #endif
     232             : 
     233             :     // delete global options
     234         119 :     SvtViewOptions::ReleaseOptions();
     235             : 
     236         119 :     if ( !pAppData_Impl->bDowning )
     237         119 :         Deinitialize();
     238             : 
     239             : #if HAVE_FEATURE_SCRIPTING
     240         119 :     delete pBasic;
     241             : #endif
     242             : 
     243         119 :     delete pAppData_Impl;
     244         119 :     pApp = 0;
     245         238 : }
     246             : 
     247             : 
     248             : 
     249           0 : const OUString& SfxApplication::GetLastDir_Impl() const
     250             : 
     251             : /*  [Description]
     252             : 
     253             :     Internal method by which the last set directory with the method
     254             :     <SfxApplication::SetLastDir_Impl()> in SFX is returned.
     255             : 
     256             :     This is usually the most recently addressed by the
     257             :     SfxFileDialog directory.
     258             : 
     259             :     [Cross-reference]
     260             :     <SfxApplication::SetLastDir_Impl()>
     261             : */
     262             : 
     263             : {
     264           0 :     return pAppData_Impl->aLastDir;
     265             : }
     266             : 
     267           0 : const OUString& SfxApplication::GetLastSaveDirectory() const
     268             : 
     269             : /*  [Description]
     270             : 
     271             :     As <SfxApplication::GetLastDir_Impl()>, only external
     272             : 
     273             :     [Cross-reference]
     274             :     <SfxApplication::GetLastDir_Impl()>
     275             : */
     276             : 
     277             : {
     278           0 :     return GetLastDir_Impl();
     279             : }
     280             : 
     281             : 
     282             : 
     283           0 : void SfxApplication::SetLastDir_Impl
     284             : (
     285             :     const OUString&   rNewDir     /* Complete directory path as a string */
     286             : )
     287             : 
     288             : /*  [Description]
     289             : 
     290             :     Internal Method, by which a directory path is set that was last addressed
     291             :     (eg by the SfxFileDialog).
     292             : 
     293             :     [Cross-reference]
     294             :     <SfxApplication::GetLastDir_Impl()>
     295             : */
     296             : 
     297             : {
     298           0 :     pAppData_Impl->aLastDir = rNewDir;
     299           0 : }
     300             : 
     301             : 
     302             : 
     303           0 : void SfxApplication::ResetLastDir()
     304             : {
     305           0 :     pAppData_Impl->aLastDir.clear();
     306           0 : }
     307             : 
     308             : 
     309             : 
     310           0 : SfxDispatcher* SfxApplication::GetDispatcher_Impl()
     311             : {
     312           0 :     return pAppData_Impl->pViewFrame? pAppData_Impl->pViewFrame->GetDispatcher(): pAppData_Impl->pAppDispat;
     313             : }
     314             : 
     315             : 
     316       10565 : void SfxApplication::SetViewFrame_Impl( SfxViewFrame *pFrame )
     317             : {
     318       10565 :     if ( pFrame != pAppData_Impl->pViewFrame )
     319             :     {
     320             :         // get the containerframes ( if one of the frames is an InPlaceFrame )
     321        6274 :         SfxViewFrame *pOldContainerFrame = pAppData_Impl->pViewFrame;
     322       12548 :         while ( pOldContainerFrame && pOldContainerFrame->GetParentViewFrame_Impl() )
     323           0 :             pOldContainerFrame = pOldContainerFrame->GetParentViewFrame_Impl();
     324        6274 :         SfxViewFrame *pNewContainerFrame = pFrame;
     325       12548 :         while ( pNewContainerFrame && pNewContainerFrame->GetParentViewFrame_Impl() )
     326           0 :             pNewContainerFrame = pNewContainerFrame->GetParentViewFrame_Impl();
     327             : 
     328             :         // DocWinActivate : both frames belong to the same TopWindow
     329             :         // TopWinActivate : both frames belong to different TopWindows
     330             : 
     331        6274 :         bool bTaskActivate = pOldContainerFrame != pNewContainerFrame;
     332             : 
     333        6274 :         if ( pOldContainerFrame )
     334             :         {
     335        3145 :             if ( bTaskActivate )
     336        3145 :                 NotifyEvent( SfxViewEventHint( SFX_EVENT_DEACTIVATEDOC, GlobalEventConfig::GetEventName(GlobalEventId::DEACTIVATEDOC), pOldContainerFrame->GetObjectShell(), pOldContainerFrame->GetFrame().GetController() ) );
     337        3145 :             pOldContainerFrame->DoDeactivate( bTaskActivate, pFrame );
     338             : 
     339        3145 :             if( pOldContainerFrame->GetProgress() )
     340           0 :                 pOldContainerFrame->GetProgress()->Suspend();
     341             :         }
     342             : 
     343        6274 :         pAppData_Impl->pViewFrame = pFrame;
     344             : 
     345        6274 :         if( pNewContainerFrame )
     346             :         {
     347        3148 :             pNewContainerFrame->DoActivate( bTaskActivate );
     348        3148 :             if ( bTaskActivate && pNewContainerFrame->GetObjectShell() )
     349             :             {
     350        3148 :                 pNewContainerFrame->GetObjectShell()->PostActivateEvent_Impl( pNewContainerFrame );
     351        3148 :                 NotifyEvent(SfxViewEventHint(SFX_EVENT_ACTIVATEDOC, GlobalEventConfig::GetEventName(GlobalEventId::ACTIVATEDOC), pNewContainerFrame->GetObjectShell(), pNewContainerFrame->GetFrame().GetController() ) );
     352             :             }
     353             : 
     354        3148 :             SfxProgress *pProgress = pNewContainerFrame->GetProgress();
     355        3148 :             if ( pProgress )
     356             :             {
     357           0 :                 if( pProgress->IsSuspended() )
     358           0 :                     pProgress->Resume();
     359             :                 else
     360           0 :                     pProgress->SetState( pProgress->GetState() );
     361             :             }
     362             : 
     363        3148 :             if ( pAppData_Impl->pViewFrame->GetViewShell() )
     364             :             {
     365        3148 :                 SfxDispatcher* pDisp = pAppData_Impl->pViewFrame->GetDispatcher();
     366        3148 :                 pDisp->Flush();
     367        3148 :                 pDisp->Update_Impl(true);
     368             :             }
     369             :         }
     370             :     }
     371             : 
     372             :     // even if the frame actually didn't change, ensure its document is forwarded
     373             :     // to SfxObjectShell::SetCurrentComponent.
     374             :     // Otherwise, the CurrentComponent might not be correct, in case it has meanwhile
     375             :     // been reset to some other document, by some non-SFX component.
     376             :     // #i49133# / 2007-12-19 / frank.schoenheit@sun.com
     377       10565 :     if ( pFrame && pFrame->GetViewShell() )
     378        7439 :         pFrame->GetViewShell()->SetCurrentDocument();
     379       10565 : }
     380             : 
     381        8896 : ResMgr* SfxApplication::GetSfxResManager()
     382             : {
     383        8896 :     return SfxResId::GetResMgr();
     384             : }
     385             : 
     386             : 
     387             : 
     388           0 : void SfxApplication::SetProgress_Impl
     389             : (
     390             :     SfxProgress *pProgress
     391             : 
     392             : )
     393             : {
     394             :     DBG_ASSERT( ( !pAppData_Impl->pProgress && pProgress ) ||
     395             :                 ( pAppData_Impl->pProgress && !pProgress ),
     396             :                 "Progress acitivation/deacitivation mismatch" );
     397             : 
     398           0 :     if ( pAppData_Impl->pProgress && pProgress )
     399             :     {
     400           0 :         pAppData_Impl->pProgress->Suspend();
     401           0 :         pAppData_Impl->pProgress->UnLock();
     402           0 :         delete pAppData_Impl->pProgress;
     403             :     }
     404             : 
     405           0 :     pAppData_Impl->pProgress = pProgress;
     406           0 : }
     407             : 
     408             : 
     409             : 
     410         729 : sal_uInt16 SfxApplication::GetFreeIndex()
     411             : {
     412         729 :     return pAppData_Impl->aIndexBitSet.GetFreeIndex()+1;
     413             : }
     414             : 
     415             : 
     416             : 
     417         728 : void SfxApplication::ReleaseIndex(sal_uInt16 i)
     418             : {
     419         728 :     pAppData_Impl->aIndexBitSet.ReleaseIndex(i-1);
     420         728 : }
     421             : 
     422             : 
     423             : 
     424           0 : vcl::Window* SfxApplication::GetTopWindow() const
     425             : {
     426           0 :     SfxWorkWindow* pWork = GetWorkWindow_Impl( SfxViewFrame::Current() );
     427           0 :     return pWork ? pWork->GetWindow() : NULL;
     428             : }
     429             : 
     430       50154 : SfxTbxCtrlFactArr_Impl&     SfxApplication::GetTbxCtrlFactories_Impl() const
     431             : {
     432       50154 :     return *pAppData_Impl->pTbxCtrlFac;
     433             : }
     434             : 
     435         646 : SfxStbCtrlFactArr_Impl&     SfxApplication::GetStbCtrlFactories_Impl() const
     436             : {
     437         646 :     return *pAppData_Impl->pStbCtrlFac;
     438             : }
     439             : 
     440           0 : SfxMenuCtrlFactArr_Impl&    SfxApplication::GetMenuCtrlFactories_Impl() const
     441             : {
     442           0 :     return *pAppData_Impl->pMenuCtrlFac;
     443             : }
     444             : 
     445    53727402 : SfxViewFrameArr_Impl&       SfxApplication::GetViewFrames_Impl() const
     446             : {
     447    53727402 :     return *pAppData_Impl->pViewFrames;
     448             : }
     449             : 
     450        8451 : SfxViewShellArr_Impl&       SfxApplication::GetViewShells_Impl() const
     451             : {
     452        8451 :     return *pAppData_Impl->pViewShells;
     453             : }
     454             : 
     455       24032 : SfxObjectShellArr_Impl&     SfxApplication::GetObjectShells_Impl() const
     456             : {
     457       24032 :     return *pAppData_Impl->pObjShells;
     458             : }
     459             : 
     460           0 : void SfxApplication::Invalidate( sal_uInt16 nId )
     461             : {
     462           0 :     for( SfxViewFrame* pFrame = SfxViewFrame::GetFirst(); pFrame; pFrame = SfxViewFrame::GetNext( *pFrame ) )
     463           0 :         Invalidate_Impl( pFrame->GetBindings(), nId );
     464           0 : }
     465             : 
     466             : #if HAVE_FEATURE_SCRIPTING
     467             : 
     468             : #ifndef DISABLE_DYNLOADING
     469             : 
     470             : typedef long (SAL_CALL *basicide_handle_basic_error)(void*);
     471             : typedef void (SAL_CALL *basicide_macro_organizer)(sal_Int16);
     472             : 
     473           0 : extern "C" { static void SAL_CALL thisModule() {} }
     474             : 
     475             : #else
     476             : 
     477             : extern "C" long basicide_handle_basic_error(void*);
     478             : extern "C" void basicide_macro_organizer(sal_Int16);
     479             : 
     480             : #endif
     481             : 
     482             : #endif
     483             : 
     484           0 : IMPL_LINK_TYPED( SfxApplication, GlobalBasicErrorHdl_Impl, StarBASIC*, pStarBasic, bool )
     485             : {
     486             : #if !HAVE_FEATURE_SCRIPTING
     487             :     (void) pStarBasic;
     488             :     return false;
     489             : #else
     490             : 
     491             : #ifndef DISABLE_DYNLOADING
     492             :     // load basctl module
     493           0 :     osl::Module aMod;
     494           0 :     aMod.loadRelative(&thisModule, SVLIBRARY("basctl"), 0);
     495             : 
     496             :     // get symbol
     497           0 :     basicide_handle_basic_error pSymbol = reinterpret_cast<basicide_handle_basic_error>(aMod.getFunctionSymbol("basicide_handle_basic_error"));
     498             : 
     499           0 :     aMod.release();
     500             : 
     501             :     // call basicide_handle_basic_error in basctl
     502           0 :     bool nRet = pSymbol && pSymbol( pStarBasic );
     503             : 
     504             : #else
     505             : 
     506             :     bool nRet = basicide_handle_basic_error( pStarBasic );
     507             : 
     508             : #endif
     509             : 
     510           0 :     return nRet;
     511             : 
     512             : #endif
     513             : }
     514             : 
     515           0 : bool SfxApplication::IsXScriptURL( const OUString& rScriptURL )
     516             : {
     517           0 :     bool result = false;
     518             : 
     519             : #if !HAVE_FEATURE_SCRIPTING
     520             :     (void) rScriptURL;
     521             : #else
     522             :     ::com::sun::star::uno::Reference
     523             :         < ::com::sun::star::uno::XComponentContext > xContext =
     524           0 :             ::comphelper::getProcessComponentContext();
     525             : 
     526             :     ::com::sun::star::uno::Reference
     527             :         < ::com::sun::star::uri::XUriReferenceFactory >
     528           0 :             xFactory = ::com::sun::star::uri::UriReferenceFactory::create( xContext );
     529             : 
     530             :     try
     531             :     {
     532             :         ::com::sun::star::uno::Reference
     533             :             < ::com::sun::star::uri::XVndSunStarScriptUrl >
     534           0 :                 xUrl( xFactory->parse( rScriptURL ),
     535           0 :                     ::com::sun::star::uno::UNO_QUERY );
     536             : 
     537           0 :         if ( xUrl.is() )
     538             :         {
     539           0 :             result = true;
     540           0 :         }
     541             :     }
     542           0 :     catch (const ::com::sun::star::uno::RuntimeException&)
     543             :     {
     544             :         // ignore, will just return FALSE
     545             :     }
     546             : #endif
     547           0 :     return result;
     548             : }
     549             : 
     550             : OUString
     551           0 : SfxApplication::ChooseScript()
     552             : {
     553           0 :     OUString aScriptURL;
     554             : 
     555             : #if HAVE_FEATURE_SCRIPTING
     556           0 :     SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create();
     557           0 :     if ( pFact )
     558             :     {
     559             :         SAL_INFO( "sfx.appl", "create selector dialog");
     560             : 
     561           0 :         const SfxViewFrame* pViewFrame = SfxViewFrame::Current();
     562           0 :         const SfxFrame* pFrame = pViewFrame ? &pViewFrame->GetFrame() : NULL;
     563           0 :         uno::Reference< frame::XFrame > xFrame( pFrame ? pFrame->GetFrameInterface() : uno::Reference< frame::XFrame >() );
     564             : 
     565             :         boost::scoped_ptr<AbstractScriptSelectorDialog> pDlg(
     566           0 :             pFact->CreateScriptSelectorDialog( NULL, false, xFrame ));
     567             : 
     568             :         SAL_INFO( "sfx.appl", "done, now exec it");
     569             : 
     570           0 :           sal_uInt16 nRet = pDlg->Execute();
     571             : 
     572             :         SAL_INFO( "sfx.appl", "has returned");
     573             : 
     574           0 :         if ( nRet == RET_OK )
     575             :         {
     576           0 :             aScriptURL = pDlg->GetScriptURL();
     577           0 :         }
     578             :     }
     579             : #endif
     580           0 :     return aScriptURL;
     581             : }
     582             : 
     583           0 : void SfxApplication::MacroOrganizer( sal_Int16 nTabId )
     584             : {
     585             : #if !HAVE_FEATURE_SCRIPTING
     586             :     (void) nTabId;
     587             : #else
     588             : 
     589             : #ifndef DISABLE_DYNLOADING
     590             :     // load basctl module
     591           0 :     osl::Module aMod;
     592           0 :     aMod.loadRelative(&thisModule, SVLIBRARY("basctl"), 0);
     593             : 
     594             :     // get symbol
     595           0 :     basicide_macro_organizer pSymbol = reinterpret_cast<basicide_macro_organizer>(aMod.getFunctionSymbol("basicide_macro_organizer"));
     596             : 
     597           0 :     aMod.release();
     598             : 
     599             :     SAL_WARN_IF(!pSymbol, "sfx.doc", "SfxApplication::MacroOrganizer, no symbol!");
     600           0 :     if (!pSymbol)
     601           0 :         return;
     602             : 
     603             :     // call basicide_macro_organizer in basctl
     604           0 :     pSymbol( nTabId );
     605             : 
     606             : #else
     607             : 
     608             :     basicide_macro_organizer( nTabId );
     609             : 
     610             : #endif
     611             : 
     612             : #endif
     613             : }
     614             : 
     615           0 : ErrCode SfxApplication::CallBasic( const OUString& rCode, BasicManager* pMgr, SbxArray* pArgs, SbxValue* pRet )
     616             : {
     617             : #if !HAVE_FEATURE_SCRIPTING
     618             :     (void) rCode;
     619             :     (void) pMgr;
     620             :     (void) pArgs;
     621             :     (void) pRet;
     622             :     return ERRCODE_BASIC_CANNOT_LOAD;
     623             : #else
     624           0 :     return pMgr->ExecuteMacro( rCode, pArgs, pRet);
     625             : #endif
     626             : }
     627             : 
     628      326713 : sfx2::sidebar::Theme & SfxApplication::GetSidebarTheme()
     629             : {
     630      326713 :     if (!pAppData_Impl->m_pSidebarTheme.is())
     631             :     {
     632          97 :         pAppData_Impl->m_pSidebarTheme.set(new sfx2::sidebar::Theme);
     633          97 :         pAppData_Impl->m_pSidebarTheme->InitializeTheme();
     634             :     }
     635      326713 :     return *pAppData_Impl->m_pSidebarTheme;
     636         648 : }
     637             : 
     638             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11