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_012
)
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
)
477 eODFDefaultVersion
= SvtSaveOptions::ODFDefaultVersion( nTmp
);
479 DBG_ERRORFILE( "SvtSaveOptions_Impl::SvtSaveOptions_Impl(): Wrong Type!" );
481 bROAutoSaveTime
= pROStates
[nProp
];
487 sal_Bool bTemp
= sal_Bool();
488 if ( pValues
[nProp
] >>= bTemp
)
493 bUseUserData
= bTemp
;
494 bROUseUserData
= pROStates
[nProp
];
498 bROBackup
= pROStates
[nProp
];
502 bROAutoSave
= pROStates
[nProp
];
505 bAutoSavePrompt
= bTemp
;
506 bROAutoSavePrompt
= pROStates
[nProp
];
510 bRODocInfSave
= pROStates
[nProp
];
512 case SAVEWORKINGSET
:
513 bSaveWorkingSet
= bTemp
;
514 bROSaveWorkingSet
= pROStates
[nProp
];
517 bSaveDocWins
= bTemp
;
518 bROSaveDocWins
= pROStates
[nProp
];
521 bSaveDocView
= bTemp
;
522 bROSaveDocView
= pROStates
[nProp
];
525 bSaveRelFSys
= bTemp
;
526 bROSaveRelFSys
= pROStates
[nProp
];
529 bSaveRelINet
= bTemp
;
530 bROSaveRelINet
= pROStates
[nProp
];
533 bSaveUnpacked
= bTemp
;
534 bROSaveUnpacked
= pROStates
[nProp
];
538 bDoPrettyPrinting
= bTemp
;
539 bRODoPrettyPrinting
= pROStates
[nProp
];
542 case WARNALIENFORMAT
:
543 bWarnAlienFormat
= bTemp
;
544 bROWarnAlienFormat
= pROStates
[nProp
];
548 bLoadDocPrinter
= bTemp
;
549 bROLoadDocPrinter
= pROStates
[nProp
];
553 DBG_ERRORFILE( "invalid index to load a path" );
558 DBG_ERROR( "Wrong Type!" );
568 css::uno::Reference
< css::uno::XInterface
> xCFG
= ::comphelper::ConfigurationHelper::openConfig(
569 ::utl::getProcessServiceFactory(),
570 ::rtl::OUString::createFromAscii("org.openoffice.Office.Recovery"),
571 ::comphelper::ConfigurationHelper::E_READONLY
);
573 ::comphelper::ConfigurationHelper::readRelativeKey(
575 ::rtl::OUString::createFromAscii("AutoSave"),
576 ::rtl::OUString::createFromAscii("Enabled")) >>= bAutoSave
;
578 ::comphelper::ConfigurationHelper::readRelativeKey(
580 ::rtl::OUString::createFromAscii("AutoSave"),
581 ::rtl::OUString::createFromAscii("TimeIntervall")) >>= nAutoSaveTime
;
583 catch(const css::uno::Exception
&)
584 { DBG_ERROR("Could not find needed informations for AutoSave feature."); }
587 SvtSaveOptions_Impl::~SvtSaveOptions_Impl()
590 void SvtSaveOptions_Impl::Commit()
592 Sequence
< OUString
> aOrgNames
= GetPropertyNames();
593 OUString
* pOrgNames
= aOrgNames
.getArray();
594 sal_Int32 nOrgCount
= aOrgNames
.getLength();
596 Sequence
< OUString
> aNames( nOrgCount
);
597 Sequence
< Any
> aValues( nOrgCount
);
598 OUString
* pNames
= aNames
.getArray();
599 Any
* pValues
= aValues
.getArray();
600 sal_Int32 nRealCount
= 0;
602 for (sal_Int32 i
=0; i
<nOrgCount
; ++i
)
607 // not supported anymore
610 if (!bROAutoSaveTime
)
612 pValues
[nRealCount
] <<= nAutoSaveTime
;
613 pNames
[nRealCount
] = pOrgNames
[i
];
620 pValues
[nRealCount
] <<= bUseUserData
;
621 pNames
[nRealCount
] = pOrgNames
[i
];
628 pValues
[nRealCount
] <<= bBackup
;
629 pNames
[nRealCount
] = pOrgNames
[i
];
636 pValues
[nRealCount
] <<= bAutoSave
;
637 pNames
[nRealCount
] = pOrgNames
[i
];
642 if (!bROAutoSavePrompt
)
644 pValues
[nRealCount
] <<= bAutoSavePrompt
;
645 pNames
[nRealCount
] = pOrgNames
[i
];
652 pValues
[nRealCount
] <<= bDocInfSave
;
653 pNames
[nRealCount
] = pOrgNames
[i
];
657 case SAVEWORKINGSET
:
658 if (!bROSaveWorkingSet
)
660 pValues
[nRealCount
] <<= bSaveWorkingSet
;
661 pNames
[nRealCount
] = pOrgNames
[i
];
668 pValues
[nRealCount
] <<= bSaveDocWins
;
669 pNames
[nRealCount
] = pOrgNames
[i
];
676 pValues
[nRealCount
] <<= bSaveDocView
;
677 pNames
[nRealCount
] = pOrgNames
[i
];
684 pValues
[nRealCount
] <<= bSaveRelFSys
;
685 pNames
[nRealCount
] = pOrgNames
[i
];
692 pValues
[nRealCount
] <<= bSaveRelINet
;
693 pNames
[nRealCount
] = pOrgNames
[i
];
698 if (!bROSaveUnpacked
)
700 pValues
[nRealCount
] <<= bSaveUnpacked
;
701 pNames
[nRealCount
] = pOrgNames
[i
];
706 if (!bRODoPrettyPrinting
)
708 pValues
[nRealCount
] <<= bDoPrettyPrinting
;
709 pNames
[nRealCount
] = pOrgNames
[i
];
713 case WARNALIENFORMAT
:
714 if (!bROWarnAlienFormat
)
716 pValues
[nRealCount
] <<= bWarnAlienFormat
;
717 pNames
[nRealCount
] = pOrgNames
[i
];
722 if (!bROLoadDocPrinter
)
724 pValues
[nRealCount
] <<= bLoadDocPrinter
;
725 pNames
[nRealCount
] = pOrgNames
[i
];
729 case ODFDEFAULTVERSION
:
730 if (!bROODFDefaultVersion
)
732 pValues
[nRealCount
] <<= sal_Int16( eODFDefaultVersion
);
733 pNames
[nRealCount
] = pOrgNames
[i
];
738 DBG_ERRORFILE( "invalid index to save a path" );
742 aNames
.realloc(nRealCount
);
743 aValues
.realloc(nRealCount
);
744 PutProperties( aNames
, aValues
);
746 css::uno::Reference
< css::uno::XInterface
> xCFG
= ::comphelper::ConfigurationHelper::openConfig(
747 ::utl::getProcessServiceFactory(),
748 ::rtl::OUString::createFromAscii("org.openoffice.Office.Recovery"),
749 ::comphelper::ConfigurationHelper::E_STANDARD
);
751 ::comphelper::ConfigurationHelper::writeRelativeKey(
753 ::rtl::OUString::createFromAscii("AutoSave"),
754 ::rtl::OUString::createFromAscii("TimeIntervall"),
755 css::uno::makeAny(nAutoSaveTime
));
757 ::comphelper::ConfigurationHelper::writeRelativeKey(
759 ::rtl::OUString::createFromAscii("AutoSave"),
760 ::rtl::OUString::createFromAscii("Enabled"),
761 css::uno::makeAny(bAutoSave
));
763 ::comphelper::ConfigurationHelper::flush(xCFG
);
766 // -----------------------------------------------------------------------
768 void SvtSaveOptions_Impl::Notify( const Sequence
<rtl::OUString
>& )
773 class SvtLoadOptions_Impl
: public utl::ConfigItem
776 sal_Bool bLoadUserDefinedSettings
;
779 SvtLoadOptions_Impl();
780 ~SvtLoadOptions_Impl();
782 virtual void Notify( const com::sun::star::uno::Sequence
< rtl::OUString
>& aPropertyNames
);
783 virtual void Commit();
785 void SetLoadUserSettings(sal_Bool b
){bLoadUserDefinedSettings
= b
; SetModified();}
786 sal_Bool
IsLoadUserSettings() const {return bLoadUserDefinedSettings
;}
788 // -----------------------------------------------------------------------
789 const sal_Char cUserDefinedSettings
[] = "UserDefinedSettings";
791 SvtLoadOptions_Impl::SvtLoadOptions_Impl()
792 : ConfigItem( OUString::createFromAscii("Office.Common/Load") )
793 , bLoadUserDefinedSettings( sal_False
)
795 Sequence
< OUString
> aNames(1);
796 aNames
[0] = OUString::createFromAscii(cUserDefinedSettings
);
797 Sequence
< Any
> aValues
= GetProperties( aNames
);
798 EnableNotification( aNames
);
799 const Any
* pValues
= aValues
.getConstArray();
800 DBG_ASSERT( aValues
.getLength() == aNames
.getLength(), "GetProperties failed" );
801 if (pValues
[0].getValueTypeClass() == ::com::sun::star::uno::TypeClass_BOOLEAN
)
802 bLoadUserDefinedSettings
= *(sal_Bool
*)pValues
[0].getValue();
804 // -----------------------------------------------------------------------
805 SvtLoadOptions_Impl::~SvtLoadOptions_Impl()
808 // -----------------------------------------------------------------------
809 void SvtLoadOptions_Impl::Commit()
811 Sequence
< OUString
> aNames(1);
812 aNames
[0] = OUString::createFromAscii(cUserDefinedSettings
);
813 Sequence
< Any
> aValues( 1 );
814 aValues
[0].setValue(&bLoadUserDefinedSettings
, ::getBooleanCppuType());
815 PutProperties( aNames
, aValues
);
817 // -----------------------------------------------------------------------
818 void SvtLoadOptions_Impl::Notify( const Sequence
<rtl::OUString
>& )
820 DBG_ERRORFILE( "properties have been changed" );
822 // -----------------------------------------------------------------------
826 class LocalSingleton
: public rtl::Static
< osl::Mutex
, LocalSingleton
>
831 // -----------------------------------------------------------------------
832 SvtSaveOptions::SvtSaveOptions()
834 // Global access, must be guarded (multithreading)
835 ::osl::MutexGuard
aGuard( LocalSingleton::get() );
838 RTL_LOGFILE_CONTEXT(aLog
, "svtools ( ??? ) ::SvtSaveOptions_Impl::ctor()");
839 pOptions
= new SvtLoadSaveOptions_Impl
;
840 pOptions
->pSaveOpt
= new SvtSaveOptions_Impl
;
841 pOptions
->pLoadOpt
= new SvtLoadOptions_Impl
;
843 ItemHolder1::holdConfigItem(E_SAVEOPTIONS
);
849 // -----------------------------------------------------------------------
851 SvtSaveOptions::~SvtSaveOptions()
853 // Global access, must be guarded (multithreading)
854 ::osl::MutexGuard
aGuard( LocalSingleton::get() );
857 if ( pOptions
->pSaveOpt
->IsModified() )
858 pOptions
->pSaveOpt
->Commit();
859 if ( pOptions
->pLoadOpt
->IsModified() )
860 pOptions
->pLoadOpt
->Commit();
862 DELETEZ( pOptions
->pLoadOpt
);
863 DELETEZ( pOptions
->pSaveOpt
);
868 void SvtSaveOptions::SetAutoSaveTime( sal_Int32 n
)
870 pImp
->pSaveOpt
->SetAutoSaveTime( n
);
873 sal_Int32
SvtSaveOptions::GetAutoSaveTime() const
875 return pImp
->pSaveOpt
->GetAutoSaveTime();
878 void SvtSaveOptions::SetUseUserData( sal_Bool b
)
880 pImp
->pSaveOpt
->SetUseUserData( b
);
883 sal_Bool
SvtSaveOptions::IsUseUserData() const
885 return pImp
->pSaveOpt
->IsUseUserData();
888 void SvtSaveOptions::SetBackup( sal_Bool b
)
890 pImp
->pSaveOpt
->SetBackup( b
);
893 sal_Bool
SvtSaveOptions::IsBackup() const
895 return pImp
->pSaveOpt
->IsBackup();
898 void SvtSaveOptions::SetAutoSave( sal_Bool b
)
900 pImp
->pSaveOpt
->SetAutoSave( b
);
903 sal_Bool
SvtSaveOptions::IsAutoSave() const
905 return pImp
->pSaveOpt
->IsAutoSave();
908 void SvtSaveOptions::SetAutoSavePrompt( sal_Bool b
)
910 pImp
->pSaveOpt
->SetAutoSavePrompt( b
);
913 sal_Bool
SvtSaveOptions::IsAutoSavePrompt() const
915 return pImp
->pSaveOpt
->IsAutoSavePrompt();
918 void SvtSaveOptions::SetDocInfoSave(sal_Bool b
)
920 pImp
->pSaveOpt
->SetDocInfoSave( b
);
923 sal_Bool
SvtSaveOptions::IsDocInfoSave() const
925 return pImp
->pSaveOpt
->IsDocInfoSave();
928 void SvtSaveOptions::SetSaveWorkingSet( sal_Bool b
)
930 pImp
->pSaveOpt
->SetSaveWorkingSet( b
);
933 sal_Bool
SvtSaveOptions::IsSaveWorkingSet() const
935 return pImp
->pSaveOpt
->IsSaveWorkingSet();
938 void SvtSaveOptions::SetSaveDocWins( sal_Bool b
)
940 pImp
->pSaveOpt
->SetSaveDocWins( b
);
943 sal_Bool
SvtSaveOptions::IsSaveDocWins() const
945 return pImp
->pSaveOpt
->IsSaveDocWins();
948 void SvtSaveOptions::SetSaveDocView( sal_Bool b
)
950 pImp
->pSaveOpt
->SetSaveDocView( b
);
953 sal_Bool
SvtSaveOptions::IsSaveDocView() const
955 return pImp
->pSaveOpt
->IsSaveDocView();
958 void SvtSaveOptions::SetSaveRelINet( sal_Bool b
)
960 pImp
->pSaveOpt
->SetSaveRelINet( b
);
963 sal_Bool
SvtSaveOptions::IsSaveRelINet() const
965 return pImp
->pSaveOpt
->IsSaveRelINet();
968 void SvtSaveOptions::SetSaveRelFSys( sal_Bool b
)
970 pImp
->pSaveOpt
->SetSaveRelFSys( b
);
973 sal_Bool
SvtSaveOptions::IsSaveRelFSys() const
975 return pImp
->pSaveOpt
->IsSaveRelFSys();
978 void SvtSaveOptions::SetSaveUnpacked( sal_Bool b
)
980 pImp
->pSaveOpt
->SetSaveUnpacked( b
);
983 sal_Bool
SvtSaveOptions::IsSaveUnpacked() const
985 return pImp
->pSaveOpt
->IsSaveUnpacked();
988 void SvtSaveOptions::SetLoadUserSettings(sal_Bool b
)
990 pImp
->pLoadOpt
->SetLoadUserSettings(b
);
993 sal_Bool
SvtSaveOptions::IsLoadUserSettings() const
995 return pImp
->pLoadOpt
->IsLoadUserSettings();
998 void SvtSaveOptions::SetPrettyPrinting( sal_Bool _bEnable
)
1000 pImp
->pSaveOpt
->EnablePrettyPrinting( _bEnable
);
1003 sal_Bool
SvtSaveOptions::IsPrettyPrinting() const
1005 return pImp
->pSaveOpt
->IsPrettyPrintingEnabled();
1008 void SvtSaveOptions::SetWarnAlienFormat( sal_Bool _bEnable
)
1010 pImp
->pSaveOpt
->SetWarnAlienFormat( _bEnable
);
1013 sal_Bool
SvtSaveOptions::IsWarnAlienFormat() const
1015 return pImp
->pSaveOpt
->IsWarnAlienFormat();
1018 void SvtSaveOptions::SetLoadDocumentPrinter( sal_Bool _bEnable
)
1020 pImp
->pSaveOpt
->SetLoadDocPrinter( _bEnable
);
1023 sal_Bool
SvtSaveOptions::IsLoadDocumentPrinter() const
1025 return pImp
->pSaveOpt
->IsLoadDocPrinter();
1028 void SvtSaveOptions::SetODFDefaultVersion( SvtSaveOptions::ODFDefaultVersion eVersion
)
1030 pImp
->pSaveOpt
->SetODFDefaultVersion( eVersion
);
1033 SvtSaveOptions::ODFDefaultVersion
SvtSaveOptions::GetODFDefaultVersion() const
1035 return pImp
->pSaveOpt
->GetODFDefaultVersion();
1038 sal_Bool
SvtSaveOptions::IsReadOnly( SvtSaveOptions::EOption eOption
) const
1040 return pImp
->pSaveOpt
->IsReadOnly(eOption
);