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