summaryrefslogtreecommitdiff
path: root/wizards/source/formwizard
diff options
context:
space:
mode:
Diffstat (limited to 'wizards/source/formwizard')
-rw-r--r--wizards/source/formwizard/DlgFormDB.xdl6
-rw-r--r--wizards/source/formwizard/FormWizard.xba94
-rw-r--r--wizards/source/formwizard/tools.xba3
3 files changed, 67 insertions, 36 deletions
diff --git a/wizards/source/formwizard/DlgFormDB.xdl b/wizards/source/formwizard/DlgFormDB.xdl
index 8e24ae8aa749..3adaf08fa8c8 100644
--- a/wizards/source/formwizard/DlgFormDB.xdl
+++ b/wizards/source/formwizard/DlgFormDB.xdl
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE dlg:window PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "dialog.dtd">
-<dlg:window xmlns:dlg="http://openoffice.org/2000/dialog" dlg:id="DlgFormDB" dlg:left="96" dlg:top="28" dlg:width="270" dlg:height="210" dlg:page="2" dlg:help-url="HID:34400">
+<dlg:window xmlns:dlg="http://openoffice.org/2000/dialog" dlg:id="DlgFormDB" dlg:left="96" dlg:top="28" dlg:width="270" dlg:height="210" dlg:page="1" dlg:help-url="HID:34400">
<dlg:bulletinboard>
<dlg:text dlg:id="lblSelFields" dlg:tab-index="0" dlg:left="154" dlg:top="70" dlg:width="110" dlg:height="8" dlg:page="1" dlg:value="lblSelFields"/>
<dlg:menulist dlg:id="lstDatabases" dlg:tab-index="1" dlg:left="6" dlg:top="51" dlg:width="110" dlg:height="12" dlg:page="1" dlg:help-url="HID:34410" dlg:spin="true">
@@ -13,7 +13,9 @@
<dlg:button dlg:id="cmdCancel" dlg:tab-index="4" dlg:left="6" dlg:top="190" dlg:width="53" dlg:height="14" dlg:help-url="HID:34401" dlg:value="cmdCancel">
<dlg:event dlg:listener-type="com.sun.star.awt.XActionListener" dlg:event-method="actionPerformed" dlg:script-type="StarBasic" dlg:script-code="FormWizard.FormWizard.CancelFormWizard"/>
</dlg:button>
- <dlg:button dlg:id="cmdHelp" dlg:tab-index="5" dlg:left="63" dlg:top="190" dlg:width="53" dlg:height="14" dlg:help-url="HiD:34400" dlg:value="cmdHelp"/>
+ <dlg:button dlg:id="cmdHelp" dlg:tab-index="5" dlg:left="63" dlg:top="190" dlg:width="53" dlg:height="14" dlg:tag="34400" dlg:help-url="HiD:34400" dlg:value="cmdHelp">
+ <dlg:event dlg:listener-type="com.sun.star.awt.XActionListener" dlg:event-method="actionPerformed" dlg:script-type="StarBasic" dlg:script-code="Tools.Recursive.ShowHelperDialog"/>
+ </dlg:button>
<dlg:button dlg:id="cmdBack" dlg:tab-index="6" dlg:left="155" dlg:top="190" dlg:width="53" dlg:height="14" dlg:help-url="HID:34401" dlg:value="cmdBack">
<dlg:event dlg:listener-type="com.sun.star.awt.XActionListener" dlg:event-method="actionPerformed" dlg:script-type="StarBasic" dlg:script-code="FormWizard.FormWizard.PreviousStep"/>
</dlg:button>
diff --git a/wizards/source/formwizard/FormWizard.xba b/wizards/source/formwizard/FormWizard.xba
index 4cb509ed4188..0cfac5663106 100644
--- a/wizards/source/formwizard/FormWizard.xba
+++ b/wizards/source/formwizard/FormWizard.xba
@@ -34,7 +34,38 @@ Public Tablename as String
&apos; Todo: Mit FS abschnacken, dass als CommandType Nur Queries und Tables zugelassen sind. Dabei müsste noch abgklärt werden
&apos; wann ein Content ein &apos;Command&apos; ist.
-Sub MainWithDefault(Optional DatasourceName as String, Optional CommandType as Integer, Optional sContent as String, Optional oConnection as Object)
+
+&apos; The macro can be called in 4 possible scenarios:
+&apos; Scenario 1. No parameters at given
+&apos; Scenario 2: Only Datasourcename is given, but no connection and no Content
+&apos; Scenario 3: a data source and a connection are given
+&apos; Scenario 4: all parameters (data source name, connection, object type and object) are given
+
+Sub Main()
+Dim oLocDBContext as Object
+Dim oLocConnection as Object
+
+&apos; Scenario 1. No parameters at given
+ MainWithDefault()
+
+&apos; Scenario 2: Only Datasourcename is given, but no connection and no Content
+&apos; MainWithDefault(&quot;Bibliography&quot;)
+
+&apos; Scenario 3: a data source and a connection are given
+&apos; oLocDBContext = CreateUnoService(&quot;com.sun.star.sdb.DatabaseContext&quot;)
+&apos; oLocConnection = oLocDBContext.GetByName(&quot;Bibliography&quot;).GetConnection(&quot;&quot;,&quot;&quot;)
+&apos; MainWithDefault(&quot;Bibliography&quot;, oLocConnection)
+
+&apos; Scenario 4: all parameters (data source name, connection, object type and object) are given
+&apos; oLocDBContext = CreateUnoService(&quot;com.sun.star.sdb.DatabaseContext&quot;)
+&apos; oLocConnection = oLocDBContext.GetByName(&quot;Bibliography&quot;).GetConnection(&quot;&quot;,&quot;&quot;)
+&apos; MainWithDefault(&quot;Bibliography&quot;, oLocConnection, com.sun.star.sdb.CommandType.TABLE, &quot;biblio&quot;)
+End Sub
+
+
+Sub MainWithDefault(Optional DatasourceName as String, Optional oConnection as Object, Optional CommandType as Integer, Optional sContent as String)
+Dim i as Integer
+Dim SelCount as Integer
&apos;On Local Error Goto GlobalError
BasicLibraries.LoadLibrary(&quot;Tools&quot;)
BasicLibraries.LoadLibrary(&quot;WebWizard&quot;)
@@ -57,21 +88,7 @@ Sub MainWithDefault(Optional DatasourceName as String, Optional CommandType as I
InitializeWidthList()
LoadLanguage
bNeedFieldRefresh = True
- If Not IsMissing(DataSourceName) Then
- CreateForm(DatasourceName, CommandType, sContent, oConnection)
- Else
- CreateForm()
- End If
-GlobalError:
- If Err &lt;&gt; 0 Then
- ToggleWindow(True)
- MsgBox(sMsgErrMsg , 16, sMsgWizardName)
- End If
-End Sub
-
-Sub CreateForm(Optional DatasourceName as String, Optional CommandType as Integer, Optional sContent as String, Optional oConnection as Object) as String
-Dim i as Integer
With oDialogModel
.optIgnoreBinaries.State = True
.cmdBack.Enabled = False
@@ -81,31 +98,43 @@ Dim i as Integer
.Step = 1
.lstDatabases.StringItemList()= sDatabaseList()&apos; = AddItem(sDatabaseList(i)
End With
-
If Not IsMissing(DataSourceName) Then
DlgFormDB.GetControl(&quot;lstDatabases&quot;).SelectItem(DataSourceName, True)
- Set oDBConnection = oConnection
- If GetDBMetaData() Then
- oDialogModel.lstTables.StringItemList() = AddListToList(TableNames(), QueryNames())
- iCommandTypes() = CreateCommandTypeList()
- SelCount = CountItemsInArray()
- If SelCount = 1 Then
- DlgFormDB.GetControl(&quot;lstTables&quot;).SelectItem(sContent, True)
- Else &apos; Note here is no Error Handling in case that no valid content is transferred
- If CommandType = com.sun.star.sdb.CommandType.QUERY Then
- SelIndex = IndexInArray(sContent, QueryNames()
- DlgFormDB.GetControl(&quot;lstTables&quot;).SelectItemPos(SelIndex, True)
- ElseIf CommandType = com.sun.star.sdb.CommandType.TABLE Then
- SelIndex = IndexInArray(sContent, TableNames()
- DlgFormDB.GetControl(&quot;lstTables&quot;).SelectItemPos(Ubound(QueryNames()+1 + SelIndex, True)
+ If Not IsMissing(oConnection) Then
+ &apos; Scenario 3: a data source and a connection are given
+ Set oDBConnection = oConnection
+ oDialogModel.lstTables.Enabled = True
+ oDialogModel.lblTables.Enabled = True
+ If GetDBMetaData() Then
+ oDialogModel.lstTables.StringItemList() = AddListToList(TableNames(), QueryNames())
+ If Not IsMissing(sContent) Then
+ &apos; Scenario 4: all parameters (data source name, connection, object type and object) are given
+ iCommandTypes() = CreateCommandTypeList()
+ SelCount = CountItemsInArray(oDialogModel.lstTables.StringItemList(), sContent)
+ If SelCount = 1 Then
+ DlgFormDB.GetControl(&quot;lstTables&quot;).SelectItem(sContent, True)
+ Else &apos; Note: Here is no Error Handling in case that no valid content is transferred
+ If CommandType = com.sun.star.sdb.CommandType.QUERY Then
+ SelIndex = IndexInArray(sContent, QueryNames()
+ DlgFormDB.GetControl(&quot;lstTables&quot;).SelectItemPos(SelIndex, True)
+ ElseIf CommandType = com.sun.star.sdb.CommandType.TABLE Then
+ SelIndex = IndexInArray(sContent, TableNames()
+ DlgFormDB.GetControl(&quot;lstTables&quot;).SelectItemPos(Ubound(QueryNames()+1 + SelIndex, True)
+ End If
+ End If
+ CurCommandType = CommandType
+ FillUpFieldsListbox(False)
End If
End If
- CurCommandType = CommandType
- FillUpFieldsListbox(False)
+ Else
+ &apos; Scenario 2: Only Datasourcename is given, but no connection and no Content
+ GetSelectedDBMetaData()
End If
Else
+ &apos; Scenario 1: No parameters are given
ToggleListboxControls(oDialogModel, False)
End If
+
DlgFormDB.Title = WizardTitle(1)
NumberofStyles = FillupWebListbox(oUcb, &quot;/stl&quot;, DlgFormDB, &quot;lstStyles&quot;, Styles())
ImportStyles()
@@ -113,7 +142,6 @@ Dim i as Integer
oDialogModel.imgTheme.ImageURL = FormPath &amp; &quot;FormWizard_1.bmp&quot;
DlgFormDB.Execute()
Exit Sub
-
GlobalError:
MsgBox(sMsgErrMsg , 16, sMsgWizardName)
ToggleWindow(True)
diff --git a/wizards/source/formwizard/tools.xba b/wizards/source/formwizard/tools.xba
index e715b07b9547..d19512bb0aa2 100644
--- a/wizards/source/formwizard/tools.xba
+++ b/wizards/source/formwizard/tools.xba
@@ -204,7 +204,8 @@ Dim i as Integer
Dim MaxIndex as Integer
Dim ResCount as Integer
ResCount = 0
- For i = o To MaxIndex
+ MaxIndex = Ubound(BigArray())
+ For i = 0 To MaxIndex
If SearchItem = BigArray(i) Then
ResCount = ResCount + 1
End If