ReadDir.xba (3e02b54d) | ReadDir.xba (6a2578b9) |
---|---|
1<?xml version="1.0" encoding="UTF-8"?> 2<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd"> 3<!--*********************************************************** 4 * 5 * Licensed to the Apache Software Foundation (ASF) under one 6 * or more contributor license agreements. See the NOTICE file 7 * distributed with this work for additional information 8 * regarding copyright ownership. The ASF licenses this file --- 76 unchanged lines hidden (view full) --- 85Dim CurFilename as String 86Dim BaseLevel as Integer 87Dim oController as Object 88Dim MaxFileIndex as Integer 89Dim FileNames() as String 90 ToggleDialogControls(False) 91 oProgressBar.ProgressValueMin = 0 92 oProgressBar.ProgressValueMax = 100 | 1<?xml version="1.0" encoding="UTF-8"?> 2<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd"> 3<!--*********************************************************** 4 * 5 * Licensed to the Apache Software Foundation (ASF) under one 6 * or more contributor license agreements. See the NOTICE file 7 * distributed with this work for additional information 8 * regarding copyright ownership. The ASF licenses this file --- 76 unchanged lines hidden (view full) --- 85Dim CurFilename as String 86Dim BaseLevel as Integer 87Dim oController as Object 88Dim MaxFileIndex as Integer 89Dim FileNames() as String 90 ToggleDialogControls(False) 91 oProgressBar.ProgressValueMin = 0 92 oProgressBar.ProgressValueMax = 100 |
93 bStartUpRun = True | 93 bStartUpRun = True |
94 nOldHeight = 200 95 nOldY = SBPAGEY 96 nOldX = SBPAGEX 97 nOldWidth = SBPAGEX 98 oController = oDocument.GetCurrentController 99 Source = ConvertToURL(DlgReadDir.Model.TextField1.Text) 100 BaseLevel = CountCharsInString(Source, "/", 1) 101 oProgressBar.ProgressValue = 5 --- 52 unchanged lines hidden (view full) --- 154 155 ' Save the values For the Next run 156 nOldHeight = oCurTextShape.Size.Height 157 nOldX = oCurTextShape.Position.X 158 nOldWidth = oCurTextShape.Size.Width 159 nOldLevel = iCurLevel 160 Next i 161 ToggleDialogControls(True) | 94 nOldHeight = 200 95 nOldY = SBPAGEY 96 nOldX = SBPAGEX 97 nOldWidth = SBPAGEX 98 oController = oDocument.GetCurrentController 99 Source = ConvertToURL(DlgReadDir.Model.TextField1.Text) 100 BaseLevel = CountCharsInString(Source, "/", 1) 101 oProgressBar.ProgressValue = 5 --- 52 unchanged lines hidden (view full) --- 154 155 ' Save the values For the Next run 156 nOldHeight = oCurTextShape.Size.Height 157 nOldX = oCurTextShape.Position.X 158 nOldWidth = oCurTextShape.Size.Width 159 nOldLevel = iCurLevel 160 Next i 161 ToggleDialogControls(True) |
162 DlgReadDir.Model.cmdGoOn.Enabled = False | 162 DlgReadDir.Model.cmdGoOn.Enabled = False |
163End Sub 164 165 166Function CreateTextShape(oPage as Object, Filename as String) 167Dim oTextShape As Object 168Dim aPoint As New com.sun.star.awt.Point 169 170 aPoint.X = CalculateXPoint() 171 aPoint.Y = nOldY + SBRELDIST * nOldHeight | 163End Sub 164 165 166Function CreateTextShape(oPage as Object, Filename as String) 167Dim oTextShape As Object 168Dim aPoint As New com.sun.star.awt.Point 169 170 aPoint.X = CalculateXPoint() 171 aPoint.Y = nOldY + SBRELDIST * nOldHeight |
172 nOldY = aPoint.Y | 172 nOldY = aPoint.Y |
173 174 oTextShape = oDocument.createInstance("com.sun.star.drawing.TextShape") 175 oTextShape.LineStyle = 1 176 oTextShape.Position = aPoint 177 178 oPage.add(oTextShape) 179 oTextShape.TextAutoGrowWidth = TRUE 180 oTextShape.TextAutoGrowHeight = TRUE 181 oTextShape.String = FileName 182 | 173 174 oTextShape = oDocument.createInstance("com.sun.star.drawing.TextShape") 175 oTextShape.LineStyle = 1 176 oTextShape.Position = aPoint 177 178 oPage.add(oTextShape) 179 oTextShape.TextAutoGrowWidth = TRUE 180 oTextShape.TextAutoGrowHeight = TRUE 181 oTextShape.String = FileName 182 |
183 ' Configure Size And Position of the TextShape according to its Scripting | 183 ' Configure Size And Position of the TextShape according to its Scripting |
184 aPoint.X = iLevelPos(iCurLevel,SBBASEX) 185 oTextShape.Position = aPoint 186 CreateTextShape() = oTextShape 187End Function 188 189 190Function CalculateXPoint() 191 ' The current level Is lower than the Old one --- 52 unchanged lines hidden (view full) --- 244 SystemPath = ConvertFromUrl(Source) 245 FileNameList(n,1) = FileNameoutofPath(SystemPath, PathSeparator) 246 n = 1 247 Do 248 Source = DirList(m) 249 m = m + 1 250 DirContent() = oUcbObject.GetFolderContents(Source,True) 251 If Ubound(DirContent()) <> -1 Then | 184 aPoint.X = iLevelPos(iCurLevel,SBBASEX) 185 oTextShape.Position = aPoint 186 CreateTextShape() = oTextShape 187End Function 188 189 190Function CalculateXPoint() 191 ' The current level Is lower than the Old one --- 52 unchanged lines hidden (view full) --- 244 SystemPath = ConvertFromUrl(Source) 245 FileNameList(n,1) = FileNameoutofPath(SystemPath, PathSeparator) 246 n = 1 247 Do 248 Source = DirList(m) 249 m = m + 1 250 DirContent() = oUcbObject.GetFolderContents(Source,True) 251 If Ubound(DirContent()) <> -1 Then |
252 MaxFileIndex = Ubound(DirContent()) | 252 MaxFileIndex = Ubound(DirContent()) |
253 For i = 0 to MaxFileIndex 254 FileName = DirContent(i) 255 FileNameList(n,0) = FileName 256 SystemPath = ConvertFromUrl(FileName) 257 FileNameList(n,1) = FileNameOutofPath(SystemPath, PathSeparator) 258 n = n + 1 259 If n > Ubound(FileNameList(),1) Then 260 ReDim Preserve FileNameList(n + 10,1) as String 261 End If 262 If oUcbObject.IsFolder(FileName) Then 263 s = s + 1 264 ReDim Preserve DirList(s) as String 265 DirList(s) = FileName 266 End If 267 Next i 268 End If | 253 For i = 0 to MaxFileIndex 254 FileName = DirContent(i) 255 FileNameList(n,0) = FileName 256 SystemPath = ConvertFromUrl(FileName) 257 FileNameList(n,1) = FileNameOutofPath(SystemPath, PathSeparator) 258 n = n + 1 259 If n > Ubound(FileNameList(),1) Then 260 ReDim Preserve FileNameList(n + 10,1) as String 261 End If 262 If oUcbObject.IsFolder(FileName) Then 263 s = s + 1 264 ReDim Preserve DirList(s) as String 265 DirList(s) = FileName 266 End If 267 Next i 268 End If |
269 Loop Until m > Ubound(DirList() | 269 Loop Until m > Ubound(DirList()) |
270 ReDim Preserve FileNameList(n-1,1) as String 271 ReadSourceDirectory() = FileNameList() 272End Function 273 274 275Sub CloseDialog 276 DlgReadDir.EndExecute 277End Sub 278 279 | 270 ReDim Preserve FileNameList(n-1,1) as String 271 ReadSourceDirectory() = FileNameList() 272End Function 273 274 275Sub CloseDialog 276 DlgReadDir.EndExecute 277End Sub 278 279 |
280Sub AdjustPageHeight(lShapeHeight, FileCount) | 280Sub AdjustPageHeight(lShapeHeight, FileCount) |
281Dim lNecHeight as Long 282Dim lBorders as Long 283 oDocument.LockControllers 284 lBorders = oPage.BorderTop + oPage.BorderBottom 285 lNecHeight = SBPAGEY + (FileCount * SBRELDIST * lShapeHeight) 286 If lNecHeight > (oPage.Height - lBorders) Then | 281Dim lNecHeight as Long 282Dim lBorders as Long 283 oDocument.LockControllers 284 lBorders = oPage.BorderTop + oPage.BorderBottom 285 lNecHeight = SBPAGEY + (FileCount * SBRELDIST * lShapeHeight) 286 If lNecHeight > (oPage.Height - lBorders) Then |
287 oPage.Height = lNecHeight + lBorders + 500 | 287 oPage.Height = lNecHeight + lBorders + 500 |
288 End If | 288 End If |
289 oDocument.UnlockControllers | 289 oDocument.UnlockControllers |
290End Sub 291 292 293Sub SetNewLevels(FileName as String, BaseLevel as Integer) 294 iCurLevel= CountCharsInString(FileName, "/", 1) - BaseLevel 295 If iCurLevel <> 0 Then 296 nConnectLevel = iCurLevel- 1 297 Else --- 28 unchanged lines hidden --- | 290End Sub 291 292 293Sub SetNewLevels(FileName as String, BaseLevel as Integer) 294 iCurLevel= CountCharsInString(FileName, "/", 1) - BaseLevel 295 If iCurLevel <> 0 Then 296 nConnectLevel = iCurLevel- 1 297 Else --- 28 unchanged lines hidden --- |