summaryrefslogtreecommitdiff
path: root/wizards/com/sun/star/wizards/report
diff options
context:
space:
mode:
Diffstat (limited to 'wizards/com/sun/star/wizards/report')
-rw-r--r--wizards/com/sun/star/wizards/report/CallReportWizard.java281
-rw-r--r--wizards/com/sun/star/wizards/report/DBColumn.java482
-rw-r--r--wizards/com/sun/star/wizards/report/Dataimport.java222
-rw-r--r--wizards/com/sun/star/wizards/report/GroupFieldHandler.java196
-rwxr-xr-xwizards/com/sun/star/wizards/report/IReportBuilderLayouter.java119
-rwxr-xr-xwizards/com/sun/star/wizards/report/IReportDefinitionReadAccess.java61
-rw-r--r--wizards/com/sun/star/wizards/report/IReportDocument.java268
-rw-r--r--wizards/com/sun/star/wizards/report/MANIFEST.MF2
-rw-r--r--wizards/com/sun/star/wizards/report/RecordTable.java99
-rw-r--r--wizards/com/sun/star/wizards/report/ReportFinalizer.java293
-rw-r--r--wizards/com/sun/star/wizards/report/ReportImplementationHelper.java68
-rw-r--r--wizards/com/sun/star/wizards/report/ReportLayouter.java341
-rw-r--r--wizards/com/sun/star/wizards/report/ReportTextDocument.java786
-rw-r--r--wizards/com/sun/star/wizards/report/ReportTextImplementation.java735
-rw-r--r--wizards/com/sun/star/wizards/report/ReportWizard.java762
-rw-r--r--wizards/com/sun/star/wizards/report/delzip0
-rw-r--r--wizards/com/sun/star/wizards/report/makefile.mk68
17 files changed, 4783 insertions, 0 deletions
diff --git a/wizards/com/sun/star/wizards/report/CallReportWizard.java b/wizards/com/sun/star/wizards/report/CallReportWizard.java
new file mode 100644
index 000000000000..89aa7f471705
--- /dev/null
+++ b/wizards/com/sun/star/wizards/report/CallReportWizard.java
@@ -0,0 +1,281 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+package com.sun.star.wizards.report;
+
+import com.sun.star.beans.PropertyValue;
+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.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
+ * method, that writes the information into the given registry key
+ * (<CODE>__writeRegistryServiceInfo</CODE>).
+ * @author Bertram Nolte
+ */
+public class CallReportWizard
+{
+
+ static boolean bWizardstartedalready;
+
+/* public static void main(String args[])
+ {
+ String ConnectStr = "uno:pipe,name=fs93730;urp;StarOffice.ServiceManager";
+ try
+ {
+ XMultiServiceFactory orb = Desktop.connect(ConnectStr);
+ if ( orb != null )
+ {
+ PropertyValue[] curproperties = new PropertyValue[1];
+ curproperties[0] = Properties.createProperty("DataSourceName", "countries");
+
+ 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>
+ * <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 tree
+ * structures) of a single
+ * registry key accessible.
+ */
+ public static com.sun.star.lang.XSingleServiceFactory __getServiceFactory(String stringImplementationName, com.sun.star.lang.XMultiServiceFactory xMSF, com.sun.star.registry.XRegistryKey xregistrykey)
+ {
+ 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;
+ }
+
+ /** Writes the service information into the given registry key.
+ * This method is called by the <code>JavaLoader</code>.
+ * @return returns true if the operation succeeded
+ * @see com.sun.star.comp.loader.JavaLoader#
+ * @param xregistrykey Makes structural information (except regarding tree
+ * structures) of a single
+ * registry key accessible.
+ */
+ public static boolean __writeRegistryServiceInfo(com.sun.star.registry.XRegistryKey xregistrykey)
+ {
+ return com.sun.star.comp.loader.FactoryHelper.writeRegistryServiceInfo(
+ ReportWizardImplementation.class.getName(),
+ ReportWizardImplementation.__serviceName,
+ xregistrykey);
+ }
+
+ /** This class implements the component. At least the interfaces XServiceInfo,
+ * XTypeProvider, and XInitialization should be provided by the service.
+ */
+ 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
+ {
+
+ 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)
+ {
+ super();
+ xmultiservicefactory = xmultiservicefactoryInitialization;
+ }
+
+ public void trigger(String sEvent)
+ {
+ try
+ {
+ if (sEvent.compareTo("start") == 0)
+ {
+ if (bWizardstartedalready != true)
+ {
+ ReportWizard CurReportWizard = new ReportWizard( xmultiservicefactory, m_wizardContext );
+ CurReportWizard.startReportWizard();
+ }
+ bWizardstartedalready = false;
+ }
+ else if (sEvent.compareTo("fill") == 0)
+ {
+ Dataimport CurDataimport = new Dataimport(xmultiservicefactory);
+ if (m_wizardContext != 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, documentUI, textDocument, m_wizardContext);
+ }
+ }
+ }
+ }
+ catch (Exception exception)
+ {
+ System.err.println(exception);
+ }
+ System.gc();
+ }
+ /** 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
+ {
+ this.m_wizardContext = Properties.convertToPropertyValueArray(object);
+
+ // xmultiservicefactory = (XMultiservicefactory) UnoRuntime.queryInterface(XMultiServiceFactory.class, object[0]);
+ }
+
+ /** 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];
+
+ stringSupportedServiceNames[ 0] = __serviceName;
+
+ 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;
+
+ if (stringService.equals(__serviceName))
+ {
+ booleanSupportsService = true;
+ }
+ return (booleanSupportsService);
+ }
+
+ /** This method returns an array of bytes, that can be used to
+ * unambiguously distinguish between two sets of types, e.g.
+ * to realise hashing functionality when the object is introspected.
+ * Two objects that return the same ID also have to return
+ * the same set of types in getTypes(). If an unique
+ * implementation Id cannot be provided this method has to
+ * return an empty sequence. Important: If the object
+ * aggregates other objects the ID has to be unique for the
+ * whole combination of objects.
+ * @return Array of bytes, in order to distinguish between two sets.
+ */
+ public byte[] getImplementationId()
+ {
+ byte[] byteReturn =
+ {
+ };
+
+ try
+ {
+ byteReturn = new String("" + this.hashCode()).getBytes();
+ }
+ catch (Exception exception)
+ {
+ System.err.println(exception);
+ }
+
+ return (byteReturn);
+ }
+
+ /** Return the class name of the component.
+ * @return Class name of the component.
+ */
+ public java.lang.String getImplementationName()
+ {
+ return (ReportWizardImplementation.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.
+ */
+ public Type[] getTypes()
+ {
+ Type[] typeReturn =
+ {
+ };
+
+ 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 exception)
+ {
+ System.err.println(exception);
+ }
+
+ return (typeReturn);
+ }
+ }
+}
+
diff --git a/wizards/com/sun/star/wizards/report/DBColumn.java b/wizards/com/sun/star/wizards/report/DBColumn.java
new file mode 100644
index 000000000000..eb6ce3229ac4
--- /dev/null
+++ b/wizards/com/sun/star/wizards/report/DBColumn.java
@@ -0,0 +1,482 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+package com.sun.star.wizards.report;
+
+import com.sun.star.beans.PropertyState;
+import com.sun.star.beans.XPropertySet;
+import com.sun.star.beans.XPropertyState;
+import com.sun.star.container.XNameAccess;
+import com.sun.star.container.XNamed;
+// import com.sun.star.lang.IndexOutOfBoundsException;
+import com.sun.star.style.ParagraphAdjust;
+import com.sun.star.table.XCell;
+import com.sun.star.table.XCellRange;
+import com.sun.star.table.XTableColumns;
+import com.sun.star.table.XTableRows;
+import com.sun.star.text.XDependentTextField;
+import com.sun.star.text.XTextCursor;
+import com.sun.star.text.XTextRange;
+import com.sun.star.text.XTextTable;
+import com.sun.star.uno.AnyConverter;
+import com.sun.star.uno.Exception;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.util.XNumberFormats;
+import com.sun.star.wizards.db.*;
+import com.sun.star.wizards.common.*;
+import com.sun.star.wizards.text.TextDocument;
+import com.sun.star.wizards.text.TextTableHandler;
+import com.sun.star.wizards.text.TextFieldHandler;
+
+public class DBColumn
+{
+
+ public XCell xValCell;
+ public XTextRange xValTextCell;
+ public XTextCursor xValCellCursor;
+ public XNumberFormats xValCellNumberFormats;
+ public XCell xNameCell;
+ public XTextRange xNameTextCell;
+ public boolean bAlignLeft;
+ public Object DefaultValue;
+ public String CharFontName;
+ public int FormatKey;
+ public PropertyState PropertyState;
+ public int ValColumn = 1;
+ public int ValRow = 0;
+ public FieldColumn CurDBField;
+ private XTextTable xTextTable;
+ private XTableColumns xTableColumns;
+ private XCellRange xCellRange;
+ public XNamed xTableName;
+ private boolean bIsGroupColumn;
+ TextDocument oTextDocument;
+ RecordParser CurDBMetaData;
+ RecordTable CurRecordTable;
+ TextTableHandler oTextTableHandler;
+
+ public DBColumn(TextTableHandler _oTextTableHandler, RecordParser _CurDBMetaData, int i) throws Exception
+ {
+ CurRecordTable = new RecordTable(_oTextTableHandler);
+ initializeRecordTableMembers(CurRecordTable, _oTextTableHandler, _CurDBMetaData, i, false);
+ }
+
+ public DBColumn(RecordTable _CurRecordTable, TextTableHandler _oTextTableHandler, RecordParser _CurDBMetaData, int i, boolean _bforce) throws Exception
+ {
+ initializeRecordTableMembers(_CurRecordTable, _oTextTableHandler, _CurDBMetaData, i, _bforce);
+ }
+
+ public DBColumn(RecordTable _CurRecordTable, TextTableHandler _oTextTableHandler, RecordParser _CurDBMetaData, int i) throws Exception
+ {
+ initializeRecordTableMembers(_CurRecordTable, _oTextTableHandler, _CurDBMetaData, i, false);
+ }
+
+ private void initializeRecordTableMembers(RecordTable _CurRecordTable, TextTableHandler _oTextTableHandler, RecordParser _CurDBMetaData, int i, boolean _bForce) throws Exception
+ {
+ this.oTextTableHandler = _oTextTableHandler;
+ this.CurDBMetaData = _CurDBMetaData;
+ this.CurRecordTable = _CurRecordTable;
+ bIsGroupColumn = false;
+ if (CurDBMetaData.RecordFieldColumns != null)
+ {
+ CurDBField = CurDBMetaData.getFieldColumnByFieldName(CurDBMetaData.RecordFieldColumns[i].getFieldName());
+ }
+ else
+ {
+ CurDBField = CurDBMetaData.getFieldColumnByFieldName(CurDBMetaData.getRecordFieldName(i));
+ }
+ if (_bForce)
+ {
+ assignCells(i, true);
+ }
+ else
+ {
+ for (int n = 0; n < CurRecordTable.xTableColumns.getCount(); n++)
+ {
+ assignCells(n, false);
+ }
+ }
+ }
+
+ private boolean assignCells(int _nColumn, boolean _bforce)
+ {
+ try
+ {
+ XCell xCell = CurRecordTable.xCellRange.getCellByPosition(_nColumn, 0);
+ XTextRange xTextCell = (XTextRange) UnoRuntime.queryInterface(XTextRange.class, xCell);
+ String CompString = "Column";
+ XTextCursor xLocCellCursor = TextDocument.createTextCursor(xCell);
+ if (isNameCell(xLocCellCursor, CurDBField.getFieldName(), CompString) || (_bforce))
+ {
+ xNameCell = xCell;
+ xNameTextCell = xTextCell;
+ xValCell = CurRecordTable.xCellRange.getCellByPosition(_nColumn, 1);
+ xValTextCell = (XTextRange) UnoRuntime.queryInterface(XTextRange.class, xValCell);
+ xValCellCursor = TextDocument.createTextCursor(xValCell);
+ ValColumn = _nColumn;
+ return true;
+ }
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace(System.out);
+ }
+ return false;
+ }
+
+ public DBColumn(TextTableHandler _oTextTableHandler, RecordParser _CurDBMetaData, String _FieldName, int GroupIndex, String TableName, DBColumn OldDBColumn) throws Exception
+ {
+ this.oTextTableHandler = _oTextTableHandler;
+ this.CurDBMetaData = _CurDBMetaData;
+ CurDBField = CurDBMetaData.getFieldColumnByDisplayName(_FieldName);
+ bIsGroupColumn = true;
+ getTableColumns(TableName);
+ xNameCell = OldDBColumn.xNameCell;
+ xNameTextCell = OldDBColumn.xNameTextCell;
+ xValCell = OldDBColumn.xValCell;
+ xValTextCell = OldDBColumn.xValTextCell;
+ xValCellCursor = TextDocument.createTextCursor(xValCell);
+ ValColumn = OldDBColumn.ValColumn;
+ ValRow = OldDBColumn.ValRow;
+ initializeNumberFormat();
+ }
+
+ public DBColumn(TextTableHandler _oTextTableHandler, RecordParser _CurDBMetaData, String _FieldName, int GroupIndex, String TableName) throws Exception
+ {
+ this.oTextTableHandler = _oTextTableHandler;
+ this.CurDBMetaData = _CurDBMetaData;
+ CurDBField = CurDBMetaData.getFieldColumnByFieldName(_FieldName);
+ bIsGroupColumn = true;
+ XTextRange xTextCell;
+ XCell xCell;
+ getTableColumns(TableName);
+
+ XTableRows xRows = null;
+ try
+ {
+ xRows = xTextTable.getRows();
+ }
+ catch (java.lang.NullPointerException e)
+ {
+ e.printStackTrace();
+// TODO: handle the nullpointer right
+// return;
+ }
+ for (int n = 0; n < xTableColumns.getCount(); n++)
+ {
+ for (int m = 0; m < xRows.getCount(); m++)
+ {
+ xCell = xCellRange.getCellByPosition(n, m);
+ xTextCell = (XTextRange) UnoRuntime.queryInterface(XTextRange.class, xCell);
+ String CompString = TableName.substring(4);
+ XTextCursor xLocCellCursor = TextDocument.createTextCursor(xCell);
+ if (isNameCell(xLocCellCursor, CurDBField.getFieldName(), CompString))
+ {
+ xNameCell = xCell;
+ xNameTextCell = xTextCell;
+ }
+ else
+ { //In Grouping Sections only two cells are allowed ' if (CellString.equals(CurFieldString)){
+ xValCell = xCell;
+ xValTextCell = xTextCell;
+ xValCellCursor = xLocCellCursor;
+ ValColumn = n;
+ ValRow = m;
+ checkforLeftAlignment();
+ }
+ }
+ }
+ }
+
+ private void getTableColumns(String TableName)
+ {
+ try
+ {
+ XNameAccess xAllTextTables = oTextTableHandler.xTextTablesSupplier.getTextTables();
+ if (xAllTextTables.hasByName(TableName) == true)
+ {
+ Object oTextTable = xAllTextTables.getByName(TableName);
+ xCellRange = (XCellRange) UnoRuntime.queryInterface(XCellRange.class, oTextTable);
+ xTextTable = (XTextTable) UnoRuntime.queryInterface(XTextTable.class, oTextTable);
+ xTableName = (XNamed) UnoRuntime.queryInterface(XNamed.class, oTextTable);
+ xTableColumns = xTextTable.getColumns();
+ }
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ public void initializeNumberFormat()
+ {
+ if (CurDBField.isBoolean())
+ {
+ NumberFormatter oNumberFormatter = oTextTableHandler.getNumberFormatter();
+ int iLogicalFormatKey = oNumberFormatter.setBooleanReportDisplayNumberFormat();
+ oNumberFormatter.setNumberFormat(xValCell, iLogicalFormatKey, oNumberFormatter);
+ }
+ else
+ {
+ oTextTableHandler.getNumberFormatter().setNumberFormat(xValCell, CurDBField.getDBFormatKey(), CurDBMetaData.getNumberFormatter());
+ }
+ setCellFont();
+ }
+
+ public void insertColumnData(TextFieldHandler oTextFieldHandler, boolean _bIsLandscape)
+ {
+ insertUserFieldToTableCell(oTextFieldHandler);
+ replaceValueCellofTable(_bIsLandscape);
+ }
+
+ public void insertUserFieldToTableCell(TextFieldHandler oTextFieldHandler)
+ {
+ XTextCursor xTextCursor = TextDocument.createTextCursor(xNameCell);
+ xTextCursor.gotoStart(false);
+ xTextCursor.gotoEnd(true);
+ xTextCursor.setString("");
+ oTextFieldHandler.insertUserField(xTextCursor, CurDBField.getFieldName(), CurDBField.getFieldTitle());
+ }
+
+ public void insertUserFieldToTableCell(TextFieldHandler oTextFieldHandler, XCell xCell)
+ {
+ XTextCursor xTextCursor = TextDocument.createTextCursor(xCell);
+ xTextCursor.gotoStart(false);
+ xTextCursor.gotoEnd(true);
+ xTextCursor.setString("");
+ oTextFieldHandler.insertUserField(xTextCursor, CurDBField.getFieldName(), CurDBField.getFieldTitle());
+ }
+
+ public void formatValueCell()
+ {
+ initializeNumberFormat();
+ if (checkforLeftAlignment())
+ {
+ bAlignLeft = true;
+ }
+ }
+
+ private boolean checkforLeftAlignment()
+ {
+ bAlignLeft = ((CurDBField.isNumberFormat()) && (ValColumn == xTableColumns.getCount() - 1));
+ return bAlignLeft;
+ }
+
+ public void modifyCellContent(XCellRange xCellRange, Object CurGroupValue)
+ {
+ try
+ {
+ xValCell = xCellRange.getCellByPosition(ValColumn, ValRow);
+ xValTextCell = (XTextRange) UnoRuntime.queryInterface(XTextRange.class, xValCell);
+ modifyCellContent(CurGroupValue);
+ if (bAlignLeft)
+ {
+ xValCellCursor = TextDocument.createTextCursor(xValCell);
+ Helper.setUnoPropertyValue(xValCellCursor, "ParaAdjust", new Integer(com.sun.star.style.ParagraphAdjust.LEFT_value));
+ }
+ }
+ catch (Exception exception)
+ {
+ exception.printStackTrace(System.out);
+ }
+ }
+
+ public void modifyCellContent(Object CurGroupValue)
+ {
+ double dblValue = 0;
+ try
+ {
+ if (xValCell != null)
+ {
+ if (AnyConverter.isString(CurGroupValue))
+ {
+ String sValue = AnyConverter.toString(CurGroupValue);
+ xValTextCell.setString(sValue);
+ }
+ else
+ {
+ if (AnyConverter.isBoolean(CurGroupValue))
+ {
+ dblValue = (double) AnyConverter.toInt(CurGroupValue);
+ }
+ if (AnyConverter.isByte(CurGroupValue))
+ {
+ dblValue = (double) AnyConverter.toByte(CurGroupValue);
+ }
+ else if (AnyConverter.isDouble(CurGroupValue))
+ {
+ dblValue = AnyConverter.toDouble(CurGroupValue);
+ }
+ else if (AnyConverter.isFloat(CurGroupValue))
+ {
+ dblValue = (double) AnyConverter.toFloat(CurGroupValue);
+ }
+ else if (AnyConverter.isInt(CurGroupValue))
+ {
+ dblValue = (double) AnyConverter.toInt(CurGroupValue);
+ }
+ else if (AnyConverter.isLong(CurGroupValue))
+ {
+ dblValue = (double) AnyConverter.toLong(CurGroupValue);
+ }
+ else if (AnyConverter.isShort(CurGroupValue))
+ {
+ dblValue = (double) AnyConverter.toShort(CurGroupValue);
+ }
+ xValCell.setValue(dblValue);
+ }
+ }
+ }
+ catch (Exception exception)
+ {
+ System.err.println(exception);
+ }
+ }
+ // If the parameter CurGroupValue is null the placeholders are inserted
+ public void replaceValueCellofTable(boolean _bIsLandscape)
+ {
+ try
+ {
+ Object CurGroupValue;
+ if (bIsGroupColumn == false && CurDBField.isNumberFormat() == false)
+ {
+ CurGroupValue = BlindtextCreator.adjustBlindTextlength(CurDBField.getFieldTitle(), CurDBField.getFieldWidth(), _bIsLandscape, bIsGroupColumn, CurDBMetaData.getRecordFieldNames());
+ }
+ else
+ {
+ CurGroupValue = CurDBField.getDefaultValue();
+ }
+ modifyCellContent(CurGroupValue);
+ if (bAlignLeft)
+ {
+ Helper.setUnoPropertyValue(xValCellCursor, "ParaAdjust", new Integer(ParagraphAdjust.LEFT_value));
+ }
+
+ int nFieldType = CurDBField.getFieldType();
+ if ((nFieldType == com.sun.star.sdbc.DataType.BIT) ||
+ (nFieldType == com.sun.star.sdbc.DataType.BOOLEAN))
+ {
+ CharFontName = "StarSymbol";
+ Helper.setUnoPropertyValue(xValCellCursor, "CharFontName", CharFontName);
+ if (bIsGroupColumn == false)
+ {
+ Helper.setUnoPropertyValue(xValCellCursor, "ParaAdjust", new Integer(ParagraphAdjust.CENTER_value));
+ }
+ }
+ else
+ {
+ if (PropertyState == com.sun.star.beans.PropertyState.DEFAULT_VALUE)
+ {
+ XPropertyState xPropState = (XPropertyState) UnoRuntime.queryInterface(XPropertyState.class, xValCellCursor);
+ xPropState.setPropertyToDefault("CharFontName");
+ }
+ else
+ {
+ if (PropertyState == com.sun.star.beans.PropertyState.DIRECT_VALUE)
+ {
+ Helper.setUnoPropertyValue(xValCellCursor, "CharFontName", CharFontName);
+ }
+ }
+ }
+ }
+ catch (com.sun.star.beans.UnknownPropertyException exception)
+ {
+ exception.printStackTrace(System.out);
+ }
+ }
+
+ public void setCellFont()
+ {
+ try
+ {
+ XPropertyState xPropertyState;
+ int nFieldType = CurDBField.getFieldType();
+ if ((nFieldType == com.sun.star.sdbc.DataType.BIT) ||
+ (nFieldType == com.sun.star.sdbc.DataType.BOOLEAN))
+ {
+ CharFontName = "StarSymbol";
+ PropertyState = com.sun.star.beans.PropertyState.DIRECT_VALUE;
+ xValCellCursor.gotoStart(false);
+ xValCellCursor.gotoEnd(true);
+ Helper.setUnoPropertyValue(xValCellCursor, "CharFontName", CharFontName);
+ }
+ else
+ {
+ xPropertyState = (XPropertyState) UnoRuntime.queryInterface(XPropertyState.class, xValCellCursor);
+ PropertyState = xPropertyState.getPropertyState("CharFontName");
+ CharFontName = AnyConverter.toString(Helper.getUnoPropertyValue(xValCellCursor, "CharFontName"));
+ }
+ }
+ catch (Exception exception)
+ {
+ exception.printStackTrace(System.out);
+ }
+ }
+
+ private boolean isNameCell(XTextCursor xCellCursor, String CurFieldName, String CompString)
+ {
+ try
+ {
+ xCellCursor.gotoStart(false);
+ XTextRange xTextRange = xCellCursor.getEnd();
+ Object oTextField = Helper.getUnoPropertyValue(xTextRange, "TextField");
+ if (AnyConverter.isVoid(oTextField))
+ {
+ return false;
+ }
+ else
+ {
+ XDependentTextField xDependent = (XDependentTextField) UnoRuntime.queryInterface(XDependentTextField.class, oTextField);
+ XPropertySet xMaster = xDependent.getTextFieldMaster();
+ String UserFieldName = (String) xMaster.getPropertyValue("Name");
+ boolean bIsNameCell = false;
+ if ((UserFieldName.startsWith(CompString)) || (UserFieldName.equals(CurFieldName)))
+ {
+ bIsNameCell = true;
+ }
+ else
+ {
+ // stupid hack, 'Title' is not a real good Table-Cell-Name
+ // take a look at xmloff/source/text/txtvfldi.txt, there exists 2 '_renamed_' strings
+ String sLocalCurFieldName = CurFieldName + "_renamed_";
+ if (UserFieldName.startsWith(sLocalCurFieldName))
+ {
+ bIsNameCell = true;
+ }
+ }
+ return bIsNameCell;
+ }
+ }
+ // Todo: Insert a resource; Exception should be thrown to the calling routine
+ catch (Exception exception)
+ {
+// sMsgInvalidTextField = oResource.getResText(UIConsts.RID_REPORT + 73);
+// SystemDialog.showMessageBox(oTextTableHandler.xMSFDoc, "ErrorBox", VclWindowPeerAttribute.OK, sMsgInvalidTextField);
+ exception.printStackTrace(System.out);
+ return true; //most probably this is really the Namecell!!!!
+ }
+ }
+}
diff --git a/wizards/com/sun/star/wizards/report/Dataimport.java b/wizards/com/sun/star/wizards/report/Dataimport.java
new file mode 100644
index 000000000000..8547758a08e6
--- /dev/null
+++ b/wizards/com/sun/star/wizards/report/Dataimport.java
@@ -0,0 +1,222 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+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.*;
+import com.sun.star.wizards.common.*;
+import com.sun.star.uno.Exception;
+
+public class Dataimport extends UnoDialog2 implements com.sun.star.awt.XActionListener
+{ // extends ReportWizard
+
+ // ReportTextDocument CurReportDocument;
+ IReportDocument CurReportDocument;
+
+// PropertyValue[] CurProperties;
+ static boolean bStopProcess;
+ static String sProgressDBConnection;
+ static String sProgressDataImport;
+ static String sProgressBaseCurRecord;
+ static String sProgressCurRecord;
+ static String sProgressTitle;
+ static String sStop;
+
+// public static final String TBLRECORDSECTION = ReportTextDocument.TBLRECORDSECTION;
+// public static final String TBLGROUPSECTION = ReportTextDocument.TBLGROUPSECTION;
+// public static final String RECORDSECTION = ReportTextDocument.RECORDSECTION;
+// public static final String GROUPSECTION = ReportTextDocument.GROUPSECTION;
+// public static final String COPYOFTBLRECORDSECTION = ReportTextDocument.COPYOFTBLRECORDSECTION;
+// public static final String COPYOFTBLGROUPSECTION = ReportTextDocument.COPYOFTBLGROUPSECTION;
+// public static final String COPYOFRECORDSECTION = ReportTextDocument.COPYOFRECORDSECTION;
+// public static final String COPYOFGROUPSECTION = ReportTextDocument.COPYOFGROUPSECTION;
+ public Dataimport(XMultiServiceFactory _xMSF)
+ {
+ super(_xMSF);
+ super.addResourceHandler("ReportWizard", "dbw");
+ sProgressDBConnection = m_oResource.getResText(UIConsts.RID_DB_COMMON + 34);
+ sProgressDataImport = m_oResource.getResText(UIConsts.RID_REPORT + 67);
+ sProgressTitle = m_oResource.getResText(UIConsts.RID_REPORT + 62);
+ sProgressBaseCurRecord = m_oResource.getResText(UIConsts.RID_REPORT + 63);
+ sStop = m_oResource.getResText(UIConsts.RID_DB_COMMON + 21);
+
+ }
+
+ public void disposing(com.sun.star.lang.EventObject eventObject)
+ {
+ }
+
+ public void actionPerformed(com.sun.star.awt.ActionEvent actionEvent)
+ {
+ // bStopProcess = true;
+ CurReportDocument.StopProcess();
+ }
+
+// public static void main(String args[])
+// {
+// String ConnectStr = "uno:socket,host=localhost,port=8100;urp,negotiate=0,forcesynchronous=1;StarOffice.NamingService";
+// XMultiServiceFactory xMSF = null;
+// try
+// {
+// xMSF = com.sun.star.wizards.common.Desktop.connect(ConnectStr);
+// if (xMSF != null)
+// {
+// System.out.println("Connected to " + ConnectStr);
+// }
+// PropertyValue[] curproperties = new PropertyValue[3];
+// 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/MyDocAssign.odb"); //baseLocation ); "DataSourceName", "db1");
+//// curproperties[0] = Properties.createProperty("DataSourceName", "Bibliography");
+// curproperties[1] = Properties.createProperty("CommandType", new Integer(CommandType.TABLE));
+// curproperties[2] = Properties.createProperty("Command", "Table2");
+//
+// Dataimport CurDataimport = new Dataimport(xMSF);
+// TextDocument oTextDocument = new TextDocument(xMSF, true, null);
+// CurDataimport.createReport(xMSF, oTextDocument.xTextDocument, curproperties);
+//
+// }
+// catch (Exception e)
+// {
+// e.printStackTrace(System.out);
+// }
+// catch (java.lang.Exception javaexception)
+// {
+// javaexception.printStackTrace(System.out);
+// }
+// }
+ public void showProgressDisplay(XMultiServiceFactory xMSF, boolean bgetConnection)
+ {
+ try
+ {
+ Helper.setUnoPropertyValues(xDialogModel,
+ new String[]
+ {
+ "Height", "Step", "Title", "Width"
+ },
+ new Object[]
+ {
+ new Integer(84), new Integer(0), sProgressTitle, new Integer(180)
+ });
+ com.sun.star.awt.FontDescriptor oFontDesc = new com.sun.star.awt.FontDescriptor();
+ oFontDesc.Weight = com.sun.star.awt.FontWeight.BOLD;
+ if (bgetConnection)
+ {
+ insertControlModel("com.sun.star.awt.UnoControlFixedTextModel", "lblProgressDBConnection",
+ new String[]
+ {
+ "FontDescriptor", "Height", "Label", "PositionX", "PositionY", "Step", "Width"
+ },
+ new Object[]
+ {
+ oFontDesc, new Integer(10), sProgressDBConnection, new Integer(6), new Integer(6), new Integer(0), new Integer(150)
+ });
+
+ insertControlModel("com.sun.star.awt.UnoControlFixedTextModel", "lblProgressDataImport",
+ new String[]
+ {
+ "Height", "Label", "PositionX", "PositionY", "Step", "Width"
+ },
+ new Object[]
+ {
+ new Integer(10), sProgressDataImport, new Integer(6), new Integer(24), new Integer(0), new Integer(120)
+ });
+ }
+ else
+ {
+ insertControlModel("com.sun.star.awt.UnoControlFixedTextModel", "lblProgressDataImport",
+ new String[]
+ {
+ "FontDescriptor", "Height", "Label", "PositionX", "PositionY", "Step", "Width"
+ },
+ new Object[]
+ {
+ oFontDesc, new Integer(10), sProgressDataImport, new Integer(6), new Integer(24), new Integer(0), new Integer(120)
+ });
+ }
+ insertControlModel("com.sun.star.awt.UnoControlFixedTextModel", "lblCurProgress",
+ new String[]
+ {
+ "Height", "Label", "PositionX", "PositionY", "Step", "Width"
+ },
+ new Object[]
+ {
+ new Integer(10), "", new Integer(12), new Integer(42), new Integer(0), new Integer(120)
+ });
+
+ insertButton("cmdCancel", 10000, this,
+ new String[]
+ {
+ "Height", "HelpURL", "PositionX", "PositionY", "Step", "TabIndex", "Width", "Label"
+ },
+ new Object[]
+ {
+ new Integer(14), "HID:34321", new Integer(74), new Integer(58), new Integer(0), new Short((short) 1), new Integer(40), sStop
+ });
+ createWindowPeer(CurReportDocument.getWizardParent());
+ calculateDialogPosition(CurReportDocument.getFrame().getComponentWindow().getPosSize());
+ xWindow.setVisible(true);
+ super.xReschedule.reschedule();
+ return;
+ }
+ catch (Exception exception)
+ {
+ exception.printStackTrace(System.out);
+ // return;
+ }
+ catch (java.lang.Exception jexception)
+ {
+ jexception.printStackTrace(System.out);
+ // return;
+ }
+ }
+
+ // public void importReportData(final XMultiServiceFactory xMSF, final Dataimport CurDataimport, final ReportTextDocument CurReportDocument.getDoc()) {
+ public void importReportData(final XMultiServiceFactory _xMSF, final Dataimport _CurDataimport, IReportDocument _CurReportDocument, PropertyValue[] _properties)
+ {
+ if (CurReportDocument.reconnectToDatabase(_xMSF, _properties))
+ {
+ // The following calls to remove the Sections must occur after the connection to the database
+ modifyFontWeight("lblProgressDBConnection", com.sun.star.awt.FontWeight.NORMAL);
+ modifyFontWeight("lblProgressDataImport", com.sun.star.awt.FontWeight.BOLD);
+ CurReportDocument.insertDatabaseDatatoReportDocument(_xMSF);
+ }
+ xComponent.dispose();
+ CurReportDocument.getRecordParser().dispose();
+ }
+
+ public void createReport( XMultiServiceFactory xMSF, XDatabaseDocumentUI i_documentUI, XTextDocument _textDocument,
+ PropertyValue[] 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/GroupFieldHandler.java b/wizards/com/sun/star/wizards/report/GroupFieldHandler.java
new file mode 100644
index 000000000000..82e478bac781
--- /dev/null
+++ b/wizards/com/sun/star/wizards/report/GroupFieldHandler.java
@@ -0,0 +1,196 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+package com.sun.star.wizards.report;
+
+import com.sun.star.wizards.common.JavaTools;
+import com.sun.star.wizards.ui.*;
+import com.sun.star.wizards.db.*;
+
+import java.util.Vector;
+
+public class GroupFieldHandler extends FieldSelection
+{
+
+ private IReportDocument CurReportDocument;
+ private Vector GroupFieldVector = new Vector();
+ private QueryMetaData CurDBMetaData;
+ private WizardDialog oWizardDialog;
+ private static final short MAXSELFIELDS = 4;
+
+ public GroupFieldHandler(IReportDocument _CurReportDocument, WizardDialog _CurUnoDialog)
+ {
+ super(_CurUnoDialog, ReportWizard.SOGROUPPAGE, 95, 27, 210, 127,
+ _CurUnoDialog.m_oResource.getResText(UIConsts.RID_REPORT + 19),
+ _CurUnoDialog.m_oResource.getResText(UIConsts.RID_REPORT + 50), 34340, false);
+
+ try
+ {
+ this.oWizardDialog = _CurUnoDialog;
+ this.CurReportDocument = _CurReportDocument;
+ this.CurDBMetaData = CurReportDocument.getRecordParser();
+ CurUnoDialog.setControlProperty("lstFields_2", "MultiSelection", new Boolean(false));
+ CurUnoDialog.setControlProperty("lstSelFields_2", "MultiSelection", new Boolean(false));
+ addFieldSelectionListener(new FieldSelectionListener());
+ String sNote = ReportWizard.getBlindTextNote(_CurReportDocument, _CurUnoDialog.m_oResource);
+ CurUnoDialog.insertControlModel("com.sun.star.awt.UnoControlFixedTextModel", "lblBlindTextNote_1",
+ new String[]
+ {
+ "Enabled", "Height", "Label", "MultiLine", "PositionX", "PositionY", "Step", "Width"
+ },
+ new Object[]
+ {
+ new Boolean(false), new Integer(18), sNote, new Boolean(true), new Integer(95), new Integer(158), new Integer(ReportWizard.SOGROUPPAGE), new Integer(209)
+ });
+ }
+ catch (Exception exception)
+ {
+ exception.printStackTrace(System.out);
+ }
+ }
+
+ public boolean isGroupField(String _FieldName)
+ {
+ return (JavaTools.FieldInList(CurDBMetaData.GroupFieldNames, _FieldName) != -1);
+ }
+
+ public void initialize()
+ {
+ try
+ {
+ Vector NormalFieldsVector = new Vector();
+ Vector SelFieldsVector = new Vector();
+ String[] sFieldNames = CurDBMetaData.getFieldNames();
+ for (int i = 0; i < sFieldNames.length; i++)
+ {
+ String sfieldtitle = sFieldNames[i]; // CurDBMetaData.getFieldTitle(sFieldNames[i]);
+ if (isGroupField(sFieldNames[i]))
+ {
+ SelFieldsVector.add(sfieldtitle);
+ }
+ else
+ {
+ NormalFieldsVector.add(sfieldtitle);
+ }
+ }
+ String[] SelFields = new String[SelFieldsVector.size()];
+ SelFieldsVector.toArray(SelFields);
+ String[] NormalFields = new String[NormalFieldsVector.size()];
+ NormalFieldsVector.toArray(NormalFields);
+ super.initialize(NormalFields, SelFields, true);
+ }
+ catch (Exception exception)
+ {
+ exception.printStackTrace(System.out);
+ }
+ }
+
+ public void removeGroupFieldNames()
+ {
+ emptyFieldsListBoxes();
+ GroupFieldVector.removeAllElements();
+ CurUnoDialog.setControlProperty("lblBlindTextNote_1", "Enabled", new Boolean(false));
+ }
+
+ public void getGroupFieldNames(CommandMetaData CurDBMetaData)
+ {
+ String[] GroupFieldNames = new String[GroupFieldVector.size()];
+ GroupFieldVector.copyInto(GroupFieldNames);
+ CurDBMetaData.GroupFieldNames = GroupFieldNames;
+ }
+ // @Override
+ protected void toggleListboxButtons(short iFieldsSelIndex, short iSelFieldsSelIndex)
+ {
+ super.toggleListboxButtons(iFieldsSelIndex, iSelFieldsSelIndex);
+ int iSelCount = xSelectedFieldsListBox.getItemCount();
+ if (iSelCount >= MAXSELFIELDS)
+ {
+ CurUnoDialog.setControlProperty("cmdMoveSelected" + sIncSuffix, "Enabled", Boolean.FALSE);
+ }
+ }
+
+ public void selectFields(boolean bMoveAll)
+ {
+ int iSelCount = xSelectedFieldsListBox.getItemCount();
+ if (iSelCount < MAXSELFIELDS)
+ {
+ super.selectFields(bMoveAll);
+ }
+
+ }
+
+ /* protected */ class FieldSelectionListener implements com.sun.star.wizards.ui.XFieldSelectionListener
+ {
+
+ public void moveItemDown(String Selitem)
+ {
+ CurReportDocument.refreshGroupFields(xSelectedFieldsListBox.getItems());
+ }
+
+ public void moveItemUp(String item)
+ {
+ CurReportDocument.refreshGroupFields(xSelectedFieldsListBox.getItems());
+ }
+
+ public void shiftFromLeftToRight(String[] Selitems, String[] Newitems)
+ {
+ String CurGroupTitle = Selitems[0];
+ int iSelCount = xSelectedFieldsListBox.getItemCount();
+ String[] CurGroupNames = xFieldsListBox.getItems();
+ CurReportDocument.liveupdate_addGroupNametoDocument(CurGroupNames, CurGroupTitle, GroupFieldVector, CurReportDocument.getReportPath(), iSelCount);
+ CurUnoDialog.setControlProperty("lblBlindTextNote_1", "Enabled", new Boolean(true));
+ if (iSelCount >= MAXSELFIELDS)
+ {
+ toggleMoveButtons(false, false);
+ }
+ }
+
+ public void shiftFromRightToLeft(String[] OldSelitems, String[] Newitems)
+ {
+ int iSelPos = OldSelitems.length;
+ if (iSelPos > 0)
+ {
+ String OldGroupTitle = OldSelitems[0];
+ String[] NewSelList = xSelectedFieldsListBox.getItems();
+ CurReportDocument.liveupdate_removeGroupName(NewSelList, OldGroupTitle, GroupFieldVector);
+ String[] NewSelGroupNames = xSelectedFieldsListBox.getItems();
+ CurUnoDialog.setControlProperty("lblBlindTextNote_1", "Enabled", new Boolean(NewSelGroupNames.length == 0));
+
+ // CurReportDocument.refreshGroupFields(xSelectedFieldsListBox.getItems());
+ }
+ }
+
+ public int getID()
+ {
+ // TODO: here is a good place for a comment, isn't it?
+ return 2;
+ }
+
+ public void setID(String sIncSuffix)
+ {
+ }
+ }
+}
diff --git a/wizards/com/sun/star/wizards/report/IReportBuilderLayouter.java b/wizards/com/sun/star/wizards/report/IReportBuilderLayouter.java
new file mode 100755
index 000000000000..6422befd65f0
--- /dev/null
+++ b/wizards/com/sun/star/wizards/report/IReportBuilderLayouter.java
@@ -0,0 +1,119 @@
+/*
+ * ***********************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ * **********************************************************************
+ */
+package com.sun.star.wizards.report;
+
+/**
+ * This Interface separate the ReportBuilderImplementation from the layout.
+ * Only these less methods are allowed to access from the ReportBuilderImplementation.
+ * @author ll93751
+ */
+public interface IReportBuilderLayouter
+{
+
+ /**
+ * Get the internal name of the current layout.
+ * This name identifies the layout in the internal access list.
+ * @return the internal layout name.
+ */
+ public String getName();
+
+ /**
+ * Get the localized name of the layout, which is shown in the layout page of the report wizard.
+ * This name comes out of the resource and will be translate in different languages.
+ * @return localized name of the layout.
+ */
+ public String getLocalizedName();
+
+ /**
+ * For Landscape give nOrientation == com.sun.star.wizards.report.ReportLayouter.SOOPTLANDSCAPE
+ * All other numbers are interpreted as portrait format.
+ * @param nOrientation
+ */
+ public void setPageOrientation(int nOrientation);
+
+ /**
+ * dispose the layouter
+ */
+ public void dispose();
+
+ /**
+ * Set the table name of the report
+ * This is the name to the database table.
+ * @param _nType something of com.sun.star.sdb.CommandType
+ * @param TableName
+ */
+ public void setTableName(int _nType, String TableName);
+
+ /**
+ * Insert the field names, these are the field names out of a given datebase table
+ * @param FieldNames
+ */
+ public void insertFieldNames(final String[] FieldNames);
+
+ /**
+ * Insert the field type (Varchar, int, ...) as internal an int representation.
+ * @param FieldTypes
+ */
+ public void insertFieldTypes(int[] FieldTypes);
+
+ /**
+ * Insert the field width in count of chars as given in the database.
+ * @param FieldWidths
+ */
+ public void insertFieldWidths(int[] FieldWidths);
+
+ /**
+ * Insert the titles of the field names. This names are free formed
+ * @param _aFieldTitles
+ */
+ public void insertFieldTitles(String[] _aFieldTitles);
+
+ /**
+ * Insert the names of the groups, the group names are names out of the field names.
+ *
+ * If a group name is given here, it will not shown in the fields/titles, but must be in the field string list.
+ * @param _aGroupFieldNames
+ */
+ public void insertGroupNames(String[] _aGroupFieldNames);
+
+ /**
+ * This method redraws the whole layout with all it's content
+ */
+ public void layout();
+
+ /**
+ * Initialize the current Layouter with data's out of an other Layouter.
+ *
+ * This Method copies the internal fields, groups and titles
+ * @param aOtherLayouter
+ */
+ public void initializeData(IReportBuilderLayouter aOtherLayouter);
+
+ public void loadAndSetBackgroundTemplate(String LayoutTemplatePath);
+}
diff --git a/wizards/com/sun/star/wizards/report/IReportDefinitionReadAccess.java b/wizards/com/sun/star/wizards/report/IReportDefinitionReadAccess.java
new file mode 100755
index 000000000000..59fd096fe363
--- /dev/null
+++ b/wizards/com/sun/star/wizards/report/IReportDefinitionReadAccess.java
@@ -0,0 +1,61 @@
+ /*
+ ************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ***********************************************************************
+ */
+package com.sun.star.wizards.report;
+
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.report.XReportDefinition;
+
+/**
+ * This interface contains only one function to give access to the ReportDefinition.
+ * The ReportDefinition will be initialized very late, late after the ReportLayouters.
+ * So we need this interface for the late access.
+ * @author ll93751
+ */
+public interface IReportDefinitionReadAccess
+{
+
+ /**
+ * Gives access to a ReportDefinition, if initialized.
+ * @return a ReportDefinition or null.
+ */
+ public XReportDefinition getReportDefinition(); /* should throw NullPointerException but does not. */
+
+
+ /**
+ * This ServiceFactory is the 'global' Service Factory, which knows all and every thing in the program.
+ * @return the global service factory of the program
+ */
+ public XMultiServiceFactory getGlobalMSF();
+
+ /**
+ * Returns the file path to the default report definition, we need this name for early initialisation
+ * @return
+ */
+ public String getDefaultHeaderLayout();
+}
diff --git a/wizards/com/sun/star/wizards/report/IReportDocument.java b/wizards/com/sun/star/wizards/report/IReportDocument.java
new file mode 100644
index 000000000000..702a776f9c98
--- /dev/null
+++ b/wizards/com/sun/star/wizards/report/IReportDocument.java
@@ -0,0 +1,268 @@
+/*
+ ************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+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;
+
+/**
+ * New Interface which gives us the possibility to switch on the fly between the old
+ * Wizard and the new Sun Report Builder Wizard, which use the same UI.
+ *
+ * @author ll93751
+ */
+public interface IReportDocument
+{
+ // -------------------------------------------------------------------------
+ // initialisation
+ // -------------------------------------------------------------------------
+ public void initialize(
+ final XDatabaseDocumentUI i_documentUI,
+ final Resource i_resource
+ );
+
+ // -------------------------------------------------------------------------
+ // Access Helper
+ // -------------------------------------------------------------------------
+ /**
+ * Gives access to the DB Values
+ * @return
+ */
+ public com.sun.star.wizards.db.RecordParser getRecordParser();
+
+ /**
+ * Give access to the parent document
+ * It is a document in the old Wizard
+ * It is a Report Builder in the new Wizard
+ * @return
+ */
+ public com.sun.star.awt.XWindowPeer getWizardParent();
+
+ /**
+ *
+ * @return the Frame of the document Window or Report Builder Window
+ */
+ public com.sun.star.frame.XFrame getFrame();
+
+ public XComponent getComponent();
+
+ // -------------------------------------------------------------------------
+ // First step: After entering the table name, select fields
+ // -------------------------------------------------------------------------
+ /**
+ * Is called after first step, set Tablename and the fields, which should occur in the Report.
+ * @param _aType
+ * @param TableName
+ * @param FieldNames
+ */
+ public void initializeFieldColumns(final int _aType, final String TableName, final String[] FieldNames);
+
+ /**
+ * Empties the report document
+ */
+ public void clearDocument();
+
+ /**
+ * Empties the report document, if we called back, don't remove Grouping/Sorting
+ */
+ public void removeTextTableAndTextSection();
+
+ // -------------------------------------------------------------------------
+ // Second step: Label field titles
+ // -------------------------------------------------------------------------
+ /**
+ * Set new names for the titles
+ * @param sFieldTitles
+ */
+ public void setFieldTitles(final String[] sFieldTitles);
+
+ /**
+ * Change a the name of the 'title' of one field.
+ * It is possible to give all element names new names which are used as
+ * element title of a given element name.
+ * This is only used as a preview
+ * @param FieldName
+ * @param TitleName
+ */
+ public void liveupdate_changeUserFieldContent(final String FieldName, final String TitleName);
+ // -------------------------------------------------------------------------
+ // Third step: Grouping
+ // -------------------------------------------------------------------------
+ /* Grouping Page */
+ // Document should not hold the grouping information!
+ /**
+ * Called by press ('greater then') add a group to the group list
+ * @param GroupNames
+ * @param CurGroupTitle
+ * @param GroupFieldVector
+ * @param ReportPath
+ * @param iSelCount
+ * @return
+ */
+ public boolean liveupdate_addGroupNametoDocument(String[] GroupNames, String CurGroupTitle, Vector GroupFieldVector, ArrayList ReportPath, int iSelCount);
+
+ public void refreshGroupFields(String[] _sNewNames);
+ // public boolean isGroupField(String _FieldName);
+ /**
+ * Called by press ('less then') Removes an already set Groupname out of the list
+ * @param NewSelGroupNames
+ * @param CurGroupTitle
+ * @param GroupFieldVector
+ */
+ public void liveupdate_removeGroupName(String[] NewSelGroupNames, String CurGroupTitle, java.util.Vector GroupFieldVector);
+
+ /**
+ * set the list how to group
+ * @param aGroupList
+ */
+ public void setGrouping(String[] aGroupList);
+ // -------------------------------------------------------------------------
+ // Fourth step: Sorting
+ // -------------------------------------------------------------------------
+ /**
+ * Set the list how to sort
+ * @param aSort
+ */
+ public void setSorting(String[][] aSort);
+ // -------------------------------------------------------------------------
+ // Fivth step: Templates / Layout
+ // -------------------------------------------------------------------------
+ /* Template Page */
+ public void setPageOrientation(int nOrientation) throws com.sun.star.lang.IllegalArgumentException;
+
+ public int getDefaultPageOrientation();
+
+ public ArrayList getReportPath();
+
+ public String getLayoutPath();
+
+ public String getContentPath();
+
+ /**
+ * Called if a new Layout is selected
+ * @param LayoutTemplatePath
+ */
+ public void liveupdate_changeLayoutTemplate(String LayoutTemplatePath/*, String BitmapPath*/);
+
+ /**
+ * Called if a new Template is selected
+ * @param ContentTemplatePath
+ */
+ public void liveupdate_changeContentTemplate(String ContentTemplatePath);
+
+ // public String[] getLayoutTemplates();
+ // public String[] getContentTemplates();
+ public void layout_selectFirstPage();
+
+ public void layout_setupRecordSection(String TemplateName);
+ // -------------------------------------------------------------------------
+ // finishing
+ // -------------------------------------------------------------------------
+ // preview (update titlenames)
+ // addTextListener
+ /**
+ * Set the Title into the document from the 'Create Report Page'
+ * BUG: The Title is empty after create Report.
+ * @param _sTitleName
+ */
+ public void liveupdate_updateReportTitle(String _sTitleName);
+
+ /**
+ * Store the document by the given name
+ * @param Name
+ * @param OpenMode
+ */
+ public void store(String Name, int OpenMode) throws com.sun.star.uno.Exception;
+
+ /**
+ * The current report is added to the DB View under the given name
+ *
+ * TODO: add Name to this functionality
+ */
+ public void addReportToDBView();
+
+ public void importReportData(ReportWizard aWizard);
+
+ /**
+ * Create the final Report document
+ * @param Name
+ * @param _bAsTemplate
+ * @param _bOpenInDesign
+ * @return
+ */
+ public void createAndOpenReportDocument(
+ final String Name,
+ final boolean _bAsTemplate,
+ final boolean _bOpenInDesign
+ );
+
+ public void dispose();
+ // -------------------------------------------------------------------------
+ // Garbage dump
+ // -------------------------------------------------------------------------
+ /* DataImport */
+ // ???
+ // public void addTextSectionCopies();
+ // ???
+ public boolean reconnectToDatabase(XMultiServiceFactory xMSF, PropertyValue[] Properties);
+ // ???
+ public void insertDatabaseDatatoReportDocument(XMultiServiceFactory xMSF);
+ // ???
+ // public com.sun.star.lang.XMultiServiceFactory getDocumentServiceFactory();
+ /**
+ * set a internal variable to stop a maybe longer DB access.
+ */
+ public void StopProcess(); // cancel
+
+ /**
+ * Returns a string list of layouts.
+ * @return
+ */
+ public String[][] getDataLayout();
+
+ /**
+ * Returns a string list of header layouts
+ * @return
+ */
+ public String[][] getHeaderLayout();
+
+ public void setCommandType(int CommandType);
+
+ public void setCommand(String Command);
+
+ /**
+ * check internal invariants
+ * @throws a
+ */
+ public void checkInvariants() throws java.lang.Exception;
+}
diff --git a/wizards/com/sun/star/wizards/report/MANIFEST.MF b/wizards/com/sun/star/wizards/report/MANIFEST.MF
new file mode 100644
index 000000000000..1a4f8da6e3b0
--- /dev/null
+++ b/wizards/com/sun/star/wizards/report/MANIFEST.MF
@@ -0,0 +1,2 @@
+RegistrationClassName: com.sun.star.wizards.report.CallReportWizard
+UNO-Type-Path:
diff --git a/wizards/com/sun/star/wizards/report/RecordTable.java b/wizards/com/sun/star/wizards/report/RecordTable.java
new file mode 100644
index 000000000000..b4af7f7fa94b
--- /dev/null
+++ b/wizards/com/sun/star/wizards/report/RecordTable.java
@@ -0,0 +1,99 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+package com.sun.star.wizards.report;
+
+import com.sun.star.container.XIndexAccess;
+import com.sun.star.container.XNameAccess;
+import com.sun.star.container.XNamed;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.table.XCellRange;
+import com.sun.star.table.XTableColumns;
+import com.sun.star.table.XTableRows;
+import com.sun.star.text.XTextTable;
+import com.sun.star.uno.Exception;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.wizards.text.TextTableHandler;
+import com.sun.star.wizards.text.ViewHandler;
+
+public class RecordTable
+{
+
+ String CurFieldName;
+ String LabelDescription;
+ public XNamed xTableName;
+ public XCellRange xCellRange;
+ public XTextTable xTextTable;
+ private TextTableHandler oTextTableHandler;
+ public XTableColumns xTableColumns;
+ public XTableRows xTableRows;
+
+ public RecordTable(TextTableHandler _oTextTableHandler)
+ {
+ try
+ {
+ this.oTextTableHandler = _oTextTableHandler;
+ String[] TableNames = oTextTableHandler.xTextTablesSupplier.getTextTables().getElementNames();
+ XNameAccess xAllTextTables = oTextTableHandler.xTextTablesSupplier.getTextTables();
+ if ((xAllTextTables.hasByName(ReportTextDocument.TBLRECORDSECTION)) || (xAllTextTables.hasByName(ReportTextDocument.COPYOFTBLRECORDSECTION)))
+ {
+ Object oTable;
+ if (xAllTextTables.hasByName(ReportTextDocument.COPYOFTBLRECORDSECTION))
+ {
+ oTable = xAllTextTables.getByName(ReportTextDocument.COPYOFTBLRECORDSECTION);
+ }
+ else
+ {
+ oTable = xAllTextTables.getByName(ReportTextDocument.TBLRECORDSECTION);
+ }
+ xTextTable = (XTextTable) UnoRuntime.queryInterface(XTextTable.class, oTable);
+ xTableName = (XNamed) UnoRuntime.queryInterface(XNamed.class, xTextTable);
+ }
+ else
+ {
+ XIndexAccess xTableIndex = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xAllTextTables);
+ int n = xTableIndex.getCount() - 1;
+ Object x = xTableIndex.getByIndex(n);
+ xTextTable = (XTextTable) UnoRuntime.queryInterface(XTextTable.class, x);
+ xTableName = (XNamed) UnoRuntime.queryInterface(XNamed.class, xTextTable);
+ xTableName.setName(ReportTextDocument.TBLRECORDSECTION);
+ }
+ xTableRows = xTextTable.getRows();
+ xTableColumns = xTextTable.getColumns();
+ xCellRange = (XCellRange) UnoRuntime.queryInterface(XCellRange.class, xTextTable);
+ }
+ catch (Exception exception)
+ {
+ exception.printStackTrace(System.out);
+ }
+ }
+
+ public void adjustOptimalTableWidths(XMultiServiceFactory _xMSF, ViewHandler oViewHandler)
+ { // setTableColumnSeparators(){
+ oTextTableHandler.adjustOptimalTableWidths(_xMSF, xTextTable);
+ oViewHandler.collapseViewCursorToStart();
+ }
+}
diff --git a/wizards/com/sun/star/wizards/report/ReportFinalizer.java b/wizards/com/sun/star/wizards/report/ReportFinalizer.java
new file mode 100644
index 000000000000..1482e118e516
--- /dev/null
+++ b/wizards/com/sun/star/wizards/report/ReportFinalizer.java
@@ -0,0 +1,293 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+package com.sun.star.wizards.report;
+//import com.sun.star.ucb.CommandAbortedException;
+import com.sun.star.ucb.XSimpleFileAccess;
+import com.sun.star.uno.Exception;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+import com.sun.star.wizards.common.Desktop;
+import com.sun.star.wizards.common.*;
+import com.sun.star.wizards.ui.*;
+import com.sun.star.awt.VclWindowPeerAttribute;
+import com.sun.star.awt.XTextComponent;
+//import com.sun.star.container.XHierarchicalNameAccess;
+//import com.sun.star.container.XNameAccess;
+//import com.sun.star.lang.EventObject;
+//import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.wizards.db.RecordParser;
+//import com.sun.star.wizards.document.OfficeDocument;
+public class ReportFinalizer
+{
+
+ WizardDialog CurUnoDialog;
+ XTextComponent xTitleTextBox;
+ XTextComponent[] xSaveTextBox = new XTextComponent[2];
+ Object chkTemplate;
+ String CHANGEREPORTTITLE_FUNCNAME = "changeReportTitle";
+ String TOGGLESUBTEMPLATECONTROLS_FUNCNAME = "toggleSubTemplateControls";
+// String slblHowProceed;
+// String slblChooseReportKind;
+ String TemplatePath;
+ String StoreName;
+ boolean bfinalaskbeforeOverwrite;
+ String DefaultName;
+ String OldDefaultName;
+ // ReportTextDocument CurReportDocument;
+ IReportDocument CurReportDocument;
+ // Desktop.OfficePathRetriever curofficepath;
+// short curtabindex;
+// String sMsgReportDocumentNameDuplicate;
+ public static final int SOCREATEDOCUMENT = 1;
+ public static final int SOCREATETEMPLATE = 2;
+ public static final int SOUSETEMPLATE = 3;
+ private XMultiServiceFactory m_xMSF;
+ // public Finalizer(ReportTextDocument _CurReportDocument, WizardDialog _CurUnoDialog) {
+ public ReportFinalizer(XMultiServiceFactory _xMSF, IReportDocument _CurReportDocument, WizardDialog _CurUnoDialog)
+ {
+ m_xMSF = _xMSF;
+
+ this.CurUnoDialog = _CurUnoDialog;
+ this.CurReportDocument = _CurReportDocument;
+ short curtabindex = (short) (ReportWizard.SOSTOREPAGE * 100);
+ Desktop odesktop = new Desktop();
+ // curofficepath = odesktop.new OfficePathRetriever(m_xMSF);
+
+ String sSaveAsTemplate = CurUnoDialog.m_oResource.getResText(UIConsts.RID_REPORT + 40);
+ String sUseTemplate = CurUnoDialog.m_oResource.getResText(UIConsts.RID_REPORT + 41);
+ String sEditTemplate = CurUnoDialog.m_oResource.getResText(UIConsts.RID_REPORT + 42);
+ String sSaveAsDocument = CurUnoDialog.m_oResource.getResText(UIConsts.RID_REPORT + 43);
+// String sSaveAs = CurUnoDialog.m_oResource.getResText(UIConsts.RID_REPORT + 44);
+ String sReportTitle = CurUnoDialog.m_oResource.getResText(UIConsts.RID_REPORT + 33);
+ String slblHowProceed = CurUnoDialog.m_oResource.getResText(UIConsts.RID_REPORT + 78);
+ String slblChooseReportKind = CurUnoDialog.m_oResource.getResText(UIConsts.RID_REPORT + 79);
+
+ CurUnoDialog.insertControlModel("com.sun.star.awt.UnoControlFixedTextModel", "lblTitle",
+ new String[]
+ {
+ "Height", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ new Integer(8), sReportTitle, new Integer(95), new Integer(27), new Integer(ReportWizard.SOSTOREPAGE), new Short(curtabindex++), new Integer(68)
+ });
+
+ xTitleTextBox = CurUnoDialog.insertTextField("txtTitle", CHANGEREPORTTITLE_FUNCNAME, this,
+ new String[]
+ {
+ "Height", "HelpURL", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ new Integer(12), "HID:34362", new Integer(95), new Integer(37), new Integer(ReportWizard.SOSTOREPAGE), new Short(curtabindex++), new Integer(209)
+ });
+
+ CurUnoDialog.insertControlModel("com.sun.star.awt.UnoControlFixedTextModel", "lblChooseReportKind",
+ new String[]
+ {
+ "Height", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ new Integer(8), slblChooseReportKind, new Integer(95), new Integer(57), new Integer(ReportWizard.SOSTOREPAGE), new Short(curtabindex++), new Integer(209)
+ });
+
+ CurUnoDialog.insertRadioButton("optCreateDocument", TOGGLESUBTEMPLATECONTROLS_FUNCNAME, this,
+ new String[]
+ {
+ "Height", "HelpURL", "Label", "PositionX", "PositionY", "State", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ new Integer(10), "HID:34371", sSaveAsDocument, new Integer(95), new Integer(69), new Short((short) 0), new Integer(ReportWizard.SOSTOREPAGE), new Short(curtabindex++), new Integer(138)
+ });
+
+ CurUnoDialog.insertRadioButton("optCreateReportTemplate", TOGGLESUBTEMPLATECONTROLS_FUNCNAME, this,
+ new String[]
+ {
+ "Height", "HelpURL", "Label", "PositionX", "PositionY", "State", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ new Integer(8), "HID:34370", sSaveAsTemplate, new Integer(95), new Integer(81), new Short((short) 1), new Integer(ReportWizard.SOSTOREPAGE), new Short(curtabindex++), new Integer(209)
+ });
+
+
+ CurUnoDialog.insertControlModel("com.sun.star.awt.UnoControlFixedTextModel", "lblHowProceed",
+ new String[]
+ {
+ "Height", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ new Integer(8), slblHowProceed, new Integer(105), new Integer(93), new Integer(ReportWizard.SOSTOREPAGE), new Short(curtabindex++), new Integer(209)
+ });
+
+
+ CurUnoDialog.insertRadioButton("optEditTemplate", TOGGLESUBTEMPLATECONTROLS_FUNCNAME, this,
+ new String[]
+ {
+ "Height", "HelpURL", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ new Integer(10), "HID:34374", sEditTemplate, new Integer(111), new Integer(105), new Integer(6), new Short(curtabindex++), new Integer(138)
+ });
+
+ CurUnoDialog.insertRadioButton("optUseTemplate", TOGGLESUBTEMPLATECONTROLS_FUNCNAME, this,
+ new String[]
+ {
+ "Height", "HelpURL", "Label", "PositionX", "PositionY", "State", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ new Integer(10), "HID:34375", sUseTemplate, new Integer(111), new Integer(115), new Short((short) 1), new Integer(ReportWizard.SOSTOREPAGE), new Short(curtabindex++), new Integer(138)
+ });
+ }
+
+
+ /*
+ * This function is called if one of the radio buttons is pressed
+ */
+ public void toggleSubTemplateControls()
+ {
+ // String sStorePath = "";
+ Short iState = (Short) CurUnoDialog.getControlProperty("optCreateReportTemplate", "State");
+ boolean bDoTemplateEnable = iState.shortValue() == 1;
+ CurUnoDialog.setControlProperty("optEditTemplate", "Enabled", new Boolean(bDoTemplateEnable));
+ CurUnoDialog.setControlProperty("optUseTemplate", "Enabled", new Boolean(bDoTemplateEnable));
+ CurUnoDialog.setControlProperty("lblHowProceed", "Enabled", new Boolean(bDoTemplateEnable));
+
+ String sTitle = xTitleTextBox.getText();
+ boolean bDoEnable = sTitle.equals("");
+ CurUnoDialog.enableFinishButton(!bDoEnable);
+ }
+// private boolean fileexists(XMultiServiceFactory _xMSF, String _spath){
+// try {
+// XInterface xUcbInterface = (XInterface) _xMSF.createInstance("com.sun.star.ucb.SimpleFileAccess");
+// XSimpleFileAccess xSimpleFileAccess = (XSimpleFileAccess) com.sun.star.uno.UnoRuntime.queryInterface(XSimpleFileAccess.class, xUcbInterface);
+// return xSimpleFileAccess.exists(_spath);
+// } catch (Exception exception) {
+// exception.printStackTrace(System.out);
+// return false;
+// }}
+ public void initialize(RecordParser _CurDBMetaData)
+ {
+ String FirstCommandName = (_CurDBMetaData.getIncludedCommandNames())[0];
+ DefaultName = Desktop.getUniqueName(_CurDBMetaData.getReportDocuments(), FirstCommandName);
+ if (DefaultName.equals(OldDefaultName) == false)
+ {
+ OldDefaultName = DefaultName;
+ }
+ xTitleTextBox.setText(DefaultName);
+ }
+
+ public String getStoreName()
+ {
+ if (CurUnoDialog != null)
+ {
+ String LocStoreName = xTitleTextBox.getText();
+ if (!LocStoreName.equals(""))
+ {
+ StoreName = LocStoreName;
+ }
+ }
+ return (StoreName);
+ }
+
+ public String getStorePath()
+ {
+ try
+ {
+ StoreName = getStoreName();
+ String StorePath;
+ XInterface xInterface = (XInterface) m_xMSF.createInstance("com.sun.star.ucb.SimpleFileAccess");
+ XSimpleFileAccess xSimpleFileAccess = (XSimpleFileAccess) UnoRuntime.queryInterface(XSimpleFileAccess.class, xInterface);
+ StorePath = FileAccess.getOfficePath(m_xMSF, "Temp", xSimpleFileAccess) + "/" + StoreName;
+ return StorePath;
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace(System.out);
+ return "";
+ }
+ }
+
+ public void changeReportTitle()
+ {
+ final String TitleName = xTitleTextBox.getText();
+ CurReportDocument.liveupdate_updateReportTitle(TitleName);
+ CurUnoDialog.enableFinishButton(!"".equals(TitleName));
+ }
+
+ public int getReportOpenMode()
+ {
+ int ReportMode = SOCREATEDOCUMENT;
+ boolean bcreateTemplate = ((Short) CurUnoDialog.getControlProperty("optCreateReportTemplate", "State")).shortValue() == (short) 1;
+ if (bcreateTemplate)
+ {
+ ReportMode = SOCREATETEMPLATE;
+ }
+ boolean buseTemplate = ((Short) CurUnoDialog.getControlProperty("optUseTemplate", "State")).shortValue() == (short) 1;
+ if (buseTemplate)
+ {
+ ReportMode = SOUSETEMPLATE;
+ }
+ boolean buseDocument = ((Short) CurUnoDialog.getControlProperty("optCreateDocument", "State")).shortValue() == (short) 1;
+ if (buseDocument)
+ {
+ ReportMode = SOCREATEDOCUMENT;
+ }
+ return ReportMode;
+ }
+
+ public boolean finish()
+ {
+ StoreName = getStoreName();
+ if (!CurReportDocument.getRecordParser().getReportDocuments().hasByHierarchicalName(StoreName))
+ {
+ try
+ {
+ CurReportDocument.store(StoreName, getReportOpenMode());
+ ReportWizard.bCloseDocument = false;
+ return true;
+ }
+ catch(Exception e)
+ {
+ CurUnoDialog.showMessageBox("ErrorBox", VclWindowPeerAttribute.OK,e.getLocalizedMessage() );
+ CurUnoDialog.enableFinishButton(false);
+ return false;
+ }
+ }
+ String sMsgReportDocumentNameDuplicate = CurUnoDialog.m_oResource.getResText(UIConsts.RID_REPORT + 76);
+ String sShowMsgReportNameisDuplicate = JavaTools.replaceSubString(sMsgReportDocumentNameDuplicate, StoreName, "%REPORTNAME");
+ /* int iMsg = */ CurUnoDialog.showMessageBox("ErrorBox", VclWindowPeerAttribute.OK, sShowMsgReportNameisDuplicate);
+ CurUnoDialog.enableFinishButton(false);
+ return false;
+ }
+}
diff --git a/wizards/com/sun/star/wizards/report/ReportImplementationHelper.java b/wizards/com/sun/star/wizards/report/ReportImplementationHelper.java
new file mode 100644
index 000000000000..a8d26d68cd41
--- /dev/null
+++ b/wizards/com/sun/star/wizards/report/ReportImplementationHelper.java
@@ -0,0 +1,68 @@
+/*
+ ************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+package com.sun.star.wizards.report;
+
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.wizards.db.RecordParser;
+
+/**
+ *
+ * @author ll93751
+ */
+public class ReportImplementationHelper
+{
+
+ private RecordParser m_aCurDBMetaData;
+ private XMultiServiceFactory m_xMSF;
+ protected int m_nDefaultPageOrientation;
+
+ /**
+ *
+ * @param _aMSF
+ * @param _nOrientation
+ */
+ public ReportImplementationHelper(XMultiServiceFactory _aMSF, int _nOrientation)
+ {
+ m_xMSF = _aMSF;
+ m_nDefaultPageOrientation = _nOrientation;
+ }
+
+ public RecordParser getRecordParser()
+ {
+ if (m_aCurDBMetaData == null)
+ {
+ m_aCurDBMetaData = new RecordParser(getMSF());
+ }
+ return m_aCurDBMetaData;
+ }
+
+ public XMultiServiceFactory getMSF()
+ {
+ return m_xMSF;
+ }
+}
diff --git a/wizards/com/sun/star/wizards/report/ReportLayouter.java b/wizards/com/sun/star/wizards/report/ReportLayouter.java
new file mode 100644
index 000000000000..d1532b47dc4a
--- /dev/null
+++ b/wizards/com/sun/star/wizards/report/ReportLayouter.java
@@ -0,0 +1,341 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+package com.sun.star.wizards.report;
+
+import com.sun.star.awt.XListBox;
+// import com.sun.star.awt.XTextComponent;
+import com.sun.star.lang.EventObject;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.wizards.common.*;
+import com.sun.star.wizards.ui.*;
+
+public class ReportLayouter
+{
+
+ UnoDialog CurUnoDialog;
+// static String sOrientationHeader;
+// static String sOrientVertical;
+// static String sOrientHorizontal;
+ final int SOTXTTITLE = 28;
+ final int SOCONTENTLST = 29;
+ final static public int SOOPTLANDSCAPE = 30;
+ final static public int SOOPTPORTRAIT = 31;
+ final int SOLAYOUTLST = 32;
+// static String sReportTitle;
+// static String slblDataStructure;
+// static String slblPageLayout;
+// static String sOrganizeFields;
+ XListBox xContentListBox;
+ XListBox xLayoutListBox;
+ int iOldContentPos;
+ int iOldLayoutPos;
+ // ReportTextDocument CurReportDocument;
+ IReportDocument CurReportDocument;
+ public String[][] LayoutFiles;
+ public String[][] ContentFiles;
+ // private Desktop.OfficePathRetriever curofficepath;
+ Object aOrientationImage;
+ // boolean m_bLandscape = true;
+ private XMultiServiceFactory m_xMSF;
+
+ public ReportLayouter(XMultiServiceFactory _xMSF, IReportDocument _CurReportDocument, UnoDialog _CurUnoDialog)
+ {
+ m_xMSF = _xMSF;
+ try
+ {
+ short curtabindex = (short) (100 * ReportWizard.SOTEMPLATEPAGE);
+ this.CurUnoDialog = _CurUnoDialog;
+ this.CurReportDocument = _CurReportDocument;
+ //TODO the constructor for the OfficePathRetriever is redundant and should be instantiated elsewhere
+ // Desktop odesktop = new Desktop();
+ // curofficepath = odesktop.new OfficePathRetriever(m_xMSF);
+ String slblDataStructure = CurUnoDialog.m_oResource.getResText(UIConsts.RID_REPORT + 15);
+ String slblPageLayout = CurUnoDialog.m_oResource.getResText(UIConsts.RID_REPORT + 16);
+// String sOrganizeFields = CurUnoDialog.m_oResource.getResText(UIConsts.RID_REPORT + 19);
+
+ String sOrientationHeader = CurUnoDialog.m_oResource.getResText(UIConsts.RID_REPORT + 22);
+ String sOrientVertical = CurUnoDialog.m_oResource.getResText(UIConsts.RID_REPORT + 23);
+ String sOrientHorizontal = CurUnoDialog.m_oResource.getResText(UIConsts.RID_REPORT + 24);
+
+ // XInterface xUcbInterface = (XInterface) m_xMSF.createInstance("com.sun.star.ucb.SimpleFileAccess");
+ // XSimpleFileAccess xSimpleFileAccess = (XSimpleFileAccess) com.sun.star.uno.UnoRuntime.queryInterface(XSimpleFileAccess.class, xUcbInterface);
+ // boolean bcntexists = xSimpleFileAccess.exists(CurReportDocument.getReportPath() + "/cnt-default.ott");
+ // boolean bstlexists = xSimpleFileAccess.exists(CurReportDocument.getReportPath() + "/stl-default.ott");
+ // if ((bcntexists == false) || (bstlexists == false))
+ // throw new NoValidPathException(CurReportDocument.xMSF);
+
+
+ CurUnoDialog.insertControlModel("com.sun.star.awt.UnoControlFixedTextModel", "lblContent",
+ new String[]
+ {
+ "Height", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ new Integer(8), slblDataStructure, new Integer(95), new Integer(27), new Integer(ReportWizard.SOTEMPLATEPAGE), new Short(curtabindex++), new Integer(99)
+ });
+
+ short iSelPos = 0;
+// ContentFiles = FileAccess.getFolderTitles(m_xMSF, "cnt", CurReportDocument.getReportPath());
+ ContentFiles = CurReportDocument.getDataLayout();
+ iSelPos = (short) JavaTools.FieldInList(ContentFiles[1], CurReportDocument.getContentPath());
+ if (iSelPos < 0)
+ {
+ iSelPos = 0;
+ }
+ iOldContentPos = (int) iSelPos;
+ xContentListBox = CurUnoDialog.insertListBox("lstContent", SOCONTENTLST, new ActionListenerImpl(), new ItemListenerImpl(),
+ new String[]
+ {
+ "Height", "HelpURL", "PositionX", "PositionY", "SelectedItems", "Step", "StringItemList", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ new Integer(108), "HID:34363", new Integer(95), new Integer(37), new short[]
+ {
+ iSelPos
+ }, new Integer(ReportWizard.SOTEMPLATEPAGE), ContentFiles[0], new Short(curtabindex++), new Integer(99)
+ });
+
+ CurUnoDialog.insertControlModel("com.sun.star.awt.UnoControlFixedTextModel", "lblLayout",
+ new String[]
+ {
+ "Height", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ new Integer(8), slblPageLayout, new Integer(205), new Integer(27), new Integer(ReportWizard.SOTEMPLATEPAGE), new Short(curtabindex++), new Integer(99)
+ });
+
+ short iSelLayoutPos = 0;
+// LayoutFiles = FileAccess.getFolderTitles(m_xMSF, "stl", CurReportDocument.getReportPath());
+ LayoutFiles = CurReportDocument.getHeaderLayout();
+ iSelLayoutPos = (short) JavaTools.FieldInList(LayoutFiles[1], CurReportDocument.getLayoutPath());
+ if (iSelLayoutPos < 0)
+ {
+ iSelLayoutPos = (short) JavaTools.FieldInList(LayoutFiles[0], CurReportDocument.getLayoutPath());
+ if (iSelLayoutPos < 0)
+ {
+ iSelLayoutPos = 0;
+ }
+ }
+ xLayoutListBox = CurUnoDialog.insertListBox("lstLayout", SOLAYOUTLST, new ActionListenerImpl(), new ItemListenerImpl(),
+ new String[]
+ {
+ "Height", "HelpURL", "PositionX", "PositionY", "SelectedItems", "Step", "StringItemList", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ new Integer(108), "HID:34364", new Integer(205), new Integer(37), new short[]
+ {
+ iSelLayoutPos
+ }, new Integer(ReportWizard.SOTEMPLATEPAGE), LayoutFiles[0], new Short(curtabindex++), new Integer(99)
+ });
+ iOldLayoutPos = (int) iSelPos;
+ CurUnoDialog.insertControlModel("com.sun.star.awt.UnoControlFixedTextModel", "lblOrientation",
+ new String[]
+ {
+ "Height", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ new Integer(8), sOrientationHeader, new Integer(95), new Integer(148), new Integer(ReportWizard.SOTEMPLATEPAGE), new Short(curtabindex++), new Integer(74)
+ });
+
+ short m_nLandscapeState = CurReportDocument.getDefaultPageOrientation() == SOOPTLANDSCAPE ? (short) 1 : 0;
+ CurUnoDialog.insertRadioButton("optLandscape", SOOPTLANDSCAPE, new ItemListenerImpl(),
+ new String[]
+ {
+ "Height", "HelpURL", "Label", "PositionX", "PositionY", "State", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ new Integer(10), "HID:34365", sOrientHorizontal, new Integer(101), new Integer(158), new Short(m_nLandscapeState), new Integer(ReportWizard.SOTEMPLATEPAGE), new Short(curtabindex++), new Integer(60)
+ });
+
+ short m_nPortraitState = CurReportDocument.getDefaultPageOrientation() == SOOPTPORTRAIT ? (short) 1 : (short) 0;
+ CurUnoDialog.insertRadioButton("optPortrait", SOOPTPORTRAIT, new ItemListenerImpl(),
+ new String[]
+ {
+ "Height", "HelpURL", "Label", "PositionX", "PositionY", "State", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ new Integer(10), "HID:34366", sOrientVertical, new Integer(101), new Integer(171), new Short(m_nPortraitState), new Integer(ReportWizard.SOTEMPLATEPAGE), new Short(curtabindex++), new Integer(60)
+ });
+
+ aOrientationImage = CurUnoDialog.insertControlModel("com.sun.star.awt.UnoControlImageControlModel", "imgOrientation",
+ new String[]
+ {
+ "Border", "Height", "PositionX", "PositionY", "ScaleImage", "Step", "Width"
+ },
+ new Object[]
+ {
+ new Short("0"), new Integer(23), new Integer(164), new Integer(158), new Boolean(false), new Integer(ReportWizard.SOTEMPLATEPAGE), new Integer(30)
+ });
+
+ String sNote = ReportWizard.getBlindTextNote(CurReportDocument, CurUnoDialog.m_oResource);
+ CurUnoDialog.insertControlModel("com.sun.star.awt.UnoControlFixedTextModel", "lblBlindTextNote_2",
+ new String[]
+ {
+ "Height", "Label", "MultiLine", "PositionX", "PositionY", "Step", "Width"
+ },
+ new Object[]
+ {
+ new Integer(34), sNote, new Boolean(true), new Integer(205), new Integer(148), new Integer(ReportWizard.SOTEMPLATEPAGE), new Integer(99)
+ });
+ if (m_nLandscapeState == 1)
+ {
+ CurUnoDialog.getPeerConfiguration().setImageUrl(aOrientationImage, 1002, 1003);
+ }
+ else
+ {
+ CurUnoDialog.getPeerConfiguration().setImageUrl(aOrientationImage, 1000, 1001);
+ }
+ }
+ catch (Exception exception)
+ {
+ exception.printStackTrace(System.out);
+ }
+ }
+
+ public void initialize(String _defaultTemplatePath)
+ {
+// CurReportDocument.getDoc().xTextDocument.lockControllers();
+ CurReportDocument.layout_setupRecordSection(_defaultTemplatePath);
+ if (CurUnoDialog.getControlProperty("txtTitle", "Text").equals(""))
+ {
+ String[] sCommandNames = CurReportDocument.getRecordParser().getIncludedCommandNames();
+ CurUnoDialog.setControlProperty("txtTitle", "Text", sCommandNames[0]);
+ }
+ // CurReportDocument.getDoc().oViewHandler.selectFirstPage(CurReportDocument.getDoc().oTextTableHandler);
+ CurReportDocument.layout_selectFirstPage();
+ CurUnoDialog.setFocus("lblContent");
+// CurReportDocument.getDoc().unlockallControllers();
+ }
+
+ class ItemListenerImpl implements com.sun.star.awt.XItemListener
+ {
+
+ public void itemStateChanged(com.sun.star.awt.ItemEvent EventObject)
+ {
+ try
+ {
+ int iPos;
+ Helper.setUnoPropertyValue(CurUnoDialog.xDialogModel, "Enabled", new Boolean(false));
+ // LLA: should we lock controllers here?
+ // CurReportDocument.getDoc().xTextDocument.lockControllers();
+ int iKey = CurUnoDialog.getControlKey(EventObject.Source, CurUnoDialog.ControlList);
+ switch (iKey)
+ {
+ case SOCONTENTLST:
+ iPos = xContentListBox.getSelectedItemPos();
+ if (iPos != iOldContentPos)
+ {
+ iOldContentPos = iPos;
+ CurReportDocument.liveupdate_changeContentTemplate(ContentFiles[1][iPos]);
+ }
+ break;
+
+ case SOLAYOUTLST:
+ iPos = xLayoutListBox.getSelectedItemPos();
+ if (iPos != iOldLayoutPos)
+ {
+ iOldLayoutPos = iPos;
+ CurReportDocument.liveupdate_changeLayoutTemplate(LayoutFiles[1][iPos]/*, Desktop.getBitmapPath(m_xMSF)*/);
+ }
+ break;
+
+ case SOOPTLANDSCAPE:
+ // CurReportDocument.getDoc().changePageOrientation(true);
+ try
+ {
+ CurReportDocument.setPageOrientation(SOOPTLANDSCAPE);
+ }
+ catch (com.sun.star.lang.IllegalArgumentException e)
+ {
+ }
+ Helper.setUnoPropertyValue(aOrientationImage, "ImageURL", CurUnoDialog.getWizardImageUrl(1002, 1003));
+
+ break;
+
+ case SOOPTPORTRAIT:
+ // CurReportDocument.getDoc().changePageOrientation( false);
+ try
+ {
+ CurReportDocument.setPageOrientation(SOOPTPORTRAIT);
+ }
+ catch (com.sun.star.lang.IllegalArgumentException e)
+ {
+ }
+
+ CurUnoDialog.setControlProperty("imgOrientation", "ImageURL", Desktop.getBitmapPath(m_xMSF) + "/portrait.gif");
+ Helper.setUnoPropertyValue(aOrientationImage, "ImageURL", CurUnoDialog.getWizardImageUrl(1000, 1001));
+ break;
+
+ default:
+ break;
+ }
+ }
+ catch (RuntimeException e)
+ {
+ e.printStackTrace();
+ }
+ // CurReportDocument.getDoc().unlockallControllers();
+ Helper.setUnoPropertyValue(CurUnoDialog.xDialogModel, "Enabled", new Boolean(true));
+ }
+
+ public void disposing(EventObject eventObject)
+ {
+ }
+ }
+
+ class ActionListenerImpl implements com.sun.star.awt.XActionListener
+ {
+
+ public void disposing(EventObject eventObject)
+ {
+ }
+
+ public void actionPerformed(com.sun.star.awt.ActionEvent actionEvent)
+ {
+ try
+ {
+ Helper.setUnoPropertyValue(CurUnoDialog.xDialogModel, "Enabled", new Boolean(false));
+// CurReportDocument.getDoc().xTextDocument.lockControllers();
+ boolean blandscape = (((Short) CurUnoDialog.getControlProperty("optLandscape", "State")).shortValue() == 1);
+ CurReportDocument.setPageOrientation((blandscape == true) ? SOOPTLANDSCAPE : SOOPTPORTRAIT);
+ }
+ catch (Exception exception)
+ {
+ exception.printStackTrace(System.out);
+ }
+// CurReportDocument.getDoc().unlockallControllers();
+ Helper.setUnoPropertyValue(CurUnoDialog.xDialogModel, "Enabled", new Boolean(true));
+ }
+ }
+}
diff --git a/wizards/com/sun/star/wizards/report/ReportTextDocument.java b/wizards/com/sun/star/wizards/report/ReportTextDocument.java
new file mode 100644
index 000000000000..3ab9e704b9b9
--- /dev/null
+++ b/wizards/com/sun/star/wizards/report/ReportTextDocument.java
@@ -0,0 +1,786 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+package com.sun.star.wizards.report;
+
+import com.sun.star.lang.IllegalArgumentException;
+import com.sun.star.text.XRelativeTextContentRemove;
+import com.sun.star.text.XTextContent;
+import java.util.ArrayList;
+import java.util.Comparator;
+import java.util.Vector;
+
+import com.sun.star.awt.Rectangle;
+import com.sun.star.awt.VclWindowPeerAttribute;
+import com.sun.star.container.XNameAccess;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.uno.AnyConverter;
+import com.sun.star.uno.Exception;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.wizards.db.*;
+import com.sun.star.wizards.common.*;
+import com.sun.star.wizards.ui.*;
+import com.sun.star.sdb.CommandType;
+// import com.sun.star.table.XCell;
+import com.sun.star.text.XTextDocument;
+import com.sun.star.wizards.common.JavaTools;
+import com.sun.star.wizards.text.TextTableHandler;
+import com.sun.star.wizards.text.TextSectionHandler;
+import com.sun.star.wizards.text.TextStyleHandler;
+import com.sun.star.wizards.text.TextFieldHandler;
+import com.sun.star.wizards.text.ViewHandler;
+import com.sun.star.wizards.document.FormHandler;
+
+class ReportTextDocument extends com.sun.star.wizards.text.TextDocument implements Comparator
+{
+ // private XMultiServiceFactory xMSF;
+ // private XMultiServiceFactory xMSFDoc;
+ private Object ReportPageStyle;
+ private Object FirstPageStyle;
+ private int PageWidth;
+ private Rectangle PosSize;
+ // private String ReportFolderName;
+ public Vector DBColumnsVector;
+ private RecordTable CurRecordTable;
+ private String sMsgTableNotExisting;
+ private String sMsgCommonReportError;
+ private String ContentTemplatePath;
+ private String LayoutTemplatePath;
+ // private String sMsgInvalidTextField;
+ private String sMsgEndAutopilot;
+ public boolean bIsCurLandscape;
+ public TextTableHandler oTextTableHandler;
+ public TextSectionHandler oTextSectionHandler;
+ public FormHandler oFormHandler;
+ public TextStyleHandler oTextStyleHandler;
+ public TextFieldHandler oTextFieldHandler;
+ public ViewHandler oViewHandler;
+ public NumberFormatter oNumberFormatter;
+ public static final String TBLRECORDSECTION = "Tbl_RecordSection";
+ public static final String TBLGROUPSECTION = "Tbl_GroupField";
+ public static final String RECORDSECTION = "RecordSection";
+ public static final String GROUPSECTION = "GroupField";
+ public static final String COPYOFTBLRECORDSECTION = "CopyOf" + TBLRECORDSECTION;
+ public static final String COPYOFTBLGROUPSECTION = "CopyOf" + TBLGROUPSECTION;
+ public static final String COPYOFRECORDSECTION = "CopyOf" + RECORDSECTION;
+ public static final String COPYOFGROUPSECTION = "CopyOf" + GROUPSECTION;
+ private RecordParser CurDBMetaData;
+
+ /** Creates new ReportDocument */
+ public ReportTextDocument(XMultiServiceFactory xMSF, XTextDocument _textDocument, Resource oResource, RecordParser _aRP)
+ {
+ super(xMSF, _textDocument, false);
+ lateInit(oResource, _aRP);
+ }
+
+ public ReportTextDocument(XMultiServiceFactory xMSF, String _sPreviewURL, Resource oResource, RecordParser _aRP)
+ {
+ super(xMSF, _sPreviewURL, true, null);
+ lateInit(oResource, _aRP);
+ }
+
+ void lateInit(Resource oResource, RecordParser _aRecordParser)
+ {
+ oTextTableHandler = new TextTableHandler(xMSFDoc, xTextDocument);
+ oTextSectionHandler = new TextSectionHandler(xMSFDoc, xTextDocument);
+ oFormHandler = new FormHandler(xMSFDoc, xTextDocument);
+ oTextStyleHandler = new TextStyleHandler(xMSFDoc, xTextDocument);
+ oViewHandler = new ViewHandler(xMSFDoc, xTextDocument);
+ oTextFieldHandler = new TextFieldHandler(xMSFDoc, xTextDocument);
+ DBColumnsVector = new java.util.Vector();
+ oNumberFormatter = oTextTableHandler.getNumberFormatter();
+ // CurDBMetaData = new RecordParser(xMSF); //, CharLocale, oNumberFormatter);
+ CurDBMetaData = _aRecordParser;
+ long lDateCorrection = oNumberFormatter.getNullDateCorrection();
+ oNumberFormatter.setBooleanReportDisplayNumberFormat();
+ oNumberFormatter.setNullDateCorrection(lDateCorrection);
+ // sMsgInvalidTextField = oResource.getResText(UIConsts.RID_REPORT + 73);
+ sMsgTableNotExisting = oResource.getResText(UIConsts.RID_REPORT + 61);
+ sMsgCommonReportError = oResource.getResText(UIConsts.RID_REPORT + 72);
+ sMsgCommonReportError = JavaTools.replaceSubString(sMsgCommonReportError, String.valueOf((char) 13), "<BR>");
+ sMsgEndAutopilot = oResource.getResText(UIConsts.RID_DB_COMMON + 33);
+ sMsgTableNotExisting = sMsgTableNotExisting + (char) 13 + sMsgEndAutopilot;
+ bIsCurLandscape = true;
+ getReportPageStyles();
+ }
+
+ public NumberFormatter getNumberFormatter()
+ {
+ return oNumberFormatter;
+ }
+
+ public boolean checkReportLayoutMode(String[] GroupFieldNames)
+ {
+ try
+ {
+ XNameAccess xTextSections = oTextSectionHandler.xTextSectionsSupplier.getTextSections();
+ Object oTextSection;
+ if (GroupFieldNames.length > 0)
+ {
+ oTextSection = xTextSections.getByName(GROUPSECTION + String.valueOf(1));
+ }
+ else
+ {
+ oTextSection = xTextSections.getByName(RECORDSECTION);
+ }
+ boolean bLayoutMode = AnyConverter.toBoolean(Helper.getUnoPropertyValue(oTextSection, "IsVisible"));
+ return bLayoutMode;
+ }
+ catch (Exception exception)
+ {
+ exception.printStackTrace(System.out);
+ // In doubt we rather suggest this is LayoutMode...
+ return true;
+ }
+ }
+
+ public void swapContentTemplate(String ContentTemplatePath)
+ {
+// unlockallControllers();
+ //xProgressBar.start("", 10);
+ this.ContentTemplatePath = ContentTemplatePath;
+ loadSectionsfromTemplate(ContentTemplatePath);
+ // xProgressBar.setValue(40);
+ oTextStyleHandler.loadStyleTemplates(ContentTemplatePath, "LoadTextStyles");
+ // xProgressBar.setValue(70);
+ if (CurRecordTable != null)
+ {
+ CurRecordTable.adjustOptimalTableWidths(xMSF, oViewHandler);
+ }
+ // xProgressBar.setValue(100);
+ oViewHandler.selectFirstPage(oTextTableHandler);
+ // xProgressBar.end();
+ }
+
+ public void swapLayoutTemplate(String LayoutTemplatePath/*, String BitmapPath*/)
+ {
+ try
+ {
+ // xProgressBar.start("", 10);
+ this.LayoutTemplatePath = LayoutTemplatePath;
+ boolean bOldIsCurLandscape = AnyConverter.toBoolean(Helper.getUnoPropertyValue(ReportPageStyle, "IsLandscape"));
+ oTextStyleHandler.loadStyleTemplates(LayoutTemplatePath, "LoadPageStyles");
+ // xProgressBar.setValue(60);
+ changePageOrientation(bOldIsCurLandscape);
+ // xProgressBar.setValue(100);
+ oViewHandler.selectFirstPage(oTextTableHandler);
+ // xProgressBar.end();
+ }
+ catch (Exception exception)
+ {
+ exception.printStackTrace(System.out);
+ }
+ }
+
+ public void createReportForm(String SOREPORTFORMNAME)
+ {
+ com.sun.star.container.XNameContainer xNamedForm = oFormHandler.insertFormbyName(SOREPORTFORMNAME);
+ XNameAccess xNameAccess = (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, xNamedForm);
+ oFormHandler.insertHiddenControl(xNameAccess, xNamedForm, "CommandType", new String(Integer.toString(CurDBMetaData.getCommandType())));
+ if (CurDBMetaData.getCommandType() == CommandType.QUERY)
+ {
+ oFormHandler.insertHiddenControl(xNameAccess, xNamedForm, "QueryName", CurDBMetaData.getCommandName());
+ // oFormHandler.insertHiddenControl(xNameAccess, xNamedForm, "Command", "");
+ DBMetaData.CommandObject oCommand = CurDBMetaData.getQueryByName(CurDBMetaData.getCommandName());
+ oFormHandler.insertHiddenControl(xNameAccess, xNamedForm, "Command", CurDBMetaData.Command);
+ }
+ else
+ {
+ oFormHandler.insertHiddenControl(xNameAccess, xNamedForm, "QueryName", "");
+ oFormHandler.insertHiddenControl(xNameAccess, xNamedForm, "Command", CurDBMetaData.Command);
+ }
+ oFormHandler.insertHiddenControl(xNameAccess, xNamedForm, "GroupFieldNames", JavaTools.ArraytoString(CurDBMetaData.GroupFieldNames));
+ oFormHandler.insertHiddenControl(xNameAccess, xNamedForm, "FieldNames", JavaTools.ArraytoString(CurDBMetaData.getFieldNames()));
+ oFormHandler.insertHiddenControl(xNameAccess, xNamedForm, "RecordFieldNames", JavaTools.ArraytoString(CurDBMetaData.getRecordFieldNames()));
+ }
+
+ public void updateReportTitle(String _sTitleName)
+ {
+ m_xDocProps.setTitle(_sTitleName);
+ }
+
+ public void getReportPageStyles()
+ {
+ try
+ {
+ Object oPageStyleFamily = oTextStyleHandler.xStyleFamiliesSupplier.getStyleFamilies().getByName("PageStyles");
+ ReportPageStyle = Helper.getUnoObjectbyName(oPageStyleFamily, "Standard");
+ FirstPageStyle = Helper.getUnoObjectbyName(oPageStyleFamily, "First Page");
+ }
+ catch (Exception exception)
+ {
+ exception.printStackTrace(System.out);
+ }
+ }
+
+ public void changePageOrientation(boolean bNewLandscape)
+ {
+ try
+ {
+ com.sun.star.awt.Size oNewSize;
+ getReportPageStyles();
+ com.sun.star.awt.Size oLocSize = (com.sun.star.awt.Size) Helper.getUnoStructValue(ReportPageStyle, "Size");
+ bIsCurLandscape = AnyConverter.toBoolean(Helper.getUnoPropertyValue(ReportPageStyle, "IsLandscape"));
+ if (bIsCurLandscape != bNewLandscape)
+ {
+ oNewSize = new com.sun.star.awt.Size(oLocSize.Height, oLocSize.Width);
+ Helper.setUnoPropertyValue(ReportPageStyle, "IsLandscape", new Boolean(bNewLandscape));
+ Helper.setUnoPropertyValue(ReportPageStyle, "Size", oNewSize);
+ Helper.setUnoPropertyValue(FirstPageStyle, "IsLandscape", new Boolean(bNewLandscape));
+ Helper.setUnoPropertyValue(FirstPageStyle, "Size", oNewSize);
+ int iLeftMargin = AnyConverter.toInt(Helper.getUnoPropertyValue(ReportPageStyle, "LeftMargin"));
+ int iRightMargin = AnyConverter.toInt(Helper.getUnoPropertyValue(ReportPageStyle, "RightMargin"));
+ PageWidth = oNewSize.Width - iLeftMargin - iRightMargin;
+ if (CurRecordTable != null)
+ {
+ CurRecordTable.adjustOptimalTableWidths(xMSF, oViewHandler);
+ }
+ }
+ }
+ catch (Exception exception)
+ {
+ exception.printStackTrace(System.out);
+ }
+ }
+
+ public boolean loadSectionsfromTemplate(String sTemplateUrl)
+ {
+ try
+ {
+ int i;
+ DBColumn CurDBColumn;
+ int GroupCount = CurDBMetaData.GroupFieldNames.length;
+ CurRecordTable = null;
+ for (i = 0; i < GroupCount; i++)
+ {
+ String SectionName = GROUPSECTION + Integer.toString(i + 1);
+ oTextTableHandler.renameTextTable("Tbl_" + SectionName, "MyTextTable");
+ oTextSectionHandler.linkSectiontoTemplate(sTemplateUrl, SectionName);
+ oTextTableHandler.renameTextTable("MyTextTable", "Tbl_" + SectionName);
+ }
+ if (oTextSectionHandler.xTextSectionsSupplier.getTextSections().getElementNames().length > CurDBMetaData.GroupFieldNames.length)
+ {
+ oTextSectionHandler.linkSectiontoTemplate(sTemplateUrl, RECORDSECTION);
+ CurRecordTable = new RecordTable(oTextTableHandler);
+ insertColumnstoRecordTable();
+ }
+ for (i = 0; i < GroupCount; i++)
+ {
+ CurDBColumn = new DBColumn(oTextTableHandler, CurDBMetaData, CurDBMetaData.GroupFieldNames[i], i, TBLGROUPSECTION + (i + 1));
+ if (CurDBColumn == null)
+ {
+ return false;
+ }
+ else
+ {
+ CurDBColumn.formatValueCell();
+ DBColumnsVector.set(i, CurDBColumn);
+ replaceFieldValueInGroupTable(CurDBColumn, i);
+ }
+ }
+ return true;
+ }
+ catch (Exception exception)
+ {
+ exception.printStackTrace(System.out);
+ return false;
+ }
+ }
+
+ public void setupRecordSection(String TemplateName)
+ {
+ this.ContentTemplatePath = TemplateName;
+ if (CurDBMetaData.getRecordFieldNames().length > 0)
+ {
+ boolean bAddParagraph = true;
+ if (CurDBMetaData.GroupFieldNames != null)
+ {
+ bAddParagraph = (CurDBMetaData.GroupFieldNames.length == 0);
+ }
+ oTextSectionHandler.insertTextSection(RECORDSECTION, TemplateName, bAddParagraph);
+ CurRecordTable = new RecordTable(oTextTableHandler);
+ insertColumnstoRecordTable();
+ if (CurRecordTable != null)
+ {
+ CurRecordTable.adjustOptimalTableWidths(xMSF, oViewHandler);
+ }
+ }
+ else
+ {
+ CurRecordTable = null;
+ }
+ }
+
+ public void refreshGroupFields(String[] _sNewNames)
+ {
+ int nSize = DBColumnsVector.size();
+ for (int i = 0; i < nSize; i++)
+ {
+ DBColumn CurDBColumn = (DBColumn) DBColumnsVector.elementAt(i);
+ String sFieldName = CurDBColumn.CurDBField.getFieldName();
+ if (!sFieldName.equals(_sNewNames[i]))
+ {
+ CurDBColumn.CurDBField = CurDBMetaData.getFieldColumnByDisplayName(_sNewNames[i]);
+ CurDBColumn.insertColumnData(oTextFieldHandler, bIsCurLandscape);
+ }
+ }
+ }
+ //public boolean isGroupField(String _FieldName)
+ // {
+ // return (JavaTools.FieldInList(CurDBMetaData.GroupFieldNames, _FieldName) != -1);
+ // }
+ public void replaceFieldValueInRecordSection(int RecordCount)
+ {
+ int GroupCount = CurDBMetaData.GroupFieldNames.length;
+ int FieldCount = CurDBMetaData.getFieldNames().length;
+ for (int i = GroupCount; i < FieldCount; i++)
+ {
+ ((DBColumn) DBColumnsVector.elementAt(i)).insertColumnData(oTextFieldHandler, this.bIsCurLandscape);
+ }
+ }
+
+ public void updateTextSections(String[] SelGroupNames) throws Exception
+ {
+ String TableName;
+ DBColumn OldDBColumn;
+ DBColumn CurDBColumn;
+ XNameAccess xTableNames = oTextTableHandler.xTextTablesSupplier.getTextTables();
+ int GroupFieldCount = SelGroupNames.length;
+ for (int i = 0; i < GroupFieldCount; i++)
+ {
+ TableName = TBLGROUPSECTION + Integer.toString(i + 1);
+ OldDBColumn = (DBColumn) DBColumnsVector.get(i);
+ CurDBColumn = new DBColumn(oTextTableHandler, CurDBMetaData, SelGroupNames[i], i, TableName, OldDBColumn);
+ CurDBColumn.formatValueCell();
+ DBColumnsVector.setElementAt(CurDBColumn, i);
+ CurDBColumn.insertColumnData(oTextFieldHandler, this.bIsCurLandscape);
+ }
+ }
+
+ public void replaceFieldValueInGroupTable(DBColumn CurDBColumn, int TableIndex)
+ {
+ String TableName = TBLGROUPSECTION + (TableIndex + 1);
+ // Note: for some reason the table might lose its name and has to be renamed therefor
+ String OldTableName = CurDBColumn.xTableName.getName();
+ if (OldTableName.compareTo(TableName) != 0)
+ {
+ CurDBColumn.xTableName.setName(TableName);
+ }
+ CurDBColumn.insertColumnData(oTextFieldHandler, this.bIsCurLandscape);
+ CurDBColumn.setCellFont();
+ }
+
+ public void replaceFieldValueInRecordTable()
+ {
+ String TableName = TBLRECORDSECTION;
+ String OldTableName = CurRecordTable.xTableName.getName();
+ if (OldTableName.compareTo(TableName) != 0)
+ {
+ CurRecordTable.xTableName.setName(TableName);
+ }
+ int GroupCount = CurDBMetaData.GroupFieldNames.length;
+ int RecordCount = CurDBMetaData.getRecordFieldNames().length;
+ for (int i = GroupCount; i < RecordCount; i++)
+ {
+ ((DBColumn) DBColumnsVector.elementAt(i)).insertColumnData(oTextFieldHandler, this.bIsCurLandscape);
+ }
+ }
+
+ public void insertColumnstoRecordTable()
+ {
+ try
+ {
+ int GroupCount = CurDBMetaData.GroupFieldNames.length;
+ DBColumn CurDBColumn;
+ // Note for some reason the table might lose its name and has to be renamed therefor
+ String OldTableName = CurRecordTable.xTableName.getName();
+ if (OldTableName.compareTo(TBLRECORDSECTION) != 0)
+ {
+ CurRecordTable = new RecordTable(oTextTableHandler);
+ }
+ com.sun.star.table.XTableColumns xColumns = CurRecordTable.xTextTable.getColumns();
+ int ColCount = xColumns.getCount();
+ int RecordCount = CurDBMetaData.getRecordFieldNames().length;
+ if (ColCount > RecordCount)
+ {
+ int RemoveCount = ColCount - RecordCount;
+ xColumns.removeByIndex(0, RemoveCount);
+ }
+ else if (ColCount < RecordCount)
+ {
+ int AddCount = RecordCount - ColCount;
+ CurRecordTable.xTextTable.getColumns().insertByIndex(ColCount, AddCount);
+ }
+ for (int i = 0; i < RecordCount; i++)
+ {
+ CurDBColumn = new DBColumn(CurRecordTable, oTextTableHandler, CurDBMetaData, i, true);
+ CurDBColumn.initializeNumberFormat();
+ CurDBColumn.insertColumnData(oTextFieldHandler, this.bIsCurLandscape);
+ if (DBColumnsVector.size() <= (i + GroupCount))
+ {
+ DBColumnsVector.add(CurDBColumn);
+ }
+ else
+ {
+ DBColumnsVector.set(i + GroupCount, CurDBColumn);
+ }
+ }
+ }
+ catch (Exception exception)
+ {
+ showCommonReportErrorBox(exception);
+ }
+ }
+
+ public boolean addGroupNametoDocument(String[] GroupNames, String CurGroupTitle, Vector GroupFieldVector, ArrayList ReportPath, int iSelCount)
+ {
+ DBColumn CurDBColumn = null;
+ int GroupCount = GroupFieldVector.size();
+ if (GroupCount < 4)
+ {
+ removeGroupNamesofRecordTable(iSelCount);
+ FieldColumn CurFieldColumn = CurDBMetaData.getFieldColumnByTitle(CurGroupTitle);
+ GroupFieldVector.addElement(CurFieldColumn.getFieldName());
+ GroupCount += 1;
+ try
+ {
+ String sPath = FileAccess.getPathFromList(xMSF, ReportPath, "cnt-default.ott");
+ oTextSectionHandler.insertTextSection(GROUPSECTION + GroupCount, sPath, GroupCount == 1);
+ CurDBColumn = new DBColumn(oTextTableHandler, CurDBMetaData, CurFieldColumn.getFieldName(), GroupCount - 1, TBLGROUPSECTION + (GroupCount));
+ CurDBColumn.formatValueCell();
+ if (CurDBColumn != null)
+ {
+ DBColumnsVector.addElement(CurDBColumn);
+ replaceFieldValueInGroupTable(CurDBColumn, GroupCount - 1);
+ }
+ else
+ {
+ String sMessage = JavaTools.replaceSubString(sMsgTableNotExisting, TBLGROUPSECTION + (GroupCount), "<TABLENAME>");
+ CurDBMetaData.showMessageBox("ErrorBox", VclWindowPeerAttribute.OK, sMessage);
+ }
+ }
+ catch (Exception exception)
+ {
+ showCommonReportErrorBox(exception);
+ }
+
+ }
+
+ return (CurDBColumn != null);
+ }
+
+ public void removeGroupName(String[] NewSelGroupNames, String CurGroupTitle, java.util.Vector GroupFieldVector)
+ {
+ removeGroupNamesofRecordTable(NewSelGroupNames.length + 1);
+ FieldColumn CurFieldColumn = CurDBMetaData.getFieldColumnByTitle(CurGroupTitle);
+ GroupFieldVector.removeElement(CurFieldColumn.getFieldName());
+ try
+ {
+ oTextSectionHandler.removeLastTextSection();
+ oTextTableHandler.removeLastTextTable();
+ // if the previously selected item is somewhere in the middle of the listbox (and not at the end) the
+ // Textsections have to be updated
+ if (JavaTools.FieldInList(NewSelGroupNames, CurGroupTitle) == -1)
+ {
+ updateTextSections(NewSelGroupNames);
+ }
+ int iSelItemCount = NewSelGroupNames.length;
+ DBColumnsVector.remove(iSelItemCount);
+ }
+ catch (Exception exception)
+ {
+ showCommonReportErrorBox(exception);
+ }
+ }
+
+ public void removeGroupNamesofRecordTable(int GroupFieldCount)
+ {
+ int CurFieldCount = DBColumnsVector.size();
+ if (CurFieldCount > GroupFieldCount)
+ {
+ for (int i = CurFieldCount - 1; i >= GroupFieldCount; i--)
+ {
+ DBColumnsVector.removeElementAt(i);
+ }
+ }
+ }
+
+ public void showCommonReportErrorBox(Exception exception)
+ {
+ String SystemContentPath = JavaTools.convertfromURLNotation(ContentTemplatePath);
+ String sMsgCurCommonReportError = JavaTools.replaceSubString(sMsgCommonReportError, SystemContentPath, "%PATH");
+ CurDBMetaData.showMessageBox("ErrorBox", VclWindowPeerAttribute.OK, sMsgCurCommonReportError);
+ exception.printStackTrace(System.out);
+ }
+
+ public void getallDBColumns()
+ {
+ try
+ {
+ DBColumn CurDBColumn;
+ for (int i = 0; i < CurDBMetaData.FieldColumns.length; i++)
+ {
+ if (i < CurDBMetaData.GroupFieldNames.length)
+ {
+ CurDBColumn = new DBColumn(oTextTableHandler, CurDBMetaData, CurDBMetaData.GroupFieldNames[i], i, COPYOFTBLGROUPSECTION + (i + 1));
+ }
+ else
+ {
+ if (CurRecordTable == null)
+ {
+ CurRecordTable = new RecordTable(oTextTableHandler);
+ }
+ CurDBColumn = new DBColumn(CurRecordTable, oTextTableHandler, CurDBMetaData, i - CurDBMetaData.GroupFieldNames.length);
+ }
+ if (CurDBColumn != null)
+ {
+ if (CurDBColumn.xNameCell != null)
+ {
+ DBColumnsVector.addElement(CurDBColumn);
+ }
+ else
+ {
+ String DelFieldName;
+ if (i < CurDBMetaData.GroupFieldNames.length)
+ {
+ DelFieldName = CurDBMetaData.GroupFieldNames[i];
+ CurDBMetaData.GroupFieldNames = JavaTools.removefromList(CurDBMetaData.GroupFieldNames, new String[]
+ {
+ DelFieldName
+ });
+ CurDBMetaData.GroupFieldColumns = removeFieldColumnByFieldName(DelFieldName, CurDBMetaData.GroupFieldColumns);
+ }
+ else
+ {
+ DelFieldName = CurDBMetaData.getRecordFieldName(i - CurDBMetaData.GroupFieldNames.length);
+ String[] aNewList = JavaTools.removefromList(CurDBMetaData.getRecordFieldNames(), new String[]
+ {
+ DelFieldName
+ });
+ CurDBMetaData.setRecordFieldNames(aNewList);
+ CurDBMetaData.RecordFieldColumns = removeFieldColumnByFieldName(DelFieldName, CurDBMetaData.RecordFieldColumns);
+ CurDBMetaData.FieldColumns = removeFieldColumnByFieldName(DelFieldName, CurDBMetaData.FieldColumns);
+
+ }
+ i--;
+ }
+ }
+ else
+ {
+ String sMessage = JavaTools.replaceSubString(sMsgTableNotExisting, TBLGROUPSECTION + (CurDBMetaData.GroupFieldNames.length), "<TABLENAME>");
+ CurDBMetaData.showMessageBox("ErrorBox", VclWindowPeerAttribute.OK, sMessage);
+ }
+ }
+ java.util.Arrays.sort(CurDBMetaData.RecordFieldColumns, this);
+ }
+ catch (Exception exception)
+ {
+ showCommonReportErrorBox(exception);
+ }
+ }
+
+ public int compare(Object _oObject1, Object _oObject2)
+ {
+ FieldColumn oFieldColumn1 = (FieldColumn) _oObject1;
+ FieldColumn oFieldColumn2 = (FieldColumn) _oObject2;
+ DBColumn oDBColumn1 = getDBColumnByName(oFieldColumn1.getFieldName());
+ DBColumn oDBColumn2 = getDBColumnByName(oFieldColumn2.getFieldName());
+ if (oDBColumn1.ValColumn < oDBColumn2.ValColumn)
+ {
+ return -1;
+ }
+ else if (oDBColumn1.ValColumn == oDBColumn2.ValColumn)
+ {
+ return 0;
+ }
+ else
+ {
+ return 1;
+ }
+ }
+
+ private DBColumn getDBColumnByName(String _FieldName)
+ {
+ for (int i = 0; i < DBColumnsVector.size(); i++)
+ {
+ DBColumn oDBColumn = (DBColumn) DBColumnsVector.get(i);
+ if (oDBColumn.CurDBField.getFieldName().equals(_FieldName))
+ {
+ return oDBColumn;
+ }
+ }
+ return null;
+ }
+
+ public static FieldColumn[] removeFieldColumnByFieldName(String _FieldName, FieldColumn[] _FieldColumns)
+ {
+ try
+ {
+ Vector aFieldColumns = new Vector();
+ for (int i = 0; i < _FieldColumns.length; i++)
+ {
+ FieldColumn CurFieldColumn = _FieldColumns[i];
+ if (!CurFieldColumn.getFieldName().equals(_FieldName))
+ {
+ aFieldColumns.add(CurFieldColumn);
+ }
+ }
+ FieldColumn[] aRetList = new FieldColumn[aFieldColumns.size()];
+ aFieldColumns.toArray(aRetList);
+ return aRetList;
+ }
+ catch (RuntimeException e)
+ {
+ e.printStackTrace(System.out);
+ return null;
+ }
+ }
+
+ public void removeAllVisibleTextSections()
+ {
+ int GroupCount = CurDBMetaData.GroupFieldNames.length;
+ String[] sInvisibleSectionNames = new String[GroupCount + 1];
+ sInvisibleSectionNames[0] = RECORDSECTION;
+ for (int i = 1; i <= GroupCount; i++)
+ {
+ sInvisibleSectionNames[i] = GROUPSECTION + i;
+ }
+ XNameAccess xNameAccessTextSections = (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, oTextSectionHandler.xTextSectionsSupplier.getTextSections());
+ String[] sSectionNames = xNameAccessTextSections.getElementNames();
+ for (int i = 0; i < sSectionNames.length; i++)
+ {
+ String sSectionName = sSectionNames[i];
+ if (JavaTools.FieldInList(sInvisibleSectionNames, sSectionName) < 0)
+ {
+ oTextSectionHandler.removeTextSectionbyName(sSectionName);
+ }
+ }
+ }
+
+ private String[] getLayoutTextTableNames()
+ {
+ int GroupCount = CurDBMetaData.GroupFieldNames.length;
+ String[] sLayoutTableNames = new String[GroupCount + 1];
+ for (int i = 0; i < GroupCount; i++)
+ {
+ sLayoutTableNames[i] = TBLGROUPSECTION + (i + 1);
+ }
+ sLayoutTableNames[GroupCount] = TBLRECORDSECTION;
+ return sLayoutTableNames;
+ }
+
+ public void removeNonLayoutTextTables()
+ {
+ String[] sLayoutTableNames = getLayoutTextTableNames();
+ XNameAccess xNameAccessTextTables = (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, oTextTableHandler.xTextTablesSupplier.getTextTables());
+ String[] sTableNames = xNameAccessTextTables.getElementNames();
+ for (int i = 0; i < sTableNames.length; i++)
+ {
+ String sTableName = sTableNames[i];
+ if (JavaTools.FieldInList(sLayoutTableNames, sTableName) < 0)
+ {
+ oTextTableHandler.removeTextTablebyName(sTableName);
+ }
+ }
+ }
+
+ public void removeLayoutTextTables()
+ {
+ String[] sLayoutTableNames = getLayoutTextTableNames();
+ XNameAccess xNameAccessTextTables = (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, oTextTableHandler.xTextTablesSupplier.getTextTables());
+ XRelativeTextContentRemove xRelativeTextContentRemove = (XRelativeTextContentRemove) UnoRuntime.queryInterface(XRelativeTextContentRemove.class, xText);
+ String[] sTableNames = xNameAccessTextTables.getElementNames();
+ for (int i = 0; i < sTableNames.length; i++)
+ {
+ String sTableName = sTableNames[i];
+ if (JavaTools.FieldInList(sLayoutTableNames, sTableName) > -1)
+ {
+ if (!sTableName.equals(sLayoutTableNames[0]))
+ {
+ XTextContent xTextContent = (XTextContent) UnoRuntime.queryInterface(XTextContent.class, oTextTableHandler.getByName(sTableName));
+ boolean bleaveloop = false;
+ while (!bleaveloop)
+ {
+ try
+ {
+// xRelativeTextContentRemove.removeTextContentBefore(xTextContent);
+ xRelativeTextContentRemove.removeTextContentAfter(xTextContent);
+ // IllegalArgumentException may be thrown when no paragraphbreak is there
+ }
+ catch (IllegalArgumentException iexception)
+ {
+ bleaveloop = true;
+ }
+ }
+ }
+ oTextTableHandler.removeTextTablebyName(sTableName);
+ }
+ }
+ }
+
+ public void setLayoutSectionsVisible(boolean _IsVisible)
+ {
+ try
+ {
+ XNameAccess xTextSections = oTextSectionHandler.xTextSectionsSupplier.getTextSections();
+ Object oTextSection;
+ int GroupFieldCount = CurDBMetaData.GroupFieldNames.length;
+ for (int i = 0; i < GroupFieldCount; i++)
+ {
+ oTextSection = xTextSections.getByName(GROUPSECTION + String.valueOf(i + 1));
+ Helper.setUnoPropertyValue(oTextSection, "IsVisible", new Boolean(_IsVisible));
+ }
+ if (xTextSections.hasByName(RECORDSECTION))
+ {
+ oTextSection = xTextSections.getByName(RECORDSECTION);
+ Helper.setUnoPropertyValue(oTextSection, "IsVisible", new Boolean(_IsVisible));
+ }
+ }
+ catch (Exception exception)
+ {
+ exception.printStackTrace(System.out);
+ }
+ }
+
+ public void removeCopiedTextSections()
+ {
+ int GroupCount = CurDBMetaData.GroupFieldNames.length;
+ String[] sCopyTextSections = new String[GroupCount + 1];
+ String[] sCopyTextTables = new String[GroupCount + 1];
+ sCopyTextSections[0] = COPYOFRECORDSECTION;
+ sCopyTextTables[0] = COPYOFTBLRECORDSECTION;
+ for (int i = 1; i <= GroupCount; i++)
+ {
+ sCopyTextSections[i] = COPYOFGROUPSECTION + (i);
+ sCopyTextTables[i] = COPYOFTBLGROUPSECTION + (i);
+ }
+ for (int i = 0; i <= GroupCount; i++)
+ {
+ oTextTableHandler.removeTextTablebyName(sCopyTextTables[i]);
+ oTextSectionHandler.removeTextSectionbyName(sCopyTextSections[i]);
+ }
+ }
+}
diff --git a/wizards/com/sun/star/wizards/report/ReportTextImplementation.java b/wizards/com/sun/star/wizards/report/ReportTextImplementation.java
new file mode 100644
index 000000000000..9c8180a05c2d
--- /dev/null
+++ b/wizards/com/sun/star/wizards/report/ReportTextImplementation.java
@@ -0,0 +1,735 @@
+/*
+ ************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+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.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;
+import com.sun.star.text.XTextDocument;
+import com.sun.star.text.XTextTable;
+import com.sun.star.uno.Any;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+import com.sun.star.wizards.common.FileAccess;
+import com.sun.star.wizards.common.Helper;
+import com.sun.star.wizards.common.InvalidQueryException;
+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;
+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;
+
+/**
+ *
+ * @author ll93751
+ */
+public class ReportTextImplementation extends ReportImplementationHelper implements IReportDocument
+{
+
+ private ReportTextDocument m_aDoc;
+ private Object m_aInitialDoc;
+ private Resource m_resource;
+ private XDatabaseDocumentUI m_documentUI;
+
+ private void setInitialDocument(Object _aDoc)
+ {
+ m_aInitialDoc = _aDoc;
+ }
+
+ /**
+ * This is a TEMPORARY function to give direct access to the old text document.
+ * We have to remove this!!!
+ * @return
+ */
+ ReportTextDocument getDoc()
+ {
+ if (m_aDoc == null)
+ {
+ if (m_aInitialDoc instanceof XTextDocument)
+ {
+ 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_resource, getRecordParser());
+ }
+ else
+ {
+ throw new RuntimeException("Unknown type for setInitialDocument() given.");
+ }
+ }
+ return m_aDoc;
+ }
+
+ public void clearDocument()
+ {
+ getDoc().oTextSectionHandler.removeAllTextSections();
+ getDoc().oTextTableHandler.removeAllTextTables();
+ getDoc().DBColumnsVector = new Vector();
+ }
+
+ protected ReportTextImplementation( XMultiServiceFactory i_serviceFactory )
+ {
+ super( i_serviceFactory, ReportLayouter.SOOPTLANDSCAPE );
+ }
+
+ public void initialize( final XDatabaseDocumentUI i_documentUI, final Resource i_resource )
+ {
+ m_documentUI = i_documentUI;
+ m_resource = i_resource;
+
+ if ( m_aInitialDoc == null )
+ setInitialDocument( getLayoutPath() );
+
+ initialResources();
+ }
+
+ static IReportDocument create( XMultiServiceFactory i_serviceFactory, XDatabaseDocumentUI i_documentUI, XTextDocument i_initialDocument, Resource i_resources )
+ {
+ ReportTextImplementation a = new ReportTextImplementation( i_serviceFactory );
+ a.setInitialDocument(i_initialDocument);
+ a.initialize( i_documentUI, i_resources );
+ return a;
+ }
+
+ public XWindowPeer getWizardParent()
+ {
+ return getDoc().xWindowPeer;
+ }
+ static String sMsgQueryCreationImpossible;
+ static String sReportFormNotExisting;
+ static String sMsgHiddenControlMissing;
+ static String sMsgEndAutopilot;
+ static String sMsgConnectionImpossible;
+ static String sMsgNoConnection;
+ static String[] ReportMessages = new String[4];
+
+ private void initialResources()
+ {
+ 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()
+ {
+ m_aDoc.setLayoutSectionsVisible(false);
+ XTextCursor xTextCursor = ReportTextDocument.createTextCursor(m_aDoc.xTextDocument.getText());
+ xTextCursor.gotoStart(false);
+ for (int i = 0; i < getRecordParser().GroupFieldNames.length; i++)
+ {
+ XNamed xNamedTextSection = addLinkedTextSection(xTextCursor, ReportTextDocument.GROUPSECTION + Integer.toString(i + 1), null, null);
+ xNamedTextSection.setName(ReportTextDocument.COPYOFGROUPSECTION + (i + 1));
+ renameTableofLastSection(ReportTextDocument.COPYOFTBLGROUPSECTION + (i + 1));
+ }
+ if (getRecordParser().getRecordFieldNames().length > 0)
+ {
+ XNamed xNamedTextSection = addLinkedTextSection(xTextCursor, ReportTextDocument.RECORDSECTION, null, null);
+ xNamedTextSection.setName(ReportTextDocument.COPYOFRECORDSECTION);
+ renameTableofLastSection(ReportTextDocument.COPYOFTBLRECORDSECTION);
+ }
+ }
+
+ private XNamed addLinkedTextSection(XTextCursor xTextCursor, String sLinkRegion, DBColumn CurDBColumn, Object CurGroupValue)
+ {
+ XNamed xNamedTextSection = null;
+ try
+ {
+ XInterface xTextSection = (XInterface) getDocumentServiceFactory().createInstance("com.sun.star.text.TextSection");
+ 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);
+ if (CurDBColumn != null)
+ {
+ boolean bIsGroupTable = (sLinkRegion.equals(ReportTextDocument.RECORDSECTION) != true);
+ if (bIsGroupTable == true)
+ {
+ XTextTable xTextTable = getDoc().oTextTableHandler.getlastTextTable();
+ XCellRange xCellRange = UnoRuntime.queryInterface( XCellRange.class, xTextTable );
+ CurDBColumn.modifyCellContent(xCellRange, CurGroupValue);
+ }
+ }
+ }
+ catch (Exception exception)
+ {
+ exception.printStackTrace(System.out);
+ }
+ return xNamedTextSection;
+ }
+
+ private void renameTableofLastSection(String _snewname)
+ {
+ XTextTable xTextTable = getDoc().oTextTableHandler.getlastTextTable();
+ XNamed xNamedTable = UnoRuntime.queryInterface( XNamed.class, xTextTable );
+ xNamedTable.setName(_snewname);
+ }
+
+ private int showMessageBox(String windowServiceName, int windowAttribute, String MessageText)
+ {
+ return SystemDialog.showMessageBox(getMSF(), getWizardParent(), windowServiceName, windowAttribute, MessageText);
+ }
+
+ public boolean reconnectToDatabase(XMultiServiceFactory xMSF, PropertyValue[] _properties)
+ {
+ try
+ {
+ XNameContainer xNamedForms = getDoc().oFormHandler.getDocumentForms();
+ Object oDBForm = Helper.getUnoObjectbyName(xNamedForms, ReportWizard.SOREPORTFORMNAME);
+ boolean bgetConnection;
+ String sQueryName = "";
+ if (oDBForm != null)
+ {
+ String sMsg = sMsgHiddenControlMissing + (char) 13 + sMsgEndAutopilot;
+ 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);
+ String sFieldNames = getDoc().oFormHandler.getValueofHiddenControl(xNamedForm, "FieldNames", sMsg);
+ String sRecordFieldNames = getDoc().oFormHandler.getValueofHiddenControl(xNamedForm, "RecordFieldNames", sMsg);
+ if (xNamedForm.hasByName("QueryName"))
+ {
+ sQueryName = getDoc().oFormHandler.getValueofHiddenControl(xNamedForm, "QueryName", sMsg);
+ }
+ String[] sFieldNameList = JavaTools.ArrayoutofString(sFieldNames, ";");
+ String[] sNewList = JavaTools.ArrayoutofString(sRecordFieldNames, ";");
+ getRecordParser().setRecordFieldNames(sNewList);
+ getRecordParser().GroupFieldNames = JavaTools.ArrayoutofString(sGroupFieldNames, ";");
+ getRecordParser().setCommandType(Integer.valueOf(sCommandType).intValue());
+ sMsgQueryCreationImpossible = JavaTools.replaceSubString(sMsgQueryCreationImpossible, getRecordParser().Command, "<STATEMENT>");
+ bgetConnection = getRecordParser().getConnection(_properties);
+ int nCommandType = com.sun.star.sdb.CommandType.COMMAND;
+ boolean bexecute = false;
+ if (bgetConnection)
+ {
+
+ if ((getRecordParser().getCommandType() == CommandType.QUERY) && (getRecordParser().Command.equals("")))
+ {
+ getRecordParser().oSQLQueryComposer = new SQLQueryComposer(getRecordParser());
+ DBMetaData.CommandObject oCommand = getRecordParser().getQueryByName(sQueryName);
+ if (getRecordParser().hasEscapeProcessing(oCommand.getPropertySet()))
+ {
+ getRecordParser().Command = (String) oCommand.getPropertySet().getPropertyValue("Command");
+ getRecordParser().oSQLQueryComposer.m_xQueryAnalyzer.setQuery(getRecordParser().Command);
+ getRecordParser().oSQLQueryComposer.prependSortingCriteria();
+ }
+ else
+ {
+ nCommandType = com.sun.star.sdb.CommandType.QUERY;
+ getRecordParser().Command = sQueryName;
+ }
+ }
+
+ bexecute = getRecordParser().executeCommand(nCommandType); //sMsgQueryCreationImpossible + (char) 13 + sMsgEndAutopilot, sFieldNameList, true);
+ if (bexecute)
+ {
+ bexecute = getRecordParser().getFields(sFieldNameList, true);
+ }
+ return bexecute;
+ }
+ else
+ {
+ return false;
+ }
+ }
+ else
+ {
+ sReportFormNotExisting = JavaTools.replaceSubString(sReportFormNotExisting, ReportWizard.SOREPORTFORMNAME, "<REPORTFORM>");
+ showMessageBox("ErrorBox", VclWindowPeerAttribute.OK, sReportFormNotExisting + (char) 13 + sMsgEndAutopilot);
+ return false;
+ }
+ }
+ catch (InvalidQueryException queryexception)
+ {
+ return false;
+ }
+ catch (java.lang.Exception javaexception)
+ {
+ javaexception.printStackTrace(System.out);
+ return false;
+ }
+ catch (com.sun.star.wizards.document.FormHandler.UnknownHiddenControlException exception)
+ {
+ return false;
+ }
+ }
+ private boolean m_bStopProcess;
+
+ public void StopProcess()
+ {
+ m_bStopProcess = true;
+ }
+
+ public void insertDatabaseDatatoReportDocument(XMultiServiceFactory xMSF)
+ {
+ try
+ {
+ int ColIndex;
+ boolean breset;
+ Object oTable;
+ Vector DataVector = new Vector();
+ DBColumn CurDBColumn;
+ Object CurGroupValue;
+ String CurGroupTableName;
+// RecordParser CurDBMetaData = getRecordParser();
+ com.sun.star.style.BreakType CorrBreakValue = null;
+ String CorrPageDescName = "";
+ getDoc().oTextFieldHandler.fixDateFields(true);
+ getDoc().removeAllVisibleTextSections();
+ getDoc().removeNonLayoutTextTables();
+ addTextSectionCopies();
+ getDoc().getallDBColumns();
+ int GroupFieldCount = getRecordParser().GroupFieldNames.length;
+ int FieldCount = getRecordParser().FieldColumns.length;
+ Object[] OldGroupFieldValues = new Object[GroupFieldCount];
+ XTextTable[] xGroupBaseTables = new XTextTable[GroupFieldCount];
+ int RecordFieldCount = FieldCount - GroupFieldCount;
+ XTextDocument xTextDocument = getDoc().xTextDocument;
+ XTextCursor xTextCursor = ReportTextDocument.createTextCursor(getDoc().xTextDocument.getText());
+ xTextDocument.lockControllers();
+
+ if (getRecordParser().ResultSet.next() == true)
+ {
+ replaceUserFields();
+ Helper.setUnoPropertyValue(xTextCursor, "PageDescName", "First Page");
+ for (ColIndex = 0; ColIndex < GroupFieldCount; ColIndex++)
+ {
+ CurGroupTableName = ReportTextDocument.TBLGROUPSECTION + Integer.toString(ColIndex + 1);
+ oTable = getDoc().oTextTableHandler.xTextTablesSupplier.getTextTables().getByName(CurGroupTableName);
+ xGroupBaseTables[ColIndex] = UnoRuntime.queryInterface( XTextTable.class, oTable );
+ CurGroupValue = getRecordParser().getGroupColumnValue(ColIndex);
+ OldGroupFieldValues[ColIndex] = CurGroupValue;
+ CurDBColumn = (DBColumn) getDoc().DBColumnsVector.elementAt(ColIndex);
+ addLinkedTextSection(xTextCursor, ReportTextDocument.GROUPSECTION + Integer.toString(ColIndex + 1), CurDBColumn, CurGroupValue); //COPYOF!!!!
+ }
+ if (getRecordParser().getcurrentRecordData(DataVector) == true)
+ {
+ // int RowIndex = 1;
+ m_bStopProcess = false;
+ while ((getRecordParser().ResultSet.next() == true) && (m_bStopProcess == false))
+ {
+ // RowIndex += 1;
+ breset = false;
+ for (ColIndex = 0; ColIndex < GroupFieldCount; ColIndex++)
+ {
+ CurGroupValue = getRecordParser().getGroupColumnValue(ColIndex);
+ if ((CurGroupValue.equals(OldGroupFieldValues[ColIndex]) == false) || (breset))
+ {
+ breset = true;
+ insertDataToRecordTable(xTextCursor, DataVector, RecordFieldCount);
+ CurDBColumn = (DBColumn) getDoc().DBColumnsVector.elementAt(ColIndex);
+ addLinkedTextSection(xTextCursor, ReportTextDocument.COPYOFGROUPSECTION + Integer.toString(ColIndex + 1), CurDBColumn, CurGroupValue);
+ OldGroupFieldValues[ColIndex] = CurGroupValue;
+ breset = !(ColIndex == GroupFieldCount - 1);
+ }
+ }
+ getRecordParser().getcurrentRecordData(DataVector);
+ // updateProgressDisplay(RowIndex);
+ }
+ insertDataToRecordTable(xTextCursor, DataVector, RecordFieldCount);
+ }
+ else
+ {
+ getDoc().unlockallControllers();
+ return;
+ }
+ }
+ else
+ {
+ for (ColIndex = 0; ColIndex < GroupFieldCount; ColIndex++)
+ {
+ CurDBColumn = (DBColumn) getDoc().DBColumnsVector.elementAt(ColIndex);
+ Object oValue = "";
+ addLinkedTextSection(xTextCursor, ReportTextDocument.COPYOFGROUPSECTION + Integer.toString(ColIndex + 1), CurDBColumn, oValue);
+ }
+ addLinkedTextSection(xTextCursor, ReportTextDocument.COPYOFRECORDSECTION, null, null);
+ Object[][] RecordArray = new Object[1][RecordFieldCount];
+ for (int i = 0; i < RecordArray[0].length; i++)
+ {
+ RecordArray[0][i] = Any.VOID;
+ }
+ XTextTable xTextTable = getDoc().oTextTableHandler.getlastTextTable();
+ OfficeDocument.ArraytoCellRange(RecordArray, xTextTable, 0, 1);
+ }
+ getDoc().oTextSectionHandler.breakLinkofTextSections();
+ }
+ catch (Exception exception)
+ {
+ }
+// catch (java.lang.Exception javaexception)
+// {
+// javaexception.printStackTrace(System.out);
+// }
+ getDoc().unlockallControllers();
+ getDoc().setLayoutSectionsVisible(false);
+ getDoc().removeCopiedTextSections();
+ getDoc().oTextSectionHandler.removeInvisibleTextSections();
+ getDoc().removeLayoutTextTables();
+ }
+
+ private void insertDataToRecordTable(XTextCursor xTextCursor, Vector DataVector, int FieldCount)
+ {
+ int DataLength = DataVector.size();
+ if ((FieldCount > 0) && (DataLength > 0))
+ {
+ addLinkedTextSection(xTextCursor, ReportTextDocument.COPYOFRECORDSECTION, null, null);
+ Object[][] RecordArray = new Object[DataLength][FieldCount];
+ DataVector.copyInto(RecordArray);
+ XTextTable xTextTable = getDoc().oTextTableHandler.getlastTextTable();
+ if (DataLength > 1)
+ {
+ xTextTable.getRows().insertByIndex(xTextTable.getRows().getCount(), DataLength - 1);
+ }
+ OfficeDocument.ArraytoCellRange(RecordArray, xTextTable, 0, 1);
+ }
+ DataVector.removeAllElements();
+ }
+// public void updateProgressDisplay(int iCounter)
+// {
+// try
+// {
+// if (iCounter % 10 == 0)
+// {
+// sProgressCurRecord = JavaTools.replaceSubString(sProgressBaseCurRecord, String.valueOf(iCounter), "<COUNT>");
+// setControlProperty("lblCurProgress", "Label", sProgressCurRecord);
+// super.xReschedule.reschedule();
+// }
+// }
+// catch (java.lang.Exception jexception)
+// {
+// jexception.printStackTrace(System.out);
+// }
+// }
+ private void replaceUserFields()
+ {
+ DBColumn CurDBColumn;
+ XTextCursor xNameCellCursor;
+ String FieldContent;
+ int iCount = getDoc().DBColumnsVector.size();
+ for (int i = 0; i < iCount; i++)
+ {
+ CurDBColumn = (DBColumn) getDoc().DBColumnsVector.elementAt(i);
+ xNameCellCursor = ReportTextDocument.createTextCursor(CurDBColumn.xNameCell);
+ xNameCellCursor.gotoStart(false);
+ FieldContent = getDoc().oTextFieldHandler.getUserFieldContent(xNameCellCursor);
+ if (!FieldContent.equals(""))
+ {
+ xNameCellCursor.goRight((short) 1, true);
+ xNameCellCursor.setString(FieldContent);
+ }
+ }
+ }
+
+ public XFrame getFrame()
+ {
+ return m_aDoc.xFrame;
+ }
+
+ public XMultiServiceFactory getDocumentServiceFactory()
+ {
+ return m_aDoc.xMSFDoc;
+ }
+
+ public void store(String _sName, int _nOpenMode) throws com.sun.star.uno.Exception
+ {
+ getDoc().createReportForm(ReportWizard.SOREPORTFORMNAME);
+ // int nOpenMode = getReportOpenMode();
+ getDoc().oTextFieldHandler.updateDateFields();
+ getDoc().oTextFieldHandler.fixDateFields(false);
+ if ((_nOpenMode == ReportFinalizer.SOCREATETEMPLATE || _nOpenMode == ReportFinalizer.SOUSETEMPLATE))
+ {
+ getDoc().oTextSectionHandler.breakLinkofTextSections();
+ getRecordParser().storeDatabaseDocumentToTempPath(getComponent(), _sName);
+ }
+ }
+
+ public boolean liveupdate_addGroupNametoDocument(String[] GroupNames, String CurGroupTitle, Vector GroupFieldVector, ArrayList ReportPath, int iSelCount)
+ {
+ return getDoc().addGroupNametoDocument(GroupNames, CurGroupTitle, GroupFieldVector, ReportPath, iSelCount);
+ }
+
+ public void refreshGroupFields(String[] _sNewNames)
+ {
+ getDoc().refreshGroupFields(_sNewNames);
+ }
+
+ // public boolean isGroupField(String _FieldName)
+ // {
+ // return getDoc().isGroupField(_FieldName);
+ // }
+ public void liveupdate_removeGroupName(String[] NewSelGroupNames, String CurGroupTitle, Vector GroupFieldVector)
+ {
+ getDoc().removeGroupName(NewSelGroupNames, CurGroupTitle, GroupFieldVector);
+ }
+
+ public void setPageOrientation(int nOrientation) throws com.sun.star.lang.IllegalArgumentException
+ {
+ // LLA: should we lock controllers here?
+ // CurReportDocument.getDoc().xTextDocument.lockControllers();
+ if (nOrientation == ReportLayouter.SOOPTLANDSCAPE)
+ {
+ getDoc().changePageOrientation(true);
+ }
+ else if (nOrientation == ReportLayouter.SOOPTPORTRAIT)
+ {
+ getDoc().changePageOrientation(false);
+ }
+ else
+ {
+ throw new com.sun.star.lang.IllegalArgumentException("Unknown Orientation.");
+ }
+ // CurReportDocument.getDoc().unlockallControllers();
+ }
+
+ public void liveupdate_changeLayoutTemplate(String LayoutTemplatePath/*, String BitmapPath*/)
+ {
+ getDoc().swapLayoutTemplate(LayoutTemplatePath/*, BitmapPath*/);
+ }
+
+ public void liveupdate_changeContentTemplate(String ContentTemplatePath)
+ {
+ getDoc().swapContentTemplate(ContentTemplatePath);
+ }
+
+ public void layout_setupRecordSection(String TemplateName)
+ {
+ getDoc().setupRecordSection(TemplateName);
+ }
+
+ public void removeTextTableAndTextSection()
+ {
+ getDoc().oTextSectionHandler.removeTextSectionbyName("RecordSection");
+ getDoc().oTextTableHandler.removeTextTablebyName("Tbl_RecordSection");
+ }
+
+ public void layout_selectFirstPage()
+ {
+ getDoc().oViewHandler.selectFirstPage(getDoc().oTextTableHandler);
+ }
+
+ public void dispose()
+ {
+ OfficeDocument.dispose(getMSF(), getComponent());
+ }
+
+ public XComponent getComponent()
+ {
+ return getDoc().xComponent;
+ }
+
+ public void liveupdate_changeUserFieldContent(String fieldname, String sfieldtitle)
+ {
+ getDoc().oTextFieldHandler.changeUserFieldContent(fieldname, sfieldtitle);
+ }
+
+ public void liveupdate_updateReportTitle(String _sTitleName)
+ {
+ }
+
+ public void addReportToDBView()
+ {
+ getRecordParser().addReportDocument(getComponent(), true);
+ }
+
+ public void createAndOpenReportDocument( String sReportName, boolean _bAsTemplate, boolean _bOpenInDesign )
+ {
+ 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)
+ {
+ getRecordParser().initializeFieldColumns(FieldNames, TableName);
+ }
+
+ public void setFieldTitles(String[] sFieldTitles)
+ {
+ getRecordParser().setFieldTitles(sFieldTitles);
+ }
+
+ public void setSorting(String[][] aSortFieldNames)
+ {
+ getRecordParser().setSortFieldNames(aSortFieldNames);
+ }
+
+ public void setGrouping(String[] aGroupFieldNames)
+ {
+ getRecordParser().prependSortFieldNames(aGroupFieldNames);
+ }
+
+// TODO: we have to change to String List!!!!
+ private ArrayList m_aReportPath = null;
+
+ public ArrayList getReportPath()
+ {
+ if (m_aReportPath == null)
+ {
+ // Check general availability of office paths
+ try
+ {
+ m_aReportPath = FileAccess.getOfficePaths(getMSF(), "Template", "share", "/wizard");
+ // m_sReportPath = FileAccess.combinePaths(getMSF(), m_sReportPath, "/wizard/report");
+ FileAccess.combinePaths(getMSF(), m_aReportPath, "/wizard/report");
+ }
+ catch (Exception e)
+ {
+ }
+ }
+ return m_aReportPath;
+ }
+
+ public String getContentPath()
+ {
+ ArrayList aReportPath = getReportPath();
+ for (int i = 0; i < aReportPath.size(); i++)
+ {
+ String sPath = (String) aReportPath.get(i);
+ sPath += "/cnt-default.ott";
+ if (FileAccess.isPathValid(getMSF(), sPath))
+ {
+ return sPath;
+ }
+ }
+ return "";
+ }
+
+ public String getLayoutPath()
+ {
+ ArrayList aReportPath = getReportPath();
+ for (int i = 0; i < aReportPath.size(); i++)
+ {
+ String sPath = (String) aReportPath.get(i);
+ sPath += "/stl-default.ott";
+ if (FileAccess.isPathValid(getMSF(), sPath))
+ {
+ return sPath;
+ }
+ }
+ return "";
+ }
+
+ public int getDefaultPageOrientation()
+ {
+ return m_nDefaultPageOrientation;
+ }
+
+ public String[][] getDataLayout()
+ {
+ String[][] ContentFiles;
+ try
+ {
+// ContentFiles = FileAccess.getFolderTitles(m_xMSF, "cnt", CurReportDocument.getReportPath());
+ ContentFiles = FileAccess.getFolderTitles(getMSF(), "cnt", getReportPath());
+ }
+ catch (com.sun.star.wizards.common.NoValidPathException e)
+ {
+ ContentFiles = new String[2][];
+ String[] a = new String[1];
+ String[] b = new String[1];
+ a[0] = "DefaultLayoutOfData";
+ b[0] = "default";
+ ContentFiles[1] = a;
+ ContentFiles[0] = b;
+ }
+ return ContentFiles;
+ }
+
+ public String[][] getHeaderLayout()
+ {
+ String[][] LayoutFiles;
+ try
+ {
+// LayoutFiles = FileAccess.getFolderTitles(m_xMSF, "stl", CurReportDocument.getReportPath());
+ LayoutFiles = FileAccess.getFolderTitles(getMSF(), "stl", getReportPath());
+ }
+ catch (com.sun.star.wizards.common.NoValidPathException e)
+ {
+ LayoutFiles = new String[2][];
+ String[] a = new String[1];
+ String[] b = new String[1];
+ a[0] = "DefaultLayoutOfHeaders";
+ b[0] = "default";
+ LayoutFiles[1] = a;
+ LayoutFiles[0] = b;
+ }
+ return LayoutFiles;
+ }
+
+ public void importReportData(ReportWizard _aWizard)
+ {
+ Dataimport CurDataimport = new Dataimport(_aWizard.xMSF);
+ CurDataimport.CurReportDocument = this;
+ _aWizard.importReportData(_aWizard.xMSF, CurDataimport);
+ }
+
+ public void setCommandType(int _nCommand)
+ {
+ // already set somewhere else
+ }
+
+ public void setCommand(String _sCommand)
+ {
+ getRecordParser().Command = _sCommand;
+ }
+
+ 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
new file mode 100644
index 000000000000..61ab85c6094d
--- /dev/null
+++ b/wizards/com/sun/star/wizards/report/ReportWizard.java
@@ -0,0 +1,762 @@
+/*
+ ************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+package com.sun.star.wizards.report;
+
+// import java.util.Vector;
+
+import com.sun.star.awt.TextEvent;
+import com.sun.star.awt.VclWindowPeerAttribute;
+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;
+import com.sun.star.logging.XLoggerPool;
+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.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 DatabaseObjectWizard implements XTextListener, XCompletion
+{
+ protected FieldSelection CurGroupFieldSelection;
+ private SortingComponent CurSortingComponent;
+ private TitlesComponent CurTitlesComponent;
+ private CommandFieldSelection CurDBCommandFieldSelection;
+ private GroupFieldHandler CurGroupFieldHandler;
+ private ReportLayouter CurReportLayouter;
+ private ReportFinalizer CurReportFinalizer;
+ private int nReportMode = ReportFinalizer.SOCREATEDOCUMENT;
+ private String m_sReportName = "";
+ protected static final String SOREPORTFORMNAME = "ReportSource";
+ private static final int SOMAINPAGE = 1;
+ private static final int SOTITLEPAGE = 2;
+ protected static final int SOGROUPPAGE = 3;
+ private static final int SOSORTPAGE = 4;
+ protected static final int SOTEMPLATEPAGE = 5;
+ protected static final int SOSTOREPAGE = 6;
+
+ private IReportDocument m_reportDocument;
+ private static String sMsgWizardName;
+ private static String slblFields;
+ private static String slblSelFields;
+ private static String sShowBinaryFields;
+ private String[] WizardHeaderText = new String[6];
+ private static String slblColumnTitles;
+ private static String slblColumnNames;
+ private static String slblTables;
+ protected static boolean bCloseDocument;
+ private boolean bHasEscapeProcessing = true;
+
+ public ReportWizard( XMultiServiceFactory i_serviceFactory, final PropertyValue[] i_wizardContext )
+ {
+ super(i_serviceFactory, 34320, i_wizardContext );
+ super.addResourceHandler("Report Wizard", "dbw");
+ if (getReportResources(false) == true)
+ {
+ Helper.setUnoPropertyValues(xDialogModel,
+ new String[]
+ {
+ "Height",
+ "Moveable",
+ "Name",
+ "PositionX",
+ "PositionY",
+ "Step",
+ "TabIndex",
+ "Title",
+ "Width"
+ },
+ new Object[]
+ {
+ Integer.valueOf(210),
+ Boolean.TRUE,
+ "DialogReport",
+ new Integer(102),
+ new Integer(41),
+ new Integer(1),
+ new Short((short) 0),
+ sMsgWizardName,
+ new Integer(310)
+ });
+ drawNaviBar();
+ setRightPaneHeaders(this.WizardHeaderText);
+ }
+ }
+
+ protected void enterStep(int nOldStep, int nNewStep)
+ {
+ if ((nOldStep >= SOTEMPLATEPAGE) && (nNewStep < SOTEMPLATEPAGE))
+ {
+ // CurReportDocument.getDoc().oTextSectionHandler.removeTextSectionbyName("RecordSection");
+ // CurReportDocument.getDoc().oTextTableHandler.removeTextTablebyName("Tbl_RecordSection");
+ m_reportDocument.removeTextTableAndTextSection();
+ }
+ switch (nNewStep)
+ {
+ case SOMAINPAGE:
+ CurDBCommandFieldSelection.setModified(false);
+ break;
+
+ case SOTITLEPAGE:
+ String[] aFieldNames = m_reportDocument.getRecordParser().getFieldNames();
+ Map aFieldTitleSet = m_reportDocument.getRecordParser().getFieldTitleSet();
+ CurTitlesComponent.initialize(aFieldNames, aFieldTitleSet);
+ break;
+
+ case SOGROUPPAGE:
+ CurGroupFieldHandler.initialize();
+ break;
+
+ case SOSORTPAGE:
+ String[] aFieldNames2 = m_reportDocument.getRecordParser().getFieldNames();
+ String[][] aSortFieldNames = m_reportDocument.getRecordParser().getSortFieldNames();
+ CurSortingComponent.initialize(aFieldNames2, aSortFieldNames);
+ int nLength = m_reportDocument.getRecordParser().GroupFieldNames.length;
+ CurSortingComponent.setReadOnlyUntil(nLength, false);
+ break;
+
+ case SOTEMPLATEPAGE:
+ break;
+
+ case SOSTOREPAGE:
+ //TODO initialize with suitable PathName
+ CurReportFinalizer.initialize(m_reportDocument.getRecordParser());
+ break;
+
+ default:
+ break;
+ }
+ }
+
+ protected void leaveStep(int nOldStep, int nNewStep)
+ {
+
+ switch (nOldStep)
+ {
+ case SOMAINPAGE:
+ String[] aSelectedFieldNames = CurDBCommandFieldSelection.getSelectedFieldNames();
+ String aTableName = CurDBCommandFieldSelection.getSelectedCommandName();
+ int nType = CurDBCommandFieldSelection.getSelectedCommandType();
+ m_reportDocument.initializeFieldColumns(nType, aTableName, aSelectedFieldNames);
+ if (CurDBCommandFieldSelection.isModified())
+ {
+ // cleanup document
+ m_reportDocument.clearDocument();
+ m_reportDocument.getRecordParser().setGroupFieldNames(new String[]{});
+ CurGroupFieldHandler.removeGroupFieldNames();
+ }
+ break;
+
+ case SOTITLEPAGE:
+ String[] sFieldTitles = CurTitlesComponent.getFieldTitles();
+ // set new field name titles
+ // CurReportDocument.getRecordParser().setFieldTitles(sFieldTitles);
+ m_reportDocument.setFieldTitles(sFieldTitles);
+ break;
+
+ case SOGROUPPAGE:
+ // TODO: DESIGN!!! a getter should return a value!!!
+ CurGroupFieldHandler.getGroupFieldNames(m_reportDocument.getRecordParser());
+ String[] aGroupFieldNames = m_reportDocument.getRecordParser().GroupFieldNames;
+ // CurReportDocument.getRecordParser().prependSortFieldNames(aGroupFieldNames);
+ m_reportDocument.setGrouping(aGroupFieldNames);
+ break;
+
+ case SOSORTPAGE:
+ String[][] aSortFieldNames = CurSortingComponent.getSortFieldNames();
+ // CurReportDocument.getRecordParser().SortFieldNames = aSortFieldNames;
+ m_reportDocument.setSorting(aSortFieldNames);
+ // TODO: why do we make a switch here
+ super.enablefromStep(SOTEMPLATEPAGE, true);
+ break;
+
+ case SOTEMPLATEPAGE:
+ break;
+
+ case SOSTOREPAGE:
+ break;
+
+ default:
+ break;
+ }
+
+ if ((nOldStep < SOTEMPLATEPAGE) && (super.getNewStep() >= SOTEMPLATEPAGE))
+ {
+// this is called before SOTEMPLATEPAGE, after SOGROUPPAGE
+ m_reportDocument.getRecordParser().createRecordFieldNames();
+ CurReportLayouter.initialize(m_reportDocument.getContentPath());
+ }
+ }
+
+ private void dialogFinish()
+ {
+ 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 );
+ }
+ }
+
+ private boolean executeQuery()
+ {
+ boolean bQueryCreated = false;
+ if (this.CurDBCommandFieldSelection.getSelectedCommandType() == CommandType.TABLE)
+ {
+ bQueryCreated = m_reportDocument.getRecordParser().oSQLQueryComposer.setQueryCommand(this.xWindow, false, false);
+
+ 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 = 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(""));
+ m_reportDocument.getRecordParser().oSQLQueryComposer.m_xQueryAnalyzer.setQuery(sCommand);
+ m_reportDocument.getRecordParser().oSQLQueryComposer.prependSortingCriteria();
+// TODO: check with query
+ m_reportDocument.setCommandType(CommandType.COMMAND);
+ m_reportDocument.setCommand(m_reportDocument.getRecordParser().oSQLQueryComposer.getQuery());
+ bQueryCreated = true;
+ }
+ else
+ {
+ m_reportDocument.setCommandType(CommandType.COMMAND);
+ m_reportDocument.setCommand(sCommand);
+ bQueryCreated = true;
+ }
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace(System.out);
+ }
+ }
+ if (!bQueryCreated)
+ {
+ super.vetoableChange(null);
+ }
+ return bQueryCreated;
+ }
+ public void buildSteps()
+ {
+ // CurReportDocument.getDoc().xProgressBar.setValue(30);
+ CurDBCommandFieldSelection = new CommandFieldSelection(this, m_reportDocument.getRecordParser(), 100, slblFields, slblSelFields, slblTables, true, 34330);
+ CurDBCommandFieldSelection.addFieldSelectionListener(new FieldSelectionListener());
+ if ( !isReportBuilderInstalled() )
+ {
+ insertLabel("lblBinaryFields",
+ new String[]
+ {
+ "Height", "Label", "PositionX", "PositionY", "Step", "Width"
+ },
+ new Object[]
+ {
+ new Integer(16), sShowBinaryFields, new Integer(95), new Integer(162), new Integer(1), new Integer(210)
+ });
+ }
+ // CurReportDocument.getDoc().xProgressBar.setValue(40);
+ CurTitlesComponent = new TitlesComponent(this, SOTITLEPAGE, 97, 37, 210, 7, slblColumnNames, slblColumnTitles, 34381);
+ CurTitlesComponent.addTextListener(this);
+ // CurReportDocument.getDoc().xProgressBar.setValue(50);
+ 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, m_reportDocument, this);
+ // CurReportDocument.getDoc().xProgressBar.setValue(80);
+ CurReportFinalizer = new ReportFinalizer(xMSF, m_reportDocument, this);
+ // CurReportDocument.getDoc().xProgressBar.setValue(100);
+ bCloseDocument = true;
+ // CurReportDocument.getDoc().xProgressBar.end();
+ enableNavigationButtons(false, false, false);
+ }
+
+ public boolean finishWizard()
+ {
+ final int ncurStep = getCurrentStep();
+ if ((switchToStep(ncurStep, SOSTOREPAGE)) || (ncurStep == SOSTOREPAGE))
+ {
+ if (this.executeQuery())
+ {
+ if (CurReportFinalizer.finish())
+ {
+ nReportMode = CurReportFinalizer.getReportOpenMode();
+ m_sReportName = CurReportFinalizer.getStoreName();
+ xDialog.endExecute();
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ public void cancelWizard()
+ {
+ xDialog.endExecute();
+ }
+
+ public void insertQueryRelatedSteps()
+ {
+ setRMItemLabels(m_oResource, UIConsts.RID_QUERY + 80);
+ addRoadmap();
+ int i = 0;
+ i = insertRoadmapItem(0, true, m_oResource.getResText(UIConsts.RID_QUERY + 80), SOMAINPAGE);
+ i = insertRoadmapItem(i, false, m_oResource.getResText(UIConsts.RID_REPORT + 68), SOTITLEPAGE);
+ i = insertRoadmapItem(i, false, m_oResource.getResText(UIConsts.RID_REPORT + 11), SOGROUPPAGE);
+ i = insertRoadmapItem(i, false, m_oResource.getResText(UIConsts.RID_REPORT + 12), SOSORTPAGE); // Orderby is always supported
+ i = insertRoadmapItem(i, false, m_oResource.getResText(UIConsts.RID_REPORT + 13), SOTEMPLATEPAGE);
+ i = insertRoadmapItem(i, false, m_oResource.getResText(UIConsts.RID_REPORT + 14), SOSTOREPAGE);
+ setRoadmapInteractive(true);
+ setRoadmapComplete(true);
+ setCurrentRoadmapItemID((short) 1);
+ }
+
+ private boolean isReportBuilderInstalled()
+ {
+ //! Check if the new Report Builder Extension is available
+ 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)
+ {
+ return false;
+ }
+ if (e.hasMoreElements())
+ {
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * 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 );
+ final String sLocation = xProvider.getPackageLocation("com.sun.reportdesigner");
+ return sLocation;
+ }
+
+private static XLogger m_xLogger;
+
+private static void initializeLogger(XMultiServiceFactory _xMSF)
+{
+ XComponentContext xContext = Helper.getComponentContext(_xMSF);
+
+ final Object aLoggerPool = xContext.getValueByName("/singletons/com.sun.star.logging.LoggerPool");
+ if (aLoggerPool == null)
+ {
+ System.out.println("Can't get singleton from logging");
+ }
+ final XLoggerPool xLoggerPool = UnoRuntime.queryInterface( XLoggerPool.class, aLoggerPool );
+ m_xLogger = xLoggerPool.getNamedLogger("com.sun.star.wizards.ReportBuilder");
+}
+
+public static XLogger getLogger()
+{
+ return m_xLogger;
+}
+
+ public void startReportWizard()
+ {
+ initializeLogger(xMSF);
+ getLogger().log(LogLevel.SEVERE, "Start Report Wizard");
+
+ 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 )
+ {
+ 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 });
+ 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 (m_reportDocument == null)
+ {
+ // Fallback, if there is no reportbuilder wizard implementation, we use the old wizard
+ m_reportDocument = new ReportTextImplementation( xMSF );
+ }
+
+ m_reportDocument.initialize( m_docUI, m_oResource );
+
+ if ( m_reportDocument.getRecordParser().getConnection( m_wizardContext ) )
+ {
+ m_reportDocument.getRecordParser().oSQLQueryComposer = new SQLQueryComposer(m_reportDocument.getRecordParser());
+ buildSteps();
+
+ m_reportDocument.checkInvariants();
+
+ this.CurDBCommandFieldSelection.preselectCommand( m_wizardContext, false );
+
+ createWindowPeer(m_reportDocument.getWizardParent());
+
+ m_reportDocument.getRecordParser().setWindowPeer(this.xControl.getPeer());
+ insertQueryRelatedSteps();
+ short RetValue = executeDialog(m_reportDocument.getFrame().getComponentWindow().getPosSize());
+ if ( RetValue == 0 )
+ dialogFinish();
+ }
+ m_reportDocument.getRecordParser().dispose();
+ }
+ catch (java.io.IOException e)
+ {
+ String sMessage = e.getMessage();
+ if (sMessage.equals("default.otr"))
+ {
+ sMessage = m_oResource.getResText(UIConsts.RID_REPORT + 92);
+ }
+ else
+ {
+ }
+ // show a dialog with the error message
+ SystemDialog.showMessageBox(xMSF, "ErrorBox", VclWindowPeerAttribute.OK, sMessage);
+ }
+ catch (java.lang.Exception jexception)
+ {
+ jexception.printStackTrace(System.out);
+ }
+ }
+
+ public void importReportData(final XMultiServiceFactory xMSF, final Dataimport CurDataimport)
+ {
+ boolean bDocisStored = false;
+ try
+ {
+ boolean bexecute = false;
+ if (!bHasEscapeProcessing)
+ {
+ bexecute = m_reportDocument.getRecordParser().executeCommand(com.sun.star.sdb.CommandType.QUERY); // sMsgQueryCreationImpossible + (char) 13 + sMsgEndAutopilot))
+ }
+ else
+ {
+ bexecute = m_reportDocument.getRecordParser().executeCommand(com.sun.star.sdb.CommandType.COMMAND); // sMsgQueryCreationImpossible + (char) 13 + sMsgEndAutopilot))
+ }
+ if (bexecute)
+ {
+ bexecute = m_reportDocument.getRecordParser().getFields(m_reportDocument.getRecordParser().getFieldNames(), false);
+ }
+ if (bexecute)
+ {
+ // CurDataimport.insertDatabaseDatatoReportDocument(xMSF);
+ m_reportDocument.insertDatabaseDatatoReportDocument(xMSF);
+ }
+
+ if (CurReportFinalizer.getReportOpenMode() == ReportFinalizer.SOCREATEDOCUMENT)
+ {
+ bDocisStored = m_reportDocument.getRecordParser().storeDatabaseDocumentToTempPath(m_reportDocument.getComponent(), CurReportFinalizer.getStoreName());
+ }
+ }
+ catch (com.sun.star.wizards.common.InvalidQueryException queryexception)
+ {
+ }
+ CurDataimport.xComponent.dispose();
+ if (bDocisStored)
+ {
+ m_reportDocument.getRecordParser().addReportDocument(m_reportDocument.getComponent(), false);
+ }
+
+ m_reportDocument.getRecordParser().dispose();
+ }
+
+ public boolean getReportResources(boolean bgetProgressResourcesOnly)
+ {
+ sMsgWizardName = super.m_oResource.getResText(UIConsts.RID_REPORT);
+ if (bgetProgressResourcesOnly == false)
+ {
+ sShowBinaryFields = m_oResource.getResText(UIConsts.RID_REPORT + 60);
+ slblTables = m_oResource.getResText(UIConsts.RID_FORM + 6);
+ slblFields = m_oResource.getResText(UIConsts.RID_FORM + 12);
+ slblSelFields = m_oResource.getResText(UIConsts.RID_REPORT + 9);
+ WizardHeaderText[0] = m_oResource.getResText(UIConsts.RID_REPORT + 28);
+ WizardHeaderText[1] = m_oResource.getResText(UIConsts.RID_REPORT + 69);
+ WizardHeaderText[2] = m_oResource.getResText(UIConsts.RID_REPORT + 29);
+ 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);
+ }
+ slblColumnTitles = m_oResource.getResText(UIConsts.RID_REPORT + 70);
+ slblColumnNames = m_oResource.getResText(UIConsts.RID_REPORT + 71);
+ return true;
+ }
+
+ public static String getBlindTextNote(Object _aDocument, Resource _oResource)
+ {
+ String sBlindTextNote = "";
+ if (_aDocument instanceof ReportTextImplementation)
+ {
+ sBlindTextNote = _oResource.getResText(UIConsts.RID_REPORT + 75);
+ sBlindTextNote = JavaTools.replaceSubString(sBlindTextNote, String.valueOf((char) 13), "<BR>");
+ }
+ return sBlindTextNote;
+ }
+
+ public void enableRoadmapItems(boolean _bEnabled)
+ {
+ try
+ {
+ Object oRoadmapItem = null;
+ int CurStep = AnyConverter.toInt(Helper.getUnoPropertyValue(xDialogModel, "Step"));
+ boolean bEnabled = false;
+ int CurItemID;
+ for (int i = 0; i < getRMItemCount(); i++)
+ {
+ oRoadmapItem = this.xIndexContRoadmap.getByIndex(i);
+ CurItemID = AnyConverter.toInt(Helper.getUnoPropertyValue(oRoadmapItem, "ID"));
+ if (CurItemID > CurStep)
+ {
+ bEnabled = _bEnabled;
+ }
+ else
+ {
+ bEnabled = true;
+ }
+
+ Helper.setUnoPropertyValue(oRoadmapItem, "Enabled", new Boolean(bEnabled));
+ }
+ }
+ catch (com.sun.star.uno.Exception exception)
+ {
+ exception.printStackTrace(System.out);
+ }
+ }
+
+ private void enableWizardSteps(String[] NewItems)
+ {
+ boolean bEnabled = NewItems.length > 0;
+ setControlProperty("btnWizardNext", "Enabled", new Boolean(bEnabled));
+ setControlProperty("btnWizardFinish", "Enabled", new Boolean(bEnabled));
+ enableRoadmapItems(bEnabled); // Note: Performancewise this could be improved
+ }
+
+ public void textChanged(TextEvent xTextEvent)
+ {
+ try
+ {
+ Object oModel = UnoDialog.getModel(xTextEvent.Source);
+ String sContent = (String) Helper.getUnoPropertyValue(oModel, "Text");
+ String fieldname = this.CurTitlesComponent.getFieldNameByTitleControl(oModel);
+ // CurReportDocument.getDoc().oTextFieldHandler.changeUserFieldContent(fieldname, sfieldtitle);
+ m_reportDocument.liveupdate_changeUserFieldContent(fieldname, sContent);
+ }
+ catch (Exception exception)
+ {
+ exception.printStackTrace(System.out);
+ }
+ }
+
+ public void disposing(EventObject EventObject)
+ {
+ }
+
+ public void setmodified(int _ndialogpage, Object ooldValue, Object onewValue)
+ {
+ switch (_ndialogpage)
+ {
+ case SOMAINPAGE:
+ break;
+ default:
+ break;
+ }
+ }
+
+ private void toggleSortingPage()
+ {
+ int nlCommandType = this.CurDBCommandFieldSelection.getSelectedCommandType();
+ boolean bdoenable = (nlCommandType == CommandType.TABLE);
+ if (!bdoenable)
+ {
+ String sQueryName = CurDBCommandFieldSelection.getSelectedCommandName();
+ DBMetaData.CommandObject oCommand = m_reportDocument.getRecordParser().getQueryByName(sQueryName);
+ bdoenable = m_reportDocument.getRecordParser().hasEscapeProcessing(oCommand.getPropertySet());
+ }
+ super.setStepEnabled(SOSORTPAGE, bdoenable);
+
+ // int nCommandType = this.CurDBCommandFieldSelection.getSelectedCommandType();
+ // super.setStepEnabled(SOSORTPAGE, (nCommandType == CommandType.TABLE));
+ }
+
+ public class FieldSelectionListener implements com.sun.star.wizards.ui.XFieldSelectionListener
+ {
+
+ protected int m_nID;
+
+ public int getID()
+ {
+ return m_nID;
+ }
+
+ public void setID(String sIncSuffix)
+ {
+ m_nID = 1;
+ if (sIncSuffix != null)
+ {
+ if ((!sIncSuffix.equals("")) && (!sIncSuffix.equals("_")))
+ {
+ String sID = JavaTools.ArrayoutofString(sIncSuffix, "_")[1];
+ m_nID = Integer.parseInt(sID);
+ }
+ }
+ }
+
+ public void shiftFromLeftToRight(String[] SelItems, String[] NewItems)
+ {
+ if (m_nID == 1)
+ {
+ CurDBCommandFieldSelection.setModified(true);
+ enableWizardSteps(NewItems);
+ toggleSortingPage();
+ }
+ else
+ {
+ boolean bEnabled = (CurGroupFieldSelection.getSelectedFieldNames().length > 0);
+ Helper.setUnoPropertyValue(getRoadmapItemByID(SOGROUPPAGE), "Enabled", new Boolean(bEnabled));
+ }
+ }
+
+ public void shiftFromRightToLeft(String[] SelItems, String[] NewItems)
+ {
+ // TODO When the ListFieldbox is refilled only fields of the current Command may be merged into the Listbox
+ if (m_nID == 1)
+ {
+ enableWizardSteps(NewItems);
+ CurDBCommandFieldSelection.setModified(true);
+ }
+ else
+ {
+ boolean bEnabled = (CurGroupFieldSelection.getSelectedFieldNames().length > 0);
+ Helper.setUnoPropertyValue(getRoadmapItemByID(SOGROUPPAGE), "Enabled", new Boolean(bEnabled));
+ }
+ }
+
+ public void moveItemDown(String item)
+ {
+ }
+
+ public void moveItemUp(String item)
+ {
+ }
+ }
+// public void tests()
+// {
+//
+// Calendar aCalendar = new GregorianCalendar();
+// aCalendar.setTimeInMillis(1202382900000L);
+// String aCalStr = aCalendar.toString();
+//
+// Date aDate = new Date();
+// aDate.setSeconds(0);
+// aDate.setMinutes(15);
+// aDate.setHours(12);
+// // aDate.setMonth(2);
+// // aDate.setYear(2008);
+// // aDate.setDay(7);
+// long nTime = aDate.getTime();
+// Long aLong = new Long(nTime);
+// String aStr = aLong.toString();
+//
+// Date aNewDate = new Date(1202382900000L);
+//// aNewDate.
+// String aDateStr = aNewDate.toString();
+//// Datetime aNewTime = new Time(1202382900);
+//// String aTimeStr = aNewTime.toString();
+//
+// }
+}
diff --git a/wizards/com/sun/star/wizards/report/delzip b/wizards/com/sun/star/wizards/report/delzip
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/wizards/com/sun/star/wizards/report/delzip
diff --git a/wizards/com/sun/star/wizards/report/makefile.mk b/wizards/com/sun/star/wizards/report/makefile.mk
new file mode 100644
index 000000000000..b31639d21a46
--- /dev/null
+++ b/wizards/com/sun/star/wizards/report/makefile.mk
@@ -0,0 +1,68 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+PRJ = ..$/..$/..$/..$/..
+PRJNAME = wizards
+TARGET = report
+PACKAGE = com$/sun$/star$/wizards$/report
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+#.INCLUDE : $(PRJ)$/util$/makefile.pmk
+
+JARFILES= unoil.jar jurt.jar ridl.jar juh.jar java_uno.jar commonwizards.jar
+
+CUSTOMMANIFESTFILE= MANIFEST.MF
+
+JARCLASSDIRS = com$/sun$/star$/wizards$/report
+JARTARGET = $(TARGET).jar
+JARCLASSPATH = commonwizards.jar
+
+# --- Files --------------------------------------------------------
+
+JAVAFILES= \
+ CallReportWizard.java \
+ DBColumn.java \
+ Dataimport.java \
+ GroupFieldHandler.java \
+ IReportDocument.java \
+ IReportBuilderLayouter.java \
+ IReportDefinitionReadAccess.java \
+ RecordTable.java \
+ ReportFinalizer.java \
+ ReportImplementationHelper.java \
+ ReportLayouter.java \
+ ReportTextDocument.java \
+ ReportTextImplementation.java \
+ ReportWizard.java
+
+JAVACLASSFILES = $(foreach,i,$(JAVAFILES) $(CLASSDIR)$/$(PACKAGE)$/$(i:b).class)
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk