diff options
author | Jens-Heiner Rechtien <hr@openoffice.org> | 2009-07-30 10:52:48 +0000 |
---|---|---|
committer | Jens-Heiner Rechtien <hr@openoffice.org> | 2009-07-30 10:52:48 +0000 |
commit | b61c41075439251d3f4fc695a7f34f66137de590 (patch) | |
tree | bb9b5a706154ba05eb93c7ca45cf07267fb139af | |
parent | 0ae578eaad7c0ffa16a6645debe0da30bf17ced3 (diff) |
CWS-TOOLING: integrate CWS fwk114
2009-07-08 Mikhail Voytenko #i102448# fix typo
2009-07-08 Mikhail Voytenko #i102448# detect the document of new format correctly
2009-07-03 Mikhail Voytenko #i101418# adjust header
2009-07-02 Mikhail Voytenko #i103001# Integrate the patch
2009-07-01 Mikhail Voytenko rebase to DEV300_m51
2009-06-25 Mikhail Voytenko #i71512# integrate the patch
2009-06-19 Mikhail Voytenko #i102931# check whether the file was changed even in case of system file locking
2009-06-10 Mikhail Voytenko #i102448# allow to turn the office update dialog off
2009-06-10 Mikhail Voytenko #i102448# allow to turn the office update dialog off
2009-06-09 Mikhail Voytenko #i96091# the disposed frame should throw DisposedException
2009-06-09 Mikhail Voytenko #i100835# commit the patch
2009-05-26 Mikhail Voytenko #i89514# integrate the patch
2009-05-26 Mikhail Voytenko #i30373# integrate the patch
2009-05-26 Mikhail Voytenko #i101418# fix the error handling
-rw-r--r-- | framework/source/services/frame.cxx | 9 | ||||
-rw-r--r-- | officecfg/registry/schema/org/openoffice/Office/Common.xcs | 7 | ||||
-rw-r--r-- | sfx2/source/doc/docfile.cxx | 41 | ||||
-rw-r--r-- | sfx2/source/doc/doctemplates.cxx | 2 | ||||
-rw-r--r-- | sfx2/source/doc/objmisc.cxx | 28 | ||||
-rw-r--r-- | sfx2/source/doc/objstor.cxx | 28 | ||||
-rw-r--r-- | sfx2/source/inc/objshimp.hxx | 2 |
7 files changed, 76 insertions, 41 deletions
diff --git a/framework/source/services/frame.cxx b/framework/source/services/frame.cxx index 74728b4326..6b3231b2b9 100644 --- a/framework/source/services/frame.cxx +++ b/framework/source/services/frame.cxx @@ -350,6 +350,15 @@ css::uno::Reference< css::lang::XComponent > SAL_CALL Frame::loadComponentFromUR css::lang::IllegalArgumentException , css::uno::RuntimeException ) { + { + // If the frame is closed the call might lead to crash even with target "_blank", + // so the DisposedException should be thrown in this case + // It still looks to be too dangerous to set the transaction for the whole loading process + // so the guard is used in scopes to let the standard check be used + + TransactionGuard aTransaction( m_aTransactionManager, E_HARDEXCEPTIONS ); + } + ReadGuard aReadLock(m_aLock); css::uno::Reference< css::frame::XComponentLoader > xThis(static_cast< css::frame::XComponentLoader* >(this), css::uno::UNO_QUERY); css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR = m_xFactory; diff --git a/officecfg/registry/schema/org/openoffice/Office/Common.xcs b/officecfg/registry/schema/org/openoffice/Office/Common.xcs index b9bd1b56b4..a9f0b85419 100644 --- a/officecfg/registry/schema/org/openoffice/Office/Common.xcs +++ b/officecfg/registry/schema/org/openoffice/Office/Common.xcs @@ -2346,6 +2346,13 @@ Dymamic border coloring means that when the mouse is hovered over a control, and </info> <value>true</value> </prop> + <prop oor:name="ShowOfficeUpdateDialog" oor:type="xs:boolean"> + <info> + <author>MAV</author> + <desc>Specifies whether the office update dialog should be shown in case the loaded document has newer ODF version than the maximal supported one.</desc> + </info> + <value>true</value> + </prop> </group> <group oor:name="Security"> <info> diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx index 7028edc921..e0314ea11e 100644 --- a/sfx2/source/doc/docfile.cxx +++ b/sfx2/source/doc/docfile.cxx @@ -576,33 +576,30 @@ void SfxMedium::CheckFileDate( const util::DateTime& aInitDate ) || pImp->m_aDateTime.Month != aInitDate.Month || pImp->m_aDateTime.Year != aInitDate.Year ) { - if ( !IsSystemFileLockingUsed() ) - { - uno::Reference< task::XInteractionHandler > xHandler = GetInteractionHandler(); + uno::Reference< task::XInteractionHandler > xHandler = GetInteractionHandler(); - if ( xHandler.is() ) + if ( xHandler.is() ) + { + try { - try - { - ::rtl::Reference< ::ucbhelper::InteractionRequest > xInteractionRequestImpl = new ::ucbhelper::InteractionRequest( uno::makeAny( - document::ChangedByOthersRequest() ) ); - uno::Sequence< uno::Reference< task::XInteractionContinuation > > aContinuations( 3 ); - aContinuations[0] = new ::ucbhelper::InteractionAbort( xInteractionRequestImpl.get() ); - aContinuations[1] = new ::ucbhelper::InteractionApprove( xInteractionRequestImpl.get() ); - xInteractionRequestImpl->setContinuations( aContinuations ); + ::rtl::Reference< ::ucbhelper::InteractionRequest > xInteractionRequestImpl = new ::ucbhelper::InteractionRequest( uno::makeAny( + document::ChangedByOthersRequest() ) ); + uno::Sequence< uno::Reference< task::XInteractionContinuation > > aContinuations( 3 ); + aContinuations[0] = new ::ucbhelper::InteractionAbort( xInteractionRequestImpl.get() ); + aContinuations[1] = new ::ucbhelper::InteractionApprove( xInteractionRequestImpl.get() ); + xInteractionRequestImpl->setContinuations( aContinuations ); - xHandler->handle( xInteractionRequestImpl.get() ); + xHandler->handle( xInteractionRequestImpl.get() ); - ::rtl::Reference< ::ucbhelper::InteractionContinuation > xSelected = xInteractionRequestImpl->getSelection(); - if ( uno::Reference< task::XInteractionAbort >( xSelected.get(), uno::UNO_QUERY ).is() ) - { - SetError( ERRCODE_ABORT, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) ); - } + ::rtl::Reference< ::ucbhelper::InteractionContinuation > xSelected = xInteractionRequestImpl->getSelection(); + if ( uno::Reference< task::XInteractionAbort >( xSelected.get(), uno::UNO_QUERY ).is() ) + { + SetError( ERRCODE_ABORT, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) ); } - catch ( uno::Exception& ) - {} - } - } + } + catch ( uno::Exception& ) + {} + } } } diff --git a/sfx2/source/doc/doctemplates.cxx b/sfx2/source/doc/doctemplates.cxx index 6b07a22361..c61060c11b 100644 --- a/sfx2/source/doc/doctemplates.cxx +++ b/sfx2/source/doc/doctemplates.cxx @@ -2064,7 +2064,7 @@ sal_Bool SfxDocTplService_Impl::addTemplate( const OUString& rGroupName, Content aResultContent; if ( Content::create( aNewTemplateTargetURL, xEnv, aResultContent ) ) { - ::rtl::OUString aPropertyName( RTL_CONSTASCII_USTRINGPARAM( "IsReadonly" ) ); + ::rtl::OUString aPropertyName( RTL_CONSTASCII_USTRINGPARAM( "IsReadOnly" ) ); uno::Any aProperty; sal_Bool bReadOnly = sal_False; if ( getProperty( aResultContent, aPropertyName, aProperty ) && ( aProperty >>= bReadOnly ) && bReadOnly ) diff --git a/sfx2/source/doc/objmisc.cxx b/sfx2/source/doc/objmisc.cxx index 88b3ab70b5..3b03a9d4ff 100644 --- a/sfx2/source/doc/objmisc.cxx +++ b/sfx2/source/doc/objmisc.cxx @@ -84,6 +84,7 @@ #include <comphelper/processfactory.hxx> #include <comphelper/componentcontext.hxx> +#include <comphelper/configurationhelper.hxx> #include <com/sun/star/security/XDocumentDigitalSignatures.hpp> #include <com/sun/star/frame/XModel.hpp> @@ -2251,6 +2252,33 @@ sal_Bool SfxObjectShell::UseInteractionToHandleError( return bResult; } +sal_Bool SfxObjectShell_Impl::NeedsOfficeUpdateDialog() +{ + // if the configuration is not available for any reason, the default behavior is to show the message + sal_Bool bResult = sal_True; + + try + { + uno::Reference< lang::XMultiServiceFactory > xServiceManager( ::comphelper::getProcessServiceFactory(), uno::UNO_SET_THROW ); + uno::Reference< uno::XInterface > xCommonConfig( + ::comphelper::ConfigurationHelper::openConfig( + xServiceManager, + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/org.openoffice.Office.Common" ) ), + ::comphelper::ConfigurationHelper::E_STANDARD ), + uno::UNO_SET_THROW ); + + ::comphelper::ConfigurationHelper::readRelativeKey( + xCommonConfig, + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Load/" ) ), + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ShowOfficeUpdateDialog" ) ) ) >>= bResult; + } + catch( uno::Exception& ) + { + } + + return bResult; +} + sal_Int16 SfxObjectShell_Impl::getCurrentMacroExecMode() const { sal_Int16 nImposedExecMode( MacroExecMode::NEVER_EXECUTE ); diff --git a/sfx2/source/doc/objstor.cxx b/sfx2/source/doc/objstor.cxx index 1590d156ca..0c240d0e9c 100644 --- a/sfx2/source/doc/objstor.cxx +++ b/sfx2/source/doc/objstor.cxx @@ -828,37 +828,28 @@ sal_Bool SfxObjectShell::DoLoad( SfxMedium *pMed ) } } - uno::Reference< XInteractionHandler > xHandler( pMedium->GetInteractionHandler() ); - if ( xHandler.is() && !SFX_APP()->Get_Impl()->bODFVersionWarningLater ) - { - // scan the generator string (within meta.xml) - uno::Reference<document::XDocumentPropertiesSupplier> xDPS( - GetModel(), uno::UNO_QUERY_THROW); - uno::Reference<document::XDocumentProperties> xDocProps - = xDPS->getDocumentProperties(); - if ( xDocProps.is() ) + if ( pMedium->HasStorage_Impl() ) + { + uno::Reference< XInteractionHandler > xHandler( pMedium->GetInteractionHandler() ); + if ( xHandler.is() && !SFX_APP()->Get_Impl()->bODFVersionWarningLater ) { - uno::Reference<beans::XPropertySet> xUserDefinedProps( - xDocProps->getUserDefinedProperties(), uno::UNO_QUERY_THROW); - uno::Any aAny; + uno::Reference<beans::XPropertySet> xStorageProps( pMedium->GetStorage(), uno::UNO_QUERY_THROW ); + ::rtl::OUString sVersion; try { - aAny = xUserDefinedProps->getPropertyValue( - DEFINE_CONST_UNICODE("ODFVersion")); + xStorageProps->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Version" ) ) ) >>= sVersion; } catch( const uno::Exception& ) { // Custom Property "ODFVersion" does not exist } - ::rtl::OUString sVersion; - if ( (aAny >>= sVersion) && sVersion.getLength() ) + if ( sVersion.getLength() ) { double nVersion = sVersion.toDouble(); - if ( nVersion > 1.20001 ) + if ( nVersion > 1.20001 && SfxObjectShell_Impl::NeedsOfficeUpdateDialog() ) // ODF version greater than 1.2 - added some decimal places to be safe against floating point conversion errors (hack) { - ::rtl::OUString sDocumentURL( pMedium->GetOrigURL() ); ::rtl::OUString aSystemFileURL; if ( osl::FileBase::getSystemPathFromFileURL( sDocumentURL, aSystemFileURL ) == osl::FileBase::E_None ) @@ -2100,6 +2091,7 @@ sal_Bool SfxObjectShell::DoSaveCompleted( SfxMedium* pNewMed ) } pMedium->ClearBackup_Impl(); + pMedium->LockOrigFileOnDemand( sal_True, sal_False ); return bOk; } diff --git a/sfx2/source/inc/objshimp.hxx b/sfx2/source/inc/objshimp.hxx index cf8aedb954..77d8cae84b 100644 --- a/sfx2/source/inc/objshimp.hxx +++ b/sfx2/source/inc/objshimp.hxx @@ -174,6 +174,8 @@ struct SfxObjectShell_Impl : public ::sfx2::IMacroDocumentAccess SfxObjectShell_Impl( SfxObjectShell& _rDocShell ); virtual ~SfxObjectShell_Impl(); + static sal_Bool NeedsOfficeUpdateDialog(); + // IMacroDocumentAccess overridables virtual sal_Int16 getCurrentMacroExecMode() const; virtual sal_Bool setCurrentMacroExecMode( sal_uInt16 nMacroMode ); |