Bug Summary

File:home/maarten/src/libreoffice/core/sfx2/source/appl/appserv.cxx
Warning:line 842, column 25
Value stored to 'bDone' is never read

Annotated Source Code

Press '?' to see keyboard shortcuts

clang -cc1 -cc1 -triple x86_64-unknown-linux-gnu -analyze -disable-free -disable-llvm-verifier -discard-value-names -main-file-name appserv.cxx -analyzer-store=region -analyzer-opt-analyze-nested-blocks -analyzer-checker=core -analyzer-checker=apiModeling -analyzer-checker=unix -analyzer-checker=deadcode -analyzer-checker=cplusplus -analyzer-checker=security.insecureAPI.UncheckedReturn -analyzer-checker=security.insecureAPI.getpw -analyzer-checker=security.insecureAPI.gets -analyzer-checker=security.insecureAPI.mktemp -analyzer-checker=security.insecureAPI.mkstemp -analyzer-checker=security.insecureAPI.vfork -analyzer-checker=nullability.NullPassedToNonnull -analyzer-checker=nullability.NullReturnedFromNonnull -analyzer-output plist -w -setup-static-analyzer -mrelocation-model pic -pic-level 2 -mframe-pointer=all -fmath-errno -fno-rounding-math -mconstructor-aliases -munwind-tables -target-cpu x86-64 -fno-split-dwarf-inlining -debugger-tuning=gdb -resource-dir /usr/lib64/clang/11.0.0 -isystem /usr/include/libxml2 -D BOOST_ERROR_CODE_HEADER_ONLY -D BOOST_SYSTEM_NO_DEPRECATED -D CPPU_ENV=gcc3 -D LINUX -D OSL_DEBUG_LEVEL=1 -D SAL_LOG_INFO -D SAL_LOG_WARN -D UNIX -D UNX -D X86_64 -D _PTHREADS -D _REENTRANT -D SFX2_DLLIMPLEMENTATION -D ENABLE_CUPS -D SYSTEM_LIBXML -D EXCEPTIONS_ON -D LIBO_INTERNAL_ONLY -I /home/maarten/src/libreoffice/core/workdir/UnpackedTarball/liborcus/include -I /home/maarten/src/libreoffice/core/workdir/UnpackedTarball/liborcus/include -I /home/maarten/src/libreoffice/core/external/boost/include -I /home/maarten/src/libreoffice/core/workdir/UnpackedTarball/boost -I /home/maarten/src/libreoffice/core/sfx2/inc -I /home/maarten/src/libreoffice/core/sfx2/source/inc -I /home/maarten/src/libreoffice/core/workdir/SdiTarget/sfx2/sdi -I /home/maarten/src/libreoffice/core/include -I /usr/lib/jvm/java-11-openjdk-11.0.9.10-0.0.ea.fc33.x86_64/include -I /usr/lib/jvm/java-11-openjdk-11.0.9.10-0.0.ea.fc33.x86_64/include/linux -I /home/maarten/src/libreoffice/core/config_host -I /home/maarten/src/libreoffice/core/workdir/CustomTarget/officecfg/registry -I /home/maarten/src/libreoffice/core/workdir/UnoApiHeadersTarget/udkapi/normal -I /home/maarten/src/libreoffice/core/workdir/UnoApiHeadersTarget/offapi/normal -internal-isystem /usr/bin/../lib/gcc/x86_64-redhat-linux/10/../../../../include/c++/10 -internal-isystem /usr/bin/../lib/gcc/x86_64-redhat-linux/10/../../../../include/c++/10/x86_64-redhat-linux -internal-isystem /usr/bin/../lib/gcc/x86_64-redhat-linux/10/../../../../include/c++/10/backward -internal-isystem /usr/local/include -internal-isystem /usr/lib64/clang/11.0.0/include -internal-externc-isystem /include -internal-externc-isystem /usr/include -O0 -Wno-missing-braces -std=c++17 -fdeprecated-macro -fdebug-compilation-dir /home/maarten/src/libreoffice/core -ferror-limit 19 -fvisibility hidden -fvisibility-inlines-hidden -stack-protector 2 -fgnuc-version=4.2.1 -fcxx-exceptions -fexceptions -debug-info-kind=constructor -analyzer-output=html -faddrsig -o /home/maarten/tmp/wis/scan-build-libreoffice/output/report/2020-10-07-141433-9725-1 -x c++ /home/maarten/src/libreoffice/core/sfx2/source/appl/appserv.cxx
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 <com/sun/star/document/XEmbeddedScripts.hpp>
22#include <com/sun/star/drawing/ModuleDispatcher.hpp>
23#include <com/sun/star/frame/Desktop.hpp>
24#include <com/sun/star/frame/DispatchResultEvent.hpp>
25#include <com/sun/star/frame/DispatchResultState.hpp>
26#include <com/sun/star/frame/DispatchHelper.hpp>
27#include <com/sun/star/frame/UnknownModuleException.hpp>
28#include <com/sun/star/frame/XLayoutManager.hpp>
29#include <com/sun/star/frame/XSynchronousFrameLoader.hpp>
30#include <com/sun/star/sdbc/DriverManager.hpp>
31#include <com/sun/star/system/SystemShellExecute.hpp>
32#include <com/sun/star/system/SystemShellExecuteFlags.hpp>
33#include <com/sun/star/text/ModuleDispatcher.hpp>
34#include <com/sun/star/task/OfficeRestartManager.hpp>
35#include <com/sun/star/task/XInteractionHandler.hpp>
36#include <com/sun/star/ui/dialogs/AddressBookSourcePilot.hpp>
37#include <com/sun/star/ui/UIElementType.hpp>
38#include <com/sun/star/ui/XUIElement.hpp>
39#include <com/sun/star/uno/Reference.hxx>
40#include <com/sun/star/util/XCloseable.hpp>
41#include <com/sun/star/util/CloseVetoException.hpp>
42#include <org/freedesktop/PackageKit/SyncDbusSessionHelper.hpp>
43
44#include <comphelper/lok.hxx>
45#include <comphelper/namedvaluecollection.hxx>
46#include <comphelper/processfactory.hxx>
47#include <comphelper/propertysequence.hxx>
48#include <comphelper/sequence.hxx>
49
50#include <svtools/addresstemplate.hxx>
51#include <svtools/miscopt.hxx>
52#include <svtools/restartdialog.hxx>
53#include <svl/visitem.hxx>
54
55#include <unotools/configmgr.hxx>
56#include <tools/svlibrary.h>
57#include <tools/diagnose_ex.h>
58#include <vcl/svapp.hxx>
59#include <vcl/weld.hxx>
60#include <svl/intitem.hxx>
61#include <svl/eitem.hxx>
62#include <svl/stritem.hxx>
63#include <basic/sbstar.hxx>
64#include <basic/basrdll.hxx>
65#include <basic/sberrors.hxx>
66#include <vcl/help.hxx>
67#include <rtl/ustrbuf.hxx>
68#include <sal/log.hxx>
69#include <osl/file.hxx>
70#include <vcl/EnumContext.hxx>
71
72#include <unotools/moduleoptions.hxx>
73#include <svtools/helpopt.hxx>
74#include <toolkit/helper/vclunohelper.hxx>
75#include <rtl/bootstrap.hxx>
76
77#include <com/sun/star/frame/ModuleManager.hpp>
78#include <com/sun/star/beans/XPropertySet.hpp>
79
80#include <sfx2/app.hxx>
81#include <sfx2/request.hxx>
82#include <sfx2/dispatch.hxx>
83#include <sfx2/bindings.hxx>
84#include <sfx2/msg.hxx>
85#include <sfx2/objface.hxx>
86#include <sfx2/objsh.hxx>
87#include <sfx2/viewsh.hxx>
88#include <sfx2/docfac.hxx>
89#include <sfx2/strings.hrc>
90#include <sfx2/sfxresid.hxx>
91#include <appdata.hxx>
92#include <sfx2/viewfrm.hxx>
93#include <sfx2/sfxdlg.hxx>
94#include <sfx2/sfxsids.hrc>
95#include <sorgitm.hxx>
96#include <sfx2/sfxhelp.hxx>
97#include <sfx2/zoomitem.hxx>
98#include <sfx2/templatedlg.hxx>
99#include <sfx2/notebookbar/SfxNotebookBar.hxx>
100#include <sfx2/sidebar/SidebarController.hxx>
101#include <sfx2/safemode.hxx>
102#include <sfx2/sfxuno.hxx>
103
104#include <comphelper/types.hxx>
105#include <officecfg/Office/Common.hxx>
106#include <unotools/confignode.hxx>
107#include <officecfg/Setup.hxx>
108#include <memory>
109
110#include <openuriexternally.hxx>
111
112#include "getbasctlfunction.hxx"
113
114using namespace ::com::sun::star;
115using namespace ::com::sun::star::beans;
116using namespace ::com::sun::star::uno;
117using namespace ::com::sun::star::frame;
118using namespace ::com::sun::star::container;
119using namespace ::com::sun::star::util;
120using namespace ::com::sun::star::script;
121using namespace ::com::sun::star::system;
122using namespace ::com::sun::star::lang;
123using namespace ::com::sun::star::document;
124using namespace ::com::sun::star::ui;
125
126namespace
127{
128 OUString lcl_getAppName( vcl::EnumContext::Application eApp )
129 {
130 switch ( eApp )
131 {
132 case vcl::EnumContext::Application::Writer:
133 return "Writer";
134 break;
135 case vcl::EnumContext::Application::Calc:
136 return "Calc";
137 break;
138 case vcl::EnumContext::Application::Impress:
139 return "Impress";
140 break;
141 case vcl::EnumContext::Application::Draw:
142 return "Draw";
143 break;
144 case vcl::EnumContext::Application::Formula:
145 return "Formula";
146 break;
147 case vcl::EnumContext::Application::Base:
148 return "Base";
149 break;
150 default:
151 return OUString();
152 break;
153 }
154 }
155
156 // lp#527938, debian#602953, fdo#33266, i#105408
157 bool lcl_isBaseAvailable()
158 {
159 try
160 {
161 // if we get css::sdbc::DriverManager, libsdbc2 is there
162 // and the bibliography is assumed to work
163 return css::sdbc::DriverManager::create(comphelper::getProcessComponentContext()).is();
164 }
165 catch (const Exception &)
166 {
167 TOOLS_INFO_EXCEPTION("sfx.appl", "assuming Base to be missing")do { css::uno::Any tools_warn_exception( DbgGetCaughtException
() ); do { if (true) { switch (sal_detail_log_report(::SAL_DETAIL_LOG_LEVEL_INFO
, "sfx.appl")) { case SAL_DETAIL_LOG_ACTION_IGNORE: break; case
SAL_DETAIL_LOG_ACTION_LOG: if (sizeof ::sal::detail::getResult
( ::sal::detail::StreamStart() << "assuming Base to be missing"
<< " " << exceptionToString(tools_warn_exception
)) == 1) { ::sal_detail_log( (::SAL_DETAIL_LOG_LEVEL_INFO), (
"sfx.appl"), ("/home/maarten/src/libreoffice/core/sfx2/source/appl/appserv.cxx"
":" "167" ": "), ::sal::detail::unwrapStream( ::sal::detail::
StreamStart() << "assuming Base to be missing" <<
" " << exceptionToString(tools_warn_exception)), 0); }
else { ::std::ostringstream sal_detail_stream; sal_detail_stream
<< "assuming Base to be missing" << " " <<
exceptionToString(tools_warn_exception); ::sal::detail::log(
(::SAL_DETAIL_LOG_LEVEL_INFO), ("sfx.appl"), ("/home/maarten/src/libreoffice/core/sfx2/source/appl/appserv.cxx"
":" "167" ": "), sal_detail_stream, 0); }; break; case SAL_DETAIL_LOG_ACTION_FATAL
: if (sizeof ::sal::detail::getResult( ::sal::detail::StreamStart
() << "assuming Base to be missing" << " " <<
exceptionToString(tools_warn_exception)) == 1) { ::sal_detail_log
( (::SAL_DETAIL_LOG_LEVEL_INFO), ("sfx.appl"), ("/home/maarten/src/libreoffice/core/sfx2/source/appl/appserv.cxx"
":" "167" ": "), ::sal::detail::unwrapStream( ::sal::detail::
StreamStart() << "assuming Base to be missing" <<
" " << exceptionToString(tools_warn_exception)), 0); }
else { ::std::ostringstream sal_detail_stream; sal_detail_stream
<< "assuming Base to be missing" << " " <<
exceptionToString(tools_warn_exception); ::sal::detail::log(
(::SAL_DETAIL_LOG_LEVEL_INFO), ("sfx.appl"), ("/home/maarten/src/libreoffice/core/sfx2/source/appl/appserv.cxx"
":" "167" ": "), sal_detail_stream, 0); }; std::abort(); break
; } } } while (false); } while (false)
;
168 return false;
169 }
170 }
171 void lcl_tryLoadBibliography()
172 {
173 // lp#527938, debian#602953, fdo#33266, i#105408
174 // make sure we actually can instantiate services from base first
175 if(!lcl_isBaseAvailable())
176 {
177 if (officecfg::Office::Common::PackageKit::EnableBaseInstallation::get())
178 {
179 try
180 {
181 using namespace org::freedesktop::PackageKit;
182 using namespace svtools;
183 Reference< XSyncDbusSessionHelper > xSyncDbusSessionHelper(SyncDbusSessionHelper::create(comphelper::getProcessComponentContext()));
184 Sequence< OUString > vPackages { "libreoffice-base" };
185 xSyncDbusSessionHelper->InstallPackageNames(vPackages, OUString());
186 // I'll be back (hopefully)!
187 SolarMutexGuard aGuard;
188 executeRestartDialog(comphelper::getProcessComponentContext(), nullptr, RESTART_REASON_BIBLIOGRAPHY_INSTALL);
189 }
190 catch (const Exception &)
191 {
192 TOOLS_INFO_EXCEPTION("sfx.appl", "trying to install LibreOffice Base")do { css::uno::Any tools_warn_exception( DbgGetCaughtException
() ); do { if (true) { switch (sal_detail_log_report(::SAL_DETAIL_LOG_LEVEL_INFO
, "sfx.appl")) { case SAL_DETAIL_LOG_ACTION_IGNORE: break; case
SAL_DETAIL_LOG_ACTION_LOG: if (sizeof ::sal::detail::getResult
( ::sal::detail::StreamStart() << "trying to install LibreOffice Base"
<< " " << exceptionToString(tools_warn_exception
)) == 1) { ::sal_detail_log( (::SAL_DETAIL_LOG_LEVEL_INFO), (
"sfx.appl"), ("/home/maarten/src/libreoffice/core/sfx2/source/appl/appserv.cxx"
":" "192" ": "), ::sal::detail::unwrapStream( ::sal::detail::
StreamStart() << "trying to install LibreOffice Base" <<
" " << exceptionToString(tools_warn_exception)), 0); }
else { ::std::ostringstream sal_detail_stream; sal_detail_stream
<< "trying to install LibreOffice Base" << " " <<
exceptionToString(tools_warn_exception); ::sal::detail::log(
(::SAL_DETAIL_LOG_LEVEL_INFO), ("sfx.appl"), ("/home/maarten/src/libreoffice/core/sfx2/source/appl/appserv.cxx"
":" "192" ": "), sal_detail_stream, 0); }; break; case SAL_DETAIL_LOG_ACTION_FATAL
: if (sizeof ::sal::detail::getResult( ::sal::detail::StreamStart
() << "trying to install LibreOffice Base" << " "
<< exceptionToString(tools_warn_exception)) == 1) { ::
sal_detail_log( (::SAL_DETAIL_LOG_LEVEL_INFO), ("sfx.appl"), (
"/home/maarten/src/libreoffice/core/sfx2/source/appl/appserv.cxx"
":" "192" ": "), ::sal::detail::unwrapStream( ::sal::detail::
StreamStart() << "trying to install LibreOffice Base" <<
" " << exceptionToString(tools_warn_exception)), 0); }
else { ::std::ostringstream sal_detail_stream; sal_detail_stream
<< "trying to install LibreOffice Base" << " " <<
exceptionToString(tools_warn_exception); ::sal::detail::log(
(::SAL_DETAIL_LOG_LEVEL_INFO), ("sfx.appl"), ("/home/maarten/src/libreoffice/core/sfx2/source/appl/appserv.cxx"
":" "192" ": "), sal_detail_stream, 0); }; std::abort(); break
; } } } while (false); } while (false)
;
193 }
194 }
195 return;
196 }
197
198 try // fdo#48775
199 {
200 SfxStringItem aURL(SID_FILE_NAME(5000 + 507), ".component:Bibliography/View1");
201 SfxStringItem aRef(SID_REFERER(5000 + 654), "private:user");
202 SfxStringItem aTarget(SID_TARGETNAME(5000 + 560), "_blank");
203 SfxViewFrame::Current()->GetDispatcher()->ExecuteList(SID_OPENDOC(5000 + 501),
204 SfxCallMode::ASYNCHRON, { &aURL, &aRef, &aTarget });
205 }
206 catch (const Exception &)
207 {
208 TOOLS_INFO_EXCEPTION( "sfx.appl", "trying to load bibliography database")do { css::uno::Any tools_warn_exception( DbgGetCaughtException
() ); do { if (true) { switch (sal_detail_log_report(::SAL_DETAIL_LOG_LEVEL_INFO
, "sfx.appl")) { case SAL_DETAIL_LOG_ACTION_IGNORE: break; case
SAL_DETAIL_LOG_ACTION_LOG: if (sizeof ::sal::detail::getResult
( ::sal::detail::StreamStart() << "trying to load bibliography database"
<< " " << exceptionToString(tools_warn_exception
)) == 1) { ::sal_detail_log( (::SAL_DETAIL_LOG_LEVEL_INFO), (
"sfx.appl"), ("/home/maarten/src/libreoffice/core/sfx2/source/appl/appserv.cxx"
":" "208" ": "), ::sal::detail::unwrapStream( ::sal::detail::
StreamStart() << "trying to load bibliography database"
<< " " << exceptionToString(tools_warn_exception
)), 0); } else { ::std::ostringstream sal_detail_stream; sal_detail_stream
<< "trying to load bibliography database" << " "
<< exceptionToString(tools_warn_exception); ::sal::detail
::log( (::SAL_DETAIL_LOG_LEVEL_INFO), ("sfx.appl"), ("/home/maarten/src/libreoffice/core/sfx2/source/appl/appserv.cxx"
":" "208" ": "), sal_detail_stream, 0); }; break; case SAL_DETAIL_LOG_ACTION_FATAL
: if (sizeof ::sal::detail::getResult( ::sal::detail::StreamStart
() << "trying to load bibliography database" << " "
<< exceptionToString(tools_warn_exception)) == 1) { ::
sal_detail_log( (::SAL_DETAIL_LOG_LEVEL_INFO), ("sfx.appl"), (
"/home/maarten/src/libreoffice/core/sfx2/source/appl/appserv.cxx"
":" "208" ": "), ::sal::detail::unwrapStream( ::sal::detail::
StreamStart() << "trying to load bibliography database"
<< " " << exceptionToString(tools_warn_exception
)), 0); } else { ::std::ostringstream sal_detail_stream; sal_detail_stream
<< "trying to load bibliography database" << " "
<< exceptionToString(tools_warn_exception); ::sal::detail
::log( (::SAL_DETAIL_LOG_LEVEL_INFO), ("sfx.appl"), ("/home/maarten/src/libreoffice/core/sfx2/source/appl/appserv.cxx"
":" "208" ": "), sal_detail_stream, 0); }; std::abort(); break
; } } } while (false); } while (false)
;
209 }
210 }
211}
212/// Find the correct location of the document (CREDITS.fodt, etc.), and return
213/// it in rURL if found.
214static bool checkURL( const char *pName, const char *pExt, OUString &rURL )
215{
216 using namespace osl;
217 DirectoryItem aDirItem;
218
219#ifdef MACOSX
220 rURL = "$BRAND_BASE_DIR/Resources/" + OUString::createFromAscii( pName ) +
221 OUString::createFromAscii( pExt );
222#else
223 rURL = "$BRAND_BASE_DIR/" + OUString::createFromAscii( pName ) +
224 OUString::createFromAscii( pExt );
225#endif
226 rtl::Bootstrap::expandMacros( rURL );
227
228 if (!rURL.isEmpty())
229 return DirectoryItem::get( rURL, aDirItem ) == DirectoryItem::E_None;
230 else
231 return false;
232}
233
234/// Displays CREDITS or LICENSE in any of the available version
235static void showDocument( const char* pBaseName )
236{
237 try {
238 Reference < XDesktop2 > xDesktop = Desktop::create( ::comphelper::getProcessComponentContext() );
239 auto args(::comphelper::InitPropertySequence({
240 {"ViewOnly", makeAny(true)},
241 {"ReadOnly", makeAny(true)}
242 }));
243
244 OUString aURL;
245 if ( checkURL ( pBaseName, ".fodt", aURL ) ||
246 checkURL ( pBaseName, ".html", aURL ) ||
247 checkURL ( pBaseName, "", aURL ) ) {
248 xDesktop->loadComponentFromURL( aURL, "_blank", 0, args );
249 }
250 } catch (const css::uno::Exception &) {
251 }
252}
253
254namespace
255{
256 Reference<XFrame> GetRequestFrame(const SfxRequest& rReq)
257 {
258 const SfxItemSet* pArgs = rReq.GetInternalArgs_Impl();
259 const SfxPoolItem* pItem = nullptr;
260 Reference <XFrame> xFrame;
261 if (pArgs && pArgs->GetItemState(SID_FILLFRAME(5000 + 1516), false, &pItem) == SfxItemState::SET)
262 {
263 OSL_ENSURE( dynamic_cast< const SfxUnoFrameItem *>( pItem ) != nullptr, "SfxApplication::OfaExec_Impl: XFrames are to be transported via SfxUnoFrameItem by now!" )do { if (true && (!(dynamic_cast< const SfxUnoFrameItem
*>( pItem ) != nullptr))) { sal_detail_logFormat((SAL_DETAIL_LOG_LEVEL_WARN
), ("legacy.osl"), ("/home/maarten/src/libreoffice/core/sfx2/source/appl/appserv.cxx"
":" "263" ": "), "%s", "SfxApplication::OfaExec_Impl: XFrames are to be transported via SfxUnoFrameItem by now!"
); } } while (false)
;
264 xFrame = static_cast< const SfxUnoFrameItem*>( pItem )->GetFrame();
265 }
266 return xFrame;
267 }
268
269 vcl::Window* getFrameWindow(const Reference<XFrame>& rFrame)
270 {
271 if (rFrame.is())
272 {
273 try
274 {
275 Reference< awt::XWindow > xContainerWindow(rFrame->getContainerWindow(), UNO_SET_THROW);
276 VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow(xContainerWindow);
277 return pWindow;
278 }
279 catch (const Exception&)
280 {
281 DBG_UNHANDLED_EXCEPTION("sfx.appl")DbgUnhandledException( DbgGetCaughtException(), __func__, "/home/maarten/src/libreoffice/core/sfx2/source/appl/appserv.cxx"
":" "281" ": ", "sfx.appl" );
;
282 }
283 }
284
285 SAL_WARN( "sfx.appl", "no parent for dialogs" )do { if (true) { switch (sal_detail_log_report(::SAL_DETAIL_LOG_LEVEL_WARN
, "sfx.appl")) { case SAL_DETAIL_LOG_ACTION_IGNORE: break; case
SAL_DETAIL_LOG_ACTION_LOG: if (sizeof ::sal::detail::getResult
( ::sal::detail::StreamStart() << "no parent for dialogs"
) == 1) { ::sal_detail_log( (::SAL_DETAIL_LOG_LEVEL_WARN), ("sfx.appl"
), ("/home/maarten/src/libreoffice/core/sfx2/source/appl/appserv.cxx"
":" "285" ": "), ::sal::detail::unwrapStream( ::sal::detail::
StreamStart() << "no parent for dialogs"), 0); } else {
::std::ostringstream sal_detail_stream; sal_detail_stream <<
"no parent for dialogs"; ::sal::detail::log( (::SAL_DETAIL_LOG_LEVEL_WARN
), ("sfx.appl"), ("/home/maarten/src/libreoffice/core/sfx2/source/appl/appserv.cxx"
":" "285" ": "), sal_detail_stream, 0); }; break; case SAL_DETAIL_LOG_ACTION_FATAL
: if (sizeof ::sal::detail::getResult( ::sal::detail::StreamStart
() << "no parent for dialogs") == 1) { ::sal_detail_log
( (::SAL_DETAIL_LOG_LEVEL_WARN), ("sfx.appl"), ("/home/maarten/src/libreoffice/core/sfx2/source/appl/appserv.cxx"
":" "285" ": "), ::sal::detail::unwrapStream( ::sal::detail::
StreamStart() << "no parent for dialogs"), 0); } else {
::std::ostringstream sal_detail_stream; sal_detail_stream <<
"no parent for dialogs"; ::sal::detail::log( (::SAL_DETAIL_LOG_LEVEL_WARN
), ("sfx.appl"), ("/home/maarten/src/libreoffice/core/sfx2/source/appl/appserv.cxx"
":" "285" ": "), sal_detail_stream, 0); }; std::abort(); break
; } } } while (false)
;
286 return nullptr;
287 }
288
289 class LicenseDialog : public weld::GenericDialogController
290 {
291 public:
292 LicenseDialog(weld::Window* pParent)
293 : GenericDialogController(pParent, "sfx/ui/licensedialog.ui", "LicenseDialog")
294 {
295 }
296
297 virtual short run() override
298 {
299 short nRet = GenericDialogController::run();
300 if (nRet == RET_OK)
301 showDocument("LICENSE");
302 return nRet;
303 }
304 };
305
306 class SafeModeQueryDialog : public weld::MessageDialogController
307 {
308 public:
309 SafeModeQueryDialog(weld::Window* pParent)
310 : MessageDialogController(pParent, "sfx/ui/safemodequerydialog.ui", "SafeModeQueryDialog")
311 {
312 }
313
314 virtual short run() override
315 {
316 short nRet = MessageDialogController::run();
317 if (nRet == RET_OK)
318 {
319 sfx2::SafeMode::putFlag();
320 uno::Reference< uno::XComponentContext > xContext = comphelper::getProcessComponentContext();
321 css::task::OfficeRestartManager::get(xContext)->requestRestart(
322 css::uno::Reference< css::task::XInteractionHandler >());
323 }
324 return nRet;
325 }
326 };
327}
328
329vcl::Window* SfxRequest::GetFrameWindow() const
330{
331 return getFrameWindow(GetRequestFrame(*this));
332}
333
334weld::Window* SfxRequest::GetFrameWeld() const
335{
336 const SfxItemSet* pIntArgs = GetInternalArgs_Impl();
337 const SfxPoolItem* pItem = nullptr;
338 if (pIntArgs && pIntArgs->GetItemState(SID_DIALOG_PARENT(5000 + 1735), false, &pItem) == SfxItemState::SET)
339 {
340 assert(dynamic_cast<const SfxUnoAnyItem*>(pItem))(static_cast <bool> (dynamic_cast<const SfxUnoAnyItem
*>(pItem)) ? void (0) : __assert_fail ("dynamic_cast<const SfxUnoAnyItem*>(pItem)"
, "/home/maarten/src/libreoffice/core/sfx2/source/appl/appserv.cxx"
, 340, __extension__ __PRETTY_FUNCTION__))
;
341 auto aAny = static_cast<const SfxUnoAnyItem*>(pItem)->GetValue();
342 Reference<awt::XWindow> xWindow;
343 aAny >>= xWindow;
344 return Application::GetFrameWeld(xWindow);
345 }
346
347 vcl::Window* pWin = GetFrameWindow();
348 return pWin ? pWin->GetFrameWeld() : nullptr;
349}
350
351void SfxApplication::MiscExec_Impl( SfxRequest& rReq )
352{
353 bool bDone = false;
354 switch ( rReq.GetSlot() )
355 {
356 case SID_SETOPTIONS(5000 + 670):
357 {
358 if( rReq.GetArgs() )
359 SetOptions_Impl( *rReq.GetArgs() );
360 break;
361 }
362
363 case SID_QUITAPP(5000 + 300):
364 case SID_LOGOUT(5000 + 1652):
365 {
366 // protect against reentrant calls
367 if ( pImpl->bInQuit )
368 return;
369
370 if ( rReq.GetSlot() == SID_LOGOUT(5000 + 1652) )
371 {
372 for ( SfxObjectShell *pObjSh = SfxObjectShell::GetFirst();
373 pObjSh; pObjSh = SfxObjectShell::GetNext( *pObjSh ) )
374 {
375 if ( !pObjSh->IsModified() )
376 continue;
377
378 SfxViewFrame* pFrame = SfxViewFrame::GetFirst( pObjSh );
379 if ( !pFrame || !pFrame->GetWindow().IsReallyVisible() )
380 continue;
381
382 if (pObjSh->PrepareClose())
383 pObjSh->SetModified( false );
384 else
385 return;
386 }
387
388 SfxStringItem aNameItem( SID_FILE_NAME(5000 + 507), "vnd.sun.star.cmd:logout" );
389 SfxStringItem aReferer( SID_REFERER(5000 + 654), "private/user" );
390 pImpl->pAppDispat->ExecuteList(SID_OPENDOC(5000 + 501),
391 SfxCallMode::SLOT, { &aNameItem, &aReferer });
392 return;
393 }
394
395 // try from nested requests again after 100ms
396 if( Application::GetDispatchLevel() > 1 )
397 {
398 /* Don't save the request for closing the application and try it later
399 again. This is an UI bound functionality ... and the user will try it again
400 if the dialog is closed. But we should not close the application automatically
401 if this dialog is closed by the user ...
402 So we ignore this request now and wait for a new user decision.
403 */
404 SAL_INFO("sfx.appl", "QueryExit => sal_False, DispatchLevel == " << Application::GetDispatchLevel() )do { if (true) { switch (sal_detail_log_report(::SAL_DETAIL_LOG_LEVEL_INFO
, "sfx.appl")) { case SAL_DETAIL_LOG_ACTION_IGNORE: break; case
SAL_DETAIL_LOG_ACTION_LOG: if (sizeof ::sal::detail::getResult
( ::sal::detail::StreamStart() << "QueryExit => sal_False, DispatchLevel == "
<< Application::GetDispatchLevel()) == 1) { ::sal_detail_log
( (::SAL_DETAIL_LOG_LEVEL_INFO), ("sfx.appl"), ("/home/maarten/src/libreoffice/core/sfx2/source/appl/appserv.cxx"
":" "404" ": "), ::sal::detail::unwrapStream( ::sal::detail::
StreamStart() << "QueryExit => sal_False, DispatchLevel == "
<< Application::GetDispatchLevel()), 0); } else { ::std
::ostringstream sal_detail_stream; sal_detail_stream <<
"QueryExit => sal_False, DispatchLevel == " << Application
::GetDispatchLevel(); ::sal::detail::log( (::SAL_DETAIL_LOG_LEVEL_INFO
), ("sfx.appl"), ("/home/maarten/src/libreoffice/core/sfx2/source/appl/appserv.cxx"
":" "404" ": "), sal_detail_stream, 0); }; break; case SAL_DETAIL_LOG_ACTION_FATAL
: if (sizeof ::sal::detail::getResult( ::sal::detail::StreamStart
() << "QueryExit => sal_False, DispatchLevel == " <<
Application::GetDispatchLevel()) == 1) { ::sal_detail_log( (
::SAL_DETAIL_LOG_LEVEL_INFO), ("sfx.appl"), ("/home/maarten/src/libreoffice/core/sfx2/source/appl/appserv.cxx"
":" "404" ": "), ::sal::detail::unwrapStream( ::sal::detail::
StreamStart() << "QueryExit => sal_False, DispatchLevel == "
<< Application::GetDispatchLevel()), 0); } else { ::std
::ostringstream sal_detail_stream; sal_detail_stream <<
"QueryExit => sal_False, DispatchLevel == " << Application
::GetDispatchLevel(); ::sal::detail::log( (::SAL_DETAIL_LOG_LEVEL_INFO
), ("sfx.appl"), ("/home/maarten/src/libreoffice/core/sfx2/source/appl/appserv.cxx"
":" "404" ": "), sal_detail_stream, 0); }; std::abort(); break
; } } } while (false)
;
405 return;
406 }
407
408 // block reentrant calls
409 pImpl->bInQuit = true;
410 Reference < XDesktop2 > xDesktop = Desktop::create ( ::comphelper::getProcessComponentContext() );
411
412 rReq.ForgetAllArgs();
413
414 // if terminate() failed, pImpl->bInQuit will now be sal_False, allowing further calls of SID_QUITAPP
415 bool bTerminated = xDesktop->terminate();
416 if (!bTerminated)
417 // if terminate() was successful, SfxApplication is now dead!
418 pImpl->bInQuit = false;
419
420 // Set return value, terminate if possible
421 rReq.SetReturnValue( SfxBoolItem( rReq.GetSlot(), bTerminated ) );
422 return;
423 }
424
425 case SID_CONFIG(5000 + 904):
426 case SID_TOOLBOXOPTIONS(5000 + 907):
427 case SID_CONFIGSTATUSBAR(5000 + 921):
428 case SID_CONFIGMENU(5000 + 924):
429 case SID_CONFIGACCEL(5000 + 925):
430 case SID_CONFIGEVENT(5000 + 926):
431 {
432 SfxAbstractDialogFactory* pFact =
433 SfxAbstractDialogFactory::Create();
434
435 const SfxStringItem* pStringItem = rReq.GetArg<SfxStringItem>(SID_CONFIG(5000 + 904));
436
437 SfxItemSet aSet(
438 GetPool(), svl::Items<SID_CONFIG(5000 + 904), SID_CONFIG(5000 + 904)>{} );
439
440 if ( pStringItem )
441 {
442 aSet.Put( SfxStringItem(
443 SID_CONFIG(5000 + 904), pStringItem->GetValue() ) );
444 }
445
446 Reference <XFrame> xFrame(GetRequestFrame(rReq));
447 ScopedVclPtr<SfxAbstractTabDialog> pDlg(pFact->CreateCustomizeTabDialog(rReq.GetFrameWeld(),
448 &aSet, xFrame ));
449
450 const short nRet = pDlg->Execute();
451
452 if ( nRet )
453 bDone = true;
454 break;
455 }
456
457 case SID_CLOSEDOCS(5000 + 595):
458 {
459
460 Reference < XDesktop2 > xDesktop = Desktop::create( ::comphelper::getProcessComponentContext() );
461 Reference< XIndexAccess > xTasks = xDesktop->getFrames();
462 if ( !xTasks.is() )
463 break;
464
465 sal_Int32 n=0;
466 do
467 {
468 if ( xTasks->getCount() <= n )
469 break;
470
471 Any aAny = xTasks->getByIndex(n);
472 Reference < XCloseable > xTask;
473 aAny >>= xTask;
474 try
475 {
476 xTask->close(true);
477 n++;
478 }
479 catch( CloseVetoException& )
480 {
481 }
482 }
483 while( true );
484
485 bool bOk = ( n == 0);
486 rReq.SetReturnValue( SfxBoolItem( 0, bOk ) );
487 bDone = true;
488 break;
489 }
490
491 case SID_SAVEDOCS(5000 + 309):
492 {
493 bool bOK = true;
494 for ( SfxObjectShell *pObjSh = SfxObjectShell::GetFirst();
495 pObjSh;
496 pObjSh = SfxObjectShell::GetNext( *pObjSh ) )
497 {
498 SfxRequest aReq( SID_SAVEDOC(5000 + 505), SfxCallMode::SLOT, pObjSh->GetPool() );
499 if ( pObjSh->IsModified() )
500 {
501 pObjSh->ExecuteSlot( aReq );
502 const SfxBoolItem *pItem = dynamic_cast<const SfxBoolItem*>( aReq.GetReturnValue() );
503 if ( !pItem || !pItem->GetValue() )
504 bOK = false;
505 }
506 }
507
508 rReq.SetReturnValue( SfxBoolItem( 0, bOK ) );
509 rReq.Done();
510 break;
511 }
512
513 case SID_SEND_FEEDBACK(5000 + 421):
514 {
515 OUString module = SfxHelp::GetCurrentModuleIdentifier();
516 OUString sURL(officecfg::Office::Common::Menus::SendFeedbackURL::get() + //officecfg/registry/data/org/openoffice/Office/Common.xcu => https://hub.libreoffice.org/send-feedback/
517 "?LOversion=" + utl::ConfigManager::getAboutBoxProductVersion() +
518 "&LOlocale=" + utl::ConfigManager::getUILocale() +
519 "&LOmodule=" + module.copy(module.lastIndexOf('.') + 1 ) );
520 sfx2::openUriExternally(sURL, false);
521 break;
522 }
523
524 case SID_Q_AND_A(5000 + 422):
525 {
526 // Askbot has URL's normalized to languages, not locales
527 // Get language from locale: ll or lll or ll-CC or lll-CC
528
529 OUString sURL(officecfg::Office::Common::Menus::QA_URL::get() + //https://hub.libreoffice.org/forum/
530 "?LOlocale=" + utl::ConfigManager::getUILocale());
531 sfx2::openUriExternally(sURL, false);
532 break;
533 }
534 case SID_DOCUMENTATION(5000 + 423):
535 {
536 // Open documentation page based on locales
537 OUString sURL(officecfg::Office::Common::Menus::DocumentationURL::get() + //https://hub.libreoffice.org/documentation/
538 "?LOlocale=" + utl::ConfigManager::getUILocale());
539 sfx2::openUriExternally(sURL, false);
540 break;
541 }
542 case SID_GETINVOLVED(5000 + 425):
543 {
544 // Open get involved/join us page based on locales
545 OUString sURL(officecfg::Office::Common::Menus::GetInvolvedURL::get() + //https://hub.libreoffice.org/joinus/
546 "?LOlocale=" + utl::ConfigManager::getUILocale());
547 sfx2::openUriExternally(sURL, false);
548 break;
549 }
550 case SID_DONATION(5000 + 424):
551 {
552 // Open donation page based on language + script (BCP47) with language as fall back.
553 OUString aLang = LanguageTag(utl::ConfigManager::getUILocale()).getLanguage();
554 OUString aBcp47 = LanguageTag(utl::ConfigManager::getUILocale()).getBcp47();
555 OUString sURL(officecfg::Office::Common::Menus::DonationURL::get() + //https://hub.libreoffice.org/donation/
556 "?BCP47=" + aBcp47 + "&LOlang=" + aLang );
557 sfx2::openUriExternally(sURL, false);
558 break;
559 }
560 case SID_WHATSNEW(5000 + 426):
561 {
562 // Open release notes depending on version and locale
563 OUString sURL(officecfg::Office::Common::Menus::ReleaseNotesURL::get() + //https://hub.libreoffice.org/ReleaseNotes/
564 "?LOvers=" + utl::ConfigManager::getProductVersion() +
565 "&LOlocale=" + LanguageTag(utl::ConfigManager::getUILocale()).getBcp47() );
566 sfx2::openUriExternally(sURL, false);
567 break;
568 }
569 case SID_SHOW_LICENSE(5000 + 1683):
570 {
571 LicenseDialog aDialog(rReq.GetFrameWeld());
572 aDialog.run();
573 break;
574 }
575
576 case SID_SHOW_CREDITS(5000 + 1711):
577 {
578 showDocument( "CREDITS" );
579 break;
580 }
581
582 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
583 case SID_HELPINDEX(5000 + 401):
584 {
585 Help* pHelp = Application::GetHelp();
586 if ( pHelp )
587 {
588 pHelp->Start(".uno:HelpIndex", Application::GetDefDialogParent()); // show start page
589 bDone = true;
590 }
591 break;
592 }
593
594 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
595 case SID_HELPTIPS(5000 + 404):
596 {
597 // Evaluate Parameter
598 const SfxBoolItem* pOnItem = rReq.GetArg<SfxBoolItem>(SID_HELPTIPS(5000 + 404));
599 bool bOn = pOnItem
600 ? pOnItem->GetValue()
601 : !Help::IsQuickHelpEnabled();
602
603 if ( bOn )
604 Help::EnableQuickHelp();
605 else
606 Help::DisableQuickHelp();
607 SvtHelpOptions().SetHelpTips( bOn );
608 Invalidate(SID_HELPTIPS(5000 + 404));
609 bDone = true;
610
611 // Record if possible
612 if ( !rReq.IsAPI() )
613 rReq.AppendItem( SfxBoolItem( SID_HELPTIPS(5000 + 404), bOn) );
614 break;
615 }
616 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
617 case SID_EXTENDEDHELP(5000 + 402):
618 {
619 Help::StartExtHelp();
620 break;
621 }
622 case SID_HELPBALLOONS(5000 + 403):
623 {
624 // Evaluate Parameter
625 const SfxBoolItem* pOnItem = rReq.GetArg<SfxBoolItem>(SID_HELPBALLOONS(5000 + 403));
626 bool bOn = pOnItem
627 ? pOnItem->GetValue()
628 : !Help::IsBalloonHelpEnabled();
629
630 if ( bOn )
631 Help::EnableBalloonHelp();
632 else
633 Help::DisableBalloonHelp();
634 SvtHelpOptions().SetExtendedHelp( bOn );
635 Invalidate(SID_HELPBALLOONS(5000 + 403));
636 bDone = true;
637
638 // Record if possible
639 if ( !rReq.IsAPI() )
640 rReq.AppendItem( SfxBoolItem( SID_HELPBALLOONS(5000 + 403), bOn) );
641 break;
642 }
643 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
644 case SID_TIPOFTHEDAY(5000 + 407):
645 {
646 SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create();
647 ScopedVclPtr<VclAbstractDialog> pDlg(pFact->CreateTipOfTheDayDialog(rReq.GetFrameWeld()));
648 pDlg->Execute();
649 bDone = true;
650 break;
651 }
652
653 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
654 case SID_ABOUT(5000 + 301):
655 {
656 SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create();
657 ScopedVclPtr<VclAbstractDialog> pDlg(pFact->CreateAboutDialog(rReq.GetFrameWeld()));
658 pDlg->Execute();
659 bDone = true;
660 break;
661 }
662
663 case SID_TEMPLATE_MANAGER(5000 + 1727):
664 {
665 SfxTemplateManagerDlg aDialog(rReq.GetFrameWeld());
666 aDialog.run();
667 bDone = true;
668 break;
669 }
670
671 case SID_TEMPLATE_ADDRESSBOKSOURCE(5000 + 1655):
672 {
673 svt::AddressBookSourceDialog aDialog(rReq.GetFrameWeld(), ::comphelper::getProcessComponentContext());
674 aDialog.run();
675 bDone = true;
676 break;
677 }
678
679#if HAVE_FEATURE_SCRIPTING1
680 case SID_BASICSTOP(5000 + 958):
681 StarBASIC::Stop();
682 break;
683
684 case SID_BASICBREAK(5000 +1521) :
685 BasicDLL::BasicBreak();
686 break;
687#endif
688
689 case SID_ZOOM_50_PERCENT(10000 + 1421):
690 case SID_ZOOM_75_PERCENT(10000 + 1422):
691 case SID_ZOOM_100_PERCENT((10000 + 99)):
692 case SID_ZOOM_150_PERCENT(10000 + 1423):
693 case SID_ZOOM_200_PERCENT(10000 + 1424):
694 case SID_ZOOM_OPTIMAL((27000 +99)):
695 case SID_ZOOM_ENTIRE_PAGE((10000 + 100)):
696 case SID_ZOOM_PAGE_WIDTH(10000 + 1420):
697 {
698 SfxObjectShell* pCurrentShell = SfxObjectShell::Current();
699 if (!pCurrentShell)
700 return;
701
702 // make sure aZoom is initialized with a proper value if SetType
703 // doesn't work
704 SvxZoomItem aZoom( SvxZoomType::PERCENT, 100 );
705
706 switch (rReq.GetSlot())
707 {
708 case SID_ZOOM_50_PERCENT(10000 + 1421):
709 aZoom.SetValue(50);
710 break;
711 case SID_ZOOM_75_PERCENT(10000 + 1422):
712 aZoom.SetValue(75);
713 break;
714 case SID_ZOOM_100_PERCENT((10000 + 99)):
715 aZoom.SetValue(100);
716 break;
717 case SID_ZOOM_150_PERCENT(10000 + 1423):
718 aZoom.SetValue(150);
719 break;
720 case SID_ZOOM_200_PERCENT(10000 + 1424):
721 aZoom.SetValue(200);
722 break;
723 case SID_ZOOM_OPTIMAL((27000 +99)):
724 aZoom.SetType( SvxZoomType::OPTIMAL );
725 break;
726 case SID_ZOOM_ENTIRE_PAGE((10000 + 100)):
727 aZoom.SetType( SvxZoomType::WHOLEPAGE );
728 break;
729 case SID_ZOOM_PAGE_WIDTH(10000 + 1420):
730 aZoom.SetType( SvxZoomType::PAGEWIDTH );
731 break;
732 }
733
734 pCurrentShell->GetDispatcher()->ExecuteList(SID_ATTR_ZOOMTypedWhichId<SvxZoomItem>(10000 + 0), SfxCallMode::ASYNCHRON, { &aZoom });
735
736 break;
737 }
738 case SID_TOOLBAR_MODE(5000 + 1728):
739 {
740 const SfxStringItem* pModeName = rReq.GetArg<SfxStringItem>( SID_TOOLBAR_MODE(5000 + 1728) );
741
742 if ( !pModeName )
743 {
744 bDone = true;
745 break;
746 }
747
748 OUString aNewName(pModeName->GetValue());
749 uno::Reference< uno::XComponentContext > xContext =
750 ::comphelper::getProcessComponentContext();
751
752 // Get information about current frame and module
753 Reference<XFrame> xCurrentFrame;
754 vcl::EnumContext::Application eCurrentApp = vcl::EnumContext::Application::NONE;
755 OUString aCurrentMode;
756
757 SfxViewFrame* pViewFrame = SfxViewFrame::Current();
758 if( pViewFrame )
759 {
760 xCurrentFrame = pViewFrame->GetFrame().GetFrameInterface();
761
762 const Reference<frame::XModuleManager> xModuleManager = frame::ModuleManager::create( xContext );
763 eCurrentApp = vcl::EnumContext::GetApplicationEnum( xModuleManager->identify( xCurrentFrame ) );
764
765 OUStringBuffer aPath("org.openoffice.Office.UI.ToolbarMode/Applications/");
766 aPath.append( lcl_getAppName( eCurrentApp ) );
767
768 const utl::OConfigurationTreeRoot aAppNode(
769 xContext,
770 aPath.makeStringAndClear(),
771 true);
772 if ( !aAppNode.isValid() )
773 {
774 bDone = true;
775 break;
776 }
777
778 aCurrentMode = comphelper::getString( aAppNode.getNodeValue( "Active" ) );
779
780 if ( aCurrentMode == aNewName )
781 {
782 bDone = true;
783 break;
784 }
785
786 // Save new toolbar mode for a current module
787 aAppNode.setNodeValue( "Active", makeAny( aNewName ) );
788 aAppNode.commit();
789 }
790
791 // Apply settings for all frames
792 pViewFrame = SfxViewFrame::GetFirst();
793 while( pViewFrame )
794 {
795 Reference<XFrame> xFrame = pViewFrame->GetFrame().GetFrameInterface();
796
797 // We want to change mode only for a current app module, ignore other apps
798 const Reference<frame::XModuleManager> xModuleManager = frame::ModuleManager::create( xContext );
799 vcl::EnumContext::Application eApp = vcl::EnumContext::GetApplicationEnum( xModuleManager->identify( xFrame ) );
800 if ( eApp != eCurrentApp )
801 {
802 pViewFrame = SfxViewFrame::GetNext( *pViewFrame );
803 continue;
804 }
805
806 Reference<css::beans::XPropertySet> xPropSet( xFrame, UNO_QUERY );
807 Reference<css::frame::XLayoutManager> xLayoutManager;
808 if ( xPropSet.is() )
809 {
810 try
811 {
812 Any aValue = xPropSet->getPropertyValue( "LayoutManager" );
813 aValue >>= xLayoutManager;
814 }
815 catch ( const css::uno::RuntimeException& )
816 {
817 throw;
818 }
819 catch ( css::uno::Exception& )
820 {
821 }
822 }
823
824 if ( xLayoutManager.is() )
825 {
826 css::uno::Sequence<OUString> aMandatoryToolbars;
827 css::uno::Sequence<OUString> aUserToolbars;
828 std::vector<OUString> aBackupList;
829 OUString aSidebarMode;
830
831 OUStringBuffer aPath( "org.openoffice.Office.UI.ToolbarMode/Applications/" );
832 aPath.append( lcl_getAppName( eApp ) );
833 aPath.append( "/Modes" );
834
835 // Read mode settings
836 const utl::OConfigurationTreeRoot aModesNode(
837 xContext,
838 aPath.makeStringAndClear(),
839 true);
840 if ( !aModesNode.isValid() )
841 {
842 bDone = true;
Value stored to 'bDone' is never read
843 break;
844 }
845
846 const Sequence<OUString> aModeNodeNames( aModesNode.getNodeNames() );
847
848 for ( const auto& rModeNodeName : aModeNodeNames )
849 {
850 const utl::OConfigurationNode aModeNode( aModesNode.openNode( rModeNodeName ) );
851 if ( !aModeNode.isValid() )
852 continue;
853
854 OUString aCommandArg = comphelper::getString( aModeNode.getNodeValue( "CommandArg" ) );
855
856 if ( aCommandArg == aNewName )
857 {
858 aMandatoryToolbars = aModeNode.getNodeValue( "Toolbars" ).get< uno::Sequence<OUString> >();
859 aUserToolbars = aModeNode.getNodeValue( "UserToolbars" ).get< uno::Sequence<OUString> >();
860 aSidebarMode = comphelper::getString( aModeNode.getNodeValue( "Sidebar" ) );
861 break;
862 }
863 }
864
865 // Backup visible toolbar list and hide all toolbars
866 const Sequence<Reference<XUIElement>> aUIElements = xLayoutManager->getElements();
867 for ( const Reference< XUIElement >& xUIElement : aUIElements )
868 {
869 Reference< XPropertySet > xPropertySet( xUIElement, UNO_QUERY );
870 if ( xPropertySet.is() && xUIElement.is() )
871 {
872 try
873 {
874 OUString aResName;
875 sal_Int16 nType( -1 );
876 xPropertySet->getPropertyValue( "Type" ) >>= nType;
877 xPropertySet->getPropertyValue( "ResourceURL" ) >>= aResName;
878
879 if (( nType == css::ui::UIElementType::TOOLBAR ) &&
880 !aResName.isEmpty() )
881 {
882 if ( xLayoutManager->isElementVisible( aResName ) )
883 {
884 aBackupList.push_back( aResName );
885 }
886 xLayoutManager->hideElement( aResName );
887 }
888 }
889 catch ( const Exception& )
890 {
891 }
892 }
893 }
894
895 // Show/Hide the Notebookbar
896 const SfxStringItem pItem(SID_NOTEBOOKBAR(10000 + 338), aNewName);
897 pViewFrame->GetDispatcher()->ExecuteList(SID_NOTEBOOKBAR(10000 + 338), SfxCallMode::SYNCHRON, {&pItem});
898
899 // Show toolbars
900 for ( const OUString& rName : std::as_const(aMandatoryToolbars) )
901 {
902 xLayoutManager->createElement( rName );
903 xLayoutManager->showElement( rName );
904 }
905
906 for ( const OUString& rName : std::as_const(aUserToolbars) )
907 {
908 xLayoutManager->createElement( rName );
909 xLayoutManager->showElement( rName );
910 }
911
912 // Sidebar
913 pViewFrame->ShowChildWindow( SID_SIDEBAR(10000 + 336) );
914
915 sfx2::sidebar::SidebarController* pSidebar =
916 sfx2::sidebar::SidebarController::GetSidebarControllerForFrame( xFrame );
917 if ( pSidebar )
918 {
919 if ( aSidebarMode == "Arrow" )
920 {
921 pSidebar->FadeOut();
922 }
923 else if ( aSidebarMode == "Tabs" )
924 {
925 pSidebar->FadeIn();
926 pSidebar->RequestOpenDeck();
927 pSidebar->RequestCloseDeck();
928 }
929 else if ( aSidebarMode == "Opened" )
930 {
931 pSidebar->FadeIn();
932 pSidebar->RequestOpenDeck();
933 }
934 }
935
936 // Save settings
937 if ( pViewFrame == SfxViewFrame::Current() )
938 {
939 css::uno::Sequence<OUString> aBackup( comphelper::containerToSequence(aBackupList) );
940
941 for ( const auto& rModeNodeName : aModeNodeNames )
942 {
943 const utl::OConfigurationNode aModeNode( aModesNode.openNode( rModeNodeName ) );
944 if ( !aModeNode.isValid() )
945 continue;
946
947 OUString aCommandArg = comphelper::getString( aModeNode.getNodeValue( "CommandArg" ) );
948
949 if ( aCommandArg == aCurrentMode )
950 {
951 aModeNode.setNodeValue( "UserToolbars", makeAny( aBackup ) );
952 break;
953 }
954 }
955 aModesNode.commit();
956 }
957 }
958
959 pViewFrame = SfxViewFrame::GetNext(*pViewFrame);
960 }
961
962 bDone = true;
963 break;
964 }
965 case SID_AVAILABLE_TOOLBARS(5000 + 1698):
966 {
967 const SfxStringItem* pToolbarName = rReq.GetArg<SfxStringItem>(SID_AVAILABLE_TOOLBARS(5000 + 1698));
968
969 if ( pToolbarName )
970 {
971 Reference < XDesktop2 > xDesktop = Desktop::create ( ::comphelper::getProcessComponentContext() );
972 Reference< XFrame > xFrame = xDesktop->getActiveFrame();
973
974 Reference< css::beans::XPropertySet > xPropSet( xFrame, UNO_QUERY );
975 Reference< css::frame::XLayoutManager > xLayoutManager;
976 if ( xPropSet.is() )
977 {
978 try
979 {
980 Any aValue = xPropSet->getPropertyValue("LayoutManager");
981 aValue >>= xLayoutManager;
982 }
983 catch ( const css::uno::RuntimeException& )
984 {
985 throw;
986 }
987 catch ( css::uno::Exception& )
988 {
989 }
990 }
991
992 if ( xLayoutManager.is() )
993 {
994 OUStringBuffer aBuf( "private:resource/toolbar/" );
995 aBuf.append( pToolbarName->GetValue() );
996
997 // Evaluate Parameter
998 OUString aToolbarName( aBuf.makeStringAndClear() );
999 bool bShow( !xLayoutManager->isElementVisible( aToolbarName ));
1000
1001 if ( bShow )
1002 {
1003 xLayoutManager->createElement( aToolbarName );
1004 xLayoutManager->showElement( aToolbarName );
1005 }
1006 else
1007 xLayoutManager->hideElement( aToolbarName );
1008 }
1009 }
1010
1011 bDone = true;
1012 break;
1013 }
1014 case SID_MENUBAR(10000 + 339):
1015 {
1016 sfx2::SfxNotebookBar::ToggleMenubar();
1017 bDone = true;
1018 break;
1019 }
1020 case SID_SAFE_MODE(5000 + 303):
1021 {
1022 SafeModeQueryDialog aDialog(rReq.GetFrameWeld());
1023 aDialog.run();
1024 break;
1025 }
1026
1027 default:
1028 break;
1029 }
1030
1031 if ( bDone )
1032 rReq.Done();
1033}
1034
1035void SfxApplication::MiscState_Impl(SfxItemSet &rSet)
1036{
1037 const sal_uInt16 *pRanges = rSet.GetRanges();
1038 DBG_ASSERT(pRanges && *pRanges, "Set without range")do { if (true && (!(pRanges && *pRanges))) { sal_detail_logFormat
((SAL_DETAIL_LOG_LEVEL_WARN), ("legacy.tools"), ("/home/maarten/src/libreoffice/core/sfx2/source/appl/appserv.cxx"
":" "1038" ": "), "%s", "Set without range"); } } while (false
)
;
1039 while ( *pRanges )
1040 {
1041 for(sal_uInt16 nWhich = *pRanges++; nWhich <= *pRanges; ++nWhich)
1042 {
1043 switch(nWhich)
1044 {
1045 case SID_TEMPLATE_ADDRESSBOKSOURCE(5000 + 1655):
1046 if ( !SvtModuleOptions().IsModuleInstalled(SvtModuleOptions::EModule::DATABASE) )
1047 rSet.Put(SfxVisibilityItem(nWhich, false));
1048 break;
1049 case SID_QUITAPP(5000 + 300):
1050 {
1051 if ( pImpl->nDocModalMode )
1052 rSet.DisableItem(nWhich);
1053 else
1054 rSet.Put(SfxStringItem(nWhich, SfxResId(STR_QUITAPPreinterpret_cast<char const *>("STR_QUITAPP" "\004" u8"E~xit %PRODUCTNAME"
)
)));
1055 break;
1056 }
1057
1058 case SID_CONFIG(5000 + 904):
1059 case SID_TOOLBOXOPTIONS(5000 + 907):
1060 case SID_CONFIGSTATUSBAR(5000 + 921):
1061 case SID_CONFIGMENU(5000 + 924):
1062 case SID_CONFIGACCEL(5000 + 925):
1063 case SID_CONFIGEVENT(5000 + 926):
1064 {
1065 if( SvtMiscOptions().DisableUICustomization() )
1066 rSet.DisableItem(nWhich);
1067 break;
1068 }
1069
1070#if HAVE_FEATURE_SCRIPTING1
1071 case SID_BASICSTOP(5000 + 958):
1072 if ( !StarBASIC::IsRunning() )
1073 rSet.DisableItem(nWhich);
1074 break;
1075#endif
1076
1077 case SID_HELPTIPS(5000 + 404):
1078 {
1079 rSet.Put( SfxBoolItem( SID_HELPTIPS(5000 + 404), Help::IsQuickHelpEnabled() ) );
1080 }
1081 break;
1082 case SID_HELPBALLOONS(5000 + 403):
1083 {
1084 rSet.Put( SfxBoolItem( SID_HELPBALLOONS(5000 + 403), Help::IsBalloonHelpEnabled() ) );
1085 }
1086 break;
1087
1088 case SID_EXTENDEDHELP(5000 + 402):
1089 {
1090 }
1091 break;
1092
1093 case SID_CLOSEDOCS(5000 + 595):
1094 {
1095 Reference < XDesktop2 > xDesktop = Desktop::create( ::comphelper::getProcessComponentContext() );
1096 Reference< XIndexAccess > xTasks = xDesktop->getFrames();
1097 if ( !xTasks.is() || !xTasks->getCount() )
1098 rSet.DisableItem(nWhich);
1099 break;
1100 }
1101
1102 case SID_SAVEDOCS(5000 + 309):
1103 {
1104 bool bModified = false;
1105 for ( SfxObjectShell *pObjSh = SfxObjectShell::GetFirst();
1106 pObjSh;
1107 pObjSh = SfxObjectShell::GetNext( *pObjSh ) )
1108 {
1109 if ( pObjSh->IsModified() )
1110 {
1111 bModified = true;
1112 break;
1113 }
1114 }
1115
1116 if ( !bModified )
1117 rSet.DisableItem( nWhich );
1118 break;
1119 }
1120
1121 case SID_TEMPLATE_MANAGER(5000 + 1727):
1122 {
1123 SvtMiscOptions aMiscOptions;
1124 if ( !aMiscOptions.IsExperimentalMode() )
1125 {
1126 rSet.DisableItem( nWhich );
1127 rSet.Put( SfxVisibilityItem( nWhich, false ) );
1128 }
1129 }
1130 break;
1131
1132 case SID_ZOOM_50_PERCENT(10000 + 1421):
1133 case SID_ZOOM_75_PERCENT(10000 + 1422):
1134 case SID_ZOOM_100_PERCENT((10000 + 99)):
1135 case SID_ZOOM_150_PERCENT(10000 + 1423):
1136 case SID_ZOOM_200_PERCENT(10000 + 1424):
1137 case SID_ZOOM_OPTIMAL((27000 +99)):
1138 case SID_ZOOM_ENTIRE_PAGE((10000 + 100)):
1139 case SID_ZOOM_PAGE_WIDTH(10000 + 1420):
1140 {
1141 SfxObjectShell* pCurrentShell = SfxObjectShell::Current();
1142
1143 const SfxPoolItem *pItem;
1144 SfxItemState aState = pCurrentShell ?
1145 pCurrentShell->GetDispatcher()->QueryState(SID_ATTR_ZOOMTypedWhichId<SvxZoomItem>(10000 + 0), pItem) : SfxItemState::DISABLED;
1146 if ( aState == SfxItemState::DISABLED )
1147 rSet.DisableItem( nWhich );
1148 }
1149 break;
1150
1151 case SID_MENUBAR(10000 + 339):
1152 {
1153 Reference < XDesktop2 > xDesktop = Desktop::create ( ::comphelper::getProcessComponentContext() );
1154 Reference< XFrame > xFrame = xDesktop->getActiveFrame();
1155
1156 Reference< css::beans::XPropertySet > xPropSet( xFrame, UNO_QUERY );
1157 Reference< css::frame::XLayoutManager > xLayoutManager;
1158 if ( xPropSet.is() )
1159 {
1160 try
1161 {
1162 Any aValue = xPropSet->getPropertyValue("LayoutManager");
1163 aValue >>= xLayoutManager;
1164 }
1165 catch ( const css::uno::RuntimeException& )
1166 {
1167 throw;
1168 }
1169 catch ( css::uno::Exception& )
1170 {
1171 }
1172 }
1173
1174 if ( xLayoutManager.is() )
1175 {
1176 const bool bState
1177 = xLayoutManager->getElement("private:resource/menubar/menubar").is()
1178 && xLayoutManager->isElementVisible(
1179 "private:resource/menubar/menubar");
1180
1181 SfxBoolItem aItem( SID_MENUBAR(10000 + 339), bState );
1182 rSet.Put( aItem );
1183 }
1184 break;
1185 }
1186 case SID_SAFE_MODE(5000 + 303):
1187 {
1188 // no restart in safe mode when already in safe mode
1189 if ( Application::IsSafeModeEnabled() )
1190 rSet.DisableItem( SID_SAFE_MODE(5000 + 303) );
1191 break;
1192 }
1193
1194 default:
1195 break;
1196 }
1197 }
1198
1199 ++pRanges;
1200 }
1201}
1202
1203#if HAVE_FEATURE_SCRIPTING1
1204
1205#ifndef DISABLE_DYNLOADING
1206
1207typedef rtl_uString* (*basicide_choose_macro)(void*, void*, void*, sal_Bool);
1208
1209#else
1210
1211extern "C" rtl_uString* basicide_choose_macro(void*, void*, void*, sal_Bool);
1212
1213#endif
1214
1215static OUString ChooseMacro(weld::Window* pParent, const Reference<XModel>& rxLimitToDocument, const Reference<XFrame>& xDocFrame, bool bChooseOnly)
1216{
1217#ifndef DISABLE_DYNLOADING
1218 basicide_choose_macro pSymbol = reinterpret_cast<basicide_choose_macro>(sfx2::getBasctlFunction("basicide_choose_macro"));
1219#else
1220#define pSymbol basicide_choose_macro
1221#endif
1222
1223 // call basicide_choose_macro in basctl
1224 rtl_uString* pScriptURL = pSymbol(pParent, rxLimitToDocument.get(), xDocFrame.get(), bChooseOnly);
1225 OUString aScriptURL( pScriptURL );
1226 rtl_uString_release( pScriptURL );
1227 return aScriptURL;
1228
1229#ifdef DISABLE_DYNLOADING
1230#undef pSymbol
1231#endif
1232}
1233
1234#endif
1235
1236namespace
1237{
1238#if HAVE_FEATURE_SCRIPTING1
1239 weld::Window* lcl_getDialogParent(const Reference<XFrame>& rxFrame)
1240 {
1241 Reference<awt::XWindow> xContainerWindow;
1242 if (rxFrame.is())
1243 xContainerWindow = rxFrame->getContainerWindow();
1244 return Application::GetFrameWeld(xContainerWindow);
1245 }
1246
1247 SfxViewFrame* lcl_getBasicIDEViewFrame( SfxObjectShell const * i_pBasicIDE )
1248 {
1249 SfxViewFrame* pView = SfxViewFrame::GetFirst( i_pBasicIDE );
1250 while ( pView )
1251 {
1252 if ( pView->GetObjectShell()->GetFactory().GetDocumentServiceName() == "com.sun.star.script.BasicIDE" )
1253 break;
1254 pView = SfxViewFrame::GetNext( *pView, i_pBasicIDE );
1255 }
1256 return pView;
1257 }
1258 Reference< XFrame > lcl_findStartModuleFrame( const Reference<XComponentContext> & rxContext )
1259 {
1260 try
1261 {
1262 Reference < XDesktop2 > xDesktop = Desktop::create( rxContext );
1263 Reference < XIndexAccess > xContainer( xDesktop->getFrames(), UNO_QUERY_THROW );
1264
1265 Reference< XModuleManager2 > xCheck = ModuleManager::create(rxContext);
1266
1267 sal_Int32 nCount = xContainer->getCount();
1268 for ( sal_Int32 i=0; i<nCount; ++i )
1269 {
1270 try
1271 {
1272 Reference < XFrame > xFrame( xContainer->getByIndex(i), UNO_QUERY_THROW );
1273 OUString sModule = xCheck->identify( xFrame );
1274 if ( sModule == "com.sun.star.frame.StartModule" )
1275 return xFrame;
1276 }
1277 catch( const UnknownModuleException& )
1278 {
1279 // silence
1280 }
1281 catch(const Exception&)
1282 {
1283 // re-throw, caught below
1284 throw;
1285 }
1286 }
1287 }
1288 catch( const Exception& )
1289 {
1290 DBG_UNHANDLED_EXCEPTION("sfx.appl")DbgUnhandledException( DbgGetCaughtException(), __func__, "/home/maarten/src/libreoffice/core/sfx2/source/appl/appserv.cxx"
":" "1290" ": ", "sfx.appl" );
;
1291 }
1292 return nullptr;
1293 }
1294#endif // HAVE_FEATURE_SCRIPTING
1295}
1296
1297void SfxApplication::OfaExec_Impl( SfxRequest& rReq )
1298{
1299 switch ( rReq.GetSlot() )
1300 {
1301 case SID_OPTIONS_TREEDIALOG( (30000 + 768) + 862):
1302 {
1303 OUString sPageURL;
1304 const SfxStringItem* pURLItem = rReq.GetArg<SfxStringItem>(SID_OPTIONS_PAGEURL(5000 + 1713));
1305 if ( pURLItem )
1306 sPageURL = pURLItem->GetValue();
1307 Reference <XFrame> xFrame(GetRequestFrame(rReq));
1308 SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create();
1309 VclPtr<VclAbstractDialog> pDlg =
1310 pFact->CreateFrameDialog(rReq.GetFrameWeld(), xFrame, rReq.GetSlot(), sPageURL );
1311 short nRet = pDlg->Execute();
1312 pDlg.disposeAndClear();
1313 SfxViewFrame* pView = SfxViewFrame::GetFirst();
1314 while ( pView )
1315 {
1316 if (nRet == RET_OK)
1317 {
1318 SfxObjectShell* pObjSh = pView->GetObjectShell();
1319 if (pObjSh)
1320 pObjSh->SetConfigOptionsChecked(false);
1321 }
1322 pView->GetBindings().InvalidateAll(false);
1323 pView = SfxViewFrame::GetNext( *pView );
1324 }
1325 break;
1326 }
1327
1328 case SID_MORE_DICTIONARIES(5000 + 1714):
1329 {
1330 try
1331 {
1332 uno::Reference< uno::XComponentContext > xContext =
1333 ::comphelper::getProcessComponentContext();
1334 uno::Reference< css::system::XSystemShellExecute > xSystemShell(
1335 css::system::SystemShellExecute::create(xContext) );
1336
1337 // read repository URL from configuration
1338 OUString sTemplRepoURL(officecfg::Office::Common::Dictionaries::RepositoryURL::get());
1339
1340 if ( xSystemShell.is() && !sTemplRepoURL.isEmpty() )
1341 {
1342 // read locale from configuration
1343 OUString sLocale(officecfg::Setup::L10N::ooLocale::get());
1344 if (sLocale.isEmpty())
1345 sLocale = "en-US";
1346
1347 OUString aURLBuf = sTemplRepoURL + "?lang=" + sLocale;
1348 xSystemShell->execute(
1349 aURLBuf,
1350 OUString(),
1351 css::system::SystemShellExecuteFlags::URIS_ONLY );
1352 }
1353 }
1354 catch( const css::uno::Exception& )
1355 {
1356 TOOLS_WARN_EXCEPTION( "sfx.appl", "SfxApplication::OfaExec_Impl(SID_MORE_DICTIONARIES)" )do { css::uno::Any tools_warn_exception( DbgGetCaughtException
() ); do { if (true) { switch (sal_detail_log_report(::SAL_DETAIL_LOG_LEVEL_WARN
, "sfx.appl")) { case SAL_DETAIL_LOG_ACTION_IGNORE: break; case
SAL_DETAIL_LOG_ACTION_LOG: if (sizeof ::sal::detail::getResult
( ::sal::detail::StreamStart() << "SfxApplication::OfaExec_Impl(SID_MORE_DICTIONARIES)"
<< " " << exceptionToString(tools_warn_exception
)) == 1) { ::sal_detail_log( (::SAL_DETAIL_LOG_LEVEL_WARN), (
"sfx.appl"), ("/home/maarten/src/libreoffice/core/sfx2/source/appl/appserv.cxx"
":" "1356" ": "), ::sal::detail::unwrapStream( ::sal::detail
::StreamStart() << "SfxApplication::OfaExec_Impl(SID_MORE_DICTIONARIES)"
<< " " << exceptionToString(tools_warn_exception
)), 0); } else { ::std::ostringstream sal_detail_stream; sal_detail_stream
<< "SfxApplication::OfaExec_Impl(SID_MORE_DICTIONARIES)"
<< " " << exceptionToString(tools_warn_exception
); ::sal::detail::log( (::SAL_DETAIL_LOG_LEVEL_WARN), ("sfx.appl"
), ("/home/maarten/src/libreoffice/core/sfx2/source/appl/appserv.cxx"
":" "1356" ": "), sal_detail_stream, 0); }; break; case SAL_DETAIL_LOG_ACTION_FATAL
: if (sizeof ::sal::detail::getResult( ::sal::detail::StreamStart
() << "SfxApplication::OfaExec_Impl(SID_MORE_DICTIONARIES)"
<< " " << exceptionToString(tools_warn_exception
)) == 1) { ::sal_detail_log( (::SAL_DETAIL_LOG_LEVEL_WARN), (
"sfx.appl"), ("/home/maarten/src/libreoffice/core/sfx2/source/appl/appserv.cxx"
":" "1356" ": "), ::sal::detail::unwrapStream( ::sal::detail
::StreamStart() << "SfxApplication::OfaExec_Impl(SID_MORE_DICTIONARIES)"
<< " " << exceptionToString(tools_warn_exception
)), 0); } else { ::std::ostringstream sal_detail_stream; sal_detail_stream
<< "SfxApplication::OfaExec_Impl(SID_MORE_DICTIONARIES)"
<< " " << exceptionToString(tools_warn_exception
); ::sal::detail::log( (::SAL_DETAIL_LOG_LEVEL_WARN), ("sfx.appl"
), ("/home/maarten/src/libreoffice/core/sfx2/source/appl/appserv.cxx"
":" "1356" ": "), sal_detail_stream, 0); }; std::abort(); break
; } } } while (false); } while (false)
;
1357 }
1358 break;
1359 }
1360#if HAVE_FEATURE_SCRIPTING1
1361 case SID_BASICIDE_APPEAR( (30000 + 768) + 15 ):
1362 {
1363 SfxViewFrame* pView = lcl_getBasicIDEViewFrame( nullptr );
1364 if ( !pView )
1365 {
1366 SfxObjectShell* pBasicIDE = SfxObjectShell::CreateObject( "com.sun.star.script.BasicIDE" );
1367 pBasicIDE->DoInitNew();
1368 pBasicIDE->SetModified( false );
1369 try
1370 {
1371 // load the Basic IDE via direct access to the SFX frame loader. A generic loadComponentFromURL
1372 // (which could be done via SfxViewFrame::LoadDocumentIntoFrame) is not feasible here, since the Basic IDE
1373 // does not really play nice with the framework's concept. For instance, it is a "singleton document",
1374 // which conflicts, at the latest, with the framework's concept of loading into _blank frames.
1375 // So, since we know that our frame loader can handle it, we skip the generic framework loader
1376 // mechanism, and the type detection (which doesn't know about the Basic IDE).
1377 Reference< XComponentContext > xContext( ::comphelper::getProcessComponentContext() );
1378 Reference< XSynchronousFrameLoader > xLoader(
1379 xContext->getServiceManager()->createInstanceWithContext("com.sun.star.comp.office.FrameLoader", xContext),
1380 UNO_QUERY_THROW );
1381 ::comphelper::NamedValueCollection aLoadArgs;
1382 aLoadArgs.put( "Model", pBasicIDE->GetModel() );
1383 aLoadArgs.put( "URL", OUString( "private:factory/sbasic" ) );
1384
1385 Reference< XFrame > xTargetFrame( lcl_findStartModuleFrame( xContext ) );
1386 if ( !xTargetFrame.is() )
1387 xTargetFrame = SfxFrame::CreateBlankFrame();
1388 ENSURE_OR_THROW( xTargetFrame.is(), "could not obtain a frameto load the Basic IDE into!" )if( !(xTargetFrame.is()) ){ do { if (true && (!(xTargetFrame
.is()))) { sal_detail_logFormat((SAL_DETAIL_LOG_LEVEL_WARN), (
"legacy.osl"), ("/home/maarten/src/libreoffice/core/sfx2/source/appl/appserv.cxx"
":" "1388" ": "), "%s", "could not obtain a frameto load the Basic IDE into!"
); } } while (false); throw css::uno::RuntimeException( __func__
+ OUStringLiteral(u",\n" "could not obtain a frameto load the Basic IDE into!"
), css::uno::Reference< css::uno::XInterface >() ); }
;
1389
1390 xLoader->load( aLoadArgs.getPropertyValues(), xTargetFrame );
1391 }
1392 catch( const Exception& )
1393 {
1394 DBG_UNHANDLED_EXCEPTION("sfx.appl")DbgUnhandledException( DbgGetCaughtException(), __func__, "/home/maarten/src/libreoffice/core/sfx2/source/appl/appserv.cxx"
":" "1394" ": ", "sfx.appl" );
;
1395 }
1396
1397 pView = lcl_getBasicIDEViewFrame( pBasicIDE );
1398 if ( pView )
1399 pView->SetName( "BASIC:1" );
1400 }
1401
1402 if ( pView )
1403 pView->GetFrame().Appear();
1404
1405 const SfxItemSet* pArgs = rReq.GetArgs();
1406 if ( pArgs && pView )
1407 {
1408 SfxViewShell* pViewShell = pView->GetViewShell();
1409 SfxObjectShell* pObjShell = pView->GetObjectShell();
1410 if ( pViewShell && pObjShell )
1411 {
1412 SfxRequest aReq( SID_BASICIDE_SHOWWINDOW( (30000 + 768) + 44 ), SfxCallMode::SYNCHRON, pObjShell->GetPool() );
1413 aReq.SetArgs( *pArgs );
1414 pViewShell->ExecuteSlot( aReq );
1415 }
1416 }
1417
1418 rReq.Done();
1419 }
1420 break;
1421
1422 case SID_BASICCHOOSER(5000 + 959):
1423 {
1424 const SfxItemSet* pArgs = rReq.GetArgs();
1425 const SfxPoolItem* pItem;
1426 bool bChooseOnly = false;
1427 Reference< XModel > xLimitToModel;
1428 if(pArgs && SfxItemState::SET == pArgs->GetItemState(SID_RECORDMACRO(5000 + 1669), false, &pItem) )
1429 {
1430 bool bRecord = static_cast<const SfxBoolItem*>(pItem)->GetValue();
1431 if ( bRecord )
1432 {
1433 // !Hack
1434 bChooseOnly = false;
1435 SfxObjectShell* pCurrentShell = SfxObjectShell::Current();
1436 OSL_ENSURE( pCurrentShell, "macro recording outside an SFX document?" )do { if (true && (!(pCurrentShell))) { sal_detail_logFormat
((SAL_DETAIL_LOG_LEVEL_WARN), ("legacy.osl"), ("/home/maarten/src/libreoffice/core/sfx2/source/appl/appserv.cxx"
":" "1436" ": "), "%s", "macro recording outside an SFX document?"
); } } while (false)
;
1437 if ( pCurrentShell )
1438 xLimitToModel = pCurrentShell->GetModel();
1439 }
1440 }
1441
1442 Reference <XFrame> xFrame(GetRequestFrame(rReq));
1443 rReq.SetReturnValue(SfxStringItem(rReq.GetSlot(), ChooseMacro(rReq.GetFrameWeld(), xLimitToModel, xFrame, bChooseOnly)));
1444 rReq.Done();
1445 }
1446 break;
1447
1448 case SID_MACROORGANIZER(5000 + 1691):
1449 {
1450 SAL_INFO("sfx.appl", "handling SID_MACROORGANIZER")do { if (true) { switch (sal_detail_log_report(::SAL_DETAIL_LOG_LEVEL_INFO
, "sfx.appl")) { case SAL_DETAIL_LOG_ACTION_IGNORE: break; case
SAL_DETAIL_LOG_ACTION_LOG: if (sizeof ::sal::detail::getResult
( ::sal::detail::StreamStart() << "handling SID_MACROORGANIZER"
) == 1) { ::sal_detail_log( (::SAL_DETAIL_LOG_LEVEL_INFO), ("sfx.appl"
), ("/home/maarten/src/libreoffice/core/sfx2/source/appl/appserv.cxx"
":" "1450" ": "), ::sal::detail::unwrapStream( ::sal::detail
::StreamStart() << "handling SID_MACROORGANIZER"), 0); }
else { ::std::ostringstream sal_detail_stream; sal_detail_stream
<< "handling SID_MACROORGANIZER"; ::sal::detail::log( (
::SAL_DETAIL_LOG_LEVEL_INFO), ("sfx.appl"), ("/home/maarten/src/libreoffice/core/sfx2/source/appl/appserv.cxx"
":" "1450" ": "), sal_detail_stream, 0); }; break; case SAL_DETAIL_LOG_ACTION_FATAL
: if (sizeof ::sal::detail::getResult( ::sal::detail::StreamStart
() << "handling SID_MACROORGANIZER") == 1) { ::sal_detail_log
( (::SAL_DETAIL_LOG_LEVEL_INFO), ("sfx.appl"), ("/home/maarten/src/libreoffice/core/sfx2/source/appl/appserv.cxx"
":" "1450" ": "), ::sal::detail::unwrapStream( ::sal::detail
::StreamStart() << "handling SID_MACROORGANIZER"), 0); }
else { ::std::ostringstream sal_detail_stream; sal_detail_stream
<< "handling SID_MACROORGANIZER"; ::sal::detail::log( (
::SAL_DETAIL_LOG_LEVEL_INFO), ("sfx.appl"), ("/home/maarten/src/libreoffice/core/sfx2/source/appl/appserv.cxx"
":" "1450" ": "), sal_detail_stream, 0); }; std::abort(); break
; } } } while (false)
;
1451 const SfxItemSet* pArgs = rReq.GetArgs();
1452 const SfxPoolItem* pItem;
1453 sal_Int16 nTabId = 0;
1454 if(pArgs && SfxItemState::SET == pArgs->GetItemState(SID_MACROORGANIZER(5000 + 1691), false, &pItem) )
1455 {
1456 nTabId = static_cast<const SfxUInt16Item*>(pItem)->GetValue();
1457 }
1458
1459 SfxApplication::MacroOrganizer(rReq.GetFrameWeld(), nTabId);
1460 rReq.Done();
1461 }
1462 break;
1463
1464 case SID_RUNMACRO(5000 + 1692):
1465 {
1466 SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create();
1467 SAL_INFO("sfx.appl", "SfxApplication::OfaExec_Impl: case ScriptOrg")do { if (true) { switch (sal_detail_log_report(::SAL_DETAIL_LOG_LEVEL_INFO
, "sfx.appl")) { case SAL_DETAIL_LOG_ACTION_IGNORE: break; case
SAL_DETAIL_LOG_ACTION_LOG: if (sizeof ::sal::detail::getResult
( ::sal::detail::StreamStart() << "SfxApplication::OfaExec_Impl: case ScriptOrg"
) == 1) { ::sal_detail_log( (::SAL_DETAIL_LOG_LEVEL_INFO), ("sfx.appl"
), ("/home/maarten/src/libreoffice/core/sfx2/source/appl/appserv.cxx"
":" "1467" ": "), ::sal::detail::unwrapStream( ::sal::detail
::StreamStart() << "SfxApplication::OfaExec_Impl: case ScriptOrg"
), 0); } else { ::std::ostringstream sal_detail_stream; sal_detail_stream
<< "SfxApplication::OfaExec_Impl: case ScriptOrg"; ::sal
::detail::log( (::SAL_DETAIL_LOG_LEVEL_INFO), ("sfx.appl"), (
"/home/maarten/src/libreoffice/core/sfx2/source/appl/appserv.cxx"
":" "1467" ": "), sal_detail_stream, 0); }; break; case SAL_DETAIL_LOG_ACTION_FATAL
: if (sizeof ::sal::detail::getResult( ::sal::detail::StreamStart
() << "SfxApplication::OfaExec_Impl: case ScriptOrg") ==
1) { ::sal_detail_log( (::SAL_DETAIL_LOG_LEVEL_INFO), ("sfx.appl"
), ("/home/maarten/src/libreoffice/core/sfx2/source/appl/appserv.cxx"
":" "1467" ": "), ::sal::detail::unwrapStream( ::sal::detail
::StreamStart() << "SfxApplication::OfaExec_Impl: case ScriptOrg"
), 0); } else { ::std::ostringstream sal_detail_stream; sal_detail_stream
<< "SfxApplication::OfaExec_Impl: case ScriptOrg"; ::sal
::detail::log( (::SAL_DETAIL_LOG_LEVEL_INFO), ("sfx.appl"), (
"/home/maarten/src/libreoffice/core/sfx2/source/appl/appserv.cxx"
":" "1467" ": "), sal_detail_stream, 0); }; std::abort(); break
; } } } while (false)
;
1468
1469 Reference <XFrame> xFrame(GetRequestFrame(rReq));
1470 if ( !xFrame.is() )
1471 {
1472 const SfxViewFrame* pViewFrame = SfxViewFrame::Current();
1473 if ( pViewFrame )
1474 xFrame = pViewFrame->GetFrame().GetFrameInterface();
1475 }
1476
1477 do // artificial loop for flow control
1478 {
1479 ScopedVclPtr<AbstractScriptSelectorDialog> pDlg(pFact->CreateScriptSelectorDialog(lcl_getDialogParent(xFrame), xFrame));
1480 OSL_ENSURE( pDlg, "SfxApplication::OfaExec_Impl( SID_RUNMACRO ): no dialog!" )do { if (true && (!(pDlg))) { sal_detail_logFormat((SAL_DETAIL_LOG_LEVEL_WARN
), ("legacy.osl"), ("/home/maarten/src/libreoffice/core/sfx2/source/appl/appserv.cxx"
":" "1480" ": "), "%s", "SfxApplication::OfaExec_Impl( SID_RUNMACRO ): no dialog!"
); } } while (false)
;
1481 if ( !pDlg )
1482 break;
1483 pDlg->SetRunLabel();
1484
1485 short nDialogResult = pDlg->Execute();
1486 if ( !nDialogResult )
1487 break;
1488
1489 Sequence< Any > args;
1490 Sequence< sal_Int16 > outIndex;
1491 Sequence< Any > outArgs;
1492 Any ret;
1493
1494 Reference< XInterface > xScriptContext;
1495
1496 Reference< XController > xController;
1497 if ( xFrame.is() )
1498 xController = xFrame->getController();
1499 if ( xController.is() )
1500 xScriptContext = xController->getModel();
1501 if ( !xScriptContext.is() )
1502 xScriptContext = xController;
1503
1504 SfxObjectShell::CallXScript( xScriptContext, pDlg->GetScriptURL(), args, ret, outIndex, outArgs );
1505 }
1506 while ( false );
1507 rReq.Done();
1508 }
1509 break;
1510
1511 case SID_SCRIPTORGANIZER(5000 + 1690):
1512 {
1513 SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create();
1514 SAL_INFO("sfx.appl", "SfxApplication::OfaExec_Impl: case ScriptOrg")do { if (true) { switch (sal_detail_log_report(::SAL_DETAIL_LOG_LEVEL_INFO
, "sfx.appl")) { case SAL_DETAIL_LOG_ACTION_IGNORE: break; case
SAL_DETAIL_LOG_ACTION_LOG: if (sizeof ::sal::detail::getResult
( ::sal::detail::StreamStart() << "SfxApplication::OfaExec_Impl: case ScriptOrg"
) == 1) { ::sal_detail_log( (::SAL_DETAIL_LOG_LEVEL_INFO), ("sfx.appl"
), ("/home/maarten/src/libreoffice/core/sfx2/source/appl/appserv.cxx"
":" "1514" ": "), ::sal::detail::unwrapStream( ::sal::detail
::StreamStart() << "SfxApplication::OfaExec_Impl: case ScriptOrg"
), 0); } else { ::std::ostringstream sal_detail_stream; sal_detail_stream
<< "SfxApplication::OfaExec_Impl: case ScriptOrg"; ::sal
::detail::log( (::SAL_DETAIL_LOG_LEVEL_INFO), ("sfx.appl"), (
"/home/maarten/src/libreoffice/core/sfx2/source/appl/appserv.cxx"
":" "1514" ": "), sal_detail_stream, 0); }; break; case SAL_DETAIL_LOG_ACTION_FATAL
: if (sizeof ::sal::detail::getResult( ::sal::detail::StreamStart
() << "SfxApplication::OfaExec_Impl: case ScriptOrg") ==
1) { ::sal_detail_log( (::SAL_DETAIL_LOG_LEVEL_INFO), ("sfx.appl"
), ("/home/maarten/src/libreoffice/core/sfx2/source/appl/appserv.cxx"
":" "1514" ": "), ::sal::detail::unwrapStream( ::sal::detail
::StreamStart() << "SfxApplication::OfaExec_Impl: case ScriptOrg"
), 0); } else { ::std::ostringstream sal_detail_stream; sal_detail_stream
<< "SfxApplication::OfaExec_Impl: case ScriptOrg"; ::sal
::detail::log( (::SAL_DETAIL_LOG_LEVEL_INFO), ("sfx.appl"), (
"/home/maarten/src/libreoffice/core/sfx2/source/appl/appserv.cxx"
":" "1514" ": "), sal_detail_stream, 0); }; std::abort(); break
; } } } while (false)
;
1515 const SfxItemSet* pArgs = rReq.GetArgs();
1516 const SfxPoolItem* pItem;
1517 OUString aLanguage;
1518 if(pArgs && SfxItemState::SET == pArgs->GetItemState(SID_SCRIPTORGANIZER(5000 + 1690), false, &pItem) )
1519 {
1520 aLanguage = static_cast<const SfxScriptOrganizerItem*>(pItem)->getLanguage();
1521 }
1522
1523 OUString aLang( aLanguage );
1524 SAL_INFO("sfx.appl", "SfxApplication::OfaExec_Impl: about to create dialog for: " << aLang)do { if (true) { switch (sal_detail_log_report(::SAL_DETAIL_LOG_LEVEL_INFO
, "sfx.appl")) { case SAL_DETAIL_LOG_ACTION_IGNORE: break; case
SAL_DETAIL_LOG_ACTION_LOG: if (sizeof ::sal::detail::getResult
( ::sal::detail::StreamStart() << "SfxApplication::OfaExec_Impl: about to create dialog for: "
<< aLang) == 1) { ::sal_detail_log( (::SAL_DETAIL_LOG_LEVEL_INFO
), ("sfx.appl"), ("/home/maarten/src/libreoffice/core/sfx2/source/appl/appserv.cxx"
":" "1524" ": "), ::sal::detail::unwrapStream( ::sal::detail
::StreamStart() << "SfxApplication::OfaExec_Impl: about to create dialog for: "
<< aLang), 0); } else { ::std::ostringstream sal_detail_stream
; sal_detail_stream << "SfxApplication::OfaExec_Impl: about to create dialog for: "
<< aLang; ::sal::detail::log( (::SAL_DETAIL_LOG_LEVEL_INFO
), ("sfx.appl"), ("/home/maarten/src/libreoffice/core/sfx2/source/appl/appserv.cxx"
":" "1524" ": "), sal_detail_stream, 0); }; break; case SAL_DETAIL_LOG_ACTION_FATAL
: if (sizeof ::sal::detail::getResult( ::sal::detail::StreamStart
() << "SfxApplication::OfaExec_Impl: about to create dialog for: "
<< aLang) == 1) { ::sal_detail_log( (::SAL_DETAIL_LOG_LEVEL_INFO
), ("sfx.appl"), ("/home/maarten/src/libreoffice/core/sfx2/source/appl/appserv.cxx"
":" "1524" ": "), ::sal::detail::unwrapStream( ::sal::detail
::StreamStart() << "SfxApplication::OfaExec_Impl: about to create dialog for: "
<< aLang), 0); } else { ::std::ostringstream sal_detail_stream
; sal_detail_stream << "SfxApplication::OfaExec_Impl: about to create dialog for: "
<< aLang; ::sal::detail::log( (::SAL_DETAIL_LOG_LEVEL_INFO
), ("sfx.appl"), ("/home/maarten/src/libreoffice/core/sfx2/source/appl/appserv.cxx"
":" "1524" ": "), sal_detail_stream, 0); }; std::abort(); break
; } } } while (false)
;
1525 ScopedVclPtr<VclAbstractDialog> pDlg(pFact->CreateSvxScriptOrgDialog(rReq.GetFrameWeld(), aLanguage));
1526 if( pDlg )
1527 {
1528 pDlg->Execute();
1529 }
1530 else
1531 {
1532 SAL_WARN("sfx.appl", "no dialog!!!")do { if (true) { switch (sal_detail_log_report(::SAL_DETAIL_LOG_LEVEL_WARN
, "sfx.appl")) { case SAL_DETAIL_LOG_ACTION_IGNORE: break; case
SAL_DETAIL_LOG_ACTION_LOG: if (sizeof ::sal::detail::getResult
( ::sal::detail::StreamStart() << "no dialog!!!") == 1)
{ ::sal_detail_log( (::SAL_DETAIL_LOG_LEVEL_WARN), ("sfx.appl"
), ("/home/maarten/src/libreoffice/core/sfx2/source/appl/appserv.cxx"
":" "1532" ": "), ::sal::detail::unwrapStream( ::sal::detail
::StreamStart() << "no dialog!!!"), 0); } else { ::std::
ostringstream sal_detail_stream; sal_detail_stream << "no dialog!!!"
; ::sal::detail::log( (::SAL_DETAIL_LOG_LEVEL_WARN), ("sfx.appl"
), ("/home/maarten/src/libreoffice/core/sfx2/source/appl/appserv.cxx"
":" "1532" ": "), sal_detail_stream, 0); }; break; case SAL_DETAIL_LOG_ACTION_FATAL
: if (sizeof ::sal::detail::getResult( ::sal::detail::StreamStart
() << "no dialog!!!") == 1) { ::sal_detail_log( (::SAL_DETAIL_LOG_LEVEL_WARN
), ("sfx.appl"), ("/home/maarten/src/libreoffice/core/sfx2/source/appl/appserv.cxx"
":" "1532" ": "), ::sal::detail::unwrapStream( ::sal::detail
::StreamStart() << "no dialog!!!"), 0); } else { ::std::
ostringstream sal_detail_stream; sal_detail_stream << "no dialog!!!"
; ::sal::detail::log( (::SAL_DETAIL_LOG_LEVEL_WARN), ("sfx.appl"
), ("/home/maarten/src/libreoffice/core/sfx2/source/appl/appserv.cxx"
":" "1532" ": "), sal_detail_stream, 0); }; std::abort(); break
; } } } while (false)
;
1533 }
1534 rReq.Done();
1535 }
1536 break;
1537#endif // HAVE_FEATURE_SCRIPTING
1538
1539 case SID_OFFICE_CHECK_PLZ(5000 + 1610):
1540 {
1541 bool bRet = false;
1542 const SfxStringItem* pStringItem = rReq.GetArg<SfxStringItem>(rReq.GetSlot());
1543
1544 if ( pStringItem )
1545 {
1546 bRet = true /*!!!SfxIniManager::CheckPLZ( aPLZ )*/;
1547 }
1548#if HAVE_FEATURE_SCRIPTING1
1549 else
1550 SbxBase::SetError( ERRCODE_BASIC_WRONG_ARGSErrCode( ErrCodeArea::Sbx, ErrCodeClass::Sbx, 28) );
1551#endif
1552 rReq.SetReturnValue( SfxBoolItem( rReq.GetSlot(), bRet ) );
1553 }
1554 break;
1555
1556 case SID_AUTO_CORRECT_DLG(10000 + 424):
1557 {
1558 SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create();
1559 SfxItemSet aSet(GetPool(), svl::Items<SID_AUTO_CORRECT_DLG(10000 + 424), SID_AUTO_CORRECT_DLG(10000 + 424)>{});
1560 const SfxPoolItem* pItem=nullptr;
1561 const SfxItemSet* pSet = rReq.GetArgs();
1562 SfxItemPool* pSetPool = pSet ? pSet->GetPool() : nullptr;
1563 if ( pSet && pSet->GetItemState( pSetPool->GetWhich( SID_AUTO_CORRECT_DLG(10000 + 424) ), false, &pItem ) == SfxItemState::SET )
1564 aSet.Put( *pItem );
1565
1566 const SfxViewFrame* pViewFrame = SfxViewFrame::Current();
1567 ScopedVclPtr<SfxAbstractTabDialog> pDlg(pFact->CreateAutoCorrTabDialog(pViewFrame ? pViewFrame->GetWindow().GetFrameWeld() : nullptr, &aSet));
1568 pDlg->Execute();
1569
1570 break;
1571 }
1572
1573 case SID_NEWSD(5000 + 1686) :
1574 {
1575 SvtModuleOptions aModuleOpt;
1576 if ( !aModuleOpt.IsImpress() )
1577 {
1578 std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(nullptr,
1579 VclMessageType::Warning, VclButtonsType::Ok,
1580 SfxResId(STR_MODULENOTINSTALLEDreinterpret_cast<char const *>("STR_MODULENOTINSTALLED"
"\004" u8"The action could not be executed. The %PRODUCTNAME program module needed for this action is currently not installed."
)
)));
1581 xBox->run();
1582 return;
1583 }
1584
1585 Reference< uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext();
1586 Reference< frame::XDispatchProvider > xProv = drawing::ModuleDispatcher::create( xContext );
1587
1588 OUString aCmd = OUString::createFromAscii( GetInterface()->GetSlot( rReq.GetSlot() )->GetUnoName() );
1589 Reference< frame::XDispatchHelper > xHelper( frame::DispatchHelper::create(xContext) );
1590 Sequence < beans::PropertyValue > aSeq;
1591 if ( rReq.GetArgs() )
1592 TransformItems( rReq.GetSlot(), *rReq.GetArgs(), aSeq );
1593 Any aResult = xHelper->executeDispatch( xProv, aCmd, OUString(), 0, aSeq );
1594 frame::DispatchResultEvent aEvent;
1595 bool bSuccess = (aResult >>= aEvent) &&
1596 (aEvent.State == frame::DispatchResultState::SUCCESS);
1597 rReq.SetReturnValue( SfxBoolItem( rReq.GetSlot(), bSuccess ) );
1598 }
1599 break;
1600
1601 case FN_LABEL(20000 + 1051 ) :
1602 case FN_BUSINESS_CARD(20000 + 1052) :
1603 case FN_XFORMS_INIT(20000 + 1053) :
1604 {
1605 Reference< uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext();
1606 Reference< frame::XDispatchProvider > xProv = text::ModuleDispatcher::create( xContext );
1607
1608 OUString aCmd = OUString::createFromAscii( GetInterface()->GetSlot( rReq.GetSlot() )->GetUnoName() );
1609 Reference< frame::XDispatchHelper > xHelper( frame::DispatchHelper::create(xContext) );
1610 Sequence < beans::PropertyValue > aSeq;
1611 if ( rReq.GetArgs() )
1612 TransformItems( rReq.GetSlot(), *rReq.GetArgs(), aSeq );
1613 Any aResult = xHelper->executeDispatch( xProv, aCmd, OUString(), 0, aSeq );
1614 frame::DispatchResultEvent aEvent;
1615 bool bSuccess = (aResult >>= aEvent) &&
1616 (aEvent.State == frame::DispatchResultState::SUCCESS);
1617 rReq.SetReturnValue( SfxBoolItem( rReq.GetSlot(), bSuccess ) );
1618 }
1619 break;
1620
1621 case SID_ADDRESS_DATA_SOURCE(10000 + 934):
1622 {
1623 try
1624 {
1625 Reference< uno::XComponentContext > xORB = ::comphelper::getProcessComponentContext();
1626 Reference< ui::dialogs::XExecutableDialog > xDialog = ui::dialogs::AddressBookSourcePilot::createWithParent(xORB, nullptr);
1627 xDialog->execute();
1628 }
1629 catch(const css::uno::Exception&)
1630 {
1631 DBG_UNHANDLED_EXCEPTION("sfx.appl")DbgUnhandledException( DbgGetCaughtException(), __func__, "/home/maarten/src/libreoffice/core/sfx2/source/appl/appserv.cxx"
":" "1631" ": ", "sfx.appl" );
;
1632 }
1633 }
1634 break;
1635
1636 case SID_COMP_BIBLIOGRAPHY(10000 + 880):
1637 lcl_tryLoadBibliography();
1638 break;
1639 }
1640}
1641
1642void SfxApplication::OfaState_Impl(SfxItemSet &rSet)
1643{
1644 SvtModuleOptions aModuleOpt;
1645
1646 if( !aModuleOpt.IsWriter())
1647 {
1648 rSet.DisableItem( FN_LABEL(20000 + 1051 ) );
1649 rSet.DisableItem( FN_BUSINESS_CARD(20000 + 1052) );
1650 rSet.DisableItem( FN_XFORMS_INIT(20000 + 1053) );
1651 }
1652 if ( comphelper::LibreOfficeKit::isActive() )
1653 rSet.DisableItem( SID_AUTO_CORRECT_DLG(10000 + 424) );
1654
1655 bool bMacrosDisabled
1656 = officecfg::Office::Common::Security::Scripting::DisableMacrosExecution::get();
1657 if (bMacrosDisabled)
1658 {
1659 rSet.DisableItem(SID_RUNMACRO(5000 + 1692));
1660 rSet.DisableItem(SID_MACROORGANIZER(5000 + 1691));
1661 rSet.DisableItem(SID_SCRIPTORGANIZER(5000 + 1690));
1662 rSet.DisableItem(SID_BASICIDE_APPEAR( (30000 + 768) + 15 ));
1663 }
1664}
1665
1666/* vim:set shiftwidth=4 softtabstop=4 expandtab: */