diff options
author | Ocke.Janssen <Ocke.Janssen@oracle.com> | 2011-01-20 13:12:51 +0100 |
---|---|---|
committer | Ocke.Janssen <Ocke.Janssen@oracle.com> | 2011-01-20 13:12:51 +0100 |
commit | e0c1daa9561ff447351135f3318d1a1183077212 (patch) | |
tree | 266e63f408dd7593ba113c2a857b8cdeaa49dfc0 /wizards | |
parent | a5fa6f4652b4a723f935c611a68b039ed3f7f46c (diff) |
dba34d: #i98163# import hidden value correted
Diffstat (limited to 'wizards')
9 files changed, 213 insertions, 133 deletions
diff --git a/wizards/com/sun/star/wizards/db/DBMetaData.java b/wizards/com/sun/star/wizards/db/DBMetaData.java index 5a151937d73f..f6f5d0212fc5 100644 --- a/wizards/com/sun/star/wizards/db/DBMetaData.java +++ b/wizards/com/sun/star/wizards/db/DBMetaData.java @@ -187,7 +187,7 @@ public class DBMetaData } catch (Exception e) { - e.printStackTrace(System.out); + Logger.getLogger( DBMetaData.class.getName() ).log( Level.SEVERE, null, e ); } } return oNumberFormatter; @@ -215,9 +215,9 @@ public class DBMetaData xNameAccess = UnoRuntime.queryInterface( XNameAccess.class, xDatabaseContext ); DataSourceNames = xNameAccess.getElementNames(); } - catch (Exception exception) + catch (Exception e) { - exception.printStackTrace(System.out); + Logger.getLogger( DBMetaData.class.getName() ).log( Level.SEVERE, null, e ); } } @@ -326,9 +326,9 @@ public class DBMetaData // TODO: Performance leak getColumns() take very long. xColumns = UnoRuntime.queryInterface( XNameAccess.class, xCommandCols.getColumns() ); } - catch (Exception exception) + catch (Exception e) { - exception.printStackTrace(System.out); + Logger.getLogger( DBMetaData.class.getName() ).log( Level.SEVERE, null, e ); } } public XNameAccess getColumns() @@ -357,7 +357,7 @@ public class DBMetaData } catch (Exception e) { - e.printStackTrace(System.out); + Logger.getLogger( DBMetaData.class.getName() ).log( Level.SEVERE, null, e ); } return bHasEscapeProcessing; } @@ -453,7 +453,7 @@ public class DBMetaData } catch (SQLException e) { - e.printStackTrace(System.out); + Logger.getLogger( DBMetaData.class.getName() ).log( Level.SEVERE, null, e ); return - 1; } } @@ -507,7 +507,7 @@ public class DBMetaData } catch (SQLException e) { - e.printStackTrace(System.out); + Logger.getLogger( DBMetaData.class.getName() ).log( Level.SEVERE, null, e ); } } @@ -530,7 +530,7 @@ public class DBMetaData } catch (Exception e) { - e.printStackTrace(); + Logger.getLogger( DBMetaData.class.getName() ).log( Level.SEVERE, null, e ); } return isSQL92CheckEnabled; } @@ -579,9 +579,9 @@ public class DBMetaData xModel = xDocu.getDatabaseDocument(); } } - catch (Exception exception) + catch (Exception e) { - exception.printStackTrace(System.out); + Logger.getLogger( DBMetaData.class.getName() ).log( Level.SEVERE, null, e ); } } @@ -653,15 +653,15 @@ public class DBMetaData } catch (IllegalArgumentException e) { - e.printStackTrace(System.out); + Logger.getLogger( DBMetaData.class.getName() ).log( Level.SEVERE, null, e ); } catch (UnknownPropertyException e) { - e.printStackTrace(System.out); + Logger.getLogger( DBMetaData.class.getName() ).log( Level.SEVERE, null, e ); } catch (WrappedTargetException e) { - e.printStackTrace(System.out); + Logger.getLogger( DBMetaData.class.getName() ).log( Level.SEVERE, null, e ); } return false; @@ -684,7 +684,7 @@ public class DBMetaData } catch (Exception e) { - e.printStackTrace(System.out); + Logger.getLogger( DBMetaData.class.getName() ).log( Level.SEVERE, null, e ); return false; } } @@ -746,11 +746,11 @@ public class DBMetaData } return bgetConnection; } - catch (Exception exception) + catch (Exception e) { String sMsgConnectionImpossible = oResource.getResText(RID_DB_COMMON + 35); showMessageBox("ErrorBox", VclWindowPeerAttribute.OK, sMsgConnectionImpossible); - exception.printStackTrace(System.out); + Logger.getLogger( DBMetaData.class.getName() ).log( Level.SEVERE, null, e ); return false; } } @@ -767,7 +767,7 @@ public class DBMetaData } catch (SQLException e) { - e.printStackTrace(System.out); + Logger.getLogger( DBMetaData.class.getName() ).log( Level.SEVERE, null, e ); return 0; } } @@ -784,7 +784,7 @@ public class DBMetaData } catch (SQLException e) { - e.printStackTrace(System.out); + Logger.getLogger( DBMetaData.class.getName() ).log( Level.SEVERE, null, e ); return 0; } } @@ -816,7 +816,7 @@ public class DBMetaData } catch (SQLException e) { - e.printStackTrace(System.out); + Logger.getLogger( DBMetaData.class.getName() ).log( Level.SEVERE, null, e ); return false; } } @@ -877,13 +877,13 @@ public class DBMetaData } exception.printStackTrace(System.out); } - catch (SQLException exception) + catch (SQLException e) { - callSQLErrorMessageDialog(exception, null); + Logger.getLogger( DBMetaData.class.getName() ).log( Level.SEVERE, null, e ); } - catch (Exception exception) + catch (Exception e) { - exception.printStackTrace(System.out); + Logger.getLogger( DBMetaData.class.getName() ).log( Level.SEVERE, null, e ); } return false; } @@ -962,7 +962,7 @@ public class DBMetaData } catch (Exception e) { - e.printStackTrace(); + Logger.getLogger( DBMetaData.class.getName() ).log( Level.SEVERE, null, e ); } } @@ -992,7 +992,7 @@ public class DBMetaData } catch (SQLException e) { - e.printStackTrace(); + Logger.getLogger( DBMetaData.class.getName() ).log( Level.SEVERE, null, e ); } return sColValues; } @@ -1006,7 +1006,7 @@ public class DBMetaData } catch (SQLException e) { - e.printStackTrace(System.out); + Logger.getLogger( DBMetaData.class.getName() ).log( Level.SEVERE, null, e ); return null; } } @@ -1020,7 +1020,7 @@ public class DBMetaData } catch (SQLException e) { - e.printStackTrace(System.out); + Logger.getLogger( DBMetaData.class.getName() ).log( Level.SEVERE, null, e ); return null; } } @@ -1041,7 +1041,7 @@ public class DBMetaData } catch (Exception e) { - e.printStackTrace(System.out); + Logger.getLogger( DBMetaData.class.getName() ).log( Level.SEVERE, null, e ); return false; } } diff --git a/wizards/com/sun/star/wizards/db/SQLQueryComposer.java b/wizards/com/sun/star/wizards/db/SQLQueryComposer.java index e088fb75641f..8e3d9706cc9d 100644 --- a/wizards/com/sun/star/wizards/db/SQLQueryComposer.java +++ b/wizards/com/sun/star/wizards/db/SQLQueryComposer.java @@ -26,9 +26,11 @@ ************************************************************************/ package com.sun.star.wizards.db; - // import com.sun.star.lang.IllegalArgumentException; // import com.sun.star.lang.WrappedTargetException; +import com.sun.star.container.NoSuchElementException; +import com.sun.star.container.XNameAccess; +import com.sun.star.lang.WrappedTargetException; import com.sun.star.lang.XMultiServiceFactory; import com.sun.star.beans.*; // import com.sun.star.container.NoSuchElementException; @@ -49,6 +51,8 @@ import com.sun.star.sdb.SQLFilterOperator; import com.sun.star.wizards.common.*; import java.util.ArrayList; +import java.util.logging.Level; +import java.util.logging.Logger; public class SQLQueryComposer { @@ -188,10 +192,32 @@ public class SQLQueryComposer { String sSortValue = CurDBMetaData.getSortFieldNames()[_SortIndex][0]; XPropertySet xColumn = CurDBMetaData.getColumnObjectByFieldName(sSortValue, _baddAliasFieldNames); + if (xColumn == null) + { + XNameAccess columns = UnoRuntime.queryInterface(XColumnsSupplier.class, m_queryComposer).getColumns(); + if (columns != null && columns.hasByName(sSortValue)) + { + try + { + xColumn = UnoRuntime.queryInterface(XPropertySet.class, columns.getByName(sSortValue)); + } + catch (NoSuchElementException ex) + { + Logger.getLogger(SQLQueryComposer.class.getName()).log(Level.SEVERE, null, ex); + } + catch (WrappedTargetException ex) + { + Logger.getLogger(SQLQueryComposer.class.getName()).log(Level.SEVERE, null, ex); + } + } + } - String sSort = CurDBMetaData.getSortFieldNames()[_SortIndex][1]; - boolean bascend = (sSort.equals("ASC")); - m_queryComposer.appendOrderByColumn(xColumn, bascend); + if (xColumn != null) + { + String sSort = CurDBMetaData.getSortFieldNames()[_SortIndex][1]; + boolean bascend = (sSort.equals("ASC")); + m_queryComposer.appendOrderByColumn(xColumn, bascend); + } } public void appendSortingcriteria(boolean _baddAliasFieldNames) throws SQLException diff --git a/wizards/com/sun/star/wizards/document/FormHandler.java b/wizards/com/sun/star/wizards/document/FormHandler.java index 17dece81a03e..e1fab5a3301b 100644 --- a/wizards/com/sun/star/wizards/document/FormHandler.java +++ b/wizards/com/sun/star/wizards/document/FormHandler.java @@ -59,9 +59,17 @@ import com.sun.star.lang.XComponent; import com.sun.star.lang.XMultiServiceFactory; import com.sun.star.lang.XServiceInfo; import com.sun.star.container.XNamed; +import java.util.logging.Level; +import java.util.logging.Logger; public class FormHandler { + private static final String CHECKBOX = "CheckBox"; + private static final String DATEFIELD = "DateField"; + private static final String FORMATTEDFIELD = "FormattedField"; + private static final String IMAGECONTROL = "ImageControl"; + private static final String TEXTFIELD = "TextField"; + private static final String TIMEFIELD = "TimeField"; public XFormsSupplier xFormsSupplier; public XMultiServiceFactory xMSFDoc; @@ -124,30 +132,30 @@ public class FormHandler sModelServices[SOIMAGECONTROL] = "com.sun.star.form.component.DatabaseImageControl"; oControlData = new ControlData[22]; - oControlData[0] = createControlData(DataType.BIT, SOCHECKBOX, "CheckBox", "CheckBox", false); - oControlData[1] = createControlData(DataType.BOOLEAN, SOCHECKBOX, "CheckBox", "CheckBox", false); - oControlData[2] = createControlData(DataType.TINYINT, SONUMERICCONTROL, "FormattedField", "FormattedField", false); - oControlData[3] = createControlData(DataType.SMALLINT, SONUMERICCONTROL, "FormattedField", "FormattedField", false); - oControlData[4] = createControlData(DataType.INTEGER, SONUMERICCONTROL, "FormattedField", "FormattedField", false); - oControlData[5] = createControlData(DataType.BIGINT, SONUMERICCONTROL, "FormattedField", "FormattedField", false); - oControlData[6] = createControlData(DataType.FLOAT, SONUMERICCONTROL, "FormattedField", "FormattedField", false); - oControlData[7] = createControlData(DataType.REAL, SONUMERICCONTROL, "FormattedField", "FormattedField", false); - oControlData[8] = createControlData(DataType.DOUBLE, SONUMERICCONTROL, "FormattedField", "FormattedField", false); - oControlData[9] = createControlData(DataType.NUMERIC, SONUMERICCONTROL, "FormattedField", "FormattedField", false); - oControlData[10] = createControlData(DataType.DECIMAL, SONUMERICCONTROL, "FormattedField", "FormattedField", false); - oControlData[11] = createControlData(DataType.CHAR, SOTEXTBOX, "TextField", "TextField", false); - oControlData[12] = createControlData(DataType.VARCHAR, SOTEXTBOX, "TextField", "TextField", true); - oControlData[13] = createControlData(DataType.LONGVARCHAR, SOTEXTBOX, "TextField", "TextField", true); - oControlData[14] = createControlData(DataType.DATE, SODATECONTROL, "DateField", "DateField", false); - oControlData[15] = createControlData(DataType.TIME, SOTIMECONTROL, "TimeField", "TimeField", false); - oControlData[16] = createControlData(DataType.TIMESTAMP, SODATECONTROL, "DateField", "TextField", false); + oControlData[0] = createControlData(DataType.BIT, SOCHECKBOX, CHECKBOX, CHECKBOX, false); + oControlData[1] = createControlData(DataType.BOOLEAN, SOCHECKBOX, CHECKBOX, CHECKBOX, false); + oControlData[2] = createControlData(DataType.TINYINT, SONUMERICCONTROL, FORMATTEDFIELD, FORMATTEDFIELD, false); + oControlData[3] = createControlData(DataType.SMALLINT, SONUMERICCONTROL, FORMATTEDFIELD, FORMATTEDFIELD, false); + oControlData[4] = createControlData(DataType.INTEGER, SONUMERICCONTROL, FORMATTEDFIELD, FORMATTEDFIELD, false); + oControlData[5] = createControlData(DataType.BIGINT, SONUMERICCONTROL, FORMATTEDFIELD, FORMATTEDFIELD, false); + oControlData[6] = createControlData(DataType.FLOAT, SONUMERICCONTROL, FORMATTEDFIELD, FORMATTEDFIELD, false); + oControlData[7] = createControlData(DataType.REAL, SONUMERICCONTROL, FORMATTEDFIELD, FORMATTEDFIELD, false); + oControlData[8] = createControlData(DataType.DOUBLE, SONUMERICCONTROL, FORMATTEDFIELD, FORMATTEDFIELD, false); + oControlData[9] = createControlData(DataType.NUMERIC, SONUMERICCONTROL, FORMATTEDFIELD, FORMATTEDFIELD, false); + oControlData[10] = createControlData(DataType.DECIMAL, SONUMERICCONTROL, FORMATTEDFIELD, FORMATTEDFIELD, false); + oControlData[11] = createControlData(DataType.CHAR, SOTEXTBOX, TEXTFIELD, TEXTFIELD, false); + oControlData[12] = createControlData(DataType.VARCHAR, SOTEXTBOX, TEXTFIELD, TEXTFIELD, true); + oControlData[13] = createControlData(DataType.LONGVARCHAR, SOTEXTBOX, TEXTFIELD, TEXTFIELD, true); + oControlData[14] = createControlData(DataType.DATE, SODATECONTROL, DATEFIELD, DATEFIELD, false); + oControlData[15] = createControlData(DataType.TIME, SOTIMECONTROL, TIMEFIELD, TIMEFIELD, false); + oControlData[16] = createControlData(DataType.TIMESTAMP, SODATECONTROL, DATEFIELD, TEXTFIELD, false); // oImageControlData = new ControlData[4]; - oControlData[17] = createControlData(DataType.BINARY, SOIMAGECONTROL, "ImageControl", "TextField", false); - oControlData[18] = createControlData(DataType.VARBINARY, SOIMAGECONTROL, "ImageControl", "TextField", false); - oControlData[19] = createControlData(DataType.LONGVARBINARY, SOIMAGECONTROL, "ImageControl", "TextField", false); - oControlData[20] = createControlData(DataType.BLOB, SOIMAGECONTROL, "ImageControl", "TextField", false); + oControlData[17] = createControlData(DataType.BINARY, SOIMAGECONTROL, IMAGECONTROL, TEXTFIELD, false); + oControlData[18] = createControlData(DataType.VARBINARY, SOIMAGECONTROL, IMAGECONTROL, TEXTFIELD, false); + oControlData[19] = createControlData(DataType.LONGVARBINARY, SOIMAGECONTROL, IMAGECONTROL, TEXTFIELD, false); + oControlData[20] = createControlData(DataType.BLOB, SOIMAGECONTROL, IMAGECONTROL, TEXTFIELD, false); - oControlData[21] = createControlData(DataType.OTHER, SOIMAGECONTROL, "ImageControl", "TextField", false); + oControlData[21] = createControlData(DataType.OTHER, SOIMAGECONTROL, IMAGECONTROL, TEXTFIELD, false); } public int getControlType(int _fieldtype) @@ -209,8 +217,7 @@ public class FormHandler public XNameContainer getDocumentForms() { - XNameContainer xNamedForms = xFormsSupplier.getForms(); - return xNamedForms; + return xFormsSupplier.getForms(); } public String getValueofHiddenControl(XNameAccess xNamedForm, String ControlName, String sMsg) throws com.sun.star.wizards.document.FormHandler.UnknownHiddenControlException @@ -238,7 +245,7 @@ public class FormHandler try { XInterface xHiddenControl; - if (xNameAccess.hasByName(ControlName) == true) + if (xNameAccess.hasByName(ControlName)) { xHiddenControl = (XInterface) AnyConverter.toObject(new Type(XInterface.class), xNameAccess.getByName(ControlName)); } @@ -249,9 +256,9 @@ public class FormHandler } Helper.setUnoPropertyValue(xHiddenControl, "HiddenValue", ControlValue); } - catch (Exception exception) + catch (Exception ex) { - exception.printStackTrace(System.out); + Logger.getLogger(FormHandler.class.getName()).log(Level.SEVERE, null, ex); } } @@ -285,9 +292,9 @@ public class FormHandler xNamedFormContainer.removeByName(_FormName); } } - catch (com.sun.star.uno.Exception exception) + catch (com.sun.star.uno.Exception ex) { - exception.printStackTrace(System.out); + Logger.getLogger(FormHandler.class.getName()).log(Level.SEVERE, null, ex); } } @@ -306,7 +313,7 @@ public class FormHandler } catch (Exception e) { - e.printStackTrace(System.out); + Logger.getLogger(FormHandler.class.getName()).log(Level.SEVERE, null, e); } } @@ -318,11 +325,11 @@ public class FormHandler } catch ( WrappedTargetException e ) { - e.printStackTrace( System.err ); + Logger.getLogger(FormHandler.class.getName()).log(Level.SEVERE, null, e); } catch( final NoSuchElementException e ) { - e.printStackTrace( System.err ); + Logger.getLogger(FormHandler.class.getName()).log(Level.SEVERE, null, e); } } @@ -363,9 +370,9 @@ public class FormHandler return getFormByName(_FormName); } } - catch (com.sun.star.uno.Exception exception) + catch (com.sun.star.uno.Exception e) { - exception.printStackTrace(System.out); + Logger.getLogger(FormHandler.class.getName()).log(Level.SEVERE, null, e); return null; } } @@ -393,7 +400,7 @@ public class FormHandler } catch (IllegalArgumentException e) { - e.printStackTrace(System.out); + Logger.getLogger(FormHandler.class.getName()).log(Level.SEVERE, null, e); } return xNamedForm; } @@ -490,7 +497,7 @@ public class FormHandler } catch (Exception e) { - e.printStackTrace(System.out); + Logger.getLogger(FormHandler.class.getName()).log(Level.SEVERE, null, e); } } @@ -538,7 +545,7 @@ public class FormHandler } catch (Exception e) { - e.printStackTrace(System.out); + Logger.getLogger(FormHandler.class.getName()).log(Level.SEVERE, null, e); return null; } } @@ -586,9 +593,9 @@ public class FormHandler XPropertySet xPropertySet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, this.xMSFDoc.createInstance("com.sun.star.text.DocumentSettings")); xPropertySet.setPropertyValue("DoNotCaptureDrawObjsOnPage", new Boolean(!_bCaptureObjects)); } - catch (Exception ex) + catch (Exception e) { - ex.printStackTrace(System.out); + Logger.getLogger(FormHandler.class.getName()).log(Level.SEVERE, null, e); } } } diff --git a/wizards/com/sun/star/wizards/report/CallReportWizard.java b/wizards/com/sun/star/wizards/report/CallReportWizard.java index c66596e11c02..fc0a60447cd3 100644 --- a/wizards/com/sun/star/wizards/report/CallReportWizard.java +++ b/wizards/com/sun/star/wizards/report/CallReportWizard.java @@ -28,11 +28,12 @@ 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 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>). @@ -138,9 +139,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 +213,11 @@ public class CallReportWizard try { - byteReturn = new String("" + this.hashCode()).getBytes(); + byteReturn = ("" + 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 +252,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/Dataimport.java b/wizards/com/sun/star/wizards/report/Dataimport.java index 00b58fb5e008..6ae33413605d 100644 --- a/wizards/com/sun/star/wizards/report/Dataimport.java +++ b/wizards/com/sun/star/wizards/report/Dataimport.java @@ -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 @@ -186,14 +188,14 @@ public class Dataimport extends UnoDialog2 implements com.sun.star.awt.XActionLi 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/ReportTextDocument.java b/wizards/com/sun/star/wizards/report/ReportTextDocument.java index 3ab9e704b9b9..cec7f0cbed1d 100644 --- a/wizards/com/sun/star/wizards/report/ReportTextDocument.java +++ b/wizards/com/sun/star/wizards/report/ReportTextDocument.java @@ -53,9 +53,17 @@ 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 COMMAND = "Command"; + 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 +110,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 +154,12 @@ class ReportTextDocument extends com.sun.star.wizards.text.TextDocument implemen { oTextSection = xTextSections.getByName(RECORDSECTION); } - boolean bLayoutMode = AnyConverter.toBoolean(Helper.getUnoPropertyValue(oTextSection, "IsVisible")); + boolean bLayoutMode = AnyConverter.toBoolean(Helper.getUnoPropertyValue(oTextSection, ISVISIBLE)); return bLayoutMode; } - 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 +180,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,17 +189,17 @@ 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); } } @@ -199,21 +207,41 @@ class ReportTextDocument extends com.sun.star.wizards.text.TextDocument implemen { 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()))); + oFormHandler.insertHiddenControl(xNameAccess, xNamedForm, "CommandType", 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, "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, 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 +258,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 +270,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 +288,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); } } @@ -303,9 +331,9 @@ class ReportTextDocument extends com.sun.star.wizards.text.TextDocument implemen } 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 +380,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 +396,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++) { @@ -639,7 +668,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 +683,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; } } @@ -728,7 +757,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 +780,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..535139b8f985 100644 --- a/wizards/com/sun/star/wizards/report/ReportTextImplementation.java +++ b/wizards/com/sun/star/wizards/report/ReportTextImplementation.java @@ -202,9 +202,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; } @@ -237,6 +237,7 @@ public class ReportTextImplementation extends ReportImplementationHelper impleme String sCommandType = getDoc().oFormHandler.getValueofHiddenControl(xNamedForm, "CommandType", 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")) { @@ -244,16 +245,28 @@ public class ReportTextImplementation extends ReportImplementationHelper impleme } String[] sFieldNameList = JavaTools.ArrayoutofString(sFieldNames, ";"); String[] sNewList = JavaTools.ArrayoutofString(sRecordFieldNames, ";"); + if ( !"".equals(sorting)) + { + String[] sortList = JavaTools.ArrayoutofString(sorting, ";"); + 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().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(""))) { DBMetaData.CommandObject oCommand = getRecordParser().getQueryByName(sQueryName); @@ -262,6 +275,7 @@ public class ReportTextImplementation extends ReportImplementationHelper impleme getRecordParser().Command = (String) oCommand.getPropertySet().getPropertyValue("Command"); getRecordParser().getSQLQueryComposer().m_xQueryAnalyzer.setQuery(getRecordParser().Command); getRecordParser().getSQLQueryComposer().prependSortingCriteria(); + getRecordParser().Command = getRecordParser().getSQLQueryComposer().getQuery(); } else { @@ -293,13 +307,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 +337,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(); @@ -403,8 +416,9 @@ 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) // { @@ -629,6 +643,7 @@ public class ReportTextImplementation extends ReportImplementationHelper impleme } catch (Exception e) { + Logger.getLogger( ReportTextImplementation.class.getName() ).log( Level.SEVERE, null, e ); } } return m_aReportPath; diff --git a/wizards/com/sun/star/wizards/report/ReportWizard.java b/wizards/com/sun/star/wizards/report/ReportWizard.java index 0c9eef8f430d..0ec981b54218 100644 --- a/wizards/com/sun/star/wizards/report/ReportWizard.java +++ b/wizards/com/sun/star/wizards/report/ReportWizard.java @@ -457,7 +457,7 @@ public class ReportWizard extends DatabaseObjectWizard implements XTextListener, // 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) + if (sLocation.length() == 0) { try { diff --git a/wizards/com/sun/star/wizards/ui/SortingComponent.java b/wizards/com/sun/star/wizards/ui/SortingComponent.java index d15f5131b560..aa5e0b244022 100644 --- a/wizards/com/sun/star/wizards/ui/SortingComponent.java +++ b/wizards/com/sun/star/wizards/ui/SortingComponent.java @@ -111,7 +111,7 @@ public class SortingComponent "Dropdown", PropertyNames.PROPERTY_ENABLED, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, "LineCount", PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH }, new Object[] { - new Boolean(true), new Boolean(bDoEnable), 12, HIDString, new Short(UnoDialog.getListBoxLineCount()), "lstSort" + new Integer(i + 1), IListBoxPosX, new Integer(iCurPosY + 14), IStep, new Short(curtabindex++), IListBoxWidth + true, bDoEnable, 12, HIDString, new Short(UnoDialog.getListBoxLineCount()), "lstSort" + new Integer(i + 1), IListBoxPosX, new Integer(iCurPosY + 14), IStep, new Short(curtabindex++), IListBoxWidth }); //new Short((short) (17+i*4)) HIDString = HelpIds.getHelpIdString(FirstHelpIndex + 1); @@ -120,7 +120,7 @@ public class SortingComponent PropertyNames.PROPERTY_ENABLED, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STATE, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, "Tag", PropertyNames.PROPERTY_WIDTH }, new Object[] { - new Boolean(bDoEnable), 10, HIDString, sSortAscend[i], IOptButtonPosX, new Integer(iCurPosY + 10), new Short((short) 1), IStep, new Short(curtabindex++), new String("ASC"), IOptButtonWidth + bDoEnable, 10, HIDString, sSortAscend[i], IOptButtonPosX, new Integer(iCurPosY + 10), new Short((short) 1), IStep, new Short(curtabindex++), "ASC", IOptButtonWidth }); //, new Short((short) (18+i*4)) HIDString = HelpIds.getHelpIdString(FirstHelpIndex + 2); @@ -129,7 +129,7 @@ public class SortingComponent PropertyNames.PROPERTY_ENABLED, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STATE, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, "Tag", PropertyNames.PROPERTY_WIDTH }, new Object[] { - new Boolean(bDoEnable), 10, HIDString, sSortDescend[i], IOptButtonPosX, new Integer(iCurPosY + 24), new Short((short) 0), IStep, new Short(curtabindex++), new String("DESC"), IOptButtonWidth + bDoEnable, 10, HIDString, sSortDescend[i], IOptButtonPosX, new Integer(iCurPosY + 24), new Short((short) 0), IStep, new Short(curtabindex++), "DESC", IOptButtonWidth }); //, new Short((short) (19+i*4)) iCurPosY = iCurPosY + 36; FirstHelpIndex += 3; |