summaryrefslogtreecommitdiff
path: root/wizards
diff options
context:
space:
mode:
authorBehrend Cornelius <bc@openoffice.org>2001-06-21 13:47:44 +0000
committerBehrend Cornelius <bc@openoffice.org>2001-06-21 13:47:44 +0000
commit7a47e72c044da7d3a41148cbb721936ca5940f06 (patch)
treebabfe1af633f4971959817ec1a23ce12f55229f4 /wizards
parent9a8be587090efc901c43108091dcaa72007eba38 (diff)
#88615# New Listbox methods inserted
Diffstat (limited to 'wizards')
-rw-r--r--wizards/source/tools/Listbox.xba38
-rw-r--r--wizards/source/tools/ModuleControls.xba3
-rw-r--r--wizards/source/tools/Strings.xba24
3 files changed, 60 insertions, 5 deletions
diff --git a/wizards/source/tools/Listbox.xba b/wizards/source/tools/Listbox.xba
index 0f69beab917e..f3d56027e6bc 100644
--- a/wizards/source/tools/Listbox.xba
+++ b/wizards/source/tools/Listbox.xba
@@ -268,4 +268,40 @@ Dim CurIndex as Integer
Next i
GetSelectedListboxItems() = SelList()
End Function
-</script:module> \ No newline at end of file
+
+
+&apos; Note: When using this Sub it must be ensured that the
+&apos; &apos;RemoveItem&apos; appears only only once in the Listbox
+Sub RemoveListboxItemByName(oListbox as Object, RemoveItem as String)
+Dim OldList() 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()
+End Sub
+
+
+Function GetItemPos(oListBox as Object, sItem as String)
+Dim ItemList()
+Dim MaxIndex as Integer
+Dim i as Integer
+ ItemList() = oListBox.StringItemList()
+ MaxIndex = Ubound(ItemList())
+ For i = 0 To MaxIndex
+ If sItem = ItemList(i) Then
+ GetItemPos() = i
+ Exit Function
+ End If
+ Next i
+ GetItemPos() = -1
+End Function</script:module> \ No newline at end of file
diff --git a/wizards/source/tools/ModuleControls.xba b/wizards/source/tools/ModuleControls.xba
index 678e07ecf7c3..27c03469ceeb 100644
--- a/wizards/source/tools/ModuleControls.xba
+++ b/wizards/source/tools/ModuleControls.xba
@@ -146,10 +146,9 @@ Function LoadDialog(Libname as String, DialogName as String, Optional oLibContai
Dim oLib as Object
Dim oLibDialog as Object
Dim oRuntimeDialog as Object
- If IsMissing( oLibContainer ) then
+ If IsMissing(oLibContainer ) then
oLibContainer = DialogLibraries
End If
- oLibContainer.LoadLibrary(Libname)
oLib = oLibContainer.GetByName(Libname)
oLibDialog = oLib.GetByName(DialogName)
oRuntimeDialog = CreateUnoDialog(oLibDialog)
diff --git a/wizards/source/tools/Strings.xba b/wizards/source/tools/Strings.xba
index 0cedb611e23e..d43d36ec5ed7 100644
--- a/wizards/source/tools/Strings.xba
+++ b/wizards/source/tools/Strings.xba
@@ -42,7 +42,7 @@ Dim BigLen%, PreLen%, PostLen%
BigLen = Len(BigString)
PostLen = Len(PostString)
FindPartString = Mid(BigString,StartPos + PreLen, EndPos - (StartPos + PreLen))
- &apos; Da diese Funktion daf?r programmiert wurde, in einer Schleife abgearbeitet zu werden
+ &apos; Da diese Funktion daf├╝r programmiert wurde, in einer Schleife abgearbeitet zu werden
&apos; muss die initiale Suchposition hinter die Position des gefundenen Teilstrings gesetzt werden.
SearchPos = EndPos + PostLen
Else
@@ -55,6 +55,22 @@ Dim BigLen%, PreLen%, PostLen%
End Function
+&apos; Note iCompare = 0 (Binary comparison)
+&apos; iCompare = 1 (Text comparison)
+Function PartStringInArray(BigArray(), SearchString as String, iCompare as Integer) as Integer
+Dim MaxIndex as Integer
+Dim i as Integer
+ MaxIndex = Ubound(BigArray())
+ For i = 0 To MaxIndex
+ If Instr(1, BigArray(i), SearchString, iCompare) &lt;&gt; 0 Then
+ PartStringInArray() = i
+ Exit Function
+ End If
+ Next i
+ PartStringInArray() = -1
+End Function
+
+
&apos; Deletes the String &apos;SmallString&apos; out of the String &apos;BigString&apos;
&apos; in case SmallString&apos;s Position in BigString is right at the end
Function RTrimStr(ByVal BigString, SmallString as String) as String
@@ -118,7 +134,11 @@ Dim StartUbound as Integer
If Not IsMissing(Maxindex) Then
MaxIndex = i
End If
- ReDim Preserve LocList(i) as String
+ If i &lt;&gt; -1 Then
+ ReDim Preserve LocList(i) as String
+ Else
+ ReDim LocList() as String
+ End If
ArrayOutofString = LocList()
End Function