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