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 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 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 139 SfxEventAsyncer_Impl::~SfxEventAsyncer_Impl() 140 { 141 delete pTimer; 142 } 143 144 // ----------------------------------------------------------------------- 145 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 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_PRETTYPRINTING: 209 { 210 bRet = sal_True; 211 if (!aSaveOptions.IsReadOnly(SvtSaveOptions::E_DOPRETTYPRINTING)) 212 if (!rSet.Put( SfxBoolItem( rPool.GetWhich( SID_ATTR_PRETTYPRINTING ), aSaveOptions.IsPrettyPrinting()))) 213 bRet = sal_False; 214 } 215 break; 216 case SID_ATTR_WARNALIENFORMAT: 217 { 218 bRet = sal_True; 219 if (!aSaveOptions.IsReadOnly(SvtSaveOptions::E_WARNALIENFORMAT)) 220 if (!rSet.Put( SfxBoolItem( rPool.GetWhich( SID_ATTR_WARNALIENFORMAT ), aSaveOptions.IsWarnAlienFormat()))) 221 bRet = sal_False; 222 } 223 break; 224 case SID_ATTR_AUTOSAVE : 225 { 226 bRet = sal_True; 227 if (!aSaveOptions.IsReadOnly(SvtSaveOptions::E_AUTOSAVE)) 228 if (!rSet.Put( SfxBoolItem( rPool.GetWhich( SID_ATTR_AUTOSAVE ), aSaveOptions.IsAutoSave()))) 229 bRet = sal_False; 230 } 231 break; 232 case SID_ATTR_AUTOSAVEPROMPT : 233 { 234 bRet = sal_True; 235 if (!aSaveOptions.IsReadOnly(SvtSaveOptions::E_AUTOSAVEPROMPT)) 236 if (!rSet.Put( SfxBoolItem( rPool.GetWhich( SID_ATTR_AUTOSAVEPROMPT ), aSaveOptions.IsAutoSavePrompt()))) 237 bRet = sal_False; 238 } 239 break; 240 case SID_ATTR_AUTOSAVEMINUTE : 241 { 242 bRet = sal_True; 243 if (!aSaveOptions.IsReadOnly(SvtSaveOptions::E_AUTOSAVETIME)) 244 if (!rSet.Put( SfxUInt16Item( rPool.GetWhich( SID_ATTR_AUTOSAVEMINUTE ), (sal_uInt16)aSaveOptions.GetAutoSaveTime()))) 245 bRet = sal_False; 246 } 247 break; 248 case SID_ATTR_DOCINFO : 249 { 250 bRet = sal_True; 251 if (!aSaveOptions.IsReadOnly(SvtSaveOptions::E_DOCINFSAVE)) 252 if (!rSet.Put( SfxBoolItem( rPool.GetWhich( SID_ATTR_DOCINFO ), aSaveOptions.IsDocInfoSave()))) 253 bRet = sal_False; 254 } 255 break; 256 case SID_ATTR_WORKINGSET : 257 { 258 bRet = sal_True; 259 if (!aSaveOptions.IsReadOnly(SvtSaveOptions::E_SAVEWORKINGSET)) 260 if (!rSet.Put( SfxBoolItem( rPool.GetWhich( SID_ATTR_WORKINGSET ), aSaveOptions.IsSaveWorkingSet()))) 261 bRet = sal_False; 262 } 263 break; 264 case SID_ATTR_SAVEDOCVIEW : 265 { 266 bRet = sal_True; 267 if (!aSaveOptions.IsReadOnly(SvtSaveOptions::E_SAVEDOCVIEW)) 268 if (!rSet.Put( SfxBoolItem( rPool.GetWhich( SID_ATTR_SAVEDOCVIEW ), aSaveOptions.IsSaveDocView()))) 269 bRet = sal_False; 270 } 271 break; 272 case SID_ATTR_METRIC : 273 // if(rSet.Put( SfxUInt16Item( rPool.GetWhich( SID_ATTR_METRIC ), 274 // pOptions->GetMetric() ) ) ) 275 // bRet = sal_True; 276 break; 277 case SID_HELPBALLOONS : 278 if(rSet.Put( SfxBoolItem ( rPool.GetWhich( SID_HELPBALLOONS ), 279 aHelpOptions.IsExtendedHelp() ) ) ) 280 bRet = sal_True; 281 break; 282 case SID_HELPTIPS : 283 if(rSet.Put( SfxBoolItem ( rPool.GetWhich( SID_HELPTIPS ), 284 aHelpOptions.IsHelpTips() ) ) ) 285 bRet = sal_True; 286 break; 287 case SID_ATTR_AUTOHELPAGENT : 288 if(rSet.Put( SfxBoolItem ( rPool.GetWhich( SID_ATTR_AUTOHELPAGENT ), 289 aHelpOptions.IsHelpAgentAutoStartMode() ) ) ) 290 bRet = sal_True; 291 break; 292 case SID_HELPAGENT_TIMEOUT : 293 if ( rSet.Put( SfxInt32Item( rPool.GetWhich( SID_HELPAGENT_TIMEOUT ), 294 aHelpOptions.GetHelpAgentTimeoutPeriod() ) ) ) 295 bRet = sal_True; 296 break; 297 case SID_ATTR_WELCOMESCREEN : 298 if(rSet.Put( SfxBoolItem ( rPool.GetWhich( SID_ATTR_WELCOMESCREEN ), 299 aHelpOptions.IsWelcomeScreen() ) ) ) 300 bRet = sal_True; 301 break; 302 case SID_HELP_STYLESHEET : 303 if(rSet.Put( SfxStringItem ( rPool.GetWhich( SID_HELP_STYLESHEET ), 304 aHelpOptions.GetHelpStyleSheet() ) ) ) 305 bRet = sal_True; 306 break; 307 case SID_ATTR_UNDO_COUNT : 308 if(rSet.Put( SfxUInt16Item ( rPool.GetWhich( SID_ATTR_UNDO_COUNT ), 309 (sal_uInt16)aUndoOptions.GetUndoCount() ) ) ) 310 bRet = sal_True; 311 break; 312 case SID_ATTR_QUICKLAUNCHER : 313 { 314 if ( ShutdownIcon::IsQuickstarterInstalled() ) 315 { 316 if ( rSet.Put( SfxBoolItem( rPool.GetWhich( SID_ATTR_QUICKLAUNCHER ), 317 ShutdownIcon::GetAutostart() ) ) ) 318 bRet = sal_True; 319 } 320 else 321 { 322 rSet.DisableItem( rPool.GetWhich( SID_ATTR_QUICKLAUNCHER ) ); 323 bRet = sal_True; 324 } 325 break; 326 } 327 case SID_SAVEREL_INET : 328 { 329 bRet = sal_True; 330 if (!aSaveOptions.IsReadOnly(SvtSaveOptions::E_SAVERELINET)) 331 if (!rSet.Put( SfxBoolItem ( rPool.GetWhich( SID_SAVEREL_INET ), aSaveOptions.IsSaveRelINet() ))) 332 bRet = sal_False; 333 } 334 break; 335 case SID_SAVEREL_FSYS : 336 { 337 bRet = sal_True; 338 if (!aSaveOptions.IsReadOnly(SvtSaveOptions::E_SAVERELFSYS)) 339 if (!rSet.Put( SfxBoolItem ( rPool.GetWhich( SID_SAVEREL_FSYS ), aSaveOptions.IsSaveRelFSys() ))) 340 bRet = sal_False; 341 } 342 break; 343 case SID_BASIC_ENABLED : 344 { 345 bRet = sal_True; 346 if (!aSecurityOptions.IsReadOnly(SvtSecurityOptions::E_BASICMODE)) 347 { 348 if ( !rSet.Put( SfxUInt16Item( rPool.GetWhich( SID_BASIC_ENABLED ), sal::static_int_cast< sal_uInt16 >(aSecurityOptions.GetBasicMode())))) 349 bRet = sal_False; 350 } 351 } 352 break; 353 case SID_INET_EXE_PLUGIN : 354 { 355 bRet = sal_True; 356 if (!aSecurityOptions.IsReadOnly(SvtSecurityOptions::E_EXECUTEPLUGINS)) 357 { 358 if ( !rSet.Put( SfxBoolItem( SID_INET_EXE_PLUGIN, aSecurityOptions.IsExecutePlugins() ) ) ) 359 bRet = sal_False; 360 } 361 } 362 break; 363 case SID_MACRO_WARNING : 364 { 365 bRet = sal_True; 366 if (!aSecurityOptions.IsReadOnly(SvtSecurityOptions::E_WARNING)) 367 { 368 if ( !rSet.Put( SfxBoolItem( SID_MACRO_WARNING, aSecurityOptions.IsWarningEnabled() ) ) ) 369 bRet = sal_False; 370 } 371 } 372 break; 373 case SID_MACRO_CONFIRMATION : 374 { 375 bRet = sal_True; 376 if (!aSecurityOptions.IsReadOnly(SvtSecurityOptions::E_CONFIRMATION)) 377 { 378 if ( !rSet.Put( SfxBoolItem( SID_MACRO_CONFIRMATION, aSecurityOptions.IsConfirmationEnabled() ) ) ) 379 bRet = sal_False; 380 } 381 } 382 break; 383 case SID_SECURE_URL : 384 { 385 bRet = sal_True; 386 if (!aSecurityOptions.IsReadOnly(SvtSecurityOptions::E_SECUREURLS)) 387 { 388 ::com::sun::star::uno::Sequence< ::rtl::OUString > seqURLs = aSecurityOptions.GetSecureURLs(); 389 List aList; 390 sal_uInt32 nCount = seqURLs.getLength(); 391 sal_uInt32 nURL; 392 for( nURL=0; nURL<nCount; ++nURL ) 393 { 394 aList.Insert( new String( seqURLs[nURL] ), LIST_APPEND ); 395 } 396 if( !rSet.Put( SfxStringListItem( rPool.GetWhich(SID_SECURE_URL), 397 &aList ) ) ) 398 { 399 bRet = sal_False; 400 } 401 for( nURL=0; nURL<nCount; ++nURL ) 402 { 403 delete (String*)aList.GetObject(nURL); 404 } 405 aList.Clear(); 406 } 407 } 408 break; 409 case SID_ENABLE_METAFILEPRINT : 410 #ifdef ENABLE_MISSINGKEYASSERTIONS//MUSTINI 411 DBG_ASSERT(sal_False, "SfxApplication::GetOptions()\nSoffice.ini key \"Common\\MetafilePrint\" is obsolete! .. How I can support SID_ENABLE_METAFILEPRINT any longer?\n"); 412 #endif 413 break; 414 case SID_INET_PROXY_TYPE : 415 { 416 if( rSet.Put( SfxUInt16Item ( rPool.GetWhich( SID_INET_PROXY_TYPE ), 417 (sal_uInt16)aInetOptions.GetProxyType() ))) 418 bRet = sal_True; 419 break; 420 } 421 case SID_INET_HTTP_PROXY_NAME : 422 { 423 if ( rSet.Put( SfxStringItem ( rPool.GetWhich(SID_INET_HTTP_PROXY_NAME ), 424 aInetOptions.GetProxyHttpName() ))) 425 bRet = sal_True; 426 break; 427 } 428 case SID_INET_HTTP_PROXY_PORT : 429 if ( rSet.Put( SfxInt32Item( rPool.GetWhich(SID_INET_HTTP_PROXY_PORT ), 430 aInetOptions.GetProxyHttpPort() ))) 431 bRet = sal_True; 432 break; 433 case SID_INET_FTP_PROXY_NAME : 434 if ( rSet.Put( SfxStringItem ( rPool.GetWhich(SID_INET_FTP_PROXY_NAME ), 435 aInetOptions.GetProxyFtpName() ))) 436 bRet = sal_True; 437 break; 438 case SID_INET_FTP_PROXY_PORT : 439 if ( rSet.Put( SfxInt32Item ( rPool.GetWhich(SID_INET_FTP_PROXY_PORT ), 440 aInetOptions.GetProxyFtpPort() ))) 441 bRet = sal_True; 442 break; 443 case SID_INET_SECURITY_PROXY_NAME : 444 case SID_INET_SECURITY_PROXY_PORT : 445 #ifdef ENABLE_MISSINGKEYASSERTIONS//MUSTINI 446 DBG_ASSERT( sal_False, "SfxApplication::GetOptions()\nSome INET values no longer supported!\n" ); 447 #endif 448 break; 449 case SID_INET_NOPROXY : 450 if( rSet.Put( SfxStringItem ( rPool.GetWhich( SID_INET_NOPROXY), 451 aInetOptions.GetProxyNoProxy() ))) 452 bRet = sal_True; 453 break; 454 case SID_ATTR_PATHNAME : 455 case SID_ATTR_PATHGROUP : 456 { 457 SfxAllEnumItem aNames(rPool.GetWhich(SID_ATTR_PATHGROUP)); 458 SfxAllEnumItem aValues(rPool.GetWhich(SID_ATTR_PATHNAME)); 459 SvtPathOptions aPathCfg; 460 for ( sal_uInt16 nProp = SvtPathOptions::PATH_ADDIN; 461 nProp <= SvtPathOptions::PATH_WORK; nProp++ ) 462 { 463 const String aName( SfxResId( CONFIG_PATH_START + nProp ) ); 464 aNames.InsertValue( nProp, aName ); 465 String aValue; 466 switch ( nProp ) 467 { 468 case SvtPathOptions::PATH_ADDIN: ::utl::LocalFileHelper::ConvertPhysicalNameToURL( aPathCfg.GetAddinPath(), aValue ); break; 469 case SvtPathOptions::PATH_AUTOCORRECT: aValue = aPathCfg.GetAutoCorrectPath(); break; 470 case SvtPathOptions::PATH_AUTOTEXT: aValue = aPathCfg.GetAutoTextPath(); break; 471 case SvtPathOptions::PATH_BACKUP: aValue = aPathCfg.GetBackupPath(); break; 472 case SvtPathOptions::PATH_BASIC: aValue = aPathCfg.GetBasicPath(); break; 473 case SvtPathOptions::PATH_BITMAP: aValue = aPathCfg.GetBitmapPath(); break; 474 case SvtPathOptions::PATH_CONFIG: aValue = aPathCfg.GetConfigPath(); break; 475 case SvtPathOptions::PATH_DICTIONARY: aValue = aPathCfg.GetDictionaryPath(); break; 476 case SvtPathOptions::PATH_FAVORITES: aValue = aPathCfg.GetFavoritesPath(); break; 477 case SvtPathOptions::PATH_FILTER: ::utl::LocalFileHelper::ConvertPhysicalNameToURL( aPathCfg.GetFilterPath(), aValue ); break; 478 case SvtPathOptions::PATH_GALLERY: aValue = aPathCfg.GetGalleryPath(); break; 479 case SvtPathOptions::PATH_GRAPHIC: aValue = aPathCfg.GetGraphicPath(); break; 480 case SvtPathOptions::PATH_HELP: ::utl::LocalFileHelper::ConvertPhysicalNameToURL( aPathCfg.GetHelpPath(), aValue ); break; 481 case SvtPathOptions::PATH_LINGUISTIC: aValue = aPathCfg.GetLinguisticPath(); break; 482 case SvtPathOptions::PATH_MODULE: ::utl::LocalFileHelper::ConvertPhysicalNameToURL( aPathCfg.GetModulePath(), aValue ); break; 483 case SvtPathOptions::PATH_PALETTE: aValue = aPathCfg.GetPalettePath(); break; 484 case SvtPathOptions::PATH_PLUGIN: ::utl::LocalFileHelper::ConvertPhysicalNameToURL( aPathCfg.GetPluginPath(), aValue ); break; 485 case SvtPathOptions::PATH_STORAGE: ::utl::LocalFileHelper::ConvertPhysicalNameToURL( aPathCfg.GetStoragePath(), aValue ); break; 486 case SvtPathOptions::PATH_TEMP: aValue = aPathCfg.GetTempPath(); break; 487 case SvtPathOptions::PATH_TEMPLATE: aValue = aPathCfg.GetTemplatePath(); break; 488 case SvtPathOptions::PATH_USERCONFIG: aValue = aPathCfg.GetUserConfigPath(); break; 489 case SvtPathOptions::PATH_WORK: aValue = aPathCfg.GetWorkPath(); break; 490 } 491 aValues.InsertValue( nProp, aValue ); 492 } 493 494 if ( rSet.Put(aNames) || rSet.Put(aValues) ) 495 bRet = sal_True; 496 } 497 498 default: 499 DBG_WARNING( "W1:Wrong ID while getting Options!" ); 500 break; 501 } 502 #ifdef DBG_UTIL 503 if ( !bRet ) 504 DBG_ERROR( "Putting options failed!" ); 505 #endif 506 } 507 pRanges++; 508 } 509 510 return bRet; 511 } 512 513 //-------------------------------------------------------------------- 514 sal_Bool SfxApplication::IsSecureURL( const INetURLObject& rURL, const String* pReferer ) const 515 { 516 return SvtSecurityOptions().IsSecureURL( rURL.GetMainURL( INetURLObject::NO_DECODE ), *pReferer ); 517 } 518 //-------------------------------------------------------------------- 519 // TODO/CLEANUP: wieso zwei SetOptions Methoden? 520 void SfxApplication::SetOptions_Impl( const SfxItemSet& rSet ) 521 { 522 const SfxPoolItem *pItem = 0; 523 SfxItemPool &rPool = GetPool(); 524 sal_Bool bResetSession = sal_False; 525 sal_Bool bProxiesModified = sal_False; 526 527 SvtSaveOptions aSaveOptions; 528 SvtUndoOptions aUndoOptions; 529 SvtHelpOptions aHelpOptions; 530 SvtSecurityOptions aSecurityOptions; 531 SvtPathOptions aPathOptions; 532 SvtInetOptions aInetOptions; 533 SvtMiscOptions aMiscOptions; 534 if ( SFX_ITEM_SET == rSet.GetItemState(rPool.GetWhich(SID_ATTR_BUTTON_OUTSTYLE3D), sal_True, &pItem) ) 535 { 536 DBG_ASSERT(pItem->ISA(SfxBoolItem), "BoolItem expected"); 537 sal_uInt16 nOutStyle = 538 ( (const SfxBoolItem *)pItem)->GetValue() ? 0 : TOOLBOX_STYLE_FLAT; 539 aMiscOptions.SetToolboxStyle( nOutStyle ); 540 } 541 542 if ( SFX_ITEM_SET == rSet.GetItemState(rPool.GetWhich(SID_ATTR_BUTTON_BIGSIZE), sal_True, &pItem) ) 543 { 544 DBG_ASSERT(pItem->ISA(SfxBoolItem), "BoolItem expected"); 545 sal_Bool bBigSize = ( (const SfxBoolItem*)pItem )->GetValue(); 546 aMiscOptions.SetSymbolsSize( 547 sal::static_int_cast< sal_Int16 >( 548 bBigSize ? SFX_SYMBOLS_SIZE_LARGE : SFX_SYMBOLS_SIZE_SMALL ) ); 549 SfxViewFrame* pCurrViewFrame = SfxViewFrame::GetFirst(); 550 while ( pCurrViewFrame ) 551 { 552 // update all "final" dispatchers 553 if ( !pCurrViewFrame->GetActiveChildFrame_Impl() ) 554 pCurrViewFrame->GetDispatcher()->Update_Impl(sal_True); 555 pCurrViewFrame = SfxViewFrame::GetNext(*pCurrViewFrame); 556 } 557 } 558 559 // Backup 560 if ( SFX_ITEM_SET == rSet.GetItemState(rPool.GetWhich(SID_ATTR_BACKUP), sal_True, &pItem) ) 561 { 562 DBG_ASSERT(pItem->ISA(SfxBoolItem), "BoolItem expected"); 563 aSaveOptions.SetBackup( ( (const SfxBoolItem*)pItem )->GetValue() ); 564 } 565 566 // PrettyPrinting 567 if ( SFX_ITEM_SET == rSet.GetItemState( rPool.GetWhich( SID_ATTR_PRETTYPRINTING ), sal_True, &pItem ) ) 568 { 569 DBG_ASSERT( pItem->ISA( SfxBoolItem ), "BoolItem expected" ); 570 aSaveOptions.SetPrettyPrinting( static_cast< const SfxBoolItem*> ( pItem )->GetValue() ); 571 } 572 573 // WarnAlienFormat 574 if ( SFX_ITEM_SET == rSet.GetItemState( rPool.GetWhich( SID_ATTR_WARNALIENFORMAT ), sal_True, &pItem ) ) 575 { 576 DBG_ASSERT( pItem->ISA( SfxBoolItem ), "BoolItem expected" ); 577 aSaveOptions.SetWarnAlienFormat( static_cast< const SfxBoolItem*> ( pItem )->GetValue() ); 578 } 579 580 // AutoSave 581 if ( SFX_ITEM_SET == rSet.GetItemState(rPool.GetWhich(SID_ATTR_AUTOSAVE), sal_True, &pItem)) 582 { 583 DBG_ASSERT(pItem->ISA(SfxBoolItem), "BoolItem expected"); 584 aSaveOptions.SetAutoSave( ( (const SfxBoolItem*)pItem )->GetValue() ); 585 } 586 587 // AutoSave-Propt 588 if ( SFX_ITEM_SET == rSet.GetItemState(rPool.GetWhich(SID_ATTR_AUTOSAVEPROMPT), sal_True, &pItem)) 589 { 590 DBG_ASSERT(pItem->ISA(SfxBoolItem), "BoolItem expected"); 591 aSaveOptions.SetAutoSavePrompt(((const SfxBoolItem *)pItem)->GetValue()); 592 } 593 594 // AutoSave-Time 595 if ( SFX_ITEM_SET == rSet.GetItemState(rPool.GetWhich(SID_ATTR_AUTOSAVEMINUTE), sal_True, &pItem)) 596 { 597 DBG_ASSERT(pItem->ISA(SfxUInt16Item), "UInt16Item expected"); 598 aSaveOptions.SetAutoSaveTime(((const SfxUInt16Item *)pItem)->GetValue()); 599 } 600 601 // DocInfo 602 if ( SFX_ITEM_SET == rSet.GetItemState(rPool.GetWhich(SID_ATTR_DOCINFO), sal_True, &pItem)) 603 { 604 DBG_ASSERT(pItem->ISA(SfxBoolItem), "BoolItem expected"); 605 aSaveOptions.SetDocInfoSave(((const SfxBoolItem *)pItem)->GetValue()); 606 } 607 608 // offende Dokumente merken 609 if ( SFX_ITEM_SET == rSet.GetItemState(rPool.GetWhich(SID_ATTR_WORKINGSET), sal_True, &pItem)) 610 { 611 DBG_ASSERT(pItem->ISA(SfxBoolItem), "BoolItem expected"); 612 aSaveOptions.SetSaveWorkingSet(((const SfxBoolItem *)pItem)->GetValue()); 613 } 614 615 // Fenster-Einstellung speichern 616 if ( SFX_ITEM_SET == rSet.GetItemState(rPool.GetWhich(SID_ATTR_SAVEDOCVIEW), sal_True, &pItem)) 617 { 618 DBG_ASSERT(pItem->ISA(SfxBoolItem), "BoolItem expected"); 619 aSaveOptions.SetSaveDocView(((const SfxBoolItem *)pItem)->GetValue()); 620 } 621 622 // Metric 623 if ( SFX_ITEM_SET == rSet.GetItemState(rPool.GetWhich(SID_ATTR_METRIC), sal_True, &pItem)) 624 { 625 DBG_ASSERT(pItem->ISA(SfxUInt16Item), "UInt16Item expected"); 626 // pOptions->SetMetric((FieldUnit)((const SfxUInt16Item*)pItem)->GetValue()); 627 } 628 629 // HelpBalloons 630 if ( SFX_ITEM_SET == rSet.GetItemState(rPool.GetWhich(SID_HELPBALLOONS), sal_True, &pItem)) 631 { 632 DBG_ASSERT(pItem->ISA(SfxBoolItem), "BoolItem expected"); 633 aHelpOptions.SetExtendedHelp(((const SfxBoolItem *)pItem)->GetValue()); 634 } 635 636 // HelpTips 637 if ( SFX_ITEM_SET == rSet.GetItemState(rPool.GetWhich(SID_HELPTIPS), sal_True, &pItem)) 638 { 639 DBG_ASSERT(pItem->ISA(SfxBoolItem), "BoolItem expected"); 640 aHelpOptions.SetHelpTips(((const SfxBoolItem *)pItem)->GetValue()); 641 } 642 643 // AutoHelpAgent 644 if ( SFX_ITEM_SET == rSet.GetItemState(rPool.GetWhich(SID_ATTR_AUTOHELPAGENT ), sal_True, &pItem)) 645 { 646 DBG_ASSERT(pItem->ISA(SfxBoolItem), "BoolItem expected"); 647 aHelpOptions.SetHelpAgentAutoStartMode( ((const SfxBoolItem *)pItem)->GetValue() ); 648 } 649 650 // help agent timeout 651 if ( SFX_ITEM_SET == rSet.GetItemState( rPool.GetWhich( SID_HELPAGENT_TIMEOUT ), sal_True, &pItem ) ) 652 { 653 DBG_ASSERT(pItem->ISA(SfxInt32Item), "Int32Item expected"); 654 aHelpOptions.SetHelpAgentTimeoutPeriod( ( (const SfxInt32Item*)pItem )->GetValue() ); 655 } 656 657 // WelcomeScreen 658 if ( SFX_ITEM_SET == rSet.GetItemState(rPool.GetWhich(SID_ATTR_WELCOMESCREEN ), sal_True, &pItem)) 659 { 660 DBG_ASSERT(pItem->ISA(SfxBoolItem), "BoolItem expected"); 661 aHelpOptions.SetWelcomeScreen( ((const SfxBoolItem *)pItem)->GetValue() ); 662 } 663 664 // WelcomeScreen 665 if ( SFX_ITEM_SET == rSet.GetItemState(rPool.GetWhich(SID_WELCOMESCREEN_RESET ), sal_True, &pItem)) 666 { 667 DBG_ASSERT(pItem->ISA(SfxBoolItem), "BoolItem expected"); 668 sal_Bool bReset = ((const SfxBoolItem *)pItem)->GetValue(); 669 if ( bReset ) 670 { 671 DBG_ERROR( "Not implemented, may be EOL!" ); 672 } } 673 674 if ( SFX_ITEM_SET == rSet.GetItemState(rPool.GetWhich(SID_HELP_STYLESHEET ), sal_True, &pItem)) 675 { 676 DBG_ASSERT(pItem->ISA(SfxStringItem), "StringItem expected"); 677 aHelpOptions.SetHelpStyleSheet( ((const SfxStringItem *)pItem)->GetValue() ); 678 } 679 680 // SaveRelINet 681 if ( SFX_ITEM_SET == rSet.GetItemState(rPool.GetWhich(SID_SAVEREL_INET), sal_True, &pItem)) 682 { 683 DBG_ASSERT(pItem->ISA(SfxBoolItem), "BoolItem expected"); 684 aSaveOptions.SetSaveRelINet(((const SfxBoolItem *)pItem)->GetValue()); 685 } 686 687 // SaveRelFSys 688 if ( SFX_ITEM_SET == rSet.GetItemState(rPool.GetWhich(SID_SAVEREL_FSYS), sal_True, &pItem)) 689 { 690 DBG_ASSERT(pItem->ISA(SfxBoolItem), "BoolItem expected"); 691 aSaveOptions.SetSaveRelFSys(((const SfxBoolItem *)pItem)->GetValue()); 692 } 693 694 // Undo-Count 695 if ( SFX_ITEM_SET == rSet.GetItemState(rPool.GetWhich(SID_ATTR_UNDO_COUNT), sal_True, &pItem)) 696 { 697 DBG_ASSERT(pItem->ISA(SfxUInt16Item), "UInt16Item expected"); 698 sal_uInt16 nUndoCount = ((const SfxUInt16Item*)pItem)->GetValue(); 699 aUndoOptions.SetUndoCount( nUndoCount ); 700 701 // um alle Undo-Manager zu erwischen: "uber alle Frames iterieren 702 for ( SfxViewFrame *pFrame = SfxViewFrame::GetFirst(); 703 pFrame; 704 pFrame = SfxViewFrame::GetNext(*pFrame) ) 705 { 706 // den Dispatcher des Frames rausholen 707 SfxDispatcher *pDispat = pFrame->GetDispatcher(); 708 pDispat->Flush(); 709 710 // "uber alle SfxShells auf dem Stack des Dispatchers iterieren 711 sal_uInt16 nIdx = 0; 712 for ( SfxShell *pSh = pDispat->GetShell(nIdx); 713 pSh; 714 ++nIdx, pSh = pDispat->GetShell(nIdx) ) 715 { 716 ::svl::IUndoManager *pShUndoMgr = pSh->GetUndoManager(); 717 if ( pShUndoMgr ) 718 pShUndoMgr->SetMaxUndoActionCount( nUndoCount ); 719 } 720 } 721 } 722 723 // Office autostart 724 if ( SFX_ITEM_SET == rSet.GetItemState(rPool.GetWhich(SID_ATTR_QUICKLAUNCHER), sal_True, &pItem)) 725 { 726 DBG_ASSERT(pItem->ISA(SfxBoolItem), "BoolItem expected"); 727 ShutdownIcon::SetAutostart( ( (const SfxBoolItem*)pItem )->GetValue() != sal_False ); 728 } 729 730 // StarBasic Enable 731 if ( SFX_ITEM_SET == rSet.GetItemState(SID_BASIC_ENABLED, sal_True, &pItem)) 732 { 733 DBG_ASSERT(pItem->ISA(SfxUInt16Item), "SfxInt16Item expected"); 734 aSecurityOptions.SetBasicMode( (EBasicSecurityMode)( (const SfxUInt16Item*)pItem )->GetValue() ); 735 } 736 737 // Execute PlugIns 738 if ( SFX_ITEM_SET == rSet.GetItemState(SID_INET_EXE_PLUGIN, sal_True, &pItem)) 739 { 740 DBG_ASSERT(pItem->ISA(SfxBoolItem), "SfxBoolItem expected"); 741 aSecurityOptions.SetExecutePlugins( ( (const SfxBoolItem *)pItem )->GetValue() ); 742 bResetSession = sal_True; 743 } 744 745 if ( SFX_ITEM_SET == rSet.GetItemState(rPool.GetWhich(SID_INET_PROXY_TYPE), sal_True, &pItem)) 746 { 747 DBG_ASSERT( pItem->ISA(SfxUInt16Item), "UInt16Item expected" ); 748 aInetOptions.SetProxyType((SvtInetOptions::ProxyType)( (const SfxUInt16Item*)pItem )->GetValue()); 749 bResetSession = sal_True; 750 bProxiesModified = sal_True; 751 } 752 753 if ( SFX_ITEM_SET == rSet.GetItemState( rPool.GetWhich( SID_INET_HTTP_PROXY_NAME ), sal_True, &pItem ) ) 754 { 755 DBG_ASSERT( pItem->ISA(SfxStringItem), "StringItem expected" ); 756 aInetOptions.SetProxyHttpName( ((const SfxStringItem *)pItem)->GetValue() ); 757 bResetSession = sal_True; 758 bProxiesModified = sal_True; 759 } 760 if ( SFX_ITEM_SET == rSet.GetItemState( rPool.GetWhich( SID_INET_HTTP_PROXY_PORT ), sal_True, &pItem ) ) 761 { 762 DBG_ASSERT( pItem->ISA(SfxInt32Item), "Int32Item expected" ); 763 aInetOptions.SetProxyHttpPort( ( (const SfxInt32Item*)pItem )->GetValue() ); 764 bResetSession = sal_True; 765 bProxiesModified = sal_True; 766 } 767 if ( SFX_ITEM_SET == rSet.GetItemState( rPool.GetWhich( SID_INET_FTP_PROXY_NAME ), sal_True, &pItem ) ) 768 { 769 DBG_ASSERT( pItem->ISA(SfxStringItem), "StringItem expected" ); 770 aInetOptions.SetProxyFtpName( ((const SfxStringItem *)pItem)->GetValue() ); 771 bResetSession = sal_True; 772 bProxiesModified = sal_True; 773 } 774 if ( SFX_ITEM_SET == rSet.GetItemState( rPool.GetWhich( SID_INET_FTP_PROXY_PORT ), sal_True, &pItem ) ) 775 { 776 DBG_ASSERT( pItem->ISA(SfxInt32Item), "Int32Item expected" ); 777 aInetOptions.SetProxyFtpPort( ( (const SfxInt32Item*)pItem )->GetValue() ); 778 bResetSession = sal_True; 779 bProxiesModified = sal_True; 780 } 781 if ( SFX_ITEM_SET == rSet.GetItemState(SID_INET_NOPROXY, sal_True, &pItem)) 782 { 783 DBG_ASSERT(pItem->ISA(SfxStringItem), "StringItem expected"); 784 aInetOptions.SetProxyNoProxy(((const SfxStringItem *)pItem)->GetValue()); 785 bResetSession = sal_True; 786 bProxiesModified = sal_True; 787 } 788 789 // Secure-Referers 790 if ( SFX_ITEM_SET == rSet.GetItemState(SID_SECURE_URL, sal_True, &pItem)) 791 { 792 DELETEZ(pAppData_Impl->pSecureURLs); 793 794 DBG_ASSERT(pItem->ISA(SfxStringListItem), "StringListItem expected"); 795 const List *pList = ((SfxStringListItem*)pItem)->GetList(); 796 sal_uInt32 nCount = pList->Count(); 797 ::com::sun::star::uno::Sequence< ::rtl::OUString > seqURLs(nCount); 798 for( sal_uInt32 nPosition=0;nPosition<nCount;++nPosition) 799 { 800 seqURLs[nPosition] = *(const String*)(pList->GetObject(nPosition)); 801 } 802 aSecurityOptions.SetSecureURLs( seqURLs ); 803 } 804 805 if ( SFX_ITEM_SET == rSet.GetItemState(SID_MACRO_WARNING, sal_True, &pItem)) 806 { 807 DBG_ASSERT(pItem->ISA(SfxBoolItem), "SfxBoolItem expected"); 808 aSecurityOptions.SetWarningEnabled( ( (const SfxBoolItem *)pItem )->GetValue() ); 809 } 810 if ( SFX_ITEM_SET == rSet.GetItemState(SID_MACRO_CONFIRMATION, sal_True, &pItem)) 811 { 812 DBG_ASSERT(pItem->ISA(SfxBoolItem), "SfxBoolItem expected"); 813 aSecurityOptions.SetConfirmationEnabled( ( (const SfxBoolItem *)pItem )->GetValue() ); 814 } 815 816 // EnableMetafilePrint 817 if ( SFX_ITEM_SET == rSet.GetItemState( rPool.GetWhich( SID_ENABLE_METAFILEPRINT ), sal_True, &pItem ) ) 818 { 819 #ifdef ENABLE_MISSINGKEYASSERTIONS//MUSTINI 820 DBG_ASSERT(sal_False, "SfxApplication::SetOptions_Impl()\nsoffice.ini key \"MetafilPrint\" not supported any longer!\n"); 821 #endif 822 } 823 824 // geaenderte Daten speichern 825 aInetOptions.flush(); 826 } 827 828 //-------------------------------------------------------------------- 829 void SfxApplication::SetOptions(const SfxItemSet &rSet) 830 { 831 SvtPathOptions aPathOptions; 832 833 // Daten werden in DocInfo und IniManager gespeichert 834 const SfxPoolItem *pItem = 0; 835 SfxItemPool &rPool = GetPool(); 836 837 SfxAllItemSet aSendSet( rSet ); 838 839 // PathName 840 if ( SFX_ITEM_SET == rSet.GetItemState(rPool.GetWhich(SID_ATTR_PATHNAME), sal_True, &pItem)) 841 { 842 DBG_ASSERT(pItem->ISA(SfxAllEnumItem), "AllEnumItem expected"); 843 const SfxAllEnumItem* pEnumItem = (const SfxAllEnumItem *)pItem; 844 sal_uInt32 nCount = pEnumItem->GetValueCount(); 845 String aNoChangeStr( ' ' ); 846 for( sal_uInt32 nPath=0; nPath<nCount; ++nPath ) 847 { 848 String sValue = pEnumItem->GetValueTextByPos((sal_uInt16)nPath); 849 if ( sValue != aNoChangeStr ) 850 { 851 switch( nPath ) 852 { 853 case SvtPathOptions::PATH_ADDIN: 854 { 855 String aTmp; 856 if( ::utl::LocalFileHelper::ConvertURLToPhysicalName( sValue, aTmp ) ) 857 aPathOptions.SetAddinPath( aTmp ); 858 break; 859 } 860 861 case SvtPathOptions::PATH_AUTOCORRECT: aPathOptions.SetAutoCorrectPath( sValue );break; 862 case SvtPathOptions::PATH_AUTOTEXT: aPathOptions.SetAutoTextPath( sValue );break; 863 case SvtPathOptions::PATH_BACKUP: aPathOptions.SetBackupPath( sValue );break; 864 case SvtPathOptions::PATH_BASIC: aPathOptions.SetBasicPath( sValue );break; 865 case SvtPathOptions::PATH_BITMAP: aPathOptions.SetBitmapPath( sValue );break; 866 case SvtPathOptions::PATH_CONFIG: aPathOptions.SetConfigPath( sValue );break; 867 case SvtPathOptions::PATH_DICTIONARY: aPathOptions.SetDictionaryPath( sValue );break; 868 case SvtPathOptions::PATH_FAVORITES: aPathOptions.SetFavoritesPath( sValue );break; 869 case SvtPathOptions::PATH_FILTER: 870 { 871 String aTmp; 872 if( ::utl::LocalFileHelper::ConvertURLToPhysicalName( sValue, aTmp ) ) 873 aPathOptions.SetFilterPath( aTmp ); 874 break; 875 } 876 case SvtPathOptions::PATH_GALLERY: aPathOptions.SetGalleryPath( sValue );break; 877 case SvtPathOptions::PATH_GRAPHIC: aPathOptions.SetGraphicPath( sValue );break; 878 case SvtPathOptions::PATH_HELP: 879 { 880 String aTmp; 881 if( ::utl::LocalFileHelper::ConvertURLToPhysicalName( sValue, aTmp ) ) 882 aPathOptions.SetHelpPath( aTmp ); 883 break; 884 } 885 886 case SvtPathOptions::PATH_LINGUISTIC: aPathOptions.SetLinguisticPath( sValue );break; 887 case SvtPathOptions::PATH_MODULE: 888 { 889 String aTmp; 890 if( ::utl::LocalFileHelper::ConvertURLToPhysicalName( sValue, aTmp ) ) 891 aPathOptions.SetModulePath( aTmp ); 892 break; 893 } 894 895 case SvtPathOptions::PATH_PALETTE: aPathOptions.SetPalettePath( sValue );break; 896 case SvtPathOptions::PATH_PLUGIN: 897 { 898 String aTmp; 899 if( ::utl::LocalFileHelper::ConvertURLToPhysicalName( sValue, aTmp ) ) 900 aPathOptions.SetPluginPath( aTmp ); 901 break; 902 } 903 904 case SvtPathOptions::PATH_STORAGE: 905 { 906 String aTmp; 907 if( ::utl::LocalFileHelper::ConvertURLToPhysicalName( sValue, aTmp ) ) 908 aPathOptions.SetStoragePath( aTmp ); 909 break; 910 } 911 912 case SvtPathOptions::PATH_TEMP: aPathOptions.SetTempPath( sValue );break; 913 case SvtPathOptions::PATH_TEMPLATE: aPathOptions.SetTemplatePath( sValue );break; 914 case SvtPathOptions::PATH_USERCONFIG: aPathOptions.SetUserConfigPath( sValue );break; 915 case SvtPathOptions::PATH_WORK: aPathOptions.SetWorkPath( sValue );break; 916 default: DBG_ERRORFILE("SfxApplication::SetOptions_Impl()\nInvalid path number found for set directories!"); 917 } 918 } 919 } 920 921 aSendSet.ClearItem( rPool.GetWhich( SID_ATTR_PATHNAME ) ); 922 } 923 924 SetOptions_Impl( rSet ); 925 926 // Undo-Count 927 Broadcast( SfxItemSetHint( rSet ) ); 928 } 929 930 //-------------------------------------------------------------------- 931 932 // alle Dokumente speichern 933 934 sal_Bool SfxApplication::SaveAll_Impl(sal_Bool bPrompt, sal_Bool bAutoSave) 935 { 936 bAutoSave = sal_False; // functionality moved to new AutoRecovery Service! 937 938 sal_Bool bFunc = sal_True; 939 short nRet; 940 941 for ( SfxObjectShell *pDoc = SfxObjectShell::GetFirst(); 942 pDoc; 943 pDoc = SfxObjectShell::GetNext(*pDoc) ) 944 { 945 if( SFX_CREATE_MODE_STANDARD == pDoc->GetCreateMode() && 946 SfxViewFrame::GetFirst(pDoc) && 947 !pDoc->IsInModalMode() && 948 !pDoc->HasModalViews() ) 949 { 950 if ( pDoc->GetProgress() == 0 ) 951 { 952 if ( !pDoc->IsModified() ) 953 continue; 954 955 if ( bPrompt || (bAutoSave && !pDoc->HasName()) ) 956 nRet = QuerySave_Impl( *pDoc, bAutoSave ); 957 else 958 nRet = RET_YES; 959 960 if ( nRet == RET_YES ) 961 { 962 SfxRequest aReq( SID_SAVEDOC, 0, pDoc->GetPool() ); 963 const SfxPoolItem *pPoolItem = pDoc->ExecuteSlot( aReq ); 964 if ( !pPoolItem || !pPoolItem->ISA(SfxBoolItem) || 965 !( (const SfxBoolItem*) pPoolItem )->GetValue() ) 966 bFunc = sal_False; 967 } 968 else if ( nRet == RET_CANCEL ) 969 { 970 bFunc = sal_False; 971 break; 972 } 973 else if ( nRet == RET_NO ) 974 { 975 } 976 } 977 } 978 } 979 980 return bFunc; 981 } 982 983 //-------------------------------------------------------------------- 984 985 //-------------------------------------------------------------------- 986 void SfxApplication::NotifyEvent( const SfxEventHint& rEventHint, bool bSynchron ) 987 { 988 SfxObjectShell *pDoc = rEventHint.GetObjShell(); 989 if ( pDoc && ( pDoc->IsPreview() || !pDoc->Get_Impl()->bInitialized ) ) 990 return; 991 992 #ifdef DBG_UTIL 993 //::rtl::OUString aName = SfxEventConfiguration::GetEventName_Impl( rEventHint.GetEventId() ); 994 //ByteString aTmp( "SfxEvent: "); 995 //aTmp += ByteString( String(aName), RTL_TEXTENCODING_UTF8 ); 996 //DBG_TRACE( aTmp.GetBuffer() ); 997 #endif 998 999 if ( bSynchron ) 1000 { 1001 #ifdef DBG_UTIL 1002 if (!pDoc) 1003 { 1004 ByteString aTmp( "SfxEvent: "); 1005 aTmp += ByteString( String( rEventHint.GetEventName() ), RTL_TEXTENCODING_UTF8 ); 1006 DBG_TRACE( aTmp.GetBuffer() ); 1007 } 1008 #endif 1009 Broadcast(rEventHint); 1010 if ( pDoc ) 1011 pDoc->Broadcast( rEventHint ); 1012 } 1013 else 1014 new SfxEventAsyncer_Impl( rEventHint ); 1015 } 1016 1017 IMPL_OBJHINT( SfxStringHint, String ) 1018 1019