merge the formfield patch from ooo-build
[ooovba.git] / sfx2 / source / appl / appcfg.cxx
blob172c584c9322a0a97f43964876d8062214308cce
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: appcfg.cxx,v $
10 * $Revision: 1.74 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_sfx2.hxx"
33 #include <com/sun/star/uno/Reference.hxx>
34 #include <com/sun/star/frame/XDesktop.hpp>
35 #include <com/sun/star/util/XURLTransformer.hpp>
36 #ifndef _COM_SUN_STAR_BEANS_PropertyValue_HPP_
37 #include <com/sun/star/beans/PropertyValue.hpp>
38 #endif
39 #include <com/sun/star/beans/XPropertySet.hpp>
40 #include <com/sun/star/util/XFlushable.hpp>
42 #ifndef _STDLIB_H
43 #include <stdlib.h>
44 #endif
45 #include <tools/config.hxx>
46 #include <vcl/sound.hxx>
47 #include <vcl/msgbox.hxx>
48 #include <tools/string.hxx>
49 #include <svtools/itempool.hxx>
50 #include <svtools/aeitem.hxx>
51 #include <svtools/slstitm.hxx>
52 #include <svtools/stritem.hxx>
53 #include <svtools/intitem.hxx>
54 #include <svtools/eitem.hxx>
55 #include <svtools/szitem.hxx>
56 #include <svtools/undo.hxx>
58 #define _SVSTDARR_STRINGS
59 #include <svtools/svstdarr.hxx>
60 #include <svtools/ttprops.hxx>
61 #include <sfx2/sfxsids.hrc>
62 #include <sot/exchange.hxx>
64 //#include <svtools/agprop.hxx>
65 //#include <sj2/sjapplet.hxx>
66 #include <svtools/isethint.hxx>
68 #include <unotools/configmgr.hxx>
69 #include <tools/urlobj.hxx>
70 #include <tools/wldcrd.hxx>
71 #include <svtools/saveopt.hxx>
72 #include <svtools/helpopt.hxx>
73 #include <svtools/undoopt.hxx>
74 #include <svtools/securityoptions.hxx>
75 #include <svtools/pathoptions.hxx>
76 #include <svtools/inetoptions.hxx>
77 #include <svtools/miscopt.hxx>
78 #include <vcl/toolbox.hxx>
79 #include <unotools/localfilehelper.hxx>
80 #include <comphelper/processfactory.hxx>
81 #include <rtl/ustrbuf.hxx>
82 #include <svtools/misccfg.hxx>
84 #include <sfx2/app.hxx>
85 #include <sfx2/docfile.hxx>
86 #include <sfx2/viewfrm.hxx>
87 #include "sfxhelp.hxx"
88 #include "sfxtypes.hxx"
89 #include <sfx2/dispatch.hxx>
90 #include <sfx2/objsh.hxx>
91 #include "objshimp.hxx"
92 #include <sfx2/viewsh.hxx>
93 #include <sfx2/request.hxx>
94 #include <sfx2/evntconf.hxx>
95 #include "appdata.hxx"
96 #include "workwin.hxx"
97 #include <sfx2/macrconf.hxx>
98 #include "helper.hxx" // SfxContentHelper::...
99 #include "app.hrc"
100 #include "sfxresid.hxx"
101 #include "shutdownicon.hxx"
103 using namespace ::com::sun::star::uno;
104 using namespace ::com::sun::star::util;
105 using namespace ::com::sun::star::frame;
106 using namespace ::com::sun::star::beans;
108 //-------------------------------------------------------------------------
110 class SfxEventAsyncer_Impl : public SfxListener
112 SfxEventHint aHint;
113 Timer* pTimer;
115 public:
117 virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
118 SfxEventAsyncer_Impl( const SfxEventHint& rHint );
119 ~SfxEventAsyncer_Impl();
120 DECL_LINK( TimerHdl, Timer*);
123 // -----------------------------------------------------------------------
125 void SfxEventAsyncer_Impl::Notify( SfxBroadcaster&, const SfxHint& rHint )
127 SfxSimpleHint* pHint = PTR_CAST( SfxSimpleHint, &rHint );
128 if( pHint && pHint->GetId() == SFX_HINT_DYING && pTimer->IsActive() )
130 pTimer->Stop();
131 delete this;
135 // -----------------------------------------------------------------------
137 SfxEventAsyncer_Impl::SfxEventAsyncer_Impl( const SfxEventHint& rHint )
138 : aHint( rHint )
140 if( rHint.GetObjShell() )
141 StartListening( *rHint.GetObjShell() );
142 pTimer = new Timer;
143 pTimer->SetTimeoutHdl( LINK(this, SfxEventAsyncer_Impl, TimerHdl) );
144 pTimer->SetTimeout( 0 );
145 pTimer->Start();
148 // -----------------------------------------------------------------------
150 SfxEventAsyncer_Impl::~SfxEventAsyncer_Impl()
152 delete pTimer;
155 // -----------------------------------------------------------------------
157 IMPL_LINK(SfxEventAsyncer_Impl, TimerHdl, Timer*, pAsyncTimer)
159 (void)pAsyncTimer; // unused variable
160 SfxObjectShellRef xRef( aHint.GetObjShell() );
161 pAsyncTimer->Stop();
162 #ifdef DBG_UTIL
163 if (!xRef.Is())
165 ByteString aTmp( "SfxEvent: ");
166 aTmp += ByteString( String( aHint.GetEventName() ), RTL_TEXTENCODING_UTF8 );
167 DBG_TRACE( aTmp.GetBuffer() );
169 #endif
170 SFX_APP()->Broadcast( aHint );
171 if ( xRef.Is() )
172 xRef->Broadcast( aHint );
173 delete this;
174 return 0L;
178 //--------------------------------------------------------------------
180 BOOL SfxApplication::GetOptions( SfxItemSet& rSet )
182 BOOL bRet = FALSE;
183 SfxItemPool &rPool = GetPool();
184 String aTRUEStr('1');
186 const USHORT *pRanges = rSet.GetRanges();
187 SvtSaveOptions aSaveOptions;
188 SvtUndoOptions aUndoOptions;
189 SvtHelpOptions aHelpOptions;
190 SvtInetOptions aInetOptions;
191 SvtSecurityOptions aSecurityOptions;
192 SvtMiscOptions aMiscOptions;
194 while ( *pRanges )
196 for(USHORT nWhich = *pRanges++; nWhich <= *pRanges; ++nWhich)
198 switch(nWhich)
200 case SID_ATTR_BUTTON_OUTSTYLE3D :
201 if(rSet.Put( SfxBoolItem( rPool.GetWhich( SID_ATTR_BUTTON_OUTSTYLE3D ),
202 aMiscOptions.GetToolboxStyle() != TOOLBOX_STYLE_FLAT)))
203 bRet = TRUE;
204 break;
205 case SID_ATTR_BUTTON_BIGSIZE :
207 if( rSet.Put( SfxBoolItem( rPool.GetWhich( SID_ATTR_BUTTON_BIGSIZE ), aMiscOptions.AreCurrentSymbolsLarge() ) ) )
208 bRet = TRUE;
209 break;
211 case SID_ATTR_BACKUP :
213 bRet = TRUE;
214 if (!aSaveOptions.IsReadOnly(SvtSaveOptions::E_BACKUP))
215 if (!rSet.Put( SfxBoolItem( rPool.GetWhich( SID_ATTR_BACKUP ),aSaveOptions.IsBackup())))
216 bRet = FALSE;
218 break;
219 case SID_ATTR_PRETTYPRINTING:
221 bRet = TRUE;
222 if (!aSaveOptions.IsReadOnly(SvtSaveOptions::E_DOPRETTYPRINTING))
223 if (!rSet.Put( SfxBoolItem( rPool.GetWhich( SID_ATTR_PRETTYPRINTING ), aSaveOptions.IsPrettyPrinting())))
224 bRet = FALSE;
226 break;
227 case SID_ATTR_WARNALIENFORMAT:
229 bRet = TRUE;
230 if (!aSaveOptions.IsReadOnly(SvtSaveOptions::E_WARNALIENFORMAT))
231 if (!rSet.Put( SfxBoolItem( rPool.GetWhich( SID_ATTR_WARNALIENFORMAT ), aSaveOptions.IsWarnAlienFormat())))
232 bRet = FALSE;
234 break;
235 case SID_ATTR_AUTOSAVE :
237 bRet = TRUE;
238 if (!aSaveOptions.IsReadOnly(SvtSaveOptions::E_AUTOSAVE))
239 if (!rSet.Put( SfxBoolItem( rPool.GetWhich( SID_ATTR_AUTOSAVE ), aSaveOptions.IsAutoSave())))
240 bRet = FALSE;
242 break;
243 case SID_ATTR_AUTOSAVEPROMPT :
245 bRet = TRUE;
246 if (!aSaveOptions.IsReadOnly(SvtSaveOptions::E_AUTOSAVEPROMPT))
247 if (!rSet.Put( SfxBoolItem( rPool.GetWhich( SID_ATTR_AUTOSAVEPROMPT ), aSaveOptions.IsAutoSavePrompt())))
248 bRet = FALSE;
250 break;
251 case SID_ATTR_AUTOSAVEMINUTE :
253 bRet = TRUE;
254 if (!aSaveOptions.IsReadOnly(SvtSaveOptions::E_AUTOSAVETIME))
255 if (!rSet.Put( SfxUInt16Item( rPool.GetWhich( SID_ATTR_AUTOSAVEMINUTE ), (UINT16)aSaveOptions.GetAutoSaveTime())))
256 bRet = FALSE;
258 break;
259 case SID_ATTR_DOCINFO :
261 bRet = TRUE;
262 if (!aSaveOptions.IsReadOnly(SvtSaveOptions::E_DOCINFSAVE))
263 if (!rSet.Put( SfxBoolItem( rPool.GetWhich( SID_ATTR_DOCINFO ), aSaveOptions.IsDocInfoSave())))
264 bRet = FALSE;
266 break;
267 case SID_ATTR_WORKINGSET :
269 bRet = TRUE;
270 if (!aSaveOptions.IsReadOnly(SvtSaveOptions::E_SAVEWORKINGSET))
271 if (!rSet.Put( SfxBoolItem( rPool.GetWhich( SID_ATTR_WORKINGSET ), aSaveOptions.IsSaveWorkingSet())))
272 bRet = FALSE;
274 break;
275 case SID_ATTR_SAVEDOCWINS :
277 bRet = TRUE;
278 if (!aSaveOptions.IsReadOnly(SvtSaveOptions::E_SAVEDOCWINS))
279 if (!rSet.Put( SfxBoolItem( rPool.GetWhich( SID_ATTR_SAVEDOCWINS ), aSaveOptions.IsSaveDocWins())))
280 bRet = FALSE;
282 break;
283 case SID_ATTR_SAVEDOCVIEW :
285 bRet = TRUE;
286 if (!aSaveOptions.IsReadOnly(SvtSaveOptions::E_SAVEDOCVIEW))
287 if (!rSet.Put( SfxBoolItem( rPool.GetWhich( SID_ATTR_SAVEDOCVIEW ), aSaveOptions.IsSaveDocView())))
288 bRet = FALSE;
290 break;
291 case SID_ATTR_METRIC :
292 // if(rSet.Put( SfxUInt16Item( rPool.GetWhich( SID_ATTR_METRIC ),
293 // pOptions->GetMetric() ) ) )
294 // bRet = TRUE;
295 break;
296 case SID_HELPBALLOONS :
297 if(rSet.Put( SfxBoolItem ( rPool.GetWhich( SID_HELPBALLOONS ),
298 aHelpOptions.IsExtendedHelp() ) ) )
299 bRet = TRUE;
300 break;
301 case SID_HELPTIPS :
302 if(rSet.Put( SfxBoolItem ( rPool.GetWhich( SID_HELPTIPS ),
303 aHelpOptions.IsHelpTips() ) ) )
304 bRet = TRUE;
305 break;
306 case SID_ATTR_AUTOHELPAGENT :
307 if(rSet.Put( SfxBoolItem ( rPool.GetWhich( SID_ATTR_AUTOHELPAGENT ),
308 aHelpOptions.IsHelpAgentAutoStartMode() ) ) )
309 bRet = TRUE;
310 break;
311 case SID_HELPAGENT_TIMEOUT :
312 if ( rSet.Put( SfxInt32Item( rPool.GetWhich( SID_HELPAGENT_TIMEOUT ),
313 aHelpOptions.GetHelpAgentTimeoutPeriod() ) ) )
314 bRet = TRUE;
315 break;
316 case SID_ATTR_WELCOMESCREEN :
317 if(rSet.Put( SfxBoolItem ( rPool.GetWhich( SID_ATTR_WELCOMESCREEN ),
318 aHelpOptions.IsWelcomeScreen() ) ) )
319 bRet = TRUE;
320 break;
321 case SID_HELP_STYLESHEET :
322 if(rSet.Put( SfxStringItem ( rPool.GetWhich( SID_HELP_STYLESHEET ),
323 aHelpOptions.GetHelpStyleSheet() ) ) )
324 bRet = TRUE;
325 break;
326 case SID_ATTR_UNDO_COUNT :
327 if(rSet.Put( SfxUInt16Item ( rPool.GetWhich( SID_ATTR_UNDO_COUNT ),
328 (UINT16)aUndoOptions.GetUndoCount() ) ) )
329 bRet = TRUE;
330 break;
331 case SID_ATTR_QUICKLAUNCHER :
333 if ( ShutdownIcon::IsQuickstarterInstalled() )
335 if ( rSet.Put( SfxBoolItem( rPool.GetWhich( SID_ATTR_QUICKLAUNCHER ),
336 ShutdownIcon::GetAutostart() ) ) )
337 bRet = TRUE;
339 else
341 rSet.DisableItem( rPool.GetWhich( SID_ATTR_QUICKLAUNCHER ) );
342 bRet = TRUE;
344 break;
346 case SID_SAVEREL_INET :
348 bRet = TRUE;
349 if (!aSaveOptions.IsReadOnly(SvtSaveOptions::E_SAVERELINET))
350 if (!rSet.Put( SfxBoolItem ( rPool.GetWhich( SID_SAVEREL_INET ), aSaveOptions.IsSaveRelINet() )))
351 bRet = FALSE;
353 break;
354 case SID_SAVEREL_FSYS :
356 bRet = TRUE;
357 if (!aSaveOptions.IsReadOnly(SvtSaveOptions::E_SAVERELFSYS))
358 if (!rSet.Put( SfxBoolItem ( rPool.GetWhich( SID_SAVEREL_FSYS ), aSaveOptions.IsSaveRelFSys() )))
359 bRet = FALSE;
361 break;
362 case SID_BASIC_ENABLED :
364 bRet = TRUE;
365 if (!aSecurityOptions.IsReadOnly(SvtSecurityOptions::E_BASICMODE))
367 if ( !rSet.Put( SfxUInt16Item( rPool.GetWhich( SID_BASIC_ENABLED ), sal::static_int_cast< UINT16 >(aSecurityOptions.GetBasicMode()))))
368 bRet = FALSE;
371 break;
372 case SID_INET_EXE_PLUGIN :
374 bRet = TRUE;
375 if (!aSecurityOptions.IsReadOnly(SvtSecurityOptions::E_EXECUTEPLUGINS))
377 if ( !rSet.Put( SfxBoolItem( SID_INET_EXE_PLUGIN, aSecurityOptions.IsExecutePlugins() ) ) )
378 bRet = FALSE;
381 break;
382 case SID_MACRO_WARNING :
384 bRet = TRUE;
385 if (!aSecurityOptions.IsReadOnly(SvtSecurityOptions::E_WARNING))
387 if ( !rSet.Put( SfxBoolItem( SID_MACRO_WARNING, aSecurityOptions.IsWarningEnabled() ) ) )
388 bRet = FALSE;
391 break;
392 case SID_MACRO_CONFIRMATION :
394 bRet = TRUE;
395 if (!aSecurityOptions.IsReadOnly(SvtSecurityOptions::E_CONFIRMATION))
397 if ( !rSet.Put( SfxBoolItem( SID_MACRO_CONFIRMATION, aSecurityOptions.IsConfirmationEnabled() ) ) )
398 bRet = FALSE;
401 break;
402 case SID_SECURE_URL :
404 bRet = TRUE;
405 if (!aSecurityOptions.IsReadOnly(SvtSecurityOptions::E_SECUREURLS))
407 ::com::sun::star::uno::Sequence< ::rtl::OUString > seqURLs = aSecurityOptions.GetSecureURLs();
408 List aList;
409 sal_uInt32 nCount = seqURLs.getLength();
410 sal_uInt32 nURL;
411 for( nURL=0; nURL<nCount; ++nURL )
413 aList.Insert( new String( seqURLs[nURL] ), LIST_APPEND );
415 if( !rSet.Put( SfxStringListItem( rPool.GetWhich(SID_SECURE_URL),
416 &aList ) ) )
418 bRet = FALSE;
420 for( nURL=0; nURL<nCount; ++nURL )
422 delete (String*)aList.GetObject(nURL);
424 aList.Clear();
427 break;
428 case SID_ENABLE_METAFILEPRINT :
429 #ifdef ENABLE_MISSINGKEYASSERTIONS//MUSTINI
430 DBG_ASSERT(sal_False, "SfxApplication::GetOptions()\nSoffice.ini key \"Common\\MetafilePrint\" is obsolete! .. How I can support SID_ENABLE_METAFILEPRINT any longer?\n");
431 #endif
432 break;
433 case SID_INET_PROXY_TYPE :
435 if( rSet.Put( SfxUInt16Item ( rPool.GetWhich( SID_INET_PROXY_TYPE ),
436 (UINT16)aInetOptions.GetProxyType() )))
437 bRet = TRUE;
438 break;
440 case SID_INET_HTTP_PROXY_NAME :
442 if ( rSet.Put( SfxStringItem ( rPool.GetWhich(SID_INET_HTTP_PROXY_NAME ),
443 aInetOptions.GetProxyHttpName() )))
444 bRet = TRUE;
445 break;
447 case SID_INET_HTTP_PROXY_PORT :
448 if ( rSet.Put( SfxInt32Item( rPool.GetWhich(SID_INET_HTTP_PROXY_PORT ),
449 aInetOptions.GetProxyHttpPort() )))
450 bRet = TRUE;
451 break;
452 case SID_INET_FTP_PROXY_NAME :
453 if ( rSet.Put( SfxStringItem ( rPool.GetWhich(SID_INET_FTP_PROXY_NAME ),
454 aInetOptions.GetProxyFtpName() )))
455 bRet = TRUE;
456 break;
457 case SID_INET_FTP_PROXY_PORT :
458 if ( rSet.Put( SfxInt32Item ( rPool.GetWhich(SID_INET_FTP_PROXY_PORT ),
459 aInetOptions.GetProxyFtpPort() )))
460 bRet = TRUE;
461 break;
462 case SID_INET_SECURITY_PROXY_NAME :
463 case SID_INET_SECURITY_PROXY_PORT :
464 #ifdef ENABLE_MISSINGKEYASSERTIONS//MUSTINI
465 DBG_ASSERT( sal_False, "SfxApplication::GetOptions()\nSome INET values no longer supported!\n" );
466 #endif
467 break;
468 case SID_INET_NOPROXY :
469 if( rSet.Put( SfxStringItem ( rPool.GetWhich( SID_INET_NOPROXY),
470 aInetOptions.GetProxyNoProxy() )))
471 bRet = TRUE;
472 break;
473 case SID_ATTR_PATHNAME :
474 case SID_ATTR_PATHGROUP :
476 SfxAllEnumItem aNames(rPool.GetWhich(SID_ATTR_PATHGROUP));
477 SfxAllEnumItem aValues(rPool.GetWhich(SID_ATTR_PATHNAME));
478 SvtPathOptions aPathCfg;
479 for ( USHORT nProp = SvtPathOptions::PATH_ADDIN;
480 nProp <= SvtPathOptions::PATH_WORK; nProp++ )
482 const String aName( SfxResId( CONFIG_PATH_START + nProp ) );
483 aNames.InsertValue( nProp, aName );
484 String aValue;
485 switch ( nProp )
487 case SvtPathOptions::PATH_ADDIN: ::utl::LocalFileHelper::ConvertPhysicalNameToURL( aPathCfg.GetAddinPath(), aValue ); break;
488 case SvtPathOptions::PATH_AUTOCORRECT: aValue = aPathCfg.GetAutoCorrectPath(); break;
489 case SvtPathOptions::PATH_AUTOTEXT: aValue = aPathCfg.GetAutoTextPath(); break;
490 case SvtPathOptions::PATH_BACKUP: aValue = aPathCfg.GetBackupPath(); break;
491 case SvtPathOptions::PATH_BASIC: aValue = aPathCfg.GetBasicPath(); break;
492 case SvtPathOptions::PATH_BITMAP: aValue = aPathCfg.GetBitmapPath(); break;
493 case SvtPathOptions::PATH_CONFIG: aValue = aPathCfg.GetConfigPath(); break;
494 case SvtPathOptions::PATH_DICTIONARY: aValue = aPathCfg.GetDictionaryPath(); break;
495 case SvtPathOptions::PATH_FAVORITES: aValue = aPathCfg.GetFavoritesPath(); break;
496 case SvtPathOptions::PATH_FILTER: ::utl::LocalFileHelper::ConvertPhysicalNameToURL( aPathCfg.GetFilterPath(), aValue ); break;
497 case SvtPathOptions::PATH_GALLERY: aValue = aPathCfg.GetGalleryPath(); break;
498 case SvtPathOptions::PATH_GRAPHIC: aValue = aPathCfg.GetGraphicPath(); break;
499 case SvtPathOptions::PATH_HELP: ::utl::LocalFileHelper::ConvertPhysicalNameToURL( aPathCfg.GetHelpPath(), aValue ); break;
500 case SvtPathOptions::PATH_LINGUISTIC: aValue = aPathCfg.GetLinguisticPath(); break;
501 case SvtPathOptions::PATH_MODULE: ::utl::LocalFileHelper::ConvertPhysicalNameToURL( aPathCfg.GetModulePath(), aValue ); break;
502 case SvtPathOptions::PATH_PALETTE: aValue = aPathCfg.GetPalettePath(); break;
503 case SvtPathOptions::PATH_PLUGIN: ::utl::LocalFileHelper::ConvertPhysicalNameToURL( aPathCfg.GetPluginPath(), aValue ); break;
504 case SvtPathOptions::PATH_STORAGE: ::utl::LocalFileHelper::ConvertPhysicalNameToURL( aPathCfg.GetStoragePath(), aValue ); break;
505 case SvtPathOptions::PATH_TEMP: aValue = aPathCfg.GetTempPath(); break;
506 case SvtPathOptions::PATH_TEMPLATE: aValue = aPathCfg.GetTemplatePath(); break;
507 case SvtPathOptions::PATH_USERCONFIG: aValue = aPathCfg.GetUserConfigPath(); break;
508 case SvtPathOptions::PATH_WORK: aValue = aPathCfg.GetWorkPath(); break;
510 aValues.InsertValue( nProp, aValue );
513 if ( rSet.Put(aNames) || rSet.Put(aValues) )
514 bRet = TRUE;
517 default:
518 DBG_WARNING( "W1:Wrong ID while getting Options!" );
519 break;
521 #ifdef DBG_UTIL
522 if ( !bRet )
523 DBG_ERROR( "Putting options failed!" );
524 #endif
526 pRanges++;
529 return bRet;
532 //--------------------------------------------------------------------
533 BOOL SfxApplication::IsSecureURL( const INetURLObject& rURL, const String* pReferer ) const
535 return SvtSecurityOptions().IsSecureURL( rURL.GetMainURL( INetURLObject::NO_DECODE ), *pReferer );
537 //--------------------------------------------------------------------
538 // TODO/CLEANUP: wieso zwei SetOptions Methoden?
539 void SfxApplication::SetOptions_Impl( const SfxItemSet& rSet )
541 const SfxPoolItem *pItem = 0;
542 SfxItemPool &rPool = GetPool();
543 BOOL bResetSession = FALSE;
544 BOOL bProxiesModified = FALSE;
546 SvtSaveOptions aSaveOptions;
547 SvtUndoOptions aUndoOptions;
548 SvtHelpOptions aHelpOptions;
549 SvtSecurityOptions aSecurityOptions;
550 SvtPathOptions aPathOptions;
551 SvtInetOptions aInetOptions;
552 SvtMiscOptions aMiscOptions;
553 if ( SFX_ITEM_SET == rSet.GetItemState(rPool.GetWhich(SID_ATTR_BUTTON_OUTSTYLE3D), TRUE, &pItem) )
555 DBG_ASSERT(pItem->ISA(SfxBoolItem), "BoolItem expected");
556 USHORT nOutStyle =
557 ( (const SfxBoolItem *)pItem)->GetValue() ? 0 : TOOLBOX_STYLE_FLAT;
558 aMiscOptions.SetToolboxStyle( nOutStyle );
561 if ( SFX_ITEM_SET == rSet.GetItemState(rPool.GetWhich(SID_ATTR_BUTTON_BIGSIZE), TRUE, &pItem) )
563 DBG_ASSERT(pItem->ISA(SfxBoolItem), "BoolItem expected");
564 BOOL bBigSize = ( (const SfxBoolItem*)pItem )->GetValue();
565 aMiscOptions.SetSymbolsSize(
566 sal::static_int_cast< sal_Int16 >(
567 bBigSize ? SFX_SYMBOLS_SIZE_LARGE : SFX_SYMBOLS_SIZE_SMALL ) );
568 SfxViewFrame* pCurrViewFrame = SfxViewFrame::GetFirst();
569 while ( pCurrViewFrame )
571 // update all "final" dispatchers
572 if ( !pCurrViewFrame->GetActiveChildFrame_Impl() )
573 pCurrViewFrame->GetDispatcher()->Update_Impl(sal_True);
574 pCurrViewFrame = SfxViewFrame::GetNext(*pCurrViewFrame);
578 // Backup
579 if ( SFX_ITEM_SET == rSet.GetItemState(rPool.GetWhich(SID_ATTR_BACKUP), TRUE, &pItem) )
581 DBG_ASSERT(pItem->ISA(SfxBoolItem), "BoolItem expected");
582 aSaveOptions.SetBackup( ( (const SfxBoolItem*)pItem )->GetValue() );
585 // PrettyPrinting
586 if ( SFX_ITEM_SET == rSet.GetItemState( rPool.GetWhich( SID_ATTR_PRETTYPRINTING ), TRUE, &pItem ) )
588 DBG_ASSERT( pItem->ISA( SfxBoolItem ), "BoolItem expected" );
589 aSaveOptions.SetPrettyPrinting( static_cast< const SfxBoolItem*> ( pItem )->GetValue() );
592 // WarnAlienFormat
593 if ( SFX_ITEM_SET == rSet.GetItemState( rPool.GetWhich( SID_ATTR_WARNALIENFORMAT ), TRUE, &pItem ) )
595 DBG_ASSERT( pItem->ISA( SfxBoolItem ), "BoolItem expected" );
596 aSaveOptions.SetWarnAlienFormat( static_cast< const SfxBoolItem*> ( pItem )->GetValue() );
599 // AutoSave
600 if ( SFX_ITEM_SET == rSet.GetItemState(rPool.GetWhich(SID_ATTR_AUTOSAVE), TRUE, &pItem))
602 DBG_ASSERT(pItem->ISA(SfxBoolItem), "BoolItem expected");
603 aSaveOptions.SetAutoSave( ( (const SfxBoolItem*)pItem )->GetValue() );
606 // AutoSave-Propt
607 if ( SFX_ITEM_SET == rSet.GetItemState(rPool.GetWhich(SID_ATTR_AUTOSAVEPROMPT), TRUE, &pItem))
609 DBG_ASSERT(pItem->ISA(SfxBoolItem), "BoolItem expected");
610 aSaveOptions.SetAutoSavePrompt(((const SfxBoolItem *)pItem)->GetValue());
613 // AutoSave-Time
614 if ( SFX_ITEM_SET == rSet.GetItemState(rPool.GetWhich(SID_ATTR_AUTOSAVEMINUTE), TRUE, &pItem))
616 DBG_ASSERT(pItem->ISA(SfxUInt16Item), "UInt16Item expected");
617 aSaveOptions.SetAutoSaveTime(((const SfxUInt16Item *)pItem)->GetValue());
620 // DocInfo
621 if ( SFX_ITEM_SET == rSet.GetItemState(rPool.GetWhich(SID_ATTR_DOCINFO), TRUE, &pItem))
623 DBG_ASSERT(pItem->ISA(SfxBoolItem), "BoolItem expected");
624 aSaveOptions.SetDocInfoSave(((const SfxBoolItem *)pItem)->GetValue());
627 // offende Dokumente merken
628 if ( SFX_ITEM_SET == rSet.GetItemState(rPool.GetWhich(SID_ATTR_WORKINGSET), TRUE, &pItem))
630 DBG_ASSERT(pItem->ISA(SfxBoolItem), "BoolItem expected");
631 aSaveOptions.SetSaveWorkingSet(((const SfxBoolItem *)pItem)->GetValue());
634 // offene Fenster speichern
635 if ( SFX_ITEM_SET == rSet.GetItemState(rPool.GetWhich(SID_ATTR_SAVEDOCWINS), TRUE, &pItem))
637 DBG_ASSERT(pItem->ISA(SfxBoolItem), "BoolItem expected");
638 aSaveOptions.SetSaveDocWins(((const SfxBoolItem *)pItem)->GetValue());
641 // Fenster-Einstellung speichern
642 if ( SFX_ITEM_SET == rSet.GetItemState(rPool.GetWhich(SID_ATTR_SAVEDOCVIEW), TRUE, &pItem))
644 DBG_ASSERT(pItem->ISA(SfxBoolItem), "BoolItem expected");
645 aSaveOptions.SetSaveDocView(((const SfxBoolItem *)pItem)->GetValue());
648 // Metric
649 if ( SFX_ITEM_SET == rSet.GetItemState(rPool.GetWhich(SID_ATTR_METRIC), TRUE, &pItem))
651 DBG_ASSERT(pItem->ISA(SfxUInt16Item), "UInt16Item expected");
652 // pOptions->SetMetric((FieldUnit)((const SfxUInt16Item*)pItem)->GetValue());
655 // HelpBalloons
656 if ( SFX_ITEM_SET == rSet.GetItemState(rPool.GetWhich(SID_HELPBALLOONS), TRUE, &pItem))
658 DBG_ASSERT(pItem->ISA(SfxBoolItem), "BoolItem expected");
659 aHelpOptions.SetExtendedHelp(((const SfxBoolItem *)pItem)->GetValue());
662 // HelpTips
663 if ( SFX_ITEM_SET == rSet.GetItemState(rPool.GetWhich(SID_HELPTIPS), TRUE, &pItem))
665 DBG_ASSERT(pItem->ISA(SfxBoolItem), "BoolItem expected");
666 aHelpOptions.SetHelpTips(((const SfxBoolItem *)pItem)->GetValue());
669 // AutoHelpAgent
670 if ( SFX_ITEM_SET == rSet.GetItemState(rPool.GetWhich(SID_ATTR_AUTOHELPAGENT ), TRUE, &pItem))
672 DBG_ASSERT(pItem->ISA(SfxBoolItem), "BoolItem expected");
673 aHelpOptions.SetHelpAgentAutoStartMode( ((const SfxBoolItem *)pItem)->GetValue() );
676 // help agent timeout
677 if ( SFX_ITEM_SET == rSet.GetItemState( rPool.GetWhich( SID_HELPAGENT_TIMEOUT ), TRUE, &pItem ) )
679 DBG_ASSERT(pItem->ISA(SfxInt32Item), "Int32Item expected");
680 aHelpOptions.SetHelpAgentTimeoutPeriod( ( (const SfxInt32Item*)pItem )->GetValue() );
683 // WelcomeScreen
684 if ( SFX_ITEM_SET == rSet.GetItemState(rPool.GetWhich(SID_ATTR_WELCOMESCREEN ), TRUE, &pItem))
686 DBG_ASSERT(pItem->ISA(SfxBoolItem), "BoolItem expected");
687 aHelpOptions.SetWelcomeScreen( ((const SfxBoolItem *)pItem)->GetValue() );
690 // WelcomeScreen
691 if ( SFX_ITEM_SET == rSet.GetItemState(rPool.GetWhich(SID_WELCOMESCREEN_RESET ), TRUE, &pItem))
693 DBG_ASSERT(pItem->ISA(SfxBoolItem), "BoolItem expected");
694 BOOL bReset = ((const SfxBoolItem *)pItem)->GetValue();
695 if ( bReset )
697 DBG_ERROR( "Not implemented, may be EOL!" );
700 if ( SFX_ITEM_SET == rSet.GetItemState(rPool.GetWhich(SID_HELP_STYLESHEET ), TRUE, &pItem))
702 DBG_ASSERT(pItem->ISA(SfxStringItem), "StringItem expected");
703 aHelpOptions.SetHelpStyleSheet( ((const SfxStringItem *)pItem)->GetValue() );
706 // SaveRelINet
707 if ( SFX_ITEM_SET == rSet.GetItemState(rPool.GetWhich(SID_SAVEREL_INET), TRUE, &pItem))
709 DBG_ASSERT(pItem->ISA(SfxBoolItem), "BoolItem expected");
710 aSaveOptions.SetSaveRelINet(((const SfxBoolItem *)pItem)->GetValue());
713 // SaveRelFSys
714 if ( SFX_ITEM_SET == rSet.GetItemState(rPool.GetWhich(SID_SAVEREL_FSYS), TRUE, &pItem))
716 DBG_ASSERT(pItem->ISA(SfxBoolItem), "BoolItem expected");
717 aSaveOptions.SetSaveRelFSys(((const SfxBoolItem *)pItem)->GetValue());
720 // Undo-Count
721 if ( SFX_ITEM_SET == rSet.GetItemState(rPool.GetWhich(SID_ATTR_UNDO_COUNT), TRUE, &pItem))
723 DBG_ASSERT(pItem->ISA(SfxUInt16Item), "UInt16Item expected");
724 USHORT nUndoCount = ((const SfxUInt16Item*)pItem)->GetValue();
725 aUndoOptions.SetUndoCount( nUndoCount );
727 // um alle Undo-Manager zu erwischen: "uber alle Frames iterieren
728 for ( SfxViewFrame *pFrame = SfxViewFrame::GetFirst();
729 pFrame;
730 pFrame = SfxViewFrame::GetNext(*pFrame) )
732 // den Dispatcher des Frames rausholen
733 SfxDispatcher *pDispat = pFrame->GetDispatcher();
734 pDispat->Flush();
736 // "uber alle SfxShells auf dem Stack des Dispatchers iterieren
737 USHORT nIdx = 0;
738 for ( SfxShell *pSh = pDispat->GetShell(nIdx);
739 pSh;
740 ++nIdx, pSh = pDispat->GetShell(nIdx) )
742 SfxUndoManager *pShUndoMgr = pSh->GetUndoManager();
743 if ( pShUndoMgr )
744 pShUndoMgr->SetMaxUndoActionCount( nUndoCount );
749 // Office autostart
750 if ( SFX_ITEM_SET == rSet.GetItemState(rPool.GetWhich(SID_ATTR_QUICKLAUNCHER), TRUE, &pItem))
752 DBG_ASSERT(pItem->ISA(SfxBoolItem), "BoolItem expected");
753 ShutdownIcon::SetAutostart( ( (const SfxBoolItem*)pItem )->GetValue() != FALSE );
756 // StarBasic Enable
757 if ( SFX_ITEM_SET == rSet.GetItemState(SID_BASIC_ENABLED, TRUE, &pItem))
759 DBG_ASSERT(pItem->ISA(SfxUInt16Item), "SfxInt16Item expected");
760 aSecurityOptions.SetBasicMode( (EBasicSecurityMode)( (const SfxUInt16Item*)pItem )->GetValue() );
763 // Execute PlugIns
764 if ( SFX_ITEM_SET == rSet.GetItemState(SID_INET_EXE_PLUGIN, TRUE, &pItem))
766 DBG_ASSERT(pItem->ISA(SfxBoolItem), "SfxBoolItem expected");
767 aSecurityOptions.SetExecutePlugins( ( (const SfxBoolItem *)pItem )->GetValue() );
768 bResetSession = TRUE;
771 if ( SFX_ITEM_SET == rSet.GetItemState(rPool.GetWhich(SID_INET_PROXY_TYPE), TRUE, &pItem))
773 DBG_ASSERT( pItem->ISA(SfxUInt16Item), "UInt16Item expected" );
774 aInetOptions.SetProxyType((SvtInetOptions::ProxyType)( (const SfxUInt16Item*)pItem )->GetValue());
775 bResetSession = TRUE;
776 bProxiesModified = TRUE;
779 if ( SFX_ITEM_SET == rSet.GetItemState( rPool.GetWhich( SID_INET_HTTP_PROXY_NAME ), TRUE, &pItem ) )
781 DBG_ASSERT( pItem->ISA(SfxStringItem), "StringItem expected" );
782 aInetOptions.SetProxyHttpName( ((const SfxStringItem *)pItem)->GetValue() );
783 bResetSession = TRUE;
784 bProxiesModified = TRUE;
786 if ( SFX_ITEM_SET == rSet.GetItemState( rPool.GetWhich( SID_INET_HTTP_PROXY_PORT ), TRUE, &pItem ) )
788 DBG_ASSERT( pItem->ISA(SfxInt32Item), "Int32Item expected" );
789 aInetOptions.SetProxyHttpPort( ( (const SfxInt32Item*)pItem )->GetValue() );
790 bResetSession = TRUE;
791 bProxiesModified = TRUE;
793 if ( SFX_ITEM_SET == rSet.GetItemState( rPool.GetWhich( SID_INET_FTP_PROXY_NAME ), TRUE, &pItem ) )
795 DBG_ASSERT( pItem->ISA(SfxStringItem), "StringItem expected" );
796 aInetOptions.SetProxyFtpName( ((const SfxStringItem *)pItem)->GetValue() );
797 bResetSession = TRUE;
798 bProxiesModified = TRUE;
800 if ( SFX_ITEM_SET == rSet.GetItemState( rPool.GetWhich( SID_INET_FTP_PROXY_PORT ), TRUE, &pItem ) )
802 DBG_ASSERT( pItem->ISA(SfxInt32Item), "Int32Item expected" );
803 aInetOptions.SetProxyFtpPort( ( (const SfxInt32Item*)pItem )->GetValue() );
804 bResetSession = TRUE;
805 bProxiesModified = TRUE;
807 if ( SFX_ITEM_SET == rSet.GetItemState(SID_INET_NOPROXY, TRUE, &pItem))
809 DBG_ASSERT(pItem->ISA(SfxStringItem), "StringItem expected");
810 aInetOptions.SetProxyNoProxy(((const SfxStringItem *)pItem)->GetValue());
811 bResetSession = TRUE;
812 bProxiesModified = TRUE;
815 // Secure-Referers
816 if ( SFX_ITEM_SET == rSet.GetItemState(SID_SECURE_URL, TRUE, &pItem))
818 DELETEZ(pAppData_Impl->pSecureURLs);
820 DBG_ASSERT(pItem->ISA(SfxStringListItem), "StringListItem expected");
821 const List *pList = ((SfxStringListItem*)pItem)->GetList();
822 sal_uInt32 nCount = pList->Count();
823 ::com::sun::star::uno::Sequence< ::rtl::OUString > seqURLs(nCount);
824 for( sal_uInt32 nPosition=0;nPosition<nCount;++nPosition)
826 seqURLs[nPosition] = *(const String*)(pList->GetObject(nPosition));
828 aSecurityOptions.SetSecureURLs( seqURLs );
831 if ( SFX_ITEM_SET == rSet.GetItemState(SID_MACRO_WARNING, TRUE, &pItem))
833 DBG_ASSERT(pItem->ISA(SfxBoolItem), "SfxBoolItem expected");
834 aSecurityOptions.SetWarningEnabled( ( (const SfxBoolItem *)pItem )->GetValue() );
836 if ( SFX_ITEM_SET == rSet.GetItemState(SID_MACRO_CONFIRMATION, TRUE, &pItem))
838 DBG_ASSERT(pItem->ISA(SfxBoolItem), "SfxBoolItem expected");
839 aSecurityOptions.SetConfirmationEnabled( ( (const SfxBoolItem *)pItem )->GetValue() );
842 // EnableMetafilePrint
843 if ( SFX_ITEM_SET == rSet.GetItemState( rPool.GetWhich( SID_ENABLE_METAFILEPRINT ), TRUE, &pItem ) )
845 #ifdef ENABLE_MISSINGKEYASSERTIONS//MUSTINI
846 DBG_ASSERT(sal_False, "SfxApplication::SetOptions_Impl()\nsoffice.ini key \"MetafilPrint\" not supported any longer!\n");
847 #endif
850 // INet Session neu aufsetzen
851 if ( bResetSession )
853 // no more sj2
854 #if 0
857 SjApplet2::settingsChanged();
859 catch ( ... )
861 DBG_ERRORFILE( "SjApplet2::settingsChanged() throws an exception" );
863 #endif
866 // geaenderte Daten speichern
867 aInetOptions.flush();
870 //--------------------------------------------------------------------
871 void SfxApplication::SetOptions(const SfxItemSet &rSet)
873 SvtPathOptions aPathOptions;
875 // Daten werden in DocInfo und IniManager gespeichert
876 const SfxPoolItem *pItem = 0;
877 SfxItemPool &rPool = GetPool();
879 SfxAllItemSet aSendSet( rSet );
881 // PathName
882 if ( SFX_ITEM_SET == rSet.GetItemState(rPool.GetWhich(SID_ATTR_PATHNAME), TRUE, &pItem))
884 DBG_ASSERT(pItem->ISA(SfxAllEnumItem), "AllEnumItem expected");
885 const SfxAllEnumItem* pEnumItem = (const SfxAllEnumItem *)pItem;
886 sal_uInt32 nCount = pEnumItem->GetValueCount();
887 String aNoChangeStr( ' ' );
888 for( sal_uInt32 nPath=0; nPath<nCount; ++nPath )
890 String sValue = pEnumItem->GetValueTextByPos((USHORT)nPath);
891 if ( sValue != aNoChangeStr )
893 switch( nPath )
895 case SvtPathOptions::PATH_ADDIN:
897 String aTmp;
898 if( ::utl::LocalFileHelper::ConvertURLToPhysicalName( sValue, aTmp ) )
899 aPathOptions.SetAddinPath( aTmp );
900 break;
903 case SvtPathOptions::PATH_AUTOCORRECT: aPathOptions.SetAutoCorrectPath( sValue );break;
904 case SvtPathOptions::PATH_AUTOTEXT: aPathOptions.SetAutoTextPath( sValue );break;
905 case SvtPathOptions::PATH_BACKUP: aPathOptions.SetBackupPath( sValue );break;
906 case SvtPathOptions::PATH_BASIC: aPathOptions.SetBasicPath( sValue );break;
907 case SvtPathOptions::PATH_BITMAP: aPathOptions.SetBitmapPath( sValue );break;
908 case SvtPathOptions::PATH_CONFIG: aPathOptions.SetConfigPath( sValue );break;
909 case SvtPathOptions::PATH_DICTIONARY: aPathOptions.SetDictionaryPath( sValue );break;
910 case SvtPathOptions::PATH_FAVORITES: aPathOptions.SetFavoritesPath( sValue );break;
911 case SvtPathOptions::PATH_FILTER:
913 String aTmp;
914 if( ::utl::LocalFileHelper::ConvertURLToPhysicalName( sValue, aTmp ) )
915 aPathOptions.SetFilterPath( aTmp );
916 break;
918 case SvtPathOptions::PATH_GALLERY: aPathOptions.SetGalleryPath( sValue );break;
919 case SvtPathOptions::PATH_GRAPHIC: aPathOptions.SetGraphicPath( sValue );break;
920 case SvtPathOptions::PATH_HELP:
922 String aTmp;
923 if( ::utl::LocalFileHelper::ConvertURLToPhysicalName( sValue, aTmp ) )
924 aPathOptions.SetHelpPath( aTmp );
925 break;
928 case SvtPathOptions::PATH_LINGUISTIC: aPathOptions.SetLinguisticPath( sValue );break;
929 case SvtPathOptions::PATH_MODULE:
931 String aTmp;
932 if( ::utl::LocalFileHelper::ConvertURLToPhysicalName( sValue, aTmp ) )
933 aPathOptions.SetModulePath( aTmp );
934 break;
937 case SvtPathOptions::PATH_PALETTE: aPathOptions.SetPalettePath( sValue );break;
938 case SvtPathOptions::PATH_PLUGIN:
940 String aTmp;
941 if( ::utl::LocalFileHelper::ConvertURLToPhysicalName( sValue, aTmp ) )
942 aPathOptions.SetPluginPath( aTmp );
943 break;
946 case SvtPathOptions::PATH_STORAGE:
948 String aTmp;
949 if( ::utl::LocalFileHelper::ConvertURLToPhysicalName( sValue, aTmp ) )
950 aPathOptions.SetStoragePath( aTmp );
951 break;
954 case SvtPathOptions::PATH_TEMP: aPathOptions.SetTempPath( sValue );break;
955 case SvtPathOptions::PATH_TEMPLATE: aPathOptions.SetTemplatePath( sValue );break;
956 case SvtPathOptions::PATH_USERCONFIG: aPathOptions.SetUserConfigPath( sValue );break;
957 case SvtPathOptions::PATH_WORK: aPathOptions.SetWorkPath( sValue );break;
958 default: DBG_ERRORFILE("SfxApplication::SetOptions_Impl()\nInvalid path number found for set directories!");
963 aSendSet.ClearItem( rPool.GetWhich( SID_ATTR_PATHNAME ) );
966 SetOptions_Impl( rSet );
968 // Undo-Count
969 Broadcast( SfxItemSetHint( rSet ) );
972 //--------------------------------------------------------------------
974 // alle Dokumente speichern
976 BOOL SfxApplication::SaveAll_Impl(BOOL bPrompt, BOOL bAutoSave)
978 bAutoSave = FALSE; // functionality moved to new AutoRecovery Service!
980 BOOL bFunc = TRUE;
981 short nRet;
983 for ( SfxObjectShell *pDoc = SfxObjectShell::GetFirst();
984 pDoc;
985 pDoc = SfxObjectShell::GetNext(*pDoc) )
987 if( SFX_CREATE_MODE_STANDARD == pDoc->GetCreateMode() &&
988 SfxViewFrame::GetFirst(pDoc) &&
989 !pDoc->IsInModalMode() &&
990 !pDoc->HasModalViews() )
992 if ( pDoc->GetProgress() == 0 )
994 if ( !pDoc->IsModified() )
995 continue;
997 if ( bPrompt || (bAutoSave && !pDoc->HasName()) )
998 nRet = QuerySave_Impl( *pDoc, bAutoSave );
999 else
1000 nRet = RET_YES;
1002 if ( nRet == RET_YES )
1004 SfxRequest aReq( SID_SAVEDOC, 0, pDoc->GetPool() );
1005 const SfxPoolItem *pPoolItem = pDoc->ExecuteSlot( aReq );
1006 if ( !pPoolItem || !pPoolItem->ISA(SfxBoolItem) ||
1007 !( (const SfxBoolItem*) pPoolItem )->GetValue() )
1008 bFunc = FALSE;
1010 else if ( nRet == RET_CANCEL )
1012 bFunc = FALSE;
1013 break;
1015 else if ( nRet == RET_NO )
1022 return bFunc;
1025 //--------------------------------------------------------------------
1027 SfxMacroConfig* SfxApplication::GetMacroConfig() const
1029 return SfxMacroConfig::GetOrCreate();
1032 //--------------------------------------------------------------------
1033 SfxEventConfiguration* SfxApplication::GetEventConfig() const
1035 if (!pAppData_Impl->pEventConfig)
1036 pAppData_Impl->pEventConfig = new SfxEventConfiguration;
1037 return pAppData_Impl->pEventConfig;
1040 //--------------------------------------------------------------------
1042 //--------------------------------------------------------------------
1043 void SfxApplication::NotifyEvent( const SfxEventHint& rEventHint, FASTBOOL bSynchron )
1045 //DBG_ASSERT(pAppData_Impl->pEventConfig,"Keine Events angemeldet!");
1047 SfxObjectShell *pDoc = rEventHint.GetObjShell();
1048 if ( pDoc && ( pDoc->IsPreview() || !pDoc->Get_Impl()->bInitialized ) )
1049 return;
1051 #ifdef DBG_UTIL
1052 //::rtl::OUString aName = SfxEventConfiguration::GetEventName_Impl( rEventHint.GetEventId() );
1053 //ByteString aTmp( "SfxEvent: ");
1054 //aTmp += ByteString( String(aName), RTL_TEXTENCODING_UTF8 );
1055 //DBG_TRACE( aTmp.GetBuffer() );
1056 #endif
1058 if ( bSynchron )
1060 #ifdef DBG_UTIL
1061 if (!pDoc)
1063 ByteString aTmp( "SfxEvent: ");
1064 aTmp += ByteString( String( rEventHint.GetEventName() ), RTL_TEXTENCODING_UTF8 );
1065 DBG_TRACE( aTmp.GetBuffer() );
1067 #endif
1068 Broadcast(rEventHint);
1069 if ( pDoc )
1070 pDoc->Broadcast( rEventHint );
1072 else
1073 new SfxEventAsyncer_Impl( rEventHint );
1076 IMPL_OBJHINT( SfxStringHint, String )
1078 SfxMiscCfg* SfxApplication::GetMiscConfig()
1080 if ( !pAppData_Impl->pMiscConfig )
1081 pAppData_Impl->pMiscConfig = new SfxMiscCfg;
1083 return pAppData_Impl->pMiscConfig;