summaryrefslogtreecommitdiff
path: root/wizards
diff options
context:
space:
mode:
authorBehrend Cornelius <bc@openoffice.org>2001-06-25 08:36:11 +0000
committerBehrend Cornelius <bc@openoffice.org>2001-06-25 08:36:11 +0000
commita9828d6d3061282652a8e3ff971fe4145315e30a (patch)
treef07366d78260ec59343ca97765e0769556c75983 /wizards
parent778c958b1f53f19e616e0c56539779fd42d10d71 (diff)
#88615# Common file and FolderPicker Subs added in ModuleControls.xba
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
&apos; &apos;RemoveItem&apos; 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 &lt;&gt; OldList(i) Then
- NewList(a) = OldList(i)
- a = a + 1
- End If
- Next i
- oListbox.StringItemList() = NewList()
+ MaxIndex = Ubound(OldList())
+ If MaxIndex &gt; 0 Then
+ a = 0
+ Dim NewList(MaxIndex -1)
+ For i = 0 To MaxIndex
+ If RemoveItem &lt;&gt; 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