[Libreoffice-commits] core.git: Branch 'libreoffice-4-1' - reportbuilder/Module_reportbuilder.mk reportbuilder/Package_reportbuilder-templates.mk reportbuilder/registry scp2/source wizards/com

Stephan Bergmann sbergman at redhat.com
Fri Jun 7 04:42:58 PDT 2013


 reportbuilder/Module_reportbuilder.mk                       |    1 
 reportbuilder/Package_reportbuilder-templates.mk            |   23 +++++++
 reportbuilder/registry/data/org/openoffice/Office/Paths.xcu |   30 ---------
 scp2/source/ooo/module_reportbuilder.scp                    |   12 +++
 wizards/com/sun/star/wizards/report/MANIFEST.MF             |    1 
 wizards/com/sun/star/wizards/report/ReportWizard.java       |   37 ++----------
 6 files changed, 44 insertions(+), 60 deletions(-)

New commits:
commit 0cd10346f94430128beee0b4084b27837ccda6fa
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Fri Jun 7 11:55:00 2013 +0200

    fdo#65168: Fix regressions introduced with de-extension-ing report builder
    
    ...in 90a326c7028d5af132c62edfaef77c53627e4c0e "fdo#61950 move report builder
    from bundled extensions to plain code":
    
    * For one, ReportWizard.startReportWizard
    (wizards/com/sun/star/wizards/report/ReportWizard.java) would still try to load
    reportbuilderwizard.jar from the unpacked extension (and, failing that, fell
    back to the old default engine, so this didn't cause any failure per se).
    Instead, reference reportbuilderwizard.jar (which was also missing from scp2)
    from report.jar's manifest Class-Path (which will always be OK, even if
    reportbuilderwizard.jar is not installed) and check for the relevant class via
    Class::forName directly.
    
    * For another, the en-US/wizard/report/default.otr template had gone missing.
    The way to find it inside the unpacked extension in the past was to include a
    Paths.xcu update that extends the Template path.  Instead, install that
    template directly into share/template now, and drop the (unused already)
    Paths.xcu update.
    
    Change-Id: I09eca2b69aa55d5b15fb5ecfec6881f8a6f6e5e5
    (cherry picked from commit e57eeb6d5f547a4a49df796641141c733f6c5204)

diff --git a/reportbuilder/Module_reportbuilder.mk b/reportbuilder/Module_reportbuilder.mk
index 08c3b01..aaa3e59 100644
--- a/reportbuilder/Module_reportbuilder.mk
+++ b/reportbuilder/Module_reportbuilder.mk
@@ -12,6 +12,7 @@ $(eval $(call gb_Module_Module,reportbuilder))
 ifeq ($(ENABLE_REPORTBUILDER),TRUE)
 $(eval $(call gb_Module_add_targets,reportbuilder,\
 	Jar_reportbuilder \
+	Package_reportbuilder-templates \
 ))
 endif
 
diff --git a/reportbuilder/Package_reportbuilder-templates.mk b/reportbuilder/Package_reportbuilder-templates.mk
new file mode 100644
index 0000000..54e6d7f
--- /dev/null
+++ b/reportbuilder/Package_reportbuilder-templates.mk
@@ -0,0 +1,23 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+
+# There is currently only a single, en-US, template that needs to be included in
+# any installation set regardless of language settings, so keep this as a
+# Package instead of an AllLangPackage (whose content would need to go into a
+# language pack in scp2) for now.
+
+$(eval $(call gb_Package_Package,reportbuilder-templates,$(SRCDIR)/reportbuilder/template))
+
+$(eval $(call gb_Package_set_outdir,reportbuilder-templates,$(INSTDIR)))
+
+$(eval $(call gb_Package_add_files_with_dir,reportbuilder-templates,share/template, \
+    en-US/wizard/report/default.otr \
+))
+
+# vim: set noet sw=4 ts=4:
diff --git a/reportbuilder/registry/data/org/openoffice/Office/Paths.xcu b/reportbuilder/registry/data/org/openoffice/Office/Paths.xcu
deleted file mode 100644
index b8e8be8..0000000
--- a/reportbuilder/registry/data/org/openoffice/Office/Paths.xcu
+++ /dev/null
@@ -1,30 +0,0 @@
-<?xml version='1.0' encoding='UTF-8'?>
-<!--
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- *   Licensed to the Apache Software Foundation (ASF) under one or more
- *   contributor license agreements. See the NOTICE file distributed
- *   with this work for additional information regarding copyright
- *   ownership. The ASF licenses this file to you under the Apache
- *   License, Version 2.0 (the "License"); you may not use this file
- *   except in compliance with the License. You may obtain a copy of
- *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
- -->
-
-<oor:component-data oor:package="org.openoffice.Office" oor:name="Paths" xmlns:install="http://openoffice.org/2004/installation" xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > <node oor:name="Paths">
-
-        <node oor:name="Template" oor:op="fuse">
-            <node oor:name="InternalPaths">
-                <node oor:name="%origin%/../../../../../template" oor:op="fuse"/>
-            </node>
-        </node>
-
-    </node>
-</oor:component-data>
-
diff --git a/scp2/source/ooo/module_reportbuilder.scp b/scp2/source/ooo/module_reportbuilder.scp
index 67ffebf..1c5b0f3 100644
--- a/scp2/source/ooo/module_reportbuilder.scp
+++ b/scp2/source/ooo/module_reportbuilder.scp
@@ -38,7 +38,9 @@ Module gid_Module_Reportbuilder
         gid_File_Lib_Rptui,
         gid_File_Lib_Rptxml,
         gid_File_Jar_Reportbuilder,
-        gid_File_Xcd_Reportbuilder);
+        gid_File_Jar_Reportbuilderwizard,
+        gid_File_Xcd_Reportbuilder,
+        gid_Filelist_ReportbuilderTemplates);
 End
 
 Directory gid_Dir_Share_Reportbuilder
@@ -47,6 +49,7 @@ Directory gid_Dir_Share_Reportbuilder
 End
 
 STD_JAR_FILE( gid_File_Jar_Reportbuilder, reportbuilder )
+STD_JAR_FILE( gid_File_Jar_Reportbuilderwizard, reportbuilderwizard )
 
 #if !defined SYSTEM_APACHE_COMMONS
 STD_JAR_FILE(gid_File_Jar_CommonsLogging, commons-logging-1.1.1)
@@ -74,4 +77,11 @@ File gid_File_Xcd_Reportbuilder
     Styles = (PACKED);
 End
 
+File gid_Filelist_ReportbuilderTemplates
+    TXT_FILE_BODY;
+    Dir = FILELIST_DIR;
+    Name = "reportbuilder-templates.filelist";
+    Styles = (FILELIST);
+End
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/wizards/com/sun/star/wizards/report/MANIFEST.MF b/wizards/com/sun/star/wizards/report/MANIFEST.MF
index 1a4f8da..2dda41a 100644
--- a/wizards/com/sun/star/wizards/report/MANIFEST.MF
+++ b/wizards/com/sun/star/wizards/report/MANIFEST.MF
@@ -1,2 +1,3 @@
+Class-Path: reportbuilderwizard.jar
 RegistrationClassName: com.sun.star.wizards.report.CallReportWizard
 UNO-Type-Path: 
diff --git a/wizards/com/sun/star/wizards/report/ReportWizard.java b/wizards/com/sun/star/wizards/report/ReportWizard.java
index 3e40f7b..9ddb305 100644
--- a/wizards/com/sun/star/wizards/report/ReportWizard.java
+++ b/wizards/com/sun/star/wizards/report/ReportWizard.java
@@ -24,7 +24,6 @@ import com.sun.star.awt.XTextListener;
 import com.sun.star.beans.PropertyValue;
 
 import com.sun.star.container.XContentEnumerationAccess;
-import com.sun.star.deployment.XPackageInformationProvider;
 import com.sun.star.lang.EventObject;
 import com.sun.star.lang.XMultiServiceFactory;
 import com.sun.star.logging.XLogger;
@@ -52,9 +51,6 @@ import com.sun.star.wizards.ui.TitlesComponent;
 import com.sun.star.wizards.ui.UIConsts;
 import com.sun.star.wizards.ui.UnoDialog;
 import java.lang.reflect.Method;
-import java.net.URI;
-import java.net.URL;
-import java.net.URLClassLoader;
 import java.util.Map;
 
 public class ReportWizard extends DatabaseObjectWizard implements XTextListener
@@ -398,19 +394,6 @@ public class ReportWizard extends DatabaseObjectWizard implements XTextListener
         return e.hasMoreElements();
         }
 
-    /**
-     * Return the path to the "com.sun.reportdesigner" extension
-     * @param _xMSF
-     * @return
-     */
-    public static String getPathToExtension(XMultiServiceFactory _xMSF)
-    {
-        // Get the path to the extension and try to add the path to the class loader
-        final XComponentContext xComponentContext = Helper.getComponentContext(_xMSF);
-        final Object aSingleton = xComponentContext.getValueByName("/singletons/com.sun.star.deployment.PackageInformationProvider");
-        XPackageInformationProvider xProvider = UnoRuntime.queryInterface(XPackageInformationProvider.class, aSingleton);
-        return xProvider.getPackageLocation("com.sun.reportdesigner");
-    }
     private static XLogger m_xLogger;
 
     private static void initializeLogger(XMultiServiceFactory _xMSF)
@@ -438,19 +421,16 @@ public class ReportWizard extends DatabaseObjectWizard implements XTextListener
 
         if (isReportBuilderInstalled())
         {
-            // Get the path to the extension and try to add the path to the class loader
-            String sLocation = getPathToExtension(xMSF);
-            // TODO: Umlaut in filename!
-            if (sLocation.length() > 0)
+            Class<?> a = null;
+            try
+            {
+                a = Class.forName("com.sun.star.wizards.reportbuilder.ReportBuilderImplementation");
+            }
+            catch (ClassNotFoundException e) {}
+            if (a != null)
             {
                 try
                 {
-                    URI aLocationURI = URI.create(sLocation + "/" + "reportbuilderwizard.jar");
-
-                    URL[] aURLs = new URL[1];
-                    aURLs[0] = aLocationURI.toURL();
-                    URLClassLoader aClassLoader = new URLClassLoader(aURLs, this.getClass().getClassLoader());
-                    Class<?> a = aClassLoader.loadClass("com.sun.star.wizards.reportbuilder.ReportBuilderImplementation");
                     Method aMethod = a.getMethod("create", new Class[]
                             {
                                 XMultiServiceFactory.class
@@ -460,8 +440,7 @@ public class ReportWizard extends DatabaseObjectWizard implements XTextListener
                 }
                 catch (Exception e)
                 {
-                    // Maybe problems in URI create() if a wrong char is used like '[' ']', ...
-                    System.out.println("There could be a problem with the path '" + sLocation + "'");
+                    e.printStackTrace();
                 }
             }
         }


More information about the Libreoffice-commits mailing list