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

Generated by: LCOV version 1.10