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

Generated by: LCOV version 1.10