1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: saveopt.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_svtools.hxx"
37 #include <svtools/saveopt.hxx>
38 #include "rtl/instance.hxx"
39 #include <unotools/configmgr.hxx>
40 #include <unotools/configitem.hxx>
41 #include <tools/debug.hxx>
42 #include <com/sun/star/uno/Any.hxx>
43 #include <com/sun/star/uno/Sequence.hxx>
45 #include <osl/mutex.hxx>
46 #include <comphelper/configurationhelper.hxx>
47 #include <unotools/processfactory.hxx>
48 #include <rtl/logfile.hxx>
49 #include "itemholder1.hxx"
53 using namespace com::sun::star::uno
;
54 namespace css
= ::com::sun::star
;
56 class SvtSaveOptions_Impl
;
57 class SvtLoadOptions_Impl
;
59 #define CFG_READONLY_DEFAULT sal_False
61 struct SvtLoadSaveOptions_Impl
63 SvtSaveOptions_Impl
* pSaveOpt
;
64 SvtLoadOptions_Impl
* pLoadOpt
;
67 static SvtLoadSaveOptions_Impl
* pOptions
= NULL
;
68 static sal_Int32 nRefCount
= 0;
70 class SvtSaveOptions_Impl
: public utl::ConfigItem
72 sal_Int32 nAutoSaveTime
;
73 sal_Bool bUseUserData
,
88 sal_Bool bROAutoSaveTime
,
103 bROODFDefaultVersion
;
105 SvtSaveOptions::ODFDefaultVersion eODFDefaultVersion
;
108 SvtSaveOptions_Impl();
109 ~SvtSaveOptions_Impl();
111 virtual void Notify( const com::sun::star::uno::Sequence
< rtl::OUString
>& aPropertyNames
);
112 virtual void Commit();
114 sal_Int32
GetAutoSaveTime() const { return nAutoSaveTime
; }
115 BOOL
IsUseUserData() const { return bUseUserData
; }
116 BOOL
IsBackup() const { return bBackup
; }
117 BOOL
IsAutoSave() const { return bAutoSave
; }
118 BOOL
IsAutoSavePrompt() const { return bAutoSavePrompt
; }
119 BOOL
IsDocInfoSave() const { return bDocInfSave
; }
120 BOOL
IsSaveWorkingSet() const { return bSaveWorkingSet
; }
121 BOOL
IsSaveDocWins() const { return bSaveDocWins
; }
122 BOOL
IsSaveDocView() const { return bSaveDocView
; }
123 BOOL
IsSaveRelINet() const { return bSaveRelINet
; }
124 BOOL
IsSaveRelFSys() const { return bSaveRelFSys
; }
125 BOOL
IsSaveUnpacked() const { return bSaveUnpacked
; }
126 sal_Bool
IsPrettyPrintingEnabled( ) const { return bDoPrettyPrinting
; }
127 sal_Bool
IsWarnAlienFormat() const { return bWarnAlienFormat
; }
128 sal_Bool
IsLoadDocPrinter() const { return bLoadDocPrinter
; }
129 SvtSaveOptions::ODFDefaultVersion
130 GetODFDefaultVersion() const { return eODFDefaultVersion
; }
132 void SetAutoSaveTime( sal_Int32 n
);
133 void SetUseUserData( BOOL b
);
134 void SetBackup( BOOL b
);
135 void SetAutoSave( BOOL b
);
136 void SetAutoSavePrompt( BOOL b
);
137 void SetDocInfoSave( BOOL b
);
138 void SetSaveWorkingSet( BOOL b
);
139 void SetSaveDocWins( BOOL b
);
140 void SetSaveDocView( BOOL b
);
141 void SetSaveRelINet( BOOL b
);
142 void SetSaveRelFSys( BOOL b
);
143 void SetSaveUnpacked( BOOL b
);
144 void EnablePrettyPrinting( sal_Bool _bDoPP
);
145 void SetWarnAlienFormat( sal_Bool _bDoPP
);
146 void SetLoadDocPrinter( sal_Bool bNew
);
147 void SetODFDefaultVersion( SvtSaveOptions::ODFDefaultVersion eNew
);
149 sal_Bool
IsReadOnly( SvtSaveOptions::EOption eOption
) const;
152 void SvtSaveOptions_Impl::SetAutoSaveTime( sal_Int32 n
)
154 if (!bROAutoSaveTime
&& nAutoSaveTime
!=n
)
162 void SvtSaveOptions_Impl::SetUseUserData( BOOL b
)
164 if (!bROUseUserData
&& bUseUserData
!=b
)
171 void SvtSaveOptions_Impl::SetBackup( BOOL b
)
173 if (!bROBackup
&& bBackup
!=b
)
180 void SvtSaveOptions_Impl::SetAutoSave( BOOL b
)
182 if (!bROAutoSave
&& bAutoSave
!=b
)
190 void SvtSaveOptions_Impl::SetAutoSavePrompt( BOOL b
)
192 if (!bROAutoSavePrompt
&& bAutoSavePrompt
!=b
)
199 void SvtSaveOptions_Impl::SetDocInfoSave(BOOL b
)
201 if (!bRODocInfSave
&& bDocInfSave
!=b
)
208 void SvtSaveOptions_Impl::SetSaveWorkingSet( BOOL b
)
210 if (!bROSaveWorkingSet
&& bSaveWorkingSet
!=b
)
217 void SvtSaveOptions_Impl::SetSaveDocWins( BOOL b
)
219 if (!bROSaveDocWins
&& bSaveDocWins
!=b
)
226 void SvtSaveOptions_Impl::SetSaveDocView( BOOL b
)
228 if (!bROSaveDocView
&& bSaveDocView
!=b
)
235 void SvtSaveOptions_Impl::SetSaveRelINet( BOOL b
)
237 if (!bROSaveRelINet
&& bSaveRelINet
!=b
)
244 void SvtSaveOptions_Impl::SetSaveRelFSys( BOOL b
)
246 if (!bROSaveRelFSys
&& bSaveRelFSys
!=b
)
253 void SvtSaveOptions_Impl::SetSaveUnpacked( BOOL b
)
255 if (!bROSaveUnpacked
&& bSaveUnpacked
!=b
)
262 void SvtSaveOptions_Impl::EnablePrettyPrinting( sal_Bool _bDoPP
)
264 if (!bRODoPrettyPrinting
&& bDoPrettyPrinting
!=_bDoPP
)
266 bDoPrettyPrinting
= _bDoPP
;
271 void SvtSaveOptions_Impl::SetWarnAlienFormat( sal_Bool _bDoPP
)
273 if (!bROWarnAlienFormat
&& bWarnAlienFormat
!=_bDoPP
)
275 bWarnAlienFormat
= _bDoPP
;
280 void SvtSaveOptions_Impl::SetLoadDocPrinter( sal_Bool bNew
)
282 if ( !bROLoadDocPrinter
&& bLoadDocPrinter
!= bNew
)
284 bLoadDocPrinter
= bNew
;
289 void SvtSaveOptions_Impl::SetODFDefaultVersion( SvtSaveOptions::ODFDefaultVersion eNew
)
291 if ( !bROODFDefaultVersion
&& eODFDefaultVersion
!= eNew
)
293 eODFDefaultVersion
= eNew
;
298 sal_Bool
SvtSaveOptions_Impl::IsReadOnly( SvtSaveOptions::EOption eOption
) const
300 sal_Bool bReadOnly
= CFG_READONLY_DEFAULT
;
303 case SvtSaveOptions::E_AUTOSAVETIME
:
304 bReadOnly
= bROAutoSaveTime
;
306 case SvtSaveOptions::E_USEUSERDATA
:
307 bReadOnly
= bROUseUserData
;
309 case SvtSaveOptions::E_BACKUP
:
310 bReadOnly
= bROBackup
;
312 case SvtSaveOptions::E_AUTOSAVE
:
313 bReadOnly
= bROAutoSave
;
315 case SvtSaveOptions::E_AUTOSAVEPROMPT
:
316 bReadOnly
= bROAutoSavePrompt
;
318 case SvtSaveOptions::E_DOCINFSAVE
:
319 bReadOnly
= bRODocInfSave
;
321 case SvtSaveOptions::E_SAVEWORKINGSET
:
322 bReadOnly
= bROSaveWorkingSet
;
324 case SvtSaveOptions::E_SAVEDOCWINS
:
325 bReadOnly
= bROSaveDocWins
;
327 case SvtSaveOptions::E_SAVEDOCVIEW
:
328 bReadOnly
= bROSaveDocView
;
330 case SvtSaveOptions::E_SAVERELINET
:
331 bReadOnly
= bROSaveRelINet
;
333 case SvtSaveOptions::E_SAVERELFSYS
:
334 bReadOnly
= bROSaveRelFSys
;
336 case SvtSaveOptions::E_SAVEUNPACKED
:
337 bReadOnly
= bROSaveUnpacked
;
339 case SvtSaveOptions::E_DOPRETTYPRINTING
:
340 bReadOnly
= bRODoPrettyPrinting
;
342 case SvtSaveOptions::E_WARNALIENFORMAT
:
343 bReadOnly
= bROWarnAlienFormat
;
345 case SvtSaveOptions::E_LOADDOCPRINTER
:
346 bReadOnly
= bROLoadDocPrinter
;
348 case SvtSaveOptions::E_ODFDEFAULTVERSION
:
349 bReadOnly
= bROLoadDocPrinter
;
356 #define TIMEINTERVALL 1
357 #define USEUSERDATA 2
358 #define CREATEBACKUP 3
361 #define EDITPROPERTY 6
362 #define SAVEDOCWINS 7
363 #define SAVEVIEWINFO 8
365 #define PRETTYPRINTING 10
366 #define WARNALIENFORMAT 11
367 #define LOADDOCPRINTER 12
368 #define FILESYSTEM 13
370 #define SAVEWORKINGSET 15
371 #define ODFDEFAULTVERSION 16
373 Sequence
< OUString
> GetPropertyNames()
375 static const char* aPropNames
[] =
378 "Document/AutoSaveTimeIntervall",
379 "Document/UseUserData",
380 "Document/CreateBackup",
382 "Document/AutoSavePrompt",
383 "Document/EditProperty",
384 "Document/DocumentWindows",
387 "Document/PrettyPrinting",
388 "Document/WarnAlienFormat",
389 "Document/LoadPrinter",
396 const int nCount
= sizeof( aPropNames
) / sizeof( const char* );
397 Sequence
< OUString
> aNames( nCount
);
398 OUString
* pNames
= aNames
.getArray();
399 for ( int i
= 0; i
< nCount
; i
++ )
400 pNames
[i
] = OUString::createFromAscii( aPropNames
[i
] );
405 // -----------------------------------------------------------------------
407 SvtSaveOptions_Impl::SvtSaveOptions_Impl()
408 : ConfigItem( OUString::createFromAscii("Office.Common/Save") )
410 , bUseUserData( sal_False
)
411 , bBackup( sal_False
)
412 , bAutoSave( sal_False
)
413 , bAutoSavePrompt( sal_False
)
414 , bDocInfSave( sal_False
)
415 , bSaveWorkingSet( sal_False
)
416 , bSaveDocWins( sal_False
)
417 , bSaveDocView( sal_False
)
418 , bSaveRelINet( sal_False
)
419 , bSaveRelFSys( sal_False
)
420 , bSaveUnpacked( sal_False
)
421 , bDoPrettyPrinting( sal_False
)
422 , bWarnAlienFormat( sal_True
)
423 , bLoadDocPrinter( sal_True
)
424 , bROAutoSaveTime( CFG_READONLY_DEFAULT
)
425 , bROUseUserData( CFG_READONLY_DEFAULT
)
426 , bROBackup( CFG_READONLY_DEFAULT
)
427 , bROAutoSave( CFG_READONLY_DEFAULT
)
428 , bROAutoSavePrompt( CFG_READONLY_DEFAULT
)
429 , bRODocInfSave( CFG_READONLY_DEFAULT
)
430 , bROSaveWorkingSet( CFG_READONLY_DEFAULT
)
431 , bROSaveDocWins( CFG_READONLY_DEFAULT
)
432 , bROSaveDocView( CFG_READONLY_DEFAULT
)
433 , bROSaveRelINet( CFG_READONLY_DEFAULT
)
434 , bROSaveRelFSys( CFG_READONLY_DEFAULT
)
435 , bROSaveUnpacked( CFG_READONLY_DEFAULT
)
436 , bROWarnAlienFormat( CFG_READONLY_DEFAULT
)
437 , bRODoPrettyPrinting( CFG_READONLY_DEFAULT
)
438 , bROLoadDocPrinter( CFG_READONLY_DEFAULT
)
439 , bROODFDefaultVersion( CFG_READONLY_DEFAULT
)
440 , eODFDefaultVersion( SvtSaveOptions::ODFVER_LATEST
)
442 Sequence
< OUString
> aNames
= GetPropertyNames();
443 Sequence
< Any
> aValues
= GetProperties( aNames
);
444 Sequence
< sal_Bool
> aROStates
= GetReadOnlyStates( aNames
);
445 EnableNotification( aNames
);
446 const Any
* pValues
= aValues
.getConstArray();
447 const sal_Bool
* pROStates
= aROStates
.getConstArray();
448 DBG_ASSERT( aValues
.getLength() == aNames
.getLength(), "GetProperties failed" );
449 DBG_ASSERT( aROStates
.getLength() == aNames
.getLength(), "GetReadOnlyStates failed" );
450 if ( aValues
.getLength() == aNames
.getLength() && aROStates
.getLength() == aNames
.getLength() )
452 for ( int nProp
= 0; nProp
< aNames
.getLength(); nProp
++ )
454 DBG_ASSERT( pValues
[nProp
].hasValue(), "property value missing" );
455 if ( pValues
[nProp
].hasValue() )
461 // not supported anymore
465 if ( pValues
[nProp
] >>= nTemp
)
466 nAutoSaveTime
= nTemp
;
468 DBG_ERROR( "Wrong Type!" );
470 bROAutoSaveTime
= pROStates
[nProp
];
473 case ODFDEFAULTVERSION
:
476 if ( pValues
[nProp
] >>= nTmp
)
479 eODFDefaultVersion
= SvtSaveOptions::ODFVER_LATEST
;
481 eODFDefaultVersion
= SvtSaveOptions::ODFDefaultVersion( nTmp
);
484 DBG_ERRORFILE( "SvtSaveOptions_Impl::SvtSaveOptions_Impl(): Wrong Type!" );
486 bROODFDefaultVersion
= pROStates
[nProp
];
492 sal_Bool bTemp
= sal_Bool();
493 if ( pValues
[nProp
] >>= bTemp
)
498 bUseUserData
= bTemp
;
499 bROUseUserData
= pROStates
[nProp
];
503 bROBackup
= pROStates
[nProp
];
507 bROAutoSave
= pROStates
[nProp
];
510 bAutoSavePrompt
= bTemp
;
511 bROAutoSavePrompt
= pROStates
[nProp
];
515 bRODocInfSave
= pROStates
[nProp
];
517 case SAVEWORKINGSET
:
518 bSaveWorkingSet
= bTemp
;
519 bROSaveWorkingSet
= pROStates
[nProp
];
522 bSaveDocWins
= bTemp
;
523 bROSaveDocWins
= pROStates
[nProp
];
526 bSaveDocView
= bTemp
;
527 bROSaveDocView
= pROStates
[nProp
];
530 bSaveRelFSys
= bTemp
;
531 bROSaveRelFSys
= pROStates
[nProp
];
534 bSaveRelINet
= bTemp
;
535 bROSaveRelINet
= pROStates
[nProp
];
538 bSaveUnpacked
= bTemp
;
539 bROSaveUnpacked
= pROStates
[nProp
];
543 bDoPrettyPrinting
= bTemp
;
544 bRODoPrettyPrinting
= pROStates
[nProp
];
547 case WARNALIENFORMAT
:
548 bWarnAlienFormat
= bTemp
;
549 bROWarnAlienFormat
= pROStates
[nProp
];
553 bLoadDocPrinter
= bTemp
;
554 bROLoadDocPrinter
= pROStates
[nProp
];
558 DBG_ERRORFILE( "invalid index to load a path" );
563 DBG_ERROR( "Wrong Type!" );
573 css::uno::Reference
< css::uno::XInterface
> xCFG
= ::comphelper::ConfigurationHelper::openConfig(
574 ::utl::getProcessServiceFactory(),
575 ::rtl::OUString::createFromAscii("org.openoffice.Office.Recovery"),
576 ::comphelper::ConfigurationHelper::E_READONLY
);
578 ::comphelper::ConfigurationHelper::readRelativeKey(
580 ::rtl::OUString::createFromAscii("AutoSave"),
581 ::rtl::OUString::createFromAscii("Enabled")) >>= bAutoSave
;
583 ::comphelper::ConfigurationHelper::readRelativeKey(
585 ::rtl::OUString::createFromAscii("AutoSave"),
586 ::rtl::OUString::createFromAscii("TimeIntervall")) >>= nAutoSaveTime
;
588 catch(const css::uno::Exception
&)
589 { DBG_ERROR("Could not find needed informations for AutoSave feature."); }
592 SvtSaveOptions_Impl::~SvtSaveOptions_Impl()
595 void SvtSaveOptions_Impl::Commit()
597 Sequence
< OUString
> aOrgNames
= GetPropertyNames();
598 OUString
* pOrgNames
= aOrgNames
.getArray();
599 sal_Int32 nOrgCount
= aOrgNames
.getLength();
601 Sequence
< OUString
> aNames( nOrgCount
);
602 Sequence
< Any
> aValues( nOrgCount
);
603 OUString
* pNames
= aNames
.getArray();
604 Any
* pValues
= aValues
.getArray();
605 sal_Int32 nRealCount
= 0;
607 for (sal_Int32 i
=0; i
<nOrgCount
; ++i
)
612 // not supported anymore
615 if (!bROAutoSaveTime
)
617 pValues
[nRealCount
] <<= nAutoSaveTime
;
618 pNames
[nRealCount
] = pOrgNames
[i
];
625 pValues
[nRealCount
] <<= bUseUserData
;
626 pNames
[nRealCount
] = pOrgNames
[i
];
633 pValues
[nRealCount
] <<= bBackup
;
634 pNames
[nRealCount
] = pOrgNames
[i
];
641 pValues
[nRealCount
] <<= bAutoSave
;
642 pNames
[nRealCount
] = pOrgNames
[i
];
647 if (!bROAutoSavePrompt
)
649 pValues
[nRealCount
] <<= bAutoSavePrompt
;
650 pNames
[nRealCount
] = pOrgNames
[i
];
657 pValues
[nRealCount
] <<= bDocInfSave
;
658 pNames
[nRealCount
] = pOrgNames
[i
];
662 case SAVEWORKINGSET
:
663 if (!bROSaveWorkingSet
)
665 pValues
[nRealCount
] <<= bSaveWorkingSet
;
666 pNames
[nRealCount
] = pOrgNames
[i
];
673 pValues
[nRealCount
] <<= bSaveDocWins
;
674 pNames
[nRealCount
] = pOrgNames
[i
];
681 pValues
[nRealCount
] <<= bSaveDocView
;
682 pNames
[nRealCount
] = pOrgNames
[i
];
689 pValues
[nRealCount
] <<= bSaveRelFSys
;
690 pNames
[nRealCount
] = pOrgNames
[i
];
697 pValues
[nRealCount
] <<= bSaveRelINet
;
698 pNames
[nRealCount
] = pOrgNames
[i
];
703 if (!bROSaveUnpacked
)
705 pValues
[nRealCount
] <<= bSaveUnpacked
;
706 pNames
[nRealCount
] = pOrgNames
[i
];
711 if (!bRODoPrettyPrinting
)
713 pValues
[nRealCount
] <<= bDoPrettyPrinting
;
714 pNames
[nRealCount
] = pOrgNames
[i
];
718 case WARNALIENFORMAT
:
719 if (!bROWarnAlienFormat
)
721 pValues
[nRealCount
] <<= bWarnAlienFormat
;
722 pNames
[nRealCount
] = pOrgNames
[i
];
727 if (!bROLoadDocPrinter
)
729 pValues
[nRealCount
] <<= bLoadDocPrinter
;
730 pNames
[nRealCount
] = pOrgNames
[i
];
734 case ODFDEFAULTVERSION
:
735 if (!bROODFDefaultVersion
)
737 pValues
[nRealCount
] <<= (eODFDefaultVersion
== SvtSaveOptions::ODFVER_LATEST
) ? sal_Int16( 3 ) : sal_Int16( eODFDefaultVersion
);
738 pNames
[nRealCount
] = pOrgNames
[i
];
743 DBG_ERRORFILE( "invalid index to save a path" );
747 aNames
.realloc(nRealCount
);
748 aValues
.realloc(nRealCount
);
749 PutProperties( aNames
, aValues
);
751 css::uno::Reference
< css::uno::XInterface
> xCFG
= ::comphelper::ConfigurationHelper::openConfig(
752 ::utl::getProcessServiceFactory(),
753 ::rtl::OUString::createFromAscii("org.openoffice.Office.Recovery"),
754 ::comphelper::ConfigurationHelper::E_STANDARD
);
756 ::comphelper::ConfigurationHelper::writeRelativeKey(
758 ::rtl::OUString::createFromAscii("AutoSave"),
759 ::rtl::OUString::createFromAscii("TimeIntervall"),
760 css::uno::makeAny(nAutoSaveTime
));
762 ::comphelper::ConfigurationHelper::writeRelativeKey(
764 ::rtl::OUString::createFromAscii("AutoSave"),
765 ::rtl::OUString::createFromAscii("Enabled"),
766 css::uno::makeAny(bAutoSave
));
768 ::comphelper::ConfigurationHelper::flush(xCFG
);
771 // -----------------------------------------------------------------------
773 void SvtSaveOptions_Impl::Notify( const Sequence
<rtl::OUString
>& )
778 class SvtLoadOptions_Impl
: public utl::ConfigItem
781 sal_Bool bLoadUserDefinedSettings
;
784 SvtLoadOptions_Impl();
785 ~SvtLoadOptions_Impl();
787 virtual void Notify( const com::sun::star::uno::Sequence
< rtl::OUString
>& aPropertyNames
);
788 virtual void Commit();
790 void SetLoadUserSettings(sal_Bool b
){bLoadUserDefinedSettings
= b
; SetModified();}
791 sal_Bool
IsLoadUserSettings() const {return bLoadUserDefinedSettings
;}
793 // -----------------------------------------------------------------------
794 const sal_Char cUserDefinedSettings
[] = "UserDefinedSettings";
796 SvtLoadOptions_Impl::SvtLoadOptions_Impl()
797 : ConfigItem( OUString::createFromAscii("Office.Common/Load") )
798 , bLoadUserDefinedSettings( sal_False
)
800 Sequence
< OUString
> aNames(1);
801 aNames
[0] = OUString::createFromAscii(cUserDefinedSettings
);
802 Sequence
< Any
> aValues
= GetProperties( aNames
);
803 EnableNotification( aNames
);
804 const Any
* pValues
= aValues
.getConstArray();
805 DBG_ASSERT( aValues
.getLength() == aNames
.getLength(), "GetProperties failed" );
806 if (pValues
[0].getValueTypeClass() == ::com::sun::star::uno::TypeClass_BOOLEAN
)
807 bLoadUserDefinedSettings
= *(sal_Bool
*)pValues
[0].getValue();
809 // -----------------------------------------------------------------------
810 SvtLoadOptions_Impl::~SvtLoadOptions_Impl()
813 // -----------------------------------------------------------------------
814 void SvtLoadOptions_Impl::Commit()
816 Sequence
< OUString
> aNames(1);
817 aNames
[0] = OUString::createFromAscii(cUserDefinedSettings
);
818 Sequence
< Any
> aValues( 1 );
819 aValues
[0].setValue(&bLoadUserDefinedSettings
, ::getBooleanCppuType());
820 PutProperties( aNames
, aValues
);
822 // -----------------------------------------------------------------------
823 void SvtLoadOptions_Impl::Notify( const Sequence
<rtl::OUString
>& )
825 DBG_ERRORFILE( "properties have been changed" );
827 // -----------------------------------------------------------------------
831 class LocalSingleton
: public rtl::Static
< osl::Mutex
, LocalSingleton
>
836 // -----------------------------------------------------------------------
837 SvtSaveOptions::SvtSaveOptions()
839 // Global access, must be guarded (multithreading)
840 ::osl::MutexGuard
aGuard( LocalSingleton::get() );
843 RTL_LOGFILE_CONTEXT(aLog
, "svtools ( ??? ) ::SvtSaveOptions_Impl::ctor()");
844 pOptions
= new SvtLoadSaveOptions_Impl
;
845 pOptions
->pSaveOpt
= new SvtSaveOptions_Impl
;
846 pOptions
->pLoadOpt
= new SvtLoadOptions_Impl
;
848 ItemHolder1::holdConfigItem(E_SAVEOPTIONS
);
854 // -----------------------------------------------------------------------
856 SvtSaveOptions::~SvtSaveOptions()
858 // Global access, must be guarded (multithreading)
859 ::osl::MutexGuard
aGuard( LocalSingleton::get() );
862 if ( pOptions
->pSaveOpt
->IsModified() )
863 pOptions
->pSaveOpt
->Commit();
864 if ( pOptions
->pLoadOpt
->IsModified() )
865 pOptions
->pLoadOpt
->Commit();
867 DELETEZ( pOptions
->pLoadOpt
);
868 DELETEZ( pOptions
->pSaveOpt
);
873 void SvtSaveOptions::SetAutoSaveTime( sal_Int32 n
)
875 pImp
->pSaveOpt
->SetAutoSaveTime( n
);
878 sal_Int32
SvtSaveOptions::GetAutoSaveTime() const
880 return pImp
->pSaveOpt
->GetAutoSaveTime();
883 void SvtSaveOptions::SetUseUserData( sal_Bool b
)
885 pImp
->pSaveOpt
->SetUseUserData( b
);
888 sal_Bool
SvtSaveOptions::IsUseUserData() const
890 return pImp
->pSaveOpt
->IsUseUserData();
893 void SvtSaveOptions::SetBackup( sal_Bool b
)
895 pImp
->pSaveOpt
->SetBackup( b
);
898 sal_Bool
SvtSaveOptions::IsBackup() const
900 return pImp
->pSaveOpt
->IsBackup();
903 void SvtSaveOptions::SetAutoSave( sal_Bool b
)
905 pImp
->pSaveOpt
->SetAutoSave( b
);
908 sal_Bool
SvtSaveOptions::IsAutoSave() const
910 return pImp
->pSaveOpt
->IsAutoSave();
913 void SvtSaveOptions::SetAutoSavePrompt( sal_Bool b
)
915 pImp
->pSaveOpt
->SetAutoSavePrompt( b
);
918 sal_Bool
SvtSaveOptions::IsAutoSavePrompt() const
920 return pImp
->pSaveOpt
->IsAutoSavePrompt();
923 void SvtSaveOptions::SetDocInfoSave(sal_Bool b
)
925 pImp
->pSaveOpt
->SetDocInfoSave( b
);
928 sal_Bool
SvtSaveOptions::IsDocInfoSave() const
930 return pImp
->pSaveOpt
->IsDocInfoSave();
933 void SvtSaveOptions::SetSaveWorkingSet( sal_Bool b
)
935 pImp
->pSaveOpt
->SetSaveWorkingSet( b
);
938 sal_Bool
SvtSaveOptions::IsSaveWorkingSet() const
940 return pImp
->pSaveOpt
->IsSaveWorkingSet();
943 void SvtSaveOptions::SetSaveDocWins( sal_Bool b
)
945 pImp
->pSaveOpt
->SetSaveDocWins( b
);
948 sal_Bool
SvtSaveOptions::IsSaveDocWins() const
950 return pImp
->pSaveOpt
->IsSaveDocWins();
953 void SvtSaveOptions::SetSaveDocView( sal_Bool b
)
955 pImp
->pSaveOpt
->SetSaveDocView( b
);
958 sal_Bool
SvtSaveOptions::IsSaveDocView() const
960 return pImp
->pSaveOpt
->IsSaveDocView();
963 void SvtSaveOptions::SetSaveRelINet( sal_Bool b
)
965 pImp
->pSaveOpt
->SetSaveRelINet( b
);
968 sal_Bool
SvtSaveOptions::IsSaveRelINet() const
970 return pImp
->pSaveOpt
->IsSaveRelINet();
973 void SvtSaveOptions::SetSaveRelFSys( sal_Bool b
)
975 pImp
->pSaveOpt
->SetSaveRelFSys( b
);
978 sal_Bool
SvtSaveOptions::IsSaveRelFSys() const
980 return pImp
->pSaveOpt
->IsSaveRelFSys();
983 void SvtSaveOptions::SetSaveUnpacked( sal_Bool b
)
985 pImp
->pSaveOpt
->SetSaveUnpacked( b
);
988 sal_Bool
SvtSaveOptions::IsSaveUnpacked() const
990 return pImp
->pSaveOpt
->IsSaveUnpacked();
993 void SvtSaveOptions::SetLoadUserSettings(sal_Bool b
)
995 pImp
->pLoadOpt
->SetLoadUserSettings(b
);
998 sal_Bool
SvtSaveOptions::IsLoadUserSettings() const
1000 return pImp
->pLoadOpt
->IsLoadUserSettings();
1003 void SvtSaveOptions::SetPrettyPrinting( sal_Bool _bEnable
)
1005 pImp
->pSaveOpt
->EnablePrettyPrinting( _bEnable
);
1008 sal_Bool
SvtSaveOptions::IsPrettyPrinting() const
1010 return pImp
->pSaveOpt
->IsPrettyPrintingEnabled();
1013 void SvtSaveOptions::SetWarnAlienFormat( sal_Bool _bEnable
)
1015 pImp
->pSaveOpt
->SetWarnAlienFormat( _bEnable
);
1018 sal_Bool
SvtSaveOptions::IsWarnAlienFormat() const
1020 return pImp
->pSaveOpt
->IsWarnAlienFormat();
1023 void SvtSaveOptions::SetLoadDocumentPrinter( sal_Bool _bEnable
)
1025 pImp
->pSaveOpt
->SetLoadDocPrinter( _bEnable
);
1028 sal_Bool
SvtSaveOptions::IsLoadDocumentPrinter() const
1030 return pImp
->pSaveOpt
->IsLoadDocPrinter();
1033 void SvtSaveOptions::SetODFDefaultVersion( SvtSaveOptions::ODFDefaultVersion eVersion
)
1035 pImp
->pSaveOpt
->SetODFDefaultVersion( eVersion
);
1038 SvtSaveOptions::ODFDefaultVersion
SvtSaveOptions::GetODFDefaultVersion() const
1040 return pImp
->pSaveOpt
->GetODFDefaultVersion();
1043 sal_Bool
SvtSaveOptions::IsReadOnly( SvtSaveOptions::EOption eOption
) const
1045 return pImp
->pSaveOpt
->IsReadOnly(eOption
);