summaryrefslogtreecommitdiff
path: root/wizards
diff options
context:
space:
mode:
Diffstat (limited to 'wizards')
-rw-r--r--wizards/source/tools/Listbox.xba25
-rw-r--r--wizards/source/tools/ModuleControls.xba56
2 files changed, 70 insertions, 11 deletions
diff --git a/wizards/source/tools/Listbox.xba b/wizards/source/tools/Listbox.xba
index f3d56027e6bc..b61afad93b55 100644
--- a/wizards/source/tools/Listbox.xba
+++ b/wizards/source/tools/Listbox.xba
@@ -274,20 +274,25 @@ End Function
' 'RemoveItem' appears only only once in the Listbox
Sub RemoveListboxItemByName(oListbox as Object, RemoveItem as String)
Dim OldList() as String
+Dim NullList() as String
Dim i as Integer
Dim a as Integer
Dim MaxIndex as Integer
- a = 0
- MaxIndex = Ubound(oListbox.StringItemList())
OldList = oListbox.StringItemList()
- Dim NewList(MaxIndex -1)
- For i = 0 To MaxIndex
- If RemoveItem <> OldList(i) Then
- NewList(a) = OldList(i)
- a = a + 1
- End If
- Next i
- oListbox.StringItemList() = NewList()
+ MaxIndex = Ubound(OldList())
+ If MaxIndex > 0 Then
+ a = 0
+ Dim NewList(MaxIndex -1)
+ For i = 0 To MaxIndex
+ If RemoveItem <> OldList(i) Then
+ NewList(a) = OldList(i)
+ a = a + 1
+ End If
+ Next i
+ oListbox.StringItemList() = NewList()
+ Else
+ oListBox.StringItemList() = NullList()
+ End If
End Sub
diff --git a/wizards/source/tools/ModuleControls.xba b/wizards/source/tools/ModuleControls.xba
index c8614baa4c49..59c1363e55c9 100644
--- a/wizards/source/tools/ModuleControls.xba
+++ b/wizards/source/tools/ModuleControls.xba
@@ -182,4 +182,58 @@ Dim iYPos as Integer
oDialogModel.cmdGoOn.PositionY = iYPos
oDialogModel.cmdSwitchHeight.PositionY = iYPos
oDialogModel.Height = iDlgHeight
-End Sub</script:module> \ No newline at end of file
+End Sub
+
+
+Sub GetFolderName(oRefModel as Object)
+Dim oFolderDialog
+Dim iAccept as Integer
+Dim sPath as String
+Dim InitPath as String
+Dim RefControlName as String
+Dim oUcb as object
+ oUcb = createUnoService(&quot;com.sun.star.ucb.SimpleFileAccess&quot;)
+ oFolderDialog = CreateUnoService(&quot;com.sun.star.ui.dialogs.FolderPicker&quot;)
+ InitPath = ConvertToUrl(oRefModel.Text)
+ If oUcb.Exists(InitPath) Then
+ oFolderDialog.SetDisplayDirectory(InitPath)
+ End If
+ iAccept = oFolderDialog.Execute()
+ If iAccept = 1 Then
+ sPath = oFolderDialog.GetDisplayDirectory()
+ If oUcb.Exists(sPath) Then
+ oRefModel.Text = ConvertFromUrl(sPath)
+ End If
+ End If
+End Sub
+
+
+Sub GetFileName(oRefModel as Object, Filternames())
+Dim oFileDialog as Object
+Dim iAccept as Integer
+Dim sPath as String
+Dim InitPath as String
+Dim RefControlName as String
+Dim oUcb as object
+Dim i as Integer
+Dim MaxIndex as Integer
+ oUcb = createUnoService(&quot;com.sun.star.ucb.SimpleFileAccess&quot;)
+ oFileDialog = CreateUnoService(&quot;com.sun.star.ui.dialogs.FilePicker&quot;)
+ MaxIndex = Ubound(FilterNames())
+ For i = 0 To MaxIndex
+ oFileDialog.AppendFilter(FilterNames(i,0), FilterNames(i,1))
+ Next i
+ oFileDialog.SetCurrentFilter(FilterNames(0,0)
+ InitPath = ConvertToUrl(oRefModel.Text)
+ If oUcb.Exists(InitPath) Then
+ oFileDialog.SetDisplayDirectory(InitPath)
+ End If
+ iAccept = oFileDialog.Execute()
+ If iAccept = 1 Then
+ sPath = oFileDialog.Files(0)
+ If oUcb.Exists(sPath) Then
+ oRefModel.Text = ConvertFromUrl(sPath)
+ End If
+ End If
+End Sub
+</script:module> \ No newline at end of file