summaryrefslogtreecommitdiff
path: root/wizards/source/formwizard/FormWizard.xba
diff options
context:
space:
mode:
Diffstat (limited to 'wizards/source/formwizard/FormWizard.xba')
-rw-r--r--wizards/source/formwizard/FormWizard.xba75
1 files changed, 48 insertions, 27 deletions
diff --git a/wizards/source/formwizard/FormWizard.xba b/wizards/source/formwizard/FormWizard.xba
index 38ef1d381419..6c0a3b614282 100644
--- a/wizards/source/formwizard/FormWizard.xba
+++ b/wizards/source/formwizard/FormWizard.xba
@@ -14,7 +14,7 @@ Public bWithBackGraphic as Boolean
Public bNeedFieldRefresh as Boolean
Public oDBForm as Object
Public oColumns() as Object
-Public sDatabaseList()
+Public sDatabaseList() as String
Public TableNames() as String
Public QueryNames() as String
Public FieldNames() as String
@@ -85,12 +85,10 @@ Dim SelList(0) as Integer
Exit Sub
End If
oDocument.GetCurrentController().Frame.ComponentWindow.Enable = False
- oProgressBar.Value = 5
- GetDatabaseNames()
oProgressBar.Value = 10
- InitializeWidthList()
- oProgressBar.Value = 20
LoadLanguage()
+ oProgressBar.Value = 20
+ InitializeWidthList()
oProgressBar.Value = 30
Styles() = getListBoxArrays(oUcb, "/stl")
CurIndex = GetCurIndex(DialogModel, Styles(), 2)
@@ -106,7 +104,8 @@ Dim SelList(0) as Integer
.lblTables.Enabled = False
.lstSelFields.Tag = False
.Step = 1
- .lstDatabases.StringItemList()= sDatabaseList()' = AddItem(sDatabaseList(i)
+ .lstDatabases.StringItemList()= GetDatabaseNames(IsMissing(DataSourceName))
+ .lstDatabases.SelectedItems() = Array(0)
End With
oProgressBar.Value = 60
If Not IsMissing(DataSourceName) Then
@@ -133,7 +132,7 @@ Dim SelList(0) as Integer
DlgFormDB.GetControl("lstTables").SelectItemPos(SelIndex, True)
ElseIf CommandType = com.sun.star.sdb.CommandType.TABLE Then
SelIndex = IndexInArray(sContent, TableNames()
- DlgFormDB.GetControl("lstTables").SelectItemPos(Ubound(QueryNames()+1 + SelIndex, True)
+ DlgFormDB.GetControl("lstTables").SelectItemPos(Ubound(QueryNames()+1 + SelIndex, True)
End If
End If
CurCommandType = CommandType
@@ -154,10 +153,10 @@ Dim SelList(0) as Integer
DialogModel.lstStyles.StringItemList() = ArrayfromMultiArray(Styles, 1)
DialogModel.lstStyles.SelectedItems() = SelList()
ControlCaptionsToStandardLayout()
-
oDocument.GetCurrentController().Frame.ComponentWindow.Enable = True
oProgressBar.Value = 90
DialogModel.imgTheme.ImageURL = FormPath & "FormWizard_1.bmp"
+ DialogModel.imgTheme.BackGroundColor = RGB(0,60,126)
ToggleDatabasePage(True)
oProgressBar.Value = 100
DlgFormDB.GetControl("lstDatabases").SetFocus()
@@ -173,16 +172,17 @@ Dim SelList(0) as Integer
RemoveNirwanaShapes()
End If
WIZARDERROR:
- If Err <> 0 Then
+ If Err <> 0 Then
Msgbox(sMsgErrMsg, 16, GetProductName())
Resume LOCERROR
- LOCERROR:
+ LOCERROR:
End If
End Sub
Sub FormGetFields()
Dim i as Integer
+ DeleteFirstListBoxEntry("lstTables", sSelectDBTable)
ToggleDatabasePage(False)
FillUpFieldsListbox(True)
ToggleDatabasePage(True)
@@ -190,20 +190,18 @@ End Sub
Sub FillUpFieldsListbox(bGetCommandType as Boolean)
-Dim n as Integer
Dim SelIndex as Integer
Dim QueryIndex as Integer
If Not bDebug Then
On Local Error GoTo NOFIELDS
End If
- n = Ubound(DialogModel.lstTables.SelectedItems())
- If n > -1 Then
- SelIndex = DialogModel.lstTables.SelectedItems(0)
+ SelIndex = DlgFormDB.GetControl("lstTables").getSelectedItemPos() '.SelectedItems())
+ If SelIndex > -1 Then
If bGetCommandType Then
CurCommandType = iCommandTypes(SelIndex)
End If
If CurCommandType = com.sun.star.sdb.CommandType.QUERY Then
- QueryIndex = SelIndex - Ubound(Tablenames()) - 1
+ QueryIndex = SelIndex - Ubound(Tablenames()) - 1
Tablename = QueryNames(QueryIndex)
oColumns = oDBConnection.Queries.GetByName(TableName).Columns
Else
@@ -211,13 +209,11 @@ Dim QueryIndex as Integer
oColumns = oDBConnection.Tables.GetByName(Tablename).Columns
End If
If GetSpecificFieldNames() <> -1 Then
- ToggleListboxControls(DialogModel, True)
- Else
- EmptyFieldsListboxes()
+ ToggleListboxControls(DialogModel, True)
+ Exit Sub
End If
- Else
- EmptyFieldsListboxes()
End If
+ EmptyFieldsListboxes()
NOFIELDS:
If Err <> 0 Then
MsgBox sMsgErrCouldNotOpenObject, 16, sMsgWizardName
@@ -239,10 +235,10 @@ Sub PreviousStep()
End With
FormSetMoveRights()
WIZARDERROR:
- If Err <> 0 Then
+ If Err <> 0 Then
Msgbox(sMsgErrMsg, 16, GetProductName())
Resume LOCERROR
- LOCERROR:
+ LOCERROR:
End If
End Sub
@@ -274,7 +270,7 @@ WIZARDERROR:
If Err <> 0 Then
Msgbox(sMsgErrMsg, 16, GetProductName())
Resume LOCERROR
- LOCERROR:
+ LOCERROR:
End If
End Sub
@@ -306,9 +302,9 @@ End Sub
' This Sub is called from the Procedure "StoreDocument" in the "Tools" Library
Sub CommitLastDocumentChanges(sTargetPath as String)
-Dim i as Integer
+Dim i as Integer
Dim sBookmarkName as String
-Dim oDBBookmarks as Object
+Dim oDBBookmarks as Object
Dim bLinkExists as Boolean
Dim sBaseBookmarkName as String
sBookmarkName = GetFileNamewithoutExtension(FileNameoutofPath(sTargetPath))
@@ -337,8 +333,8 @@ Dim TypeNames(0,2) as String
Dim oMasterKey as Object
Dim oTypes() as Object
oMasterKey = GetRegistryKeyContent("org.openoffice.Office.TypeDetection/")
- oTypes() = oMasterKey.Types
- TypeNames(0,0) = oTypes.GetByName("writer_StarOffice_XML_Writer").UIName
+ oTypes() = oMasterKey.Filters
+ TypeNames(0,0) = GetFilterName("StarOffice XML (Writer)")
TypeNames(0,1) = "*.sxw"
TypeNames(0,2) = ""
sTargetPath = StoreDocument(oDocument, TypeNames(), "Form_" & sDBName & "_" & TableName & ".sxw", WorkPath, 1)
@@ -355,4 +351,29 @@ Dim NullList() as String
DialogModel.lstSelFields.StringItemList() = NullList()
bEnableBinaryOptionGroup = False
End Sub
+
+
+Sub DeleteFirstDBListBoxEntry()
+ DeleteFirstListBoxEntry("lstDatabases", sSelectDatasource)
+End Sub
+
+
+Sub DeleteFirstTableListBoxEntry()
+ DeleteFirstListBoxEntry("lstTables", sSelectDBTable)
+End Sub
+
+Sub DeleteFirstListboxEntry(ListBoxName as String, DelEntryName as String)
+Dim oListbox as Object
+Dim sFirstItem as String
+dim iSelPos as Integer
+ oListBox = DlgFormDB.getControl(ListBoxName)
+ sFirstItem = oListBox.getItem(0)
+ If sFirstItem = DelEntryName Then
+ iSelPos = oListBox.getSelectedItemPos()
+ oListBox.removeItems(0, 1)
+ If iSelPos > 0 Then
+ oListBox.selectItemPos(iSelPos-1, True)
+ End If
+ End If
+End Sub
</script:module> \ No newline at end of file