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 <tools/solar.h>
29 #include <com/sun/star/uno/Any.hxx>
30 #include <com/sun/star/uno/Sequence.hxx>
32 #include <osl/diagnose.h>
33 #include <osl/mutex.hxx>
34 #include <comphelper/processfactory.hxx>
35 #include "itemholder1.hxx"
36 #include <officecfg/Office/Recovery.hxx>
39 using namespace com::sun::star::uno
;
41 class SvtSaveOptions_Impl
;
42 class SvtLoadOptions_Impl
;
44 #define CFG_READONLY_DEFAULT false
46 struct SvtLoadSaveOptions_Impl
48 SvtSaveOptions_Impl
* pSaveOpt
;
49 SvtLoadOptions_Impl
* pLoadOpt
;
52 static SvtLoadSaveOptions_Impl
* pOptions
= NULL
;
53 static sal_Int32 nRefCount
= 0;
55 class SvtSaveOptions_Impl
: public utl::ConfigItem
57 sal_Int32 nAutoSaveTime
;
75 SvtSaveOptions::ODFDefaultVersion eODFDefaultVersion
;
94 bROUseBlowfishInODF12
;
96 virtual void ImplCommit() SAL_OVERRIDE
;
99 SvtSaveOptions_Impl();
100 virtual ~SvtSaveOptions_Impl();
102 virtual void Notify( const com::sun::star::uno::Sequence
< OUString
>& aPropertyNames
) SAL_OVERRIDE
;
104 sal_Int32
GetAutoSaveTime() const { return nAutoSaveTime
; }
105 bool IsUseUserData() const { return bUseUserData
; }
106 bool IsBackup() const { return bBackup
; }
107 bool IsAutoSave() const { return bAutoSave
; }
108 bool IsAutoSavePrompt() const { return bAutoSavePrompt
; }
109 bool IsUserAutoSave() const { return bUserAutoSave
; }
110 bool IsDocInfoSave() const { return bDocInfSave
; }
111 bool IsSaveWorkingSet() const { return bSaveWorkingSet
; }
112 bool IsSaveDocView() const { return bSaveDocView
; }
113 bool IsSaveRelINet() const { return bSaveRelINet
; }
114 bool IsSaveRelFSys() const { return bSaveRelFSys
; }
115 bool IsSaveUnpacked() const { return bSaveUnpacked
; }
116 bool IsPrettyPrintingEnabled( ) const { return bDoPrettyPrinting
; }
117 bool IsWarnAlienFormat() const { return bWarnAlienFormat
; }
118 bool IsLoadDocPrinter() const { return bLoadDocPrinter
; }
119 bool IsUseSHA1InODF12() const { return bUseSHA1InODF12
; }
120 bool IsUseBlowfishInODF12() const { return bUseBlowfishInODF12
; }
122 SvtSaveOptions::ODFDefaultVersion
123 GetODFDefaultVersion() const { return eODFDefaultVersion
; }
125 void SetAutoSaveTime( sal_Int32 n
);
126 void SetUseUserData( bool b
);
127 void SetBackup( bool b
);
128 void SetAutoSave( bool b
);
129 void SetAutoSavePrompt( bool b
);
130 void SetUserAutoSave( bool b
);
131 void SetDocInfoSave( bool b
);
132 void SetSaveWorkingSet( bool b
);
133 void SetSaveDocView( bool b
);
134 void SetSaveRelINet( bool b
);
135 void SetSaveRelFSys( bool b
);
136 void EnablePrettyPrinting( bool _bDoPP
);
137 void SetWarnAlienFormat( bool _bDoPP
);
138 void SetLoadDocPrinter( bool bNew
);
139 void SetODFDefaultVersion( SvtSaveOptions::ODFDefaultVersion eNew
);
141 bool IsReadOnly( SvtSaveOptions::EOption eOption
) const;
144 void SvtSaveOptions_Impl::SetAutoSaveTime( sal_Int32 n
)
146 if (!bROAutoSaveTime
&& nAutoSaveTime
!=n
)
154 void SvtSaveOptions_Impl::SetUseUserData( bool b
)
156 if (!bROUseUserData
&& bUseUserData
!=b
)
163 void SvtSaveOptions_Impl::SetBackup( bool b
)
165 if (!bROBackup
&& bBackup
!=b
)
172 void SvtSaveOptions_Impl::SetAutoSave( bool b
)
174 if (!bROAutoSave
&& bAutoSave
!=b
)
182 void SvtSaveOptions_Impl::SetAutoSavePrompt( bool b
)
184 if (!bROAutoSavePrompt
&& bAutoSavePrompt
!=b
)
191 void SvtSaveOptions_Impl::SetUserAutoSave( bool b
)
193 if (!bROUserAutoSave
&& bUserAutoSave
!=b
)
201 void SvtSaveOptions_Impl::SetDocInfoSave(bool b
)
203 if (!bRODocInfSave
&& bDocInfSave
!=b
)
210 void SvtSaveOptions_Impl::SetSaveWorkingSet( bool b
)
212 if (!bROSaveWorkingSet
&& bSaveWorkingSet
!=b
)
219 void SvtSaveOptions_Impl::SetSaveDocView( bool b
)
221 if (!bROSaveDocView
&& bSaveDocView
!=b
)
228 void SvtSaveOptions_Impl::SetSaveRelINet( bool b
)
230 if (!bROSaveRelINet
&& bSaveRelINet
!=b
)
237 void SvtSaveOptions_Impl::SetSaveRelFSys( bool b
)
239 if (!bROSaveRelFSys
&& bSaveRelFSys
!=b
)
246 void SvtSaveOptions_Impl::EnablePrettyPrinting( bool _bDoPP
)
248 if (!bRODoPrettyPrinting
&& bDoPrettyPrinting
!=_bDoPP
)
250 bDoPrettyPrinting
= _bDoPP
;
255 void SvtSaveOptions_Impl::SetWarnAlienFormat( bool _bDoPP
)
257 if (!bROWarnAlienFormat
&& bWarnAlienFormat
!=_bDoPP
)
259 bWarnAlienFormat
= _bDoPP
;
264 void SvtSaveOptions_Impl::SetLoadDocPrinter( bool bNew
)
266 if ( !bROLoadDocPrinter
&& bLoadDocPrinter
!= bNew
)
268 bLoadDocPrinter
= bNew
;
273 void SvtSaveOptions_Impl::SetODFDefaultVersion( SvtSaveOptions::ODFDefaultVersion eNew
)
275 if ( !bROODFDefaultVersion
&& eODFDefaultVersion
!= eNew
)
277 eODFDefaultVersion
= eNew
;
282 bool SvtSaveOptions_Impl::IsReadOnly( SvtSaveOptions::EOption eOption
) const
284 bool bReadOnly
= CFG_READONLY_DEFAULT
;
287 case SvtSaveOptions::E_AUTOSAVETIME
:
288 bReadOnly
= bROAutoSaveTime
;
290 case SvtSaveOptions::E_USEUSERDATA
:
291 bReadOnly
= bROUseUserData
;
293 case SvtSaveOptions::E_BACKUP
:
294 bReadOnly
= bROBackup
;
296 case SvtSaveOptions::E_AUTOSAVE
:
297 bReadOnly
= bROAutoSave
;
299 case SvtSaveOptions::E_AUTOSAVEPROMPT
:
300 bReadOnly
= bROAutoSavePrompt
;
302 case SvtSaveOptions::E_USERAUTOSAVE
:
303 bReadOnly
= bROUserAutoSave
;
305 case SvtSaveOptions::E_DOCINFSAVE
:
306 bReadOnly
= bRODocInfSave
;
308 case SvtSaveOptions::E_SAVEWORKINGSET
:
309 bReadOnly
= bROSaveWorkingSet
;
311 case SvtSaveOptions::E_SAVEDOCVIEW
:
312 bReadOnly
= bROSaveDocView
;
314 case SvtSaveOptions::E_SAVERELINET
:
315 bReadOnly
= bROSaveRelINet
;
317 case SvtSaveOptions::E_SAVERELFSYS
:
318 bReadOnly
= bROSaveRelFSys
;
320 case SvtSaveOptions::E_SAVEUNPACKED
:
321 bReadOnly
= bROSaveUnpacked
;
323 case SvtSaveOptions::E_DOPRETTYPRINTING
:
324 bReadOnly
= bRODoPrettyPrinting
;
326 case SvtSaveOptions::E_WARNALIENFORMAT
:
327 bReadOnly
= bROWarnAlienFormat
;
329 case SvtSaveOptions::E_LOADDOCPRINTER
:
330 bReadOnly
= bROLoadDocPrinter
;
332 case SvtSaveOptions::E_ODFDEFAULTVERSION
:
333 bReadOnly
= bROLoadDocPrinter
;
335 case SvtSaveOptions::E_USESHA1INODF12
:
336 bReadOnly
= bROUseSHA1InODF12
;
338 case SvtSaveOptions::E_USEBLOWFISHINODF12
:
339 bReadOnly
= bROUseBlowfishInODF12
;
346 #define TIMEINTERVALL 1
347 #define USEUSERDATA 2
348 #define CREATEBACKUP 3
351 #define EDITPROPERTY 6
352 #define SAVEVIEWINFO 7
354 #define PRETTYPRINTING 9
355 #define WARNALIENFORMAT 10
356 #define LOADDOCPRINTER 11
357 #define FILESYSTEM 12
359 #define SAVEWORKINGSET 14
360 #define ODFDEFAULTVERSION 15
361 #define USESHA1INODF12 16
362 #define USEBLOWFISHINODF12 17
364 Sequence
< OUString
> GetPropertyNames()
366 static const char* aPropNames
[] =
369 "Document/AutoSaveTimeIntervall",
370 "Document/UseUserData",
371 "Document/CreateBackup",
373 "Document/AutoSavePrompt",
374 "Document/EditProperty",
377 "Document/PrettyPrinting",
378 "Document/WarnAlienFormat",
379 "Document/LoadPrinter",
383 "ODF/DefaultVersion",
384 "ODF/UseSHA1InODF12",
385 "ODF/UseBlowfishInODF12"
388 const int nCount
= sizeof( aPropNames
) / sizeof( const char* );
389 Sequence
< OUString
> aNames( nCount
);
390 OUString
* pNames
= aNames
.getArray();
391 for ( int i
= 0; i
< nCount
; i
++ )
392 pNames
[i
] = OUString::createFromAscii( aPropNames
[i
] );
397 SvtSaveOptions_Impl::SvtSaveOptions_Impl()
398 : ConfigItem( OUString("Office.Common/Save") )
400 , bUseUserData( false )
403 , bAutoSavePrompt( false )
404 , bUserAutoSave( false )
405 , bDocInfSave( false )
406 , bSaveWorkingSet( false )
407 , bSaveDocView( false )
408 , bSaveRelINet( false )
409 , bSaveRelFSys( false )
410 , bSaveUnpacked( false )
411 , bDoPrettyPrinting( false )
412 , bWarnAlienFormat( true )
413 , bLoadDocPrinter( true )
414 , bUseSHA1InODF12( false )
415 , bUseBlowfishInODF12( false )
416 , eODFDefaultVersion( SvtSaveOptions::ODFVER_LATEST
)
417 , bROAutoSaveTime( CFG_READONLY_DEFAULT
)
418 , bROUseUserData( CFG_READONLY_DEFAULT
)
419 , bROBackup( CFG_READONLY_DEFAULT
)
420 , bROAutoSave( CFG_READONLY_DEFAULT
)
421 , bROAutoSavePrompt( CFG_READONLY_DEFAULT
)
422 , bROUserAutoSave( CFG_READONLY_DEFAULT
)
423 , bRODocInfSave( CFG_READONLY_DEFAULT
)
424 , bROSaveWorkingSet( CFG_READONLY_DEFAULT
)
425 , bROSaveDocView( CFG_READONLY_DEFAULT
)
426 , bROSaveRelINet( CFG_READONLY_DEFAULT
)
427 , bROSaveRelFSys( CFG_READONLY_DEFAULT
)
428 , bROSaveUnpacked( CFG_READONLY_DEFAULT
)
429 , bROWarnAlienFormat( CFG_READONLY_DEFAULT
)
430 , bRODoPrettyPrinting( CFG_READONLY_DEFAULT
)
431 , bROLoadDocPrinter( CFG_READONLY_DEFAULT
)
432 , bROODFDefaultVersion( CFG_READONLY_DEFAULT
)
433 , bROUseSHA1InODF12( CFG_READONLY_DEFAULT
)
434 , bROUseBlowfishInODF12( CFG_READONLY_DEFAULT
)
436 Sequence
< OUString
> aNames
= GetPropertyNames();
437 Sequence
< Any
> aValues
= GetProperties( aNames
);
438 Sequence
< sal_Bool
> aROStates
= GetReadOnlyStates( aNames
);
439 EnableNotification( aNames
);
440 const Any
* pValues
= aValues
.getConstArray();
441 const sal_Bool
* pROStates
= aROStates
.getConstArray();
442 DBG_ASSERT( aValues
.getLength() == aNames
.getLength(), "GetProperties failed" );
443 DBG_ASSERT( aROStates
.getLength() == aNames
.getLength(), "GetReadOnlyStates failed" );
444 if ( aValues
.getLength() == aNames
.getLength() && aROStates
.getLength() == aNames
.getLength() )
446 for ( int nProp
= 0; nProp
< aNames
.getLength(); nProp
++ )
448 if ( pValues
[nProp
].hasValue() )
454 // not supported anymore
458 if ( pValues
[nProp
] >>= nTemp
)
459 nAutoSaveTime
= nTemp
;
461 OSL_FAIL( "Wrong Type!" );
463 bROAutoSaveTime
= pROStates
[nProp
];
466 case ODFDEFAULTVERSION
:
469 if ( pValues
[nProp
] >>= nTmp
)
472 eODFDefaultVersion
= SvtSaveOptions::ODFVER_LATEST
;
474 eODFDefaultVersion
= SvtSaveOptions::ODFDefaultVersion( nTmp
);
477 SAL_WARN( "unotools.config", "SvtSaveOptions_Impl::SvtSaveOptions_Impl(): Wrong Type!" );
479 bROODFDefaultVersion
= pROStates
[nProp
];
486 if ( pValues
[nProp
] >>= bTemp
)
491 bUseUserData
= bTemp
;
492 bROUseUserData
= pROStates
[nProp
];
496 bROBackup
= pROStates
[nProp
];
500 bROAutoSave
= pROStates
[nProp
];
503 bAutoSavePrompt
= bTemp
;
504 bROAutoSavePrompt
= pROStates
[nProp
];
508 bRODocInfSave
= pROStates
[nProp
];
510 case SAVEWORKINGSET
:
511 bSaveWorkingSet
= bTemp
;
512 bROSaveWorkingSet
= pROStates
[nProp
];
515 bSaveDocView
= bTemp
;
516 bROSaveDocView
= pROStates
[nProp
];
519 bSaveRelFSys
= bTemp
;
520 bROSaveRelFSys
= pROStates
[nProp
];
523 bSaveRelINet
= bTemp
;
524 bROSaveRelINet
= pROStates
[nProp
];
527 bSaveUnpacked
= bTemp
;
528 bROSaveUnpacked
= pROStates
[nProp
];
532 bDoPrettyPrinting
= bTemp
;
533 bRODoPrettyPrinting
= pROStates
[nProp
];
536 case WARNALIENFORMAT
:
537 bWarnAlienFormat
= bTemp
;
538 bROWarnAlienFormat
= pROStates
[nProp
];
542 bLoadDocPrinter
= bTemp
;
543 bROLoadDocPrinter
= pROStates
[nProp
];
547 bUseSHA1InODF12
= bTemp
;
548 bROUseSHA1InODF12
= pROStates
[nProp
];
551 case USEBLOWFISHINODF12
:
552 bUseBlowfishInODF12
= bTemp
;
553 bROUseBlowfishInODF12
= pROStates
[nProp
];
557 SAL_WARN( "unotools.config", "invalid index to load a path" );
562 OSL_FAIL( "Wrong Type!" );
570 bAutoSave
= officecfg::Office::Recovery::AutoSave::Enabled::get();
571 nAutoSaveTime
= officecfg::Office::Recovery::AutoSave::TimeIntervall::get();
572 bUserAutoSave
= officecfg::Office::Recovery::AutoSave::UserAutoSaveEnabled::get();
575 SvtSaveOptions_Impl::~SvtSaveOptions_Impl()
578 void SvtSaveOptions_Impl::ImplCommit()
580 Sequence
< OUString
> aOrgNames
= GetPropertyNames();
581 OUString
* pOrgNames
= aOrgNames
.getArray();
582 sal_Int32 nOrgCount
= aOrgNames
.getLength();
584 Sequence
< OUString
> aNames( nOrgCount
);
585 Sequence
< Any
> aValues( nOrgCount
);
586 OUString
* pNames
= aNames
.getArray();
587 Any
* pValues
= aValues
.getArray();
588 sal_Int32 nRealCount
= 0;
590 for (sal_Int32 i
=0; i
<nOrgCount
; ++i
)
595 // not supported anymore
598 if (!bROAutoSaveTime
)
600 pValues
[nRealCount
] <<= nAutoSaveTime
;
601 pNames
[nRealCount
] = pOrgNames
[i
];
608 pValues
[nRealCount
] <<= bUseUserData
;
609 pNames
[nRealCount
] = pOrgNames
[i
];
616 pValues
[nRealCount
] <<= bBackup
;
617 pNames
[nRealCount
] = pOrgNames
[i
];
624 pValues
[nRealCount
] <<= bAutoSave
;
625 pNames
[nRealCount
] = pOrgNames
[i
];
630 if (!bROAutoSavePrompt
)
632 pValues
[nRealCount
] <<= bAutoSavePrompt
;
633 pNames
[nRealCount
] = pOrgNames
[i
];
640 pValues
[nRealCount
] <<= bDocInfSave
;
641 pNames
[nRealCount
] = pOrgNames
[i
];
645 case SAVEWORKINGSET
:
646 if (!bROSaveWorkingSet
)
648 pValues
[nRealCount
] <<= bSaveWorkingSet
;
649 pNames
[nRealCount
] = pOrgNames
[i
];
656 pValues
[nRealCount
] <<= bSaveDocView
;
657 pNames
[nRealCount
] = pOrgNames
[i
];
664 pValues
[nRealCount
] <<= bSaveRelFSys
;
665 pNames
[nRealCount
] = pOrgNames
[i
];
672 pValues
[nRealCount
] <<= bSaveRelINet
;
673 pNames
[nRealCount
] = pOrgNames
[i
];
678 if (!bROSaveUnpacked
)
680 pValues
[nRealCount
] <<= bSaveUnpacked
;
681 pNames
[nRealCount
] = pOrgNames
[i
];
686 if (!bRODoPrettyPrinting
)
688 pValues
[nRealCount
] <<= bDoPrettyPrinting
;
689 pNames
[nRealCount
] = pOrgNames
[i
];
693 case WARNALIENFORMAT
:
694 if (!bROWarnAlienFormat
)
696 pValues
[nRealCount
] <<= bWarnAlienFormat
;
697 pNames
[nRealCount
] = pOrgNames
[i
];
702 if (!bROLoadDocPrinter
)
704 pValues
[nRealCount
] <<= bLoadDocPrinter
;
705 pNames
[nRealCount
] = pOrgNames
[i
];
709 case ODFDEFAULTVERSION
:
710 if (!bROODFDefaultVersion
)
712 pValues
[nRealCount
] <<= (eODFDefaultVersion
== SvtSaveOptions::ODFVER_LATEST
) ? sal_Int16( 3 ) : sal_Int16( eODFDefaultVersion
);
713 pNames
[nRealCount
] = pOrgNames
[i
];
718 if (!bROUseSHA1InODF12
)
720 pValues
[nRealCount
] <<= bUseSHA1InODF12
;
721 pNames
[nRealCount
] = pOrgNames
[i
];
725 case USEBLOWFISHINODF12
:
726 if (!bROUseBlowfishInODF12
)
728 pValues
[nRealCount
] <<= bUseBlowfishInODF12
;
729 pNames
[nRealCount
] = pOrgNames
[i
];
735 SAL_WARN( "unotools.config", "invalid index to save a path" );
739 aNames
.realloc(nRealCount
);
740 aValues
.realloc(nRealCount
);
741 PutProperties( aNames
, aValues
);
743 std::shared_ptr
< comphelper::ConfigurationChanges
> batch(
744 comphelper::ConfigurationChanges::create());
745 officecfg::Office::Recovery::AutoSave::TimeIntervall::set(nAutoSaveTime
, batch
);
746 officecfg::Office::Recovery::AutoSave::Enabled::set(bAutoSave
, batch
);
747 officecfg::Office::Recovery::AutoSave::UserAutoSaveEnabled::set(bUserAutoSave
, batch
);
751 void SvtSaveOptions_Impl::Notify( const Sequence
<OUString
>& )
755 class SvtLoadOptions_Impl
: public utl::ConfigItem
758 bool bLoadUserDefinedSettings
;
760 virtual void ImplCommit() SAL_OVERRIDE
;
763 SvtLoadOptions_Impl();
764 virtual ~SvtLoadOptions_Impl();
766 virtual void Notify( const com::sun::star::uno::Sequence
< OUString
>& aPropertyNames
) SAL_OVERRIDE
;
768 void SetLoadUserSettings(bool b
){bLoadUserDefinedSettings
= b
; SetModified();}
769 bool IsLoadUserSettings() const {return bLoadUserDefinedSettings
;}
772 const sal_Char cUserDefinedSettings
[] = "UserDefinedSettings";
774 SvtLoadOptions_Impl::SvtLoadOptions_Impl()
775 : ConfigItem( OUString("Office.Common/Load") )
776 , bLoadUserDefinedSettings( false )
778 Sequence
< OUString
> aNames(1);
779 aNames
[0] = cUserDefinedSettings
;
780 Sequence
< Any
> aValues
= GetProperties( aNames
);
781 EnableNotification( aNames
);
782 const Any
* pValues
= aValues
.getConstArray();
783 DBG_ASSERT( aValues
.getLength() == aNames
.getLength(), "GetProperties failed" );
784 if (pValues
[0].getValueTypeClass() == ::com::sun::star::uno::TypeClass_BOOLEAN
)
785 bLoadUserDefinedSettings
= *static_cast<sal_Bool
const *>(pValues
[0].getValue());
788 SvtLoadOptions_Impl::~SvtLoadOptions_Impl()
792 void SvtLoadOptions_Impl::ImplCommit()
794 Sequence
< OUString
> aNames(1);
795 aNames
[0] = cUserDefinedSettings
;
796 Sequence
< Any
> aValues( 1 );
797 aValues
[0].setValue(&bLoadUserDefinedSettings
, cppu::UnoType
<bool>::get());
798 PutProperties( aNames
, aValues
);
801 void SvtLoadOptions_Impl::Notify( const Sequence
<OUString
>& )
803 SAL_WARN( "unotools.config", "properties have been changed" );
808 class LocalSingleton
: public rtl::Static
< osl::Mutex
, LocalSingleton
>
813 SvtSaveOptions::SvtSaveOptions()
815 // Global access, must be guarded (multithreading)
816 ::osl::MutexGuard
aGuard( LocalSingleton::get() );
819 pOptions
= new SvtLoadSaveOptions_Impl
;
820 pOptions
->pSaveOpt
= new SvtSaveOptions_Impl
;
821 pOptions
->pLoadOpt
= new SvtLoadOptions_Impl
;
823 ItemHolder1::holdConfigItem(E_SAVEOPTIONS
);
829 SvtSaveOptions::~SvtSaveOptions()
831 // Global access, must be guarded (multithreading)
832 ::osl::MutexGuard
aGuard( LocalSingleton::get() );
835 if ( pOptions
->pSaveOpt
->IsModified() )
836 pOptions
->pSaveOpt
->Commit();
837 if ( pOptions
->pLoadOpt
->IsModified() )
838 pOptions
->pLoadOpt
->Commit();
840 DELETEZ( pOptions
->pLoadOpt
);
841 DELETEZ( pOptions
->pSaveOpt
);
846 void SvtSaveOptions::SetAutoSaveTime( sal_Int32 n
)
848 pImp
->pSaveOpt
->SetAutoSaveTime( n
);
851 sal_Int32
SvtSaveOptions::GetAutoSaveTime() const
853 return pImp
->pSaveOpt
->GetAutoSaveTime();
856 void SvtSaveOptions::SetUseUserData( bool b
)
858 pImp
->pSaveOpt
->SetUseUserData( b
);
861 bool SvtSaveOptions::IsUseUserData() const
863 return pImp
->pSaveOpt
->IsUseUserData();
866 void SvtSaveOptions::SetBackup( bool b
)
868 pImp
->pSaveOpt
->SetBackup( b
);
871 bool SvtSaveOptions::IsBackup() const
873 return pImp
->pSaveOpt
->IsBackup();
876 void SvtSaveOptions::SetAutoSave( bool b
)
878 pImp
->pSaveOpt
->SetAutoSave( b
);
881 bool SvtSaveOptions::IsAutoSave() const
883 return pImp
->pSaveOpt
->IsAutoSave();
886 void SvtSaveOptions::SetAutoSavePrompt( bool b
)
888 pImp
->pSaveOpt
->SetAutoSavePrompt( b
);
891 bool SvtSaveOptions::IsAutoSavePrompt() const
893 return pImp
->pSaveOpt
->IsAutoSavePrompt();
896 void SvtSaveOptions::SetUserAutoSave( bool b
)
898 pImp
->pSaveOpt
->SetUserAutoSave( b
);
901 bool SvtSaveOptions::IsUserAutoSave() const
903 return pImp
->pSaveOpt
->IsUserAutoSave();
906 void SvtSaveOptions::SetDocInfoSave(bool b
)
908 pImp
->pSaveOpt
->SetDocInfoSave( b
);
911 bool SvtSaveOptions::IsDocInfoSave() const
913 return pImp
->pSaveOpt
->IsDocInfoSave();
916 void SvtSaveOptions::SetSaveWorkingSet( bool b
)
918 pImp
->pSaveOpt
->SetSaveWorkingSet( b
);
921 bool SvtSaveOptions::IsSaveWorkingSet() const
923 return pImp
->pSaveOpt
->IsSaveWorkingSet();
926 void SvtSaveOptions::SetSaveDocView( bool b
)
928 pImp
->pSaveOpt
->SetSaveDocView( b
);
931 bool SvtSaveOptions::IsSaveDocView() const
933 return pImp
->pSaveOpt
->IsSaveDocView();
936 void SvtSaveOptions::SetSaveRelINet( bool b
)
938 pImp
->pSaveOpt
->SetSaveRelINet( b
);
941 bool SvtSaveOptions::IsSaveRelINet() const
943 return pImp
->pSaveOpt
->IsSaveRelINet();
946 void SvtSaveOptions::SetSaveRelFSys( bool b
)
948 pImp
->pSaveOpt
->SetSaveRelFSys( b
);
951 bool SvtSaveOptions::IsSaveRelFSys() const
953 return pImp
->pSaveOpt
->IsSaveRelFSys();
956 bool SvtSaveOptions::IsSaveUnpacked() const
958 return pImp
->pSaveOpt
->IsSaveUnpacked();
961 void SvtSaveOptions::SetLoadUserSettings(bool b
)
963 pImp
->pLoadOpt
->SetLoadUserSettings(b
);
966 bool SvtSaveOptions::IsLoadUserSettings() const
968 return pImp
->pLoadOpt
->IsLoadUserSettings();
971 void SvtSaveOptions::SetPrettyPrinting( bool _bEnable
)
973 pImp
->pSaveOpt
->EnablePrettyPrinting( _bEnable
);
976 bool SvtSaveOptions::IsPrettyPrinting() const
978 return pImp
->pSaveOpt
->IsPrettyPrintingEnabled();
981 void SvtSaveOptions::SetWarnAlienFormat( bool _bEnable
)
983 pImp
->pSaveOpt
->SetWarnAlienFormat( _bEnable
);
986 bool SvtSaveOptions::IsWarnAlienFormat() const
988 return pImp
->pSaveOpt
->IsWarnAlienFormat();
991 void SvtSaveOptions::SetLoadDocumentPrinter( bool _bEnable
)
993 pImp
->pSaveOpt
->SetLoadDocPrinter( _bEnable
);
996 bool SvtSaveOptions::IsLoadDocumentPrinter() const
998 return pImp
->pSaveOpt
->IsLoadDocPrinter();
1001 void SvtSaveOptions::SetODFDefaultVersion( SvtSaveOptions::ODFDefaultVersion eVersion
)
1003 pImp
->pSaveOpt
->SetODFDefaultVersion( eVersion
);
1006 SvtSaveOptions::ODFDefaultVersion
SvtSaveOptions::GetODFDefaultVersion() const
1008 return pImp
->pSaveOpt
->GetODFDefaultVersion();
1011 SvtSaveOptions::ODFSaneDefaultVersion
SvtSaveOptions::GetODFSaneDefaultVersion() const
1013 const ODFSaneDefaultVersion NOW_CURRENT_LATEST
= ODFSVER_012_EXTENDED
;
1015 switch (pImp
->pSaveOpt
->GetODFDefaultVersion())
1018 assert(!"map new ODFDefaultVersion to ODFSaneDefaultVersion");
1020 case ODFVER_UNKNOWN
:
1022 return NOW_CURRENT_LATEST
;
1029 case ODFVER_012_EXT_COMPAT
:
1030 return ODFSVER_012_EXT_COMPAT
;
1032 return NOW_CURRENT_LATEST
;
1035 bool SvtSaveOptions::IsUseSHA1InODF12() const
1037 return pImp
->pSaveOpt
->IsUseSHA1InODF12();
1040 bool SvtSaveOptions::IsUseBlowfishInODF12() const
1042 return pImp
->pSaveOpt
->IsUseBlowfishInODF12();
1045 bool SvtSaveOptions::IsReadOnly( SvtSaveOptions::EOption eOption
) const
1047 return pImp
->pSaveOpt
->IsReadOnly(eOption
);
1050 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */