diff options
author | Rüdiger Timm <rt@openoffice.org> | 2004-03-30 12:38:44 +0000 |
---|---|---|
committer | Rüdiger Timm <rt@openoffice.org> | 2004-03-30 12:38:44 +0000 |
commit | de7fab036f224f626165413185d13e5293ea43d4 (patch) | |
tree | 5c1f2b8996bb2d45b7de5cdc9e096c1abc1eeb4b /wizards/source/importwizard | |
parent | 60f760eb81995a7c26107ef25610a6539c615cd5 (diff) |
INTEGRATION: CWS extras12 (1.37.8); FILE MERGED
2003/12/17 12:36:09 bc 1.37.8.1: #112871# Filtertracing for importwizard added
Diffstat (limited to 'wizards/source/importwizard')
-rw-r--r-- | wizards/source/importwizard/FilesModul.xba | 170 |
1 files changed, 144 insertions, 26 deletions
diff --git a/wizards/source/importwizard/FilesModul.xba b/wizards/source/importwizard/FilesModul.xba index b98e1de5d897..b15acfc35add 100644 --- a/wizards/source/importwizard/FilesModul.xba +++ b/wizards/source/importwizard/FilesModul.xba @@ -15,7 +15,8 @@ Public sCurPassWord as String Public FileCount as Integer Public XMLTemplateCount as Integer Public PathCollection(7,3) as String - +Public bIsFirstLogTable as Boolean +Public bFilterTracerIsinsideTable as Boolean Function ReadCollectionPaths(FilesList() as String, sFilterName() as String) @@ -110,6 +111,7 @@ Dim bAssignFileName as Boolean End If End If Next i + ReadCollectionPaths() = Ubound(FilesList()) > -1 End Function @@ -249,6 +251,7 @@ Dim bContainsBasicMacro as Boolean Dim bIsPassWordProtected as Boolean Dim iOverwrite as Integer Dim sMimeTypeorExtension as String +Dim sPrevMimeTypeorExtension as String bConversionisrunning = True InteractionTypes(0) = com.sun.star.task.PasswordRequestMode.PASSWORD_REENTER oInteractionHandler = createUnoService("com.sun.star.task.InteractionHandler") @@ -271,6 +274,7 @@ Dim sMimeTypeorExtension as String TotFound = 0 ' because it will return the value 0 (and not -1) even when the Array is empty SetProgressDisplay(0) End If + BubbleSortList(FilesList(), true) If TotFound > 0 Then CreateLogDocument(OpenProperties()) InitializeProgressPage(ImportDialog) @@ -293,9 +297,13 @@ Dim sMimeTypeorExtension as String End If bDoSave = True sSourceUrl = FilesList(i,0) + sPrevMimeTypeorExtension = sMimeTypeorExtension sMimeTypeorExtension = FilesList(i,1) CurFiltername = GetFilterName(sMimeTypeorExtension, sFilterName(), sExtension, FilterIndex) ApplIndex = FilesList(i,2) + If sMimeTypeorExtension <> sPrevMimeTypeorExtension Then + CreateLogTable(ApplIndex, sMimeTypeOrExtension, sFiltername() + End If If ApplIndex > Ubound(Applications) or (ApplIndex < 0) Then Msgbox "Applicationindex out of bounds:" & sSourcUrl End If @@ -378,11 +386,11 @@ Dim sMimeTypeorExtension as String FileCount = FileCount + 1 End If oDocument.Dispose() - InsertTargetUrlToLogDocument(sTargetUrl, sComment) + InsertTargetUrlToLogDocument(sTargetUrl, sComment, ApplIndex) Else sCurcouldnotopenDocument = ReplaceString(scouldnotopenDocument, ConvertFromUrl(sSourceUrl), "<1>") sComment = ConcatComment(sComment, sCurCouldnotopenDocument) - InsertSourceUrlToLogDocument(sSourceUrl, sComment) + InsertSourceUrlToLogDocument(sSourceUrl, sComment) End If End If End If @@ -417,7 +425,7 @@ Dim s as Integer FirstList(i,1) = SecList(s,1) sLocExtension = lcase(FirstList(i,1)) Select Case sLocExtension - Case "sdw", "sdc", "sda", "sdd", "smf", "sgl", "doc", "xls", "ppt", "pps" + Case "sdw", "sdc", "sda", "sdd", "smf", "sgl", "doc", "xls", "ppt" AbsDocuFound = AbsDocuFound + 1 Case else AbsTemplateFound = AbsTemplateFound + 1 @@ -490,11 +498,97 @@ Dim StringList() as String End Function -Sub CreateLogDocument(HiddenProperties()) -Dim OpenProperties(0) as new com.sun.star.beans.PropertyValue -Dim oTableCursor as Object +Sub CreateLogTable(ApplIndex as Integer, CurFileContent as String, sFilterName() as String) Dim oLogCursor as Object Dim oLogRows as Object +Dim FilterIndex as Integer +Dim sDocumentType as String +Dim oTextCursor +Dim oCell + bFilterTracerIsinsideTable = False + FilterIndex = GetIndexForPartStringinMultiArray(sFilterName(), CurFileContent, 0) + sDocumentType = sFiltername(FilterIndex,3) + oLogCursor = oLogDocument.Text.createTextCursor() + oLogCursor.GotoEnd(False) + If Not bIsFirstLogTable Then + oLogDocument.Text.insertControlCharacter(oLogCursor, com.sun.star.text.ControlCharacter.PARAGRAPH_BREAK, False) + Else + bisFirstLogTable = False + End If + oLogCursor.HyperLinkURL = "" + oLogCursor.HyperLinkName = "" + oLogCursor.HyperLinkTarget = "" + oLogCursor.ParaStyleName = "Heading 1" + oLogCursor.setString(sDocumentType) + If WizardMode = SBMICROSOFTMODE Then + If bFilterTracingAvailable Then + If bMSApplFilterTracingAvailable(ApplIndex) Then + Dim CurFilterTracingPath as String + CurFilterTracingPath = FilterTracingLogPath(ApplIndex) + bFilterTracerIsinsideTable = (bTakeOverTargetName(ApplIndex) Or bTakeOverPathName(ApplIndex)) + If Not bFilterTracerIsinsideTable Then + oLogCursor.CollapseToEnd() + oLogDocument.Text.insertControlCharacter(oLogCursor, com.sun.star.text.ControlCharacter.PARAGRAPH_BREAK, False) + InsertCommandButtonatViewCursor(oLogDocument, oLogCursor, CurFilterTracingPath) + End If + End If + End If + End If + oLogCursor.CollapsetoEnd() + oLogDocument.Text.insertControlCharacter(oLogCursor, com.sun.star.text.ControlCharacter.PARAGRAPH_BREAK, False) + oLogTable = oLogDocument.CreateInstance("com.sun.star.text.TextTable") + oLogTable.RepeatHeadline = true + If bFilterTracerIsinsideTable Then + oLogTable.initialize(2,3) + End If + oLogCursor.Text.InsertTextContent(oLogCursor, oLogTable, True) + oTextCursor = oLogTable.GetCellbyPosition(0,0).createTextCursor() + oTextCursor.SetString(sSourceDocuments) + oTextCursor = oLogTable.GetCellbyPosition(1,0).createTextCursor() + oTextCursor.SetString(sTargetDocuments) + If bFilterTracerIsinsideTable Then + oTextCursor = oLogTable.GetCellbyPosition(2,0).createTextCursor() + oTextCursor.SetString("FilterTracer") + End If + bInsertRow = False +End Sub + + +Function GetSize(iWidth, iHeight) As New com.sun.star.awt.Size +Dim aSize As New com.sun.star.awt.Size + aSize.Width = iWidth + aSize.Height = iHeight + GetSize() = aSize +End Function + + +Sub InsertCommandButtonatViewCursor(oLocDocument, oLocCursor, TargetUrl as String, Optional aSize) +Dim oDocument +Dim oController +Dim oCommandButton +Dim oShape +Dim oDrawPage +Dim oCommandControl +Dim oEvent +Dim oCell + oCommandButton = oLocDocument.createInstance("com.sun.star.form.component.CommandButton") + oShape = oLocDocument.CreateInstance ("com.sun.star.drawing.ControlShape") + If IsMissing(aSize) Then + oShape.Size = GetSize(4000, 600) + End If + oCommandButton.Label = FileNameoutofPath(Targeturl) + oCommandButton.TargetFrame = "_default" + oCommandButton.ButtonType = com.sun.star.form.FormButtonType.URL + oCommandbutton.DispatchUrlInternal = True + oCommandButton.TargetURL = ConverttoUrl(TargetUrl) + oShape.Control = oCommandbutton + oLocCursor.Text.InsertTextContent(oLocCursor, oShape, True) +End Sub + + + +Sub CreateLogDocument(HiddenProperties()) +Dim OpenProperties(0) as new com.sun.star.beans.PropertyValue Dim NoArgs() Dim i as Integer Dim bLogIsThere as Boolean @@ -503,15 +597,6 @@ Dim bLogIsThere as Boolean OpenProperties(0).Name = "Hidden" OpenProperties(0).Value = True oLogDocument = StarDesktop.LoadComponentFromURL("private:factory/swriter", "_default", 4, OpenProperties()) - oLogCursor = oLogDocument.Text.CreateTextCursor - oLogTable = oLogDocument.CreateInstance("com.sun.star.text.TextTable") - oLogTable.RepeatHeadline = true - oLogCursor.Text.InsertTextContent(oLogCursor, oLogTable, True) - oLogCursor = oLogTable.GetCellbyPosition(0,0).createTextCursor() - oLogCursor.SetString(sSourceDocuments) - oLogCursor = oLogTable.GetCellbyPosition(1,0).createTextCursor() - oLogCursor.SetString(sTargetDocuments) - bInsertRow = False sLogUrl = SOWorkPath & "/Logfile.sxw" Do bLogIsThere = oUcb.Exists(sLogUrl) @@ -530,15 +615,41 @@ Dim bLogIsThere as Boolean End Sub -Sub InsertTargetUrlToLogDocument(sTargetUrl as String, sComment as String) -Dim oCell as Object +Function GetFilterTracingLogPath(sTargetUrl as String, ApplIndex) as String +Dim TargetFileName as String +Dim sTargetFolder as String +Dim CurFilterTracingPath as String +Dim CurFilterTracingname as String +Dim CurFilterFolder as String + CurFilterTracingPath = FilterTracingLogPath(ApplIndex) + If bTakeOverTargetName(ApplIndex) Then + TargetFilename = GetFileNameWithoutextension(sTargetUrl, "/") + CurFilterFolder = DirectoryNameoutofPath(FilterTracingLogPath(ApplIndex), "/") + CurFilterTracingpath = CurFilterFolder & "/" & TargetFilename & ".log" + End If + If bTakeOverPathName(ApplIndex) Then 'Replace the Folder in the FilterTracerpath by the Folder of the targetUrl + sTargetFolder = DirectoryNameoutofPath(sTargetUrl,"/") + CurFilterTracingPath = sTargetFolder & "/" & FileNameoutofPath(CurFilterTracingPath, "/") + End If + GetFilterTracingLogPath() = CurFilterTracingPath +End Function + + +Sub InsertTargetUrlToLogDocument(sTargetUrl as String, sComment as String, ApplIndex as Integer) +Dim oCell +Dim oTextCursor +Dim CurFilterTracingpath as String If (bLogExists) And (sTargetUrl <> "") Then If sTargetUrl <> "" Then oCell = oLogTable.GetCellbyPosition(1,oLogTable.Rows.Count-1) -' If ((TargetUrl <>"") AND (i = 1)) Or ((TargetUrl = "") AND (i = 0)) Then - InsertCommentToLogCell(sComment, oCell) -' End If + InsertCommentToLogCell(sComment, oCell) InsertHyperLinkToLogCell(sTargetUrl, oCell) + If bFilterTracerIsinsideTable Then + oCell = oLogTable.getCellByPosition(2, oLogTable.Rows.Count-1) + oTextCursor = oCell.Text.CreateTextCursor() + CurFilterTracingpath = GetFilterTracingLogPath(sTargetUrl, ApplIndex) + InsertCommandButtonatViewCursor(oLogDocument, oTextCursor, CurFilterTracingPath) + End If oLogDocument.Store() End If End If @@ -591,11 +702,18 @@ Dim MaxRowIndex as Integer If bLogExists Then MaxRowIndex = oLogTable.Rows.Count sLogSummary = ReplaceString(sLogSummary, FileCount, "<COUNT>") - oLogTable.Rows.InsertByIndex(MaxRowIndex, 1) - oCell = oLogTable.GetCellbyPosition(0, MaxRowIndex) - oLogCursor = oCell.createTextCursor() - oCell.InsertString(oLogCursor, sLogSummary,False) - MergeRange(oLogTable, oCell, 1) +' oLogTable.Rows.InsertByIndex(MaxRowIndex, 1) +' oCell = oLogTable.GetCellbyPosition(0, MaxRowIndex) +' oLogCursor = oCell.createTextCursor() +' oCell.InsertString(oLogCursor, sLogSummary,False) +' MergeRange(oLogTable, oCell, 1) + + oLogCursor = oLogDocument.Text.CreateTextCursor + oLogCursor.gotoEnd(False) + oLogCursor.HyperLinkURL = "" + oLogCursor.HyperLinkName = "" + oLogCursor.HyperLinkTarget = "" + oLogCursor.SetString(sLogSummary) oLogDocument.Store() oLogDocument.Dispose() bLogExists = False |