Update ooo320-m1
[ooovba.git] / wizards / source / importwizard / DialogModul.xba
blobd323ba7ed711c7d6e7e9397ddf360ce5415f6ea2
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
3 <script:module xmlns:script="http://openoffice.org/2000/script" script:name="DialogModul" script:language="StarBasic">Option Explicit
5 Public Const bDebugWizard = True
7 Public Const SBFIRSTAPPLCHECKED = 0
8 Public Const SBSECONDAPPLCHECKED = 1
9 Public Const SBTHIRDAPPLCHECKED = 2
10 Public Const SBFOURTHAPPLCHECKED = 3
11 Public bFilterTracingAvailable as Boolean
12 Public WizardMode as String
13 Public Const SBMICROSOFTMODE = &quot;MS&quot;
14 Public Const SBXMLMODE = &quot;SO&quot;
15 &apos; The absolute maximal Number of possible Applications
16 Public Const Twip = 425
17 Public Const SBMAXAPPLCOUNT = 4
18 Public MaxApplCount as Integer
19 Public CurOffice As Integer
20 Public SOBitmapPath As String
21 Public SOWorkPath As String
22 Public SOTemplatePath as String
23 Public bCancelTask As Boolean
24 Public bDoKeepApplValues as Boolean
25 Public iApplSection as Integer
26 Public oUcb as Object
27 Public PathSeparator as String
29 Public ApplCount as Integer
30 Public sKeyName(SBMAXAPPLCOUNT-1) as String
31 Public sValueName(SBMAXAPPLCOUNT-1) as String
32 Public sCRLF as String
33 Public MSFilterName(5,4) as String
34 Public XMLFilterName(7,3) as String &apos;Number of different formats
35 Public FilterTracingLogPath(2) as String
36 Public bMSApplFilterTracingAvailable(2) as String
37 Public bTakeOverTargetName(2) as Boolean
38 Public bTakeOverPathName(2) as Boolean
40 &apos; e.g.:
41 &apos; XMLFilterName(x,0) = &quot;sdw&quot; &apos; in documents we take the extensions; in SO-templates the appropriate Filtername
42 &apos; XMLFilterName(x,1) = &quot;swriter: StarWriter 5.0&quot; &apos; the filtername of the target-format
43 &apos; XMLFilterName(x,2) = &quot;sxw&quot; &apos; the target extension
45 Public Applications(SBMAXAPPLCOUNT-1,9)
47 Public Const SBAPPLCONVERT = 0
48 Public Const SBDOCCONVERT = 1
49 Public Const SBDOCRECURSIVE = 2
50 Public Const SBDOCSOURCE = 3
51 Public Const SBDOCTARGET = 4
52 Public Const SBTEMPLCONVERT = 5
53 Public Const SBTEMPLRECURSIVE = 6
54 Public Const SBTEMPLSOURCE = 7
55 Public Const SBTEMPLTARGET = 8
56 Public Const SBAPPLKEY = 9
57 Public XMLTemplateList()
59 &apos; Application-relating Data are stored in this Array
60 &apos; according to the following structure:
61 &apos; Applications(X,0) = True/False (Application is to be converted)
62 &apos; Applications(X,1) = True/False (Documents are to be converted)
63 &apos; Applications(X,2) = True/False (Including Subdirectories)
64 &apos; Applications(X,3) = &quot;File:///...&quot; (SourceUrl of the documents)
65 &apos; Applications(X,4) = &quot;File///:...&quot; (TargetUrl of the documents)
66 &apos; Applications(X,5) = True/False (Templates are to be converted)
67 &apos; Applications(X,6) = True/False (Including Subdirectories)
68 &apos; Applications(X,7) = &quot;File:///...&quot; (SourceUrl of the templates)
69 &apos; Applications(X,8) = &quot;File:///...&quot; (TargetUrl of the templates)
70 &apos; Applications(X,9) = 0 (Key to the original Index of the Applications)
72 Public Const SBMAXEXTENSIONLENGTH = 15
75 Sub FillStep_Welcome()
76 Dim i as Integer
77 &apos; bDoKeepApplValues = False
78 ImportDialogArea.Title = sTitle
79 With ImportDialog
80 .cmdHelp.Label = sHelpButton
81 .cmdCancel.Label = sCancelButton
82 .cmdBack.Label = sBackButton
83 .cmdGoOn.Label = sNextButton
84 .WelcomeTextLabel.Label = sWelcomeTextLabel1
85 .WelcomeTextLabel2.Label = sWelcomeTextLabel2
86 .WelcomeTextLabel3.Label = sWelcomeTextLabel3
88 .optMSDocuments.Label = sContainerName(0)
89 .chkMSApplication1.Label = sMsDocumentCheckbox(0)
90 .chkMSApplication2.Label = sMsDocumentCheckbox(1)
91 .chkMSApplication3.Label = sMsDocumentCheckbox(2)
93 .optSODocuments.Label = sContainerName(1)
94 .chkSOApplication1.Label = sSODocumentCheckbox(0)
95 .chkSOApplication2.Label = sSODocumentCheckbox(1)
96 .chkSOApplication3.Label = sSODocumentCheckbox(2)
97 .chkSOApplication4.Label = sSODocumentCheckbox(3)
98 .cmdBack.Enabled = False
99 .Step = 1
101 If Not oFactoryKey.hasbyName(&quot;com.sun.star.text.TextDocument&quot;) Then
102 .chkLogfile.State = 0
103 .chkLogfile.Enabled = False
104 End If
105 End With
106 CheckModuleInstallation()
107 ToggleNextButton()
108 End Sub
111 Sub FillStep_InputPaths(OfficeIndex as Integer, bStartup as Boolean)
112 Dim Index as Integer
113 Dim oNullObject as Object
114 If bStartup And Not bDoKeepApplValues Then
115 If ImportDialog.optMSDocuments.State = 1 Then
116 SetupMSConfiguration()
117 Else
118 SetupXMLConfiguration()
119 End If
120 FillUpApplicationList()
121 End If
122 CurOffice = OfficeIndex
123 Index = Applications(CurOffice,SBAPPLKEY)
124 InitializePathsforCurrentApplication(Index)
125 With ImportDialog
126 .chkTemplatePath.Label = sTemplateCheckbox(Index)
127 .chkDocumentPath.State = Abs(Applications(CurOffice,SBDOCCONVERT))
128 .chkDocumentSearchSubDir.State = Abs(Applications(CurOffice,SBDOCRECURSIVE))
129 .txtDocumentImportPath.Text = ConvertFromUrl(Applications(CurOffice,SBDOCSOURCE))
130 .txtDocumentExportPath.Text = ConvertFromUrl(Applications(CurOffice,SBDOCTARGET))
131 .hlnDocuments.Label = sProgressMoreDocs
132 If WizardMode = SBXMLMODE Then
133 ImportDialogArea.Title = sTitle &amp; &quot; - &quot; &amp; sSODocumentCheckBox(Index)
134 Else
135 ImportDialogArea.Title = sTitle &amp; &quot; - &quot; &amp; sMSDocumentCheckBox(Index)
136 End If
137 If WizardMode = SBXMLMODE AND Index = 3 Then
138 &apos; Note: SO-Helper Applications are partly treated like templates although they only have documents
139 .hlnTemplates.Label = sProgressMoreDocs
140 .chkTemplatePath.Label = sSOHelperDocuments(0,0)
141 .chkTemplatePath.Enabled = oFactoryKey.HasByName(sSOHelperDocuments(0,1))
142 .chkDocumentPath.Label = sSOHelperDocuments(1,0)
143 .chkDocumentPath.Enabled = oFactoryKey.HasByName(sSOHelperDocuments(1,1))
144 Else
145 .chkTemplatePath.Enabled = True
146 .chkDocumentPath.Enabled = True
147 .chkTemplatePath.Label = sTemplateCheckbox(Index)
148 .chkDocumentPath.Label = sDocumentCheckbox(Index)
149 .hlnTemplates.Label = sProgressMoreTemplates
150 End If
151 .chkTemplatePath.State = Abs(Applications(CurOffice,SBTEMPLCONVERT))
152 ToggleInputPaths(oNullObject,&quot;Template&quot;)
153 ToggleInputPaths(oNullObject,&quot;Document&quot;)
154 .chkTemplateSearchSubDir.State = Abs(Applications(CurOffice,SBTEMPLRECURSIVE))
155 .txtTemplateImportPath.Text = ConvertFromUrl(Applications(CurOffice,SBTEMPLSOURCE))
156 .txtTemplateExportPath.Text = ConvertFromUrl(Applications(CurOffice,SBTEMPLTARGET))
157 .cmdGoOn.Label = sNextButton
158 .cmdBack.Enabled = True
159 ImportDialog.Step = 2
160 End With
161 ImportDialogArea.GetControl(&quot;chkTemplatePath&quot;).SetFocus()
162 ToggleNextButton()
163 End Sub
166 Sub FillUpApplicationList()
167 Dim i as Integer
168 Dim a as Integer
169 Dim BoolValue as Boolean
170 If Not bDoKeepApplValues Then
171 a = 0
172 For i = 1 To ApplCount
173 If ImportDialog.optMSDocuments.State = 1 Then
174 BoolValue = ImportDialogArea.GetControl(&quot;chkMSApplication&quot; &amp; i).Model.State = 1
175 Else
176 BoolValue = ImportDialogArea.GetControl(&quot;chkSOApplication&quot; &amp; i).Model.State = 1
177 End If
178 Applications(a,SBAPPLCONVERT) = BoolValue
179 Applications(a,SBDOCCONVERT) = BoolValue
180 Applications(a,SBDOCRECURSIVE) = BoolValue
181 Applications(a,SBDOCSOURCE) = &quot;&quot; &apos; GetDefaultPath(i)
182 Applications(a,SBDOCTARGET) = &quot;&quot; &apos; SOWorkPath
183 Applications(a,SBTEMPLCONVERT) = BoolValue
184 Applications(a,SBTEMPLRECURSIVE) = BoolValue
185 Applications(a,SBTEMPLSOURCE) = &quot;&quot; &apos; GetTemplateDefaultPath(i)
186 Applications(a,SBTEMPLTARGET) = &quot;&quot; &apos; GetTargetTemplatePath(i)
187 Applications(a,SBAPPLKEY) = i-1
188 If BoolValue Then
189 a = a + 1
190 End If
191 Next i
192 ApplCount = a
193 End If
194 End Sub
197 Sub InitializePathsforCurrentApplication(i as Integer)
198 AssignPathToCurrentApplication(SBDOCSOURCE, GetDefaultPath(i))
199 AssignPathToCurrentApplication(SBDOCTARGET, SOWorkPath)
200 AssignPathToCurrentApplication(SBTEMPLSOURCE, GetTemplateDefaultPath(i))
201 AssignPathToCurrentApplication(SBTEMPLTARGET, GetTargetTemplatePath(i))
202 End Sub
205 Sub AssignPathToCurrentApplication(Index as Integer, NewPath as String)
206 If Applications(CurOffice,Index) = &quot;&quot; Then
207 If CurOffice &gt; 0 Then
208 Applications(CurOffice,Index) = Applications(CurOffice-1,Index)
209 Else
210 Applications(CurOffice,Index) = NewPath
211 End If
212 End If
213 End Sub
216 Sub SaveStep_InputPath()
217 Applications(CurOffice,SBDOCCONVERT) = ImportDialog.chkDocumentPath.State = 1
218 Applications(CurOffice,SBDOCRECURSIVE) = ImportDialog.chkDocumentSearchSubDir.State = 1
219 Applications(CurOffice,SBDOCSOURCE) = ConvertToURL(ImportDialog.txtDocumentImportPath.Text)
220 Applications(CurOffice,SBDOCTARGET) = ConvertToUrl(ImportDialog.txtDocumentExportPath.Text)
221 Applications(CurOffice,SBTEMPLCONVERT) = ImportDialog.chkTemplatePath.State = 1
222 Applications(CurOffice,SBTEMPLRECURSIVE) = ImportDialog.chkTemplateSearchSubDir.State = 1
223 Applications(CurOffice,SBTEMPLSOURCE) = ConvertToURL(ImportDialog.txtTemplateImportPath.Text)
224 Applications(CurOffice,SBTEMPLTARGET) = ConvertToURL(ImportDialog.txtTemplateExportPath.Text)
225 End Sub
228 Sub ToggleInputPaths(aEvent as Object, Optional sDocType)
229 Dim bDoEnable as Boolean
230 Dim sLocDocType as String
231 Dim oCheckBox as Object
232 If Not IsNull(aEvent) Then
233 sLocDocType = aEvent.Source.Model.Tag
234 Else
235 sLocDocType = sDocType
236 End If
237 With ImportDialogArea
238 oCheckBox = .GetControl(&quot;chk&quot; &amp; sLocDocType &amp; &quot;Path&quot;).Model
239 bDoEnable = oCheckBox.State = 1 And oCheckBox.Enabled
240 .GetControl(&quot;lbl&quot; &amp; sLocDocType &amp; &quot;Import&quot;).Model.Enabled = bDoEnable
241 .GetControl(&quot;lbl&quot; &amp; sLocDocType &amp; &quot;Export&quot;).Model.Enabled = bDoEnable
242 .GetControl(&quot;txt&quot; &amp; sLocDocType &amp; &quot;ImportPath&quot;).Model.Enabled = bDoEnable
243 .GetControl(&quot;txt&quot; &amp; sLocDocType &amp; &quot;ExportPath&quot;).Model.Enabled = bDoEnable
244 .GetControl(&quot;chk&quot; &amp; sLocDocType &amp; &quot;SearchSubDir&quot;).Model.Enabled = bDoEnable
245 .GetControl(&quot;cmd&quot; &amp; sLocDocType &amp; &quot;Import&quot;).Model.Enabled = bDoEnable
246 .GetControl(&quot;cmd&quot; &amp; sLocDocType &amp; &quot;Export&quot;).Model.Enabled = bDoEnable
247 End With
248 ToggleNextButton()
249 End Sub
252 Function MakeSummaryString()
253 Dim sTmpText As String
254 Dim i as Integer
255 Dim Index as Integer
256 Dim sAddText as String
257 For i = 0 To ApplCount -1
258 Index = Applications(i,SBAPPLKEY)
259 GetFilterTracingLogPath(i, Index)
260 If Applications(i,SBTEMPLCONVERT) Then
261 &apos; Templates are to be converted
262 sAddText = &quot;&quot;
263 If WizardMode = SBMICROSOFTMODE Then
264 sAddText = sSumMSTemplates(Index) &amp; sCRLF
265 Else
266 sAddText = sSumSOTemplates(Index) &amp; sCRLF
267 End If
268 sTmpText = sTmpText &amp; sAddText &amp; ConvertFromUrl(Applications(i,SBTEMPLSOURCE)) &amp; sCRLF
269 If Applications(i,SBTEMPLRECURSIVE) Then
270 &apos; Including Subdirectories
271 sTmpText = sTmpText &amp; sSumInclusiveSubDir &amp; sCRLF
272 End If
273 sTmpText = sTmpText &amp; sSumSaveDocuments &amp; sCRLF
274 sTmpText = sTmpText &amp; ConvertFromUrl(Applications(i,SBTEMPLTARGET)) &amp; sCRLF
275 sTmpText = sTmpText &amp; sCRLF
276 End If
278 If Applications(i,SBDOCCONVERT) Then
279 &apos; Documents are to be converted
280 If WizardMode = SBMICROSOFTMODE Then
281 sAddText = sSumMSDocuments(Index) &amp; sCRLF
282 Else
283 sAddText = sSumSODocuments(Index) &amp; sCRLF
284 End If
285 sTmpText = sTmpText &amp; sAddText &amp; ConvertFromUrl(Applications(i,SBDOCSOURCE)) &amp; sCRLF
287 If Applications(i,SBDOCRECURSIVE) Then
288 &apos; Including Subdirectories
289 sTmpText = sTmpText &amp; sSumInclusiveSubDir &amp; sCRLF
290 End If
292 sTmpText = sTmpText &amp; sSumSaveDocuments &amp; sCRLF
293 sTmpText = sTmpText &amp; ConvertFromUrl(Applications(i,SBDOCTARGET)) &amp; sCRLF
294 sTmpText = sTmpText &amp; sCRLF
295 End If
296 Next i
297 MakeSummaryString = sTmpText
298 End Function
301 Sub FillStep_Summary()
302 ImportDialogArea.Title = sTitle
303 With ImportDialog
304 .SummaryTextbox.Text = MakeSummaryString()
305 .cmdGoOn.Enabled = .SummaryTextbox.Text &lt;&gt; &quot;&quot;
306 .cmdGoOn.Label = sBeginButton
307 .SummaryHeaderLabel.Label = sSummaryHeader
308 .Step = 3
309 End With
310 ImportDialogArea.GetControl(&quot;SummaryHeaderLabel&quot;).SetFocus()
311 End Sub
314 Sub FillStep_Progress()
315 With ImportDialog
316 .cmdBack.Enabled = False
317 .cmdGoOn.Enabled = False
318 .hlnProgress.Label = sProgressPage_1
319 .LabelRetrieval.FontWeight = com.sun.star.awt.FontWeight.BOLD
320 .LabelRetrieval.Label = sProgressPage_2
321 .LabelCurProgress.Label = sProgressPage_3
322 .LabelCurDocumentRetrieval.Label = &quot;&quot;
323 .LabelCurTemplateRetrieval.Label = &quot;&quot;
324 .LabelCurDocument.Label = &quot;&quot;
325 .Step = 4
326 End With
327 ImportDialogArea.GetControl(&quot;LabelRetrieval&quot;).SetFocus()
328 If ImportDialog.chkLogfile.State = 1 Then
329 ImportDialog.cmdShowLogFile.DefaultButton = True
330 End If
331 End Sub
334 Sub GetFilterTracingLogPath(i as Integer, Index as Integer)
335 Dim aNodePath(0) as new com.sun.star.beans.PropertyValue
336 Dim oMasterKey
337 Dim oImportKey
338 Dim oWordKey
339 Dim oExcelkey
340 Dim oPowerpointKey
341 Dim oFilterService
342 aNodePath(0).Name = &quot;nodepath&quot;
343 aNodePath(0).Value = &quot;org.openoffice.Office.Tracing&quot;
344 oFilterService = createUnoService(&quot;com.sun.star.util.FilterTracer&quot;)
345 bFilterTracingAvailable = Not IsNull(oFilterService)
346 If bFilterTracingAvailable Then
347 oMasterkey = GetRegistryKeyContent(&quot;org.openoffice.Office.Tracing/&quot;)
348 If oMasterKey.hasbyName(&quot;Import&quot;) Then
349 oImportKey = GetRegistryKeyContent(&quot;org.openoffice.Office.Tracing/Import&quot;)
350 bMSApplFilterTracingAvailable(i) = CheckMSImportAvailability(oImportkey, MSFiltername(Index, 4), FilterTracingLogPath(i), bTakeOverTargetName(i), bTakeOverPathName(i))
351 End If
352 End If
353 End Sub
356 Function CheckMSImportAvailability(oImportkey, MSApplName as String, MSLogPath as String, bTakeOverTargetname as String, bTakeOverpathName as String) as Boolean
357 Dim bApplIsAvailable as Boolean
358 Dim oApplKey
359 Dim LocApplName as String
360 Dim LocApplPath as String
361 bApplIsAvailable = oImportKey.hasbyName(MSApplName)
362 If bApplIsAvailable Then
363 oApplKey = oImportKey.getByName(MSApplName)
364 bApplIsAvailable = oApplKey.On
365 LocApplName = oApplKey.Name
366 LocApplPath = oApplKey.Path
367 bTakeOverTargetName = (LocApplName = &quot;&quot;)
368 bTakeOverPathName = (LocApplPath = &quot;&quot;)
369 MSLogPath = LocApplPath &amp; &quot;/&quot; &amp; LocApplName &amp; &quot;.log&quot;
370 End If
371 CheckMSImportAvailability() = bApplIsAvailable
372 End Function
376 Sub SetupMSConfiguration()
377 iApplSection = 0
378 Wizardmode = SBMICROSOFTMODE
379 MaxApplCount = 3
380 ApplCount = 3
381 &apos; chkTemplatePath-Captions
382 GetApplResourceArray(1009 + iApplSection, ApplCount, sTemplateCheckBox())
383 &apos; DocumentCheckbox- Captions
384 GetApplResourceArray(1009 + iApplSection + ApplCount, ApplCount, sDocumentCheckBox())
386 sKeyName(0) = &quot;Software\Microsoft\Office\8.0\Word\Options&quot;
387 sKeyName(1) = &quot;Software\Microsoft\Office\8.0\Excel\Microsoft Excel&quot;
388 sKeyName(2) = &quot;Software\Microsoft\Office\8.0\PowerPoint\Recent Folder List\Default&quot;
390 sValueName(0) = &quot;DOC-PATH&quot;
391 sValueName(1) = &quot;DefaultPath&quot;
392 sValueName(2) = &quot;&quot;
394 &apos; See definition of Filtername-Array about meaning of fields
395 MSFilterName(0,0) = &quot;doc&quot;
396 MSFilterName(0,1) = &quot;writer8&quot;
397 MSFilterName(0,2) = &quot;odt&quot;
398 MSFilterName(0,3) = sMSDocumentCheckBox(0)
399 MSFilterName(0,4) = &quot;Word&quot;
402 MSFilterName(1,0) = &quot;xls&quot;
403 MSFilterName(1,1) = &quot;calc8&quot;
404 MSFilterName(1,2) = &quot;ods&quot;
405 MSFilterName(1,3) = sMSDocumentCheckBox(1)
406 MSFilterName(1,4) = &quot;Excel&quot;
408 MSFilterName(2,0) = &quot;ppt|pps&quot;
409 MSFilterName(2,1) = &quot;impress8|impress8&quot;
410 MSFilterName(2,2) = &quot;odp|odp&quot;
411 MSFilterName(2,3) = sMSDocumentCheckBox(2)
412 MSFilterName(2,4) = &quot;PowerPoint&quot;
414 MSFilterName(3,0) = &quot;dot&quot;
415 MSFilterName(3,1) = &quot;writer8_template&quot;
416 MSFilterName(3,2) = &quot;ott&quot;
417 MSFilterName(3,3) = sMSTemplateCheckBox(0)
418 MSFilterName(3,4) = &quot;Word&quot;
420 MSFilterName(4,0) = &quot;xlt&quot;
421 MSFilterName(4,1) = &quot;calc8_template&quot;
422 MSFilterName(4,2) = &quot;ots&quot;
423 MSFilterName(4,3) = sMSTemplateCheckBox(1)
424 MSFilterName(4,4) = &quot;Excel&quot;
426 MSFilterName(5,0) = &quot;pot&quot;
427 MSFilterName(5,1) = &quot;impress8_template&quot;
428 MSFilterName(5,2) = &quot;otp&quot;
429 MSFilterName(5,3) = sMSTemplateCheckBox(2)
430 MSFilterName(5,4) = &quot;PowerPoint&quot;
431 End Sub
435 &apos; This is an extract from &quot;http://util.openoffice.org/source/browse/util/sot/source/base/exchange.cxx?rev=1.25&amp;content-type=text/x-cvsweb-markup&quot;
436 &apos; about the listed defined mimetypes that are required to define binary StarOffice templates that have for all applications the same extension &quot;.vor&quot;
438 &apos; 26 SOT_FORMATSTR_ID_STARWRITER_30*/ { &quot;application/x-openoffice-starwriter-30;windows_formatname=\&quot;StarWriter 3.0\&quot;&quot;, &quot;StarWriter 3.0&quot;, &amp;::getCppuType( (const Sequence&lt; sal_Int8 &gt;*) 0 ) },
439 &apos; 27 SOT_FORMATSTR_ID_STARWRITER_40*/ { &quot;application/x-openoffice-starwriter-40;windows_formatname=\&quot;StarWriter 4.0\&quot;&quot;, &quot;StarWriter 4.0&quot;, &amp;::getCppuType( (const Sequence&lt; sal_Int8 &gt;*) 0 ) },
440 &apos; 28 SOT_FORMATSTR_ID_STARWRITER_50*/ { &quot;application/x-openoffice-starwriter-50;windows_formatname=\&quot;StarWriter 5.0\&quot;&quot;, &quot;StarWriter 5.0&quot;, &amp;::getCppuType( (const Sequence&lt; sal_Int8 &gt;*) 0 ) },
442 &apos; 29 SOT_FORMATSTR_ID_STARWRITERWEB_40*/ { &quot;application/x-openoffice-starwriterweb-40;windows_formatname=\&quot;StarWriter/Web 4.0\&quot;&quot;, &quot;StarWriter/Web 4.0&quot;, &amp;::getCppuType( (const Sequence&lt; sal_Int8 &gt;*) 0 ) },
443 &apos; 30 SOT_FORMATSTR_ID_STARWRITERWEB_50*/ { &quot;application/x-openoffice-starwriterweb-50;windows_formatname=\&quot;StarWriter/Web 5.0\&quot;&quot;, &quot;StarWriter/Web 5.0&quot;, &amp;::getCppuType( (const Sequence&lt; sal_Int8 &gt;*) 0 ) },
445 &apos; 31 SOT_FORMATSTR_ID_STARWRITERGLOB_40*/ { &quot;application/x-openoffice-starwriterglob-40;windows_formatname=\&quot;StarWriter/Global 4.0\&quot;&quot;, &quot;StarWriter/Global 4.0&quot;, &amp;::getCppuType( (const Sequence&lt; sal_Int8 &gt;*) 0 ) },
446 &apos; 32 SOT_FORMATSTR_ID_STARWRITERGLOB_50*/ { &quot;application/x-openoffice-starwriterglob-50;windows_formatname=\&quot;StarWriter/Global 5.0\&quot;&quot;, &quot;StarWriter/Global 5.0&quot;, &amp;::getCppuType( (const Sequence&lt; sal_Int8 &gt;*) 0 ) },
448 &apos; 33 SOT_FORMATSTR_ID_STARDRAW*/ { &quot;application/x-openoffice-stardraw;windows_formatname=\&quot;StarDrawDocument\&quot;&quot;, &quot;StarDrawDocument&quot;, &amp;::getCppuType( (const Sequence&lt; sal_Int8 &gt;*) 0 ) },
449 &apos; 34 SOT_FORMATSTR_ID_STARDRAW_40*/ { &quot;application/x-openoffice-stardraw-40;windows_formatname=\&quot;StarDrawDocument 4.0\&quot;&quot;, &quot;StarDrawDocument 4.0&quot;, &amp;::getCppuType( (const Sequence&lt; sal_Int8 &gt;*) 0 ) },
450 &apos; 36 SOT_FORMATSTR_ID_STARDRAW_50*/ { &quot;application/x-openoffice-stardraw-50;windows_formatname=\&quot;StarDraw 5.0\&quot;&quot;, &quot;StarDraw 5.0&quot;, &amp;::getCppuType( (const Sequence&lt; sal_Int8 &gt;*) 0 ) },
452 &apos; 35 SOT_FORMATSTR_ID_STARIMPRESS_50*/ { &quot;application/x-openoffice-starimpress-50;windows_formatname=\&quot;StarImpress 5.0\&quot;&quot;, &quot;StarImpress 5.0&quot;, &amp;::getCppuType( (const Sequence&lt; sal_Int8 &gt;*) 0 ) },
454 &apos; 37 SOT_FORMATSTR_ID_STARCALC*/ { &quot;application/x-openoffice-starcalc;windows_formatname=\&quot;StarCalcDocument\&quot;&quot;, &quot;StarCalcDocument&quot;, &amp;::getCppuType( (const Sequence&lt; sal_Int8 &gt;*) 0 ) },
455 &apos; 38 SOT_FORMATSTR_ID_STARCALC_40*/ { &quot;application/x-openoffice-starcalc-40;windows_formatname=\&quot;StarCalc 4.0\&quot;&quot;, &quot;StarCalc 4.0&quot;, &amp;::getCppuType( (const Sequence&lt; sal_Int8 &gt;*) 0 ) },
456 &apos; 39 SOT_FORMATSTR_ID_STARCALC_50*/ { &quot;application/x-openoffice-starcalc-50;windows_formatname=\&quot;StarCalc 5.0\&quot;&quot;, &quot;StarCalc 5.0&quot;, &amp;::getCppuType( (const Sequence&lt; sal_Int8 &gt;*) 0 ) },
458 &apos; 40 SOT_FORMATSTR_ID_STARCHART*/ { &quot;application/x-openoffice-starchart;windows_formatname=\&quot;StarChartDocument\&quot;&quot;, &quot;StarChartDocument&quot;, &amp;::getCppuType( (const Sequence&lt; sal_Int8 &gt;*) 0 ) },
459 &apos; 41 SOT_FORMATSTR_ID_STARCHART_40*/ { &quot;application/x-openoffice-starchart-40;windows_formatname=\&quot;StarChartDocument 4.0\&quot;&quot;, &quot;StarChartDocument 4.0&quot;, &amp;::getCppuType( (const Sequence&lt; sal_Int8 &gt;*) 0 ) },
460 &apos; 42 SOT_FORMATSTR_ID_STARCHART_50*/ { &quot;application/x-openoffice-starchart-50;windows_formatname=\&quot;StarChart 5.0\&quot;&quot;, &quot;StarChart 5.0&quot;, &amp;::getCppuType( (const Sequence&lt; sal_Int8 &gt;*) 0 ) },
462 &apos; 46 SOT_FORMATSTR_ID_STARMATH*/ { &quot;application/x-openoffice-starmath;windows_formatname=\&quot;StarMath\&quot;&quot;, &quot;StarMath&quot;, &amp;::getCppuType( (const Sequence&lt; sal_Int8 &gt;*) 0 ) },
463 &apos; 47 SOT_FORMATSTR_ID_STARMATH_40*/ { &quot;application/x-openoffice-starmath-40;windows_formatname=\&quot;StarMathDocument 4.0\&quot;&quot;, &quot;StarMathDocument 4.0&quot;, &amp;::getCppuType( (const Sequence&lt; sal_Int8 &gt;*) 0 ) },
464 &apos; 48 SOT_FORMATSTR_ID_STARMATH_50*/ { &quot;application/x-openoffice-starmath-50;windows_formatname=\&quot;StarMath 5.0\&quot;&quot;, &quot;StarMath 5.0&quot;, &amp;::getCppuType( (const Sequence&lt; sal_Int8 &gt;*) 0 ) },
467 Sub SetupXMLConfiguration()
468 iApplSection = 1000
469 Wizardmode = SBXMLMODE
470 ApplCount = 4
471 MaxApplCount = 4
472 XMLTemplateList = Array(&quot;vor&quot;, &quot;sti&quot;, &quot;stw&quot; , &quot;stc&quot; , &quot;std&quot;)
473 &apos; chkTemplatePath-Captions
474 GetApplResourceArray(1009 + iApplSection, ApplCount, sTemplateCheckBox())
475 &apos; DocumentCheckbox- Captions
476 GetApplResourceArray(1009 + iApplSection + ApplCount, ApplCount, sDocumentCheckBox())
478 XMLFilterName(0,0) = &quot;sdw|sxw&quot;
479 XMLFilterName(0,1) = &quot;writer8|writer8&quot;
480 XMLFilterName(0,2) = &quot;odt|odt&quot;
481 XMLFilterName(0,3) = sDocumentCheckBox(0)
483 XMLFilterName(1,0) = &quot;sdc|sxc&quot;
484 XMLFilterName(1,1) = &quot;calc8|calc8&quot;
485 XMLFilterName(1,2) = &quot;ods|ods&quot;
486 XMLFilterName(1,3) = sDocumentCheckBox(1)
488 If oFactoryKey.HasByName(&quot;com.sun.star.drawing.DrawingDocument&quot;) and oFactoryKey.HasByName(&quot;com.sun.star.presentation.PresentationDocument&quot;) Then
489 XMLFilterName(2,0) = &quot;sdd|sda|sxi|sxd&quot;
490 XMLFilterName(2,1) = &quot;impress8|draw8|impress8|draw8&quot;
491 XMLFilterName(2,2) = &quot;odp|odg|odp|odg&quot;
492 Elseif oFactoryKey.HasByName(&quot;com.sun.star.drawing.DrawingDocument&quot;) Then
493 XMLFilterName(2,0) = &quot;sda|sxd&quot;
494 XMLFilterName(2,1) = &quot;draw8|draw8&quot;
495 XMLFilterName(2,2) = &quot;odg|odg&quot;
496 Elseif oFactoryKey.HasByName(&quot;com.sun.star.presentation.PresentationDocument&quot;) Then
497 XMLFilterName(2,0) = &quot;sdd|sxi&quot;
498 XMLFilterName(2,1) = &quot;impress8|impress8&quot;
499 XMLFilterName(2,2) = &quot;odp|odp&quot;
500 End If
501 XMLFilterName(2,3) = sDocumentCheckBox(2)
504 XMLFilterName(3,0) = &quot;smf|sxm&quot;
505 XMLFilterName(3,1) = &quot;math8|math8&quot;
506 XMLFilterName(3,2) = &quot;odf|odf&quot;
507 XMLFilterName(3,3) = sDocumentCheckBox(3)
509 XMLFilterName(4,0) = &quot;application/x-openoffice-starwriter|application/vnd.stardivision.writer/web|application/vnd.sun.xml.writer|application/vnd.sun.xml.writerweb&quot;
510 XMLFilterName(4,1) = &quot;writer8_template|writerweb8_writer_template|writer8_template|writerweb8_writer_template&quot;
511 XMLFilterName(4,2) = &quot;ott|oth|ott|oth&quot;
512 XMLFilterName(4,3) = sTemplateCheckBox(0)
515 XMLFilterName(5,0) = &quot;application/x-openoffice-starcalc|application/vnd.sun.xml.calc&quot;
516 XMLFilterName(5,1) = &quot;calc8_template|calc8_template&quot;
517 XMLFilterName(5,2) = &quot;ots|ots&quot;
518 XMLFilterName(5,3) = sTemplateCheckBox(1)
520 &apos; due to bug #108942# impress templates of the version 4.0 have to be handled in a special way because their mimetype
521 &apos; falsely points to the draw application.
522 If oFactoryKey.HasByName(&quot;com.sun.star.drawing.DrawingDocument&quot;) and oFactoryKey.HasByName(&quot;com.sun.star.presentation.PresentationDocument&quot;) Then
523 XMLFilterName(6,0) = &quot;application/x-openoffice-starimpress|application/x-openoffice-stardraw-40|application/x-openoffice-stardraw|application/vnd.sun.xml.impress|application/vnd.sun.xml.draw&quot;
524 XMLFilterName(6,1) = &quot;impress8_template|impress8_template|draw8_template|impress8_template|draw8_template&quot;
525 XMLFilterName(6,2) = &quot;otp|otp|otg|otp|otg&quot;
526 Elseif oFactoryKey.HasByName(&quot;com.sun.star.drawing.DrawingDocument&quot;) Then
527 XMLFilterName(6,0) = &quot;application/x-openoffice-stardraw|application/vnd.sun.xml.draw&quot;
528 XMLFilterName(6,1) = &quot;draw8_template|draw8_template&quot;
529 XMLFilterName(6,2) = &quot;otg|otg&quot;
530 Elseif oFactoryKey.HasByName(&quot;com.sun.star.presentation.PresentationDocument&quot;) Then
531 XMLFilterName(6,0) = &quot;application/x-openoffice-starimpress|application/x-openoffice-stardraw-40|application/vnd.sun.xml.impress&quot;
532 XMLFilterName(6,1) = &quot;impress8_template|impress8_template|impress8_template&quot;
533 XMLFilterName(6,2) = &quot;otp|otp|otp&quot;
534 End If
535 XMLFilterName(6,3) = sTemplateCheckBox(2)
537 If oFactoryKey.HasByName(&quot;com.sun.star.text.GlobalDocument&quot;) Then
538 XMLFilterName(7,0) = &quot;sgl|sxg&quot;
539 XMLFilterName(7,1) = &quot;writerglobal8|writerglobal8&quot;
540 XMLFilterName(7,2) = &quot;odm|odm&quot;
541 XMLFilterName(7,3) = sTemplateCheckBox(3)
542 End If
543 End Sub
546 Function CheckControlPath(oCheckbox as Object, oTextBox as Object, ByVal bDoEnable as Boolean)
547 Dim sPath as String
548 If Not bDoEnable Then
549 CheckControlPath = False
550 ElseIf oCheckbox.State = 0 Then
551 CheckControlPath = True
552 Else
553 sPath = ConvertToUrl(Trim(oTextBox.Text)
554 CheckControlPath = oUcb.Exists(sPath)
555 End If
556 End Function
559 Function CheckInputPaths() as Boolean
560 Dim bChangePage as Boolean
561 bChangePage = CheckTextBoxPath(ImportDialog.txtTemplateImportPath, True, False, sTitle, False)
562 bChangePage = CheckTextBoxPath(ImportDialog.txtTemplateExportPath, bChangePage, True, sTitle, False)
563 bChangePage = CheckTextBoxPath(ImportDialog.txtDocumentImportPath, bChangePage, False, sTitle, False)
564 bChangePage = CheckTextBoxPath(ImportDialog.txtDocumentExportPath, bChangePage, True, sTitle, False)
565 CheckInputPaths = bChangePage
566 End Function
569 Function CheckTextBoxPath(oTextBox as Object, ByVal bCheck as Boolean, bCreateNew as Boolean, sTitle as String, bgetResources as Boolean) as Boolean
570 Dim iCreate as Integer
571 Dim sQueryMessage as String
572 Dim sUrlPath as String
573 Dim sMessageNoDir as String
574 Dim sShowPath as String
575 Dim oLocUcb as Object
576 oLocUcb = createUnoService(&quot;com.sun.star.ucb.SimpleFileAccess&quot;)
577 If bGetResources Then
578 If InitResources(&quot;ImportWizard&quot;,&quot;imp&quot;) then
579 sNoDirCreation = GetResText(1050)
580 sMsgDirNotThere = GetResText(1051)
581 sQueryForNewCreation = GetResText(1052)
582 Else
583 CheckTextBoxPath() = False
584 Exit Function
585 End If
586 End If
587 If oTextBox.Enabled Then
588 If bCheck Then
589 sShowPath = oTextBox.Text
590 sUrlPath = ConvertToUrl(sShowPath)
591 If Not oLocUcb.Exists(sUrlPath) Then
592 If Not bCreateNew Then
593 &apos; Sourcedirectories must be existing, Targetdirectories may be created new
594 sQueryMessage = ReplaceString(sMsgDirNotThere, sShowPath,&quot;%1&quot;)
595 Msgbox(sQueryMessage,16,sTitle)
596 CheckTextBoxPath() = False
597 Exit Function
598 Else
599 sQueryMessage = ReplaceString(sMsgDirNotThere, sShowPath,&quot;%1&quot;)
600 sQueryMessage = sQueryMessage &amp; Chr(13) &amp; sQueryForNewCreation
601 iCreate = Msgbox (sQueryMessage, 36, sTitle)
602 If iCreate = 6 Then
603 On Local Error Goto NOVALIDPATH
604 CreateFolder(sUrlPath)
605 If Not oLocUcb.Exists(sUrlPath) Then
606 Goto NOVALIDPATH
607 End If
608 Else
609 CheckTextBoxPath() = False
610 Exit Function
611 End If
612 End If
613 End If
614 CheckTextBoxPath() = True
615 Else
616 CheckTextBoxPath() = False
617 End If
618 Else
619 CheckTextBoxPath() = True
620 End If
621 Exit Function
622 NOVALIDPATH:
623 sMessageNoDir = ReplaceString(sNoDirCreation, sShowPath, &quot;%1&quot;)
624 Msgbox(sMessageNoDir, 16, sTitle)
625 CheckTextBoxPath() = False
626 End Function
629 Sub InitializeProgressPage(oDialog as Object)
630 oDialog.LabelRetrieval.FontWeight = com.sun.star.awt.FontWeight.NORMAL
631 oDialog.LabelCurProgress.FontWeight = com.sun.star.awt.FontWeight.BOLD
632 End Sub
635 Sub SetProgressDisplay(AbsFound as Integer)
636 ImportDialog.LabelRetrieval.Label = sProgressPage_2 &amp; &quot; &quot; &amp; ReplaceString(sProgressPage_5, Str(AbsFound) &amp; &quot; &quot;, &quot;%1&quot;)
637 ImportDialog.LabelCurDocumentRetrieval.Label = sProgressFound &amp; &quot; &quot; &amp; CStr(AbsDocuFound) &amp; &quot; &quot; &amp; sProgressMoreDocs
638 ImportDialog.LabelCurTemplateRetrieval.Label = sProgressFound &amp; &quot; &quot; &amp; CStr(AbsTemplateFound) &amp; &quot; &quot; &amp; sProgressMoreTemplates
639 End Sub
641 Sub TakoverFolderName(aEvent as Object)
642 Dim RefControlName as String
643 Dim oRefControl
644 RefControlName = aEvent.Source.Model.Tag
645 oRefControl = ImportDialogArea.GetControl(RefControlName)
646 GetFolderName(oRefControl.Model)
647 ToggleNextButton()
648 End Sub
651 Sub FinalizeDialogButtons()
652 ImportDialog.cmdShowLogFile.Enabled = ((Isnull(oLogDocument) = False) And (ImportDialog.chkLogfile.State = 1))
653 ImportDialog.cmdCancel.Enabled = False
654 ImportDialog.cmdGoOn.Label = sCloseButton
655 ImportDialog.cmdGoOn.Enabled = True
656 End Sub
657 </script:module>