summaryrefslogtreecommitdiff
path: root/wizards/source/importwizard/FilesModul.xba
diff options
context:
space:
mode:
Diffstat (limited to 'wizards/source/importwizard/FilesModul.xba')
-rw-r--r--wizards/source/importwizard/FilesModul.xba168
1 files changed, 90 insertions, 78 deletions
diff --git a/wizards/source/importwizard/FilesModul.xba b/wizards/source/importwizard/FilesModul.xba
index 483c89947ed6..b6e36144e993 100644
--- a/wizards/source/importwizard/FilesModul.xba
+++ b/wizards/source/importwizard/FilesModul.xba
@@ -8,7 +8,6 @@ Public oLogDocument as Object
Public oLogTable as Object
-
Function ReadApplicationDirectories(ApplIndex as Integer, FilesList(),bIsDocument as Boolean, sFiltername()) as Integer
Dim bCheckDocuType as Boolean
Dim FilterIndex as Integer
@@ -50,8 +49,8 @@ Dim sLocExtension as String
NewList() = ReadDirectories(sSourceDir, bRecursive, bCheckRealType, False, sFileContent(), sLocExtension)
If Ubound(NewList()) > -1 Then
AddListtoList(FilesList(), NewList(), ApplIndex)
+ ImportDialog.LabelRetrieval.Label = sProgressPage_2 & " " & ReplaceString(sProgressPage_5, Str(Ubound(FilesList()) + 1) & " ", "%1")
End If
- LabelRetrieval.Caption = sProgressPage_2 & " " & ReplaceString(sProgressPage_5, Str(Ubound(FilesList()) + 1) & " ", "%1")
End If
ReadApplicationDirectories() = Ubound(NewList(),1) + 1
End Function
@@ -69,7 +68,7 @@ End Sub
Sub ConvertAllDocuments(sFilterName())
-Dim FileProperties(0) as new com.sun.star.beans.PropertyValue
+Dim FileProperties() as new com.sun.star.beans.PropertyValue
Dim OpenProperties(0) as new com.sun.star.beans.PropertyValue
Dim FilesList(0,2) as String
Dim sViewPath as String
@@ -81,6 +80,7 @@ Dim oDocument as Object
Dim sExtension as String
Dim OldExtension as String
Dim CurFound as Integer
+Dim TotFound as Integer
Dim TargetStemDir as String
Dim SourceStemDir as String
Dim TargetDir as String
@@ -97,6 +97,7 @@ Dim oTask as Object
Dim oModel as Object
Dim oTaskController as Object
Dim MaxFileIndex as Integer
+
AbsTemplateFound = 0
AbsDocuFound = 0
For i = 0 To ApplCount-1
@@ -112,87 +113,98 @@ Dim MaxFileIndex as Integer
CurFound = ReadApplicationDirectories(i, FilesList(), bIsDocument, sFilterName())
ShowCurrentProgress(bIsDocument, CurFound)
Next i
- InitializeProgressPage(ImportDialog)
- OpenProperties(0).Name = "Hidden"
- OpenProperties(0).Value = True
- MaxFileIndex = Ubound(FilesList(),1)
- For i = 0 To MaxFileIndex
- bDoSave = True
- If bCancelTask Then
- Call CancelTask()
- End if
+ TotFound = AbsTemplateFound + AbsDocuFound
+ If TotFound > 0 Then
+ bCallCancelMsg = True
+ InitializeProgressPage(ImportDialog)
+ OpenProperties(0).Name = "Hidden"
+ OpenProperties(0).Value = True
+ MaxFileIndex = Ubound(FilesList(),1)
+ For i = 0 To MaxFileIndex
+ bDoSave = True
+ If bCancelTask Then
+ Call CancelTask()
+ 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)
+ 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 Not IsNull(oDocument) Then
- Select Case sExtension
- Case "sxw", "sxc", "sxi", "sxd", "sxs", "mml"
- SourceStemDir = RTrimStr(Applications(ApplIndex,SBDOCSOURCE), "/")
- TargetStemDir = RTrimStr(Applications(ApplIndex,SBDOCTARGET), "/")
- Case Else ' Templates and Helper-Applications remain
- SourceStemDir = RTrimStr(Applications(ApplIndex,SBTEMPLSOURCE), "/")
- TargetStemDir = RTrimStr(Applications(ApplIndex,SBTEMPLTARGET), "/")
- End Select
+ If Not IsNull(oDocument) Then
+ Select Case sExtension
+ Case "sxw", "sxc", "sxi", "sxd", "sxs", "mml"
+ SourceStemDir = RTrimStr(Applications(ApplIndex,SBDOCSOURCE), "/")
+ TargetStemDir = RTrimStr(Applications(ApplIndex,SBDOCTARGET), "/")
+ Case Else ' Templates and Helper-Applications remain
+ SourceStemDir = RTrimStr(Applications(ApplIndex,SBTEMPLSOURCE), "/")
+ TargetStemDir = RTrimStr(Applications(ApplIndex,SBTEMPLTARGET), "/")
+ End Select
- TargetFile = ReplaceString(sFullname, TargetStemDir, SourceStemDir)
- sFileName = GetFileNameWithoutExtension(TargetFile, "/")
- OldExtension = GetFileNameExtension(TargetFile)
+ TargetFile = ReplaceString(sFullname, TargetStemDir, SourceStemDir)
+ sFileName = GetFileNameWithoutExtension(TargetFile, "/")
+ OldExtension = GetFileNameExtension(TargetFile)
- TargetFile = RTrimStr(TargetFile, OldExtension)
- TargetFile = TargetFile & sExtension
- TargetDir = RTrimStr(TargetFile, sFileName & "." & sExtension)
- If Not oUcb.Exists(TargetDir) Then
- oUcb.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
- Call CancelTask()
- Case 7 ' No
- bDoSave = False
- End Select
- End If
- If bDoSave Then
- InsertDocNamesToLogDocument(i+1, sFullName, TargetFile
- On Local Error Resume Next
- FileProperties(0).Name = "FilterName"
- FileProperties(0).Value = CurFilterName
- oDocument.StoreToUrl(TargetFile,FileProperties())
- oDocument.Dispose()
- On Local Error Goto 0
- End If
- oTaskenum = StarDesktop.Tasks.CreateEnumeration
-' While oTaskEnum.HasmoreElements
-' oTask = oTaskenum.NextElement
-' If oTask.Name <> "" Then
-' oTaskController = oTask.Controller
-' PrintdbgInfo oTaskController
-' If hasUnoInterfaces(oTaskController,"com.sun.star.frame.XModel") then
-' oModel = oTaskController.Model
-' If Ucase(oModel.Url) = Ucase(sFullName) Then
-' oTask.Close
+ TargetFile = RTrimStr(TargetFile, OldExtension)
+ TargetFile = TargetFile & sExtension
+ TargetDir = RTrimStr(TargetFile, sFileName & "." & sExtension)
+ If Not oUcb.Exists(TargetDir) Then
+ oUcb.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
+ bCallCancelMsg = False
+ Exit For
+' Call CancelTask()
+ Case 7 ' No
+ bDoSave = False
+ End Select
+ End If
+ If bDoSave Then
+ InsertDocNamesToLogDocument(i+1, sFullName, TargetFile
+ On Local Error Resume Next
+' Note: Files are automatically stored in Default format
+' FileProperties(0).Name = "FilterName"
+' FileProperties(0).Value = CurFilterName
+ oDocument.StoreToUrl(TargetFile,FileProperties())
+ oDocument.Dispose()
+ On Local Error Goto 0
+ End If
+' oTaskenum = StarDesktop.Tasks.CreateEnumeration
+' While oTaskEnum.HasmoreElements
+' oTask = oTaskenum.NextElement
+' If oTask.Name <> "" Then
+' oTaskController = oTask.Controller
+' PrintdbgInfo oTaskController
+' If hasUnoInterfaces(oTaskController,"com.sun.star.frame.XModel") then
+' oModel = oTaskController.Model
+' If Ucase(oModel.Url) = Ucase(sFullName) Then
+' oTask.Close
+' End If
' End If
' End If
-' End If
-' Wend
- End If
- Next i
- ImportDialog.cbCancel.Label = sCloseButton
+' Wend
+ End If
+ Next i
+ ImportDialog.cbCancel.Label = sCloseButton
+ Msgbox sReady, 64, sTitle
+ bCallCancelMsg = False
+ End If
' oLogDocument.Dispose()
- Msgbox sReady, 64, sTitle
' ImportDialogArea.endExecute
' ImportDialogArea.Dispose
End