1cdf0e10cSrcweir<?xml version="1.0" encoding="UTF-8"?> 2cdf0e10cSrcweir<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd"> 3cdf0e10cSrcweir<script:module xmlns:script="http://openoffice.org/2000/script" script:name="AutoPilotRun" script:language="StarBasic">Option Explicit 4cdf0e10cSrcweir 5cdf0e10cSrcweirPublic SourceDir as String 6cdf0e10cSrcweirPublic TargetDir as String 7cdf0e10cSrcweirPublic TargetStemDir as String 8cdf0e10cSrcweirPublic SourceFile as String 9cdf0e10cSrcweirPublic TargetFile as String 10cdf0e10cSrcweirPublic Source as String 11cdf0e10cSrcweirPublic SubstFile as String 12cdf0e10cSrcweirPublic SubstDir as String 13cdf0e10cSrcweirPublic NoArgs() 14*283d1c44SPedro GiffuniPublic TypeList(14) as String 15cdf0e10cSrcweirPublic GoOn as Boolean 16cdf0e10cSrcweirPublic DoUnprotect as Integer 17cdf0e10cSrcweirPublic Password as String 18cdf0e10cSrcweirPublic DocIndex as Integer 19cdf0e10cSrcweirPublic oPathSettings as Object 20cdf0e10cSrcweirPublic oUcb as Object 21cdf0e10cSrcweirPublic TotDocCount as Integer 22cdf0e10cSrcweirPublic sTotDocCount as String 23cdf0e10cSrcweirPublic OpenProperties(1) as New com.sun.star.beans.PropertyValue 24cdf0e10cSrcweir 25cdf0e10cSrcweir 26cdf0e10cSrcweirSub StartAutoPilot() 27cdf0e10cSrcweirDim i As Integer 28cdf0e10cSrcweirDim oFactoryKey as Object 29cdf0e10cSrcweir BasicLibraries.LoadLibrary("Tools") 30cdf0e10cSrcweir BasicLibraries.LoadLibrary("ImportWizard") 31cdf0e10cSrcweir If InitResources("Euro Converter", "eur") Then 32cdf0e10cSrcweir oUcb = createUnoService("com.sun.star.ucb.SimpleFileAccess") 33cdf0e10cSrcweir oLocale = GetStarOfficeLocale() 34cdf0e10cSrcweir InitializeConverter(oLocale, 2) 35cdf0e10cSrcweir ToggleGoOnButton() 36cdf0e10cSrcweir oFactoryKey = GetRegistryKeyContent("org.openoffice.Setup/Office/Factories") 37cdf0e10cSrcweir DialogModel.chkTextDocuments.Enabled = oFactoryKey.hasbyName("com.sun.star.text.TextDocument") 38cdf0e10cSrcweir DialogModel.cmdGoOn.DefaultButton = True 39cdf0e10cSrcweir DialogModel.lstCurrencies.TabIndex = 12 40cdf0e10cSrcweir DialogConvert.GetControl("optWholeDir").SetFocus() 41cdf0e10cSrcweir DialogConvert.Execute() 42cdf0e10cSrcweir DialogConvert.Dispose() 43cdf0e10cSrcweir End If 44cdf0e10cSrcweirEnd Sub 45cdf0e10cSrcweir 46cdf0e10cSrcweir 47cdf0e10cSrcweirSub ConvertDocuments() 48cdf0e10cSrcweirDim FilesList() 49cdf0e10cSrcweirDim bDisposable as Boolean 50cdf0e10cSrcweir 51cdf0e10cSrcweir If Source <> "" And TargetDir <> "" Then 52cdf0e10cSrcweir If DialogModel.optSingleFile.State = 1 Then 53cdf0e10cSrcweir SourceFile = Source 54cdf0e10cSrcweir TotDocCount = 1 55cdf0e10cSrcweir Else 56cdf0e10cSrcweir SourceDir = Source 57cdf0e10cSrcweir TargetStemDir = TargetDir 58*283d1c44SPedro Giffuni TypeList(0) = "calc8" 59*283d1c44SPedro Giffuni TypeList(1) = "calc_StarOffice_XML_Calc" 60*283d1c44SPedro Giffuni TypeList(2) = "calc_StarCalc_30" 61*283d1c44SPedro Giffuni TypeList(3) = "calc_StarCalc_40" 62*283d1c44SPedro Giffuni TypeList(4) = "calc_StarCalc_50" 63cdf0e10cSrcweir If DialogModel.chkTextDocuments.State = 1 Then 64*283d1c44SPedro Giffuni ReDim Preserve TypeList(13) as String 65*283d1c44SPedro Giffuni 66*283d1c44SPedro Giffuni TypeList(5) = "writer8" 67*283d1c44SPedro Giffuni TypeList(6) = "writerglobal8" 68*283d1c44SPedro Giffuni TypeList(7) = "writer_StarOffice_XML_Writer" 69*283d1c44SPedro Giffuni TypeList(8) = "writer_globaldocument_StarOffice_XML_Writer_GlobalDocument" 70*283d1c44SPedro Giffuni TypeList(9) = "writer_StarWriter_30" 71*283d1c44SPedro Giffuni TypeList(10) = "writer_StarWriter_40" 72*283d1c44SPedro Giffuni TypeList(11) = "writer_globaldocument_StarWriter_40GlobalDocument" 73*283d1c44SPedro Giffuni TypeList(12) = "writer_StarWriter_50" 74*283d1c44SPedro Giffuni TypeList(13) = "writer_globaldocument_StarWriter_50GlobalDocument" 75cdf0e10cSrcweir End If 76*283d1c44SPedro Giffuni FilesList() = ReadDirectories(SourceDir, bRecursive, True, False, TypeList()) 77cdf0e10cSrcweir TotDocCount = Ubound(FilesList(),1) + 1 78cdf0e10cSrcweir End If 79cdf0e10cSrcweir InitializeProgressPage(DialogModel) 80cdf0e10cSrcweir' ChangeToNextProgressStep() 81cdf0e10cSrcweir sTotDocCount = CStr(TotDocCount) 82cdf0e10cSrcweir OpenProperties(0).Name = "Hidden" 83cdf0e10cSrcweir OpenProperties(0).Value = True 84cdf0e10cSrcweir OpenProperties(1).Name = "AsTemplate" 85cdf0e10cSrcweir OpenProperties(1).Value = False 86cdf0e10cSrcweir For DocIndex = 0 To TotDocCount - 1 87cdf0e10cSrcweir If InitializeDocument(FilesList(), bDisposable) Then 88cdf0e10cSrcweir If StoreDocument() Then 89cdf0e10cSrcweir ConvertDocument() 90cdf0e10cSrcweir oDocument.Store 91cdf0e10cSrcweir End If 92cdf0e10cSrcweir If bDisposable Then 93cdf0e10cSrcweir oDocument.Dispose() 94cdf0e10cSrcweir End If 95cdf0e10cSrcweir End If 96cdf0e10cSrcweir Next DocIndex 97cdf0e10cSrcweir DialogModel.cmdBack.Enabled = True 98cdf0e10cSrcweir DialogModel.cmdGoOn.Enabled = True 99cdf0e10cSrcweir DialogModel.cmdGoOn.Label = sReady 100cdf0e10cSrcweir DialogModel.cmdCancel.Label = sEnd 101cdf0e10cSrcweir End If 102cdf0e10cSrcweirEnd Sub 103cdf0e10cSrcweir 104cdf0e10cSrcweir 105cdf0e10cSrcweirFunction InitializeDocument(FilesList(), bDisposable as Boolean) as Boolean 106cdf0e10cSrcweir' The Autopilot is started from step No. 2 107cdf0e10cSrcweirDim sViewPath as String 108cdf0e10cSrcweirDim bIsReadOnly as Boolean 109cdf0e10cSrcweirDim sExtension as String 110cdf0e10cSrcweir On Local Error Goto NEXTFILE 111cdf0e10cSrcweir If Not bCancelTask Then 112cdf0e10cSrcweir If DialogModel.optWholeDir.State = 1 Then 113cdf0e10cSrcweir SourceFile = FilesList(DocIndex,0) 114cdf0e10cSrcweir TargetFile = ReplaceString(SourceFile,TargetStemDir,SourceDir) 115cdf0e10cSrcweir TargetDir = DirectorynameoutofPath(TargetFile, "/") 116cdf0e10cSrcweir Else 117cdf0e10cSrcweir SourceFile = Source 118cdf0e10cSrcweir TargetFile = TargetDir & "/" & FileNameoutofPath(SourceFile, "/") 119cdf0e10cSrcweir End If 120cdf0e10cSrcweir If CreateFolder(TargetDir) Then 121cdf0e10cSrcweir sExtension = GetFileNameExtension(SourceFile, "/") 122cdf0e10cSrcweir oDocument = OpenDocument(SourceFile, OpenProperties(), bDisposable) 123cdf0e10cSrcweir If (oDocument.IsReadOnly) AND (UCase(SourceFile) = UCase(TargetFile)) Then 124cdf0e10cSrcweir bIsReadOnly = True 125cdf0e10cSrcweir Msgbox(sMsgDOCISREADONLY, 16, GetProductName()) 126cdf0e10cSrcweir Else 127cdf0e10cSrcweir bIsReadOnly = False 128cdf0e10cSrcweir RetrieveDocumentObjects() 129cdf0e10cSrcweir sViewPath = CutPathView(SourceFile, 60) 130cdf0e10cSrcweir DialogModel.lblCurDocument.Label = Str(DocIndex+1) & "/" & sTotDocCount & " (" & sViewPath & ")" 131cdf0e10cSrcweir End If 132cdf0e10cSrcweir InitializeDocument() = Not bIsReadOnly 133cdf0e10cSrcweir Else 134cdf0e10cSrcweir InitializeDocument() = False 135cdf0e10cSrcweir End If 136cdf0e10cSrcweir Else 137cdf0e10cSrcweir InitializeDocument() = False 138cdf0e10cSrcweir End If 139cdf0e10cSrcweirNEXTFILE: 140cdf0e10cSrcweir If Err <> 0 Then 141cdf0e10cSrcweir InitializeDocument() = False 142cdf0e10cSrcweir Resume LETSGO 143cdf0e10cSrcweirLETSGO: 144cdf0e10cSrcweir End If 145cdf0e10cSrcweirEnd Function 146cdf0e10cSrcweir 147cdf0e10cSrcweir 148cdf0e10cSrcweirSub ChangeToNextProgressStep() 149cdf0e10cSrcweir DialogModel.lblCurProgress.FontWeight = com.sun.star.awt.FontWeight.NORMAL 150cdf0e10cSrcweir DialogConvert.GetControl("lblCurProgress").Visible = True 151cdf0e10cSrcweirEnd Sub 152cdf0e10cSrcweir 153cdf0e10cSrcweir 154cdf0e10cSrcweirFunction StoreDocument() as Boolean 155cdf0e10cSrcweirDim sCurFileExists as String 156cdf0e10cSrcweirDim iOverWrite as Integer 157cdf0e10cSrcweir If (TargetFile <> "") And (Not bCancelTask) Then 158cdf0e10cSrcweir On Local Error Goto NOSAVING 159cdf0e10cSrcweir If oUcb.Exists(TargetFile) Then 160cdf0e10cSrcweir sCurFileExists = ReplaceString(sMsgFileExists, ConvertFromUrl(TargetFile), "<1>") 161cdf0e10cSrcweir sCurFileExists = ReplaceString(sCurFileExists, chr(13), "<CR>") 162cdf0e10cSrcweir iOverWrite = Msgbox (sCurFileExists, 32 + 3, sMsgDLGTITLE) 163cdf0e10cSrcweir Select Case iOverWrite 164cdf0e10cSrcweir Case 1 ' OK 165cdf0e10cSrcweir Case 2 ' Abort 166cdf0e10cSrcweir bCancelTask = True 167cdf0e10cSrcweir StoreDocument() = False 168cdf0e10cSrcweir Exit Function 169cdf0e10cSrcweir Case 7 ' No 170cdf0e10cSrcweir StoreDocument() = False 171cdf0e10cSrcweir Exit Function 172cdf0e10cSrcweir End Select 173cdf0e10cSrcweir End If 174cdf0e10cSrcweir If TargetFile <> SourceFile Then 175cdf0e10cSrcweir oDocument.StoreAsUrl(TargetFile,NoArgs) 176cdf0e10cSrcweir Else 177cdf0e10cSrcweir oDocument.Store 178cdf0e10cSrcweir End If 179cdf0e10cSrcweir StoreDocument() = True 180cdf0e10cSrcweir NOSAVING: 181cdf0e10cSrcweir If Err <> 0 Then 182cdf0e10cSrcweir StoreDocument() = False 183cdf0e10cSrcweir Resume CLERROR 184cdf0e10cSrcweir End If 185cdf0e10cSrcweir CLERROR: 186cdf0e10cSrcweir End If 187cdf0e10cSrcweirEnd Function 188cdf0e10cSrcweir 189cdf0e10cSrcweir 190cdf0e10cSrcweirSub SwapExtent() 191cdf0e10cSrcweir DialogModel.chkRecursive.Enabled = DialogModel.optWholeDir.State = 1 192cdf0e10cSrcweir If DialogModel.optWholeDir.State = 1 Then 193cdf0e10cSrcweir DialogModel.lblSource.Label = sSOURCEDIR 194cdf0e10cSrcweir If Not IsNull(SubstFile) Then 195cdf0e10cSrcweir SubstFile = DialogModel.txtSource.Text 196cdf0e10cSrcweir DialogModel.txtSource.Text = SubstDir 197cdf0e10cSrcweir End If 198cdf0e10cSrcweir Else 199cdf0e10cSrcweir DialogModel.LblSource.Label = sSOURCEFILE 200cdf0e10cSrcweir If Not IsNull(SubstDir) Then 201cdf0e10cSrcweir SubstDir = DialogModel.txtSource.Text 202cdf0e10cSrcweir DialogModel.txtSource.Text = SubstFile 203cdf0e10cSrcweir End If 204cdf0e10cSrcweir End If 205cdf0e10cSrcweir ToggleGoOnButton() 206cdf0e10cSrcweirEnd Sub 207cdf0e10cSrcweir 208cdf0e10cSrcweir 209cdf0e10cSrcweirFunction InitializeThirdStep() as Boolean 210cdf0e10cSrcweirDim TextBoxText as String 211cdf0e10cSrcweir Source = AssignFileName(DialogModel.txtSource.Text, DialogModel.lblSource.Label, True) 212cdf0e10cSrcweir If CheckTextBoxPath(DialogModel.txtTarget, True, True, sMsgDLGTITLE, True) Then 213cdf0e10cSrcweir TargetDir = AssignFileName(DialogModel.txtTarget.Text, DialogModel.lblTarget.Label, False) 214cdf0e10cSrcweir Else 215cdf0e10cSrcweir TargetDir = "" 216cdf0e10cSrcweir End If 217cdf0e10cSrcweir If Source <> "" And TargetDir <> "" Then 218cdf0e10cSrcweir bRecursive = DialogModel.chkRecursive.State = 1 219cdf0e10cSrcweir bDoUnprotect = DialogModel.chkProtect.State = 1 220cdf0e10cSrcweir DialogModel.lblRetrieval.FontWeight = com.sun.star.awt.FontWeight.BOLD 221cdf0e10cSrcweir DialogModel.lblRetrieval.Label = sPrgsRETRIEVAL 222cdf0e10cSrcweir DialogModel.lblCurProgress.Label = sPrgsCONVERTING 223cdf0e10cSrcweir If DialogModel.optWholeDir.State = 1 Then 224cdf0e10cSrcweir TextBoxText = sSOURCEDIR & " " & ConvertFromUrl(Source) & chr(13) 225cdf0e10cSrcweir If DialogModel.chkRecursive.State = 1 Then 226cdf0e10cSrcweir TextBoxText = TextBoxText & DeleteStr(sInclusiveSubDir,"~") & chr(13) 227cdf0e10cSrcweir End If 228cdf0e10cSrcweir Else 229cdf0e10cSrcweir TextBoxText = sSOURCEFILE & " " & ConvertFromUrl(Source) & chr(13) 230cdf0e10cSrcweir End If 231cdf0e10cSrcweir TextBoxText = TextBoxText & sTARGETDIR & " " & ConvertFromUrl(TargetDir) & chr(13) 232cdf0e10cSrcweir If DialogModel.chkProtect.State = 1 Then 233cdf0e10cSrcweir TextBoxText = TextboxText & sPrgsUNPROTECT 234cdf0e10cSrcweir End If 235cdf0e10cSrcweir DialogModel.txtConfig.Text = TextBoxText 236cdf0e10cSrcweir ToggleProgressStep() 237cdf0e10cSrcweir DialogModel.cmdGoOn.Enabled = False 238cdf0e10cSrcweir InitializeThirdStep() = True 239cdf0e10cSrcweir Else 240cdf0e10cSrcweir InitializeThirdStep() = False 241cdf0e10cSrcweir End If 242cdf0e10cSrcweirEnd Function 243cdf0e10cSrcweir 244cdf0e10cSrcweir 245cdf0e10cSrcweirSub ToggleProgressStep(Optional aEvent as Object) 246cdf0e10cSrcweirDim bMakeVisible as Boolean 247cdf0e10cSrcweirDim LocStep as Integer 248cdf0e10cSrcweir ' If the Sub is call by the 'cmdBack' Button then set the 'bMakeVisible' variable accordingly 249cdf0e10cSrcweir bMakeVisible = IsMissing(aEvent) 250cdf0e10cSrcweir If bMakeVisible Then 251cdf0e10cSrcweir DialogModel.Step = 3 252cdf0e10cSrcweir Else 253cdf0e10cSrcweir DialogModel.Step = 2 254cdf0e10cSrcweir End If 255cdf0e10cSrcweir DialogConvert.GetControl("lblCurrencies").Visible = Not bMakeVisible 256cdf0e10cSrcweir DialogConvert.GetControl("lstCurrencies").Visible = Not bMakeVisible 257cdf0e10cSrcweir DialogConvert.GetControl("cmdBack").Visible = bMakeVisible 258cdf0e10cSrcweir DialogConvert.GetControl("cmdGoOn").Visible = bMakeVisible 259cdf0e10cSrcweir DialogModel.imgPreview.ImageUrl = BitmapDir & "euro_" & DialogModel.Step & ".bmp" 260cdf0e10cSrcweirEnd Sub 261cdf0e10cSrcweir 262cdf0e10cSrcweir 263cdf0e10cSrcweirSub EnableStep2DialogControls(OnValue as Boolean) 264cdf0e10cSrcweir With DialogModel 265cdf0e10cSrcweir .hlnExtent.Enabled = OnValue 266cdf0e10cSrcweir .optWholeDir.Enabled = OnValue 267cdf0e10cSrcweir .optSingleFile.Enabled = OnValue 268cdf0e10cSrcweir .chkProtect.Enabled = OnValue 269cdf0e10cSrcweir .cmdCallSourceDialog.Enabled = OnValue 270cdf0e10cSrcweir .cmdCallTargetDialog.Enabled = OnValue 271cdf0e10cSrcweir .lblSource.Enabled = OnValue 272cdf0e10cSrcweir .lblTarget.Enabled = OnValue 273cdf0e10cSrcweir .txtSource.Enabled = OnValue 274cdf0e10cSrcweir .txtTarget.Enabled = OnValue 275cdf0e10cSrcweir .imgPreview.Enabled = OnValue 276cdf0e10cSrcweir .lstCurrencies.Enabled = OnValue 277cdf0e10cSrcweir .lblCurrencies.Enabled = OnValue 278cdf0e10cSrcweir If OnValue Then 279cdf0e10cSrcweir ToggleGoOnButton() 280cdf0e10cSrcweir .chkRecursive.Enabled = .optWholeDir.State = 1 281cdf0e10cSrcweir Else 282cdf0e10cSrcweir .cmdGoOn.Enabled = False 283cdf0e10cSrcweir .chkRecursive.Enabled = False 284cdf0e10cSrcweir End If 285cdf0e10cSrcweir End With 286cdf0e10cSrcweirEnd Sub 287cdf0e10cSrcweir 288cdf0e10cSrcweir 289cdf0e10cSrcweirSub InitializeProgressPage() 290cdf0e10cSrcweir DialogConvert.GetControl("lblRetrieval").Visible = False 291cdf0e10cSrcweir DialogConvert.GetControl("lblCurProgress").Visible = False 292cdf0e10cSrcweir DialogModel.lblRetrieval.FontWeight = com.sun.star.awt.FontWeight.NORMAL 293cdf0e10cSrcweir DialogModel.lblCurProgress.FontWeight = com.sun.star.awt.FontWeight.BOLD 294cdf0e10cSrcweir DialogConvert.GetControl("lblRetrieval").Visible = True 295cdf0e10cSrcweir DialogConvert.GetControl("lblCurProgress").Visible = True 296cdf0e10cSrcweirEnd Sub 297cdf0e10cSrcweir 298cdf0e10cSrcweir 299cdf0e10cSrcweirFunction AssignFileName(sPath as String, ByVal HeaderString, bCheckFileType as Boolean) as String 300cdf0e10cSrcweirDim bIsValid as Boolean 301cdf0e10cSrcweirDim sLocMimeType as String 302cdf0e10cSrcweirDim sNoDirMessage as String 303cdf0e10cSrcweir HeaderString = DeleteStr(HeaderString, ":") 304cdf0e10cSrcweir sPath = ConvertToUrl(Trim(sPath)) 305cdf0e10cSrcweir bIsValid = oUcb.Exists(sPath) 306cdf0e10cSrcweir If bIsValid Then 307cdf0e10cSrcweir If DialogModel.optSingleFile.State = 1 Then 308cdf0e10cSrcweir If bCheckFileType Then 309cdf0e10cSrcweir sLocMimeType = GetRealFileContent(sPath) 310cdf0e10cSrcweir If DialogModel.chkTextDocuments.State = 1 Then 311cdf0e10cSrcweir If (Instr(1, sLocMimeType, "text") = 0) And (Instr(1, sLocMimeType, "calc") = 0) Then 312cdf0e10cSrcweir Msgbox(sMsgFileInvalid, 48, sMsgDLGTITLE) 313cdf0e10cSrcweir bIsValid = False 314cdf0e10cSrcweir End If 315cdf0e10cSrcweir Else 316cdf0e10cSrcweir If (Instr(1, sLocMimeType, "spreadsheet") = 0) And (Instr(1, sLocMimeType, "calc")) = 0 Then 317cdf0e10cSrcweir Msgbox(sMsgFileInvalid, 48, sMsgDLGTITLE) 318cdf0e10cSrcweir bIsValid = False 319cdf0e10cSrcweir End If 320cdf0e10cSrcweir End If 321cdf0e10cSrcweir End If 322cdf0e10cSrcweir Else 323cdf0e10cSrcweir If Not oUcb.IsFolder(sPath) Then 324cdf0e10cSrcweir sNoDirMessage = ReplaceString(sMsgNODIRECTORY,sPath,"<1>") 325cdf0e10cSrcweir Msgbox(sNoDirMessage,48, sMsgDLGTITLE) 326cdf0e10cSrcweir bIsValid = False 327cdf0e10cSrcweir Else 328cdf0e10cSrcweir sPath = RTrimStr(sPath,"/") 329cdf0e10cSrcweir sPath = sPath & "/" 330cdf0e10cSrcweir End If 331cdf0e10cSrcweir End if 332cdf0e10cSrcweir Else 333cdf0e10cSrcweir Msgbox(HeaderString & " '" & ConvertFromUrl(sPath) & "' " & sMsgNOTTHERE,48, sMsgDLGTITLE) 334cdf0e10cSrcweir End If 335cdf0e10cSrcweir If bIsValid Then 336cdf0e10cSrcweir AssignFileName() = sPath 337cdf0e10cSrcweir Else 338cdf0e10cSrcweir AssignFilename() = "" 339cdf0e10cSrcweir End If 340cdf0e10cSrcweirEnd Function 341cdf0e10cSrcweir 342cdf0e10cSrcweir 343cdf0e10cSrcweirSub ToggleGoOnButton() 344cdf0e10cSrcweirDim bDoEnable as Boolean 345cdf0e10cSrcweirDim sLocMimeType as String 346cdf0e10cSrcweirDim sPath as String 347cdf0e10cSrcweir bDoEnable = Ubound(DialogModel.lstCurrencies.SelectedItems()) > -1 348cdf0e10cSrcweir If bDoEnable Then 349cdf0e10cSrcweir ' Check if Source is set correctly 350cdf0e10cSrcweir sPath = ConvertToUrl(Trim(DialogModel.txtSource.Text)) 351cdf0e10cSrcweir bDoEnable = oUcb.Exists(sPath) 352cdf0e10cSrcweir End If 353cdf0e10cSrcweir DialogModel.cmdGoOn.Enabled = bDoEnable 354cdf0e10cSrcweirEnd Sub 355cdf0e10cSrcweir 356cdf0e10cSrcweir 357cdf0e10cSrcweirSub CallFolderPicker() 358cdf0e10cSrcweir GetFolderName(DialogModel.txtTarget) 359cdf0e10cSrcweir ToggleGoOnButton() 360cdf0e10cSrcweirEnd Sub 361cdf0e10cSrcweir 362cdf0e10cSrcweir 363cdf0e10cSrcweirSub CallFilePicker() 364cdf0e10cSrcweir If DialogModel.optSingleFile.State = 1 Then 365cdf0e10cSrcweir Dim oMasterKey as Object 366cdf0e10cSrcweir Dim oTypes() as Object 367cdf0e10cSrcweir Dim oUIKey() as Object 368cdf0e10cSrcweir 369cdf0e10cSrcweir oMasterKey = GetRegistryKeyContent("org.openoffice.TypeDetection.Types") 370cdf0e10cSrcweir oTypes() = oMasterKey.Types 371cdf0e10cSrcweir oUIKey = GetRegistryKeyContent("org.openoffice.Office.UI/FilterClassification/LocalFilters") 372cdf0e10cSrcweir If DialogModel.chkTextDocuments.State = 1 Then 373cdf0e10cSrcweir Dim FilterNames(11,1) as String 374cdf0e10cSrcweir FilterNames(6,0) = oTypes.GetByName("writer_StarOffice_XML_Writer").UIName 375cdf0e10cSrcweir FilterNames(6,1) = "*.sxw" 376cdf0e10cSrcweir FilterNames(7,0) = oTypes.GetByName("writer_StarOffice_XML_Writer_Template").UIName 377cdf0e10cSrcweir FilterNames(7,1) = "*.stw" 378cdf0e10cSrcweir FilterNames(8,0) = oUIKey.Classes.GetByName("sw3to5").DisplayName 379cdf0e10cSrcweir FilterNames(8,1) = "*.sdw" 380cdf0e10cSrcweir FilterNames(9,0) = oUIKey.Classes.GetByName("sw3to5templ").DisplayName 381cdf0e10cSrcweir Filternames(9,1) = "*.vor" 382cdf0e10cSrcweir FilterNames(10,0) = oTypes.GetByName("writer8").UIName 383cdf0e10cSrcweir FilterNames(10,1) = "*.odt" 384cdf0e10cSrcweir FilterNames(11,0) = oTypes.GetByName("writer8_template").UIName 385cdf0e10cSrcweir FilterNames(11,1) = "*.ott" 386cdf0e10cSrcweir Else 387cdf0e10cSrcweir ReDim FilterNames(5,1) as String 388cdf0e10cSrcweir End If 389cdf0e10cSrcweir FilterNames(0,0) = oTypes.GetByName("calc_StarOffice_XML_Calc").UIName 390cdf0e10cSrcweir Filternames(0,1) = "*.sxc" 391cdf0e10cSrcweir FilterNames(1,0) = oTypes.GetByName("calc_StarOffice_XML_Calc_Template").UIName 392cdf0e10cSrcweir Filternames(1,1) = "*.stc" 393cdf0e10cSrcweir FilterNames(2,0) = oUIKey.Classes.GetByName("sc345").DisplayName 394cdf0e10cSrcweir FilterNames(2,1) = "*.sdc" 395cdf0e10cSrcweir FilterNames(3,0) = oUIKey.Classes.GetByName("sc345templ").DisplayName 396cdf0e10cSrcweir Filternames(3,1) = "*.vor" 397cdf0e10cSrcweir FilterNames(4,0) = oTypes.GetByName("calc8").UIName 398cdf0e10cSrcweir Filternames(4,1) = "*.ods" 399cdf0e10cSrcweir FilterNames(5,0) = oTypes.GetByName("calc8_template").UIName 400cdf0e10cSrcweir Filternames(5,1) = "*.ots" 401cdf0e10cSrcweir GetFileName(DialogModel.txtSource, Filternames()) 402cdf0e10cSrcweir Else 403cdf0e10cSrcweir GetFolderName(DialogModel.txtSource) 404cdf0e10cSrcweir End If 405cdf0e10cSrcweir ToggleGoOnButton() 406cdf0e10cSrcweirEnd Sub 407cdf0e10cSrcweir 408cdf0e10cSrcweir 409cdf0e10cSrcweirSub PreviousStep() 410cdf0e10cSrcweir DialogModel.Step = 2 411cdf0e10cSrcweir DialogModel.cmdGoOn.Label = sGOON 412cdf0e10cSrcweir DialogModel.cmdCancel.Label = sCANCEL 413cdf0e10cSrcweirEnd Sub 414cdf0e10cSrcweir</script:module> 415