diff options
author | Jan Holesovsky <kendy@suse.cz> | 2010-12-20 01:29:39 +0100 |
---|---|---|
committer | Jan Holesovsky <kendy@suse.cz> | 2010-12-20 01:29:39 +0100 |
commit | c939070f709143482ce749603c0e1f0d84df443c (patch) | |
tree | c7ed48d5fa87e8ec699f006f49404ce6aa538925 /sfx2 | |
parent | a0f911669be348a5539687e4ebe25446d526b2a8 (diff) | |
parent | 066ee33f2754e36cf7b6c39d2c2bff3b31f55951 (diff) |
Merge commit 'libreoffice-3.3.0.2'
Conflicts:
sfx2/source/appl/sfxhelp.cxx
sfx2/source/appl/shutdowniconunx.cxx
sfx2/source/menu/virtmenu.cxx
sysui/desktop/share/create_tree.sh
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/source/appl/sfxhelp.cxx | 20 | ||||
-rw-r--r-- | sfx2/source/appl/shutdowniconunx.cxx | 16 | ||||
-rw-r--r-- | sfx2/source/doc/docfile.cxx | 329 |
3 files changed, 197 insertions, 168 deletions
diff --git a/sfx2/source/appl/sfxhelp.cxx b/sfx2/source/appl/sfxhelp.cxx index 7b867c284bfd..e24396435d2f 100644 --- a/sfx2/source/appl/sfxhelp.cxx +++ b/sfx2/source/appl/sfxhelp.cxx @@ -724,6 +724,17 @@ SfxHelpWindow_Impl* impl_createHelp(Reference< XFrame >& rHelpTask , return pHelpWindow; } +/// Check for built-in help +static bool impl_hasHelpInstalled() +{ + String aHelpRootURL( DEFINE_CONST_OUSTRING("vnd.sun.star.help://") ); + AppendConfigToken_Impl( aHelpRootURL, sal_True ); + Sequence< ::rtl::OUString > aFactories = SfxContentHelper::GetResultSet( aHelpRootURL ); + + return ( aFactories.getLength() != 0 ); +} + +/// Redirect the vnd.sun.star.help:// urls to http://help.libreoffice.org static bool impl_showOnlineHelp( const String& rURL ) { String aInternal( RTL_CONSTASCII_USTRINGPARAM( "vnd.sun.star.help://" ) ); @@ -790,13 +801,8 @@ BOOL SfxHelp::Start( const String& rURL, const Window* pWindow ) } } - // check if help is available - String aHelpRootURL( DEFINE_CONST_OUSTRING("vnd.sun.star.help://") ); - AppendConfigToken_Impl( aHelpRootURL, sal_True ); - Sequence< ::rtl::OUString > aFactories = SfxContentHelper::GetResultSet( aHelpRootURL ); - if ( 0 == aFactories.getLength() ) + if ( !impl_hasHelpInstalled() ) { - // no factories -> no help -> try online if ( impl_showOnlineHelp( aHelpURL ) ) return TRUE; else @@ -850,7 +856,7 @@ BOOL SfxHelp::Start( ULONG nHelpId, const Window* pWindow ) { String aHelpModuleName( GetHelpModuleName_Impl() ); String aHelpURL = CreateHelpURL( nHelpId, aHelpModuleName ); - if ( pWindow && SfxContentHelper::IsHelpErrorDocument( aHelpURL ) ) + if ( impl_hasHelpInstalled() && pWindow && SfxContentHelper::IsHelpErrorDocument( aHelpURL ) ) { // no help found -> try with parent help id. Window* pParent = pWindow->GetParent(); diff --git a/sfx2/source/appl/shutdowniconunx.cxx b/sfx2/source/appl/shutdowniconunx.cxx index 371140c21e2c..a25583445fe6 100644 --- a/sfx2/source/appl/shutdowniconunx.cxx +++ b/sfx2/source/appl/shutdowniconunx.cxx @@ -343,6 +343,22 @@ static void notify_file_changed(GFileMonitor * /*gfilemonitor*/, GFile * /*arg1* } #endif +#ifdef ENABLE_GIO +/* + * See rhbz#610103. If the quickstarter is running, then LibreOffice is + * upgraded, then the old quickstarter is still running, but is now unreliable + * as the old install has been deleted. A fairly intractable problem but we + * can avoid much of the pain if we turn off the quickstarter if we detect + * that it has been physically deleted. +*/ +static void notify_file_changed(GFileMonitor * /*gfilemonitor*/, GFile * /*arg1*/, + GFile * /*arg2*/, GFileMonitorEvent event_type, gpointer /*user_data*/) +{ + if (event_type == G_FILE_MONITOR_EVENT_DELETED) + exit_quickstarter_cb(GTK_WIDGET(pTrayIcon)); +} +#endif + void SAL_DLLPUBLIC_EXPORT plugin_init_sys_tray() { ::SolarMutexGuard aGuard; diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx index 8323214bef29..e2bbea60b1d4 100644 --- a/sfx2/source/doc/docfile.cxx +++ b/sfx2/source/doc/docfile.cxx @@ -1012,135 +1012,148 @@ sal_Bool SfxMedium::LockOrigFileOnDemand( sal_Bool bLoading, sal_Bool bNoUI ) // returns true if the document can be opened for editing ( even if it should be a copy ) // otherwise the document should be opened readonly // if user cancel the loading the ERROR_ABORT is set + sal_Bool bResult = sal_False; - if ( pImp->m_bLocked && bLoading && ::utl::LocalFileHelper::IsLocalFile( GetURLObject().GetMainURL( INetURLObject::NO_DECODE ) ) ) + if ( !GetURLObject().HasError() ) try { - // if the document is already locked the system locking might be temporarely off after storing - // check whether the system file locking should be taken again - GetLockingStream_Impl(); - } + if ( pImp->m_bLocked && bLoading && ::utl::LocalFileHelper::IsLocalFile( GetURLObject().GetMainURL( INetURLObject::NO_DECODE ) ) ) + { + // if the document is already locked the system locking might be temporarely off after storing + // check whether the system file locking should be taken again + GetLockingStream_Impl(); + } - sal_Bool bResult = pImp->m_bLocked; + sal_Bool bResult = pImp->m_bLocked; - if ( !bResult ) - { - // no read-write access is necessary on loading if the document is explicitly opened as copy - SFX_ITEMSET_ARG( GetItemSet(), pTemplateItem, SfxBoolItem, SID_TEMPLATE, sal_False); - bResult = ( bLoading && pTemplateItem && pTemplateItem->GetValue() ); - } - - if ( !bResult && !IsReadOnly() ) - { - sal_Bool bContentReadonly = sal_False; - if ( bLoading && ::utl::LocalFileHelper::IsLocalFile( GetURLObject().GetMainURL( INetURLObject::NO_DECODE ) ) ) + if ( !bResult ) { - // let the original document be opened to check the possibility to open it for editing - // and to let the writable stream stay open to hold the lock on the document - GetLockingStream_Impl(); + // no read-write access is necessary on loading if the document is explicitly opened as copy + SFX_ITEMSET_ARG( GetItemSet(), pTemplateItem, SfxBoolItem, SID_TEMPLATE, sal_False); + bResult = ( bLoading && pTemplateItem && pTemplateItem->GetValue() ); } - // "IsReadOnly" property does not allow to detect whether the file is readonly always - // so we try always to open the file for editing - // the file is readonly only in case the read-write stream can not be opened - if ( bLoading && !pImp->m_xLockingStream.is() ) + if ( !bResult && !IsReadOnly() ) { - try + sal_Bool bContentReadonly = sal_False; + if ( bLoading && ::utl::LocalFileHelper::IsLocalFile( GetURLObject().GetMainURL( INetURLObject::NO_DECODE ) ) ) { - // MediaDescriptor does this check also, the duplication should be avoided in future - Reference< ::com::sun::star::ucb::XCommandEnvironment > xDummyEnv; - ::ucbhelper::Content aContent( GetURLObject().GetMainURL( INetURLObject::NO_DECODE ), xDummyEnv ); - aContent.getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsReadOnly" ) ) ) >>= bContentReadonly; + // let the original document be opened to check the possibility to open it for editing + // and to let the writable stream stay open to hold the lock on the document + GetLockingStream_Impl(); } - catch( uno::Exception ) - {} -#if EXTRA_ACL_CHECK - // This block was introduced as a fix to i#102464, but removing - // this does not make the problem re-appear. But leaving this - // part would interfere with documents saved in samba share. This - // affects Windows only. - if ( !bContentReadonly ) + // "IsReadOnly" property does not allow to detect whether the file is readonly always + // so we try always to open the file for editing + // the file is readonly only in case the read-write stream can not be opened + if ( bLoading && !pImp->m_xLockingStream.is() ) { - // the file is not readonly, check the ACL + try + { + // MediaDescriptor does this check also, the duplication should be avoided in future + Reference< ::com::sun::star::ucb::XCommandEnvironment > xDummyEnv; + ::ucbhelper::Content aContent( GetURLObject().GetMainURL( INetURLObject::NO_DECODE ), xDummyEnv ); + aContent.getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsReadOnly" ) ) ) >>= bContentReadonly; + } + catch( uno::Exception ) + {} - String aPhysPath; - if ( ::utl::LocalFileHelper::ConvertURLToPhysicalName( GetURLObject().GetMainURL( INetURLObject::NO_DECODE ), aPhysPath ) ) - bContentReadonly = IsReadonlyAccordingACL( aPhysPath.GetBuffer() ); - } +#if EXTRA_ACL_CHECK + // This block was introduced as a fix to i#102464, but removing + // this does not make the problem re-appear. But leaving this + // part would interfere with documents saved in samba share. This + // affects Windows only. + if ( !bContentReadonly ) + { + // the file is not readonly, check the ACL + + String aPhysPath; + if ( ::utl::LocalFileHelper::ConvertURLToPhysicalName( GetURLObject().GetMainURL( INetURLObject::NO_DECODE ), aPhysPath ) ) + bContentReadonly = IsReadonlyAccordingACL( aPhysPath.GetBuffer() ); + } #endif - } + } - // do further checks only if the file not readonly in fs - if ( !bContentReadonly ) - { - // the special file locking should be used only for file URLs - if ( ::utl::LocalFileHelper::IsLocalFile( aLogicName ) ) + // do further checks only if the file not readonly in fs + if ( !bContentReadonly ) { - - // in case of storing the document should request the output before locking - if ( bLoading ) + // the special file locking should be used only for file URLs + if ( ::utl::LocalFileHelper::IsLocalFile( aLogicName ) ) { - // let the stream be opened to check the system file locking - GetMedium_Impl(); - } - sal_Int8 bUIStatus = LOCK_UI_NOLOCK; + // in case of storing the document should request the output before locking + if ( bLoading ) + { + // let the stream be opened to check the system file locking + GetMedium_Impl(); + } - // check whether system file locking has been used, the default value is false - sal_Bool bUseSystemLock = IsSystemFileLockingUsed(); + sal_Int8 bUIStatus = LOCK_UI_NOLOCK; - // TODO/LATER: This implementation does not allow to detect the system lock on saving here, actually this is no big problem - // if system lock is used the writeable stream should be available - sal_Bool bHandleSysLocked = ( bLoading && bUseSystemLock && !pImp->xStream.is() && !pOutStream ); + // check whether system file locking has been used, the default value is false + sal_Bool bUseSystemLock = IsSystemFileLockingUsed(); - do - { - try + // TODO/LATER: This implementation does not allow to detect the system lock on saving here, actually this is no big problem + // if system lock is used the writeable stream should be available + sal_Bool bHandleSysLocked = ( bLoading && bUseSystemLock && !pImp->xStream.is() && !pOutStream ); + + do { - ::svt::DocumentLockFile aLockFile( aLogicName ); - if ( !bHandleSysLocked ) + try { - try - { - bResult = aLockFile.CreateOwnLockFile(); - } - catch ( ucb::InteractiveIOException& e ) + ::svt::DocumentLockFile aLockFile( aLogicName ); + if ( !bHandleSysLocked ) { - // exception means that the lock file can not be successfuly accessed - // in this case it should be ignored if system file locking is anyway active - if ( bUseSystemLock || !IsOOoLockFileUsed() ) + try { - bResult = sal_True; - // take the ownership over the lock file - aLockFile.OverwriteOwnLockFile(); + bResult = aLockFile.CreateOwnLockFile(); } - else if ( e.Code == IOErrorCode_INVALID_PARAMETER ) + catch ( ucb::InteractiveIOException& e ) { - // system file locking is not active, ask user whether he wants to open the document without any locking - uno::Reference< task::XInteractionHandler > xHandler = GetInteractionHandler(); - - if ( xHandler.is() ) + // exception means that the lock file can not be successfuly accessed + // in this case it should be ignored if system file locking is anyway active + if ( bUseSystemLock || !IsOOoLockFileUsed() ) + { + bResult = sal_True; + // take the ownership over the lock file + aLockFile.OverwriteOwnLockFile(); + } + else if ( e.Code == IOErrorCode_INVALID_PARAMETER ) { - ::rtl::Reference< ::ucbhelper::InteractionRequest > xIgnoreRequestImpl - = new ::ucbhelper::InteractionRequest( uno::makeAny( document::LockFileIgnoreRequest() ) ); + // system file locking is not active, ask user whether he wants to open the document without any locking + uno::Reference< task::XInteractionHandler > xHandler = GetInteractionHandler(); - uno::Sequence< uno::Reference< task::XInteractionContinuation > > aContinuations( 2 ); - aContinuations[0] = new ::ucbhelper::InteractionAbort( xIgnoreRequestImpl.get() ); - aContinuations[1] = new ::ucbhelper::InteractionApprove( xIgnoreRequestImpl.get() ); - xIgnoreRequestImpl->setContinuations( aContinuations ); + if ( xHandler.is() ) + { + ::rtl::Reference< ::ucbhelper::InteractionRequest > xIgnoreRequestImpl + = new ::ucbhelper::InteractionRequest( uno::makeAny( document::LockFileIgnoreRequest() ) ); - xHandler->handle( xIgnoreRequestImpl.get() ); + uno::Sequence< uno::Reference< task::XInteractionContinuation > > aContinuations( 2 ); + aContinuations[0] = new ::ucbhelper::InteractionAbort( xIgnoreRequestImpl.get() ); + aContinuations[1] = new ::ucbhelper::InteractionApprove( xIgnoreRequestImpl.get() ); + xIgnoreRequestImpl->setContinuations( aContinuations ); - ::rtl::Reference< ::ucbhelper::InteractionContinuation > xSelected = xIgnoreRequestImpl->getSelection(); - bResult = ( uno::Reference< task::XInteractionApprove >( xSelected.get(), uno::UNO_QUERY ).is() ); + xHandler->handle( xIgnoreRequestImpl.get() ); + + ::rtl::Reference< ::ucbhelper::InteractionContinuation > xSelected = xIgnoreRequestImpl->getSelection(); + bResult = ( uno::Reference< task::XInteractionApprove >( xSelected.get(), uno::UNO_QUERY ).is() ); + } } } - } - catch ( uno::Exception& ) - { - // exception means that the lock file can not be successfuly accessed - // in this case it should be ignored if system file locking is anyway active - if ( bUseSystemLock || !IsOOoLockFileUsed() ) + catch ( uno::Exception& ) + { + // exception means that the lock file can not be successfuly accessed + // in this case it should be ignored if system file locking is anyway active + if ( bUseSystemLock || !IsOOoLockFileUsed() ) + { + bResult = sal_True; + // take the ownership over the lock file + aLockFile.OverwriteOwnLockFile(); + } + } + + // in case OOo locking is turned off the lock file is still written if possible + // but it is ignored while deciding whether the document should be opened for editing or not + if ( !bResult && !IsOOoLockFileUsed() ) { bResult = sal_True; // take the ownership over the lock file @@ -1148,89 +1161,83 @@ sal_Bool SfxMedium::LockOrigFileOnDemand( sal_Bool bLoading, sal_Bool bNoUI ) } } - // in case OOo locking is turned off the lock file is still written if possible - // but it is ignored while deciding whether the document should be opened for editing or not - if ( !bResult && !IsOOoLockFileUsed() ) - { - bResult = sal_True; - // take the ownership over the lock file - aLockFile.OverwriteOwnLockFile(); - } - } - - if ( !bResult ) - { - uno::Sequence< ::rtl::OUString > aData; - try + if ( !bResult ) { - // impossibility to get data is no real problem - aData = aLockFile.GetLockData(); - } - catch( uno::Exception ) {} + uno::Sequence< ::rtl::OUString > aData; + try + { + // impossibility to get data is no real problem + aData = aLockFile.GetLockData(); + } + catch( uno::Exception ) {} - sal_Bool bOwnLock = sal_False; + sal_Bool bOwnLock = sal_False; - if ( !bHandleSysLocked ) - { - uno::Sequence< ::rtl::OUString > aOwnData = aLockFile.GenerateOwnEntry(); - bOwnLock = ( aData.getLength() > LOCKFILE_USERURL_ID - && aOwnData.getLength() > LOCKFILE_USERURL_ID - && aOwnData[LOCKFILE_SYSUSERNAME_ID].equals( aData[LOCKFILE_SYSUSERNAME_ID] ) ); - - if ( bOwnLock - && aOwnData[LOCKFILE_LOCALHOST_ID].equals( aData[LOCKFILE_LOCALHOST_ID] ) - && aOwnData[LOCKFILE_USERURL_ID].equals( aData[LOCKFILE_USERURL_ID] ) ) + if ( !bHandleSysLocked ) { - // this is own lock from the same installation, it could remain because of crash - bResult = sal_True; + uno::Sequence< ::rtl::OUString > aOwnData = aLockFile.GenerateOwnEntry(); + bOwnLock = ( aData.getLength() > LOCKFILE_USERURL_ID + && aOwnData.getLength() > LOCKFILE_USERURL_ID + && aOwnData[LOCKFILE_SYSUSERNAME_ID].equals( aData[LOCKFILE_SYSUSERNAME_ID] ) ); + + if ( bOwnLock + && aOwnData[LOCKFILE_LOCALHOST_ID].equals( aData[LOCKFILE_LOCALHOST_ID] ) + && aOwnData[LOCKFILE_USERURL_ID].equals( aData[LOCKFILE_USERURL_ID] ) ) + { + // this is own lock from the same installation, it could remain because of crash + bResult = sal_True; + } } - } - if ( !bResult && !bNoUI ) - { - bUIStatus = ShowLockedDocumentDialog( aData, bLoading, bOwnLock ); - if ( bUIStatus == LOCK_UI_SUCCEEDED ) + if ( !bResult && !bNoUI ) { - // take the ownership over the lock file - bResult = aLockFile.OverwriteOwnLockFile(); + bUIStatus = ShowLockedDocumentDialog( aData, bLoading, bOwnLock ); + if ( bUIStatus == LOCK_UI_SUCCEEDED ) + { + // take the ownership over the lock file + bResult = aLockFile.OverwriteOwnLockFile(); + } } - } - bHandleSysLocked = sal_False; + bHandleSysLocked = sal_False; + } } - } - catch( uno::Exception& ) - { - } - } while( !bResult && bUIStatus == LOCK_UI_TRY ); + catch( uno::Exception& ) + { + } + } while( !bResult && bUIStatus == LOCK_UI_TRY ); - pImp->m_bLocked = bResult; + pImp->m_bLocked = bResult; + } + else + { + // this is no file URL, check whether the file is readonly + bResult = !bContentReadonly; + } } + } + + if ( !bResult && GetError() == ERRCODE_NONE ) + { + // the error should be set in case it is storing process + // or the document has been opened for editing explicitly + + SFX_ITEMSET_ARG( pSet, pReadOnlyItem, SfxBoolItem, SID_DOC_READONLY, FALSE ); + if ( !bLoading || (pReadOnlyItem && !pReadOnlyItem->GetValue()) ) + SetError( ERRCODE_IO_ACCESSDENIED, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) ); else - { - // this is no file URL, check whether the file is readonly - bResult = !bContentReadonly; - } + GetItemSet()->Put( SfxBoolItem( SID_DOC_READONLY, sal_True ) ); } - } - if ( !bResult && GetError() == ERRCODE_NONE ) + // when the file is locked, get the current file date + if ( bResult && DocNeedsFileDateCheck() ) + GetInitFileDate( sal_True ); + } + catch( uno::Exception& ) { - // the error should be set in case it is storing process - // or the document has been opened for editing explicitly - - SFX_ITEMSET_ARG( pSet, pReadOnlyItem, SfxBoolItem, SID_DOC_READONLY, FALSE ); - if ( !bLoading || (pReadOnlyItem && !pReadOnlyItem->GetValue()) ) - SetError( ERRCODE_IO_ACCESSDENIED, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) ); - else - GetItemSet()->Put( SfxBoolItem( SID_DOC_READONLY, sal_True ) ); + OSL_ENSURE( sal_False, "Unexpected problem by locking, high probability, that the content could not be created" ); } - - // when the file is locked, get the current file date - if ( bResult && DocNeedsFileDateCheck() ) - GetInitFileDate( sal_True ); - return bResult; } |