From 6ca32944979cf38fe408b68e040585b8820b36b4 Mon Sep 17 00:00:00 2001 From: Behrend Cornelius Date: Fri, 15 Jun 2001 14:34:18 +0000 Subject: #87606# several improvements --- wizards/source/formwizard/DBMeta.xba | 165 ++++++++++++-------- wizards/source/formwizard/DlgFormDB.xdl | 114 ++++++-------- wizards/source/formwizard/FormWizard.xba | 238 +++++++++++++---------------- wizards/source/formwizard/Language.xba | 251 +++++++++++++++---------------- wizards/source/formwizard/Layouter.xba | 87 +++++++---- wizards/source/formwizard/dbwizres.src | 21 ++- wizards/source/formwizard/develop.xba | 42 +++--- wizards/source/formwizard/tools.xba | 107 ++++++++----- wizards/source/tools/ModuleControls.xba | 33 ++-- 9 files changed, 568 insertions(+), 490 deletions(-) (limited to 'wizards') diff --git a/wizards/source/formwizard/DBMeta.xba b/wizards/source/formwizard/DBMeta.xba index 00a81ebfa167..b32f9dda85cc 100644 --- a/wizards/source/formwizard/DBMeta.xba +++ b/wizards/source/formwizard/DBMeta.xba @@ -14,56 +14,63 @@ End Sub Sub GetSelectedDBMetaData() Dim NullList() Dim OldsDBname as String -Dim bGetConnection as Boolean - ToggleDatabasePage(False) - bGetConnection = GetDBMetaData(sDatabaseList(), oDialogModel.lstDatabases.SelectedItems(0) ) - If bGetConnection Then - With oDialogModel - .lstTables.Enabled = True - .lblTables.Enabled = True - .lstTables.StringItemList() = AddListToList(TableNames(), QueryNames()) - .lstFields.StringItemList() = NullList() - .lstSelFields.StringItemList() = NullList() - End With +Dim bGetMetaData as Boolean + If Ubound(oDialogModel.lstDatabases.SelectedItems()) > -1 Then + ToggleDatabasePage(False) + DBIndex = oDialogModel.lstDatabases.SelectedItems(0) + If GetConnection(sDatabaseList(DBIndex)) Then + bGetMetaData = GetDBMetaData() + End If + If bGetMetaData Then + With oDialogModel + .lstTables.Enabled = True + .lblTables.Enabled = True + .lstTables.StringItemList() = AddListToList(TableNames(), QueryNames()) + .lstFields.StringItemList() = NullList() + .lstSelFields.StringItemList() = NullList() + End With + End If + ToggleDatabasePage(True) End If - ToggleDatabasePage(True) End Sub -Function GetDBMetaData(sDataBaseList(), DBIndex as Integer) +Function GetConnection(sDBName as String) Dim oDatabase as Object Dim oInteractionHandler as Object Dim oDataSource as Object Dim bExitLoop as Boolean +Dim bGetConnection as Boolean Dim iMsg as Integer + oDatabase = oDBContext.GetByName(sDBName) + If Not oDatabase.IsPasswordRequired Then + oDBConnection = oDBContext.GetByName(sDBName).GetConnection("","") + GetConnection() = True + Else + oInteractionHandler = createUnoService("com.sun.star.sdb.InteractionHandler") + oDataSource = oDBContext.GetByName(sDBName) +' On Local Error Goto NOCONNECTION + Do + bExitLoop = True + oDBConnection = oDataSource.ConnectWithCompletion(oInteractionHandler) + NOCONNECTION: + bGetConnection = Err = 0 + If Not bGetConnection Then + iMsg = Msgbox (sMsgNoConnection,32 + 2, sMsgWizardName) ' '?' & ' Repeat and Cancel' + bExitLoop = iMsg = SBCANCEL + End If + On Local Error Goto 0 + Loop Until bExitLoop + End If + GetConnection() = bGetConnection +End Function + + +Function GetDBMetaData() If oDBContext.HasElements Then - oDatabase = oDBContext.GetByName(sDatabaseList(DBIndex)) - sDBName = oDatabase.Name - If Not oDatabase.IsPasswordRequired Then - oDBConnection = oDBContext.GetByName(sDatabaseList(DBIndex)).GetConnection("","") - bGetConnection = True - Else - oInteractionHandler = createUnoService("com.sun.star.sdb.InteractionHandler") - oDataSource = oDBContext.GetByName(sDatabaseList(DBIndex)) - On Local Error Goto NOCONNECTION - Do - bExitLoop = True - oDBConnection = oDataSource.ConnectWithCompletion(oInteractionHandler) - - NOCONNECTION: - bGetConnection = Err = 0 - If Not bGetConnection Then - iMsg = Msgbox (sMsgNoConnection,32 + 2, sMsgWizardName) ' '?' & ' Repeat and Cancel' - bExitLoop = iMsg = SBCANCEL - End If - On Local Error Goto 0 - Loop Until bExitLoop - End If - If bGetConnection Then - Tablenames() = oDBConnection.Tables.ElementNames() - Querynames() = oDBConnection.Queries.ElementNames() - End If - GetDBMetaData() = bGetConnection + Tablenames() = oDBConnection.Tables.ElementNames() + Querynames() = oDBConnection.Queries.ElementNames() + GetDBMetaData = True Else MsgBox(sMsgErrNoDatabase, 64, sMsgWizardName) GetDBMetaData = False @@ -95,14 +102,17 @@ Dim Found as Boolean Wend Next i -' Todo: Was Wenn die Reihenfolge durcheinandergebracht ist? For n = 0 to MaxIndex sFieldname = FieldNames(n) iType = oColumns.GetByName(sFieldName).Type FieldMetaValues(n,0) = iType + ' Todo: Geht das nicht etwas performanter? FieldMetaValues(n,1) = GetValueoutofList(iType, WidthList(),1) FieldMetaValues(n,2) = GetValueoutofList(iType, WidthList(),2) + FieldMetaValues(n,3) = GetValueoutofList(iType, WidthList(),4) Next + ReDim oDBShapeList(MaxIndex) as Object + ReDim oTCShapeList(MaxIndex) as Object End Sub @@ -115,38 +125,71 @@ Dim MaxIndex as Integer Dim EmptyList() If Ubound(oDialogModel.lstTables.StringItemList()) > -1 Then FieldNames() = oColumns.GetElementNames() - If oDialogModel.optIgnoreBinaries.State = 1 Then - MaxIndex = Ubound(FieldNames()) - Dim ResultFieldNames(MaxIndex) - m = 0 - For n = 0 To MaxIndex - oField = oColumns.GetByName(FieldNames(n)) - iType = oField.Type - If (iType <> com.sun.star.sdbc.DataType.BINARY)AND(iType <> com.sun.star.sdbc.DataType.VARBINARY)AND(iType <> com.sun.star.sdbc.DataType.LONGVARBINARY) Then - ResultFieldNames(m) = FieldNames(n) - m = m + 1 - End If - Next n - Redim Preserve ResultFieldNames(m-1) - Redim Preserve FieldNames(m-1) - FieldNames() = ResultFieldNames() - End If + MaxIndex = Ubound(FieldNames()) + Dim ResultFieldNames(MaxIndex) + m = 0 + For n = 0 To MaxIndex + oField = oColumns.GetByName(FieldNames(n)) + iType = oField.Type + If GetIndexInMultiArray(WidthList(), iType, 0) <> -1 Then + ResultFieldNames(m) = FieldNames(n) + m = m + 1 + End If + Next n + Redim Preserve ResultFieldNames(m-1) + Redim Preserve FieldNames(m-1) + FieldNames() = ResultFieldNames() oDialogModel.lstFields.StringItemList = FieldNames() + InitializeListboxProcedures(oDialogModel, oDialogModel.lstFields, oDialogModel.lstSelFields) End If End Sub Sub CreateDBForm() - oDBForm = oDocument.CreateInstance("com.sun.star.form.component.Form") - oDocument.Drawpage.Forms.InsertByIndex (0, oDBForm) + If oDrawPage.Forms.Count = 0 Then + oDBForm = oDocument.CreateInstance("com.sun.star.form.component.Form") + oDrawpage.Forms.InsertByIndex (0, oDBForm) + Else + oDBForm = oDrawPage.Forms.GetByIndex(0) + End If oDBForm.Name = "Standard" oDBForm.DataSourceName = sDBName oDBForm.Command = TableName - ' Todo: Ist diese Abfrage notwendig? If bIsQuery Then oDBForm.CommandType = 1 ' Abfrage else oDBForm.CommandType = 0 ' Tabelle End If End Sub - \ No newline at end of file + + +Sub AddBinaryFieldsToWidthList() +Dim LocWidthList() +Dim MaxIndex as Integer +Dim OldMaxIndex as Integer +Dim s as Integer +Dim n as Integer +Dim m as Integer +' Todo: Die folgenden Zeilen könnten in einer allgemeinen Routine +' bearbeitet werden, z. B. durch Umschreiben von AddListToList, wobei +' beim Abfragen des Ubounds der zweiten Dimension eine Fehlerabfrage nötig wäre. + MaxIndex = Ubound(WidthList(),1) + Ubound(ImgWidthList(),1) + 1 + OldMaxIndex = Ubound(WidthList(),1) + ReDim Preserve WidthList(MaxIndex,4) + s = 0 + For n = OldMaxIndex + 1 To MaxIndex + For m = 0 To 4 + WidthList(n,m) = ImgWidthList(s,m) + Next m + s = s + 1 + Next n + FillUpFieldsListbox() +End Sub + + +Sub RemoveBinaryFieldsFromWidthList() +Dim MaxIndex as Integer + MaxIndex = Ubound(WidthList(),1) - Ubound(ImgWidthList(),1) - 1 + ReDim Preserve WidthList(MaxIndex, 4) + FillUpFieldsListbox() +End Sub \ No newline at end of file diff --git a/wizards/source/formwizard/DlgFormDB.xdl b/wizards/source/formwizard/DlgFormDB.xdl index 54c165c17086..7963979a1495 100644 --- a/wizards/source/formwizard/DlgFormDB.xdl +++ b/wizards/source/formwizard/DlgFormDB.xdl @@ -1,122 +1,108 @@ - + - - - - - - - - - - - - - - - + + - + - - - - - + + - - + + - + - - - - - + + + + + - - + + - - + + - - + + - - + + + + + + - + - + - + - + - + - + - - - - + + - - - - - - + + + + + + - + - + - + - + - + - + - - + + - + - + diff --git a/wizards/source/formwizard/FormWizard.xba b/wizards/source/formwizard/FormWizard.xba index 182dd745467e..e1888651e9b0 100644 --- a/wizards/source/formwizard/FormWizard.xba +++ b/wizards/source/formwizard/FormWizard.xba @@ -1,7 +1,7 @@ Option Explicit -'Very new version + Public DocumentName as String Public FormPath$, FormDBName$, FormReturnValue$ Public TemplatePath$ @@ -27,21 +27,23 @@ Public oDBContext as Object Public oUcb as Object Public oDocInfo as Object 'Public TemplateList(50,1) as String -Public WidthList(27,3) as Long -Public ControlList(1 To 9) as String +Public WidthList(15,4) +Public ImgWidthList(3,4) Public sDBName as String Public Tablename as String -Sub MainWithDefault() +' Todo: 'Datenquelle' für 'Datenbank' +' 'Inhalte' oder 'Objekte' mit 'Tabellen und Abfragen' evtl als Hilfetext für 'Datenquelle' +Sub MainWithDefault(Optional DatasourceName as String, Optional Contenttype as Integer, Optional sContent as String, Optional oConnection as Object) 'On Local Error Goto GlobalError BasicLibraries.LoadLibrary("Tools") BasicLibraries.LoadLibrary("WebWizard") bControlsareCreated = False + MaxIndex = -1 If Not InitResources("Formwizard","dbw") Then Exit Sub End If - MaxIndex = -1 oDBContext = CreateUnoService("com.sun.star.sdb.DatabaseContext") oUcb = createUnoService("com.sun.star.ucb.SimpleFileAccess") FormPath = GetOfficeSubPath("Template","wizard/bitmap") @@ -49,15 +51,16 @@ Sub MainWithDefault() WizardPath = GetOfficeSubPath("Template","wizard/") TexturePath = GetOfficeSubPath("Gallery", "www-back/") WorkPath = GetPathSettings("Work") - OpenBaseDocument() + OpenFormDocument() GetDatabaseNames() InitializeWidthList() - ' calc some special currency control properties (they depend from the system language) - ' Todo: What's going on here? -' calcCurrencyProperties() LoadLanguage bNeedFieldRefresh = True - CreateForm() + If Not IsMissing(DataSourceName) Then + CreateForm(DatasourceName, Contenttype, sContent, oConnection) + Else + CreateForm() + End If GlobalError: If Err <> 0 Then ToggleWindow(True) @@ -66,20 +69,29 @@ GlobalError: End Sub -Sub CreateForm() as String +Sub CreateForm(Optional DatasourceName as String, Optional Contenttype as Integer, Optional sContent as String, Optional oConnection as Object) as String Dim i as Integer -' On Error Goto GlobalError With oDialogModel .optIgnoreBinaries.State = True - .optUseDocument.State = True .cmdBack.Enabled = False .cmdGoOn.Enabled = False .lblTables.Enabled = False .lstSelFields.Tag = False - ToggleListboxControls(oDialogModel, False) .Step = 1 .lstDatabases.StringItemList()= sDatabaseList()' = AddItem(sDatabaseList(i) End With + If Not IsMissing(DataSourceName) Then + DlgFormDB.GetControl("lstDatabases").SelectItem(DataSourceName, True) + ' Todo: Hier muss auch noch der Contenttype untergebracht werden + If GetDBMetaData() Then + Set oDBConnection = oConnection + oDialogModel.lstTables.StringItemList() = AddListToList(TableNames(), QueryNames() + DlgFormDB.GetControl("lstTables").SelectItem(sContent, True) + FillUpFieldsListbox() + End If + Else + ToggleListboxControls(oDialogModel, False) + End If DlgFormDB.Title = WizardTitle(1) NumberofStyles = FillupWebListbox(oUcb, "/stl", DlgFormDB, "lstStyles", Styles()) ImportStyles() @@ -97,29 +109,17 @@ GlobalError: End Sub -Function AddListtoList(FirstArray(), SecondArray(), Optional StarIndex) -Dim n as Integer -Dim m as Integer -Dim MaxIndex as Integer - MaxIndex = Ubound(FirstArray()) + Ubound(SecondArray()) + 1 - Dim ResultArray(MaxIndex) - For m = 0 To Ubound(FirstArray()) - ResultArray(m) = FirstArray(m) - Next m - For n = 0 To Ubound(SecondArray()) - ResultArray(m) = SecondArray(n) - m = m + 1 - Next n - AddListToList() = ResultArray() -End Function - - Sub FormGetFields() Dim i as Integer -Dim n as Integer ToggleDatabasePage(False) + FillUpFieldsListbox() + ToggleDatabasePage(True) +End Sub + + +Sub FillUpFieldsListbox() +Dim n as Integer n = Ubound(oDialogModel.lstTables.SelectedItems()) - InitializeListboxProcedures(oDialogModel, oDialogModel.lstFields, oDialogModel.lstSelFields) If n <> -1 Then Tablename = Tablenames(oDialogModel.lstTables.SelectedItems(0)) bIsQuery = FieldinArray(QueryNames(), Ubound(QueryNames()), TableName) @@ -131,15 +131,12 @@ Dim n as Integer GetSpecificFieldNames() ToggleListboxControls(oDialogModel, True) End If - ToggleDatabasePage(True) - -' bNeedFieldRefresh = False Exit Sub -no_fields: +'TODO: Diese Fehlermarke sinnvoll einbinden +NOFIELDS: MsgBox sMsgErrCouldNotOpenObject, 16, sMsgWizardName End Sub - Sub CancelFormWizard() DlgFormDB.EndExecute() DlgFormDB.Dispose() @@ -149,121 +146,62 @@ End Sub Sub PreviousStep() -Dim CurStep as Integer - CurStep = oDialogModel.Step - 1 - oDialogModel.Step = CurStep - oDialogModel.cmdBack.Enabled = CurStep <> 1 - oDialogModel.cmdGoOn.Enabled = True - Select Case oDialogModel.Step - Case 1 - oDialogModel.lstSelFields.Tag = Not bControlsareCreated - Case 2 - oDialogModel.cmdGoOn.Label = sGoOn - End Select - oDialogModel.imgTheme.ImageUrl = FormPath & "FormWizard_" & CurStep & ".bmp" - DlgFormDB.Title = WizardTitle(CurStep) + With oDialogModel + .Step = 1 + .cmdBack.Enabled = False + .cmdGoOn.Enabled = True + .lstSelFields.Tag = Not bControlsareCreated + .cmdGoOn.Label = sGoOn + .imgTheme.ImageUrl = FormPath & "FormWizard_1.bmp" + End With + DlgFormDB.Title = WizardTitle(1) End Sub Sub NextStep() +Dim bOldVisible + ' Note: Unfortunately it is not possible to query the visibility of the imagecontrol directly + bOldVisible = oDialogModel.Height > 40 Select Case oDialogModel.Step Case 1 - GetTableMetaData() - CreateDBForm() - InitializeLayoutSettings() + bControlsAreCreated = Not (CBool(oDialogModel.lstSelFields.Tag)) + If Not bControlsAreCreated Then + GetTableMetaData() + CreateDBForm() + RemoveShapes() + InitializeLayoutSettings() + oDBForm.Load + End If + oDialogModel.cmdGoOn.Label = sReady + oDialogModel.cmdBack.Enabled = True oDialogModel.Step = 2 - oDBForm.Load Case 2 - oDialogModel.cmdGoOn.Label = sReady - ToggleControlsofLastPage() - oDialogModel.Step = 3 - Case 3 - HandleCreatedDocument() + StoreForm() End Select + DlgFormDB.GetControl("imgTheme").Visible = bOldVisible oDialogModel.imgTheme.ImageUrl = FormPath & "FormWizard_" & oDialogModel.Step & ".bmp" - DlgFormDB.Title = WizardTitle(oDialogModel.Step) + DlgFormDB.Title = WizardTitle(oDialogModel.Step) End Sub Sub InitializeLayoutSettings() -' Todo: Dieses Flag neu setzen! - bControlsAreCreated = False 'Not (CBool(oDialogModel.lstSelFields.Tag)) - If Not bControlsAreCreated Then + If oPageStyle.BackGraphicLocation = com.sun.star.style.GraphicLocation.TILED Then oDialogModel.optTiled.State = 1 - OldArrangement = 0 - CurArrangement = cTabled - CurBorderType = SB3DBORDER - CurAlignmode = SBALIGNLEFT - ToggleBorderGroup(bControlsAreCreated) - ToggleAlignGroup(bControlsAreCreated) - ArrangeControls() - End If -End Sub - - -Sub HandleCreatedDocument() -Dim sPath as String -Dim NoArgs() as new com.sun.star.beans.PropertyValue -Dim DocTitle as String -Dim sDirPath as String - On Local Error Goto NOSAVING - - If oDialogModel.optSaveDocument.State = 1 Then - sDirPath = ConvertToUrl(oDialogModel.txtInputPath.Text) - sDirPath = RTrimStr(sDirPath,"/") - DocTitle = oDialogModel.txtTitle.Text - sPath = sDirPath & "/" & DocTitle & ".sxw" - - oDocument.StoreToUrl(sPath,NoArgs() - NOSAVING: - If Err <> 0 Then - Msgbox("Todo: Resourcen für fehlerhaftes Abspeichern suchen!", 16, GetProductname) - Resume CLERROR - Else - DlgFormDB.EndExecute() - oDocument.Dispose - End If - CLERROR: Else - DlgFormDB.EndExecute() + oDialogModel.optArea.State = 1 End If -End Sub - - -Sub ChangeDocumentTitle - oDocument.DocumentInfo.Title = oDialogModel.txtTitle.Text -End Sub - - -Sub CheckPathValidation() -Dim sPath as String -Dim sDir as String - sPath = ConvertToUrl(oDialogModel.txtInputPath.Text) - If sPath <> "" Then - sDir = DirectorynameoutofPath(sPath, "/") - End If - If oUcb.IsFolder(sDir) Then - oDialogModel.cmdGoOn.Enabled = oUcb.Exists(sDir) - Else - oDialogModel.cmdGoOn.Enabled = False + SwitchArrangementButtons(cTabled) + SwitchAlignButtons(SBALIGNLEFT) + SwitchBorderButtons(SB3DBORDER) + ToggleBorderGroup(bControlsAreCreated) + ToggleAlignGroup(bControlsAreCreated) + ArrangeControls() + If OldAlignMode <> 0 Then + DlgFormDB.GetControl("cmdAlign" & OldAlignmode).Model.State = 0 + End If + If OldAlignMode <> 0 Then + DlgFormDB.GetControl("cmdAlign" & OldAlignmode).Model.State = 0 End If -End Sub - - -Sub ToggleControlsofLastPage() - With oDialogModel - If .optUseDocument.State = 1 Then - .cmdGoOn.Enabled = True - .txtInputPath.Enabled = False - .cmdGetPathDialog.Enabled = False - .lblPath.Enabled = False - Else - .lblPath.Enabled = True - .txtInputPath.Enabled = True - .cmdGetPathDialog.Enabled = True - CheckPathValidation() - End If - End With End Sub @@ -278,6 +216,32 @@ End Sub Sub SwitchDialogHeight() - SwitchWizardDialogHeight(DlgFormDB) + SwitchWizardDialogHeight(DlgFormDB, sHeightenDialog, sReduceDialog) End Sub - \ No newline at end of file + + +Sub StoreForm() +Dim oFileDialog +Dim iAccept as Integer +Dim sPath as String +Dim oStoreProperties(0) as New com.sun.star.beans.PropertyValue +Dim ListAny(0) +' Todo: Laut DV soll hierfür ein integer Wert gesetzt werden + ListAny(0) = "FileSave_AutoextPwdBox" + oFileDialog = CreateUnoService("com.sun.star.ui.FilePicker") + oFileDialog.AppendFilter("Writer 6.0", "*.sxw") + oFileDialog.AppendFilter("Writer 6.0 Vorlage", "*.stw") + oFileDialog.SetCurrentFilter("Writer 6.0") + oFileDialog.Initialize(ListAny()) + oFileDialog.SetDisplayDirectory(WorkPath) +' Todo: Vorschlag für Namen: "Form_DatasourceName.ContentName + iAccept = oFileDialog.Execute() + If iAccept = 1 Then + sPath = oFileDialog.Path(0) + oStoreProperties(0).Name = "FilterName" + oStoreProperties(0).Value = oFileDialog.GetCurrentFilter + RemoveShapes() + oDocument.StoreAsUrl(sPath, oStoreProperties()) + DlgFormDB.EndExecute() + End If +End Sub \ No newline at end of file diff --git a/wizards/source/formwizard/Language.xba b/wizards/source/formwizard/Language.xba index 13a6d014f7af..ae60dd6e8ffa 100644 --- a/wizards/source/formwizard/Language.xba +++ b/wizards/source/formwizard/Language.xba @@ -34,6 +34,9 @@ Dim sMsgDatetime_TimeComponent as String Public sGoOn as String Public sReady as String Public sMsgNoConnection as String +Public sReduceDialog as String +Public sHeightenDialog as String + Sub LoadLanguage () sMsgWizardName = GetResText(RID_FORM + 0) @@ -63,232 +66,216 @@ End Sub Sub SetDialogLanguage () DlgFormDB = LoadDialog("FormWizard", "DlgFormDB") oDialogModel = DlgFormDB.Model - oDialogModel.cmdCancel.Label = GetResText(RID_COMMON + 1) - oDialogModel.cmdBack.Label = GetResText(RID_COMMON + 2) - oDialogModel.cmdHelp.Label = GetResText(RID_COMMON + 20) - sGoOn = GetResText(RID_COMMON + 3) - oDialogModel.cmdGoOn.Label = sGoOn - oDialogModel.lblDatabases.Label = GetResText(RID_COMMON + 4) - oDialogModel.lblTables.Label = GetResText(RID_FORM + 11) 'Form_1_frameTables - - oDialogModel.lblFields.Label = GetResText(RID_FORM + 12) 'Form_2_lblAvailable - oDialogModel.lblSelFields.Label = GetResText(RID_FORM + 13) 'Form_2_lblSelected - - - oDialogModel.lblStyles.Label = GetResText(RID_FORM + 21) -' Todo: Die Position des Eingabefeld für den Formulartitel entsprechend der Länge seines Labels bestimmen - oDialogModel.lblInputTitle.Label = GetResText(RID_FORM + 22) - oDialogModel.lblFinalConfig.Label = GetResText(RID_FORM + 23) - oDialogModel.optUseDocument.Label = GetResText(RID_FORM + 24) - oDialogModel.optSaveDocument.Label = GetResText(RID_FORM + 25) - oDialogModel.optUseDocument.Enabled = True - oDialogModel.lblPath.Label = GetResText(RID_FORM + 60) - oDialogModel.txtInputPath.Text = ConvertFromUrl(WorkPath) - oDialogModel.hlnBorderLayout.Label = GetResText(RID_FORM + 28) - oDialogModel.hlnAlign.Label = GetResText(RID_FORM + 32) - oDialogModel.hlnArrangements.Label = GetResText(RID_FORM + 35) - - WizardTitle(1) = GetResText(RID_FORM + 45) - WizardTitle(2) = GetResText(RID_FORM + 46) - WizardTitle(3) = GetResText(RID_FORM + 47) - - oDialogModel.hlnBinaries.Label = GetResText(RID_FORM + 50) - oDialogModel.optIgnoreBinaries.Label = GetResText(RID_FORM + 51) - oDialogModel.optBinariesasGraphics.Label = GetResText(RID_FORM + 52) + With oDialogModel + .cmdCancel.Label = GetResText(RID_COMMON + 1) + .cmdBack.Label = GetResText(RID_COMMON + 2) + .cmdHelp.Label = GetResText(RID_COMMON + 20) + sGoOn = GetResText(RID_COMMON + 3) + .cmdGoOn.Label = sGoOn + .lblDatabases.Label = GetResText(RID_COMMON + 4) + .lblTables.Label = GetResText(RID_FORM + 11) + + .lblFields.Label = GetResText(RID_FORM + 12) + .lblSelFields.Label = GetResText(RID_FORM + 13) + + .lblStyles.Label = GetResText(RID_FORM + 21) + .hlnBorderLayout.Label = GetResText(RID_FORM + 28) + .hlnAlign.Label = GetResText(RID_FORM + 32) + .hlnArrangements.Label = GetResText(RID_FORM + 35) + + WizardTitle(1) = GetResText(RID_FORM + 45) + WizardTitle(2) = GetResText(RID_FORM + 46) + WizardTitle(3) = GetResText(RID_FORM + 47) + + .hlnBinaries.Label = GetResText(RID_FORM + 50) + .optIgnoreBinaries.Label = GetResText(RID_FORM + 51) + .optBinariesasGraphics.Label = GetResText(RID_FORM + 52) - oDialogModel.hlnBackground.Label = GetResText(RID_FORM + 55) - oDialogModel.optTiled.Label = GetResText(RID_FORM + 56) - oDialogModel.optArea.Label = GetResText(RID_FORM + 57) - - oDialogModel.cmdAlign0.ImageURL = FormPath & "Align_0.bmp" - oDialogModel.cmdAlign0.HelpText = GetResText(RID_FORM + 33) + .hlnBackground.Label = GetResText(RID_FORM + 55) + .optTiled.Label = GetResText(RID_FORM + 56) + .optArea.Label = GetResText(RID_FORM + 57) - oDialogModel.cmdAlign2.ImageURL = FormPath & "Align_2.bmp" - oDialogModel.cmdAlign2.HelpText = GetResText(RID_FORM + 34) + .cmdAlign0.ImageURL = FormPath & "Align_0.bmp" + .cmdAlign0.HelpText = GetResText(RID_FORM + 33) - oDialogModel.cmdBorder0.ImageURL = FormPath & "Border_0.bmp" - oDialogModel.cmdBorder0.HelpText = GetResText(RID_FORM + 29) + .cmdAlign2.ImageURL = FormPath & "Align_2.bmp" + .cmdAlign2.HelpText = GetResText(RID_FORM + 34) - oDialogModel.cmdBorder1.ImageURL = FormPath & "Border_1.bmp" - oDialogModel.cmdBorder1.HelpText = GetResText(RID_FORM + 30) + .cmdBorder0.ImageURL = FormPath & "Border_0.bmp" + .cmdBorder0.HelpText = GetResText(RID_FORM + 29) - oDialogModel.cmdBorder2.ImageURL = FormPath & "Border_2.bmp" - oDialogModel.cmdBorder2.HelpText = GetResText(RID_FORM + 31) + .cmdBorder1.ImageURL = FormPath & "Border_1.bmp" + .cmdBorder1.HelpText = GetResText(RID_FORM + 30) + .cmdBorder2.ImageURL = FormPath & "Border_2.bmp" + .cmdBorder2.HelpText = GetResText(RID_FORM + 31) - oDialogModel.cmdArrange1.ImageURL = FormPath & "Arrange_1.bmp" - oDialogModel.cmdArrange1.HelpText = GetResText(RID_FORM + 36) + .cmdArrange1.ImageURL = FormPath & "Arrange_1.bmp" + .cmdArrange1.HelpText = GetResText(RID_FORM + 36) + + .cmdArrange2.ImageURL = FormPath & "Arrange_2.bmp" + .cmdArrange2.HelpText = GetResText(RID_FORM + 37) - oDialogModel.cmdArrange2.ImageURL = FormPath & "Arrange_2.bmp" - oDialogModel.cmdArrange2.HelpText = GetResText(RID_FORM + 37) + .cmdArrange3.ImageURL = FormPath & "Arrange_3.bmp" + .cmdArrange3.HelpText = GetResText(RID_FORM + 40) - oDialogModel.cmdArrange3.ImageURL = FormPath & "Arrange_3.bmp" - oDialogModel.cmdArrange3.HelpText = GetResText(RID_FORM + 40) + .cmdArrange4.ImageURL = FormPath & "Arrange_4.bmp" + .cmdArrange4.HelpText = GetResText(RID_FORM + 38) - oDialogModel.cmdArrange4.ImageURL = FormPath & "Arrange_4.bmp" - oDialogModel.cmdArrange4.HelpText = GetResText(RID_FORM + 38) + .cmdArrange5.ImageURL = FormPath & "Arrange_5.bmp" + .cmdArrange5.HelpText = GetResText(RID_FORM + 39) + + sHeightenDialog = GetResText(RID_FORM + 66) + sReduceDialog = GetResText(RID_FORM + 65) - oDialogModel.cmdArrange5.ImageURL = FormPath & "Arrange_5.bmp" - oDialogModel.cmdArrange5.HelpText = GetResText(RID_FORM + 39) + .cmdSwitchHeight.HelpText = sReduceDialog + .cmdSwitchHeight.ImageURL = FormPath & "up.bmp" + End With End Sub Sub InitializeWidthList() + 'Todo: Was ist mit Currencies? Wieso sind dafür in der API keine Feldtypen definiert? +' 'Currency' ist ein Flag, dass grundsätzlich an jedes Feld angehängt sein kann. +' An der Connection kann man irgendwie abfragen, ob ein bestimmter Datentyp als Währung +' interpretiert wird. Darstellung über Numberformatter. Ist nicht konsistent über Datenbanken. +' außerdem dürften hier einige Treiber auch buggy sein. WidthList(0,0) = com.sun.star.sdbc.DataType.BIT ' = -7; WidthList(0,1) = 5 WidthList(0,2) = cCheckbox WidthList(0,3) = False - + WidthList(0,4) = "CheckBox" WidthList(1,0) = com.sun.star.sdbc.DataType.TINYINT ' = -6; WidthList(1,1) = 4 WidthList(1,2) = cNumericBox WidthList(1,3) = False + WidthList(1,4) = "FormattedField" WidthList(2,0) = com.sun.star.sdbc.DataType.SMALLINT ' = 5; WidthList(2,1) = 4 WidthList(2,2) = cNumericBox WidthList(2,3) = False + WidthList(2,4) = "FormattedField" WidthList(3,0) = com.sun.star.sdbc.DataType.INTEGER ' = 4; WidthList(3,1) = 6 WidthList(3,2) = cNumericBox WidthList(3,3) = False + WidthList(3,4) = "FormattedField" WidthList(4,0) = com.sun.star.sdbc.DataType.BIGINT ' = -5; WidthList(4,1) = 11 WidthList(4,2) = cNumericBox WidthList(4,3) = False + WidthList(4,4) = "FormattedField" WidthList(5,0) = com.sun.star.sdbc.DataType.FLOAT ' = 6; WidthList(5,1) = 21 WidthList(5,2) = cNumericBox WidthList(5,3) = False + WidthList(5,4) = "FormattedField" WidthList(6,0) = com.sun.star.sdbc.DataType.REAL ' = 7; - WidthList(6,1) = 21 + WidthList(6,1) = 21 'Property 'Scale', keine maximalwerte WidthList(6,2) = cNumericBox WidthList(6,3) = False + WidthList(6,4) = "FormattedField" WidthList(7,0) = com.sun.star.sdbc.DataType.DOUBLE ' = 8; - WidthList(7,1) = 21 + WidthList(7,1) = 21 ' dynamisch erstellen + 'Property 'Scale' WidthList(7,2) = cNumericBox WidthList(7,3) = False + WidthList(7,4) = "FormattedField" WidthList(8,0) = com.sun.star.sdbc.DataType.NUMERIC ' = 2; WidthList(8,1) = 21 WidthList(8,2) = cNumericBox WidthList(8,3) = False + WidthList(8,4) = "FormattedField" - WidthList(9,0) = com.sun.star.sdbc.DataType.DECIMAL ' = 3; + WidthList(9,0) = com.sun.star.sdbc.DataType.DECIMAL ' = 3; (mit Nachkommastellen) WidthList(9,1) = 10 ' ToDo: Dies muss in einer Routine errechnet werden WidthList(9,2) = cNumericBox WidthList(9,3) = False + WidthList(9,4) = "FormattedField" WidthList(10,0) = com.sun.star.sdbc.DataType.CHAR ' = 1; WidthList(10,1) = 3 WidthList(10,2) = cTextBox WidthList(10,3) = False + WidthList(10,4) = "TextField" + ' Todo: Sollte die Feldlänge vielleicht lieber aus den Metadaten ausgelesen werden? WidthList(11,0) = com.sun.star.sdbc.DataType.VARCHAR ' = 12; WidthList(11,1) = 20 WidthList(11,2) = cTextBox WidthList(11,3) = True + WidthList(11,4) = "TextField" WidthList(12,0) = com.sun.star.sdbc.DataType.LONGVARCHAR ' = -1; WidthList(12,1) = 20 WidthList(12,2) = cTextBox WidthList(12,3) = True + WidthList(12,4) = "TextField" WidthList(13,0) = com.sun.star.sdbc.DataType.DATE ' = 91; WidthList(13,1) = 12 WidthList(13,2) = cDateBox WidthList(13,3) = False + WidthList(13,4) = "DateField" WidthList(14,0) = com.sun.star.sdbc.DataType.TIME ' = 92; WidthList(14,1) = 11 WidthList(14,2) = cTimeBox WidthList(14,3) = False + WidthList(14,4) = "TimeField" ' Todo: Die folgenden Felder auffüllen! WidthList(15,0) = com.sun.star.sdbc.DataType.TIMESTAMP ' = 93; -' WidthList(15,1) = +' WidthList(15,1) = Datum-Zeit Feld ' WidthList(15,2) = WidthList(15,3) = False +' WidthList(15,4) = + + + ImgWidthList(0,0) = com.sun.star.sdbc.DataType.BINARY ' = -2; + ImgWidthList(0,1) = 1000 + ImgWidthList(0,2) = cImageControl + ImgWidthList(0,3) = False + ImgWidthList(0,4) = "ImageControl" - WidthList(16,0) = com.sun.star.sdbc.DataType.BINARY ' = -2; -' WidthList(16,1) = -' WidthList(16,2) = cImageControl - WidthList(16,3) = False - - WidthList(17,0) = com.sun.star.sdbc.DataType.VARBINARY ' = -3; -' WidthList(17,1) = -' WidthList(17,2) = cImageControl - WidthList(17,3) = False - - WidthList(18,0) = com.sun.star.sdbc.DataType.LONGVARBINARY ' = -4; -' WidthList(18,1) = -' WidthList(18,2) = cImageControl - WidthList(18,3) = False - - WidthList(19,0) = com.sun.star.sdbc.DataType.SQLNULL ' = 0; -' WidthList(19,1) = -' WidthList(19,2) = - WidthList(19,3) = False - - WidthList(20,0) = com.sun.star.sdbc.DataType.OTHER ' = 1111; -' WidthList(20,1) = -' WidthList(20,2) = - WidthList(20,3) = False - - WidthList(21,0) = com.sun.star.sdbc.DataType.OBJECT ' = 2000; -' WidthList(21,1) = -' WidthList(21,2) = - WidthList(21,3) = False - - WidthList(22,0) = com.sun.star.sdbc.DataType.DISTINCT ' = 2001; -' WidthList(22,1) = -' WidthList(22,2) = - WidthList(22,3) = False - - WidthList(23,0) = com.sun.star.sdbc.DataType.STRUCT ' = 2002; -' WidthList(23,1) = -' WidthList(23,2) = - WidthList(23,3) = False - - WidthList(24,0) = com.sun.star.sdbc.DataType.ARRAY ' = 2003; -' WidthList(24,1) = -' WidthList(24,2) = - WidthList(24,3) = False - - WidthList(25,0) = com.sun.star.sdbc.DataType.BLOB ' = 2004; -' WidthList(25,1) = -' WidthList(25,2) = - WidthList(25,3) = False - - WidthList(26,0) = com.sun.star.sdbc.DataType.CLOB ' = 2005; -' WidthList(26,1) = -' WidthList(26,2) = - WidthList(26,3) = False + ImgWidthList(1,0) = com.sun.star.sdbc.DataType.VARBINARY ' = -3; + ImgWidthList(1,1) = 1000 + ImgWidthList(1,2) = cImageControl + ImgWidthList(1,3) = False + ImgWidthList(1,4) = "ImageControl" + + ImgWidthList(2,0) = com.sun.star.sdbc.DataType.LONGVARBINARY ' = -4; + ImgWidthList(2,1) = 1000 + ImgWidthList(2,2) = cImageControl + ImgWidthList(2,3) = False + ImgWidthList(2,4) = "ImageControl" + + ImgWidthList(3,0) = com.sun.star.sdbc.DataType.BLOB ' = 2004; + ImgWidthList(3,1) = 1000 + ImgWidthList(3,2) = cImageControl + ImgWidthList(3,3) = False + ImgWidthList(3,4) = "ImageControl" + +' Note: the following Fieldtypes cannot be presented +' Todo: This should be mentioned in the help +'ExcludeList(0) = com.sun.star.sdbc.DataType.SQLNULL +'ExcludeList(1) = com.sun.star.sdbc.DataType.OTHER +'ExcludeList(2) = com.sun.star.sdbc.DataType.OBJECT +'ExcludeList(3) = com.sun.star.sdbc.DataType.DISTINCT +'ExcludeList(4) = com.sun.star.sdbc.DataType.STRUCT +'ExcludeList(5) = com.sun.star.sdbc.DataType.ARRAY +'ExcludeList(6) = com.sun.star.sdbc.DataType.CLOB +'ExcludeList(7) = com.sun.star.sdbc.DataType.REF - WidthList(27,0) = com.sun.star.sdbc.DataType.REF ' = 2006; -' WidthList(27,1) = -' WidthList(27,2) = - WidthList(27,3) = False - - ControlList(cCheckBox) = "CheckBox" ' cBoolean - ControlList(cNumericBox) = "NumericField" ' cFloat, cInteger, cLong, cCounter, cDecimal, cShortInt - ControlList(cCurrencyBox) = "CurrencyField" ' cCurrency - ControlList(cDateBox) = "DateField" - ControlList(cTimeBox) = "TimeField" - ControlList(cTextBox) = "TextField" - ControlList(cImageControl) = "ImageControl" -' Todo: Und was ist hiermit? -'const cLabel = 1 -'const cGridControl = 8 -'const cImageControl = 9 - oModelService(cLabel) = "com.sun.star.form.component.FixedText" oModelService(cTextBox) = "com.sun.star.form.component.TextField" oModelService(cCheckBox) = "com.sun.star.form.component.CheckBox" diff --git a/wizards/source/formwizard/Layouter.xba b/wizards/source/formwizard/Layouter.xba index 3d3d2251dce0..842e7147fde0 100644 --- a/wizards/source/formwizard/Layouter.xba +++ b/wizards/source/formwizard/Layouter.xba @@ -7,12 +7,16 @@ ' Was passiert, wenn Felder jenseits der Ränder positioniert werden? ' Todo: Die ObjektArrays oDBShapeList() und oTCShaplist könnten 3-Dimensional sein mit dem Model und dem Control ' in den anderen beiden Dimensionen +' Todo: doppelte Liste für Tabellen und Abfragen mit der Angabe des Contenttypes + Public oProgressbar as Object Public ProgressValue as Integer Public oDocument as Object Public oController as Object Public oForm as Object Public oDrawPage as Object +Public oPageStyle as Object + Public nMaxColRightX as Long Public nMaxTCWidth as Long Public nMaxRowRightX as Long @@ -39,7 +43,10 @@ Public CurArrangement as Integer Public CurBorderType as Integer Public CurAlignmode as Integer +Public OldAlignMode as Integer +Public OldBorderType as Integer Public OldArrangement as Integer + Public Const cColumnarLeft = 1 Public Const cColumnarTop = 2 Public Const cTabled = 3 @@ -64,7 +71,7 @@ Public Const cGridControl = 8 Public Const cImageControl = 9 Public Styles(8, 50) as String -Public FieldMetaValues(MaxFieldIndex,2) as String +Public FieldMetaValues(MaxFieldIndex,3) ' Description of this List: ' FieldMetaValues(0-MaxFieldIndex,0) (Datafieldtype) ' FieldMetaValues(0-MaxFieldIndex,1) (Datafieldlength) @@ -122,36 +129,37 @@ ErrorAndCloseForm: End Function -Sub OpenBaseDocument() +Sub OpenFormDocument() Dim NoArgs() as new com.sun.star.beans.PropertyValue -Dim aPageSize As New com.sun.star.awt.Size -Dim aSize As New com.sun.star.awt.Size Dim oViewSettings as Object -Dim oPageStyle as Object - oDocument = StarDesktop.LoadComponentFromURL("private:factory/swriter", "_blank", 0, NoArgs()) + oDocument.ApplyFormDesignMode = False oController = oDocument.GetCurrentController oViewSettings = oDocument.CurrentController.ViewSettings ' oDocument.LockControllers oViewSettings.ShowTableBoundaries = False +' Todo: Im Auge behalten, ob die Viewsettings auch mit abgespeichert werden oViewSettings.ShowTextBoundaries = False oViewSettings.ShowOnlineLayout = True oViewSettings.ShowHoriRuler = True -' oCursor = oDocument.Text.CreateTextCursor -' oCursor.InsertDocumentfromURL(FileStr, NoArgs()) oDrawPage = oDocument.DrawPage oPageStyle = oDocument.StyleFamilies.GetByName("PageStyles").GetByName("Standard") +End Sub + + +Sub ConfigurePageStyle() +Dim aPageSize As New com.sun.star.awt.Size +Dim aSize As New com.sun.star.awt.Size oPageStyle.IsLandscape = True -' Todo: Prozedur schreiben um Seite auf Landscape/Portrait zu setzen aPageSize = oPageStyle.Size nPageWidth = aPageSize.Width nPageHeight = aPageSize.Height aSize.Width = nPageHeight aSize.Height = nPageWidth oPageStyle.Size = aSize + nPageWidth = nPageHeight nPageHeight = oPageStyle.Size.Height - ' Todo: Es könnte der unterste Grenze in Abhängigkeit von der Anzahl der DB-Felder bestimmt werden. nFormWidth = nPageWidth - oPageStyle.RightMargin - oPageStyle.LeftMargin - 2 * cXOffset nFormHeight = nPageHeight - oPageStyle.TopMargin - oPageStyle.BottomMargin - 2 * cYOffset - cSymbolMargin End Sub @@ -160,22 +168,18 @@ End Sub ' Modify the Borders of the Controls Sub ChangeBorderLayouts(oEvent as Object) Dim oModel as Object -Dim OldBorderType as Integer Dim i as Integer Dim oCurModel as Object + oModel = oEvent.Source.Model + SwitchBorderButtons(Val(Right(oModel.Name,1))) ToggleLayoutPage(False) ' oDocument.LockControllers - OldBorderType = CurBorderType - oModel = oEvent.Source.Model - CurBorderType = Val(Right(oModel.Name,1)) -' Todo: Die Grafikurl des Controls umsetzen, ebenso wie die Grafikurl des -' alten Controls + ' Todo: Auch unsichtbare Controls müssen eine neue Border bekommen ' Am besten wird hierbei das dynamische Array oDBShapeList() abgegriffen If CurArrangement = cTabled Then oGridModel.Border = CurBorderType Else - ' If OldBorderType <> CurBorderType Then For i = 0 To MaxIndex oCurModel = oDBShapeList(i).GetControl @@ -193,15 +197,11 @@ End Sub Sub ChangeLabelAlignments(oEvent as Object) Dim i as Integer Dim oCurModel as Object -Dim OldAlignMode as Integer Dim oModel as Object + oModel = oEvent.Source.Model + SwitchAlignButtons(Val(Right(oModel.Name,1))) ToggleLayoutPage(False) ' oDocument.LockControllers() - OldAlignMode = CurAlignMode - oModel = oEvent.Source.Model - CurAlignMode = Val(Right(oModel.Name,1)) - ' Todo: Es muss festgestellt werden, welches Imagecontrol vorher selectiert war - ' und die GrafikUrls müssen entsprechend angepasst werden. If OldAlignMode <> CurAlignMode Then For i = 0 To MaxIndex oCurModel = oTCShapeList(i).GetControl @@ -215,9 +215,10 @@ End Sub Sub ChangeArrangemode(oEvent as Object) Dim oModel as Object - OldArrangement = CurArrangement oModel = oEvent.Source.Model - CurArrangement = Val(Right(oModel.Name,1)) + SwitchArrangementButtons(Val(Right(oModel.Name,1))) + oModel.State = 1 + DlgFormDB.GetControl("cmdArrange" & OldArrangement).Model.State = 0 If CurArrangement <> OldArrangement Then ArrangeControls() Select Case CurArrangement @@ -228,8 +229,8 @@ Dim oModel as Object ToggleAlignGroup(CurArrangement = cColumnarLeft) ControlCaptionstoStandardLayout() ' Todo: geht das nicht eleganter? - ToggleDesignmode(oDocument) - ToggleDesignmode(oDocument) +' ToggleDesignmode(oDocument) +' ToggleDesignmode(oDocument) oDBForm.Load End Select @@ -276,7 +277,7 @@ Sub ToggleLayoutPage(bDoEnable as Boolean) .cmdBack.Enabled = bDoEnable .cmdGoOn.Enabled = bDoEnable ' If DlgFormDB.GetControl("imgTheme").Visible Then - .imgTheme.Enabled = bDoEnable +' .imgTheme.Enabled = bDoEnable ' End If End With ToggleAlignGroup(bDoEnable) @@ -294,4 +295,34 @@ Dim oShape as Object End If Next i End Sub + + +Sub SwitchArrangementButtons(ByVal LocArrangement as Integer) + OldArrangement = CurArrangement + CurArrangement = LocArrangement + If OldArrangement <> 0 Then + DlgFormDB.GetControl("cmdArrange" & OldArrangement).Model.State = 0 + End If + DlgFormDB.GetControl("cmdArrange" & CurArrangement).Model.State = 1 +End Sub + + +Sub SwitchBorderButtons(ByVal LocBorderType as Integer) + OldBorderType = CurBorderType + CurBorderType = LocBorderType +' If OldArrangement <> 0 Then + DlgFormDB.GetControl("cmdBorder" & OldBorderType).Model.State = 0 +' End If + DlgFormDB.GetControl("cmdBorder" & CurBorderType).Model.State = 1 +End Sub + + +Sub SwitchAlignButtons(ByVal LocAlignMode as Integer) + OldAlignMode = CurAlignMode + CurAlignMode = LocAlignMode +' If OldAlignMode <> 0 Then + DlgFormDB.GetControl("cmdAlign" & OldAlignMode).Model.State = 0 +' End If + DlgFormDB.GetControl("cmdAlign" & CurAlignMode).Model.State = 1 +End Sub \ No newline at end of file diff --git a/wizards/source/formwizard/dbwizres.src b/wizards/source/formwizard/dbwizres.src index 6b2c7a706b84..21930c1be14e 100644 --- a/wizards/source/formwizard/dbwizres.src +++ b/wizards/source/formwizard/dbwizres.src @@ -2,9 +2,9 @@ * * $RCSfile: dbwizres.src,v $ * - * $Revision: 1.10 $ + * $Revision: 1.11 $ * - * last change: $Author: kz $ $Date: 2001-06-13 23:33:31 $ + * last change: $Author: bc $ $Date: 2001-06-15 15:29:19 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -2523,6 +2523,23 @@ String RID_DB_FORM_WIZARD_START + 60 }; +String RID_DB_FORM_WIZARD_START + 65 +{ + Text = "Dialog wird verkleinert"; + Text[English] = "Dialog will be reduced"; + Text[ English_us ] = "Dialog will be reduced"; + Text[ language_user1 ] = "Hilfetext eines Buttons"; +}; + +String RID_DB_FORM_WIZARD_START + 66 +{ + Text = "Dialog wird vergrößert"; + Text[English] = "Dialog will be enlarged"; + Text[ English_us ] = "Dialog will be enlarged"; + Text[ language_user1 ] = "Hilfetext eines Buttons"; +}; + + // ============================================================================ String RID_DB_QUERY_WIZARD_START + 0 diff --git a/wizards/source/formwizard/develop.xba b/wizards/source/formwizard/develop.xba index 3d2aada4523a..3a58507ed703 100644 --- a/wizards/source/formwizard/develop.xba +++ b/wizards/source/formwizard/develop.xba @@ -1,8 +1,8 @@ REM ***** BASIC ***** -Public oDBShapeList(200) as Object -Public oTCShapeList(200) as Object +Public oDBShapeList() as Object +Public oTCShapeList() as Object Public oGridShape as Object Public a as Integer Public StartA as Integer @@ -20,6 +20,7 @@ Public CurControlType as Integer Public CurFieldlength as Double Public CurFieldType as Integer Public CurFieldName as String +Public CurControlName as String Dim iReduceWidth as Integer Function PositionControls(Maxindex as Integer) @@ -36,15 +37,17 @@ Dim i as Integer CurFieldType = FieldMetaValues(i,0) CurFieldLength = CDbl(FieldMetaValues(i,1)) CurControlType = FieldMetaValues(i,2) + CurControlName = FieldMetaValues(i,3) CurFieldName = FieldNames(i) oTCModel = InsertTextControl(i) InsertDBControl(oDBModel, i) bIsVeryFirstRun = False - oDBModel.LabelControl = oTCModel +' Todo: Klären, wieso er bei der folgenden Zeile abstürzt +' oDBModel.LabelControl = oTCModel ResetPosSizes(i) oProgressbar.Value = i Next i -' ControlCaptionstoStandardLayout() + ControlCaptionstoStandardLayout() bControlsareCreated = True End Function @@ -80,6 +83,7 @@ Sub ResetPosSizes(LastIndex as Integer) a = a + 1 End If Case cLeftJustified,cTopJustified +' Todo: Berücksichtigen, wenn das Label eines Controls länger als das DB-Control ist If nMaxColRightX > cXOffset + nFormWidth Then Dim nOldYTCPos as Long nOldYTCPos = nYTCPos @@ -147,21 +151,20 @@ Dim aSize As New com.sun.star.awt.Size oShape.Position = GetPoint(nXTCPos, nYTCPos) Else oModel = CreateUnoService(oModelService(cLabel)) - oModel.Name ="Label" + (i+1) oModel.Label = CurFieldName ' + nFieldPostfixes(i) (Todo: Was ist ein fieldPostfix?) oDBForm.InsertByName(oModel.Name, oModel) aPoint = GetPoint(nXTCPos, nYTCPos) aSize = GetSize(nTCWidth,nTCHeight) Set oShape = InsertControl(oModel, aPoint, aSize) - Set oTCShapeList(i)= oShape + Set oTCShapeList(i)= oShape If bIsVeryFirstRun Then nTCHeight = GetPreferredHeight(oModel, CurFieldname) If CurArrangement = cColumnarTop Then nYDBPos = nYTCPos + nTCHeight End If End If + nTCWidth = GetPreferredWidth(oModel, True, CurFieldname) End If - nTCWidth = GetPreferredWidth(oModel, True, CurFieldname) CheckOuterPoints(oShape.Position.X, nTCWidth, nYTCPos, nTCHeight) Select Case CurArrangement Case cLeftJustified @@ -206,9 +209,8 @@ Dim iColRightX as Long Else aSize = GetSize(nDBWidth,nDBHeight) oDBModel = CreateUnoService(oModelService(CurControlType)) - oDBModel.Name = ControlList(CurControlType) - ' ToDo: Diese (recht allgemein benamte) Prozedur mit Hilfe von FS anpassen - HandleNumerics(oDBModel) + oDBModel.Name = CurControlName + SetNumerics(oDBModel) oShape = InsertControl(oDBModel, aPoint, aSize) Set oDBShapeList(i)= oShape oDBForm.InsertByName(oDBModel.Name, oDBModel) @@ -375,22 +377,26 @@ Dim n as Integer Dim oColumn as Object Dim aPoint as New com.sun.star.awt.Point Dim aSize as New com.sun.star.awt.Size -Dim ControlName as String Dim nWidth as Long If bControlsareCreated Then - MakeControlsVisible(False) + ShapesToNirwana() End If oGridModel = CreateUnoService(oModelService(cGridControl)) + nWidth = 0 For n = 0 to MaxIndex CurType = FieldMetaValues(n,0) CurControlType = FieldMetaValues(n,2) - CurFieldName = FieldNames(n) - ControlName = ControlList(CurControlType) - oColumn = oGridModel.CreateColumn(ControlName) - oColumn.Name = CalcUniqueContentName(oGridModel, ControlName) -' Todo: Put this in a separate function - HandleNumerics(oColumn) + CurFieldName = FieldNames(n) + If CurControlType = cImageControl Then + CurControlName = "TextField" + oColumn.Hidden = True + Else + CurControlName = FieldMetaValues(n,3) + oColumn = oGridModel.CreateColumn(CurControlName) + End If + oColumn.Name = CalcUniqueContentName(oGridModel, CurControlName) + SetNumerics(oColumn) oColumn.DataField = CurFieldName oColumn.Label = CurFieldName '+ nFieldPostfixes(n); Todo: Was hat das nFieldPostfix hier zu suchen? oColumn.Width = 0 'Spaltenbreite richtet sich nach dem Feldnamen diff --git a/wizards/source/formwizard/tools.xba b/wizards/source/formwizard/tools.xba index 9d42e86674ad..deda298cde8f 100644 --- a/wizards/source/formwizard/tools.xba +++ b/wizards/source/formwizard/tools.xba @@ -17,6 +17,7 @@ Dim aPeerSize as new com.sun.star.awt.Size Dim nWidth as Integer Dim oControl as Object ' Todo: Wie geht das mit ImageControls +' kann nur fest verdrahtet werden If Not IsMissing(LocText) Then aPeerSize = GetPeerSize(oModel, oControl, LocText) Else @@ -102,57 +103,91 @@ End Function Sub ImportStyles() Dim CurIndex as Integer Dim sImportPath as String - oDocument.LockControllers +' oDocument.LockControllers CurIndex = GetCurIndex(oDialogModel.lstStyles, Styles(), NumberofStyles,8) sImportPath = Styles(8,CurIndex) LoadNewStyles(oDocument, oDialogModel, CurIndex, sImportPath, Styles(), TexturePath) - ' Todo: Diese Zeile wieder rein wenn Bug #83015 behoben ist ControlCaptionsToStandardLayout() - oDocument.UnlockControllers + ConfigurePageStyle() +' oDocument.UnlockControllers End Sub -' Todo: Einbinden!!! -Function SetMaxNumericValue(ByVal oLocObject as Object, nType as Long) as Object - oLocObject.DecimalAccuracy = 0 ' keine Nachkommastellen - oLocObject.ValueMin = 0 ' Minwerte sind 0 - select Case (nType) - case cLong - oLocObject.ValueMax = 2147483647 ' Maxwert - case cInteger - oLocObject.ValueMax = 32767 ' Maxwert - case cShortInt - oLocObject.ValueMax = 255 ' Maxwert - case cDecimal - oLocObject.DecimalAccuracy = FieldDecimalAccuracy%(n%) ' Nachkommastellen +Function SetNumerics(ByVal oLocObject as Object) as Object + ' Todo: FS fragen, ob dies alles richtig ist + ' Todo: Es sollte in der Hilfe darauf hingewiesen werden, dass der untere Wertbereich negativ ist. + Select Case CurFieldType + Case com.sun.star.sdbc.DataType.BIGINT + oLocObject.ValueMax = 2147483647 * 2147483647 + oLocObject.ValueMin = -(-2147483648 * -2147483648) + Case com.sun.star.sdbc.DataType.INTEGER + oLocObject.ValueMax = 2147483647 + oLocObject.ValueMin = -2147483648 + Case com.sun.star.sdbc.DataType.SMALLINT + oLocObject.ValueMax = 32767 + oLocObject.ValueMin = -32768 + Case com.sun.star.sdbc.DataType.TINYINT + oLocObject.ValueMax = 127 + oLocObject.ValueMin = -128 + Case com.sun.star.sdbc.DataType.FLOAT, com.sun.star.sdbc.DataType.REAL, com.sun.star.sdbc.DataType.DOUBLE, com.sun.star.sdbc.DataType.DECIMAL, com.sun.star.sdbc.DataType.NUMERIC + ' Todo: Hier sollte der Numberformatter angeworfen werden um die Nachkommastellen + ' festzulegen +' oLocObject.DecimalAccuracy = FieldDecimalAccuracy%(n%) ' Nachkommastellen End Select SetMaxColumnValue = oLocObject End Function -Sub MakeControlsVisible(bIsVisible as Boolean) +' Destroy all Shapes in Nirwana +Sub RemoveShapes() Dim n as Integer Dim oControl as Object - For n = 0 To MaxIndex - oControl = oController.GetControl(oDBShapeList(n).GetControl) - oControl.SetVisible(bIsVisible) - oControl = oController.GetControl(oTCShapeList(n).GetControl) - oControl.SetVisible(bIsVisible) + For n = oDrawPage.Count-1 To 0 Step -1 + oShape = oDrawPage(n) + If oShape.Position.Y > -2000 Then + oDrawPage.Remove(oShape) + End If Next n End Sub - -' Todo: Hier werden allgemeine Einstellungen für numerische Werte vorgenommen -' Was wird mit den Währungen gemacht?; für Dezimalfelder muss die Anzahl der -' Nachkommastellen, Tausenderstellen, festgelegt werden. Stichwort "Formatüberprüfungen" -' im Propertybrowser des Controls -Sub HandleNumerics(oObject) - Select Case CurControlType - Case cNumericBox - oLocObject = SetMaxNumericValue(oLocObject, CurFieldType) - Case cCurrencyBox - oLocObject.CurrencySymbol = s_aCurrencySymbol - oLocObject.PrependCurrencySymbol = s_aPrependCurrencySymbol - End Select +' Note as Shapes cannot be removed from the DrawPage without destroying +' the object we have to park them somewhere in Nirwana +Sub ShapesToNirwana() +Dim n as Integer +Dim oControl as Object + For n = 0 To oDrawPage.Count-1 + oDrawPage(n).Position = GetPoint(-20, -10000) + Next n End Sub - \ No newline at end of file + + +Function CalcUniqueContentName(BYVAL oContainer as Object, sBaseName as String) as String +Dim nPostfix as Integer +Dim sReturn as String + nPostfix = 2 + sReturn = sBaseName + + while (oContainer.hasByName(sReturn)) + sReturn = sBaseName & nPostfix + nPostfix = nPostfix + 1 + Wend + CalcUniqueContentName = sReturn +End Function + + + +Function AddListtoList(FirstArray(), SecondArray(), Optional StarIndex) +Dim n as Integer +Dim m as Integer +Dim MaxIndex as Integer + MaxIndex = Ubound(FirstArray()) + Ubound(SecondArray()) + 1 + Dim ResultArray(MaxIndex) + For m = 0 To Ubound(FirstArray()) + ResultArray(m) = FirstArray(m) + Next m + For n = 0 To Ubound(SecondArray()) + ResultArray(m) = SecondArray(n) + m = m + 1 + Next n + AddListToList() = ResultArray() +End Function \ No newline at end of file diff --git a/wizards/source/tools/ModuleControls.xba b/wizards/source/tools/ModuleControls.xba index ab85b7438e88..0f728b1fb75c 100644 --- a/wizards/source/tools/ModuleControls.xba +++ b/wizards/source/tools/ModuleControls.xba @@ -142,21 +142,30 @@ Dim oCell as Object End Function -Function LoadDialog(Libname as String, DialogName as String, Optional oLibContainer) +Function LoadDialog(Libname as String, DialogName as String) Dim oLib as Object -Dim oLibDialog as Object -Dim oRuntimeDialog as Object - - If IsMissing( oLibContainer ) then - oLibContainer = DialogLibraries - End If - oLibContainer.LoadLibrary(Libname) - oLib = oLibContainer.GetByName(Libname) - oLibDialog = oLib.GetByName(DialogName) - oRuntimeDialog = CreateUnoDialog(oLibDialog) - LoadDialog() = oRuntimeDialog +Dim oDialog as Object + DialogLibraries.loadLibrary(Libname) + oLib = DialogLibraries.GetByName(Libname) + oDialog = CreateUnoDialog(oLib, DialogName) + LoadDialog() = oDialog End Function +'Function LoadDialog(Libname as String, DialogName as String, Optional oLibContainer) +'Dim oLib as Object +'Dim oLibDialog as Object +'Dim oRuntimeDialog as Object + +' If IsMissing( oLibContainer ) then +' oLibContainer = DialogLibraries +' End If +' oLibContainer.LoadLibrary(Libname) +' oLib = oLibContainer.GetByName(Libname) +' oLibDialog = oLib.GetByName(DialogName) +' oRuntimeDialog = CreateUnoDialog(oLibDialog) +' LoadDialog() = oRuntimeDialog +'End Function + Sub SwitchWizardDialogHeight(oDialog as Object) Dim oDialogModel as Object -- cgit v1.2.3