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