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