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