29#include <com/sun/star/frame/XFrame.hpp>
32#include <com/sun/star/uri/UriReferenceFactory.hpp>
33#include <com/sun/star/uri/XVndSunStarScriptUrl.hpp>
53#include <officecfg/Office/Common.hxx>
54#include <rtl/strbuf.hxx>
66#if HAVE_FEATURE_XMLHELP
67static SfxHelp* pSfxHelp =
nullptr;
91 static std::mutex theApplicationMutex;
94 std::unique_lock aGuard(theApplicationMutex);
97 SAL_INFO(
"sfx.appl",
"SfxApplication::SetApp" );
111#if HAVE_FEATURE_XMLHELP
114#if HAVE_FEATURE_XMLHELP || defined(EMSCRIPTEN)
115 bool bHelpTip = officecfg::Office::Common::Help::Tip::get();
116 bool bExtendedHelpTip = officecfg::Office::Common::Help::ExtendedTip::get();
135 SAL_INFO(
"sfx.appl",
"{ initialize DDE" );
142 OStringBuffer
aStr(
"No DDE-Service possible. Error: ");
153#if HAVE_FEATURE_XMLHELP
157#if HAVE_FEATURE_SCRIPTING
161 SAL_INFO(
"sfx.appl",
"} initialize DDE" );
173#if HAVE_FEATURE_XMLHELP
178 if ( !
pImpl->bDowning )
200 return pImpl->aLastDir;
205 const OUString& rNewDir
218 pImpl->aLastDir = rNewDir;
224 pImpl->aLastDir.clear();
230 return pImpl->pViewFrame ?
pImpl->pViewFrame->GetDispatcher() : &*
pImpl->pAppDispat;
236 if ( pFrame !=
pImpl->pViewFrame )
243 bool bTaskActivate = pOldFrame != pFrame;
256 pImpl->pViewFrame = pFrame;
276 if (
pImpl->pViewFrame->GetViewShell() )
299 (
pImpl->pProgress && !pProgress ),
300 "Progress activation/deactivation mismatch" );
302 if (
pImpl->pProgress && pProgress )
304 pImpl->pProgress->Suspend();
305 delete pImpl->pProgress;
308 pImpl->pProgress = pProgress;
314 return pImpl->aIndexBitSet.GetFreeIndex()+1;
320 pImpl->aIndexBitSet.ReleaseIndex(
i-1);
338 for (
auto& rFactory :
pImpl->maTbxCtrlFactories)
339 if( rFactory.nTypeId == rSlotType && rFactory.nSlotId == nSlotID )
344 for (
auto& rFactory :
pImpl->maTbxCtrlFactories)
345 if( rFactory.nTypeId == rSlotType && rFactory.nSlotId == 0 )
353 for (
auto& rFactory :
pImpl->maStbCtrlFactories)
354 if ( rFactory.nTypeId == rSlotType &&
355 ( rFactory.nSlotId == 0 || rFactory.nSlotId == nSlotID ) )
362 return pImpl->maViewFrames;
367 return pImpl->maViewShells;
372 return pImpl->maAcceleratorConfs;
377 return pImpl->maObjShells;
386#if HAVE_FEATURE_SCRIPTING
388#ifndef DISABLE_DYNLOADING
390typedef long (*basicide_handle_basic_error)(
void const *);
391typedef void (*basicide_macro_organizer)(
void *,
void *, sal_Int16);
404#if !HAVE_FEATURE_SCRIPTING
416 std::shared_ptr<weld::MessageDialog> xBox;
419 VclMessageType::Error,
424 xBox->runAsync(xBox, [](sal_Int32 ) {});
429#ifndef DISABLE_DYNLOADING
433 bool bRet = pSymbol( pStarBasic );
450#if !HAVE_FEATURE_SCRIPTING
453 css::uno::Reference< css::uno::XComponentContext > xContext =
454 ::comphelper::getProcessComponentContext();
456 css::uno::Reference< css::uri::XUriReferenceFactory >
457 xFactory = css::uri::UriReferenceFactory::create( xContext );
461 css::uno::Reference< css::uri::XVndSunStarScriptUrl >
462 xUrl(
xFactory->parse( rScriptURL ), css::uno::UNO_QUERY );
469 catch (
const css::uno::RuntimeException&)
482#if HAVE_FEATURE_SCRIPTING
484 SAL_INFO(
"sfx.appl",
"create selector dialog");
488 uno::Reference< frame::XFrame >
xFrame( pFrame ? pFrame->
GetFrameInterface() : uno::Reference< frame::XFrame >() );
492 SAL_INFO(
"sfx.appl",
"done, now exec it");
494 sal_uInt16 nRet = pDlg->Execute();
496 SAL_INFO(
"sfx.appl",
"has returned");
500 aScriptURL = pDlg->GetScriptURL();
510#if !HAVE_FEATURE_SCRIPTING
515#ifndef DISABLE_DYNLOADING
519 pSymbol(pParent, xDocFrame.get(), nTabId);
532#if !HAVE_FEATURE_SCRIPTING
546 if (!
pImpl->m_pSidebarTheme.is())
549 pImpl->m_pSidebarTheme->InitializeTheme();
551 return *
pImpl->m_pSidebarTheme;
IMPL_STATIC_LINK(SfxApplication, GlobalBasicErrorHdl_Impl, StarBASIC *, pStarBasic, bool)
static SfxApplication * g_pSfxApplication
static weld::MessageDialog * CreateMessageDialog(weld::Widget *pParent, VclMessageType eMessageType, VclButtonsType eButtonType, const OUString &rPrimaryMessage, const ILibreOfficeKitNotifier *pNotifier=nullptr)
static void SetHelp(Help *pHelp=nullptr)
ErrCode ExecuteMacro(OUString const &i_fullyQualifiedName, SbxArray *i_arguments, SbxValue *i_retValue)
static std::unique_ptr< ErrorInfo > GetErrorInfo(ErrCode)
static bool CreateString(const ErrorInfo *, OUString &)
static OUString GetEventName(GlobalEventId nID)
static void EnableQuickHelp()
static void DisableBalloonHelp()
static void EnableBalloonHelp()
static void DisableQuickHelp()
virtual VclPtr< AbstractScriptSelectorDialog > CreateScriptSelectorDialog(weld::Window *pParent, const css::uno::Reference< css::frame::XFrame > &rxFrame)=0
static SfxAbstractDialogFactory * Create()
static bool IsXScriptURL(const OUString &rScriptURL)
static void SetModule(SfxToolsModule nSharedLib, std::unique_ptr< SfxModule > pModule)
SAL_DLLPRIVATE void SetProgress_Impl(SfxProgress *)
static OUString ChooseScript(weld::Window *pParent)
SAL_DLLPRIVATE SfxTbxCtrlFactory * GetTbxCtrlFactory(const std::type_info &rSlotType, sal_uInt16 nSlotID) const
sfx2::sidebar::Theme & GetSidebarTheme()
this Theme contains Images so must be deleted before DeInitVCL
SAL_DLLPRIVATE void SetViewFrame_Impl(SfxViewFrame *pViewFrame)
SAL_DLLPRIVATE SfxDispatcher * GetDispatcher_Impl()
std::unique_ptr< SfxAppData_Impl > pImpl
static SfxApplication * Get()
SAL_DLLPRIVATE std::vector< SfxViewShell * > & GetViewShells_Impl() const
SAL_DLLPRIVATE std::vector< SfxViewFrame * > & GetViewFrames_Impl() const
virtual ~SfxApplication() override
SAL_DLLPRIVATE void SetLastDir_Impl(const OUString &)
void ReleaseIndex(sal_uInt16 i)
virtual void Invalidate(sal_uInt16 nId=0) override
With this method can the slots of the subclasses be invalidated through the slot Id or alternatively ...
SAL_DLLPRIVATE void Initialize_Impl()
SAL_DLLPRIVATE std::unordered_map< OUString, css::uno::Reference< css::ui::XAcceleratorConfiguration > > & GetAcceleratorConfs_Impl() const
SAL_DLLPRIVATE std::vector< SfxObjectShell * > & GetObjectShells_Impl() const
void NotifyEvent(const SfxEventHint &rEvent, bool bSynchron=true)
static void MacroOrganizer(weld::Window *pParent, const css::uno::Reference< css::frame::XFrame > &xDocFrame, sal_Int16 nTabId)
const DdeService * GetDdeService() const
SAL_DLLPRIVATE const OUString & GetLastDir_Impl() const
SAL_DLLPRIVATE SfxStbCtrlFactory * GetStbCtrlFactory(const std::type_info &rSlotType, sal_uInt16 nSlotID) const
static SfxModule * GetModule(SfxToolsModule nSharedLib)
static ErrCode CallBasic(const OUString &, BasicManager *, SbxArray *pArgs, SbxValue *pRet)
SAL_DLLPRIVATE SfxWorkWindow * GetWorkWindow_Impl(const SfxViewFrame *pFrame) const
sal_uInt16 GetFreeIndex()
static SfxApplication * GetOrCreate()
weld::Window * GetTopWindow() const
void Broadcast(const SfxHint &rHint)
SAL_DLLPRIVATE void Update_Impl(bool bForce=false)
void Flush()
This method performs outstanding push- and pop- commands.
const css::uno::Reference< css::frame::XFrame > & GetFrameInterface() const
css::uno::Reference< css::frame::XController > GetController() const
SAL_DLLPRIVATE void PostActivateEvent_Impl(SfxViewFrame const *)
sal_uInt32 GetState() const
void SetState(sal_uInt32 nVal, sal_uInt32 nNewRange=0)
SAL_DLLPRIVATE void Invalidate_Impl(SfxBindings &rBindings, sal_uInt16 nId)
SfxViewShell * GetViewShell() const
Returns the SfxViewShell in which they are located in the subshells.
void SetName(const OUString &rName)
Sets the name of the Shell object.
void DoDeactivate(bool bMDI, SfxViewFrame const *pOld)
static SAL_WARN_UNUSED_RESULT SfxViewFrame * Current()
SfxProgress * GetProgress() const
static SAL_WARN_UNUSED_RESULT SfxViewFrame * GetNext(const SfxViewFrame &rPrev, const SfxObjectShell *pDoc=nullptr, bool bOnlyVisible=true)
static SAL_WARN_UNUSED_RESULT SfxViewFrame * GetFirst(const SfxObjectShell *pDoc=nullptr, bool bOnlyVisible=true)
void DoActivate(bool bMDI)
SfxFrame & GetFrame() const
virtual SfxObjectShell * GetObjectShell() override
weld::Window * GetFrameWeld() const
void SetCurrentDocument() const
forwards the current document, as returned by ->GetCurrentDocument, to SfxObjectShell::SetWorkingDocu...
vcl::Window * GetWindow() const
static void SetGlobalErrorHdl(const Link< StarBASIC *, bool > &rNewHdl)
static ErrCode const & GetErrorCode()
weld::Window * GetFrameWeld() const
#define DBG_ASSERT(sCon, aError)
bool IsDockingWindowVisible(const uno::Reference< frame::XFrame > &rFrame, std::u16string_view rDockingWindowName)
Function used by the framework layout manager to determine the visibility state of a docking window w...
void SfxDockingWindowFactory(const uno::Reference< frame::XFrame > &rFrame, std::u16string_view rDockingWindowName)
Factory function used by the framework layout manager to "create" a docking window with a special nam...
Reference< XSingleServiceFactory > xFactory
void RefreshToolbars(css::uno::Reference< css::frame::XFrame > const &xFrame)
#define LINK(Instance, Class, Member)
#define SAL_WARN_IF(condition, area, stream)
#define SAL_WARN(area, stream)
#define SAL_INFO(area, stream)
SAL_DLLPUBLIC_EXPORT void basicide_macro_organizer(void *pParent, void *pDocFrame_AsXFrame, sal_Int16 nTabId)
SAL_DLLPUBLIC_EXPORT tools::Long basicide_handle_basic_error(void const *pPtr)
#define ERRCODE_BASIC_CANNOT_LOAD
rtl::Reference< svt::StatusbarController > SfxStatusBarControllerFactory(const uno::Reference< frame::XFrame > &rFrame, StatusBar *pStatusBar, unsigned short nID, const OUString &aCommandURL)
Reference< XFrame > xFrame
VCL_DLLPUBLIC Application * GetpApp()
rtl::Reference< svt::ToolboxController > SfxToolBoxControllerFactory(const Reference< XFrame > &rFrame, ToolBox *pToolbox, ToolBoxItemId nID, const OUString &aCommandURL)