1*b1cdbd2cSJim Jagielski<?xml version="1.0" encoding="UTF-8"?> 2*b1cdbd2cSJim Jagielski<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd"> 3*b1cdbd2cSJim Jagielski<!--*********************************************************** 4*b1cdbd2cSJim Jagielski * 5*b1cdbd2cSJim Jagielski * Licensed to the Apache Software Foundation (ASF) under one 6*b1cdbd2cSJim Jagielski * or more contributor license agreements. See the NOTICE file 7*b1cdbd2cSJim Jagielski * distributed with this work for additional information 8*b1cdbd2cSJim Jagielski * regarding copyright ownership. The ASF licenses this file 9*b1cdbd2cSJim Jagielski * to you under the Apache License, Version 2.0 (the 10*b1cdbd2cSJim Jagielski * "License"); you may not use this file except in compliance 11*b1cdbd2cSJim Jagielski * with the License. You may obtain a copy of the License at 12*b1cdbd2cSJim Jagielski * 13*b1cdbd2cSJim Jagielski * http://www.apache.org/licenses/LICENSE-2.0 14*b1cdbd2cSJim Jagielski * 15*b1cdbd2cSJim Jagielski * Unless required by applicable law or agreed to in writing, 16*b1cdbd2cSJim Jagielski * software distributed under the License is distributed on an 17*b1cdbd2cSJim Jagielski * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 18*b1cdbd2cSJim Jagielski * KIND, either express or implied. See the License for the 19*b1cdbd2cSJim Jagielski * specific language governing permissions and limitations 20*b1cdbd2cSJim Jagielski * under the License. 21*b1cdbd2cSJim Jagielski * 22*b1cdbd2cSJim Jagielski ***********************************************************--> 23*b1cdbd2cSJim Jagielski<script:module xmlns:script="http://openoffice.org/2000/script" script:name="ReadDir" script:language="StarBasic">Option Explicit 24*b1cdbd2cSJim JagielskiPublic Const SBPAGEX = 800 25*b1cdbd2cSJim JagielskiPublic Const SBPAGEY = 800 26*b1cdbd2cSJim JagielskiPublic Const SBRELDIST = 1.3 27*b1cdbd2cSJim Jagielski 28*b1cdbd2cSJim Jagielski' Names of the second Dimension of the Array iLevelPos 29*b1cdbd2cSJim JagielskiPublic Const SBBASEX = 0 30*b1cdbd2cSJim JagielskiPublic Const SBBASEY = 1 31*b1cdbd2cSJim Jagielski 32*b1cdbd2cSJim JagielskiPublic Const SBOLDSTARTX = 2 33*b1cdbd2cSJim JagielskiPublic Const SBOLDSTARTY = 3 34*b1cdbd2cSJim Jagielski 35*b1cdbd2cSJim JagielskiPublic Const SBOLDENDX = 4 36*b1cdbd2cSJim JagielskiPublic Const SBOLDENDY = 5 37*b1cdbd2cSJim Jagielski 38*b1cdbd2cSJim JagielskiPublic Const SBNEWSTARTX = 6 39*b1cdbd2cSJim JagielskiPublic Const SBNEWSTARTY = 7 40*b1cdbd2cSJim Jagielski 41*b1cdbd2cSJim JagielskiPublic Const SBNEWENDX = 8 42*b1cdbd2cSJim JagielskiPublic Const SBNEWENDY = 9 43*b1cdbd2cSJim Jagielski 44*b1cdbd2cSJim JagielskiPublic ConnectLevel As Integer 45*b1cdbd2cSJim JagielskiPublic iLevelPos(1,9) As Long 46*b1cdbd2cSJim JagielskiPublic Source as String 47*b1cdbd2cSJim JagielskiPublic iCurLevel as Integer 48*b1cdbd2cSJim JagielskiPublic nConnectLevel as Integer 49*b1cdbd2cSJim JagielskiPublic nOldWidth, nOldHeight As Long 50*b1cdbd2cSJim JagielskiPublic nOldX, nOldY, nOldLevel As Integer 51*b1cdbd2cSJim JagielskiPublic oOldLeavingLine As Object 52*b1cdbd2cSJim JagielskiPublic oOldArrivingLine As Object 53*b1cdbd2cSJim JagielskiPublic DlgReadDir as Object 54*b1cdbd2cSJim JagielskiDim oProgressBar as Object 55*b1cdbd2cSJim JagielskiDim oDocument As Object 56*b1cdbd2cSJim JagielskiDim oPage As Object 57*b1cdbd2cSJim Jagielski 58*b1cdbd2cSJim Jagielski 59*b1cdbd2cSJim JagielskiSub Main() 60*b1cdbd2cSJim JagielskiDim oStandardTemplate as Object 61*b1cdbd2cSJim Jagielski BasicLibraries.LoadLibrary("Tools") 62*b1cdbd2cSJim Jagielski oDocument = CreateNewDocument("sdraw") 63*b1cdbd2cSJim Jagielski If Not IsNull(oDocument) Then 64*b1cdbd2cSJim Jagielski oPage = oDocument.DrawPages(0) 65*b1cdbd2cSJim Jagielski oStandardTemplate = oDocument.StyleFamilies.GetByName("graphics").GetByName("standard") 66*b1cdbd2cSJim Jagielski oStandardTemplate.CharHeight = 10 67*b1cdbd2cSJim Jagielski oStandardTemplate.TextLeftDistance = 100 68*b1cdbd2cSJim Jagielski oStandardTemplate.TextRightDistance = 100 69*b1cdbd2cSJim Jagielski oStandardTemplate.TextUpperDistance = 50 70*b1cdbd2cSJim Jagielski oStandardTemplate.TextLowerDistance = 50 71*b1cdbd2cSJim Jagielski DlgReadDir = LoadDialog("Gimmicks","ReadFolderDlg") 72*b1cdbd2cSJim Jagielski oProgressBar = DlgReadDir.Model.ProgressBar1 73*b1cdbd2cSJim Jagielski DlgReadDir.Model.TextField1.Text = ConvertFromUrl(GetPathSettings("Work")) 74*b1cdbd2cSJim Jagielski DlgReadDir.Model.cmdGoOn.DefaultButton = True 75*b1cdbd2cSJim Jagielski DlgReadDir.GetControl("TextField1").SetFocus() 76*b1cdbd2cSJim Jagielski DlgReadDir.Execute 77*b1cdbd2cSJim Jagielski End If 78*b1cdbd2cSJim JagielskiEnd Sub 79*b1cdbd2cSJim Jagielski 80*b1cdbd2cSJim Jagielski 81*b1cdbd2cSJim JagielskiSub TreeInfo() 82*b1cdbd2cSJim JagielskiDim oCurTextShape As Object 83*b1cdbd2cSJim JagielskiDim i as Integer 84*b1cdbd2cSJim JagielskiDim bStartUpRun As Boolean 85*b1cdbd2cSJim JagielskiDim CurFilename as String 86*b1cdbd2cSJim JagielskiDim BaseLevel as Integer 87*b1cdbd2cSJim JagielskiDim oController as Object 88*b1cdbd2cSJim JagielskiDim MaxFileIndex as Integer 89*b1cdbd2cSJim JagielskiDim FileNames() as String 90*b1cdbd2cSJim Jagielski ToggleDialogControls(False) 91*b1cdbd2cSJim Jagielski oProgressBar.ProgressValueMin = 0 92*b1cdbd2cSJim Jagielski oProgressBar.ProgressValueMax = 100 93*b1cdbd2cSJim Jagielski bStartUpRun = True 94*b1cdbd2cSJim Jagielski nOldHeight = 200 95*b1cdbd2cSJim Jagielski nOldY = SBPAGEY 96*b1cdbd2cSJim Jagielski nOldX = SBPAGEX 97*b1cdbd2cSJim Jagielski nOldWidth = SBPAGEX 98*b1cdbd2cSJim Jagielski oController = oDocument.GetCurrentController 99*b1cdbd2cSJim Jagielski Source = ConvertToURL(DlgReadDir.Model.TextField1.Text) 100*b1cdbd2cSJim Jagielski BaseLevel = CountCharsInString(Source, "/", 1) 101*b1cdbd2cSJim Jagielski oProgressBar.ProgressValue = 5 102*b1cdbd2cSJim Jagielski DlgReadDir.Model.Label3.Enabled = True 103*b1cdbd2cSJim Jagielski FileNames() = ReadSourceDirectory(Source) 104*b1cdbd2cSJim Jagielski DlgReadDir.Model.Label4.Enabled = True 105*b1cdbd2cSJim Jagielski DlgReadDir.Model.Label3.Enabled = False 106*b1cdbd2cSJim Jagielski oProgressBar.ProgressValue = 12 107*b1cdbd2cSJim Jagielski FileNames() = BubbleSortList(FileNames()) 108*b1cdbd2cSJim Jagielski DlgReadDir.Model.Label5.Enabled = True 109*b1cdbd2cSJim Jagielski DlgReadDir.Model.Label4.Enabled = False 110*b1cdbd2cSJim Jagielski oProgressBar.ProgressValue = 20 111*b1cdbd2cSJim Jagielski MaxFileIndex = Ubound(FileNames(),1) 112*b1cdbd2cSJim Jagielski For i = 0 To MaxFileIndex 113*b1cdbd2cSJim Jagielski oProgressBar.ProgressValue = 20 + (i/MaxFileIndex * 80) 114*b1cdbd2cSJim Jagielski CurFilename = FileNames(i,1) 115*b1cdbd2cSJim Jagielski SetNewLevels(FileNames(i,0), BaseLevel) 116*b1cdbd2cSJim Jagielski oCurTextShape = CreateTextShape(oPage, CurFilename) 117*b1cdbd2cSJim Jagielski CheckPageWidth(oCurTextShape.Size.Width) 118*b1cdbd2cSJim Jagielski iLevelPos(iCurLevel,SBBASEY) = oCurTextShape.Position.Y 119*b1cdbd2cSJim Jagielski If i = 0 Then 120*b1cdbd2cSJim Jagielski AdjustPageHeight(oCurTextShape.Size.Height, MaxFileIndex + 1) 121*b1cdbd2cSJim Jagielski End If 122*b1cdbd2cSJim Jagielski ' The Current TextShape has To be connected with a TextShape one Level higher 123*b1cdbd2cSJim Jagielski ' except for a TextShape In Level 0: 124*b1cdbd2cSJim Jagielski If Not bStartUpRun Then 125*b1cdbd2cSJim Jagielski ' A leaving Line Is only drawn when level is not 0 126*b1cdbd2cSJim Jagielski If iCurLevel<> 0 Then 127*b1cdbd2cSJim Jagielski ' Determine the Coordinates of the arriving Line 128*b1cdbd2cSJim Jagielski iLevelPos(iCurLevel,SBOLDSTARTX) = iLevelPos(nConnectLevel,SBNEWSTARTX) 129*b1cdbd2cSJim Jagielski iLevelPos(iCurLevel,SBOLDSTARTY) = oCurTextShape.Position.Y + 0.5 * oCurTextShape.Size.Height 130*b1cdbd2cSJim Jagielski 131*b1cdbd2cSJim Jagielski iLevelPos(iCurLevel,SBOLDENDX) = iLevelPos(iCurLevel,SBBASEX) 132*b1cdbd2cSJim Jagielski iLevelPos(iCurLevel,SBOLDENDY) = oCurTextShape.Position.Y + 0.5 * oCurTextShape.Size.Height 133*b1cdbd2cSJim Jagielski 134*b1cdbd2cSJim Jagielski oOldArrivingLine = DrawLine(iCurLevel, SBOLDSTARTX, SBOLDSTARTY, SBOLDENDX, SBOLDENDY, oPage) 135*b1cdbd2cSJim Jagielski 136*b1cdbd2cSJim Jagielski ' Determine the End-Coordinates of the last leaving Line 137*b1cdbd2cSJim Jagielski iLevelPos(nConnectLevel,SBNEWENDX) = iLevelPos(nConnectLevel,SBNEWSTARTX) 138*b1cdbd2cSJim Jagielski iLevelPos(nConnectLevel,SBNEWENDY) = oCurTextShape.Position.Y + 0.5 * oCurTextShape.Size.Height 139*b1cdbd2cSJim Jagielski Else 140*b1cdbd2cSJim Jagielski ' On Level 0 the last Leaving Line's Endpoint is the upper edge of the TextShape 141*b1cdbd2cSJim Jagielski iLevelPos(nConnectLevel,SBNEWENDY) = oCurTextShape.Position.Y 142*b1cdbd2cSJim Jagielski iLevelPos(nConnectLevel,SBNEWENDX) = iLevelPos(nConnectLevel,SBNEWSTARTX) 143*b1cdbd2cSJim Jagielski End If 144*b1cdbd2cSJim Jagielski ' Draw the Connectors To the previous TextShapes 145*b1cdbd2cSJim Jagielski oOldLeavingLine = DrawLine(nConnectLevel, SBNEWSTARTX, SBNEWSTARTY, SBNEWENDX, SBNEWENDY, oPage) 146*b1cdbd2cSJim Jagielski Else 147*b1cdbd2cSJim Jagielski ' StartingPoint of the leaving Edge 148*b1cdbd2cSJim Jagielski bStartUpRun = FALSE 149*b1cdbd2cSJim Jagielski End If 150*b1cdbd2cSJim Jagielski 151*b1cdbd2cSJim Jagielski ' Determine the beginning Coordinates of the leaving Line 152*b1cdbd2cSJim Jagielski iLevelPos(iCurLevel,SBNEWSTARTX) = iLevelPos(iCurLevel,SBBASEX) + 0.5 * oCurTextShape.Size.Width 153*b1cdbd2cSJim Jagielski iLevelPos(iCurLevel,SBNEWSTARTY) = iLevelPos(iCurLevel,SBBASEY) + oCurTextShape.Size.Height 154*b1cdbd2cSJim Jagielski 155*b1cdbd2cSJim Jagielski ' Save the values For the Next run 156*b1cdbd2cSJim Jagielski nOldHeight = oCurTextShape.Size.Height 157*b1cdbd2cSJim Jagielski nOldX = oCurTextShape.Position.X 158*b1cdbd2cSJim Jagielski nOldWidth = oCurTextShape.Size.Width 159*b1cdbd2cSJim Jagielski nOldLevel = iCurLevel 160*b1cdbd2cSJim Jagielski Next i 161*b1cdbd2cSJim Jagielski ToggleDialogControls(True) 162*b1cdbd2cSJim Jagielski DlgReadDir.Model.cmdGoOn.Enabled = False 163*b1cdbd2cSJim JagielskiEnd Sub 164*b1cdbd2cSJim Jagielski 165*b1cdbd2cSJim Jagielski 166*b1cdbd2cSJim JagielskiFunction CreateTextShape(oPage as Object, Filename as String) 167*b1cdbd2cSJim JagielskiDim oTextShape As Object 168*b1cdbd2cSJim JagielskiDim aPoint As New com.sun.star.awt.Point 169*b1cdbd2cSJim Jagielski 170*b1cdbd2cSJim Jagielski aPoint.X = CalculateXPoint() 171*b1cdbd2cSJim Jagielski aPoint.Y = nOldY + SBRELDIST * nOldHeight 172*b1cdbd2cSJim Jagielski nOldY = aPoint.Y 173*b1cdbd2cSJim Jagielski 174*b1cdbd2cSJim Jagielski oTextShape = oDocument.createInstance("com.sun.star.drawing.TextShape") 175*b1cdbd2cSJim Jagielski oTextShape.LineStyle = 1 176*b1cdbd2cSJim Jagielski oTextShape.Position = aPoint 177*b1cdbd2cSJim Jagielski 178*b1cdbd2cSJim Jagielski oPage.add(oTextShape) 179*b1cdbd2cSJim Jagielski oTextShape.TextAutoGrowWidth = TRUE 180*b1cdbd2cSJim Jagielski oTextShape.TextAutoGrowHeight = TRUE 181*b1cdbd2cSJim Jagielski oTextShape.String = FileName 182*b1cdbd2cSJim Jagielski 183*b1cdbd2cSJim Jagielski ' Configure Size And Position of the TextShape according to its Scripting 184*b1cdbd2cSJim Jagielski aPoint.X = iLevelPos(iCurLevel,SBBASEX) 185*b1cdbd2cSJim Jagielski oTextShape.Position = aPoint 186*b1cdbd2cSJim Jagielski CreateTextShape() = oTextShape 187*b1cdbd2cSJim JagielskiEnd Function 188*b1cdbd2cSJim Jagielski 189*b1cdbd2cSJim Jagielski 190*b1cdbd2cSJim JagielskiFunction CalculateXPoint() 191*b1cdbd2cSJim Jagielski ' The current level Is lower than the Old one 192*b1cdbd2cSJim Jagielski If (iCurLevel< nOldLevel) And (iCurLevel<> 0) Then 193*b1cdbd2cSJim Jagielski ' ClearArray(iLevelPos(),iCurLevel+1) 194*b1cdbd2cSJim Jagielski Elseif iCurLevel= 0 Then 195*b1cdbd2cSJim Jagielski iLevelPos(iCurLevel,SBBASEX) = SBPAGEX 196*b1cdbd2cSJim Jagielski ' The current level Is higher than the old one 197*b1cdbd2cSJim Jagielski Elseif iCurLevel> nOldLevel Then 198*b1cdbd2cSJim Jagielski iLevelPos(iCurLevel,SBBASEX) = iLevelPos(iCurLevel-1,SBBASEX) + nOldWidth + 100 199*b1cdbd2cSJim Jagielski End If 200*b1cdbd2cSJim Jagielski CalculateXPoint = iLevelPos(iCurLevel,SBBASEX) 201*b1cdbd2cSJim JagielskiEnd Function 202*b1cdbd2cSJim Jagielski 203*b1cdbd2cSJim Jagielski 204*b1cdbd2cSJim JagielskiFunction DrawLine(nLevel, nStartX, nStartY, nEndX, nEndY As Integer, oPage as Object) 205*b1cdbd2cSJim JagielskiDim oConnect As Object 206*b1cdbd2cSJim JagielskiDim aPoint As New com.sun.star.awt.Point 207*b1cdbd2cSJim JagielskiDim aSize As New com.sun.star.awt.Size 208*b1cdbd2cSJim Jagielski aPoint.X = iLevelPos(nLevel,nStartX) 209*b1cdbd2cSJim Jagielski aPoint.Y = iLevelPos(nLevel,nStartY) 210*b1cdbd2cSJim Jagielski aSize.Width = iLevelPos(nLevel,nEndX) - iLevelPos(nLevel,nStartX) 211*b1cdbd2cSJim Jagielski aSize.Height = iLevelPos(nLevel,nEndY) - iLevelPos(nLevel,nStartY) 212*b1cdbd2cSJim Jagielski oConnect = oDocument.createInstance("com.sun.star.drawing.LineShape") 213*b1cdbd2cSJim Jagielski oConnect.Position = aPoint 214*b1cdbd2cSJim Jagielski oConnect.Size = aSize 215*b1cdbd2cSJim Jagielski oPage.Add(oConnect) 216*b1cdbd2cSJim Jagielski DrawLine() = oConnect 217*b1cdbd2cSJim JagielskiEnd Function 218*b1cdbd2cSJim Jagielski 219*b1cdbd2cSJim Jagielski 220*b1cdbd2cSJim JagielskiSub GetSourceDirectory() 221*b1cdbd2cSJim Jagielski GetFolderName(DlgReadDir.Model.TextField1) 222*b1cdbd2cSJim JagielskiEnd Sub 223*b1cdbd2cSJim Jagielski 224*b1cdbd2cSJim Jagielski 225*b1cdbd2cSJim JagielskiFunction ReadSourceDirectory(ByVal Source As String) 226*b1cdbd2cSJim JagielskiDim i as Integer 227*b1cdbd2cSJim JagielskiDim m as Integer 228*b1cdbd2cSJim JagielskiDim n as Integer 229*b1cdbd2cSJim JagielskiDim s as integer 230*b1cdbd2cSJim JagielskiDim FileName as string 231*b1cdbd2cSJim JagielskiDim FileNameList(100,1) as String 232*b1cdbd2cSJim JagielskiDim DirList(0) as String 233*b1cdbd2cSJim JagielskiDim oUCBobject as Object 234*b1cdbd2cSJim JagielskiDim DirContent() as String 235*b1cdbd2cSJim JagielskiDim SystemPath as String 236*b1cdbd2cSJim JagielskiDim PathSeparator as String 237*b1cdbd2cSJim JagielskiDim MaxFileIndex as Integer 238*b1cdbd2cSJim Jagielski PathSeparator = GetPathSeparator() 239*b1cdbd2cSJim Jagielski oUcbobject = createUnoService("com.sun.star.ucb.SimpleFileAccess") 240*b1cdbd2cSJim Jagielski m = 0 241*b1cdbd2cSJim Jagielski s = 0 242*b1cdbd2cSJim Jagielski DirList(0) = Source 243*b1cdbd2cSJim Jagielski FileNameList(n,0) = Source 244*b1cdbd2cSJim Jagielski SystemPath = ConvertFromUrl(Source) 245*b1cdbd2cSJim Jagielski FileNameList(n,1) = FileNameoutofPath(SystemPath, PathSeparator) 246*b1cdbd2cSJim Jagielski n = 1 247*b1cdbd2cSJim Jagielski Do 248*b1cdbd2cSJim Jagielski Source = DirList(m) 249*b1cdbd2cSJim Jagielski m = m + 1 250*b1cdbd2cSJim Jagielski DirContent() = oUcbObject.GetFolderContents(Source,True) 251*b1cdbd2cSJim Jagielski If Ubound(DirContent()) <> -1 Then 252*b1cdbd2cSJim Jagielski MaxFileIndex = Ubound(DirContent()) 253*b1cdbd2cSJim Jagielski For i = 0 to MaxFileIndex 254*b1cdbd2cSJim Jagielski FileName = DirContent(i) 255*b1cdbd2cSJim Jagielski FileNameList(n,0) = FileName 256*b1cdbd2cSJim Jagielski SystemPath = ConvertFromUrl(FileName) 257*b1cdbd2cSJim Jagielski FileNameList(n,1) = FileNameOutofPath(SystemPath, PathSeparator) 258*b1cdbd2cSJim Jagielski n = n + 1 259*b1cdbd2cSJim Jagielski If n > Ubound(FileNameList(),1) Then 260*b1cdbd2cSJim Jagielski ReDim Preserve FileNameList(n + 10,1) as String 261*b1cdbd2cSJim Jagielski End If 262*b1cdbd2cSJim Jagielski If oUcbObject.IsFolder(FileName) Then 263*b1cdbd2cSJim Jagielski s = s + 1 264*b1cdbd2cSJim Jagielski ReDim Preserve DirList(s) as String 265*b1cdbd2cSJim Jagielski DirList(s) = FileName 266*b1cdbd2cSJim Jagielski End If 267*b1cdbd2cSJim Jagielski Next i 268*b1cdbd2cSJim Jagielski End If 269*b1cdbd2cSJim Jagielski Loop Until m > Ubound(DirList() 270*b1cdbd2cSJim Jagielski ReDim Preserve FileNameList(n-1,1) as String 271*b1cdbd2cSJim Jagielski ReadSourceDirectory() = FileNameList() 272*b1cdbd2cSJim JagielskiEnd Function 273*b1cdbd2cSJim Jagielski 274*b1cdbd2cSJim Jagielski 275*b1cdbd2cSJim JagielskiSub CloseDialog 276*b1cdbd2cSJim Jagielski DlgReadDir.EndExecute 277*b1cdbd2cSJim JagielskiEnd Sub 278*b1cdbd2cSJim Jagielski 279*b1cdbd2cSJim Jagielski 280*b1cdbd2cSJim JagielskiSub AdjustPageHeight(lShapeHeight, FileCount) 281*b1cdbd2cSJim JagielskiDim lNecHeight as Long 282*b1cdbd2cSJim JagielskiDim lBorders as Long 283*b1cdbd2cSJim Jagielski oDocument.LockControllers 284*b1cdbd2cSJim Jagielski lBorders = oPage.BorderTop + oPage.BorderBottom 285*b1cdbd2cSJim Jagielski lNecHeight = SBPAGEY + (FileCount * SBRELDIST * lShapeHeight) 286*b1cdbd2cSJim Jagielski If lNecHeight > (oPage.Height - lBorders) Then 287*b1cdbd2cSJim Jagielski oPage.Height = lNecHeight + lBorders + 500 288*b1cdbd2cSJim Jagielski End If 289*b1cdbd2cSJim Jagielski oDocument.UnlockControllers 290*b1cdbd2cSJim JagielskiEnd Sub 291*b1cdbd2cSJim Jagielski 292*b1cdbd2cSJim Jagielski 293*b1cdbd2cSJim JagielskiSub SetNewLevels(FileName as String, BaseLevel as Integer) 294*b1cdbd2cSJim Jagielski iCurLevel= CountCharsInString(FileName, "/", 1) - BaseLevel 295*b1cdbd2cSJim Jagielski If iCurLevel <> 0 Then 296*b1cdbd2cSJim Jagielski nConnectLevel = iCurLevel- 1 297*b1cdbd2cSJim Jagielski Else 298*b1cdbd2cSJim Jagielski nConnectLevel = iCurLevel 299*b1cdbd2cSJim Jagielski End If 300*b1cdbd2cSJim Jagielski If iCurLevel > Ubound(iLevelPos(),1) Then 301*b1cdbd2cSJim Jagielski ReDim Preserve iLevelPos(iCurLevel,9) as Long 302*b1cdbd2cSJim Jagielski End If 303*b1cdbd2cSJim JagielskiEnd Sub 304*b1cdbd2cSJim Jagielski 305*b1cdbd2cSJim Jagielski 306*b1cdbd2cSJim JagielskiSub CheckPageWidth(TextWidth as Long) 307*b1cdbd2cSJim JagielskiDim PageWidth as Long 308*b1cdbd2cSJim JagielskiDim BaseX as Long 309*b1cdbd2cSJim Jagielski PageWidth = oPage.Width 310*b1cdbd2cSJim Jagielski BaseX = iLevelPos(iCurLevel,SBBASEX) 311*b1cdbd2cSJim Jagielski If BaseX + TextWidth > PageWidth - 1000 Then 312*b1cdbd2cSJim Jagielski oPage.Width = 1000 + BaseX + TextWidth 313*b1cdbd2cSJim Jagielski End If 314*b1cdbd2cSJim JagielskiEnd Sub 315*b1cdbd2cSJim Jagielski 316*b1cdbd2cSJim Jagielski 317*b1cdbd2cSJim JagielskiSub ToggleDialogControls(bDoEnable as Boolean) 318*b1cdbd2cSJim Jagielski With DlgReadDir.Model 319*b1cdbd2cSJim Jagielski .cmdGoOn.Enabled = bDoEnable 320*b1cdbd2cSJim Jagielski .cmdGetDir.Enabled = bDoEnable 321*b1cdbd2cSJim Jagielski .Label1.Enabled = bDoEnable 322*b1cdbd2cSJim Jagielski .Label2.Enabled = bDoEnable 323*b1cdbd2cSJim Jagielski .TextField1.Enabled = bDoEnable 324*b1cdbd2cSJim Jagielski End With 325*b1cdbd2cSJim JagielskiEnd Sub</script:module> 326