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