Version 4.0.0.1, tag libreoffice-4.0.0.1
[LibreOffice.git] / wizards / source / importwizard / DialogModul.xba
blob70f9a6b3df6452c33d76d85d338782845c806688
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
3 <!--
4 * This file is part of the LibreOffice project.
6 * This Source Code Form is subject to the terms of the Mozilla Public
7 * License, v. 2.0. If a copy of the MPL was not distributed with this
8 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
10 * This file incorporates work covered by the following license notice:
12 * Licensed to the Apache Software Foundation (ASF) under one or more
13 * contributor license agreements. See the NOTICE file distributed
14 * with this work for additional information regarding copyright
15 * ownership. The ASF licenses this file to you under the Apache
16 * License, Version 2.0 (the "License"); you may not use this file
17 * except in compliance with the License. You may obtain a copy of
18 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
19 -->
20 <script:module xmlns:script="http://openoffice.org/2000/script" script:name="DialogModul" script:language="StarBasic">Option Explicit
22 Public Const bDebugWizard = True
24 Public Const SBFIRSTAPPLCHECKED = 0
25 Public Const SBSECONDAPPLCHECKED = 1
26 Public Const SBTHIRDAPPLCHECKED = 2
27 Public Const SBFOURTHAPPLCHECKED = 3
28 Public WizardMode as String
29 Public Const SBMICROSOFTMODE = &quot;MS&quot;
30 Public Const SBXMLMODE = &quot;SO&quot;
31 &apos; The absolute maximal Number of possible Applications
32 Public Const Twip = 425
33 Public Const SBMAXAPPLCOUNT = 4
34 Public MaxApplCount as Integer
35 Public CurOffice As Integer
36 Public SOBitmapPath As String
37 Public SOWorkPath As String
38 Public SOTemplatePath as String
39 Public bCancelTask As Boolean
40 Public bDoKeepApplValues as Boolean
41 Public iApplSection as Integer
42 Public oUcb as Object
43 Public PathSeparator as String
45 Public ApplCount as Integer
46 Public sKeyName(SBMAXAPPLCOUNT-1) as String
47 Public sValueName(SBMAXAPPLCOUNT-1) as String
48 Public sCRLF as String
49 Public MSFilterName(5,4) as String
50 Public XMLFilterName(7,3) as String &apos;Number of different formats
52 &apos; e.g.:
53 &apos; XMLFilterName(x,0) = &quot;sdw&quot; &apos; in documents we take the extensions; in SO-templates the appropriate Filtername
54 &apos; XMLFilterName(x,1) = &quot;swriter: StarWriter 5.0&quot; &apos; the filtername of the target-format
55 &apos; XMLFilterName(x,2) = &quot;sxw&quot; &apos; the target extension
57 Public Applications(SBMAXAPPLCOUNT-1,9)
59 Public Const SBAPPLCONVERT = 0
60 Public Const SBDOCCONVERT = 1
61 Public Const SBDOCRECURSIVE = 2
62 Public Const SBDOCSOURCE = 3
63 Public Const SBDOCTARGET = 4
64 Public Const SBTEMPLCONVERT = 5
65 Public Const SBTEMPLRECURSIVE = 6
66 Public Const SBTEMPLSOURCE = 7
67 Public Const SBTEMPLTARGET = 8
68 Public Const SBAPPLKEY = 9
69 Public XMLTemplateList()
71 &apos; Application-relating Data are stored in this Array
72 &apos; according to the following structure:
73 &apos; Applications(X,0) = True/False (Application is to be converted)
74 &apos; Applications(X,1) = True/False (Documents are to be converted)
75 &apos; Applications(X,2) = True/False (Including Subdirectories)
76 &apos; Applications(X,3) = &quot;File:///...&quot; (SourceUrl of the documents)
77 &apos; Applications(X,4) = &quot;File///:...&quot; (TargetUrl of the documents)
78 &apos; Applications(X,5) = True/False (Templates are to be converted)
79 &apos; Applications(X,6) = True/False (Including Subdirectories)
80 &apos; Applications(X,7) = &quot;File:///...&quot; (SourceUrl of the templates)
81 &apos; Applications(X,8) = &quot;File:///...&quot; (TargetUrl of the templates)
82 &apos; Applications(X,9) = 0 (Key to the original Index of the Applications)
84 Public Const SBMAXEXTENSIONLENGTH = 15
87 Sub FillStep_Welcome()
88 Dim i as Integer
89 &apos; bDoKeepApplValues = False
90 ImportDialogArea.Title = sTitle
91 With ImportDialog
92 .cmdHelp.Label = sHelpButton
93 .cmdCancel.Label = sCancelButton
94 .cmdBack.Label = sBackButton
95 .cmdGoOn.Label = sNextButton
96 .WelcomeTextLabel.Label = sWelcomeTextLabel1
97 .WelcomeTextLabel3.Label = sWelcomeTextLabel3
99 .optMSDocuments.Label = sContainerName(0)
100 .chkMSApplication1.Label = sMsDocumentCheckbox(0)
101 .chkMSApplication2.Label = sMsDocumentCheckbox(1)
102 .chkMSApplication3.Label = sMsDocumentCheckbox(2)
104 .optSODocuments.Label = sContainerName(1)
105 .chkSOApplication1.Label = sSODocumentCheckbox(0)
106 .chkSOApplication2.Label = sSODocumentCheckbox(1)
107 .chkSOApplication3.Label = sSODocumentCheckbox(2)
108 .chkSOApplication4.Label = sSODocumentCheckbox(3)
109 .cmdBack.Enabled = False
110 .Step = 1
112 If Not oFactoryKey.hasbyName(&quot;com.sun.star.text.TextDocument&quot;) Then
113 .chkLogfile.State = 0
114 .chkLogfile.Enabled = False
115 End If
116 End With
117 CheckModuleInstallation()
118 ToggleNextButton()
119 End Sub
122 Sub FillStep_InputPaths(OfficeIndex as Integer, bStartup as Boolean)
123 Dim Index as Integer
124 Dim oNullObject as Object
125 If bStartup And Not bDoKeepApplValues Then
126 If ImportDialog.optMSDocuments.State = 1 Then
127 SetupMSConfiguration()
128 Else
129 SetupXMLConfiguration()
130 End If
131 FillUpApplicationList()
132 End If
133 CurOffice = OfficeIndex
134 Index = Applications(CurOffice,SBAPPLKEY)
135 InitializePathsforCurrentApplication(Index)
136 With ImportDialog
137 .chkTemplatePath.Label = sTemplateCheckbox(Index)
138 .chkDocumentPath.State = Abs(Applications(CurOffice,SBDOCCONVERT))
139 .chkDocumentSearchSubDir.State = Abs(Applications(CurOffice,SBDOCRECURSIVE))
140 .txtDocumentImportPath.Text = ConvertFromUrl(Applications(CurOffice,SBDOCSOURCE))
141 .txtDocumentExportPath.Text = ConvertFromUrl(Applications(CurOffice,SBDOCTARGET))
142 .hlnDocuments.Label = sProgressMoreDocs
143 If WizardMode = SBXMLMODE Then
144 ImportDialogArea.Title = sTitle &amp; &quot; - &quot; &amp; sSODocumentCheckBox(Index)
145 Else
146 ImportDialogArea.Title = sTitle &amp; &quot; - &quot; &amp; sMSDocumentCheckBox(Index)
147 End If
148 If WizardMode = SBXMLMODE AND Index = 3 Then
149 &apos; Note: SO-Helper Applications are partly treated like templates although they only have documents
150 .hlnTemplates.Label = sProgressMoreDocs
151 .chkTemplatePath.Label = sSOHelperDocuments(0,0)
152 .chkTemplatePath.Enabled = oFactoryKey.HasByName(sSOHelperDocuments(0,1))
153 .chkDocumentPath.Label = sSOHelperDocuments(1,0)
154 .chkDocumentPath.Enabled = oFactoryKey.HasByName(sSOHelperDocuments(1,1))
155 Else
156 .chkTemplatePath.Enabled = True
157 .chkDocumentPath.Enabled = True
158 .chkTemplatePath.Label = sTemplateCheckbox(Index)
159 .chkDocumentPath.Label = sDocumentCheckbox(Index)
160 .hlnTemplates.Label = sProgressMoreTemplates
161 End If
162 .chkTemplatePath.State = Abs(Applications(CurOffice,SBTEMPLCONVERT))
163 ToggleInputPaths(oNullObject,&quot;Template&quot;)
164 ToggleInputPaths(oNullObject,&quot;Document&quot;)
165 .chkTemplateSearchSubDir.State = Abs(Applications(CurOffice,SBTEMPLRECURSIVE))
166 .txtTemplateImportPath.Text = ConvertFromUrl(Applications(CurOffice,SBTEMPLSOURCE))
167 .txtTemplateExportPath.Text = ConvertFromUrl(Applications(CurOffice,SBTEMPLTARGET))
168 .cmdGoOn.Label = sNextButton
169 .cmdBack.Enabled = True
170 ImportDialog.Step = 2
171 End With
172 ImportDialogArea.GetControl(&quot;chkTemplatePath&quot;).SetFocus()
173 ToggleNextButton()
174 End Sub
177 Sub FillUpApplicationList()
178 Dim i as Integer
179 Dim a as Integer
180 Dim BoolValue as Boolean
181 If Not bDoKeepApplValues Then
182 a = 0
183 For i = 1 To ApplCount
184 If ImportDialog.optMSDocuments.State = 1 Then
185 BoolValue = ImportDialogArea.GetControl(&quot;chkMSApplication&quot; &amp; i).Model.State = 1
186 Else
187 BoolValue = ImportDialogArea.GetControl(&quot;chkSOApplication&quot; &amp; i).Model.State = 1
188 End If
189 Applications(a,SBAPPLCONVERT) = BoolValue
190 Applications(a,SBDOCCONVERT) = BoolValue
191 Applications(a,SBDOCRECURSIVE) = BoolValue
192 Applications(a,SBDOCSOURCE) = &quot;&quot; &apos; GetDefaultPath(i)
193 Applications(a,SBDOCTARGET) = &quot;&quot; &apos; SOWorkPath
194 Applications(a,SBTEMPLCONVERT) = BoolValue
195 Applications(a,SBTEMPLRECURSIVE) = BoolValue
196 Applications(a,SBTEMPLSOURCE) = &quot;&quot; &apos; GetTemplateDefaultPath(i)
197 Applications(a,SBTEMPLTARGET) = &quot;&quot; &apos; GetTargetTemplatePath(i)
198 Applications(a,SBAPPLKEY) = i-1
199 If BoolValue Then
200 a = a + 1
201 End If
202 Next i
203 ApplCount = a
204 End If
205 End Sub
208 Sub InitializePathsforCurrentApplication(i as Integer)
209 AssignPathToCurrentApplication(SBDOCSOURCE, GetDefaultPath(i))
210 AssignPathToCurrentApplication(SBDOCTARGET, SOWorkPath)
211 AssignPathToCurrentApplication(SBTEMPLSOURCE, GetTemplateDefaultPath(i))
212 AssignPathToCurrentApplication(SBTEMPLTARGET, GetTargetTemplatePath(i))
213 End Sub
216 Sub AssignPathToCurrentApplication(Index as Integer, NewPath as String)
217 If Applications(CurOffice,Index) = &quot;&quot; Then
218 If CurOffice &gt; 0 Then
219 Applications(CurOffice,Index) = Applications(CurOffice-1,Index)
220 Else
221 Applications(CurOffice,Index) = NewPath
222 End If
223 End If
224 End Sub
227 Sub SaveStep_InputPath()
228 Applications(CurOffice,SBDOCCONVERT) = ImportDialog.chkDocumentPath.State = 1
229 Applications(CurOffice,SBDOCRECURSIVE) = ImportDialog.chkDocumentSearchSubDir.State = 1
230 Applications(CurOffice,SBDOCSOURCE) = ConvertToURL(ImportDialog.txtDocumentImportPath.Text)
231 Applications(CurOffice,SBDOCTARGET) = ConvertToUrl(ImportDialog.txtDocumentExportPath.Text)
232 Applications(CurOffice,SBTEMPLCONVERT) = ImportDialog.chkTemplatePath.State = 1
233 Applications(CurOffice,SBTEMPLRECURSIVE) = ImportDialog.chkTemplateSearchSubDir.State = 1
234 Applications(CurOffice,SBTEMPLSOURCE) = ConvertToURL(ImportDialog.txtTemplateImportPath.Text)
235 Applications(CurOffice,SBTEMPLTARGET) = ConvertToURL(ImportDialog.txtTemplateExportPath.Text)
236 End Sub
239 Sub ToggleInputPaths(aEvent as Object, Optional sDocType)
240 Dim bDoEnable as Boolean
241 Dim sLocDocType as String
242 Dim oCheckBox as Object
243 If Not IsNull(aEvent) Then
244 sLocDocType = aEvent.Source.Model.Tag
245 Else
246 sLocDocType = sDocType
247 End If
248 With ImportDialogArea
249 oCheckBox = .GetControl(&quot;chk&quot; &amp; sLocDocType &amp; &quot;Path&quot;).Model
250 bDoEnable = oCheckBox.State = 1 And oCheckBox.Enabled
251 .GetControl(&quot;lbl&quot; &amp; sLocDocType &amp; &quot;Import&quot;).Model.Enabled = bDoEnable
252 .GetControl(&quot;lbl&quot; &amp; sLocDocType &amp; &quot;Export&quot;).Model.Enabled = bDoEnable
253 .GetControl(&quot;txt&quot; &amp; sLocDocType &amp; &quot;ImportPath&quot;).Model.Enabled = bDoEnable
254 .GetControl(&quot;txt&quot; &amp; sLocDocType &amp; &quot;ExportPath&quot;).Model.Enabled = bDoEnable
255 .GetControl(&quot;chk&quot; &amp; sLocDocType &amp; &quot;SearchSubDir&quot;).Model.Enabled = bDoEnable
256 .GetControl(&quot;cmd&quot; &amp; sLocDocType &amp; &quot;Import&quot;).Model.Enabled = bDoEnable
257 .GetControl(&quot;cmd&quot; &amp; sLocDocType &amp; &quot;Export&quot;).Model.Enabled = bDoEnable
258 End With
259 ToggleNextButton()
260 End Sub
263 Function MakeSummaryString()
264 Dim sTmpText As String
265 Dim i as Integer
266 Dim Index as Integer
267 Dim sAddText as String
268 For i = 0 To ApplCount -1
269 Index = Applications(i,SBAPPLKEY)
270 If Applications(i,SBTEMPLCONVERT) Then
271 &apos; Templates are to be converted
272 sAddText = &quot;&quot;
273 If WizardMode = SBMICROSOFTMODE Then
274 sAddText = sSumMSTemplates(Index) &amp; sCRLF
275 Else
276 sAddText = sSumSOTemplates(Index) &amp; sCRLF
277 End If
278 sTmpText = sTmpText &amp; sAddText &amp; ConvertFromUrl(Applications(i,SBTEMPLSOURCE)) &amp; sCRLF
279 If Applications(i,SBTEMPLRECURSIVE) Then
280 &apos; Including Subdirectories
281 sTmpText = sTmpText &amp; sSumInclusiveSubDir &amp; sCRLF
282 End If
283 sTmpText = sTmpText &amp; sSumSaveDocuments &amp; sCRLF
284 sTmpText = sTmpText &amp; ConvertFromUrl(Applications(i,SBTEMPLTARGET)) &amp; sCRLF
285 sTmpText = sTmpText &amp; sCRLF
286 End If
288 If Applications(i,SBDOCCONVERT) Then
289 &apos; Documents are to be converted
290 If WizardMode = SBMICROSOFTMODE Then
291 sAddText = sSumMSDocuments(Index) &amp; sCRLF
292 Else
293 sAddText = sSumSODocuments(Index) &amp; sCRLF
294 End If
295 sTmpText = sTmpText &amp; sAddText &amp; ConvertFromUrl(Applications(i,SBDOCSOURCE)) &amp; sCRLF
297 If Applications(i,SBDOCRECURSIVE) Then
298 &apos; Including Subdirectories
299 sTmpText = sTmpText &amp; sSumInclusiveSubDir &amp; sCRLF
300 End If
302 sTmpText = sTmpText &amp; sSumSaveDocuments &amp; sCRLF
303 sTmpText = sTmpText &amp; ConvertFromUrl(Applications(i,SBDOCTARGET)) &amp; sCRLF
304 sTmpText = sTmpText &amp; sCRLF
305 End If
306 Next i
307 MakeSummaryString = sTmpText
308 End Function
311 Sub FillStep_Summary()
312 ImportDialogArea.Title = sTitle
313 With ImportDialog
314 .SummaryTextbox.Text = MakeSummaryString()
315 .cmdGoOn.Enabled = .SummaryTextbox.Text &lt;&gt; &quot;&quot;
316 .cmdGoOn.Label = sBeginButton
317 .SummaryHeaderLabel.Label = sSummaryHeader
318 .Step = 3
319 End With
320 ImportDialogArea.GetControl(&quot;SummaryHeaderLabel&quot;).SetFocus()
321 End Sub
324 Sub FillStep_Progress()
325 With ImportDialog
326 .cmdBack.Enabled = False
327 .cmdGoOn.Enabled = False
328 .hlnProgress.Label = sProgressPage_1
329 .LabelRetrieval.FontWeight = com.sun.star.awt.FontWeight.BOLD
330 .LabelRetrieval.Label = sProgressPage_2
331 .LabelCurProgress.Label = sProgressPage_3
332 .LabelCurDocumentRetrieval.Label = &quot;&quot;
333 .LabelCurTemplateRetrieval.Label = &quot;&quot;
334 .LabelCurDocument.Label = &quot;&quot;
335 .Step = 4
336 End With
337 ImportDialogArea.GetControl(&quot;LabelRetrieval&quot;).SetFocus()
338 If ImportDialog.chkLogfile.State = 1 Then
339 ImportDialog.cmdShowLogFile.DefaultButton = True
340 End If
341 End Sub
344 Sub SetupMSConfiguration()
345 iApplSection = 0
346 Wizardmode = SBMICROSOFTMODE
347 MaxApplCount = 3
348 ApplCount = 3
349 &apos; chkTemplatePath-Captions
350 GetApplResourceArray(1009 + iApplSection, ApplCount, sTemplateCheckBox())
351 &apos; DocumentCheckbox- Captions
352 GetApplResourceArray(1009 + iApplSection + ApplCount, ApplCount, sDocumentCheckBox())
354 sKeyName(0) = &quot;Software\Microsoft\Office\8.0\Word\Options&quot;
355 sKeyName(1) = &quot;Software\Microsoft\Office\8.0\Excel\Microsoft Excel&quot;
356 sKeyName(2) = &quot;Software\Microsoft\Office\8.0\PowerPoint\Recent Folder List\Default&quot;
358 sValueName(0) = &quot;DOC-PATH&quot;
359 sValueName(1) = &quot;DefaultPath&quot;
360 sValueName(2) = &quot;&quot;
362 &apos; See definition of Filtername-Array about meaning of fields
363 MSFilterName(0,0) = &quot;doc|docx|docm&quot;
364 MSFilterName(0,1) = &quot;writer8|writer8|writer8&quot;
365 MSFilterName(0,2) = &quot;odt&quot;
366 MSFilterName(0,3) = sMSDocumentCheckBox(0)
367 MSFilterName(0,4) = &quot;Word&quot;
370 MSFilterName(1,0) = &quot;xls|xlsx|xlsm&quot;
371 MSFilterName(1,1) = &quot;calc8|calc8|calc8&quot;
372 MSFilterName(1,2) = &quot;ods&quot;
373 MSFilterName(1,3) = sMSDocumentCheckBox(1)
374 MSFilterName(1,4) = &quot;Excel&quot;
376 MSFilterName(2,0) = &quot;ppt|pps|pptx|pptm|ppsx|ppsm&quot;
377 MSFilterName(2,1) = &quot;impress8|impress8|impress8|impress8|impress8|impress8&quot;
378 MSFilterName(2,2) = &quot;odp|odp&quot;
379 MSFilterName(2,3) = sMSDocumentCheckBox(2)
380 MSFilterName(2,4) = &quot;PowerPoint&quot;
382 MSFilterName(3,0) = &quot;dot|dotx|dotm&quot;
383 MSFilterName(3,1) = &quot;writer8_template|writer8_template|writer8_template&quot;
384 MSFilterName(3,2) = &quot;ott&quot;
385 MSFilterName(3,3) = sMSTemplateCheckBox(0)
386 MSFilterName(3,4) = &quot;Word&quot;
388 MSFilterName(4,0) = &quot;xlt|xltx|xltm&quot;
389 MSFilterName(4,1) = &quot;calc8_template|calc8_template|calc8_template&quot;
390 MSFilterName(4,2) = &quot;ots&quot;
391 MSFilterName(4,3) = sMSTemplateCheckBox(1)
392 MSFilterName(4,4) = &quot;Excel&quot;
394 MSFilterName(5,0) = &quot;pot|potx|potm&quot;
395 MSFilterName(5,1) = &quot;impress8_template|impress8_template|impress8_template&quot;
396 MSFilterName(5,2) = &quot;otp&quot;
397 MSFilterName(5,3) = sMSTemplateCheckBox(2)
398 MSFilterName(5,4) = &quot;PowerPoint&quot;
399 End Sub
403 &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;
404 &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;
406 &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 ) },
407 &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 ) },
408 &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 ) },
410 &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 ) },
411 &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 ) },
413 &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 ) },
414 &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 ) },
416 &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 ) },
417 &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 ) },
418 &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 ) },
420 &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 ) },
422 &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 ) },
423 &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 ) },
424 &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 ) },
426 &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 ) },
427 &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 ) },
428 &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 ) },
430 &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 ) },
431 &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 ) },
432 &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 ) },
435 Sub SetupXMLConfiguration()
436 iApplSection = 1000
437 Wizardmode = SBXMLMODE
438 ApplCount = 4
439 MaxApplCount = 4
440 XMLTemplateList = Array(&quot;vor&quot;, &quot;sti&quot;, &quot;stw&quot; , &quot;stc&quot; , &quot;std&quot;)
441 &apos; chkTemplatePath-Captions
442 GetApplResourceArray(1009 + iApplSection, ApplCount, sTemplateCheckBox())
443 &apos; DocumentCheckbox- Captions
444 GetApplResourceArray(1009 + iApplSection + ApplCount, ApplCount, sDocumentCheckBox())
446 XMLFilterName(0,0) = &quot;sdw|sxw&quot;
447 XMLFilterName(0,1) = &quot;writer8|writer8&quot;
448 XMLFilterName(0,2) = &quot;odt|odt&quot;
449 XMLFilterName(0,3) = sDocumentCheckBox(0)
451 XMLFilterName(1,0) = &quot;sdc|sxc&quot;
452 XMLFilterName(1,1) = &quot;calc8|calc8&quot;
453 XMLFilterName(1,2) = &quot;ods|ods&quot;
454 XMLFilterName(1,3) = sDocumentCheckBox(1)
456 If oFactoryKey.HasByName(&quot;com.sun.star.drawing.DrawingDocument&quot;) and oFactoryKey.HasByName(&quot;com.sun.star.presentation.PresentationDocument&quot;) Then
457 XMLFilterName(2,0) = &quot;sdd|sda|sxi|sxd&quot;
458 XMLFilterName(2,1) = &quot;impress8|draw8|impress8|draw8&quot;
459 XMLFilterName(2,2) = &quot;odp|odg|odp|odg&quot;
460 Elseif oFactoryKey.HasByName(&quot;com.sun.star.drawing.DrawingDocument&quot;) Then
461 XMLFilterName(2,0) = &quot;sda|sxd&quot;
462 XMLFilterName(2,1) = &quot;draw8|draw8&quot;
463 XMLFilterName(2,2) = &quot;odg|odg&quot;
464 Elseif oFactoryKey.HasByName(&quot;com.sun.star.presentation.PresentationDocument&quot;) Then
465 XMLFilterName(2,0) = &quot;sdd|sxi&quot;
466 XMLFilterName(2,1) = &quot;impress8|impress8&quot;
467 XMLFilterName(2,2) = &quot;odp|odp&quot;
468 End If
469 XMLFilterName(2,3) = sDocumentCheckBox(2)
472 XMLFilterName(3,0) = &quot;smf|sxm&quot;
473 XMLFilterName(3,1) = &quot;math8|math8&quot;
474 XMLFilterName(3,2) = &quot;odf|odf&quot;
475 XMLFilterName(3,3) = sDocumentCheckBox(3)
477 XMLFilterName(4,0) = &quot;application/x-openoffice-starwriter|application/vnd.stardivision.writer/web|application/vnd.sun.xml.writer|application/vnd.sun.xml.writerweb&quot;
478 XMLFilterName(4,1) = &quot;writer8_template|writerweb8_writer_template|writer8_template|writerweb8_writer_template&quot;
479 XMLFilterName(4,2) = &quot;ott|oth|ott|oth&quot;
480 XMLFilterName(4,3) = sTemplateCheckBox(0)
483 XMLFilterName(5,0) = &quot;application/x-openoffice-starcalc|application/vnd.sun.xml.calc&quot;
484 XMLFilterName(5,1) = &quot;calc8_template|calc8_template&quot;
485 XMLFilterName(5,2) = &quot;ots|ots&quot;
486 XMLFilterName(5,3) = sTemplateCheckBox(1)
488 &apos; due to bug #108942# impress templates of the version 4.0 have to be handled in a special way because their mimetype
489 &apos; falsely points to the draw application.
490 If oFactoryKey.HasByName(&quot;com.sun.star.drawing.DrawingDocument&quot;) and oFactoryKey.HasByName(&quot;com.sun.star.presentation.PresentationDocument&quot;) Then
491 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;
492 XMLFilterName(6,1) = &quot;impress8_template|impress8_template|draw8_template|impress8_template|draw8_template&quot;
493 XMLFilterName(6,2) = &quot;otp|otp|otg|otp|otg&quot;
494 Elseif oFactoryKey.HasByName(&quot;com.sun.star.drawing.DrawingDocument&quot;) Then
495 XMLFilterName(6,0) = &quot;application/x-openoffice-stardraw|application/vnd.sun.xml.draw&quot;
496 XMLFilterName(6,1) = &quot;draw8_template|draw8_template&quot;
497 XMLFilterName(6,2) = &quot;otg|otg&quot;
498 Elseif oFactoryKey.HasByName(&quot;com.sun.star.presentation.PresentationDocument&quot;) Then
499 XMLFilterName(6,0) = &quot;application/x-openoffice-starimpress|application/x-openoffice-stardraw-40|application/vnd.sun.xml.impress&quot;
500 XMLFilterName(6,1) = &quot;impress8_template|impress8_template|impress8_template&quot;
501 XMLFilterName(6,2) = &quot;otp|otp|otp&quot;
502 End If
503 XMLFilterName(6,3) = sTemplateCheckBox(2)
505 If oFactoryKey.HasByName(&quot;com.sun.star.text.GlobalDocument&quot;) Then
506 XMLFilterName(7,0) = &quot;sgl|sxg&quot;
507 XMLFilterName(7,1) = &quot;writerglobal8|writerglobal8&quot;
508 XMLFilterName(7,2) = &quot;odm|odm&quot;
509 XMLFilterName(7,3) = sTemplateCheckBox(3)
510 End If
511 End Sub
514 Function CheckControlPath(oCheckbox as Object, oTextBox as Object, ByVal bDoEnable as Boolean)
515 Dim sPath as String
516 If Not bDoEnable Then
517 CheckControlPath = False
518 ElseIf oCheckbox.State = 0 Then
519 CheckControlPath = True
520 Else
521 sPath = ConvertToUrl(Trim(oTextBox.Text)
522 CheckControlPath = oUcb.Exists(sPath)
523 End If
524 End Function
527 Function CheckInputPaths() as Boolean
528 Dim bChangePage as Boolean
529 bChangePage = CheckTextBoxPath(ImportDialog.txtTemplateImportPath, True, False, sTitle, False)
530 bChangePage = CheckTextBoxPath(ImportDialog.txtTemplateExportPath, bChangePage, True, sTitle, False)
531 bChangePage = CheckTextBoxPath(ImportDialog.txtDocumentImportPath, bChangePage, False, sTitle, False)
532 bChangePage = CheckTextBoxPath(ImportDialog.txtDocumentExportPath, bChangePage, True, sTitle, False)
533 CheckInputPaths = bChangePage
534 End Function
537 Function CheckTextBoxPath(oTextBox as Object, ByVal bCheck as Boolean, bCreateNew as Boolean, sTitle as String, bgetResources as Boolean) as Boolean
538 Dim iCreate as Integer
539 Dim sQueryMessage as String
540 Dim sUrlPath as String
541 Dim sMessageNoDir as String
542 Dim sShowPath as String
543 Dim oLocUcb as Object
544 oLocUcb = createUnoService(&quot;com.sun.star.ucb.SimpleFileAccess&quot;)
545 If bGetResources Then
546 If InitResources(&quot;ImportWizard&quot;,&quot;imp&quot;) then
547 sNoDirCreation = GetResText(1050)
548 sMsgDirNotThere = GetResText(1051)
549 sQueryForNewCreation = GetResText(1052)
550 Else
551 CheckTextBoxPath() = False
552 Exit Function
553 End If
554 End If
555 If oTextBox.Enabled Then
556 If bCheck Then
557 sShowPath = oTextBox.Text
558 sUrlPath = ConvertToUrl(sShowPath)
559 If Not oLocUcb.Exists(sUrlPath) Then
560 If Not bCreateNew Then
561 &apos; Sourcedirectories must be existing, Targetdirectories may be created new
562 sQueryMessage = ReplaceString(sMsgDirNotThere, sShowPath,&quot;%1&quot;)
563 Msgbox(sQueryMessage,16,sTitle)
564 CheckTextBoxPath() = False
565 Exit Function
566 Else
567 sQueryMessage = ReplaceString(sMsgDirNotThere, sShowPath,&quot;%1&quot;)
568 sQueryMessage = sQueryMessage &amp; Chr(13) &amp; sQueryForNewCreation
569 iCreate = Msgbox (sQueryMessage, 36, sTitle)
570 If iCreate = 6 Then
571 On Local Error Goto NOVALIDPATH
572 CreateFolder(sUrlPath)
573 If Not oLocUcb.Exists(sUrlPath) Then
574 Goto NOVALIDPATH
575 End If
576 Else
577 CheckTextBoxPath() = False
578 Exit Function
579 End If
580 End If
581 End If
582 CheckTextBoxPath() = True
583 Else
584 CheckTextBoxPath() = False
585 End If
586 Else
587 CheckTextBoxPath() = True
588 End If
589 Exit Function
590 NOVALIDPATH:
591 sMessageNoDir = ReplaceString(sNoDirCreation, sShowPath, &quot;%1&quot;)
592 Msgbox(sMessageNoDir, 16, sTitle)
593 CheckTextBoxPath() = False
594 End Function
597 Sub InitializeProgressPage(oDialog as Object)
598 oDialog.LabelRetrieval.FontWeight = com.sun.star.awt.FontWeight.NORMAL
599 oDialog.LabelCurProgress.FontWeight = com.sun.star.awt.FontWeight.BOLD
600 End Sub
603 Sub SetProgressDisplay(AbsFound as Integer)
604 ImportDialog.LabelRetrieval.Label = sProgressPage_2 &amp; &quot; &quot; &amp; ReplaceString(sProgressPage_5, Str(AbsFound) &amp; &quot; &quot;, &quot;%1&quot;)
605 ImportDialog.LabelCurDocumentRetrieval.Label = sProgressFound &amp; &quot; &quot; &amp; CStr(AbsDocuFound) &amp; &quot; &quot; &amp; sProgressMoreDocs
606 ImportDialog.LabelCurTemplateRetrieval.Label = sProgressFound &amp; &quot; &quot; &amp; CStr(AbsTemplateFound) &amp; &quot; &quot; &amp; sProgressMoreTemplates
607 End Sub
609 Sub TakoverFolderName(aEvent as Object)
610 Dim RefControlName as String
611 Dim oRefControl
612 RefControlName = aEvent.Source.Model.Tag
613 oRefControl = ImportDialogArea.GetControl(RefControlName)
614 GetFolderName(oRefControl.Model)
615 ToggleNextButton()
616 End Sub
619 Sub FinalizeDialogButtons()
620 ImportDialog.cmdShowLogFile.Enabled = ((Isnull(oLogDocument) = False) And (ImportDialog.chkLogfile.State = 1))
621 ImportDialog.cmdCancel.Enabled = False
622 ImportDialog.cmdGoOn.Label = sCloseButton
623 ImportDialog.cmdGoOn.Enabled = True
624 End Sub
625 </script:module>