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 =
"MS
"
14 Public Const SBXMLMODE =
"SO
"
15 ' 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
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
'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
41 ' XMLFilterName(x,
0) =
"sdw
" ' in documents we take the extensions; in SO-templates the appropriate Filtername
42 ' XMLFilterName(x,
1) =
"swriter: StarWriter
5.0" ' the filtername of the target-format
43 ' XMLFilterName(x,
2) =
"sxw
" ' 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 ' Application-relating Data are stored in this Array
60 ' according to the following structure:
61 ' Applications(X,
0) = True/False (Application is to be converted)
62 ' Applications(X,
1) = True/False (Documents are to be converted)
63 ' Applications(X,
2) = True/False (Including Subdirectories)
64 ' Applications(X,
3) =
"File:///...
" (SourceUrl of the documents)
65 ' Applications(X,
4) =
"File///:...
" (TargetUrl of the documents)
66 ' Applications(X,
5) = True/False (Templates are to be converted)
67 ' Applications(X,
6) = True/False (Including Subdirectories)
68 ' Applications(X,
7) =
"File:///...
" (SourceUrl of the templates)
69 ' Applications(X,
8) =
"File:///...
" (TargetUrl of the templates)
70 ' Applications(X,
9) =
0 (Key to the original Index of the Applications)
72 Public Const SBMAXEXTENSIONLENGTH =
15
75 Sub FillStep_Welcome()
77 ' bDoKeepApplValues = False
78 ImportDialogArea.Title = sTitle
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
101 If Not oFactoryKey.hasbyName(
"com.sun.star.text.TextDocument
") Then
102 .chkLogfile.State =
0
103 .chkLogfile.Enabled = False
106 CheckModuleInstallation()
111 Sub FillStep_InputPaths(OfficeIndex as Integer, bStartup as Boolean)
113 Dim oNullObject as Object
114 If bStartup And Not bDoKeepApplValues Then
115 If ImportDialog.optMSDocuments.State =
1 Then
116 SetupMSConfiguration()
118 SetupXMLConfiguration()
120 FillUpApplicationList()
122 CurOffice = OfficeIndex
123 Index = Applications(CurOffice,SBAPPLKEY)
124 InitializePathsforCurrentApplication(Index)
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
& " -
" & sSODocumentCheckBox(Index)
135 ImportDialogArea.Title = sTitle
& " -
" & sMSDocumentCheckBox(Index)
137 If WizardMode = SBXMLMODE AND Index =
3 Then
138 ' 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))
145 .chkTemplatePath.Enabled = True
146 .chkDocumentPath.Enabled = True
147 .chkTemplatePath.Label = sTemplateCheckbox(Index)
148 .chkDocumentPath.Label = sDocumentCheckbox(Index)
149 .hlnTemplates.Label = sProgressMoreTemplates
151 .chkTemplatePath.State = Abs(Applications(CurOffice,SBTEMPLCONVERT))
152 ToggleInputPaths(oNullObject,
"Template
")
153 ToggleInputPaths(oNullObject,
"Document
")
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
161 ImportDialogArea.GetControl(
"chkTemplatePath
").SetFocus()
166 Sub FillUpApplicationList()
169 Dim BoolValue as Boolean
170 If Not bDoKeepApplValues Then
172 For i =
1 To ApplCount
173 If ImportDialog.optMSDocuments.State =
1 Then
174 BoolValue = ImportDialogArea.GetControl(
"chkMSApplication
" & i).Model.State =
1
176 BoolValue = ImportDialogArea.GetControl(
"chkSOApplication
" & i).Model.State =
1
178 Applications(a,SBAPPLCONVERT) = BoolValue
179 Applications(a,SBDOCCONVERT) = BoolValue
180 Applications(a,SBDOCRECURSIVE) = BoolValue
181 Applications(a,SBDOCSOURCE) =
"" ' GetDefaultPath(i)
182 Applications(a,SBDOCTARGET) =
"" ' SOWorkPath
183 Applications(a,SBTEMPLCONVERT) = BoolValue
184 Applications(a,SBTEMPLRECURSIVE) = BoolValue
185 Applications(a,SBTEMPLSOURCE) =
"" ' GetTemplateDefaultPath(i)
186 Applications(a,SBTEMPLTARGET) =
"" ' GetTargetTemplatePath(i)
187 Applications(a,SBAPPLKEY) = i-
1
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))
205 Sub AssignPathToCurrentApplication(Index as Integer, NewPath as String)
206 If Applications(CurOffice,Index) =
"" Then
207 If CurOffice
> 0 Then
208 Applications(CurOffice,Index) = Applications(CurOffice-
1,Index)
210 Applications(CurOffice,Index) = NewPath
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)
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
235 sLocDocType = sDocType
237 With ImportDialogArea
238 oCheckBox = .GetControl(
"chk
" & sLocDocType
& "Path
").Model
239 bDoEnable = oCheckBox.State =
1 And oCheckBox.Enabled
240 .GetControl(
"lbl
" & sLocDocType
& "Import
").Model.Enabled = bDoEnable
241 .GetControl(
"lbl
" & sLocDocType
& "Export
").Model.Enabled = bDoEnable
242 .GetControl(
"txt
" & sLocDocType
& "ImportPath
").Model.Enabled = bDoEnable
243 .GetControl(
"txt
" & sLocDocType
& "ExportPath
").Model.Enabled = bDoEnable
244 .GetControl(
"chk
" & sLocDocType
& "SearchSubDir
").Model.Enabled = bDoEnable
245 .GetControl(
"cmd
" & sLocDocType
& "Import
").Model.Enabled = bDoEnable
246 .GetControl(
"cmd
" & sLocDocType
& "Export
").Model.Enabled = bDoEnable
252 Function MakeSummaryString()
253 Dim sTmpText As String
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 ' Templates are to be converted
262 sAddText =
""
263 If WizardMode = SBMICROSOFTMODE Then
264 sAddText = sSumMSTemplates(Index)
& sCRLF
266 sAddText = sSumSOTemplates(Index)
& sCRLF
268 sTmpText = sTmpText
& sAddText
& ConvertFromUrl(Applications(i,SBTEMPLSOURCE))
& sCRLF
269 If Applications(i,SBTEMPLRECURSIVE) Then
270 ' Including Subdirectories
271 sTmpText = sTmpText
& sSumInclusiveSubDir
& sCRLF
273 sTmpText = sTmpText
& sSumSaveDocuments
& sCRLF
274 sTmpText = sTmpText
& ConvertFromUrl(Applications(i,SBTEMPLTARGET))
& sCRLF
275 sTmpText = sTmpText
& sCRLF
278 If Applications(i,SBDOCCONVERT) Then
279 ' Documents are to be converted
280 If WizardMode = SBMICROSOFTMODE Then
281 sAddText = sSumMSDocuments(Index)
& sCRLF
283 sAddText = sSumSODocuments(Index)
& sCRLF
285 sTmpText = sTmpText
& sAddText
& ConvertFromUrl(Applications(i,SBDOCSOURCE))
& sCRLF
287 If Applications(i,SBDOCRECURSIVE) Then
288 ' Including Subdirectories
289 sTmpText = sTmpText
& sSumInclusiveSubDir
& sCRLF
292 sTmpText = sTmpText
& sSumSaveDocuments
& sCRLF
293 sTmpText = sTmpText
& ConvertFromUrl(Applications(i,SBDOCTARGET))
& sCRLF
294 sTmpText = sTmpText
& sCRLF
297 MakeSummaryString = sTmpText
301 Sub FillStep_Summary()
302 ImportDialogArea.Title = sTitle
304 .SummaryTextbox.Text = MakeSummaryString()
305 .cmdGoOn.Enabled = .SummaryTextbox.Text
<> ""
306 .cmdGoOn.Label = sBeginButton
307 .SummaryHeaderLabel.Label = sSummaryHeader
310 ImportDialogArea.GetControl(
"SummaryHeaderLabel
").SetFocus()
314 Sub FillStep_Progress()
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 =
""
323 .LabelCurTemplateRetrieval.Label =
""
324 .LabelCurDocument.Label =
""
327 ImportDialogArea.GetControl(
"LabelRetrieval
").SetFocus()
328 If ImportDialog.chkLogfile.State =
1 Then
329 ImportDialog.cmdShowLogFile.DefaultButton = True
334 Sub GetFilterTracingLogPath(i as Integer, Index as Integer)
335 Dim aNodePath(
0) as new com.sun.star.beans.PropertyValue
342 aNodePath(
0).Name =
"nodepath
"
343 aNodePath(
0).Value =
"org.openoffice.Office.Tracing
"
344 oFilterService = createUnoService(
"com.sun.star.util.FilterTracer
")
345 bFilterTracingAvailable = Not IsNull(oFilterService)
346 If bFilterTracingAvailable Then
347 oMasterkey = GetRegistryKeyContent(
"org.openoffice.Office.Tracing/
")
348 If oMasterKey.hasbyName(
"Import
") Then
349 oImportKey = GetRegistryKeyContent(
"org.openoffice.Office.Tracing/Import
")
350 bMSApplFilterTracingAvailable(i) = CheckMSImportAvailability(oImportkey, MSFiltername(Index,
4), FilterTracingLogPath(i), bTakeOverTargetName(i), bTakeOverPathName(i))
356 Function CheckMSImportAvailability(oImportkey, MSApplName as String, MSLogPath as String, bTakeOverTargetname as String, bTakeOverpathName as String) as Boolean
357 Dim bApplIsAvailable as Boolean
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 =
"")
368 bTakeOverPathName = (LocApplPath =
"")
369 MSLogPath = LocApplPath
& "/
" & LocApplName
& ".log
"
371 CheckMSImportAvailability() = bApplIsAvailable
376 Sub SetupMSConfiguration()
378 Wizardmode = SBMICROSOFTMODE
381 ' chkTemplatePath-Captions
382 GetApplResourceArray(
1009 + iApplSection, ApplCount, sTemplateCheckBox())
383 ' DocumentCheckbox- Captions
384 GetApplResourceArray(
1009 + iApplSection + ApplCount, ApplCount, sDocumentCheckBox())
386 sKeyName(
0) =
"Software\Microsoft\Office\
8.0\Word\Options
"
387 sKeyName(
1) =
"Software\Microsoft\Office\
8.0\Excel\Microsoft Excel
"
388 sKeyName(
2) =
"Software\Microsoft\Office\
8.0\PowerPoint\Recent Folder List\Default
"
390 sValueName(
0) =
"DOC-PATH
"
391 sValueName(
1) =
"DefaultPath
"
392 sValueName(
2) =
""
394 ' See definition of Filtername-Array about meaning of fields
395 MSFilterName(
0,
0) =
"doc
"
396 MSFilterName(
0,
1) =
"writer8
"
397 MSFilterName(
0,
2) =
"odt
"
398 MSFilterName(
0,
3) = sMSDocumentCheckBox(
0)
399 MSFilterName(
0,
4) =
"Word
"
402 MSFilterName(
1,
0) =
"xls
"
403 MSFilterName(
1,
1) =
"calc8
"
404 MSFilterName(
1,
2) =
"ods
"
405 MSFilterName(
1,
3) = sMSDocumentCheckBox(
1)
406 MSFilterName(
1,
4) =
"Excel
"
408 MSFilterName(
2,
0) =
"ppt|pps
"
409 MSFilterName(
2,
1) =
"impress8|impress8
"
410 MSFilterName(
2,
2) =
"odp|odp
"
411 MSFilterName(
2,
3) = sMSDocumentCheckBox(
2)
412 MSFilterName(
2,
4) =
"PowerPoint
"
414 MSFilterName(
3,
0) =
"dot
"
415 MSFilterName(
3,
1) =
"writer8_template
"
416 MSFilterName(
3,
2) =
"ott
"
417 MSFilterName(
3,
3) = sMSTemplateCheckBox(
0)
418 MSFilterName(
3,
4) =
"Word
"
420 MSFilterName(
4,
0) =
"xlt
"
421 MSFilterName(
4,
1) =
"calc8_template
"
422 MSFilterName(
4,
2) =
"ots
"
423 MSFilterName(
4,
3) = sMSTemplateCheckBox(
1)
424 MSFilterName(
4,
4) =
"Excel
"
426 MSFilterName(
5,
0) =
"pot
"
427 MSFilterName(
5,
1) =
"impress8_template
"
428 MSFilterName(
5,
2) =
"otp
"
429 MSFilterName(
5,
3) = sMSTemplateCheckBox(
2)
430 MSFilterName(
5,
4) =
"PowerPoint
"
435 ' 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
"
436 ' about the listed defined mimetypes that are required to define binary StarOffice templates that have for all applications the same extension
".vor
"
438 ' 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 ) },
439 ' 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 ) },
440 ' 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 ) },
442 ' 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 ) },
443 ' 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 ) },
445 ' 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 ) },
446 ' 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 ) },
448 ' 33 SOT_FORMATSTR_ID_STARDRAW*/ {
"application/x-openoffice-stardraw;windows_formatname=\
"StarDrawDocument\
"",
"StarDrawDocument
",
&::getCppuType( (const Sequence
< sal_Int8
>*)
0 ) },
449 ' 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 ) },
450 ' 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 ) },
452 ' 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 ) },
454 ' 37 SOT_FORMATSTR_ID_STARCALC*/ {
"application/x-openoffice-starcalc;windows_formatname=\
"StarCalcDocument\
"",
"StarCalcDocument
",
&::getCppuType( (const Sequence
< sal_Int8
>*)
0 ) },
455 ' 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 ) },
456 ' 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 ) },
458 ' 40 SOT_FORMATSTR_ID_STARCHART*/ {
"application/x-openoffice-starchart;windows_formatname=\
"StarChartDocument\
"",
"StarChartDocument
",
&::getCppuType( (const Sequence
< sal_Int8
>*)
0 ) },
459 ' 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 ) },
460 ' 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 ) },
462 ' 46 SOT_FORMATSTR_ID_STARMATH*/ {
"application/x-openoffice-starmath;windows_formatname=\
"StarMath\
"",
"StarMath
",
&::getCppuType( (const Sequence
< sal_Int8
>*)
0 ) },
463 ' 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 ) },
464 ' 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 ) },
467 Sub SetupXMLConfiguration()
469 Wizardmode = SBXMLMODE
472 XMLTemplateList = Array(
"vor
",
"sti
",
"stw
" ,
"stc
" ,
"std
")
473 ' chkTemplatePath-Captions
474 GetApplResourceArray(
1009 + iApplSection, ApplCount, sTemplateCheckBox())
475 ' DocumentCheckbox- Captions
476 GetApplResourceArray(
1009 + iApplSection + ApplCount, ApplCount, sDocumentCheckBox())
478 XMLFilterName(
0,
0) =
"sdw|sxw
"
479 XMLFilterName(
0,
1) =
"writer8|writer8
"
480 XMLFilterName(
0,
2) =
"odt|odt
"
481 XMLFilterName(
0,
3) = sDocumentCheckBox(
0)
483 XMLFilterName(
1,
0) =
"sdc|sxc
"
484 XMLFilterName(
1,
1) =
"calc8|calc8
"
485 XMLFilterName(
1,
2) =
"ods|ods
"
486 XMLFilterName(
1,
3) = sDocumentCheckBox(
1)
488 If oFactoryKey.HasByName(
"com.sun.star.drawing.DrawingDocument
") and oFactoryKey.HasByName(
"com.sun.star.presentation.PresentationDocument
") Then
489 XMLFilterName(
2,
0) =
"sdd|sda|sxi|sxd
"
490 XMLFilterName(
2,
1) =
"impress8|draw8|impress8|draw8
"
491 XMLFilterName(
2,
2) =
"odp|odg|odp|odg
"
492 Elseif oFactoryKey.HasByName(
"com.sun.star.drawing.DrawingDocument
") Then
493 XMLFilterName(
2,
0) =
"sda|sxd
"
494 XMLFilterName(
2,
1) =
"draw8|draw8
"
495 XMLFilterName(
2,
2) =
"odg|odg
"
496 Elseif oFactoryKey.HasByName(
"com.sun.star.presentation.PresentationDocument
") Then
497 XMLFilterName(
2,
0) =
"sdd|sxi
"
498 XMLFilterName(
2,
1) =
"impress8|impress8
"
499 XMLFilterName(
2,
2) =
"odp|odp
"
501 XMLFilterName(
2,
3) = sDocumentCheckBox(
2)
504 XMLFilterName(
3,
0) =
"smf|sxm
"
505 XMLFilterName(
3,
1) =
"math8|math8
"
506 XMLFilterName(
3,
2) =
"odf|odf
"
507 XMLFilterName(
3,
3) = sDocumentCheckBox(
3)
509 XMLFilterName(
4,
0) =
"application/x-openoffice-starwriter|application/vnd.stardivision.writer/web|application/vnd.sun.xml.writer|application/vnd.sun.xml.writerweb
"
510 XMLFilterName(
4,
1) =
"writer8_template|writerweb8_writer_template|writer8_template|writerweb8_writer_template
"
511 XMLFilterName(
4,
2) =
"ott|oth|ott|oth
"
512 XMLFilterName(
4,
3) = sTemplateCheckBox(
0)
515 XMLFilterName(
5,
0) =
"application/x-openoffice-starcalc|application/vnd.sun.xml.calc
"
516 XMLFilterName(
5,
1) =
"calc8_template|calc8_template
"
517 XMLFilterName(
5,
2) =
"ots|ots
"
518 XMLFilterName(
5,
3) = sTemplateCheckBox(
1)
520 ' due to bug #
108942# impress templates of the version
4.0 have to be handled in a special way because their mimetype
521 ' falsely points to the draw application.
522 If oFactoryKey.HasByName(
"com.sun.star.drawing.DrawingDocument
") and oFactoryKey.HasByName(
"com.sun.star.presentation.PresentationDocument
") Then
523 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
"
524 XMLFilterName(
6,
1) =
"impress8_template|impress8_template|draw8_template|impress8_template|draw8_template
"
525 XMLFilterName(
6,
2) =
"otp|otp|otg|otp|otg
"
526 Elseif oFactoryKey.HasByName(
"com.sun.star.drawing.DrawingDocument
") Then
527 XMLFilterName(
6,
0) =
"application/x-openoffice-stardraw|application/vnd.sun.xml.draw
"
528 XMLFilterName(
6,
1) =
"draw8_template|draw8_template
"
529 XMLFilterName(
6,
2) =
"otg|otg
"
530 Elseif oFactoryKey.HasByName(
"com.sun.star.presentation.PresentationDocument
") Then
531 XMLFilterName(
6,
0) =
"application/x-openoffice-starimpress|application/x-openoffice-stardraw-
40|application/vnd.sun.xml.impress
"
532 XMLFilterName(
6,
1) =
"impress8_template|impress8_template|impress8_template
"
533 XMLFilterName(
6,
2) =
"otp|otp|otp
"
535 XMLFilterName(
6,
3) = sTemplateCheckBox(
2)
537 If oFactoryKey.HasByName(
"com.sun.star.text.GlobalDocument
") Then
538 XMLFilterName(
7,
0) =
"sgl|sxg
"
539 XMLFilterName(
7,
1) =
"writerglobal8|writerglobal8
"
540 XMLFilterName(
7,
2) =
"odm|odm
"
541 XMLFilterName(
7,
3) = sTemplateCheckBox(
3)
546 Function CheckControlPath(oCheckbox as Object, oTextBox as Object, ByVal bDoEnable as Boolean)
548 If Not bDoEnable Then
549 CheckControlPath = False
550 ElseIf oCheckbox.State =
0 Then
551 CheckControlPath = True
553 sPath = ConvertToUrl(Trim(oTextBox.Text)
554 CheckControlPath = oUcb.Exists(sPath)
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
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(
"com.sun.star.ucb.SimpleFileAccess
")
577 If bGetResources Then
578 If InitResources(
"ImportWizard
",
"imp
") then
579 sNoDirCreation = GetResText(
1050)
580 sMsgDirNotThere = GetResText(
1051)
581 sQueryForNewCreation = GetResText(
1052)
583 CheckTextBoxPath() = False
587 If oTextBox.Enabled Then
589 sShowPath = oTextBox.Text
590 sUrlPath = ConvertToUrl(sShowPath)
591 If Not oLocUcb.Exists(sUrlPath) Then
592 If Not bCreateNew Then
593 ' Sourcedirectories must be existing, Targetdirectories may be created new
594 sQueryMessage = ReplaceString(sMsgDirNotThere, sShowPath,
"%
1")
595 Msgbox(sQueryMessage,
16,sTitle)
596 CheckTextBoxPath() = False
599 sQueryMessage = ReplaceString(sMsgDirNotThere, sShowPath,
"%
1")
600 sQueryMessage = sQueryMessage
& Chr(
13)
& sQueryForNewCreation
601 iCreate = Msgbox (sQueryMessage,
36, sTitle)
603 On Local Error Goto NOVALIDPATH
604 CreateFolder(sUrlPath)
605 If Not oLocUcb.Exists(sUrlPath) Then
609 CheckTextBoxPath() = False
614 CheckTextBoxPath() = True
616 CheckTextBoxPath() = False
619 CheckTextBoxPath() = True
623 sMessageNoDir = ReplaceString(sNoDirCreation, sShowPath,
"%
1")
624 Msgbox(sMessageNoDir,
16, sTitle)
625 CheckTextBoxPath() = False
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
635 Sub SetProgressDisplay(AbsFound as Integer)
636 ImportDialog.LabelRetrieval.Label = sProgressPage_2
& " " & ReplaceString(sProgressPage_5, Str(AbsFound)
& " ",
"%
1")
637 ImportDialog.LabelCurDocumentRetrieval.Label = sProgressFound
& " " & CStr(AbsDocuFound)
& " " & sProgressMoreDocs
638 ImportDialog.LabelCurTemplateRetrieval.Label = sProgressFound
& " " & CStr(AbsTemplateFound)
& " " & sProgressMoreTemplates
641 Sub TakoverFolderName(aEvent as Object)
642 Dim RefControlName as String
644 RefControlName = aEvent.Source.Model.Tag
645 oRefControl = ImportDialogArea.GetControl(RefControlName)
646 GetFolderName(oRefControl.Model)
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