diff options
author | Behrend Cornelius <bc@openoffice.org> | 2002-08-16 14:21:32 +0000 |
---|---|---|
committer | Behrend Cornelius <bc@openoffice.org> | 2002-08-16 14:21:32 +0000 |
commit | 86c303c6d9cd62fae2f4d263756a3cdc782dc88d (patch) | |
tree | a39d75e6695fe79e2b9baa3f17cb2d0a506cb903 /wizards | |
parent | 6b0c4278b5559667dd477b0f8f8dcd1c74b3a262 (diff) |
#95840# added some changes for the logfile
Diffstat (limited to 'wizards')
-rw-r--r-- | wizards/source/importwizard/DialogModul.xba | 2 | ||||
-rw-r--r-- | wizards/source/importwizard/FilesModul.xba | 146 | ||||
-rw-r--r-- | wizards/source/importwizard/ImportDialog.xdl | 2 | ||||
-rw-r--r-- | wizards/source/importwizard/Language.xba | 17 |
4 files changed, 115 insertions, 52 deletions
diff --git a/wizards/source/importwizard/DialogModul.xba b/wizards/source/importwizard/DialogModul.xba index 176cc17f4621..64b28a4c25fd 100644 --- a/wizards/source/importwizard/DialogModul.xba +++ b/wizards/source/importwizard/DialogModul.xba @@ -506,7 +506,7 @@ End Sub Sub FinalizeDialogButtons() - ImportDialog.cmdShowLogFile.Enabled = ((FileCount > 0) And (ImportDialog.chkLogfile.State = 1)) + ImportDialog.cmdShowLogFile.Enabled = ((Isnull(oLogDocument) = False) And (ImportDialog.chkLogfile.State = 1)) ImportDialog.cmdCancel.Enabled = False ImportDialog.cmdGoOn.Label = sCloseButton ImportDialog.cmdGoOn.Enabled = True diff --git a/wizards/source/importwizard/FilesModul.xba b/wizards/source/importwizard/FilesModul.xba index ed1485d24e5a..ecae8b06e67e 100644 --- a/wizards/source/importwizard/FilesModul.xba +++ b/wizards/source/importwizard/FilesModul.xba @@ -2,11 +2,17 @@ <!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd"> <script:module xmlns:script="http://openoffice.org/2000/script" script:name="FilesModul" script:language="StarBasic">Option Explicit +Public Const SBOVERWRITEUNDEFINED as Integer = 0 +Public Const SBOVERWRITECANCEL as Integer = 2 +Public Const SBOVERWRITEQUERY as Integer = 7 +Public Const SBOVERWRITEALWAYS as Integer = 6 + Public AbsTemplateFound as Integer Public AbsDocuFound as Integer Public oLogDocument as Object Public oLogTable as Object Public bLogExists as Boolean +Public sComment as String Public bInsertRow as Boolean Public sLogUrl as String @@ -15,7 +21,6 @@ Public FileCount as Integer - Function ReadApplicationDirectories(ApplIndex as Integer, FilesList(),bIsDocument as Boolean, sFiltername()) as Integer Dim bCheckDocuType as Boolean Dim FilterIndex as Integer @@ -76,7 +81,7 @@ End Sub Sub ConvertAllDocuments(sFilterName()) -Dim FileProperties(1) as new com.sun.star.beans.PropertyValue +Dim FileProperties(2) as new com.sun.star.beans.PropertyValue Dim WriterWebProperties(0) as new com.sun.star.beans.PropertyValue Dim OpenProperties(3) as new com.sun.star.beans.PropertyValue Dim FilesList(0,2) as String @@ -98,12 +103,14 @@ Dim CurFilterName as String Dim ApplIndex as Integer Dim Index as Integer Dim bIsDocument as Boolean -Dim iOverWrite as Integer +Dim iGeneralOverwrite as Integer Dim bDoSave as Boolean Dim sCurFileExists as String Dim MaxFileIndex as Integer Dim bContainsBasicMacro as Boolean Dim bIsPassWordProtected as Boolean +Dim iOverwrite as Integer + iGeneralOverwrite = SBOVERWRITEUNDEFINED bConversionIsRunnig = True bLogExists = false AbsTemplateFound = 0 @@ -113,7 +120,7 @@ Dim bIsPassWordProtected as Boolean If bCancelTask Or RetValue = 0 Then bConversionIsRunnig = False Exit Sub - End if + End if bIsDocument = False CurFound = ReadApplicationDirectories(i, FilesList(), bIsDocument, sFilterName()) ShowCurrentProgress(bIsDocument, CurFound) @@ -123,7 +130,7 @@ Dim bIsPassWordProtected as Boolean If bCancelTask Or RetValue = 0 Then bConversionIsRunnig = False Exit Sub - End if + End if bIsDocument = True CurFound = ReadApplicationDirectories(i, FilesList(), bIsDocument, sFilterName()) ShowCurrentProgress(bIsDocument, CurFound) @@ -135,15 +142,15 @@ Dim bIsPassWordProtected as Boolean OpenProperties(0).Name = "Hidden" OpenProperties(0).Value = True OpenProperties(1).Name = "AsTemplate" - OpenProperties(1).Name = False + OpenProperties(1).Value = False OpenProperties(2).Name = "MacroExecutionMode" - OpenProperties(2).Name = com.sun.star.document.MacroExecMode.NEVER_EXECUTE + OpenProperties(2).Value = com.sun.star.document.MacroExecMode.NEVER_EXECUTE OpenProperties(3).Name = "UpdateDocMode" - OpenProperties(3).Name = com.sun.star.document.UpdateDocMode.NO_UPDATE - + OpenProperties(3).Value = com.sun.star.document.UpdateDocMode.NO_UPDATE MaxFileIndex = Ubound(FilesList(),1) FileCount = 0 For i = 0 To MaxFileIndex + sComment = "" If bCancelTask Or RetValue = 0 Then bConversionIsRunnig = False Exit For @@ -158,9 +165,9 @@ Dim bIsPassWordProtected as Boolean If Not IsNull(oDocument) Then bIsPassWordProtected = CheckPassWordProtection(oDocument) End If - bContainsBasicMacro = CheckIfMacroExists(oDocument) If Not IsNull(oDocument) Then + CheckIfMacroExists(oDocument, sComment) Select Case sExtension Case "sxw", "sxc", "sxi", "sxd", "sxs", "sxm" SourceStemDir = RTrimStr(Applications(ApplIndex,SBDOCSOURCE), "/") @@ -180,36 +187,57 @@ Dim bIsPassWordProtected as Boolean If Not oUcb.Exists(TargetDir) Then CreateFolder(TargetDir) End If - If oUcb.Exists(TargetFile) Then - sCurFileExists = ReplaceString(sFileExists, ConvertFromUrl(TargetFile), "<1>") - sCurFileExists = ReplaceString(sCurFileExists, chr(13), "<CR>") - iOverWrite = Msgbox (sCurFileExists, 32 + 3, sTitle) - Select Case iOverWrite - Case 1 ' OK - ' In the FileProperty-Bean this is already default - bDoSave = True - Case 2 ' Abort - CancelTask(False) - bDoSave = False - Case 7 ' No - bDoSave = False - End Select + ' Todo: According to AS there might come a new feature that storeasUrl could possibly rise a UI dialog. + ' In this case my own UI becomes obsolete + If ((oUcb.Exists(TargetFile)) and (iGeneralOverwrite <> SBOVERWRITEALWAYS)) Then + If (iGeneralOverwrite = SBOVERWRITEUNDEFINED) Then + iGeneralOverWrite = Msgbox (sOverwriteallFiles, 32 + 3, sTitle) + End If + If ((iGeneralOverWrite = SBOVERWRITEQUERY) OR (iGeneralOverwrite = SBOVERWRITECANCEL)) Then + sCurFileExists = ReplaceString(sFileExists, ConvertFromUrl(TargetFile), "<1>") + sCurFileExists = ReplaceString(sCurFileExists, chr(13), "<CR>") + iOverWrite = Msgbox (sCurFileExists, 32 + 3, sTitle) + Select Case iOverWrite + Case 1 ' OK + ' In the FileProperty-Bean this is already default + bDoSave = True + Case 2 ' Abort + CancelTask(False) + bDoSave = False + Case 7 ' No + bDoSave = False + End Select + End If End If If bDoSave Then - InsertDocNamesToLogDocument(sFullName, TargetFile, bContainsBasicMacro) - On Local Error Resume Next + On Local Error Goto NOSAVING FileProperties(0).Name = "FilterName" FileProperties(0).Value = CurFilterName + FileProperties(1).Name = "Overwrite" + FileProperties(1).Value = True If bIsPassWordProtected Then - FileProperties(1).Name = "PassWord" - FileProperties(1).Value = sCurPassWord + FileProperties(2).Name = "PassWord" + FileProperties(2).Value = sCurPassWord End If + ' Todo: Make sure that an errorbox pops up when saving fails oDocument.StoreAsUrl(TargetFile,FileProperties()) - FileCount = FileCount + 1 + NOSAVING: + If Err <> 0 Then + sCurcouldnotsaveDocument = ReplaceString(scouldnotsaveDocument, ConvertFromUrl(TargetFile), "<1>") + sComment = ConcatComment(sComment, sCurCouldnotsaveDocument) + Resume LETSGO + LETSGO: + Else + FileCount = FileCount + 1 + End If oDocument.Dispose() - On Local Error Goto 0 End If + Else + sCurcouldnotopenDocument = ReplaceString(scouldnotopenDocument, ConvertFromUrl(sFullName), "<1>") + sComment = ConcatComment(sComment, sCurCouldnotopenDocument) + TargetFile = "" End If + InsertDocNamesToLogDocument(sFullName, TargetFile, sComment) Next i End If AddLogStatistics() @@ -351,7 +379,8 @@ Dim bLogIsThere as Boolean End Sub -Sub InsertDocNamesToLogDocument(SourceUrl as String, TargetUrl as String, bContainsBasicMacro as Boolean) + +Sub InsertDocNamesToLogDocument(SourceUrl as String, TargetUrl as String, sComment as String) 'bContainsBasicMacro as Boolean Dim oCell as Object Dim oLogCursor as Object Dim UrlList(1) as String @@ -369,11 +398,13 @@ Dim oCommentCursor as Object UrlList(1) = TargetUrl For i = 0 To 1 oCell = oLogTable.GetCellbyPosition(i,oLogTable.Rows.Count-1) - If i = 1 And bContainsBasicMacro Then - oCommentCursor = oCell.createTextCursor() - oCell.insertControlCharacter(oCommentCursor, com.sun.star.text.ControlCharacter.PARAGRAPH_BREAK, False) - oCell.insertString(oCommentCursor, sReeditMacro, false) - End If + If sComment <> "" Then + If ((TargetUrl <>"") AND (i = 1)) Or ((TargetUrl = "") AND (i = 0)) Then + oCommentCursor = oCell.createTextCursor() + oCell.insertControlCharacter(oCommentCursor, com.sun.star.text.ControlCharacter.PARAGRAPH_BREAK, False) + oCell.insertString(oCommentCursor, sComment, false) + End If + End If LocUrl = UrlList(i) oLogCursor = oCell.createTextCursor() oLogCursor.CollapseToStart() @@ -382,7 +413,7 @@ Dim oCommentCursor as Object oLogCursor.HyperLinkTarget = LocUrl LocFileName = FileNameOutOfPath(LocUrl) oCell.InsertString(oLogCursor, LocFileName,False) - Next i + Next i oLogDocument.Store() End If End Sub @@ -392,7 +423,6 @@ Sub AddLogStatistics() Dim oCell as Object Dim oLogCursor as Object Dim MaxRowIndex as Integer -Dim oTableCursor as Object If bLogExists Then MaxRowIndex = oLogTable.Rows.Count sLogSummary = ReplaceString(sLogSummary, FileCount, "<COUNT>") @@ -400,9 +430,7 @@ Dim oTableCursor as Object oCell = oLogTable.GetCellbyPosition(0, MaxRowIndex) oLogCursor = oCell.createTextCursor() oCell.InsertString(oLogCursor, sLogSummary,False) - oTableCursor = oLogTable.createCursorByCellName(oCell.CellName) - oTableCursor.goRight(1, True) - oTableCursor.mergeRange() + MergeRange(oLogTable, oCell, 1) oLogDocument.Store() oLogDocument.Dispose() bLogExists = False @@ -412,12 +440,14 @@ End Sub ' This macro has to be reworked out again as it works with deprecated interfaces ' It can be completed as soon as Bug #93295 will be fixed because right now it -' is not possible to access BasicLibraries and DialogLibraries from outside the +' is not possible to access BasicLibraries and DialogLibraries from outside the ' document -Function CheckIfMacroExists(oDocument as Object) as Boolean +Function CheckIfMacroExists(oDocument as Object, sComment as String) as Boolean Dim ModuleNames() as String Dim MaxIndex as Integer Dim oLibraryContainer as Object +Dim bMacroExists as Boolean + bMacroExists = False ' oLibraryContainer = oDocument.LibraryContainer ' If oLibraryContainer.hasElements Then ' ModuleNames = oDocument.LibraryContainer.ElementNames @@ -425,16 +455,19 @@ Dim oLibraryContainer as Object ' For i = 0 To MaxIndex ' oLibrary = oLibraryContainer.getByName(ModuleNames(i)) ' If Not IsNull(oLibrary.getDialogContainer) Then -' CheckIf MacroExists = True +' bMacroExists = True ' Exit Function ' End If ' If oLibrary.ModuleContainer.HasElements Then -' CheckIfMacroExists() = True +' bMacroExists = True ' Exit Function ' End If ' Next i ' End If - CheckIfMacroExists() = False + If bMacroExists = True Then + ConcatComment(sComment, sReeditMacro) + End If + CheckIfMacroExists() = bMacroExists End Function @@ -461,4 +494,23 @@ End Function Sub OpenLogDocument() Dim NoArgs() as New com.sun.star.beans.PropertyValue OpenDocument(sLogUrl, NoArgs()) -End Sub</script:module> +End Sub + + +Sub MergeRange(oTable as Object, oCell as Object, MergeCount as Integer) +Dim oTableCursor as Object + oTableCursor = oTable.createCursorByCellName(oCell.CellName) + oTableCursor.goRight(MergeCount, True) + oTableCursor.mergeRange() +End Sub + + +Function ConcatComment(sComment as String, AdditionalComment as String) + If sComment = "" Then + sComment = AdditionalComment + Else + sComment = sComment & chr(13) + AdditionalComment + End If + ConcatComment = sComment +End Function +</script:module>
\ No newline at end of file diff --git a/wizards/source/importwizard/ImportDialog.xdl b/wizards/source/importwizard/ImportDialog.xdl index 9758ff147798..287c3dccac1a 100644 --- a/wizards/source/importwizard/ImportDialog.xdl +++ b/wizards/source/importwizard/ImportDialog.xdl @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE dlg:window PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "dialog.dtd"> -<dlg:window xmlns:dlg="http://openoffice.org/2000/dialog" xmlns:script="http://openoffice.org/2000/script" dlg:id="ImportDialog" dlg:left="96" dlg:top="28" dlg:width="270" dlg:height="210" dlg:page="4" dlg:help-url="HID:34570" dlg:closeable="true" dlg:moveable="true" dlg:title="ImportDialog"> +<dlg:window xmlns:dlg="http://openoffice.org/2000/dialog" xmlns:script="http://openoffice.org/2000/script" dlg:id="ImportDialog" dlg:left="96" dlg:top="28" dlg:width="270" dlg:height="210" dlg:page="2" dlg:help-url="HID:34570" dlg:closeable="true" dlg:moveable="true" dlg:title="ImportDialog"> <dlg:bulletinboard> <dlg:text dlg:id="lblTemplateExport" dlg:tab-index="0" dlg:left="12" dlg:top="94" dlg:width="60" dlg:height="8" dlg:page="2" dlg:value="lblTemplateExport"/> <dlg:textfield dlg:id="txtTemplateImportPath" dlg:tab-index="1" dlg:left="73" dlg:top="76" dlg:width="170" dlg:height="12" dlg:page="2" dlg:help-url="HID:34583"> diff --git a/wizards/source/importwizard/Language.xba b/wizards/source/importwizard/Language.xba index 83c2a3be3f0e..b69e836ecec2 100644 --- a/wizards/source/importwizard/Language.xba +++ b/wizards/source/importwizard/Language.xba @@ -41,6 +41,12 @@ Public sSumMSTemplates(3) as String Public ModuleList(3) as String Public sLogSummary as String Public sReeditMacro as String +Public sOverwriteallFiles as String +Public scouldnotopenDocument as String +Public sCurcouldnotopenDocument as String +Public scouldnotsaveDocument as String +Public sCurcouldnotsaveDocument as String + Sub LoadLanguage() If InitResources("ImportWizard","imp") then @@ -74,7 +80,7 @@ Sub LoadLanguage() GetApplResourceArray(2017,2, sSOHelperDocuments()) sContainerName(0) = GetResText(1030) - + ' Note: for the version 5.2 there was no Productname "StarSuite" sContainerName(1) = "StarOffice" sSummaryHeader = GetResText(1031) @@ -92,9 +98,12 @@ Sub LoadLanguage() sConvertError2 = GetResText(1056) sRTErrorDesc = GetResText(1057) sRTErrorHeader = GetResText(1058) + sOverwriteallFiles = GetResText(1070) + sReeditMacro = GetResText(1071) + scouldnotsaveDocument = GetResText(1072) + scouldnotopenDocument = GetResText(1073) sPathDialogMessage = GetResText(1080) sTitle = GetResText(1081) - sReeditMacro = "Dokumentenmakro muss überarbeitet werden" sProgressPage_1 = GetResText(1090) sProgressPage_2 = GetResText(1091) @@ -124,7 +133,9 @@ Sub LoadLanguage() .lblTemplateExport.Label = sExportLabel .chkLogfile.Label = GetResText(2032) .chkLogfile.Helptext = GetResText(2033) - .cmdShowLogFile.Label = "Logdatei anzeigen" + Dim Blabla as String + blabla = GetResText(1072) + .cmdShowLogFile.Label = GetResText(2035) End With ModuleList(0) = "com.sun.star.text.TextDocument" ModuleList(1) = "com.sun.star.sheet.SpreadsheetDocument" |