diff options
author | Bjoern Michaelsen <bjoern.michaelsen@canonical.com> | 2011-08-18 02:27:27 +0200 |
---|---|---|
committer | Bjoern Michaelsen <bjoern.michaelsen@canonical.com> | 2011-08-18 02:27:27 +0200 |
commit | 57272eaaf5776f673b5141354a1d1e1af080d575 (patch) | |
tree | 9241d5523e03af24cd7ba2e45dd8b0951a9fdeb1 /wizards/com/sun/star/wizards/report | |
parent | 1df024d97cc44155566f8db279e8cdba37e95fcf (diff) | |
parent | f9d40c2b591215b57ece4ba6e623b7808a7ae717 (diff) |
Merge commit 'f9d40c2b591215b57ece4ba6e623b7808a7ae717' into feature/gsoc2011_wizards
Conflicts:
wizards/com/sun/star/wizards/common/Resource.java
merged resolved as per:
e52421bc118e9c5f3fce5a32ba9efdcad7627d92
9e91dbca08056fc31f388f5642fdfa3d2b910990
in the old components repository merging the corresponding commit
3b4fe490441f9f77829bc6c1ae30d79a4d50255b there
Diffstat (limited to 'wizards/com/sun/star/wizards/report')
14 files changed, 328 insertions, 301 deletions
diff --git a/wizards/com/sun/star/wizards/report/CallReportWizard.java b/wizards/com/sun/star/wizards/report/CallReportWizard.java index c66596e11c02..0ddedc8be5b0 100644 --- a/wizards/com/sun/star/wizards/report/CallReportWizard.java +++ b/wizards/com/sun/star/wizards/report/CallReportWizard.java @@ -1,7 +1,7 @@ /************************************************************************* * * 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 @@ -28,11 +28,13 @@ 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; +import com.sun.star.wizards.common.PropertyNames; +import java.util.logging.Level; +import java.util.logging.Logger; /** This class capsulates the class, that implements the minimal component, a * factory for creating the service (<CODE>__getServiceFactory</CODE>). @@ -114,9 +116,9 @@ public class CallReportWizard { try { - if (sEvent.compareTo("start") == 0) + if (sEvent.compareTo(PropertyNames.START) == 0) { - if (bWizardstartedalready != true) + if (!bWizardstartedalready) { ReportWizard CurReportWizard = new ReportWizard( xmultiservicefactory, m_wizardContext ); CurReportWizard.startReportWizard(); @@ -138,9 +140,9 @@ public class CallReportWizard } } } - catch (Exception exception) + catch (Exception e) { - System.err.println(exception); + Logger.getLogger(CallReportWizard.class.getName()).log(Level.SEVERE, null, e); } System.gc(); } @@ -212,11 +214,11 @@ public class CallReportWizard try { - byteReturn = new String("" + this.hashCode()).getBytes(); + byteReturn = (PropertyNames.EMPTY_STRING + this.hashCode()).getBytes(); } - catch (Exception exception) + catch (Exception e) { - System.err.println(exception); + Logger.getLogger(CallReportWizard.class.getName()).log(Level.SEVERE, null, e); } return (byteReturn); @@ -251,9 +253,9 @@ public class CallReportWizard new Type(com.sun.star.lang.XInitialization.class) }; } - catch (Exception exception) + catch (Exception e) { - System.err.println(exception); + Logger.getLogger(CallReportWizard.class.getName()).log(Level.SEVERE, null, e); } return (typeReturn); diff --git a/wizards/com/sun/star/wizards/report/DBColumn.java b/wizards/com/sun/star/wizards/report/DBColumn.java index ee60f3744000..9abf4a4ebf98 100644 --- a/wizards/com/sun/star/wizards/report/DBColumn.java +++ b/wizards/com/sun/star/wizards/report/DBColumn.java @@ -1,7 +1,7 @@ /************************************************************************* * * 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 @@ -126,7 +126,7 @@ public class DBColumn try { XCell xCell = CurRecordTable.xCellRange.getCellByPosition(_nColumn, 0); - XTextRange xTextCell = (XTextRange) UnoRuntime.queryInterface(XTextRange.class, xCell); + XTextRange xTextCell = UnoRuntime.queryInterface(XTextRange.class, xCell); String CompString = "Column"; XTextCursor xLocCellCursor = TextDocument.createTextCursor(xCell); if (isNameCell(xLocCellCursor, CurDBField.getFieldName(), CompString) || (_bforce)) @@ -134,7 +134,7 @@ public class DBColumn xNameCell = xCell; xNameTextCell = xTextCell; xValCell = CurRecordTable.xCellRange.getCellByPosition(_nColumn, 1); - xValTextCell = (XTextRange) UnoRuntime.queryInterface(XTextRange.class, xValCell); + xValTextCell = UnoRuntime.queryInterface(XTextRange.class, xValCell); xValCellCursor = TextDocument.createTextCursor(xValCell); ValColumn = _nColumn; return true; @@ -190,7 +190,7 @@ public class DBColumn for (int m = 0; m < xRows.getCount(); m++) { xCell = xCellRange.getCellByPosition(n, m); - xTextCell = (XTextRange) UnoRuntime.queryInterface(XTextRange.class, xCell); + xTextCell = UnoRuntime.queryInterface(XTextRange.class, xCell); String CompString = TableName.substring(4); XTextCursor xLocCellCursor = TextDocument.createTextCursor(xCell); if (isNameCell(xLocCellCursor, CurDBField.getFieldName(), CompString)) @@ -216,12 +216,12 @@ public class DBColumn try { XNameAccess xAllTextTables = oTextTableHandler.xTextTablesSupplier.getTextTables(); - if (xAllTextTables.hasByName(TableName) == true) + if (xAllTextTables.hasByName(TableName)) { 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); + xCellRange = UnoRuntime.queryInterface(XCellRange.class, oTextTable); + xTextTable = UnoRuntime.queryInterface(XTextTable.class, oTextTable); + xTableName = UnoRuntime.queryInterface(XNamed.class, oTextTable); xTableColumns = xTextTable.getColumns(); } } @@ -257,7 +257,7 @@ public class DBColumn XTextCursor xTextCursor = TextDocument.createTextCursor(xNameCell); xTextCursor.gotoStart(false); xTextCursor.gotoEnd(true); - xTextCursor.setString(""); + xTextCursor.setString(PropertyNames.EMPTY_STRING); oTextFieldHandler.insertUserField(xTextCursor, CurDBField.getFieldName(), CurDBField.getFieldTitle()); } @@ -266,7 +266,7 @@ public class DBColumn XTextCursor xTextCursor = TextDocument.createTextCursor(xCell); xTextCursor.gotoStart(false); xTextCursor.gotoEnd(true); - xTextCursor.setString(""); + xTextCursor.setString(PropertyNames.EMPTY_STRING); oTextFieldHandler.insertUserField(xTextCursor, CurDBField.getFieldName(), CurDBField.getFieldTitle()); } @@ -290,7 +290,7 @@ public class DBColumn try { xValCell = xCellRange.getCellByPosition(ValColumn, ValRow); - xValTextCell = (XTextRange) UnoRuntime.queryInterface(XTextRange.class, xValCell); + xValTextCell = UnoRuntime.queryInterface(XTextRange.class, xValCell); modifyCellContent(CurGroupValue); if (bAlignLeft) { @@ -361,7 +361,7 @@ public class DBColumn try { Object CurGroupValue; - if (bIsGroupColumn == false && CurDBField.isNumberFormat() == false) + if (!bIsGroupColumn && !CurDBField.isNumberFormat()) { CurGroupValue = BlindtextCreator.adjustBlindTextlength(CurDBField.getFieldTitle(), CurDBField.getFieldWidth(), _bIsLandscape, bIsGroupColumn, CurDBMetaData.getRecordFieldNames()); } @@ -381,7 +381,7 @@ public class DBColumn { CharFontName = "StarSymbol"; Helper.setUnoPropertyValue(xValCellCursor, "CharFontName", CharFontName); - if (bIsGroupColumn == false) + if (!bIsGroupColumn) { Helper.setUnoPropertyValue(xValCellCursor, "ParaAdjust", new Integer(ParagraphAdjust.CENTER_value)); } @@ -390,7 +390,7 @@ public class DBColumn { if (PropertyState == com.sun.star.beans.PropertyState.DEFAULT_VALUE) { - XPropertyState xPropState = (XPropertyState) UnoRuntime.queryInterface(XPropertyState.class, xValCellCursor); + XPropertyState xPropState = UnoRuntime.queryInterface(XPropertyState.class, xValCellCursor); xPropState.setPropertyToDefault("CharFontName"); } else @@ -425,7 +425,7 @@ public class DBColumn } else { - xPropertyState = (XPropertyState) UnoRuntime.queryInterface(XPropertyState.class, xValCellCursor); + xPropertyState = UnoRuntime.queryInterface(XPropertyState.class, xValCellCursor); PropertyState = xPropertyState.getPropertyState("CharFontName"); CharFontName = AnyConverter.toString(Helper.getUnoPropertyValue(xValCellCursor, "CharFontName")); } @@ -449,7 +449,7 @@ public class DBColumn } else { - XDependentTextField xDependent = (XDependentTextField) UnoRuntime.queryInterface(XDependentTextField.class, oTextField); + XDependentTextField xDependent = UnoRuntime.queryInterface(XDependentTextField.class, oTextField); XPropertySet xMaster = xDependent.getTextFieldMaster(); String UserFieldName = (String) xMaster.getPropertyValue(PropertyNames.PROPERTY_NAME); boolean bIsNameCell = false; diff --git a/wizards/com/sun/star/wizards/report/Dataimport.java b/wizards/com/sun/star/wizards/report/Dataimport.java index 2081b655ae7e..f8dd6feb7620 100644 --- a/wizards/com/sun/star/wizards/report/Dataimport.java +++ b/wizards/com/sun/star/wizards/report/Dataimport.java @@ -1,7 +1,7 @@ /************************************************************************* * * 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 @@ -34,6 +34,8 @@ import com.sun.star.text.XTextDocument; import com.sun.star.wizards.ui.*; import com.sun.star.wizards.common.*; import com.sun.star.uno.Exception; +import java.util.logging.Level; +import java.util.logging.Logger; public class Dataimport extends UnoDialog2 implements com.sun.star.awt.XActionListener { // extends ReportWizard @@ -80,11 +82,11 @@ public class Dataimport extends UnoDialog2 implements com.sun.star.awt.XActionLi CurReportDocument.StopProcess(); } -// public static void main(String args[]) +// 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 +// try // { // xMSF = com.sun.star.wizards.common.Desktop.connect(ConnectStr); // if (xMSF != null) @@ -95,19 +97,19 @@ public class Dataimport extends UnoDialog2 implements com.sun.star.awt.XActionLi // 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"); +// curproperties[1] = Properties.createProperty(PropertyNames.COMMAND_TYPE, new Integer(CommandType.TABLE)); +// curproperties[2] = Properties.createProperty(PropertyNames.COMMAND, "Table2"); // // Dataimport CurDataimport = new Dataimport(xMSF); // TextDocument oTextDocument = new TextDocument(xMSF, true, null); // CurDataimport.createReport(xMSF, oTextDocument.xTextDocument, curproperties); // // } -// catch (Exception e) +// catch (Exception e) // { // e.printStackTrace(System.out); // } -// catch (java.lang.Exception javaexception) +// catch (java.lang.Exception javaexception) // { // javaexception.printStackTrace(System.out); // } @@ -119,11 +121,11 @@ public class Dataimport extends UnoDialog2 implements com.sun.star.awt.XActionLi Helper.setUnoPropertyValues(xDialogModel, new String[] { - PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_STEP, "Title", PropertyNames.PROPERTY_WIDTH + PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TITLE, PropertyNames.PROPERTY_WIDTH }, new Object[] { - new Integer(84), new Integer(0), sProgressTitle, new Integer(180) + 84, 0, sProgressTitle, 180 }); com.sun.star.awt.FontDescriptor oFontDesc = new com.sun.star.awt.FontDescriptor(); oFontDesc.Weight = com.sun.star.awt.FontWeight.BOLD; @@ -132,11 +134,11 @@ public class Dataimport extends UnoDialog2 implements com.sun.star.awt.XActionLi insertControlModel("com.sun.star.awt.UnoControlFixedTextModel", "lblProgressDBConnection", new String[] { - "FontDescriptor", PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_WIDTH + PropertyNames.FONT_DESCRIPTOR, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_WIDTH }, new Object[] { - oFontDesc, new Integer(10), sProgressDBConnection, new Integer(6), new Integer(6), new Integer(0), new Integer(150) + oFontDesc, 10, sProgressDBConnection, 6, 6, 0, 150 }); insertControlModel("com.sun.star.awt.UnoControlFixedTextModel", "lblProgressDataImport", @@ -146,7 +148,7 @@ public class Dataimport extends UnoDialog2 implements com.sun.star.awt.XActionLi }, new Object[] { - new Integer(10), sProgressDataImport, new Integer(6), new Integer(24), new Integer(0), new Integer(120) + 10, sProgressDataImport, 6, 24, 0, 120 }); } else @@ -154,11 +156,11 @@ public class Dataimport extends UnoDialog2 implements com.sun.star.awt.XActionLi insertControlModel("com.sun.star.awt.UnoControlFixedTextModel", "lblProgressDataImport", new String[] { - "FontDescriptor", PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_WIDTH + PropertyNames.FONT_DESCRIPTOR, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_WIDTH }, new Object[] { - oFontDesc, new Integer(10), sProgressDataImport, new Integer(6), new Integer(24), new Integer(0), new Integer(120) + oFontDesc, 10, sProgressDataImport, 6, 24, 0, 120 }); } insertControlModel("com.sun.star.awt.UnoControlFixedTextModel", "lblCurProgress", @@ -168,7 +170,7 @@ public class Dataimport extends UnoDialog2 implements com.sun.star.awt.XActionLi }, new Object[] { - new Integer(10), "", new Integer(12), new Integer(42), new Integer(0), new Integer(120) + 10, PropertyNames.EMPTY_STRING, 12, 42, 0, 120 }); insertButton("cmdCancel", 10000, this, @@ -178,22 +180,21 @@ public class Dataimport extends UnoDialog2 implements com.sun.star.awt.XActionLi }, new Object[] { - new Integer(14), HelpIds.getHelpIdString(34321), new Integer(74), new Integer(58), new Integer(0), new Short((short) 1), new Integer(40), sStop + 14, HelpIds.getHelpIdString(34321), 74, 58, 0, new Short((short) 1), 40, sStop }); createWindowPeer(CurReportDocument.getWizardParent()); calculateDialogPosition(CurReportDocument.getFrame().getComponentWindow().getPosSize()); xWindow.setVisible(true); super.xReschedule.reschedule(); - return; - } - catch (Exception exception) + } + catch (Exception e) { - exception.printStackTrace(System.out); + Logger.getLogger(Dataimport.class.getName()).log(Level.SEVERE, null, e); // return; } - catch (java.lang.Exception jexception) + catch (java.lang.Exception e) { - jexception.printStackTrace(System.out); + Logger.getLogger(Dataimport.class.getName()).log(Level.SEVERE, null, e); // return; } } diff --git a/wizards/com/sun/star/wizards/report/GroupFieldHandler.java b/wizards/com/sun/star/wizards/report/GroupFieldHandler.java index bab8a4bb240e..56d3d4d041cb 100644 --- a/wizards/com/sun/star/wizards/report/GroupFieldHandler.java +++ b/wizards/com/sun/star/wizards/report/GroupFieldHandler.java @@ -1,7 +1,7 @@ /************************************************************************* * * 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 @@ -53,8 +53,8 @@ public class GroupFieldHandler extends FieldSelection 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)); + CurUnoDialog.setControlProperty("lstFields_2", "MultiSelection", Boolean.FALSE); + CurUnoDialog.setControlProperty("lstSelFields_2", "MultiSelection", Boolean.FALSE); addFieldSelectionListener(new FieldSelectionListener()); String sNote = ReportWizard.getBlindTextNote(_CurReportDocument, _CurUnoDialog.m_oResource); CurUnoDialog.insertControlModel("com.sun.star.awt.UnoControlFixedTextModel", "lblBlindTextNote_1", @@ -64,7 +64,7 @@ public class GroupFieldHandler extends FieldSelection }, 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) + Boolean.FALSE, 18, sNote, Boolean.TRUE, 95, 158, new Integer(ReportWizard.SOGROUPPAGE), 209 }); } catch (Exception exception) @@ -113,7 +113,7 @@ public class GroupFieldHandler extends FieldSelection { emptyFieldsListBoxes(); GroupFieldVector.removeAllElements(); - CurUnoDialog.setControlProperty("lblBlindTextNote_1", PropertyNames.PROPERTY_ENABLED, new Boolean(false)); + CurUnoDialog.setControlProperty("lblBlindTextNote_1", PropertyNames.PROPERTY_ENABLED, Boolean.FALSE); } public void getGroupFieldNames(CommandMetaData CurDBMetaData) @@ -162,7 +162,7 @@ public class GroupFieldHandler extends FieldSelection int iSelCount = xSelectedFieldsListBox.getItemCount(); String[] CurGroupNames = xFieldsListBox.getItems(); CurReportDocument.liveupdate_addGroupNametoDocument(CurGroupNames, CurGroupTitle, GroupFieldVector, CurReportDocument.getReportPath(), iSelCount); - CurUnoDialog.setControlProperty("lblBlindTextNote_1", PropertyNames.PROPERTY_ENABLED, new Boolean(true)); + CurUnoDialog.setControlProperty("lblBlindTextNote_1", PropertyNames.PROPERTY_ENABLED, Boolean.TRUE); if (iSelCount >= MAXSELFIELDS) { toggleMoveButtons(false, false); @@ -178,7 +178,7 @@ public class GroupFieldHandler extends FieldSelection String[] NewSelList = xSelectedFieldsListBox.getItems(); CurReportDocument.liveupdate_removeGroupName(NewSelList, OldGroupTitle, GroupFieldVector); String[] NewSelGroupNames = xSelectedFieldsListBox.getItems(); - CurUnoDialog.setControlProperty("lblBlindTextNote_1", PropertyNames.PROPERTY_ENABLED, new Boolean(NewSelGroupNames.length == 0)); + CurUnoDialog.setControlProperty("lblBlindTextNote_1", PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(NewSelGroupNames.length == 0)); // CurReportDocument.refreshGroupFields(xSelectedFieldsListBox.getItems()); } diff --git a/wizards/com/sun/star/wizards/report/IReportBuilderLayouter.java b/wizards/com/sun/star/wizards/report/IReportBuilderLayouter.java index 6422befd65f0..48be197b8a60 100755 --- a/wizards/com/sun/star/wizards/report/IReportBuilderLayouter.java +++ b/wizards/com/sun/star/wizards/report/IReportBuilderLayouter.java @@ -1,8 +1,8 @@ /* * *********************************************************************** - * + * * 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 @@ -96,13 +96,21 @@ public interface IReportBuilderLayouter /** * 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); /** + * Insert the names of the groups which should be used as sorting, 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 _aSortFieldNames + */ + public void insertSortingNames(String[][] _aSortFieldNames); + + /** * This method redraws the whole layout with all it's content */ public void layout(); diff --git a/wizards/com/sun/star/wizards/report/IReportDefinitionReadAccess.java b/wizards/com/sun/star/wizards/report/IReportDefinitionReadAccess.java index 59fd096fe363..1c71d5e34641 100755 --- a/wizards/com/sun/star/wizards/report/IReportDefinitionReadAccess.java +++ b/wizards/com/sun/star/wizards/report/IReportDefinitionReadAccess.java @@ -2,7 +2,7 @@ ************************************************************************ * * 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 diff --git a/wizards/com/sun/star/wizards/report/IReportDocument.java b/wizards/com/sun/star/wizards/report/IReportDocument.java index 702a776f9c98..b15339573ece 100644 --- a/wizards/com/sun/star/wizards/report/IReportDocument.java +++ b/wizards/com/sun/star/wizards/report/IReportDocument.java @@ -2,7 +2,7 @@ ************************************************************************ * * 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 @@ -38,7 +38,7 @@ 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 @@ -53,7 +53,7 @@ public interface IReportDocument // ------------------------------------------------------------------------- // Access Helper - // ------------------------------------------------------------------------- + // ------------------------------------------------------------------------- /** * Gives access to the DB Values * @return @@ -69,7 +69,7 @@ public interface IReportDocument 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(); @@ -78,10 +78,10 @@ public interface IReportDocument // ------------------------------------------------------------------------- // 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 _aType * @param TableName * @param FieldNames */ @@ -99,7 +99,7 @@ public interface IReportDocument // ------------------------------------------------------------------------- // Second step: Label field titles - // ------------------------------------------------------------------------- + // ------------------------------------------------------------------------- /** * Set new names for the titles * @param sFieldTitles @@ -117,7 +117,7 @@ public interface IReportDocument public void liveupdate_changeUserFieldContent(final String FieldName, final String TitleName); // ------------------------------------------------------------------------- // Third step: Grouping - // ------------------------------------------------------------------------- + // ------------------------------------------------------------------------- /* Grouping Page */ // Document should not hold the grouping information! /** @@ -148,7 +148,7 @@ public interface IReportDocument public void setGrouping(String[] aGroupList); // ------------------------------------------------------------------------- // Fourth step: Sorting - // ------------------------------------------------------------------------- + // ------------------------------------------------------------------------- /** * Set the list how to sort * @param aSort @@ -156,7 +156,7 @@ public interface IReportDocument public void setSorting(String[][] aSort); // ------------------------------------------------------------------------- // Fivth step: Templates / Layout - // ------------------------------------------------------------------------- + // ------------------------------------------------------------------------- /* Template Page */ public void setPageOrientation(int nOrientation) throws com.sun.star.lang.IllegalArgumentException; @@ -187,7 +187,7 @@ public interface IReportDocument public void layout_setupRecordSection(String TemplateName); // ------------------------------------------------------------------------- // finishing - // ------------------------------------------------------------------------- + // ------------------------------------------------------------------------- // preview (update titlenames) // addTextListener /** @@ -229,7 +229,7 @@ public interface IReportDocument public void dispose(); // ------------------------------------------------------------------------- // Garbage dump - // ------------------------------------------------------------------------- + // ------------------------------------------------------------------------- /* DataImport */ // ??? // public void addTextSectionCopies(); @@ -262,7 +262,7 @@ public interface IReportDocument /** * check internal invariants - * @throws a + * @throws a */ public void checkInvariants() throws java.lang.Exception; } diff --git a/wizards/com/sun/star/wizards/report/RecordTable.java b/wizards/com/sun/star/wizards/report/RecordTable.java index b4af7f7fa94b..a75a649b8c92 100644 --- a/wizards/com/sun/star/wizards/report/RecordTable.java +++ b/wizards/com/sun/star/wizards/report/RecordTable.java @@ -1,7 +1,7 @@ /************************************************************************* * * 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 @@ -69,21 +69,21 @@ public class RecordTable { oTable = xAllTextTables.getByName(ReportTextDocument.TBLRECORDSECTION); } - xTextTable = (XTextTable) UnoRuntime.queryInterface(XTextTable.class, oTable); - xTableName = (XNamed) UnoRuntime.queryInterface(XNamed.class, xTextTable); + xTextTable = UnoRuntime.queryInterface(XTextTable.class, oTable); + xTableName = UnoRuntime.queryInterface(XNamed.class, xTextTable); } else { - XIndexAccess xTableIndex = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xAllTextTables); + XIndexAccess xTableIndex = 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); + xTextTable = UnoRuntime.queryInterface(XTextTable.class, x); + xTableName = UnoRuntime.queryInterface(XNamed.class, xTextTable); xTableName.setName(ReportTextDocument.TBLRECORDSECTION); } xTableRows = xTextTable.getRows(); xTableColumns = xTextTable.getColumns(); - xCellRange = (XCellRange) UnoRuntime.queryInterface(XCellRange.class, xTextTable); + xCellRange = UnoRuntime.queryInterface(XCellRange.class, xTextTable); } catch (Exception exception) { diff --git a/wizards/com/sun/star/wizards/report/ReportFinalizer.java b/wizards/com/sun/star/wizards/report/ReportFinalizer.java index 73a32f35c029..3034b518f645 100644 --- a/wizards/com/sun/star/wizards/report/ReportFinalizer.java +++ b/wizards/com/sun/star/wizards/report/ReportFinalizer.java @@ -1,7 +1,7 @@ /************************************************************************* * * 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 @@ -94,7 +94,7 @@ public class ReportFinalizer }, new Object[] { - new Integer(8), sReportTitle, new Integer(95), new Integer(27), new Integer(ReportWizard.SOSTOREPAGE), new Short(curtabindex++), new Integer(68) + 8, sReportTitle, 95, 27, new Integer(ReportWizard.SOSTOREPAGE), new Short(curtabindex++), 68 }); xTitleTextBox = CurUnoDialog.insertTextField("txtTitle", CHANGEREPORTTITLE_FUNCNAME, this, @@ -104,7 +104,7 @@ public class ReportFinalizer }, new Object[] { - new Integer(12), "HID:WIZARDS_HID_DLGREPORT_4_TITLE", new Integer(95), new Integer(37), new Integer(ReportWizard.SOSTOREPAGE), new Short(curtabindex++), new Integer(209) + 12, "HID:WIZARDS_HID_DLGREPORT_4_TITLE", 95, 37, new Integer(ReportWizard.SOSTOREPAGE), new Short(curtabindex++), 209 }); CurUnoDialog.insertControlModel("com.sun.star.awt.UnoControlFixedTextModel", "lblChooseReportKind", @@ -114,7 +114,7 @@ public class ReportFinalizer }, new Object[] { - new Integer(8), slblChooseReportKind, new Integer(95), new Integer(57), new Integer(ReportWizard.SOSTOREPAGE), new Short(curtabindex++), new Integer(209) + 8, slblChooseReportKind, 95, 57, new Integer(ReportWizard.SOSTOREPAGE), new Short(curtabindex++), 209 }); CurUnoDialog.insertRadioButton("optCreateDocument", TOGGLESUBTEMPLATECONTROLS_FUNCNAME, this, @@ -124,7 +124,7 @@ public class ReportFinalizer }, new Object[] { - new Integer(10), "HID:WIZARDS_HID_DLGREPORT_5_OPTSTATDOCUMENT", sSaveAsDocument, new Integer(95), new Integer(69), new Short((short) 0), new Integer(ReportWizard.SOSTOREPAGE), new Short(curtabindex++), new Integer(138) + 10, "HID:WIZARDS_HID_DLGREPORT_5_OPTSTATDOCUMENT", sSaveAsDocument, 95, 69, new Short((short) 0), new Integer(ReportWizard.SOSTOREPAGE), new Short(curtabindex++), 138 }); CurUnoDialog.insertRadioButton("optCreateReportTemplate", TOGGLESUBTEMPLATECONTROLS_FUNCNAME, this, @@ -134,7 +134,7 @@ public class ReportFinalizer }, new Object[] { - new Integer(8), "HID:WIZARDS_HID_DLGREPORT_5_OPTDYNTEMPLATE", sSaveAsTemplate, new Integer(95), new Integer(81), new Short((short) 1), new Integer(ReportWizard.SOSTOREPAGE), new Short(curtabindex++), new Integer(209) + 8, "HID:WIZARDS_HID_DLGREPORT_5_OPTDYNTEMPLATE", sSaveAsTemplate, 95, 81, new Short((short) 1), new Integer(ReportWizard.SOSTOREPAGE), new Short(curtabindex++), 209 }); @@ -145,7 +145,7 @@ public class ReportFinalizer }, new Object[] { - new Integer(8), slblHowProceed, new Integer(105), new Integer(93), new Integer(ReportWizard.SOSTOREPAGE), new Short(curtabindex++), new Integer(209) + 8, slblHowProceed, 105, 93, new Integer(ReportWizard.SOSTOREPAGE), new Short(curtabindex++), 209 }); @@ -156,7 +156,7 @@ public class ReportFinalizer }, new Object[] { - new Integer(10), "HID:WIZARDS_HID_DLGREPORT_5_OPTEDITTEMPLATE", sEditTemplate, new Integer(111), new Integer(105), new Integer(6), new Short(curtabindex++), new Integer(138) + 10, "HID:WIZARDS_HID_DLGREPORT_5_OPTEDITTEMPLATE", sEditTemplate, 111, 105, 6, new Short(curtabindex++), 138 }); CurUnoDialog.insertRadioButton("optUseTemplate", TOGGLESUBTEMPLATECONTROLS_FUNCNAME, this, @@ -166,7 +166,7 @@ public class ReportFinalizer }, new Object[] { - new Integer(10), "HID:WIZARDS_HID_DLGREPORT_5_OPTUSETEMPLATE", sUseTemplate, new Integer(111), new Integer(115), new Short((short) 1), new Integer(ReportWizard.SOSTOREPAGE), new Short(curtabindex++), new Integer(138) + 10, "HID:WIZARDS_HID_DLGREPORT_5_OPTUSETEMPLATE", sUseTemplate, 111, 115, new Short((short) 1), new Integer(ReportWizard.SOSTOREPAGE), new Short(curtabindex++), 138 }); } @@ -176,15 +176,15 @@ public class ReportFinalizer */ public void toggleSubTemplateControls() { - // String sStorePath = ""; + // String sStorePath = PropertyNames.EMPTY_STRING; Short iState = (Short) CurUnoDialog.getControlProperty("optCreateReportTemplate", PropertyNames.PROPERTY_STATE); boolean bDoTemplateEnable = iState.shortValue() == 1; - CurUnoDialog.setControlProperty("optEditTemplate", PropertyNames.PROPERTY_ENABLED, new Boolean(bDoTemplateEnable)); - CurUnoDialog.setControlProperty("optUseTemplate", PropertyNames.PROPERTY_ENABLED, new Boolean(bDoTemplateEnable)); - CurUnoDialog.setControlProperty("lblHowProceed", PropertyNames.PROPERTY_ENABLED, new Boolean(bDoTemplateEnable)); + CurUnoDialog.setControlProperty("optEditTemplate", PropertyNames.PROPERTY_ENABLED, bDoTemplateEnable); + CurUnoDialog.setControlProperty("optUseTemplate", PropertyNames.PROPERTY_ENABLED, bDoTemplateEnable); + CurUnoDialog.setControlProperty("lblHowProceed", PropertyNames.PROPERTY_ENABLED, bDoTemplateEnable); String sTitle = xTitleTextBox.getText(); - boolean bDoEnable = sTitle.equals(""); + boolean bDoEnable = sTitle.equals(PropertyNames.EMPTY_STRING); CurUnoDialog.enableFinishButton(!bDoEnable); } // private boolean fileexists(XMultiServiceFactory _xMSF, String _spath){ @@ -200,7 +200,7 @@ public class ReportFinalizer { String FirstCommandName = (_CurDBMetaData.getIncludedCommandNames())[0]; DefaultName = Desktop.getUniqueName(_CurDBMetaData.getReportDocuments(), FirstCommandName); - if (DefaultName.equals(OldDefaultName) == false) + if (!DefaultName.equals(OldDefaultName)) { OldDefaultName = DefaultName; } @@ -212,7 +212,7 @@ public class ReportFinalizer if (CurUnoDialog != null) { String LocStoreName = xTitleTextBox.getText(); - if (!LocStoreName.equals("")) + if (!LocStoreName.equals(PropertyNames.EMPTY_STRING)) { StoreName = LocStoreName; } @@ -227,14 +227,14 @@ public class ReportFinalizer StoreName = getStoreName(); String StorePath; XInterface xInterface = (XInterface) m_xMSF.createInstance("com.sun.star.ucb.SimpleFileAccess"); - XSimpleFileAccess xSimpleFileAccess = (XSimpleFileAccess) UnoRuntime.queryInterface(XSimpleFileAccess.class, xInterface); + 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 ""; + return PropertyNames.EMPTY_STRING; } } @@ -242,7 +242,7 @@ public class ReportFinalizer { final String TitleName = xTitleTextBox.getText(); CurReportDocument.liveupdate_updateReportTitle(TitleName); - CurUnoDialog.enableFinishButton(!"".equals(TitleName)); + CurUnoDialog.enableFinishButton(!PropertyNames.EMPTY_STRING.equals(TitleName)); } public int getReportOpenMode() diff --git a/wizards/com/sun/star/wizards/report/ReportImplementationHelper.java b/wizards/com/sun/star/wizards/report/ReportImplementationHelper.java index a8d26d68cd41..a215bd98369d 100644 --- a/wizards/com/sun/star/wizards/report/ReportImplementationHelper.java +++ b/wizards/com/sun/star/wizards/report/ReportImplementationHelper.java @@ -2,7 +2,7 @@ ************************************************************************ * * 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 @@ -42,9 +42,9 @@ public class ReportImplementationHelper protected int m_nDefaultPageOrientation; /** - * + * * @param _aMSF - * @param _nOrientation + * @param _nOrientation */ public ReportImplementationHelper(XMultiServiceFactory _aMSF, int _nOrientation) { diff --git a/wizards/com/sun/star/wizards/report/ReportLayouter.java b/wizards/com/sun/star/wizards/report/ReportLayouter.java index 16180f4df91c..c44f4af9b1eb 100644 --- a/wizards/com/sun/star/wizards/report/ReportLayouter.java +++ b/wizards/com/sun/star/wizards/report/ReportLayouter.java @@ -1,7 +1,7 @@ /************************************************************************* * * 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 @@ -96,7 +96,7 @@ public class ReportLayouter }, new Object[] { - new Integer(8), slblDataStructure, new Integer(95), new Integer(27), new Integer(ReportWizard.SOTEMPLATEPAGE), new Short(curtabindex++), new Integer(99) + 8, slblDataStructure, 95, 27, new Integer(ReportWizard.SOTEMPLATEPAGE), new Short(curtabindex++), 99 }); short iSelPos = 0; @@ -111,14 +111,14 @@ public class ReportLayouter xContentListBox = CurUnoDialog.insertListBox("lstContent", SOCONTENTLST, new ActionListenerImpl(), new ItemListenerImpl(), new String[] { - PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, "SelectedItems", PropertyNames.PROPERTY_STEP, "StringItemList", PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH + PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.SELECTED_ITEMS, PropertyNames.PROPERTY_STEP, PropertyNames.STRING_ITEM_LIST, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH }, new Object[] { - new Integer(108), "HID:WIZARDS_HID_DLGREPORT_4_DATALAYOUT", new Integer(95), new Integer(37), new short[] + 108, "HID:WIZARDS_HID_DLGREPORT_4_DATALAYOUT", 95, 37, new short[] { iSelPos - }, new Integer(ReportWizard.SOTEMPLATEPAGE), ContentFiles[0], new Short(curtabindex++), new Integer(99) + }, new Integer(ReportWizard.SOTEMPLATEPAGE), ContentFiles[0], new Short(curtabindex++), 99 }); CurUnoDialog.insertControlModel("com.sun.star.awt.UnoControlFixedTextModel", "lblLayout", @@ -128,7 +128,7 @@ public class ReportLayouter }, new Object[] { - new Integer(8), slblPageLayout, new Integer(205), new Integer(27), new Integer(ReportWizard.SOTEMPLATEPAGE), new Short(curtabindex++), new Integer(99) + 8, slblPageLayout, 205, 27, new Integer(ReportWizard.SOTEMPLATEPAGE), new Short(curtabindex++), 99 }); short iSelLayoutPos = 0; @@ -146,14 +146,14 @@ public class ReportLayouter xLayoutListBox = CurUnoDialog.insertListBox("lstLayout", SOLAYOUTLST, new ActionListenerImpl(), new ItemListenerImpl(), new String[] { - PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, "SelectedItems", PropertyNames.PROPERTY_STEP, "StringItemList", PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH + PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.SELECTED_ITEMS, PropertyNames.PROPERTY_STEP, PropertyNames.STRING_ITEM_LIST, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH }, new Object[] { - new Integer(108), "HID:WIZARDS_HID_DLGREPORT_4_PAGELAYOUT", new Integer(205), new Integer(37), new short[] + 108, "HID:WIZARDS_HID_DLGREPORT_4_PAGELAYOUT", 205, 37, new short[] { iSelLayoutPos - }, new Integer(ReportWizard.SOTEMPLATEPAGE), LayoutFiles[0], new Short(curtabindex++), new Integer(99) + }, new Integer(ReportWizard.SOTEMPLATEPAGE), LayoutFiles[0], new Short(curtabindex++), 99 }); iOldLayoutPos = (int) iSelPos; CurUnoDialog.insertControlModel("com.sun.star.awt.UnoControlFixedTextModel", "lblOrientation", @@ -163,7 +163,7 @@ public class ReportLayouter }, new Object[] { - new Integer(8), sOrientationHeader, new Integer(95), new Integer(148), new Integer(ReportWizard.SOTEMPLATEPAGE), new Short(curtabindex++), new Integer(74) + 8, sOrientationHeader, 95, 148, new Integer(ReportWizard.SOTEMPLATEPAGE), new Short(curtabindex++), 74 }); short m_nLandscapeState = CurReportDocument.getDefaultPageOrientation() == SOOPTLANDSCAPE ? (short) 1 : 0; @@ -174,7 +174,7 @@ public class ReportLayouter }, new Object[] { - new Integer(10), "HID:WIZARDS_HID_DLGREPORT_4_LANDSCAPE", sOrientHorizontal, new Integer(101), new Integer(158), new Short(m_nLandscapeState), new Integer(ReportWizard.SOTEMPLATEPAGE), new Short(curtabindex++), new Integer(60) + 10, "HID:WIZARDS_HID_DLGREPORT_4_LANDSCAPE", sOrientHorizontal, 101, 158, new Short(m_nLandscapeState), new Integer(ReportWizard.SOTEMPLATEPAGE), new Short(curtabindex++), 60 }); short m_nPortraitState = CurReportDocument.getDefaultPageOrientation() == SOOPTPORTRAIT ? (short) 1 : (short) 0; @@ -185,17 +185,17 @@ public class ReportLayouter }, new Object[] { - new Integer(10), "HID:WIZARDS_HID_DLGREPORT_4_PORTRAIT", sOrientVertical, new Integer(101), new Integer(171), new Short(m_nPortraitState), new Integer(ReportWizard.SOTEMPLATEPAGE), new Short(curtabindex++), new Integer(60) + 10, "HID:WIZARDS_HID_DLGREPORT_4_PORTRAIT", sOrientVertical, 101, 171, new Short(m_nPortraitState), new Integer(ReportWizard.SOTEMPLATEPAGE), new Short(curtabindex++), 60 }); aOrientationImage = CurUnoDialog.insertControlModel("com.sun.star.awt.UnoControlImageControlModel", "imgOrientation", new String[] { - "Border", PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, "ScaleImage", PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_WIDTH + PropertyNames.PROPERTY_BORDER, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, "ScaleImage", PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_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) + new Short("0"), 23, 164, 158, Boolean.FALSE, new Integer(ReportWizard.SOTEMPLATEPAGE), 30 }); String sNote = ReportWizard.getBlindTextNote(CurReportDocument, CurUnoDialog.m_oResource); @@ -206,7 +206,7 @@ public class ReportLayouter }, new Object[] { - new Integer(34), sNote, new Boolean(true), new Integer(205), new Integer(148), new Integer(ReportWizard.SOTEMPLATEPAGE), new Integer(99) + 34, sNote, Boolean.TRUE, 205, 148, new Integer(ReportWizard.SOTEMPLATEPAGE), 99 }); if (m_nLandscapeState == 1) { @@ -227,7 +227,7 @@ public class ReportLayouter { // CurReportDocument.getDoc().xTextDocument.lockControllers(); CurReportDocument.layout_setupRecordSection(_defaultTemplatePath); - if (CurUnoDialog.getControlProperty("txtTitle", "Text").equals("")) + if (CurUnoDialog.getControlProperty("txtTitle", "Text").equals(PropertyNames.EMPTY_STRING)) { String[] sCommandNames = CurReportDocument.getRecordParser().getIncludedCommandNames(); CurUnoDialog.setControlProperty("txtTitle", "Text", sCommandNames[0]); @@ -246,7 +246,7 @@ public class ReportLayouter try { int iPos; - Helper.setUnoPropertyValue(CurUnoDialog.xDialogModel, PropertyNames.PROPERTY_ENABLED, new Boolean(false)); + Helper.setUnoPropertyValue(CurUnoDialog.xDialogModel, PropertyNames.PROPERTY_ENABLED, Boolean.FALSE); // LLA: should we lock controllers here? // CurReportDocument.getDoc().xTextDocument.lockControllers(); int iKey = CurUnoDialog.getControlKey(EventObject.Source, CurUnoDialog.ControlList); @@ -306,7 +306,7 @@ public class ReportLayouter e.printStackTrace(); } // CurReportDocument.getDoc().unlockallControllers(); - Helper.setUnoPropertyValue(CurUnoDialog.xDialogModel, PropertyNames.PROPERTY_ENABLED, new Boolean(true)); + Helper.setUnoPropertyValue(CurUnoDialog.xDialogModel, PropertyNames.PROPERTY_ENABLED, Boolean.TRUE); } public void disposing(EventObject eventObject) @@ -325,17 +325,17 @@ public class ReportLayouter { try { - Helper.setUnoPropertyValue(CurUnoDialog.xDialogModel, PropertyNames.PROPERTY_ENABLED, new Boolean(false)); + Helper.setUnoPropertyValue(CurUnoDialog.xDialogModel, PropertyNames.PROPERTY_ENABLED, Boolean.FALSE); // CurReportDocument.getDoc().xTextDocument.lockControllers(); boolean blandscape = (((Short) CurUnoDialog.getControlProperty("optLandscape", PropertyNames.PROPERTY_STATE)).shortValue() == 1); - CurReportDocument.setPageOrientation((blandscape == true) ? SOOPTLANDSCAPE : SOOPTPORTRAIT); + CurReportDocument.setPageOrientation((blandscape) ? SOOPTLANDSCAPE : SOOPTPORTRAIT); } catch (Exception exception) { exception.printStackTrace(System.out); } // CurReportDocument.getDoc().unlockallControllers(); - Helper.setUnoPropertyValue(CurUnoDialog.xDialogModel, PropertyNames.PROPERTY_ENABLED, new Boolean(true)); + Helper.setUnoPropertyValue(CurUnoDialog.xDialogModel, PropertyNames.PROPERTY_ENABLED, Boolean.TRUE); } } } diff --git a/wizards/com/sun/star/wizards/report/ReportTextDocument.java b/wizards/com/sun/star/wizards/report/ReportTextDocument.java index 3ab9e704b9b9..5cddecac701f 100644 --- a/wizards/com/sun/star/wizards/report/ReportTextDocument.java +++ b/wizards/com/sun/star/wizards/report/ReportTextDocument.java @@ -1,7 +1,7 @@ /************************************************************************* * * 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 @@ -53,9 +53,16 @@ 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; +import java.util.logging.Level; +import java.util.logging.Logger; class ReportTextDocument extends com.sun.star.wizards.text.TextDocument implements Comparator { + + private static final String ISLANDSCAPE = "IsLandscape"; + private static final String ISVISIBLE = "IsVisible"; + private static final String QUERYNAME = "QueryName"; + private static final String SIZE = "Size"; // private XMultiServiceFactory xMSF; // private XMultiServiceFactory xMSFDoc; private Object ReportPageStyle; @@ -102,7 +109,7 @@ class ReportTextDocument extends com.sun.star.wizards.text.TextDocument implemen lateInit(oResource, _aRP); } - void lateInit(Resource oResource, RecordParser _aRecordParser) + private void lateInit(Resource oResource, RecordParser _aRecordParser) { oTextTableHandler = new TextTableHandler(xMSFDoc, xTextDocument); oTextSectionHandler = new TextSectionHandler(xMSFDoc, xTextDocument); @@ -146,12 +153,11 @@ class ReportTextDocument extends com.sun.star.wizards.text.TextDocument implemen { oTextSection = xTextSections.getByName(RECORDSECTION); } - boolean bLayoutMode = AnyConverter.toBoolean(Helper.getUnoPropertyValue(oTextSection, "IsVisible")); - return bLayoutMode; + return AnyConverter.toBoolean(Helper.getUnoPropertyValue(oTextSection, ISVISIBLE)); } - catch (Exception exception) + catch (Exception e) { - exception.printStackTrace(System.out); + Logger.getLogger(ReportTextDocument.class.getName()).log(Level.SEVERE, null, e); // In doubt we rather suggest this is LayoutMode... return true; } @@ -172,7 +178,7 @@ class ReportTextDocument extends com.sun.star.wizards.text.TextDocument implemen } // xProgressBar.setValue(100); oViewHandler.selectFirstPage(oTextTableHandler); - // xProgressBar.end(); + // xProgressBar.end(); } public void swapLayoutTemplate(String LayoutTemplatePath/*, String BitmapPath*/) @@ -181,39 +187,59 @@ class ReportTextDocument extends com.sun.star.wizards.text.TextDocument implemen { // xProgressBar.start("", 10); this.LayoutTemplatePath = LayoutTemplatePath; - boolean bOldIsCurLandscape = AnyConverter.toBoolean(Helper.getUnoPropertyValue(ReportPageStyle, "IsLandscape")); + 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(); + // xProgressBar.end(); } - catch (Exception exception) + catch (Exception e) { - exception.printStackTrace(System.out); + Logger.getLogger(ReportTextDocument.class.getName()).log(Level.SEVERE, null, e); } } 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()))); + XNameAccess xNameAccess = UnoRuntime.queryInterface(XNameAccess.class, xNamedForm); + oFormHandler.insertHiddenControl(xNameAccess, xNamedForm, PropertyNames.COMMAND_TYPE, 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); + oFormHandler.insertHiddenControl(xNameAccess, xNamedForm, QUERYNAME, CurDBMetaData.getCommandName()); + oFormHandler.insertHiddenControl(xNameAccess, xNamedForm, PropertyNames.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, QUERYNAME, ""); + oFormHandler.insertHiddenControl(xNameAccess, xNamedForm, PropertyNames.COMMAND, CurDBMetaData.Command); } oFormHandler.insertHiddenControl(xNameAccess, xNamedForm, "GroupFieldNames", JavaTools.ArraytoString(CurDBMetaData.GroupFieldNames)); oFormHandler.insertHiddenControl(xNameAccess, xNamedForm, "FieldNames", JavaTools.ArraytoString(CurDBMetaData.getFieldNames())); + String[][] sortFieldNames = CurDBMetaData.getSortFieldNames(); + if (sortFieldNames != null && sortFieldNames.length > 0) + { + final String space = ","; + final String colon = ";"; + StringBuilder orderBy = new StringBuilder(); + for (String[] sortPair : sortFieldNames) + { + orderBy.append(sortPair[0]).append(space).append(sortPair[1]).append(colon); + } + if (orderBy.length() != 0) + { + orderBy.delete(orderBy.lastIndexOf(colon), orderBy.length()); + } + oFormHandler.insertHiddenControl(xNameAccess, xNamedForm, "Sorting", orderBy.toString()); + } + else + { + oFormHandler.insertHiddenControl(xNameAccess, xNamedForm, "Sorting", ""); + } oFormHandler.insertHiddenControl(xNameAccess, xNamedForm, "RecordFieldNames", JavaTools.ArraytoString(CurDBMetaData.getRecordFieldNames())); } @@ -230,9 +256,9 @@ class ReportTextDocument extends com.sun.star.wizards.text.TextDocument implemen ReportPageStyle = Helper.getUnoObjectbyName(oPageStyleFamily, "Standard"); FirstPageStyle = Helper.getUnoObjectbyName(oPageStyleFamily, "First Page"); } - catch (Exception exception) + catch (Exception e) { - exception.printStackTrace(System.out); + Logger.getLogger(ReportTextDocument.class.getName()).log(Level.SEVERE, null, e); } } @@ -242,15 +268,15 @@ class ReportTextDocument extends com.sun.star.wizards.text.TextDocument implemen { 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")); + 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); + Helper.setUnoPropertyValue(ReportPageStyle, ISLANDSCAPE, bNewLandscape); + Helper.setUnoPropertyValue(ReportPageStyle, SIZE, oNewSize); + Helper.setUnoPropertyValue(FirstPageStyle, ISLANDSCAPE, 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; @@ -260,9 +286,9 @@ class ReportTextDocument extends com.sun.star.wizards.text.TextDocument implemen } } } - catch (Exception exception) + catch (Exception e) { - exception.printStackTrace(System.out); + Logger.getLogger(ReportTextDocument.class.getName()).log(Level.SEVERE, null, e); } } @@ -290,22 +316,15 @@ class ReportTextDocument extends com.sun.star.wizards.text.TextDocument implemen 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); - } + CurDBColumn.formatValueCell(); + DBColumnsVector.set(i, CurDBColumn); + replaceFieldValueInGroupTable(CurDBColumn, i); } return true; } - catch (Exception exception) + catch (Exception e) { - exception.printStackTrace(System.out); + Logger.getLogger(ReportTextDocument.class.getName()).log(Level.SEVERE, null, e); return false; } } @@ -352,6 +371,7 @@ class ReportTextDocument extends com.sun.star.wizards.text.TextDocument implemen // { // return (JavaTools.FieldInList(CurDBMetaData.GroupFieldNames, _FieldName) != -1); // } + public void replaceFieldValueInRecordSection(int RecordCount) { int GroupCount = CurDBMetaData.GroupFieldNames.length; @@ -367,7 +387,7 @@ class ReportTextDocument extends com.sun.star.wizards.text.TextDocument implemen String TableName; DBColumn OldDBColumn; DBColumn CurDBColumn; - XNameAccess xTableNames = oTextTableHandler.xTextTablesSupplier.getTextTables(); + // XNameAccess xTableNames = oTextTableHandler.xTextTablesSupplier.getTextTables(); int GroupFieldCount = SelGroupNames.length; for (int i = 0; i < GroupFieldCount; i++) { @@ -471,16 +491,8 @@ class ReportTextDocument extends com.sun.star.wizards.text.TextDocument implemen 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); - } + DBColumnsVector.addElement(CurDBColumn); + replaceFieldValueInGroupTable(CurDBColumn, GroupCount - 1); } catch (Exception exception) { @@ -555,43 +567,35 @@ class ReportTextDocument extends com.sun.star.wizards.text.TextDocument implemen } CurDBColumn = new DBColumn(CurRecordTable, oTextTableHandler, CurDBMetaData, i - CurDBMetaData.GroupFieldNames.length); } - if (CurDBColumn != null) + if (CurDBColumn.xNameCell != null) { - if (CurDBColumn.xNameCell != null) + DBColumnsVector.addElement(CurDBColumn); + } + else + { + String DelFieldName; + if (i < CurDBMetaData.GroupFieldNames.length) { - DBColumnsVector.addElement(CurDBColumn); + DelFieldName = CurDBMetaData.GroupFieldNames[i]; + CurDBMetaData.GroupFieldNames = JavaTools.removefromList(CurDBMetaData.GroupFieldNames, new String[] + { + DelFieldName + }); + CurDBMetaData.GroupFieldColumns = removeFieldColumnByFieldName(DelFieldName, CurDBMetaData.GroupFieldColumns); } 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); + 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); + i--; } } java.util.Arrays.sort(CurDBMetaData.RecordFieldColumns, this); @@ -639,7 +643,7 @@ class ReportTextDocument extends com.sun.star.wizards.text.TextDocument implemen { try { - Vector aFieldColumns = new Vector(); + ArrayList<FieldColumn> aFieldColumns = new ArrayList<FieldColumn>(); for (int i = 0; i < _FieldColumns.length; i++) { FieldColumn CurFieldColumn = _FieldColumns[i]; @@ -654,7 +658,7 @@ class ReportTextDocument extends com.sun.star.wizards.text.TextDocument implemen } catch (RuntimeException e) { - e.printStackTrace(System.out); + Logger.getLogger(ReportTextDocument.class.getName()).log(Level.SEVERE, null, e); return null; } } @@ -668,7 +672,7 @@ class ReportTextDocument extends com.sun.star.wizards.text.TextDocument implemen { sInvisibleSectionNames[i] = GROUPSECTION + i; } - XNameAccess xNameAccessTextSections = (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, oTextSectionHandler.xTextSectionsSupplier.getTextSections()); + XNameAccess xNameAccessTextSections = UnoRuntime.queryInterface(XNameAccess.class, oTextSectionHandler.xTextSectionsSupplier.getTextSections()); String[] sSectionNames = xNameAccessTextSections.getElementNames(); for (int i = 0; i < sSectionNames.length; i++) { @@ -695,7 +699,7 @@ class ReportTextDocument extends com.sun.star.wizards.text.TextDocument implemen public void removeNonLayoutTextTables() { String[] sLayoutTableNames = getLayoutTextTableNames(); - XNameAccess xNameAccessTextTables = (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, oTextTableHandler.xTextTablesSupplier.getTextTables()); + XNameAccess xNameAccessTextTables = UnoRuntime.queryInterface(XNameAccess.class, oTextTableHandler.xTextTablesSupplier.getTextTables()); String[] sTableNames = xNameAccessTextTables.getElementNames(); for (int i = 0; i < sTableNames.length; i++) { @@ -710,8 +714,8 @@ class ReportTextDocument extends com.sun.star.wizards.text.TextDocument implemen public void removeLayoutTextTables() { String[] sLayoutTableNames = getLayoutTextTableNames(); - XNameAccess xNameAccessTextTables = (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, oTextTableHandler.xTextTablesSupplier.getTextTables()); - XRelativeTextContentRemove xRelativeTextContentRemove = (XRelativeTextContentRemove) UnoRuntime.queryInterface(XRelativeTextContentRemove.class, xText); + XNameAccess xNameAccessTextTables = UnoRuntime.queryInterface(XNameAccess.class, oTextTableHandler.xTextTablesSupplier.getTextTables()); + XRelativeTextContentRemove xRelativeTextContentRemove = UnoRuntime.queryInterface(XRelativeTextContentRemove.class, xText); String[] sTableNames = xNameAccessTextTables.getElementNames(); for (int i = 0; i < sTableNames.length; i++) { @@ -720,7 +724,7 @@ class ReportTextDocument extends com.sun.star.wizards.text.TextDocument implemen { if (!sTableName.equals(sLayoutTableNames[0])) { - XTextContent xTextContent = (XTextContent) UnoRuntime.queryInterface(XTextContent.class, oTextTableHandler.getByName(sTableName)); + XTextContent xTextContent = UnoRuntime.queryInterface(XTextContent.class, oTextTableHandler.getByName(sTableName)); boolean bleaveloop = false; while (!bleaveloop) { @@ -728,7 +732,7 @@ class ReportTextDocument extends com.sun.star.wizards.text.TextDocument implemen { // xRelativeTextContentRemove.removeTextContentBefore(xTextContent); xRelativeTextContentRemove.removeTextContentAfter(xTextContent); - // IllegalArgumentException may be thrown when no paragraphbreak is there + // IllegalArgumentException may be thrown when no paragraphbreak is there } catch (IllegalArgumentException iexception) { @@ -751,17 +755,17 @@ class ReportTextDocument extends com.sun.star.wizards.text.TextDocument implemen for (int i = 0; i < GroupFieldCount; i++) { oTextSection = xTextSections.getByName(GROUPSECTION + String.valueOf(i + 1)); - Helper.setUnoPropertyValue(oTextSection, "IsVisible", new Boolean(_IsVisible)); + Helper.setUnoPropertyValue(oTextSection, ISVISIBLE, _IsVisible); } if (xTextSections.hasByName(RECORDSECTION)) { oTextSection = xTextSections.getByName(RECORDSECTION); - Helper.setUnoPropertyValue(oTextSection, "IsVisible", new Boolean(_IsVisible)); + Helper.setUnoPropertyValue(oTextSection, ISVISIBLE, _IsVisible); } } - catch (Exception exception) + catch (Exception e) { - exception.printStackTrace(System.out); + Logger.getLogger(ReportTextDocument.class.getName()).log(Level.SEVERE, null, e); } } diff --git a/wizards/com/sun/star/wizards/report/ReportTextImplementation.java b/wizards/com/sun/star/wizards/report/ReportTextImplementation.java index ceecaf28ba4f..9e73038e14f6 100644 --- a/wizards/com/sun/star/wizards/report/ReportTextImplementation.java +++ b/wizards/com/sun/star/wizards/report/ReportTextImplementation.java @@ -2,7 +2,7 @@ ************************************************************************ * * 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 @@ -30,16 +30,12 @@ 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; @@ -57,9 +53,9 @@ 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.PropertyNames; 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; @@ -193,8 +189,8 @@ public class ReportTextImplementation extends ReportImplementationHelper impleme Helper.setUnoPropertyValue(xTextSection, "LinkRegion", sLinkRegion); if (CurDBColumn != null) { - boolean bIsGroupTable = (sLinkRegion.equals(ReportTextDocument.RECORDSECTION) != true); - if (bIsGroupTable == true) + boolean bIsGroupTable = (!sLinkRegion.equals(ReportTextDocument.RECORDSECTION)); + if (bIsGroupTable) { XTextTable xTextTable = getDoc().oTextTableHandler.getlastTextTable(); XCellRange xCellRange = UnoRuntime.queryInterface( XCellRange.class, xTextTable ); @@ -202,9 +198,9 @@ public class ReportTextImplementation extends ReportImplementationHelper impleme } } } - catch (Exception exception) + catch (Exception ex) { - exception.printStackTrace(System.out); + Logger.getLogger( ReportTextImplementation.class.getName() ).log( Level.SEVERE, null, ex ); } return xNamedTextSection; } @@ -228,40 +224,54 @@ public class ReportTextImplementation extends ReportImplementationHelper impleme XNameContainer xNamedForms = getDoc().oFormHandler.getDocumentForms(); Object oDBForm = Helper.getUnoObjectbyName(xNamedForms, ReportWizard.SOREPORTFORMNAME); boolean bgetConnection; - String sQueryName = ""; + String sQueryName = PropertyNames.EMPTY_STRING; 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); + getRecordParser().Command = getDoc().oFormHandler.getValueofHiddenControl(xNamedForm, PropertyNames.COMMAND, sMsg); + String sCommandType = getDoc().oFormHandler.getValueofHiddenControl(xNamedForm, PropertyNames.COMMAND_TYPE, sMsg); String sGroupFieldNames = getDoc().oFormHandler.getValueofHiddenControl(xNamedForm, "GroupFieldNames", sMsg); String sFieldNames = getDoc().oFormHandler.getValueofHiddenControl(xNamedForm, "FieldNames", sMsg); + final String sorting = getDoc().oFormHandler.getValueofHiddenControl(xNamedForm, "Sorting", 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, ";"); + String[] sFieldNameList = JavaTools.ArrayoutofString(sFieldNames, PropertyNames.SEMI_COLON); + String[] sNewList = JavaTools.ArrayoutofString(sRecordFieldNames, PropertyNames.SEMI_COLON); + if ( !PropertyNames.EMPTY_STRING.equals(sorting)) + { + String[] sortList = JavaTools.ArrayoutofString(sorting, PropertyNames.SEMI_COLON); + ArrayList<String[]> aSortFields = new ArrayList<String[]>(); + for (String sortEntry : sortList) + { + aSortFields.add(JavaTools.ArrayoutofString(sortEntry, ",")); + } + String[][] sortFieldNames = new String[aSortFields.size()][2]; + aSortFields.toArray(sortFieldNames); + getRecordParser().setSortFieldNames(sortFieldNames); + } getRecordParser().setRecordFieldNames(sNewList); - getRecordParser().GroupFieldNames = JavaTools.ArrayoutofString(sGroupFieldNames, ";"); + getRecordParser().GroupFieldNames = JavaTools.ArrayoutofString(sGroupFieldNames, PropertyNames.SEMI_COLON); 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(""))) + if ((getRecordParser().getCommandType() == CommandType.QUERY) && (getRecordParser().Command.equals(PropertyNames.EMPTY_STRING))) { DBMetaData.CommandObject oCommand = getRecordParser().getQueryByName(sQueryName); if (getRecordParser().hasEscapeProcessing(oCommand.getPropertySet())) { - getRecordParser().Command = (String) oCommand.getPropertySet().getPropertyValue("Command"); + getRecordParser().Command = (String) oCommand.getPropertySet().getPropertyValue(PropertyNames.COMMAND); getRecordParser().getSQLQueryComposer().m_xQueryAnalyzer.setQuery(getRecordParser().Command); getRecordParser().getSQLQueryComposer().prependSortingCriteria(); + getRecordParser().Command = getRecordParser().getSQLQueryComposer().getQuery(); } else { @@ -293,13 +303,14 @@ public class ReportTextImplementation extends ReportImplementationHelper impleme { return false; } - catch (java.lang.Exception javaexception) + catch (java.lang.Exception ex) { - javaexception.printStackTrace(System.out); + Logger.getLogger( ReportTextImplementation.class.getName() ).log( Level.SEVERE, null, ex ); return false; } - catch (com.sun.star.wizards.document.FormHandler.UnknownHiddenControlException exception) + catch (com.sun.star.wizards.document.FormHandler.UnknownHiddenControlException ex) { + Logger.getLogger( ReportTextImplementation.class.getName() ).log( Level.SEVERE, null, ex ); return false; } } @@ -322,8 +333,6 @@ public class ReportTextImplementation extends ReportImplementationHelper impleme Object CurGroupValue; String CurGroupTableName; // RecordParser CurDBMetaData = getRecordParser(); - com.sun.star.style.BreakType CorrBreakValue = null; - String CorrPageDescName = ""; getDoc().oTextFieldHandler.fixDateFields(true); getDoc().removeAllVisibleTextSections(); getDoc().removeNonLayoutTextTables(); @@ -338,7 +347,7 @@ public class ReportTextImplementation extends ReportImplementationHelper impleme XTextCursor xTextCursor = ReportTextDocument.createTextCursor(getDoc().xTextDocument.getText()); xTextDocument.lockControllers(); - if (getRecordParser().ResultSet.next() == true) + if (getRecordParser().ResultSet.next()) { replaceUserFields(); Helper.setUnoPropertyValue(xTextCursor, "PageDescName", "First Page"); @@ -352,18 +361,18 @@ public class ReportTextImplementation extends ReportImplementationHelper impleme CurDBColumn = (DBColumn) getDoc().DBColumnsVector.elementAt(ColIndex); addLinkedTextSection(xTextCursor, ReportTextDocument.GROUPSECTION + Integer.toString(ColIndex + 1), CurDBColumn, CurGroupValue); //COPYOF!!!! } - if (getRecordParser().getcurrentRecordData(DataVector) == true) + if (getRecordParser().getcurrentRecordData(DataVector)) { // int RowIndex = 1; m_bStopProcess = false; - while ((getRecordParser().ResultSet.next() == true) && (m_bStopProcess == false)) + while ((getRecordParser().ResultSet.next()) && (!m_bStopProcess)) { // RowIndex += 1; breset = false; for (ColIndex = 0; ColIndex < GroupFieldCount; ColIndex++) { CurGroupValue = getRecordParser().getGroupColumnValue(ColIndex); - if ((CurGroupValue.equals(OldGroupFieldValues[ColIndex]) == false) || (breset)) + if ((!CurGroupValue.equals(OldGroupFieldValues[ColIndex])) || (breset)) { breset = true; insertDataToRecordTable(xTextCursor, DataVector, RecordFieldCount); @@ -389,7 +398,7 @@ public class ReportTextImplementation extends ReportImplementationHelper impleme for (ColIndex = 0; ColIndex < GroupFieldCount; ColIndex++) { CurDBColumn = (DBColumn) getDoc().DBColumnsVector.elementAt(ColIndex); - Object oValue = ""; + Object oValue = PropertyNames.EMPTY_STRING; addLinkedTextSection(xTextCursor, ReportTextDocument.COPYOFGROUPSECTION + Integer.toString(ColIndex + 1), CurDBColumn, oValue); } addLinkedTextSection(xTextCursor, ReportTextDocument.COPYOFRECORDSECTION, null, null); @@ -403,10 +412,11 @@ public class ReportTextImplementation extends ReportImplementationHelper impleme } getDoc().oTextSectionHandler.breakLinkofTextSections(); } - catch (Exception exception) + catch (Exception ex) { + Logger.getLogger( ReportTextImplementation.class.getName() ).log( Level.SEVERE, null, ex ); } -// catch (java.lang.Exception javaexception) +// catch (java.lang.Exception javaexception) // { // javaexception.printStackTrace(System.out); // } @@ -434,18 +444,18 @@ public class ReportTextImplementation extends ReportImplementationHelper impleme } DataVector.removeAllElements(); } -// public void updateProgressDisplay(int iCounter) +// public void updateProgressDisplay(int iCounter) // { -// try +// try // { -// if (iCounter % 10 == 0) +// if (iCounter % 10 == 0) // { // sProgressCurRecord = JavaTools.replaceSubString(sProgressBaseCurRecord, String.valueOf(iCounter), "<COUNT>"); // setControlProperty("lblCurProgress", PropertyNames.PROPERTY_LABEL, sProgressCurRecord); // super.xReschedule.reschedule(); // } -// } -// catch (java.lang.Exception jexception) +// } +// catch (java.lang.Exception jexception) // { // jexception.printStackTrace(System.out); // } @@ -462,7 +472,7 @@ public class ReportTextImplementation extends ReportImplementationHelper impleme xNameCellCursor = ReportTextDocument.createTextCursor(CurDBColumn.xNameCell); xNameCellCursor.gotoStart(false); FieldContent = getDoc().oTextFieldHandler.getUserFieldContent(xNameCellCursor); - if (!FieldContent.equals("")) + if (!FieldContent.equals(PropertyNames.EMPTY_STRING)) { xNameCellCursor.goRight((short) 1, true); xNameCellCursor.setString(FieldContent); @@ -629,6 +639,7 @@ public class ReportTextImplementation extends ReportImplementationHelper impleme } catch (Exception e) { + Logger.getLogger( ReportTextImplementation.class.getName() ).log( Level.SEVERE, null, e ); } } return m_aReportPath; @@ -646,7 +657,7 @@ public class ReportTextImplementation extends ReportImplementationHelper impleme return sPath; } } - return ""; + return PropertyNames.EMPTY_STRING; } public String getLayoutPath() @@ -661,7 +672,7 @@ public class ReportTextImplementation extends ReportImplementationHelper impleme return sPath; } } - return ""; + return PropertyNames.EMPTY_STRING; } public int getDefaultPageOrientation() diff --git a/wizards/com/sun/star/wizards/report/ReportWizard.java b/wizards/com/sun/star/wizards/report/ReportWizard.java index 46fe77fbee38..62cb10a1fad1 100644 --- a/wizards/com/sun/star/wizards/report/ReportWizard.java +++ b/wizards/com/sun/star/wizards/report/ReportWizard.java @@ -2,7 +2,7 @@ ************************************************************************ * * 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 @@ -79,7 +79,7 @@ public class ReportWizard extends DatabaseObjectWizard implements XTextListener, private ReportLayouter CurReportLayouter; private ReportFinalizer CurReportFinalizer; private int nReportMode = ReportFinalizer.SOCREATEDOCUMENT; - private String m_sReportName = ""; + private String m_sReportName = PropertyNames.EMPTY_STRING; protected static final String SOREPORTFORMNAME = "ReportSource"; private static final int SOMAINPAGE = 1; private static final int SOTITLEPAGE = 2; @@ -103,19 +103,19 @@ public class ReportWizard extends DatabaseObjectWizard implements XTextListener, { super(i_serviceFactory, 34320, i_wizardContext); super.addResourceHandler("Report Wizard", "dbw"); - if (getReportResources(false) == true) + if (getReportResources(false)) { Helper.setUnoPropertyValues(xDialogModel, new String[] { PropertyNames.PROPERTY_HEIGHT, - "Moveable", + PropertyNames.PROPERTY_MOVEABLE, PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, - "Title", + PropertyNames.PROPERTY_TITLE, PropertyNames.PROPERTY_WIDTH }, new Object[] @@ -123,12 +123,12 @@ public class ReportWizard extends DatabaseObjectWizard implements XTextListener, Integer.valueOf(210), Boolean.TRUE, "DialogReport", - new Integer(102), - new Integer(41), - new Integer(1), + 102, + 41, + 1, new Short((short) 0), sMsgWizardName, - new Integer(310) + 310 }); drawNaviBar(); setRightPaneHeaders(this.WizardHeaderText); @@ -245,7 +245,7 @@ public class ReportWizard extends DatabaseObjectWizard implements XTextListener, private void dialogFinish() { this.xComponent.dispose(); - if (bCloseDocument == true) + if (bCloseDocument) { m_reportDocument.dispose(); return; @@ -272,10 +272,17 @@ public class ReportWizard extends DatabaseObjectWizard implements XTextListener, final SQLQueryComposer sqlQueryComposer = recordParser.getSQLQueryComposer(); if (this.CurDBCommandFieldSelection.getSelectedCommandType() == CommandType.TABLE) { - bQueryCreated = sqlQueryComposer.setQueryCommand(this.xWindow, false, false); - m_reportDocument.setCommandType(CommandType.COMMAND); - String sQuery = sqlQueryComposer.getQuery(); - m_reportDocument.setCommand(sQuery); + if (m_reportDocument instanceof ReportTextImplementation) + { + bQueryCreated = sqlQueryComposer.setQueryCommand(this.xWindow, false, false); + m_reportDocument.setCommandType(CommandType.COMMAND); + String sQuery = sqlQueryComposer.getQuery(); + m_reportDocument.setCommand(sQuery); + } + else + { + bQueryCreated = true; + } } else { @@ -284,24 +291,25 @@ public class ReportWizard extends DatabaseObjectWizard implements XTextListener, String sQueryName = CurDBCommandFieldSelection.getSelectedCommandName(); DBMetaData.CommandObject oCommand = recordParser.getQueryByName(sQueryName); bHasEscapeProcessing = recordParser.hasEscapeProcessing(oCommand.getPropertySet()); - String sCommand = (String) oCommand.getPropertySet().getPropertyValue("Command"); + String sCommand = (String) oCommand.getPropertySet().getPropertyValue(PropertyNames.COMMAND); if (bHasEscapeProcessing) { - // String sCommand = (String) oCommand.xPropertySet.getPropertyValue("Command"); - bQueryCreated = (!sCommand.equals("")); - sqlQueryComposer.m_xQueryAnalyzer.setQuery(sCommand); - sqlQueryComposer.prependSortingCriteria(); -// TODO: check with query - m_reportDocument.setCommandType(CommandType.COMMAND); - m_reportDocument.setCommand(sqlQueryComposer.getQuery()); - bQueryCreated = true; + // String sCommand = (String) oCommand.xPropertySet.getPropertyValue(PropertyNames.COMMAND); + bQueryCreated = (!sCommand.equals(PropertyNames.EMPTY_STRING)); + if (m_reportDocument instanceof ReportTextImplementation) + { + sqlQueryComposer.m_xQueryAnalyzer.setQuery(sCommand); + sqlQueryComposer.prependSortingCriteria(); + m_reportDocument.setCommandType(CommandType.COMMAND); + m_reportDocument.setCommand(sqlQueryComposer.getQuery()); + } } else { m_reportDocument.setCommandType(CommandType.COMMAND); m_reportDocument.setCommand(sCommand); - bQueryCreated = true; } + bQueryCreated = true; } catch (Exception e) { @@ -329,7 +337,7 @@ public class ReportWizard extends DatabaseObjectWizard implements XTextListener, }, new Object[] { - new Integer(16), sShowBinaryFields, new Integer(95), new Integer(162), new Integer(1), new Integer(210) + 16, sShowBinaryFields, 95, 162, 1, 210 }); } // CurReportDocument.getDoc().xProgressBar.setValue(40); @@ -398,12 +406,8 @@ public class ReportWizard extends DatabaseObjectWizard implements XTextListener, { return false; } - if (e.hasMoreElements()) - { - return true; + return e.hasMoreElements(); } - return false; - } /** * Return the path to the "com.sun.reportdesigner" extension @@ -416,8 +420,7 @@ public class ReportWizard extends DatabaseObjectWizard implements XTextListener, 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; + return xProvider.getPackageLocation("com.sun.reportdesigner"); } private static XLogger m_xLogger; @@ -463,10 +466,8 @@ public class ReportWizard extends DatabaseObjectWizard implements XTextListener, { XMultiServiceFactory.class }); - m_reportDocument = (IReportDocument) aMethod.invoke(a, new Object[] - { - xMSF - }); + m_reportDocument = (IReportDocument) aMethod.invoke(a, xMSF + ); } catch (Exception e) { @@ -569,7 +570,7 @@ public class ReportWizard extends DatabaseObjectWizard implements XTextListener, public boolean getReportResources(boolean bgetProgressResourcesOnly) { sMsgWizardName = super.m_oResource.getResText(UIConsts.RID_REPORT); - if (bgetProgressResourcesOnly == false) + if (!bgetProgressResourcesOnly) { sShowBinaryFields = m_oResource.getResText(UIConsts.RID_REPORT + 60); slblTables = m_oResource.getResText(UIConsts.RID_FORM + 6); @@ -589,7 +590,7 @@ public class ReportWizard extends DatabaseObjectWizard implements XTextListener, public static String getBlindTextNote(Object _aDocument, Resource _oResource) { - String sBlindTextNote = ""; + String sBlindTextNote = PropertyNames.EMPTY_STRING; if (_aDocument instanceof ReportTextImplementation) { sBlindTextNote = _oResource.getResText(UIConsts.RID_REPORT + 75); @@ -619,7 +620,7 @@ public class ReportWizard extends DatabaseObjectWizard implements XTextListener, bEnabled = true; } - Helper.setUnoPropertyValue(oRoadmapItem, PropertyNames.PROPERTY_ENABLED, new Boolean(bEnabled)); + Helper.setUnoPropertyValue(oRoadmapItem, PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(bEnabled)); } } catch (com.sun.star.uno.Exception exception) @@ -631,8 +632,8 @@ public class ReportWizard extends DatabaseObjectWizard implements XTextListener, private void enableWizardSteps(String[] NewItems) { boolean bEnabled = NewItems.length > 0; - setControlProperty("btnWizardNext", PropertyNames.PROPERTY_ENABLED, new Boolean(bEnabled)); - setControlProperty("btnWizardFinish", PropertyNames.PROPERTY_ENABLED, new Boolean(bEnabled)); + setControlProperty("btnWizardNext", PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(bEnabled)); + setControlProperty("btnWizardFinish", PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(bEnabled)); enableRoadmapItems(bEnabled); // Note: Performancewise this could be improved } @@ -698,7 +699,7 @@ public class ReportWizard extends DatabaseObjectWizard implements XTextListener, m_nID = 1; if (sIncSuffix != null) { - if ((!sIncSuffix.equals("")) && (!sIncSuffix.equals("_"))) + if ((!sIncSuffix.equals(PropertyNames.EMPTY_STRING)) && (!sIncSuffix.equals("_"))) { String sID = JavaTools.ArrayoutofString(sIncSuffix, "_")[1]; m_nID = Integer.parseInt(sID); @@ -717,7 +718,7 @@ public class ReportWizard extends DatabaseObjectWizard implements XTextListener, else { boolean bEnabled = (CurGroupFieldSelection.getSelectedFieldNames().length > 0); - Helper.setUnoPropertyValue(getRoadmapItemByID(SOGROUPPAGE), PropertyNames.PROPERTY_ENABLED, new Boolean(bEnabled)); + Helper.setUnoPropertyValue(getRoadmapItemByID(SOGROUPPAGE), PropertyNames.PROPERTY_ENABLED, bEnabled); } } @@ -732,7 +733,7 @@ public class ReportWizard extends DatabaseObjectWizard implements XTextListener, else { boolean bEnabled = (CurGroupFieldSelection.getSelectedFieldNames().length > 0); - Helper.setUnoPropertyValue(getRoadmapItemByID(SOGROUPPAGE), PropertyNames.PROPERTY_ENABLED, new Boolean(bEnabled)); + Helper.setUnoPropertyValue(getRoadmapItemByID(SOGROUPPAGE), PropertyNames.PROPERTY_ENABLED, bEnabled); } } @@ -761,7 +762,7 @@ public class ReportWizard extends DatabaseObjectWizard implements XTextListener, // long nTime = aDate.getTime(); // Long aLong = new Long(nTime); // String aStr = aLong.toString(); -// +// // Date aNewDate = new Date(1202382900000L); //// aNewDate. // String aDateStr = aNewDate.toString(); |