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