From 8f3f4a573a879e997c4aa60e117525d145349fb4 Mon Sep 17 00:00:00 2001 From: Behrend Cornelius Date: Thu, 12 Jul 2001 09:39:01 +0000 Subject: #88911# handling of Path input improved --- wizards/source/importwizard/DialogModul.xba | 83 ++++++++++-------- wizards/source/importwizard/FilesModul.xba | 20 +++-- wizards/source/importwizard/ImportDialog.xdl | 124 +++++++++++++-------------- wizards/source/importwizard/Language.xba | 6 +- wizards/source/importwizard/Main.xba | 57 ++++++------ 5 files changed, 151 insertions(+), 139 deletions(-) (limited to 'wizards') diff --git a/wizards/source/importwizard/DialogModul.xba b/wizards/source/importwizard/DialogModul.xba index 2c8f9de50bbf..0e49a160a3d1 100644 --- a/wizards/source/importwizard/DialogModul.xba +++ b/wizards/source/importwizard/DialogModul.xba @@ -8,7 +8,6 @@ Public Const SBFIRSTAPPLCHECKED = 0 Public Const SBSECONDAPPLCHECKED = 1 Public Const SBTHIRDAPPLCHECKED = 2 Public Const SBFOURTHAPPLCHECKED = 3 -'Public bDoKeepApplValues as Boolean Public WizardMode as String Public Const SBMICROSOFTMODE = "MS" Public Const SBXMLMODE = "XML" @@ -91,7 +90,7 @@ Dim i as Integer .cbBack.Enabled = False .Step = 1 End With - DisorEnableNextButton() + ToggleNextButton() End Sub @@ -107,15 +106,12 @@ Dim Index as Integer GetApplResourceArray(1009 + iApplSection, ApplCount, sTemplateCheckBox()) ' DocumentCheckbox- Captions GetApplResourceArray(1009 + iApplSection + ApplCount, ApplCount, sDocumentCheckBox()) - AssignCheckboxObjects() - FillUpApplicationList() End If - CurOffice = OfficeIndex - Index = Applications(CurOffice,SBAPPLKEY) + InitializePathsforCurrentApplication(Index) With ImportDialog .TemplateCheckbox.Label = sTemplateCheckbox(Index) .DocumentPathCheckbox.State = Abs(Applications(CurOffice,SBDOCCONVERT)) @@ -123,17 +119,17 @@ Dim Index as Integer .DocumentSearchSubDir.State = Abs(Applications(CurOffice,SBDOCRECURSIVE)) .DocumentImportPath.Text = ConvertFromUrl(Applications(CurOffice,SBDOCSOURCE)) .DocumentExportPath.Text = ConvertFromUrl(Applications(CurOffice,SBDOCTARGET)) - .DocumentFrame.Label = sProgressMoreDocs + .hlnDocuments.Label = sProgressMoreDocs If WizardMode = SBXMLMODE AND Index = 3 Then ' Note: SO-Helper Applications are partly treated like templates although they only have documents - .TemplateFrame.Label = sProgressMoreDocs + .hlnTemplates.Label = sProgressMoreDocs .TemplateCheckbox.Label = sSOHelperDocuments(0) .DocumentPathCheckbox.Label = sSOHelperDocuments(1) Else .TemplateCheckbox.Label = sTemplateCheckbox(Index) .DocumentPathCheckbox.Label = sDocumentCheckbox(Index) - .TemplateFrame.Label = sProgressMoreTemplates + .hlnTemplates.Label = sProgressMoreTemplates End If .TemplateCheckbox.State = Abs(Applications(CurOffice,SBTEMPLCONVERT)) SetEnabledTemplate_InputPath() @@ -144,54 +140,66 @@ Dim Index as Integer .cbBack.Enabled = True ImportDialog.Step = 2 End With - DisOrEnableNextButton() + ToggleNextButton() End Sub -Sub FillUpApplicationList() +Sub FillUpApplicationList() Dim i as Integer Dim a as Integer Dim BoolValue as Boolean - If Not bDoKeepApplValues Then a = 0 For i = 0 To ApplCount - 1 - BoolValue = ChkApplication(i).State = 1 + BoolValue = ChkApplication(i).State = 1 Applications(a,SBAPPLCONVERT) = BoolValue Applications(a,SBDOCCONVERT) = BoolValue Applications(a,SBDOCRECURSIVE) = BoolValue - Applications(a,SBDOCSOURCE) = GetDefaultPath(i) - Applications(a,SBDOCTARGET) = SOWorkPath + Applications(a,SBDOCSOURCE) = "" ' GetDefaultPath(i) + Applications(a,SBDOCTARGET) = "" ' SOWorkPath Applications(a,SBTEMPLCONVERT) = BoolValue Applications(a,SBTEMPLRECURSIVE) = BoolValue - Applications(a,SBTEMPLSOURCE) = GetTemplateDefaultPath(i) - Applications(a,SBTEMPLTARGET) = GetTargetTemplatePath(i) + Applications(a,SBTEMPLSOURCE) = "" ' GetTemplateDefaultPath(i) + Applications(a,SBTEMPLTARGET) = "" ' GetTargetTemplatePath(i) Applications(a,SBAPPLKEY) = i - If ChkApplication(i).State = 1 Then - a = a + 1 - End If + If ChkApplication(i).State = 1 Then + a = a + 1 + End If Next i ApplCount = a End If End Sub +Sub InitializePathsforCurrentApplication(i as Integer) + AssignPathToCurrentApplication(SBDOCSOURCE, GetDefaultPath(i)) + AssignPathToCurrentApplication(SBDOCTARGET, SOWorkPath) + AssignPathToCurrentApplication(SBTEMPLSOURCE, GetTemplateDefaultPath(i)) + AssignPathToCurrentApplication(SBTEMPLTARGET, GetTargetTemplatePath(i)) +End Sub + -Function SaveStep_InputPath() as Boolean -Dim bSaveConfiguration as Boolean - bSaveConfiguration = CheckInputPaths - If bSaveConfiguration Then - Applications(CurOffice,SBDOCCONVERT) = ImportDialog.DocumentPathCheckbox.State = 1 - Applications(CurOffice,SBDOCRECURSIVE) = ImportDialog.DocumentSearchSubDir.State = 1 - Applications(CurOffice,SBDOCSOURCE) = ConvertToURL(ImportDialog.DocumentImportPath.Text) - Applications(CurOffice,SBDOCTARGET) = ConvertToUrl(ImportDialog.DocumentExportPath.Text) - Applications(CurOffice,SBTEMPLCONVERT) = ImportDialog.TemplateCheckbox.State = 1 - Applications(CurOffice,SBTEMPLRECURSIVE) = ImportDialog.TemplateSearchSubDir.State = 1 - Applications(CurOffice,SBTEMPLSOURCE) = ConvertToURL(ImportDialog.TemplateImportPath.Text) - Applications(CurOffice,SBTEMPLTARGET) = ConvertToURL(ImportDialog.TemplateExportPath.Text) +Sub AssignPathToCurrentApplication(Index as Integer, NewPath as String) + If Applications(CurOffice,Index) = "" Then + If CurOffice > 0 Then + Applications(CurOffice,Index) = Applications(CurOffice-1,Index) + Else + Applications(CurOffice,Index) = NewPath + End If End If - SaveStep_InputPath = bSaveConfiguration -End Function +End Sub + + +Sub SaveStep_InputPath() + Applications(CurOffice,SBDOCCONVERT) = ImportDialog.DocumentPathCheckbox.State = 1 + Applications(CurOffice,SBDOCRECURSIVE) = ImportDialog.DocumentSearchSubDir.State = 1 + Applications(CurOffice,SBDOCSOURCE) = ConvertToURL(ImportDialog.DocumentImportPath.Text) + Applications(CurOffice,SBDOCTARGET) = ConvertToUrl(ImportDialog.DocumentExportPath.Text) + Applications(CurOffice,SBTEMPLCONVERT) = ImportDialog.TemplateCheckbox.State = 1 + Applications(CurOffice,SBTEMPLRECURSIVE) = ImportDialog.TemplateSearchSubDir.State = 1 + Applications(CurOffice,SBTEMPLSOURCE) = ConvertToURL(ImportDialog.TemplateImportPath.Text) + Applications(CurOffice,SBTEMPLTARGET) = ConvertToURL(ImportDialog.TemplateExportPath.Text) +End Sub Sub SetEnabledTemplate_InputPath() @@ -295,7 +303,7 @@ Sub FillStep_Progress() With ImportDialog .cbBack.Enabled = False .cbGoOn.Enabled = False - .FrameProgress.Label = sProgressPage_1 + .hlnProgress.Label = sProgressPage_1 .LabelRetrieval.FontWeight = com.sun.star.awt.FontWeight.BOLD .LabelRetrieval.Label = sProgressPage_2 .LabelCurProgress.Label = sProgressPage_3 @@ -409,11 +417,12 @@ End Sub Function CheckControlPath(oTextBox as Object, ByVal bDoEnable as Boolean) -Dim Path as String +Dim sPath as String If Not bDoEnable Then CheckControlPath = False Else - CheckControlPath = oTextBox.Text <> "" + sPath = ConvertToUrl(Trim(oTextBox.Text) + CheckControlPath = oUcb.Exists(sPath) End If End Function diff --git a/wizards/source/importwizard/FilesModul.xba b/wizards/source/importwizard/FilesModul.xba index 054fcc18b69a..f89a74cdc490 100644 --- a/wizards/source/importwizard/FilesModul.xba +++ b/wizards/source/importwizard/FilesModul.xba @@ -48,7 +48,7 @@ Dim sLocExtension as String sFileContent() = GetMimeTypeList(sFilterName(FilterIndex)) NewList() = ReadDirectories(sSourceDir, bRecursive, bCheckRealType, False, sFileContent(), sLocExtension) If Ubound(NewList()) > -1 Then - AddListtoList(FilesList(), NewList(), ApplIndex) + AddListtoFilesList(FilesList(), NewList(), ApplIndex) ImportDialog.LabelRetrieval.Label = sProgressPage_2 & " " & ReplaceString(sProgressPage_5, Str(Ubound(FilesList()) + 1) & " ", "%1") End If End If @@ -200,10 +200,12 @@ Dim MaxFileIndex as Integer ' Wend End If Next i - ImportDialog.cbCancel.Label = sCloseButton - Msgbox sReady, 64, sTitle - bCallCancelMsg = False End If + ImportDialog.cbCancel.Label = sCloseButton + ImportDialog.cbGoOn.Label = sReady + ImportDialog.cbGoOn.Enabled = True + bCallCancelMsg = False + ' oLogDocument.Dispose() ' ImportDialogArea.endExecute ' ImportDialogArea.Dispose @@ -215,9 +217,13 @@ RTError: End Sub -Sub AddListtoList(FirstList(), SecList(), ApplIndex as Integer) +Sub AddListtoFilesList(FirstList(), SecList(), ApplIndex as Integer) Dim FirstStart as Integer, FirstEnd as Integer, i as Integer, s as Integer - FirstStart = Ubound(FirstList(),1) + If FirstList(0,0) = "" Then + FirstStart = Ubound(FirstList(),1) + Else + FirstStart = Ubound(FirstList(),1) + 1 + End If FirstEnd = FirstStart + Ubound(SecList(),1) ReDim Preserve FirstList(FirstEnd,2) s = 0 @@ -233,7 +239,7 @@ End Sub Function GetTargetTemplatePath(Index as Integer) Select Case WizardMode Case SBMICROSOFTMODE - GetTargetTemplatePath() = SOTemplatePath & "/" & sTemplateGroupName(Index) + GetTargetTemplatePath() = SOTemplatePath & "/" & sTemplateGroupName Case SBXMLMODE If Index = 3 Then ' Helper Application diff --git a/wizards/source/importwizard/ImportDialog.xdl b/wizards/source/importwizard/ImportDialog.xdl index e6d5daab14f8..f70a750e5ff8 100644 --- a/wizards/source/importwizard/ImportDialog.xdl +++ b/wizards/source/importwizard/ImportDialog.xdl @@ -1,99 +1,95 @@ - - - - + - - - - + + + + + + - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + - - - - + - + - + - - - + + + - + - + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - - + + + + + + + - + \ No newline at end of file diff --git a/wizards/source/importwizard/Language.xba b/wizards/source/importwizard/Language.xba index 188c44e3665f..8dc3e2a4eb2e 100644 --- a/wizards/source/importwizard/Language.xba +++ b/wizards/source/importwizard/Language.xba @@ -8,7 +8,7 @@ Public sSODocumentCheckbox(4) As String Public sSOHelperdocuments(1) As String Public sTemplateCheckbox(SBMAXAPPLCOUNT-1) As String Public sDocumentCheckbox(SBMAXAPPLCOUNT-1) As String -Public sTemplateGroupName(SBMAXAPPLCOUNT-1) As String +Public sTemplateGroupName As String Public sSearchInSubDir as String Public sPathErrorTemplates(SBMAXAPPLCOUNT-1) As String Public sPathErrorDocument(SBMAXAPPLCOUNT-1) As String @@ -71,9 +71,7 @@ Sub LoadLanguage() sSummaryHeader = GetResText(1031) - sTemplateGroupName(0) = GetResText(1036) - sTemplateGroupName(1) = GetResText(1037) - sTemplateGroupName(2) = GetResText(1038) + sTemplateGroupName = GetResText(1036) sProgressMoreDocs = GetResText(1041) sProgressMoreTemplates = GetResText(1042) diff --git a/wizards/source/importwizard/Main.xba b/wizards/source/importwizard/Main.xba index ba7126ee17b9..62bfd0c36134 100644 --- a/wizards/source/importwizard/Main.xba +++ b/wizards/source/importwizard/Main.xba @@ -37,7 +37,7 @@ Sub Main() FillStep_Welcome() RepaintHeaderPreview() SetStates() - ImportDialogArea.Execute() + ImportDialogArea.Visible = True 'Execute() ImportDialog.cbGoOn.DefaultButton = True Exit Sub RTError: @@ -66,7 +66,8 @@ Dim iCurStep as Integer Case 1 FillStep_InputPaths(0, True) Case 2 - If SaveStep_InputPath Then + If CheckInputPaths Then + SaveStep_InputPath If CurOffice < ApplCount - 1 Then CurOffice = CurOffice + 1 TakeOverPathSettings() @@ -84,6 +85,7 @@ Dim iCurStep as Integer Call ConvertAllDocuments(XMLFilterName()) End Select Case 4 + CancelButton() End Select ImportDialog.cbGoOn.DefaultButton = True RepaintHeaderPreview() @@ -108,14 +110,13 @@ Dim iCurStep as Integer '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) - Else - FillStep_Welcome() - bDoKeepApplValues = True - End If + SaveStep_InputPath + If CurOffice > 0 Then + CurOffice = CurOffice - 1 + FillStep_InputPaths(CurOffice, False) + Else + FillStep_Welcome() + bDoKeepApplValues = True End If End Select ImportDialog.cbGoOn.DefaultButton = True @@ -126,13 +127,13 @@ RTError: End Sub -Sub CancelButton +Sub CancelButton() If bCallCancelMsg Then ' Conversion is already running ImportDialog.cbCancel.Enabled = False bCancelTask = True Else - ImportDialogArea.EndExecute + ImportDialogArea.Visible = False 'EndExecute ImportDialogArea.Dispose() End End If @@ -141,7 +142,7 @@ End Sub Sub CancelTask() If Msgbox(sConvertError1, 36, sConvertError2) = 6 Then - ImportDialogArea.EndExecute + ImportDialogArea.Visible = False 'EndExecute ImportDialogArea.Dispose End Else @@ -177,7 +178,7 @@ Sub HelperDialog() End Sub -Sub DisorEnableCheckboxes(oEvent as Object) +Sub ToggleCheckboxes(oEvent as Object) Dim bMSEnable as Boolean bMSEnable = oEvent.Source.Model.Tag = "MS" With ImportDialog @@ -191,11 +192,11 @@ Dim bMSEnable as Boolean .WelcomeTextLabel2.Enabled = bMSEnable End With bDoKeepApplValues = False - DisOrEnableNextButton() + ToggleNextButton() End Sub -Sub DisOrEnableNextButton() +Sub ToggleNextButton() Dim iCurStep as Integer Dim bDoEnable as Boolean Dim i as Integer @@ -212,9 +213,9 @@ Dim i as Integer bDoKeepApplValues = False Case 2 bDoEnable = CheckControlPath(ImportDialog.TemplateImportPath, True) - bDoEnable = CheckControlPath(ImportDialog.TemplateExportPath, bDoEnable) +' bDoEnable = CheckControlPath(ImportDialog.TemplateExportPath, bDoEnable) bDoEnable = CheckControlPath(ImportDialog.DocumentImportPath, bDoEnable) - bDoEnable = CheckControlPath(ImportDialog.DocumentExportPath, bDoenable) +' bDoEnable = CheckControlPath(ImportDialog.DocumentExportPath, bDoenable) End Select ImportDialog.cbGoOn.Enabled = bDoEnable End Sub @@ -222,14 +223,16 @@ 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) + If Applications(CurOffice,SBDOCSOURCE) = "" Then + Applications(CurOffice,SBDOCSOURCE) = Applications(0,SBDOCSOURCE) + Applications(CurOffice,SBDOCTARGET) = Applications(0,SBDOCTARGET) + If WizardMode = SBXMLMODE AND Applications(CurOffice,SBAPPLKEY) = 3 Then + 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 If -End Sub +End Sub \ No newline at end of file -- cgit v1.2.3