Commits

hr  committed 8ffab01

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

  • Participants
  • Parent commits db041f6

Comments (0)

Files changed (22)

File framework/source/services/frame.cxx

                                                                                                                                                                    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;

File odk/examples/java/EmbedDocument/EmbeddedObject/Makefile

 
 $(COMP_GEN_OUT)/%.Manifest :
 	-$(MKDIR) $(subst \\,\,$(subst /,$(PS),$(@D)))
-	@echo RegistrationClassName: $(subst /,.,$(PACKAGE)).$(COMP_NAME)Factory > $@
+	@echo RegistrationClassName: $(subst /,.,$(PACKAGE)).$(COMP_NAME)Factory> $@
 
 # component as well as application are dependent from the generated types
 # rule for component class files

File officecfg/registry/schema/org/openoffice/Office/Common.xcs

 				</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>

File package/inc/Inflater.hxx

 {
 protected:
 	sal_Bool				bFinish, bFinished, bSetParams, bNeedDict;
-	sal_Int32				nOffset, nLength;
+	sal_Int32				nOffset, nLength, nLastInflateError;
 	z_stream*				pStream;
 	com::sun::star::uno::Sequence < sal_Int8 > 	sInBuffer;
 	sal_Int32	doInflateBytes (com::sun::star::uno::Sequence < sal_Int8 > &rBuffer, sal_Int32 nNewOffset, sal_Int32 nNewLength);
     sal_Bool SAL_CALL finished(  );
     sal_Int32 SAL_CALL doInflateSegment( ::com::sun::star::uno::Sequence< sal_Int8 >& rBuffer, sal_Int32 nNewOffset, sal_Int32 nNewLength );
     void SAL_CALL end(  );
+
+    sal_Int32 getLastInflateError() { return nLastInflateError; }
 };
 
 #endif

File package/source/xstor/owriteablestream.cxx

 	return xInputStream;
 }
 
-//-----------------------------------------------
-void OWriteStream_Impl::CopyTempFileToOutput( uno::Reference< io::XOutputStream > xOutStream )
-{
-	OSL_ENSURE( xOutStream.is(), "The stream must be specified!\n" );
-	OSL_ENSURE( m_aTempURL.getLength() || m_xCacheStream.is(), "The temporary must exist!\n" );
-
-	uno::Reference< io::XInputStream > xTempInStream;
-
-    if ( m_xCacheStream.is() )
-    {
-        if ( !m_xCacheSeek.is() )
-            throw uno::RuntimeException();
-        sal_Int64 nPos = m_xCacheSeek->getPosition();
-
-        try
-        {
-            m_xCacheSeek->seek( 0 );
-            uno::Reference< io::XInputStream > xTempInp = m_xCacheStream->getInputStream();
-            if ( xTempInp.is() )
-                ::comphelper::OStorageHelper::CopyInputToOutput( xTempInStream, xOutStream );
-        }
-        catch( uno::Exception& aException )
-        {
-            AddLog( aException.Message );
-            AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Quiet exception" ) ) );
-
-            m_xCacheSeek->seek( nPos );
-            throw io::IOException(); //TODO:
-        }
-        
-        m_xCacheSeek->seek( nPos );
-    }
-    else if ( m_aTempURL.getLength() )
-    {
-        uno::Reference < ucb::XSimpleFileAccess > xTempAccess( 
-                        GetServiceFactory()->createInstance ( 
-                                ::rtl::OUString::createFromAscii( "com.sun.star.ucb.SimpleFileAccess" ) ),
-                        uno::UNO_QUERY );
-
-        if ( !xTempAccess.is() )
-            throw uno::RuntimeException(); // TODO:
-
-        try
-        {
-            xTempInStream = xTempAccess->openFileRead( m_aTempURL );
-        }
-        catch( uno::Exception& aException )
-        {
-            AddLog( aException.Message );
-            AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Quiet exception" ) ) );
-        }
-
-        if ( !xTempInStream.is() )
-            throw io::IOException(); //TODO:
-
-        ::comphelper::OStorageHelper::CopyInputToOutput( xTempInStream, xOutStream );
-    }
-}
-
 // =================================================================================================
 
 //-----------------------------------------------

File package/source/xstor/owriteablestream.hxx

 	::com::sun::star::uno::Reference< ::com::sun::star::io::XStream >		GetTempFileAsStream();
 	::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >	GetTempFileAsInputStream();
 
-	void CopyTempFileToOutput( ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream > xOutStream );
-
 	::com::sun::star::uno::Reference< ::com::sun::star::io::XStream > GetStream_Impl( sal_Int32 nStreamMode,
 																						sal_Bool bHierarchyAccess );
 

File package/source/zipapi/Inflater.cxx

 /** Provides general purpose decompression using the ZLIB library */
 
 Inflater::Inflater(sal_Bool bNoWrap)
-: bFinish(sal_False),
-  bFinished(sal_False),
+: bFinished(sal_False),
   bSetParams(sal_False),
   bNeedDict(sal_False),
   nOffset(0),
   nLength(0),
+  nLastInflateError(0),
   pStream(NULL)
 {
 	pStream = new z_stream;
 
 sal_Int32 Inflater::doInflateBytes (Sequence < sal_Int8 >  &rBuffer, sal_Int32 nNewOffset, sal_Int32 nNewLength)
 {
-	sal_Int32 nResult;
+    if ( !pStream )
+    {
+        nLastInflateError = Z_STREAM_ERROR;
+        return 0;
+    }
+
+    nLastInflateError = 0;
+
 	pStream->next_in   = ( unsigned char* ) ( sInBuffer.getConstArray() + nOffset );
 	pStream->avail_in  = nLength;
 	pStream->next_out  = reinterpret_cast < unsigned char* > ( rBuffer.getArray() + nNewOffset );
 	pStream->avail_out = nNewLength;
 
 #ifdef SYSTEM_ZLIB
-	nResult = ::inflate(pStream, bFinish ? Z_SYNC_FLUSH : Z_PARTIAL_FLUSH);
+	sal_Int32 nResult = ::inflate(pStream, Z_PARTIAL_FLUSH);
 #else
-	nResult = ::z_inflate(pStream, bFinish ? Z_SYNC_FLUSH : Z_PARTIAL_FLUSH);
+	sal_Int32 nResult = ::z_inflate(pStream, Z_PARTIAL_FLUSH);
 #endif
 
 	switch (nResult)
 			nOffset += nLength - pStream->avail_in;
 			nLength = pStream->avail_in;
 			return nNewLength - pStream->avail_out;
+
 		case Z_NEED_DICT:
 			bNeedDict = sal_True;
 			nOffset += nLength - pStream->avail_in;
 			nLength = pStream->avail_in;
-		case Z_BUF_ERROR:
-			return 0;
-		case Z_DATA_ERROR:
-			return 0;
+            return 0;
+
+        default:
+            // it is no error, if there is no input or no output
+            if ( nLength && nNewLength )
+                nLastInflateError = nResult;
 	}
+
 	return 0;
 }
 

File package/source/zipapi/XUnbufferedStream.cxx

 						OUString( RTL_CONSTASCII_USTRINGPARAM( "Should not be possible to read more then requested!" ) ),
 						Reference< XInterface >() );
 					
-				if ( maInflater.finished() ) 
+				if ( maInflater.finished() || maInflater.getLastInflateError() )
 					throw ZipIOException( OUString( RTL_CONSTASCII_USTRINGPARAM( "The stream seems to be broken!" ) ),
 										Reference< XInterface >() );
 
 				if ( maInflater.needsDictionary() )
 					throw ZipIOException( OUString( RTL_CONSTASCII_USTRINGPARAM( "Dictionaries are not supported!" ) ),
 										Reference< XInterface >() );
-				
+
 				sal_Int32 nDiff = static_cast < sal_Int32 > ( mnZipEnd - mnZipCurrent );
 				if ( nDiff > 0 )
 				{
 					mxZipSeek->seek ( mnZipCurrent );
 					sal_Int32 nToRead = std::min ( nDiff, std::max ( nRequestedBytes, static_cast< sal_Int32 >( 8192 ) ) );
 					sal_Int32 nZipRead = mxZipStream->readBytes ( maCompBuffer, nToRead );
+                    if ( nZipRead < nToRead )
+                        throw ZipIOException( OUString( RTL_CONSTASCII_USTRINGPARAM( "No expected data!" ) ),
+                                            Reference< XInterface >() );
+
 					mnZipCurrent += nZipRead;
 					// maCompBuffer now has the data, check if we need to decrypt
 					// before passing to the Inflater

File sal/osl/os2/util.c

 
 
 
-extern sal_Bool osl_getEtherAddr(sal_Char* pszAddr, sal_uInt16 BufferSize)
-{
-	return sal_False;
-}
-
 extern sal_Bool osl_getEthernetAddress( sal_uInt8 * pTargetAddress )
 {
 	return sal_False;

File sal/osl/unx/file_path_helper.cxx

  }
  
  /******************************************
-  *  osl_systemPathIsAbsolutePath   		 
-  *****************************************/
-  
- sal_Bool SAL_CALL osl_systemPathIsAbsolutePath(const rtl_uString* pustrPath)
- {
- 	OSL_PRECOND(pustrPath, "osl_systemPathIsAbsolutePath: Invalid parameter");		
- 	return (!osl_systemPathIsRelativePath(pustrPath));
- }
- 
- /******************************************
     osl_systemPathMakeAbsolutePath
   *****************************************/
   

File sal/osl/unx/file_path_helper.h

  	const rtl_uString* pustrPath);
  
  /******************************************
-    osl_systemPathIsAbsolutePath
-    Returns true if the given path is an 
-    absolute path and so starts with a '/'
-	
-	@param pustrPath [in] a system path
-		   pustrPath must not be NULL
-		   
-	@returns sal_True if the given path 
-			 start's with a separator else
-			 sal_False will be returned
-			 
-  *****************************************/
-  
- sal_Bool SAL_CALL osl_systemPathIsAbsolutePath(
- 	const rtl_uString* pustrPath);
- 
- /******************************************
     osl_systemPathMakeAbsolutePath
     Append a relative path to a base path 
 	

File sal/osl/unx/file_path_helper.hxx

  }
  
  /******************************************
-    systemPathIsAbsolutePath
-    Returns true if the given path is an 
-    absolute path and so starts with a '/'
-	
-	@param pustrPath [in] a system path
-		   pustrPath must not be NULL
-		   
-	@returns sal_True if the given path 
-			 start's with a separator else
-			 sal_False will be returned
-			 
-  *****************************************/
-  
- inline bool systemPathIsAbsolutePath(const rtl::OUString& Path)
- {
- 	return osl_systemPathIsAbsolutePath(Path.pData);
- }
- 
- /******************************************
     systemPathMakeAbsolutePath
     Append a relative path to a base path 
 	

File sal/osl/unx/file_url.cxx

 	/*********************************************
 
 	 ********************************************/
-	sal_Unicode* ustrcpy(const sal_Unicode* s, sal_Unicode* d)
-	{
-		const sal_Unicode* sc = s;
-		sal_Unicode*       dc = d;
-		
-		while ((*dc++ = *sc++))
-			/**/;
-			
-		return d;
-	}
-	
-	/*********************************************
-
-	 ********************************************/
-	 
-	sal_Unicode* ustrncpy(const sal_Unicode* s, sal_Unicode* d, unsigned int n)
-	{
-		const sal_Unicode* sc = s;
-		sal_Unicode*       dc = d;
-		unsigned int       i  = n;		
-		
-		while (i--)	
-			*dc++ = *sc++;
-		
-		if (n)
-			*dc = 0;
-			
-		return d;
-	}
-	
-	/*********************************************
-
-	 ********************************************/
 	 
 	sal_Unicode* ustrchrcat(const sal_Unicode chr, sal_Unicode* d)
 	{
 		return d;	
 	}
 
-	/*********************************************
-
-	 ********************************************/
-	 
-	sal_Unicode* ustrcat(const sal_Unicode* s, sal_Unicode* d)
-	{
-		sal_Unicode* dc = ustrtoend(d);					
-		ustrcpy(s, dc);		
-		return d;
-	}	
-
 	/******************************************************
 	 *
 	 ******************************************************/
 	}
 
 	/******************************************************
-	 * Ensure that the given string has the specified last 
-	 * character if necessary append it
-	 ******************************************************/
- 
-	sal_Unicode* _strensurelast(sal_Unicode* pStr, sal_Unicode Chr)
-	{
-    	if (!_islastchr(pStr, Chr))
-        	ustrchrcat(Chr, pStr);
-	    return pStr;
-	}	
-
-	/******************************************************
 	 * Remove the last part of a path, a path that has 
 	 * only a '/' or no '/' at all will be returned
 	 * unmodified 

File sal/osl/unx/util.c

 
 static int   osl_getHWAddr(const char *ifname, char* hard_addr);
 static int   osl_checkAddr(const char* addr);
-static char* osl_decodeEtherAddr(const char *ptr, char* buff);
 
 
 /*****************************************************************************/
-/* osl_getEtherAddr */
+/* osl_getEthernetAddress */
 /*****************************************************************************/
 
 sal_Bool SAL_CALL osl_getEthernetAddress( sal_uInt8 * pAddr )
 }
 
 
-extern sal_Bool osl_getEtherAddr(sal_Char* pszAddr, sal_uInt16 BufferSize)
-{
-	char buff[1024];
-	char hard_addr[64];
-	struct ifconf ifc;
-	struct ifreq *ifr;
-	int i;
-	int so;
-
-    (void) BufferSize; /* unused */
-
-	if ( pszAddr == 0 )
-	{
-		return sal_False;
-	}
-
-	
-	/*
-	 * All we need is ... a network file descriptor.
-	 * Normally, this is a very socket.
-	 */
-	
-	so = socket(AF_INET, SOCK_DGRAM, 0);	
-
-	
-	/*
-	 * The first thing we have to do, get the interface configuration.
-	 * It is a list of attached/configured interfaces
-	 */
-	
-	ifc.ifc_len = sizeof(buff);
-	ifc.ifc_buf = buff;
-	if ( ioctl(so, SIOCGIFCONF, &ifc) < 0 )
-	{
-/*		fprintf(stderr, "SIOCGIFCONF: %s\n", strerror(errno));*/
-		close(so);
-		return sal_False;
-	}
-
-	close(so);
-	
-	/*
-	 *  For each of the interfaces in the interface list,
-	 *  try to get the hardware address
-	 */
-
-	ifr = ifc.ifc_req;
-	for ( i = ifc.ifc_len / sizeof(struct ifreq) ; --i >= 0 ; ifr++ )
-	{
-		int nRet=0;
-		nRet = osl_getHWAddr(ifr->ifr_name,hard_addr);
-		if ( nRet  > 0 )
-		{
-			osl_decodeEtherAddr(hard_addr,pszAddr);
-			return sal_True;
-		}		
-	}
-
-	return sal_False;
-}
-
-
 /*****************************************************************************/
 /* osl_getHWAddr */
 /*****************************************************************************/
 }
 
 
-/*****************************************************************************/
-/* osl_decodeEtherAddr */
-/*****************************************************************************/
-
-static char* osl_decodeEtherAddr(const char *ptr, char* buff)
-{
-	sprintf(buff, "%02X:%02X:%02X:%02X:%02X:%02X",
-			(ptr[0] & 0377), (ptr[1] & 0377), (ptr[2] & 0377),
-			(ptr[3] & 0377), (ptr[4] & 0377), (ptr[5] & 0377));
-	return(buff);
-}
-
 #if defined (SPARC)
 
 #if defined (SOLARIS) && !defined(__sparcv8plus) && !defined(__sparcv9)

File sal/osl/w32/util.c

 
 
 
-extern sal_Bool osl_getEtherAddr(sal_Char* pszAddr, sal_uInt16 BufferSize)
-{
-    /* avoid warnings */
-    pszAddr = pszAddr;
-    BufferSize = BufferSize;
-    
-	return sal_False;
-}
-
 extern sal_Bool SAL_CALL osl_getEthernetAddress( sal_uInt8 *pAddr )
 {
     pAddr = pAddr; /* avoid warnings */

File sfx2/source/doc/docfile.cxx

       || pImp->m_aDateTime.Month != aInitDate.Month
       || pImp->m_aDateTime.Year != aInitDate.Year )
     {
-        if ( !IsSystemFileLockingUsed() )
+        uno::Reference< task::XInteractionHandler > xHandler = GetInteractionHandler();
+
+        if ( xHandler.is() )
         {
-            uno::Reference< task::XInteractionHandler > xHandler = GetInteractionHandler();
-
-            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 );
+
+                xHandler->handle( xInteractionRequestImpl.get() );
+
+                ::rtl::Reference< ::ucbhelper::InteractionContinuation > xSelected = xInteractionRequestImpl->getSelection();
+                if ( uno::Reference< task::XInteractionAbort >( xSelected.get(), uno::UNO_QUERY ).is() )
                 {
-                    ::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() );
-
-                    ::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 ) ) );
-                    }
+                    SetError( ERRCODE_ABORT, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) );
                 }
-                catch ( uno::Exception& )
-                {}
-            } 
-        }
+            }
+            catch ( uno::Exception& )
+            {}
+        } 
     }
 }
 

File sfx2/source/doc/doctemplates.cxx

 		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 )

File sfx2/source/doc/objmisc.cxx

 
 #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>
     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 );

File sfx2/source/doc/objstor.cxx

             }
         }
 
-        uno::Reference< XInteractionHandler > xHandler( pMedium->GetInteractionHandler() );
-        if ( xHandler.is() && !SFX_APP()->Get_Impl()->bODFVersionWarningLater )
+        if ( pMedium->HasStorage_Impl() )
         {
-            // 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() )
+            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 )
 		}
 	}
 
-	pMedium->ClearBackup_Impl();
+    pMedium->ClearBackup_Impl();
+    pMedium->LockOrigFileOnDemand( sal_True, sal_False );
 
 	return bOk;
 }

File sfx2/source/inc/objshimp.hxx

 	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 );

File sot/inc/sot/exchange.hxx

 	static ULONG 	RegisterFormatMimeType( const String& rMimeType );
 
 	static ULONG	GetFormat( const ::com::sun::star::datatransfer::DataFlavor& rFlavor );
-	static ULONG	GetStaticNameFormat( const String& rName );
-
     static String	GetFormatName( ULONG nFormat );
-    static String	GetFormatStaticName( ULONG nFormat );
     static sal_Bool	GetFormatDataFlavor( ULONG nFormat, ::com::sun::star::datatransfer::DataFlavor& rFlavor );
 	static String 	GetFormatMimeType( ULONG nFormat );
     static BOOL     IsInternal( const SvGlobalName& );
     static ULONG RegisterSotFormatName( SotFormatStringId nId )
 		{ return nId; }
 
-	// Anzahl der bereits registrierten Formate bzw. der hoechsten
-	// registrierten ID abfragen (fuer System-Registrierung)
-	// ACHTUNG: Die Algorithmen zur Registrierung beim System
-	// verlassen sich darauf, dass die hier gelieferte maximale
-	// Format-ID 'klein' ist, so dass eine Schleife ueber alle
-	// Formate laufen kann.
-	static ULONG	GetMaxFormat( void );
-
 	// same for XTransferable interface
 	static USHORT 	GetExchangeAction(
 		// XTransferable

File sot/source/base/exchange.cxx

 
 /*************************************************************************
 |*
-|*    SotExchange::GetStaticNameFormat()
-|*
-|*    Beschreibung      CLIP.SDW
-*************************************************************************/
-ULONG SotExchange::GetStaticNameFormat( const String& rName )
-{
-    // has to be changed to return the format for the static name (KA 27.09.2001)
-    return SotExchange::RegisterFormatName( rName );
-}
-
-/*************************************************************************
-|*
 |*    SotExchange::GetFormatName()
 |*
 |*    Beschreibung      CLIP.SDW
 	return aRet;
 }
 
-/*************************************************************************
-|*
-|*    SotExchange::GetFormatStaticName()
-|*
-|*    Beschreibung      CLIP.SDW
-*************************************************************************/
-String SotExchange::GetFormatStaticName( ULONG nFormat )
-{
-    // has to be changed to return the static format name (KA 27.09.2001)
-    return SotExchange::GetFormatName( nFormat );
-}
-
-/*************************************************************************
-|*
-|*    SotExchange::GetMaxFormat()
-|*
-*************************************************************************/
-ULONG SotExchange::GetMaxFormat( void )
-{
-    return( SOT_FORMATSTR_ID_USER_END + InitFormats_Impl().Count() );
-}
-
 BOOL SotExchange::IsInternal( const SvGlobalName& rName )
 {
     if ( rName == SvGlobalName(SO3_SW_CLASSID_60) ||