From 8ee9e2cde5843b631a08f225fe786f11c8db74de Mon Sep 17 00:00:00 2001 From: Behrend Cornelius Date: Thu, 9 Aug 2001 15:35:42 +0000 Subject: #90750# Call of ReadDirectoryRoutine adapted; LogFile handling improved --- wizards/source/importwizard/DialogModul.xba | 23 ++--------------- wizards/source/importwizard/FilesModul.xba | 38 +++++++++++++---------------- wizards/source/importwizard/Main.xba | 23 ++++++++--------- 3 files changed, 31 insertions(+), 53 deletions(-) (limited to 'wizards') diff --git a/wizards/source/importwizard/DialogModul.xba b/wizards/source/importwizard/DialogModul.xba index 43c115d0212f..64b7e4068031 100644 --- a/wizards/source/importwizard/DialogModul.xba +++ b/wizards/source/importwizard/DialogModul.xba @@ -62,7 +62,7 @@ Public Const SBAPPLKEY = 9 ' Applications(X,6) = True/False (Including Subdirectories) ' Applications(X,7) = "File:///..." (SourceUrl of the templates) ' Applications(X,8) = "File:///..." (TargetUrl of the templates) -' Applications(X,9) = 0 (Key to the original Index of the Applications) +' Applications(X,9) = 0 (Key to the original Index of the Applications) Sub FillStep_Welcome() @@ -288,7 +288,7 @@ End Function Sub FillStep_Summary() -' Todo: Angabe über die Vorlagengruppen,bzw. Template-Exportpfad +' Todo: Angabe über die Vorlagengruppen,bzw. Template-Exportpfad With ImportDialog .SummaryTextbox.Text = MakeSummaryString() .cbGoOn.Enabled = .SummaryTextbox.Text <> "" @@ -315,25 +315,6 @@ Sub FillStep_Progress() End Sub -Sub DocumentDirSearchDialog() - CallDirSearchDialog(ImportDialog.DocumentImportPath) -End Sub - - -Sub StarDocumentDirSearchDialog() - CallDirSearchDialog(ImportDialog.DocumentExportPath) -End Sub - - -Sub CallDirSearchDialog(oTargetControl as Object) -Dim sDirName as String - sDirName = Application.FileDialog("P", sPathDialogMessage, oTargetControl.Text) - If Len(sDirName) > 0 Then - oTargetControl.Text = sDirName - End If -End Sub - - Sub SetupMSConfiguration() iApplSection = 0 Wizardmode = SBMICROSOFTMODE diff --git a/wizards/source/importwizard/FilesModul.xba b/wizards/source/importwizard/FilesModul.xba index 739fcf6d9541..2a83b03c2dfc 100644 --- a/wizards/source/importwizard/FilesModul.xba +++ b/wizards/source/importwizard/FilesModul.xba @@ -6,7 +6,7 @@ Public AbsTemplateFound as Integer Public AbsDocuFound as Integer Public oLogDocument as Object Public oLogTable as Object - +Public bInsertRow as Boolean Function ReadApplicationDirectories(ApplIndex as Integer, FilesList(),bIsDocument as Boolean, sFiltername()) as Integer Dim bCheckDocuType as Boolean @@ -114,6 +114,7 @@ Dim MaxFileIndex as Integer ShowCurrentProgress(bIsDocument, CurFound) Next i TotFound = AbsTemplateFound + AbsDocuFound + CreateLogDocument(OpenProperties()) If TotFound > 0 Then bCallCancelMsg = True InitializeProgressPage(ImportDialog) @@ -123,16 +124,15 @@ Dim MaxFileIndex as Integer For i = 0 To MaxFileIndex bDoSave = True If bCancelTask Then - Call CancelTask() + If CancelTask() Then + Exit Sub + End If End if sFullName = FilesList(i,0) CurFiltername = GetFilterName(FilesList(i,1), sFilterName(), sExtension, FilterIndex) ApplIndex = FilesList(i,2) sViewPath = CutPathView(sFullName, 60) ImportDialog.LabelCurDocument.Label = Str(i+1) & "/" & MaxFileIndex + 1 & " (" & sViewPath & ")" - If i = 0 Then - CreateLogDocument(OpenProperties()) - End If oDocument = StarDesktop.LoadComponentFromURL(sFullName, "_blank", 0, OpenProperties()) If bSetFonts Then CheckScripts(oDocument, 1) @@ -175,7 +175,7 @@ Dim MaxFileIndex as Integer End Select End If If bDoSave Then - InsertDocNamesToLogDocument(i+1, sFullName, TargetFile) + InsertDocNamesToLogDocument(sFullName, TargetFile) On Local Error Resume Next ' Note: Files are automatically stored in Default format ' FileProperties(0).Name = "FilterName" @@ -205,14 +205,6 @@ Dim MaxFileIndex as Integer ImportDialog.cbGoOn.Label = sReady ImportDialog.cbGoOn.Enabled = True bCallCancelMsg = False -'Todo: Natürlich nur schließen, wenn auch vorhanden! - If Not IsNull(oLogDocument) Then - oLogDocument.Dispose() - End If - ImportDialogArea.endExecute - ImportDialogArea.Dispose - End - Exit Sub RTError: Msgbox sRTErrorDesc, 16, sRTErrorHeader @@ -313,7 +305,7 @@ Dim i as Integer Dim bLogExists as Boolean If ImportDialog.chkLogfile.State = 1 Then i = 2 - oLogDocument = StarDesktop.LoadComponentFromURL("private:factory/swriter", "_blank", 0, NoArgs())' HiddenProperties()) ' HiddenProperties()) + oLogDocument = StarDesktop.LoadComponentFromURL("private:factory/swriter", "_blank", 4, NoArgs())' HiddenProperties()) ' HiddenProperties()) oLogCursor = oLogDocument.Text.CreateTextCursor oLogTable = oLogDocument.CreateInstance("com.sun.star.text.TextTable") oLogCursor.Text.InsertTextContent(oLogCursor, oLogTable, True) @@ -322,6 +314,7 @@ Dim bLogExists as Boolean oLogCursor.SetString(sSourceDocuments) oLogCursor = oLogTable.GetCellbyPosition(1,0).createTextCursor oLogCursor.SetString(sTargetDocuments) + bInsertRow = False sLogUrl = SOWorkPath & "/Logfile.sxw" Do bLogExists = oUcb.Exists(sLogUrl) @@ -334,32 +327,35 @@ Dim bLogExists as Boolean i = i + 1 End If Loop Until Not bLogExists -' Todo Für das Logdokument einen sinnigen Titel festlegen! - oLogDocument.StoreToUrl(sLogUrl, NoArgs()) + oLogDocument.StoreAsUrl(sLogUrl, NoArgs()) EndIf End Sub -Sub InsertDocNamesToLogDocument(iRow as Integer, SourceUrl as String, TargetUrl as String) +Sub InsertDocNamesToLogDocument(SourceUrl as String, TargetUrl as String) +Dim oCell as Object Dim oLogCursor as Object Dim UrlList(1) as String Dim LocFileName as String Dim LocUrl as String Dim i as Integer If ImportDialog.chkLogfile.State = 1 Then - If iRow > 1 Then + If bInsertRow Then oLogTable.Rows.InsertByIndex(oLogTable.Rows.Count,1) + Else + bInsertRow = True End If UrlList(0) = SourceUrl UrlList(1) = TargetUrl For i = 0 To 1 - oLogCursor = oLogTable.GetCellbyPosition(i,iRow).createTextCursor + oCell = oLogTable.GetCellbyPosition(i,oLogTable.Rows.Count-1) + oLogCursor = oCell.createTextCursor() LocUrl = UrlList(i) oLogCursor.HyperLinkURL = LocUrl oLogCursor.HyperLinkName = LocUrl oLogCursor.HyperLinkTarget = LocUrl LocFileName = FileNameOutOfPath(LocUrl, "/") - oLogTable.GetCellbyPosition(i,iRow).InsertString(oLogCursor, LocFileName,False) + oCell.InsertString(oLogCursor, LocFileName,False) Next i oLogDocument.Store() End If diff --git a/wizards/source/importwizard/Main.xba b/wizards/source/importwizard/Main.xba index 9065cd3a5a3c..e25df463fc74 100644 --- a/wizards/source/importwizard/Main.xba +++ b/wizards/source/importwizard/Main.xba @@ -16,6 +16,7 @@ Public bCallCancelMsg as Boolean Sub Main() BasicLibraries.LoadLibrary("Tools") bSetFonts = False + bCallCancelMsg = False If bSetFonts Then BasicLibraries.LoadLibrary("Translater") GetFontNames() @@ -37,11 +38,13 @@ Sub Main() FillStep_Welcome() RepaintHeaderPreview() SetStates() - ImportDialogArea.Visible = True ImportDialog.cbGoOn.DefaultButton = True + ImportDialogArea.Execute() + ImportDialogArea.Dispose() + End Exit Sub RTError: - Msgbox sRTErrorDesc, 16, sRTErrorHeader +' Msgbox sRTErrorDesc, 16, sRTErrorHeader End Sub @@ -107,7 +110,6 @@ Dim iCurStep as Integer 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 SaveStep_InputPath @@ -130,26 +132,25 @@ End Sub Sub CancelButton() If bCallCancelMsg Then ' Conversion is already running - ImportDialog.cbCancel.Enabled = False - bCancelTask = True + CancelTask() +' ImportDialog.cbCancel.Enabled = False +' bCancelTask = True Else ImportDialogArea.EndExecute() - ImportDialogArea.Dispose() - End End If End Sub -Sub CancelTask() +Function CancelTask() If Msgbox(sConvertError1, 36, sConvertError2) = 6 Then ImportDialogArea.EndExecute 'Visible = False - ImportDialogArea.Dispose - End +' CancelTask = True Else bCancelTask = False ImportDialog.cbCancel.Enabled = True + CancelTask = False End If -End Sub +End Function -- cgit v1.2.3