xref: /aoo42x/main/sfx2/source/appl/appcfg.cxx (revision 972a6c96)
1d119d52dSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3d119d52dSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4d119d52dSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5d119d52dSAndrew Rist  * distributed with this work for additional information
6d119d52dSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7d119d52dSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8d119d52dSAndrew Rist  * "License"); you may not use this file except in compliance
9d119d52dSAndrew Rist  * with the License.  You may obtain a copy of the License at
10d119d52dSAndrew Rist  *
11d119d52dSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12d119d52dSAndrew Rist  *
13d119d52dSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14d119d52dSAndrew Rist  * software distributed under the License is distributed on an
15d119d52dSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16d119d52dSAndrew Rist  * KIND, either express or implied.  See the License for the
17d119d52dSAndrew Rist  * specific language governing permissions and limitations
18d119d52dSAndrew Rist  * under the License.
19d119d52dSAndrew Rist  *
20d119d52dSAndrew Rist  *************************************************************/
21d119d52dSAndrew Rist 
22d119d52dSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_sfx2.hxx"
26cdf0e10cSrcweir #include <com/sun/star/uno/Reference.hxx>
27cdf0e10cSrcweir #include <com/sun/star/frame/XDesktop.hpp>
28cdf0e10cSrcweir #include <com/sun/star/util/XURLTransformer.hpp>
29cdf0e10cSrcweir #ifndef _COM_SUN_STAR_BEANS_PropertyValue_HPP_
30cdf0e10cSrcweir #include <com/sun/star/beans/PropertyValue.hpp>
31cdf0e10cSrcweir #endif
32cdf0e10cSrcweir #include <com/sun/star/beans/XPropertySet.hpp>
33cdf0e10cSrcweir #include <com/sun/star/util/XFlushable.hpp>
34cdf0e10cSrcweir 
35cdf0e10cSrcweir #ifndef _STDLIB_H
36cdf0e10cSrcweir #include <stdlib.h>
37cdf0e10cSrcweir #endif
38cdf0e10cSrcweir #include <tools/config.hxx>
39cdf0e10cSrcweir #include <vcl/sound.hxx>
40cdf0e10cSrcweir #include <vcl/msgbox.hxx>
41cdf0e10cSrcweir #include <tools/string.hxx>
42cdf0e10cSrcweir #include <svl/itempool.hxx>
43cdf0e10cSrcweir #include <svl/aeitem.hxx>
44cdf0e10cSrcweir #include <svl/slstitm.hxx>
45cdf0e10cSrcweir #include <svl/stritem.hxx>
46cdf0e10cSrcweir #include <svl/intitem.hxx>
47cdf0e10cSrcweir #include <svl/eitem.hxx>
48cdf0e10cSrcweir #include <svl/szitem.hxx>
49cdf0e10cSrcweir #include <svl/undo.hxx>
50cdf0e10cSrcweir 
51cdf0e10cSrcweir #define _SVSTDARR_STRINGS
52cdf0e10cSrcweir #include <svl/svstdarr.hxx>
53cdf0e10cSrcweir #include <svtools/ttprops.hxx>
54cdf0e10cSrcweir #include <sfx2/sfxsids.hrc>
55cdf0e10cSrcweir #include <sot/exchange.hxx>
56cdf0e10cSrcweir 
57cdf0e10cSrcweir #include <svl/isethint.hxx>
58cdf0e10cSrcweir 
59cdf0e10cSrcweir #include <unotools/configmgr.hxx>
60cdf0e10cSrcweir #include <tools/urlobj.hxx>
61cdf0e10cSrcweir #include <tools/wldcrd.hxx>
62cdf0e10cSrcweir #include <unotools/saveopt.hxx>
63cdf0e10cSrcweir #include <svtools/helpopt.hxx>
64cdf0e10cSrcweir #include <unotools/undoopt.hxx>
65cdf0e10cSrcweir #include <unotools/securityoptions.hxx>
66cdf0e10cSrcweir #include <unotools/pathoptions.hxx>
67cdf0e10cSrcweir #include <unotools/inetoptions.hxx>
68cdf0e10cSrcweir #include <svtools/miscopt.hxx>
69cdf0e10cSrcweir #include <vcl/toolbox.hxx>
70cdf0e10cSrcweir #include <unotools/localfilehelper.hxx>
71cdf0e10cSrcweir #include <comphelper/processfactory.hxx>
72cdf0e10cSrcweir #include <rtl/ustrbuf.hxx>
73cdf0e10cSrcweir 
74cdf0e10cSrcweir #include <sfx2/app.hxx>
75cdf0e10cSrcweir #include <sfx2/docfile.hxx>
76cdf0e10cSrcweir #include <sfx2/viewfrm.hxx>
77cdf0e10cSrcweir #include "sfx2/sfxhelp.hxx"
78cdf0e10cSrcweir #include "sfxtypes.hxx"
79cdf0e10cSrcweir #include <sfx2/dispatch.hxx>
80cdf0e10cSrcweir #include <sfx2/objsh.hxx>
81cdf0e10cSrcweir #include "objshimp.hxx"
82cdf0e10cSrcweir #include <sfx2/viewsh.hxx>
83cdf0e10cSrcweir #include <sfx2/request.hxx>
84cdf0e10cSrcweir #include <sfx2/evntconf.hxx>
85cdf0e10cSrcweir #include "appdata.hxx"
86cdf0e10cSrcweir #include "workwin.hxx"
87cdf0e10cSrcweir #include "helper.hxx"	// SfxContentHelper::...
88cdf0e10cSrcweir #include "app.hrc"
89cdf0e10cSrcweir #include "sfx2/sfxresid.hxx"
90cdf0e10cSrcweir #include "shutdownicon.hxx"
91cdf0e10cSrcweir 
92cdf0e10cSrcweir using namespace ::com::sun::star::uno;
93cdf0e10cSrcweir using namespace ::com::sun::star::util;
94cdf0e10cSrcweir using namespace ::com::sun::star::frame;
95cdf0e10cSrcweir using namespace ::com::sun::star::beans;
96cdf0e10cSrcweir 
97cdf0e10cSrcweir //-------------------------------------------------------------------------
98cdf0e10cSrcweir 
99cdf0e10cSrcweir class SfxEventAsyncer_Impl : public SfxListener
100cdf0e10cSrcweir {
101cdf0e10cSrcweir     SfxEventHint        aHint;
102cdf0e10cSrcweir     Timer*              pTimer;
103cdf0e10cSrcweir 
104cdf0e10cSrcweir public:
105cdf0e10cSrcweir 
106cdf0e10cSrcweir 	virtual void		Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
107cdf0e10cSrcweir     SfxEventAsyncer_Impl( const SfxEventHint& rHint );
108cdf0e10cSrcweir     ~SfxEventAsyncer_Impl();
109cdf0e10cSrcweir 	DECL_LINK( TimerHdl, Timer*);
110cdf0e10cSrcweir };
111cdf0e10cSrcweir 
112cdf0e10cSrcweir // -----------------------------------------------------------------------
113cdf0e10cSrcweir 
Notify(SfxBroadcaster &,const SfxHint & rHint)114cdf0e10cSrcweir void SfxEventAsyncer_Impl::Notify( SfxBroadcaster&, const SfxHint& rHint )
115cdf0e10cSrcweir {
116cdf0e10cSrcweir 	SfxSimpleHint* pHint = PTR_CAST( SfxSimpleHint, &rHint );
117cdf0e10cSrcweir 	if( pHint && pHint->GetId() == SFX_HINT_DYING && pTimer->IsActive() )
118cdf0e10cSrcweir 	{
119cdf0e10cSrcweir 		pTimer->Stop();
120cdf0e10cSrcweir 		delete this;
121cdf0e10cSrcweir 	}
122cdf0e10cSrcweir }
123cdf0e10cSrcweir 
124cdf0e10cSrcweir // -----------------------------------------------------------------------
125cdf0e10cSrcweir 
SfxEventAsyncer_Impl(const SfxEventHint & rHint)126cdf0e10cSrcweir SfxEventAsyncer_Impl::SfxEventAsyncer_Impl( const SfxEventHint& rHint )
127cdf0e10cSrcweir  : aHint( rHint )
128cdf0e10cSrcweir {
129cdf0e10cSrcweir     if( rHint.GetObjShell() )
130cdf0e10cSrcweir         StartListening( *rHint.GetObjShell() );
131cdf0e10cSrcweir 	pTimer = new Timer;
132cdf0e10cSrcweir     pTimer->SetTimeoutHdl( LINK(this, SfxEventAsyncer_Impl, TimerHdl) );
133cdf0e10cSrcweir 	pTimer->SetTimeout( 0 );
134cdf0e10cSrcweir 	pTimer->Start();
135cdf0e10cSrcweir }
136cdf0e10cSrcweir 
137cdf0e10cSrcweir // -----------------------------------------------------------------------
138cdf0e10cSrcweir 
~SfxEventAsyncer_Impl()139cdf0e10cSrcweir SfxEventAsyncer_Impl::~SfxEventAsyncer_Impl()
140cdf0e10cSrcweir {
141cdf0e10cSrcweir 	delete pTimer;
142cdf0e10cSrcweir }
143cdf0e10cSrcweir 
144cdf0e10cSrcweir // -----------------------------------------------------------------------
145cdf0e10cSrcweir 
IMPL_LINK(SfxEventAsyncer_Impl,TimerHdl,Timer *,pAsyncTimer)146cdf0e10cSrcweir IMPL_LINK(SfxEventAsyncer_Impl, TimerHdl, Timer*, pAsyncTimer)
147cdf0e10cSrcweir {
148cdf0e10cSrcweir     (void)pAsyncTimer; // unused variable
149cdf0e10cSrcweir     SfxObjectShellRef xRef( aHint.GetObjShell() );
150cdf0e10cSrcweir     pAsyncTimer->Stop();
151cdf0e10cSrcweir #ifdef DBG_UTIL
152cdf0e10cSrcweir 	if (!xRef.Is())
153cdf0e10cSrcweir 	{
154cdf0e10cSrcweir 		ByteString aTmp( "SfxEvent: ");
155cdf0e10cSrcweir 		aTmp += ByteString( String( aHint.GetEventName() ), RTL_TEXTENCODING_UTF8 );
156cdf0e10cSrcweir 		DBG_TRACE( aTmp.GetBuffer() );
157cdf0e10cSrcweir 	}
158cdf0e10cSrcweir #endif
159cdf0e10cSrcweir     SFX_APP()->Broadcast( aHint );
160cdf0e10cSrcweir     if ( xRef.Is() )
161cdf0e10cSrcweir         xRef->Broadcast( aHint );
162cdf0e10cSrcweir     delete this;
163cdf0e10cSrcweir 	return 0L;
164cdf0e10cSrcweir }
165cdf0e10cSrcweir 
166cdf0e10cSrcweir 
167cdf0e10cSrcweir //--------------------------------------------------------------------
168cdf0e10cSrcweir 
GetOptions(SfxItemSet & rSet)169cdf0e10cSrcweir sal_Bool SfxApplication::GetOptions( SfxItemSet& rSet )
170cdf0e10cSrcweir {
171cdf0e10cSrcweir     sal_Bool bRet = sal_False;
172cdf0e10cSrcweir     SfxItemPool &rPool = GetPool();
173cdf0e10cSrcweir 	String aTRUEStr('1');
174cdf0e10cSrcweir 
175cdf0e10cSrcweir 	const sal_uInt16 *pRanges = rSet.GetRanges();
176cdf0e10cSrcweir     SvtSaveOptions aSaveOptions;
177cdf0e10cSrcweir     SvtUndoOptions aUndoOptions;
178cdf0e10cSrcweir     SvtHelpOptions aHelpOptions;
179cdf0e10cSrcweir 	SvtInetOptions aInetOptions;
180cdf0e10cSrcweir 	SvtSecurityOptions	aSecurityOptions;
181cdf0e10cSrcweir     SvtMiscOptions aMiscOptions;
182cdf0e10cSrcweir 
183cdf0e10cSrcweir 	while ( *pRanges )
184cdf0e10cSrcweir 	{
185cdf0e10cSrcweir 		for(sal_uInt16 nWhich = *pRanges++; nWhich <= *pRanges; ++nWhich)
186cdf0e10cSrcweir 		{
187cdf0e10cSrcweir 			switch(nWhich)
188cdf0e10cSrcweir 			{
189cdf0e10cSrcweir     			case SID_ATTR_BUTTON_OUTSTYLE3D :
190cdf0e10cSrcweir 					if(rSet.Put( SfxBoolItem( rPool.GetWhich( SID_ATTR_BUTTON_OUTSTYLE3D ),
191cdf0e10cSrcweir                               aMiscOptions.GetToolboxStyle() != TOOLBOX_STYLE_FLAT)))
192cdf0e10cSrcweir 						bRet = sal_True;
193cdf0e10cSrcweir 					break;
194cdf0e10cSrcweir     			case SID_ATTR_BUTTON_BIGSIZE :
195cdf0e10cSrcweir                 {
196cdf0e10cSrcweir 					if( rSet.Put( SfxBoolItem( rPool.GetWhich( SID_ATTR_BUTTON_BIGSIZE ), aMiscOptions.AreCurrentSymbolsLarge() ) ) )
197cdf0e10cSrcweir 						bRet = sal_True;
198cdf0e10cSrcweir 					break;
199cdf0e10cSrcweir                 }
200cdf0e10cSrcweir     			case SID_ATTR_BACKUP :
201cdf0e10cSrcweir                     {
202cdf0e10cSrcweir                         bRet = sal_True;
203cdf0e10cSrcweir                         if (!aSaveOptions.IsReadOnly(SvtSaveOptions::E_BACKUP))
204cdf0e10cSrcweir                             if (!rSet.Put( SfxBoolItem( rPool.GetWhich( SID_ATTR_BACKUP ),aSaveOptions.IsBackup())))
205cdf0e10cSrcweir                                 bRet = sal_False;
206cdf0e10cSrcweir                     }
207cdf0e10cSrcweir 					break;
208*972a6c96SJuergen Schmidt                 case SID_ATTR_ODFENCRYPTION:
209*972a6c96SJuergen Schmidt                     {
210*972a6c96SJuergen Schmidt                         bRet = sal_True;
211*972a6c96SJuergen Schmidt                         if (!aSaveOptions.IsReadOnly(SvtSaveOptions::E_USESHA1INODF12) &&
212*972a6c96SJuergen Schmidt                             !aSaveOptions.IsReadOnly(SvtSaveOptions::E_USEBLOWFISHINODF12))
213*972a6c96SJuergen Schmidt                             if (!rSet.Put( SfxBoolItem( rPool.GetWhich( SID_ATTR_ODFENCRYPTION ),
214*972a6c96SJuergen Schmidt                                                         !(aSaveOptions.IsUseSHA1InODF12() && aSaveOptions.IsUseBlowfishInODF12()))))
215*972a6c96SJuergen Schmidt                                 bRet = sal_False;
216*972a6c96SJuergen Schmidt                     }
217*972a6c96SJuergen Schmidt 					break;
218cdf0e10cSrcweir     			case SID_ATTR_PRETTYPRINTING:
219cdf0e10cSrcweir                     {
220cdf0e10cSrcweir                         bRet = sal_True;
221cdf0e10cSrcweir                         if (!aSaveOptions.IsReadOnly(SvtSaveOptions::E_DOPRETTYPRINTING))
222cdf0e10cSrcweir                             if (!rSet.Put( SfxBoolItem( rPool.GetWhich( SID_ATTR_PRETTYPRINTING ), aSaveOptions.IsPrettyPrinting())))
223cdf0e10cSrcweir                                 bRet = sal_False;
224cdf0e10cSrcweir                     }
225cdf0e10cSrcweir 					break;
226cdf0e10cSrcweir                 case SID_ATTR_WARNALIENFORMAT:
227cdf0e10cSrcweir                     {
228cdf0e10cSrcweir                         bRet = sal_True;
229cdf0e10cSrcweir                         if (!aSaveOptions.IsReadOnly(SvtSaveOptions::E_WARNALIENFORMAT))
230cdf0e10cSrcweir                             if (!rSet.Put( SfxBoolItem( rPool.GetWhich( SID_ATTR_WARNALIENFORMAT ), aSaveOptions.IsWarnAlienFormat())))
231cdf0e10cSrcweir                                 bRet = sal_False;
232cdf0e10cSrcweir                     }
233cdf0e10cSrcweir 					break;
234cdf0e10cSrcweir     			case SID_ATTR_AUTOSAVE :
235cdf0e10cSrcweir                     {
236cdf0e10cSrcweir                         bRet = sal_True;
237cdf0e10cSrcweir                         if (!aSaveOptions.IsReadOnly(SvtSaveOptions::E_AUTOSAVE))
238cdf0e10cSrcweir                             if (!rSet.Put( SfxBoolItem( rPool.GetWhich( SID_ATTR_AUTOSAVE ), aSaveOptions.IsAutoSave())))
239cdf0e10cSrcweir                                 bRet = sal_False;
240cdf0e10cSrcweir                     }
241cdf0e10cSrcweir 					break;
242cdf0e10cSrcweir 				case SID_ATTR_AUTOSAVEPROMPT :
243cdf0e10cSrcweir                     {
244cdf0e10cSrcweir                         bRet = sal_True;
245cdf0e10cSrcweir                         if (!aSaveOptions.IsReadOnly(SvtSaveOptions::E_AUTOSAVEPROMPT))
246cdf0e10cSrcweir                             if (!rSet.Put( SfxBoolItem( rPool.GetWhich( SID_ATTR_AUTOSAVEPROMPT ), aSaveOptions.IsAutoSavePrompt())))
247cdf0e10cSrcweir                                 bRet = sal_False;
248cdf0e10cSrcweir                     }
249cdf0e10cSrcweir 					break;
250cdf0e10cSrcweir     			case SID_ATTR_AUTOSAVEMINUTE :
251cdf0e10cSrcweir                     {
252cdf0e10cSrcweir                         bRet = sal_True;
253cdf0e10cSrcweir                         if (!aSaveOptions.IsReadOnly(SvtSaveOptions::E_AUTOSAVETIME))
254cdf0e10cSrcweir                             if (!rSet.Put( SfxUInt16Item( rPool.GetWhich( SID_ATTR_AUTOSAVEMINUTE ), (sal_uInt16)aSaveOptions.GetAutoSaveTime())))
255cdf0e10cSrcweir                                 bRet = sal_False;
256cdf0e10cSrcweir                     }
257cdf0e10cSrcweir 					break;
258cdf0e10cSrcweir     			case SID_ATTR_DOCINFO :
259cdf0e10cSrcweir                     {
260cdf0e10cSrcweir                         bRet = sal_True;
261cdf0e10cSrcweir                         if (!aSaveOptions.IsReadOnly(SvtSaveOptions::E_DOCINFSAVE))
262cdf0e10cSrcweir                             if (!rSet.Put( SfxBoolItem( rPool.GetWhich( SID_ATTR_DOCINFO ), aSaveOptions.IsDocInfoSave())))
263cdf0e10cSrcweir                                 bRet = sal_False;
264cdf0e10cSrcweir                     }
265cdf0e10cSrcweir 					break;
266cdf0e10cSrcweir     			case SID_ATTR_WORKINGSET :
267cdf0e10cSrcweir                     {
268cdf0e10cSrcweir                         bRet = sal_True;
269cdf0e10cSrcweir                         if (!aSaveOptions.IsReadOnly(SvtSaveOptions::E_SAVEWORKINGSET))
270cdf0e10cSrcweir                             if (!rSet.Put( SfxBoolItem( rPool.GetWhich( SID_ATTR_WORKINGSET ), aSaveOptions.IsSaveWorkingSet())))
271cdf0e10cSrcweir                                 bRet = sal_False;
272cdf0e10cSrcweir                     }
273cdf0e10cSrcweir 					break;
274cdf0e10cSrcweir     			case SID_ATTR_SAVEDOCVIEW :
275cdf0e10cSrcweir                     {
276cdf0e10cSrcweir                         bRet = sal_True;
277cdf0e10cSrcweir                         if (!aSaveOptions.IsReadOnly(SvtSaveOptions::E_SAVEDOCVIEW))
278cdf0e10cSrcweir                             if (!rSet.Put( SfxBoolItem( rPool.GetWhich( SID_ATTR_SAVEDOCVIEW ), aSaveOptions.IsSaveDocView())))
279cdf0e10cSrcweir                                 bRet = sal_False;
280cdf0e10cSrcweir                     }
281cdf0e10cSrcweir 					break;
282cdf0e10cSrcweir     			case SID_ATTR_METRIC :
283cdf0e10cSrcweir //                    if(rSet.Put( SfxUInt16Item( rPool.GetWhich( SID_ATTR_METRIC ),
284cdf0e10cSrcweir //                                pOptions->GetMetric() ) ) )
285cdf0e10cSrcweir //                        bRet = sal_True;
286cdf0e10cSrcweir 					break;
287cdf0e10cSrcweir     			case SID_HELPBALLOONS :
288cdf0e10cSrcweir 					if(rSet.Put( SfxBoolItem ( rPool.GetWhich( SID_HELPBALLOONS ),
289cdf0e10cSrcweir                                aHelpOptions.IsExtendedHelp() ) ) )
290cdf0e10cSrcweir         				bRet = sal_True;
291cdf0e10cSrcweir 					break;
292cdf0e10cSrcweir     			case SID_HELPTIPS :
293cdf0e10cSrcweir 					if(rSet.Put( SfxBoolItem ( rPool.GetWhich( SID_HELPTIPS ),
294cdf0e10cSrcweir                                aHelpOptions.IsHelpTips() ) ) )
295cdf0e10cSrcweir         				bRet = sal_True;
296cdf0e10cSrcweir 					break;
297cdf0e10cSrcweir     			case SID_ATTR_AUTOHELPAGENT :
298cdf0e10cSrcweir 					if(rSet.Put( SfxBoolItem ( rPool.GetWhich( SID_ATTR_AUTOHELPAGENT ),
299cdf0e10cSrcweir                                aHelpOptions.IsHelpAgentAutoStartMode() ) ) )
300cdf0e10cSrcweir         				bRet = sal_True;
301cdf0e10cSrcweir 					break;
302cdf0e10cSrcweir     			case SID_HELPAGENT_TIMEOUT :
303cdf0e10cSrcweir 					if ( rSet.Put( SfxInt32Item( rPool.GetWhich( SID_HELPAGENT_TIMEOUT ),
304cdf0e10cSrcweir 												 aHelpOptions.GetHelpAgentTimeoutPeriod() ) ) )
305cdf0e10cSrcweir         				bRet = sal_True;
306cdf0e10cSrcweir 					break;
307cdf0e10cSrcweir     			case SID_ATTR_WELCOMESCREEN :
308cdf0e10cSrcweir 					if(rSet.Put( SfxBoolItem ( rPool.GetWhich( SID_ATTR_WELCOMESCREEN ),
309cdf0e10cSrcweir                                aHelpOptions.IsWelcomeScreen() ) ) )
310cdf0e10cSrcweir         				bRet = sal_True;
311cdf0e10cSrcweir 					break;
312cdf0e10cSrcweir                 case SID_HELP_STYLESHEET :
313cdf0e10cSrcweir                     if(rSet.Put( SfxStringItem ( rPool.GetWhich( SID_HELP_STYLESHEET ),
314cdf0e10cSrcweir                                aHelpOptions.GetHelpStyleSheet() ) ) )
315cdf0e10cSrcweir         				bRet = sal_True;
316cdf0e10cSrcweir                 break;
317cdf0e10cSrcweir     			case SID_ATTR_UNDO_COUNT :
318cdf0e10cSrcweir 					if(rSet.Put( SfxUInt16Item ( rPool.GetWhich( SID_ATTR_UNDO_COUNT ),
319cdf0e10cSrcweir                                  (sal_uInt16)aUndoOptions.GetUndoCount() ) ) )
320cdf0e10cSrcweir         				bRet = sal_True;
321cdf0e10cSrcweir 					break;
322cdf0e10cSrcweir     			case SID_ATTR_QUICKLAUNCHER :
323cdf0e10cSrcweir                 {
324cdf0e10cSrcweir                     if ( ShutdownIcon::IsQuickstarterInstalled() )
325cdf0e10cSrcweir                     {
326cdf0e10cSrcweir                         if ( rSet.Put( SfxBoolItem( rPool.GetWhich( SID_ATTR_QUICKLAUNCHER ),
327cdf0e10cSrcweir                                                     ShutdownIcon::GetAutostart() ) ) )
328cdf0e10cSrcweir                             bRet = sal_True;
329cdf0e10cSrcweir                     }
330cdf0e10cSrcweir                     else
331cdf0e10cSrcweir                     {
332cdf0e10cSrcweir                         rSet.DisableItem( rPool.GetWhich( SID_ATTR_QUICKLAUNCHER ) );
333cdf0e10cSrcweir                         bRet = sal_True;
334cdf0e10cSrcweir                     }
335cdf0e10cSrcweir 					break;
336cdf0e10cSrcweir                 }
337cdf0e10cSrcweir     			case SID_SAVEREL_INET :
338cdf0e10cSrcweir                     {
339cdf0e10cSrcweir                         bRet = sal_True;
340cdf0e10cSrcweir                         if (!aSaveOptions.IsReadOnly(SvtSaveOptions::E_SAVERELINET))
341cdf0e10cSrcweir                             if (!rSet.Put( SfxBoolItem ( rPool.GetWhich( SID_SAVEREL_INET ), aSaveOptions.IsSaveRelINet() )))
342cdf0e10cSrcweir                                 bRet = sal_False;
343cdf0e10cSrcweir                     }
344cdf0e10cSrcweir 					break;
345cdf0e10cSrcweir     			case SID_SAVEREL_FSYS :
346cdf0e10cSrcweir                     {
347cdf0e10cSrcweir                         bRet = sal_True;
348cdf0e10cSrcweir                         if (!aSaveOptions.IsReadOnly(SvtSaveOptions::E_SAVERELFSYS))
349cdf0e10cSrcweir                             if (!rSet.Put( SfxBoolItem ( rPool.GetWhich( SID_SAVEREL_FSYS ), aSaveOptions.IsSaveRelFSys() )))
350cdf0e10cSrcweir                                 bRet = sal_False;
351cdf0e10cSrcweir                     }
352cdf0e10cSrcweir 					break;
353cdf0e10cSrcweir                 case SID_BASIC_ENABLED :
354cdf0e10cSrcweir                     {
355cdf0e10cSrcweir                         bRet = sal_True;
356cdf0e10cSrcweir                         if (!aSecurityOptions.IsReadOnly(SvtSecurityOptions::E_BASICMODE))
357cdf0e10cSrcweir                         {
358cdf0e10cSrcweir                             if ( !rSet.Put( SfxUInt16Item( rPool.GetWhich( SID_BASIC_ENABLED ), sal::static_int_cast< sal_uInt16 >(aSecurityOptions.GetBasicMode()))))
359cdf0e10cSrcweir                                 bRet = sal_False;
360cdf0e10cSrcweir                         }
361cdf0e10cSrcweir                     }
362cdf0e10cSrcweir                     break;
363cdf0e10cSrcweir                 case SID_INET_EXE_PLUGIN  :
364cdf0e10cSrcweir                     {
365cdf0e10cSrcweir                         bRet = sal_True;
366cdf0e10cSrcweir                         if (!aSecurityOptions.IsReadOnly(SvtSecurityOptions::E_EXECUTEPLUGINS))
367cdf0e10cSrcweir                         {
368cdf0e10cSrcweir                             if ( !rSet.Put( SfxBoolItem( SID_INET_EXE_PLUGIN, aSecurityOptions.IsExecutePlugins() ) ) )
369cdf0e10cSrcweir                                 bRet = sal_False;
370cdf0e10cSrcweir                         }
371cdf0e10cSrcweir                     }
372cdf0e10cSrcweir                     break;
373cdf0e10cSrcweir                 case SID_MACRO_WARNING :
374cdf0e10cSrcweir                     {
375cdf0e10cSrcweir                         bRet = sal_True;
376cdf0e10cSrcweir                         if (!aSecurityOptions.IsReadOnly(SvtSecurityOptions::E_WARNING))
377cdf0e10cSrcweir                         {
378cdf0e10cSrcweir                             if ( !rSet.Put( SfxBoolItem( SID_MACRO_WARNING, aSecurityOptions.IsWarningEnabled() ) ) )
379cdf0e10cSrcweir                                 bRet = sal_False;
380cdf0e10cSrcweir                         }
381cdf0e10cSrcweir                     }
382cdf0e10cSrcweir                     break;
383cdf0e10cSrcweir                 case SID_MACRO_CONFIRMATION :
384cdf0e10cSrcweir                     {
385cdf0e10cSrcweir                         bRet = sal_True;
386cdf0e10cSrcweir                         if (!aSecurityOptions.IsReadOnly(SvtSecurityOptions::E_CONFIRMATION))
387cdf0e10cSrcweir                         {
388cdf0e10cSrcweir                             if ( !rSet.Put( SfxBoolItem( SID_MACRO_CONFIRMATION, aSecurityOptions.IsConfirmationEnabled() ) ) )
389cdf0e10cSrcweir                                 bRet = sal_False;
390cdf0e10cSrcweir                         }
391cdf0e10cSrcweir                     }
392cdf0e10cSrcweir                     break;
393cdf0e10cSrcweir                 case SID_SECURE_URL :
394cdf0e10cSrcweir                     {
395cdf0e10cSrcweir                         bRet = sal_True;
396cdf0e10cSrcweir                         if (!aSecurityOptions.IsReadOnly(SvtSecurityOptions::E_SECUREURLS))
397cdf0e10cSrcweir                         {
398cdf0e10cSrcweir                             ::com::sun::star::uno::Sequence< ::rtl::OUString > seqURLs = aSecurityOptions.GetSecureURLs();
399cdf0e10cSrcweir                             List aList;
400cdf0e10cSrcweir                             sal_uInt32 nCount = seqURLs.getLength();
401cdf0e10cSrcweir                             sal_uInt32 nURL;
402cdf0e10cSrcweir                             for( nURL=0; nURL<nCount; ++nURL )
403cdf0e10cSrcweir                             {
404cdf0e10cSrcweir                                 aList.Insert( new String( seqURLs[nURL] ), LIST_APPEND );
405cdf0e10cSrcweir                             }
406cdf0e10cSrcweir                             if( !rSet.Put( SfxStringListItem( rPool.GetWhich(SID_SECURE_URL),
407cdf0e10cSrcweir                                     &aList ) ) )
408cdf0e10cSrcweir                             {
409cdf0e10cSrcweir                                 bRet = sal_False;
410cdf0e10cSrcweir                             }
411cdf0e10cSrcweir                             for( nURL=0; nURL<nCount; ++nURL )
412cdf0e10cSrcweir                             {
413cdf0e10cSrcweir                                 delete (String*)aList.GetObject(nURL);
414cdf0e10cSrcweir                             }
415cdf0e10cSrcweir                             aList.Clear();
416cdf0e10cSrcweir                         }
417cdf0e10cSrcweir                     }
418cdf0e10cSrcweir                     break;
419cdf0e10cSrcweir     			case SID_ENABLE_METAFILEPRINT :
420cdf0e10cSrcweir #ifdef ENABLE_MISSINGKEYASSERTIONS//MUSTINI
421cdf0e10cSrcweir 					DBG_ASSERT(sal_False, "SfxApplication::GetOptions()\nSoffice.ini key \"Common\\MetafilePrint\" is obsolete! .. How I can support SID_ENABLE_METAFILEPRINT any longer?\n");
422cdf0e10cSrcweir #endif
423cdf0e10cSrcweir 					break;
424cdf0e10cSrcweir                 case SID_INET_PROXY_TYPE :
425cdf0e10cSrcweir                 {
426cdf0e10cSrcweir                     if( rSet.Put( SfxUInt16Item ( rPool.GetWhich( SID_INET_PROXY_TYPE ),
427cdf0e10cSrcweir                         (sal_uInt16)aInetOptions.GetProxyType() )))
428cdf0e10cSrcweir                             bRet = sal_True;
429cdf0e10cSrcweir                     break;
430cdf0e10cSrcweir                 }
431cdf0e10cSrcweir                 case SID_INET_HTTP_PROXY_NAME :
432cdf0e10cSrcweir                 {
433cdf0e10cSrcweir                     if ( rSet.Put( SfxStringItem ( rPool.GetWhich(SID_INET_HTTP_PROXY_NAME ),
434cdf0e10cSrcweir                         aInetOptions.GetProxyHttpName() )))
435cdf0e10cSrcweir                             bRet = sal_True;
436cdf0e10cSrcweir                     break;
437cdf0e10cSrcweir                 }
438cdf0e10cSrcweir                 case SID_INET_HTTP_PROXY_PORT :
439cdf0e10cSrcweir                     if ( rSet.Put( SfxInt32Item( rPool.GetWhich(SID_INET_HTTP_PROXY_PORT ),
440cdf0e10cSrcweir                         aInetOptions.GetProxyHttpPort() )))
441cdf0e10cSrcweir                             bRet = sal_True;
442cdf0e10cSrcweir                     break;
443cdf0e10cSrcweir                 case SID_INET_FTP_PROXY_NAME :
444cdf0e10cSrcweir                     if ( rSet.Put( SfxStringItem ( rPool.GetWhich(SID_INET_FTP_PROXY_NAME ),
445cdf0e10cSrcweir                         aInetOptions.GetProxyFtpName() )))
446cdf0e10cSrcweir                             bRet = sal_True;
447cdf0e10cSrcweir                     break;
448cdf0e10cSrcweir                 case SID_INET_FTP_PROXY_PORT :
449cdf0e10cSrcweir                     if ( rSet.Put( SfxInt32Item ( rPool.GetWhich(SID_INET_FTP_PROXY_PORT ),
450cdf0e10cSrcweir                         aInetOptions.GetProxyFtpPort() )))
451cdf0e10cSrcweir                             bRet = sal_True;
452cdf0e10cSrcweir                     break;
453cdf0e10cSrcweir                 case SID_INET_SECURITY_PROXY_NAME :
454cdf0e10cSrcweir                 case SID_INET_SECURITY_PROXY_PORT :
455cdf0e10cSrcweir #ifdef ENABLE_MISSINGKEYASSERTIONS//MUSTINI
456cdf0e10cSrcweir                     DBG_ASSERT( sal_False, "SfxApplication::GetOptions()\nSome INET values no longer supported!\n" );
457cdf0e10cSrcweir #endif
458cdf0e10cSrcweir                     break;
459cdf0e10cSrcweir                 case SID_INET_NOPROXY :
460cdf0e10cSrcweir                     if( rSet.Put( SfxStringItem ( rPool.GetWhich( SID_INET_NOPROXY),
461cdf0e10cSrcweir                         aInetOptions.GetProxyNoProxy() )))
462cdf0e10cSrcweir                             bRet = sal_True;
463cdf0e10cSrcweir                     break;
464cdf0e10cSrcweir 				case SID_ATTR_PATHNAME :
465cdf0e10cSrcweir 				case SID_ATTR_PATHGROUP :
466cdf0e10cSrcweir 				{
467cdf0e10cSrcweir 					SfxAllEnumItem aNames(rPool.GetWhich(SID_ATTR_PATHGROUP));
468cdf0e10cSrcweir     				SfxAllEnumItem aValues(rPool.GetWhich(SID_ATTR_PATHNAME));
469cdf0e10cSrcweir                     SvtPathOptions aPathCfg;
470cdf0e10cSrcweir                     for ( sal_uInt16 nProp = SvtPathOptions::PATH_ADDIN;
471cdf0e10cSrcweir 						  nProp <= SvtPathOptions::PATH_WORK; nProp++ )
472cdf0e10cSrcweir                     {
473cdf0e10cSrcweir 						const String aName( SfxResId( CONFIG_PATH_START + nProp ) );
474cdf0e10cSrcweir 						aNames.InsertValue( nProp, aName );
475cdf0e10cSrcweir                         String aValue;
476cdf0e10cSrcweir                         switch ( nProp )
477cdf0e10cSrcweir                         {
478cdf0e10cSrcweir                             case SvtPathOptions::PATH_ADDIN:        ::utl::LocalFileHelper::ConvertPhysicalNameToURL( aPathCfg.GetAddinPath(), aValue ); break;
479cdf0e10cSrcweir                             case SvtPathOptions::PATH_AUTOCORRECT:  aValue = aPathCfg.GetAutoCorrectPath(); break;
480cdf0e10cSrcweir                             case SvtPathOptions::PATH_AUTOTEXT:     aValue = aPathCfg.GetAutoTextPath(); break;
481cdf0e10cSrcweir                             case SvtPathOptions::PATH_BACKUP:       aValue = aPathCfg.GetBackupPath(); break;
482cdf0e10cSrcweir                             case SvtPathOptions::PATH_BASIC:        aValue = aPathCfg.GetBasicPath(); break;
483cdf0e10cSrcweir                             case SvtPathOptions::PATH_BITMAP:       aValue = aPathCfg.GetBitmapPath(); break;
484cdf0e10cSrcweir                             case SvtPathOptions::PATH_CONFIG:       aValue = aPathCfg.GetConfigPath(); break;
485cdf0e10cSrcweir                             case SvtPathOptions::PATH_DICTIONARY:   aValue = aPathCfg.GetDictionaryPath(); break;
486cdf0e10cSrcweir                             case SvtPathOptions::PATH_FAVORITES:    aValue = aPathCfg.GetFavoritesPath(); break;
487cdf0e10cSrcweir                             case SvtPathOptions::PATH_FILTER:       ::utl::LocalFileHelper::ConvertPhysicalNameToURL( aPathCfg.GetFilterPath(), aValue ); break;
488cdf0e10cSrcweir                             case SvtPathOptions::PATH_GALLERY:      aValue = aPathCfg.GetGalleryPath(); break;
489cdf0e10cSrcweir                             case SvtPathOptions::PATH_GRAPHIC:      aValue = aPathCfg.GetGraphicPath(); break;
490cdf0e10cSrcweir                             case SvtPathOptions::PATH_HELP:         ::utl::LocalFileHelper::ConvertPhysicalNameToURL( aPathCfg.GetHelpPath(), aValue ); break;
491cdf0e10cSrcweir                             case SvtPathOptions::PATH_LINGUISTIC:   aValue = aPathCfg.GetLinguisticPath(); break;
492cdf0e10cSrcweir                             case SvtPathOptions::PATH_MODULE:       ::utl::LocalFileHelper::ConvertPhysicalNameToURL( aPathCfg.GetModulePath(), aValue ); break;
493cdf0e10cSrcweir                             case SvtPathOptions::PATH_PALETTE:      aValue = aPathCfg.GetPalettePath(); break;
494cdf0e10cSrcweir                             case SvtPathOptions::PATH_PLUGIN:       ::utl::LocalFileHelper::ConvertPhysicalNameToURL( aPathCfg.GetPluginPath(), aValue ); break;
495cdf0e10cSrcweir                             case SvtPathOptions::PATH_STORAGE:      ::utl::LocalFileHelper::ConvertPhysicalNameToURL( aPathCfg.GetStoragePath(), aValue ); break;
496cdf0e10cSrcweir                             case SvtPathOptions::PATH_TEMP:         aValue = aPathCfg.GetTempPath(); break;
497cdf0e10cSrcweir                             case SvtPathOptions::PATH_TEMPLATE:     aValue = aPathCfg.GetTemplatePath(); break;
498cdf0e10cSrcweir                             case SvtPathOptions::PATH_USERCONFIG:   aValue = aPathCfg.GetUserConfigPath(); break;
499cdf0e10cSrcweir                             case SvtPathOptions::PATH_WORK:         aValue = aPathCfg.GetWorkPath(); break;
500cdf0e10cSrcweir                         }
501cdf0e10cSrcweir                         aValues.InsertValue( nProp, aValue );
502cdf0e10cSrcweir                     }
503cdf0e10cSrcweir 
504cdf0e10cSrcweir 					if ( rSet.Put(aNames) || rSet.Put(aValues) )
505cdf0e10cSrcweir 						bRet = sal_True;
506cdf0e10cSrcweir 				}
507cdf0e10cSrcweir 
508cdf0e10cSrcweir 				default:
509cdf0e10cSrcweir 					DBG_WARNING( "W1:Wrong ID while getting Options!" );
510cdf0e10cSrcweir 					break;
511cdf0e10cSrcweir 			}
512cdf0e10cSrcweir #ifdef DBG_UTIL
513cdf0e10cSrcweir 			if ( !bRet )
514cdf0e10cSrcweir 				DBG_ERROR( "Putting options failed!" );
515cdf0e10cSrcweir #endif
516cdf0e10cSrcweir 		}
517cdf0e10cSrcweir 		pRanges++;
518cdf0e10cSrcweir 	}
519cdf0e10cSrcweir 
520cdf0e10cSrcweir 	return bRet;
521cdf0e10cSrcweir }
522cdf0e10cSrcweir 
523cdf0e10cSrcweir //--------------------------------------------------------------------
IsSecureURL(const INetURLObject & rURL,const String * pReferer) const524cdf0e10cSrcweir sal_Bool SfxApplication::IsSecureURL( const INetURLObject& rURL, const String* pReferer ) const
525cdf0e10cSrcweir {
526cdf0e10cSrcweir 	return SvtSecurityOptions().IsSecureURL( rURL.GetMainURL( INetURLObject::NO_DECODE ), *pReferer );
527cdf0e10cSrcweir }
528cdf0e10cSrcweir //--------------------------------------------------------------------
529cdf0e10cSrcweir // TODO/CLEANUP: wieso zwei SetOptions Methoden?
SetOptions_Impl(const SfxItemSet & rSet)530cdf0e10cSrcweir void SfxApplication::SetOptions_Impl( const SfxItemSet& rSet )
531cdf0e10cSrcweir {
532cdf0e10cSrcweir     const SfxPoolItem *pItem = 0;
533cdf0e10cSrcweir     SfxItemPool &rPool = GetPool();
534cdf0e10cSrcweir 	sal_Bool bResetSession = sal_False;
535cdf0e10cSrcweir 	sal_Bool bProxiesModified = sal_False;
536cdf0e10cSrcweir 
537cdf0e10cSrcweir     SvtSaveOptions aSaveOptions;
538cdf0e10cSrcweir     SvtUndoOptions aUndoOptions;
539cdf0e10cSrcweir     SvtHelpOptions aHelpOptions;
540cdf0e10cSrcweir 	SvtSecurityOptions aSecurityOptions;
541cdf0e10cSrcweir 	SvtPathOptions aPathOptions;
542cdf0e10cSrcweir 	SvtInetOptions aInetOptions;
543cdf0e10cSrcweir     SvtMiscOptions aMiscOptions;
544cdf0e10cSrcweir     if ( SFX_ITEM_SET == rSet.GetItemState(rPool.GetWhich(SID_ATTR_BUTTON_OUTSTYLE3D), sal_True, &pItem) )
545cdf0e10cSrcweir     {
546cdf0e10cSrcweir         DBG_ASSERT(pItem->ISA(SfxBoolItem), "BoolItem expected");
547cdf0e10cSrcweir 		sal_uInt16 nOutStyle =
548cdf0e10cSrcweir 			( (const SfxBoolItem *)pItem)->GetValue() ? 0 : TOOLBOX_STYLE_FLAT;
549cdf0e10cSrcweir         aMiscOptions.SetToolboxStyle( nOutStyle );
550cdf0e10cSrcweir     }
551cdf0e10cSrcweir 
552cdf0e10cSrcweir     if ( SFX_ITEM_SET == rSet.GetItemState(rPool.GetWhich(SID_ATTR_BUTTON_BIGSIZE), sal_True, &pItem) )
553cdf0e10cSrcweir     {
554cdf0e10cSrcweir         DBG_ASSERT(pItem->ISA(SfxBoolItem), "BoolItem expected");
555cdf0e10cSrcweir 		sal_Bool bBigSize = ( (const SfxBoolItem*)pItem )->GetValue();
556cdf0e10cSrcweir         aMiscOptions.SetSymbolsSize(
557cdf0e10cSrcweir             sal::static_int_cast< sal_Int16 >(
558cdf0e10cSrcweir                 bBigSize ? SFX_SYMBOLS_SIZE_LARGE : SFX_SYMBOLS_SIZE_SMALL ) );
559cdf0e10cSrcweir         SfxViewFrame* pCurrViewFrame = SfxViewFrame::GetFirst();
560cdf0e10cSrcweir         while ( pCurrViewFrame )
561cdf0e10cSrcweir         {
562cdf0e10cSrcweir             // update all "final" dispatchers
563cdf0e10cSrcweir             if ( !pCurrViewFrame->GetActiveChildFrame_Impl() )
564cdf0e10cSrcweir                 pCurrViewFrame->GetDispatcher()->Update_Impl(sal_True);
565cdf0e10cSrcweir             pCurrViewFrame = SfxViewFrame::GetNext(*pCurrViewFrame);
566cdf0e10cSrcweir         }
567cdf0e10cSrcweir     }
568cdf0e10cSrcweir 
569cdf0e10cSrcweir 	// Backup
570cdf0e10cSrcweir     if ( SFX_ITEM_SET == rSet.GetItemState(rPool.GetWhich(SID_ATTR_BACKUP), sal_True, &pItem) )
571cdf0e10cSrcweir     {
572cdf0e10cSrcweir         DBG_ASSERT(pItem->ISA(SfxBoolItem), "BoolItem expected");
573cdf0e10cSrcweir         aSaveOptions.SetBackup( ( (const SfxBoolItem*)pItem )->GetValue() );
574cdf0e10cSrcweir     }
575cdf0e10cSrcweir 
576*972a6c96SJuergen Schmidt     // ODF Encryption
577*972a6c96SJuergen Schmidt     if ( SFX_ITEM_SET == rSet.GetItemState( rPool.GetWhich( SID_ATTR_ODFENCRYPTION ), sal_True, &pItem ) )
578*972a6c96SJuergen Schmidt     {
579*972a6c96SJuergen Schmidt         DBG_ASSERT( pItem->ISA( SfxBoolItem ), "BoolItem expected" );
580*972a6c96SJuergen Schmidt         sal_Bool bItemValue =  static_cast< const SfxBoolItem*>(pItem)->GetValue();
581*972a6c96SJuergen Schmidt 
582*972a6c96SJuergen Schmidt         aSaveOptions.SetUseSHA1InODF12( !bItemValue );
583*972a6c96SJuergen Schmidt         aSaveOptions.SetUseBlowfishInODF12( !bItemValue );
584*972a6c96SJuergen Schmidt     }
585*972a6c96SJuergen Schmidt 
586cdf0e10cSrcweir 	// PrettyPrinting
587cdf0e10cSrcweir     if ( SFX_ITEM_SET == rSet.GetItemState( rPool.GetWhich( SID_ATTR_PRETTYPRINTING ), sal_True, &pItem ) )
588cdf0e10cSrcweir     {
589cdf0e10cSrcweir         DBG_ASSERT( pItem->ISA( SfxBoolItem ), "BoolItem expected" );
590cdf0e10cSrcweir         aSaveOptions.SetPrettyPrinting( static_cast< const SfxBoolItem*> ( pItem )->GetValue() );
591cdf0e10cSrcweir     }
592cdf0e10cSrcweir 
593cdf0e10cSrcweir     // WarnAlienFormat
594cdf0e10cSrcweir     if ( SFX_ITEM_SET == rSet.GetItemState( rPool.GetWhich( SID_ATTR_WARNALIENFORMAT ), sal_True, &pItem ) )
595cdf0e10cSrcweir     {
596cdf0e10cSrcweir         DBG_ASSERT( pItem->ISA( SfxBoolItem ), "BoolItem expected" );
597cdf0e10cSrcweir         aSaveOptions.SetWarnAlienFormat( static_cast< const SfxBoolItem*> ( pItem )->GetValue() );
598cdf0e10cSrcweir     }
599cdf0e10cSrcweir 
600cdf0e10cSrcweir 	// AutoSave
601cdf0e10cSrcweir     if ( SFX_ITEM_SET == rSet.GetItemState(rPool.GetWhich(SID_ATTR_AUTOSAVE), sal_True, &pItem))
602cdf0e10cSrcweir     {
603cdf0e10cSrcweir         DBG_ASSERT(pItem->ISA(SfxBoolItem), "BoolItem expected");
604cdf0e10cSrcweir         aSaveOptions.SetAutoSave( ( (const SfxBoolItem*)pItem )->GetValue() );
605cdf0e10cSrcweir     }
606cdf0e10cSrcweir 
607cdf0e10cSrcweir 	// AutoSave-Propt
608cdf0e10cSrcweir     if ( SFX_ITEM_SET == rSet.GetItemState(rPool.GetWhich(SID_ATTR_AUTOSAVEPROMPT), sal_True, &pItem))
609cdf0e10cSrcweir     {
610cdf0e10cSrcweir         DBG_ASSERT(pItem->ISA(SfxBoolItem), "BoolItem expected");
611cdf0e10cSrcweir         aSaveOptions.SetAutoSavePrompt(((const SfxBoolItem *)pItem)->GetValue());
612cdf0e10cSrcweir     }
613cdf0e10cSrcweir 
614cdf0e10cSrcweir 	// AutoSave-Time
615cdf0e10cSrcweir     if ( SFX_ITEM_SET == rSet.GetItemState(rPool.GetWhich(SID_ATTR_AUTOSAVEMINUTE), sal_True, &pItem))
616cdf0e10cSrcweir     {
617cdf0e10cSrcweir         DBG_ASSERT(pItem->ISA(SfxUInt16Item), "UInt16Item expected");
618cdf0e10cSrcweir         aSaveOptions.SetAutoSaveTime(((const SfxUInt16Item *)pItem)->GetValue());
619cdf0e10cSrcweir     }
620cdf0e10cSrcweir 
621cdf0e10cSrcweir 	// DocInfo
622cdf0e10cSrcweir     if ( SFX_ITEM_SET == rSet.GetItemState(rPool.GetWhich(SID_ATTR_DOCINFO), sal_True, &pItem))
623cdf0e10cSrcweir     {
624cdf0e10cSrcweir         DBG_ASSERT(pItem->ISA(SfxBoolItem), "BoolItem expected");
625cdf0e10cSrcweir         aSaveOptions.SetDocInfoSave(((const SfxBoolItem *)pItem)->GetValue());
626cdf0e10cSrcweir     }
627cdf0e10cSrcweir 
628cdf0e10cSrcweir 	// offende Dokumente merken
629cdf0e10cSrcweir     if ( SFX_ITEM_SET == rSet.GetItemState(rPool.GetWhich(SID_ATTR_WORKINGSET), sal_True, &pItem))
630cdf0e10cSrcweir     {
631cdf0e10cSrcweir         DBG_ASSERT(pItem->ISA(SfxBoolItem), "BoolItem expected");
632cdf0e10cSrcweir         aSaveOptions.SetSaveWorkingSet(((const SfxBoolItem *)pItem)->GetValue());
633cdf0e10cSrcweir     }
634cdf0e10cSrcweir 
635cdf0e10cSrcweir 	// Fenster-Einstellung speichern
636cdf0e10cSrcweir     if ( SFX_ITEM_SET == rSet.GetItemState(rPool.GetWhich(SID_ATTR_SAVEDOCVIEW), sal_True, &pItem))
637cdf0e10cSrcweir     {
638cdf0e10cSrcweir         DBG_ASSERT(pItem->ISA(SfxBoolItem), "BoolItem expected");
639cdf0e10cSrcweir         aSaveOptions.SetSaveDocView(((const SfxBoolItem *)pItem)->GetValue());
640cdf0e10cSrcweir     }
641cdf0e10cSrcweir 
642cdf0e10cSrcweir 	// Metric
643cdf0e10cSrcweir     if ( SFX_ITEM_SET == rSet.GetItemState(rPool.GetWhich(SID_ATTR_METRIC), sal_True, &pItem))
644cdf0e10cSrcweir     {
645cdf0e10cSrcweir         DBG_ASSERT(pItem->ISA(SfxUInt16Item), "UInt16Item expected");
646cdf0e10cSrcweir //        pOptions->SetMetric((FieldUnit)((const SfxUInt16Item*)pItem)->GetValue());
647cdf0e10cSrcweir     }
648cdf0e10cSrcweir 
649cdf0e10cSrcweir 	// HelpBalloons
650cdf0e10cSrcweir     if ( SFX_ITEM_SET == rSet.GetItemState(rPool.GetWhich(SID_HELPBALLOONS), sal_True, &pItem))
651cdf0e10cSrcweir     {
652cdf0e10cSrcweir         DBG_ASSERT(pItem->ISA(SfxBoolItem), "BoolItem expected");
653cdf0e10cSrcweir         aHelpOptions.SetExtendedHelp(((const SfxBoolItem *)pItem)->GetValue());
654cdf0e10cSrcweir     }
655cdf0e10cSrcweir 
656cdf0e10cSrcweir 	// HelpTips
657cdf0e10cSrcweir     if ( SFX_ITEM_SET == rSet.GetItemState(rPool.GetWhich(SID_HELPTIPS), sal_True, &pItem))
658cdf0e10cSrcweir     {
659cdf0e10cSrcweir         DBG_ASSERT(pItem->ISA(SfxBoolItem), "BoolItem expected");
660cdf0e10cSrcweir         aHelpOptions.SetHelpTips(((const SfxBoolItem *)pItem)->GetValue());
661cdf0e10cSrcweir     }
662cdf0e10cSrcweir 
663cdf0e10cSrcweir 	// AutoHelpAgent
664cdf0e10cSrcweir     if ( SFX_ITEM_SET == rSet.GetItemState(rPool.GetWhich(SID_ATTR_AUTOHELPAGENT ), sal_True, &pItem))
665cdf0e10cSrcweir     {
666cdf0e10cSrcweir         DBG_ASSERT(pItem->ISA(SfxBoolItem), "BoolItem expected");
667cdf0e10cSrcweir         aHelpOptions.SetHelpAgentAutoStartMode( ((const SfxBoolItem *)pItem)->GetValue() );
668cdf0e10cSrcweir     }
669cdf0e10cSrcweir 
670cdf0e10cSrcweir 	// help agent timeout
671cdf0e10cSrcweir     if ( SFX_ITEM_SET == rSet.GetItemState( rPool.GetWhich( SID_HELPAGENT_TIMEOUT ), sal_True, &pItem ) )
672cdf0e10cSrcweir     {
673cdf0e10cSrcweir         DBG_ASSERT(pItem->ISA(SfxInt32Item), "Int32Item expected");
674cdf0e10cSrcweir 		aHelpOptions.SetHelpAgentTimeoutPeriod( ( (const SfxInt32Item*)pItem )->GetValue() );
675cdf0e10cSrcweir     }
676cdf0e10cSrcweir 
677cdf0e10cSrcweir 	// WelcomeScreen
678cdf0e10cSrcweir     if ( SFX_ITEM_SET == rSet.GetItemState(rPool.GetWhich(SID_ATTR_WELCOMESCREEN ), sal_True, &pItem))
679cdf0e10cSrcweir     {
680cdf0e10cSrcweir         DBG_ASSERT(pItem->ISA(SfxBoolItem), "BoolItem expected");
681cdf0e10cSrcweir         aHelpOptions.SetWelcomeScreen( ((const SfxBoolItem *)pItem)->GetValue() );
682cdf0e10cSrcweir     }
683cdf0e10cSrcweir 
684cdf0e10cSrcweir 	// WelcomeScreen
685cdf0e10cSrcweir     if ( SFX_ITEM_SET == rSet.GetItemState(rPool.GetWhich(SID_WELCOMESCREEN_RESET ), sal_True, &pItem))
686cdf0e10cSrcweir     {
687cdf0e10cSrcweir         DBG_ASSERT(pItem->ISA(SfxBoolItem), "BoolItem expected");
688cdf0e10cSrcweir 		sal_Bool bReset = ((const SfxBoolItem *)pItem)->GetValue();
689cdf0e10cSrcweir 		if ( bReset )
690cdf0e10cSrcweir 		{
691cdf0e10cSrcweir             DBG_ERROR( "Not implemented, may be EOL!" );
692cdf0e10cSrcweir         }                                                   }
693cdf0e10cSrcweir 
694cdf0e10cSrcweir     if ( SFX_ITEM_SET == rSet.GetItemState(rPool.GetWhich(SID_HELP_STYLESHEET ), sal_True, &pItem))
695cdf0e10cSrcweir     {
696cdf0e10cSrcweir         DBG_ASSERT(pItem->ISA(SfxStringItem), "StringItem expected");
697cdf0e10cSrcweir         aHelpOptions.SetHelpStyleSheet( ((const SfxStringItem *)pItem)->GetValue() );
698cdf0e10cSrcweir     }
699cdf0e10cSrcweir 
700cdf0e10cSrcweir     // SaveRelINet
701cdf0e10cSrcweir     if ( SFX_ITEM_SET == rSet.GetItemState(rPool.GetWhich(SID_SAVEREL_INET), sal_True, &pItem))
702cdf0e10cSrcweir     {
703cdf0e10cSrcweir         DBG_ASSERT(pItem->ISA(SfxBoolItem), "BoolItem expected");
704cdf0e10cSrcweir         aSaveOptions.SetSaveRelINet(((const SfxBoolItem *)pItem)->GetValue());
705cdf0e10cSrcweir     }
706cdf0e10cSrcweir 
707cdf0e10cSrcweir 	// SaveRelFSys
708cdf0e10cSrcweir     if ( SFX_ITEM_SET == rSet.GetItemState(rPool.GetWhich(SID_SAVEREL_FSYS), sal_True, &pItem))
709cdf0e10cSrcweir     {
710cdf0e10cSrcweir         DBG_ASSERT(pItem->ISA(SfxBoolItem), "BoolItem expected");
711cdf0e10cSrcweir         aSaveOptions.SetSaveRelFSys(((const SfxBoolItem *)pItem)->GetValue());
712cdf0e10cSrcweir     }
713cdf0e10cSrcweir 
714cdf0e10cSrcweir 	// Undo-Count
715cdf0e10cSrcweir     if ( SFX_ITEM_SET == rSet.GetItemState(rPool.GetWhich(SID_ATTR_UNDO_COUNT), sal_True, &pItem))
716cdf0e10cSrcweir     {
717cdf0e10cSrcweir         DBG_ASSERT(pItem->ISA(SfxUInt16Item), "UInt16Item expected");
718cdf0e10cSrcweir         sal_uInt16 nUndoCount = ((const SfxUInt16Item*)pItem)->GetValue();
719cdf0e10cSrcweir         aUndoOptions.SetUndoCount( nUndoCount );
720cdf0e10cSrcweir 
721cdf0e10cSrcweir         // um alle Undo-Manager zu erwischen: "uber alle Frames iterieren
722cdf0e10cSrcweir         for ( SfxViewFrame *pFrame = SfxViewFrame::GetFirst();
723cdf0e10cSrcweir               pFrame;
724cdf0e10cSrcweir               pFrame = SfxViewFrame::GetNext(*pFrame) )
725cdf0e10cSrcweir         {
726cdf0e10cSrcweir             // den Dispatcher des Frames rausholen
727cdf0e10cSrcweir             SfxDispatcher *pDispat = pFrame->GetDispatcher();
728cdf0e10cSrcweir             pDispat->Flush();
729cdf0e10cSrcweir 
730cdf0e10cSrcweir             // "uber alle SfxShells auf dem Stack des Dispatchers iterieren
731cdf0e10cSrcweir             sal_uInt16 nIdx = 0;
732cdf0e10cSrcweir             for ( SfxShell *pSh = pDispat->GetShell(nIdx);
733cdf0e10cSrcweir                   pSh;
734cdf0e10cSrcweir                   ++nIdx, pSh = pDispat->GetShell(nIdx) )
735cdf0e10cSrcweir             {
736cdf0e10cSrcweir                 ::svl::IUndoManager *pShUndoMgr = pSh->GetUndoManager();
737cdf0e10cSrcweir                 if ( pShUndoMgr )
738cdf0e10cSrcweir                     pShUndoMgr->SetMaxUndoActionCount( nUndoCount );
739cdf0e10cSrcweir             }
740cdf0e10cSrcweir         }
741cdf0e10cSrcweir     }
742cdf0e10cSrcweir 
743cdf0e10cSrcweir 	// Office autostart
744cdf0e10cSrcweir     if ( SFX_ITEM_SET == rSet.GetItemState(rPool.GetWhich(SID_ATTR_QUICKLAUNCHER), sal_True, &pItem))
745cdf0e10cSrcweir     {
746cdf0e10cSrcweir         DBG_ASSERT(pItem->ISA(SfxBoolItem), "BoolItem expected");
747cdf0e10cSrcweir         ShutdownIcon::SetAutostart( ( (const SfxBoolItem*)pItem )->GetValue() != sal_False );
748cdf0e10cSrcweir     }
749cdf0e10cSrcweir 
750cdf0e10cSrcweir 	// StarBasic Enable
751cdf0e10cSrcweir 	if ( SFX_ITEM_SET == rSet.GetItemState(SID_BASIC_ENABLED, sal_True, &pItem))
752cdf0e10cSrcweir     {
753cdf0e10cSrcweir 		DBG_ASSERT(pItem->ISA(SfxUInt16Item), "SfxInt16Item expected");
754cdf0e10cSrcweir 		aSecurityOptions.SetBasicMode( (EBasicSecurityMode)( (const SfxUInt16Item*)pItem )->GetValue() );
755cdf0e10cSrcweir     }
756cdf0e10cSrcweir 
757cdf0e10cSrcweir 	// Execute PlugIns
758cdf0e10cSrcweir 	if ( SFX_ITEM_SET == rSet.GetItemState(SID_INET_EXE_PLUGIN, sal_True, &pItem))
759cdf0e10cSrcweir     {
760cdf0e10cSrcweir 		DBG_ASSERT(pItem->ISA(SfxBoolItem), "SfxBoolItem expected");
761cdf0e10cSrcweir         aSecurityOptions.SetExecutePlugins( ( (const SfxBoolItem *)pItem )->GetValue() );
762cdf0e10cSrcweir 		bResetSession = sal_True;
763cdf0e10cSrcweir     }
764cdf0e10cSrcweir 
765cdf0e10cSrcweir     if ( SFX_ITEM_SET == rSet.GetItemState(rPool.GetWhich(SID_INET_PROXY_TYPE), sal_True, &pItem))
766cdf0e10cSrcweir     {
767cdf0e10cSrcweir         DBG_ASSERT( pItem->ISA(SfxUInt16Item), "UInt16Item expected" );
768cdf0e10cSrcweir         aInetOptions.SetProxyType((SvtInetOptions::ProxyType)( (const SfxUInt16Item*)pItem )->GetValue());
769cdf0e10cSrcweir         bResetSession = sal_True;
770cdf0e10cSrcweir         bProxiesModified = sal_True;
771cdf0e10cSrcweir     }
772cdf0e10cSrcweir 
773cdf0e10cSrcweir     if ( SFX_ITEM_SET == rSet.GetItemState( rPool.GetWhich( SID_INET_HTTP_PROXY_NAME ), sal_True, &pItem ) )
774cdf0e10cSrcweir     {
775cdf0e10cSrcweir         DBG_ASSERT( pItem->ISA(SfxStringItem), "StringItem expected" );
776cdf0e10cSrcweir         aInetOptions.SetProxyHttpName( ((const SfxStringItem *)pItem)->GetValue() );
777cdf0e10cSrcweir         bResetSession = sal_True;
778cdf0e10cSrcweir         bProxiesModified = sal_True;
779cdf0e10cSrcweir     }
780cdf0e10cSrcweir     if ( SFX_ITEM_SET == rSet.GetItemState( rPool.GetWhich( SID_INET_HTTP_PROXY_PORT ), sal_True, &pItem ) )
781cdf0e10cSrcweir     {
782cdf0e10cSrcweir         DBG_ASSERT( pItem->ISA(SfxInt32Item), "Int32Item expected" );
783cdf0e10cSrcweir         aInetOptions.SetProxyHttpPort( ( (const SfxInt32Item*)pItem )->GetValue() );
784cdf0e10cSrcweir         bResetSession = sal_True;
785cdf0e10cSrcweir         bProxiesModified = sal_True;
786cdf0e10cSrcweir     }
787cdf0e10cSrcweir     if ( SFX_ITEM_SET == rSet.GetItemState( rPool.GetWhich( SID_INET_FTP_PROXY_NAME ), sal_True, &pItem ) )
788cdf0e10cSrcweir     {
789cdf0e10cSrcweir         DBG_ASSERT( pItem->ISA(SfxStringItem), "StringItem expected" );
790cdf0e10cSrcweir         aInetOptions.SetProxyFtpName( ((const SfxStringItem *)pItem)->GetValue() );
791cdf0e10cSrcweir         bResetSession = sal_True;
792cdf0e10cSrcweir         bProxiesModified = sal_True;
793cdf0e10cSrcweir     }
794cdf0e10cSrcweir     if ( SFX_ITEM_SET == rSet.GetItemState( rPool.GetWhich( SID_INET_FTP_PROXY_PORT ), sal_True, &pItem ) )
795cdf0e10cSrcweir     {
796cdf0e10cSrcweir         DBG_ASSERT( pItem->ISA(SfxInt32Item), "Int32Item expected" );
797cdf0e10cSrcweir         aInetOptions.SetProxyFtpPort( ( (const SfxInt32Item*)pItem )->GetValue() );
798cdf0e10cSrcweir         bResetSession = sal_True;
799cdf0e10cSrcweir         bProxiesModified = sal_True;
800cdf0e10cSrcweir     }
801cdf0e10cSrcweir     if ( SFX_ITEM_SET == rSet.GetItemState(SID_INET_NOPROXY, sal_True, &pItem))
802cdf0e10cSrcweir     {
803cdf0e10cSrcweir         DBG_ASSERT(pItem->ISA(SfxStringItem), "StringItem expected");
804cdf0e10cSrcweir         aInetOptions.SetProxyNoProxy(((const SfxStringItem *)pItem)->GetValue());
805cdf0e10cSrcweir         bResetSession = sal_True;
806cdf0e10cSrcweir         bProxiesModified = sal_True;
807cdf0e10cSrcweir     }
808cdf0e10cSrcweir 
809cdf0e10cSrcweir 	// Secure-Referers
810cdf0e10cSrcweir 	if ( SFX_ITEM_SET == rSet.GetItemState(SID_SECURE_URL, sal_True, &pItem))
811cdf0e10cSrcweir     {
812cdf0e10cSrcweir 		DELETEZ(pAppData_Impl->pSecureURLs);
813cdf0e10cSrcweir 
814cdf0e10cSrcweir 		DBG_ASSERT(pItem->ISA(SfxStringListItem), "StringListItem expected");
815cdf0e10cSrcweir 		const List *pList = ((SfxStringListItem*)pItem)->GetList();
816cdf0e10cSrcweir 		sal_uInt32 nCount = pList->Count();
817cdf0e10cSrcweir 		::com::sun::star::uno::Sequence< ::rtl::OUString > seqURLs(nCount);
818cdf0e10cSrcweir 		for( sal_uInt32 nPosition=0;nPosition<nCount;++nPosition)
819cdf0e10cSrcweir 		{
820cdf0e10cSrcweir 			seqURLs[nPosition] = *(const String*)(pList->GetObject(nPosition));
821cdf0e10cSrcweir 		}
822cdf0e10cSrcweir 		aSecurityOptions.SetSecureURLs( seqURLs );
823cdf0e10cSrcweir     }
824cdf0e10cSrcweir 
825cdf0e10cSrcweir     if ( SFX_ITEM_SET == rSet.GetItemState(SID_MACRO_WARNING, sal_True, &pItem))
826cdf0e10cSrcweir     {
827cdf0e10cSrcweir 		DBG_ASSERT(pItem->ISA(SfxBoolItem), "SfxBoolItem expected");
828cdf0e10cSrcweir         aSecurityOptions.SetWarningEnabled( ( (const SfxBoolItem *)pItem )->GetValue() );
829cdf0e10cSrcweir     }
830cdf0e10cSrcweir     if ( SFX_ITEM_SET == rSet.GetItemState(SID_MACRO_CONFIRMATION, sal_True, &pItem))
831cdf0e10cSrcweir     {
832cdf0e10cSrcweir 		DBG_ASSERT(pItem->ISA(SfxBoolItem), "SfxBoolItem expected");
833cdf0e10cSrcweir         aSecurityOptions.SetConfirmationEnabled( ( (const SfxBoolItem *)pItem )->GetValue() );
834cdf0e10cSrcweir     }
835cdf0e10cSrcweir 
836cdf0e10cSrcweir     // EnableMetafilePrint
837cdf0e10cSrcweir     if ( SFX_ITEM_SET == rSet.GetItemState( rPool.GetWhich( SID_ENABLE_METAFILEPRINT ), sal_True, &pItem ) )
838cdf0e10cSrcweir     {
839cdf0e10cSrcweir #ifdef ENABLE_MISSINGKEYASSERTIONS//MUSTINI
840cdf0e10cSrcweir 		DBG_ASSERT(sal_False, "SfxApplication::SetOptions_Impl()\nsoffice.ini key \"MetafilPrint\" not supported any longer!\n");
841cdf0e10cSrcweir #endif
842cdf0e10cSrcweir     }
843cdf0e10cSrcweir 
844cdf0e10cSrcweir 	// geaenderte Daten speichern
845cdf0e10cSrcweir 	aInetOptions.flush();
846cdf0e10cSrcweir }
847cdf0e10cSrcweir 
848cdf0e10cSrcweir //--------------------------------------------------------------------
SetOptions(const SfxItemSet & rSet)849cdf0e10cSrcweir void SfxApplication::SetOptions(const SfxItemSet &rSet)
850cdf0e10cSrcweir {
851cdf0e10cSrcweir 	SvtPathOptions aPathOptions;
852cdf0e10cSrcweir 
853cdf0e10cSrcweir 	// Daten werden in DocInfo und IniManager gespeichert
854cdf0e10cSrcweir     const SfxPoolItem *pItem = 0;
855cdf0e10cSrcweir     SfxItemPool &rPool = GetPool();
856cdf0e10cSrcweir 
857cdf0e10cSrcweir 	SfxAllItemSet aSendSet( rSet );
858cdf0e10cSrcweir 
859cdf0e10cSrcweir 	// PathName
860cdf0e10cSrcweir     if ( SFX_ITEM_SET == rSet.GetItemState(rPool.GetWhich(SID_ATTR_PATHNAME), sal_True, &pItem))
861cdf0e10cSrcweir     {
862cdf0e10cSrcweir         DBG_ASSERT(pItem->ISA(SfxAllEnumItem), "AllEnumItem expected");
863cdf0e10cSrcweir 		const SfxAllEnumItem* pEnumItem = (const SfxAllEnumItem *)pItem;
864cdf0e10cSrcweir 		sal_uInt32 nCount = pEnumItem->GetValueCount();
865cdf0e10cSrcweir 		String aNoChangeStr( ' ' );
866cdf0e10cSrcweir 		for( sal_uInt32 nPath=0; nPath<nCount; ++nPath )
867cdf0e10cSrcweir 		{
868cdf0e10cSrcweir 			String sValue = pEnumItem->GetValueTextByPos((sal_uInt16)nPath);
869cdf0e10cSrcweir 			if ( sValue != aNoChangeStr )
870cdf0e10cSrcweir 			{
871cdf0e10cSrcweir 				switch( nPath )
872cdf0e10cSrcweir 				{
873cdf0e10cSrcweir                     case SvtPathOptions::PATH_ADDIN:
874cdf0e10cSrcweir                     {
875cdf0e10cSrcweir                         String aTmp;
876cdf0e10cSrcweir                         if( ::utl::LocalFileHelper::ConvertURLToPhysicalName( sValue, aTmp ) )
877cdf0e10cSrcweir                             aPathOptions.SetAddinPath( aTmp );
878cdf0e10cSrcweir                         break;
879cdf0e10cSrcweir                     }
880cdf0e10cSrcweir 
881cdf0e10cSrcweir 					case SvtPathOptions::PATH_AUTOCORRECT:	aPathOptions.SetAutoCorrectPath( sValue );break;
882cdf0e10cSrcweir 					case SvtPathOptions::PATH_AUTOTEXT:		aPathOptions.SetAutoTextPath( sValue );break;
883cdf0e10cSrcweir 					case SvtPathOptions::PATH_BACKUP:		aPathOptions.SetBackupPath( sValue );break;
884cdf0e10cSrcweir 					case SvtPathOptions::PATH_BASIC:		aPathOptions.SetBasicPath( sValue );break;
885cdf0e10cSrcweir 					case SvtPathOptions::PATH_BITMAP:		aPathOptions.SetBitmapPath( sValue );break;
886cdf0e10cSrcweir 					case SvtPathOptions::PATH_CONFIG:		aPathOptions.SetConfigPath( sValue );break;
887cdf0e10cSrcweir 					case SvtPathOptions::PATH_DICTIONARY:	aPathOptions.SetDictionaryPath( sValue );break;
888cdf0e10cSrcweir 					case SvtPathOptions::PATH_FAVORITES:	aPathOptions.SetFavoritesPath( sValue );break;
889cdf0e10cSrcweir                     case SvtPathOptions::PATH_FILTER:
890cdf0e10cSrcweir                     {
891cdf0e10cSrcweir                         String aTmp;
892cdf0e10cSrcweir                         if( ::utl::LocalFileHelper::ConvertURLToPhysicalName( sValue, aTmp ) )
893cdf0e10cSrcweir                             aPathOptions.SetFilterPath( aTmp );
894cdf0e10cSrcweir                         break;
895cdf0e10cSrcweir                     }
896cdf0e10cSrcweir 					case SvtPathOptions::PATH_GALLERY:		aPathOptions.SetGalleryPath( sValue );break;
897cdf0e10cSrcweir 					case SvtPathOptions::PATH_GRAPHIC:		aPathOptions.SetGraphicPath( sValue );break;
898cdf0e10cSrcweir                     case SvtPathOptions::PATH_HELP:
899cdf0e10cSrcweir                     {
900cdf0e10cSrcweir                         String aTmp;
901cdf0e10cSrcweir                         if( ::utl::LocalFileHelper::ConvertURLToPhysicalName( sValue, aTmp ) )
902cdf0e10cSrcweir                             aPathOptions.SetHelpPath( aTmp );
903cdf0e10cSrcweir                         break;
904cdf0e10cSrcweir                     }
905cdf0e10cSrcweir 
906cdf0e10cSrcweir 					case SvtPathOptions::PATH_LINGUISTIC:	aPathOptions.SetLinguisticPath( sValue );break;
907cdf0e10cSrcweir                     case SvtPathOptions::PATH_MODULE:
908cdf0e10cSrcweir                     {
909cdf0e10cSrcweir                         String aTmp;
910cdf0e10cSrcweir                         if( ::utl::LocalFileHelper::ConvertURLToPhysicalName( sValue, aTmp ) )
911cdf0e10cSrcweir                             aPathOptions.SetModulePath( aTmp );
912cdf0e10cSrcweir                         break;
913cdf0e10cSrcweir                     }
914cdf0e10cSrcweir 
915cdf0e10cSrcweir 					case SvtPathOptions::PATH_PALETTE:		aPathOptions.SetPalettePath( sValue );break;
916cdf0e10cSrcweir                     case SvtPathOptions::PATH_PLUGIN:
917cdf0e10cSrcweir                     {
918cdf0e10cSrcweir                         String aTmp;
919cdf0e10cSrcweir                         if( ::utl::LocalFileHelper::ConvertURLToPhysicalName( sValue, aTmp ) )
920cdf0e10cSrcweir                             aPathOptions.SetPluginPath( aTmp );
921cdf0e10cSrcweir                         break;
922cdf0e10cSrcweir                     }
923cdf0e10cSrcweir 
924cdf0e10cSrcweir                     case SvtPathOptions::PATH_STORAGE:
925cdf0e10cSrcweir                     {
926cdf0e10cSrcweir                         String aTmp;
927cdf0e10cSrcweir                         if( ::utl::LocalFileHelper::ConvertURLToPhysicalName( sValue, aTmp ) )
928cdf0e10cSrcweir                             aPathOptions.SetStoragePath( aTmp );
929cdf0e10cSrcweir                         break;
930cdf0e10cSrcweir                     }
931cdf0e10cSrcweir 
932cdf0e10cSrcweir 					case SvtPathOptions::PATH_TEMP:			aPathOptions.SetTempPath( sValue );break;
933cdf0e10cSrcweir 					case SvtPathOptions::PATH_TEMPLATE:		aPathOptions.SetTemplatePath( sValue );break;
934cdf0e10cSrcweir 					case SvtPathOptions::PATH_USERCONFIG:	aPathOptions.SetUserConfigPath( sValue );break;
935cdf0e10cSrcweir 					case SvtPathOptions::PATH_WORK:			aPathOptions.SetWorkPath( sValue );break;
936cdf0e10cSrcweir 					default: DBG_ERRORFILE("SfxApplication::SetOptions_Impl()\nInvalid path number found for set directories!");
937cdf0e10cSrcweir 				}
938cdf0e10cSrcweir 			}
939cdf0e10cSrcweir 		}
940cdf0e10cSrcweir 
941cdf0e10cSrcweir 		aSendSet.ClearItem( rPool.GetWhich( SID_ATTR_PATHNAME ) );
942cdf0e10cSrcweir     }
943cdf0e10cSrcweir 
944cdf0e10cSrcweir 	SetOptions_Impl( rSet );
945cdf0e10cSrcweir 
946cdf0e10cSrcweir 	// Undo-Count
947cdf0e10cSrcweir 	Broadcast( SfxItemSetHint( rSet ) );
948cdf0e10cSrcweir }
949cdf0e10cSrcweir 
950cdf0e10cSrcweir //--------------------------------------------------------------------
951cdf0e10cSrcweir 
952cdf0e10cSrcweir // alle Dokumente speichern
953cdf0e10cSrcweir 
SaveAll_Impl(sal_Bool bPrompt,sal_Bool bAutoSave)954cdf0e10cSrcweir sal_Bool SfxApplication::SaveAll_Impl(sal_Bool bPrompt, sal_Bool bAutoSave)
955cdf0e10cSrcweir {
956cdf0e10cSrcweir     bAutoSave = sal_False; // functionality moved to new AutoRecovery Service!
957cdf0e10cSrcweir 
958cdf0e10cSrcweir     sal_Bool bFunc = sal_True;
959cdf0e10cSrcweir     short nRet;
960cdf0e10cSrcweir 
961cdf0e10cSrcweir     for ( SfxObjectShell *pDoc = SfxObjectShell::GetFirst();
962cdf0e10cSrcweir           pDoc;
963cdf0e10cSrcweir           pDoc = SfxObjectShell::GetNext(*pDoc) )
964cdf0e10cSrcweir     {
965cdf0e10cSrcweir 		if( SFX_CREATE_MODE_STANDARD == pDoc->GetCreateMode() &&
966cdf0e10cSrcweir 			SfxViewFrame::GetFirst(pDoc) &&
967cdf0e10cSrcweir 			!pDoc->IsInModalMode() &&
968cdf0e10cSrcweir 			!pDoc->HasModalViews() )
969cdf0e10cSrcweir 		{
970cdf0e10cSrcweir 			if ( pDoc->GetProgress() == 0 )
971cdf0e10cSrcweir 			{
972cdf0e10cSrcweir 				if ( !pDoc->IsModified() )
973cdf0e10cSrcweir 					continue;
974cdf0e10cSrcweir 
975cdf0e10cSrcweir 				if ( bPrompt || (bAutoSave && !pDoc->HasName()) )
976cdf0e10cSrcweir 					nRet = QuerySave_Impl( *pDoc, bAutoSave );
977cdf0e10cSrcweir 				else
978cdf0e10cSrcweir 					nRet = RET_YES;
979cdf0e10cSrcweir 
980cdf0e10cSrcweir 				if ( nRet == RET_YES )
981cdf0e10cSrcweir 				{
982cdf0e10cSrcweir 					SfxRequest aReq( SID_SAVEDOC, 0, pDoc->GetPool() );
983cdf0e10cSrcweir 					const SfxPoolItem *pPoolItem = pDoc->ExecuteSlot( aReq );
984cdf0e10cSrcweir 					if ( !pPoolItem || !pPoolItem->ISA(SfxBoolItem) ||
985cdf0e10cSrcweir 						!( (const SfxBoolItem*) pPoolItem )->GetValue() )
986cdf0e10cSrcweir 						bFunc = sal_False;
987cdf0e10cSrcweir 				}
988cdf0e10cSrcweir 				else if ( nRet == RET_CANCEL )
989cdf0e10cSrcweir 				{
990cdf0e10cSrcweir 					bFunc = sal_False;
991cdf0e10cSrcweir 					break;
992cdf0e10cSrcweir 				}
993cdf0e10cSrcweir 				else if ( nRet == RET_NO )
994cdf0e10cSrcweir 				{
995cdf0e10cSrcweir 				}
996cdf0e10cSrcweir 			}
997cdf0e10cSrcweir 		}
998cdf0e10cSrcweir     }
999cdf0e10cSrcweir 
1000cdf0e10cSrcweir     return bFunc;
1001cdf0e10cSrcweir }
1002cdf0e10cSrcweir 
1003cdf0e10cSrcweir //--------------------------------------------------------------------
1004cdf0e10cSrcweir 
1005cdf0e10cSrcweir //--------------------------------------------------------------------
NotifyEvent(const SfxEventHint & rEventHint,bool bSynchron)1006cdf0e10cSrcweir void SfxApplication::NotifyEvent( const SfxEventHint& rEventHint, bool bSynchron )
1007cdf0e10cSrcweir {
1008cdf0e10cSrcweir     SfxObjectShell *pDoc = rEventHint.GetObjShell();
1009cdf0e10cSrcweir     if ( pDoc && ( pDoc->IsPreview() || !pDoc->Get_Impl()->bInitialized ) )
1010cdf0e10cSrcweir         return;
1011cdf0e10cSrcweir 
1012cdf0e10cSrcweir #ifdef DBG_UTIL
1013cdf0e10cSrcweir     //::rtl::OUString aName = SfxEventConfiguration::GetEventName_Impl( rEventHint.GetEventId() );
1014cdf0e10cSrcweir     //ByteString aTmp( "SfxEvent: ");
1015cdf0e10cSrcweir     //aTmp += ByteString( String(aName), RTL_TEXTENCODING_UTF8 );
1016cdf0e10cSrcweir     //DBG_TRACE( aTmp.GetBuffer() );
1017cdf0e10cSrcweir #endif
1018cdf0e10cSrcweir 
1019cdf0e10cSrcweir 	if ( bSynchron )
1020cdf0e10cSrcweir     {
1021cdf0e10cSrcweir #ifdef DBG_UTIL
1022cdf0e10cSrcweir 		if (!pDoc)
1023cdf0e10cSrcweir 		{
1024cdf0e10cSrcweir 			ByteString aTmp( "SfxEvent: ");
1025cdf0e10cSrcweir 			aTmp += ByteString( String( rEventHint.GetEventName() ), RTL_TEXTENCODING_UTF8 );
1026cdf0e10cSrcweir 			DBG_TRACE( aTmp.GetBuffer() );
1027cdf0e10cSrcweir 		}
1028cdf0e10cSrcweir #endif
1029cdf0e10cSrcweir         Broadcast(rEventHint);
1030cdf0e10cSrcweir         if ( pDoc )
1031cdf0e10cSrcweir             pDoc->Broadcast( rEventHint );
1032cdf0e10cSrcweir     }
1033cdf0e10cSrcweir     else
1034cdf0e10cSrcweir         new SfxEventAsyncer_Impl( rEventHint );
1035cdf0e10cSrcweir }
1036cdf0e10cSrcweir 
1037cdf0e10cSrcweir IMPL_OBJHINT( SfxStringHint, String )
1038cdf0e10cSrcweir 
1039