summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--wizards/source/importwizard/DialogModul.xba11
-rw-r--r--wizards/source/importwizard/FilesModul.xba168
-rw-r--r--wizards/source/importwizard/Main.xba32
3 files changed, 114 insertions, 97 deletions
diff --git a/wizards/source/importwizard/DialogModul.xba b/wizards/source/importwizard/DialogModul.xba
index 429982ebff97..1edc13d39cf7 100644
--- a/wizards/source/importwizard/DialogModul.xba
+++ b/wizards/source/importwizard/DialogModul.xba
@@ -381,16 +381,16 @@ Sub SetupXMLConfiguration()
XMLFilterName(1,0) = "sdc"
XMLFilterName(1,1) = "scalc: StarOffice XML (Calc)"
XMLFilterName(1,2) = "sxc"
-
+' Todo: Gepacktes 'sdp' Format ber├╝cksichtigen
XMLFilterName(2,0) = "sdd|sda"
XMLFilterName(2,1) = "simpress: StarOffice XML (Impress)|sdraw: StarOffice XML (Draw)"
XMLFilterName(2,2) = "sxi|sxd"
XMLFilterName(3,0) = "smf"
- XMLFilterName(3,1) = "smath: MathML XML (Math)"
- XMLFilterName(3,2) = "mml"
+ XMLFilterName(3,1) = "smath: StarOffice XML (Math)"
+ XMLFilterName(3,2) = "sxm"
- XMLFilterName(4,0) = "application/vnd.stardivision.writer;application/x-starwriter"
+ XMLFilterName(4,0) = "application/vnd.stardivision.writer;application/vnd.stardivision.writer/web;application/x-starwriter"
XMLFilterName(4,1) = "swriter: writer_StarOffice_XML_Writer_Template"
XMLFilterName(4,2) = "stw"
@@ -402,7 +402,6 @@ Sub SetupXMLConfiguration()
XMLFilterName(6,1) = "simpress: impress_StarOffice_XML_Impress_Template|draw_StarOffice_XML_Draw_Template"
XMLFilterName(6,2) = "sti|std"
-' ToDo: define Filter for Masterdocument
XMLFilterName(7,0) = "sgl"
XMLFilterName(7,1) = "swriter: writer_globaldocument_StarOffice_XML_Writer_GlobalDocument"
XMLFilterName(7,2) = "sxg"
@@ -508,7 +507,7 @@ Dim sPath as String
Dim InitPath as String
Dim RefControlName as String
Dim oRefControl
- oFolderDialog = CreateUnoService("com.sun.star.ui.FolderPicker")
+ oFolderDialog = CreateUnoService("com.sun.star.ui.dialogs.FolderPicker")
RefControlName = aEvent.Source.Model.Tag
oRefControl = ImportDialogArea.GetControl(RefControlName)
InitPath = ConvertToUrl(oRefControl.Model.Text)
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
diff --git a/wizards/source/importwizard/Main.xba b/wizards/source/importwizard/Main.xba
index 6d2c93b29aec..7ba8e8b25ba7 100644
--- a/wizards/source/importwizard/Main.xba
+++ b/wizards/source/importwizard/Main.xba
@@ -5,14 +5,21 @@
' ***** BASIC *****
' Todo: Problematik der VBA-Makros, die angeblich nicht mit abgespeichert werden koennen.
' Evt. Erkennen der Arbeitsverzeichnisse von MS Office
-' Filternamen fuer Ziel-XML-Dokumente und deren Extensionen feststellen (auch fuer StarMath)
-' Extension fuer XML-Vorlagen klaeren
Public HeaderPreviews(4) as Object
Public ImportDialog as Object
Public ImportDialogArea as Object
+Public bSetFonts as Boolean
+' If the ProgressPage ist already on Top The Dialog will be immediately closed when this flag is
+' set to False
+Public bCallCancelMsg as Boolean
-Sub Main
+Sub Main()
BasicLibraries.LoadLibrary("Tools")
+ bSetFonts = False
+ If bSetFonts Then
+ BasicLibraries.LoadLibrary("Translater")
+ GetFontNames()
+ End If
sCRLF = CHR(10) & CHR(13)
oUcb = createUnoService("com.sun.star.ucb.SimpleFileAccess")
If Not bDebugWizard Then
@@ -30,7 +37,7 @@ Sub Main
FillStep_Welcome()
RepaintHeaderPreview()
SetStates()
- ImportDialogArea.SetVisible(True)
+ ImportDialogArea.SetVisible(True) 'Execute()
ImportDialog.cbGoOn.DefaultButton = True
Exit Sub
RTError:
@@ -53,6 +60,7 @@ Dim iCurStep as Integer
If Not bDebugWizard Then
On Error Goto RTError
End If
+ bCallCancelMsg = False
iCurStep = ImportDialog.Step
Select Case iCurStep
Case 1
@@ -90,6 +98,7 @@ Dim iCurStep as Integer
If Not bDebugWizard Then
On Error Goto RTError
End If
+ bCallCancelMsg = False
iCurStep = ImportDialog.Step
Select Case iCurStep
Case 4
@@ -118,13 +127,15 @@ End Sub
Sub CancelButton
-' If ImportDialog.Step = 4 Then
-' Call CancelButtonPressed()
-' Else
+ If bCallCancelMsg Then
+ ' Conversion is already running
+ ImportDialog.cbCancel.Enabled = False
+ bCancelTask = True
+ Else
ImportDialogArea.EndExecute
ImportDialogArea.Dispose()
End
-' End If
+ End If
End Sub
@@ -140,11 +151,6 @@ Sub CancelTask()
End Sub
-'Sub CancelButtonPressed()
-' ImportDialog.cbCancel.Enabled = False
-' bCancelTask = True
-'End Sub
-
Sub TemplateDirSearchDialog()
CallDirSearchDialog(ImportDialog.TemplateImportPath)