/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * 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 . */ #ifndef INCLUDED_COMPHELPER_PROPERTYINFOHASH_HXX #define INCLUDED_COMPHELPER_PROPERTYINFOHASH_HXX #include #include #include namespace comphelper { struct PropertyInfo { OUString const maName; sal_Int32 const mnHandle; css::uno::Type const maType; sal_Int16 const mnAttributes; }; struct PropertyData { sal_uInt8 const mnMapId; PropertyInfo const *mpInfo; PropertyData ( sal_uInt8 nMapId, PropertyInfo const *pInfo ) : mnMapId ( nMapId ) , mpInfo ( pInfo ) {} }; } typedef std::unordered_map < OUString, ::comphelper::PropertyInfo const * > PropertyInfoHash; typedef std::unordered_map < OUString, ::comphelper::PropertyData* > PropertyDataHash; #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ n value='distro/cib/libreoffice-6-2'>distro/cib/libreoffice-6-2 LibreOffice 核心代码仓库文档基金会
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrank Schoenheit [fs] <frank.schoenheit@sun.com>2010-02-04 16:04:06 +0100
committerFrank Schoenheit [fs] <frank.schoenheit@sun.com>2010-02-04 16:04:06 +0100
commitc0ea2fcd404cd3830c71752cf1a0c0ee6e5b4e76 (patch)
tree753da1f65cabcadd94cc5c60fa31f363c14f161e /wizards
parent722556b9cd099cbb352cb11692ec1b27adfac5dd (diff)
autorecovery: form and report wizzard now also using XDatabaseDocumentUI, instead of manipulating document definitions
All database object wizards by now employ XDatabaseDocumentUI. This way, it is ensured that the controller has the full control over the opened sub components. Still, other third-party code could use direct access to the document definitions, and open sub documents this way. This would go unnoticed by the application controller at the moment. I would be possible to fix this, by introducing broadcasts from the document definitions, listened to by the controller. But as this sounds like a rare case, and XDatabaseDocumentUI is the preferred way for third-party components, too, such an implementation is deferred to Later ...
Diffstat (limited to 'wizards')
-rw-r--r--wizards/com/sun/star/wizards/db/DBMetaData.java70
-rw-r--r--wizards/com/sun/star/wizards/form/CallFormWizard.java30
-rw-r--r--wizards/com/sun/star/wizards/form/Finalizer.java9
-rw-r--r--wizards/com/sun/star/wizards/form/FormWizard.java84
-rw-r--r--wizards/com/sun/star/wizards/report/CallReportWizard.java63
-rw-r--r--wizards/com/sun/star/wizards/report/Dataimport.java8
-rw-r--r--wizards/com/sun/star/wizards/report/IReportDocument.java18
-rw-r--r--wizards/com/sun/star/wizards/report/ReportTextImplementation.java106
-rw-r--r--wizards/com/sun/star/wizards/report/ReportWizard.java478
-rw-r--r--wizards/com/sun/star/wizards/reportbuilder/ReportBuilderImplementation.java390
10 files changed, 372 insertions, 884 deletions
diff --git a/wizards/com/sun/star/wizards/db/DBMetaData.java b/wizards/com/sun/star/wizards/db/DBMetaData.java
index 296d73c5c31a..40966bf8e813 100644
--- a/wizards/com/sun/star/wizards/db/DBMetaData.java
+++ b/wizards/com/sun/star/wizards/db/DBMetaData.java
@@ -81,6 +81,7 @@ import com.sun.star.wizards.common.Configuration;
import com.sun.star.wizards.common.Desktop;
import com.sun.star.wizards.common.FileAccess;
import com.sun.star.wizards.common.JavaTools;
+import com.sun.star.wizards.common.NamedValueCollection;
import com.sun.star.wizards.common.NumberFormatter;
import com.sun.star.wizards.common.Properties;
import com.sun.star.wizards.common.Resource;
@@ -922,82 +923,33 @@ public class DBMetaData
* @param _xDocNameAccess
* @param _bcreateTemplate describes the type of the document: "form" or "report"
*/
- public void addDatabaseDocument(XComponent _xComponent, XHierarchicalNameAccess _xDocNameAccess, boolean _bcreateTemplate)
+ public void addDatabaseDocument(XComponent _xComponent, XHierarchicalNameAccess _xDocNameAccess, boolean i_createTemplate)
{
try
{
- PropertyValue[] aDocProperties;
XModel xDocumentModel = UnoRuntime.queryInterface( XModel.class, _xComponent );
- String sPath = xDocumentModel.getURL();
- String basename = FileAccess.getBasename(sPath, "/");
+ String documentURL = xDocumentModel.getURL();
+ String basename = FileAccess.getBasename(documentURL, "/");
XCloseable xCloseable = UnoRuntime.queryInterface( XCloseable.class, _xComponent );
xCloseable.close(false);
- if (_bcreateTemplate)
- {
- aDocProperties = new PropertyValue[5];
- }
- else
- {
- aDocProperties = new PropertyValue[4];
- }
- aDocProperties[0] = Properties.createProperty("Name", basename);
- aDocProperties[1] = Properties.createProperty("Parent", _xDocNameAccess);
- aDocProperties[2] = Properties.createProperty("URL", sPath);
- aDocProperties[3] = Properties.createProperty("DocumentTitle", basename);
- if (_bcreateTemplate)
- {
- aDocProperties[4] = Properties.createProperty("AsTemplate", new Boolean(_bcreateTemplate));
- }
+
+ NamedValueCollection creationArgs = new NamedValueCollection();
+ creationArgs.put( "Name", basename );
+ creationArgs.put( "URL", documentURL );
+ creationArgs.put( "AsTemplate", new Boolean( i_createTemplate ) );
XMultiServiceFactory xDocMSF = UnoRuntime.queryInterface( XMultiServiceFactory.class, _xDocNameAccess );
- Object oDBDocument = xDocMSF.createInstanceWithArguments("com.sun.star.sdb.DocumentDefinition", aDocProperties);
+ Object oDBDocument = xDocMSF.createInstanceWithArguments( "com.sun.star.sdb.DocumentDefinition", creationArgs.getPropertyValues() );
XHierarchicalNameContainer xHier = UnoRuntime.queryInterface( XHierarchicalNameContainer.class, _xDocNameAccess );
String sdocname = Desktop.getUniqueName(_xDocNameAccess, basename);
xHier.insertByHierarchicalName(sdocname, oDBDocument);
XInterface xInterface = (XInterface) xMSF.createInstance("com.sun.star.ucb.SimpleFileAccess");
XSimpleFileAccess xSimpleFileAccess = UnoRuntime.queryInterface( XSimpleFileAccess.class, xInterface );
- xSimpleFileAccess.kill(sPath);
- }
- catch (Exception e)
- {
- e.printStackTrace(System.out);
- }
- }
-
- public XComponent[] openDatabaseDocument(String _docname, boolean _bAsTemplate, boolean _bOpenInDesign, XHierarchicalNameAccess _xDocuments)
- {
- XComponent[] xRetComponent = new XComponent[2];
- try
- {
- XComponentLoader xComponentLoader = UnoRuntime.queryInterface( XComponentLoader.class, _xDocuments );
- PropertyValue[] aPropertyValues = new PropertyValue[4];
- aPropertyValues[0] = Properties.createProperty("OpenMode", _bOpenInDesign ? "openDesign" : "open");
- aPropertyValues[1] = Properties.createProperty("ActiveConnection", this.DBConnection);
- aPropertyValues[2] = Properties.createProperty("DocumentTitle", _docname);
- aPropertyValues[3] = Properties.createProperty("AsTemplate", new Boolean(_bAsTemplate));
- XHierarchicalNameContainer xHier = UnoRuntime.queryInterface( XHierarchicalNameContainer.class, _xDocuments );
- if (xHier.hasByHierarchicalName(_docname))
- {
- xRetComponent[0] = UnoRuntime.queryInterface( XComponent.class, xHier.getByHierarchicalName( _docname ) );
- xRetComponent[1] = xComponentLoader.loadComponentFromURL(_docname, "", 0, aPropertyValues);
- }
+ xSimpleFileAccess.kill(documentURL);
}
catch (Exception e)
{
e.printStackTrace(System.out);
}
- return xRetComponent;
- }
-
- public XComponent[] openFormDocument(String _sformname, boolean _bOpenInDesign)
- {
- XHierarchicalNameAccess xFormDocuments = getFormDocuments();
- return openDatabaseDocument(_sformname, false, _bOpenInDesign, xFormDocuments);
- }
-
- public XComponent[] openReportDocument(String _sreportname, boolean _bAsTemplate, boolean _bOpenInDesign)
- {
- XHierarchicalNameAccess xReportDocuments = getReportDocuments();
- return openDatabaseDocument(_sreportname, _bAsTemplate, _bOpenInDesign, xReportDocuments);
}
public void createTypeInspector() throws SQLException
diff --git a/wizards/com/sun/star/wizards/form/CallFormWizard.java b/wizards/com/sun/star/wizards/form/CallFormWizard.java
index 60b0b1705487..a7894ce281ca 100644
--- a/wizards/com/sun/star/wizards/form/CallFormWizard.java
+++ b/wizards/com/sun/star/wizards/form/CallFormWizard.java
@@ -30,9 +30,7 @@
package com.sun.star.wizards.form;
import com.sun.star.beans.PropertyValue;
-import com.sun.star.beans.PropertyAttribute;
import com.sun.star.uno.Type;
-import com.sun.star.lang.XComponent;
import com.sun.star.wizards.common.Properties;
/** This class capsulates the class, that implements the minimal component, a
@@ -85,10 +83,7 @@ public class CallFormWizard
*/
public static class FormWizardImplementation 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;
+ private PropertyValue[] m_wizardContext;
/** The constructor of the inner class has a XMultiServiceFactory parameter.
* @param xmultiservicefactoryInitialization A special service factory
@@ -97,9 +92,7 @@ public class CallFormWizard
public FormWizardImplementation(com.sun.star.lang.XMultiServiceFactory xmultiservicefactoryInitialization)
{
super();
- xmultiservicefactory = xmultiservicefactoryInitialization;
- registerProperty("Document", (short) (PropertyAttribute.READONLY | PropertyAttribute.MAYBEVOID));
- registerProperty("DocumentDefinition", (short) (PropertyAttribute.READONLY | PropertyAttribute.MAYBEVOID));
+ m_serviceFactory = xmultiservicefactoryInitialization;
}
public void trigger(String sEvent)
@@ -108,19 +101,8 @@ public class CallFormWizard
{
if (sEvent.compareTo("start") == 0)
{
- FormWizard CurFormWizard = new FormWizard(xmultiservicefactory);
- XComponent[] obj = CurFormWizard.startFormWizard(xmultiservicefactory, databaseproperties);
- if (obj != null)
- {
- DocumentDefinition = obj[0];
- Document = obj[1];
- }
- }
- else if (sEvent.compareTo("end") == 0)
- {
- DocumentDefinition = null;
- Document = null;
- databaseproperties = null;
+ FormWizard CurFormWizard = new FormWizard( m_serviceFactory, m_wizardContext );
+ CurFormWizard.startFormWizard();
}
}
catch (Exception exception)
@@ -134,7 +116,7 @@ public class CallFormWizard
private static final String __serviceName = "com.sun.star.wizards.form.CallFormWizard";
/** The service manager, that gives access to all registered services.
*/
- private com.sun.star.lang.XMultiServiceFactory xmultiservicefactory;
+ private com.sun.star.lang.XMultiServiceFactory m_serviceFactory;
/** This method is a member of the interface for initializing an object
* directly after its creation.
@@ -145,7 +127,7 @@ public class CallFormWizard
*/
public void initialize(Object[] object) throws com.sun.star.uno.Exception
{
- databaseproperties = Properties.convertToPropertyValueArray(object);
+ m_wizardContext = Properties.convertToPropertyValueArray(object);
}
/** This method returns an array of all supported service names.
diff --git a/wizards/com/sun/star/wizards/form/Finalizer.java b/wizards/com/sun/star/wizards/form/Finalizer.java
index 2b1ffc5786e2..2294586b813d 100644
--- a/wizards/com/sun/star/wizards/form/Finalizer.java
+++ b/wizards/com/sun/star/wizards/form/Finalizer.java
@@ -32,7 +32,6 @@ package com.sun.star.wizards.form;
import com.sun.star.awt.XRadioButton;
import com.sun.star.awt.XTextComponent;
import com.sun.star.wizards.common.Desktop;
-import com.sun.star.wizards.ui.UIConsts;
import com.sun.star.wizards.ui.*;
/**
@@ -45,7 +44,6 @@ public class Finalizer
{
WizardDialog CurUnoDialog;
- Desktop.OfficePathRetriever curofficepath;
short curtabindex;
XRadioButton optModifyForm;
XRadioButton optWorkWithForm;
@@ -88,7 +86,7 @@ public class Finalizer
{
UIConsts.INTEGERS[8], slblProceed, new Integer(97), new Integer(62), UIConsts.INTEGERS[8], new Short(curtabindex++), new Integer(185)
});
- XRadioButton optWorkWithForm = CurUnoDialog.insertRadioButton("optWorkWithForm", null,
+ CurUnoDialog.insertRadioButton("optWorkWithForm", null,
new String[]
{
"Height", "HelpURL", "Label", "PositionX", "PositionY", "State", "Step", "TabIndex", "Width"
@@ -130,10 +128,9 @@ public class Finalizer
return txtFormName.getText();
}
- public boolean getOpenMode()
+ public boolean getOpenForEditing()
{
- boolean bOpenMode = optModifyForm.getState() ? true : false;
- return bOpenMode;
+ return optModifyForm.getState() ? true : false;
}
public boolean finish()
diff --git a/wizards/com/sun/star/wizards/form/FormWizard.java b/wizards/com/sun/star/wizards/form/FormWizard.java
index 5b0a7939f6c2..9a6c0763aebf 100644
--- a/wizards/com/sun/star/wizards/form/FormWizard.java
+++ b/wizards/com/sun/star/wizards/form/FormWizard.java
@@ -33,12 +33,18 @@ import com.sun.star.awt.XWindowPeer;
import com.sun.star.beans.PropertyValue;
import com.sun.star.lang.XMultiServiceFactory;
import com.sun.star.lang.XComponent;
-import com.sun.star.wizards.common.*;
+import com.sun.star.sdb.application.DatabaseObject;
+import com.sun.star.wizards.common.Helper;
+import com.sun.star.wizards.common.JavaTools;
+import com.sun.star.wizards.common.NoValidPathException;
+import com.sun.star.wizards.common.Properties;
+import com.sun.star.wizards.db.DatabaseObjectWizard;
import com.sun.star.wizards.db.RelationController;
import com.sun.star.wizards.document.OfficeDocument;
-import com.sun.star.wizards.ui.*;
+import com.sun.star.wizards.ui.CommandFieldSelection;
+import com.sun.star.wizards.ui.UIConsts;
-public class FormWizard extends WizardDialog
+public class FormWizard extends DatabaseObjectWizard
{
private CommandFieldSelection curDBCommandFieldSelection;
@@ -67,13 +73,13 @@ public class FormWizard extends WizardDialog
public static final int SOGRID = 3;
public static final int SOTOPJUSTIFIED = 4;
private String slblTables;
- private boolean bFormOpenMode;
- private boolean bcreateForm = false;
+ private boolean m_openForEditing;
+ private boolean m_success = false;
private String FormName;
- public FormWizard(XMultiServiceFactory xMSF)
+ public FormWizard( XMultiServiceFactory i_servicFactory, final PropertyValue[] i_wizardContext )
{
- super(xMSF, 34400);
+ super( i_servicFactory, 34400, i_wizardContext );
super.addResourceHandler("FormWizard", "dbw");
Helper.setUnoPropertyValues(xDialogModel,
new String[]
@@ -171,7 +177,6 @@ public class FormWizard extends WizardDialog
switch (nOldStep)
{
case SOMAIN_PAGE:
-// curFormDocument.oMainFormDBMetaData.setFieldNames(curDBCommandFieldSelection.getSelectedFieldNames());
{
final String sTableName = curDBCommandFieldSelection.getSelectedCommandName();
final String[] aFieldNames = curDBCommandFieldSelection.getSelectedFieldNames();
@@ -219,40 +224,6 @@ public class FormWizard extends WizardDialog
}
}
-/*
- public static void main(String args[])
- {
-
- String ConnectStr = "uno:socket,host=localhost,port=8100;urp;StarOffice.ServiceManager"; //localhost ;Lo-1.Germany.sun.com; 10.16.65.155
- PropertyValue[] curproperties = null;
- try
- {
- XMultiServiceFactory xLocMSF = com.sun.star.wizards.common.Desktop.connect(ConnectStr);
- FormWizard CurFormWizard = new FormWizard(xLocMSF);
- if (xLocMSF != null)
- {
- System.out.println("Connected to " + ConnectStr);
- curproperties = new PropertyValue[1];
-// curproperties[0] = Properties.createProperty("DatabaseLocation", "file:///C:/Documents and Settings/bc93774.EHAM02-DEV/My Documents/MyHSQL.odb");
- curproperties[0] = Properties.createProperty("DatabaseLocation", "file:///C:/Documents and Settings/bc93774.EHAM02-DEV/My Documents/MyHSQL.odb");
- curproperties[0] = Properties.createProperty("DataSourceName", "MyHSQLDatabase");
- // file:///C:/Documents and Settings/bc93774.EHAM02-DEV/My Documents/myjapanesehsqldatasourceMyDocAssign.odb");
- // MyDBase; Mydbwizard2DocAssign.odb; MyDBase.odb, Mydbwizard2DocAssign.odb ; Mydbwizard2DocAssign.odb; NewAccessDatabase, MyDocAssign baseLocation ); "DataSourceName", "db1");
- // /--/curproperties[0] = Properties.createProperty("DatabaseLocation", "file:///x:/bc/MyHSQL Database.odb"); //MyDBase; Mydbwizard2DocAssign.odb; MyDBase.odb, Mydbwizard2DocAssign.odb ; Mydbwizard2DocAssign.odb; NewAccessDatabase, baseLocation ); "DataSourceName", "db1");
- // curproperties[0] = Properties.createProperty("DataSourceName", "Bibliography");
- // curproperties[0] = Properties.createProperty("DataSourceName", "Bibliography");
- // Bibliography* CurTableWizard.startTableWizard(xLocMSF, curproperties);
-
- CurFormWizard.startFormWizard(xLocMSF, curproperties);
- }
- }
- catch (Exception exception)
- {
- exception.printStackTrace(System.out);
- }
- }
-*/
-
public void buildSteps() throws NoValidPathException
{
curDBCommandFieldSelection = new CommandFieldSelection(this, curFormDocument.oMainFormDBMetaData, 92, slblFields, slblSelFields, slblTables, true, 34411);
@@ -317,14 +288,14 @@ public class FormWizard extends WizardDialog
String sNewFormName = curFinalizer.getName();
if (!curFormDocument.oMainFormDBMetaData.hasFormDocumentByName(sNewFormName))
{
- bFormOpenMode = curFinalizer.getOpenMode();
+ m_openForEditing = curFinalizer.getOpenForEditing();
FormName = curFinalizer.getName();
if (curFormDocument.finalizeForms(CurDataEntrySetter, curFieldLinker, curFormConfiguration))
{
if (curFinalizer.finish())
{
- bcreateForm = true;
+ m_success = true;
xDialog.endExecute();
}
}
@@ -340,7 +311,7 @@ public class FormWizard extends WizardDialog
// @Override
public void cancelWizard()
{
- bcreateForm = false;
+ m_success = false;
xDialog.endExecute();
}
@@ -361,33 +332,29 @@ public class FormWizard extends WizardDialog
setCurrentRoadmapItemID((short) 1);
}
- public XComponent[] startFormWizard(XMultiServiceFactory _xMSF, PropertyValue[] CurPropertyValue)
+ public void startFormWizard()
{
- XComponent[] ret = null;
try
{
curFormDocument = new FormDocument(xMSF);
- if (curFormDocument.oMainFormDBMetaData.getConnection(CurPropertyValue))
+ if ( curFormDocument.oMainFormDBMetaData.getConnection( m_wizardContext ) )
{
curFormDocument.oSubFormDBMetaData.getConnection(new PropertyValue[]
{
Properties.createProperty("ActiveConnection", curFormDocument.oMainFormDBMetaData.DBConnection)
});
curFormDocument.xProgressBar.setValue(20);
- // SystemDialog.showMessageBox(xMSF, "FormName", 0, "slblFields");
buildSteps();
- // SystemDialog.showMessageBox(xMSF, "FormName", 0, "slblFields");
- this.curDBCommandFieldSelection.preselectCommand(CurPropertyValue, false);
+ this.curDBCommandFieldSelection.preselectCommand( m_wizardContext, false );
XWindowPeer xWindowPeer2 = createWindowPeer(curFormDocument.xWindowPeer);
- curFormDocument.oMainFormDBMetaData.setWindowPeer(xWindowPeer2 /* xControl.getPeer() */ );
- // setAutoMnemonic("lblDialogHeader", false);
+ curFormDocument.oMainFormDBMetaData.setWindowPeer( xWindowPeer2 );
insertFormRelatedSteps();
- short RetValue = executeDialog(curFormDocument.xFrame);
+ short dialogReturn = executeDialog(curFormDocument.xFrame);
xComponent.dispose();
- if (bcreateForm)
+ if ( ( dialogReturn == 0 ) && m_success )
{
- curFormDocument.oMainFormDBMetaData.addFormDocument(curFormDocument.xComponent);
- ret = curFormDocument.oMainFormDBMetaData.openFormDocument(FormName, bFormOpenMode);
+ curFormDocument.oMainFormDBMetaData.addFormDocument( curFormDocument.xComponent );
+ loadSubComponent( DatabaseObject.FORM, FormName, m_openForEditing );
}
}
}
@@ -395,11 +362,10 @@ public class FormWizard extends WizardDialog
{
jexception.printStackTrace(System.out);
}
- if ((!bcreateForm) && (curFormDocument != null))
+ if ((!m_success) && (curFormDocument != null))
{
OfficeDocument.close(curFormDocument.xComponent);
}
- return ret;
}
private boolean getFormResources()
diff --git a/wizards/com/sun/star/wizards/report/CallReportWizard.java b/wizards/com/sun/star/wizards/report/CallReportWizard.java
index 82c405747ad8..424e117c4d4f 100644
--- a/wizards/com/sun/star/wizards/report/CallReportWizard.java
+++ b/wizards/com/sun/star/wizards/report/CallReportWizard.java
@@ -30,14 +30,12 @@
package com.sun.star.wizards.report;
import com.sun.star.beans.PropertyValue;
-import com.sun.star.beans.PropertyAttribute;
import com.sun.star.uno.Type;
import com.sun.star.uno.UnoRuntime;
import com.sun.star.text.XTextDocument;
import com.sun.star.wizards.common.Properties;
-import com.sun.star.lang.XComponent;
-import com.sun.star.lang.XMultiServiceFactory;
-import com.sun.star.wizards.common.Desktop;
+import com.sun.star.sdb.application.XDatabaseDocumentUI;
+import com.sun.star.wizards.common.NamedValueCollection;
/** This class capsulates the class, that implements the minimal component, a
* factory for creating the service (<CODE>__getServiceFactory</CODE>) and a
@@ -50,7 +48,7 @@ public class CallReportWizard
static boolean bWizardstartedalready;
- public static void main(String args[])
+/* public static void main(String args[])
{
String ConnectStr = "uno:pipe,name=fs93730;urp;StarOffice.ServiceManager";
try
@@ -61,15 +59,15 @@ public class CallReportWizard
PropertyValue[] curproperties = new PropertyValue[1];
curproperties[0] = Properties.createProperty("DataSourceName", "countries");
- ReportWizard wizard = new ReportWizard(orb);
- wizard.startReportWizard(orb, curproperties);
+ ReportWizard wizard = new ReportWizard( orb, curproperties );
+ wizard.startReportWizard();
}
}
catch (java.lang.Exception jexception)
{
jexception.printStackTrace(System.out);
}
- }
+ }*/
/** Gives a factory for creating the service.
* This method is called by the <code>JavaLoader</code>
@@ -121,9 +119,7 @@ public class CallReportWizard
public 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.lang.XTypeProvider, com.sun.star.task.XJobExecutor
{
- PropertyValue[] databaseproperties;
- public XComponent DocumentDefinition = null;
- public XComponent Document = null;
+ private PropertyValue[] m_wizardContext;
/** The constructor of the inner class has a XMultiServiceFactory parameter.
* @param xmultiservicefactoryInitialization A special service factory
@@ -133,59 +129,32 @@ public class CallReportWizard
{
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)
{
if (bWizardstartedalready != true)
{
- ReportWizard CurReportWizard = new ReportWizard(xmultiservicefactory);
- XComponent[] obj = CurReportWizard.startReportWizard(xmultiservicefactory, databaseproperties);
- if (obj != null)
- {
- DocumentDefinition = obj[0];
- if (obj.length > 1)
- {
- Document = obj[1];
- }
- else
- {
- Document = null;
- }
- }
+ ReportWizard CurReportWizard = new ReportWizard( xmultiservicefactory, m_wizardContext );
+ CurReportWizard.startReportWizard();
}
bWizardstartedalready = false;
}
- else if (sEvent.compareTo("end") == 0)
- {
- DocumentDefinition = null;
- Document = null;
- databaseproperties = null;
- }
else if (sEvent.compareTo("fill") == 0)
{
Dataimport CurDataimport = new Dataimport(xmultiservicefactory);
- XTextDocument xTextDocument = null;
- if (databaseproperties != null)
+ if (m_wizardContext != null)
{
- for (int i = 0; i < databaseproperties.length; ++i)
- {
- if (databaseproperties[i].Name.equals("TextDocument"))
- {
- xTextDocument = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, databaseproperties[i].Value);
- }
-
- }
- if (xTextDocument != null)
+ 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, xTextDocument, databaseproperties);
+ CurDataimport.createReport(xmultiservicefactory, documentUI, textDocument, m_wizardContext);
}
}
}
@@ -212,7 +181,7 @@ public class CallReportWizard
*/
public void initialize(Object[] object) throws com.sun.star.uno.Exception
{
- this.databaseproperties = Properties.convertToPropertyValueArray(object);
+ this.m_wizardContext = Properties.convertToPropertyValueArray(object);
// xmultiservicefactory = (XMultiservicefactory) UnoRuntime.queryInterface(XMultiServiceFactory.class, object[0]);
}
diff --git a/wizards/com/sun/star/wizards/report/Dataimport.java b/wizards/com/sun/star/wizards/report/Dataimport.java
index d0f6c4a0ceca..067e14d496a5 100644
--- a/wizards/com/sun/star/wizards/report/Dataimport.java
+++ b/wizards/com/sun/star/wizards/report/Dataimport.java
@@ -31,6 +31,7 @@ package com.sun.star.wizards.report;
import com.sun.star.beans.PropertyValue;
import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.sdb.application.XDatabaseDocumentUI;
import com.sun.star.text.XTextDocument;
import com.sun.star.wizards.ui.*;
@@ -214,11 +215,10 @@ public class Dataimport extends UnoDialog2 implements com.sun.star.awt.XActionLi
CurReportDocument.getRecordParser().dispose();
}
- public void createReport(final XMultiServiceFactory xMSF, XTextDocument _textDocument, PropertyValue[] properties)
+ public void createReport( XMultiServiceFactory xMSF, XDatabaseDocumentUI i_documentUI, XTextDocument _textDocument,
+ PropertyValue[] properties)
{
- // CurReportDocument = new ReportTextDocument(xMSF, _textDocument,m_oResource);
- CurReportDocument = ReportTextImplementation.create(xMSF, _textDocument, m_oResource);
-// CurProperties = properties;
+ CurReportDocument = ReportTextImplementation.create( xMSF, i_documentUI, _textDocument, m_oResource );
showProgressDisplay(xMSF, true);
importReportData(xMSF, this, CurReportDocument, properties);
}
diff --git a/wizards/com/sun/star/wizards/report/IReportDocument.java b/wizards/com/sun/star/wizards/report/IReportDocument.java
index af8476f5c3e9..7629b6f54ffd 100644
--- a/wizards/com/sun/star/wizards/report/IReportDocument.java
+++ b/wizards/com/sun/star/wizards/report/IReportDocument.java
@@ -34,6 +34,8 @@ package com.sun.star.wizards.report;
import com.sun.star.beans.PropertyValue;
import com.sun.star.lang.XComponent;
import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.sdb.application.XDatabaseDocumentUI;
+import com.sun.star.wizards.common.Resource;
import java.util.ArrayList;
import java.util.Vector;
@@ -45,15 +47,15 @@ import java.util.Vector;
*/
public interface IReportDocument
{
- // public ReportTextDocument getDoc();
// -------------------------------------------------------------------------
// initialisation
// -------------------------------------------------------------------------
+ public void initialize(
+ final XDatabaseDocumentUI i_documentUI,
+ final Resource i_resource
+ );
// -------------------------------------------------------------------------
- // opening the dialog
- // -------------------------------------------------------------------------
- // -------------------------------------------------------------------------
// Access Helper
// -------------------------------------------------------------------------
/**
@@ -211,7 +213,7 @@ public interface IReportDocument
*
* TODO: add Name to this functionality
*/
- public void addReportToDBView(/* String Name */);
+ public void addReportToDBView();
public void importReportData(ReportWizard aWizard);
@@ -222,7 +224,11 @@ public interface IReportDocument
* @param _bOpenInDesign
* @return
*/
- public XComponent[] createFinalReportDocument(String Name, boolean _bAsTemplate, boolean _bOpenInDesign);
+ public void createAndOpenReportDocument(
+ final String Name,
+ final boolean _bAsTemplate,
+ final boolean _bOpenInDesign
+ );
public void dispose();
// -------------------------------------------------------------------------
diff --git a/wizards/com/sun/star/wizards/report/ReportTextImplementation.java b/wizards/com/sun/star/wizards/report/ReportTextImplementation.java
index 3d79c5d2d8ac..53d7e75dd006 100644
--- a/wizards/com/sun/star/wizards/report/ReportTextImplementation.java
+++ b/wizards/com/sun/star/wizards/report/ReportTextImplementation.java
@@ -34,13 +34,16 @@ package com.sun.star.wizards.report;
import com.sun.star.awt.VclWindowPeerAttribute;
import com.sun.star.awt.XWindowPeer;
import com.sun.star.beans.PropertyValue;
+import com.sun.star.container.NoSuchElementException;
import com.sun.star.container.XNameAccess;
import com.sun.star.container.XNameContainer;
import com.sun.star.container.XNamed;
+import com.sun.star.frame.XController;
import com.sun.star.frame.XFrame;
-// import com.sun.star.lang.IllegalArgumentException;
+import com.sun.star.lang.IllegalArgumentException;
import com.sun.star.lang.XComponent;
import com.sun.star.sdb.CommandType;
+import com.sun.star.sdbc.SQLException;
import com.sun.star.table.XCellRange;
import com.sun.star.text.XTextContent;
import com.sun.star.text.XTextCursor;
@@ -56,6 +59,8 @@ import com.sun.star.wizards.common.JavaTools;
import com.sun.star.wizards.common.Resource;
import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.sdb.application.DatabaseObject;
+import com.sun.star.sdb.application.XDatabaseDocumentUI;
import com.sun.star.wizards.common.SystemDialog;
import com.sun.star.wizards.db.DBMetaData;
import com.sun.star.wizards.db.SQLQueryComposer;
@@ -63,6 +68,8 @@ import com.sun.star.wizards.document.OfficeDocument;
import com.sun.star.wizards.ui.UIConsts;
import java.util.ArrayList;
import java.util.Vector;
+import java.util.logging.Level;
+import java.util.logging.Logger;
/**
*
@@ -71,11 +78,12 @@ import java.util.Vector;
public class ReportTextImplementation extends ReportImplementationHelper implements IReportDocument
{
- private ReportTextDocument m_aDoc;
- private Object m_aInitialDoc;
- private Resource m_aResource;
+ private ReportTextDocument m_aDoc;
+ private Object m_aInitialDoc;
+ private Resource m_resource;
+ private XDatabaseDocumentUI m_documentUI;
- public void setInitialDocument(Object _aDoc)
+ private void setInitialDocument(Object _aDoc)
{
m_aInitialDoc = _aDoc;
}
@@ -91,15 +99,15 @@ public class ReportTextImplementation extends ReportImplementationHelper impleme
{
if (m_aInitialDoc instanceof XTextDocument)
{
- m_aDoc = new ReportTextDocument(getMSF(), (XTextDocument) m_aInitialDoc, m_aResource, getRecordParser());
+ m_aDoc = new ReportTextDocument(getMSF(), (XTextDocument) m_aInitialDoc, m_resource, getRecordParser());
}
else if (m_aInitialDoc instanceof String)
{
- m_aDoc = new ReportTextDocument(getMSF(), (String) m_aInitialDoc, m_aResource, getRecordParser());
+ m_aDoc = new ReportTextDocument(getMSF(), (String) m_aInitialDoc, m_resource, getRecordParser());
}
else
{
- throw new RuntimeException("Unknown type for setInitialDoc() given.");
+ throw new RuntimeException("Unknown type for setInitialDocument() given.");
}
}
return m_aDoc;
@@ -107,40 +115,37 @@ public class ReportTextImplementation extends ReportImplementationHelper impleme
public void clearDocument()
{
- int dummy = 0;
- /*CurReportDocument.*/ getDoc().oTextSectionHandler.removeAllTextSections();
- /*CurReportDocument.*/ getDoc().oTextTableHandler.removeAllTextTables();
- /*CurReportDocument.*/ getDoc().DBColumnsVector = new Vector();
- //getRecordParser().setGroupFieldNames(new String[]{});
- // CurGroupFieldHandler.removeGroupFieldNames();
+ getDoc().oTextSectionHandler.removeAllTextSections();
+ getDoc().oTextTableHandler.removeAllTextTables();
+ getDoc().DBColumnsVector = new Vector();
}
- private ReportTextImplementation(XMultiServiceFactory _xMSF, Resource _oResource)
+ protected ReportTextImplementation( XMultiServiceFactory i_serviceFactory )
{
- super(_xMSF, ReportLayouter.SOOPTLANDSCAPE);
- m_aResource = _oResource;
+ super( i_serviceFactory, ReportLayouter.SOOPTLANDSCAPE );
}
- static IReportDocument create(XMultiServiceFactory _xMSF /*, String _sPreviewURL */, Resource _oResource)
+ public void initialize( final XDatabaseDocumentUI i_documentUI, final Resource i_resource )
{
- ReportTextImplementation a = new ReportTextImplementation(_xMSF, _oResource);
- String sPreviewURL = a.getLayoutPath(); // a.getReportPath() + "/stl-default.ott";
- a.setInitialDocument(sPreviewURL);
- a.initialResources();
- return a;
+ m_documentUI = i_documentUI;
+ m_resource = i_resource;
+
+ if ( m_aInitialDoc == null )
+ setInitialDocument( getLayoutPath() );
+
+ initialResources();
}
- static IReportDocument create(XMultiServiceFactory _xMSF, XTextDocument _aDoc, Resource _oResource)
+ static IReportDocument create( XMultiServiceFactory i_serviceFactory, XDatabaseDocumentUI i_documentUI, XTextDocument i_initialDocument, Resource i_resources )
{
- ReportTextImplementation a = new ReportTextImplementation(_xMSF, _oResource);
- a.setInitialDocument(_aDoc);
- a.initialResources();
+ ReportTextImplementation a = new ReportTextImplementation( i_serviceFactory );
+ a.setInitialDocument(i_initialDocument);
+ a.initialize( i_documentUI, i_resources );
return a;
}
public XWindowPeer getWizardParent()
{
- // throw new UnsupportedOperationException("Not supported yet.");
return getDoc().xWindowPeer;
}
static String sMsgQueryCreationImpossible;
@@ -153,11 +158,11 @@ public class ReportTextImplementation extends ReportImplementationHelper impleme
private void initialResources()
{
- sReportFormNotExisting = m_aResource.getResText(UIConsts.RID_REPORT + 64);
- sMsgQueryCreationImpossible = m_aResource.getResText(UIConsts.RID_REPORT + 65);
- sMsgHiddenControlMissing = m_aResource.getResText(UIConsts.RID_REPORT + 66);
- sMsgEndAutopilot = m_aResource.getResText(UIConsts.RID_DB_COMMON + 33);
- sMsgNoConnection = m_aResource.getResText(UIConsts.RID_DB_COMMON + 14);
+ sReportFormNotExisting = m_resource.getResText(UIConsts.RID_REPORT + 64);
+ sMsgQueryCreationImpossible = m_resource.getResText(UIConsts.RID_REPORT + 65);
+ sMsgHiddenControlMissing = m_resource.getResText(UIConsts.RID_REPORT + 66);
+ sMsgEndAutopilot = m_resource.getResText(UIConsts.RID_DB_COMMON + 33);
+ sMsgNoConnection = m_resource.getResText(UIConsts.RID_DB_COMMON + 14);
}
public void addTextSectionCopies()
@@ -185,8 +190,8 @@ public class ReportTextImplementation extends ReportImplementationHelper impleme
try
{
XInterface xTextSection = (XInterface) getDocumentServiceFactory().createInstance("com.sun.star.text.TextSection");
- XTextContent xTextSectionContent = (XTextContent) UnoRuntime.queryInterface(XTextContent.class, xTextSection);
- xNamedTextSection = (XNamed) UnoRuntime.queryInterface(XNamed.class, xTextSection);
+ XTextContent xTextSectionContent = UnoRuntime.queryInterface( XTextContent.class, xTextSection );
+ xNamedTextSection = UnoRuntime.queryInterface( XNamed.class, xTextSection );
xTextCursor.gotoEnd(false);
xTextCursor.getText().insertTextContent(xTextCursor, xTextSectionContent, true);
Helper.setUnoPropertyValue(xTextSection, "LinkRegion", sLinkRegion);
@@ -196,7 +201,7 @@ public class ReportTextImplementation extends ReportImplementationHelper impleme
if (bIsGroupTable == true)
{
XTextTable xTextTable = getDoc().oTextTableHandler.getlastTextTable();
- XCellRange xCellRange = (XCellRange) UnoRuntime.queryInterface(XCellRange.class, xTextTable);
+ XCellRange xCellRange = UnoRuntime.queryInterface( XCellRange.class, xTextTable );
CurDBColumn.modifyCellContent(xCellRange, CurGroupValue);
}
}
@@ -211,7 +216,7 @@ public class ReportTextImplementation extends ReportImplementationHelper impleme
private void renameTableofLastSection(String _snewname)
{
XTextTable xTextTable = getDoc().oTextTableHandler.getlastTextTable();
- XNamed xNamedTable = (XNamed) UnoRuntime.queryInterface(XNamed.class, xTextTable);
+ XNamed xNamedTable = UnoRuntime.queryInterface( XNamed.class, xTextTable );
xNamedTable.setName(_snewname);
}
@@ -231,7 +236,7 @@ public class ReportTextImplementation extends ReportImplementationHelper impleme
if (oDBForm != null)
{
String sMsg = sMsgHiddenControlMissing + (char) 13 + sMsgEndAutopilot;
- XNameAccess xNamedForm = (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, oDBForm);
+ XNameAccess xNamedForm = UnoRuntime.queryInterface( XNameAccess.class, oDBForm );
getRecordParser().Command = getDoc().oFormHandler.getValueofHiddenControl(xNamedForm, "Command", sMsg);
String sCommandType = getDoc().oFormHandler.getValueofHiddenControl(xNamedForm, "CommandType", sMsg);
String sGroupFieldNames = getDoc().oFormHandler.getValueofHiddenControl(xNamedForm, "GroupFieldNames", sMsg);
@@ -346,7 +351,7 @@ public class ReportTextImplementation extends ReportImplementationHelper impleme
{
CurGroupTableName = ReportTextDocument.TBLGROUPSECTION + Integer.toString(ColIndex + 1);
oTable = getDoc().oTextTableHandler.xTextTablesSupplier.getTextTables().getByName(CurGroupTableName);
- xGroupBaseTables[ColIndex] = (XTextTable) UnoRuntime.queryInterface(XTextTable.class, oTable);
+ xGroupBaseTables[ColIndex] = UnoRuntime.queryInterface( XTextTable.class, oTable );
CurGroupValue = getRecordParser().getGroupColumnValue(ColIndex);
OldGroupFieldValues[ColIndex] = CurGroupValue;
CurDBColumn = (DBColumn) getDoc().DBColumnsVector.elementAt(ColIndex);
@@ -574,24 +579,23 @@ public class ReportTextImplementation extends ReportImplementationHelper impleme
public void liveupdate_updateReportTitle(String _sTitleName)
{
- int dummy = 0;
- // getDoc().updateReportTitle(_sTitleName);
}
-// public void finish()
-// {
-// throw new UnsupportedOperationException("Not supported yet.");
-// }
public void addReportToDBView()
{
getRecordParser().addReportDocument(getComponent(), true);
}
- public XComponent[] createFinalReportDocument(String sReportName, boolean _bAsTemplate, boolean _bOpenInDesign)
+ public void createAndOpenReportDocument( String sReportName, boolean _bAsTemplate, boolean _bOpenInDesign )
{
- // create the real report document, filled with content
- XComponent[] ret = getRecordParser().openReportDocument(sReportName, _bAsTemplate, _bOpenInDesign);
- return ret;
+ try
+ {
+ m_documentUI.loadComponent( DatabaseObject.REPORT, sReportName, _bOpenInDesign );
+ }
+ catch ( Exception ex )
+ {
+ Logger.getLogger( ReportTextImplementation.class.getName() ).log( Level.SEVERE, null, ex );
+ }
}
public void initializeFieldColumns(final int _nType, final String TableName, final String[] FieldNames)
@@ -715,8 +719,7 @@ public class ReportTextImplementation extends ReportImplementationHelper impleme
public void importReportData(ReportWizard _aWizard)
{
Dataimport CurDataimport = new Dataimport(_aWizard.xMSF);
- CurDataimport.CurReportDocument = _aWizard.CurReportDocument;
- // CurDataimport.showProgressDisplay(xMSF, false);
+ CurDataimport.CurReportDocument = this;
_aWizard.importReportData(_aWizard.xMSF, CurDataimport);
}
@@ -728,7 +731,6 @@ public class ReportTextImplementation extends ReportImplementationHelper impleme
public void setCommand(String _sCommand)
{
getRecordParser().Command = _sCommand;
- // throw new UnsupportedOperationException("Not supported yet.");
}
public void checkInvariants() throws java.lang.Exception
diff --git a/wizards/com/sun/star/wizards/report/ReportWizard.java b/wizards/com/sun/star/wizards/report/ReportWizard.java
index a4b4e3af18ad..245e3716be04 100644
--- a/wizards/com/sun/star/wizards/report/ReportWizard.java
+++ b/wizards/com/sun/star/wizards/report/ReportWizard.java
@@ -32,24 +32,15 @@ package com.sun.star.wizards.report;
// import java.util.Vector;
-// import com.sun.star.wizards.reportbuilder.ReportBuilderImplementation;
-import com.sun.star.awt.Size;
import com.sun.star.awt.TextEvent;
import com.sun.star.awt.VclWindowPeerAttribute;
-import com.sun.star.awt.XControl;
-import com.sun.star.awt.XControlModel;
-import com.sun.star.awt.XFixedText;
-import com.sun.star.awt.XLayoutConstrains;
import com.sun.star.awt.XTextListener;
-import com.sun.star.awt.XWindow;
import com.sun.star.beans.PropertyValue;
-// import com.sun.star.beans.XPropertySet;
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.lang.XServiceInfo;
import com.sun.star.logging.XLogger;
import com.sun.star.logging.XLoggerPool;
import com.sun.star.sdb.CommandType;
@@ -57,39 +48,40 @@ import com.sun.star.sdb.CommandType;
import com.sun.star.uno.AnyConverter;
import com.sun.star.uno.UnoRuntime;
import com.sun.star.uno.XComponentContext;
-import com.sun.star.wizards.common.*;
-import com.sun.star.wizards.ui.*;
-import com.sun.star.wizards.db.*;
-import com.sun.star.lang.XComponent;
+import com.sun.star.logging.LogLevel;
+import com.sun.star.wizards.common.Helper;
+import com.sun.star.wizards.common.JavaTools;
+import com.sun.star.wizards.common.Resource;
+import com.sun.star.wizards.common.SystemDialog;
+import com.sun.star.wizards.db.DBMetaData;
+import com.sun.star.wizards.db.DatabaseObjectWizard;
+import com.sun.star.wizards.db.SQLQueryComposer;
+import com.sun.star.wizards.ui.CommandFieldSelection;
+import com.sun.star.wizards.ui.FieldSelection;
+import com.sun.star.wizards.ui.SortingComponent;
+import com.sun.star.wizards.ui.TitlesComponent;
+import com.sun.star.wizards.ui.UIConsts;
+import com.sun.star.wizards.ui.UnoDialog;
+import com.sun.star.wizards.ui.XCompletion;
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 WizardDialog implements XTextListener, XCompletion
+public class ReportWizard extends DatabaseObjectWizard implements XTextListener, XCompletion
{
- // XMultiServiceFactory xMSF;
- // QueryMetaData CurDBMetaData;
protected FieldSelection CurGroupFieldSelection;
private SortingComponent CurSortingComponent;
- // private UnoDialog CurUnoProgressDialog;
private TitlesComponent CurTitlesComponent;
private CommandFieldSelection CurDBCommandFieldSelection;
private GroupFieldHandler CurGroupFieldHandler;
private ReportLayouter CurReportLayouter;
private ReportFinalizer CurReportFinalizer;
- private PropertyValue[] DBGPROPERTYVALUE;
- // private String sCommandName = "";
- // private int nCommandType = -1;
private int nReportMode = ReportFinalizer.SOCREATEDOCUMENT;
private String m_sReportName = "";
protected static final String SOREPORTFORMNAME = "ReportSource";
- // private final int SOSELGROUPLST = 33;
- // private final int SOTXTCOLTITLE = 48;
- // private final int SOTITLESCROLLBAR = 49;
- // private static final int SONULLPAGE = 0;
private static final int SOMAINPAGE = 1;
private static final int SOTITLEPAGE = 2;
protected static final int SOGROUPPAGE = 3;
@@ -97,36 +89,21 @@ public class ReportWizard extends WizardDialog implements XTextListener, XComple
protected static final int SOTEMPLATEPAGE = 5;
protected static final int SOSTOREPAGE = 6;
- // ReportTextDocument CurReportDocument;
- // ReportTextImplementation CurReportDocument;
- protected IReportDocument CurReportDocument;
+ private IReportDocument m_reportDocument;
private static String sMsgWizardName;
private static String slblFields;
private static String slblSelFields;
private static String sShowBinaryFields;
- // private static String sGroupings;
private String[] WizardHeaderText = new String[6];
- // private static String[] WizardTitle = new String[6];
- // private static String sWriterFilterName;
- private static String slstDatabasesDefaultText;
- private static String slstTablesDefaultText;
- private static String sMsgErrorOccured;
- private static String sMsgSavingImpossible;
- // private static String sMsgNoConnection;
- // Progress display relevant Strings
private static String slblColumnTitles;
private static String slblColumnNames;
- private static String sMsgNoConnectionforDataimport;
- private static String sMsgQueryCreationImpossible;
- private static String sMsgFilePathInvalid;
private static String slblTables;
-// public static String sBlindTextNote;
protected static boolean bCloseDocument;
private boolean bHasEscapeProcessing = true;
- public ReportWizard(XMultiServiceFactory xMSF)
+ public ReportWizard( XMultiServiceFactory i_serviceFactory, final PropertyValue[] i_wizardContext )
{
- super(xMSF, 34320);
+ super(i_serviceFactory, 34320, i_wizardContext );
super.addResourceHandler("Report Wizard", "dbw");
if (getReportResources(false) == true)
{
@@ -166,7 +143,7 @@ public class ReportWizard extends WizardDialog implements XTextListener, XComple
{
// CurReportDocument.getDoc().oTextSectionHandler.removeTextSectionbyName("RecordSection");
// CurReportDocument.getDoc().oTextTableHandler.removeTextTablebyName("Tbl_RecordSection");
- CurReportDocument.removeTextTableAndTextSection();
+ m_reportDocument.removeTextTableAndTextSection();
}
switch (nNewStep)
{
@@ -175,8 +152,8 @@ public class ReportWizard extends WizardDialog implements XTextListener, XComple
break;
case SOTITLEPAGE:
- String[] aFieldNames = CurReportDocument.getRecordParser().getFieldNames();
- Map aFieldTitleSet = CurReportDocument.getRecordParser().getFieldTitleSet();
+ String[] aFieldNames = m_reportDocument.getRecordParser().getFieldNames();
+ Map aFieldTitleSet = m_reportDocument.getRecordParser().getFieldTitleSet();
CurTitlesComponent.initialize(aFieldNames, aFieldTitleSet);
break;
@@ -185,10 +162,10 @@ public class ReportWizard extends WizardDialog implements XTextListener, XComple
break;
case SOSORTPAGE:
- String[] aFieldNames2 = CurReportDocument.getRecordParser().getFieldNames();
- String[][] aSortFieldNames = CurReportDocument.getRecordParser().getSortFieldNames();
+ String[] aFieldNames2 = m_reportDocument.getRecordParser().getFieldNames();
+ String[][] aSortFieldNames = m_reportDocument.getRecordParser().getSortFieldNames();
CurSortingComponent.initialize(aFieldNames2, aSortFieldNames);
- int nLength = CurReportDocument.getRecordParser().GroupFieldNames.length;
+ int nLength = m_reportDocument.getRecordParser().GroupFieldNames.length;
CurSortingComponent.setReadOnlyUntil(nLength, false);
break;
@@ -197,7 +174,7 @@ public class ReportWizard extends WizardDialog implements XTextListener, XComple
case SOSTOREPAGE:
//TODO initialize with suitable PathName
- CurReportFinalizer.initialize(CurReportDocument.getRecordParser());
+ CurReportFinalizer.initialize(m_reportDocument.getRecordParser());
break;
default:
@@ -213,23 +190,13 @@ public class ReportWizard extends WizardDialog implements XTextListener, XComple
case SOMAINPAGE:
String[] aSelectedFieldNames = CurDBCommandFieldSelection.getSelectedFieldNames();
String aTableName = CurDBCommandFieldSelection.getSelectedCommandName();
- // set all selected field names, DB Table name
- // CurReportDocument.getRecordParser().initializeFieldColumns(aSelectedFieldNames, aTableName);
int nType = CurDBCommandFieldSelection.getSelectedCommandType();
- // nType = com.sun.star.sdb.CommandType.TABLE;
- CurReportDocument.initializeFieldColumns(nType, aTableName, aSelectedFieldNames);
- // CurReportDocument.initializeFieldColumns(aSelectedFieldNames, aSelectedCommandName);
- // CurReportDocument.getRecordParser().setAllIncludedFieldNames(false);
+ m_reportDocument.initializeFieldColumns(nType, aTableName, aSelectedFieldNames);
if (CurDBCommandFieldSelection.isModified())
{
// cleanup document
- CurReportDocument.clearDocument();
- // CurReportDocument.getDoc().oTextSectionHandler.removeAllTextSections();
- // CurReportDocument.getDoc().oTextTableHandler.removeAllTextTables();
- // CurReportDocument.getDoc().DBColumnsVector = new Vector();
- CurReportDocument.getRecordParser().setGroupFieldNames(new String[]
- {
- });
+ m_reportDocument.clearDocument();
+ m_reportDocument.getRecordParser().setGroupFieldNames(new String[]{});
CurGroupFieldHandler.removeGroupFieldNames();
}
break;
@@ -238,21 +205,21 @@ public class ReportWizard extends WizardDialog implements XTextListener, XComple
String[] sFieldTitles = CurTitlesComponent.getFieldTitles();
// set new field name titles
// CurReportDocument.getRecordParser().setFieldTitles(sFieldTitles);
- CurReportDocument.setFieldTitles(sFieldTitles);
+ m_reportDocument.setFieldTitles(sFieldTitles);
break;
case SOGROUPPAGE:
// TODO: DESIGN!!! a getter should return a value!!!
- CurGroupFieldHandler.getGroupFieldNames(CurReportDocument.getRecordParser());
- String[] aGroupFieldNames = CurReportDocument.getRecordParser().GroupFieldNames;
+ CurGroupFieldHandler.getGroupFieldNames(m_reportDocument.getRecordParser());
+ String[] aGroupFieldNames = m_reportDocument.getRecordParser().GroupFieldNames;
// CurReportDocument.getRecordParser().prependSortFieldNames(aGroupFieldNames);
- CurReportDocument.setGrouping(aGroupFieldNames);
+ m_reportDocument.setGrouping(aGroupFieldNames);
break;
case SOSORTPAGE:
String[][] aSortFieldNames = CurSortingComponent.getSortFieldNames();
// CurReportDocument.getRecordParser().SortFieldNames = aSortFieldNames;
- CurReportDocument.setSorting(aSortFieldNames);
+ m_reportDocument.setSorting(aSortFieldNames);
// TODO: why do we make a switch here
super.enablefromStep(SOTEMPLATEPAGE, true);
break;
@@ -270,58 +237,33 @@ public class ReportWizard extends WizardDialog implements XTextListener, XComple
if ((nOldStep < SOTEMPLATEPAGE) && (super.getNewStep() >= SOTEMPLATEPAGE))
{
// this is called before SOTEMPLATEPAGE, after SOGROUPPAGE
- CurReportDocument.getRecordParser().createRecordFieldNames();
- CurReportLayouter.initialize(CurReportDocument.getContentPath());
+ m_reportDocument.getRecordParser().createRecordFieldNames();
+ CurReportLayouter.initialize(m_reportDocument.getContentPath());
}
}
- private XComponent[] dialogFinish(short RetValue)
+ private void dialogFinish()
{
- XComponent[] ret = null;
- // Report Wizard Dialog is done.
- boolean bdisposeDialog = true;
- switch (RetValue)
- {
- case 0:
- // via Cancelbutton or via sourceCode with "endExecute"
- this.xComponent.dispose();
- if (bCloseDocument == true)
- {
- // OfficeDocument.dispose(xMSF, CurReportDocument.getDoc().xComponent);
- CurReportDocument.dispose();
- return ret;
- }
- if ((nReportMode == ReportFinalizer.SOCREATETEMPLATE) || (nReportMode == ReportFinalizer.SOUSETEMPLATE))
- {
- bdisposeDialog = false;
- // Add Report to the DB View
- // old: CurReportDocument.getRecordParser().addReportDocument(CurReportDocument.getComponent(), true);
- CurReportDocument.addReportToDBView();
- boolean bOpenInDesign = (nReportMode == ReportFinalizer.SOCREATETEMPLATE);
- // Create Report
- // old: ret = CurReportDocument.getRecordParser().openReportDocument(sReportName, true, bOpenInDesign);
- ret = CurReportDocument.createFinalReportDocument(m_sReportName, true, bOpenInDesign);
- }
- else
- {
- bdisposeDialog = false;
- CurReportDocument.importReportData(this);
- // Dataimport CurDataimport = new Dataimport(xMSF);
- // CurDataimport.CurReportDocument = CurReportDocument;
- // CurDataimport.showProgressDisplay(xMSF, false);
- // importReportData(xMSF, CurDataimport);
- // old: ret = CurReportDocument.getRecordParser().openReportDocument(sReportName, false, false);
- ret = CurReportDocument.createFinalReportDocument(m_sReportName, false, false);
- }
- return ret;
- case 1:
- if (bdisposeDialog == true)
- {
- // CurReportDocument.getDoc().unlockallControllers();
- }
- break;
+ this.xComponent.dispose();
+ if (bCloseDocument == true)
+ {
+ m_reportDocument.dispose();
+ return;
+ }
+
+ if ( ( nReportMode == ReportFinalizer.SOCREATETEMPLATE )
+ || ( nReportMode == ReportFinalizer.SOUSETEMPLATE )
+ )
+ {
+ m_reportDocument.addReportToDBView();
+ boolean bOpenInDesign = (nReportMode == ReportFinalizer.SOCREATETEMPLATE);
+ m_reportDocument.createAndOpenReportDocument( m_sReportName, true, bOpenInDesign);
+ }
+ else
+ {
+ m_reportDocument.importReportData(this);
+ m_reportDocument.createAndOpenReportDocument( m_sReportName, false, false );
}
- return null;
}
private boolean executeQuery()
@@ -329,35 +271,35 @@ public class ReportWizard extends WizardDialog implements XTextListener, XComple
boolean bQueryCreated = false;
if (this.CurDBCommandFieldSelection.getSelectedCommandType() == CommandType.TABLE)
{
- bQueryCreated = CurReportDocument.getRecordParser().oSQLQueryComposer.setQueryCommand(sMsgWizardName, this.xWindow, false, false);
+ bQueryCreated = m_reportDocument.getRecordParser().oSQLQueryComposer.setQueryCommand(sMsgWizardName, this.xWindow, false, false);
- CurReportDocument.setCommandType(CommandType.COMMAND);
- String sQuery = CurReportDocument.getRecordParser().oSQLQueryComposer.getQuery();
- CurReportDocument.setCommand(sQuery);
+ m_reportDocument.setCommandType(CommandType.COMMAND);
+ String sQuery = m_reportDocument.getRecordParser().oSQLQueryComposer.getQuery();
+ m_reportDocument.setCommand(sQuery);
}
else
{
try
{
String sQueryName = CurDBCommandFieldSelection.getSelectedCommandName();
- DBMetaData.CommandObject oCommand = CurReportDocument.getRecordParser().getQueryByName(sQueryName);
- bHasEscapeProcessing = CurReportDocument.getRecordParser().hasEscapeProcessing(oCommand.getPropertySet());
+ DBMetaData.CommandObject oCommand = m_reportDocument.getRecordParser().getQueryByName(sQueryName);
+ bHasEscapeProcessing = m_reportDocument.getRecordParser().hasEscapeProcessing(oCommand.getPropertySet());
String sCommand = (String) oCommand.getPropertySet().getPropertyValue("Command");
if (bHasEscapeProcessing)
{
// String sCommand = (String) oCommand.xPropertySet.getPropertyValue("Command");
bQueryCreated = (!sCommand.equals(""));
- CurReportDocument.getRecordParser().oSQLQueryComposer.m_xQueryAnalyzer.setQuery(sCommand);
- CurReportDocument.getRecordParser().oSQLQueryComposer.prependSortingCriteria();
+ m_reportDocument.getRecordParser().oSQLQueryComposer.m_xQueryAnalyzer.setQuery(sCommand);
+ m_reportDocument.getRecordParser().oSQLQueryComposer.prependSortingCriteria();
// TODO: check with query
- CurReportDocument.setCommandType(CommandType.COMMAND);
- CurReportDocument.setCommand(CurReportDocument.getRecordParser().oSQLQueryComposer.getQuery());
+ m_reportDocument.setCommandType(CommandType.COMMAND);
+ m_reportDocument.setCommand(m_reportDocument.getRecordParser().oSQLQueryComposer.getQuery());
bQueryCreated = true;
}
else
{
- CurReportDocument.setCommandType(CommandType.COMMAND);
- CurReportDocument.setCommand(sCommand);
+ m_reportDocument.setCommandType(CommandType.COMMAND);
+ m_reportDocument.setCommand(sCommand);
bQueryCreated = true;
}
}
@@ -372,124 +314,10 @@ public class ReportWizard extends WizardDialog implements XTextListener, XComple
}
return bQueryCreated;
}
-/*
- public static void main(String args[])
- {
- String ConnectStr = "uno:socket,host=localhost,port=8107;urp;StarOffice.NamingService"; //localhost ;Lo-1.Germany.sun.com; 10.16.65.155
- try
- {
- XMultiServiceFactory xLocMSF = com.sun.star.wizards.common.Desktop.connect(ConnectStr);
-
- tests(xLocMSF);
-
- ReportWizard CurReportWizard = new ReportWizard(xLocMSF);
- if (xLocMSF != null)
- {
- System.out.println("Connected to " + ConnectStr);
- PropertyValue[] curproperties = new PropertyValue[1];
- // curproperties[0] = Properties.createProperty(
- // "DatabaseLocation",
- // "file:///localhome/bc93774/NewDatabase2" +
- // "C:/Documents and Settings/ll93751/My Documents/RptWizard01_DB.odb");
- // "file://C:/Documents%20and%20Settings/ll93751/My%20Documents/RptWizard01_DB.odb");
-// "C:/Documents and Settings/bc93774.EHAM02-DEV/My Documents/MyHSQL.odb"); //MyDocAssign.odb; baseLocation ); "DataSourceName", "db1");
- // curproperties[0] = Properties.createProperty("DataSourceName", "Bibliography");
- curproperties[0] = Properties.createProperty("DataSourceName", "RptWizard01_DB");
- CurReportWizard.startReportWizard(xLocMSF, curproperties, true);
- }
- }
- catch (Exception exception)
- {
- exception.printStackTrace(System.out);
- }
- System.exit(1);
- }
-*/
-/*
- private static void tests(XMultiServiceFactory _xMSF)
- {
- try
- {
-// String[] sServices = _xMSF.getAvailableServiceNames();
-// File aFile = new File("C:/temp/services.txt");
-// aFile.delete();
-// FileWriter aRAF = new FileWriter(aFile);
-// for (int i=0;i<sServices.length;i++)
-// {
-// aRAF.write(sServices[i]);
-// aRAF.write("\n");
-// }
-// aRAF.close();
-
-
-// XServiceInfo xServiceInfo = (XServiceInfo)UnoRuntime.queryInterface(XServiceInfo.class, _xMSF);
-// String[] sServices = xServiceInfo.getSupportedServiceNames();
-
-// XControl xControl = (XControl)UnoRuntime.queryInterface(XControl.class, xFormattedField);
-// Object aPeer = xControl.getPeer();
-// XTextConstraints xTC = (XTextConstraints)UnoRuntime.queryInterface(XTextConstraints.class, aPeer);
-// int nHeight = xTC.getTextHeight();
-// int nWidth = xTC.getTextWidth("Blah Fasel");
-
-// Object aTextShapeObj = _xMSF.createInstance("com.sun.star.drawing.TextShape");
-// XText xText = (XText)UnoRuntime.queryInterface(XText.class, aTextShapeObj);
-// xText.setString("Blah fasel");
-//
-// XServiceInfo xServiceInfo2 = (XServiceInfo)UnoRuntime.queryInterface(XServiceInfo.class, aTextShapeObj);
-// String[] sServices2 = xServiceInfo2.getSupportedServiceNames();
-
-// Object aToolkitObj = _xMSF.createInstance("com.sun.star.awt.Toolkit");
-// XToolkit xToolkit = (XToolkit)UnoRuntime.queryInterface(XToolkit.class, aToolkitObj);
-// WindowDescriptor aDescriptor = new WindowDescriptor();
-// aDescriptor.Bounds = new Rectangle(0,0,640,480);
-//
-// XWindowPeer aWindowPeer = xToolkit.createWindow(aDescriptor);
-// XWindow xWindow = (XWindow)UnoRuntime.queryInterface(XWindow.class, aWindowPeer);
-// xWindow.setVisible(true);
-// aWindowPeer.setBackground(0x00000000);
-
- Object aControlContainer = _xMSF.createInstance("com.sun.star.awt.UnoControlContainer");
- // XControlContainer xControlContainer = (XControlContainer)UnoRuntime.queryInterface(XControlContainer.class, aControlContainer);
-
- Object aFixedTextModel = _xMSF.createInstance("com.sun.star.awt.UnoControlFixedTextModel");
- XControlModel xFixedTextModel = (XControlModel) UnoRuntime.queryInterface(XControlModel.class, aFixedTextModel);
-// nicht das Model, sondern gleich den FixedText nehmen??
-
-// XMultiServiceFactory xMSF = (XMultiServiceFactory)UnoRuntime.queryInterface(XMultiServiceFactory.class, xFixedTextModel);
-
- Object aFixedText = _xMSF.createInstance("com.sun.star.awt.UnoControlFixedText");
- XServiceInfo xServiceInfo2 = (XServiceInfo) UnoRuntime.queryInterface(XServiceInfo.class, aFixedText);
- String[] sServices2 = xServiceInfo2.getSupportedServiceNames();
-
- XWindow xWindow = (XWindow) UnoRuntime.queryInterface(XWindow.class, aFixedText);
- xWindow.setVisible(true);
-
- XFixedText xFixedText = (XFixedText) UnoRuntime.queryInterface(XFixedText.class, aFixedText);
- xFixedText.setText("Dies ist ein String");
-
- XControl xControl = (XControl) UnoRuntime.queryInterface(XControl.class, xFixedText);
- xControl.setModel(xFixedTextModel);
-
- XLayoutConstrains xLayoutConstrains = (XLayoutConstrains) UnoRuntime.queryInterface(XLayoutConstrains.class, aFixedText);
- Size aSize = xLayoutConstrains.getPreferredSize();
-
- // xToolkit.createScreenCompatibleDevice(_nWidth, _nWidth).
- // XWindow x = getReportDefinition().getCurrentController().getFrame().getContainerWindow();
- // Object aObj = _xSection.getParent();
- int dummy = 0;
- }
- catch (Exception e)
- {
- int dummy = 0;
- }
-
- }
-*/
-
public void buildSteps()
{
// CurReportDocument.getDoc().xProgressBar.setValue(30);
- CurDBCommandFieldSelection = new CommandFieldSelection(this, CurReportDocument.getRecordParser(), 100, slblFields, slblSelFields, slblTables, true, 34330);
+ CurDBCommandFieldSelection = new CommandFieldSelection(this, m_reportDocument.getRecordParser(), 100, slblFields, slblSelFields, slblTables, true, 34330);
CurDBCommandFieldSelection.addFieldSelectionListener(new FieldSelectionListener());
if ( !isReportBuilderInstalled() )
{
@@ -507,13 +335,13 @@ public class ReportWizard extends WizardDialog implements XTextListener, XComple
CurTitlesComponent = new TitlesComponent(this, SOTITLEPAGE, 97, 37, 210, 7, slblColumnNames, slblColumnTitles, 34381);
CurTitlesComponent.addTextListener(this);
// CurReportDocument.getDoc().xProgressBar.setValue(50);
- CurGroupFieldHandler = new GroupFieldHandler(CurReportDocument, this);
+ CurGroupFieldHandler = new GroupFieldHandler(m_reportDocument, this);
// CurReportDocument.getDoc().xProgressBar.setValue(60);
CurSortingComponent = new SortingComponent(this, SOSORTPAGE, 95, 30, 210, 34346);
// CurReportDocument.getDoc().xProgressBar.setValue(70);
- CurReportLayouter = new ReportLayouter(xMSF, CurReportDocument, this);
+ CurReportLayouter = new ReportLayouter(xMSF, m_reportDocument, this);
// CurReportDocument.getDoc().xProgressBar.setValue(80);
- CurReportFinalizer = new ReportFinalizer(xMSF, CurReportDocument, this);
+ CurReportFinalizer = new ReportFinalizer(xMSF, m_reportDocument, this);
// CurReportDocument.getDoc().xProgressBar.setValue(100);
bCloseDocument = true;
// CurReportDocument.getDoc().xProgressBar.end();
@@ -561,7 +389,7 @@ public class ReportWizard extends WizardDialog implements XTextListener, XComple
private boolean isReportBuilderInstalled()
{
//! Check if the new Report Builder Extension is available
- XContentEnumerationAccess a = (XContentEnumerationAccess) com.sun.star.uno.UnoRuntime.queryInterface(XContentEnumerationAccess.class, xMSF);
+ XContentEnumerationAccess a = com.sun.star.uno.UnoRuntime.queryInterface( XContentEnumerationAccess.class, xMSF );
com.sun.star.container.XEnumeration e = a.createContentEnumeration("com.sun.star.report.pentaho.SOReportJobFactory");
if (e == null)
{
@@ -584,8 +412,7 @@ public class ReportWizard extends WizardDialog implements XTextListener, XComple
// 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 = (XPackageInformationProvider) UnoRuntime.queryInterface(XPackageInformationProvider.class, aSingleton);
- // String[][] aStrListList = xProvider.getExtensionList();
+ XPackageInformationProvider xProvider = UnoRuntime.queryInterface( XPackageInformationProvider.class, aSingleton );
final String sLocation = xProvider.getPackageLocation("com.sun.reportdesigner");
return sLocation;
}
@@ -601,7 +428,7 @@ private static void initializeLogger(XMultiServiceFactory _xMSF)
{
System.out.println("Can't get singleton from logging");
}
- final XLoggerPool xLoggerPool = (XLoggerPool)UnoRuntime.queryInterface(XLoggerPool.class, aLoggerPool);
+ final XLoggerPool xLoggerPool = UnoRuntime.queryInterface( XLoggerPool.class, aLoggerPool );
m_xLogger = xLoggerPool.getNamedLogger("com.sun.star.wizards.ReportBuilder");
}
@@ -610,120 +437,65 @@ public static XLogger getLogger()
return m_xLogger;
}
- public XComponent[] startReportWizard(XMultiServiceFactory _xMSF, PropertyValue[] CurPropertyValue)
- {
- return startReportWizard(_xMSF, CurPropertyValue, false);
- }
-
- public XComponent[] startReportWizard(XMultiServiceFactory _xMSF, PropertyValue[] CurPropertyValue, boolean _bDebug)
+ public void startReportWizard()
{
- initializeLogger(_xMSF);
- getLogger().log(com.sun.star.logging.LogLevel.SEVERE, "Start Report Wizard");
+ initializeLogger(xMSF);
+ getLogger().log(LogLevel.SEVERE, "Start Report Wizard");
- XComponent[] ret = null;
- this.xMSF = _xMSF;
- DBGPROPERTYVALUE = CurPropertyValue;
-
- // CurReportDocument = new ReportTextDocument(xMSF, ReportPath + "/stl-default.ott", m_oResource );
- // if (isReportBuilderInstalled())
- // {
- // CurReportDocument = ReportBuilderImplementation.create(xMSF, m_oResource);
- // }
- // else
- // {
- // CurReportDocument = ReportTextImplementation.create(xMSF, m_oResource );
- // }
- boolean bUseOld = false;
- if (!isReportBuilderInstalled())
- {
- bUseOld = true;
- }
- if (_bDebug == true && !bUseOld)
- {
- try
- {
- Class a = Class.forName("com.sun.star.wizards.reportbuilder.ReportBuilderImplementation");
- Method aMethod = a.getMethod("create", new Class[]
- {
- XMultiServiceFactory.class, Resource.class
- });
- CurReportDocument = (IReportDocument) aMethod.invoke(a, new Object[]
- {
- xMSF, m_oResource
- });
- }
- catch (Exception e)
- {
- int dummy = 0;
- }
- }
- else
+ if ( isReportBuilderInstalled() )
{
- if (!bUseOld)
+ // 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 )
{
- // debug == false
-
- // 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)
+ try
{
- 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, Resource.class
- });
- CurReportDocument = (IReportDocument) aMethod.invoke(a, new Object[]
- {
- xMSF, m_oResource
- });
- }
- catch (Exception e)
- {
- // TODO: Exception not handled.
- int dummy = 0;
- // Maybe problems in URI create() if a wrong char is used like '[' ']', ...
- System.out.println("There could be a problem with the path '" + sLocation + "'");
- }
+ 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 });
+ m_reportDocument = (IReportDocument) aMethod.invoke(a, new Object[] { xMSF });
+ }
+ 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 + "'");
}
}
}
+
try
{
- if (CurReportDocument == null)
+ if (m_reportDocument == null)
{
// Fallback, if there is no reportbuilder wizard implementation, we use the old wizard
- CurReportDocument = ReportTextImplementation.create(xMSF, m_oResource);
+ m_reportDocument = new ReportTextImplementation( xMSF );
}
- // CurDBMetaData = CurReportDocument.getRecordParser();
-// tests();
+ m_reportDocument.initialize( m_docUI, m_oResource );
- if (CurReportDocument.getRecordParser().getConnection(CurPropertyValue))
+ if ( m_reportDocument.getRecordParser().getConnection( m_wizardContext ) )
{
- // CurReportDocument.getDoc().xProgressBar.setValue(20);
- CurReportDocument.getRecordParser().oSQLQueryComposer = new SQLQueryComposer(CurReportDocument.getRecordParser());
+ m_reportDocument.getRecordParser().oSQLQueryComposer = new SQLQueryComposer(m_reportDocument.getRecordParser());
buildSteps();
- CurReportDocument.checkInvariants();
+ m_reportDocument.checkInvariants();
- this.CurDBCommandFieldSelection.preselectCommand(CurPropertyValue, false);
+ this.CurDBCommandFieldSelection.preselectCommand( m_wizardContext, false );
- createWindowPeer(CurReportDocument.getWizardParent());
+ createWindowPeer(m_reportDocument.getWizardParent());
- CurReportDocument.getRecordParser().setWindowPeer(this.xControl.getPeer());
+ m_reportDocument.getRecordParser().setWindowPeer(this.xControl.getPeer());
insertQueryRelatedSteps();
- short RetValue = executeDialog(CurReportDocument.getFrame().getComponentWindow().getPosSize());
- ret = dialogFinish(RetValue);
+ short RetValue = executeDialog(m_reportDocument.getFrame().getComponentWindow().getPosSize());
+ if ( RetValue == 0 )
+ dialogFinish();
}
- CurReportDocument.getRecordParser().dispose();
+ m_reportDocument.getRecordParser().dispose();
}
catch (java.io.IOException e)
{
@@ -742,7 +514,6 @@ public static XLogger getLogger()
{
jexception.printStackTrace(System.out);
}
- return ret;
}
public void importReportData(final XMultiServiceFactory xMSF, final Dataimport CurDataimport)
@@ -753,25 +524,25 @@ public static XLogger getLogger()
boolean bexecute = false;
if (!bHasEscapeProcessing)
{
- bexecute = CurReportDocument.getRecordParser().executeCommand(com.sun.star.sdb.CommandType.QUERY); // sMsgQueryCreationImpossible + (char) 13 + sMsgEndAutopilot))
+ bexecute = m_reportDocument.getRecordParser().executeCommand(com.sun.star.sdb.CommandType.QUERY); // sMsgQueryCreationImpossible + (char) 13 + sMsgEndAutopilot))
}
else
{
- bexecute = CurReportDocument.getRecordParser().executeCommand(com.sun.star.sdb.CommandType.COMMAND); // sMsgQueryCreationImpossible + (char) 13 + sMsgEndAutopilot))
+ bexecute = m_reportDocument.getRecordParser().executeCommand(com.sun.star.sdb.CommandType.COMMAND); // sMsgQueryCreationImpossible + (char) 13 + sMsgEndAutopilot))
}
if (bexecute)
{
- bexecute = CurReportDocument.getRecordParser().getFields(CurReportDocument.getRecordParser().getFieldNames(), false);
+ bexecute = m_reportDocument.getRecordParser().getFields(m_reportDocument.getRecordParser().getFieldNames(), false);
}
if (bexecute)
{
// CurDataimport.insertDatabaseDatatoReportDocument(xMSF);
- CurReportDocument.insertDatabaseDatatoReportDocument(xMSF);
+ m_reportDocument.insertDatabaseDatatoReportDocument(xMSF);
}
if (CurReportFinalizer.getReportOpenMode() == ReportFinalizer.SOCREATEDOCUMENT)
{
- bDocisStored = CurReportDocument.getRecordParser().storeDatabaseDocumentToTempPath(CurReportDocument.getComponent(), CurReportFinalizer.getStoreName());
+ bDocisStored = m_reportDocument.getRecordParser().storeDatabaseDocumentToTempPath(m_reportDocument.getComponent(), CurReportFinalizer.getStoreName());
}
}
catch (com.sun.star.wizards.common.InvalidQueryException queryexception)
@@ -780,10 +551,10 @@ public static XLogger getLogger()
CurDataimport.xComponent.dispose();
if (bDocisStored)
{
- CurReportDocument.getRecordParser().addReportDocument(CurReportDocument.getComponent(), false);
+ m_reportDocument.getRecordParser().addReportDocument(m_reportDocument.getComponent(), false);
}
- CurReportDocument.getRecordParser().dispose();
+ m_reportDocument.getRecordParser().dispose();
}
public boolean getReportResources(boolean bgetProgressResourcesOnly)
@@ -792,9 +563,6 @@ public static XLogger getLogger()
if (bgetProgressResourcesOnly == false)
{
sShowBinaryFields = m_oResource.getResText(UIConsts.RID_REPORT + 60);
- slstDatabasesDefaultText = m_oResource.getResText(UIConsts.RID_DB_COMMON + 37);
- slstTablesDefaultText = m_oResource.getResText(UIConsts.RID_DB_COMMON + 38);
- sMsgErrorOccured = m_oResource.getResText(UIConsts.RID_DB_COMMON + 6);
slblTables = m_oResource.getResText(UIConsts.RID_FORM + 6);
slblFields = m_oResource.getResText(UIConsts.RID_FORM + 12);
slblSelFields = m_oResource.getResText(UIConsts.RID_REPORT + 9);
@@ -804,13 +572,9 @@ public static XLogger getLogger()
WizardHeaderText[3] = m_oResource.getResText(UIConsts.RID_REPORT + 30);
WizardHeaderText[4] = m_oResource.getResText(UIConsts.RID_REPORT + 31);
WizardHeaderText[5] = m_oResource.getResText(UIConsts.RID_REPORT + 32);
- sMsgSavingImpossible = m_oResource.getResText(UIConsts.RID_DB_COMMON + 30);
}
- sMsgFilePathInvalid = m_oResource.getResText(UIConsts.RID_DB_COMMON + 36);
slblColumnTitles = m_oResource.getResText(UIConsts.RID_REPORT + 70);
slblColumnNames = m_oResource.getResText(UIConsts.RID_REPORT + 71);
-// sBlindTextNote = m_oResource.getResText(UIConsts.RID_REPORT + 75);
-// sBlindTextNote = JavaTools.replaceSubString( sBlindTextNote, String.valueOf((char)13), "<BR>");
return true;
}
@@ -871,7 +635,7 @@ public static XLogger getLogger()
String sContent = (String) Helper.getUnoPropertyValue(oModel, "Text");
String fieldname = this.CurTitlesComponent.getFieldNameByTitleControl(oModel);
// CurReportDocument.getDoc().oTextFieldHandler.changeUserFieldContent(fieldname, sfieldtitle);
- CurReportDocument.liveupdate_changeUserFieldContent(fieldname, sContent);
+ m_reportDocument.liveupdate_changeUserFieldContent(fieldname, sContent);
}
catch (Exception exception)
{
@@ -901,8 +665,8 @@ public static XLogger getLogger()
if (!bdoenable)
{
String sQueryName = CurDBCommandFieldSelection.getSelectedCommandName();
- DBMetaData.CommandObject oCommand = CurReportDocument.getRecordParser().getQueryByName(sQueryName);
- bdoenable = CurReportDocument.getRecordParser().hasEscapeProcessing(oCommand.getPropertySet());
+ DBMetaData.CommandObject oCommand = m_reportDocument.getRecordParser().getQueryByName(sQueryName);
+ bdoenable = m_reportDocument.getRecordParser().hasEscapeProcessing(oCommand.getPropertySet());
}
super.setStepEnabled(SOSORTPAGE, bdoenable);
diff --git a/wizards/com/sun/star/wizards/reportbuilder/ReportBuilderImplementation.java b/wizards/com/sun/star/wizards/reportbuilder/ReportBuilderImplementation.java
index dad827841e96..f14f4dce0bd9 100644
--- a/wizards/com/sun/star/wizards/reportbuilder/ReportBuilderImplementation.java
+++ b/wizards/com/sun/star/wizards/reportbuilder/ReportBuilderImplementation.java
@@ -33,11 +33,9 @@ package com.sun.star.wizards.reportbuilder;
import com.sun.star.util.XModeSelector;
-import com.sun.star.wizards.report.*;
import com.sun.star.awt.XWindowPeer;
import com.sun.star.beans.PropertyValue;
import com.sun.star.beans.XPropertySet;
-import com.sun.star.container.XNameAccess;
import com.sun.star.container.XNameContainer;
import com.sun.star.frame.XController;
import com.sun.star.frame.XDispatch;
@@ -46,10 +44,15 @@ import com.sun.star.frame.XFrame;
import com.sun.star.lang.XComponent;
import com.sun.star.lang.XMultiServiceFactory;
import com.sun.star.report.XReportDefinition;
+import com.sun.star.sdb.XSubDocument;
+import com.sun.star.sdb.application.DatabaseObject;
+import com.sun.star.sdb.application.XDatabaseDocumentUI;
import com.sun.star.sdbc.XConnection;
import com.sun.star.ucb.XCommandProcessor;
import com.sun.star.uno.UnoRuntime;
+import com.sun.star.util.XModifiable;
import com.sun.star.util.XURLTransformer;
+import com.sun.star.wizards.common.NoValidPathException;
import com.sun.star.wizards.common.Resource;
import com.sun.star.wizards.db.FieldColumn;
import java.lang.reflect.Constructor;
@@ -59,6 +62,15 @@ import java.util.LinkedHashMap;
import java.util.Set;
import java.util.Vector;
import com.sun.star.wizards.common.FileAccess;
+import com.sun.star.wizards.common.NamedValueCollection;
+import com.sun.star.wizards.report.IReportBuilderLayouter;
+import com.sun.star.wizards.report.IReportDefinitionReadAccess;
+import com.sun.star.wizards.report.IReportDocument;
+import com.sun.star.wizards.report.ReportImplementationHelper;
+import com.sun.star.wizards.report.ReportLayouter;
+import com.sun.star.wizards.report.ReportWizard;
+import java.util.logging.Level;
+import java.util.logging.Logger;
/**
* This class use the IReportDocument Interface to communicate between the UI
@@ -69,61 +81,35 @@ import com.sun.star.wizards.common.FileAccess;
public class ReportBuilderImplementation extends ReportImplementationHelper
implements IReportDocument, IReportDefinitionReadAccess
{
+ private Resource m_resource;
+ private XDatabaseDocumentUI m_documentUI;
private static final int MAXIMUM_GROUPCOUNT = 4;
-// public ReportTextDocument getDoc()
-// {
-// throw new UnsupportedOperationException("Not supported yet.");
-// }
- public void clearDocument()
+
+ private ReportBuilderImplementation( XMultiServiceFactory _serviceFactory )
{
- // throw new UnsupportedOperationException("Not supported yet.");
+ // creates an access to the ReportBuilder Extension
+ super(_serviceFactory, ReportLayouter.SOOPTLANDSCAPE);
}
- private Resource m_aResource;
- public ReportBuilderImplementation()
+ public static IReportDocument create( XMultiServiceFactory i_serviceFactory )
{
- // super(null, ReportLayouter.SOOPTPORTRAIT);
- super(null, ReportLayouter.SOOPTLANDSCAPE);
- m_aResource = null;
+ return new ReportBuilderImplementation( i_serviceFactory );
}
- private ReportBuilderImplementation(XMultiServiceFactory _aMSF, Resource _oResource)
+ public void initialize( final XDatabaseDocumentUI i_documentUI, final Resource i_resource )
{
- // creates an access to the ReportBuilder Extension
- // super(_aMSF, ReportLayouter.SOOPTPORTRAIT);
- super(_aMSF, ReportLayouter.SOOPTLANDSCAPE);
- m_aResource = _oResource;
+ m_documentUI = i_documentUI;