LibreOffice Module cui (master) 1
treeopt.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 <memory>
21#include <string_view>
22
23#include <config_features.h>
24#include <config_feature_opencl.h>
25#include <config_feature_desktop.h>
26#include <config_gpgme.h>
27
28#include <officecfg/Office/Common.hxx>
29
30#include <svx/dialogs.hrc>
31#include <svx/svxids.hrc>
32
33#include <treeopt.hrc>
34#include <helpids.h>
35
36#include "cfgchart.hxx"
37#include "connpoolconfig.hxx"
38#include "connpooloptions.hxx"
39#include <cuioptgenrl.hxx>
40#include <dbregister.hxx>
42#include <dialmgr.hxx>
43#include "fontsubs.hxx"
44#include "optaccessibility.hxx"
45#include <optasian.hxx>
46#include "optchart.hxx"
47#include "optcolor.hxx"
48#include "optctl.hxx"
49#include "optfltr.hxx"
50#include "optgdlg.hxx"
51#include "opthtml.hxx"
52#include "optinet2.hxx"
53#include "optjava.hxx"
54#include "optjsearch.hxx"
55#include <optlingu.hxx>
56#if HAVE_FEATURE_OPENCL
57#include "optopencl.hxx"
58#endif
59#include <optpath.hxx>
60#include "optsave.hxx"
61#include "optupdt.hxx"
62#include "personalization.hxx"
63#include <treeopt.hxx>
64#include "optbasic.hxx"
65#include "optlanguagetool.hxx"
66#include "optdeepl.hxx"
67
68#include <com/sun/star/awt/XContainerWindowEventHandler.hpp>
69#include <com/sun/star/awt/ContainerWindowProvider.hpp>
70#include <com/sun/star/awt/XControl.hpp>
71#include <com/sun/star/awt/PosSize.hpp>
72#include <com/sun/star/frame/Desktop.hpp>
73#include <com/sun/star/frame/ModuleManager.hpp>
74#include <com/sun/star/frame/UnknownModuleException.hpp>
75#include <com/sun/star/lang/XMultiServiceFactory.hpp>
76#include <com/sun/star/linguistic2/LinguProperties.hpp>
77#include <com/sun/star/setup/UpdateCheck.hpp>
80#include <editeng/langitem.hxx>
81#include <editeng/optitems.hxx>
82#include <editeng/unolingu.hxx>
83#include <linguistic/misc.hxx>
84#include <officecfg/Office/OptionsDialog.hxx>
85#include <sfx2/app.hxx>
86#include <sfx2/dispatch.hxx>
87#include <sfx2/module.hxx>
88#include <sfx2/printopt.hxx>
89#include <sfx2/shell.hxx>
90#include <sfx2/viewsh.hxx>
91#include <sfx2/viewfrm.hxx>
92#include <svl/flagitem.hxx>
93#include <svl/intitem.hxx>
94#include <svl/cjkoptions.hxx>
95#include <svl/ctloptions.hxx>
98#include <tools/urlobj.hxx>
100#include <unotools/configmgr.hxx>
104#include <utility>
105#include <vcl/help.hxx>
106#include <vcl/svapp.hxx>
107#include <vcl/weldutils.hxx>
108#include <vcl/window.hxx>
109#include <sal/log.hxx>
110
111using namespace ::com::sun::star;
112using namespace ::com::sun::star::beans;
113using namespace ::com::sun::star::container;
114using namespace ::com::sun::star::frame;
115using namespace ::com::sun::star::lang;
116using namespace ::com::sun::star::linguistic2;
117using namespace ::com::sun::star::uno;
118using namespace ::com::sun::star::util;
119
121
122// some stuff for easier changes for SvtViewOptions
123constexpr OUStringLiteral VIEWOPT_DATANAME = u"page data";
124
125static void SetViewOptUserItem( SvtViewOptions& rOpt, const OUString& rData )
126{
127 rOpt.SetUserItem( VIEWOPT_DATANAME, Any( rData ) );
128}
129
130static OUString GetViewOptUserItem( const SvtViewOptions& rOpt )
131{
132 Any aAny( rOpt.GetUserItem( VIEWOPT_DATANAME ) );
133 OUString aUserData;
134 aAny >>= aUserData;
135
136 return aUserData;
137}
138
139namespace {
140
141struct ModuleToGroupNameMap_Impl
142{
143 std::u16string_view m_pModule;
144 OUString m_sGroupName;
145 sal_uInt16 m_nNodeId;
146};
147}
148
149static ModuleToGroupNameMap_Impl ModuleMap[] =
150{
151 { u"ProductName", OUString(), SID_GENERAL_OPTIONS },
152 { u"LanguageSettings", OUString(), SID_LANGUAGE_OPTIONS },
153 { u"Internet", OUString(), SID_INET_DLG },
154 { u"LoadSave", OUString(), SID_FILTER_DLG },
155 { u"Writer", OUString(), SID_SW_EDITOPTIONS },
156 { u"WriterWeb", OUString(), SID_SW_ONLINEOPTIONS },
157 { u"Math", OUString(), SID_SM_EDITOPTIONS },
158 { u"Calc", OUString(), SID_SC_EDITOPTIONS },
159 { u"Impress", OUString(), SID_SD_EDITOPTIONS },
160 { u"Draw", OUString(), SID_SD_GRAPHIC_OPTIONS },
161 { u"Charts", OUString(), SID_SCH_EDITOPTIONS },
162 { u"Base", OUString(), SID_SB_STARBASEOPTIONS },
163};
164
165static void setGroupName( std::u16string_view rModule, const OUString& rGroupName )
166{
167 for (ModuleToGroupNameMap_Impl& rEntry : ModuleMap)
168 {
169 if ( rEntry.m_pModule == rModule )
170 {
171 rEntry.m_sGroupName = rGroupName;
172 break;
173 }
174 }
175}
176
177static OUString getGroupName( std::u16string_view rModule, bool bForced )
178{
179 OUString sGroupName;
180 for (const ModuleToGroupNameMap_Impl& rEntry : ModuleMap)
181 {
182 if ( rEntry.m_pModule == rModule )
183 {
184 sGroupName = rEntry.m_sGroupName;
185 break;
186 }
187 }
188
189 if ( sGroupName.isEmpty() && bForced )
190 {
191 if ( rModule == u"Writer" )
192 sGroupName = CuiResId(SID_SW_EDITOPTIONS_RES[0].first);
193 else if ( rModule == u"WriterWeb" )
194 sGroupName = CuiResId(SID_SW_ONLINEOPTIONS_RES[0].first);
195 else if ( rModule == u"Calc" )
196 sGroupName = CuiResId(SID_SC_EDITOPTIONS_RES[0].first);
197 else if ( rModule == u"Impress" )
198 sGroupName = CuiResId(SID_SD_EDITOPTIONS_RES[0].first);
199 else if ( rModule == u"Draw" )
200 sGroupName = CuiResId(SID_SD_GRAPHIC_OPTIONS_RES[0].first);
201 else if ( rModule == u"Math" )
202 sGroupName = CuiResId(SID_SM_EDITOPTIONS_RES[0].first);
203 else if ( rModule == u"Base" )
204 sGroupName = CuiResId(SID_SB_STARBASEOPTIONS_RES[0].first);
205 }
206 return sGroupName;
207}
208
209static void deleteGroupNames()
210{
211 for (ModuleToGroupNameMap_Impl& rEntry : ModuleMap)
212 rEntry.m_sGroupName.clear();
213}
214
215static sal_uInt16 getGroupNodeId( std::u16string_view rModule )
216{
217 sal_uInt16 nNodeId = 0xFFFF;
218 for (const ModuleToGroupNameMap_Impl& rEntry : ModuleMap)
219 {
220 if ( rEntry.m_pModule == rModule )
221 {
222 nNodeId = rEntry.m_nNodeId;
223 break;
224 }
225 }
226
227 return nNodeId;
228}
229
230namespace {
231
232class MailMergeCfg_Impl : public utl::ConfigItem
233{
234private:
235 // variables
236 bool bIsEmailSupported;
237
238 virtual void ImplCommit() override;
239
240public:
241 MailMergeCfg_Impl();
242
243 virtual void Notify( const css::uno::Sequence< OUString >& _rPropertyNames) override;
244
245 bool IsEmailSupported() const {return bIsEmailSupported;}
246
247};
248
249}
250
251MailMergeCfg_Impl::MailMergeCfg_Impl() :
252 utl::ConfigItem("Office.Writer/MailMergeWizard"),
253 bIsEmailSupported(false)
254{
255 Sequence<OUString> aNames { "EMailSupported" };
256 const Sequence< Any > aValues = GetProperties(aNames);
257 const Any* pValues = aValues.getConstArray();
258 if(aValues.hasElements() && pValues[0].hasValue())
259 pValues[0] >>= bIsEmailSupported;
260}
261
262void MailMergeCfg_Impl::ImplCommit()
263{
264}
265
266void MailMergeCfg_Impl::Notify( const css::uno::Sequence< OUString >& )
267{
268}
269
270//typedef SfxTabPage* (*FNCreateTabPage)(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet &rAttrSet);
271static std::unique_ptr<SfxTabPage> CreateGeneralTabPage(sal_uInt16 nId, weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rSet)
272{
273 CreateTabPage fnCreate = nullptr;
274 switch(nId)
275 {
276 case RID_SFXPAGE_SAVE: fnCreate = &SvxSaveTabPage::Create; break;
277 case RID_SFXPAGE_PATH: fnCreate = &SvxPathTabPage::Create; break;
278 case RID_SFXPAGE_GENERAL: fnCreate = &SvxGeneralTabPage::Create; break;
280 case OFA_TP_LANGUAGES: fnCreate = &OfaLanguagesTabPage::Create; break;
281 case RID_SFXPAGE_LINGU: fnCreate = &SvxLinguTabPage::Create; break;
282 case OFA_TP_VIEW: fnCreate = &OfaViewTabPage::Create; break;
283 case OFA_TP_MISC: fnCreate = &OfaMiscTabPage::Create; break;
286 case RID_SVXPAGE_INET_PROXY: fnCreate = &SvxProxyTabPage::Create; break;
288 case RID_SVXPAGE_INET_MAIL: fnCreate = &SvxEMailTabPage::Create; break;
289#if HAVE_FEATURE_DESKTOP
291#endif
293 case RID_OFAPAGE_HTMLOPT: fnCreate = &OfaHtmlTabPage::Create; break;
294 case SID_OPTFILTER_MSOFFICE: fnCreate = &OfaMSFilterTabPage::Create; break;
297 case SID_SB_CONNECTIONPOOLING: fnCreate = &::offapp::ConnectionPoolOptionsPage::Create; break;
298 case SID_SB_DBREGISTEROPTIONS: fnCreate = &svx::DbRegistrationOptionsPage::Create; break;
300 case RID_SVXPAGE_OPTIONS_CTL: fnCreate = &SvxCTLOptionsPage::Create ; break;
302 case RID_SVXPAGE_DEEPL_OPTIONS: fnCreate = &OptDeeplTabPage::Create ; break;
304#if HAVE_FEATURE_OPENCL
305 case RID_SVXPAGE_OPENCL: fnCreate = &SvxOpenCLTabPage::Create ; break;
306#endif
309#if HAVE_FEATURE_SCRIPTING
311#endif
312 }
313
314 return fnCreate ? (*fnCreate)( pPage, pController, &rSet ) : nullptr;
315}
316
317namespace {
318
319struct OptionsMapping_Impl
320{
321 const char* m_pGroupName;
322 const char* m_pPageName;
323 sal_uInt16 m_nPageId;
324};
325
326}
327
328OptionsMapping_Impl const OptionsMap_Impl[] =
329{
330// GROUP PAGE PAGE-ID
331 { "ProductName", nullptr, SID_GENERAL_OPTIONS },
332 { "ProductName", "UserData", RID_SFXPAGE_GENERAL },
333 { "ProductName", "General", OFA_TP_MISC },
334 { "ProductName", "View", OFA_TP_VIEW },
335 { "ProductName", "Print", RID_SFXPAGE_PRINTOPTIONS },
336 { "ProductName", "Paths", RID_SFXPAGE_PATH },
337 { "ProductName", "Fonts", RID_SVX_FONT_SUBSTITUTION },
338 { "ProductName", "Security", RID_SVXPAGE_INET_SECURITY },
339 { "ProductName", "Personalization", RID_SVXPAGE_PERSONALIZATION },
340 { "ProductName", "Appearance", RID_SVXPAGE_COLORCONFIG },
341 { "ProductName", "Accessibility", RID_SVXPAGE_ACCESSIBILITYCONFIG },
342 { "ProductName", "Java", RID_SVXPAGE_OPTIONS_JAVA },
343 { "ProductName", "BasicIDEOptions", RID_SVXPAGE_BASICIDE_OPTIONS },
344 { "ProductName", "OnlineUpdate", RID_SVXPAGE_ONLINEUPDATE },
345 { "LanguageSettings", nullptr, SID_LANGUAGE_OPTIONS },
346 { "LanguageSettings", "Languages", OFA_TP_LANGUAGES },
347 { "LanguageSettings", "WritingAids", RID_SFXPAGE_LINGU },
348 { "LanguageSettings", "SearchingInJapanese", RID_SVXPAGE_JSEARCH_OPTIONS },
349 { "LanguageSettings", "AsianLayout", RID_SVXPAGE_ASIAN_LAYOUT },
350 { "LanguageSettings", "ComplexTextLayout", RID_SVXPAGE_OPTIONS_CTL },
351 { "Internet", nullptr, SID_INET_DLG },
352 { "Internet", "Proxy", RID_SVXPAGE_INET_PROXY },
353 { "Internet", "Email", RID_SVXPAGE_INET_MAIL },
354 { "LoadSave", nullptr, SID_FILTER_DLG },
355 { "LoadSave", "General", RID_SFXPAGE_SAVE },
356 { "LoadSave", "VBAProperties", SID_OPTFILTER_MSOFFICE },
357 { "LoadSave", "MicrosoftOffice", RID_OFAPAGE_MSFILTEROPT2 },
358 { "LoadSave", "HTMLCompatibility", RID_OFAPAGE_HTMLOPT },
359 { "Writer", nullptr, SID_SW_EDITOPTIONS },
360 { "Writer", "General", RID_SW_TP_OPTLOAD_PAGE },
361 { "Writer", "View", RID_SW_TP_CONTENT_OPT },
362 { "Writer", "FormattingAids", RID_SW_TP_OPTSHDWCRSR },
363 { "Writer", "Grid", RID_SVXPAGE_GRID },
364 { "Writer", "BasicFontsWestern", RID_SW_TP_STD_FONT },
365 { "Writer", "BasicFontsAsian", RID_SW_TP_STD_FONT_CJK },
366 { "Writer", "BasicFontsCTL", RID_SW_TP_STD_FONT_CTL },
367 { "Writer", "Print", RID_SW_TP_OPTPRINT_PAGE },
368 { "Writer", "Table", RID_SW_TP_OPTTABLE_PAGE },
369 { "Writer", "Changes", RID_SW_TP_REDLINE_OPT },
370 { "Writer", "Comparison", RID_SW_TP_COMPARISON_OPT },
371 { "Writer", "Compatibility", RID_SW_TP_OPTCOMPATIBILITY_PAGE },
372 { "Writer", "AutoCaption", RID_SW_TP_OPTCAPTION_PAGE },
373 { "Writer", "MailMerge", RID_SW_TP_MAILCONFIG },
374 { "WriterWeb", nullptr, SID_SW_ONLINEOPTIONS },
375 { "WriterWeb", "View", RID_SW_TP_HTML_CONTENT_OPT },
376 { "WriterWeb", "FormattingAids", RID_SW_TP_HTML_OPTSHDWCRSR },
377 { "WriterWeb", "Grid", RID_SW_TP_HTML_OPTGRID_PAGE },
378 { "WriterWeb", "Print", RID_SW_TP_HTML_OPTPRINT_PAGE },
379 { "WriterWeb", "Table", RID_SW_TP_HTML_OPTTABLE_PAGE },
380 { "WriterWeb", "Background", RID_SW_TP_BACKGROUND },
381 { "Math", nullptr, SID_SM_EDITOPTIONS },
382 { "Math", "Settings", SID_SM_TP_PRINTOPTIONS },
383 { "Calc", nullptr, SID_SC_EDITOPTIONS },
384 { "Calc", "General", SID_SC_TP_LAYOUT },
385 { "Calc", "View", SID_SC_TP_CONTENT },
386 { "Calc", "Calculate", SID_SC_TP_CALC },
387 { "Calc", "Formula", SID_SC_TP_FORMULA },
388 { "Calc", "SortLists", SID_SC_TP_USERLISTS },
389 { "Calc", "Changes", SID_SC_TP_CHANGES },
390 { "Calc", "Compatibility", SID_SC_TP_COMPATIBILITY },
391 { "Calc", "Grid", SID_SC_TP_GRID },
392 { "Calc", "Print", RID_SC_TP_PRINT },
393 { "Impress", nullptr, SID_SD_EDITOPTIONS },
394 { "Impress", "General", SID_SI_TP_MISC },
395 { "Impress", "View", SID_SI_TP_CONTENTS },
396 { "Impress", "Grid", SID_SI_TP_SNAP },
397 { "Impress", "Print", SID_SI_TP_PRINT },
398 { "Draw", nullptr, SID_SD_GRAPHIC_OPTIONS },
399 { "Draw", "General", SID_SD_TP_MISC },
400 { "Draw", "View", SID_SD_TP_CONTENTS },
401 { "Draw", "Grid", SID_SD_TP_SNAP },
402 { "Draw", "Print", SID_SD_TP_PRINT },
403 { "Charts", nullptr, SID_SCH_EDITOPTIONS },
404 { "Charts", "DefaultColors", RID_OPTPAGE_CHART_DEFCOLORS },
405 { "Base", nullptr, SID_SB_STARBASEOPTIONS },
406 { "Base", "Connections", SID_SB_CONNECTIONPOOLING },
407 { "Base", "Databases", SID_SB_DBREGISTEROPTIONS },
408 { nullptr, nullptr, 0 }
409};
410
411static bool lcl_getStringFromID( sal_uInt16 _nPageId, OUString& _rGroupName, OUString& _rPageName )
412{
413 bool bRet = false;
414
415 sal_uInt16 nIdx = 0;
416 while ( OptionsMap_Impl[nIdx].m_pGroupName != nullptr )
417 {
418 if ( _nPageId == OptionsMap_Impl[nIdx].m_nPageId )
419 {
420 bRet = true;
421 _rGroupName = OUString::createFromAscii( OptionsMap_Impl[nIdx].m_pGroupName );
422 if ( OptionsMap_Impl[nIdx].m_pPageName != nullptr )
423 _rPageName = OUString::createFromAscii( OptionsMap_Impl[nIdx].m_pPageName );
424 break;
425 }
426 ++nIdx;
427 }
428
429 return bRet;
430}
431
432static bool lcl_isOptionHidden( sal_uInt16 _nPageId, const SvtOptionsDialogOptions& _rOptOptions )
433{
434 bool bIsHidden = false;
435 OUString sGroupName, sPageName;
436 if ( lcl_getStringFromID( _nPageId, sGroupName, sPageName ) )
437 {
438 if ( sPageName.isEmpty() )
439 bIsHidden = _rOptOptions.IsGroupHidden( sGroupName );
440 else
441 bIsHidden = _rOptOptions.IsPageHidden( sPageName, sGroupName );
442 }
443 return bIsHidden;
444}
445
447{
448 std::unique_ptr<SfxTabPage> m_xPage;
449 sal_uInt16 m_nPageId;
450 OUString m_sPageURL;
451 OUString m_sEventHdl;
452 std::unique_ptr<ExtensionsTabPage> m_xExtPage;
453
454 explicit OptionsPageInfo( sal_uInt16 nId ) : m_nPageId( nId ) {}
455};
456
458{
459 std::optional<SfxItemSet> m_pInItemSet;
460 std::unique_ptr<SfxItemSet> m_pOutItemSet;
461 SfxShell* m_pShell; // used to create the page
462 SfxModule* m_pModule; // used to create the ItemSet
463 sal_uInt16 m_nDialogId; // Id of the former dialog
464
465 OptionsGroupInfo( SfxShell* pSh, SfxModule* pMod, sal_uInt16 nId ) :
466 m_pShell( pSh ),
467 m_pModule( pMod ), m_nDialogId( nId ) {}
468};
469
470#define INI_LIST() \
471 , m_pParent ( pParent )\
472 , sTitle ( m_xDialog->get_title() )\
473 , bForgetSelection ( false )\
474 , bIsFromExtensionManager( false ) \
475 , bIsForSetDocumentLanguage( false ) \
476 , bNeedsRestart ( false ) \
477 , eRestartReason( svtools::RESTART_REASON_NONE )
478
480{
481 xOkPB = m_xBuilder->weld_button("ok");
482 xApplyPB = m_xBuilder->weld_button("apply");
483 xBackPB = m_xBuilder->weld_button("revert");
484 xTreeLB = m_xBuilder->weld_tree_view("pages");
485 xTabBox = m_xBuilder->weld_container("box");
486 Size aSize(xTreeLB->get_approximate_digit_width() * 82, xTreeLB->get_height_rows(30));
487#if HAVE_FEATURE_GPGME
488 // tdf#115015: make enough space for crypto settings (approx. 14 text edits + padding)
489 aSize.setHeight((weld::GetMinimumEditHeight() + 6) * 14);
490#endif
491 xTabBox->set_size_request(aSize.Width(), aSize.Height());
492 xTreeLB->set_size_request(xTreeLB->get_approximate_digit_width() * 35, aSize.Height());
493}
494
495// Ctor() with Frame -----------------------------------------------------
496OfaTreeOptionsDialog::OfaTreeOptionsDialog(weld::Window* pParent, const Reference< XFrame >& _xFrame, bool bActivateLastSelection)
497 : SfxOkDialogController(pParent, "cui/ui/optionsdialog.ui", "OptionsDialog")
498 INI_LIST()
499{
500 InitWidgets();
501
503 Initialize( _xFrame );
505 if (bActivateLastSelection)
507
508 xTreeLB->set_accessible_name(m_xDialog->get_title());
509}
510
511// Ctor() with ExtensionId -----------------------------------------------
512OfaTreeOptionsDialog::OfaTreeOptionsDialog(weld::Window* pParent, std::u16string_view rExtensionId)
513 : SfxOkDialogController(pParent, "cui/ui/optionsdialog.ui", "OptionsDialog")
514 INI_LIST()
515{
516 InitWidgets();
517
518 bIsFromExtensionManager = ( !rExtensionId.empty() );
520 LoadExtensionOptions( rExtensionId );
522}
523
525{
526 xCurrentPageEntry.reset();
527
528 std::unique_ptr<weld::TreeIter> xEntry = xTreeLB->make_iterator();
529 bool bEntry = xTreeLB->get_iter_first(*xEntry);
530 // first children
531 while (bEntry)
532 {
533 // if Child (has parent), then OptionsPageInfo
534 if (xTreeLB->get_iter_depth(*xEntry))
535 {
536 OptionsPageInfo *pPageInfo = weld::fromId<OptionsPageInfo*>(xTreeLB->get_id(*xEntry));
537 if(pPageInfo->m_xPage)
538 {
539 pPageInfo->m_xPage->FillUserData();
540 OUString aPageData(pPageInfo->m_xPage->GetUserData());
541 if ( !aPageData.isEmpty() )
542 {
543 SvtViewOptions aTabPageOpt( EViewType::TabPage, OUString::number( pPageInfo->m_nPageId) );
544 SetViewOptUserItem( aTabPageOpt, aPageData );
545 }
546 pPageInfo->m_xPage.reset();
547 }
548
549 if (pPageInfo->m_nPageId == RID_SFXPAGE_LINGU)
550 {
551 // write personal dictionaries
552 Reference< XSearchableDictionaryList > xDicList( LinguMgr::GetDictionaryList() );
553 if (xDicList.is())
554 {
556 }
557 }
558
559 pPageInfo->m_xExtPage.reset();
560
561 delete pPageInfo;
562 }
563 bEntry = xTreeLB->iter_next(*xEntry);
564 }
565
566 // and parents
567 bEntry = xTreeLB->get_iter_first(*xEntry);
568 while (bEntry)
569 {
570 if (!xTreeLB->get_iter_depth(*xEntry))
571 {
572 OptionsGroupInfo* pGroupInfo = weld::fromId<OptionsGroupInfo*>(xTreeLB->get_id(*xEntry));
573 delete pGroupInfo;
574 }
575 bEntry = xTreeLB->iter_next(*xEntry);
576 }
578}
579
581 sal_uInt16 nId, const OUString& rPageName, sal_uInt16 nGroup )
582{
583 std::unique_ptr<weld::TreeIter> xParent = xTreeLB->make_iterator();
584 if (!xTreeLB->get_iter_first(*xParent))
585 return nullptr;
586 xTreeLB->iter_nth_sibling(*xParent, nGroup);
587
588 OptionsPageInfo* pPageInfo = new OptionsPageInfo( nId );
589 OUString sId(weld::toId(pPageInfo));
590 xTreeLB->insert(xParent.get(), -1, &rPageName, &sId, nullptr, nullptr, false, nullptr);
591 return pPageInfo;
592}
593
594// the ItemSet* is passed on to the dialog's ownership
595sal_uInt16 OfaTreeOptionsDialog::AddGroup(const OUString& rGroupName,
596 SfxShell* pCreateShell,
597 SfxModule* pCreateModule,
598 sal_uInt16 nDialogId )
599{
600 OptionsGroupInfo* pInfo =
601 new OptionsGroupInfo( pCreateShell, pCreateModule, nDialogId );
602 OUString sId(weld::toId(pInfo));
603 xTreeLB->append(sId, rGroupName);
604
605 sal_uInt16 nRet = 0;
606 std::unique_ptr<weld::TreeIter> xEntry = xTreeLB->make_iterator();
607 bool bEntry = xTreeLB->get_iter_first(*xEntry);
608 while (bEntry)
609 {
610 if (!xTreeLB->get_iter_depth(*xEntry))
611 nRet++;
612 bEntry = xTreeLB->iter_next(*xEntry);
613 }
614 return nRet - 1;
615}
616
618{
619 SelectHdl_Impl();
620}
621
623{
624 if (!(xCurrentPageEntry && xTreeLB->get_iter_depth(*xCurrentPageEntry)))
625 return;
626
627 OptionsPageInfo* pPageInfo = weld::fromId<OptionsPageInfo*>(xTreeLB->get_id(*xCurrentPageEntry));
628 if (pPageInfo->m_xPage)
629 {
630 std::unique_ptr<weld::TreeIter> xParent = xTreeLB->make_iterator(xCurrentPageEntry.get());
631 xTreeLB->iter_parent(*xParent);
632 OptionsGroupInfo* pGroupInfo =
633 weld::fromId<OptionsGroupInfo*>(xTreeLB->get_id(*xParent));
634 pPageInfo->m_xPage->Reset( &*pGroupInfo->m_pInItemSet );
635 }
636 else if ( pPageInfo->m_xExtPage )
637 pPageInfo->m_xExtPage->ResetPage();
638}
639
641{
642 ResetCurrentPageFromConfig();
643}
644
646{
647 std::unique_ptr<weld::TreeIter> xEntry = xTreeLB->make_iterator();
648 bool bEntry = xTreeLB->get_iter_first(*xEntry);
649 while (bEntry)
650 {
651 if (xTreeLB->get_iter_depth(*xEntry))
652 {
653 OptionsPageInfo* pPageInfo = weld::fromId<OptionsPageInfo*>(xTreeLB->get_id(*xEntry));
654 if ( pPageInfo->m_xPage && !pPageInfo->m_xPage->HasExchangeSupport() )
655 {
656 std::unique_ptr<weld::TreeIter> xParent = xTreeLB->make_iterator(xEntry.get());
657 xTreeLB->iter_parent(*xParent);
658 OptionsGroupInfo* pGroupInfo =
659 weld::fromId<OptionsGroupInfo*>(xTreeLB->get_id(*xParent));
660 pPageInfo->m_xPage->FillItemSet(pGroupInfo->m_pOutItemSet.get());
661 }
662
663 if ( pPageInfo->m_xExtPage )
664 {
665 pPageInfo->m_xExtPage->DeactivatePage();
666 pPageInfo->m_xExtPage->SavePage();
667 }
668 if ( pPageInfo->m_xPage && RID_OPTPAGE_CHART_DEFCOLORS == pPageInfo->m_nPageId )
669 {
670 SvxDefaultColorOptPage* pPage = static_cast<SvxDefaultColorOptPage *>(pPageInfo->m_xPage.get());
671 pPage->SaveChartOptions();
672 }
673 }
674 bEntry = xTreeLB->iter_next(*xEntry);
675 }
676}
677
679{
680 Help* pHelp = Application::GetHelp();
681 if (pHelp && xCurrentPageEntry && xTreeLB->get_iter_depth(*xCurrentPageEntry))
682 {
683 OptionsPageInfo* pPageInfo = weld::fromId<OptionsPageInfo*>(xTreeLB->get_id(*xCurrentPageEntry));
684 if (pPageInfo->m_xPage)
685 {
686 OString sHelpId(pPageInfo->m_xPage->GetHelpId());
687 pHelp->Start(OStringToOUString(sHelpId, RTL_TEXTENCODING_UTF8), m_xDialog.get());
688 return false;
689 }
690 }
691 return true;
692}
693
694IMPL_LINK(OfaTreeOptionsDialog, ApplyHdl_Impl, weld::Button&, rButton, void)
695{
696 bool bOkPressed = &rButton == xOkPB.get();
697
698 OptionsGroupInfo* pGroupInfo = nullptr;
699
700 if (xCurrentPageEntry && xTreeLB->get_iter_depth(*xCurrentPageEntry))
701 {
702 OptionsPageInfo* pPageInfo = weld::fromId<OptionsPageInfo*>(xTreeLB->get_id(*xCurrentPageEntry));
703 if ( pPageInfo->m_xPage )
704 {
705 std::unique_ptr<weld::TreeIter> xParent = xTreeLB->make_iterator(xCurrentPageEntry.get());
706 xTreeLB->iter_parent(*xParent);
707
708 pGroupInfo = weld::fromId<OptionsGroupInfo*>(xTreeLB->get_id(*xParent));
709 if ( RID_SVXPAGE_COLOR != pPageInfo->m_nPageId
710 && pPageInfo->m_xPage->HasExchangeSupport() )
711 {
712 DeactivateRC nLeave = pPageInfo->m_xPage->DeactivatePage(pGroupInfo->m_pOutItemSet.get());
713 if ( nLeave == DeactivateRC::KeepPage )
714 {
715 // the page mustn't be left, so return early
716 assert(xTreeLB->is_selected(*xCurrentPageEntry)); // presumably this must be true here
717 if (bOkPressed)
718 return;
719 }
720 }
721 }
722 }
723
724 ApplyOptions();
725 ApplyItemSets();
727
728 if (bOkPressed)
729 m_xDialog->response(RET_OK);
730 else
731 {
732 // tdf#137930 rebuild the in and out itemsets to reflect the current
733 // post-apply state
734 if (pGroupInfo && pGroupInfo->m_pInItemSet)
735 {
736 // tdf#138596 seeing as the SfxTabPages keep pointers to the m_pInItemSet
737 // we update the contents of the existing SfxItemSets to match
738 // the current settings, rather than create new ones
739 auto xInItemSet = pGroupInfo->m_pShell
740 ? pGroupInfo->m_pShell->CreateItemSet( pGroupInfo->m_nDialogId )
741 : CreateItemSet( pGroupInfo->m_nDialogId );
742 pGroupInfo->m_pInItemSet->Set(*xInItemSet, false);
743 pGroupInfo->m_pOutItemSet->ClearItem();
744 }
745
746 // for the Apply case, now that the settings are saved to config,
747 // reload the current page so it knows what the config now states
748 ResetCurrentPageFromConfig();
749 // reselect it to undo possible DeactivatePage above
750 xCurrentPageEntry.reset();
751 SelectHdl_Impl();
752 }
753
754 if (!bNeedsRestart)
755 return;
756
757 SolarMutexGuard aGuard;
758 weld::Window* pParent;
759 if (!bOkPressed)
760 pParent = m_xDialog.get();
761 else
762 {
763 m_xDialog->hide();
764 pParent = m_pParent;
765 }
766 bool bRestart = ::svtools::executeRestartDialog(comphelper::getProcessComponentContext(),
767 pParent, eRestartReason);
768 if (bRestart && !bOkPressed)
769 m_xDialog->response(RET_OK);
770}
771
773{
774 std::unique_ptr<weld::TreeIter> xEntry = xTreeLB->make_iterator();
775 bool bEntry = xTreeLB->get_iter_first(*xEntry);
776 while (bEntry)
777 {
778 if (!xTreeLB->get_iter_depth(*xEntry))
779 {
780 OptionsGroupInfo* pGroupInfo = weld::fromId<OptionsGroupInfo*>(xTreeLB->get_id(*xEntry));
781 if(pGroupInfo->m_pOutItemSet)
782 {
783 if(pGroupInfo->m_pShell)
784 pGroupInfo->m_pShell->ApplyItemSet( pGroupInfo->m_nDialogId, *pGroupInfo->m_pOutItemSet);
785 else
786 ApplyItemSet( pGroupInfo->m_nDialogId, *pGroupInfo->m_pOutItemSet);
787 }
788 }
789 bEntry = xTreeLB->iter_next(*xEntry);
790 }
791}
792
794{
795 xTreeLB->set_help_id(HID_OFADLG_TREELISTBOX);
796 xTreeLB->connect_changed( LINK( this, OfaTreeOptionsDialog, ShowPageHdl_Impl ) );
797 xBackPB->connect_clicked( LINK( this, OfaTreeOptionsDialog, BackHdl_Impl ) );
798 xApplyPB->connect_clicked( LINK( this, OfaTreeOptionsDialog, ApplyHdl_Impl ) );
799 xOkPB->connect_clicked( LINK( this, OfaTreeOptionsDialog, ApplyHdl_Impl ) );
800 m_xDialog->connect_help( LINK( this, OfaTreeOptionsDialog, HelpHdl_Impl ) );
801}
802
803void OfaTreeOptionsDialog::ActivatePage( sal_uInt16 nResId )
804{
807 {
809 nResId = OFA_TP_LANGUAGES;
810 }
811
812 DBG_ASSERT( !bIsFromExtensionManager, "OfaTreeOptionsDialog::ActivatePage(): call from extension manager" );
813 if ( !pLastPageSaver )
815 bForgetSelection = true;
816 sal_uInt16 nTemp = pLastPageSaver->m_nLastPageId;
820}
821
822void OfaTreeOptionsDialog::ActivatePage( const OUString& rPageURL )
823{
824 DBG_ASSERT( !bIsFromExtensionManager, "OfaTreeOptionsDialog::ActivatePage(): call from extension manager" );
825 if ( !pLastPageSaver )
827 bForgetSelection = true;
831}
832
834{
835 std::unique_ptr<weld::TreeIter> xEntry;
836
837 if (pLastPageSaver)
838 {
841 if ( sLastURL.isEmpty() )
842 {
845 }
846
847 bool bMustExpand = ( INetURLObject( sLastURL ).GetProtocol() == INetProtocol::File );
848
849 std::unique_ptr<weld::TreeIter> xTemp = xTreeLB->make_iterator();
850 bool bTemp = xTreeLB->get_iter_first(*xTemp);
851 while (bTemp)
852 {
853 // restore only selection of a leaf
854 if (xTreeLB->get_iter_depth(*xTemp) && xTreeLB->get_id(*xTemp).toInt64())
855 {
856 OptionsPageInfo* pPageInfo = weld::fromId<OptionsPageInfo*>(xTreeLB->get_id(*xTemp));
857 OUString sPageURL = pPageInfo->m_sPageURL;
858 if ( bMustExpand )
859 {
862 }
863
865 && pPageInfo->m_nPageId && pPageInfo->m_nPageId == pLastPageSaver->m_nLastPageId )
866 || ( !pPageInfo->m_nPageId && sLastURL == sPageURL ) )
867 {
868 xEntry = xTreeLB->make_iterator(xTemp.get());
869 break;
870 }
871 }
872 bTemp = xTreeLB->iter_next(*xTemp);
873 }
874 }
875
876 if (!xEntry)
877 {
878 xEntry = xTreeLB->make_iterator();
879 if (!xTreeLB->get_iter_first(*xEntry) || !xTreeLB->iter_next(*xEntry))
880 xEntry.reset();
881 }
882
883 if (!xEntry)
884 return;
885
886 std::unique_ptr<weld::TreeIter> xParent(xTreeLB->make_iterator(xEntry.get()));
887 xTreeLB->iter_parent(*xParent);
888 xTreeLB->expand_row(*xParent);
889 xTreeLB->scroll_to_row(*xParent);
890 xTreeLB->scroll_to_row(*xEntry);
891 xTreeLB->set_cursor(*xEntry);
892 xTreeLB->select(*xEntry);
893 xTreeLB->grab_focus();
895}
896
898{
899 if (!rGroupInfo.m_pInItemSet)
900 rGroupInfo.m_pInItemSet.emplace( rGroupInfo.m_pShell
901 ? *rGroupInfo.m_pShell->CreateItemSet( rGroupInfo.m_nDialogId )
902 : *CreateItemSet( rGroupInfo.m_nDialogId ) );
903 if (!rGroupInfo.m_pOutItemSet)
904 rGroupInfo.m_pOutItemSet = std::make_unique<SfxItemSet>(
905 *rGroupInfo.m_pInItemSet->GetPool(),
906 rGroupInfo.m_pInItemSet->GetRanges());
907}
908
910{
911 std::unique_ptr<weld::TreeIter> xEntry(xTreeLB->make_iterator());
912
913 if (!xTreeLB->get_cursor(xEntry.get()))
914 return;
915
916 if (xCurrentPageEntry && xCurrentPageEntry->equal(*xEntry))
917 return;
918
919 std::unique_ptr<weld::TreeIter> xParent(xTreeLB->make_iterator(xEntry.get()));
920 bool bParent = xTreeLB->iter_parent(*xParent);
921
922 // If the user has selected a category, automatically switch to a suitable
923 // default sub-page instead.
924 if (!bParent)
925 return;
926
927 BuilderPage* pNewPage = nullptr;
928 OptionsPageInfo* pOptPageInfo = (xCurrentPageEntry && xTreeLB->get_iter_depth(*xCurrentPageEntry))
929 ? weld::fromId<OptionsPageInfo*>(xTreeLB->get_id(*xCurrentPageEntry)) : nullptr;
930
931 if (pOptPageInfo && pOptPageInfo->m_xPage && pOptPageInfo->m_xPage->IsVisible())
932 {
933 std::unique_ptr<weld::TreeIter> xCurParent(xTreeLB->make_iterator(xCurrentPageEntry.get()));
934 xTreeLB->iter_parent(*xCurParent);
935
936 OptionsGroupInfo* pGroupInfo = weld::fromId<OptionsGroupInfo*>(xTreeLB->get_id(*xCurParent));
937 DeactivateRC nLeave = DeactivateRC::LeavePage;
938 if ( RID_SVXPAGE_COLOR != pOptPageInfo->m_nPageId && pOptPageInfo->m_xPage->HasExchangeSupport() )
939 nLeave = pOptPageInfo->m_xPage->DeactivatePage( pGroupInfo->m_pOutItemSet.get() );
940
941 if ( nLeave == DeactivateRC::KeepPage )
942 {
943 // we cannot leave this page, this is may be from a user clicking a different entry
944 // in the tree so reselect the current page
945 xTreeLB->select(*xCurrentPageEntry);
946 return;
947 }
948 else
949 pOptPageInfo->m_xPage->set_visible(false);
950 }
951 else if ( pOptPageInfo && pOptPageInfo->m_xExtPage )
952 {
953 pOptPageInfo->m_xExtPage->Hide();
954 pOptPageInfo->m_xExtPage->DeactivatePage();
955 }
956
957 OptionsPageInfo *pPageInfo = weld::fromId<OptionsPageInfo*>(xTreeLB->get_id(*xEntry));
958 OptionsGroupInfo* pGroupInfo = weld::fromId<OptionsGroupInfo*>(xTreeLB->get_id(*xParent));
959 if(!pPageInfo->m_xPage && pPageInfo->m_nPageId > 0)
960 {
961 InitItemSets(*pGroupInfo);
962
963 pPageInfo->m_xPage = ::CreateGeneralTabPage(pPageInfo->m_nPageId, xTabBox.get(), this, *pGroupInfo->m_pInItemSet);
964
965 if(!pPageInfo->m_xPage && pGroupInfo->m_pModule)
966 pPageInfo->m_xPage = pGroupInfo->m_pModule->CreateTabPage(pPageInfo->m_nPageId, xTabBox.get(), this, *pGroupInfo->m_pInItemSet);
967
968 DBG_ASSERT( pPageInfo->m_xPage, "tabpage could not created");
969 if ( pPageInfo->m_xPage )
970 {
971 SvtViewOptions aTabPageOpt( EViewType::TabPage, OUString::number( pPageInfo->m_nPageId) );
972 pPageInfo->m_xPage->SetUserData( GetViewOptUserItem( aTabPageOpt ) );
973 pPageInfo->m_xPage->Reset( &*pGroupInfo->m_pInItemSet );
974 }
975 }
976 else if ( 0 == pPageInfo->m_nPageId && !pPageInfo->m_xExtPage )
977 {
978 if ( !m_xContainerWinProvider.is() )
979 {
980 m_xContainerWinProvider = awt::ContainerWindowProvider::create( ::comphelper::getProcessComponentContext() );
981 }
982
983 pPageInfo->m_xExtPage = std::make_unique<ExtensionsTabPage>(
984 xTabBox.get(), pPageInfo->m_sPageURL, pPageInfo->m_sEventHdl, m_xContainerWinProvider);
985 }
986
987 if ( pPageInfo->m_xPage )
988 {
989 if ( RID_SVXPAGE_COLOR != pPageInfo->m_nPageId &&
990 pPageInfo->m_xPage->HasExchangeSupport())
991 {
992 pPageInfo->m_xPage->ActivatePage(*pGroupInfo->m_pOutItemSet);
993 }
994 pPageInfo->m_xPage->set_visible(true);
995 }
996 else if ( pPageInfo->m_xExtPage )
997 {
998 pPageInfo->m_xExtPage->Show();
999 pPageInfo->m_xExtPage->ActivatePage();
1000 }
1001
1002 {
1003 OUString sTitleText = sTitle
1004 + " - " + xTreeLB->get_text(*xParent)
1005 + " - " + xTreeLB->get_text(*xEntry);
1006 m_xDialog->set_title(sTitleText);
1007 }
1008
1009 xCurrentPageEntry = std::move(xEntry);
1010
1011 if ( !bForgetSelection )
1012 {
1013 if ( !pLastPageSaver )
1017 if ( pPageInfo->m_xExtPage )
1018 {
1021 else
1023 }
1024 }
1025 pNewPage = pPageInfo->m_xPage.get();
1026
1027 // fdo#58170 use current page's layout child HelpId, unless there isn't a current page
1028 OString sHelpId(pNewPage ? pNewPage->GetHelpId() : OString());
1029 if (sHelpId.isEmpty())
1030 sHelpId = HID_OFADLG_TREELISTBOX;
1031 xTreeLB->set_help_id(sHelpId);
1032}
1033
1034std::optional<SfxItemSet> OfaTreeOptionsDialog::CreateItemSet( sal_uInt16 nId )
1035{
1036 Reference< XLinguProperties > xProp( LinguMgr::GetLinguPropertySet() );
1037 std::optional<SfxItemSet> pRet;
1038 switch(nId)
1039 {
1040 case SID_GENERAL_OPTIONS:
1041 {
1042 pRet.emplace(
1043 SfxGetpApp()->GetPool(),
1044 svl::Items<
1045 SID_HTML_MODE, SID_HTML_MODE,
1046 SID_ATTR_METRIC, SID_ATTR_METRIC,
1047 SID_AUTOSPELL_CHECK, SID_AUTOSPELL_CHECK,
1048 SID_ATTR_QUICKLAUNCHER, SID_ATTR_QUICKLAUNCHER,
1049 SID_ATTR_YEAR2000, SID_ATTR_YEAR2000> );
1050
1053 pRet->Put(aOptSet);
1054
1055 SfxViewFrame* pViewFrame = SfxViewFrame::Current();
1056 if ( pViewFrame )
1057 {
1058 const SfxUInt16Item* pItem = nullptr;
1059 SfxDispatcher* pDispatch = pViewFrame->GetDispatcher();
1060
1061 // miscellaneous - Year2000
1062 if( SfxItemState::DEFAULT <= pDispatch->QueryState( SID_ATTR_YEAR2000, pItem ) )
1063 pRet->Put( SfxUInt16Item( SID_ATTR_YEAR2000, pItem->GetValue() ) );
1064 else
1065 pRet->Put( SfxUInt16Item( SID_ATTR_YEAR2000, officecfg::Office::Common::DateFormat::TwoDigitYear::get() ) );
1066 }
1067 else
1068 pRet->Put( SfxUInt16Item( SID_ATTR_YEAR2000, officecfg::Office::Common::DateFormat::TwoDigitYear::get() ) );
1069
1070
1071 // miscellaneous - Tabulator
1072 pRet->Put(SfxBoolItem(SID_PRINTER_NOTFOUND_WARN, officecfg::Office::Common::Print::Warning::NotFound::get()));
1073
1074 SfxPrinterChangeFlags nFlag = officecfg::Office::Common::Print::Warning::PaperSize::get() ? SfxPrinterChangeFlags::CHG_SIZE : SfxPrinterChangeFlags::NONE;
1075 nFlag |= officecfg::Office::Common::Print::Warning::PaperOrientation::get() ? SfxPrinterChangeFlags::CHG_ORIENTATION : SfxPrinterChangeFlags::NONE;
1076 pRet->Put( SfxFlagItem( SID_PRINTER_CHANGESTODOC, static_cast<int>(nFlag) ));
1077
1078 }
1079 break;
1080 case SID_LANGUAGE_OPTIONS :
1081 {
1082 pRet.emplace(
1083 SfxGetpApp()->GetPool(),
1084 svl::Items<
1085 SID_ATTR_CHAR_CJK_LANGUAGE, SID_ATTR_CHAR_CJK_LANGUAGE,
1086 SID_ATTR_CHAR_CTL_LANGUAGE, SID_ATTR_CHAR_CTL_LANGUAGE,
1087 SID_SET_DOCUMENT_LANGUAGE, SID_SET_DOCUMENT_LANGUAGE,
1088 SID_ATTR_LANGUAGE, SID_ATTR_LANGUAGE,
1089 SID_AUTOSPELL_CHECK, SID_AUTOSPELL_CHECK,
1090 SID_OPT_LOCALE_CHANGED, SID_OPT_LOCALE_CHANGED>);
1091
1092 // for linguistic
1093 SfxHyphenRegionItem aHyphen( SID_ATTR_HYPHENREGION );
1094
1095 sal_Int16 nMinLead = 2,
1096 nMinTrail = 2;
1097 if (xProp.is())
1098 {
1099 nMinLead = xProp->getHyphMinLeading();
1100 nMinTrail = xProp->getHyphMinTrailing();
1101 }
1102 aHyphen.GetMinLead() = static_cast<sal_uInt8>(nMinLead);
1103 aHyphen.GetMinTrail() = static_cast<sal_uInt8>(nMinTrail);
1104
1105 SfxViewFrame* pViewFrame = SfxViewFrame::Current();
1106 if ( pViewFrame )
1107 {
1108 const SvxLanguageItem* pLangItem = nullptr;
1109 SfxDispatcher* pDispatch = pViewFrame->GetDispatcher();
1110 if(SfxItemState::DEFAULT <= pDispatch->QueryState(SID_ATTR_LANGUAGE, pLangItem))
1111 pRet->Put(*pLangItem, SID_ATTR_LANGUAGE);
1112 if(SfxItemState::DEFAULT <= pDispatch->QueryState(SID_ATTR_CHAR_CJK_LANGUAGE, pLangItem))
1113 pRet->Put(*pLangItem, SID_ATTR_CHAR_CJK_LANGUAGE);
1114 if(SfxItemState::DEFAULT <= pDispatch->QueryState(SID_ATTR_CHAR_CTL_LANGUAGE, pLangItem))
1115 pRet->Put(*pLangItem, SID_ATTR_CHAR_CTL_LANGUAGE);
1116
1117 pRet->Put(aHyphen);
1118 const SfxPoolItem* pItem = nullptr;
1119 if(SfxItemState::DEFAULT <= pDispatch->QueryState(SID_AUTOSPELL_CHECK, pItem))
1120 {
1121 pRet->Put(std::unique_ptr<SfxPoolItem>(pItem->Clone()));
1122 }
1123 else
1124 {
1125 bool bVal = false;
1126 if (xProp.is())
1127 {
1128 bVal = xProp->getIsSpellAuto();
1129 }
1130
1131 pRet->Put(SfxBoolItem(SID_AUTOSPELL_CHECK, bVal));
1132 }
1133 }
1134 pRet->Put( SfxBoolItem( SID_SET_DOCUMENT_LANGUAGE, bIsForSetDocumentLanguage ) );
1135 }
1136 break;
1137 case SID_INET_DLG :
1138 pRet.emplace( SfxGetpApp()->GetPool(),
1139 svl::Items<
1140 //SID_OPTIONS_START - ..END
1141 SID_SAVEREL_INET, SID_SAVEREL_FSYS,
1142 SID_INET_NOPROXY, SID_INET_FTP_PROXY_PORT,
1143 SID_SECURE_URL, SID_SECURE_URL> );
1145 break;
1146 case SID_FILTER_DLG:
1147 pRet.emplace(
1148 SfxGetpApp()->GetPool(),
1149 svl::Items<
1150 SID_ATTR_WARNALIENFORMAT, SID_ATTR_WARNALIENFORMAT,
1151 SID_ATTR_DOCINFO, SID_ATTR_AUTOSAVEMINUTE,
1152 SID_SAVEREL_INET, SID_SAVEREL_FSYS,
1153 SID_ATTR_PRETTYPRINTING, SID_ATTR_PRETTYPRINTING> );
1155 break;
1156
1157 case SID_SB_STARBASEOPTIONS:
1158 pRet.emplace( SfxGetpApp()->GetPool(),
1159 svl::Items<SID_SB_POOLING_ENABLED, SID_SB_DB_REGISTER> );
1162 break;
1163
1164 case SID_SCH_EDITOPTIONS:
1165 {
1166 SvxChartOptions aChartOpt;
1167 pRet.emplace( SfxGetpApp()->GetPool(), svl::Items<SID_SCH_EDITOPTIONS, SID_SCH_EDITOPTIONS> );
1168 pRet->Put( SvxChartColorTableItem( SID_SCH_EDITOPTIONS, aChartOpt.GetDefaultColors() ) );
1169 break;
1170 }
1171 }
1172 return pRet;
1173}
1174
1175void OfaTreeOptionsDialog::ApplyItemSet( sal_uInt16 nId, const SfxItemSet& rSet )
1176{
1177 switch(nId)
1178 {
1179 case SID_GENERAL_OPTIONS:
1180 {
1181 std::shared_ptr<comphelper::ConfigurationChanges> batch(comphelper::ConfigurationChanges::create());
1182
1184 aOptSet.Put(rSet);
1185 if(aOptSet.Count())
1186 SfxGetpApp()->SetOptions( aOptSet );
1187 // get dispatcher anew, because SetOptions() might have destroyed the dispatcher
1188 SfxViewFrame *pViewFrame = SfxViewFrame::Current();
1189
1190// evaluate Year2000
1191 sal_uInt16 nY2K = USHRT_MAX;
1192 const SfxUInt16Item* pYearItem = rSet.GetItemIfSet( SID_ATTR_YEAR2000, false );
1193 if( pYearItem )
1194 nY2K = pYearItem->GetValue();
1195 if( USHRT_MAX != nY2K )
1196 {
1197 if ( pViewFrame )
1198 {
1199 SfxDispatcher* pDispatch = pViewFrame->GetDispatcher();
1200 pDispatch->ExecuteList(SID_ATTR_YEAR2000,
1201 SfxCallMode::ASYNCHRON, { pYearItem });
1202 }
1203 officecfg::Office::Common::DateFormat::TwoDigitYear::set(nY2K, batch);
1204 }
1205
1206// evaluate print
1207 if(const SfxBoolItem* pWarnItem = rSet.GetItemIfSet(SID_PRINTER_NOTFOUND_WARN, false))
1208 officecfg::Office::Common::Print::Warning::NotFound::set(pWarnItem->GetValue(), batch);
1209
1210 if(const SfxFlagItem* pFlag = rSet.GetItemIfSet(SID_PRINTER_CHANGESTODOC, false))
1211 {
1212 bool bPaperSizeWarning = bool(static_cast<SfxPrinterChangeFlags>(pFlag->GetValue()) & SfxPrinterChangeFlags::CHG_SIZE);
1213 officecfg::Office::Common::Print::Warning::PaperSize::set(bPaperSizeWarning, batch);
1214 bool bPaperOrientationWarning = bool(static_cast<SfxPrinterChangeFlags>(pFlag->GetValue()) & SfxPrinterChangeFlags::CHG_ORIENTATION);
1215 officecfg::Office::Common::Print::Warning::PaperOrientation::set(bPaperOrientationWarning, batch);
1216 }
1217
1218// evaluate help options
1219 bool bHelpTips = officecfg::Office::Common::Help::Tip::get();
1220 if ( bHelpTips != Help::IsQuickHelpEnabled() )
1222 bool bExtendedHelp = officecfg::Office::Common::Help::ExtendedTip::get();
1223 if ( bExtendedHelp != Help::IsBalloonHelpEnabled() )
1225
1226 batch->commit();
1227 }
1228 break;
1229 case SID_LANGUAGE_OPTIONS :
1230 {
1232 }
1233 break;
1234 case SID_INET_DLG :
1235 case SID_FILTER_DLG:
1237 break;
1238
1239 case SID_SB_STARBASEOPTIONS:
1242 break;
1243
1244 case SID_SCH_EDITOPTIONS:
1245 // nothing to do. Chart options only apply to newly created charts
1246 break;
1247
1248 default:
1249 {
1250 OSL_FAIL( "Unhandled option in ApplyItemSet" );
1251 }
1252 break;
1253 }
1254
1255}
1257{
1258 bool bSaveSpellCheck = false;
1259 const SfxPoolItem* pItem = nullptr;
1260
1261 Reference< XComponentContext > xContext( ::comphelper::getProcessComponentContext() );
1262 Reference< XLinguProperties > xProp = LinguProperties::create( xContext );
1263 if ( const SfxHyphenRegionItem* pHyphenItem = rSet.GetItemIfSet(SID_ATTR_HYPHENREGION, false ) )
1264 {
1265 xProp->setHyphMinLeading( static_cast<sal_Int16>(pHyphenItem->GetMinLead()) );
1266 xProp->setHyphMinTrailing( static_cast<sal_Int16>(pHyphenItem->GetMinTrail()) );
1267 bSaveSpellCheck = true;
1268 }
1269
1270 SfxViewFrame *pViewFrame = SfxViewFrame::Current();
1271 if ( pViewFrame )
1272 {
1273 SfxDispatcher* pDispatch = pViewFrame->GetDispatcher();
1274 pItem = nullptr;
1275 if(SfxItemState::SET == rSet.GetItemState( SID_ATTR_LANGUAGE, false, &pItem ))
1276 {
1277 pDispatch->ExecuteList(pItem->Which(), SfxCallMode::SYNCHRON, { pItem });
1278 bSaveSpellCheck = true;
1279 }
1280 if(SfxItemState::SET == rSet.GetItemState( SID_ATTR_CHAR_CTL_LANGUAGE, false, &pItem ))
1281 {
1282 pDispatch->ExecuteList(pItem->Which(), SfxCallMode::SYNCHRON, { pItem });
1283 bSaveSpellCheck = true;
1284 }
1285 if(SfxItemState::SET == rSet.GetItemState( SID_ATTR_CHAR_CJK_LANGUAGE, false, &pItem ))
1286 {
1287 pDispatch->ExecuteList(pItem->Which(), SfxCallMode::SYNCHRON, { pItem });
1288 bSaveSpellCheck = true;
1289 }
1290
1291 if( SfxItemState::SET == rSet.GetItemState(SID_AUTOSPELL_CHECK, false, &pItem ))
1292 {
1293 bool bOnlineSpelling = static_cast<const SfxBoolItem*>(pItem)->GetValue();
1294 pDispatch->ExecuteList(SID_AUTOSPELL_CHECK,
1295 SfxCallMode::ASYNCHRON|SfxCallMode::RECORD, { pItem });
1296
1297 xProp->setIsSpellAuto( bOnlineSpelling );
1298 }
1299
1300 if( bSaveSpellCheck )
1301 {
1304 pDispatch->Execute(SID_SPELLCHECKER_CHANGED, SfxCallMode::ASYNCHRON);
1305 }
1306 }
1307
1308 if( SfxItemState::SET == rSet.GetItemState(SID_OPT_LOCALE_CHANGED, false, &pItem ))
1309 {
1310 SfxViewFrame* _pViewFrame = SfxViewFrame::GetFirst();
1311 while ( _pViewFrame )
1312 {
1313 _pViewFrame->GetDispatcher()->ExecuteList(pItem->Which(),
1314 SfxCallMode::ASYNCHRON, { pItem });
1315 _pViewFrame = SfxViewFrame::GetNext( *_pViewFrame );
1316 }
1317 }
1318}
1319
1320static OUString getCurrentFactory_Impl( const Reference< XFrame >& _xFrame )
1321{
1322 OUString sIdentifier;
1323 Reference < XFrame > xCurrentFrame( _xFrame );
1324 Reference < XModuleManager2 > xModuleManager = ModuleManager::create(::comphelper::getProcessComponentContext());
1325 if ( !xCurrentFrame.is() )
1326 {
1327 Reference< XDesktop2 > xDesktop = Desktop::create( ::comphelper::getProcessComponentContext() );
1328 xCurrentFrame = xDesktop->getCurrentFrame();
1329 }
1330
1331 if ( xCurrentFrame.is() )
1332 {
1333 try
1334 {
1335 sIdentifier = xModuleManager->identify( xCurrentFrame );
1336 }
1337 catch ( css::frame::UnknownModuleException& )
1338 {
1339 SAL_INFO( "cui.options", "unknown module" );
1340 }
1341 catch ( Exception const & )
1342 {
1343 TOOLS_WARN_EXCEPTION( "cui.options", "getActiveModule_Impl(): exception of XModuleManager::identify()" );
1344 }
1345 }
1346
1347 return sIdentifier;
1348}
1349
1350void OfaTreeOptionsDialog::Initialize( const Reference< XFrame >& _xFrame )
1351{
1352 sal_uInt16 nGroup = 0;
1353
1354 SvtOptionsDialogOptions aOptionsDlgOpt;
1355 sal_uInt16 nPageId;
1356
1357 // %PRODUCTNAME options
1358 if ( !lcl_isOptionHidden( SID_GENERAL_OPTIONS, aOptionsDlgOpt ) )
1359 {
1360 setGroupName(u"ProductName", CuiResId(SID_GENERAL_OPTIONS_RES[0].first));
1361 nGroup = AddGroup(CuiResId(SID_GENERAL_OPTIONS_RES[0].first), nullptr, nullptr, SID_GENERAL_OPTIONS );
1362 const sal_uInt16 nEnd = static_cast<sal_uInt16>(std::size(SID_GENERAL_OPTIONS_RES));
1363
1364 for (sal_uInt16 i = 1; i < nEnd; ++i)
1365 {
1366 OUString sNewTitle = CuiResId(SID_GENERAL_OPTIONS_RES[i].first);
1367 nPageId = SID_GENERAL_OPTIONS_RES[i].second;
1368 if ( lcl_isOptionHidden( nPageId, aOptionsDlgOpt ) )
1369 continue;
1370
1371 // Disable Online Update page if service not installed
1373 {
1374 try
1375 {
1376 Reference < XInterface > xService( setup::UpdateCheck::create( ::comphelper::getProcessComponentContext() ) );
1377 if( ! xService.is() )
1378 continue;
1379 }
1380 catch ( css::uno::DeploymentException& )
1381 {
1382 continue;
1383 }
1384 }
1385
1386 // Disable Basic IDE options, if experimental features are not enabled
1388 {
1389 if( ! officecfg::Office::Common::Misc::ExperimentalMode::get() )
1390 continue;
1391 }
1392
1393 AddTabPage( nPageId, sNewTitle, nGroup );
1394 }
1395 }
1396
1397 // Load and Save options
1398 if ( !lcl_isOptionHidden( SID_FILTER_DLG, aOptionsDlgOpt ) )
1399 {
1400 setGroupName( u"LoadSave", CuiResId(SID_FILTER_DLG_RES[0].first) );
1401 nGroup = AddGroup( CuiResId(SID_FILTER_DLG_RES[0].first), nullptr, nullptr, SID_FILTER_DLG );
1402 for ( size_t i = 1; i < std::size(SID_FILTER_DLG_RES); ++i )
1403 {
1404 nPageId = static_cast<sal_uInt16>(SID_FILTER_DLG_RES[i].second);
1405 if ( !lcl_isOptionHidden( nPageId, aOptionsDlgOpt ) )
1406 AddTabPage( nPageId, CuiResId(SID_FILTER_DLG_RES[i].first), nGroup );
1407 }
1408 }
1409
1410 // Language options
1411 SvtCTLOptions aCTLLanguageOptions;
1412 if ( !lcl_isOptionHidden( SID_LANGUAGE_OPTIONS, aOptionsDlgOpt ) )
1413 {
1414 setGroupName(u"LanguageSettings", CuiResId(SID_LANGUAGE_OPTIONS_RES[0].first));
1415 nGroup = AddGroup(CuiResId(SID_LANGUAGE_OPTIONS_RES[0].first), nullptr, nullptr, SID_LANGUAGE_OPTIONS );
1416 for (size_t i = 1; i < std::size(SID_LANGUAGE_OPTIONS_RES); ++i)
1417 {
1418 nPageId = static_cast<sal_uInt16>(SID_LANGUAGE_OPTIONS_RES[i].second);
1419 if ( lcl_isOptionHidden( nPageId, aOptionsDlgOpt ) )
1420 continue;
1421
1422 // Disable DeepL translation settings, if experimental mode is not enabled
1424 {
1425 if( ! officecfg::Office::Common::Misc::ExperimentalMode::get() )
1426 continue;
1427 }
1428
1431 ( RID_SVXPAGE_OPTIONS_CTL != nPageId || aCTLLanguageOptions.IsCTLFontEnabled() ) )
1432 AddTabPage(nPageId, CuiResId(SID_LANGUAGE_OPTIONS_RES[i].first), nGroup);
1433 }
1434 }
1435
1436 OUString aFactory = getCurrentFactory_Impl( _xFrame );
1437 DBG_ASSERT( GetModuleIdentifier( _xFrame ) == aFactory, "S H I T!!!" );
1438
1439 // Writer and Writer/Web options
1440 SvtModuleOptions aModuleOpt;
1442 {
1443 // text document
1444 if ( aFactory == "com.sun.star.text.TextDocument"
1445 || aFactory == "com.sun.star.text.WebDocument"
1446 || aFactory == "com.sun.star.text.GlobalDocument" )
1447 {
1448 SfxModule* pSwMod = SfxApplication::GetModule(SfxToolsModule::Writer);
1449 if ( !lcl_isOptionHidden( SID_SW_EDITOPTIONS, aOptionsDlgOpt ) )
1450 {
1451 if ( aFactory == "com.sun.star.text.WebDocument" )
1452 setGroupName( u"WriterWeb", CuiResId(SID_SW_EDITOPTIONS_RES[0].first) );
1453 else
1454 setGroupName( u"Writer", CuiResId(SID_SW_EDITOPTIONS_RES[0].first) );
1455 nGroup = AddGroup(CuiResId(SID_SW_EDITOPTIONS_RES[0].first), pSwMod, pSwMod, SID_SW_EDITOPTIONS );
1456 for ( size_t i = 1; i < std::size(SID_SW_EDITOPTIONS_RES); ++i )
1457 {
1458 nPageId = static_cast<sal_uInt16>(SID_SW_EDITOPTIONS_RES[i].second);
1459 if ( lcl_isOptionHidden( nPageId, aOptionsDlgOpt ) )
1460 continue;
1461 if ( ( RID_SW_TP_STD_FONT_CJK != nPageId || SvtCJKOptions::IsCJKFontEnabled() ) &&
1462 ( RID_SW_TP_STD_FONT_CTL != nPageId || aCTLLanguageOptions.IsCTLFontEnabled() ) &&
1463 ( RID_SW_TP_MAILCONFIG != nPageId || MailMergeCfg_Impl().IsEmailSupported() ) )
1464 AddTabPage( nPageId, CuiResId(SID_SW_EDITOPTIONS_RES[i].first), nGroup );
1465 }
1466#ifdef DBG_UTIL
1467 AddTabPage( RID_SW_TP_OPTTEST_PAGE, "Internal Test", nGroup );
1468#endif
1469 }
1470
1471 // HTML documents
1472 if ( !lcl_isOptionHidden( SID_SW_ONLINEOPTIONS, aOptionsDlgOpt ) )
1473 {
1474 nGroup = AddGroup(CuiResId(SID_SW_ONLINEOPTIONS_RES[0].first), pSwMod, pSwMod, SID_SW_ONLINEOPTIONS );
1475 for( size_t i = 1; i < std::size(SID_SW_ONLINEOPTIONS_RES); ++i )
1476 {
1477 nPageId = static_cast<sal_uInt16>(SID_SW_ONLINEOPTIONS_RES[i].second);
1478 if ( !lcl_isOptionHidden( nPageId, aOptionsDlgOpt ) )
1479 AddTabPage(nPageId, CuiResId(SID_SW_ONLINEOPTIONS_RES[i].first), nGroup);
1480 }
1481#ifdef DBG_UTIL
1482 AddTabPage( RID_SW_TP_OPTTEST_PAGE, "Internal Test", nGroup );
1483#endif
1484 }
1485 }
1486 }
1487
1488 // Calc options
1490 {
1491 if ( aFactory == "com.sun.star.sheet.SpreadsheetDocument" )
1492 {
1493 if ( !lcl_isOptionHidden( SID_SC_EDITOPTIONS, aOptionsDlgOpt ) )
1494 {
1495 SfxModule* pScMod = SfxApplication::GetModule( SfxToolsModule::Calc );
1496 setGroupName( u"Calc", CuiResId(SID_SC_EDITOPTIONS_RES[0].first) );
1497 nGroup = AddGroup( CuiResId(SID_SC_EDITOPTIONS_RES[0].first), pScMod, pScMod, SID_SC_EDITOPTIONS );
1498 const sal_uInt16 nCount = static_cast<sal_uInt16>(std::size(SID_SC_EDITOPTIONS_RES));
1499 for ( sal_uInt16 i = 1; i < nCount; ++i )
1500 {
1501 nPageId = static_cast<sal_uInt16>(SID_SC_EDITOPTIONS_RES[i].second);
1502 if ( lcl_isOptionHidden( nPageId, aOptionsDlgOpt ) )
1503 continue;
1504
1505 AddTabPage( nPageId, CuiResId(SID_SC_EDITOPTIONS_RES[i].first), nGroup );
1506 }
1507 }
1508 }
1509 }
1510
1511 // Impress options
1512 SfxModule* pSdMod = SfxApplication::GetModule( SfxToolsModule::Draw );
1514 {
1515 if ( aFactory == "com.sun.star.presentation.PresentationDocument" )
1516 {
1517 if ( !lcl_isOptionHidden( SID_SD_EDITOPTIONS, aOptionsDlgOpt ) )
1518 {
1519 setGroupName( u"Impress", CuiResId(SID_SD_EDITOPTIONS_RES[0].first) );
1520 nGroup = AddGroup( CuiResId(SID_SD_EDITOPTIONS_RES[0].first), pSdMod, pSdMod, SID_SD_EDITOPTIONS );
1521 const sal_uInt16 nCount = static_cast<sal_uInt16>(std::size(SID_SD_EDITOPTIONS_RES));
1522 for ( sal_uInt16 i = 1; i < nCount; ++i )
1523 {
1524 nPageId = static_cast<sal_uInt16>(SID_SD_EDITOPTIONS_RES[i].second);
1525 if ( lcl_isOptionHidden( nPageId, aOptionsDlgOpt ) )
1526 continue;
1527
1528 AddTabPage( nPageId, CuiResId(SID_SD_EDITOPTIONS_RES[i].first), nGroup );
1529 }
1530 }
1531 }
1532 }
1533
1534 // Draw options
1536 {
1537 if ( aFactory == "com.sun.star.drawing.DrawingDocument" )
1538 {
1539 if ( !lcl_isOptionHidden( SID_SD_GRAPHIC_OPTIONS, aOptionsDlgOpt ) )
1540 {
1541 setGroupName( u"Draw", CuiResId(SID_SD_GRAPHIC_OPTIONS_RES[0].first) );
1542 nGroup = AddGroup( CuiResId(SID_SD_GRAPHIC_OPTIONS_RES[0].first), pSdMod, pSdMod, SID_SD_GRAPHIC_OPTIONS );
1543 const sal_uInt16 nCount = static_cast<sal_uInt16>(std::size(SID_SD_GRAPHIC_OPTIONS_RES));
1544 for ( sal_uInt16 i = 1; i < nCount; ++i )
1545 {
1546 nPageId = static_cast<sal_uInt16>(SID_SD_GRAPHIC_OPTIONS_RES[i].second);
1547 if ( lcl_isOptionHidden( nPageId, aOptionsDlgOpt ) )
1548 continue;
1549
1550 AddTabPage( nPageId, CuiResId(SID_SD_GRAPHIC_OPTIONS_RES[i].first), nGroup );
1551 }
1552 }
1553 }
1554 }
1555
1556 // Math options
1558 {
1559 if ( aFactory == "com.sun.star.formula.FormulaProperties" )
1560 {
1561 if ( !lcl_isOptionHidden( SID_SM_EDITOPTIONS, aOptionsDlgOpt ) )
1562 {
1563 SfxModule* pSmMod = SfxApplication::GetModule(SfxToolsModule::Math);
1564 setGroupName( u"Math", CuiResId(SID_SM_EDITOPTIONS_RES[0].first) );
1565 nGroup = AddGroup(CuiResId(SID_SM_EDITOPTIONS_RES[0].first), pSmMod, pSmMod, SID_SM_EDITOPTIONS );
1566 for ( size_t i = 1; i < std::size(SID_SM_EDITOPTIONS_RES); ++i )
1567 {
1568 nPageId = static_cast<sal_uInt16>(SID_SM_EDITOPTIONS_RES[i].second);
1569 if ( !lcl_isOptionHidden( nPageId, aOptionsDlgOpt ) )
1570 AddTabPage( nPageId, CuiResId(SID_SM_EDITOPTIONS_RES[i].first), nGroup );
1571 }
1572 }
1573 }
1574 }
1575
1576 // Database - needed only if there is an application which integrates with databases
1577 if ( !lcl_isOptionHidden( SID_SB_STARBASEOPTIONS, aOptionsDlgOpt ) &&
1581 ) )
1582 {
1583 setGroupName( u"Base", CuiResId(SID_SB_STARBASEOPTIONS_RES[0].first) );
1584 nGroup = AddGroup( CuiResId(SID_SB_STARBASEOPTIONS_RES[0].first), nullptr, nullptr, SID_SB_STARBASEOPTIONS );
1585 for ( size_t i = 1; i < std::size(SID_SB_STARBASEOPTIONS_RES); ++i )
1586 {
1587 nPageId = static_cast<sal_uInt16>(SID_SB_STARBASEOPTIONS_RES[i].second);
1588 if ( !lcl_isOptionHidden( nPageId, aOptionsDlgOpt ) )
1589 AddTabPage( nPageId, CuiResId(SID_SB_STARBASEOPTIONS_RES[i].first), nGroup );
1590 }
1591 }
1592
1593 // Chart options (always installed and active)
1594 if ( !lcl_isOptionHidden( SID_SCH_EDITOPTIONS, aOptionsDlgOpt ) )
1595 {
1596 setGroupName( u"Charts", CuiResId(SID_SCH_EDITOPTIONS_RES[0].first) );
1597 nGroup = AddGroup( CuiResId(SID_SCH_EDITOPTIONS_RES[0].first), nullptr, nullptr, SID_SCH_EDITOPTIONS );
1598 for ( size_t i = 1; i < std::size(SID_SCH_EDITOPTIONS_RES); ++i )
1599 {
1600 nPageId = static_cast<sal_uInt16>(SID_SCH_EDITOPTIONS_RES[i].second);
1601 if ( !lcl_isOptionHidden( nPageId, aOptionsDlgOpt ) )
1602 AddTabPage( nPageId, CuiResId(SID_SCH_EDITOPTIONS_RES[i].first), nGroup );
1603 }
1604 }
1605
1606 // Internet options
1607 if ( lcl_isOptionHidden( SID_INET_DLG, aOptionsDlgOpt ) )
1608 return;
1609
1610 setGroupName(u"Internet", CuiResId(SID_INET_DLG_RES[0].first));
1611 nGroup = AddGroup(CuiResId(SID_INET_DLG_RES[0].first), nullptr, nullptr, SID_INET_DLG );
1612
1613 for ( size_t i = 1; i < std::size(SID_INET_DLG_RES); ++i )
1614 {
1615 nPageId = static_cast<sal_uInt16>(SID_INET_DLG_RES[i].second);
1616 if ( lcl_isOptionHidden( nPageId, aOptionsDlgOpt ) )
1617 continue;
1618#if defined(_WIN32)
1619 // Disable E-mail tab-page on Windows
1621 continue;
1622#endif
1623 AddTabPage( nPageId, CuiResId(SID_INET_DLG_RES[i].first), nGroup );
1624 }
1625}
1626
1627static bool isNodeActive( OptionsNode const * pNode, Module* pModule )
1628{
1629 if ( !pNode )
1630 return false;
1631
1632 // Node for all modules active?
1633 if ( pNode->m_bAllModules )
1634 return true;
1635
1636 // OOo-Nodes (Writer, Calc, Impress...) are active if node is already inserted
1637 if ( !getGroupName( pNode->m_sId, false ).isEmpty() )
1638 return true;
1639
1640 // no module -> not active
1641 if ( !pModule )
1642 return false;
1643
1644 // search node in active module
1645 if ( pModule->m_bActive )
1646 {
1647 for (auto const& j : pModule->m_aNodeList)
1648 if ( j->m_sId == pNode->m_sId )
1649 return true;
1650 }
1651 return false;
1652}
1653
1654void OfaTreeOptionsDialog::LoadExtensionOptions( std::u16string_view rExtensionId )
1655{
1656 std::unique_ptr<Module> pModule;
1657
1658 // when called by Tools - Options then load nodes of active module
1659 if ( rExtensionId.empty() )
1660 {
1661 pModule = LoadModule( GetModuleIdentifier( Reference< XFrame >() ) );
1662 }
1663
1664 VectorOfNodes aNodeList = LoadNodes( pModule.get(), rExtensionId );
1665 InsertNodes( aNodeList );
1666}
1667
1668OUString OfaTreeOptionsDialog::GetModuleIdentifier( const Reference< XFrame >& rFrame )
1669{
1670 OUString sModule;
1671 Reference < XFrame > xCurrentFrame( rFrame );
1672 Reference< XComponentContext > xContext = comphelper::getProcessComponentContext();
1673 Reference < XModuleManager2 > xModuleManager = ModuleManager::create(xContext);
1674
1675 if ( !xCurrentFrame.is() )
1676 {
1677 Reference < XDesktop2 > xDesktop = Desktop::create( xContext );
1678 xCurrentFrame = xDesktop->getCurrentFrame();
1679 }
1680
1681 if ( xCurrentFrame.is() )
1682 {
1683 try
1684 {
1685 sModule = xModuleManager->identify( xCurrentFrame );
1686 }
1687 catch ( css::frame::UnknownModuleException& )
1688 {
1689 SAL_INFO( "cui.options", "unknown module" );
1690 }
1691 catch ( Exception const & )
1692 {
1693 TOOLS_WARN_EXCEPTION( "cui.options", "OfaTreeOptionsDialog::GetModuleIdentifier(): exception of XModuleManager::identify()");
1694 }
1695 }
1696 return sModule;
1697}
1698
1699std::unique_ptr<Module> OfaTreeOptionsDialog::LoadModule(
1700 std::u16string_view rModuleIdentifier )
1701{
1702 std::unique_ptr<Module> pModule;
1704 officecfg::Office::OptionsDialog::Modules::get());
1705
1706 const Sequence< OUString > seqNames = xSet->getElementNames();
1707 for ( const OUString& rModule : seqNames )
1708 {
1709 if ( rModuleIdentifier == rModule )
1710 {
1711 // current active module found
1712 pModule.reset(new Module);
1713 pModule->m_bActive = true;
1714
1715 Reference< XNameAccess > xModAccess;
1716 xSet->getByName( rModule ) >>= xModAccess;
1717 if ( xModAccess.is() )
1718 {
1719 // load the nodes of this module
1720 Reference< XNameAccess > xNodeAccess;
1721 xModAccess->getByName( "Nodes" ) >>= xNodeAccess;
1722 if ( xNodeAccess.is() )
1723 {
1724 const Sequence< OUString > xTemp = xNodeAccess->getElementNames();
1726 sal_Int32 nIndex = -1;
1727 for ( const OUString& rNode : xTemp)
1728 {
1729 xNodeAccess->getByName( rNode ) >>= xAccess;
1730 if ( xAccess.is() )
1731 {
1732 xAccess->getByName( "Index" ) >>= nIndex;
1733 if ( nIndex < 0 )
1734 // append nodes with index < 0
1735 pModule->m_aNodeList.push_back(
1736 std::unique_ptr<OrderedEntry>(new OrderedEntry(nIndex, rNode)));
1737 else
1738 {
1739 // search position of the node
1740 std::vector<OrderedEntry *>::size_type y = 0;
1741 for ( ; y < pModule->m_aNodeList.size(); ++y )
1742 {
1743 sal_Int32 nNodeIdx = pModule->m_aNodeList[y]->m_nIndex;
1744 if ( nNodeIdx < 0 || nNodeIdx > nIndex )
1745 break;
1746 }
1747 // and insert the node on this position
1748 pModule->m_aNodeList.insert(
1749 pModule->m_aNodeList.begin() + y,
1750 std::unique_ptr<OrderedEntry>(new OrderedEntry( nIndex, rNode )) );
1751 }
1752 }
1753 }
1754 }
1755 }
1756 break;
1757 }
1758 }
1759 return pModule;
1760}
1761
1763 Module* pModule, std::u16string_view rExtensionId)
1764{
1765 VectorOfNodes aOutNodeList;
1766
1768 officecfg::Office::OptionsDialog::Nodes::get());
1769 VectorOfNodes aNodeList;
1770 const Sequence< OUString > seqNames = xSet->getElementNames();
1771
1772 for ( OUString const & sGroupName : seqNames )
1773 {
1774 Reference< XNameAccess > xNodeAccess;
1775 xSet->getByName( sGroupName ) >>= xNodeAccess;
1776
1777 if ( xNodeAccess.is() )
1778 {
1779 OUString sNodeId, sLabel, sPageURL;
1780 bool bAllModules = false;
1781
1782 sNodeId = sGroupName;
1783 xNodeAccess->getByName( "Label" ) >>= sLabel;
1784 xNodeAccess->getByName( "OptionsPage" ) >>= sPageURL;
1785 xNodeAccess->getByName( "AllModules" ) >>= bAllModules;
1786
1787 if ( sLabel.isEmpty() )
1788 sLabel = sGroupName;
1789 OUString sTemp = getGroupName( sLabel, !rExtensionId.empty() );
1790 if ( !sTemp.isEmpty() )
1791 sLabel = sTemp;
1792 std::unique_ptr<OptionsNode> pNode(new OptionsNode(sNodeId, sLabel, bAllModules));
1793
1794 if ( rExtensionId.empty() && !isNodeActive( pNode.get(), pModule ) )
1795 {
1796 continue;
1797 }
1798
1799 Reference< XNameAccess > xLeavesSet;
1800 xNodeAccess->getByName( "Leaves" ) >>= xLeavesSet;
1801 if ( xLeavesSet.is() )
1802 {
1803 const Sequence< OUString > seqLeaves = xLeavesSet->getElementNames();
1804 for ( OUString const & leafName : seqLeaves )
1805 {
1806 Reference< XNameAccess > xLeaveAccess;
1807 xLeavesSet->getByName( leafName ) >>= xLeaveAccess;
1808
1809 if ( xLeaveAccess.is() )
1810 {
1811 OUString sId, sLeafLabel, sEventHdl, sLeafURL, sLeafGrpId;
1812 sal_Int32 nLeafGrpIdx = 0;
1813
1814 xLeaveAccess->getByName( "Id" ) >>= sId;
1815 xLeaveAccess->getByName( "Label" ) >>= sLeafLabel;
1816 xLeaveAccess->getByName( "OptionsPage" ) >>= sLeafURL;
1817 xLeaveAccess->getByName( "EventHandlerService" ) >>= sEventHdl;
1818 xLeaveAccess->getByName( "GroupId" ) >>= sLeafGrpId;
1819 xLeaveAccess->getByName( "GroupIndex" ) >>= nLeafGrpIdx;
1820
1821 if ( rExtensionId.empty() || sId == rExtensionId )
1822 {
1823 std::unique_ptr<OptionsLeaf> pLeaf(new OptionsLeaf(
1824 sLeafLabel, sLeafURL, sEventHdl, sLeafGrpId, nLeafGrpIdx ));
1825
1826 if ( !sLeafGrpId.isEmpty() )
1827 {
1828 bool bAlreadyOpened = false;
1829 if ( !pNode->m_aGroupedLeaves.empty() )
1830 {
1831 for (auto & rGroup : pNode->m_aGroupedLeaves)
1832 {
1833 if ( !rGroup.empty() &&
1834 rGroup[0]->m_sGroupId == sLeafGrpId )
1835 {
1836 std::vector<std::unique_ptr<OptionsLeaf>>::size_type l = 0;
1837 for ( ; l < rGroup.size(); ++l )
1838 {
1839 if ( rGroup[l]->m_nGroupIndex >= nLeafGrpIdx )
1840 break;
1841 }
1842 rGroup.insert( rGroup.begin() + l, std::move(pLeaf) );
1843 bAlreadyOpened = true;
1844 break;
1845 }
1846 }
1847 }
1848 if ( !bAlreadyOpened )
1849 {
1850 std::vector< std::unique_ptr<OptionsLeaf> > aGroupedLeaves;
1851 aGroupedLeaves.push_back( std::move(pLeaf) );
1852 pNode->m_aGroupedLeaves.push_back( std::move(aGroupedLeaves) );
1853 }
1854 }
1855 else
1856 pNode->m_aLeaves.push_back( std::move(pLeaf) );
1857 }
1858 }
1859 }
1860 }
1861
1862 // do not insert nodes without leaves
1863 if ( !pNode->m_aLeaves.empty() || !pNode->m_aGroupedLeaves.empty() )
1864 {
1865 pModule ? aNodeList.push_back( std::move(pNode) ) : aOutNodeList.push_back( std::move(pNode) );
1866 }
1867 }
1868 }
1869
1870 if ( pModule && !aNodeList.empty() )
1871 {
1872 for ( auto const & i: pModule->m_aNodeList )
1873 {
1874 OUString sNodeId = i->m_sId;
1875 for ( auto j = aNodeList.begin(); j != aNodeList.end(); ++j )
1876 {
1877 if ( (*j)->m_sId == sNodeId )
1878 {
1879 aOutNodeList.push_back( std::move(*j) );
1880 aNodeList.erase( j );
1881 break;
1882 }
1883 }
1884 }
1885
1886 for ( auto & i: aNodeList )
1887 aOutNodeList.push_back( std::move(i) );
1888 }
1889 return aOutNodeList;
1890}
1891
1892static sal_uInt16 lcl_getGroupId( std::u16string_view rGroupName, const weld::TreeView& rTreeLB )
1893{
1894 sal_uInt16 nRet = 0;
1895
1896 std::unique_ptr<weld::TreeIter> xEntry = rTreeLB.make_iterator();
1897 bool bEntry = rTreeLB.get_iter_first(*xEntry);
1898 while (bEntry)
1899 {
1900 if (!rTreeLB.get_iter_depth(*xEntry))
1901 {
1902 OUString sTemp(rTreeLB.get_text(*xEntry));
1903 if (sTemp == rGroupName)
1904 return nRet;
1905 nRet++;
1906 }
1907 bEntry = rTreeLB.iter_next(*xEntry);
1908 }
1909
1910 return USHRT_MAX;
1911}
1912
1913static void lcl_insertLeaf(
1914 OfaTreeOptionsDialog* pDlg, OptionsNode const * pNode, OptionsLeaf const * pLeaf, const weld::TreeView& rTreeLB )
1915{
1916 sal_uInt16 nGrpId = lcl_getGroupId( pNode->m_sLabel, rTreeLB );
1917 if ( USHRT_MAX == nGrpId )
1918 {
1919 sal_uInt16 nNodeGrpId = getGroupNodeId( pNode->m_sId );
1920 nGrpId = pDlg->AddGroup( pNode->m_sLabel, nullptr, nullptr, nNodeGrpId );
1921 }
1922 OptionsPageInfo* pInfo = pDlg->AddTabPage( 0, pLeaf->m_sLabel, nGrpId );
1923 pInfo->m_sPageURL = pLeaf->m_sPageURL;
1924 pInfo->m_sEventHdl = pLeaf->m_sEventHdl;
1925}
1926
1928{
1929 for (auto const& node : rNodeList)
1930 {
1931 if ( !node->m_aLeaves.empty() || !node->m_aGroupedLeaves.empty() )
1932 {
1933 for ( auto const & j: node->m_aGroupedLeaves )
1934 {
1935 for ( size_t k = 0; k < j.size(); ++k )
1936 {
1937 lcl_insertLeaf( this, node.get(), j[k].get(), *xTreeLB );
1938 }
1939 }
1940
1941 for ( auto const & j: node->m_aLeaves )
1942 {
1943 lcl_insertLeaf( this, node.get(), j.get(), *xTreeLB );
1944 }
1945 }
1946 }
1947}
1948
1950{
1951 bNeedsRestart = true;
1952 eRestartReason = eReason;
1953}
1954
1956{
1957 std::unique_ptr< SvxDicListChgClamp > pClamp;
1959 {
1960 // collect all DictionaryList Events while the dialog is executed
1961 Reference<css::linguistic2::XSearchableDictionaryList> xDictionaryList(LinguMgr::GetDictionaryList());
1962 pClamp.reset( new SvxDicListChgClamp( xDictionaryList ) );
1963 }
1964
1965 return SfxOkDialogController::run();
1966}
1967
1968// class ExtensionsTabPage -----------------------------------------------
1970 weld::Container* pParent, OUString aPageURL,
1971 OUString aEvtHdl, const Reference< awt::XContainerWindowProvider >& rProvider )
1972 : m_pContainer(pParent)
1973 , m_sPageURL(std::move(aPageURL))
1974 , m_sEventHdl(std::move(aEvtHdl))
1975 , m_xWinProvider(rProvider)
1976{
1977}
1978
1980{
1981 Hide();
1983
1984 if ( m_xPage.is() )
1985 {
1986 try
1987 {
1988 m_xPage->dispose();
1989 }
1990 catch (const Exception&)
1991 {
1992 }
1993 m_xPage.clear();
1994 }
1995
1996 if ( m_xPageParent.is() )
1997 {
1998 try
1999 {
2000 m_xPageParent->dispose();
2001 }
2002 catch (const Exception&)
2003 {
2004 }
2005 m_xPageParent.clear();
2006 }
2007}
2008
2010{
2011 try
2012 {
2013 bool bWithHandler = !m_sEventHdl.isEmpty();
2014 if ( bWithHandler )
2015 {
2016 Reference < XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory() );
2017 m_xEventHdl.set( xFactory->createInstance( m_sEventHdl ), UNO_QUERY );
2018 }
2019
2020 if ( !bWithHandler || m_xEventHdl.is() )
2021 {
2023 Reference<awt::XWindowPeer> xParent(m_xPageParent, UNO_QUERY);
2024 m_xPage =
2025 m_xWinProvider->createContainerWindow(
2026 m_sPageURL, OUString(), xParent, m_xEventHdl );
2027
2028 Reference< awt::XControl > xPageControl( m_xPage, UNO_QUERY );
2029 if ( xPageControl.is() )
2030 {
2031 Reference< awt::XWindowPeer > xWinPeer( xPageControl->getPeer() );
2032 if ( xWinPeer.is() )
2033 {
2034 VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( xWinPeer );
2035 if ( pWindow )
2036 pWindow->SetStyle( pWindow->GetStyle() | WB_DIALOGCONTROL | WB_CHILDDLGCTRL );
2037 }
2038 }
2039 }
2040 }
2041 catch (const Exception&)
2042 {
2043 TOOLS_WARN_EXCEPTION( "cui.options", "ExtensionsTabPage::CreateDialogWithHandler(): exception of XDialogProvider2::createDialogWithHandler()");
2044 }
2045}
2046
2047bool ExtensionsTabPage::DispatchAction( const OUString& rAction )
2048{
2049 bool bRet = false;
2050 if ( m_xEventHdl.is() )
2051 {
2052 try
2053 {
2054 bRet = m_xEventHdl->callHandlerMethod( m_xPage, Any( rAction ), "external_event" );
2055 }
2056 catch ( Exception const & )
2057 {
2058 TOOLS_WARN_EXCEPTION( "cui.options", "ExtensionsTabPage::DispatchAction(): exception of XDialogEventHandler::callHandlerMethod()" );
2059 }
2060 }
2061 return bRet;
2062}
2063
2065{
2066 if (!m_xPageParent.is())
2067 return;
2068
2070 if (xPageParent)
2071 {
2072 // NoActivate otherwise setVisible will call Window::Show which will grab
2073 // focus to the page by default
2074 xPageParent->Show(true, ShowFlags::NoActivate);
2075 }
2076
2077 m_xPageParent->setVisible(true);
2078}
2079
2081{
2082 if (!m_xPageParent.is())
2083 return;
2084 m_xPageParent->setVisible(false);
2085}
2086
2088{
2089 if ( !m_xPage.is() )
2090 {
2092
2093 if ( m_xPage.is() )
2094 {
2095 auto aWindowRect = m_xPageParent->getPosSize();
2096 m_xPage->setPosSize(0, 0, aWindowRect.Width, aWindowRect.Height, awt::PosSize::POSSIZE);
2097 if ( !m_sEventHdl.isEmpty() )
2098 DispatchAction( "initialize" );
2099 }
2100 }
2101
2102 if ( m_xPage.is() )
2103 {
2104 m_xPage->setVisible( true );
2105 }
2106}
2107
2109{
2110 if ( m_xPage.is() )
2111 m_xPage->setVisible( false );
2112}
2113
2115{
2116 DispatchAction( "back" );
2117 ActivatePage();
2118}
2119
2121{
2122 DispatchAction( "ok" );
2123}
2124
2125/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
const PropertyValue * pValues
SfxApplication * SfxGetpApp()
Reference< XExecutableDialog > m_xDialog
sal_uInt16 nPageId
std::map< OUString, std::shared_ptr< NoAutoUnloadModule > > ModuleMap
static Help * GetHelp()
OString GetHelpId() const
sal_uInt16 GetValue() const
bool DispatchAction(const OUString &rAction)
Definition: treeopt.cxx:2047
css::uno::Reference< css::awt::XWindow > m_xPageParent
Definition: treeopt.hxx:209
ExtensionsTabPage(weld::Container *pParent, OUString rPageURL, OUString aEvtHdl, const css::uno::Reference< css::awt::XContainerWindowProvider > &rProvider)
Definition: treeopt.cxx:1969
css::uno::Reference< css::awt::XWindow > m_xPage
Definition: treeopt.hxx:210
void CreateDialogWithHandler()
Definition: treeopt.cxx:2009
css::uno::Reference< css::awt::XContainerWindowProvider > m_xWinProvider
Definition: treeopt.hxx:215
weld::Container * m_pContainer
Definition: treeopt.hxx:207
OUString m_sPageURL
Definition: treeopt.hxx:208
css::uno::Reference< css::awt::XContainerWindowEventHandler > m_xEventHdl
Definition: treeopt.hxx:213
OUString m_sEventHdl
Definition: treeopt.hxx:211
void DeactivatePage()
Definition: treeopt.cxx:2108
virtual bool Start(const OUString &rHelpId, weld::Widget *pWidget=nullptr)
static void EnableQuickHelp()
static bool IsQuickHelpEnabled()
static void DisableBalloonHelp()
static void EnableBalloonHelp()
static void DisableQuickHelp()
static bool IsBalloonHelpEnabled()
INetProtocol GetProtocol() const
static css::uno::Reference< css::linguistic2::XSearchableDictionaryList > GetDictionaryList()
static css::uno::Reference< css::linguistic2::XLinguProperties > GetLinguPropertySet()
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *rAttrSet)
Definition: opthtml.cxx:65
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *rAttrSet)
Definition: optgdlg.cxx:1203
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *rAttrSet)
Definition: optfltr.cxx:152
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *rAttrSet)
Definition: optfltr.cxx:68
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *rAttrSet)
Definition: optgdlg.cxx:212
virtual ~OfaTreeOptionsDialog() override
Definition: treeopt.cxx:524
std::unique_ptr< weld::Button > xBackPB
Definition: treeopt.hxx:123
std::unique_ptr< weld::TreeIter > xCurrentPageEntry
Definition: treeopt.hxx:130
static void ApplyItemSet(sal_uInt16 nId, const SfxItemSet &rSet)
Definition: treeopt.cxx:1175
svtools::RestartReason eRestartReason
Definition: treeopt.hxx:141
std::unique_ptr< weld::Button > xApplyPB
Definition: treeopt.hxx:122
static void ApplyLanguageOptions(const SfxItemSet &rSet)
Definition: treeopt.cxx:1256
void SetNeedsRestart(svtools::RestartReason eReason)
Definition: treeopt.cxx:1949
bool bIsForSetDocumentLanguage
Definition: treeopt.hxx:138
void InsertNodes(const VectorOfNodes &rNodeList)
Definition: treeopt.cxx:1927
static std::unique_ptr< Module > LoadModule(std::u16string_view rModuleIdentifier)
Definition: treeopt.cxx:1699
OptionsPageInfo * AddTabPage(sal_uInt16 nId, const OUString &rPageName, sal_uInt16 nGroup)
Definition: treeopt.cxx:580
void ActivatePage(sal_uInt16 nResId)
Definition: treeopt.cxx:803
void InitItemSets(OptionsGroupInfo &rGroupInfo)
Definition: treeopt.cxx:897
static LastPageSaver * pLastPageSaver
Definition: treeopt.hxx:146
virtual short run() override
Definition: treeopt.cxx:1955
void LoadExtensionOptions(std::u16string_view rExtensionId)
Definition: treeopt.cxx:1654
static VectorOfNodes LoadNodes(Module *pModule, std::u16string_view rExtensionId)
Definition: treeopt.cxx:1762
void Initialize(const css::uno::Reference< css::frame::XFrame > &_xFrame)
Definition: treeopt.cxx:1350
bool bIsFromExtensionManager
Definition: treeopt.hxx:135
sal_uInt16 AddGroup(const OUString &rGroupName, SfxShell *pCreateShell, SfxModule *pCreateModule, sal_uInt16 nDialogId)
Definition: treeopt.cxx:595
std::unique_ptr< weld::Container > xTabBox
Definition: treeopt.hxx:126
void InitTreeAndHandler()
Definition: treeopt.cxx:793
std::unique_ptr< weld::Button > xOkPB
Definition: treeopt.hxx:121
void ResetCurrentPageFromConfig()
Definition: treeopt.cxx:622
std::optional< SfxItemSet > CreateItemSet(sal_uInt16 nId)
Definition: treeopt.cxx:1034
void ActivateLastSelection()
Definition: treeopt.cxx:833
static OUString GetModuleIdentifier(const css::uno::Reference< css::frame::XFrame > &xFrame)
Definition: treeopt.cxx:1668
OfaTreeOptionsDialog(weld::Window *pParent, const css::uno::Reference< css::frame::XFrame > &_xFrame, bool bActivateLastSelection)
css::uno::Reference< css::awt::XContainerWindowProvider > m_xContainerWinProvider
Definition: treeopt.hxx:144
std::unique_ptr< weld::TreeView > xTreeLB
Definition: treeopt.hxx:125
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *rAttrSet)
Definition: optgdlg.cxx:662
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *rAttrSet)
Definition: optdeepl.cxx:48
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *rAttrSet)
static void GetOptions(SfxItemSet &)
void SetOptions(const SfxItemSet &)
static SfxModule * GetModule(SfxToolsModule nSharedLib)
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *)
const SfxPoolItem * Execute(sal_uInt16 nSlot, SfxCallMode nCall=SfxCallMode::SLOT, const SfxPoolItem **pArgs=nullptr, sal_uInt16 nModi=0, const SfxPoolItem **pInternalArgs=nullptr)
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 * >())
sal_uInt8 & GetMinTrail()
sal_uInt8 & GetMinLead()
sal_uInt16 Count() 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)
virtual std::unique_ptr< SfxTabPage > CreateTabPage(sal_uInt16 nId, weld::Container *pPage, weld::DialogController *pController, const SfxItemSet &rSet)
sal_uInt16 Which() const
virtual SfxPoolItem * Clone(SfxItemPool *pPool=nullptr) const=0
virtual void ApplyItemSet(sal_uInt16 nId, const SfxItemSet &rSet)
virtual std::optional< SfxItemSet > CreateItemSet(sal_uInt16 nId)
static SAL_WARN_UNUSED_RESULT SfxViewFrame * Current()
static SAL_WARN_UNUSED_RESULT SfxViewFrame * GetNext(const SfxViewFrame &rPrev, const SfxObjectShell *pDoc=nullptr, bool bOnlyVisible=true)
SfxDispatcher * GetDispatcher()
static SAL_WARN_UNUSED_RESULT SfxViewFrame * GetFirst(const SfxObjectShell *pDoc=nullptr, bool bOnlyVisible=true)
constexpr tools::Long Height() const
void setHeight(tools::Long nHeight)
constexpr tools::Long Width() const
bool IsCTLFontEnabled() const
bool IsModuleInstalled(EModule eModule) const
bool IsPageHidden(std::u16string_view _rPage, std::u16string_view _rGroup) const
bool IsGroupHidden(std::u16string_view _rGroup) const
css::uno::Any GetUserItem(const OUString &sName) const
void SetUserItem(const OUString &sName, const css::uno::Any &aValue)
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *rAttrSet)
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *rAttrSet)
Definition: optasian.cxx:139
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *rSet)
Definition: optbasic.cxx:121
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *rAttrSet)
Definition: optctl.cxx:56
const SvxChartColorTable & GetDefaultColors()
Definition: cfgchart.cxx:173
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *rAttrSet)
Definition: optcolor.cxx:746
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *rInAttrs)
Definition: optchart.cxx:143
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *rAttrSet)
Definition: optinet2.cxx:857
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *rAttrSet)
Definition: fontsubs.cxx:137
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *rAttrSet)
Definition: optgenrl.cxx:339
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *rSet)
Definition: optjsearch.cxx:58
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *rSet)
Definition: optjava.cxx:464
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *rSet)
Definition: optlingu.cxx:919
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *rSet)
Definition: optupdt.cxx:188
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *rSet)
Definition: optopencl.cxx:48
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *rSet)
Definition: optpath.cxx:218
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *rSet)
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *rAttrSet)
Definition: optinet2.cxx:184
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *rAttrSet)
Definition: optsave.cxx:195
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *rAttrSet)
Definition: optinet2.cxx:755
static vcl::Window * GetWindow(const css::uno::Reference< css::awt::XWindow > &rxWindow)
static std::shared_ptr< ConfigurationChanges > create()
static void GetOptions(SfxItemSet &_rFillItems)
static void SetOptions(const SfxItemSet &_rSourceItems)
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *_rAttrSet)
static void SetOptions(const SfxItemSet &_rSourceItems)
static void GetOptions(SfxItemSet &_rFillItems)
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *rSet)
Definition: dbregister.cxx:128
virtual void Notify(const css::uno::Sequence< OUString > &aPropertyNames)=0
virtual void ImplCommit()=0
static void storeConfigItems()
virtual css::uno::Reference< css::awt::XWindow > CreateChildFrame()=0
virtual std::unique_ptr< TreeIter > make_iterator(const TreeIter *pOrig=nullptr) const=0
virtual OUString get_text(int row, int col=-1) const=0
virtual bool get_iter_first(TreeIter &rIter) const=0
virtual bool iter_next(TreeIter &rIter) const=0
virtual int get_iter_depth(const TreeIter &rIter) const=0
OUString CuiResId(TranslateId aKey)
Definition: cuiresmgr.cxx:23
int nCount
#define DBG_ASSERT(sCon, aError)
#define TOOLS_WARN_EXCEPTION(area, stream)
virtual tools::Long GetValue() const override
float u
float y
Reference< XSingleServiceFactory > xFactory
constexpr OStringLiteral HID_OFADLG_TREELISTBOX
Definition: helpids.h:28
sal_Int32 nIndex
#define SAL_INFO(area, stream)
bool IsCJKFontEnabled()
bool IsJapaneseFindEnabled()
bool IsAsianTypographyEnabled()
@ Exception
COMPHELPER_DLLPUBLIC OUString getExpandedUri(css::uno::Reference< css::uno::XComponentContext > const &context, OUString const &uri)
Reference< XComponentContext > getProcessComponentContext()
int i
constexpr OUStringLiteral first
bool SaveDictionaries(const uno::Reference< XSearchableDictionaryList > &xDicList)
static constexpr auto Items
int GetMinimumEditHeight()
OUString toId(const void *pValue)
sal_Int16 nId
#define OFA_TP_LANGUAGES
#define RID_SVXPAGE_OPTIONS_CTL
#define RID_SFXPAGE_LINGU
#define OFA_TP_LANGUAGES_FOR_SET_DOCUMENT_LANGUAGE
#define RID_SVXPAGE_BASICIDE_OPTIONS
#define RID_SVXPAGE_OPENCL
#define OFA_TP_MISC
#define RID_SVXPAGE_INET_SECURITY
#define RID_SVXPAGE_LANGTOOL_OPTIONS
#define RID_SVXPAGE_ONLINEUPDATE
#define RID_SVXPAGE_ASIAN_LAYOUT
#define RID_SVX_FONT_SUBSTITUTION
#define RID_SVXPAGE_JSEARCH_OPTIONS
#define OFA_TP_VIEW
#define RID_SVXPAGE_INET_PROXY
#define RID_SVXPAGE_PERSONALIZATION
#define RID_SVXPAGE_OPTIONS_JAVA
#define RID_SVXPAGE_COLORCONFIG
#define RID_SVXPAGE_ACCESSIBILITYCONFIG
#define RID_OFAPAGE_HTMLOPT
#define RID_SVXPAGE_INET_MAIL
#define RID_SVXPAGE_COLOR
#define RID_SFXPAGE_PATH
#define RID_OPTPAGE_CHART_DEFCOLORS
#define RID_OFAPAGE_MSFILTEROPT2
#define RID_SFXPAGE_GENERAL
#define RID_SVXPAGE_DEEPL_OPTIONS
#define RID_SFXPAGE_PRINTOPTIONS
#define RID_SFXPAGE_SAVE
static SfxItemSet & rSet
OUString m_sLastPageURL_ExtMgr
Definition: treeopt.hxx:102
OUString m_sLastPageURL_Tools
Definition: treeopt.hxx:101
sal_uInt16 m_nLastPageId
Definition: treeopt.hxx:100
bool m_bActive
Definition: treeopt.hxx:49
std::vector< std::unique_ptr< OrderedEntry > > m_aNodeList
Definition: treeopt.hxx:50
std::unique_ptr< SfxItemSet > m_pOutItemSet
Definition: treeopt.cxx:460
OptionsGroupInfo(SfxShell *pSh, SfxModule *pMod, sal_uInt16 nId)
Definition: treeopt.cxx:465
SfxShell * m_pShell
Definition: treeopt.cxx:461
sal_uInt16 m_nDialogId
Definition: treeopt.cxx:463
std::optional< SfxItemSet > m_pInItemSet
Definition: treeopt.cxx:459
SfxModule * m_pModule
Definition: treeopt.cxx:462
OUString m_sPageURL
Definition: treeopt.hxx:60
OUString m_sLabel
Definition: treeopt.hxx:59
OUString m_sEventHdl
Definition: treeopt.hxx:61
OUString m_sLabel
Definition: treeopt.hxx:82
bool m_bAllModules
Definition: treeopt.hxx:83
OUString m_sId
Definition: treeopt.hxx:81
std::unique_ptr< ExtensionsTabPage > m_xExtPage
Definition: treeopt.cxx:452
OUString m_sPageURL
Definition: treeopt.cxx:450
OUString m_sEventHdl
Definition: treeopt.cxx:451
std::unique_ptr< SfxTabPage > m_xPage
Definition: treeopt.cxx:448
OptionsPageInfo(sal_uInt16 nId)
Definition: treeopt.cxx:454
sal_uInt16 m_nPageId
Definition: treeopt.cxx:449
std::unique_ptr< SfxTabPage >(* CreateTabPage)(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *rAttrSet)
DeactivateRC
static void deleteGroupNames()
Definition: treeopt.cxx:209
static bool isNodeActive(OptionsNode const *pNode, Module *pModule)
Definition: treeopt.cxx:1627
IMPL_LINK_NOARG(OfaTreeOptionsDialog, ShowPageHdl_Impl, weld::TreeView &, void)
Definition: treeopt.cxx:617
constexpr OUStringLiteral VIEWOPT_DATANAME
Definition: treeopt.cxx:123
static void lcl_insertLeaf(OfaTreeOptionsDialog *pDlg, OptionsNode const *pNode, OptionsLeaf const *pLeaf, const weld::TreeView &rTreeLB)
Definition: treeopt.cxx:1913
static OUString getGroupName(std::u16string_view rModule, bool bForced)
Definition: treeopt.cxx:177
#define INI_LIST()
Definition: treeopt.cxx:470
static void SetViewOptUserItem(SvtViewOptions &rOpt, const OUString &rData)
Definition: treeopt.cxx:125
static sal_uInt16 getGroupNodeId(std::u16string_view rModule)
Definition: treeopt.cxx:215
static std::unique_ptr< SfxTabPage > CreateGeneralTabPage(sal_uInt16 nId, weld::Container *pPage, weld::DialogController *pController, const SfxItemSet &rSet)
Definition: treeopt.cxx:271
static OUString getCurrentFactory_Impl(const Reference< XFrame > &_xFrame)
Definition: treeopt.cxx:1320
static OUString GetViewOptUserItem(const SvtViewOptions &rOpt)
Definition: treeopt.cxx:130
static bool lcl_isOptionHidden(sal_uInt16 _nPageId, const SvtOptionsDialogOptions &_rOptOptions)
Definition: treeopt.cxx:432
IMPL_LINK(OfaTreeOptionsDialog, ApplyHdl_Impl, weld::Button &, rButton, void)
Definition: treeopt.cxx:694
static void setGroupName(std::u16string_view rModule, const OUString &rGroupName)
Definition: treeopt.cxx:165
static bool lcl_getStringFromID(sal_uInt16 _nPageId, OUString &_rGroupName, OUString &_rPageName)
Definition: treeopt.cxx:411
OptionsMapping_Impl const OptionsMap_Impl[]
Definition: treeopt.cxx:328
static sal_uInt16 lcl_getGroupId(std::u16string_view rGroupName, const weld::TreeView &rTreeLB)
Definition: treeopt.cxx:1892
std::vector< std::unique_ptr< OptionsNode > > VectorOfNodes
Definition: treeopt.hxx:96
unsigned char sal_uInt8
OUString sId
RET_OK
SfxPrinterChangeFlags
WinBits const WB_DIALOGCONTROL
WinBits const WB_CHILDDLGCTRL