1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #include <sal/config.h>
22 #include <sal/log.hxx>
23 #include <unotools/saveopt.hxx>
24 #include <rtl/instance.hxx>
25 #include <unotools/configmgr.hxx>
26 #include <unotools/configitem.hxx>
27 #include <tools/debug.hxx>
28 #include <com/sun/star/uno/Any.hxx>
29 #include <com/sun/star/uno/Sequence.hxx>
31 #include <osl/diagnose.h>
32 #include <osl/mutex.hxx>
33 #include <officecfg/Office/Recovery.hxx>
36 using namespace com::sun::star::uno
;
40 class SvtSaveOptions_Impl
;
41 class SvtLoadOptions_Impl
;
45 #define CFG_READONLY_DEFAULT false
47 struct SvtLoadSaveOptions_Impl
49 std::unique_ptr
<SvtSaveOptions_Impl
> pSaveOpt
;
50 std::unique_ptr
<SvtLoadOptions_Impl
> pLoadOpt
;
53 static std::unique_ptr
<SvtLoadSaveOptions_Impl
> pOptions
;
54 static sal_Int32 nRefCount
= 0;
58 class SvtSaveOptions_Impl
: public utl::ConfigItem
60 sal_Int32 nAutoSaveTime
;
75 SvtSaveOptions::ODFDefaultVersion eODFDefaultVersion
;
93 virtual void ImplCommit() override
;
96 SvtSaveOptions_Impl();
98 virtual void Notify( const css::uno::Sequence
< OUString
>& aPropertyNames
) override
;
100 sal_Int32
GetAutoSaveTime() const { return nAutoSaveTime
; }
101 bool IsUseUserData() const { return bUseUserData
; }
102 bool IsBackup() const { return bBackup
; }
103 bool IsAutoSave() const { return bAutoSave
; }
104 bool IsAutoSavePrompt() const { return bAutoSavePrompt
; }
105 bool IsUserAutoSave() const { return bUserAutoSave
; }
106 bool IsDocInfoSave() const { return bDocInfSave
; }
107 bool IsSaveWorkingSet() const { return bSaveWorkingSet
; }
108 bool IsSaveDocView() const { return bSaveDocView
; }
109 bool IsSaveRelINet() const { return bSaveRelINet
; }
110 bool IsSaveRelFSys() const { return bSaveRelFSys
; }
111 bool IsPrettyPrintingEnabled( ) const { return bDoPrettyPrinting
; }
112 bool IsWarnAlienFormat() const { return bWarnAlienFormat
; }
113 bool IsLoadDocPrinter() const { return bLoadDocPrinter
; }
115 SvtSaveOptions::ODFDefaultVersion
116 GetODFDefaultVersion() const { return eODFDefaultVersion
; }
118 void SetAutoSaveTime( sal_Int32 n
);
119 void SetUseUserData( bool b
);
120 void SetBackup( bool b
);
121 void SetAutoSave( bool b
);
122 void SetAutoSavePrompt( bool b
);
123 void SetUserAutoSave( bool b
);
124 void SetDocInfoSave( bool b
);
125 void SetSaveWorkingSet( bool b
);
126 void SetSaveDocView( bool b
);
127 void SetSaveRelINet( bool b
);
128 void SetSaveRelFSys( bool b
);
129 void EnablePrettyPrinting( bool _bDoPP
);
130 void SetWarnAlienFormat( bool _bDoPP
);
131 void SetLoadDocPrinter( bool bNew
);
132 void SetODFDefaultVersion( SvtSaveOptions::ODFDefaultVersion eNew
);
134 bool IsReadOnly( SvtSaveOptions::EOption eOption
) const;
139 void SvtSaveOptions_Impl::SetAutoSaveTime( sal_Int32 n
)
141 if (!bROAutoSaveTime
&& nAutoSaveTime
!=n
)
149 void SvtSaveOptions_Impl::SetUseUserData( bool b
)
151 if (!bROUseUserData
&& bUseUserData
!=b
)
158 void SvtSaveOptions_Impl::SetBackup( bool b
)
160 if (!bROBackup
&& bBackup
!=b
)
167 void SvtSaveOptions_Impl::SetAutoSave( bool b
)
169 if (!bROAutoSave
&& bAutoSave
!=b
)
177 void SvtSaveOptions_Impl::SetAutoSavePrompt( bool b
)
179 if (!bROAutoSavePrompt
&& bAutoSavePrompt
!=b
)
186 void SvtSaveOptions_Impl::SetUserAutoSave( bool b
)
188 if (!bROUserAutoSave
&& bUserAutoSave
!=b
)
196 void SvtSaveOptions_Impl::SetDocInfoSave(bool b
)
198 if (!bRODocInfSave
&& bDocInfSave
!=b
)
205 void SvtSaveOptions_Impl::SetSaveWorkingSet( bool b
)
207 if (!bROSaveWorkingSet
&& bSaveWorkingSet
!=b
)
214 void SvtSaveOptions_Impl::SetSaveDocView( bool b
)
216 if (!bROSaveDocView
&& bSaveDocView
!=b
)
223 void SvtSaveOptions_Impl::SetSaveRelINet( bool b
)
225 if (!bROSaveRelINet
&& bSaveRelINet
!=b
)
232 void SvtSaveOptions_Impl::SetSaveRelFSys( bool b
)
234 if (!bROSaveRelFSys
&& bSaveRelFSys
!=b
)
241 void SvtSaveOptions_Impl::EnablePrettyPrinting( bool _bDoPP
)
243 if (!bRODoPrettyPrinting
&& bDoPrettyPrinting
!=_bDoPP
)
245 bDoPrettyPrinting
= _bDoPP
;
250 void SvtSaveOptions_Impl::SetWarnAlienFormat( bool _bDoPP
)
252 if (!bROWarnAlienFormat
&& bWarnAlienFormat
!=_bDoPP
)
254 bWarnAlienFormat
= _bDoPP
;
259 void SvtSaveOptions_Impl::SetLoadDocPrinter( bool bNew
)
261 if ( !bROLoadDocPrinter
&& bLoadDocPrinter
!= bNew
)
263 bLoadDocPrinter
= bNew
;
268 void SvtSaveOptions_Impl::SetODFDefaultVersion( SvtSaveOptions::ODFDefaultVersion eNew
)
270 if ( !bROODFDefaultVersion
&& eODFDefaultVersion
!= eNew
)
272 eODFDefaultVersion
= eNew
;
277 bool SvtSaveOptions_Impl::IsReadOnly( SvtSaveOptions::EOption eOption
) const
279 bool bReadOnly
= CFG_READONLY_DEFAULT
;
282 case SvtSaveOptions::EOption::AutoSaveTime
:
283 bReadOnly
= bROAutoSaveTime
;
285 case SvtSaveOptions::EOption::UseUserData
:
286 bReadOnly
= bROUseUserData
;
288 case SvtSaveOptions::EOption::Backup
:
289 bReadOnly
= bROBackup
;
291 case SvtSaveOptions::EOption::AutoSave
:
292 bReadOnly
= bROAutoSave
;
294 case SvtSaveOptions::EOption::AutoSavePrompt
:
295 bReadOnly
= bROAutoSavePrompt
;
297 case SvtSaveOptions::EOption::UserAutoSave
:
298 bReadOnly
= bROUserAutoSave
;
300 case SvtSaveOptions::EOption::DocInfSave
:
301 bReadOnly
= bRODocInfSave
;
303 case SvtSaveOptions::EOption::SaveWorkingSet
:
304 bReadOnly
= bROSaveWorkingSet
;
306 case SvtSaveOptions::EOption::SaveDocView
:
307 bReadOnly
= bROSaveDocView
;
309 case SvtSaveOptions::EOption::SaveRelInet
:
310 bReadOnly
= bROSaveRelINet
;
312 case SvtSaveOptions::EOption::SaveRelFsys
:
313 bReadOnly
= bROSaveRelFSys
;
315 case SvtSaveOptions::EOption::DoPrettyPrinting
:
316 bReadOnly
= bRODoPrettyPrinting
;
318 case SvtSaveOptions::EOption::WarnAlienFormat
:
319 bReadOnly
= bROWarnAlienFormat
;
321 case SvtSaveOptions::EOption::LoadDocPrinter
:
322 bReadOnly
= bROLoadDocPrinter
;
324 case SvtSaveOptions::EOption::OdfDefaultVersion
:
325 bReadOnly
= bROODFDefaultVersion
;
332 #define TIMEINTERVALL 1
333 #define USEUSERDATA 2
334 #define CREATEBACKUP 3
337 #define EDITPROPERTY 6
338 #define SAVEVIEWINFO 7
339 #define PRETTYPRINTING 8
340 #define WARNALIENFORMAT 9
341 #define LOADDOCPRINTER 10
342 #define FILESYSTEM 11
344 #define SAVEWORKINGSET 13
345 #define ODFDEFAULTVERSION 14
347 static Sequence
< OUString
> GetPropertyNames()
349 static const char* aPropNames
[] =
352 "Document/AutoSaveTimeIntervall",
353 "Document/UseUserData",
354 "Document/CreateBackup",
356 "Document/AutoSavePrompt",
357 "Document/EditProperty",
359 "Document/PrettyPrinting",
360 "Document/WarnAlienFormat",
361 "Document/LoadPrinter",
368 const int nCount
= SAL_N_ELEMENTS( aPropNames
);
369 Sequence
< OUString
> aNames( nCount
);
370 OUString
* pNames
= aNames
.getArray();
371 for ( int i
= 0; i
< nCount
; i
++ )
372 pNames
[i
] = OUString::createFromAscii( aPropNames
[i
] );
377 SvtSaveOptions_Impl::SvtSaveOptions_Impl()
378 : ConfigItem( "Office.Common/Save" )
380 , bUseUserData( false )
383 , bAutoSavePrompt( false )
384 , bUserAutoSave( false )
385 , bDocInfSave( false )
386 , bSaveWorkingSet( false )
387 , bSaveDocView( false )
388 , bSaveRelINet( false )
389 , bSaveRelFSys( false )
390 , bDoPrettyPrinting( false )
391 , bWarnAlienFormat( true )
392 , bLoadDocPrinter( true )
393 , eODFDefaultVersion( SvtSaveOptions::ODFVER_LATEST
)
394 , bROAutoSaveTime( CFG_READONLY_DEFAULT
)
395 , bROUseUserData( CFG_READONLY_DEFAULT
)
396 , bROBackup( CFG_READONLY_DEFAULT
)
397 , bROAutoSave( CFG_READONLY_DEFAULT
)
398 , bROAutoSavePrompt( CFG_READONLY_DEFAULT
)
399 , bROUserAutoSave( CFG_READONLY_DEFAULT
)
400 , bRODocInfSave( CFG_READONLY_DEFAULT
)
401 , bROSaveWorkingSet( CFG_READONLY_DEFAULT
)
402 , bROSaveDocView( CFG_READONLY_DEFAULT
)
403 , bROSaveRelINet( CFG_READONLY_DEFAULT
)
404 , bROSaveRelFSys( CFG_READONLY_DEFAULT
)
405 , bROWarnAlienFormat( CFG_READONLY_DEFAULT
)
406 , bRODoPrettyPrinting( CFG_READONLY_DEFAULT
)
407 , bROLoadDocPrinter( CFG_READONLY_DEFAULT
)
408 , bROODFDefaultVersion( CFG_READONLY_DEFAULT
)
410 Sequence
< OUString
> aNames
= GetPropertyNames();
411 Sequence
< Any
> aValues
= GetProperties( aNames
);
412 Sequence
< sal_Bool
> aROStates
= GetReadOnlyStates( aNames
);
413 EnableNotification( aNames
);
414 const Any
* pValues
= aValues
.getConstArray();
415 const sal_Bool
* pROStates
= aROStates
.getConstArray();
416 DBG_ASSERT( aValues
.getLength() == aNames
.getLength(), "GetProperties failed" );
417 DBG_ASSERT( aROStates
.getLength() == aNames
.getLength(), "GetReadOnlyStates failed" );
418 if ( aValues
.getLength() == aNames
.getLength() && aROStates
.getLength() == aNames
.getLength() )
420 for ( int nProp
= 0; nProp
< aNames
.getLength(); nProp
++ )
422 if ( pValues
[nProp
].hasValue() )
428 // not supported anymore
432 if ( pValues
[nProp
] >>= nTemp
)
433 nAutoSaveTime
= nTemp
;
435 OSL_FAIL( "Wrong Type!" );
437 bROAutoSaveTime
= pROStates
[nProp
];
440 case ODFDEFAULTVERSION
:
443 if ( pValues
[nProp
] >>= nTmp
)
446 eODFDefaultVersion
= SvtSaveOptions::ODFVER_LATEST
;
448 eODFDefaultVersion
= SvtSaveOptions::ODFDefaultVersion( nTmp
);
451 SAL_WARN( "unotools.config", "SvtSaveOptions_Impl::SvtSaveOptions_Impl(): Wrong Type!" );
453 bROODFDefaultVersion
= pROStates
[nProp
];
460 if ( pValues
[nProp
] >>= bTemp
)
465 bUseUserData
= bTemp
;
466 bROUseUserData
= pROStates
[nProp
];
470 bROBackup
= pROStates
[nProp
];
474 bROAutoSave
= pROStates
[nProp
];
477 bAutoSavePrompt
= bTemp
;
478 bROAutoSavePrompt
= pROStates
[nProp
];
482 bRODocInfSave
= pROStates
[nProp
];
484 case SAVEWORKINGSET
:
485 bSaveWorkingSet
= bTemp
;
486 bROSaveWorkingSet
= pROStates
[nProp
];
489 bSaveDocView
= bTemp
;
490 bROSaveDocView
= pROStates
[nProp
];
493 bSaveRelFSys
= bTemp
;
494 bROSaveRelFSys
= pROStates
[nProp
];
497 bSaveRelINet
= bTemp
;
498 bROSaveRelINet
= pROStates
[nProp
];
502 bDoPrettyPrinting
= bTemp
;
503 bRODoPrettyPrinting
= pROStates
[nProp
];
506 case WARNALIENFORMAT
:
507 bWarnAlienFormat
= bTemp
;
508 bROWarnAlienFormat
= pROStates
[nProp
];
512 bLoadDocPrinter
= bTemp
;
513 bROLoadDocPrinter
= pROStates
[nProp
];
517 SAL_WARN( "unotools.config", "invalid index to load a path" );
522 OSL_FAIL( "Wrong Type!" );
530 if (!utl::ConfigManager::IsFuzzing())
532 bAutoSave
= officecfg::Office::Recovery::AutoSave::Enabled::get();
533 nAutoSaveTime
= officecfg::Office::Recovery::AutoSave::TimeIntervall::get();
534 bUserAutoSave
= officecfg::Office::Recovery::AutoSave::UserAutoSaveEnabled::get();
540 bUserAutoSave
= false;
544 void SvtSaveOptions_Impl::ImplCommit()
546 Sequence
< OUString
> aOrgNames
= GetPropertyNames();
547 OUString
* pOrgNames
= aOrgNames
.getArray();
548 sal_Int32 nOrgCount
= aOrgNames
.getLength();
550 Sequence
< OUString
> aNames( nOrgCount
);
551 Sequence
< Any
> aValues( nOrgCount
);
552 OUString
* pNames
= aNames
.getArray();
553 Any
* pValues
= aValues
.getArray();
554 sal_Int32 nRealCount
= 0;
556 for (sal_Int32 i
=0; i
<nOrgCount
; ++i
)
561 // not supported anymore
564 if (!bROAutoSaveTime
)
566 pValues
[nRealCount
] <<= nAutoSaveTime
;
567 pNames
[nRealCount
] = pOrgNames
[i
];
574 pValues
[nRealCount
] <<= bUseUserData
;
575 pNames
[nRealCount
] = pOrgNames
[i
];
582 pValues
[nRealCount
] <<= bBackup
;
583 pNames
[nRealCount
] = pOrgNames
[i
];
590 pValues
[nRealCount
] <<= bAutoSave
;
591 pNames
[nRealCount
] = pOrgNames
[i
];
596 if (!bROAutoSavePrompt
)
598 pValues
[nRealCount
] <<= bAutoSavePrompt
;
599 pNames
[nRealCount
] = pOrgNames
[i
];
606 pValues
[nRealCount
] <<= bDocInfSave
;
607 pNames
[nRealCount
] = pOrgNames
[i
];
611 case SAVEWORKINGSET
:
612 if (!bROSaveWorkingSet
)
614 pValues
[nRealCount
] <<= bSaveWorkingSet
;
615 pNames
[nRealCount
] = pOrgNames
[i
];
622 pValues
[nRealCount
] <<= bSaveDocView
;
623 pNames
[nRealCount
] = pOrgNames
[i
];
630 pValues
[nRealCount
] <<= bSaveRelFSys
;
631 pNames
[nRealCount
] = pOrgNames
[i
];
638 pValues
[nRealCount
] <<= bSaveRelINet
;
639 pNames
[nRealCount
] = pOrgNames
[i
];
644 if (!bRODoPrettyPrinting
)
646 pValues
[nRealCount
] <<= bDoPrettyPrinting
;
647 pNames
[nRealCount
] = pOrgNames
[i
];
651 case WARNALIENFORMAT
:
652 if (!bROWarnAlienFormat
)
654 pValues
[nRealCount
] <<= bWarnAlienFormat
;
655 pNames
[nRealCount
] = pOrgNames
[i
];
660 if (!bROLoadDocPrinter
)
662 pValues
[nRealCount
] <<= bLoadDocPrinter
;
663 pNames
[nRealCount
] = pOrgNames
[i
];
667 case ODFDEFAULTVERSION
:
668 if (!bROODFDefaultVersion
)
670 pValues
[nRealCount
] <<= (eODFDefaultVersion
== SvtSaveOptions::ODFVER_LATEST
) ? sal_Int16( 3 ) : sal_Int16( eODFDefaultVersion
);
671 pNames
[nRealCount
] = pOrgNames
[i
];
677 SAL_WARN( "unotools.config", "invalid index to save a path" );
681 aNames
.realloc(nRealCount
);
682 aValues
.realloc(nRealCount
);
683 PutProperties( aNames
, aValues
);
685 std::shared_ptr
< comphelper::ConfigurationChanges
> batch(
686 comphelper::ConfigurationChanges::create());
687 officecfg::Office::Recovery::AutoSave::TimeIntervall::set(nAutoSaveTime
, batch
);
688 officecfg::Office::Recovery::AutoSave::Enabled::set(bAutoSave
, batch
);
689 officecfg::Office::Recovery::AutoSave::UserAutoSaveEnabled::set(bUserAutoSave
, batch
);
693 void SvtSaveOptions_Impl::Notify( const Sequence
<OUString
>& )
699 class SvtLoadOptions_Impl
: public utl::ConfigItem
702 bool bLoadUserDefinedSettings
;
704 virtual void ImplCommit() override
;
707 SvtLoadOptions_Impl();
709 virtual void Notify( const css::uno::Sequence
< OUString
>& aPropertyNames
) override
;
711 void SetLoadUserSettings(bool b
){bLoadUserDefinedSettings
= b
; SetModified();}
712 bool IsLoadUserSettings() const {return bLoadUserDefinedSettings
;}
717 const char cUserDefinedSettings
[] = "UserDefinedSettings";
719 SvtLoadOptions_Impl::SvtLoadOptions_Impl()
720 : ConfigItem( "Office.Common/Load" )
721 , bLoadUserDefinedSettings( false )
723 Sequence
< OUString
> aNames
{ cUserDefinedSettings
};
724 Sequence
< Any
> aValues
= GetProperties( aNames
);
725 EnableNotification( aNames
);
726 const Any
* pValues
= aValues
.getConstArray();
727 DBG_ASSERT( aValues
.getLength() == aNames
.getLength(), "GetProperties failed" );
728 pValues
[0] >>= bLoadUserDefinedSettings
;
731 void SvtLoadOptions_Impl::ImplCommit()
734 {cUserDefinedSettings
}, {css::uno::Any(bLoadUserDefinedSettings
)});
737 void SvtLoadOptions_Impl::Notify( const Sequence
<OUString
>& )
739 SAL_WARN( "unotools.config", "properties have been changed" );
744 class LocalSingleton
: public rtl::Static
< osl::Mutex
, LocalSingleton
>
749 SvtSaveOptions::SvtSaveOptions()
751 // Global access, must be guarded (multithreading)
752 ::osl::MutexGuard
aGuard( LocalSingleton::get() );
755 pOptions
.reset(new SvtLoadSaveOptions_Impl
);
756 pOptions
->pSaveOpt
.reset(new SvtSaveOptions_Impl
);
757 pOptions
->pLoadOpt
.reset( new SvtLoadOptions_Impl
);
760 pImp
= pOptions
.get();
763 SvtSaveOptions::~SvtSaveOptions()
765 // Global access, must be guarded (multithreading)
766 ::osl::MutexGuard
aGuard( LocalSingleton::get() );
769 if ( pOptions
->pSaveOpt
->IsModified() )
770 pOptions
->pSaveOpt
->Commit();
771 if ( pOptions
->pLoadOpt
->IsModified() )
772 pOptions
->pLoadOpt
->Commit();
778 void SvtSaveOptions::SetAutoSaveTime( sal_Int32 n
)
780 pImp
->pSaveOpt
->SetAutoSaveTime( n
);
783 sal_Int32
SvtSaveOptions::GetAutoSaveTime() const
785 return pImp
->pSaveOpt
->GetAutoSaveTime();
788 void SvtSaveOptions::SetUseUserData( bool b
)
790 pImp
->pSaveOpt
->SetUseUserData( b
);
793 bool SvtSaveOptions::IsUseUserData() const
795 return pImp
->pSaveOpt
->IsUseUserData();
798 void SvtSaveOptions::SetBackup( bool b
)
800 pImp
->pSaveOpt
->SetBackup( b
);
803 bool SvtSaveOptions::IsBackup() const
805 return pImp
->pSaveOpt
->IsBackup();
808 void SvtSaveOptions::SetAutoSave( bool b
)
810 pImp
->pSaveOpt
->SetAutoSave( b
);
813 bool SvtSaveOptions::IsAutoSave() const
815 return pImp
->pSaveOpt
->IsAutoSave();
818 void SvtSaveOptions::SetAutoSavePrompt( bool b
)
820 pImp
->pSaveOpt
->SetAutoSavePrompt( b
);
823 bool SvtSaveOptions::IsAutoSavePrompt() const
825 return pImp
->pSaveOpt
->IsAutoSavePrompt();
828 void SvtSaveOptions::SetUserAutoSave( bool b
)
830 pImp
->pSaveOpt
->SetUserAutoSave( b
);
833 bool SvtSaveOptions::IsUserAutoSave() const
835 return pImp
->pSaveOpt
->IsUserAutoSave();
838 void SvtSaveOptions::SetDocInfoSave(bool b
)
840 pImp
->pSaveOpt
->SetDocInfoSave( b
);
843 bool SvtSaveOptions::IsDocInfoSave() const
845 return pImp
->pSaveOpt
->IsDocInfoSave();
848 void SvtSaveOptions::SetSaveWorkingSet( bool b
)
850 pImp
->pSaveOpt
->SetSaveWorkingSet( b
);
853 bool SvtSaveOptions::IsSaveWorkingSet() const
855 return pImp
->pSaveOpt
->IsSaveWorkingSet();
858 void SvtSaveOptions::SetSaveDocView( bool b
)
860 pImp
->pSaveOpt
->SetSaveDocView( b
);
863 bool SvtSaveOptions::IsSaveDocView() const
865 return pImp
->pSaveOpt
->IsSaveDocView();
868 void SvtSaveOptions::SetSaveRelINet( bool b
)
870 pImp
->pSaveOpt
->SetSaveRelINet( b
);
873 bool SvtSaveOptions::IsSaveRelINet() const
875 return pImp
->pSaveOpt
->IsSaveRelINet();
878 void SvtSaveOptions::SetSaveRelFSys( bool b
)
880 pImp
->pSaveOpt
->SetSaveRelFSys( b
);
883 bool SvtSaveOptions::IsSaveRelFSys() const
885 return pImp
->pSaveOpt
->IsSaveRelFSys();
888 void SvtSaveOptions::SetLoadUserSettings(bool b
)
890 pImp
->pLoadOpt
->SetLoadUserSettings(b
);
893 bool SvtSaveOptions::IsLoadUserSettings() const
895 return pImp
->pLoadOpt
->IsLoadUserSettings();
898 void SvtSaveOptions::SetPrettyPrinting( bool _bEnable
)
900 pImp
->pSaveOpt
->EnablePrettyPrinting( _bEnable
);
903 bool SvtSaveOptions::IsPrettyPrinting() const
905 return pImp
->pSaveOpt
->IsPrettyPrintingEnabled();
908 void SvtSaveOptions::SetWarnAlienFormat( bool _bEnable
)
910 pImp
->pSaveOpt
->SetWarnAlienFormat( _bEnable
);
913 bool SvtSaveOptions::IsWarnAlienFormat() const
915 return pImp
->pSaveOpt
->IsWarnAlienFormat();
918 void SvtSaveOptions::SetLoadDocumentPrinter( bool _bEnable
)
920 pImp
->pSaveOpt
->SetLoadDocPrinter( _bEnable
);
923 bool SvtSaveOptions::IsLoadDocumentPrinter() const
925 return pImp
->pSaveOpt
->IsLoadDocPrinter();
928 void SvtSaveOptions::SetODFDefaultVersion( SvtSaveOptions::ODFDefaultVersion eVersion
)
930 pImp
->pSaveOpt
->SetODFDefaultVersion( eVersion
);
933 SvtSaveOptions::ODFDefaultVersion
SvtSaveOptions::GetODFDefaultVersion() const
935 auto const nRet
= pImp
->pSaveOpt
->GetODFDefaultVersion();
936 SAL_WARN_IF(nRet
== ODFVER_UNKNOWN
, "unotools.config", "DefaultVersion is ODFVER_UNKNOWN?");
937 return (nRet
== ODFVER_UNKNOWN
) ? ODFVER_LATEST
: nRet
;
940 SvtSaveOptions::ODFSaneDefaultVersion
SvtSaveOptions::GetODFSaneDefaultVersion() const
942 switch (pImp
->pSaveOpt
->GetODFDefaultVersion())
945 assert(!"map new ODFDefaultVersion to ODFSaneDefaultVersion");
949 return ODFSVER_LATEST_EXTENDED
;
956 case ODFVER_012_EXT_COMPAT
:
957 return ODFSVER_012_EXT_COMPAT
;
958 case ODFVER_012_EXTENDED
:
959 return ODFSVER_012_EXTENDED
;
963 return ODFSVER_LATEST_EXTENDED
;
966 bool SvtSaveOptions::IsReadOnly( SvtSaveOptions::EOption eOption
) const
968 return pImp
->pSaveOpt
->IsReadOnly(eOption
);
971 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */