From 1816f3232b325c81b4d843925476a9cc1f089041 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Mon, 22 Feb 2010 12:36:29 +0100 Subject: [PATCH] autorecovery: pass a MacroExecMode when creating a blank document - with the changed implementation, it is not (as before) by accident that a suitable MacroExecMode is set automatically --- .../qa/integration/forms/DocumentHelper.java | 23 ++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/forms/qa/integration/forms/DocumentHelper.java b/forms/qa/integration/forms/DocumentHelper.java index 81b0c3a86f5a..3aae6bafc21a 100644 --- a/forms/qa/integration/forms/DocumentHelper.java +++ b/forms/qa/integration/forms/DocumentHelper.java @@ -29,11 +29,13 @@ ************************************************************************/ package integration.forms; +import com.sun.star.beans.PropertyState; import com.sun.star.beans.PropertyValue; import com.sun.star.beans.XPropertySet; import com.sun.star.container.XChild; import com.sun.star.container.XIndexContainer; import com.sun.star.container.XNameContainer; +import com.sun.star.document.MacroExecMode; import com.sun.star.drawing.XDrawPage; import com.sun.star.drawing.XDrawPageSupplier; import com.sun.star.drawing.XDrawPages; @@ -70,6 +72,12 @@ public class DocumentHelper /* ------------------------------------------------------------------ */ protected static XComponent implLoadAsComponent( XMultiServiceFactory orb, String documentOrFactoryURL ) throws com.sun.star.uno.Exception + { + return implLoadAsComponent( orb, documentOrFactoryURL, new PropertyValue[0] ); + } + + /* ------------------------------------------------------------------ */ + protected static XComponent implLoadAsComponent( XMultiServiceFactory orb, String documentOrFactoryURL, final PropertyValue[] i_args ) throws com.sun.star.uno.Exception { XComponentLoader aLoader = (XComponentLoader)UnoRuntime.queryInterface( XComponentLoader.class, @@ -77,7 +85,7 @@ public class DocumentHelper ); XComponent document = dbfTools.queryComponent( - aLoader.loadComponentFromURL( documentOrFactoryURL, "_blank", 0, new PropertyValue[ 0 ] ) + aLoader.loadComponentFromURL( documentOrFactoryURL, "_blank", 0, i_args ) ); return document; } @@ -85,7 +93,13 @@ public class DocumentHelper /* ------------------------------------------------------------------ */ private static DocumentHelper implLoadDocument( XMultiServiceFactory orb, String documentOrFactoryURL ) throws com.sun.star.uno.Exception { - XComponent document = implLoadAsComponent( orb, documentOrFactoryURL ); + return implLoadDocument( orb, documentOrFactoryURL, new PropertyValue[0] ); + } + + /* ------------------------------------------------------------------ */ + private static DocumentHelper implLoadDocument( XMultiServiceFactory orb, String documentOrFactoryURL, final PropertyValue[] i_args ) throws com.sun.star.uno.Exception + { + XComponent document = implLoadAsComponent( orb, documentOrFactoryURL, i_args ); XServiceInfo xSI = (XServiceInfo)UnoRuntime.queryInterface( XServiceInfo.class, document ); @@ -115,7 +129,10 @@ public class DocumentHelper /* ------------------------------------------------------------------ */ public static DocumentHelper blankDocument( XMultiServiceFactory orb, DocumentType eType ) throws com.sun.star.uno.Exception { - return implLoadDocument( orb, getDocumentFactoryURL( eType ) ); + final PropertyValue[] args = new PropertyValue[] { + new PropertyValue( "MacroExecutionMode", -1, MacroExecMode.ALWAYS_EXECUTE, PropertyState.DIRECT_VALUE ) + }; + return implLoadDocument( orb, getDocumentFactoryURL( eType ), args ); } /* ================================================================== */