LibreOffice Module cui (master)  1
optsave.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 <sal/config.h>
21 
22 #include <string_view>
23 
24 #include <svl/eitem.hxx>
25 #include <svl/intitem.hxx>
26 #include "optsave.hxx"
27 #include <officecfg/Office/Common.hxx>
30 #include <unotools/saveopt.hxx>
32 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
33 #include <com/sun/star/container/XNameContainer.hpp>
34 #include <com/sun/star/container/XContainerQuery.hpp>
35 #include <com/sun/star/container/XEnumeration.hpp>
36 #include <com/sun/star/beans/PropertyValue.hpp>
37 #include <sfx2/sfxsids.hrc>
38 #include <sfx2/docfilt.hxx>
39 #include <unotools/optionsdlg.hxx>
40 #include <osl/diagnose.h>
41 #include <tools/diagnose_ex.h>
42 #include <officecfg/Office/Recovery.hxx>
43 
44 #include <sfx2/fcontnr.hxx>
45 
46 using namespace com::sun::star::uno;
47 using namespace com::sun::star::util;
48 using namespace com::sun::star::lang;
49 using namespace com::sun::star::beans;
50 using namespace com::sun::star::container;
51 using namespace comphelper;
52 
53 #define CFG_PAGE_AND_GROUP u"General", u"LoadSave"
54 
55 
57 {
59  std::vector< OUString > aFilterArr[APP_COUNT];
60  std::vector< bool > aODFArr[APP_COUNT];
61  std::vector< OUString > aUIFilterArr[APP_COUNT];
62  OUString aDefaultArr[APP_COUNT];
63  bool aDefaultReadonlyArr[APP_COUNT];
65 
67 };
68 
70 {
71 }
72 
73 // class SvxSaveTabPage --------------------------------------------------
74 
76  : SfxTabPage( pPage, pController, "cui/ui/optsavepage.ui", "OptSavePage", &rCoreSet )
77  , pImpl(new SvxSaveTabPage_Impl)
78  , m_xLoadUserSettingsCB(m_xBuilder->weld_check_button("load_settings"))
79  , m_xLoadDocPrinterCB(m_xBuilder->weld_check_button("load_docprinter"))
80  , m_xDocInfoCB(m_xBuilder->weld_check_button("docinfo"))
81  , m_xBackupCB(m_xBuilder->weld_check_button("backup"))
82  , m_xAutoSaveCB(m_xBuilder->weld_check_button("autosave"))
83  , m_xAutoSaveEdit(m_xBuilder->weld_spin_button("autosave_spin"))
84  , m_xMinuteFT(m_xBuilder->weld_label("autosave_mins"))
85  , m_xUserAutoSaveCB(m_xBuilder->weld_check_button("userautosave"))
86  , m_xRelativeFsysCB(m_xBuilder->weld_check_button("relative_fsys"))
87  , m_xRelativeInetCB(m_xBuilder->weld_check_button("relative_inet"))
88  , m_xODFVersionLB(m_xBuilder->weld_combo_box("odfversion"))
89  , m_xWarnAlienFormatCB(m_xBuilder->weld_check_button("warnalienformat"))
90  , m_xDocTypeLB(m_xBuilder->weld_combo_box("doctype"))
91  , m_xSaveAsFT(m_xBuilder->weld_label("saveas_label"))
92  , m_xSaveAsLB(m_xBuilder->weld_combo_box("saveas"))
93  , m_xODFWarningFI(m_xBuilder->weld_widget("odfwarning_image"))
94  , m_xODFWarningFT(m_xBuilder->weld_label("odfwarning_label"))
95 {
96  m_xAutoSaveEdit->set_max_length(2);
97 
98  m_xODFVersionLB->set_id(0, OUString::number(SvtSaveOptions::ODFVER_011)); // 1.0/1.1
99  m_xODFVersionLB->set_id(1, OUString::number(SvtSaveOptions::ODFVER_012)); // 1.2
100  m_xODFVersionLB->set_id(2, OUString::number(SvtSaveOptions::ODFVER_012_EXT_COMPAT)); // 1.2 Extended (compatibility mode)
101  m_xODFVersionLB->set_id(3, OUString::number(SvtSaveOptions::ODFVER_012_EXTENDED)); // 1.2 Extended
102  m_xODFVersionLB->set_id(4, OUString::number(SvtSaveOptions::ODFVER_013)); // 1.3
103  m_xODFVersionLB->set_id(5, OUString::number(SvtSaveOptions::ODFVER_LATEST)); // 1.3 Extended (recommended)
104 
105  m_xDocTypeLB->set_id(0, OUString::number(APP_WRITER) );
106  m_xDocTypeLB->set_id(1, OUString::number(APP_WRITER_WEB) );
107  m_xDocTypeLB->set_id(2, OUString::number(APP_WRITER_GLOBAL));
108  m_xDocTypeLB->set_id(3, OUString::number(APP_CALC) );
109  m_xDocTypeLB->set_id(4, OUString::number(APP_IMPRESS) );
110  m_xDocTypeLB->set_id(5, OUString::number(APP_DRAW) );
111  m_xDocTypeLB->set_id(6, OUString::number(APP_MATH) );
112 
113  m_xAutoSaveCB->connect_toggled( LINK( this, SvxSaveTabPage, AutoClickHdl_Impl ) );
114 
115  SvtModuleOptions aModuleOpt;
117  {
118  m_xSaveAsLB->remove_id(OUString::number(APP_MATH));
119  m_xDocTypeLB->remove_id(OUString::number(APP_MATH));
120  }
121  else
122  {
124  pImpl->aDefaultReadonlyArr[APP_MATH] = aModuleOpt.IsDefaultFilterReadonly(SvtModuleOptions::EFactory::MATH);
125  }
126 
128  {
129  m_xSaveAsLB->remove_id(OUString::number(APP_DRAW));
130  m_xDocTypeLB->remove_id(OUString::number(APP_DRAW));
131  }
132  else
133  {
135  pImpl->aDefaultReadonlyArr[APP_DRAW] = aModuleOpt.IsDefaultFilterReadonly(SvtModuleOptions::EFactory::DRAW);
136  }
137 
139  {
140  m_xSaveAsLB->remove_id(OUString::number(APP_IMPRESS));
141  m_xDocTypeLB->remove_id(OUString::number(APP_IMPRESS));
142  }
143  else
144  {
147  }
148 
150  {
151  m_xSaveAsLB->remove_id(OUString::number(APP_CALC));
152  m_xDocTypeLB->remove_id(OUString::number(APP_CALC));
153  }
154  else
155  {
157  pImpl->aDefaultReadonlyArr[APP_CALC] = aModuleOpt.IsDefaultFilterReadonly(SvtModuleOptions::EFactory::CALC);
158  }
159 
161  {
162  m_xSaveAsLB->remove_id(OUString::number(APP_WRITER));
163  m_xSaveAsLB->remove_id(OUString::number(APP_WRITER_WEB));
164  m_xSaveAsLB->remove_id(OUString::number(APP_WRITER_GLOBAL));
165  m_xDocTypeLB->remove_id(OUString::number(APP_WRITER));
166  m_xDocTypeLB->remove_id(OUString::number(APP_WRITER_WEB));
167  m_xDocTypeLB->remove_id(OUString::number(APP_WRITER_GLOBAL));
168  }
169  else
170  {
177  }
178 
179  Link<weld::ComboBox&,void> aLink = LINK( this, SvxSaveTabPage, ODFVersionHdl_Impl );
180  m_xODFVersionLB->connect_changed( aLink );
181  aLink = LINK( this, SvxSaveTabPage, FilterHdl_Impl );
182  m_xDocTypeLB->connect_changed( aLink );
183  m_xSaveAsLB->connect_changed( aLink );
184 
186 }
187 
189 {
190 }
191 
192 std::unique_ptr<SfxTabPage> SvxSaveTabPage::Create(weld::Container* pPage, weld::DialogController* pController,
193  const SfxItemSet* rAttrSet)
194 {
195  return std::make_unique<SvxSaveTabPage>(pPage, pController, *rAttrSet);
196 }
197 
199 {
200  SvtOptionsDialogOptions aOptionsDlgOpt;
201 
202  if ( aOptionsDlgOpt.IsOptionHidden( u"Backup", CFG_PAGE_AND_GROUP ) )
203  {
204  // hide controls of "Backup"
205  m_xBackupCB->hide();
206  }
207 
208  if ( aOptionsDlgOpt.IsOptionHidden( u"AutoSave", CFG_PAGE_AND_GROUP ) )
209  {
210  // hide controls of "AutoSave"
211  m_xAutoSaveCB->hide();
212  m_xAutoSaveEdit->hide();
213  m_xMinuteFT->hide();
214  }
215 
216  if ( aOptionsDlgOpt.IsOptionHidden( u"UserAutoSave", CFG_PAGE_AND_GROUP ) )
217  {
218  // hide controls of "UserAutoSave"
219  m_xUserAutoSaveCB->hide();
220  }
221 
222 }
223 
225 {
227  bool bModified = false;
228  if(m_xLoadUserSettingsCB->get_state_changed_from_saved())
229  officecfg::Office::Common::Load::UserDefinedSettings::set(m_xLoadUserSettingsCB->get_active(), xChanges);
230 
231  if ( m_xLoadDocPrinterCB->get_state_changed_from_saved() )
232  officecfg::Office::Common::Save::Document::LoadPrinter::set(m_xLoadDocPrinterCB->get_active(), xChanges);
233 
234  if ( m_xODFVersionLB->get_value_changed_from_saved() )
235  {
236  sal_Int32 nVersion = m_xODFVersionLB->get_active_id().toInt32();
238  }
239 
240  if ( m_xDocInfoCB->get_state_changed_from_saved() )
241  {
242  rSet->Put( SfxBoolItem( GetWhich( SID_ATTR_DOCINFO ),
243  m_xDocInfoCB->get_active() ) );
244  bModified = true;
245  }
246 
247  if ( m_xBackupCB->get_sensitive() && m_xBackupCB->get_state_changed_from_saved() )
248  {
249  rSet->Put( SfxBoolItem( GetWhich( SID_ATTR_BACKUP ),
250  m_xBackupCB->get_active() ) );
251  bModified = true;
252  }
253 
254  if ( m_xAutoSaveCB->get_state_changed_from_saved() )
255  {
256  rSet->Put( SfxBoolItem( GetWhich( SID_ATTR_AUTOSAVE ),
257  m_xAutoSaveCB->get_active() ) );
258  bModified = true;
259  }
260  if ( m_xWarnAlienFormatCB->get_state_changed_from_saved() )
261  {
262  rSet->Put( SfxBoolItem( GetWhich( SID_ATTR_WARNALIENFORMAT ),
263  m_xWarnAlienFormatCB->get_active() ) );
264  bModified = true;
265  }
266 
267  if ( m_xAutoSaveEdit->get_value_changed_from_saved() )
268  {
269  rSet->Put( SfxUInt16Item( GetWhich( SID_ATTR_AUTOSAVEMINUTE ),
270  static_cast<sal_uInt16>(m_xAutoSaveEdit->get_value()) ) );
271  bModified = true;
272  }
273 
274  if ( m_xUserAutoSaveCB->get_state_changed_from_saved() )
275  {
276  rSet->Put( SfxBoolItem( GetWhich( SID_ATTR_USERAUTOSAVE ),
277  m_xUserAutoSaveCB->get_active() ) );
278  bModified = true;
279  }
280  // save relatively
281  if ( m_xRelativeFsysCB->get_state_changed_from_saved() )
282  {
283  rSet->Put( SfxBoolItem( GetWhich( SID_SAVEREL_FSYS ),
284  m_xRelativeFsysCB->get_active() ) );
285  bModified = true;
286  }
287 
288  if ( m_xRelativeInetCB->get_state_changed_from_saved() )
289  {
290  rSet->Put( SfxBoolItem( GetWhich( SID_SAVEREL_INET ),
291  m_xRelativeInetCB->get_active() ) );
292  bModified = true;
293  }
294 
295  SvtModuleOptions aModuleOpt;
296  if(!pImpl->aDefaultArr[APP_MATH].isEmpty() &&
299 
300  if( !pImpl->aDefaultArr[APP_DRAW].isEmpty() &&
303 
304  if(!pImpl->aDefaultArr[APP_IMPRESS].isEmpty() &&
307 
308  if(!pImpl->aDefaultArr[APP_CALC].isEmpty() &&
311 
312  if(!pImpl->aDefaultArr[APP_WRITER].isEmpty() &&
315 
316  if(!pImpl->aDefaultArr[APP_WRITER_WEB].isEmpty() &&
319 
320  if(!pImpl->aDefaultArr[APP_WRITER_GLOBAL].isEmpty() &&
323 
324  xChanges->commit();
325  return bModified;
326 }
327 
328 static bool isODFFormat( const OUString& sFilter )
329 {
330  static const char* aODFFormats[] =
331  {
332  "writer8",
333  "writer8_template",
334  "writerglobal8",
335  "writerglobal8_writer",
336  "calc8",
337  "calc8_template",
338  "draw8",
339  "draw8_template",
340  "impress8",
341  "impress8_template",
342  "impress8_draw",
343  "chart8",
344  "math8",
345  nullptr
346  };
347 
348  bool bRet = false;
349  int i = 0;
350  while ( aODFFormats[i] != nullptr )
351  {
352  if ( sFilter.equalsAscii( aODFFormats[i++] ) )
353  {
354  bRet = true;
355  break;
356  }
357  }
358 
359  return bRet;
360 }
361 
363 {
364  m_xLoadUserSettingsCB->set_active(officecfg::Office::Common::Load::UserDefinedSettings::get());
365  m_xLoadUserSettingsCB->save_state();
366  m_xLoadUserSettingsCB->set_sensitive(!officecfg::Office::Common::Load::UserDefinedSettings::isReadOnly());
367  m_xLoadDocPrinterCB->set_active( officecfg::Office::Common::Save::Document::LoadPrinter::get() );
368  m_xLoadDocPrinterCB->save_state();
369  m_xLoadDocPrinterCB->set_sensitive(!officecfg::Office::Common::Save::Document::LoadPrinter::isReadOnly());
370 
371  if ( !pImpl->bInitialized )
372  {
373  try
374  {
376  pImpl->xFact.set(xMSF->createInstance("com.sun.star.document.FilterFactory"), UNO_QUERY);
377 
378  DBG_ASSERT(pImpl->xFact.is(), "service com.sun.star.document.FilterFactory unavailable");
379  Reference< XContainerQuery > xQuery(pImpl->xFact, UNO_QUERY);
380  if(xQuery.is())
381  {
382  for (sal_Int32 n = 0, nEntryCount = m_xDocTypeLB->get_count(); n < nEntryCount; ++n)
383  {
384  unsigned int nData = m_xDocTypeLB->get_id(n).toUInt32();
385  OUString sCommand = "getSortedFilterList():module=%1:iflags=" +
386  OUString::number(static_cast<int>(SfxFilterFlags::IMPORT|SfxFilterFlags::EXPORT)) +
387  ":eflags=" +
388  OUString::number(static_cast<int>(SfxFilterFlags::NOTINFILEDLG));
389  OUString sReplace;
390  switch(nData)
391  {
392  case APP_WRITER : sReplace = "com.sun.star.text.TextDocument"; break;
393  case APP_WRITER_WEB : sReplace = "com.sun.star.text.WebDocument"; break;
394  case APP_WRITER_GLOBAL : sReplace = "com.sun.star.text.GlobalDocument"; break;
395  case APP_CALC : sReplace = "com.sun.star.sheet.SpreadsheetDocument";break;
396  case APP_IMPRESS : sReplace = "com.sun.star.presentation.PresentationDocument";break;
397  case APP_DRAW : sReplace = "com.sun.star.drawing.DrawingDocument";break;
398  case APP_MATH : sReplace = "com.sun.star.formula.FormulaProperties";break;
399  default: OSL_FAIL("illegal user data");
400  }
401  sCommand = sCommand.replaceFirst("%1", sReplace);
402  Reference< XEnumeration > xList = xQuery->createSubSetEnumerationByQuery(sCommand);
403  std::vector< OUString > lList;
404  std::vector<bool> lODFList;
405  while(xList->hasMoreElements())
406  {
407  SequenceAsHashMap aFilter(xList->nextElement());
408  OUString sFilter = aFilter.getUnpackedValueOrDefault("Name",OUString());
409  if (!sFilter.isEmpty())
410  {
411  lList.push_back(sFilter);
412  lODFList.push_back( isODFFormat( sFilter ) );
413  }
414  }
415  pImpl->aFilterArr[nData] = lList;
416  pImpl->aODFArr[nData] = lODFList;
417  }
418  }
419  m_xDocTypeLB->set_active(0);
420  FilterHdl_Impl(*m_xDocTypeLB);
421  }
422  catch(Exception const &)
423  {
424  TOOLS_WARN_EXCEPTION( "cui.options", "exception in FilterFactory access" );
425  }
426 
427  pImpl->bInitialized = true;
428  }
429 
430  m_xDocInfoCB->set_active(officecfg::Office::Common::Save::Document::EditProperty::get());
431  m_xDocInfoCB->set_sensitive(!officecfg::Office::Common::Save::Document::EditProperty::isReadOnly());
432 
433  m_xBackupCB->set_active(officecfg::Office::Common::Save::Document::CreateBackup::get());
434  m_xBackupCB->set_sensitive(!officecfg::Office::Common::Save::Document::CreateBackup::isReadOnly());
435 
436  m_xAutoSaveCB->set_active(officecfg::Office::Common::Save::Document::AutoSave::get());
437  m_xAutoSaveCB->set_sensitive(!officecfg::Office::Common::Save::Document::AutoSave::isReadOnly());
438 
439  m_xUserAutoSaveCB->set_active(officecfg::Office::Recovery::AutoSave::UserAutoSaveEnabled::get());
440  m_xUserAutoSaveCB->set_sensitive(!officecfg::Office::Recovery::AutoSave::UserAutoSaveEnabled::isReadOnly());
441 
442  m_xWarnAlienFormatCB->set_active(officecfg::Office::Common::Save::Document::WarnAlienFormat::get());
443  m_xWarnAlienFormatCB->set_sensitive(!officecfg::Office::Common::Save::Document::WarnAlienFormat::isReadOnly());
444 
445  m_xAutoSaveEdit->set_value(officecfg::Office::Common::Save::Document::AutoSaveTimeIntervall::get());
446  m_xAutoSaveEdit->set_sensitive(!officecfg::Office::Common::Save::Document::AutoSaveTimeIntervall::isReadOnly());
447 
448  // save relatively
449  m_xRelativeFsysCB->set_active(officecfg::Office::Common::Save::URL::FileSystem::get());
450  m_xRelativeFsysCB->set_sensitive(!officecfg::Office::Common::Save::URL::FileSystem::isReadOnly());
451 
452  m_xRelativeInetCB->set_active(officecfg::Office::Common::Save::URL::Internet::get());
453  m_xRelativeInetCB->set_sensitive(!officecfg::Office::Common::Save::URL::Internet::isReadOnly());
454 
455  sal_Int32 nDefaultVersion = GetODFDefaultVersion();
456  m_xODFVersionLB->set_active_id(OUString::number(nDefaultVersion));
457  m_xODFVersionLB->set_sensitive(!officecfg::Office::Common::Save::ODF::DefaultVersion::isReadOnly());
458 
459  AutoClickHdl_Impl(*m_xAutoSaveCB);
460  ODFVersionHdl_Impl(*m_xODFVersionLB);
461 
462  m_xDocInfoCB->save_state();
463  m_xBackupCB->save_state();
464  m_xWarnAlienFormatCB->save_state();
465  m_xAutoSaveCB->save_state();
466  m_xAutoSaveEdit->save_value();
467 
468  m_xUserAutoSaveCB->save_state();
469 
470  m_xRelativeFsysCB->save_state();
471  m_xRelativeInetCB->save_state();
472  m_xODFVersionLB->save_value();
473 }
474 
475 IMPL_LINK(SvxSaveTabPage, AutoClickHdl_Impl, weld::Toggleable&, rBox, void)
476 {
477  if (&rBox != m_xAutoSaveCB.get())
478  return;
479 
480  if (m_xAutoSaveCB->get_active())
481  {
482  m_xAutoSaveEdit->set_sensitive(true);
483  m_xMinuteFT->set_sensitive(true);
484  m_xUserAutoSaveCB->set_sensitive(true);
485  }
486  else
487  {
488  m_xAutoSaveEdit->set_sensitive(false);
489  m_xMinuteFT->set_sensitive(false);
490  m_xUserAutoSaveCB->set_sensitive(false);
491  }
492 }
493 
494 static OUString lcl_ExtracUIName(const Sequence<PropertyValue> &rProperties, std::u16string_view rExtension)
495 {
496  OUString sName;
497  const PropertyValue* pPropVal = rProperties.getConstArray();
498  const PropertyValue* const pEnd = pPropVal + rProperties.getLength();
499  for( ; pPropVal != pEnd; pPropVal++ )
500  {
501  const OUString &rName = pPropVal->Name;
502  if (rName == "UIName")
503  {
504  OUString sUIName;
505  if ( ( pPropVal->Value >>= sUIName ) && sUIName.getLength() )
506  {
507  if (!rExtension.empty())
508  {
509  return sUIName + " (" + rExtension + ")";
510  }
511  else
512  {
513  return sUIName;
514  }
515  }
516  }
517  else if (rName == "Name")
518  {
519  pPropVal->Value >>= sName;
520  }
521  }
522 
523  OSL_ENSURE( false, "Filter without UIName!" );
524 
525  return sName;
526 }
527 
528 IMPL_LINK( SvxSaveTabPage, FilterHdl_Impl, weld::ComboBox&, rBox, void )
529 {
530  const int nCurPos = m_xDocTypeLB->get_active();
531 
532  int nData = -1;
533  if (nCurPos < APP_COUNT)
534  nData = m_xDocTypeLB->get_id(nCurPos).toInt32();
535 
536  if ( nData >= 0 && nData < APP_COUNT )
537  {
538  if(m_xDocTypeLB.get() == &rBox)
539  {
540  m_xSaveAsLB->clear();
541  auto & rFilters = pImpl->aFilterArr[nData];
542  if(pImpl->aUIFilterArr[nData].empty())
543  {
544  pImpl->aUIFilterArr[nData].resize(pImpl->aFilterArr[nData].size());
545  auto & rUIFilters = pImpl->aUIFilterArr[nData];
546  for(size_t nFilter = 0; nFilter < pImpl->aFilterArr[nData].size(); nFilter++)
547  {
548  Any aProps = pImpl->xFact->getByName(rFilters[nFilter]);
549  // get the extension of the filter
550  OUString extension;
551  SfxFilterMatcher matcher;
552  std::shared_ptr<const SfxFilter> pFilter = matcher.GetFilter4FilterName(rFilters[nFilter]);
553  if (pFilter)
554  {
555  extension = pFilter->GetWildcard().getGlob().getToken(0, ';');
556  }
558  aProps >>= aProperties;
559  rUIFilters[nFilter] = lcl_ExtracUIName(aProperties, extension);
560  }
561  }
562  auto const & rUIFilters = pImpl->aUIFilterArr[nData];
563  OUString sSelect;
564  for(size_t i = 0; i < pImpl->aUIFilterArr[nData].size(); i++)
565  {
566  OUString sId;
567  if (pImpl->aODFArr[nData][i])
568  sId = OUString::number(reinterpret_cast<sal_Int64>(pImpl.get()));
569  m_xSaveAsLB->append(sId, rUIFilters[i]);
570  if (rFilters[i] == pImpl->aDefaultArr[nData])
571  sSelect = rUIFilters[i];
572  }
573  if (!sSelect.isEmpty())
574  {
575  m_xSaveAsLB->set_active_text(sSelect);
576  }
577 
578  m_xSaveAsFT->set_sensitive(!pImpl->aDefaultReadonlyArr[nData]);
579  m_xSaveAsLB->set_sensitive(!pImpl->aDefaultReadonlyArr[nData]);
580  }
581  else
582  {
583  OUString sSelect = rBox.get_active_text();
584  auto const & rFilters = pImpl->aFilterArr[nData];
585  auto const & rUIFilters = pImpl->aUIFilterArr[nData];
586  for(size_t i = 0; i < pImpl->aUIFilterArr[nData].size(); i++)
587  if(rUIFilters[i] == sSelect)
588  {
589  sSelect = rFilters[i];
590  break;
591  }
592 
593  pImpl->aDefaultArr[nData] = sSelect;
594  }
595  }
596 
597  ODFVersionHdl_Impl( *m_xSaveAsLB );
598 }
599 
600 IMPL_LINK_NOARG(SvxSaveTabPage, ODFVersionHdl_Impl, weld::ComboBox&, void)
601 {
602  sal_Int32 nVersion = m_xODFVersionLB->get_active_id().toInt32();
604  if ( bShown )
605  {
606  bool bHasODFFormat = false;
607  const int nCount = m_xSaveAsLB->get_count();
608  for (int i = 0; i < nCount; ++i )
609  {
610  if ( m_xSaveAsLB->get_id(i).toInt64() != 0 )
611  {
612  bHasODFFormat = true;
613  break;
614  }
615  }
616 
617  bShown = !bHasODFFormat
618  || ( m_xSaveAsLB->get_active_id().toInt64() != 0);
619  }
620 
621  m_xODFWarningFI->set_visible(bShown);
622  m_xODFWarningFT->set_visible(bShown);
623 }
624 
625 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
#define APP_COUNT
Definition: optsave.hxx:31
static OUString lcl_ExtracUIName(const Sequence< PropertyValue > &rProperties, std::u16string_view rExtension)
Definition: optsave.cxx:494
void DetectHiddenControls()
Definition: optsave.cxx:198
std::unique_ptr< weld::CheckButton > m_xBackupCB
Definition: optsave.hxx:47
#define APP_MATH
Definition: optsave.hxx:30
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *rAttrSet)
Definition: optsave.cxx:192
IMPL_LINK(SvxSaveTabPage, AutoClickHdl_Impl, weld::Toggleable &, rBox, void)
Definition: optsave.cxx:475
bool IsModuleInstalled(EModule eModule) const
bool IsDefaultFilterReadonly(EFactory eFactory) const
void SetFactoryDefaultFilter(EFactory eFactory, const OUString &sFilter)
sal_Int64 n
#define APP_CALC
Definition: optsave.hxx:27
std::unique_ptr< weld::ComboBox > m_xODFVersionLB
Definition: optsave.hxx:54
std::unique_ptr< weld::ComboBox > m_xDocTypeLB
Definition: optsave.hxx:56
std::unique_ptr< weld::CheckButton > m_xRelativeInetCB
Definition: optsave.hxx:53
static bool isODFFormat(const OUString &sFilter)
Definition: optsave.cxx:328
PropertiesInfo aProperties
std::unique_ptr< weld::SpinButton > m_xAutoSaveEdit
Definition: optsave.hxx:49
int nCount
std::unique_ptr< SvxSaveTabPage_Impl > pImpl
Definition: optsave.hxx:42
static std::shared_ptr< ConfigurationChanges > create(css::uno::Reference< css::uno::XComponentContext > const &context=comphelper::getProcessComponentContext())
std::unique_ptr< weld::CheckButton > m_xDocInfoCB
Definition: optsave.hxx:46
void SetODFDefaultVersion(SvtSaveOptions::ODFDefaultVersion eVersion, const std::shared_ptr< comphelper::ConfigurationChanges > &xChanges)
const char * sName
SvtSaveOptions::ODFDefaultVersion GetODFDefaultVersion()
std::unique_ptr< weld::CheckButton > m_xLoadDocPrinterCB
Definition: optsave.hxx:45
std::unique_ptr< weld::Label > m_xMinuteFT
Definition: optsave.hxx:50
TValueType getUnpackedValueOrDefault(const OUString &sKey, const TValueType &aDefault) const
#define TOOLS_WARN_EXCEPTION(area, stream)
#define DBG_ASSERT(sCon, aError)
int i
std::unique_ptr< weld::CheckButton > m_xAutoSaveCB
Definition: optsave.hxx:48
#define APP_WRITER_GLOBAL
Definition: optsave.hxx:26
float u
std::unique_ptr< weld::ComboBox > m_xSaveAsLB
Definition: optsave.hxx:58
#define APP_WRITER_WEB
Definition: optsave.hxx:25
sal_Int16 nVersion
IMPL_LINK_NOARG(SvxSaveTabPage, ODFVersionHdl_Impl, weld::ComboBox &, void)
Definition: optsave.cxx:600
std::unique_ptr< weld::CheckButton > m_xRelativeFsysCB
Definition: optsave.hxx:52
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
Reference< XMultiServiceFactory > getProcessServiceFactory()
bool IsOptionHidden(std::u16string_view _rOption, std::u16string_view _rPage, std::u16string_view _rGroup) const
std::shared_ptr< const SfxFilter > GetFilter4FilterName(const OUString &rName, SfxFilterFlags nMust=SfxFilterFlags::NONE, SfxFilterFlags nDont=SFX_FILTER_NOTINSTALLED) const
OUString GetFactoryDefaultFilter(EFactory eFactory) const
virtual void Reset(const SfxItemSet *rSet) override
Definition: optsave.cxx:362
virtual bool FillItemSet(SfxItemSet *rSet) override
Definition: optsave.cxx:224
#define APP_DRAW
Definition: optsave.hxx:29
Reference< XNameContainer > xFact
Definition: optsave.cxx:58
#define APP_IMPRESS
Definition: optsave.hxx:28
#define CFG_PAGE_AND_GROUP
Definition: optsave.cxx:53
std::unique_ptr< weld::CheckButton > m_xWarnAlienFormatCB
Definition: optsave.hxx:55
std::unique_ptr< weld::CheckButton > m_xLoadUserSettingsCB
Definition: optsave.hxx:44
virtual ~SvxSaveTabPage() override
Definition: optsave.cxx:188
SvxSaveTabPage(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet &rSet)
Definition: optsave.cxx:75
sal_uInt16 GetWhich(sal_uInt16 nSlot, bool bDeep=true) const
#define APP_WRITER
Definition: optsave.hxx:24
std::unique_ptr< weld::CheckButton > m_xUserAutoSaveCB
Definition: optsave.hxx:51
OUString sId