LibreOffice Module sfx2 (master) 1
appserv.cxx
Go to the documentation of this file.
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#include <config_wasm_strip.h>
22
23#include <com/sun/star/drawing/ModuleDispatcher.hpp>
24#include <com/sun/star/frame/Desktop.hpp>
25#include <com/sun/star/frame/DispatchResultEvent.hpp>
26#include <com/sun/star/frame/DispatchResultState.hpp>
27#include <com/sun/star/frame/DispatchHelper.hpp>
28#include <com/sun/star/frame/UnknownModuleException.hpp>
29#include <com/sun/star/frame/XLayoutManager.hpp>
30#include <com/sun/star/frame/XSynchronousFrameLoader.hpp>
31#include <com/sun/star/sdbc/DriverManager.hpp>
32#include <com/sun/star/text/ModuleDispatcher.hpp>
33#include <com/sun/star/task/OfficeRestartManager.hpp>
34#include <com/sun/star/task/XInteractionHandler.hpp>
35#include <com/sun/star/ui/dialogs/AddressBookSourcePilot.hpp>
36#include <com/sun/star/ui/UIElementType.hpp>
37#include <com/sun/star/ui/XUIElement.hpp>
38#include <com/sun/star/uno/Reference.hxx>
39#include <com/sun/star/util/XCloseable.hpp>
40#include <com/sun/star/util/CloseVetoException.hpp>
41#include <org/freedesktop/PackageKit/SyncDbusSessionHelper.hpp>
42
44#include <comphelper/lok.hxx>
50
53#include <svtools/colorcfg.hxx>
54#include <svl/visitem.hxx>
55
58#include <vcl/weld.hxx>
59#include <svl/intitem.hxx>
60#include <svl/eitem.hxx>
61#include <svl/stritem.hxx>
62#include <basic/sbstar.hxx>
63#include <basic/basrdll.hxx>
64#include <basic/sberrors.hxx>
65#include <vcl/help.hxx>
66#include <sal/log.hxx>
67#include <osl/file.hxx>
68#include <vcl/EnumContext.hxx>
69#include <vcl/toolbox.hxx>
70
72#include <rtl/bootstrap.hxx>
73
74#include <com/sun/star/frame/ModuleManager.hpp>
75#include <com/sun/star/beans/XPropertySet.hpp>
76
77#include <sfx2/app.hxx>
78#include <sfx2/request.hxx>
79#include <sfx2/dispatch.hxx>
80#include <sfx2/bindings.hxx>
81#include <sfx2/minfitem.hxx>
82#include <sfx2/msg.hxx>
83#include <sfx2/objface.hxx>
84#include <sfx2/objsh.hxx>
85#include <sfx2/viewsh.hxx>
86#include <sfx2/docfac.hxx>
87#include <sfx2/strings.hrc>
88#include <sfx2/sfxresid.hxx>
89#include <appdata.hxx>
90#include <sfx2/viewfrm.hxx>
91#include <sfx2/sfxdlg.hxx>
92#include <sfx2/sfxsids.hrc>
93#include <sorgitm.hxx>
94#include <sfx2/sfxhelp.hxx>
95#include <sfx2/zoomitem.hxx>
96#include <sfx2/templatedlg.hxx>
99#include <sfx2/safemode.hxx>
100#include <sfx2/sfxuno.hxx>
102
103#include <comphelper/types.hxx>
104#include <officecfg/Office/Common.hxx>
106#include <memory>
107
108#include <openuriexternally.hxx>
109
110#include "getbasctlfunction.hxx"
111
112using namespace ::com::sun::star;
113using namespace ::com::sun::star::beans;
114using namespace ::com::sun::star::uno;
115using namespace ::com::sun::star::frame;
116using namespace ::com::sun::star::container;
117using namespace ::com::sun::star::util;
118using namespace ::com::sun::star::lang;
119using namespace ::com::sun::star::ui;
120
121namespace
122{
124 {
125 switch ( eApp )
126 {
128 return "Writer";
130 return "Calc";
132 return "Impress";
134 return "Draw";
136 return "Formula";
138 return "Base";
139 default:
140 return OUString();
141 }
142 }
143
144 // lp#527938, debian#602953, fdo#33266, i#105408
145 bool lcl_isBaseAvailable()
146 {
147 try
148 {
149 // if we get css::sdbc::DriverManager, libsdbc2 is there
150 // and the bibliography is assumed to work
151 return css::sdbc::DriverManager::create(comphelper::getProcessComponentContext()).is();
152 }
153 catch (const Exception &)
154 {
155 TOOLS_INFO_EXCEPTION("sfx.appl", "assuming Base to be missing");
156 return false;
157 }
158 }
159 void lcl_tryLoadBibliography()
160 {
161 // lp#527938, debian#602953, fdo#33266, i#105408
162 // make sure we actually can instantiate services from base first
163 if(!lcl_isBaseAvailable())
164 {
165 if (officecfg::Office::Common::PackageKit::EnableBaseInstallation::get())
166 {
167 try
168 {
169 using namespace org::freedesktop::PackageKit;
170 using namespace svtools;
171 Reference< XSyncDbusSessionHelper > xSyncDbusSessionHelper(SyncDbusSessionHelper::create(comphelper::getProcessComponentContext()));
172 Sequence< OUString > vPackages { "libreoffice-base" };
173 xSyncDbusSessionHelper->InstallPackageNames(vPackages, OUString());
174 // I'll be back (hopefully)!
175 SolarMutexGuard aGuard;
176 executeRestartDialog(comphelper::getProcessComponentContext(), nullptr, RESTART_REASON_BIBLIOGRAPHY_INSTALL);
177 }
178 catch (const Exception &)
179 {
180 TOOLS_INFO_EXCEPTION("sfx.appl", "trying to install LibreOffice Base");
181 }
182 }
183 return;
184 }
185
186 try // fdo#48775
187 {
188 SfxStringItem aURL(SID_FILE_NAME, ".component:Bibliography/View1");
189 SfxStringItem aRef(SID_REFERER, "private:user");
190 SfxStringItem aTarget(SID_TARGETNAME, "_blank");
191 if (const SfxViewFrame* pViewFrame = SfxViewFrame::Current())
192 {
193 pViewFrame->GetDispatcher()->ExecuteList(SID_OPENDOC,
194 SfxCallMode::ASYNCHRON, { &aURL, &aRef, &aTarget });
195 }
196 }
197 catch (const Exception &)
198 {
199 TOOLS_INFO_EXCEPTION( "sfx.appl", "trying to load bibliography database");
200 }
201 }
202}
205static bool checkURL( const char *pName, const char *pExt, OUString &rURL )
206{
207 using namespace osl;
208 DirectoryItem aDirItem;
209
210#ifdef MACOSX
211 rURL = "$BRAND_BASE_DIR/Resources/" + OUString::createFromAscii( pName ) +
212 OUString::createFromAscii( pExt );
213#else
214 rURL = "$BRAND_BASE_DIR/" + OUString::createFromAscii( pName ) +
215 OUString::createFromAscii( pExt );
216#endif
217 rtl::Bootstrap::expandMacros( rURL );
218
219 if (!rURL.isEmpty())
220 return DirectoryItem::get( rURL, aDirItem ) == DirectoryItem::E_None;
221 else
222 return false;
223}
224
226static void showDocument( const char* pBaseName )
227{
228 try {
229 Reference < XDesktop2 > xDesktop = Desktop::create( ::comphelper::getProcessComponentContext() );
230 auto args(::comphelper::InitPropertySequence({
231 {"ViewOnly", Any(true)},
232 {"ReadOnly", Any(true)}
233 }));
234
235 OUString aURL;
236 if ( checkURL ( pBaseName, ".fodt", aURL ) ||
237 checkURL ( pBaseName, ".html", aURL ) ||
238 checkURL ( pBaseName, "", aURL ) ) {
239 xDesktop->loadComponentFromURL( aURL, "_blank", 0, args );
240 }
241 } catch (const css::uno::Exception &) {
242 }
243}
244
245namespace
246{
247 Reference<XFrame> GetRequestFrame(const SfxRequest& rReq)
248 {
249 const SfxItemSet* pArgs = rReq.GetInternalArgs_Impl();
250 const SfxUnoFrameItem* pItem = nullptr;
251 Reference <XFrame> xFrame;
252 if (pArgs && (pItem = pArgs->GetItemIfSet(SID_FILLFRAME, false)))
253 {
254 xFrame = pItem->GetFrame();
255 }
256 return xFrame;
257 }
258
259 class LicenseDialog : public weld::GenericDialogController
260 {
261 public:
262 LicenseDialog(weld::Window* pParent)
263 : GenericDialogController(pParent, "sfx/ui/licensedialog.ui", "LicenseDialog")
264 {
265 }
266
267 virtual short run() override
268 {
269 short nRet = GenericDialogController::run();
270 if (nRet == RET_OK)
271 showDocument("LICENSE");
272 return nRet;
273 }
274 };
275
276 class SafeModeQueryDialog : public weld::MessageDialogController
277 {
278 public:
279 SafeModeQueryDialog(weld::Window* pParent)
280 : MessageDialogController(pParent, "sfx/ui/safemodequerydialog.ui", "SafeModeQueryDialog")
281 {
282 }
283
284 virtual short run() override
285 {
286 short nRet = MessageDialogController::run();
287 if (nRet == RET_OK)
288 {
290 uno::Reference< uno::XComponentContext > xContext = comphelper::getProcessComponentContext();
291 css::task::OfficeRestartManager::get(xContext)->requestRestart(
292 css::uno::Reference< css::task::XInteractionHandler >());
293 }
294 return nRet;
295 }
296 };
297}
298
300{
301 const SfxItemSet* pIntArgs = GetInternalArgs_Impl();
302 const SfxUnoAnyItem* pItem = nullptr;
303 if (pIntArgs && (pItem = pIntArgs->GetItemIfSet(SID_DIALOG_PARENT, false)))
304 {
305 auto aAny = pItem->GetValue();
306 Reference<awt::XWindow> xWindow;
307 aAny >>= xWindow;
308 return Application::GetFrameWeld(xWindow);
309 }
310
311 Reference<XFrame> xFrame(GetRequestFrame(*this));
312 if (!xFrame)
313 {
314 SAL_WARN("sfx.appl", "no parent for dialogs");
315 return nullptr;
316 }
317 return Application::GetFrameWeld(xFrame->getContainerWindow());
318}
319
321{
322 bool bDone = false;
323 switch ( rReq.GetSlot() )
324 {
325 case SID_SETOPTIONS:
326 {
327 if( rReq.GetArgs() )
328 SetOptions( *rReq.GetArgs() );
329 break;
330 }
331
332 case SID_QUITAPP:
333 case SID_LOGOUT:
334 {
335 // protect against reentrant calls
336 if ( pImpl->bInQuit )
337 return;
338
339 if ( rReq.GetSlot() == SID_LOGOUT )
340 {
342 pObjSh; pObjSh = SfxObjectShell::GetNext( *pObjSh ) )
343 {
344 if ( !pObjSh->IsModified() )
345 continue;
346
347 SfxViewFrame* pFrame = SfxViewFrame::GetFirst( pObjSh );
348 if ( !pFrame || !pFrame->GetWindow().IsReallyVisible() )
349 continue;
350
351 if (pObjSh->PrepareClose())
352 pObjSh->SetModified( false );
353 else
354 return;
355 }
356
357 SfxStringItem aNameItem( SID_FILE_NAME, "vnd.sun.star.cmd:logout" );
358 SfxStringItem aReferer( SID_REFERER, "private/user" );
359 pImpl->pAppDispat->ExecuteList(SID_OPENDOC,
360 SfxCallMode::SLOT, { &aNameItem, &aReferer });
361 return;
362 }
363
364 // try from nested requests again after 100ms
366 {
367 /* Don't save the request for closing the application and try it later
368 again. This is an UI bound functionality ... and the user will try it again
369 if the dialog is closed. But we should not close the application automatically
370 if this dialog is closed by the user ...
371 So we ignore this request now and wait for a new user decision.
372 */
373 SAL_INFO("sfx.appl", "QueryExit => sal_False, DispatchLevel == " << Application::GetDispatchLevel() );
374 return;
375 }
376
377 // block reentrant calls
378 pImpl->bInQuit = true;
379 Reference < XDesktop2 > xDesktop = Desktop::create ( ::comphelper::getProcessComponentContext() );
380
381 rReq.ForgetAllArgs();
382
383 // if terminate() failed, pImpl->bInQuit will now be sal_False, allowing further calls of SID_QUITAPP
384 bool bTerminated = xDesktop->terminate();
385 if (!bTerminated)
386 // if terminate() was successful, SfxApplication is now dead!
387 pImpl->bInQuit = false;
388
389 // Set return value, terminate if possible
390 rReq.SetReturnValue( SfxBoolItem( rReq.GetSlot(), bTerminated ) );
391 return;
392 }
393
394 case SID_CONFIG:
395 case SID_TOOLBOXOPTIONS:
396 case SID_CONFIGSTATUSBAR:
397 case SID_CONFIGMENU:
398 case SID_CONFIGACCEL:
399 case SID_CONFIGEVENT:
400 {
403
404 const SfxStringItem* pStringItem = rReq.GetArg<SfxStringItem>(SID_CONFIG);
405
407
408 // SID_CONFIG property will determine the default page shown
409 if ( pStringItem )
410 {
411 aSet.Put( SfxStringItem(
412 SID_CONFIG, pStringItem->GetValue() ) );
413 }
414 else if (rReq.GetSlot() == SID_CONFIGEVENT)
415 {
416 aSet.Put( SfxStringItem(
417 SID_CONFIG, "private:resource/event/" ) );
418 }
419 else if (rReq.GetSlot() == SID_TOOLBOXOPTIONS)
420 {
421 aSet.Put( SfxStringItem(
422 SID_CONFIG, "private:resource/toolbar/" ) );
423 }
424
425#if HAVE_FEATURE_SCRIPTING
426 // Preselect a macro in the 'keyboard' page
427 if (auto const item = rReq.GetArg<SfxMacroInfoItem>(SID_MACROINFO)) {
428 aSet.Put(*item);
429 }
430#endif
431
432 Reference <XFrame> xFrame(GetRequestFrame(rReq));
434 &aSet, xFrame ));
435
436 const short nRet = pDlg->Execute();
437
438 if ( nRet )
439 bDone = true;
440 break;
441 }
442
443 case SID_CLOSEDOCS:
444 {
445
446 Reference < XDesktop2 > xDesktop = Desktop::create( ::comphelper::getProcessComponentContext() );
447 Reference< XIndexAccess > xTasks = xDesktop->getFrames();
448 if ( !xTasks.is() )
449 break;
450
451 sal_Int32 n=0;
452 do
453 {
454 if ( xTasks->getCount() <= n )
455 break;
456
457 Any aAny = xTasks->getByIndex(n);
458 Reference < XCloseable > xTask;
459 aAny >>= xTask;
460 try
461 {
462 xTask->close(true);
463 n++;
464 }
465 catch( CloseVetoException& )
466 {
467 }
468 }
469 while( true );
470
471 bool bOk = ( n == 0);
472 rReq.SetReturnValue( SfxBoolItem( 0, bOk ) );
473 bDone = true;
474 break;
475 }
476
477 case SID_SAVEDOCS:
478 {
479 bool bOK = true;
481 pObjSh;
482 pObjSh = SfxObjectShell::GetNext( *pObjSh ) )
483 {
484 SfxRequest aReq( SID_SAVEDOC, SfxCallMode::SLOT, pObjSh->GetPool() );
485 if ( pObjSh->IsModified() && !pObjSh->isSaveLocked())
486 {
487 pObjSh->ExecuteSlot( aReq );
488 const SfxBoolItem *pItem = dynamic_cast<const SfxBoolItem*>( aReq.GetReturnValue() );
489 if ( !pItem || !pItem->GetValue() )
490 bOK = false;
491 }
492 }
493
494 rReq.SetReturnValue( SfxBoolItem( 0, bOK ) );
495 rReq.Done();
496 break;
497 }
498
499 case SID_SEND_FEEDBACK:
500 {
502 OUString sURL(officecfg::Office::Common::Menus::SendFeedbackURL::get() + //officecfg/registry/data/org/openoffice/Office/Common.xcu => https://hub.libreoffice.org/send-feedback/
504 "&LOlocale=" + utl::ConfigManager::getUILocale() +
505 "&LOmodule=" + module.subView(module.lastIndexOf('.') + 1 ) );
506 sfx2::openUriExternally(sURL, false, rReq.GetFrameWeld());
507 break;
508 }
509
510 case SID_Q_AND_A:
511 {
512 // Askbot has URL's normalized to languages, not locales
513 // Get language from locale: ll or lll or ll-CC or lll-CC
514
515 OUString sURL(officecfg::Office::Common::Menus::QA_URL::get() + //https://hub.libreoffice.org/forum/
516 "?LOlocale=" + utl::ConfigManager::getUILocale());
517 sfx2::openUriExternally(sURL, false, rReq.GetFrameWeld());
518 break;
519 }
520 case SID_DOCUMENTATION:
521 {
522 // Open documentation page based on locales
523 OUString sURL(officecfg::Office::Common::Menus::DocumentationURL::get() + //https://hub.libreoffice.org/documentation/
524 "?LOlocale=" + utl::ConfigManager::getUILocale());
525 sfx2::openUriExternally(sURL, false, rReq.GetFrameWeld());
526 break;
527 }
528#if !ENABLE_WASM_STRIP_PINGUSER
529 case SID_GETINVOLVED:
530 {
531 // Open get involved/join us page based on locales
532 OUString sURL(officecfg::Office::Common::Menus::GetInvolvedURL::get() + //https://hub.libreoffice.org/joinus/
533 "?LOlocale=" + utl::ConfigManager::getUILocale());
534 sfx2::openUriExternally(sURL, false, rReq.GetFrameWeld());
535 break;
536 }
537 case SID_DONATION:
538 {
539 // Open donation page based on language + script (BCP47) with language as fall back.
542 OUString sURL(officecfg::Office::Common::Menus::DonationURL::get() + //https://hub.libreoffice.org/donation/
543 "?BCP47=" + aBcp47 + "&LOlang=" + aLang );
544 sfx2::openUriExternally(sURL, false, rReq.GetFrameWeld());
545 break;
546 }
547 case SID_WHATSNEW:
548 {
549 // Open release notes depending on version and locale
550 OUString sURL(officecfg::Office::Common::Menus::ReleaseNotesURL::get() + //https://hub.libreoffice.org/ReleaseNotes/
552 "&LOlocale=" + LanguageTag(utl::ConfigManager::getUILocale()).getBcp47() );
553 sfx2::openUriExternally(sURL, false, rReq.GetFrameWeld());
554 break;
555 }
556 case SID_HYPHENATIONMISSING:
557 {
558 // Open wiki page about hyphenation
559 OUString sURL(officecfg::Office::Common::Menus::HyphenationMissingURL::get() + //https://hub.libreoffice.org/HyphenationMissing/
560 "?LOlocale=" + utl::ConfigManager::getUILocale());
561 sfx2::openUriExternally(sURL, false, rReq.GetFrameWeld());
562 break;
563 }
564#endif
565 case SID_SHOW_LICENSE:
566 {
567 LicenseDialog aDialog(rReq.GetFrameWeld());
568 aDialog.run();
569 break;
570 }
571
572 case SID_SHOW_CREDITS:
573 {
574 showDocument( "CREDITS" );
575 break;
576 }
577
578 case FN_CHANGE_THEME:
579 {
580 const SfxStringItem* pNewThemeArg = rReq.GetArg<SfxStringItem>(FN_PARAM_NEW_THEME);
581 if (!pNewThemeArg)
582 {
583 SAL_WARN("sfx.appl", "FN_CHANGE_THEME: no theme name");
584 break;
585 }
586
587 const OUString& rSchemeName = pNewThemeArg->GetValue();
588 svtools::EditableColorConfig aEditableConfig;
589
591 {
592 SfxViewShell* pCurrentShell = SfxViewShell::Current();
593 if (pCurrentShell && pCurrentShell->GetColorConfigName() != rSchemeName)
594 {
595 aEditableConfig.LoadScheme(rSchemeName);
596 }
597 }
598 else
599 {
600 if (aEditableConfig.GetCurrentSchemeName() != rSchemeName)
601 {
602 aEditableConfig.LoadScheme(rSchemeName);
603 }
604 }
605
606 break;
607 }
608
609 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
610 case SID_HELPINDEX:
611 {
612 Help* pHelp = Application::GetHelp();
613 if ( pHelp )
614 {
615 pHelp->Start(".uno:HelpIndex", rReq.GetFrameWeld()); // show start page
616 bDone = true;
617 }
618 break;
619 }
620
621 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
622 case SID_HELPTIPS:
623 {
624 // Evaluate Parameter
625 const SfxBoolItem* pOnItem = rReq.GetArg<SfxBoolItem>(SID_HELPTIPS);
626 bool bOn = pOnItem
627 ? pOnItem->GetValue()
629
630 if ( bOn )
632 else
635 officecfg::Office::Common::Help::Tip::set(bOn, xChanges);
636 xChanges->commit();
637 Invalidate(SID_HELPTIPS);
638 bDone = true;
639
640 // Record if possible
641 if ( !rReq.IsAPI() )
642 rReq.AppendItem( SfxBoolItem( SID_HELPTIPS, bOn) );
643 break;
644 }
645 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
646 case SID_EXTENDEDHELP:
647 {
649 break;
650 }
651 case SID_HELPBALLOONS:
652 {
653 // Evaluate Parameter
654 const SfxBoolItem* pOnItem = rReq.GetArg<SfxBoolItem>(SID_HELPBALLOONS);
655 bool bOn = pOnItem
656 ? pOnItem->GetValue()
658
659 if ( bOn )
661 else
664 officecfg::Office::Common::Help::ExtendedTip::set(bOn, xChanges);
665 xChanges->commit();
666 Invalidate(SID_HELPBALLOONS);
667 bDone = true;
668
669 // Record if possible
670 if ( !rReq.IsAPI() )
671 rReq.AppendItem( SfxBoolItem( SID_HELPBALLOONS, bOn) );
672 break;
673 }
674 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
675#if !ENABLE_WASM_STRIP_PINGUSER
676 case SID_TIPOFTHEDAY:
677 {
680 pDlg->StartExecuteAsync(nullptr);
681 bDone = true;
682 break;
683 }
684#endif
685 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
686 case SID_WIDGET_TEST_DIALOG:
687 {
690 pDlg->StartExecuteAsync([pDlg](sal_Int32 /*nResult*/){
691 pDlg->disposeOnce();
692 });
693 bDone = true;
694 break;
695 }
696
697 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
698 case SID_ABOUT:
699 {
702 pDlg->StartExecuteAsync(nullptr);
703 bDone = true;
704 break;
705 }
706
707 case SID_TEMPLATE_MANAGER:
708 {
709 SfxTemplateManagerDlg aDialog(rReq.GetFrameWeld());
710 aDialog.run();
711 bDone = true;
712 break;
713 }
714
715 case SID_TEMPLATE_ADDRESSBOOKSOURCE:
716 {
717 svt::AddressBookSourceDialog aDialog(rReq.GetFrameWeld(), ::comphelper::getProcessComponentContext());
718 aDialog.run();
719 bDone = true;
720 break;
721 }
722
723#if HAVE_FEATURE_SCRIPTING
724 case SID_BASICSTOP:
726 break;
727
728 case SID_BASICBREAK :
730 break;
731#endif
732
733 case SID_ZOOM_50_PERCENT:
734 case SID_ZOOM_75_PERCENT:
735 case SID_ZOOM_100_PERCENT:
736 case SID_ZOOM_150_PERCENT:
737 case SID_ZOOM_200_PERCENT:
738 case SID_ZOOM_OPTIMAL:
739 case SID_ZOOM_ENTIRE_PAGE:
740 case SID_ZOOM_PAGE_WIDTH:
741 {
742 SfxObjectShell* pCurrentShell = SfxObjectShell::Current();
743 if (!pCurrentShell)
744 return;
745
746 // make sure aZoom is initialized with a proper value if SetType
747 // doesn't work
748 SvxZoomItem aZoom( SvxZoomType::PERCENT, 100 );
749
750 switch (rReq.GetSlot())
751 {
752 case SID_ZOOM_50_PERCENT:
753 aZoom.SetValue(50);
754 break;
755 case SID_ZOOM_75_PERCENT:
756 aZoom.SetValue(75);
757 break;
758 case SID_ZOOM_100_PERCENT:
759 aZoom.SetValue(100);
760 break;
761 case SID_ZOOM_150_PERCENT:
762 aZoom.SetValue(150);
763 break;
764 case SID_ZOOM_200_PERCENT:
765 aZoom.SetValue(200);
766 break;
767 case SID_ZOOM_OPTIMAL:
769 break;
770 case SID_ZOOM_ENTIRE_PAGE:
772 break;
773 case SID_ZOOM_PAGE_WIDTH:
775 break;
776 }
777
778 pCurrentShell->GetDispatcher()->ExecuteList(SID_ATTR_ZOOM, SfxCallMode::ASYNCHRON, { &aZoom });
779
780 break;
781 }
782 case SID_TOOLBAR_MODE:
783 {
784 const SfxStringItem* pModeName = rReq.GetArg<SfxStringItem>( SID_TOOLBAR_MODE );
785
786 if ( !pModeName )
787 {
788 bDone = true;
789 break;
790 }
791
792 OUString aNewName(pModeName->GetValue());
793 uno::Reference< uno::XComponentContext > xContext =
794 ::comphelper::getProcessComponentContext();
795
796 // Get information about current frame and module
797 Reference<XFrame> xCurrentFrame;
799 OUString aCurrentMode;
800
801 SfxViewFrame* pViewFrame = SfxViewFrame::Current();
802 if (pViewFrame)
803 {
804 xCurrentFrame = pViewFrame->GetFrame().GetFrameInterface();
805
806 const Reference<frame::XModuleManager> xModuleManager = frame::ModuleManager::create( xContext );
807 eCurrentApp = vcl::EnumContext::GetApplicationEnum( xModuleManager->identify( xCurrentFrame ) );
808
809 OUString aPath = "org.openoffice.Office.UI.ToolbarMode/Applications/" +
810 lcl_getAppName( eCurrentApp );
811
812 const utl::OConfigurationTreeRoot aAppNode(
813 xContext,
814 aPath,
815 true);
816 if ( !aAppNode.isValid() )
817 {
818 bDone = true;
819 break;
820 }
821
822 aCurrentMode = comphelper::getString( aAppNode.getNodeValue( "Active" ) );
823
824 if ( aCurrentMode == aNewName )
825 {
826 bDone = true;
827 break;
828 }
829
830 // Save new toolbar mode for a current module
831 aAppNode.setNodeValue( "Active", Any( aNewName ) );
832 aAppNode.commit();
833 }
834
835 // Apply settings for all frames
836 pViewFrame = SfxViewFrame::GetFirst();
837 while( pViewFrame )
838 {
839 // in LOK case we want to apply changes only to the current view
841 pViewFrame != &SfxViewShell::Current()->GetViewFrame())
842 {
843 pViewFrame = SfxViewFrame::GetNext( *pViewFrame );
844 continue;
845 }
846
847 Reference<XFrame> xFrame = pViewFrame->GetFrame().GetFrameInterface();
848
849 // We want to change mode only for a current app module, ignore other apps
850 const Reference<frame::XModuleManager> xModuleManager = frame::ModuleManager::create( xContext );
852 if ( eApp != eCurrentApp )
853 {
854 pViewFrame = SfxViewFrame::GetNext( *pViewFrame );
855 continue;
856 }
857
858 Reference<css::beans::XPropertySet> xPropSet( xFrame, UNO_QUERY );
859 Reference<css::frame::XLayoutManager> xLayoutManager;
860 if ( xPropSet.is() )
861 {
862 try
863 {
864 Any aValue = xPropSet->getPropertyValue( "LayoutManager" );
865 aValue >>= xLayoutManager;
866 }
867 catch ( const css::uno::RuntimeException& )
868 {
869 throw;
870 }
871 catch ( css::uno::Exception& )
872 {
873 }
874 }
875
876 if ( xLayoutManager.is() )
877 {
878 css::uno::Sequence<OUString> aMandatoryToolbars;
879 css::uno::Sequence<OUString> aUserToolbars;
880 std::vector<OUString> aBackupList;
881 OUString aSidebarMode;
882
883 OUString aPath = "org.openoffice.Office.UI.ToolbarMode/Applications/" +
884 lcl_getAppName( eApp ) +
885 "/Modes";
886
887 // Read mode settings
888 const utl::OConfigurationTreeRoot aModesNode(
889 xContext,
890 aPath,
891 true);
892 if ( !aModesNode.isValid() )
893 {
894 bDone = true;
895 break;
896 }
897
898 const Sequence<OUString> aModeNodeNames( aModesNode.getNodeNames() );
899
900 for ( const auto& rModeNodeName : aModeNodeNames )
901 {
902 const utl::OConfigurationNode aModeNode( aModesNode.openNode( rModeNodeName ) );
903 if ( !aModeNode.isValid() )
904 continue;
905
906 OUString aCommandArg = comphelper::getString( aModeNode.getNodeValue( "CommandArg" ) );
907
908 if ( aCommandArg == aNewName )
909 {
910 aMandatoryToolbars = aModeNode.getNodeValue( "Toolbars" ).get< uno::Sequence<OUString> >();
911 aUserToolbars = aModeNode.getNodeValue( "UserToolbars" ).get< uno::Sequence<OUString> >();
912 aSidebarMode = comphelper::getString( aModeNode.getNodeValue( "Sidebar" ) );
913 break;
914 }
915 }
916
917 // Backup visible toolbar list and hide all toolbars
918 const Sequence<Reference<XUIElement>> aUIElements = xLayoutManager->getElements();
919 for ( const Reference< XUIElement >& xUIElement : aUIElements )
920 {
921 Reference< XPropertySet > xPropertySet( xUIElement, UNO_QUERY );
922 if ( xPropertySet.is() && xUIElement.is() )
923 {
924 try
925 {
926 OUString aResName;
927 sal_Int16 nType( -1 );
928 xPropertySet->getPropertyValue( "Type" ) >>= nType;
929 xPropertySet->getPropertyValue( "ResourceURL" ) >>= aResName;
930
931 if (( nType == css::ui::UIElementType::TOOLBAR ) &&
932 !aResName.isEmpty() )
933 {
934 if ( xLayoutManager->isElementVisible( aResName ) )
935 {
936 aBackupList.push_back( aResName );
937 }
938 xLayoutManager->hideElement( aResName );
939 }
940 }
941 catch ( const Exception& )
942 {
943 }
944 }
945 }
946
947 // Show/Hide the Notebookbar
948 const SfxStringItem pItem(SID_NOTEBOOKBAR, aNewName);
949 pViewFrame->GetDispatcher()->ExecuteList(SID_NOTEBOOKBAR, SfxCallMode::SYNCHRON, {&pItem});
950
951 // Show toolbars
952 for ( const OUString& rName : std::as_const(aMandatoryToolbars) )
953 {
954 xLayoutManager->createElement( rName );
955 xLayoutManager->showElement( rName );
956 }
957
958 for ( const OUString& rName : std::as_const(aUserToolbars) )
959 {
960 xLayoutManager->createElement( rName );
961 xLayoutManager->showElement( rName );
962 }
963
964 // Sidebar
965 pViewFrame->ShowChildWindow( SID_SIDEBAR );
966
968 aSidebarMode = "Opened";
969
972 if ( pSidebar )
973 {
974 if ( aSidebarMode == "Arrow" )
975 {
976 pSidebar->FadeOut();
977 }
978 else if ( aSidebarMode == "Tabs" )
979 {
980 pSidebar->FadeIn();
981 pSidebar->RequestOpenDeck();
982 pSidebar->RequestCloseDeck();
983 }
984 else if ( aSidebarMode == "Opened" )
985 {
986 pSidebar->FadeIn();
987 pSidebar->RequestOpenDeck();
988 }
989 }
990
991 // Save settings
992 if ( pViewFrame == SfxViewFrame::Current() )
993 {
994 css::uno::Sequence<OUString> aBackup( comphelper::containerToSequence(aBackupList) );
995
996 for ( const auto& rModeNodeName : aModeNodeNames )
997 {
998 const utl::OConfigurationNode aModeNode( aModesNode.openNode( rModeNodeName ) );
999 if ( !aModeNode.isValid() )
1000 continue;
1001
1002 OUString aCommandArg = comphelper::getString( aModeNode.getNodeValue( "CommandArg" ) );
1003
1004 if ( aCommandArg == aCurrentMode )
1005 {
1006 aModeNode.setNodeValue( "UserToolbars", Any( aBackup ) );
1007 break;
1008 }
1009 }
1010 aModesNode.commit();
1011 }
1012 }
1013
1014 pViewFrame = SfxViewFrame::GetNext(*pViewFrame);
1015 }
1016
1017 bDone = true;
1018 break;
1019 }
1020 case SID_TOOLBAR_MODE_UI:
1021 {
1024 pFact->CreateToolbarmodeDialog(rReq.GetFrameWeld()));
1025 pDlg->Execute();
1026 bDone = true;
1027 break;
1028 }
1029 case SID_AVAILABLE_TOOLBARS:
1030 {
1031 const SfxStringItem* pToolbarName = rReq.GetArg<SfxStringItem>(SID_AVAILABLE_TOOLBARS);
1032
1033 if ( pToolbarName )
1034 {
1035 Reference < XDesktop2 > xDesktop = Desktop::create ( ::comphelper::getProcessComponentContext() );
1036 Reference< XFrame > xFrame = xDesktop->getActiveFrame();
1037
1038 Reference< css::beans::XPropertySet > xPropSet( xFrame, UNO_QUERY );
1039 Reference< css::frame::XLayoutManager > xLayoutManager;
1040 if ( xPropSet.is() )
1041 {
1042 try
1043 {
1044 Any aValue = xPropSet->getPropertyValue("LayoutManager");
1045 aValue >>= xLayoutManager;
1046 }
1047 catch ( const css::uno::RuntimeException& )
1048 {
1049 throw;
1050 }
1051 catch ( css::uno::Exception& )
1052 {
1053 }
1054 }
1055
1056 if ( xLayoutManager.is() )
1057 {
1058 OUString aToolbarName = "private:resource/toolbar/" +
1059 pToolbarName->GetValue();
1060
1061 // Evaluate Parameter
1062 bool bShow( !xLayoutManager->isElementVisible( aToolbarName ));
1063
1064 if ( bShow )
1065 {
1066 xLayoutManager->createElement( aToolbarName );
1067 xLayoutManager->showElement( aToolbarName );
1068 }
1069 else
1070 xLayoutManager->hideElement( aToolbarName );
1071 }
1072 }
1073
1074 bDone = true;
1075 break;
1076 }
1077 case SID_MENUBAR:
1078 {
1080 bDone = true;
1081 break;
1082 }
1083 case SID_DEVELOPMENT_TOOLS_DOCKING_WINDOW:
1084 {
1085 SfxViewShell* pViewShell = SfxViewShell::Current();
1086 SfxViewFrame& rViewFrame = pViewShell->GetViewFrame();
1087 auto nID = rReq.GetSlot();
1088 rViewFrame.ToggleChildWindow(nID);
1089
1090 bDone = true;
1091 break;
1092 }
1093 case SID_INSPECT_SELECTED_OBJECT:
1094 {
1095 SfxViewShell* pViewShell = SfxViewShell::Current();
1096 SfxViewFrame& rViewFrame = pViewShell->GetViewFrame();
1097
1098 rViewFrame.ShowChildWindow(SID_DEVELOPMENT_TOOLS_DOCKING_WINDOW, true);
1099
1100 SfxChildWindow* pChild = rViewFrame.GetChildWindow(SID_DEVELOPMENT_TOOLS_DOCKING_WINDOW);
1101 if (!pChild)
1102 return;
1103
1104 auto pDockingWin = dynamic_cast<DevelopmentToolDockingWindow*>(pChild->GetWindow());
1105 if (pDockingWin)
1106 {
1107 pDockingWin->changeToCurrentSelection();
1108 }
1109
1110 bDone = true;
1111 break;
1112 }
1113 case SID_SAFE_MODE:
1114 {
1115 SafeModeQueryDialog aDialog(rReq.GetFrameWeld());
1116 aDialog.run();
1117 break;
1118 }
1119 case SID_TOOLBAR_LOCK:
1120 {
1121 if (SfxViewFrame* pViewFrame = SfxViewFrame::Current())
1122 {
1123 Reference<XFrame> xCurrentFrame;
1124 uno::Reference<uno::XComponentContext> xContext
1125 = ::comphelper::getProcessComponentContext();
1126 xCurrentFrame = pViewFrame->GetFrame().GetFrameInterface();
1127 const Reference<frame::XModuleManager> xModuleManager
1128 = frame::ModuleManager::create(xContext);
1129 const utl::OConfigurationTreeRoot aAppNode(
1130 xContext, "org.openoffice.Office.UI.GlobalSettings/Toolbars/States", true);
1131 if (aAppNode.isValid())
1132 {
1133 bool isLocked = comphelper::getBOOL(aAppNode.getNodeValue("Locked"));
1134 aAppNode.setNodeValue("Locked", Any(!isLocked));
1135 aAppNode.commit();
1136 //TODO: apply immediately w/o restart needed
1137 SolarMutexGuard aGuard;
1140 }
1141 }
1142 break;
1143 }
1144 default:
1145 break;
1146 }
1147
1148 if ( bDone )
1149 rReq.Done();
1150}
1151
1153{
1154 const WhichRangesContainer & pRanges = rSet.GetRanges();
1155 DBG_ASSERT(!pRanges.empty(), "Set without range");
1156 for ( auto const & pRange : pRanges )
1157 {
1158 for(sal_uInt16 nWhich = pRange.first; nWhich <= pRange.second; ++nWhich)
1159 {
1160 switch(nWhich)
1161 {
1162 case SID_TEMPLATE_ADDRESSBOOKSOURCE:
1163 if ( !SvtModuleOptions().IsModuleInstalled(SvtModuleOptions::EModule::DATABASE) )
1164 rSet.Put(SfxVisibilityItem(nWhich, false));
1165 break;
1166 case SID_QUITAPP:
1167 {
1168 if ( pImpl->nDocModalMode )
1169 rSet.DisableItem(nWhich);
1170 else
1171 rSet.Put(SfxStringItem(nWhich, SfxResId(STR_QUITAPP)));
1172 break;
1173 }
1174
1175 case SID_CONFIG:
1176 case SID_TOOLBOXOPTIONS:
1177 case SID_CONFIGSTATUSBAR:
1178 case SID_CONFIGMENU:
1179 case SID_CONFIGACCEL:
1180 case SID_CONFIGEVENT:
1181 {
1182 if( officecfg::Office::Common::Misc::DisableUICustomization::get() )
1183 rSet.DisableItem(nWhich);
1184 break;
1185 }
1186
1187#if HAVE_FEATURE_SCRIPTING
1188 case SID_BASICSTOP:
1189 if ( !StarBASIC::IsRunning() )
1190 rSet.DisableItem(nWhich);
1191 break;
1192#endif
1193
1194 case SID_HELPTIPS:
1195 {
1196 rSet.Put( SfxBoolItem( SID_HELPTIPS, Help::IsQuickHelpEnabled() ) );
1197 }
1198 break;
1199 case SID_HELPBALLOONS:
1200 {
1201 rSet.Put( SfxBoolItem( SID_HELPBALLOONS, Help::IsBalloonHelpEnabled() ) );
1202 }
1203 break;
1204
1205 case SID_EXTENDEDHELP:
1206 {
1207 }
1208 break;
1209
1210 case SID_CLOSEDOCS:
1211 {
1212 Reference < XDesktop2 > xDesktop = Desktop::create( ::comphelper::getProcessComponentContext() );
1213 Reference< XIndexAccess > xTasks = xDesktop->getFrames();
1214 if ( !xTasks.is() || !xTasks->getCount() )
1215 rSet.DisableItem(nWhich);
1216 break;
1217 }
1218
1219 case SID_SAVEDOCS:
1220 {
1221 bool bModified = false;
1222 for ( SfxObjectShell *pObjSh = SfxObjectShell::GetFirst();
1223 pObjSh;
1224 pObjSh = SfxObjectShell::GetNext( *pObjSh ) )
1225 {
1226 if ( pObjSh->IsModified() && !pObjSh->isSaveLocked() )
1227 {
1228 bModified = true;
1229 break;
1230 }
1231 }
1232
1233 if ( !bModified )
1234 rSet.DisableItem( nWhich );
1235 break;
1236 }
1237
1238 case SID_TEMPLATE_MANAGER:
1239 {
1240 if ( !officecfg::Office::Common::Misc::ExperimentalMode::get() )
1241 {
1242 rSet.DisableItem( nWhich );
1243 rSet.Put( SfxVisibilityItem( nWhich, false ) );
1244 }
1245 }
1246 break;
1247
1248 case SID_ZOOM_50_PERCENT:
1249 case SID_ZOOM_75_PERCENT:
1250 case SID_ZOOM_100_PERCENT:
1251 case SID_ZOOM_150_PERCENT:
1252 case SID_ZOOM_200_PERCENT:
1253 case SID_ZOOM_OPTIMAL:
1254 case SID_ZOOM_ENTIRE_PAGE:
1255 case SID_ZOOM_PAGE_WIDTH:
1256 {
1257 SfxObjectShell* pCurrentShell = SfxObjectShell::Current();
1258
1259 const SfxPoolItem *pItem;
1260 SfxItemState aState = pCurrentShell ?
1261 pCurrentShell->GetDispatcher()->QueryState(SID_ATTR_ZOOM, pItem) : SfxItemState::DISABLED;
1262 if ( aState == SfxItemState::DISABLED )
1263 rSet.DisableItem( nWhich );
1264 }
1265 break;
1266
1267 case SID_MENUBAR:
1268 {
1269 Reference < XDesktop2 > xDesktop = Desktop::create ( ::comphelper::getProcessComponentContext() );
1270 Reference< XFrame > xFrame = xDesktop->getActiveFrame();
1271
1272 Reference< css::beans::XPropertySet > xPropSet( xFrame, UNO_QUERY );
1273 Reference< css::frame::XLayoutManager > xLayoutManager;
1274 if ( xPropSet.is() )
1275 {
1276 try
1277 {
1278 Any aValue = xPropSet->getPropertyValue("LayoutManager");
1279 aValue >>= xLayoutManager;
1280 }
1281 catch ( const css::uno::RuntimeException& )
1282 {
1283 throw;
1284 }
1285 catch ( css::uno::Exception& )
1286 {
1287 }
1288 }
1289
1290 if ( xLayoutManager.is() )
1291 {
1292 const bool bState
1293 = xLayoutManager->getElement("private:resource/menubar/menubar").is()
1294 && xLayoutManager->isElementVisible(
1295 "private:resource/menubar/menubar");
1296
1297 SfxBoolItem aItem( SID_MENUBAR, bState );
1298 rSet.Put( aItem );
1299 }
1300 break;
1301 }
1302 case SID_SAFE_MODE:
1303 {
1304 // no restart in safe mode when already in safe mode
1306 rSet.DisableItem( SID_SAFE_MODE );
1307 break;
1308 }
1309 case SID_DEVELOPMENT_TOOLS_DOCKING_WINDOW:
1310 {
1311 bool bSuccess = false;
1312 auto* pViewShell = SfxViewShell::Current();
1313 if (pViewShell)
1314 {
1315 auto& rViewFrame = pViewShell->GetViewFrame();
1316 if (rViewFrame.KnowsChildWindow(nWhich))
1317 {
1318 rSet.Put(SfxBoolItem(nWhich, rViewFrame.HasChildWindow(nWhich)));
1319 bSuccess = true;
1320 }
1321 }
1322
1323 if (!bSuccess)
1324 rSet.DisableItem(nWhich);
1325 }
1326 break;
1327 case SID_INSPECT_SELECTED_OBJECT:
1328 {
1329 bool bSuccess = false;
1330 auto* pViewShell = SfxViewShell::Current();
1331 if (pViewShell)
1332 {
1333 auto& rViewFrame = pViewShell->GetViewFrame();
1334 if (rViewFrame.KnowsChildWindow(SID_DEVELOPMENT_TOOLS_DOCKING_WINDOW))
1335 {
1336 bSuccess = true;
1337 }
1338 }
1339 if (!bSuccess)
1340 rSet.DisableItem(nWhich);
1341 }
1342 break;
1343 case SID_TOOLBAR_LOCK:
1344 {
1345 rSet.Put( SfxBoolItem( SID_TOOLBAR_LOCK, ToolBox::AlwaysLocked() ));
1346 }
1347 break;
1348 default:
1349 break;
1350 }
1351 }
1352 }
1353}
1354
1355#if HAVE_FEATURE_SCRIPTING
1356
1357#ifndef DISABLE_DYNLOADING
1358
1359typedef rtl_uString* (*basicide_choose_macro)(void*, void*, void*, sal_Bool);
1360
1361#else
1362
1363extern "C" rtl_uString* basicide_choose_macro(void*, void*, void*, sal_Bool);
1364
1365#endif
1366
1367static OUString ChooseMacro(weld::Window* pParent, const Reference<XModel>& rxLimitToDocument, const Reference<XFrame>& xDocFrame, bool bChooseOnly)
1368{
1369#ifndef DISABLE_DYNLOADING
1370 basicide_choose_macro pSymbol = reinterpret_cast<basicide_choose_macro>(sfx2::getBasctlFunction("basicide_choose_macro"));
1371#else
1372#define pSymbol basicide_choose_macro
1373#endif
1374
1375 // call basicide_choose_macro in basctl
1376 rtl_uString* pScriptURL = pSymbol(pParent, rxLimitToDocument.get(), xDocFrame.get(), bChooseOnly);
1377 OUString aScriptURL( pScriptURL );
1378 rtl_uString_release( pScriptURL );
1379 return aScriptURL;
1380
1381#ifdef DISABLE_DYNLOADING
1382#undef pSymbol
1383#endif
1384}
1385
1386#endif
1387
1388namespace
1389{
1390#if HAVE_FEATURE_SCRIPTING
1391 weld::Window* lcl_getDialogParent(const Reference<XFrame>& rxFrame)
1392 {
1393 Reference<awt::XWindow> xContainerWindow;
1394 if (rxFrame.is())
1395 xContainerWindow = rxFrame->getContainerWindow();
1396 return Application::GetFrameWeld(xContainerWindow);
1397 }
1398
1399 SfxViewFrame* lcl_getBasicIDEViewFrame( SfxObjectShell const * i_pBasicIDE )
1400 {
1401 SfxViewFrame* pView = SfxViewFrame::GetFirst( i_pBasicIDE );
1402 while ( pView )
1403 {
1404 if ( pView->GetObjectShell()->GetFactory().GetDocumentServiceName() == "com.sun.star.script.BasicIDE" )
1405 break;
1406 pView = SfxViewFrame::GetNext( *pView, i_pBasicIDE );
1407 }
1408 return pView;
1409 }
1410 Reference< XFrame > lcl_findStartModuleFrame( const Reference<XComponentContext> & rxContext )
1411 {
1412 try
1413 {
1414 Reference < XDesktop2 > xDesktop = Desktop::create( rxContext );
1415 Reference < XIndexAccess > xContainer( xDesktop->getFrames(), UNO_QUERY_THROW );
1416
1417 Reference< XModuleManager2 > xCheck = ModuleManager::create(rxContext);
1418
1419 sal_Int32 nCount = xContainer->getCount();
1420 for ( sal_Int32 i=0; i<nCount; ++i )
1421 {
1422 try
1423 {
1424 Reference < XFrame > xFrame( xContainer->getByIndex(i), UNO_QUERY_THROW );
1425 OUString sModule = xCheck->identify( xFrame );
1426 if ( sModule == "com.sun.star.frame.StartModule" )
1427 return xFrame;
1428 }
1429 catch( const UnknownModuleException& )
1430 {
1431 // silence
1432 }
1433 catch(const Exception&)
1434 {
1435 // re-throw, caught below
1436 throw;
1437 }
1438 }
1439 }
1440 catch( const Exception& )
1441 {
1442 DBG_UNHANDLED_EXCEPTION("sfx.appl");
1443 }
1444 return nullptr;
1445 }
1446#endif // HAVE_FEATURE_SCRIPTING
1447}
1448
1450{
1451 switch ( rReq.GetSlot() )
1452 {
1453 case SID_OPTIONS_TREEDIALOG:
1454 {
1455 OUString sPageURL;
1456 const SfxStringItem* pURLItem = rReq.GetArg<SfxStringItem>(SID_OPTIONS_PAGEURL);
1457 if ( pURLItem )
1458 sPageURL = pURLItem->GetValue();
1459 Reference <XFrame> xFrame(GetRequestFrame(rReq));
1462 pFact->CreateFrameDialog(rReq.GetFrameWeld(), xFrame, rReq.GetSlot(), sPageURL );
1463 short nRet = pDlg->Execute();
1464 pDlg.disposeAndClear();
1466 while ( pView )
1467 {
1468 if (nRet == RET_OK)
1469 {
1470 SfxObjectShell* pObjSh = pView->GetObjectShell();
1471 if (pObjSh)
1472 pObjSh->SetConfigOptionsChecked(false);
1473 }
1474 pView->GetBindings().InvalidateAll(false);
1475 pView = SfxViewFrame::GetNext( *pView );
1476 }
1477 break;
1478 }
1479
1480 case SID_MORE_DICTIONARIES:
1481 {
1482 uno::Sequence<beans::PropertyValue> aArgs{ comphelper::makePropertyValue(
1483 "AdditionsTag", OUString("Dictionary")) };
1484 comphelper::dispatchCommand(".uno:AdditionsDialog", aArgs);
1485 break;
1486 }
1487#if HAVE_FEATURE_SCRIPTING
1488 case SID_BASICIDE_APPEAR:
1489 {
1490 SfxViewFrame* pView = lcl_getBasicIDEViewFrame( nullptr );
1491 if ( !pView )
1492 {
1493 SfxObjectShell* pBasicIDE = SfxObjectShell::CreateObject( "com.sun.star.script.BasicIDE" );
1494 pBasicIDE->DoInitNew();
1495 pBasicIDE->SetModified( false );
1496 try
1497 {
1498 // load the Basic IDE via direct access to the SFX frame loader. A generic loadComponentFromURL
1499 // (which could be done via SfxViewFrame::LoadDocumentIntoFrame) is not feasible here, since the Basic IDE
1500 // does not really play nice with the framework's concept. For instance, it is a "singleton document",
1501 // which conflicts, at the latest, with the framework's concept of loading into _blank frames.
1502 // So, since we know that our frame loader can handle it, we skip the generic framework loader
1503 // mechanism, and the type detection (which doesn't know about the Basic IDE).
1504 Reference< XComponentContext > xContext( ::comphelper::getProcessComponentContext() );
1505 Reference< XSynchronousFrameLoader > xLoader(
1506 xContext->getServiceManager()->createInstanceWithContext("com.sun.star.comp.office.FrameLoader", xContext),
1507 UNO_QUERY_THROW );
1509 aLoadArgs.put( "Model", pBasicIDE->GetModel() );
1510 aLoadArgs.put( "URL", OUString( "private:factory/sbasic" ) );
1511
1512 Reference< XFrame > xTargetFrame( lcl_findStartModuleFrame( xContext ) );
1513 if ( !xTargetFrame.is() )
1514 xTargetFrame = SfxFrame::CreateBlankFrame();
1515 ENSURE_OR_THROW( xTargetFrame.is(), "could not obtain a frameto load the Basic IDE into!" );
1516
1517 xLoader->load( aLoadArgs.getPropertyValues(), xTargetFrame );
1518 }
1519 catch( const Exception& )
1520 {
1521 DBG_UNHANDLED_EXCEPTION("sfx.appl");
1522 }
1523
1524 pView = lcl_getBasicIDEViewFrame( pBasicIDE );
1525 if ( pView )
1526 pView->SetName( "BASIC:1" );
1527 }
1528
1529 if ( pView )
1530 pView->GetFrame().Appear();
1531
1532 const SfxItemSet* pArgs = rReq.GetArgs();
1533 if ( pArgs && pView )
1534 {
1535 SfxViewShell* pViewShell = pView->GetViewShell();
1536 SfxObjectShell* pObjShell = pView->GetObjectShell();
1537 if ( pViewShell && pObjShell )
1538 {
1539 SfxRequest aReq( SID_BASICIDE_SHOWWINDOW, SfxCallMode::SYNCHRON, pObjShell->GetPool() );
1540 aReq.SetArgs( *pArgs );
1541 pViewShell->ExecuteSlot( aReq );
1542 }
1543 }
1544
1545 rReq.Done();
1546 }
1547 break;
1548
1549 case SID_BASICCHOOSER:
1550 {
1551 const SfxItemSet* pArgs = rReq.GetArgs();
1552 const SfxBoolItem* pItem;
1553 bool bChooseOnly = false;
1554 Reference< XModel > xLimitToModel;
1555 if(pArgs && (pItem = pArgs->GetItemIfSet(SID_RECORDMACRO, false)) )
1556 {
1557 bool bRecord = pItem->GetValue();
1558 if ( bRecord )
1559 {
1560 // !Hack
1561 bChooseOnly = false;
1562 SfxObjectShell* pCurrentShell = SfxObjectShell::Current();
1563 OSL_ENSURE( pCurrentShell, "macro recording outside an SFX document?" );
1564 if ( pCurrentShell )
1565 xLimitToModel = pCurrentShell->GetModel();
1566 }
1567 }
1568
1569 Reference <XFrame> xFrame(GetRequestFrame(rReq));
1570 rReq.SetReturnValue(SfxStringItem(rReq.GetSlot(), ChooseMacro(rReq.GetFrameWeld(), xLimitToModel, xFrame, bChooseOnly)));
1571 rReq.Done();
1572 }
1573 break;
1574
1575 case SID_MACROORGANIZER:
1576 {
1577 SAL_INFO("sfx.appl", "handling SID_MACROORGANIZER");
1578 const SfxItemSet* pArgs = rReq.GetArgs();
1579 sal_Int16 nTabId = 0;
1580 Reference <XFrame> xFrame;
1581 if (pArgs)
1582 {
1583 if (const SfxUInt16Item* pItem = pArgs->GetItemIfSet(SID_MACROORGANIZER, false))
1584 nTabId = pItem->GetValue();
1585 if (const SfxBoolItem* pItem = rReq.GetArg<SfxBoolItem>(FN_PARAM_2))
1586 {
1587 // if set then default to showing the macros of the document associated
1588 // with this frame
1589 if (pItem->GetValue())
1590 xFrame = GetRequestFrame(rReq);
1591 }
1592 }
1594 rReq.Done();
1595 }
1596 break;
1597
1598 case SID_RUNMACRO:
1599 {
1601 SAL_INFO("sfx.appl", "SfxApplication::OfaExec_Impl: case ScriptOrg");
1602
1603 Reference <XFrame> xFrame(GetRequestFrame(rReq));
1604 if ( !xFrame.is() )
1605 {
1606 if (const SfxViewFrame* pViewFrame = SfxViewFrame::Current())
1607 xFrame = pViewFrame->GetFrame().GetFrameInterface();
1608 }
1609
1610 do // artificial loop for flow control
1611 {
1613 OSL_ENSURE( pDlg, "SfxApplication::OfaExec_Impl( SID_RUNMACRO ): no dialog!" );
1614 if ( !pDlg )
1615 break;
1616 pDlg->SetRunLabel();
1617
1618 pDlg->StartExecuteAsync([pDlg, xFrame](sal_Int32 nDialogResult) {
1619 if ( !nDialogResult )
1620 {
1621 pDlg->disposeOnce();
1622 return;
1623 }
1624
1625 Sequence< Any > args;
1626 Sequence< sal_Int16 > outIndex;
1627 Sequence< Any > outArgs;
1628 Any ret;
1629
1630 Reference< XInterface > xScriptContext;
1631
1632 Reference< XController > xController;
1633 if ( xFrame.is() )
1634 xController = xFrame->getController();
1635 if ( xController.is() )
1636 xScriptContext = xController->getModel();
1637 if ( !xScriptContext.is() )
1638 xScriptContext = xController;
1639
1640 SfxObjectShell::CallXScript( xScriptContext, pDlg->GetScriptURL(), args, ret, outIndex, outArgs );
1641 pDlg->disposeOnce();
1642 });
1643 }
1644 while ( false );
1645 rReq.Done();
1646 }
1647 break;
1648
1649 case SID_SCRIPTORGANIZER:
1650 {
1652 SAL_INFO("sfx.appl", "SfxApplication::OfaExec_Impl: case ScriptOrg");
1653 const SfxItemSet* pArgs = rReq.GetArgs();
1654 const SfxScriptOrganizerItem* pItem;
1655 OUString aLanguage;
1656 if(pArgs && (pItem = pArgs->GetItemIfSet(SID_SCRIPTORGANIZER, false) ))
1657 {
1658 aLanguage = pItem->getLanguage();
1659 }
1660
1661 OUString aLang( aLanguage );
1662 SAL_INFO("sfx.appl", "SfxApplication::OfaExec_Impl: about to create dialog for: " << aLang);
1664 if( pDlg )
1665 {
1666 pDlg->Execute();
1667 }
1668 else
1669 {
1670 SAL_WARN("sfx.appl", "no dialog!!!");
1671 }
1672 rReq.Done();
1673 }
1674 break;
1675#endif // HAVE_FEATURE_SCRIPTING
1676
1677 case SID_OFFICE_CHECK_PLZ:
1678 {
1679 bool bRet = false;
1680 const SfxStringItem* pStringItem = rReq.GetArg<SfxStringItem>(rReq.GetSlot());
1681
1682 if ( pStringItem )
1683 {
1684 bRet = true ;
1685 }
1686#if HAVE_FEATURE_SCRIPTING
1687 else
1689#endif
1690 rReq.SetReturnValue( SfxBoolItem( rReq.GetSlot(), bRet ) );
1691 }
1692 break;
1693
1694 case SID_AUTO_CORRECT_DLG:
1695 {
1698 const SfxPoolItem* pItem=nullptr;
1699 const SfxItemSet* pSet = rReq.GetArgs();
1700 if ( pSet && pSet->GetItemState( SID_AUTO_CORRECT_DLG, false, &pItem ) == SfxItemState::SET )
1701 aSet.Put( *pItem );
1702
1704 pDlg->Execute();
1705
1706 break;
1707 }
1708
1709 case SID_NEWSD :
1710 {
1711 SvtModuleOptions aModuleOpt;
1712 if ( !aModuleOpt.IsImpress() )
1713 {
1714 std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(rReq.GetFrameWeld(),
1715 VclMessageType::Warning, VclButtonsType::Ok,
1716 SfxResId(STR_MODULENOTINSTALLED)));
1717 xBox->run();
1718 return;
1719 }
1720
1721 Reference< uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext();
1722 Reference< frame::XDispatchProvider > xProv = drawing::ModuleDispatcher::create( xContext );
1723
1724 OUString aCmd = GetInterface()->GetSlot( rReq.GetSlot() )->GetUnoName();
1725 Reference< frame::XDispatchHelper > xHelper( frame::DispatchHelper::create(xContext) );
1726 Sequence < beans::PropertyValue > aSeq;
1727 if ( rReq.GetArgs() )
1728 TransformItems( rReq.GetSlot(), *rReq.GetArgs(), aSeq );
1729 Any aResult = xHelper->executeDispatch( xProv, aCmd, OUString(), 0, aSeq );
1730 frame::DispatchResultEvent aEvent;
1731 bool bSuccess = (aResult >>= aEvent) &&
1732 (aEvent.State == frame::DispatchResultState::SUCCESS);
1733 rReq.SetReturnValue( SfxBoolItem( rReq.GetSlot(), bSuccess ) );
1734 }
1735 break;
1736
1737 case FN_LABEL :
1738 case FN_BUSINESS_CARD :
1739 case FN_XFORMS_INIT :
1740 {
1741 Reference< uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext();
1742 Reference< frame::XDispatchProvider > xProv = text::ModuleDispatcher::create( xContext );
1743
1744 OUString aCmd = GetInterface()->GetSlot( rReq.GetSlot() )->GetUnoName();
1745 Reference< frame::XDispatchHelper > xHelper( frame::DispatchHelper::create(xContext) );
1746 Sequence < beans::PropertyValue > aSeq;
1747 if ( rReq.GetArgs() )
1748 TransformItems( rReq.GetSlot(), *rReq.GetArgs(), aSeq );
1749 Any aResult = xHelper->executeDispatch( xProv, aCmd, OUString(), 0, aSeq );
1750 frame::DispatchResultEvent aEvent;
1751 bool bSuccess = (aResult >>= aEvent) &&
1752 (aEvent.State == frame::DispatchResultState::SUCCESS);
1753 rReq.SetReturnValue( SfxBoolItem( rReq.GetSlot(), bSuccess ) );
1754 }
1755 break;
1756
1757 case SID_ADDRESS_DATA_SOURCE:
1758 {
1759 try
1760 {
1761 Reference< uno::XComponentContext > xORB = ::comphelper::getProcessComponentContext();
1762 Reference< ui::dialogs::XExecutableDialog > xDialog = ui::dialogs::AddressBookSourcePilot::createWithParent(xORB, nullptr);
1763 xDialog->execute();
1764 }
1765 catch(const css::uno::Exception&)
1766 {
1767 DBG_UNHANDLED_EXCEPTION("sfx.appl");
1768 }
1769 }
1770 break;
1771
1772 case SID_COMP_BIBLIOGRAPHY:
1773 lcl_tryLoadBibliography();
1774 break;
1775 }
1776}
1777
1779{
1780 SvtModuleOptions aModuleOpt;
1781
1782 if( !aModuleOpt.IsWriter())
1783 {
1784 rSet.DisableItem( FN_LABEL );
1785 rSet.DisableItem( FN_BUSINESS_CARD );
1786 rSet.DisableItem( FN_XFORMS_INIT );
1787 }
1789 rSet.DisableItem( SID_AUTO_CORRECT_DLG );
1790
1791 bool bMacrosDisabled
1792 = officecfg::Office::Common::Security::Scripting::DisableMacrosExecution::get();
1793 if (bMacrosDisabled)
1794 {
1795 rSet.DisableItem(SID_RUNMACRO);
1796 rSet.DisableItem(SID_MACROORGANIZER);
1797 rSet.DisableItem(SID_SCRIPTORGANIZER);
1798 rSet.DisableItem(SID_BASICIDE_APPEAR);
1799 }
1800}
1801
1802/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
static OUString lcl_getAppName(vcl::EnumContext::Application eApp)
const char * pName
static void showDocument(const char *pBaseName)
Displays CREDITS or LICENSE in any of the available version.
Definition: appserv.cxx:226
static bool checkURL(const char *pName, const char *pExt, OUString &rURL)
Find the correct location of the document (CREDITS.fodt, etc.), and return it in rURL if found.
Definition: appserv.cxx:205
void TransformItems(sal_uInt16 nSlotId, const SfxItemSet &rSet, uno::Sequence< beans::PropertyValue > &rArgs, const SfxSlot *pSlot)
Definition: appuno.cxx:908
AnyEventRef aEvent
static weld::Window * GetFrameWeld(const css::uno::Reference< css::awt::XWindow > &rWindow)
static bool IsSafeModeEnabled()
static weld::MessageDialog * CreateMessageDialog(weld::Widget *pParent, VclMessageType eMessageType, VclButtonsType eButtonType, const OUString &rPrimaryMessage, const ILibreOfficeKitNotifier *pNotifier=nullptr)
static Help * GetHelp()
static sal_uInt16 GetDispatchLevel()
static void BasicBreak()
void SetValue(sal_uInt16 nTheValue)
const OUString & GetValue() const
Development tool main docking window.
virtual bool Start(const OUString &rHelpId, weld::Widget *pWidget=nullptr)
static bool StartExtHelp()
static void EnableQuickHelp()
static bool IsQuickHelpEnabled()
static void DisableBalloonHelp()
static void EnableBalloonHelp()
static void DisableQuickHelp()
static bool IsBalloonHelpEnabled()
OUString getLanguage() const
const OUString & getBcp47(bool bResolveSystem=true) const
static void SetError(ErrCode)
virtual VclPtr< AbstractScriptSelectorDialog > CreateScriptSelectorDialog(weld::Window *pParent, const css::uno::Reference< css::frame::XFrame > &rxFrame)=0
virtual VclPtr< VclAbstractDialog > CreateWidgetTestDialog(weld::Window *_pParent)=0
virtual VclPtr< VclAbstractDialog > CreateToolbarmodeDialog(weld::Window *_pParent)=0
virtual VclPtr< SfxAbstractTabDialog > CreateAutoCorrTabDialog(weld::Window *pParent, const SfxItemSet *pAttrSet)=0
virtual VclPtr< VclAbstractDialog > CreateAboutDialog(weld::Window *_pParent)=0
virtual VclPtr< VclAbstractDialog > CreateTipOfTheDayDialog(weld::Window *_pParent)=0
virtual VclPtr< VclAbstractDialog > CreateFrameDialog(weld::Window *pParent, const css::uno::Reference< css::frame::XFrame > &rFrame, sal_uInt32 nResId, const OUString &rParameter)=0
virtual VclPtr< SfxAbstractTabDialog > CreateCustomizeTabDialog(weld::Window *pParent, const SfxItemSet *pAttrSet, const css::uno::Reference< css::frame::XFrame > &xViewFrame)=0
static SfxAbstractDialogFactory * Create()
Definition: sfxdlg.cxx:22
virtual VclPtr< VclAbstractDialog > CreateSvxScriptOrgDialog(weld::Window *pParent, const OUString &rLanguage)=0
std::unique_ptr< SfxAppData_Impl > pImpl
Definition: app.hxx:97
SAL_DLLPRIVATE void MiscState_Impl(SfxItemSet &)
Definition: appserv.cxx:1152
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 ...
Definition: app.cxx:380
static SAL_DLLPRIVATE void OfaState_Impl(SfxItemSet &)
Definition: appserv.cxx:1778
SAL_DLLPRIVATE void MiscExec_Impl(SfxRequest &)
Definition: appserv.cxx:320
static void MacroOrganizer(weld::Window *pParent, const css::uno::Reference< css::frame::XFrame > &xDocFrame, sal_Int16 nTabId)
Definition: app.cxx:508
static void SetOptions(const SfxItemSet &)
Definition: appcfg.cxx:234
SAL_DLLPRIVATE void OfaExec_Impl(SfxRequest &)
Definition: appserv.cxx:1449
void InvalidateAll(bool bWithMsg)
Definition: bindings.cxx:498
bool GetValue() const
vcl::Window * GetWindow() const
Definition: childwin.hxx:117
const SfxPoolItem * ExecuteList(sal_uInt16 nSlot, SfxCallMode nCall, std::initializer_list< SfxPoolItem const * > args, std::initializer_list< SfxPoolItem const * > internalargs=std::initializer_list< SfxPoolItem const * >())
Method to execute a <SfxSlot>s over the Slot-Id.
Definition: dispatch.cxx:931
SfxItemState QueryState(sal_uInt16 nSID, const SfxPoolItem *&rpState)
Definition: dispatch.cxx:1970
void Appear()
Definition: frame.cxx:528
const css::uno::Reference< css::frame::XFrame > & GetFrameInterface() const
Definition: frame.cxx:515
static css::uno::Reference< css::frame::XFrame > CreateBlankFrame()
Definition: frame2.cxx:209
static OUString GetCurrentModuleIdentifier()
Definition: sfxhelp.cxx:1391
const SfxSlot * GetSlot(sal_uInt16 nSlotId) const
Definition: objface.cxx:187
const WhichRangesContainer & GetRanges() const
const T * GetItemIfSet(TypedWhichId< T > nWhich, bool bSrchInParent=true) const
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
void DisableItem(sal_uInt16 nWhich)
const OUString & GetDocumentServiceName() const
Definition: docfac.cxx:289
static SfxObjectShell * CreateObject(const OUString &rServiceName, SfxObjectCreateMode=SfxObjectCreateMode::STANDARD)
Definition: objxtor.cxx:996
void SetConfigOptionsChecked(bool bChecked)
Definition: objstor.cxx:3775
static SAL_WARN_UNUSED_RESULT SfxObjectShell * GetNext(const SfxObjectShell &rPrev, const std::function< bool(const SfxObjectShell *)> &isObjectShell=nullptr, bool bOnlyVisible=true)
Definition: objxtor.cxx:452
virtual SfxObjectFactory & GetFactory() const =0
ErrCode CallXScript(const OUString &rScriptURL, const css::uno::Sequence< css::uno::Any > &aParams, css::uno::Any &aRet, css::uno::Sequence< sal_Int16 > &aOutParamIndex, css::uno::Sequence< css::uno::Any > &aOutParam, bool bRaiseError=true, const css::uno::Any *aCaller=nullptr)
Definition: objmisc.cxx:1460
css::uno::Reference< css::frame::XModel3 > GetModel() const
Definition: objxtor.cxx:838
static SAL_WARN_UNUSED_RESULT SfxObjectShell * GetFirst(const std::function< bool(const SfxObjectShell *)> &isObjectShell=nullptr, bool bOnlyVisible=true)
Definition: objxtor.cxx:427
static SAL_WARN_UNUSED_RESULT SfxObjectShell * Current()
Definition: objxtor.cxx:481
bool DoInitNew()
Definition: objstor.cxx:443
virtual void SetModified(bool bModified=true)
Definition: objmisc.cxx:301
sal_uInt16 GetSlot() const
Definition: request.hxx:68
SAL_DLLPRIVATE const SfxItemSet * GetInternalArgs_Impl() const
Definition: request.cxx:314
const SfxPoolItem * GetReturnValue() const
Definition: request.cxx:429
void ForgetAllArgs()
Definition: request.cxx:493
const SfxItemSet * GetArgs() const
Definition: request.hxx:75
const T * GetArg(sal_uInt16 nSlotId) const
Templatized access to the individual parameters of the SfxRequest.
Definition: request.hxx:84
void AppendItem(const SfxPoolItem &)
Definition: request.cxx:404
void SetReturnValue(const SfxPoolItem &)
Definition: request.cxx:422
weld::Window * GetFrameWeld() const
Return the window that should be used as the parent for any dialogs this request creates.
Definition: appserv.cxx:299
void SetArgs(const SfxAllItemSet &rArgs)
Definition: request.cxx:397
bool IsAPI() const
Definition: request.cxx:705
void Done(bool bRemove=false)
Definition: request.cxx:484
const OUString & getLanguage() const
Definition: sorgitm.hxx:39
SfxItemPool & GetPool() const
Each Subclass of SfxShell must reference a pool.
Definition: shell.hxx:511
virtual SfxInterface * GetInterface() const
With this virtual method, which is automatically overridden by each subclass with its own slots throu...
Definition: shell.cxx:198
const SfxPoolItem * ExecuteSlot(SfxRequest &rReq, const SfxInterface *pIF=nullptr)
This method allows you to forward a <SfxRequest> to the specified base <SfxShell>.
Definition: shell.cxx:438
SfxViewShell * GetViewShell() const
Returns the SfxViewShell in which they are located in the subshells.
Definition: shell.cxx:129
SfxDispatcher * GetDispatcher() const
This method returns a pointer to the <SfxDispatcher>, when the SfxShell is currently <UI-active> or a...
Definition: shell.cxx:124
void SetName(const OUString &rName)
Sets the name of the Shell object.
Definition: shell.cxx:114
const OUString & GetUnoName() const
Definition: msg.hxx:237
virtual short run() override
const css::uno::Any & GetValue() const
Definition: frame.hxx:175
const css::uno::Reference< css::frame::XFrame > & GetFrame() const
Definition: frame.hxx:193
void ToggleChildWindow(sal_uInt16)
Definition: viewfrm.cxx:3538
static SAL_WARN_UNUSED_RESULT SfxViewFrame * Current()
Definition: viewfrm.cxx:1975
vcl::Window & GetWindow() const
Definition: viewfrm.cxx:2792
SfxBindings & GetBindings()
Definition: viewfrm.hxx:110
static SAL_WARN_UNUSED_RESULT SfxViewFrame * GetNext(const SfxViewFrame &rPrev, const SfxObjectShell *pDoc=nullptr, bool bOnlyVisible=true)
Definition: viewfrm.cxx:2006
SfxDispatcher * GetDispatcher()
Definition: viewfrm.hxx:109
SfxChildWindow * GetChildWindow(sal_uInt16)
Definition: viewfrm.cxx:3567
static SAL_WARN_UNUSED_RESULT SfxViewFrame * GetFirst(const SfxObjectShell *pDoc=nullptr, bool bOnlyVisible=true)
Definition: viewfrm.cxx:1983
SfxFrame & GetFrame() const
Definition: viewfrm.cxx:2782
virtual SfxObjectShell * GetObjectShell() override
Definition: viewfrm.cxx:2218
void ShowChildWindow(sal_uInt16, bool bVisible=true)
Definition: viewfrm.cxx:3557
One SfxViewShell more or less represents one edit window for a document, there can be multiple ones f...
Definition: viewsh.hxx:165
SfxViewFrame & GetViewFrame() const
Definition: viewsh.hxx:290
virtual OUString GetColorConfigName() const
Get the color scheme name of this view.
Definition: viewsh.cxx:2326
static SAL_WARN_UNUSED_RESULT SfxViewShell * Current()
Definition: viewsh.cxx:1848
static bool IsRunning()
static void Stop()
bool IsImpress() const
bool IsWriter() const
void SetType(SvxZoomType eNewType)
Definition: zoomitem.hxx:70
static bool AlwaysLocked()
void disposeAndClear()
static std::shared_ptr< ConfigurationChanges > create()
bool put(const OUString &_rValueName, const VALUE_TYPE &_rValue)
css::uno::Sequence< css::beans::PropertyValue > getPropertyValues() const
static bool putFlag()
Write a flag file to the user profile indicating that the next launch should be in safe mode.
Definition: safemode.cxx:21
static void ToggleMenubar()
void RequestCloseDeck()
Show only the tab bar, not the deck.
static SidebarController * GetSidebarControllerForFrame(const css::uno::Reference< css::frame::XFrame > &rxFrame)
Return the SidebarController object that is associated with the given XFrame.
void RequestOpenDeck()
Open the deck area and restore the parent window to its old width.
const OUString & GetCurrentSchemeName() const
void LoadScheme(const OUString &rScheme)
static OUString getProductVersion()
static OUString getUILocale()
static OUString getAboutBoxProductVersion()
css::uno::Sequence< OUString > getNodeNames() const noexcept
css::uno::Any getNodeValue(const OUString &_rPath) const noexcept
bool setNodeValue(const OUString &_rPath, const css::uno::Any &_rValue) const noexcept
OConfigurationNode openNode(const OUString &_rPath) const noexcept
bool commit() const noexcept
static Application GetApplicationEnum(const OUString &rsApplicationName)
bool IsReallyVisible() const
virtual short run()
int nCount
#define DBG_ASSERT(sCon, aError)
#define ENSURE_OR_THROW(c, m)
#define TOOLS_INFO_EXCEPTION(area, stream)
#define DBG_UNHANDLED_EXCEPTION(...)
URL aURL
sal_Int64 n
Sequence< sal_Int8 > aSeq
Definition: lnkbase2.cxx:83
#define SAL_WARN(area, stream)
#define SAL_INFO(area, stream)
if(aStr !=aBuf) UpdateName_Impl(m_xFollowLb.get()
SAL_DLLPUBLIC_EXPORT rtl_uString * basicide_choose_macro(void *pParent, void *pOnlyInDocument_AsXModel, void *pDocFrame_AsXFrame, sal_Bool bChooseOnly)
OUString ChooseMacro(weld::Window *pParent, const uno::Reference< frame::XModel > &rxLimitToDocument, const uno::Reference< frame::XFrame > &xDocFrame, bool bChooseOnly)
@ Exception
bool getBOOL(const Any &_rAny)
bool dispatchCommand(const OUString &rCommand, const uno::Reference< css::frame::XFrame > &rFrame, const css::uno::Sequence< css::beans::PropertyValue > &rArguments, const uno::Reference< css::frame::XDispatchResultListener > &rListener)
css::uno::Sequence< DstElementType > containerToSequence(const SrcType &i_Container)
Reference< XComponentContext > getProcessComponentContext()
OUString getString(const Any &_rAny)
css::beans::PropertyValue makePropertyValue(const OUString &rName, T &&rValue)
int i
module
args
void openUriExternally(const OUString &sURI, bool bHandleSystemShellExecuteException, weld::Widget *pDialogParent)
Open a URI via com.sun.star.system.SystemShellExecute.
RESTART_REASON_UI_CHANGE
SVT_DLLPUBLIC bool executeRestartDialog(css::uno::Reference< css::uno::XComponentContext > const &context, weld::Window *parent, RestartReason reason)
SfxItemState
QPRO_FUNC_TYPE nType
#define ERRCODE_BASIC_WRONG_ARGS
OUString SfxResId(TranslateId aId)
Definition: sfxresid.cxx:22
static SfxItemSet & rSet
Definition: shell.cxx:534
bool empty() const noexcept
Reference< XController > xController
Reference< XFrame > xFrame
unsigned char sal_Bool
RET_OK
const char * pExt