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