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