summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--framework/source/services/frame.cxx9
-rw-r--r--officecfg/registry/schema/org/openoffice/Office/Common.xcs7
-rw-r--r--sfx2/source/doc/docfile.cxx37
-rw-r--r--sfx2/source/doc/doctemplates.cxx2
-rw-r--r--sfx2/source/doc/objmisc.cxx28
-rw-r--r--sfx2/source/doc/objstor.cxx28
-rw-r--r--sfx2/source/inc/objshimp.hxx2
7 files changed, 74 insertions, 39 deletions
diff --git a/framework/source/services/frame.cxx b/framework/source/services/frame.cxx
index 427c2b4dc6d6..3d7b28697dd9 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 b9bd1b56b4cc..a9f0b854198e 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 21a629eec09e..23093bfa066f 100644
--- a/sfx2/source/doc/docfile.cxx
+++ b/sfx2/source/doc/docfile.cxx
@@ -576,32 +576,29 @@ 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 731c04c1086d..7df93afaa63e 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 8e1c618f65cd..a7910c463cf9 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 7cd33667c2ac..89f2fe74e2f9 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 fc0440535a47..eb8719435406 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 );