Tag: cws_ooo300_dba301a
User: fs      
Date: 2008-10-14 07:59:14+0000
Modified:
   dba/dbaccess/source/core/dataaccess/databasedocument.cxx

Log:
 #i93669# when we encounter a document having macros (in the DBDoc itself, not 
in the forms/reports), show a warning/update-question to the user

File Changes:

Directory: /dba/dbaccess/source/core/dataaccess/
================================================

File [changed]: databasedocument.cxx
Url: 
http://dba.openoffice.org/source/browse/dba/dbaccess/source/core/dataaccess/databasedocument.cxx?r1=1.47.32.1&r2=1.47.32.2
Delta lines:  +41 -1
--------------------
--- databasedocument.cxx        2008-08-21 06:19:06+0000        1.47.32.1
+++ databasedocument.cxx        2008-10-14 07:59:11+0000        1.47.32.2
@@ -7,7 +7,7 @@
  * OpenOffice.org - a multi-platform office productivity suite
  *
  * $RCSfile: databasedocument.cxx,v $
- * $Revision: 1.47.32.1 $
+ * $Revision: 1.47.32.2 $
  *
  * This file is part of OpenOffice.org.
  *
@@ -37,6 +37,7 @@
 #include "module_dba.hxx"
 
 #include <comphelper/documentconstants.hxx>
+#include <comphelper/interaction.hxx>
 #include <comphelper/namedvaluecollection.hxx>
 #include <comphelper/enumhelper.hxx>
 #include <comphelper/numberedcollection.hxx>
@@ -109,6 +110,15 @@
 #ifndef _COM_SUN_STAR_SCRIPT_PROVIDER_XSCRIPTPROVIDERFACTORY_HPP_
 #include <com/sun/star/script/provider/XScriptProviderFactory.hpp>
 #endif
+#ifndef 
INCLUDED_COM_SUN_STAR_TASK_FUTUREDOCUMENTVERSIONPRODUCTUPDATEREQUEST_HPP
+#include <com/sun/star/task/FutureDocumentVersionProductUpdateRequest.hpp>
+#endif
+#ifndef INCLUDED_COM_SUN_STAR_TASK_INTERACTIONCLASSIFICATION_HPP
+#include <com/sun/star/task/InteractionClassification.hpp>
+#endif
+#ifndef INCLUDED_COM_SUN_STAR_TASK_XINTERACTIONASKLATER_HPP
+#include <com/sun/star/task/XInteractionAskLater.hpp>
+#endif
 #ifndef _TOOLS_DEBUG_HXX
 #include <tools/debug.hxx>
 #endif
@@ -489,6 +499,36 @@
     // forms/reports, it's sufficient to do the check here.
     //
     m_pImpl->checkMacrosOnLoading();
+
+    // If we encounter a document which already contains macros in the 
document storage (instead of
+    // macros in the form's/report's storages), then this has been written by 
a newer version of OOo (>=3.1).
+    // In this case, warn the user, too.
+    if ( m_pImpl->hasMacroStorages() )
+    {
+        ::comphelper::NamedValueCollection aArgs( m_pImpl->m_aArgs );
+        Reference< XInteractionHandler > xInteraction;
+        xInteraction = aArgs.getOrDefault( "InteractionHandler", xInteraction 
);
+        if ( xInteraction.is() )
+        {
+            FutureDocumentVersionProductUpdateRequest aUpdateRequest;
+            aUpdateRequest.Classification = InteractionClassification_QUERY;
+            aUpdateRequest.DocumentURL = getURL();
+
+            ::rtl::Reference< ::comphelper::OInteractionRequest > pRequest = 
new ::comphelper::OInteractionRequest( makeAny( aUpdateRequest ) );
+            pRequest->addContinuation( new ::comphelper::OInteractionApprove );
+            pRequest->addContinuation( new 
::comphelper::OInteractionDisapprove );
+            pRequest->addContinuation( new ::comphelper::OInteraction< 
XInteractionAskLater >() );
+
+            try
+            {
+                xInteraction->handle( pRequest.get() );
+            }
+            catch( const Exception& )
+            {
+                   DBG_UNHANDLED_EXCEPTION();
+            }
+        }
+    }
 }
 
 // 
-----------------------------------------------------------------------------




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to