LCOV - code coverage report
Current view: top level - sfx2/source/appl - app.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 1 170 0.6 %
Date: 2014-04-14 Functions: 2 33 6.1 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      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             : 
     120             : using namespace ::com::sun::star;
     121             : 
     122             : // Static member
     123             : SfxApplication* SfxApplication::pApp = NULL;
     124             : #ifndef DISABLE_SCRIPTING
     125             : static BasicDLL*       pBasic   = NULL;
     126             : #endif
     127             : 
     128             : #if HAVE_FEATURE_DESKTOP
     129             : static SfxHelp*        pSfxHelp = NULL;
     130             : #endif
     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           0 : SfxApplication* SfxApplication::GetOrCreate()
     144             : {
     145             :     // SFX on demand
     146           0 :     ::osl::MutexGuard aGuard(theApplicationMutex::get());
     147           0 :     if (!pApp)
     148             :     {
     149             :         SAL_INFO( "sfx.appl", "SfxApplication::SetApp" );
     150             : 
     151           0 :         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           0 :         pApp->Initialize_Impl();
     157             : 
     158           0 :         ::framework::SetImageProducer( GetImage );
     159           0 :         ::framework::SetRefreshToolbars( RefreshToolbars );
     160           0 :         ::framework::SetToolBoxControllerCreator( SfxToolBoxControllerFactory );
     161           0 :         ::framework::SetStatusBarControllerCreator( SfxStatusBarControllerFactory );
     162           0 :         ::framework::SetDockingWindowCreator( SfxDockingWindowFactory );
     163           0 :         ::framework::SetIsDockingWindowVisible( IsDockingWindowVisible );
     164           0 :         ::framework::SetActivateToolPanel( &SfxViewFrame::ActivateToolPanel );
     165             : #if HAVE_FEATURE_DESKTOP
     166           0 :         Application::SetHelp( pSfxHelp );
     167           0 :         if ( SvtHelpOptions().IsHelpTips() )
     168           0 :             Help::EnableQuickHelp();
     169             :         else
     170           0 :             Help::DisableQuickHelp();
     171           0 :         if ( SvtHelpOptions().IsHelpTips() && SvtHelpOptions().IsExtendedHelp() )
     172           0 :             Help::EnableBalloonHelp();
     173             :         else
     174           0 :             Help::DisableBalloonHelp();
     175             : #endif
     176             :     }
     177           0 :     return pApp;
     178             : }
     179             : 
     180           0 : SfxApplication::SfxApplication()
     181           0 :     : pAppData_Impl( 0 )
     182             : {
     183             :     SAL_INFO( "sfx.appl", "SfxApplication::SfxApplication" );
     184             : 
     185           0 :     SetName( OUString("StarOffice") );
     186           0 :     SvtViewOptions::AcquireOptions();
     187             : 
     188           0 :     pAppData_Impl = new SfxAppData_Impl( this );
     189           0 :     pAppData_Impl->m_xImeStatusWindow->init();
     190             : 
     191             :     SAL_INFO( "sfx.appl", "{ initialize DDE" );
     192             : 
     193           0 :     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           0 :     pSfxHelp = new SfxHelp;
     211             : #endif
     212             : 
     213             : #ifndef DISABLE_SCRIPTING
     214           0 :     pBasic   = new BasicDLL;
     215           0 :     StarBASIC::SetGlobalErrorHdl( LINK( this, SfxApplication, GlobalBasicErrorHdl_Impl ) );
     216             : #endif
     217             :     SAL_INFO( "sfx.appl", "} initialize DDE" );
     218           0 : }
     219             : 
     220           0 : SfxApplication::~SfxApplication()
     221             : {
     222             :     OSL_ENSURE( GetObjectShells_Impl().size() == 0, "Memory leak: some object shells were not removed!" );
     223             : 
     224           0 :     Broadcast( SfxSimpleHint(SFX_HINT_DYING) );
     225             : 
     226           0 :     SfxModule::DestroyModules_Impl();
     227             : 
     228             : #if HAVE_FEATURE_DESKTOP
     229           0 :     delete pSfxHelp;
     230           0 :     Application::SetHelp( NULL );
     231             : #endif
     232             : 
     233             :     // delete global options
     234           0 :     SvtViewOptions::ReleaseOptions();
     235             : 
     236             : #ifndef DISABLE_SCRIPTING
     237           0 :     delete pBasic;
     238             : #endif
     239           0 :     if ( !pAppData_Impl->bDowning )
     240           0 :         Deinitialize();
     241             : 
     242           0 :     delete pAppData_Impl;
     243           0 :     pApp = 0;
     244           0 : }
     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           0 : void SfxApplication::SetViewFrame_Impl( SfxViewFrame *pFrame )
     316             : {
     317           0 :     if ( pFrame != pAppData_Impl->pViewFrame )
     318             :     {
     319             :         // get the containerframes ( if one of the frames is an InPlaceFrame )
     320           0 :         SfxViewFrame *pOldContainerFrame = pAppData_Impl->pViewFrame;
     321           0 :         while ( pOldContainerFrame && pOldContainerFrame->GetParentViewFrame_Impl() )
     322           0 :             pOldContainerFrame = pOldContainerFrame->GetParentViewFrame_Impl();
     323           0 :         SfxViewFrame *pNewContainerFrame = pFrame;
     324           0 :         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           0 :         bool bTaskActivate = pOldContainerFrame != pNewContainerFrame;
     331             : 
     332           0 :         if ( pOldContainerFrame )
     333             :         {
     334           0 :             if ( bTaskActivate )
     335           0 :                 NotifyEvent( SfxViewEventHint( SFX_EVENT_DEACTIVATEDOC, GlobalEventConfig::GetEventName(STR_EVENT_DEACTIVATEDOC), pOldContainerFrame->GetObjectShell(), pOldContainerFrame->GetFrame().GetController() ) );
     336           0 :             pOldContainerFrame->DoDeactivate( bTaskActivate, pFrame );
     337             : 
     338           0 :             if( pOldContainerFrame->GetProgress() )
     339           0 :                 pOldContainerFrame->GetProgress()->Suspend();
     340             :         }
     341             : 
     342           0 :         pAppData_Impl->pViewFrame = pFrame;
     343             : 
     344           0 :         if( pNewContainerFrame )
     345             :         {
     346           0 :             pNewContainerFrame->DoActivate( bTaskActivate );
     347           0 :             if ( bTaskActivate && pNewContainerFrame->GetObjectShell() )
     348             :             {
     349           0 :                 pNewContainerFrame->GetObjectShell()->PostActivateEvent_Impl( pNewContainerFrame );
     350           0 :                 NotifyEvent(SfxViewEventHint(SFX_EVENT_ACTIVATEDOC, GlobalEventConfig::GetEventName(STR_EVENT_ACTIVATEDOC), pNewContainerFrame->GetObjectShell(), pNewContainerFrame->GetFrame().GetController() ) );
     351             :             }
     352             : 
     353           0 :             SfxProgress *pProgress = pNewContainerFrame->GetProgress();
     354           0 :             if ( pProgress )
     355             :             {
     356           0 :                 if( pProgress->IsSuspended() )
     357           0 :                     pProgress->Resume();
     358             :                 else
     359           0 :                     pProgress->SetState( pProgress->GetState() );
     360             :             }
     361             : 
     362           0 :             if ( pAppData_Impl->pViewFrame->GetViewShell() )
     363             :             {
     364           0 :                 SfxDispatcher* pDisp = pAppData_Impl->pViewFrame->GetDispatcher();
     365           0 :                 pDisp->Flush();
     366           0 :                 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           0 :     if ( pFrame && pFrame->GetViewShell() )
     377           0 :         pFrame->GetViewShell()->SetCurrentDocument();
     378           0 : }
     379             : 
     380             : 
     381             : 
     382           0 : ResMgr* SfxApplication::CreateResManager( const char *pPrefix )
     383             : {
     384           0 :     return ResMgr::CreateResMgr(pPrefix);
     385             : }
     386             : 
     387             : 
     388             : 
     389           0 : ResMgr* SfxApplication::GetSfxResManager()
     390             : {
     391           0 :     return SfxResId::GetResMgr();
     392             : }
     393             : 
     394             : 
     395             : 
     396           0 : void SfxApplication::SetProgress_Impl
     397             : (
     398             :     SfxProgress *pProgress
     399             : 
     400             : )
     401             : {
     402             :     DBG_ASSERT( ( !pAppData_Impl->pProgress && pProgress ) ||
     403             :                 ( pAppData_Impl->pProgress && !pProgress ),
     404             :                 "Progress acitivation/deacitivation mismatch" );
     405             : 
     406           0 :     if ( pAppData_Impl->pProgress && pProgress )
     407             :     {
     408           0 :         pAppData_Impl->pProgress->Suspend();
     409           0 :         pAppData_Impl->pProgress->UnLock();
     410           0 :         delete pAppData_Impl->pProgress;
     411             :     }
     412             : 
     413           0 :     pAppData_Impl->pProgress = pProgress;
     414           0 : }
     415             : 
     416             : 
     417             : 
     418           0 : sal_uInt16 SfxApplication::GetFreeIndex()
     419             : {
     420           0 :     return pAppData_Impl->aIndexBitSet.GetFreeIndex()+1;
     421             : }
     422             : 
     423             : 
     424             : 
     425           0 : void SfxApplication::ReleaseIndex(sal_uInt16 i)
     426             : {
     427           0 :     pAppData_Impl->aIndexBitSet.ReleaseIndex(i-1);
     428           0 : }
     429             : 
     430             : 
     431             : 
     432           0 : Window* SfxApplication::GetTopWindow() const
     433             : {
     434           0 :     SfxWorkWindow* pWork = GetWorkWindow_Impl( SfxViewFrame::Current() );
     435           0 :     return pWork ? pWork->GetWindow() : NULL;
     436             : }
     437             : 
     438           0 : SfxTbxCtrlFactArr_Impl&     SfxApplication::GetTbxCtrlFactories_Impl() const
     439             : {
     440           0 :     return *pAppData_Impl->pTbxCtrlFac;
     441             : }
     442             : 
     443           0 : SfxStbCtrlFactArr_Impl&     SfxApplication::GetStbCtrlFactories_Impl() const
     444             : {
     445           0 :     return *pAppData_Impl->pStbCtrlFac;
     446             : }
     447             : 
     448           0 : SfxMenuCtrlFactArr_Impl&    SfxApplication::GetMenuCtrlFactories_Impl() const
     449             : {
     450           0 :     return *pAppData_Impl->pMenuCtrlFac;
     451             : }
     452             : 
     453           0 : SfxViewFrameArr_Impl&       SfxApplication::GetViewFrames_Impl() const
     454             : {
     455           0 :     return *pAppData_Impl->pViewFrames;
     456             : }
     457             : 
     458           0 : SfxViewShellArr_Impl&       SfxApplication::GetViewShells_Impl() const
     459             : {
     460           0 :     return *pAppData_Impl->pViewShells;
     461             : }
     462             : 
     463           0 : SfxObjectShellArr_Impl&     SfxApplication::GetObjectShells_Impl() const
     464             : {
     465           0 :     return *pAppData_Impl->pObjShells;
     466             : }
     467             : 
     468           0 : void SfxApplication::Invalidate( sal_uInt16 nId )
     469             : {
     470           0 :     for( SfxViewFrame* pFrame = SfxViewFrame::GetFirst(); pFrame; pFrame = SfxViewFrame::GetNext( *pFrame ) )
     471           0 :         Invalidate_Impl( pFrame->GetBindings(), nId );
     472           0 : }
     473             : 
     474             : #ifndef DISABLE_SCRIPTING
     475             : 
     476             : #ifndef DISABLE_DYNLOADING
     477             : 
     478             : typedef long (SAL_CALL *basicide_handle_basic_error)(void*);
     479             : typedef void* (SAL_CALL *basicide_macro_organizer)(sal_Int16);
     480             : 
     481           0 : extern "C" { static void SAL_CALL thisModule() {} }
     482             : 
     483             : #else
     484             : 
     485             : extern "C" long basicide_handle_basic_error(void*);
     486             : extern "C" void *basicide_macro_organizer(sal_Int16);
     487             : 
     488             : #endif
     489             : 
     490             : #endif
     491             : 
     492           0 : IMPL_LINK( SfxApplication, GlobalBasicErrorHdl_Impl, StarBASIC*, pStarBasic )
     493             : {
     494             : #ifdef DISABLE_SCRIPTING
     495             :     (void) pStarBasic;
     496             :     return 0;
     497             : #else
     498             : 
     499             : #ifndef DISABLE_DYNLOADING
     500             :     // get basctl dllname
     501           0 :     static OUString aLibName( SVLIBRARY( "basctl"  ) );
     502             : 
     503             :     // load module
     504             :     oslModule handleMod = osl_loadModuleRelative(
     505           0 :         &thisModule, aLibName.pData, 0 );
     506             : 
     507             :     // get symbol
     508           0 :     OUString aSymbol( "basicide_handle_basic_error"  );
     509           0 :     basicide_handle_basic_error pSymbol = (basicide_handle_basic_error) osl_getFunctionSymbol( handleMod, aSymbol.pData );
     510             : 
     511             :     // call basicide_handle_basic_error in basctl
     512           0 :     long nRet = pSymbol ? pSymbol( pStarBasic ) : 0;
     513             : 
     514             : #else
     515             : 
     516             :     long nRet = basicide_handle_basic_error( pStarBasic );
     517             : 
     518             : #endif
     519             : 
     520           0 :     return nRet;
     521             : 
     522             : #endif
     523             : }
     524             : 
     525           0 : bool SfxApplication::IsXScriptURL( const OUString& rScriptURL )
     526             : {
     527           0 :     bool result = false;
     528             : 
     529             : #ifdef DISABLE_SCRIPTING
     530             :     (void) rScriptURL;
     531             : #else
     532             :     ::com::sun::star::uno::Reference
     533             :         < ::com::sun::star::uno::XComponentContext > xContext =
     534           0 :             ::comphelper::getProcessComponentContext();
     535             : 
     536             :     ::com::sun::star::uno::Reference
     537             :         < ::com::sun::star::uri::XUriReferenceFactory >
     538           0 :             xFactory = ::com::sun::star::uri::UriReferenceFactory::create( xContext );
     539             : 
     540             :     try
     541             :     {
     542             :         ::com::sun::star::uno::Reference
     543             :             < ::com::sun::star::uri::XVndSunStarScriptUrl >
     544           0 :                 xUrl( xFactory->parse( rScriptURL ),
     545           0 :                     ::com::sun::star::uno::UNO_QUERY );
     546             : 
     547           0 :         if ( xUrl.is() )
     548             :         {
     549           0 :             result = true;
     550           0 :         }
     551             :     }
     552           0 :     catch (const ::com::sun::star::uno::RuntimeException&)
     553             :     {
     554             :         // ignore, will just return FALSE
     555             :     }
     556             : #endif
     557           0 :     return result;
     558             : }
     559             : 
     560             : OUString
     561           0 : SfxApplication::ChooseScript()
     562             : {
     563           0 :     OUString aScriptURL;
     564             : 
     565             : #ifndef DISABLE_SCRIPTING
     566           0 :     SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create();
     567           0 :     if ( pFact )
     568             :     {
     569             :         SAL_INFO( "sfx.appl", "create selector dialog");
     570             : 
     571           0 :         const SfxViewFrame* pViewFrame = SfxViewFrame::Current();
     572           0 :         const SfxFrame* pFrame = pViewFrame ? &pViewFrame->GetFrame() : NULL;
     573           0 :         uno::Reference< frame::XFrame > xFrame( pFrame ? pFrame->GetFrameInterface() : uno::Reference< frame::XFrame >() );
     574             : 
     575             :           AbstractScriptSelectorDialog* pDlg =
     576           0 :             pFact->CreateScriptSelectorDialog( NULL, false, xFrame );
     577             : 
     578             :         SAL_INFO( "sfx.appl", "done, now exec it");
     579             : 
     580           0 :           sal_uInt16 nRet = pDlg->Execute();
     581             : 
     582             :         SAL_INFO( "sfx.appl", "has returned");
     583             : 
     584           0 :         if ( nRet == RET_OK )
     585             :         {
     586           0 :             aScriptURL = pDlg->GetScriptURL();
     587             :         }
     588             : 
     589           0 :           delete pDlg;
     590             :     }
     591             : #endif
     592           0 :     return aScriptURL;
     593             : }
     594             : 
     595           0 : void SfxApplication::MacroOrganizer( sal_Int16 nTabId )
     596             : {
     597             : #ifdef DISABLE_SCRIPTING
     598             :     (void) nTabId;
     599             : #else
     600             : 
     601             : #ifndef DISABLE_DYNLOADING
     602             :     // get basctl dllname
     603           0 :     static OUString aLibName( SVLIBRARY( "basctl"  ) );
     604             : 
     605             :     // load module
     606             :     oslModule handleMod = osl_loadModuleRelative(
     607           0 :         &thisModule, aLibName.pData, 0 );
     608             : 
     609             :     // get symbol
     610           0 :     OUString aSymbol( "basicide_macro_organizer"  );
     611           0 :     basicide_macro_organizer pSymbol = (basicide_macro_organizer) osl_getFunctionSymbol( handleMod, aSymbol.pData );
     612             : 
     613             :     // call basicide_macro_organizer in basctl
     614           0 :     pSymbol( nTabId );
     615             : 
     616             : #else
     617             : 
     618             :     basicide_macro_organizer( nTabId );
     619             : 
     620             : #endif
     621             : 
     622             : #endif
     623           0 : }
     624             : 
     625           0 : ErrCode SfxApplication::CallBasic( const OUString& rCode, BasicManager* pMgr, SbxArray* pArgs, SbxValue* pRet )
     626             : {
     627             : #ifdef DISABLE_SCRIPTING
     628             :     (void) rCode;
     629             :     (void) pMgr;
     630             :     (void) pArgs;
     631             :     (void) pRet;
     632             :     return ERRCODE_BASIC_CANNOT_LOAD;
     633             : #else
     634           0 :     return pMgr->ExecuteMacro( rCode, pArgs, pRet);
     635             : #endif
     636             : }
     637             : 
     638           0 : sfx2::sidebar::Theme & SfxApplication::GetSidebarTheme()
     639             : {
     640           0 :     if (!pAppData_Impl->m_pSidebarTheme.is())
     641             :     {
     642           0 :         pAppData_Impl->m_pSidebarTheme.set(new sfx2::sidebar::Theme);
     643           0 :         pAppData_Impl->m_pSidebarTheme->InitializeTheme();
     644             :     }
     645           0 :     return *pAppData_Impl->m_pSidebarTheme;
     646           3 : }
     647             : 
     648             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10