wizards/com/sun/star/wizards/report/CallReportWizard.java |  247 ++++++++------
 1 file changed, 143 insertions(+), 104 deletions(-)

New commits:
commit 1d62f6a24f6160c33ad5c96f39b2ab3c918f0625
Author: Noel Grandin <n...@peralex.com>
Date:   Tue Sep 9 14:01:15 2014 +0200

    fix accidental removal of Java wizard code
    
    in commit 34bcf9b498bccb5c "java: remove dead methods"
    
    Change-Id: Id6d15248f0410a78afa803a72ba3ff0b6a8e7635

diff --git a/wizards/com/sun/star/wizards/report/CallReportWizard.java 
b/wizards/com/sun/star/wizards/report/CallReportWizard.java
index d6e3881..0126794 100644
--- a/wizards/com/sun/star/wizards/report/CallReportWizard.java
+++ b/wizards/com/sun/star/wizards/report/CallReportWizard.java
@@ -27,142 +27,181 @@ import com.sun.star.wizards.common.PropertyNames;
 import java.util.logging.Level;
 import java.util.logging.Logger;
 
-/** This class implements the component. At least the interfaces XServiceInfo,
- * XTypeProvider, and XInitialization should be provided by the service.
+/** This class capsulates the class, that implements the minimal component, a
+ * factory for creating the service (<CODE>__getServiceFactory</CODE>).
  */
 public class CallReportWizard
-  extends com.sun.star.lib.uno.helper.PropertySet implements 
com.sun.star.lang.XInitialization, com.sun.star.lang.XServiceInfo, 
com.sun.star.task.XJobExecutor
 {
 
-    private static boolean bWizardStartedAlready;
-
-    /** The service name, that must be used to get an instance of this service.
-     */
-    private static final String __serviceName = 
"com.sun.star.wizards.report.CallReportWizard";
-
-    private PropertyValue[] m_wizardContext;
-
-    /** The constructor of the inner class has a XMultiServiceFactory 
parameter.
-     * @param xmultiservicefactoryInitialization A special service factory
-     * could be introduced while initializing.
+    private static boolean bWizardstartedalready;
+
+    /** Gives a factory for creating the service.
+     * This method is called by the <code>JavaLoader</code>
+     * <p>
+     * @return Returns a <code>XSingleServiceFactory</code> for creating the 
component.
+     * @see com.sun.star.comp.loader.JavaLoader
+     * @param stringImplementationName The implementation name of the 
component.
+     * @param xMSF The service manager, who gives access to every known 
service.
+     * @param xregistrykey Makes structural information (except regarding 
treestructures) of a single
+     *    registry key accessible.
      */
-    public CallReportWizard(com.sun.star.lang.XMultiServiceFactory 
xmultiservicefactoryInitialization)
+    public static com.sun.star.lang.XSingleServiceFactory 
__getServiceFactory(String stringImplementationName, 
com.sun.star.lang.XMultiServiceFactory xMSF, com.sun.star.registry.XRegistryKey 
xregistrykey)
     {
-        super();
-        xmultiservicefactory = xmultiservicefactoryInitialization;
+        com.sun.star.lang.XSingleServiceFactory xsingleservicefactory = null;
+        if (stringImplementationName.equals(
+                ReportWizardImplementation.class.getName()))
+        {
+            xsingleservicefactory = 
com.sun.star.comp.loader.FactoryHelper.getServiceFactory(
+                    ReportWizardImplementation.class,
+                    ReportWizardImplementation.__serviceName,
+                    xMSF,
+                    xregistrykey);
+        }
+        return xsingleservicefactory;
     }
 
-    public void trigger(String sEvent)
+    /** This class implements the component. At least the interfaces 
XServiceInfo,
+     * XTypeProvider, and XInitialization should be provided by the service.
+     */
+    private static class ReportWizardImplementation extends 
com.sun.star.lib.uno.helper.PropertySet implements 
com.sun.star.lang.XInitialization, com.sun.star.lang.XServiceInfo, 
com.sun.star.task.XJobExecutor
     {
-        try
+
+        private PropertyValue[] m_wizardContext;
+
+        /** The constructor of the inner class has a XMultiServiceFactory 
parameter.
+         * @param xmultiservicefactoryInitialization A special service factory
+         * could be introduced while initializing.
+         */
+        public 
ReportWizardImplementation(com.sun.star.lang.XMultiServiceFactory 
xmultiservicefactoryInitialization)
         {
-            if (sEvent.equals(PropertyNames.START))
+            super();
+            xmultiservicefactory = xmultiservicefactoryInitialization;
+        }
+
+        public void trigger(String sEvent)
+        {
+            try
             {
-                if (!bWizardStartedAlready)
+                if (sEvent.equals(PropertyNames.START))
                 {
-                    ReportWizard CurReportWizard = new ReportWizard( 
xmultiservicefactory, m_wizardContext );
-                    CurReportWizard.startReportWizard();
+                    if (!bWizardstartedalready)
+                    {
+                        ReportWizard CurReportWizard = new ReportWizard( 
xmultiservicefactory, m_wizardContext );
+                        CurReportWizard.startReportWizard();
+                    }
+                    bWizardstartedalready = false;
                 }
-                bWizardStartedAlready = false;
-            }
-            else if (sEvent.equals("fill"))
-            {
-                Dataimport CurDataimport = new 
Dataimport(xmultiservicefactory);
-                if (m_wizardContext != null)
+                else if (sEvent.equals("fill"))
                 {
-                    NamedValueCollection context = new NamedValueCollection( 
m_wizardContext );
-                    XTextDocument textDocument = context.queryOrDefault( 
"TextDocument", null, XTextDocument.class );
-                    XDatabaseDocumentUI documentUI = context.queryOrDefault( 
"DocumentUI", null, XDatabaseDocumentUI.class );
-                    if ( textDocument != null )
+                    Dataimport CurDataimport = new 
Dataimport(xmultiservicefactory);
+                    if (m_wizardContext != null)
                     {
-                        CurDataimport.createReport(xmultiservicefactory, 
documentUI, textDocument, m_wizardContext);
+                        NamedValueCollection context = new 
NamedValueCollection( m_wizardContext );
+                        XTextDocument textDocument = context.queryOrDefault( 
"TextDocument", null, XTextDocument.class );
+                        XDatabaseDocumentUI documentUI = 
context.queryOrDefault( "DocumentUI", null, XDatabaseDocumentUI.class );
+                        if ( textDocument != null )
+                        {
+                            CurDataimport.createReport(xmultiservicefactory, 
documentUI, textDocument, m_wizardContext);
+                        }
                     }
                 }
             }
+            catch (Exception e)
+            {
+                
Logger.getLogger(CallReportWizard.class.getName()).log(Level.SEVERE, null, e);
+            }
+            System.gc();
         }
-        catch (Exception e)
+        /** The service name, that must be used to get an instance of this 
service.
+         */
+        private static final String __serviceName = 
"com.sun.star.wizards.report.CallReportWizard";
+        /** The service manager, that gives access to all registered services.
+         */
+        private com.sun.star.lang.XMultiServiceFactory xmultiservicefactory;
+
+        /** This method is a member of the interface for initializing an object
+         * directly after its creation.
+         * @param object This array of arbitrary objects will be passed to the
+         * component after its creation.
+         * @throws com.sun.star.uno.Exception Every exception will not be 
handled, but will be
+         * passed to the caller.
+         */
+        public void initialize(Object[] object) throws 
com.sun.star.uno.Exception
         {
-            
Logger.getLogger(CallReportWizard.class.getName()).log(Level.SEVERE, null, e);
-        }
-        System.gc();
-    }
+            this.m_wizardContext = 
Properties.convertToPropertyValueArray(object);
 
-    /** The service manager, that gives access to all registered services.
-     */
-    private com.sun.star.lang.XMultiServiceFactory xmultiservicefactory;
-
-    /** This method is a member of the interface for initializing an object
-     * directly after its creation.
-     * @param object This array of arbitrary objects will be passed to the
-     * component after its creation.
-     * @throws com.sun.star.uno.Exception Every exception will not be handled, 
but will be
-     * passed to the caller.
-     */
-    public void initialize(Object[] object) throws com.sun.star.uno.Exception
-    {
-        this.m_wizardContext = Properties.convertToPropertyValueArray(object);
+        }
 
-    }
+        /** This method returns an array of all supported service names.
+         * @return Array of supported service names.
+         */
+        public java.lang.String[] getSupportedServiceNames()
+        {
+            String[] stringSupportedServiceNames = new String[1];
 
-    /** This method returns an array of all supported service names.
-     * @return Array of supported service names.
-     */
-    public String[] getSupportedServiceNames()
-    {
-        String[] stringSupportedServiceNames = new String[1];
+            stringSupportedServiceNames[ 0] = __serviceName;
 
-        stringSupportedServiceNames[ 0] = __serviceName;
+            return (stringSupportedServiceNames);
+        }
 
-        return (stringSupportedServiceNames);
-    }
+        /** This method returns true, if the given service will be
+         * supported by the component.
+         * @param stringService Service name.
+         * @return True, if the given service name will be supported.
+         */
+        public boolean supportsService(String stringService)
+        {
+            boolean booleanSupportsService = false;
 
-    /** This method returns true, if the given service will be
-     * supported by the component.
-     * @param stringService Service name.
-     * @return True, if the given service name will be supported.
-     */
-    public boolean supportsService(String stringService)
-    {
-        boolean booleanSupportsService = false;
+            if (stringService.equals(__serviceName))
+            {
+                booleanSupportsService = true;
+            }
+            return (booleanSupportsService);
+        }
 
-        if (stringService.equals(__serviceName))
+        @Override
+        public byte[] getImplementationId()
         {
-            booleanSupportsService = true;
+            return new byte[0];
         }
-        return (booleanSupportsService);
-    }
 
-    @Override
-    public byte[] getImplementationId()
-    {
-        return new byte[0];
-    }
+        /** Return the class name of the component.
+         * @return Class name of the component.
+         */
+        public java.lang.String getImplementationName()
+        {
+            return (ReportWizardImplementation.class.getName());
+        }
 
-    /** Return the class name of the component.
-     * @return Class name of the component.
-     */
-    public String getImplementationName()
-    {
-        return CallReportWizard.class.getName();
-    }
+        /** Provides a sequence of all types (usually interface types)
+         * provided by the object.
+         * @return Sequence of all types (usually interface types) provided by 
the
+         * service.
+         */
+        @Override
+        public Type[] getTypes()
+        {
+            Type[] typeReturn =
+            {
+            };
 
-    /** Provides a sequence of all types (usually interface types)
-     * provided by the object.
-     * @return Sequence of all types (usually interface types) provided by the
-     * service.
-     */
-    @Override
-    public Type[] getTypes()
-    {
-        Type[] typeReturn = new Type[]
-                    {
-                        new Type(com.sun.star.task.XJobExecutor.class),
-                        new Type(com.sun.star.lang.XTypeProvider.class),
-                        new Type(com.sun.star.lang.XServiceInfo.class),
-                        new Type(com.sun.star.lang.XInitialization.class)
-                    };
+            try
+            {
+                typeReturn = new Type[]
+                        {
+                            new Type(com.sun.star.task.XJobExecutor.class),
+                            new Type(com.sun.star.lang.XTypeProvider.class),
+                            new Type(com.sun.star.lang.XServiceInfo.class),
+                            new Type(com.sun.star.lang.XInitialization.class)
+                        };
+            }
+            catch (Exception e)
+            {
+                
Logger.getLogger(CallReportWizard.class.getName()).log(Level.SEVERE, null, e);
+            }
 
-        return typeReturn;
+            return (typeReturn);
+        }
     }
 }
-
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to