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