Option Explicit ' ***** BASIC ***** ' Todo: Problematik der VBA-Makros, die angeblich nicht mit abgespeichert werden koennen. ' Evt. Erkennen der Arbeitsverzeichnisse von MS Office Public HeaderPreviews(4) as Object Public ImportDialog as Object Public ImportDialogArea as Object Public bSetFonts as Boolean ' If the ProgressPage ist already on Top The Dialog will be immediately closed when this flag is ' set to False Public bCallCancelMsg as Boolean Sub Main() BasicLibraries.LoadLibrary("Tools") bSetFonts = False If bSetFonts Then BasicLibraries.LoadLibrary("Translater") GetFontNames() End If sCRLF = CHR(10) & CHR(13) oUcb = createUnoService("com.sun.star.ucb.SimpleFileAccess") If Not bDebugWizard Then On Error Goto RTError End If SOBitmapPath = GetOfficeSubPath("Template", "wizard/bitmap") SOWorkPath = GetPathSettings("Work", False) SOTemplatePath = GetPathSettings("Template",False,1) bCancelTask = False bDoKeepApplValues = False CurOffice = 0 ImportDialogArea = LoadDialog("ImportWizard","ImportDialog") ImportDialog = ImportDialogArea.Model LoadLanguage() FillStep_Welcome() RepaintHeaderPreview() SetStates() ImportDialogArea.Execute() ImportDialog.cbGoOn.DefaultButton = True Exit Sub RTError: Msgbox sRTErrorDesc, 16, sRTErrorHeader End Sub Sub SetStates With ImportDialog .OptSODocuments.State = 1 .OptMSDocuments.State = 0 .TemplateCheckbox.State = 1 .DocumentPathCheckbox.State = 0 End With End Sub Sub NextStep Dim iCurStep as Integer If Not bDebugWizard Then On Error Goto RTError End If bCallCancelMsg = False iCurStep = ImportDialog.Step Select Case iCurStep Case 1 FillStep_InputPaths(0, True) Case 2 If SaveStep_InputPath Then If CurOffice < ApplCount - 1 Then CurOffice = CurOffice + 1 TakeOverPathSettings() FillStep_InputPaths(CurOffice, False) RepaintHeaderPreview() Else FillStep_Summary() End If End If Case 3 FillStep_Progress() Select Case WizardMode Case SBMICROSOFTMODE Call ConvertAllDocuments(MSFilterName()) CASE SBXMLMODE Call ConvertAllDocuments(XMLFilterName()) End Select Case 4 End Select ImportDialog.cbGoOn.DefaultButton = True Exit Sub RTError: Msgbox sRTErrorDesc, 16, sRTErrorHeader End Sub Sub PrevStep Dim iCurStep as Integer If Not bDebugWizard Then On Error Goto RTError End If bCallCancelMsg = False iCurStep = ImportDialog.Step Select Case iCurStep Case 4 ImportDialog.cbCancel.Label = sCancelButton FillStep_Summary() Case 3 'Todo: muessen auch beim Zuruecksteppen wirklich die Importpfade auf ihre Gueltigkeit hin Ueberprueft werden? FillStep_InputPaths(Applcount-1, False) Case 2 If SaveStep_InputPath Then If CurOffice > 0 Then CurOffice = CurOffice - 1 FillStep_InputPaths(CurOffice, False) RepaintHeaderPreview() Else FillStep_Welcome() bDoKeepApplValues = True End If End If End Select ImportDialog.cbGoOn.DefaultButton = True Exit Sub RTError: Msgbox sRTErrorDesc, 16, sRTErrorHeader End Sub Sub CancelButton If bCallCancelMsg Then ' Conversion is already running ImportDialog.cbCancel.Enabled = False bCancelTask = True Else ImportDialogArea.EndExecute ImportDialogArea.Dispose() End End If End Sub Sub CancelTask() If Msgbox(sConvertError1, 36, sConvertError2) = 6 Then ImportDialogArea.EndExecute ImportDialogArea.Dispose End Else bCancelTask = False ImportDialog.cbCancel.Enabled = True End If End Sub Sub TemplateDirSearchDialog() CallDirSearchDialog(ImportDialog.TemplateImportPath) End Sub Sub RepaintHeaderPreview() Dim Bitmap As Object Dim CurStep as Integer Dim sBitmapPath as String CurStep = ImportDialog.Step If CurStep = 2 Then sBitmapPath = SOBitmapPath & WizardMode & "-Import_" & CurStep & "-" & Applications(CurOffice,SBAPPLKEY) + 1 & ".bmp" Else sBitmapPath = SOBitmapPath & "Import_" & CurStep & ".bmp" End If ImportDialog.ImportPreview.ImageURL = sBitmapPath End Sub Sub HelperDialog() 'Todo: The String "start" can be replaced by a HelpIndex StarDesktop.LoadComponentfromUrl("vnd.sun.star.help://" & sDocType & "/start", "_OFFICE_HELP", 64, NoArgs()) End Sub Sub DisorEnableCheckboxes(oEvent as Object) Dim bMSEnable as Boolean bMSEnable = oEvent.Source.Model.Tag = "MS" With ImportDialog .ChkFirstSOApplication.Enabled = Not bMSEnable .ChkSecondSOApplication.Enabled = Not bMSEnable .ChkThirdSOApplication.Enabled = Not bMSEnable .ChkFourthSOApplication.Enabled = Not bMSEnable .ChkFirstMSApplication.Enabled = bMSEnable .ChkSecondMSApplication.Enabled = bMSEnable .ChkThirdMSApplication.Enabled = bMSEnable .WelcomeTextLabel2.Enabled = bMSEnable End With bDoKeepApplValues = False DisOrEnableNextButton() End Sub Sub DisOrEnableNextButton() Dim iCurStep as Integer Dim bDoEnable as Boolean Dim i as Integer iCurStep = ImportDialog.Step Select Case iCurStep Case 1 With ImportDialog If .OptMSDocuments.State = 1 Then bDoEnable = .ChkFirstMSApplication.State = 1 Or .ChkSecondMSApplication.State = 1 Or .ChkThirdMSApplication.State = 1 Else bDoEnable = .ChkFirstSOApplication.State = 1 Or .ChkSecondSOApplication.State = 1 Or .ChkThirdSOApplication.State = 1 Or .ChkFourthSOApplication.State = 1 End If End With bDoKeepApplValues = False Case 2 bDoEnable = CheckControlPath(ImportDialog.TemplateImportPath, True) bDoEnable = CheckControlPath(ImportDialog.TemplateExportPath, bDoEnable) bDoEnable = CheckControlPath(ImportDialog.DocumentImportPath, bDoEnable) bDoEnable = CheckControlPath(ImportDialog.DocumentExportPath, bDoenable) End Select ImportDialog.cbGoOn.Enabled = bDoEnable End Sub Sub TakeOverPathSettings() 'Takes over the Pathsettings from the first selected application to the next applications Applications(CurOffice,SBDOCSOURCE) = Applications(0,SBDOCSOURCE) Applications(CurOffice,SBDOCTARGET) = Applications(0,SBDOCTARGET) If WizardMode = SBXMLMODE AND Applications(CurOffice,SBAPPLKEY) = 3 Then ' Helper Applications Applications(CurOffice,SBTEMPLSOURCE) = Applications(CurOffice,SBDOCSOURCE) Applications(CurOffice,SBTEMPLTARGET) = Applications(CurOffice,SBDOCTARGET) Else Applications(CurOffice,SBTEMPLSOURCE) = Applications(0,SBTEMPLSOURCE) Applications(CurOffice,SBTEMPLTARGET) = Applications(0,SBTEMPLTARGET) End If End Sub