1cdf0e10cSrcweir<?xml version="1.0" encoding="UTF-8"?> 2cdf0e10cSrcweir<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd"> 33e02b54dSAndrew Rist<!--*********************************************************** 4*cf5c25e8SMatthias 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 12*cf5c25e8SMatthias Seidel * 133e02b54dSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 14*cf5c25e8SMatthias 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. 21*cf5c25e8SMatthias 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() 34283d1c44SPedro GiffuniPublic TypeList(14) 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") 57*cf5c25e8SMatthias 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" 80283d1c44SPedro Giffuni TypeList(2) = "calc_StarCalc_30" 81283d1c44SPedro Giffuni TypeList(3) = "calc_StarCalc_40" 82283d1c44SPedro Giffuni TypeList(4) = "calc_StarCalc_50" 83cdf0e10cSrcweir If DialogModel.chkTextDocuments.State = 1 Then 84283d1c44SPedro Giffuni ReDim Preserve TypeList(13) as String 85283d1c44SPedro Giffuni 86283d1c44SPedro Giffuni TypeList(5) = "writer8" 87283d1c44SPedro Giffuni TypeList(6) = "writerglobal8" 88283d1c44SPedro Giffuni TypeList(7) = "writer_StarOffice_XML_Writer" 89283d1c44SPedro Giffuni TypeList(8) = "writer_globaldocument_StarOffice_XML_Writer_GlobalDocument" 90283d1c44SPedro Giffuni TypeList(9) = "writer_StarWriter_30" 91283d1c44SPedro Giffuni TypeList(10) = "writer_StarWriter_40" 92283d1c44SPedro Giffuni TypeList(11) = "writer_globaldocument_StarWriter_40GlobalDocument" 93283d1c44SPedro Giffuni TypeList(12) = "writer_StarWriter_50" 94283d1c44SPedro Giffuni TypeList(13) = "writer_globaldocument_StarWriter_50GlobalDocument" 95cdf0e10cSrcweir End If 96283d1c44SPedro Giffuni FilesList() = ReadDirectories(SourceDir, bRecursive, True, False, TypeList()) 97cdf0e10cSrcweir TotDocCount = Ubound(FilesList(),1) + 1 98cdf0e10cSrcweir End If 99cdf0e10cSrcweir InitializeProgressPage(DialogModel) 100cdf0e10cSrcweir' ChangeToNextProgressStep() 101cdf0e10cSrcweir sTotDocCount = CStr(TotDocCount) 102cdf0e10cSrcweir OpenProperties(0).Name = "Hidden" 103cdf0e10cSrcweir OpenProperties(0).Value = True 104cdf0e10cSrcweir OpenProperties(1).Name = "AsTemplate" 105cdf0e10cSrcweir OpenProperties(1).Value = False 106cdf0e10cSrcweir For DocIndex = 0 To TotDocCount - 1 107cdf0e10cSrcweir If InitializeDocument(FilesList(), bDisposable) Then 108cdf0e10cSrcweir If StoreDocument() Then 109cdf0e10cSrcweir ConvertDocument() 110cdf0e10cSrcweir oDocument.Store 111cdf0e10cSrcweir End If 112cdf0e10cSrcweir If bDisposable Then 113cdf0e10cSrcweir oDocument.Dispose() 114cdf0e10cSrcweir End If 115cdf0e10cSrcweir End If 116cdf0e10cSrcweir Next DocIndex 117cdf0e10cSrcweir DialogModel.cmdBack.Enabled = True 118cdf0e10cSrcweir DialogModel.cmdGoOn.Enabled = True 119cdf0e10cSrcweir DialogModel.cmdGoOn.Label = sReady 120cdf0e10cSrcweir DialogModel.cmdCancel.Label = sEnd 121cdf0e10cSrcweir End If 122cdf0e10cSrcweirEnd Sub 123cdf0e10cSrcweir 124cdf0e10cSrcweir 125cdf0e10cSrcweirFunction InitializeDocument(FilesList(), bDisposable as Boolean) as Boolean 126cdf0e10cSrcweir' The Autopilot is started from step No. 2 127cdf0e10cSrcweirDim sViewPath as String 128cdf0e10cSrcweirDim bIsReadOnly as Boolean 129cdf0e10cSrcweirDim sExtension as String 130cdf0e10cSrcweir On Local Error Goto NEXTFILE 131cdf0e10cSrcweir If Not bCancelTask Then 132cdf0e10cSrcweir If DialogModel.optWholeDir.State = 1 Then 133cdf0e10cSrcweir SourceFile = FilesList(DocIndex,0) 134cdf0e10cSrcweir TargetFile = ReplaceString(SourceFile,TargetStemDir,SourceDir) 135cdf0e10cSrcweir TargetDir = DirectorynameoutofPath(TargetFile, "/") 136cdf0e10cSrcweir Else 137cdf0e10cSrcweir SourceFile = Source 138cdf0e10cSrcweir TargetFile = TargetDir & "/" & FileNameoutofPath(SourceFile, "/") 139cdf0e10cSrcweir End If 140cdf0e10cSrcweir If CreateFolder(TargetDir) Then 141cdf0e10cSrcweir sExtension = GetFileNameExtension(SourceFile, "/") 142cdf0e10cSrcweir oDocument = OpenDocument(SourceFile, OpenProperties(), bDisposable) 143cdf0e10cSrcweir If (oDocument.IsReadOnly) AND (UCase(SourceFile) = UCase(TargetFile)) Then 144cdf0e10cSrcweir bIsReadOnly = True 145cdf0e10cSrcweir Msgbox(sMsgDOCISREADONLY, 16, GetProductName()) 146cdf0e10cSrcweir Else 147cdf0e10cSrcweir bIsReadOnly = False 148cdf0e10cSrcweir RetrieveDocumentObjects() 149cdf0e10cSrcweir sViewPath = CutPathView(SourceFile, 60) 150*cf5c25e8SMatthias Seidel DialogModel.lblCurDocument.Label = Str(DocIndex+1) & "/" & sTotDocCount & " (" & sViewPath & ")" 151cdf0e10cSrcweir End If 152cdf0e10cSrcweir InitializeDocument() = Not bIsReadOnly 153cdf0e10cSrcweir Else 154cdf0e10cSrcweir InitializeDocument() = False 155cdf0e10cSrcweir End If 156cdf0e10cSrcweir Else 157cdf0e10cSrcweir InitializeDocument() = False 158cdf0e10cSrcweir End If 159cdf0e10cSrcweirNEXTFILE: 160cdf0e10cSrcweir If Err <> 0 Then 161cdf0e10cSrcweir InitializeDocument() = False 162cdf0e10cSrcweir Resume LETSGO 163cdf0e10cSrcweirLETSGO: 164cdf0e10cSrcweir End If 165cdf0e10cSrcweirEnd Function 166cdf0e10cSrcweir 167cdf0e10cSrcweir 168cdf0e10cSrcweirSub ChangeToNextProgressStep() 169cdf0e10cSrcweir DialogModel.lblCurProgress.FontWeight = com.sun.star.awt.FontWeight.NORMAL 170cdf0e10cSrcweir DialogConvert.GetControl("lblCurProgress").Visible = True 171cdf0e10cSrcweirEnd Sub 172cdf0e10cSrcweir 173cdf0e10cSrcweir 174cdf0e10cSrcweirFunction StoreDocument() as Boolean 175cdf0e10cSrcweirDim sCurFileExists as String 176cdf0e10cSrcweirDim iOverWrite as Integer 177cdf0e10cSrcweir If (TargetFile <> "") And (Not bCancelTask) Then 178cdf0e10cSrcweir On Local Error Goto NOSAVING 179cdf0e10cSrcweir If oUcb.Exists(TargetFile) Then 180cdf0e10cSrcweir sCurFileExists = ReplaceString(sMsgFileExists, ConvertFromUrl(TargetFile), "<1>") 181cdf0e10cSrcweir sCurFileExists = ReplaceString(sCurFileExists, chr(13), "<CR>") 182cdf0e10cSrcweir iOverWrite = Msgbox (sCurFileExists, 32 + 3, sMsgDLGTITLE) 183cdf0e10cSrcweir Select Case iOverWrite 184cdf0e10cSrcweir Case 1 ' OK 185cdf0e10cSrcweir Case 2 ' Abort 186cdf0e10cSrcweir bCancelTask = True 187cdf0e10cSrcweir StoreDocument() = False 188cdf0e10cSrcweir Exit Function 189cdf0e10cSrcweir Case 7 ' No 190cdf0e10cSrcweir StoreDocument() = False 191cdf0e10cSrcweir Exit Function 192cdf0e10cSrcweir End Select 193cdf0e10cSrcweir End If 194cdf0e10cSrcweir If TargetFile <> SourceFile Then 195cdf0e10cSrcweir oDocument.StoreAsUrl(TargetFile,NoArgs) 196cdf0e10cSrcweir Else 197cdf0e10cSrcweir oDocument.Store 198cdf0e10cSrcweir End If 199cdf0e10cSrcweir StoreDocument() = True 200cdf0e10cSrcweir NOSAVING: 201cdf0e10cSrcweir If Err <> 0 Then 202cdf0e10cSrcweir StoreDocument() = False 203cdf0e10cSrcweir Resume CLERROR 204cdf0e10cSrcweir End If 205cdf0e10cSrcweir CLERROR: 206cdf0e10cSrcweir End If 207cdf0e10cSrcweirEnd Function 208cdf0e10cSrcweir 209cdf0e10cSrcweir 210cdf0e10cSrcweirSub SwapExtent() 211cdf0e10cSrcweir DialogModel.chkRecursive.Enabled = DialogModel.optWholeDir.State = 1 212cdf0e10cSrcweir If DialogModel.optWholeDir.State = 1 Then 213cdf0e10cSrcweir DialogModel.lblSource.Label = sSOURCEDIR 214cdf0e10cSrcweir If Not IsNull(SubstFile) Then 215cdf0e10cSrcweir SubstFile = DialogModel.txtSource.Text 216cdf0e10cSrcweir DialogModel.txtSource.Text = SubstDir 217cdf0e10cSrcweir End If 218cdf0e10cSrcweir Else 219cdf0e10cSrcweir DialogModel.LblSource.Label = sSOURCEFILE 220cdf0e10cSrcweir If Not IsNull(SubstDir) Then 221cdf0e10cSrcweir SubstDir = DialogModel.txtSource.Text 222cdf0e10cSrcweir DialogModel.txtSource.Text = SubstFile 223cdf0e10cSrcweir End If 224cdf0e10cSrcweir End If 225cdf0e10cSrcweir ToggleGoOnButton() 226cdf0e10cSrcweirEnd Sub 227cdf0e10cSrcweir 228cdf0e10cSrcweir 229cdf0e10cSrcweirFunction InitializeThirdStep() as Boolean 230cdf0e10cSrcweirDim TextBoxText as String 231cdf0e10cSrcweir Source = AssignFileName(DialogModel.txtSource.Text, DialogModel.lblSource.Label, True) 232cdf0e10cSrcweir If CheckTextBoxPath(DialogModel.txtTarget, True, True, sMsgDLGTITLE, True) Then 233cdf0e10cSrcweir TargetDir = AssignFileName(DialogModel.txtTarget.Text, DialogModel.lblTarget.Label, False) 234cdf0e10cSrcweir Else 235cdf0e10cSrcweir TargetDir = "" 236cdf0e10cSrcweir End If 237cdf0e10cSrcweir If Source <> "" And TargetDir <> "" Then 238cdf0e10cSrcweir bRecursive = DialogModel.chkRecursive.State = 1 239cdf0e10cSrcweir bDoUnprotect = DialogModel.chkProtect.State = 1 240cdf0e10cSrcweir DialogModel.lblRetrieval.FontWeight = com.sun.star.awt.FontWeight.BOLD 241cdf0e10cSrcweir DialogModel.lblRetrieval.Label = sPrgsRETRIEVAL 242cdf0e10cSrcweir DialogModel.lblCurProgress.Label = sPrgsCONVERTING 243cdf0e10cSrcweir If DialogModel.optWholeDir.State = 1 Then 244cdf0e10cSrcweir TextBoxText = sSOURCEDIR & " " & ConvertFromUrl(Source) & chr(13) 245cdf0e10cSrcweir If DialogModel.chkRecursive.State = 1 Then 246cdf0e10cSrcweir TextBoxText = TextBoxText & DeleteStr(sInclusiveSubDir,"~") & chr(13) 247cdf0e10cSrcweir End If 248cdf0e10cSrcweir Else 249*cf5c25e8SMatthias Seidel TextBoxText = sSOURCEFILE & " " & ConvertFromUrl(Source) & chr(13) 250cdf0e10cSrcweir End If 251cdf0e10cSrcweir TextBoxText = TextBoxText & sTARGETDIR & " " & ConvertFromUrl(TargetDir) & chr(13) 252cdf0e10cSrcweir If DialogModel.chkProtect.State = 1 Then 253cdf0e10cSrcweir TextBoxText = TextboxText & sPrgsUNPROTECT 254cdf0e10cSrcweir End If 255cdf0e10cSrcweir DialogModel.txtConfig.Text = TextBoxText 256cdf0e10cSrcweir ToggleProgressStep() 257*cf5c25e8SMatthias Seidel DialogModel.cmdGoOn.Enabled = False 258*cf5c25e8SMatthias Seidel InitializeThirdStep() = True 259cdf0e10cSrcweir Else 260cdf0e10cSrcweir InitializeThirdStep() = False 261cdf0e10cSrcweir End If 262cdf0e10cSrcweirEnd Function 263cdf0e10cSrcweir 264cdf0e10cSrcweir 265cdf0e10cSrcweirSub ToggleProgressStep(Optional aEvent as Object) 266cdf0e10cSrcweirDim bMakeVisible as Boolean 267cdf0e10cSrcweirDim LocStep as Integer 268cdf0e10cSrcweir ' If the Sub is call by the 'cmdBack' Button then set the 'bMakeVisible' variable accordingly 269cdf0e10cSrcweir bMakeVisible = IsMissing(aEvent) 270cdf0e10cSrcweir If bMakeVisible Then 271cdf0e10cSrcweir DialogModel.Step = 3 272cdf0e10cSrcweir Else 273cdf0e10cSrcweir DialogModel.Step = 2 274cdf0e10cSrcweir End If 275cdf0e10cSrcweir DialogConvert.GetControl("lblCurrencies").Visible = Not bMakeVisible 276cdf0e10cSrcweir DialogConvert.GetControl("lstCurrencies").Visible = Not bMakeVisible 277cdf0e10cSrcweir DialogConvert.GetControl("cmdBack").Visible = bMakeVisible 278cdf0e10cSrcweir DialogConvert.GetControl("cmdGoOn").Visible = bMakeVisible 279*cf5c25e8SMatthias Seidel DialogModel.imgPreview.ImageUrl = BitmapDir & "euro_" & DialogModel.Step & ".png" 280cdf0e10cSrcweirEnd Sub 281cdf0e10cSrcweir 282cdf0e10cSrcweir 283cdf0e10cSrcweirSub EnableStep2DialogControls(OnValue as Boolean) 284cdf0e10cSrcweir With DialogModel 285cdf0e10cSrcweir .hlnExtent.Enabled = OnValue 286cdf0e10cSrcweir .optWholeDir.Enabled = OnValue 287cdf0e10cSrcweir .optSingleFile.Enabled = OnValue 288cdf0e10cSrcweir .chkProtect.Enabled = OnValue 289cdf0e10cSrcweir .cmdCallSourceDialog.Enabled = OnValue 290cdf0e10cSrcweir .cmdCallTargetDialog.Enabled = OnValue 291cdf0e10cSrcweir .lblSource.Enabled = OnValue 292cdf0e10cSrcweir .lblTarget.Enabled = OnValue 293cdf0e10cSrcweir .txtSource.Enabled = OnValue 294cdf0e10cSrcweir .txtTarget.Enabled = OnValue 295cdf0e10cSrcweir .imgPreview.Enabled = OnValue 296cdf0e10cSrcweir .lstCurrencies.Enabled = OnValue 297cdf0e10cSrcweir .lblCurrencies.Enabled = OnValue 298cdf0e10cSrcweir If OnValue Then 299cdf0e10cSrcweir ToggleGoOnButton() 300cdf0e10cSrcweir .chkRecursive.Enabled = .optWholeDir.State = 1 301cdf0e10cSrcweir Else 302cdf0e10cSrcweir .cmdGoOn.Enabled = False 303cdf0e10cSrcweir .chkRecursive.Enabled = False 304cdf0e10cSrcweir End If 305cdf0e10cSrcweir End With 306cdf0e10cSrcweirEnd Sub 307cdf0e10cSrcweir 308cdf0e10cSrcweir 309cdf0e10cSrcweirSub InitializeProgressPage() 310cdf0e10cSrcweir DialogConvert.GetControl("lblRetrieval").Visible = False 311cdf0e10cSrcweir DialogConvert.GetControl("lblCurProgress").Visible = False 312cdf0e10cSrcweir DialogModel.lblRetrieval.FontWeight = com.sun.star.awt.FontWeight.NORMAL 313cdf0e10cSrcweir DialogModel.lblCurProgress.FontWeight = com.sun.star.awt.FontWeight.BOLD 314cdf0e10cSrcweir DialogConvert.GetControl("lblRetrieval").Visible = True 315cdf0e10cSrcweir DialogConvert.GetControl("lblCurProgress").Visible = True 316cdf0e10cSrcweirEnd Sub 317cdf0e10cSrcweir 318cdf0e10cSrcweir 319cdf0e10cSrcweirFunction AssignFileName(sPath as String, ByVal HeaderString, bCheckFileType as Boolean) as String 320cdf0e10cSrcweirDim bIsValid as Boolean 321cdf0e10cSrcweirDim sLocMimeType as String 322cdf0e10cSrcweirDim sNoDirMessage as String 323cdf0e10cSrcweir HeaderString = DeleteStr(HeaderString, ":") 324cdf0e10cSrcweir sPath = ConvertToUrl(Trim(sPath)) 325cdf0e10cSrcweir bIsValid = oUcb.Exists(sPath) 326cdf0e10cSrcweir If bIsValid Then 327cdf0e10cSrcweir If DialogModel.optSingleFile.State = 1 Then 328cdf0e10cSrcweir If bCheckFileType Then 329cdf0e10cSrcweir sLocMimeType = GetRealFileContent(sPath) 330cdf0e10cSrcweir If DialogModel.chkTextDocuments.State = 1 Then 331cdf0e10cSrcweir If (Instr(1, sLocMimeType, "text") = 0) And (Instr(1, sLocMimeType, "calc") = 0) Then 332cdf0e10cSrcweir Msgbox(sMsgFileInvalid, 48, sMsgDLGTITLE) 333*cf5c25e8SMatthias Seidel bIsValid = False 334*cf5c25e8SMatthias Seidel End If 335cdf0e10cSrcweir Else 336cdf0e10cSrcweir If (Instr(1, sLocMimeType, "spreadsheet") = 0) And (Instr(1, sLocMimeType, "calc")) = 0 Then 337cdf0e10cSrcweir Msgbox(sMsgFileInvalid, 48, sMsgDLGTITLE) 338cdf0e10cSrcweir bIsValid = False 339cdf0e10cSrcweir End If 340cdf0e10cSrcweir End If 341cdf0e10cSrcweir End If 342cdf0e10cSrcweir Else 343cdf0e10cSrcweir If Not oUcb.IsFolder(sPath) Then 344cdf0e10cSrcweir sNoDirMessage = ReplaceString(sMsgNODIRECTORY,sPath,"<1>") 345cdf0e10cSrcweir Msgbox(sNoDirMessage,48, sMsgDLGTITLE) 346cdf0e10cSrcweir bIsValid = False 347cdf0e10cSrcweir Else 348cdf0e10cSrcweir sPath = RTrimStr(sPath,"/") 349cdf0e10cSrcweir sPath = sPath & "/" 350cdf0e10cSrcweir End If 351cdf0e10cSrcweir End if 352cdf0e10cSrcweir Else 353*cf5c25e8SMatthias Seidel Msgbox(HeaderString & " '" & ConvertFromUrl(sPath) & "' " & sMsgNOTTHERE,48, sMsgDLGTITLE) 354cdf0e10cSrcweir End If 355cdf0e10cSrcweir If bIsValid Then 356cdf0e10cSrcweir AssignFileName() = sPath 357cdf0e10cSrcweir Else 358cdf0e10cSrcweir AssignFilename() = "" 359cdf0e10cSrcweir End If 360cdf0e10cSrcweirEnd Function 361cdf0e10cSrcweir 362cdf0e10cSrcweir 363cdf0e10cSrcweirSub ToggleGoOnButton() 364*cf5c25e8SMatthias SeidelDim bDoEnable as Boolean 365cdf0e10cSrcweirDim sLocMimeType as String 366cdf0e10cSrcweirDim sPath as String 367cdf0e10cSrcweir bDoEnable = Ubound(DialogModel.lstCurrencies.SelectedItems()) > -1 368cdf0e10cSrcweir If bDoEnable Then 369cdf0e10cSrcweir ' Check if Source is set correctly 370cdf0e10cSrcweir sPath = ConvertToUrl(Trim(DialogModel.txtSource.Text)) 371cdf0e10cSrcweir bDoEnable = oUcb.Exists(sPath) 372cdf0e10cSrcweir End If 373cdf0e10cSrcweir DialogModel.cmdGoOn.Enabled = bDoEnable 374cdf0e10cSrcweirEnd Sub 375cdf0e10cSrcweir 376cdf0e10cSrcweir 377cdf0e10cSrcweirSub CallFolderPicker() 378cdf0e10cSrcweir GetFolderName(DialogModel.txtTarget) 379*cf5c25e8SMatthias Seidel ToggleGoOnButton() 380cdf0e10cSrcweirEnd Sub 381cdf0e10cSrcweir 382cdf0e10cSrcweir 383cdf0e10cSrcweirSub CallFilePicker() 384cdf0e10cSrcweir If DialogModel.optSingleFile.State = 1 Then 385cdf0e10cSrcweir Dim oMasterKey as Object 386cdf0e10cSrcweir Dim oTypes() as Object 387cdf0e10cSrcweir Dim oUIKey() as Object 388*cf5c25e8SMatthias Seidel 389cdf0e10cSrcweir oMasterKey = GetRegistryKeyContent("org.openoffice.TypeDetection.Types") 390cdf0e10cSrcweir oTypes() = oMasterKey.Types 391cdf0e10cSrcweir oUIKey = GetRegistryKeyContent("org.openoffice.Office.UI/FilterClassification/LocalFilters") 392cdf0e10cSrcweir If DialogModel.chkTextDocuments.State = 1 Then 393cdf0e10cSrcweir Dim FilterNames(11,1) as String 394cdf0e10cSrcweir FilterNames(6,0) = oTypes.GetByName("writer_StarOffice_XML_Writer").UIName 395cdf0e10cSrcweir FilterNames(6,1) = "*.sxw" 396cdf0e10cSrcweir FilterNames(7,0) = oTypes.GetByName("writer_StarOffice_XML_Writer_Template").UIName 397cdf0e10cSrcweir FilterNames(7,1) = "*.stw" 398cdf0e10cSrcweir FilterNames(8,0) = oUIKey.Classes.GetByName("sw3to5").DisplayName 399cdf0e10cSrcweir FilterNames(8,1) = "*.sdw" 400cdf0e10cSrcweir FilterNames(9,0) = oUIKey.Classes.GetByName("sw3to5templ").DisplayName 401cdf0e10cSrcweir Filternames(9,1) = "*.vor" 402cdf0e10cSrcweir FilterNames(10,0) = oTypes.GetByName("writer8").UIName 403cdf0e10cSrcweir FilterNames(10,1) = "*.odt" 404cdf0e10cSrcweir FilterNames(11,0) = oTypes.GetByName("writer8_template").UIName 405cdf0e10cSrcweir FilterNames(11,1) = "*.ott" 406cdf0e10cSrcweir Else 407cdf0e10cSrcweir ReDim FilterNames(5,1) as String 408cdf0e10cSrcweir End If 409*cf5c25e8SMatthias Seidel FilterNames(0,0) = oTypes.GetByName("calc_StarOffice_XML_Calc").UIName 410cdf0e10cSrcweir Filternames(0,1) = "*.sxc" 411cdf0e10cSrcweir FilterNames(1,0) = oTypes.GetByName("calc_StarOffice_XML_Calc_Template").UIName 412cdf0e10cSrcweir Filternames(1,1) = "*.stc" 413cdf0e10cSrcweir FilterNames(2,0) = oUIKey.Classes.GetByName("sc345").DisplayName 414cdf0e10cSrcweir FilterNames(2,1) = "*.sdc" 415cdf0e10cSrcweir FilterNames(3,0) = oUIKey.Classes.GetByName("sc345templ").DisplayName 416cdf0e10cSrcweir Filternames(3,1) = "*.vor" 417*cf5c25e8SMatthias Seidel FilterNames(4,0) = oTypes.GetByName("calc8").UIName 418cdf0e10cSrcweir Filternames(4,1) = "*.ods" 419*cf5c25e8SMatthias Seidel FilterNames(5,0) = oTypes.GetByName("calc8_template").UIName 420cdf0e10cSrcweir Filternames(5,1) = "*.ots" 421cdf0e10cSrcweir GetFileName(DialogModel.txtSource, Filternames()) 422cdf0e10cSrcweir Else 423cdf0e10cSrcweir GetFolderName(DialogModel.txtSource) 424cdf0e10cSrcweir End If 425cdf0e10cSrcweir ToggleGoOnButton() 426cdf0e10cSrcweirEnd Sub 427cdf0e10cSrcweir 428cdf0e10cSrcweir 429cdf0e10cSrcweirSub PreviousStep() 430cdf0e10cSrcweir DialogModel.Step = 2 431*cf5c25e8SMatthias Seidel DialogModel.cmdGoOn.Label = sGOON 432cdf0e10cSrcweir DialogModel.cmdCancel.Label = sCANCEL 433cdf0e10cSrcweirEnd Sub 434cdf0e10cSrcweir</script:module> 435