diff options
author | Vladimir Glazounov <vg@openoffice.org> | 2003-04-11 14:04:03 +0000 |
---|---|---|
committer | Vladimir Glazounov <vg@openoffice.org> | 2003-04-11 14:04:03 +0000 |
commit | d5bcc6dbae4c32e29be588a102110c0391c94a5f (patch) | |
tree | 608e95104ee600e6013750fdc5a1d8679257d00a | |
parent | 8fff1f8f15985671947bdf17cc598b4b9f025fa9 (diff) |
INTEGRATION: CWS extras4 (1.47.2.3.10); FILE MERGED
2003/03/31 11:40:43 bc 1.47.2.3.10.7: #107595# Hint Label changed in Size
2003/03/28 17:30:59 bc 1.47.2.3.10.6: #107595# Some casting errors solved
2003/03/24 15:43:01 bc 1.47.2.3.10.5: #107595# checkiftoupdate function improved
2003/03/20 20:53:11 bc 1.47.2.3.10.4: #107595# MaxSortIndex variable set new
2003/03/14 15:07:08 bc 1.47.2.3.10.3: #107468# Tabindices for labels introduced
2003/03/05 16:45:08 bc 1.47.2.3.10.2: #107595# Error in getting SortFieldNames resolved
2003/03/03 16:43:34 bc 1.47.2.3.10.1: #107593# Sortoption criterias now checked if duplicate
-rw-r--r-- | wizards/com/sun/star/wizards/report/ReportWizard.java | 509 |
1 files changed, 293 insertions, 216 deletions
diff --git a/wizards/com/sun/star/wizards/report/ReportWizard.java b/wizards/com/sun/star/wizards/report/ReportWizard.java index d730955b7c05..3b4f3b53a5c7 100644 --- a/wizards/com/sun/star/wizards/report/ReportWizard.java +++ b/wizards/com/sun/star/wizards/report/ReportWizard.java @@ -2,9 +2,9 @@ * * $RCSfile: ReportWizard.java,v $ * - * $Revision: 1.49 $ + * $Revision: 1.50 $ * - * last change: $Author: hr $ $Date: 2003-03-27 17:58:32 $ + * last change: $Author: vg $ $Date: 2003-04-11 15:04:03 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -155,7 +155,6 @@ public class ReportWizard { XMultiServiceFactory xMSF; UNODialogs CurUNODialog; UNODialogs CurUNOProgressDialog; - String[] DatabaseNames; final String SOREPORTFORMNAME = "ReportSource"; final int MAXSORTCRITERIA = 3; @@ -227,14 +226,16 @@ public class ReportWizard { final int SOTEMPLATEPAGE = 5; final int SOSTOREPAGE = 6; + short CurTabIndex; int MaxSortIndex = -1; int TextFieldCount; String[] sDatabaseList; static String[] TableNames; static String[] QueryNames; static String[] sSortHeader = new String[4]; - static String[]sSortAscend = new String[4]; - static String[]sSortDescend = new String[4]; + static String[] sSortAscend = new String[4]; + static String[] sSortDescend = new String[4]; + static short[] bOldSortValues = new short[4]; XTextComponent xTitleTextBox; XTextComponent[] xSaveTextBox = new XTextComponent[2]; @@ -263,6 +264,8 @@ public class ReportWizard { boolean[] baskbeforeOverwrite = new boolean[2]; boolean[] bmodifiedbySaveAsDialog = new boolean[2]; boolean bfinalaskbeforeOverwrite; + boolean[] bCommandIsSelected = new boolean[1]; + boolean[] bDataSourceIsSelected = new boolean[1]; int iOldContentPos; int iOldLayoutPos; int ScrollBarValue; @@ -291,6 +294,7 @@ public class ReportWizard { static String slblPageLayout; static String sOrganizeFields; static String sNoSorting; + static String sSortCriteriaisduplicate; static String sOrientationHeader; static String sOrientVertical; static String sOrientHorizontal; @@ -341,6 +345,7 @@ public class ReportWizard { static String sMsgCommonReportError; static String sMsgInvalidTextField; static String[] ReportMessages = new String[4]; + static String sBlindTextNote; boolean bCloseDocument; public ReportWizard() { @@ -351,8 +356,9 @@ public class ReportWizard { boolean bGetConnection = false; short DBIndex = xDBListBox.getSelectedItemPos(); if (DBIndex > -1){ - CurReportDocument.CurDBMetaData.DataSourceName = DatabaseNames[DBIndex]; + CurReportDocument.CurDBMetaData.DataSourceName = CurReportDocument.CurDBMetaData.DataSourceNames[DBIndex]; bGetConnection = CurReportDocument.CurDBMetaData.getConnection(sMsgNoConnection, sMsgConnectionImpossible); + bCommandIsSelected[0] = false; fillupCommandListBox(CurReportDocument.CurDBMetaData, false); } if (bGetConnection == false) @@ -398,7 +404,8 @@ public class ReportWizard { public int addFieldNamestoListBox(UNODialogs CurUNODialog){ int FieldCount = 0; try{ - if (xTableListBox.getItemCount() > 0){ + String[] LocList = (String[]) CurUNODialog.getPropertyOfDialogControl("lstTables", "StringItemList"); + if (LocList.length > 0){ CurReportDocument.CurDBMetaData.getSpecificFieldNames(WidthList); FieldCount = CurReportDocument.CurDBMetaData.AllFieldNames.length; if (FieldCount > 0){ @@ -421,33 +428,36 @@ public class ReportWizard { try{ //As the peer of the control might not yet exist we have to query the model for the SelectedItems short[] SelItems = (short[]) CurUNODialog.getPropertyOfDialogControl("lstTables", "SelectedItems"); + String[] sLocList = (String[]) CurUNODialog.getPropertyOfDialogControl("lstTables", "StringItemList"); if (SelItems.length > 0) { int CurCommandType; int SelIndex = SelItems[0]; if (SelIndex > -1){ - SelIndex = SelIndex ; // -1 + SelIndex = SelIndex ; + if (xTableListBox.getItem((short) SelIndex).equals(slstTablesDefaultText)== false){ if (bgetCommandType == true){ - CurCommandType = CurDBMetaData.CommandTypes[SelIndex]; - if (CurCommandType == com.sun.star.sdb.CommandType.QUERY){ + CurCommandType = CurDBMetaData.CommandTypes[SelIndex]; + if (CurCommandType == com.sun.star.sdb.CommandType.QUERY){ int QueryIndex = SelIndex - TableNames.length; CurDBMetaData.MainCommandName = QueryNames[QueryIndex]; oDBTable = CurDBMetaData.xQueryNames.getByName(CurDBMetaData.MainCommandName); CurDBMetaData.Command = AnyConverter.toString(Tools.getUNOPropertyValue(oDBTable, "Command")); - } - else{ + } + else{ CurDBMetaData.MainCommandName = TableNames[SelIndex]; oDBTable = CurDBMetaData.xTableNames.getByName(CurDBMetaData.MainCommandName); - } - CurDBMetaData.CommandType = CurCommandType; - CurDBMetaData.OldMainCommandName = CurDBMetaData.MainCommandName; - Tools.setUNOPropertyValue(CurReportDocument.xDocInfo, "Title", CurDBMetaData.MainCommandName); - CurUNODialog.assignPropertyToDialogControl("txtTitle", "Text", CurReportDocument.CurDBMetaData.MainCommandName); + } + CurDBMetaData.CommandType = CurCommandType; + CurDBMetaData.OldMainCommandName = CurDBMetaData.MainCommandName; + Tools.setUNOPropertyValue(CurReportDocument.xDocInfo, "Title", CurDBMetaData.MainCommandName); + CurUNODialog.assignPropertyToDialogControl("txtTitle", "Text", CurReportDocument.CurDBMetaData.MainCommandName); } XColumnsSupplier xTableCols = (XColumnsSupplier) UnoRuntime.queryInterface(XColumnsSupplier.class, oDBTable); CurDBMetaData.xColumns = (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, xTableCols.getColumns()); if (addFieldNamestoListBox(CurUNODialog) > 0){ - CurUNODialog.toggleListboxControls(xFieldsListBox, xSelFieldsListBox, new Boolean(true)); - return; + CurUNODialog.toggleListboxControls(xFieldsListBox, xSelFieldsListBox, new Boolean(true)); + return; + } } } } @@ -508,10 +518,10 @@ public class ReportWizard { int iKey = CurUNODialog.getControlKey(mouseEvent.Source, CurUNODialog.ControlList); switch (iKey) { case SODBLST: - CurUNODialog.deletefirstListboxEntry("lstDatabases", slstDatabasesDefaultText); + CurUNODialog.deletefirstListboxEntry("lstDatabases", slstDatabasesDefaultText, bDataSourceIsSelected); break; case SOTBLLST: - CurUNODialog.deletefirstListboxEntry("lstTables", slstTablesDefaultText); + CurUNODialog.deletefirstListboxEntry("lstTables", slstTablesDefaultText, bCommandIsSelected); break; default: break; @@ -527,19 +537,23 @@ public class ReportWizard { public void itemStateChanged(ItemEvent EventObject){ int iPos; - Tools.setUNOPropertyValue(CurUNODialog.DialogModel, "Enabled", new Boolean(false)); + Tools.setUNOPropertyValue(CurUNODialog.xDialogModel, "Enabled", new Boolean(false)); CurReportDocument.xTextDocument.lockControllers(); int iKey = CurUNODialog.getControlKey(EventObject.Source, CurUNODialog.ControlList); switch (iKey) { case SODBLST: - CurUNODialog.deletefirstListboxEntry("lstDatabases", slstDatabasesDefaultText); + if (bDataSourceIsSelected[0] == true){ + CurUNODialog.deletefirstListboxEntry("lstDatabases", slstDatabasesDefaultText, bDataSourceIsSelected); getSelectedDBMetaData(xMSF); + } break; case SOTBLLST: - CurUNODialog.deletefirstListboxEntry("lstTables", slstTablesDefaultText); + if (bCommandIsSelected[0] == true) + CurUNODialog.deletefirstListboxEntry("lstTables", slstTablesDefaultText, bCommandIsSelected); fillUpFieldsListbox(CurReportDocument.CurDBMetaData, true); + bCommandIsSelected[0] = true; break; case SOFLDSLST: @@ -550,21 +564,6 @@ public class ReportWizard { CurUNODialog.FormSetMoveRights(xFieldsListBox, xSelFieldsListBox, (short)-1, (short)-1); break; - case SOFIRSTSORTLST: - enableNextSortListBox(0); - break; - - case SOSECSORTLST: - enableNextSortListBox(1); - - case SOTHIRDSORTLST: - enableNextSortListBox(2); - break; - - case SOFOURTHSORTLST: - MaxSortIndex = 3; - break; - case SOGROUPLST: boolean bDoEnable = ((xGroupListBox.getSelectedItems().length > 0) && (GroupFieldVector.size() < 4)); CurUNODialog.assignPropertyToDialogControl("cmdGroupOut", "Enabled", new Boolean(bDoEnable)); @@ -589,11 +588,27 @@ public class ReportWizard { CurReportDocument.swapLayoutTemplate(CurReportPaths.LayoutFiles[1][iPos], CurReportPaths.BitmapPath, CurUNODialog); } break; + + case SOFIRSTSORTLST: + enableNextSortListBox(0); + break; + + case SOSECSORTLST: + enableNextSortListBox(1); + break; + + case SOTHIRDSORTLST: + enableNextSortListBox(2); + break; + + case SOFOURTHSORTLST: + enableNextSortListBox(3); + break; default: break; } CurReportDocument.unlockallControllers(); - Tools.setUNOPropertyValue(CurUNODialog.DialogModel, "Enabled", new Boolean(true)); + Tools.setUNOPropertyValue(CurUNODialog.xDialogModel, "Enabled", new Boolean(true)); } public void disposing(EventObject eventObject) { @@ -624,7 +639,7 @@ public class ReportWizard { boolean bGoOn = true; try{ int iKey = CurUNODialog.getControlKey(actionEvent.Source, CurUNODialog.ControlList); - Tools.setUNOPropertyValue(CurUNODialog.DialogModel, "Enabled", new Boolean(false)); + Tools.setUNOPropertyValue(CurUNODialog.xDialogModel, "Enabled", new Boolean(false)); CurReportDocument.xTextDocument.lockControllers(); switch (iKey){ case SOFLDSLST: @@ -698,8 +713,10 @@ public class ReportWizard { case SOCMDSECPATHSELECT: insertStorePathToTextBox(); break; + case SOTITLESCROLLBAR: scrollControls(); + break; default: // System.err.println( exception); @@ -713,7 +730,7 @@ public class ReportWizard { exception.printStackTrace(System.out); } CurReportDocument.unlockallControllers(); - Tools.setUNOPropertyValue(CurUNODialog.DialogModel, "Enabled", new Boolean(true)); + Tools.setUNOPropertyValue(CurUNODialog.xDialogModel, "Enabled", new Boolean(true)); } } @@ -722,7 +739,7 @@ public class ReportWizard { try{ boolean bSetTitle = true; int PageCount = 6; - int iPage = AnyConverter.toInt(Tools.getUNOPropertyValue(CurUNODialog.DialogModel, "Step")); + int iPage = AnyConverter.toInt(Tools.getUNOPropertyValue(CurUNODialog.xDialogModel, "Step")); switch (iPage){ case SOMAINPAGE: updateSecondStep(CurReportDocument.CurDBMetaData, iPage+1); @@ -735,10 +752,11 @@ public class ReportWizard { updateFourthStep(CurReportDocument.CurDBMetaData); break; case SOSORTPAGE: - setUpSortList(); + setupSortList(); CurReportDocument.CurDBMetaData.RecordFieldNames = CurReportDocument.CurDBMetaData.setRecordFieldNames(); CurReportDocument.CurDBMetaData.combineSelectStatement(CurReportDocument.CurDBMetaData.MainCommandName); //TODO: A message box should pop up when a single sorting criteria has been selected more than once + CurReportDocument.xTextDocument.lockControllers(); CurReportDocument.setupRecordSection(CurReportPaths.ReportPath + "/cnt-default.stw"); updateFifthStep(); break; @@ -754,7 +772,7 @@ public class ReportWizard { if (Tools.PathisValid(xMSF, StorePath, sMsgFilePathInvalid, bfinalaskbeforeOverwrite)){ if (bcreateTemplate == true){ CurReportDocument.createReportForm(SOREPORTFORMNAME); - Tools.attachEventCall(CurReportDocument.xTextDocument, "OnNew", "macro:///Tools.Debug.FillDocument()"); //"service:com.sun.star.wizards.report.CallReportWizard?fill" + Tools.attachEventCall(CurReportDocument.xTextDocument, "OnNew", "Script", "service:com.sun.star.wizards.report.CallReportWizard?fill"); buseTemplate = ((Short) CurUNODialog.getPropertyOfDialogControl("optUseTemplate", "State")).shortValue() == (short) 1; CurReportDocument.breakLinkofTextSections(); bDocisStored = Tools.storeDocument(xMSF, CurReportDocument.xComponent , StorePath, "writer_StarOffice_XML_Writer_Template", @@ -770,13 +788,11 @@ public class ReportWizard { CurUNODialog.xDialog.endExecute(); } else{ - if (bcreateTemplate){ + if (bcreateTemplate) CurUNODialog.setFocus("txtSavePath_1"); - } - else{ + else CurUNODialog.setFocus("txtSavePath_2"); } - } break; default: break; @@ -784,7 +800,7 @@ public class ReportWizard { CurReportDocument.unlockallControllers(); if (bSetTitle == true){ if (iPage < PageCount){ - Tools.setUNOPropertyValues(CurUNODialog.DialogModel, new String[]{"Step", "Title"}, new Object[]{ new Integer(iPage + 1), WizardTitle[iPage]}); + Tools.setUNOPropertyValues(CurUNODialog.xDialogModel, new String[]{"Step", "Title"}, new Object[]{ new Integer(iPage + 1), WizardTitle[iPage]}); CurUNODialog.assignPropertyToDialogControl("lblDialogHeader", "Label", WizardHeaderText[iPage]); } } @@ -796,33 +812,37 @@ public class ReportWizard { public void gotoPrevStep(){ try{ - int iPage = AnyConverter.toInt(Tools.getUNOPropertyValue(CurUNODialog.DialogModel, "Step")); + int iPage = AnyConverter.toInt(Tools.getUNOPropertyValue(CurUNODialog.xDialogModel, "Step")); switch (iPage){ case SOTITLEPAGE: scrollTextFieldInfo(ScrollBarValue); - CurReportDocument.CurDBMetaData.OldFieldTitles = CurReportDocument.CurDBMetaData.FieldTitles; + CurReportDocument.CurDBMetaData.OldFieldTitles = Tools.copyStringArray(CurReportDocument.CurDBMetaData.FieldTitles); break; + case SOGROUPPAGE: getGroupFieldNames(CurReportDocument.CurDBMetaData); -// CurReportDocument.CurDBMetaData.OldGroupFieldNames = CurReportDocument.CurDBMetaData.GroupFieldNames; break; + case SOSORTPAGE: - CurReportDocument.CurDBMetaData.OldSortFieldNames = CurReportDocument.CurDBMetaData.SortFieldNames; +// CurReportDocument.CurDBMetaData.OldSortFieldNames = Tools.copyStringArray(CurReportDocument.CurDBMetaData.SortFieldNames); break; + case SOTEMPLATEPAGE: CurReportDocument.removeTextSectionbyName("RecordSection"); CurReportDocument.removeTextTablebyName("Tbl_RecordSection"); break; + case SOSTOREPAGE: CurUNODialog.assignPropertyToDialogControl("cmdGoOn", "Label", scmdGoOn); CurUNODialog.assignPropertyToDialogControl("cmdGoOn", "Enabled", new Boolean(true)); break; + default: break; } CurUNODialog.assignPropertyToDialogControl("cmdBack", "Enabled", new Boolean(iPage > 2)); if (iPage > 1) - Tools.setUNOPropertyValues(CurUNODialog.DialogModel, new String[]{"Step", "Title"}, new Object[]{ new Integer(iPage - 1), WizardTitle[iPage-2]}); + Tools.setUNOPropertyValues(CurUNODialog.xDialogModel, new String[]{"Step", "Title"}, new Object[]{ new Integer(iPage - 1), WizardTitle[iPage-2]}); CurUNODialog.assignPropertyToDialogControl("lblDialogHeader", "Label", WizardHeaderText[iPage-2]); } catch( Exception exception ){ @@ -840,86 +860,131 @@ public class ReportWizard { }} - public void setUpSortList(){ - try{ - short iCurState = 0; - MaxSortIndex = -1; - String CurFieldName; - String CurFieldTitle; - for (int i = 0; i < 4; i++){ - if (xSortListBox[i].getSelectedItemPos() > 0) - MaxSortIndex += 1; - else - break; - } - CurReportDocument.CurDBMetaData.SortFieldNames = new String[MaxSortIndex+1][2]; - for (int i=0; i<=MaxSortIndex; i++){ + public void setupSortList(){ + String CurFieldName; + String CurFieldTitle; + short iCurState; + int a = 0; + CurReportDocument.CurDBMetaData.SortFieldNames = new String[MaxSortIndex+1][2]; + for (int i = 0; i <= MaxSortIndex; i++){ + if (xSortListBox[i].getSelectedItemPos() > 0){ CurFieldTitle = xSortListBox[i].getSelectedItem(); CurFieldName = CurReportDocument.CurDBMetaData.getFieldName(CurFieldTitle); - // Todo: Messagebox in case a sorting criteria is set twice - CurReportDocument.CurDBMetaData.SortFieldNames[i][0] = CurFieldName; iCurState = ((Short) CurUNODialog.getPropertyOfDialogControl("optAscend" + new Integer(i+1).toString(), "State")).shortValue(); + CurReportDocument.CurDBMetaData.SortFieldNames[a][0] = CurFieldName; if (iCurState == 1) - CurReportDocument.CurDBMetaData.SortFieldNames[i][1] = "ASC"; + CurReportDocument.CurDBMetaData.SortFieldNames[a][1] = "ASC"; else - CurReportDocument.CurDBMetaData.SortFieldNames[i][1] = "DESC"; + CurReportDocument.CurDBMetaData.SortFieldNames[a][1] = "DESC"; + a +=1; } } - catch( Exception exception ){ - exception.printStackTrace(System.out); - }} + } + public void enableNextSortListBox(int CurIndex){ try{ + boolean bupdateOldSortValue = true; + short iCurState = 0; + String CurFieldName; + String CurFieldTitle; + short NewItemPos = xSortListBox[CurIndex].getSelectedItemPos(); + if (NewItemPos == bOldSortValues[CurIndex]) + return; + MaxSortIndex = -1; + for (int i = 0; i < 4; i++){ + if (xSortListBox[i].getSelectedItemPos() > 0) + MaxSortIndex += 1; + else + break; + } + CurReportDocument.CurDBMetaData.SortFieldNames = new String[MaxSortIndex+1][2]; short iNextItemPos; - boolean bDoEnable = (xSortListBox[CurIndex].getSelectedItemPos() > 0); // the first Item is for "undefined" + boolean bDoEnable = (NewItemPos > 0); // the first Item is for "undefined" if (bDoEnable == true){ if (CurIndex > MaxSortIndex) MaxSortIndex = CurIndex; } if (bDoEnable == false){ - if (CurIndex < MaxSortIndex){ - for (int i = CurIndex + 1; i <= MAXSORTCRITERIA; i++){ - toggleSortListBox(i, false); - if (i < MaxSortIndex) - xSortListBox[i+1].selectItemPos((short)0,true); + disableListBoxesfromIndex(CurIndex); + } + else{ + toggleSortListBox(CurIndex+1, true); + + for (int i = 0; i <= MaxSortIndex; i++){ + CurFieldTitle = xSortListBox[i].getSelectedItem(); + CurFieldName = CurReportDocument.CurDBMetaData.getFieldName(CurFieldTitle); + if (Tools.FieldInTable(CurReportDocument.CurDBMetaData.SortFieldNames, CurFieldName) == -1){ + CurReportDocument.CurDBMetaData.SortFieldNames[i][0] = CurFieldName; + } + else{ + String NewFieldName = xSortListBox[i].getSelectedItem(); + String sLocSortCriteriaisduplicate = Tools.replaceSubString(sSortCriteriaisduplicate, NewFieldName, "<FIELDNAME>"); + UNODialogs.showMessageBox(xMSF, "WarningBox", com.sun.star.awt.VclWindowPeerAttribute.OK, sLocSortCriteriaisduplicate); + xSortListBox[CurIndex].selectItemPos(bOldSortValues[CurIndex], true); + if (bOldSortValues[CurIndex] == 0){ + disableListBoxesfromIndex(CurIndex); + MaxSortIndex = CurIndex -1; + } + bupdateOldSortValue = false; } } } - else - toggleSortListBox(CurIndex+1, bDoEnable); - // The following code can be reactivated in a future version when task #100799 will be fixed -/* if ((bDoEnable == false) && (MaxSortIndex > CurIndex)){ + if (bupdateOldSortValue == true) + bOldSortValues[CurIndex] = NewItemPos; + } + catch(Exception exception){ + exception.printStackTrace(System.out); + }} + + + public void disableListBoxesfromIndex(int CurIndex){ + if (CurIndex < MAXSORTCRITERIA){ + for (int i = CurIndex + 1; i <= MAXSORTCRITERIA; i++){ + toggleSortListBox(i, (false)); + if (i < MaxSortIndex) + xSortListBox[i+1].selectItemPos((short)0, true); + } + MaxSortIndex = CurIndex-1; + + } + } + + +// The following code can be reactivated in a future version when task #100799 will be fixed + public void moveupSortItems(int CurIndex, boolean bDoEnable){ + short iNextItemPos; + if ((bDoEnable == false) && (MaxSortIndex > CurIndex)){ for (int i= CurIndex; i < MaxSortIndex; i++){ iNextItemPos = xSortListBox[i+1].getSelectedItemPos(); - if (iNextItemPos != 0){ + if (iNextItemPos != 0){ xSortListBox[i].selectItemPos(iNextItemPos,true); xSortListBox[i+1].selectItemPos(iNextItemPos,false); toggleSortListBox(i,true); - xSortListBox[i+1].selectItemPos((short)0,true); + xSortListBox[i+1].selectItemPos((short)0,true); } } -// MaxSortIndex = MaxSortIndex - 1; -// if (MaxSortIndex < xSortListBox.length -2) -// toggleSortListBox(MaxSortIndex + 2, false); + MaxSortIndex = MaxSortIndex - 1; + if (MaxSortIndex < xSortListBox.length -2) + toggleSortListBox(MaxSortIndex + 2, false); } else - toggleSortListBox(CurIndex+1, bDoEnable); */ + toggleSortListBox(CurIndex+1, bDoEnable); } - catch( Exception exception ){ - exception.printStackTrace(System.out); - }} + public void toggleSortListBox(int CurIndex, boolean bDoEnable){ try{ + if (CurIndex < xSortListBox.length){ CurUNODialog.assignPropertyToDialogControl("lblSort" + new Integer(CurIndex+1).toString(), "Enabled", new Boolean(bDoEnable)); CurUNODialog.assignPropertyToDialogControl("lstSort" + new Integer(CurIndex+1).toString(), "Enabled", new Boolean(bDoEnable)); CurUNODialog.assignPropertyToDialogControl("optAscend" + new Integer(CurIndex+1).toString(), "Enabled", new Boolean(bDoEnable)); CurUNODialog.assignPropertyToDialogControl("optDescend" + new Integer(CurIndex+1).toString(), "Enabled", new Boolean(bDoEnable)); if (bDoEnable == false) - xSortListBox[CurIndex].selectItemPos((short)0,true); + xSortListBox[CurIndex].selectItemPos((short)0,true); + } } catch( Exception exception ){ exception.printStackTrace(System.out); @@ -953,8 +1018,8 @@ public class ReportWizard { boolean bStoreAsTemplate = ((Short) CurUNODialog.getPropertyOfDialogControl("optCreateReportTemplate", "State")).shortValue() == (short) 1; if (bStoreAsTemplate == true){ sStorePath = Tools.callStoreDialog(xMSF, CurReportPaths.UserTemplatePath, DefaultName + ".stw", "writer_StarOffice_XML_Writer_Template"); - CurUNODialog.assignPropertyToDialogControl("txtSavePath_1", "Text", sStorePath); if (sStorePath != ""){ + CurUNODialog.assignPropertyToDialogControl("txtSavePath_1", "Text", sStorePath); // As the user has been asked already if the Path exists already and he does not want to be asked again later on when the // document is created we set the flag 'bmodifiedbySaveAsDialog" to true bmodifiedbySaveAsDialog[0] = true; @@ -965,8 +1030,8 @@ public class ReportWizard { } else{ sStorePath = Tools.callStoreDialog(xMSF, CurReportPaths.WorkPath, DefaultName + ".sxw", "StarOffice XML (Writer)"); - CurUNODialog.assignPropertyToDialogControl("txtSavePath_2", "Text", sStorePath); if (sStorePath != ""){ + CurUNODialog.assignPropertyToDialogControl("txtSavePath_2", "Text", sStorePath); bmodifiedbySaveAsDialog[1] = true; baskbeforeOverwrite[1] = false; } @@ -978,22 +1043,22 @@ public class ReportWizard { }} - public void insertSaveControls(int YPos, int Index, boolean bDoEnable, int TabIndex, int BaseHelpID){ + public void insertSaveControls(int YPos, int Index, boolean bDoEnable, int BaseHelpID){ try{ String HIDString; CurUNODialog.insertControlModel("com.sun.star.awt.UnoControlFixedTextModel", "lblSaveAs_" + Integer.toString(Index+1), - new String[] {"Enabled", "Height", "Label", "PositionX", "PositionY", "Step", "Width"}, - new Object[] {new Boolean(bDoEnable), new Integer(8), sSaveAs, new Integer(16), new Integer(YPos), new Integer(SOSTOREPAGE), new Integer(130)}); + new String[] {"Enabled", "Height", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width"}, + new Object[] {new Boolean(bDoEnable), new Integer(8), sSaveAs, new Integer(16), new Integer(YPos), new Integer(SOSTOREPAGE), new Short(CurTabIndex++), new Integer(130)}); HIDString = "HID:" + Integer.toString(BaseHelpID); xSaveTextBox[Index] = CurUNODialog.insertTextField("txtSavePath_" + Integer.toString(Index+1), SOTXTSAVEPATH[Index], new TextListenerImpl(), new String[] {"Enabled", "Height", "HelpURL", "PositionX", "PositionY", "Step", "TabIndex", "Width"}, - new Object[] {new Boolean(bDoEnable), new Integer(12), HIDString, new Integer(16), new Integer(YPos + 10), new Integer(SOSTOREPAGE), new Short((short)TabIndex), new Integer(222)}); + new Object[] {new Boolean(bDoEnable), new Integer(12), HIDString, new Integer(16), new Integer(YPos + 10), new Integer(SOSTOREPAGE), new Short(CurTabIndex++), new Integer(222)}); HIDString = "HID:" + Integer.toString(BaseHelpID+1); CurUNODialog.insertButton("cmdSelectPath_" + Integer.toString(Index+1), SOCMDSELECTPATH[Index], new ActionListenerImpl(), new String[] {"Enabled", "Height", "HelpURL", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width"}, - new Object[] {new Boolean(bDoEnable), new Integer(14), HIDString, "...", new Integer(248), new Integer(YPos + 9), new Integer(SOSTOREPAGE), new Short((short) (TabIndex + 1)), new Integer(16)}); + new Object[] {new Boolean(bDoEnable), new Integer(14), HIDString, "...", new Integer(248), new Integer(YPos + 9), new Integer(SOSTOREPAGE), new Short(CurTabIndex++), new Integer(16)}); } catch( Exception exception ){ exception.printStackTrace(System.out); @@ -1054,31 +1119,31 @@ public class ReportWizard { try{ CurUNODialog.insertRadioButton("optCreateReportTemplate", SOOPTSAVEASTEMPLATE, new ActionListenerImpl(), new String[] {"Height", "HelpURL", "Label", "PositionX", "PositionY", "State", "Step", "TabIndex", "Width"}, - new Object[] {new Integer(8), "HID:34370", sSaveAsTemplate, new Integer(6), new Integer(41), new Short((short) 1), new Integer(SOSTOREPAGE), new Short((short) 40), new Integer(250)}); + new Object[] {new Integer(8), "HID:34370", sSaveAsTemplate, new Integer(6), new Integer(41), new Short((short) 1), new Integer(SOSTOREPAGE), new Short(CurTabIndex++), new Integer(250)}); CurUNODialog.insertRadioButton("optCreateDocument", SOOPTSAVEASDOCUMENT, new ActionListenerImpl(), new String[] {"Height", "HelpURL", "Label", "PositionX", "PositionY", "State", "Step", "TabIndex", "Width"}, - new Object[] {new Integer(10), "HID:34371", sSaveAsDocument, new Integer(6), new Integer(125), new Short((short) 0), new Integer(SOSTOREPAGE), new Short((short) 41), new Integer(138)}); + new Object[] {new Integer(10), "HID:34371", sSaveAsDocument, new Integer(6), new Integer(125), new Short((short) 0), new Integer(SOSTOREPAGE), new Short(CurTabIndex++), new Integer(138)}); - insertSaveControls(55, 0, true, 42, 34372); + insertSaveControls(55, 0, true, 34372); CurUNODialog.insertRadioButton("optEditTemplate", SOOPTEDITTEMPLATE, new ActionListenerImpl(), new String[] {"Height", "HelpURL", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width"}, - new Object[] {new Integer(10), "HID:34374", sEditTemplate, new Integer(16), new Integer(84), new Integer(6), new Short((short) 44), new Integer(138)}); + new Object[] {new Integer(10), "HID:34374", sEditTemplate, new Integer(16), new Integer(84), new Integer(6), new Short(CurTabIndex++), new Integer(138)}); CurUNODialog.insertRadioButton("optUseTemplate", SOOPTUSEDOCUMENT, new ActionListenerImpl(), new String[] {"Height", "HelpURL", "Label", "PositionX", "PositionY", "State", "Step", "TabIndex", "Width"}, - new Object[] {new Integer(10), "HID:34375", sUseTemplate, new Integer(16), new Integer(95), new Short((short) 1), new Integer(SOSTOREPAGE), new Short((short) 45), new Integer(138)}); + new Object[] {new Integer(10), "HID:34375", sUseTemplate, new Integer(16), new Integer(95), new Short((short) 1), new Integer(SOSTOREPAGE), new Short(CurTabIndex++), new Integer(138)}); CurUNODialog.insertControlModel("com.sun.star.awt.UnoControlFixedTextModel", "lblAutomaticLink", new String[] {"Height", "Label", "PositionX", "PositionY", "Step", "Width"}, new Object[] {new Integer(8), sCreateLinkAutomatically, new Integer(16), new Integer(108), new Integer(SOSTOREPAGE), new Integer(200)}); - insertSaveControls(140, 1, false, 46, 34376); + insertSaveControls(140, 1, false, 34376); chkTemplate = CurUNODialog.insertControlModel("com.sun.star.awt.UnoControlCheckBoxModel", "chkcreateLink", new String[] {"Enabled", "Height", "HelpURL", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width"}, - new Object[] {new Boolean(false), new Integer(8), "HID:34378", sCreateLink, new Integer(16), new Integer(170), new Integer(SOSTOREPAGE), new Short((short) 48), new Integer(130)}); + new Object[] {new Boolean(false), new Integer(8), "HID:34378", sCreateLink, new Integer(16), new Integer(170), new Integer(SOSTOREPAGE), new Short(CurTabIndex++), new Integer(130)}); } catch( Exception exception ){ exception.printStackTrace(System.out); @@ -1088,48 +1153,52 @@ public class ReportWizard { public void fillFifthStep(){ try{ CurUNODialog.insertControlModel("com.sun.star.awt.UnoControlFixedTextModel", "lblTitle", - new String[] {"Height", "Label", "PositionX", "PositionY", "Step", "Width"}, - new Object[] {new Integer(8), sReportTitle, new Integer(6), new Integer(40), new Integer(SOTEMPLATEPAGE), new Integer(200)}); + new String[] {"Height", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width"}, + new Object[] {new Integer(8), sReportTitle, new Integer(6), new Integer(40), new Integer(SOTEMPLATEPAGE), new Short(CurTabIndex++), new Integer(200)}); xTitleTextBox = CurUNODialog.insertTextField("txtTitle", SOTXTTITLE, new TextListenerImpl(), new String[] {"Height", "HelpURL", "PositionX", "PositionY", "Step", "TabIndex", "Width"}, - new Object[] {new Integer(12), "HID:34362", new Integer(6), new Integer(50), new Integer(SOTEMPLATEPAGE), new Short((short)31), new Integer(258)}); - + new Object[] {new Integer(12), "HID:34362", new Integer(6), new Integer(50), new Integer(SOTEMPLATEPAGE), new Short(CurTabIndex++), new Integer(258)}); CurUNODialog.insertControlModel("com.sun.star.awt.UnoControlFixedTextModel", "lblContent", - new String[] {"Height", "Label", "PositionX", "PositionY", "Step", "Width"}, - new Object[] {new Integer(8), slblDataStructure, new Integer(6), new Integer(70), new Integer(SOTEMPLATEPAGE), new Integer(125)}); + new String[] {"Height", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width"}, + new Object[] {new Integer(8), slblDataStructure, new Integer(6), new Integer(70), new Integer(SOTEMPLATEPAGE), new Short(CurTabIndex++), new Integer(125)}); short iSelPos = (short) Tools.FieldInList(CurReportPaths.ContentFiles[1], CurReportPaths.ReportPath + "/cnt-default.stw"); iOldContentPos = (int) iSelPos; xContentListBox = CurUNODialog.insertListBox("lstContent", SOCONTENTLST, new ActionListenerImpl(), new ItemListenerImpl(), new String[] {"Height", "HelpURL", "PositionX", "PositionY", "SelectedItems", "Step", "StringItemList", "TabIndex", "Width"}, - new Object[] {new Integer(63), "HID:34363", new Integer(6), new Integer(80), new short[] {iSelPos}, new Integer(SOTEMPLATEPAGE), CurReportPaths.ContentFiles[0], new Short((short)32), new Integer(125)}); + new Object[] {new Integer(63), "HID:34363", new Integer(6), new Integer(80), new short[] {iSelPos}, new Integer(SOTEMPLATEPAGE), CurReportPaths.ContentFiles[0], new Short(CurTabIndex++), new Integer(125)}); CurUNODialog.insertControlModel("com.sun.star.awt.UnoControlFixedTextModel", "lblLayout", - new String[] {"Height", "Label", "PositionX", "PositionY", "Step", "Width"}, - new Object[] {new Integer(8), slblPageLayout, new Integer(140), new Integer(70), new Integer(SOTEMPLATEPAGE), new Integer(125)}); + new String[] {"Height", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width"}, + new Object[] {new Integer(8), slblPageLayout, new Integer(140), new Integer(70), new Integer(SOTEMPLATEPAGE), new Short(CurTabIndex++), new Integer(125)}); short iSelLayoutPos = (short) Tools.FieldInList(CurReportPaths.LayoutFiles[1], CurReportPaths.ReportPath + "/stl-default.stw"); xLayoutListBox = CurUNODialog.insertListBox("lstLayout", SOLAYOUTLST, new ActionListenerImpl(), new ItemListenerImpl(), new String[] {"Height", "HelpURL", "PositionX", "PositionY", "SelectedItems", "Step", "StringItemList", "TabIndex", "Width"}, - new Object[] {new Integer(63), "HID:34364", new Integer(140), new Integer(80), new short[] {iSelLayoutPos}, new Integer(SOTEMPLATEPAGE), CurReportPaths.LayoutFiles[0], new Short((short)33), new Integer(125)}); + new Object[] {new Integer(63), "HID:34364", new Integer(140), new Integer(80), new short[] {iSelLayoutPos}, new Integer(SOTEMPLATEPAGE), CurReportPaths.LayoutFiles[0], new Short(CurTabIndex++), new Integer(125)}); iOldLayoutPos = (int) iSelPos; CurUNODialog.insertControlModel("com.sun.star.awt.UnoControlFixedTextModel", "lblOrientation", - new String[] {"Height", "Label", "PositionX", "PositionY", "Step", "Width"}, - new Object[] {new Integer(8), sOrientationHeader, new Integer(6), new Integer(149), new Integer(SOTEMPLATEPAGE), new Integer(74)}); + new String[] {"Height", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width"}, + new Object[] {new Integer(8), sOrientationHeader, new Integer(6), new Integer(149), new Integer(SOTEMPLATEPAGE), new Short(CurTabIndex++), new Integer(74)}); CurUNODialog.insertRadioButton("optLandscape", SOOPTLANDSCAPE, new ActionListenerImpl(), new String[] {"Height", "HelpURL", "Label", "PositionX", "PositionY", "State", "Step", "TabIndex", "Width"}, - new Object[] {new Integer(10), "HID:34365", sOrientHorizontal, new Integer(12), new Integer(160), new Short((short) 1), new Integer(SOTEMPLATEPAGE), new Short((short)34), new Integer(60)}); + new Object[] {new Integer(10), "HID:34365", sOrientHorizontal, new Integer(12), new Integer(160), new Short((short) 1), new Integer(SOTEMPLATEPAGE), new Short(CurTabIndex++), new Integer(60)}); CurUNODialog.insertRadioButton("optPortrait", SOOPTPORTRAIT, new ActionListenerImpl(), new String[] {"Height", "HelpURL", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width"}, - new Object[] {new Integer(10), "HID:34366", sOrientVertical, new Integer(12), new Integer(173), new Integer(SOTEMPLATEPAGE), new Short((short)35), new Integer(60)}); + new Object[] {new Integer(10), "HID:34366", sOrientVertical, new Integer(12), new Integer(173), new Integer(SOTEMPLATEPAGE), new Short(CurTabIndex++), new Integer(60)}); CurUNODialog.insertControlModel("com.sun.star.awt.UnoControlImageControlModel", "imgOrientation", new String[] {"Border", "Height", "ImageURL", "PositionX", "PositionY", "ScaleImage", "Step", "Width"}, new Object[] {new Short("0"), new Integer(23), CurReportPaths.BitmapPath + "/landscape.gif", new Integer(80), new Integer(158), new Boolean(false), new Integer(SOTEMPLATEPAGE), new Integer(30)}); + + CurUNODialog.insertControlModel("com.sun.star.awt.UnoControlFixedTextModel", "lblBlindTextNote_2", + new String[] {"Height", "Label", "MultiLine", "PositionX", "PositionY", "Step", "Width"}, + new Object[] {new Integer(34), sBlindTextNote, new Boolean(true), new Integer(140), new Integer(149), new Integer(SOTEMPLATEPAGE), new Integer(125)}); + } catch( Exception exception ){ exception.printStackTrace(System.out); @@ -1147,10 +1216,14 @@ public class ReportWizard { boolean bIsSame = CurDBMetaData.MainCommandName.equals(CurDBMetaData.OldMainCommandName) && (CurDBMetaData.MainCommandName != null); if (bIsSame == true) bIsSame = Arrays.equals(CurDBMetaData.FieldNames, CurDBMetaData.OldFieldNames) && (CurDBMetaData.FieldNames != null); - if ((bIsSame == true) && (iStep >= 2)) + if ((bIsSame == true) && (iStep >= 2)){ bIsSame = Arrays.equals(CurDBMetaData.FieldTitles, CurDBMetaData.OldFieldTitles) && (CurDBMetaData.FieldTitles != null); - if ((bIsSame == true) && (iStep >= 3)) + CurDBMetaData.OldFieldTitles = Tools.copyStringArray(CurDBMetaData.FieldTitles); + } + if ((bIsSame == true) && (iStep >= 3)){ bIsSame = Arrays.equals(CurDBMetaData.GroupFieldNames, CurDBMetaData.OldGroupFieldNames) && (CurDBMetaData.GroupFieldNames != null); + CurDBMetaData.OldGroupFieldNames = Tools.copyStringArray(CurDBMetaData.GroupFieldNames); + } if ((bIsSame == true) && (iStep >= 4)) bIsSame = Arrays.equals(CurDBMetaData.SortFieldNames, CurDBMetaData.OldSortFieldNames) && (CurDBMetaData.SortFieldNames != null); return !bIsSame; @@ -1169,7 +1242,6 @@ public class ReportWizard { String CurFieldTitle; CurUNODialog.setFocus("lstSort1"); if (checkIfToupdateStep(CurReportDocument.CurDBMetaData, 3) == true){ - CurDBMetaData.OldGroupFieldNames = CurDBMetaData.GroupFieldNames; getGroupFieldNames(CurDBMetaData); int FieldCount = CurDBMetaData.FieldNames.length; int SortFieldCount = FieldCount + 1 - CurDBMetaData.GroupFieldNames.length; @@ -1196,6 +1268,7 @@ public class ReportWizard { else{ SelList = new short[] {(short) 0}; } + bOldSortValues[i] = SelList[0]; if (i > 1) toggleSortListBox(i, (false)); CurUNODialog.assignPropertyToDialogControl("lstSort" + new Integer(i+1).toString(), "StringItemList", ViewSortFieldNames); @@ -1218,23 +1291,23 @@ public class ReportWizard { for (int i = 0; i<4; i++){ bDoEnable = (i < 2); CurUNODialog.insertControlModel("com.sun.star.awt.UnoControlFixedLineModel", "lblSort" + new Integer(i+1), - new String[] {"Enabled", "Height", "Label", "Orientation", "PositionX", "PositionY", "Step", "Width"}, - new Object[] {new Boolean(bDoEnable), new Integer(8), sSortHeader[i], new Integer(0), new Integer(12), new Integer(YPos), new Integer(4), new Integer(252)}); + new String[] {"Enabled", "Height", "Label", "Orientation", "PositionX", "PositionY", "Step", "TabIndex", "Width"}, + new Object[] {new Boolean(bDoEnable), new Integer(8), sSortHeader[i], new Integer(0), new Integer(12), new Integer(YPos), new Integer(4), new Short(CurTabIndex ++), new Integer(252)}); HIDString = "HID:" + Integer.toString(BaseHelpID); xSortListBox[i] = CurUNODialog.insertListBox("lstSort" + new Integer(i+1).toString(), SOSORTLST[i], new ActionListenerImpl(), new ItemListenerImpl(), new String[] {"Dropdown", "Enabled", "Height", "HelpURL", "LineCount", "Name", "PositionX", "PositionY", "Step", "TabIndex", "Width"}, - new Object[] {new Boolean(true), new Boolean(bDoEnable), new Integer(12), HIDString, new Short("7"), "lstSort" + new Integer(i+1), new Integer(12), new Integer(YPos + 14), new Integer(SOSORTPAGE), new Short((short) (17+i*4)), new Integer(154)}); + new Object[] {new Boolean(true), new Boolean(bDoEnable), new Integer(12), HIDString, new Short("7"), "lstSort" + new Integer(i+1), new Integer(12), new Integer(YPos + 14), new Integer(SOSORTPAGE), new Short(CurTabIndex++), new Integer(154)}); //new Short((short) (17+i*4)) HIDString = "HID:" + Integer.toString(BaseHelpID+1); CurUNODialog.insertRadioButton("optAscend" + Integer.toString(i+1), SOSORTASCENDOPT[i], new ActionListenerImpl(), new String[] {"Enabled", "Height", "HelpURL", "Label", "PositionX", "PositionY", "State", "Step", "TabIndex", "Tag", "Width"}, - new Object[] {new Boolean(bDoEnable), new Integer(10), HIDString, sSortAscend[i], new Integer(186), new Integer(YPos+10), new Short((short) 1), new Integer(SOSORTPAGE), new Short((short) (18+i*4)), new String("ASC"), new Integer(65)}); + new Object[] {new Boolean(bDoEnable), new Integer(10), HIDString, sSortAscend[i], new Integer(186), new Integer(YPos+10), new Short((short) 1), new Integer(SOSORTPAGE), new Short(CurTabIndex++), new String("ASC"), new Integer(65)}); //, new Short((short) (18+i*4)) HIDString = "HID:" + Integer.toString(BaseHelpID+2); CurUNODialog.insertRadioButton("optDescend" + Integer.toString(i+1), SOSORTDESCENDOPT[i], new ActionListenerImpl(), new String[] {"Enabled", "Height", "HelpURL", "Label", "PositionX", "PositionY", "State", "Step", "TabIndex", "Tag", "Width"}, - new Object[] {new Boolean(bDoEnable), new Integer(10), HIDString, sSortDescend[i], new Integer(186), new Integer(YPos+24), new Short((short) 0), new Integer(SOSORTPAGE), new Short((short) (19+i*4)), new String("DESC"), new Integer(65)}); + new Object[] {new Boolean(bDoEnable), new Integer(10), HIDString, sSortDescend[i], new Integer(186), new Integer(YPos+24), new Short((short) 0), new Integer(SOSORTPAGE), new Short(CurTabIndex++), new String("DESC"), new Integer(65)}); //, new Short((short) (19+i*4)) YPos = YPos + 36; BaseHelpID += 3; } @@ -1247,23 +1320,29 @@ public class ReportWizard { public void fillThirdStep(){ try{ CurUNODialog.insertControlModel("com.sun.star.awt.UnoControlFixedTextModel", "lblGroups", - new String[] {"Height", "Label", "PositionX", "PositionY", "Step", "Width"}, - new Object[] {new Integer(8), sOrganizeFields, new Integer(6), new Integer(38), new Integer(SOGROUPPAGE), new Integer(100)}); + new String[] {"Height", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width"}, + new Object[] {new Integer(8), sOrganizeFields, new Integer(6), new Integer(38), new Integer(SOGROUPPAGE), new Short(CurTabIndex++), new Integer(100)}); xGroupListBox = CurUNODialog.insertListBox("lstGroup", SOGROUPLST, new ActionListenerImpl(), new ItemListenerImpl(), new String[] {"Height", "HelpURL", "MultiSelection", "PositionX", "PositionY", "Step", "TabIndex", "Width"}, - new Object[] {new Integer(125), "HID:34340", new Boolean(false), new Integer(6), new Integer(49), new Integer(SOGROUPPAGE), new Short((short) 11), new Integer(110)}); - CurUNODialog.insertControlModel("com.sun.star.awt.UnoControlFixedTextModel", "lblSelGroups", - new String[] {"Height", "Label", "PositionX", "PositionY", "Step", "Width"}, - new Object[] {new Integer(8), sGroupings, new Integer(154), new Integer(38), new Integer(SOGROUPPAGE), new Integer(100)}); - xSelGroupListBox = CurUNODialog.insertListBox("lstSelGroup", SOSELGROUPLST, new ActionListenerImpl(), new ItemListenerImpl(), - new String[] {"Height", "HelpURL", "MultiSelection", "PositionX", "PositionY", "Step", "TabIndex", "Width"}, - new Object[] {new Integer(125), "HID:34343", new Boolean(true), new Integer(154), new Integer(49), new Integer(SOGROUPPAGE), new Short((short) 12), new Integer(110)}); + new Object[] {new Integer(115), "HID:34340", new Boolean(false), new Integer(6), new Integer(49), new Integer(SOGROUPPAGE), new Short(CurTabIndex++), new Integer(110)}); + CurUNODialog.insertButton("cmdGroupOut", SOCMDGROUPOUT, new ActionListenerImpl(), new String[] {"Enabled", "Height", "HelpURL", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width"}, - new Object[] {new Boolean(false), new Integer(14), "HID:34341", "->", new Integer(122), new Integer(93), new Integer(SOGROUPPAGE), new Short((short) 13), new Integer(25)}); + new Object[] {new Boolean(false), new Integer(14), "HID:34341", "->", new Integer(122), new Integer(90), new Integer(SOGROUPPAGE), new Short(CurTabIndex++), new Integer(25)}); CurUNODialog.insertButton("cmdGroupIn", SOCMDGROUPIN, new ActionListenerImpl(), new String[] {"Enabled", "Height", "HelpURL", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width"}, - new Object[] {new Boolean(false), new Integer(14), "HID:34342", "<-", new Integer(122), new Integer(115), new Integer(SOGROUPPAGE), new Short((short) 14), new Integer(25)}); + new Object[] {new Boolean(false), new Integer(14), "HID:34342", "<-", new Integer(122), new Integer(110), new Integer(SOGROUPPAGE), new Short(CurTabIndex++), new Integer(25)}); + + CurUNODialog.insertControlModel("com.sun.star.awt.UnoControlFixedTextModel", "lblSelGroups", + new String[] {"Height", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width"}, + new Object[] {new Integer(8), sGroupings, new Integer(154), new Integer(38), new Integer(SOGROUPPAGE), new Short(CurTabIndex++), new Integer(100)}); + xSelGroupListBox = CurUNODialog.insertListBox("lstSelGroup", SOSELGROUPLST, new ActionListenerImpl(), new ItemListenerImpl(), + new String[] {"Height", "HelpURL", "MultiSelection", "PositionX", "PositionY", "Step", "TabIndex", "Width"}, + new Object[] {new Integer(115), "HID:34343", new Boolean(false), new Integer(154), new Integer(49), new Integer(SOGROUPPAGE), new Short(CurTabIndex++), new Integer(110)}); + + CurUNODialog.insertControlModel("com.sun.star.awt.UnoControlFixedTextModel", "lblBlindTextNote_1", + new String[] {"Enabled", "Height", "Label", "MultiLine", "PositionX", "PositionY", "Step", "Width"}, + new Object[] {new Boolean(false), new Integer(18), sBlindTextNote, new Boolean(true), new Integer(6), new Integer(168), new Integer(SOGROUPPAGE), new Integer(258)}); } catch( Exception exception ){ exception.printStackTrace(System.out); @@ -1326,7 +1405,7 @@ public class ReportWizard { XScrollBar xTitleScrollBar; ScrollBarValue = 0; CurDBMetaData.initializeFields(xSelFieldsListBox.getItems(), true); - CurDBMetaData.OldFieldTitles = CurDBMetaData.FieldTitles; + CurDBMetaData.OldFieldTitles = Tools.copyStringArray(CurDBMetaData.FieldTitles); boolean bDoEnableScrollBar = CurDBMetaData.FieldCount > UITextFieldCount; CurUNODialog.assignPropertyToDialogControl("TitleScrollBar", "Enabled", new Boolean(bDoEnableScrollBar)); if (bDoEnableScrollBar){ @@ -1360,6 +1439,7 @@ public class ReportWizard { XScrollBar xTitleScrollBar; int LabelHeight = 6 + (UITextFieldCount) * 18; int ScrollHeight = LabelHeight-2; + CurTabIndex = 13; CurUNODialog.insertControlModel("com.sun.star.awt.UnoControlFixedTextModel", "lblColumnNames", new String[] {"Height", "Label", "PositionX", "PositionY", "Step", "Width"}, new Object[] {new Integer(8), slblColumnNames, new Integer(12), new Integer(YStartPos - 16), new Integer(SOTITLEPAGE), new Integer(68)}); @@ -1374,12 +1454,12 @@ public class ReportWizard { for (short i=0; i<UITextFieldCount; i++){ CurUNODialog.insertControlModel("com.sun.star.awt.UnoControlFixedTextModel", "lblColumnName_" + Integer.toString(i+1), - new String[] {"Height", "PositionX", "PositionY", "Step", "Width"}, - new Object[] {new Integer(8), new Integer(12), new Integer(YPos+2), new Integer(SOTITLEPAGE), new Integer(68)}); + new String[] {"Height", "PositionX", "PositionY", "Step", "TabIndex", "Width"}, + new Object[] {new Integer(8), new Integer(12), new Integer(YPos+2), new Integer(SOTITLEPAGE), new Short(CurTabIndex++), new Integer(68)}); CurUNODialog.insertTextField("txtTitleName_" + Integer.toString(i+1), SOTXTCOLTITLE, new TextListenerImpl(), - new String[] {"Height", "HelpURL", "PositionX", "PositionY", "Step", "Width"}, - new Object[] {new Integer(12), "HID:" + String.valueOf(HelpID), new Integer(90), new Integer(YPos), new Integer(SOTITLEPAGE), new Integer(152)}); + new String[] {"Height", "HelpURL", "PositionX", "PositionY", "Step", "TabIndex", "Width"}, + new Object[] {new Integer(12), "HID:" + String.valueOf(HelpID), new Integer(90), new Integer(YPos), new Integer(SOTITLEPAGE), new Short(CurTabIndex++), new Integer(152)}); YPos +=18; HelpID += 1; } @@ -1397,7 +1477,7 @@ public class ReportWizard { }} - public void fillFirstStep(ReportDocument CurReportDocument, String[] DatabaseNames, Object[] CurPropertyValue, DBMetaData CurDBMetaData) + public void fillFirstStep(ReportDocument CurReportDocument, Object[] CurPropertyValue, DBMetaData CurDBMetaData) // Scenario 1. No parameters are given // MainWithDefault() @@ -1421,21 +1501,25 @@ public class ReportWizard { short iSelCommandPos; com.sun.star.awt.FontDescriptor oFontDesc = new com.sun.star.awt.FontDescriptor(); oFontDesc.Weight = com.sun.star.awt.FontWeight.BOLD; + CurUNODialog.insertControlModel("com.sun.star.awt.UnoControlFixedTextModel", "lblBinaryFields", + new String[] {"Height", "Label", "PositionX", "PositionY", "Step", "Width"}, + new Object[] {new Integer(16), sShowBinaryFields, new Integer(6), new Integer(162), new Integer(SOMAINPAGE), new Integer(210)}); + Object oHeaderLabel = CurUNODialog.insertControlModel("com.sun.star.awt.UnoControlFixedTextModel", "lblDialogHeader", new String[] {"BackgroundColor", "FontDescriptor", "Height", "Label", "MultiLine", "PositionX", "PositionY", "Step", "Width"}, new Object[] {new Integer(16777215), oFontDesc, new Integer(30), WizardHeaderText[0], new Boolean(true), new Integer(50), new Integer(SONULLPAGE), new Integer(0), new Integer(220)}); CurUNODialog.insertButton("cmdCancel", SOCMDCANCEL, new ActionListenerImpl(), new String[] {"Height", "HelpURL", "Label", "PositionX", "PositionY", "PushButtonType", "Step", "TabIndex", "Width"}, - new Object[] {new Integer(14), "HID:34321", scmdCancel, new Integer(6), new Integer(190), new Short((short)com.sun.star.awt.PushButtonType.CANCEL_value), new Integer(SONULLPAGE), new Short((short) 60), new Integer(53)}); + new Object[] {new Integer(14), "HID:34321", scmdCancel, new Integer(6), new Integer(190), new Short((short)com.sun.star.awt.PushButtonType.CANCEL_value), new Integer(SONULLPAGE), new Short((short) 70), new Integer(53)}); CurUNODialog.insertButton("cmdHelp", SOCMDHELP, new ActionListenerImpl(), new String[] {"Height", "Label", "PositionX", "PositionY", "PushButtonType", "Step", "TabIndex", "Width"}, - new Object[] {new Integer(14), scmdHelp, new Integer(63), new Integer(190), new Short((short)com.sun.star.awt.PushButtonType.HELP_value), new Integer(SONULLPAGE), new Short((short) 61), new Integer(53)}); + new Object[] {new Integer(14), scmdHelp, new Integer(63), new Integer(190), new Short((short)com.sun.star.awt.PushButtonType.HELP_value), new Integer(SONULLPAGE), new Short((short) 71), new Integer(53)}); CurUNODialog.insertButton("cmdBack", SOCMDBACK, new ActionListenerImpl(), new String[] {"Enabled", "Height", "HelpURL", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width"}, - new Object[] {new Boolean(false), new Integer(14), "HID:34322", scmdBack, new Integer(155), new Integer(190), new Integer(SONULLPAGE), new Short((short) 62), new Integer(53)}); + new Object[] {new Boolean(false), new Integer(14), "HID:34322", scmdBack, new Integer(155), new Integer(190), new Integer(SONULLPAGE), new Short((short) 72), new Integer(53)}); CurUNODialog.insertControlModel("com.sun.star.awt.UnoControlFixedLineModel", "hlnCommandButtons", new String[] {"Height", "Label", "Orientation", "PositionX", "PositionY", "Step", "Width"}, @@ -1443,71 +1527,68 @@ public class ReportWizard { CurUNODialog.insertButton("cmdMoveSelected", SOCMDMOVESEL, new ActionListenerImpl(), new String[] {"Enabled", "Height", "HelpURL", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width"}, - new Object[] {new Boolean(false), new Integer(14), "HID:34334", "->", new Integer(122), new Integer(84), new Integer(SOMAINPAGE), new Short((short) 4), new Integer(25)}); + new Object[] {new Boolean(false), new Integer(14), "HID:34334", "->", new Integer(122), new Integer(84), new Integer(SOMAINPAGE), new Short((short) 8), new Integer(25)}); CurUNODialog.insertButton("cmdMoveAll", SOCMDMOVEALL, new ActionListenerImpl(), new String[] {"Enabled", "Height", "HelpURL", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width"}, - new Object[] {new Boolean(false), new Integer(14), "HID:34335", "=>>", new Integer(122), new Integer(102), new Integer(SOMAINPAGE), new Short((short) 5), new Integer(25)}); + new Object[] {new Boolean(false), new Integer(14), "HID:34335", "=>>", new Integer(122), new Integer(102), new Integer(SOMAINPAGE), new Short((short) 9), new Integer(25)}); CurUNODialog.insertButton("cmdRemoveSelected", SOCMDREMOVESEL, new ActionListenerImpl(), new String[] {"Enabled", "Height", "HelpURL", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width"}, - new Object[] {new Boolean(false), new Integer(14), "HID:34336", "<-", new Integer(122), new Integer(120), new Integer(SOMAINPAGE), new Short((short) 6), new Integer(25)}); + new Object[] {new Boolean(false), new Integer(14), "HID:34336", "<-", new Integer(122), new Integer(120), new Integer(SOMAINPAGE), new Short((short) 10), new Integer(25)}); CurUNODialog.insertButton("cmdRemoveAll", SOCMDREMOVEALL, new ActionListenerImpl(), new String[] {"Enabled", "Height", "HelpURL", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width"}, - new Object[] {new Boolean(false), new Integer(14), "HID:34337", "<<=", new Integer(122), new Integer(138), new Integer(SOMAINPAGE), new Short((short) 7), new Integer(25)}); - - CurUNODialog.insertControlModel("com.sun.star.awt.UnoControlFixedTextModel", "lblDatabases", - new String[] {"Height", "Label", "PositionX", "PositionY", "Step", "Width"}, - new Object[] {new Integer(8), slblDatabases, new Integer(6), new Integer(39), new Integer(SOMAINPAGE), new Integer(74)}); - - CurUNODialog.insertControlModel("com.sun.star.awt.UnoControlFixedTextModel", "lblTables", - new String[] {"Enabled", "Height", "Label", "PositionX", "PositionY", "Step", "Width"}, - new Object[] {new Boolean(false), new Integer(8), slblTables, new Integer(122), new Integer(39), new Integer(SOMAINPAGE), new Integer(72)}); - - CurUNODialog.insertControlModel("com.sun.star.awt.UnoControlFixedTextModel", "lblFields", - new String[] {"Enabled", "Height", "Label", "PositionX", "PositionY", "Step", "Width"}, - new Object[] {new Boolean(false), new Integer(8), slblFields, new Integer(6), new Integer(69), new Integer(SOMAINPAGE), new Integer(109)}); - - CurUNODialog.insertControlModel("com.sun.star.awt.UnoControlFixedTextModel", "lblSelFields", - new String[] {"Enabled", "Height", "Label", "PositionX", "PositionY", "Step", "Width"}, - new Object[] {new Boolean(false), new Integer(8), slblSelFields, new Integer(154), new Integer(69), new Integer(SOMAINPAGE), new Integer(110)}); + new Object[] {new Boolean(false), new Integer(14), "HID:34337", "<<=", new Integer(122), new Integer(138), new Integer(SOMAINPAGE), new Short((short) 11), new Integer(25)}); CurUNODialog.insertControlModel("com.sun.star.awt.UnoControlImageControlModel", "imgTheme", new String[] {"BackgroundColor", "Border", "Height", "ImageURL", "PositionX", "PositionY", "ScaleImage", "Step", "Width"}, new Object[] {new Integer(16777215), new Short("0"), new Integer(30), CurReportPaths.BitmapPath + "/report.bmp", new Integer(0), new Integer(SONULLPAGE), new Boolean(false), new Integer(0), new Integer(50)}); + if (CurPropertyValue == null) - LocDBList = UNODialogs.combineListboxList(slstDatabasesDefaultText, CurReportDocument.CurDBMetaData.getDatabaseNames()); + LocDBList = UNODialogs.combineListboxList(slstDatabasesDefaultText, CurReportDocument.CurDBMetaData.DataSourceNames); else - LocDBList = CurReportDocument.CurDBMetaData.getDatabaseNames(); - xDBListBox = CurUNODialog.insertListBox("lstDatabases", SODBLST, new ActionListenerImpl(), new ItemListenerImpl(), + LocDBList = CurReportDocument.CurDBMetaData.DataSourceNames; + bDataSourceIsSelected[0] = true; + CurUNODialog.insertControlModel("com.sun.star.awt.UnoControlFixedTextModel", "lblDatabases", + new String[] {"Height", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width"}, + new Object[] {new Integer(8), slblDatabases, new Integer(6), new Integer(39), new Integer(SOMAINPAGE), new Short((short) 1), new Integer(74)}); + xDBListBox = CurUNODialog.insertListBox("lstDatabases", SODBLST, null, new ItemListenerImpl(), new String[] {"Dropdown", "Height", "HelpURL", "LineCount", "Name", "PositionX", "PositionY", "Step", "StringItemList", "TabIndex", "Width"}, - new Object[] {new Boolean(true), new Integer(12), "HID:34330", new Short("7"), "lstDatabases", new Integer(6), new Integer(49), new Integer(SOMAINPAGE), LocDBList, new Short((short) 1), new Integer(110)}); + new Object[] {new Boolean(true), new Integer(12), "HID:34330", new Short("7"), "lstDatabases", new Integer(6), new Integer(49), new Integer(SOMAINPAGE), LocDBList, new Short((short) 2), new Integer(110)}); XWindow xDBListBoxWindow = (XWindow) UnoRuntime.queryInterface(XWindow.class, xDBListBox); xDBListBoxWindow.addMouseListener(new MouseListenerImpl()); - xTableListBox = CurUNODialog.insertListBox("lstTables", SOTBLLST, new ActionListenerImpl(), new ItemListenerImpl(), + + CurUNODialog.insertControlModel("com.sun.star.awt.UnoControlFixedTextModel", "lblTables", + new String[] {"Enabled", "Height", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width"}, + new Object[] {new Boolean(false), new Integer(8), slblTables, new Integer(122), new Integer(39), new Integer(SOMAINPAGE), new Short((short) 3), new Integer(72)}); + xTableListBox = CurUNODialog.insertListBox("lstTables", SOTBLLST, null, new ItemListenerImpl(), new String[] {"Dropdown", "Enabled", "Height", "HelpURL", "LineCount", "PositionX", "PositionY", "Step", "TabIndex", "Width"}, - new Object[] {new Boolean(true), new Boolean(false), new Integer(12), "HID:34331", new Short("7"), new Integer(122), new Integer(49), new Integer(SOMAINPAGE), new Short((short) 2), new Integer(142)}); + new Object[] {new Boolean(true), new Boolean(false), new Integer(12), "HID:34331", new Short("7"), new Integer(122), new Integer(49), new Integer(SOMAINPAGE), new Short((short) 4), new Integer(142)}); XWindow xTableListBoxWindow = (XWindow) UnoRuntime.queryInterface(XWindow.class, xTableListBox); xTableListBoxWindow.addMouseListener(new MouseListenerImpl()); + CurUNODialog.insertControlModel("com.sun.star.awt.UnoControlFixedTextModel", "lblFields", + new String[] {"Enabled", "Height", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width"}, + new Object[] {new Boolean(false), new Integer(8), slblFields, new Integer(6), new Integer(69), new Integer(SOMAINPAGE), new Short((short) 5), new Integer(109)}); xFieldsListBox = CurUNODialog.insertListBox("lstFields", SOFLDSLST, new ActionListenerImpl(), new ItemListenerImpl(), new String[] {"Enabled", "Height", "HelpURL", "MultiSelection", "PositionX", "PositionY", "Step", "TabIndex", "Width"}, - new Object[] {new Boolean(false), new Integer(77), "HID:34332", new Boolean(true), new Integer(6), new Integer(79), new Integer(SOMAINPAGE), new Short((short) 3), new Integer(110)}); + new Object[] {new Boolean(false), new Integer(77), "HID:34332", new Boolean(true), new Integer(6), new Integer(79), new Integer(SOMAINPAGE), new Short((short) 6), new Integer(110)}); + + CurUNODialog.insertControlModel("com.sun.star.awt.UnoControlFixedTextModel", "lblSelFields", + new String[] {"Enabled", "Height", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width"}, + new Object[] {new Boolean(false), new Integer(8), slblSelFields, new Integer(154), new Integer(69), new Integer(SOMAINPAGE), new Short((short) 12), new Integer(110)}); xSelFieldsListBox = CurUNODialog.insertListBox("lstSelFields", SOSELFLDSLST, new ActionListenerImpl(), new ItemListenerImpl(), new String[] {"Enabled", "Height", "HelpURL", "MultiSelection", "PositionX", "PositionY", "Step", "TabIndex", "Width"}, - new Object[] {new Boolean(false), new Integer(77), "HID:34333", new Boolean(true), new Integer(154), new Integer(79), new Integer(SOMAINPAGE), new Short((short) 8), new Integer(110)}); - CurUNODialog.insertControlModel("com.sun.star.awt.UnoControlFixedTextModel", "lblBinaryFields", - new String[] {"Height", "Label", "PositionX", "PositionY", "Step", "Width"}, - new Object[] {new Integer(16), sShowBinaryFields, new Integer(6), new Integer(162), new Integer(SOMAINPAGE), new Integer(210)}); + new Object[] {new Boolean(false), new Integer(77), "HID:34333", new Boolean(true), new Integer(154), new Integer(79), new Integer(SOMAINPAGE), new Short((short) 13), new Integer(110)}); + CurDBMetaData.DataSourceName = (String) Tools.getPropertyValuefromAny(CurPropertyValue, "DataSourceName"); CurDBMetaData.DBConnection = (com.sun.star.sdbc.XConnection) Tools.getPropertyValuefromAny(CurPropertyValue, "ActiveConnection", com.sun.star.sdbc.XConnection.class); if (CurDBMetaData.DBConnection != null){ - XNameAccess xNameAccess = (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, CurDBMetaData.DatabaseContext); + XNameAccess xNameAccess = (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, CurDBMetaData.xDatabaseContext); CurDBMetaData.DataSource = xNameAccess.getByName(CurDBMetaData.DataSourceName); CurDBMetaData.xComponent = (XComponent) UnoRuntime.queryInterface(XComponent.class, CurDBMetaData.DBConnection); } - CurDBMetaData.MainCommandName = (String) Tools.getPropertyValuefromAny(CurPropertyValue, "Command"); Integer IntCommandType = (Integer) Tools.getPropertyValuefromAny(CurPropertyValue, "CommandType"); @@ -1517,35 +1598,32 @@ public class ReportWizard { XWindow xWindow = (XWindow) UnoRuntime.queryInterface(XWindow.class, xDBListBox); if (CurDBMetaData.DataSourceName != null){ if (CurDBMetaData.DataSourceName.equals("") == false){ - short iPos = (short) Tools.FieldInList(DatabaseNames, CurDBMetaData.DataSourceName); + short iPos = (short) Tools.FieldInList(CurDBMetaData.DataSourceNames, CurDBMetaData.DataSourceName); if (iPos > -1){ short[] SelList = new short[] {(short) iPos}; CurUNODialog.assignPropertyToDialogControl("lstDatabases", "SelectedItems", SelList); - xWindow = (XWindow) UnoRuntime.queryInterface(XWindow.class, xTableListBox); } - } - } - else - CurUNODialog.assignPropertyToDialogControl("lstDatabases", "SelectedItems", new short[] {(short) 0}); - - if (CurDBMetaData.DBConnection != null){ + if (CurDBMetaData.DBConnection != null){ CurDBMetaData.xComponent = (XComponent) UnoRuntime.queryInterface(XComponent.class, CurDBMetaData.DBConnection); if (CurDBMetaData.DataSourceName != null){ - iSelCommandPos = fillupCommandListBox(CurDBMetaData, true); - if (iSelCommandPos > (short) -1) + iSelCommandPos = fillupCommandListBox(CurDBMetaData, CurDBMetaData.MainCommandName != null); + if (iSelCommandPos > (short) -1) xWindow = (XWindow) UnoRuntime.queryInterface(XWindow.class, xFieldsListBox); - else + else xWindow = (XWindow) UnoRuntime.queryInterface(XWindow.class, xTableListBox); } else - System.out.println(" Overgiven DataSourcename invalid"); + System.out.println(" Overgiven DataSourcename invalid"); + } } + } + else + CurUNODialog.assignPropertyToDialogControl("lstDatabases", "SelectedItems", new short[] {(short) 0}); xWindow.setFocus(); - // DefaultButton has to be inserted after the focus has been set CurUNODialog.insertButton("cmdGoOn", SOCMDGOON, new ActionListenerImpl(), new String[] {"DefaultButton", "Enabled", "Height", "HelpURL", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width"}, - new Object[] {new Boolean(true), new Boolean(false), new Integer(14), "HID:34323", scmdGoOn, new Integer(211), new Integer(190), new Integer(0), new Short((short) 63), new Integer(53)}); + new Object[] {new Boolean(true), new Boolean(false), new Integer(14), "HID:34323", scmdGoOn, new Integer(211), new Integer(190), new Integer(0), new Short((short) 73), new Integer(53)}); } catch (Tools.TerminateWizardException exception){} catch(Exception exception){ @@ -1554,9 +1632,7 @@ public class ReportWizard { public static void main(String args[]) { - String ConnectStr = "uno:socket,host=localhost,port=8100;urp,negotiate=0,forcesynchronous=1;StarOffice.NamingService"; - // String blabla = System.getProperties().getProperty("Path"); - + String ConnectStr = "uno:socket,host=localhost,port=8100;urp,negotiate=0,forcesynchronous=1;StarOffice.NamingService"; //localhost ;Lo-1.Germany.sun.com; 10.16.65.155 try { XMultiServiceFactory xLocMSF = Tools.connect(ConnectStr); ReportWizard CurReportWizard = new ReportWizard(); @@ -1574,7 +1650,6 @@ public class ReportWizard { try{ this.xMSF = xMSF; xDesktop = Tools.getDesktop(xMSF); - // FillSpreadsheet(xMSF); CurReportPaths = new ReportPaths(); if (CurReportPaths.initialize(xMSF) == false) return; @@ -1583,16 +1658,14 @@ public class ReportWizard { return; } CurReportDocument = new ReportDocument(xMSF, true, false, ReportMessages); - // CurReportDocument.changePageOrientation(CurReportPaths.BitmapPath, null, true); - DatabaseNames = CurReportDocument.CurDBMetaData.getDatabaseNames(); //UNODialogs.combineListboxList(slstDatabasesDefaultText, CurReportDocument.CurDBMetaData.getDatabaseNames()); - if (DatabaseNames.length > 0){ // 1 + if (CurReportDocument.CurDBMetaData.DataSourceNames.length > 0){ // 1 CurReportDocument.xProgressBar.setValue(20); CurReportDocument.loadStyleTemplates(CurReportPaths.ReportPath + "/stl-default.stw", "LoadPageStyles"); WidthList = DBMetaData.InitializeWidthList(); CurUNODialog = new UNODialogs(xMSF, new String[] {"Height", "HelpURL", "Step", "Title", "Width"}, new Object[] {new Integer(210), "HID:34320", new Integer(1), WizardTitle[0], new Integer(270)}); CurReportDocument.xProgressBar.setValue(30); - fillFirstStep(CurReportDocument, DatabaseNames, CurPropertyValue, CurReportDocument.CurDBMetaData); + fillFirstStep(CurReportDocument, CurPropertyValue, CurReportDocument.CurDBMetaData); CurReportDocument.xProgressBar.setValue(40); fillSecondStep(); CurReportDocument.xProgressBar.setValue(50); @@ -1616,7 +1689,6 @@ public class ReportWizard { CurUNODialog.setPeerProperty("lstFields", "AccessibilityName", Tools.replaceSubString(slblFields, "", "~")); //.replaceFirst("~", "")); CurUNODialog.setPeerProperty("lstSelFields", "AccessibilityName", Tools.replaceSubString(slblSelFields, "", "~")); CurUNODialog.setAutoMnemonic("lblDialogHeader", false); - short RetValue = CurUNODialog.executeDialog(CurReportDocument.xFrame.getComponentWindow().getPosSize()); boolean bdisposeDialog = true; switch (RetValue){ @@ -1633,8 +1705,8 @@ public class ReportWizard { bdisposeDialog = false; Dataimport CurDataimport = new Dataimport(); CurDataimport.CurReportDocument = CurReportDocument; - CurDataimport.showProgressDisplay(xMSF, false); // CurReportDocument.Frame.getComponentWindow().getPosSize().Width); - importReportData(xMSF, CurDataimport); // CurReportDocument, CurUNOProgressDialog, CurDataimport); + CurDataimport.showProgressDisplay(xMSF, false); // CurReportDocument.Frame.getComponentWindow().getPosSize().Width); + importReportData(xMSF, CurDataimport); // CurReportDocument, CurUNOProgressDialog, CurDataimport); } else{ CurUNODialog.xComponent.dispose(); @@ -1787,6 +1859,9 @@ public class ReportWizard { sMsgCommonReportError = Tools.getResText(xResInvoke, RID_REPORT + 72); sMsgCommonReportError = Tools.replaceSubString(sMsgCommonReportError, String.valueOf((char)13), "<BR>"); sMsgInvalidTextField = Tools.getResText(xResInvoke, RID_REPORT + 73); + sSortCriteriaisduplicate = Tools.getResText(xResInvoke, RID_REPORT + 74); + sBlindTextNote = Tools.getResText(xResInvoke, RID_REPORT + 75); + sBlindTextNote = Tools.replaceSubString(sBlindTextNote, String.valueOf((char)13), "<BR>"); sMsgNoConnection = Tools.getResText(xResInvoke, RID_COMMON + 14); ReportMessages[0] = sMsgTableNotExisting; ReportMessages[1] = sMsgCommonReportError; @@ -1803,23 +1878,25 @@ public class ReportWizard { private static void FillSpreadsheet(XMultiServiceFactory xMSF) { try { XSpreadsheetDocument xSpreadsheetDocument = (XSpreadsheetDocument) Tools.createNewDocument(xDesktop, "scalc"); - long iStart = System.currentTimeMillis(); XActionLockable xActionInterface = (XActionLockable) UnoRuntime.queryInterface(XActionLockable.class, xSpreadsheetDocument ); xActionInterface.addActionLock(); - XSpreadsheets xSheets = (XSpreadsheets) xSpreadsheetDocument.getSheets(); + XSpreadsheets xSheets = xSpreadsheetDocument.getSheets(); XIndexAccess xElements = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xSheets); Object oSheet = xElements.getByIndex(0); - // XCellRange xSheet = (XCellRange) UnoRuntime.queryInterface(XCellRange.class, oSheet); - XCellRange xSheet = (XCellRange) xElements.getByIndex(0); - for (int n=0; n<100;n++) { + XCellRange xSheet = (XCellRange) UnoRuntime.queryInterface(XCellRange.class, oSheet); +// XTextRange[] xCell = new XTextRange[10000] +// a = 0; + long iStart = System.currentTimeMillis(); + for (int n=0; n<100;n++){ for (int m=0; m<100;m++) { XTextRange xCell = (XTextRange) UnoRuntime.queryInterface(XTextRange.class, xSheet.getCellByPosition(n,m)); +// a +=1; xCell.setString("Java is fun!"); } } + long iEnd = System.currentTimeMillis(); xActionInterface.removeActionLock(); System.out.println("done..."); - long iEnd = System.currentTimeMillis(); long iTime = (long) (iEnd - iStart)/1000; UNODialogs.showMessageBox(xMSF, "ErrorBox", com.sun.star.awt.VclWindowPeerAttribute.OK, "Zeit " + String.valueOf(iTime) + " Sekunden"); System.out.println(iTime); |