summaryrefslogtreecommitdiff
path: root/sfx2/source
diff options
context:
space:
mode:
Diffstat (limited to 'sfx2/source')
-rw-r--r--sfx2/source/doc/objstor.cxx79
1 files changed, 77 insertions, 2 deletions
diff --git a/sfx2/source/doc/objstor.cxx b/sfx2/source/doc/objstor.cxx
index e26e97b31be0..dd837e149d7d 100644
--- a/sfx2/source/doc/objstor.cxx
+++ b/sfx2/source/doc/objstor.cxx
@@ -4,9 +4,9 @@
*
* $RCSfile: objstor.cxx,v $
*
- * $Revision: 1.197 $
+ * $Revision: 1.198 $
*
- * last change: $Author: ihi $ $Date: 2007-11-26 13:51:05 $
+ * last change: $Author: ihi $ $Date: 2007-11-26 18:23:43 $
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
@@ -160,6 +160,7 @@
#ifndef _UNOTOOLS_PROCESSFACTORY_HXX_
#include <comphelper/processfactory.hxx>
#endif
+#include <comphelper/configurationhelper.hxx>
#ifndef _SFXECODE_HXX
#include <svtools/sfxecode.hxx>
@@ -230,6 +231,8 @@
#include <sfx2/viewfrm.hxx>
#include "graphhelp.hxx"
#include "appbaslib.hxx"
+#include "newerverwarn.hxx"
+#include "appdata.hxx"
#include "../appl/app.hrc"
@@ -905,6 +908,78 @@ sal_Bool SfxObjectShell::DoLoad( SfxMedium *pMed )
}
}
}
+
+ // --> PB 2007-11-20 #i83653# Give warning if document contains features from new ODF version
+ // Online Update Check enabled?
+ sal_Bool bOnlineUpdateEnabled = sal_False;
+ uno::Any aVal;
+ uno::Reference< lang::XMultiServiceFactory > xSMGR = ::comphelper::getProcessServiceFactory();
+ try
+ {
+ uno::Reference < container::XNameAccess > xNameAccess(
+ xSMGR->createInstance( DEFINE_CONST_UNICODE("com.sun.star.setup.UpdateCheckConfig") ),
+ uno::UNO_QUERY );
+ if ( xNameAccess.is() )
+ {
+ aVal = xNameAccess->getByName( DEFINE_CONST_UNICODE("AutoCheckEnabled") );
+ aVal >>= bOnlineUpdateEnabled;
+ }
+ }
+ catch( const uno::Exception& )
+ {
+ // property "AutoCheckEnabled" not set
+ }
+
+ if ( bOnlineUpdateEnabled
+ /*!!!&& pMedium->GetInteractionHandler().is()*/
+ && !SFX_APP()->Get_Impl()->bODFVersionWarningLater )
+ {
+ // scan the generator string (within meta.xml)
+ SfxDocumentInfo aDocInfo( this );
+ uno::Reference< beans::XPropertySet > xSet( aDocInfo.GetInfo(), UNO_QUERY );
+ if ( xSet.is() )
+ {
+ // the new property "ODFVersion" is a temporary solution
+ // because at the moment the "Generator" property is not set correctly
+ uno::Any aAny;
+ try
+ {
+ aAny = xSet->getPropertyValue( DEFINE_CONST_UNICODE("ODFVersion") );
+ }
+ catch( const uno::Exception& )
+ {
+ // Custom Property "ODFVersion" not exists
+ }
+
+ bool bFound = false;
+ ::rtl::OUString sTemp;
+ if ( aAny >>= sTemp )
+ {
+ bFound = true;
+ if ( !sTemp.equalsAscii( "1.0" ) )
+ {
+ // document is generated by an newer office
+ sfx2::NewerVersionWarningDialog aDlg( NULL );
+ aDlg.Execute();
+ }
+ }
+
+ aAny = xSet->getPropertyValue( DEFINE_CONST_UNICODE("Generator") );
+ if ( !bFound && ( aAny >>= sTemp ) )
+ {
+ String sGenerator( sTemp );
+ String sWorkStamp = sGenerator.GetToken( 1, '$' ).GetToken( 1, '/' );
+ sal_Int32 nWorkStamp = sWorkStamp.ToInt32();
+ if ( nWorkStamp > SUPD )
+ {
+ // document is generated by an newer office
+ sfx2::NewerVersionWarningDialog aDlg( NULL );
+ aDlg.Execute();
+ }
+ }
+ }
+ }
+ // <--
}
else
GetpApp()->HideStatusText();