diff options
author | Behrend Cornelius <bc@openoffice.org> | 2002-07-15 14:42:29 +0000 |
---|---|---|
committer | Behrend Cornelius <bc@openoffice.org> | 2002-07-15 14:42:29 +0000 |
commit | ca31bde874a93e51ec613831f1b1ad11bd1d2422 (patch) | |
tree | 99d7d2e2465267ec2efc0c77ff487693b439d7bb | |
parent | 96786d85e673129029d1ab2bcfb98ea343e98348 (diff) |
#100060# Password now also taken over
-rw-r--r-- | wizards/source/importwizard/DialogModul.xba | 8 | ||||
-rw-r--r-- | wizards/source/importwizard/FilesModul.xba | 122 | ||||
-rw-r--r-- | wizards/source/importwizard/ImportDialog.xdl | 7 | ||||
-rw-r--r-- | wizards/source/importwizard/Language.xba | 3 | ||||
-rw-r--r-- | wizards/source/importwizard/Main.xba | 14 |
5 files changed, 127 insertions, 27 deletions
diff --git a/wizards/source/importwizard/DialogModul.xba b/wizards/source/importwizard/DialogModul.xba index e539043d9..308532d18 100644 --- a/wizards/source/importwizard/DialogModul.xba +++ b/wizards/source/importwizard/DialogModul.xba @@ -2,7 +2,7 @@ <!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd"> <script:module xmlns:script="http://openoffice.org/2000/script" script:name="DialogModul" script:language="StarBasic">Option Explicit -Public Const bDebugWizard = False +Public Const bDebugWizard = True Public Const SBFIRSTAPPLCHECKED = 0 Public Const SBSECONDAPPLCHECKED = 1 @@ -90,7 +90,7 @@ Dim i as Integer .cmdBack.Enabled = False .Step = 1 End With - CheckModuleInstallation() + CheckModuleInstallation() ToggleNextButton() End Sub @@ -315,6 +315,10 @@ Sub FillStep_Progress() .LabelCurDocument.Label = "" .Step = 4 End With + ImportDialogArea.GetControl("LabelRetrieval").SetFocus() + If ImportDialog.chkLogfile.State = 1 Then + ImportDialog.cmdShowLogFile.DefaultButton = True + End If End Sub diff --git a/wizards/source/importwizard/FilesModul.xba b/wizards/source/importwizard/FilesModul.xba index 69841e7ff..1f207aa9e 100644 --- a/wizards/source/importwizard/FilesModul.xba +++ b/wizards/source/importwizard/FilesModul.xba @@ -7,6 +7,10 @@ Public AbsDocuFound as Integer Public oLogDocument as Object Public oLogTable as Object Public bInsertRow as Boolean +Public sLogUrl as String +Public sCurPassWord as String + + Function ReadApplicationDirectories(ApplIndex as Integer, FilesList(),bIsDocument as Boolean, sFiltername()) as Integer Dim bCheckDocuType as Boolean @@ -68,9 +72,9 @@ End Sub Sub ConvertAllDocuments(sFilterName()) -Dim FileProperties(0) as new com.sun.star.beans.PropertyValue +Dim FileProperties(1) as new com.sun.star.beans.PropertyValue Dim WriterWebProperties(0) as new com.sun.star.beans.PropertyValue -Dim OpenProperties(1) as new com.sun.star.beans.PropertyValue +Dim OpenProperties(2) as new com.sun.star.beans.PropertyValue Dim FilesList(0,2) as String Dim sViewPath as String Dim i as Integer @@ -96,7 +100,9 @@ Dim sCurFileExists as String Dim oModel as Object Dim MaxFileIndex as Integer Dim FileCount as Integer -Dim sOldExtension as String +'Dim sOldExtension as String +Dim bContainsBasicMacro as Boolean +Dim bIsPassWordProtected as Boolean bConversionIsRunnig = True AbsTemplateFound = 0 AbsDocuFound = 0 @@ -119,6 +125,10 @@ Dim sOldExtension as String OpenProperties(0).Name = "Hidden" OpenProperties(0).Value = True OpenProperties(1).Name = "AsTemplate" + OpenProperties(1).Name = False + OpenProperties(2).Name = "Silent" + OpenProperties(2).Name = True + MaxFileIndex = Ubound(FilesList(),1) FileCount = 0 For i = 0 To MaxFileIndex @@ -132,15 +142,16 @@ Dim sOldExtension as String ApplIndex = FilesList(i,2) sViewPath = CutPathView(sFullName, 60) ImportDialog.LabelCurDocument.Label = Str(i+1) & "/" & MaxFileIndex + 1 & " (" & sViewPath & ")" - - sOldExtension = GetFileNameExtension(sFullName, "/") - Select Case sOldExtension - Case "vor", "dot", "xlt", "pot" - OpenProperties(1).Value = False - Case Else - OpenProperties(1).Value = False - End Select +' sOldExtension = GetFileNameExtension(sFullName, "/") +' Select Case sOldExtension +' Case "vor", "dot", "xlt", "pot" +' OpenProperties(1).Value = False +' Case Else +' OpenProperties(1).Value = False +' End Select oDocument = StarDesktop.LoadComponentFromURL(sFullName, "_blank", 0, OpenProperties()) + bIsPassWordProtected = CheckPassWordProtection(oDocument) + bContainsBasicMacro = CheckIfMacroExists(oDocument) If bSetFonts Then CheckScripts(oDocument, 1) End If @@ -181,10 +192,14 @@ Dim sOldExtension as String End Select End If If bDoSave Then - InsertDocNamesToLogDocument(sFullName, TargetFile) + InsertDocNamesToLogDocument(sFullName, TargetFile, bContainsBasicMacro) On Local Error Resume Next FileProperties(0).Name = "FilterName" FileProperties(0).Value = CurFilterName + If bIsPassWordProtected Then + FileProperties(1).Name = "PassWord" + FileProperties(1).Value = sCurPassWord + End If oDocument.StoreAsUrl(TargetFile,FileProperties()) FileCount = FileCount + 1 oDocument.Dispose() @@ -194,6 +209,10 @@ Dim sOldExtension as String Next i End If AddLogStatistics(FileCount) + oLogDocument.Dispose() + If (ImportDialog.chkLogfile.State = 1) And (FileCount > 0) Then + ImportDialog.cmdShowLogFile.Enabled = True + End If ImportDialog.cmdCancel.Label = sCloseButton ImportDialog.cmdGoOn.Label = sReady ImportDialog.cmdGoOn.Enabled = True @@ -204,6 +223,7 @@ RTError: End Sub + Sub AddListtoFilesList(FirstList(), SecList(), ApplIndex as Integer) Dim FirstStart as Integer, FirstEnd as Integer, i as Integer, s as Integer If FirstList(0,0) = "" Then @@ -294,23 +314,25 @@ End Function Sub CreateLogDocument(HiddenProperties()) +Dim OpenProperties(0) as new com.sun.star.beans.PropertyValue Dim oTableCursor as Object Dim oLogCursor as Object Dim oLogRows as Object -Dim sLogUrl as String Dim NoArgs() Dim i as Integer Dim bLogExists as Boolean If ImportDialog.chkLogfile.State = 1 Then i = 2 - oLogDocument = StarDesktop.LoadComponentFromURL("private:factory/swriter", "_blank", 4, NoArgs())' HiddenProperties()) ' HiddenProperties()) + OpenProperties(0).Name = "Hidden" + OpenProperties(0).Value = True + oLogDocument = StarDesktop.LoadComponentFromURL("private:factory/swriter", "_blank", 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 = oLogTable.GetCellbyPosition(0,0).createTextCursor() oLogCursor.SetString(sSourceDocuments) - oLogCursor = oLogTable.GetCellbyPosition(1,0).createTextCursor + oLogCursor = oLogTable.GetCellbyPosition(1,0).createTextCursor() oLogCursor.SetString(sTargetDocuments) bInsertRow = False sLogUrl = SOWorkPath & "/Logfile.sxw" @@ -330,13 +352,14 @@ Dim bLogExists as Boolean End Sub -Sub InsertDocNamesToLogDocument(SourceUrl as String, TargetUrl as String) +Sub InsertDocNamesToLogDocument(SourceUrl as String, TargetUrl as String, bContainsBasicMacro as Boolean) 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 +Dim oCommentCursor as Object If ImportDialog.chkLogfile.State = 1 Then If bInsertRow Then oLogTable.Rows.InsertByIndex(oLogTable.Rows.Count,1) @@ -347,8 +370,14 @@ Dim i as Integer UrlList(1) = TargetUrl For i = 0 To 1 oCell = oLogTable.GetCellbyPosition(i,oLogTable.Rows.Count-1) - oLogCursor = oCell.createTextCursor() + 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 LocUrl = UrlList(i) + oLogCursor = oCell.createTextCursor() + oLogCursor.CollapseToStart() oLogCursor.HyperLinkURL = LocUrl oLogCursor.HyperLinkName = LocUrl oLogCursor.HyperLinkTarget = LocUrl @@ -372,10 +401,63 @@ Dim oTableCursor as Object oCell = oLogTable.GetCellbyPosition(0, MaxRowIndex) oLogCursor = oCell.createTextCursor() oCell.InsertString(oLogCursor, sLogSummary,False) - oTableCursor = oLogTable.createCursorByCellName("A1") - oTableCursor.goDown(MaxRowIndex, false) + oTableCursor = oLogTable.createCursorByCellName(oCell.CellName) oTableCursor.goRight(1, True) oTableCursor.mergeRange() oLogDocument.Store() End If +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 +' document +Function CheckIfMacroExists(oDocument as Object) as Boolean +Dim ModuleNames() as String +Dim MaxIndex as Integer +Dim oLibraryContainer as Object +' oLibraryContainer = oDocument.LibraryContainer +' If oLibraryContainer.hasElements Then +' ModuleNames = oDocument.LibraryContainer.ElementNames +' MaxIndex = Ubound(ModuleNames()) +' For i = 0 To MaxIndex +' oLibrary = oLibraryContainer.getByName(ModuleNames(i)) +' If Not IsNull(oLibrary.getDialogContainer) Then +' CheckIf MacroExists = True +' Exit Function +' End If +' If oLibrary.ModuleContainer.HasElements Then +' CheckIfMacroExists() = True +' Exit Function +' End If +' Next i +' End If + CheckIfMacroExists() = False +End Function + + + +Function CheckPassWordProtection(oDocument as Object) +Dim bIsPassWordProtected as Boolean +Dim i as Integer +Dim oArgs() +Dim MaxIndex as Integer + bIsPassWordProtected = false + oArgs() = oDocument.getArgs() + MaxIndex = Ubound(oArgs()) + For i = 0 To MaxIndex + If oArgs(i).Name = "PassWord" Then + bIsPassWordProtected = True + sCurPassWord = oArgs(i).Value + Exit For + End If + Next i + CheckPassWordProtection() = bIsPassWordProtected +End Function + + +Sub OpenLogDocument() +Dim NoArgs() as New com.sun.star.beans.PropertyValue + OpenDocument(sLogUrl, NoArgs()) End Sub</script:module>
\ No newline at end of file diff --git a/wizards/source/importwizard/ImportDialog.xdl b/wizards/source/importwizard/ImportDialog.xdl index d8a430882..723f1f8a3 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:title="ImportDialog" dlg:left="96" dlg:top="28" dlg:width="270" dlg:height="210" dlg:page="1" dlg:help-url="HID:34570"> +<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: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"> @@ -84,10 +84,13 @@ </dlg:checkbox> <dlg:checkbox dlg:id="chkTemplateSearchSubDir" dlg:tab-index="38" dlg:left="12" dlg:top="61" dlg:width="240" dlg:height="10" dlg:page="2" dlg:help-url="HID:34582" dlg:value="chkTemplateSearchSubDir" dlg:checked="false"/> <dlg:text dlg:id="lblTemplateImport" dlg:tab-index="39" dlg:left="12" dlg:top="78" dlg:width="60" dlg:height="8" dlg:page="2" dlg:value="lblTemplateImport"/> - <dlg:checkbox dlg:id="chkLogfile" dlg:tab-index="40" dlg:left="6" dlg:top="171" dlg:width="136" dlg:height="9" dlg:page="1" dlg:help-url="HID:34577" dlg:value="chkLogfile" dlg:checked="false"/> + <dlg:checkbox dlg:id="chkLogfile" dlg:tab-index="40" dlg:left="6" dlg:top="171" dlg:width="136" dlg:height="9" dlg:page="1" dlg:help-url="HID:34577" dlg:value="chkLogfile" dlg:checked="true"/> <dlg:fixedline dlg:id="hlnTemplates" dlg:tab-index="41" dlg:left="6" dlg:top="37" dlg:width="258" dlg:height="8" dlg:page="2" dlg:value="hlnTemplates"/> <dlg:fixedline dlg:id="hlnDocuments" dlg:tab-index="42" dlg:left="6" dlg:top="110" dlg:width="258" dlg:height="8" dlg:page="2" dlg:value="hlnDocuments"/> <dlg:fixedline dlg:id="FixedLine1" dlg:tab-index="43" dlg:left="6" dlg:top="181" dlg:width="258" dlg:height="6"/> <dlg:fixedline dlg:id="hlnProgress" dlg:tab-index="44" dlg:left="6" dlg:top="55" dlg:width="258" dlg:height="8" dlg:page="4" dlg:value="hlnProgress"/> + <dlg:button dlg:id="cmdShowLogFile" dlg:tab-index="45" dlg:disabled="true" dlg:left="105" dlg:top="140" dlg:width="60" dlg:height="14" dlg:page="4" dlg:value="cmdShowLogFile"> + <script:event script:event-name="on-performaction" script:location="application" script:macro-name="ImportWizard.FilesModul.OpenLogDocument" script:language="StarBasic"/> + </dlg:button> </dlg:bulletinboard> </dlg:window>
\ No newline at end of file diff --git a/wizards/source/importwizard/Language.xba b/wizards/source/importwizard/Language.xba index 99ad52079..83c2a3be3 100644 --- a/wizards/source/importwizard/Language.xba +++ b/wizards/source/importwizard/Language.xba @@ -40,6 +40,7 @@ Public sSumMSDocuments(3) as String Public sSumMSTemplates(3) as String Public ModuleList(3) as String Public sLogSummary as String +Public sReeditMacro as String Sub LoadLanguage() If InitResources("ImportWizard","imp") then @@ -93,6 +94,7 @@ Sub LoadLanguage() sRTErrorHeader = GetResText(1058) sPathDialogMessage = GetResText(1080) sTitle = GetResText(1081) + sReeditMacro = "Dokumentenmakro muss überarbeitet werden" sProgressPage_1 = GetResText(1090) sProgressPage_2 = GetResText(1091) @@ -122,6 +124,7 @@ Sub LoadLanguage() .lblTemplateExport.Label = sExportLabel .chkLogfile.Label = GetResText(2032) .chkLogfile.Helptext = GetResText(2033) + .cmdShowLogFile.Label = "Logdatei anzeigen" End With ModuleList(0) = "com.sun.star.text.TextDocument" ModuleList(1) = "com.sun.star.sheet.SpreadsheetDocument" diff --git a/wizards/source/importwizard/Main.xba b/wizards/source/importwizard/Main.xba index 5867f8fbb..9693b33a5 100644 --- a/wizards/source/importwizard/Main.xba +++ b/wizards/source/importwizard/Main.xba @@ -57,7 +57,8 @@ RTError: End Sub -Sub NextStep + +Sub NextStep() Dim iCurStep as Integer If Not bDebugWizard Then On Error Goto RTError @@ -89,7 +90,11 @@ Dim iCurStep as Integer Case 4 CancelTask(True) End Select - ImportDialog.cmdGoOn.DefaultButton = True + + If ((ImportDialog.chkLogfile.State <> 1) OR (iCurStep <> 3)) Then + ImportDialog.cmdGoOn.DefaultButton = True + End If + RepaintHeaderPreview() Exit Sub RTError: @@ -97,6 +102,7 @@ RTError: End Sub + Sub PrevStep() Dim iCurStep as Integer If Not bDebugWizard Then @@ -119,7 +125,9 @@ Dim iCurStep as Integer FillStep_Welcome() bDoKeepApplValues = True End If + End Select + ImportDialog.cmdGoOn.DefaultButton = True RepaintHeaderPreview() Exit Sub @@ -145,7 +153,7 @@ Sub CancelTask(bCloseDialog as Boolean) ImportDialog.cmdCancel.Enabled = True End If Else - ImportDialogArea.EndExecute() + ImportDialogArea.EndExecute() End If End Sub |