summaryrefslogtreecommitdiff
path: root/wizards/source/importwizard
diff options
context:
space:
mode:
authorBehrend Cornelius <bc@openoffice.org>2002-07-15 14:42:29 +0000
committerBehrend Cornelius <bc@openoffice.org>2002-07-15 14:42:29 +0000
commit32fcfe109268724f6753ffb5c734a5d579571027 (patch)
treea3bcf3a3afe0a6a8b9991eeb9d033350e2b93b9c /wizards/source/importwizard
parent1cebcbe49e422bf091235dfda2c5682b36040242 (diff)
#100060# Password now also taken over
Diffstat (limited to 'wizards/source/importwizard')
-rw-r--r--wizards/source/importwizard/DialogModul.xba8
-rw-r--r--wizards/source/importwizard/FilesModul.xba122
-rw-r--r--wizards/source/importwizard/ImportDialog.xdl7
-rw-r--r--wizards/source/importwizard/Language.xba3
-rw-r--r--wizards/source/importwizard/Main.xba14
5 files changed, 127 insertions, 27 deletions
diff --git a/wizards/source/importwizard/DialogModul.xba b/wizards/source/importwizard/DialogModul.xba
index e539043d97c1..308532d18c42 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 = &quot;&quot;
.Step = 4
End With
+ ImportDialogArea.GetControl(&quot;LabelRetrieval&quot;).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 69841e7fff0b..1f207aa9ea6e 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
+&apos;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 = &quot;Hidden&quot;
OpenProperties(0).Value = True
OpenProperties(1).Name = &quot;AsTemplate&quot;
+ OpenProperties(1).Name = False
+ OpenProperties(2).Name = &quot;Silent&quot;
+ 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) &amp; &quot;/&quot; &amp; MaxFileIndex + 1 &amp; &quot; (&quot; &amp; sViewPath &amp; &quot;)&quot;
-
- sOldExtension = GetFileNameExtension(sFullName, &quot;/&quot;)
- Select Case sOldExtension
- Case &quot;vor&quot;, &quot;dot&quot;, &quot;xlt&quot;, &quot;pot&quot;
- OpenProperties(1).Value = False
- Case Else
- OpenProperties(1).Value = False
- End Select
+&apos; sOldExtension = GetFileNameExtension(sFullName, &quot;/&quot;)
+&apos; Select Case sOldExtension
+&apos; Case &quot;vor&quot;, &quot;dot&quot;, &quot;xlt&quot;, &quot;pot&quot;
+&apos; OpenProperties(1).Value = False
+&apos; Case Else
+&apos; OpenProperties(1).Value = False
+&apos; End Select
oDocument = StarDesktop.LoadComponentFromURL(sFullName, &quot;_blank&quot;, 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 = &quot;FilterName&quot;
FileProperties(0).Value = CurFilterName
+ If bIsPassWordProtected Then
+ FileProperties(1).Name = &quot;PassWord&quot;
+ 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 &gt; 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) = &quot;&quot; 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(&quot;private:factory/swriter&quot;, &quot;_blank&quot;, 4, NoArgs())&apos; HiddenProperties()) &apos; HiddenProperties())
+ OpenProperties(0).Name = &quot;Hidden&quot;
+ OpenProperties(0).Value = True
+ oLogDocument = StarDesktop.LoadComponentFromURL(&quot;private:factory/swriter&quot;, &quot;_blank&quot;, 4, OpenProperties())
oLogCursor = oLogDocument.Text.CreateTextCursor
oLogTable = oLogDocument.CreateInstance(&quot;com.sun.star.text.TextTable&quot;)
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 &amp; &quot;/Logfile.sxw&quot;
@@ -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(&quot;A1&quot;)
- oTableCursor.goDown(MaxRowIndex, false)
+ oTableCursor = oLogTable.createCursorByCellName(oCell.CellName)
oTableCursor.goRight(1, True)
oTableCursor.mergeRange()
oLogDocument.Store()
End If
+End Sub
+
+
+&apos; This macro has to be reworked out again as it works with deprecated interfaces
+&apos; It can be completed as soon as Bug #93295 will be fixed because right now it
+&apos; is not possible to access BasicLibraries and DialogLibraries from outside the
+&apos; document
+Function CheckIfMacroExists(oDocument as Object) as Boolean
+Dim ModuleNames() as String
+Dim MaxIndex as Integer
+Dim oLibraryContainer as Object
+&apos; oLibraryContainer = oDocument.LibraryContainer
+&apos; If oLibraryContainer.hasElements Then
+&apos; ModuleNames = oDocument.LibraryContainer.ElementNames
+&apos; MaxIndex = Ubound(ModuleNames())
+&apos; For i = 0 To MaxIndex
+&apos; oLibrary = oLibraryContainer.getByName(ModuleNames(i))
+&apos; If Not IsNull(oLibrary.getDialogContainer) Then
+&apos; CheckIf MacroExists = True
+&apos; Exit Function
+&apos; End If
+&apos; If oLibrary.ModuleContainer.HasElements Then
+&apos; CheckIfMacroExists() = True
+&apos; Exit Function
+&apos; End If
+&apos; Next i
+&apos; 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 = &quot;PassWord&quot; 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 d8a430882f4e..723f1f8a3e5c 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 99ad52079109..83c2a3be3f0e 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(&quot;ImportWizard&quot;,&quot;imp&quot;) then
@@ -93,6 +94,7 @@ Sub LoadLanguage()
sRTErrorHeader = GetResText(1058)
sPathDialogMessage = GetResText(1080)
sTitle = GetResText(1081)
+ sReeditMacro = &quot;Dokumentenmakro muss überarbeitet werden&quot;
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 = &quot;Logdatei anzeigen&quot;
End With
ModuleList(0) = &quot;com.sun.star.text.TextDocument&quot;
ModuleList(1) = &quot;com.sun.star.sheet.SpreadsheetDocument&quot;
diff --git a/wizards/source/importwizard/Main.xba b/wizards/source/importwizard/Main.xba
index 5867f8fbbed8..9693b33a5821 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 &lt;&gt; 1) OR (iCurStep &lt;&gt; 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