From 31e0ac86e6e181f6781fa207a5f21cf110c26cf2 Mon Sep 17 00:00:00 2001 From: Vladimir Glazounov Date: Tue, 29 Jan 2008 07:42:07 +0000 Subject: INTEGRATION: CWS dba24e_SRC680 (1.4.120); FILE MERGED 2007/12/19 12:28:44 oj 1.4.120.1: #i84339# handle refcount by releasing the objects as early as possible, gc is not alsways the best way to trust :-) --- .../sun/star/wizards/query/CallQueryWizard.java | 28 ++++++++++++++++++---- 1 file changed, 23 insertions(+), 5 deletions(-) (limited to 'wizards') diff --git a/wizards/com/sun/star/wizards/query/CallQueryWizard.java b/wizards/com/sun/star/wizards/query/CallQueryWizard.java index edf540011cc8..ab40b8e7a157 100644 --- a/wizards/com/sun/star/wizards/query/CallQueryWizard.java +++ b/wizards/com/sun/star/wizards/query/CallQueryWizard.java @@ -4,9 +4,9 @@ * * $RCSfile: CallQueryWizard.java,v $ * - * $Revision: 1.4 $ + * $Revision: 1.5 $ * - * last change: $Author: vg $ $Date: 2006-04-07 12:48:29 $ + * last change: $Author: vg $ $Date: 2008-01-29 08:42:07 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -34,7 +34,9 @@ ************************************************************************/ package com.sun.star.wizards.query; +import com.sun.star.beans.PropertyAttribute; import com.sun.star.beans.PropertyValue; +import com.sun.star.lang.XComponent; import com.sun.star.uno.Type; import com.sun.star.wizards.common.Properties; @@ -81,27 +83,43 @@ public class CallQueryWizard { /** This class implements the component. At least the interfaces XServiceInfo, * XTypeProvider, and XInitialization should be provided by the service. */ - public static class QueryWizardImplementation implements com.sun.star.lang.XInitialization, com.sun.star.lang.XServiceInfo, com.sun.star.lang.XTypeProvider, com.sun.star.task.XJobExecutor { + public static class QueryWizardImplementation extends com.sun.star.lib.uno.helper.PropertySet implements com.sun.star.lang.XInitialization, com.sun.star.lang.XServiceInfo, com.sun.star.lang.XTypeProvider, com.sun.star.task.XJobExecutor { PropertyValue[] databaseproperties; + public XComponent Document = null; + public XComponent DocumentDefinition = null; + /** The constructor of the inner class has a XMultiServiceFactory parameter. * @param xmultiservicefactoryInitialization A special service factory * could be introduced while initializing. */ public QueryWizardImplementation(com.sun.star.lang.XMultiServiceFactory xmultiservicefactoryInitialization) { + super(); xmultiservicefactory = xmultiservicefactoryInitialization; + registerProperty("Document", (short)(PropertyAttribute.READONLY|PropertyAttribute.MAYBEVOID)); + registerProperty("DocumentDefinition", (short)(PropertyAttribute.READONLY|PropertyAttribute.MAYBEVOID)); } public void trigger(String sEvent) { try { - com.sun.star.frame.XComponentLoader xcomponentloader = (com.sun.star.frame.XComponentLoader) com.sun.star.uno.UnoRuntime.queryInterface(com.sun.star.frame.XComponentLoader.class, xmultiservicefactory.createInstance("com.sun.star.frame.Desktop")); if (sEvent.compareTo("start") == 0) { QueryWizard CurQueryWizard = new QueryWizard(xmultiservicefactory); - CurQueryWizard.startQueryWizard(xmultiservicefactory, databaseproperties); + XComponent[] obj = CurQueryWizard.startQueryWizard(xmultiservicefactory, databaseproperties); + if ( obj != null ){ + DocumentDefinition = obj[1]; + Document = obj[0]; + } + CurQueryWizard = null; + } + else if (sEvent.compareTo("end") == 0) { + DocumentDefinition = null; + Document = null; + databaseproperties = null; } } catch (Exception exception) { System.err.println(exception); } + System.gc(); } /** The service name, that must be used to get an instance of this service. -- cgit