summaryrefslogtreecommitdiff
path: root/wizards
diff options
context:
space:
mode:
authorBehrend Cornelius <bc@openoffice.org>2001-06-21 13:14:32 +0000
committerBehrend Cornelius <bc@openoffice.org>2001-06-21 13:14:32 +0000
commit9a8be587090efc901c43108091dcaa72007eba38 (patch)
tree05345b7b0c2a1811e3c6660a0f4af9a6ae3a19ab /wizards
parent61b02265ef9aad63a72278bb9dfa9aca93cfb5fe (diff)
#88615# New Filepicker Service and new Formula Filter
Diffstat (limited to 'wizards')
-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) = &quot;sdc&quot;
XMLFilterName(1,1) = &quot;scalc: StarOffice XML (Calc)&quot;
XMLFilterName(1,2) = &quot;sxc&quot;
-
+&apos; Todo: Gepacktes &apos;sdp&apos; Format ber├╝cksichtigen
XMLFilterName(2,0) = &quot;sdd|sda&quot;
XMLFilterName(2,1) = &quot;simpress: StarOffice XML (Impress)|sdraw: StarOffice XML (Draw)&quot;
XMLFilterName(2,2) = &quot;sxi|sxd&quot;
XMLFilterName(3,0) = &quot;smf&quot;
- XMLFilterName(3,1) = &quot;smath: MathML XML (Math)&quot;
- XMLFilterName(3,2) = &quot;mml&quot;
+ XMLFilterName(3,1) = &quot;smath: StarOffice XML (Math)&quot;
+ XMLFilterName(3,2) = &quot;sxm&quot;
- XMLFilterName(4,0) = &quot;application/vnd.stardivision.writer;application/x-starwriter&quot;
+ XMLFilterName(4,0) = &quot;application/vnd.stardivision.writer;application/vnd.stardivision.writer/web;application/x-starwriter&quot;
XMLFilterName(4,1) = &quot;swriter: writer_StarOffice_XML_Writer_Template&quot;
XMLFilterName(4,2) = &quot;stw&quot;
@@ -402,7 +402,6 @@ Sub SetupXMLConfiguration()
XMLFilterName(6,1) = &quot;simpress: impress_StarOffice_XML_Impress_Template|draw_StarOffice_XML_Draw_Template&quot;
XMLFilterName(6,2) = &quot;sti|std&quot;
-&apos; ToDo: define Filter for Masterdocument
XMLFilterName(7,0) = &quot;sgl&quot;
XMLFilterName(7,1) = &quot;swriter: writer_globaldocument_StarOffice_XML_Writer_GlobalDocument&quot;
XMLFilterName(7,2) = &quot;sxg&quot;
@@ -508,7 +507,7 @@ Dim sPath as String
Dim InitPath as String
Dim RefControlName as String
Dim oRefControl
- oFolderDialog = CreateUnoService(&quot;com.sun.star.ui.FolderPicker&quot;)
+ oFolderDialog = CreateUnoService(&quot;com.sun.star.ui.dialogs.FolderPicker&quot;)
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()) &gt; -1 Then
AddListtoList(FilesList(), NewList(), ApplIndex)
+ ImportDialog.LabelRetrieval.Label = sProgressPage_2 &amp; &quot; &quot; &amp; ReplaceString(sProgressPage_5, Str(Ubound(FilesList()) + 1) &amp; &quot; &quot;, &quot;%1&quot;)
End If
- LabelRetrieval.Caption = sProgressPage_2 &amp; &quot; &quot; &amp; ReplaceString(sProgressPage_5, Str(Ubound(FilesList()) + 1) &amp; &quot; &quot;, &quot;%1&quot;)
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 = &quot;Hidden&quot;
- 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 &gt; 0 Then
+ bCallCancelMsg = True
+ InitializeProgressPage(ImportDialog)
+ OpenProperties(0).Name = &quot;Hidden&quot;
+ 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) &amp; &quot;/&quot; &amp; MaxFileIndex + 1 &amp; &quot; (&quot; &amp; sViewPath &amp; &quot;)&quot;
+ If i = 0 Then
+ CreateLogDocument(OpenProperties())
+ End If
+ oDocument = StarDesktop.LoadComponentFromURL(sFullName, &quot;_blank&quot;, 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) &amp; &quot;/&quot; &amp; MaxFileIndex + 1 &amp; &quot; (&quot; &amp; sViewPath &amp; &quot;)&quot;
- If i = 0 Then
- CreateLogDocument(OpenProperties())
- End If
- oDocument = StarDesktop.LoadComponentFromURL(sFullName, &quot;_blank&quot;, 0, OpenProperties())
- If Not IsNull(oDocument) Then
- Select Case sExtension
- Case &quot;sxw&quot;, &quot;sxc&quot;, &quot;sxi&quot;, &quot;sxd&quot;, &quot;sxs&quot;, &quot;mml&quot;
- SourceStemDir = RTrimStr(Applications(ApplIndex,SBDOCSOURCE), &quot;/&quot;)
- TargetStemDir = RTrimStr(Applications(ApplIndex,SBDOCTARGET), &quot;/&quot;)
- Case Else &apos; Templates and Helper-Applications remain
- SourceStemDir = RTrimStr(Applications(ApplIndex,SBTEMPLSOURCE), &quot;/&quot;)
- TargetStemDir = RTrimStr(Applications(ApplIndex,SBTEMPLTARGET), &quot;/&quot;)
- End Select
+ If Not IsNull(oDocument) Then
+ Select Case sExtension
+ Case &quot;sxw&quot;, &quot;sxc&quot;, &quot;sxi&quot;, &quot;sxd&quot;, &quot;sxs&quot;, &quot;mml&quot;
+ SourceStemDir = RTrimStr(Applications(ApplIndex,SBDOCSOURCE), &quot;/&quot;)
+ TargetStemDir = RTrimStr(Applications(ApplIndex,SBDOCTARGET), &quot;/&quot;)
+ Case Else &apos; Templates and Helper-Applications remain
+ SourceStemDir = RTrimStr(Applications(ApplIndex,SBTEMPLSOURCE), &quot;/&quot;)
+ TargetStemDir = RTrimStr(Applications(ApplIndex,SBTEMPLTARGET), &quot;/&quot;)
+ End Select
- TargetFile = ReplaceString(sFullname, TargetStemDir, SourceStemDir)
- sFileName = GetFileNameWithoutExtension(TargetFile, &quot;/&quot;)
- OldExtension = GetFileNameExtension(TargetFile)
+ TargetFile = ReplaceString(sFullname, TargetStemDir, SourceStemDir)
+ sFileName = GetFileNameWithoutExtension(TargetFile, &quot;/&quot;)
+ OldExtension = GetFileNameExtension(TargetFile)
- TargetFile = RTrimStr(TargetFile, OldExtension)
- TargetFile = TargetFile &amp; sExtension
- TargetDir = RTrimStr(TargetFile, sFileName &amp; &quot;.&quot; &amp; sExtension)
- If Not oUcb.Exists(TargetDir) Then
- oUcb.CreateFolder(TargetDir)
- End If
- If oUcb.Exists(TargetFile) Then
- sCurFileExists = ReplaceString(sFileExists, ConvertFromUrl(TargetFile), &quot;&lt;1&gt;&quot;)
- sCurFileExists = ReplaceString(sCurFileExists, chr(13), &quot;&lt;CR&gt;&quot;)
- iOverWrite = Msgbox (sCurFileExists, 32 + 3, sTitle)
- Select Case iOverWrite
- Case 1 &apos; OK
- &apos; In the FileProperty-Bean this is already default
- bDoSave = True
- Case 2 &apos; Abort
- Call CancelTask()
- Case 7 &apos; No
- bDoSave = False
- End Select
- End If
- If bDoSave Then
- InsertDocNamesToLogDocument(i+1, sFullName, TargetFile
- On Local Error Resume Next
- FileProperties(0).Name = &quot;FilterName&quot;
- FileProperties(0).Value = CurFilterName
- oDocument.StoreToUrl(TargetFile,FileProperties())
- oDocument.Dispose()
- On Local Error Goto 0
- End If
- oTaskenum = StarDesktop.Tasks.CreateEnumeration
-&apos; While oTaskEnum.HasmoreElements
-&apos; oTask = oTaskenum.NextElement
-&apos; If oTask.Name &lt;&gt; &quot;&quot; Then
-&apos; oTaskController = oTask.Controller
-&apos; PrintdbgInfo oTaskController
-&apos; If hasUnoInterfaces(oTaskController,&quot;com.sun.star.frame.XModel&quot;) then
-&apos; oModel = oTaskController.Model
-&apos; If Ucase(oModel.Url) = Ucase(sFullName) Then
-&apos; oTask.Close
+ TargetFile = RTrimStr(TargetFile, OldExtension)
+ TargetFile = TargetFile &amp; sExtension
+ TargetDir = RTrimStr(TargetFile, sFileName &amp; &quot;.&quot; &amp; sExtension)
+ If Not oUcb.Exists(TargetDir) Then
+ oUcb.CreateFolder(TargetDir)
+ End If
+ If oUcb.Exists(TargetFile) Then
+ sCurFileExists = ReplaceString(sFileExists, ConvertFromUrl(TargetFile), &quot;&lt;1&gt;&quot;)
+ sCurFileExists = ReplaceString(sCurFileExists, chr(13), &quot;&lt;CR&gt;&quot;)
+ iOverWrite = Msgbox (sCurFileExists, 32 + 3, sTitle)
+ Select Case iOverWrite
+ Case 1 &apos; OK
+ &apos; In the FileProperty-Bean this is already default
+ bDoSave = True
+ Case 2 &apos; Abort
+ bCallCancelMsg = False
+ Exit For
+&apos; Call CancelTask()
+ Case 7 &apos; No
+ bDoSave = False
+ End Select
+ End If
+ If bDoSave Then
+ InsertDocNamesToLogDocument(i+1, sFullName, TargetFile
+ On Local Error Resume Next
+&apos; Note: Files are automatically stored in Default format
+&apos; FileProperties(0).Name = &quot;FilterName&quot;
+&apos; FileProperties(0).Value = CurFilterName
+ oDocument.StoreToUrl(TargetFile,FileProperties())
+ oDocument.Dispose()
+ On Local Error Goto 0
+ End If
+&apos; oTaskenum = StarDesktop.Tasks.CreateEnumeration
+&apos; While oTaskEnum.HasmoreElements
+&apos; oTask = oTaskenum.NextElement
+&apos; If oTask.Name &lt;&gt; &quot;&quot; Then
+&apos; oTaskController = oTask.Controller
+&apos; PrintdbgInfo oTaskController
+&apos; If hasUnoInterfaces(oTaskController,&quot;com.sun.star.frame.XModel&quot;) then
+&apos; oModel = oTaskController.Model
+&apos; If Ucase(oModel.Url) = Ucase(sFullName) Then
+&apos; oTask.Close
+&apos; End If
&apos; End If
&apos; End If
-&apos; End If
-&apos; Wend
- End If
- Next i
- ImportDialog.cbCancel.Label = sCloseButton
+&apos; Wend
+ End If
+ Next i
+ ImportDialog.cbCancel.Label = sCloseButton
+ Msgbox sReady, 64, sTitle
+ bCallCancelMsg = False
+ End If
&apos; oLogDocument.Dispose()
- Msgbox sReady, 64, sTitle
&apos; ImportDialogArea.endExecute
&apos; 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 @@
&apos; ***** BASIC *****
&apos; Todo: Problematik der VBA-Makros, die angeblich nicht mit abgespeichert werden koennen.
&apos; Evt. Erkennen der Arbeitsverzeichnisse von MS Office
-&apos; Filternamen fuer Ziel-XML-Dokumente und deren Extensionen feststellen (auch fuer StarMath)
-&apos; Extension fuer XML-Vorlagen klaeren
Public HeaderPreviews(4) as Object
Public ImportDialog as Object
Public ImportDialogArea as Object
+Public bSetFonts as Boolean
+&apos; If the ProgressPage ist already on Top The Dialog will be immediately closed when this flag is
+&apos; set to False
+Public bCallCancelMsg as Boolean
-Sub Main
+Sub Main()
BasicLibraries.LoadLibrary(&quot;Tools&quot;)
+ bSetFonts = False
+ If bSetFonts Then
+ BasicLibraries.LoadLibrary(&quot;Translater&quot;)
+ GetFontNames()
+ End If
sCRLF = CHR(10) &amp; CHR(13)
oUcb = createUnoService(&quot;com.sun.star.ucb.SimpleFileAccess&quot;)
If Not bDebugWizard Then
@@ -30,7 +37,7 @@ Sub Main
FillStep_Welcome()
RepaintHeaderPreview()
SetStates()
- ImportDialogArea.SetVisible(True)
+ ImportDialogArea.SetVisible(True) &apos;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
-&apos; If ImportDialog.Step = 4 Then
-&apos; Call CancelButtonPressed()
-&apos; Else
+ If bCallCancelMsg Then
+ &apos; Conversion is already running
+ ImportDialog.cbCancel.Enabled = False
+ bCancelTask = True
+ Else
ImportDialogArea.EndExecute
ImportDialogArea.Dispose()
End
-&apos; End If
+ End If
End Sub
@@ -140,11 +151,6 @@ Sub CancelTask()
End Sub
-&apos;Sub CancelButtonPressed()
-&apos; ImportDialog.cbCancel.Enabled = False
-&apos; bCancelTask = True
-&apos;End Sub
-
Sub TemplateDirSearchDialog()
CallDirSearchDialog(ImportDialog.TemplateImportPath)