From 3c9942db1ccb44392be1261061dd2335898149e2 Mon Sep 17 00:00:00 2001 From: Tom Verbeek Date: Wed, 16 May 2001 11:48:54 +0000 Subject: #75761# fixed sorting of webwizard and calc styles --- wizards/source/template/Autotext.xba | 2 +- wizards/source/template/Correspondence.xba | 2 +- wizards/source/template/DialogStyles.xdl | 8 +-- wizards/source/template/Samples.xba | 15 ++-- wizards/source/template/TemplateDialog.xdl | 20 +++--- wizards/source/tools/Debug.xba | 10 +-- wizards/source/tools/Misc.xba | 6 +- wizards/source/tools/ModuleControls.xba | 6 +- wizards/source/tools/Strings.xba | 96 +++++++++++++++++-------- wizards/source/webwizard/HtmlAutoPilotBasic.xba | 3 +- wizards/source/webwizard/WebWzrd.xdl | 2 +- 11 files changed, 104 insertions(+), 66 deletions(-) (limited to 'wizards') diff --git a/wizards/source/template/Autotext.xba b/wizards/source/template/Autotext.xba index 14b74d3ef205..d9aca4269f31 100644 --- a/wizards/source/template/Autotext.xba +++ b/wizards/source/template/Autotext.xba @@ -135,4 +135,4 @@ Dim MaxIndex as Integer End Sub - + \ No newline at end of file diff --git a/wizards/source/template/Correspondence.xba b/wizards/source/template/Correspondence.xba index 27299a7fc35c..ce3bf788ab14 100644 --- a/wizards/source/template/Correspondence.xba +++ b/wizards/source/template/Correspondence.xba @@ -212,4 +212,4 @@ Dim oDisp as Object oDisp = StarDesktop.currentFrame.queryDispatch(oUrl, "_self", 0) oDisp.dispatch(oUrl, oArg()) End Sub - + \ No newline at end of file diff --git a/wizards/source/template/DialogStyles.xdl b/wizards/source/template/DialogStyles.xdl index 84b22e8027ec..969cc9ccb0e8 100644 --- a/wizards/source/template/DialogStyles.xdl +++ b/wizards/source/template/DialogStyles.xdl @@ -1,17 +1,17 @@ - + - + - + - + diff --git a/wizards/source/template/Samples.xba b/wizards/source/template/Samples.xba index 00407ef7bc77..b4feb5aa6b68 100644 --- a/wizards/source/template/Samples.xba +++ b/wizards/source/template/Samples.xba @@ -4,7 +4,7 @@ Const SAMPLES = 1000 Const STYLES = 1100 -Const aTempFileName = "Berend_Ilko_Peter_Tom.vor" +Const aTempFileName = "Berend_Ilko_Tom_Stella_Volker.stc" Public Const Twip = 425 Dim oUcbObject as Object Public StylesDir as String @@ -91,12 +91,13 @@ Dim MaxIndex as Integer DialogModel.Title = GetResText(STYLES) DialogModel.cmdCancel.Label = GetResText(STYLES+2) DialogModel.cmdOk.Label = GetResText(STYLES+3) - Stylenames() = ReadDirectories(StylesDir, False, False, True,) - MaxIndex = Val(StyleNames(0,0))-1 + Stylenames() = ReadDirectories(StylesDir, False, False, True,) + MaxIndex = Ubound(Stylenames()) + BubbleSortList(Stylenames(),True) Dim cStyles(MaxIndex) For t = 0 to MaxIndex - Files(t) = StyleNames(t+1,0) - cStyles(t) = StyleNames(t+1,1) + Files(t) = StyleNames(t,0) + cStyles(t) = StyleNames(t,1) Next t On Local Error Resume Next DialogModel.lbStyles.StringItemList() = cStyles() @@ -132,7 +133,7 @@ Sub SaveCurrentStyles(oDocument as Object) aTempURL = aTempURL & "/" & aTempFileName While FileExists(aTempURL) - aTempURL=Left(aTempURL,(Len(aTempURL)-4)) & "_1.vor" + aTempURL=Left(aTempURL,(Len(aTempURL)-4)) & "_1.stc" Wend oDocument.storeToURL(aTempURL, NoArgs()) Exit Sub @@ -176,4 +177,4 @@ Sub KillTempFile() End If End Sub - + \ No newline at end of file diff --git a/wizards/source/template/TemplateDialog.xdl b/wizards/source/template/TemplateDialog.xdl index b7d95a81a087..cf69f6bf2531 100644 --- a/wizards/source/template/TemplateDialog.xdl +++ b/wizards/source/template/TemplateDialog.xdl @@ -1,35 +1,35 @@ - + - + - + - + - + - - + + - + - + - + diff --git a/wizards/source/tools/Debug.xba b/wizards/source/tools/Debug.xba index 04d8235af493..d7af2b539dbe 100644 --- a/wizards/source/tools/Debug.xba +++ b/wizards/source/tools/Debug.xba @@ -81,13 +81,11 @@ End Sub Sub ShowPropertyValues(oLocObject as Object) Dim PropName as String Dim sValues as String -Dim MaxIndex as Integer On Local Error Goto NOPROPERTYSETINFO: sValues = "" - MaxIndex = Ubound(oLocObject.PropertySetInfo.Properties) - For i = 0 To MaxIndex + For i = 0 To Ubound(oLocObject.PropertySetInfo.Properties) Propname = oLocObject.PropertySetInfo.Properties(i).Name - sValues = sValues & PropName & oLocObject.GetPropertyValue(PropName) & chr(13) + sValues = sValues & PropName & chr(13) '" = " & oLocObject.GetPropertyValue(PropName) & chr(13) Next i Msgbox(sValues , 64, GetProductName()) Exit Sub @@ -175,6 +173,4 @@ Sub ShowCommands(oLocObject as Object) Msgbox("Sorry, No 'QueryCommands' - Property attached to the object", 16, GetProductName()) Resume LEAVEPROC LEAVEPROC: -End Sub - - \ No newline at end of file +End Sub \ No newline at end of file diff --git a/wizards/source/tools/Misc.xba b/wizards/source/tools/Misc.xba index 576bc58c525c..4a05f20bf092 100644 --- a/wizards/source/tools/Misc.xba +++ b/wizards/source/tools/Misc.xba @@ -76,13 +76,15 @@ End Function Function GetStarOfficeLocale() as New com.sun.star.lang.Locale Dim aLocLocale As New com.sun.star.lang.Locale Dim sLocale as String -Dim sLocaleList() +Dim sLocaleList(1) Dim oMasterKey oMasterKey = GetRegistryKeyContent("org.openoffice.UserProfile/International/") sLocale = oMasterKey.getByName("Locale") sLocaleList() = ArrayoutofString(sLocale, "-") aLocLocale.Language = sLocaleList(0) - aLocLocale.Country = sLocaleList(1) + If Ubound(sLocaleList()) > 0 Then + aLocLocale.Country = sLocaleList(1) + End If GetStarOfficeLocale() = aLocLocale End Function diff --git a/wizards/source/tools/ModuleControls.xba b/wizards/source/tools/ModuleControls.xba index 186523a9bc8c..ad0ad04dfeea 100644 --- a/wizards/source/tools/ModuleControls.xba +++ b/wizards/source/tools/ModuleControls.xba @@ -145,9 +145,9 @@ End Function Function LoadDialog(Libname as String, DialogName as String) Dim oLib as Object Dim oDialog as Object - DialogLibraries.loadLibrary(Libname) - oLib = DialogLibraries.GetByName(Libname) + dialogs.loadLibrary(Libname) + oLib = dialogs.GetByName(Libname) oDialog = CreateUnoDialog(oLib, DialogName) LoadDialog() = oDialog End Function - + \ No newline at end of file diff --git a/wizards/source/tools/Strings.xba b/wizards/source/tools/Strings.xba index 2e70535b9d49..987796299e78 100644 --- a/wizards/source/tools/Strings.xba +++ b/wizards/source/tools/Strings.xba @@ -35,8 +35,7 @@ End Function ' Finds a PartString, that is framed by the Strings 'Prestring' and 'PostString' Function FindPartString(BigString, PreString, PostString as String, SearchPos as Integer) as String Dim StartPos%, EndPos% -Dim BigLen%,PreLen%,PostLen% - +Dim BigLen%, PreLen%, PostLen% StartPos = Instr(SearchPos,BigString,PreString) If StartPos <> 0 Then PreLen = Len(PreString) @@ -61,9 +60,8 @@ End Function ' Deletes the String 'SmallString' out of the String 'BigString' ' in case SmallString's Position in BigString is right at the end Function RTrimStr(ByVal BigString, SmallString as String) as String -Dim SmallLen% -Dim BigLen% - +Dim SmallLen as Integer +Dim BigLen as Integer SmallLen = Len(SmallString) BigLen = Len(BigString) If Mid(BigString,BigLen + 1 - SmallLen, SmallLen) = SmallString Then @@ -96,26 +94,34 @@ End Function ' The Array MaxLocindex delivers the highest Index of this Array Function ArrayOutOfString(BigString, Separator as String, Optional MaxIndex as integer) Dim i%, OldPos%, Pos%, SepLen%, BigLen% -Dim LocList(200) as string - +Dim CurUbound as Integer +Dim StartUbound as Integer + StartUbound = 50 + Dim LocList(StartUbound) as String + CurUbound = StartUbound OldPos = 1 i = -1 SepLen = Len(Separator) BigLen = Len(BigString) Do - Pos = Instr(OldPos,BigString,Separator) + Pos = Instr(OldPos,BigString, Separator) i = i + 1 If Pos = 0 Then - LocList(i) = Mid(BigString,OldPos,BigLen - OldPos + 1 ) + LocList(i) = Mid(BigString, OldPos, BigLen - OldPos + 1 ) Else - LocList(i) = Mid(BigString,OldPos,Pos-OldPos ) + LocList(i) = Mid(BigString, OldPos, Pos-OldPos ) OldPos = Pos + SepLen End If + If i = CurUbound Then + CurUbound = CurUbound + StartUbound + ReDim Preserve LocList(CurUbound) as String + End If Loop until Pos = 0 - If Vartype(Maxindex) <> 0 Then - MaxIndex = i + If Not IsMissing(Maxindex) Then + MaxIndex = i End If - ArrayoutofString = LocList() + ReDim Preserve LocList(i) as String + ArrayOutofString = LocList() End Function @@ -154,7 +160,6 @@ Dim i as integer End Function - ' Checks if a Field (LocField) is already defined in an Array ' Returns 'True' or 'False' Function FieldinList(LocField, BigList()) As Boolean @@ -353,25 +358,58 @@ Dim LocCount%, LocPos% End Function -Function BubbleSortList(ByVal SortList()) -Dim s as Integer -Dim t as Integer -Dim i as Integer -Dim DisplayDummy as String - i = Val(SortList(0,0)) +Function BubbleSortList(ByVal SortList(),optional sort2ndValue as Boolean) + Dim s as Integer + Dim t as Integer + Dim i,k as Integer + Dim bJustOneDim, bSort2nd as Boolean + Dim DisplayDummy as String + bJustOneDim = false + bSort2nd = false +On Local Error Goto No2ndDim + k = Ubound(SortList(),2) + No2ndDim: + bJustOneDim = Err <> 0 + i = Ubound(SortList(),1) + If ismissing(sort2ndValue) then + bSort2nd = false + else + bSort2nd = sort2ndValue + end if + For s = 1 to i - 1 For t = 0 to i-s - If SortList(t,0) > SortList(t+1, 0) Then - DisplayDummy = SortList(t,0) - SortList(t,0) = SortList(t+1,0) - SortList(t+1,0) = DisplayDummy - - DisplayDummy = SortList(t,1) - SortList(t,1) = SortList(t+1,1) - SortList(t+1,1) = DisplayDummy + If bJustOneDim Then + If SortList(t) > SortList(t+1) Then + DisplayDummy = SortList(t) + SortList(t) = SortList(t+1) + SortList(t+1) = DisplayDummy + End If + Else + If bSort2nd Then + If SortList(t,1) > SortList(t+1,1) Then + DisplayDummy = SortList(t,0) + SortList(t,0) = SortList(t+1,0) + SortList(t+1,0) = DisplayDummy + + DisplayDummy = SortList(t,1) + SortList(t,1) = SortList(t+1,1) + SortList(t+1,1) = DisplayDummy + End If + Else + If SortList(t,0) > SortList(t+1,0) Then + DisplayDummy = SortList(t,0) + SortList(t,0) = SortList(t+1,0) + SortList(t+1,0) = DisplayDummy + + DisplayDummy = SortList(t,1) + SortList(t,1) = SortList(t+1,1) + SortList(t+1,1) = DisplayDummy + End If + End If End If Next t Next s - BubbleSortList = SortList() + BubbleSortList = SortList() End Function \ No newline at end of file diff --git a/wizards/source/webwizard/HtmlAutoPilotBasic.xba b/wizards/source/webwizard/HtmlAutoPilotBasic.xba index 576667416fc7..a605c04c0655 100644 --- a/wizards/source/webwizard/HtmlAutoPilotBasic.xba +++ b/wizards/source/webwizard/HtmlAutoPilotBasic.xba @@ -304,6 +304,7 @@ Dim LocMaxIndex as Integer bItemFound = False TemplatePath = GetOfficeSubPath("Template", "wizard/web/") DirContent() = oUcb.GetFolderContents(TemplatePath,True) + DirContent() = BubbleSortList(DirContent()) LocMaxIndex = Ubound(DirContent()) a = 0 For i = 0 To LocMaxIndex @@ -529,4 +530,4 @@ Sub SetTileBackgroundorNot(DialogModel as Object, oStyle as Object) End If End Sub - + \ No newline at end of file diff --git a/wizards/source/webwizard/WebWzrd.xdl b/wizards/source/webwizard/WebWzrd.xdl index 9091f42b9434..23ee5b288a93 100644 --- a/wizards/source/webwizard/WebWzrd.xdl +++ b/wizards/source/webwizard/WebWzrd.xdl @@ -5,7 +5,7 @@ - + -- cgit