/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * This file is part of the LibreOffice project. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * This file incorporates work covered by the following license notice: * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed * with this work for additional information regarding copyright * ownership. The ASF licenses this file to you under the Apache * License, Version 2.0 (the "License"); you may not use this file * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "sfxtypes.hxx" #include #include #include "objshimp.hxx" #include #include #include #include "appdata.hxx" #include "workwin.hxx" #include "helper.hxx" #include "app.hrc" #include #include "shutdownicon.hxx" using namespace ::com::sun::star::uno; using namespace ::com::sun::star::util; using namespace ::com::sun::star::frame; using namespace ::com::sun::star::beans; class SfxEventAsyncer_Impl : public SfxListener { SfxEventHint aHint; Timer* pTimer; public: virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) SAL_OVERRIDE; SfxEventAsyncer_Impl( const SfxEventHint& rHint ); virtual ~SfxEventAsyncer_Impl(); DECL_LINK( TimerHdl, Timer*); }; void SfxEventAsyncer_Impl::Notify( SfxBroadcaster&, const SfxHint& rHint ) { const SfxSimpleHint* pHint = dynamic_cast(&rHint); if( pHint && pHint->GetId() == SFX_HINT_DYING && pTimer->IsActive() ) { pTimer->Stop(); delete this; } } SfxEventAsyncer_Impl::SfxEventAsyncer_Impl( const SfxEventHint& rHint ) : aHint( rHint ) { if( rHint.GetObjShell() ) StartListening( *rHint.GetObjShell() ); pTimer = new Timer; pTimer->SetTimeoutHdl( LINK(this, SfxEventAsyncer_Impl, TimerHdl) ); pTimer->SetTimeout( 0 ); pTimer->Start(); } SfxEventAsyncer_Impl::~SfxEventAsyncer_Impl() { delete pTimer; } IMPL_LINK(SfxEventAsyncer_Impl, TimerHdl, Timer*, pAsyncTimer) { (void)pAsyncTimer; // unused variable SfxObjectShellRef xRef( aHint.GetObjShell() ); pAsyncTimer->Stop(); #ifdef DBG_UTIL if (!xRef.Is()) { OStringBuffer aTmp("SfxEvent: "); aTmp.append(OUStringToOString(aHint.GetEventName(), RTL_TEXTENCODING_UTF8)); OSL_TRACE( "%s", aTmp.getStr() ); } #endif SfxGetpApp()->Broadcast( aHint ); if ( xRef.Is() ) xRef->Broadcast( aHint ); delete this; return 0L; } bool SfxApplication::GetOptions( SfxItemSet& rSet ) { bool bRet = false; SfxItemPool &rPool = GetPool(); const sal_uInt16 *pRanges = rSet.GetRanges(); SvtSaveOptions aSaveOptions; SvtHelpOptions aHelpOptions; SvtSecurityOptions aSecurityOptions; SvtMiscOptions aMiscOptions; while ( *pRanges ) { for(sal_uInt16 nWhich = *pRanges++; nWhich <= *pRanges; ++nWhich) { switch(nWhich) { case SID_ATTR_BUTTON_OUTSTYLE3D : if(rSet.Put( SfxBoolItem( rPool.GetWhich( SID_ATTR_BUTTON_OUTSTYLE3D ), aMiscOptions.GetToolboxStyle() != TOOLBOX_STYLE_FLAT))) bRet = true; break; case SID_ATTR_BUTTON_BIGSIZE : { if( rSet.Put( SfxBoolItem( rPool.GetWhich( SID_ATTR_BUTTON_BIGSIZE ), aMiscOptions.AreCurrentSymbolsLarge() ) ) ) bRet = true; break; } case SID_ATTR_BACKUP : { bRet = true; if (!aSaveOptions.IsReadOnly(SvtSaveOptions::E_BACKUP)) if (!rSet.Put( SfxBoolItem( rPool.GetWhich( SID_ATTR_BACKUP ),aSaveOptions.IsBackup()))) bRet = false; } break; case SID_ATTR_PRETTYPRINTING: { bRet = true; if (!aSaveOptions.IsReadOnly(SvtSaveOptions::E_DOPRETTYPRINTING)) if (!rSet.Put( SfxBoolItem( rPool.GetWhich( SID_ATTR_PRETTYPRINTING ), aSaveOptions.IsPrettyPrinting()))) bRet = false; } break; case SID_ATTR_WARNALIENFORMAT: { bRet = true; if (!aSaveOptions.IsReadOnly(SvtSaveOptions::E_WARNALIENFORMAT)) if (!rSet.Put( SfxBoolItem( rPool.GetWhich( SID_ATTR_WARNALIENFORMAT ), aSaveOptions.IsWarnAlienFormat()))) bRet = false; } break; case SID_ATTR_AUTOSAVE : { bRet = true; if (!aSaveOptions.IsReadOnly(SvtSaveOptions::E_AUTOSAVE)) if (!rSet.Put( SfxBoolItem( rPool.GetWhich( SID_ATTR_AUTOSAVE ), aSaveOptions.IsAutoSave()))) bRet = false; } break; case SID_ATTR_AUTOSAVEPROMPT : { bRet = true; if (!aSaveOptions.IsReadOnly(SvtSaveOptions::E_AUTOSAVEPROMPT)) if (!rSet.Put( SfxBoolItem( rPool.GetWhich( SID_ATTR_AUTOSAVEPROMPT ), aSaveOptions.IsAutoSavePrompt()))) bRet = false; } break; case SID_ATTR_AUTOSAVEMINUTE : { bRet = true; if (!aSaveOptions.IsReadOnly(SvtSaveOptions::E_AUTOSAVETIME)) if (!rSet.Put( SfxUInt16Item( rPool.GetWhich( SID_ATTR_AUTOSAVEMINUTE ), (sal_uInt16)aSaveOptions.GetAutoSaveTime()))) bRet = false; } break; case SID_ATTR_USERAUTOSAVE : { bRet = true; if (!aSaveOptions.IsReadOnly(SvtSaveOptions::E_USERAUTOSAVE)) if (!rSet.Put( SfxBoolItem( rPool.GetWhich( SID_ATTR_USERAUTOSAVE ), aSaveOptions.IsUserAutoSave()))) bRet = false; } break; case SID_ATTR_DOCINFO : { bRet = true; if (!aSaveOptions.IsReadOnly(SvtSaveOptions::E_DOCINFSAVE)) if (!rSet.Put( SfxBoolItem( rPool.GetWhich( SID_ATTR_DOCINFO ), aSaveOptions.IsDocInfoSave()))) bRet = false; } break; case SID_ATTR_WORKINGSET : { bRet = true; if (!aSaveOptions.IsReadOnly(SvtSaveOptions::E_SAVEWORKINGSET)) if (!rSet.Put( SfxBoolItem( rPool.GetWhich( SID_ATTR_WORKINGSET ), aSaveOptions.IsSaveWorkingSet()))) bRet = false; } break; case SID_ATTR_SAVEDOCVIEW : { bRet = true; if (!aSaveOptions.IsReadOnly(SvtSaveOptions::E_SAVEDOCVIEW)) if (!rSet.Put( SfxBoolItem( rPool.GetWhich( SID_ATTR_SAVEDOCVIEW ), aSaveOptions.IsSaveDocView()))) bRet = false; } break; case SID_ATTR_METRIC : break; case SID_HELPBALLOONS : if(rSet.Put( SfxBoolItem ( rPool.GetWhich( SID_HELPBALLOONS ), aHelpOptions.IsExtendedHelp() ) ) ) bRet = true; break; case SID_HELPTIPS : if(rSet.Put( SfxBoolItem ( rPool.GetWhich( SID_HELPTIPS ), aHelpOptions.IsHelpTips() ) ) ) bRet = true; break; case SID_ATTR_WELCOMESCREEN : if(rSet.Put( SfxBoolItem ( rPool.GetWhich( SID_ATTR_WELCOMESCREEN ), aHelpOptions.IsWelcomeScreen() ) ) ) bRet = true; break; case SID_HELP_STYLESHEET : if(rSet.Put( SfxStringItem ( rPool.GetWhich( SID_HELP_STYLESHEET ), aHelpOptions.GetHelpStyleSheet() ) ) ) bRet = true; break; case SID_ATTR_UNDO_COUNT : if (rSet.Put( SfxUInt16Item ( rPool.GetWhich(SID_ATTR_UNDO_COUNT), officecfg::Office::Common::Undo::Steps::get()))) { bRet = true; } break; case SID_ATTR_QUICKLAUNCHER : { if ( ShutdownIcon::IsQuickstarterInstalled() ) { if ( rSet.Put( SfxBoolItem( rPool.GetWhich( SID_ATTR_QUICKLAUNCHER ), ShutdownIcon::GetAutostart() ) ) ) bRet = true; } else { rSet.DisableItem( rPool.GetWhich( SID_ATTR_QUICKLAUNCHER ) ); bRet = true; } break; } case SID_SAVEREL_INET : { bRet = true; if (!aSaveOptions.IsReadOnly(SvtSaveOptions::E_SAVERELINET)) if (!rSet.Put( SfxBoolItem ( rPool.GetWhich( SID_SAVEREL_INET ), aSaveOptions.IsSaveRelINet() ))) bRet = false; } break; case SID_SAVEREL_FSYS : { bRet = true; if (!aSaveOptions.IsReadOnly(SvtSaveOptions::E_SAVERELFSYS)) if (!rSet.Put( SfxBoolItem ( rPool.GetWhich( SID_SAVEREL_FSYS ), aSaveOptions.IsSaveRelFSys() ))) bRet = false; } break; case SID_BASIC_ENABLED : { bRet = true; if (!aSecurityOptions.IsReadOnly(SvtSecurityOptions::E_BASICMODE)) { if ( !rSet.Put( SfxUInt16Item( rPool.GetWhich( SID_BASIC_ENABLED ), sal::static_int_cast< sal_uInt16 >(aSecurityOptions.GetBasicMode())))) bRet = false; } } break; case SID_INET_EXE_PLUGIN : { bRet = true; if (!aSecurityOptions.IsReadOnly(SvtSecurityOptions::E_EXECUTEPLUGINS)) { if ( !rSet.Put( SfxBoolItem( SID_INET_EXE_PLUGIN, aSecurityOptions.IsExecutePlugins() ) ) ) bRet = false; } } break; case SID_MACRO_WARNING : { bRet = true; if (!aSecurityOptions.IsReadOnly(SvtSecurityOptions::E_WARNING)) { if ( !rSet.Put( SfxBoolItem( SID_MACRO_WARNING, aSecurityOptions.IsWarningEnabled() ) ) ) bRet = false; } } break; case SID_MACRO_CONFIRMATION : { bRet = true; if (!aSecurityOptions.IsReadOnly(SvtSecurityOptions::E_CONFIRMATION)) { if ( !rSet.Put( SfxBoolItem( SID_MACRO_CONFIRMATION, aSecurityOptions.IsConfirmationEnabled() ) ) ) bRet = false; } } break; case SID_SECURE_URL : { bRet = true; if (!aSecurityOptions.IsReadOnly(SvtSecurityOptions::E_SECUREURLS)) { ::com::sun::star::uno::Sequence< OUString > seqURLs = aSecurityOptions.GetSecureURLs(); std::vector aList; sal_uInt32 nCount = seqURLs.getLength(); for( sal_uInt32 nURL=0; nURL batch( comphelper::ConfigurationChanges::create()); if ( SfxItemState::SET == rSet.GetItemState(rPool.GetWhich(SID_ATTR_BUTTON_OUTSTYLE3D), true, &pItem) ) { DBG_ASSERT(pItem->ISA(SfxBoolItem), "BoolItem expected"); sal_uInt16 nOutStyle = static_cast(pItem)->GetValue() ? 0 : TOOLBOX_STYLE_FLAT; aMiscOptions.SetToolboxStyle( nOutStyle ); } if ( SfxItemState::SET == rSet.GetItemState(rPool.GetWhich(SID_ATTR_BUTTON_BIGSIZE), true, &pItem) ) { DBG_ASSERT(pItem->ISA(SfxBoolItem), "BoolItem expected"); bool bBigSize = static_cast(pItem)->GetValue(); aMiscOptions.SetSymbolsSize( sal::static_int_cast< sal_Int16 >( bBigSize ? SFX_SYMBOLS_SIZE_LARGE : SFX_SYMBOLS_SIZE_SMALL ) ); SfxViewFrame* pCurrViewFrame = SfxViewFrame::GetFirst(); while ( pCurrViewFrame ) { // update all "final" dispatchers if ( !pCurrViewFrame->GetActiveChildFrame_Impl() ) pCurrViewFrame->GetDispatcher()->Update_Impl(true); pCurrViewFrame = SfxViewFrame::GetNext(*pCurrViewFrame); } } // Backup if ( SfxItemState::SET == rSet.GetItemState(rPool.GetWhich(SID_ATTR_BACKUP), true, &pItem) ) { DBG_ASSERT(pItem->ISA(SfxBoolItem), "BoolItem expected"); aSaveOptions.SetBackup( static_cast(pItem)->GetValue() ); } // PrettyPrinting if ( SfxItemState::SET == rSet.GetItemState( rPool.GetWhich( SID_ATTR_PRETTYPRINTING ), true, &pItem ) ) { DBG_ASSERT( pItem->ISA( SfxBoolItem ), "BoolItem expected" ); aSaveOptions.SetPrettyPrinting( static_cast< const SfxBoolItem*> ( pItem )->GetValue() ); } // WarnAlienFormat if ( SfxItemState::SET == rSet.GetItemState( rPool.GetWhich( SID_ATTR_WARNALIENFORMAT ), true, &pItem ) ) { DBG_ASSERT( pItem->ISA( SfxBoolItem ), "BoolItem expected" ); aSaveOptions.SetWarnAlienFormat( static_cast< const SfxBoolItem*> ( pItem )->GetValue() ); } // AutoSave if ( SfxItemState::SET == rSet.GetItemState(rPool.GetWhich(SID_ATTR_AUTOSAVE), true, &pItem)) { DBG_ASSERT(pItem->ISA(SfxBoolItem), "BoolItem expected"); aSaveOptions.SetAutoSave( static_cast(pItem)->GetValue() ); } // AutoSave-Propt if ( SfxItemState::SET == rSet.GetItemState(rPool.GetWhich(SID_ATTR_AUTOSAVEPROMPT), true, &pItem)) { DBG_ASSERT(pItem->ISA(SfxBoolItem), "BoolItem expected"); aSaveOptions.SetAutoSavePrompt(static_cast(pItem)->GetValue()); } // AutoSave-Time if ( SfxItemState::SET == rSet.GetItemState(rPool.GetWhich(SID_ATTR_AUTOSAVEMINUTE), true, &pItem)) { DBG_ASSERT(pItem->ISA(SfxUInt16Item), "UInt16Item expected"); aSaveOptions.SetAutoSaveTime(static_cast(pItem)->GetValue()); } // UserAutoSave if ( SfxItemState::SET == rSet.GetItemState(rPool.GetWhich(SID_ATTR_USERAUTOSAVE), true, &pItem)) { DBG_ASSERT(pItem->ISA(SfxBoolItem), "BoolItem expected"); aSaveOptions.SetUserAutoSave( static_cast(pItem)->GetValue() ); } // DocInfo if ( SfxItemState::SET == rSet.GetItemState(rPool.GetWhich(SID_ATTR_DOCINFO), true, &pItem)) { DBG_ASSERT(pItem->ISA(SfxBoolItem), "BoolItem expected"); aSaveOptions.SetDocInfoSave(static_cast(pItem)->GetValue()); } // Mark open Documents if ( SfxItemState::SET == rSet.GetItemState(rPool.GetWhich(SID_ATTR_WORKINGSET), true, &pItem)) { DBG_ASSERT(pItem->ISA(SfxBoolItem), "BoolItem expected"); aSaveOptions.SetSaveWorkingSet(static_cast(pItem)->GetValue()); } // Save window settings if ( SfxItemState::SET == rSet.GetItemState(rPool.GetWhich(SID_ATTR_SAVEDOCVIEW), true, &pItem)) { DBG_ASSERT(pItem->ISA(SfxBoolItem), "BoolItem expected"); aSaveOptions.SetSaveDocView(static_cast(pItem)->GetValue()); } // Metric if ( SfxItemState::SET == rSet.GetItemState(rPool.GetWhich(SID_ATTR_METRIC), true, &pItem)) { DBG_ASSERT(pItem->ISA(SfxUInt16Item), "UInt16Item expected"); } // HelpBalloons if ( SfxItemState::SET == rSet.GetItemState(rPool.GetWhich(SID_HELPBALLOONS), true, &pItem)) { DBG_ASSERT(pItem->ISA(SfxBoolItem), "BoolItem expected"); aHelpOptions.SetExtendedHelp(static_cast(pItem)->GetValue()); } // HelpTips if ( SfxItemState::SET == rSet.GetItemState(rPool.GetWhich(SID_HELPTIPS), true, &pItem)) { DBG_ASSERT(pItem->ISA(SfxBoolItem), "BoolItem expected"); aHelpOptions.SetHelpTips( static_cast(pItem)->GetValue()); } // WelcomeScreen if ( SfxItemState::SET == rSet.GetItemState(rPool.GetWhich(SID_ATTR_WELCOMESCREEN ), true, &pItem)) { DBG_ASSERT(pItem->ISA(SfxBoolItem), "BoolItem expected"); aHelpOptions.SetWelcomeScreen( static_cast(pItem)->GetValue() ); } // WelcomeScreen if ( SfxItemState::SET == rSet.GetItemState(rPool.GetWhich(SID_WELCOMESCREEN_RESET ), true, &pItem)) { DBG_ASSERT(pItem->ISA(SfxBoolItem), "BoolItem expected"); bool bReset = static_cast(pItem)->GetValue(); if ( bReset ) { OSL_FAIL( "Not implemented, may be EOL!" ); } } if ( SfxItemState::SET == rSet.GetItemState(rPool.GetWhich(SID_HELP_STYLESHEET ), true, &pItem)) { DBG_ASSERT(pItem->ISA(SfxStringItem), "StringItem expected"); aHelpOptions.SetHelpStyleSheet( static_cast(pItem)->GetValue() ); } // SaveRelINet if ( SfxItemState::SET == rSet.GetItemState(rPool.GetWhich(SID_SAVEREL_INET), true, &pItem)) { DBG_ASSERT(pItem->ISA(SfxBoolItem), "BoolItem expected"); aSaveOptions.SetSaveRelINet(static_cast(pItem)->GetValue()); } // SaveRelFSys if ( SfxItemState::SET == rSet.GetItemState(rPool.GetWhich(SID_SAVEREL_FSYS), true, &pItem)) { DBG_ASSERT(pItem->ISA(SfxBoolItem), "BoolItem expected"); aSaveOptions.SetSaveRelFSys(static_cast(pItem)->GetValue()); } // Undo-Count if ( SfxItemState::SET == rSet.GetItemState(rPool.GetWhich(SID_ATTR_UNDO_COUNT), true, &pItem)) { DBG_ASSERT(pItem->ISA(SfxUInt16Item), "UInt16Item expected"); sal_uInt16 nUndoCount = static_cast(pItem)->GetValue(); officecfg::Office::Common::Undo::Steps::set(nUndoCount, batch); // To catch all Undo-Managers: Iterate over all Frames for ( SfxViewFrame *pFrame = SfxViewFrame::GetFirst(); pFrame; pFrame = SfxViewFrame::GetNext(*pFrame) ) { // Get the Dispatcher of the Frames SfxDispatcher *pDispat = pFrame->GetDispatcher(); pDispat->Flush(); // Iterate over all SfxShells on the Dispatchers Stack sal_uInt16 nIdx = 0; for ( SfxShell *pSh = pDispat->GetShell(nIdx); pSh; ++nIdx, pSh = pDispat->GetShell(nIdx) ) { ::svl::IUndoManager *pShUndoMgr = pSh->GetUndoManager(); if ( pShUndoMgr ) pShUndoMgr->SetMaxUndoActionCount( nUndoCount ); } } } // Office autostart if ( SfxItemState::SET == rSet.GetItemState(rPool.GetWhich(SID_ATTR_QUICKLAUNCHER), true, &pItem)) { DBG_ASSERT(pItem->ISA(SfxBoolItem), "BoolItem expected"); ShutdownIcon::SetAutostart( static_cast( pItem )->GetValue() ); } // StarBasic Enable if ( SfxItemState::SET == rSet.GetItemState(SID_BASIC_ENABLED, true, &pItem)) { DBG_ASSERT(pItem->ISA(SfxUInt16Item), "SfxInt16Item expected"); aSecurityOptions.SetBasicMode( (EBasicSecurityMode)static_cast( pItem )->GetValue() ); } // Execute PlugIns if ( SfxItemState::SET == rSet.GetItemState(SID_INET_EXE_PLUGIN, true, &pItem)) { DBG_ASSERT(pItem->ISA(SfxBoolItem), "SfxBoolItem expected"); aSecurityOptions.SetExecutePlugins( static_cast( pItem )->GetValue() ); } if ( SfxItemState::SET == rSet.GetItemState(rPool.GetWhich(SID_INET_PROXY_TYPE), true, &pItem)) { DBG_ASSERT( pItem->ISA(SfxUInt16Item), "UInt16Item expected" ); officecfg::Inet::Settings::ooInetProxyType::set( static_cast< SfxUInt16Item const * >(pItem)->GetValue(), batch); } if ( SfxItemState::SET == rSet.GetItemState( rPool.GetWhich( SID_INET_HTTP_PROXY_NAME ), true, &pItem ) ) { DBG_ASSERT( pItem->ISA(SfxStringItem), "StringItem expected" ); officecfg::Inet::Settings::ooInetHTTPProxyName::set( static_cast< SfxStringItem const * >(pItem)->GetValue(), batch); } if ( SfxItemState::SET == rSet.GetItemState( rPool.GetWhich( SID_INET_HTTP_PROXY_PORT ), true, &pItem ) ) { DBG_ASSERT( pItem->ISA(SfxInt32Item), "Int32Item expected" ); officecfg::Inet::Settings::ooInetHTTPProxyPort::set( static_cast< SfxInt32Item const * >(pItem)->GetValue(), batch); } if ( SfxItemState::SET == rSet.GetItemState( rPool.GetWhich( SID_INET_FTP_PROXY_NAME ), true, &pItem ) ) { DBG_ASSERT( pItem->ISA(SfxStringItem), "StringItem expected" ); officecfg::Inet::Settings::ooInetFTPProxyName::set( static_cast< SfxStringItem const * >(pItem)->GetValue(), batch); } if ( SfxItemState::SET == rSet.GetItemState( rPool.GetWhich( SID_INET_FTP_PROXY_PORT ), true, &pItem ) ) { DBG_ASSERT( pItem->ISA(SfxInt32Item), "Int32Item expected" ); officecfg::Inet::Settings::ooInetFTPProxyPort::set( static_cast< SfxInt32Item const * >(pItem)->GetValue(), batch); } if ( SfxItemState::SET == rSet.GetItemState(SID_INET_NOPROXY, true, &pItem)) { DBG_ASSERT(pItem->ISA(SfxStringItem), "StringItem expected"); officecfg::Inet::Settings::ooInetNoProxy::set( static_cast< SfxStringItem const * >(pItem)->GetValue(), batch); } // Secure-Referers if ( SfxItemState::SET == rSet.GetItemState(SID_SECURE_URL, true, &pItem)) { DBG_ASSERT(pItem->ISA(SfxStringListItem), "StringListItem expected"); ::com::sun::star::uno::Sequence< OUString > seqURLs; static_cast(pItem)->GetStringList(seqURLs); aSecurityOptions.SetSecureURLs( seqURLs ); } if ( SfxItemState::SET == rSet.GetItemState(SID_MACRO_WARNING, true, &pItem)) { DBG_ASSERT(pItem->ISA(SfxBoolItem), "SfxBoolItem expected"); aSecurityOptions.SetWarningEnabled( static_cast(pItem)->GetValue() ); } if ( SfxItemState::SET == rSet.GetItemState(SID_MACRO_CONFIRMATION, true, &pItem)) { DBG_ASSERT(pItem->ISA(SfxBoolItem), "SfxBoolItem expected"); aSecurityOptions.SetConfirmationEnabled( static_cast(pItem)->GetValue() ); } // Store changed data batch->commit(); } void SfxApplication::SetOptions(const SfxItemSet &rSet) { SvtPathOptions aPathOptions; // Data is saved in DocInfo and IniManager const SfxPoolItem *pItem = 0; SfxItemPool &rPool = GetPool(); SfxAllItemSet aSendSet( rSet ); // PathName if ( SfxItemState::SET == rSet.GetItemState(rPool.GetWhich(SID_ATTR_PATHNAME), true, &pItem)) { DBG_ASSERT(pItem->ISA(SfxAllEnumItem), "AllEnumItem expected"); const SfxAllEnumItem* pEnumItem = static_cast(pItem); sal_uInt32 nCount = pEnumItem->GetValueCount(); OUString aNoChangeStr( ' ' ); for( sal_uInt32 nPath=0; nPathGetValueTextByPos((sal_uInt16)nPath); if ( sValue != aNoChangeStr ) { switch( nPath ) { case SvtPathOptions::PATH_ADDIN: { OUString aTmp; if( ::utl::LocalFileHelper::ConvertURLToPhysicalName( sValue, aTmp ) ) aPathOptions.SetAddinPath( aTmp ); break; } case SvtPathOptions::PATH_AUTOCORRECT: aPathOptions.SetAutoCorrectPath( sValue );break; case SvtPathOptions::PATH_AUTOTEXT: aPathOptions.SetAutoTextPath( sValue );break; case SvtPathOptions::PATH_BACKUP: aPathOptions.SetBackupPath( sValue );break; case SvtPathOptions::PATH_BASIC: aPathOptions.SetBasicPath( sValue );break; case SvtPathOptions::PATH_BITMAP: aPathOptions.SetBitmapPath( sValue );break; case SvtPathOptions::PATH_CONFIG: aPathOptions.SetConfigPath( sValue );break; case SvtPathOptions::PATH_DICTIONARY: aPathOptions.SetDictionaryPath( sValue );break; case SvtPathOptions::PATH_FAVORITES: aPathOptions.SetFavoritesPath( sValue );break; case SvtPathOptions::PATH_FILTER: { OUString aTmp; if( ::utl::LocalFileHelper::ConvertURLToPhysicalName( sValue, aTmp ) ) aPathOptions.SetFilterPath( aTmp ); break; } case SvtPathOptions::PATH_GALLERY: aPathOptions.SetGalleryPath( sValue );break; case SvtPathOptions::PATH_GRAPHIC: aPathOptions.SetGraphicPath( sValue );break; case SvtPathOptions::PATH_HELP: { OUString aTmp; if( ::utl::LocalFileHelper::ConvertURLToPhysicalName( sValue, aTmp ) ) aPathOptions.SetHelpPath( aTmp ); break; } case SvtPathOptions::PATH_LINGUISTIC: aPathOptions.SetLinguisticPath( sValue );break; case SvtPathOptions::PATH_MODULE: { OUString aTmp; if( ::utl::LocalFileHelper::ConvertURLToPhysicalName( sValue, aTmp ) ) aPathOptions.SetModulePath( aTmp ); break; } case SvtPathOptions::PATH_PALETTE: aPathOptions.SetPalettePath( sValue );break; case SvtPathOptions::PATH_PLUGIN: { OUString aTmp; if( ::utl::LocalFileHelper::ConvertURLToPhysicalName( sValue, aTmp ) ) aPathOptions.SetPluginPath( aTmp ); break; } case SvtPathOptions::PATH_STORAGE: { OUString aTmp; if( ::utl::LocalFileHelper::ConvertURLToPhysicalName( sValue, aTmp ) ) aPathOptions.SetStoragePath( aTmp ); break; } case SvtPathOptions::PATH_TEMP: aPathOptions.SetTempPath( sValue );break; case SvtPathOptions::PATH_TEMPLATE: aPathOptions.SetTemplatePath( sValue );break; case SvtPathOptions::PATH_USERCONFIG: aPathOptions.SetUserConfigPath( sValue );break; case SvtPathOptions::PATH_WORK: aPathOptions.SetWorkPath( sValue );break; default: SAL_WARN( "sfx.appl", "SfxApplication::SetOptions_Impl() Invalid path number found for set directories!" ); } } } aSendSet.ClearItem( rPool.GetWhich( SID_ATTR_PATHNAME ) ); } SetOptions_Impl( rSet ); // Undo-Count Broadcast( SfxItemSetHint( rSet ) ); } void SfxApplication::NotifyEvent( const SfxEventHint& rEventHint, bool bSynchron ) { SfxObjectShell *pDoc = rEventHint.GetObjShell(); if ( pDoc && ( pDoc->IsPreview() || !pDoc->Get_Impl()->bInitialized ) ) return; if ( bSynchron ) { #ifdef DBG_UTIL if (!pDoc) { OStringBuffer aTmp("SfxEvent: "); aTmp.append(OUStringToOString(rEventHint.GetEventName(), RTL_TEXTENCODING_UTF8)); OSL_TRACE( "%s", aTmp.getStr() ); } #endif Broadcast(rEventHint); if ( pDoc ) pDoc->Broadcast( rEventHint ); } else new SfxEventAsyncer_Impl( rEventHint ); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */