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 <unotools/saveopt.hxx>
21 #include "rtl/instance.hxx"
22 #include <unotools/configmgr.hxx>
23 #include <unotools/configitem.hxx>
24 #include <tools/debug.hxx>
25 #include <com/sun/star/uno/Any.hxx>
26 #include <com/sun/star/uno/Sequence.hxx>
28 #include <osl/mutex.hxx>
29 #include <comphelper/configurationhelper.hxx>
30 #include <comphelper/processfactory.hxx>
31 #include <rtl/logfile.hxx>
32 #include "itemholder1.hxx"
35 using namespace com::sun::star::uno
;
37 using ::rtl::OUString
;
39 class SvtSaveOptions_Impl
;
40 class SvtLoadOptions_Impl
;
42 #define CFG_READONLY_DEFAULT sal_False
44 struct SvtLoadSaveOptions_Impl
46 SvtSaveOptions_Impl
* pSaveOpt
;
47 SvtLoadOptions_Impl
* pLoadOpt
;
50 static SvtLoadSaveOptions_Impl
* pOptions
= NULL
;
51 static sal_Int32 nRefCount
= 0;
53 class SvtSaveOptions_Impl
: public utl::ConfigItem
55 sal_Int32 nAutoSaveTime
;
56 sal_Bool bUseUserData
,
72 SvtSaveOptions::ODFDefaultVersion eODFDefaultVersion
;
74 sal_Bool bROAutoSaveTime
,
90 bROUseBlowfishInODF12
;
93 SvtSaveOptions_Impl();
94 ~SvtSaveOptions_Impl();
96 virtual void Notify( const com::sun::star::uno::Sequence
< rtl::OUString
>& aPropertyNames
);
97 virtual void Commit();
99 sal_Int32
GetAutoSaveTime() const { return nAutoSaveTime
; }
100 sal_Bool
IsUseUserData() const { return bUseUserData
; }
101 sal_Bool
IsBackup() const { return bBackup
; }
102 sal_Bool
IsAutoSave() const { return bAutoSave
; }
103 sal_Bool
IsAutoSavePrompt() const { return bAutoSavePrompt
; }
104 sal_Bool
IsDocInfoSave() const { return bDocInfSave
; }
105 sal_Bool
IsSaveWorkingSet() const { return bSaveWorkingSet
; }
106 sal_Bool
IsSaveDocView() const { return bSaveDocView
; }
107 sal_Bool
IsSaveRelINet() const { return bSaveRelINet
; }
108 sal_Bool
IsSaveRelFSys() const { return bSaveRelFSys
; }
109 sal_Bool
IsSaveUnpacked() const { return bSaveUnpacked
; }
110 sal_Bool
IsPrettyPrintingEnabled( ) const { return bDoPrettyPrinting
; }
111 sal_Bool
IsWarnAlienFormat() const { return bWarnAlienFormat
; }
112 sal_Bool
IsLoadDocPrinter() const { return bLoadDocPrinter
; }
113 sal_Bool
IsUseSHA1InODF12() const { return bUseSHA1InODF12
; }
114 sal_Bool
IsUseBlowfishInODF12() const { return bUseBlowfishInODF12
; }
116 SvtSaveOptions::ODFDefaultVersion
117 GetODFDefaultVersion() const { return eODFDefaultVersion
; }
119 void SetAutoSaveTime( sal_Int32 n
);
120 void SetUseUserData( sal_Bool b
);
121 void SetBackup( sal_Bool b
);
122 void SetAutoSave( sal_Bool b
);
123 void SetAutoSavePrompt( sal_Bool b
);
124 void SetDocInfoSave( sal_Bool b
);
125 void SetSaveWorkingSet( sal_Bool b
);
126 void SetSaveDocView( sal_Bool b
);
127 void SetSaveRelINet( sal_Bool b
);
128 void SetSaveRelFSys( sal_Bool b
);
129 void EnablePrettyPrinting( sal_Bool _bDoPP
);
130 void SetWarnAlienFormat( sal_Bool _bDoPP
);
131 void SetLoadDocPrinter( sal_Bool bNew
);
132 void SetODFDefaultVersion( SvtSaveOptions::ODFDefaultVersion eNew
);
134 sal_Bool
IsReadOnly( SvtSaveOptions::EOption eOption
) const;
137 void SvtSaveOptions_Impl::SetAutoSaveTime( sal_Int32 n
)
139 if (!bROAutoSaveTime
&& nAutoSaveTime
!=n
)
147 void SvtSaveOptions_Impl::SetUseUserData( sal_Bool b
)
149 if (!bROUseUserData
&& bUseUserData
!=b
)
156 void SvtSaveOptions_Impl::SetBackup( sal_Bool b
)
158 if (!bROBackup
&& bBackup
!=b
)
165 void SvtSaveOptions_Impl::SetAutoSave( sal_Bool b
)
167 if (!bROAutoSave
&& bAutoSave
!=b
)
175 void SvtSaveOptions_Impl::SetAutoSavePrompt( sal_Bool b
)
177 if (!bROAutoSavePrompt
&& bAutoSavePrompt
!=b
)
184 void SvtSaveOptions_Impl::SetDocInfoSave(sal_Bool b
)
186 if (!bRODocInfSave
&& bDocInfSave
!=b
)
193 void SvtSaveOptions_Impl::SetSaveWorkingSet( sal_Bool b
)
195 if (!bROSaveWorkingSet
&& bSaveWorkingSet
!=b
)
202 void SvtSaveOptions_Impl::SetSaveDocView( sal_Bool b
)
204 if (!bROSaveDocView
&& bSaveDocView
!=b
)
211 void SvtSaveOptions_Impl::SetSaveRelINet( sal_Bool b
)
213 if (!bROSaveRelINet
&& bSaveRelINet
!=b
)
220 void SvtSaveOptions_Impl::SetSaveRelFSys( sal_Bool b
)
222 if (!bROSaveRelFSys
&& bSaveRelFSys
!=b
)
229 void SvtSaveOptions_Impl::EnablePrettyPrinting( sal_Bool _bDoPP
)
231 if (!bRODoPrettyPrinting
&& bDoPrettyPrinting
!=_bDoPP
)
233 bDoPrettyPrinting
= _bDoPP
;
238 void SvtSaveOptions_Impl::SetWarnAlienFormat( sal_Bool _bDoPP
)
240 if (!bROWarnAlienFormat
&& bWarnAlienFormat
!=_bDoPP
)
242 bWarnAlienFormat
= _bDoPP
;
247 void SvtSaveOptions_Impl::SetLoadDocPrinter( sal_Bool bNew
)
249 if ( !bROLoadDocPrinter
&& bLoadDocPrinter
!= bNew
)
251 bLoadDocPrinter
= bNew
;
256 void SvtSaveOptions_Impl::SetODFDefaultVersion( SvtSaveOptions::ODFDefaultVersion eNew
)
258 if ( !bROODFDefaultVersion
&& eODFDefaultVersion
!= eNew
)
260 eODFDefaultVersion
= eNew
;
265 sal_Bool
SvtSaveOptions_Impl::IsReadOnly( SvtSaveOptions::EOption eOption
) const
267 sal_Bool bReadOnly
= CFG_READONLY_DEFAULT
;
270 case SvtSaveOptions::E_AUTOSAVETIME
:
271 bReadOnly
= bROAutoSaveTime
;
273 case SvtSaveOptions::E_USEUSERDATA
:
274 bReadOnly
= bROUseUserData
;
276 case SvtSaveOptions::E_BACKUP
:
277 bReadOnly
= bROBackup
;
279 case SvtSaveOptions::E_AUTOSAVE
:
280 bReadOnly
= bROAutoSave
;
282 case SvtSaveOptions::E_AUTOSAVEPROMPT
:
283 bReadOnly
= bROAutoSavePrompt
;
285 case SvtSaveOptions::E_DOCINFSAVE
:
286 bReadOnly
= bRODocInfSave
;
288 case SvtSaveOptions::E_SAVEWORKINGSET
:
289 bReadOnly
= bROSaveWorkingSet
;
291 case SvtSaveOptions::E_SAVEDOCVIEW
:
292 bReadOnly
= bROSaveDocView
;
294 case SvtSaveOptions::E_SAVERELINET
:
295 bReadOnly
= bROSaveRelINet
;
297 case SvtSaveOptions::E_SAVERELFSYS
:
298 bReadOnly
= bROSaveRelFSys
;
300 case SvtSaveOptions::E_SAVEUNPACKED
:
301 bReadOnly
= bROSaveUnpacked
;
303 case SvtSaveOptions::E_DOPRETTYPRINTING
:
304 bReadOnly
= bRODoPrettyPrinting
;
306 case SvtSaveOptions::E_WARNALIENFORMAT
:
307 bReadOnly
= bROWarnAlienFormat
;
309 case SvtSaveOptions::E_LOADDOCPRINTER
:
310 bReadOnly
= bROLoadDocPrinter
;
312 case SvtSaveOptions::E_ODFDEFAULTVERSION
:
313 bReadOnly
= bROLoadDocPrinter
;
315 case SvtSaveOptions::E_USESHA1INODF12
:
316 bReadOnly
= bROUseSHA1InODF12
;
318 case SvtSaveOptions::E_USEBLOWFISHINODF12
:
319 bReadOnly
= bROUseBlowfishInODF12
;
326 #define TIMEINTERVALL 1
327 #define USEUSERDATA 2
328 #define CREATEBACKUP 3
331 #define EDITPROPERTY 6
332 #define SAVEVIEWINFO 7
334 #define PRETTYPRINTING 9
335 #define WARNALIENFORMAT 10
336 #define LOADDOCPRINTER 11
337 #define FILESYSTEM 12
339 #define SAVEWORKINGSET 14
340 #define ODFDEFAULTVERSION 15
341 #define USESHA1INODF12 16
342 #define USEBLOWFISHINODF12 17
344 Sequence
< OUString
> GetPropertyNames()
346 static const char* aPropNames
[] =
349 "Document/AutoSaveTimeIntervall",
350 "Document/UseUserData",
351 "Document/CreateBackup",
353 "Document/AutoSavePrompt",
354 "Document/EditProperty",
357 "Document/PrettyPrinting",
358 "Document/WarnAlienFormat",
359 "Document/LoadPrinter",
363 "ODF/DefaultVersion",
364 "ODF/UseSHA1InODF12",
365 "ODF/UseBlowfishInODF12"
368 const int nCount
= sizeof( aPropNames
) / sizeof( const char* );
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 // -----------------------------------------------------------------------
379 SvtSaveOptions_Impl::SvtSaveOptions_Impl()
380 : ConfigItem( OUString("Office.Common/Save") )
382 , bUseUserData( sal_False
)
383 , bBackup( sal_False
)
384 , bAutoSave( sal_False
)
385 , bAutoSavePrompt( sal_False
)
386 , bDocInfSave( sal_False
)
387 , bSaveWorkingSet( sal_False
)
388 , bSaveDocView( sal_False
)
389 , bSaveRelINet( sal_False
)
390 , bSaveRelFSys( sal_False
)
391 , bSaveUnpacked( sal_False
)
392 , bDoPrettyPrinting( sal_False
)
393 , bWarnAlienFormat( sal_True
)
394 , bLoadDocPrinter( sal_True
)
395 , bUseSHA1InODF12( sal_False
)
396 , bUseBlowfishInODF12( sal_False
)
397 , eODFDefaultVersion( SvtSaveOptions::ODFVER_LATEST
)
398 , bROAutoSaveTime( CFG_READONLY_DEFAULT
)
399 , bROUseUserData( CFG_READONLY_DEFAULT
)
400 , bROBackup( CFG_READONLY_DEFAULT
)
401 , bROAutoSave( CFG_READONLY_DEFAULT
)
402 , bROAutoSavePrompt( CFG_READONLY_DEFAULT
)
403 , bRODocInfSave( CFG_READONLY_DEFAULT
)
404 , bROSaveWorkingSet( CFG_READONLY_DEFAULT
)
405 , bROSaveDocView( CFG_READONLY_DEFAULT
)
406 , bROSaveRelINet( CFG_READONLY_DEFAULT
)
407 , bROSaveRelFSys( CFG_READONLY_DEFAULT
)
408 , bROSaveUnpacked( CFG_READONLY_DEFAULT
)
409 , bROWarnAlienFormat( CFG_READONLY_DEFAULT
)
410 , bRODoPrettyPrinting( CFG_READONLY_DEFAULT
)
411 , bROLoadDocPrinter( CFG_READONLY_DEFAULT
)
412 , bROODFDefaultVersion( CFG_READONLY_DEFAULT
)
413 , bROUseSHA1InODF12( CFG_READONLY_DEFAULT
)
414 , bROUseBlowfishInODF12( CFG_READONLY_DEFAULT
)
416 Sequence
< OUString
> aNames
= GetPropertyNames();
417 Sequence
< Any
> aValues
= GetProperties( aNames
);
418 Sequence
< sal_Bool
> aROStates
= GetReadOnlyStates( aNames
);
419 EnableNotification( aNames
);
420 const Any
* pValues
= aValues
.getConstArray();
421 const sal_Bool
* pROStates
= aROStates
.getConstArray();
422 DBG_ASSERT( aValues
.getLength() == aNames
.getLength(), "GetProperties failed" );
423 DBG_ASSERT( aROStates
.getLength() == aNames
.getLength(), "GetReadOnlyStates failed" );
424 if ( aValues
.getLength() == aNames
.getLength() && aROStates
.getLength() == aNames
.getLength() )
426 for ( int nProp
= 0; nProp
< aNames
.getLength(); nProp
++ )
428 if ( pValues
[nProp
].hasValue() )
434 // not supported anymore
438 if ( pValues
[nProp
] >>= nTemp
)
439 nAutoSaveTime
= nTemp
;
441 OSL_FAIL( "Wrong Type!" );
443 bROAutoSaveTime
= pROStates
[nProp
];
446 case ODFDEFAULTVERSION
:
449 if ( pValues
[nProp
] >>= nTmp
)
452 eODFDefaultVersion
= SvtSaveOptions::ODFVER_LATEST
;
454 eODFDefaultVersion
= SvtSaveOptions::ODFDefaultVersion( nTmp
);
457 SAL_WARN( "unotools.config", "SvtSaveOptions_Impl::SvtSaveOptions_Impl(): Wrong Type!" );
459 bROODFDefaultVersion
= pROStates
[nProp
];
465 sal_Bool bTemp
= sal_Bool();
466 if ( pValues
[nProp
] >>= bTemp
)
471 bUseUserData
= bTemp
;
472 bROUseUserData
= pROStates
[nProp
];
476 bROBackup
= pROStates
[nProp
];
480 bROAutoSave
= pROStates
[nProp
];
483 bAutoSavePrompt
= bTemp
;
484 bROAutoSavePrompt
= pROStates
[nProp
];
488 bRODocInfSave
= pROStates
[nProp
];
490 case SAVEWORKINGSET
:
491 bSaveWorkingSet
= bTemp
;
492 bROSaveWorkingSet
= pROStates
[nProp
];
495 bSaveDocView
= bTemp
;
496 bROSaveDocView
= pROStates
[nProp
];
499 bSaveRelFSys
= bTemp
;
500 bROSaveRelFSys
= pROStates
[nProp
];
503 bSaveRelINet
= bTemp
;
504 bROSaveRelINet
= pROStates
[nProp
];
507 bSaveUnpacked
= bTemp
;
508 bROSaveUnpacked
= pROStates
[nProp
];
512 bDoPrettyPrinting
= bTemp
;
513 bRODoPrettyPrinting
= pROStates
[nProp
];
516 case WARNALIENFORMAT
:
517 bWarnAlienFormat
= bTemp
;
518 bROWarnAlienFormat
= pROStates
[nProp
];
522 bLoadDocPrinter
= bTemp
;
523 bROLoadDocPrinter
= pROStates
[nProp
];
527 bUseSHA1InODF12
= bTemp
;
528 bROUseSHA1InODF12
= pROStates
[nProp
];
531 case USEBLOWFISHINODF12
:
532 bUseBlowfishInODF12
= bTemp
;
533 bROUseBlowfishInODF12
= pROStates
[nProp
];
537 SAL_WARN( "unotools.config", "invalid index to load a path" );
542 OSL_FAIL( "Wrong Type!" );
552 css::uno::Reference
< css::uno::XInterface
> xCFG
= ::comphelper::ConfigurationHelper::openConfig(
553 ::comphelper::getProcessComponentContext(),
554 ::rtl::OUString("org.openoffice.Office.Recovery"),
555 ::comphelper::ConfigurationHelper::E_READONLY
);
557 ::comphelper::ConfigurationHelper::readRelativeKey(
559 ::rtl::OUString("AutoSave"),
560 ::rtl::OUString("Enabled")) >>= bAutoSave
;
562 ::comphelper::ConfigurationHelper::readRelativeKey(
564 ::rtl::OUString("AutoSave"),
565 ::rtl::OUString("TimeIntervall")) >>= nAutoSaveTime
;
567 catch(const css::uno::Exception
&)
568 { OSL_FAIL("Could not find needed informations for AutoSave feature."); }
571 SvtSaveOptions_Impl::~SvtSaveOptions_Impl()
574 void SvtSaveOptions_Impl::Commit()
576 Sequence
< OUString
> aOrgNames
= GetPropertyNames();
577 OUString
* pOrgNames
= aOrgNames
.getArray();
578 sal_Int32 nOrgCount
= aOrgNames
.getLength();
580 Sequence
< OUString
> aNames( nOrgCount
);
581 Sequence
< Any
> aValues( nOrgCount
);
582 OUString
* pNames
= aNames
.getArray();
583 Any
* pValues
= aValues
.getArray();
584 sal_Int32 nRealCount
= 0;
586 for (sal_Int32 i
=0; i
<nOrgCount
; ++i
)
591 // not supported anymore
594 if (!bROAutoSaveTime
)
596 pValues
[nRealCount
] <<= nAutoSaveTime
;
597 pNames
[nRealCount
] = pOrgNames
[i
];
604 pValues
[nRealCount
] <<= bUseUserData
;
605 pNames
[nRealCount
] = pOrgNames
[i
];
612 pValues
[nRealCount
] <<= bBackup
;
613 pNames
[nRealCount
] = pOrgNames
[i
];
620 pValues
[nRealCount
] <<= bAutoSave
;
621 pNames
[nRealCount
] = pOrgNames
[i
];
626 if (!bROAutoSavePrompt
)
628 pValues
[nRealCount
] <<= bAutoSavePrompt
;
629 pNames
[nRealCount
] = pOrgNames
[i
];
636 pValues
[nRealCount
] <<= bDocInfSave
;
637 pNames
[nRealCount
] = pOrgNames
[i
];
641 case SAVEWORKINGSET
:
642 if (!bROSaveWorkingSet
)
644 pValues
[nRealCount
] <<= bSaveWorkingSet
;
645 pNames
[nRealCount
] = pOrgNames
[i
];
652 pValues
[nRealCount
] <<= bSaveDocView
;
653 pNames
[nRealCount
] = pOrgNames
[i
];
660 pValues
[nRealCount
] <<= bSaveRelFSys
;
661 pNames
[nRealCount
] = pOrgNames
[i
];
668 pValues
[nRealCount
] <<= bSaveRelINet
;
669 pNames
[nRealCount
] = pOrgNames
[i
];
674 if (!bROSaveUnpacked
)
676 pValues
[nRealCount
] <<= bSaveUnpacked
;
677 pNames
[nRealCount
] = pOrgNames
[i
];
682 if (!bRODoPrettyPrinting
)
684 pValues
[nRealCount
] <<= bDoPrettyPrinting
;
685 pNames
[nRealCount
] = pOrgNames
[i
];
689 case WARNALIENFORMAT
:
690 if (!bROWarnAlienFormat
)
692 pValues
[nRealCount
] <<= bWarnAlienFormat
;
693 pNames
[nRealCount
] = pOrgNames
[i
];
698 if (!bROLoadDocPrinter
)
700 pValues
[nRealCount
] <<= bLoadDocPrinter
;
701 pNames
[nRealCount
] = pOrgNames
[i
];
705 case ODFDEFAULTVERSION
:
706 if (!bROODFDefaultVersion
)
708 pValues
[nRealCount
] <<= (eODFDefaultVersion
== SvtSaveOptions::ODFVER_LATEST
) ? sal_Int16( 3 ) : sal_Int16( eODFDefaultVersion
);
709 pNames
[nRealCount
] = pOrgNames
[i
];
714 if (!bROUseSHA1InODF12
)
716 pValues
[nRealCount
] <<= bUseSHA1InODF12
;
717 pNames
[nRealCount
] = pOrgNames
[i
];
721 case USEBLOWFISHINODF12
:
722 if (!bROUseBlowfishInODF12
)
724 pValues
[nRealCount
] <<= bUseBlowfishInODF12
;
725 pNames
[nRealCount
] = pOrgNames
[i
];
731 SAL_WARN( "unotools.config", "invalid index to save a path" );
735 aNames
.realloc(nRealCount
);
736 aValues
.realloc(nRealCount
);
737 PutProperties( aNames
, aValues
);
739 css::uno::Reference
< css::uno::XInterface
> xCFG
= ::comphelper::ConfigurationHelper::openConfig(
740 ::comphelper::getProcessComponentContext(),
741 ::rtl::OUString("org.openoffice.Office.Recovery"),
742 ::comphelper::ConfigurationHelper::E_STANDARD
);
744 ::comphelper::ConfigurationHelper::writeRelativeKey(
746 ::rtl::OUString("AutoSave"),
747 ::rtl::OUString("TimeIntervall"),
748 css::uno::makeAny(nAutoSaveTime
));
750 ::comphelper::ConfigurationHelper::writeRelativeKey(
752 ::rtl::OUString("AutoSave"),
753 ::rtl::OUString("Enabled"),
754 css::uno::makeAny(bAutoSave
));
756 ::comphelper::ConfigurationHelper::flush(xCFG
);
759 // -----------------------------------------------------------------------
761 void SvtSaveOptions_Impl::Notify( const Sequence
<rtl::OUString
>& )
766 class SvtLoadOptions_Impl
: public utl::ConfigItem
769 sal_Bool bLoadUserDefinedSettings
;
772 SvtLoadOptions_Impl();
773 ~SvtLoadOptions_Impl();
775 virtual void Notify( const com::sun::star::uno::Sequence
< rtl::OUString
>& aPropertyNames
);
776 virtual void Commit();
778 void SetLoadUserSettings(sal_Bool b
){bLoadUserDefinedSettings
= b
; SetModified();}
779 sal_Bool
IsLoadUserSettings() const {return bLoadUserDefinedSettings
;}
781 // -----------------------------------------------------------------------
782 const sal_Char cUserDefinedSettings
[] = "UserDefinedSettings";
784 SvtLoadOptions_Impl::SvtLoadOptions_Impl()
785 : ConfigItem( OUString("Office.Common/Load") )
786 , bLoadUserDefinedSettings( sal_False
)
788 Sequence
< OUString
> aNames(1);
789 aNames
[0] = OUString::createFromAscii(cUserDefinedSettings
);
790 Sequence
< Any
> aValues
= GetProperties( aNames
);
791 EnableNotification( aNames
);
792 const Any
* pValues
= aValues
.getConstArray();
793 DBG_ASSERT( aValues
.getLength() == aNames
.getLength(), "GetProperties failed" );
794 if (pValues
[0].getValueTypeClass() == ::com::sun::star::uno::TypeClass_BOOLEAN
)
795 bLoadUserDefinedSettings
= *(sal_Bool
*)pValues
[0].getValue();
797 // -----------------------------------------------------------------------
798 SvtLoadOptions_Impl::~SvtLoadOptions_Impl()
801 // -----------------------------------------------------------------------
802 void SvtLoadOptions_Impl::Commit()
804 Sequence
< OUString
> aNames(1);
805 aNames
[0] = OUString::createFromAscii(cUserDefinedSettings
);
806 Sequence
< Any
> aValues( 1 );
807 aValues
[0].setValue(&bLoadUserDefinedSettings
, ::getBooleanCppuType());
808 PutProperties( aNames
, aValues
);
810 // -----------------------------------------------------------------------
811 void SvtLoadOptions_Impl::Notify( const Sequence
<rtl::OUString
>& )
813 SAL_WARN( "unotools.config", "properties have been changed" );
815 // -----------------------------------------------------------------------
819 class LocalSingleton
: public rtl::Static
< osl::Mutex
, LocalSingleton
>
824 // -----------------------------------------------------------------------
825 SvtSaveOptions::SvtSaveOptions()
827 // Global access, must be guarded (multithreading)
828 ::osl::MutexGuard
aGuard( LocalSingleton::get() );
831 RTL_LOGFILE_CONTEXT(aLog
, "unotools ( ??? ) ::SvtSaveOptions_Impl::ctor()");
832 pOptions
= new SvtLoadSaveOptions_Impl
;
833 pOptions
->pSaveOpt
= new SvtSaveOptions_Impl
;
834 pOptions
->pLoadOpt
= new SvtLoadOptions_Impl
;
836 ItemHolder1::holdConfigItem(E_SAVEOPTIONS
);
842 // -----------------------------------------------------------------------
844 SvtSaveOptions::~SvtSaveOptions()
846 // Global access, must be guarded (multithreading)
847 ::osl::MutexGuard
aGuard( LocalSingleton::get() );
850 if ( pOptions
->pSaveOpt
->IsModified() )
851 pOptions
->pSaveOpt
->Commit();
852 if ( pOptions
->pLoadOpt
->IsModified() )
853 pOptions
->pLoadOpt
->Commit();
855 DELETEZ( pOptions
->pLoadOpt
);
856 DELETEZ( pOptions
->pSaveOpt
);
861 void SvtSaveOptions::SetAutoSaveTime( sal_Int32 n
)
863 pImp
->pSaveOpt
->SetAutoSaveTime( n
);
866 sal_Int32
SvtSaveOptions::GetAutoSaveTime() const
868 return pImp
->pSaveOpt
->GetAutoSaveTime();
871 void SvtSaveOptions::SetUseUserData( sal_Bool b
)
873 pImp
->pSaveOpt
->SetUseUserData( b
);
876 sal_Bool
SvtSaveOptions::IsUseUserData() const
878 return pImp
->pSaveOpt
->IsUseUserData();
881 void SvtSaveOptions::SetBackup( sal_Bool b
)
883 pImp
->pSaveOpt
->SetBackup( b
);
886 sal_Bool
SvtSaveOptions::IsBackup() const
888 return pImp
->pSaveOpt
->IsBackup();
891 void SvtSaveOptions::SetAutoSave( sal_Bool b
)
893 pImp
->pSaveOpt
->SetAutoSave( b
);
896 sal_Bool
SvtSaveOptions::IsAutoSave() const
898 return pImp
->pSaveOpt
->IsAutoSave();
901 void SvtSaveOptions::SetAutoSavePrompt( sal_Bool b
)
903 pImp
->pSaveOpt
->SetAutoSavePrompt( b
);
906 sal_Bool
SvtSaveOptions::IsAutoSavePrompt() const
908 return pImp
->pSaveOpt
->IsAutoSavePrompt();
911 void SvtSaveOptions::SetDocInfoSave(sal_Bool b
)
913 pImp
->pSaveOpt
->SetDocInfoSave( b
);
916 sal_Bool
SvtSaveOptions::IsDocInfoSave() const
918 return pImp
->pSaveOpt
->IsDocInfoSave();
921 void SvtSaveOptions::SetSaveWorkingSet( sal_Bool b
)
923 pImp
->pSaveOpt
->SetSaveWorkingSet( b
);
926 sal_Bool
SvtSaveOptions::IsSaveWorkingSet() const
928 return pImp
->pSaveOpt
->IsSaveWorkingSet();
931 void SvtSaveOptions::SetSaveDocView( sal_Bool b
)
933 pImp
->pSaveOpt
->SetSaveDocView( b
);
936 sal_Bool
SvtSaveOptions::IsSaveDocView() const
938 return pImp
->pSaveOpt
->IsSaveDocView();
941 void SvtSaveOptions::SetSaveRelINet( sal_Bool b
)
943 pImp
->pSaveOpt
->SetSaveRelINet( b
);
946 sal_Bool
SvtSaveOptions::IsSaveRelINet() const
948 return pImp
->pSaveOpt
->IsSaveRelINet();
951 void SvtSaveOptions::SetSaveRelFSys( sal_Bool b
)
953 pImp
->pSaveOpt
->SetSaveRelFSys( b
);
956 sal_Bool
SvtSaveOptions::IsSaveRelFSys() const
958 return pImp
->pSaveOpt
->IsSaveRelFSys();
961 sal_Bool
SvtSaveOptions::IsSaveUnpacked() const
963 return pImp
->pSaveOpt
->IsSaveUnpacked();
966 void SvtSaveOptions::SetLoadUserSettings(sal_Bool b
)
968 pImp
->pLoadOpt
->SetLoadUserSettings(b
);
971 sal_Bool
SvtSaveOptions::IsLoadUserSettings() const
973 return pImp
->pLoadOpt
->IsLoadUserSettings();
976 void SvtSaveOptions::SetPrettyPrinting( sal_Bool _bEnable
)
978 pImp
->pSaveOpt
->EnablePrettyPrinting( _bEnable
);
981 sal_Bool
SvtSaveOptions::IsPrettyPrinting() const
983 return pImp
->pSaveOpt
->IsPrettyPrintingEnabled();
986 void SvtSaveOptions::SetWarnAlienFormat( sal_Bool _bEnable
)
988 pImp
->pSaveOpt
->SetWarnAlienFormat( _bEnable
);
991 sal_Bool
SvtSaveOptions::IsWarnAlienFormat() const
993 return pImp
->pSaveOpt
->IsWarnAlienFormat();
996 void SvtSaveOptions::SetLoadDocumentPrinter( sal_Bool _bEnable
)
998 pImp
->pSaveOpt
->SetLoadDocPrinter( _bEnable
);
1001 sal_Bool
SvtSaveOptions::IsLoadDocumentPrinter() const
1003 return pImp
->pSaveOpt
->IsLoadDocPrinter();
1006 void SvtSaveOptions::SetODFDefaultVersion( SvtSaveOptions::ODFDefaultVersion eVersion
)
1008 pImp
->pSaveOpt
->SetODFDefaultVersion( eVersion
);
1011 SvtSaveOptions::ODFDefaultVersion
SvtSaveOptions::GetODFDefaultVersion() const
1013 return pImp
->pSaveOpt
->GetODFDefaultVersion();
1016 sal_Bool
SvtSaveOptions::IsUseSHA1InODF12() const
1018 return pImp
->pSaveOpt
->IsUseSHA1InODF12();
1021 sal_Bool
SvtSaveOptions::IsUseBlowfishInODF12() const
1023 return pImp
->pSaveOpt
->IsUseBlowfishInODF12();
1026 sal_Bool
SvtSaveOptions::IsReadOnly( SvtSaveOptions::EOption eOption
) const
1028 return pImp
->pSaveOpt
->IsReadOnly(eOption
);
1031 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */