1 <?xml version=
"1.0" encoding=
"UTF-8"?>
2 <!DOCTYPE script:module PUBLIC
"-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
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 .
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 =
"MS
"
30 Public Const SBXMLMODE =
"SO
"
31 ' 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
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
'Number of different formats
53 ' XMLFilterName(x,
0) =
"sdw
" ' in documents we take the extensions; in SO-templates the appropriate Filtername
54 ' XMLFilterName(x,
1) =
"swriter: StarWriter
5.0" ' the filtername of the target-format
55 ' XMLFilterName(x,
2) =
"sxw
" ' 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 ' Application-relating Data are stored in this Array
72 ' according to the following structure:
73 ' Applications(X,
0) = True/False (Application is to be converted)
74 ' Applications(X,
1) = True/False (Documents are to be converted)
75 ' Applications(X,
2) = True/False (Including Subdirectories)
76 ' Applications(X,
3) =
"File:///...
" (SourceUrl of the documents)
77 ' Applications(X,
4) =
"File///:...
" (TargetUrl of the documents)
78 ' Applications(X,
5) = True/False (Templates are to be converted)
79 ' Applications(X,
6) = True/False (Including Subdirectories)
80 ' Applications(X,
7) =
"File:///...
" (SourceUrl of the templates)
81 ' Applications(X,
8) =
"File:///...
" (TargetUrl of the templates)
82 ' Applications(X,
9) =
0 (Key to the original Index of the Applications)
84 Public Const SBMAXEXTENSIONLENGTH =
15
87 Sub FillStep_Welcome()
89 ' bDoKeepApplValues = False
90 ImportDialogArea.Title = sTitle
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
112 If Not oFactoryKey.hasbyName(
"com.sun.star.text.TextDocument
") Then
113 .chkLogfile.State =
0
114 .chkLogfile.Enabled = False
117 CheckModuleInstallation()
122 Sub FillStep_InputPaths(OfficeIndex as Integer, bStartup as Boolean)
124 Dim oNullObject as Object
125 If bStartup And Not bDoKeepApplValues Then
126 If ImportDialog.optMSDocuments.State =
1 Then
127 SetupMSConfiguration()
129 SetupXMLConfiguration()
131 FillUpApplicationList()
133 CurOffice = OfficeIndex
134 Index = Applications(CurOffice,SBAPPLKEY)
135 InitializePathsforCurrentApplication(Index)
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
& " -
" & sSODocumentCheckBox(Index)
146 ImportDialogArea.Title = sTitle
& " -
" & sMSDocumentCheckBox(Index)
148 If WizardMode = SBXMLMODE AND Index =
3 Then
149 ' 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))
156 .chkTemplatePath.Enabled = True
157 .chkDocumentPath.Enabled = True
158 .chkTemplatePath.Label = sTemplateCheckbox(Index)
159 .chkDocumentPath.Label = sDocumentCheckbox(Index)
160 .hlnTemplates.Label = sProgressMoreTemplates
162 .chkTemplatePath.State = Abs(Applications(CurOffice,SBTEMPLCONVERT))
163 ToggleInputPaths(oNullObject,
"Template
")
164 ToggleInputPaths(oNullObject,
"Document
")
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
172 ImportDialogArea.GetControl(
"chkTemplatePath
").SetFocus()
177 Sub FillUpApplicationList()
180 Dim BoolValue as Boolean
181 If Not bDoKeepApplValues Then
183 For i =
1 To ApplCount
184 If ImportDialog.optMSDocuments.State =
1 Then
185 BoolValue = ImportDialogArea.GetControl(
"chkMSApplication
" & i).Model.State =
1
187 BoolValue = ImportDialogArea.GetControl(
"chkSOApplication
" & i).Model.State =
1
189 Applications(a,SBAPPLCONVERT) = BoolValue
190 Applications(a,SBDOCCONVERT) = BoolValue
191 Applications(a,SBDOCRECURSIVE) = BoolValue
192 Applications(a,SBDOCSOURCE) =
"" ' GetDefaultPath(i)
193 Applications(a,SBDOCTARGET) =
"" ' SOWorkPath
194 Applications(a,SBTEMPLCONVERT) = BoolValue
195 Applications(a,SBTEMPLRECURSIVE) = BoolValue
196 Applications(a,SBTEMPLSOURCE) =
"" ' GetTemplateDefaultPath(i)
197 Applications(a,SBTEMPLTARGET) =
"" ' GetTargetTemplatePath(i)
198 Applications(a,SBAPPLKEY) = i-
1
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))
216 Sub AssignPathToCurrentApplication(Index as Integer, NewPath as String)
217 If Applications(CurOffice,Index) =
"" Then
218 If CurOffice
> 0 Then
219 Applications(CurOffice,Index) = Applications(CurOffice-
1,Index)
221 Applications(CurOffice,Index) = NewPath
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)
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
246 sLocDocType = sDocType
248 With ImportDialogArea
249 oCheckBox = .GetControl(
"chk
" & sLocDocType
& "Path
").Model
250 bDoEnable = oCheckBox.State =
1 And oCheckBox.Enabled
251 .GetControl(
"lbl
" & sLocDocType
& "Import
").Model.Enabled = bDoEnable
252 .GetControl(
"lbl
" & sLocDocType
& "Export
").Model.Enabled = bDoEnable
253 .GetControl(
"txt
" & sLocDocType
& "ImportPath
").Model.Enabled = bDoEnable
254 .GetControl(
"txt
" & sLocDocType
& "ExportPath
").Model.Enabled = bDoEnable
255 .GetControl(
"chk
" & sLocDocType
& "SearchSubDir
").Model.Enabled = bDoEnable
256 .GetControl(
"cmd
" & sLocDocType
& "Import
").Model.Enabled = bDoEnable
257 .GetControl(
"cmd
" & sLocDocType
& "Export
").Model.Enabled = bDoEnable
263 Function MakeSummaryString()
264 Dim sTmpText As String
267 Dim sAddText as String
268 For i =
0 To ApplCount -
1
269 Index = Applications(i,SBAPPLKEY)
270 If Applications(i,SBTEMPLCONVERT) Then
271 ' Templates are to be converted
272 sAddText =
""
273 If WizardMode = SBMICROSOFTMODE Then
274 sAddText = sSumMSTemplates(Index)
& sCRLF
276 sAddText = sSumSOTemplates(Index)
& sCRLF
278 sTmpText = sTmpText
& sAddText
& ConvertFromUrl(Applications(i,SBTEMPLSOURCE))
& sCRLF
279 If Applications(i,SBTEMPLRECURSIVE) Then
280 ' Including Subdirectories
281 sTmpText = sTmpText
& sSumInclusiveSubDir
& sCRLF
283 sTmpText = sTmpText
& sSumSaveDocuments
& sCRLF
284 sTmpText = sTmpText
& ConvertFromUrl(Applications(i,SBTEMPLTARGET))
& sCRLF
285 sTmpText = sTmpText
& sCRLF
288 If Applications(i,SBDOCCONVERT) Then
289 ' Documents are to be converted
290 If WizardMode = SBMICROSOFTMODE Then
291 sAddText = sSumMSDocuments(Index)
& sCRLF
293 sAddText = sSumSODocuments(Index)
& sCRLF
295 sTmpText = sTmpText
& sAddText
& ConvertFromUrl(Applications(i,SBDOCSOURCE))
& sCRLF
297 If Applications(i,SBDOCRECURSIVE) Then
298 ' Including Subdirectories
299 sTmpText = sTmpText
& sSumInclusiveSubDir
& sCRLF
302 sTmpText = sTmpText
& sSumSaveDocuments
& sCRLF
303 sTmpText = sTmpText
& ConvertFromUrl(Applications(i,SBDOCTARGET))
& sCRLF
304 sTmpText = sTmpText
& sCRLF
307 MakeSummaryString = sTmpText
311 Sub FillStep_Summary()
312 ImportDialogArea.Title = sTitle
314 .SummaryTextbox.Text = MakeSummaryString()
315 .cmdGoOn.Enabled = .SummaryTextbox.Text
<> ""
316 .cmdGoOn.Label = sBeginButton
317 .SummaryHeaderLabel.Label = sSummaryHeader
320 ImportDialogArea.GetControl(
"SummaryHeaderLabel
").SetFocus()
324 Sub FillStep_Progress()
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 =
""
333 .LabelCurTemplateRetrieval.Label =
""
334 .LabelCurDocument.Label =
""
337 ImportDialogArea.GetControl(
"LabelRetrieval
").SetFocus()
338 If ImportDialog.chkLogfile.State =
1 Then
339 ImportDialog.cmdShowLogFile.DefaultButton = True
344 Sub SetupMSConfiguration()
346 Wizardmode = SBMICROSOFTMODE
349 ' chkTemplatePath-Captions
350 GetApplResourceArray(
1009 + iApplSection, ApplCount, sTemplateCheckBox())
351 ' DocumentCheckbox- Captions
352 GetApplResourceArray(
1009 + iApplSection + ApplCount, ApplCount, sDocumentCheckBox())
354 sKeyName(
0) =
"Software\Microsoft\Office\
8.0\Word\Options
"
355 sKeyName(
1) =
"Software\Microsoft\Office\
8.0\Excel\Microsoft Excel
"
356 sKeyName(
2) =
"Software\Microsoft\Office\
8.0\PowerPoint\Recent Folder List\Default
"
358 sValueName(
0) =
"DOC-PATH
"
359 sValueName(
1) =
"DefaultPath
"
360 sValueName(
2) =
""
362 ' See definition of Filtername-Array about meaning of fields
363 MSFilterName(
0,
0) =
"doc|docx|docm
"
364 MSFilterName(
0,
1) =
"writer8|writer8|writer8
"
365 MSFilterName(
0,
2) =
"odt
"
366 MSFilterName(
0,
3) = sMSDocumentCheckBox(
0)
367 MSFilterName(
0,
4) =
"Word
"
370 MSFilterName(
1,
0) =
"xls|xlsx|xlsm
"
371 MSFilterName(
1,
1) =
"calc8|calc8|calc8
"
372 MSFilterName(
1,
2) =
"ods
"
373 MSFilterName(
1,
3) = sMSDocumentCheckBox(
1)
374 MSFilterName(
1,
4) =
"Excel
"
376 MSFilterName(
2,
0) =
"ppt|pps|pptx|pptm|ppsx|ppsm
"
377 MSFilterName(
2,
1) =
"impress8|impress8|impress8|impress8|impress8|impress8
"
378 MSFilterName(
2,
2) =
"odp|odp
"
379 MSFilterName(
2,
3) = sMSDocumentCheckBox(
2)
380 MSFilterName(
2,
4) =
"PowerPoint
"
382 MSFilterName(
3,
0) =
"dot|dotx|dotm
"
383 MSFilterName(
3,
1) =
"writer8_template|writer8_template|writer8_template
"
384 MSFilterName(
3,
2) =
"ott
"
385 MSFilterName(
3,
3) = sMSTemplateCheckBox(
0)
386 MSFilterName(
3,
4) =
"Word
"
388 MSFilterName(
4,
0) =
"xlt|xltx|xltm
"
389 MSFilterName(
4,
1) =
"calc8_template|calc8_template|calc8_template
"
390 MSFilterName(
4,
2) =
"ots
"
391 MSFilterName(
4,
3) = sMSTemplateCheckBox(
1)
392 MSFilterName(
4,
4) =
"Excel
"
394 MSFilterName(
5,
0) =
"pot|potx|potm
"
395 MSFilterName(
5,
1) =
"impress8_template|impress8_template|impress8_template
"
396 MSFilterName(
5,
2) =
"otp
"
397 MSFilterName(
5,
3) = sMSTemplateCheckBox(
2)
398 MSFilterName(
5,
4) =
"PowerPoint
"
403 ' 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
"
404 ' about the listed defined mimetypes that are required to define binary StarOffice templates that have for all applications the same extension
".vor
"
406 ' 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 ) },
407 ' 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 ) },
408 ' 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 ) },
410 ' 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 ) },
411 ' 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 ) },
413 ' 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 ) },
414 ' 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 ) },
416 ' 33 SOT_FORMATSTR_ID_STARDRAW*/ {
"application/x-openoffice-stardraw;windows_formatname=\
"StarDrawDocument\
"",
"StarDrawDocument
",
&::getCppuType( (const Sequence
< sal_Int8
>*)
0 ) },
417 ' 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 ) },
418 ' 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 ) },
420 ' 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 ) },
422 ' 37 SOT_FORMATSTR_ID_STARCALC*/ {
"application/x-openoffice-starcalc;windows_formatname=\
"StarCalcDocument\
"",
"StarCalcDocument
",
&::getCppuType( (const Sequence
< sal_Int8
>*)
0 ) },
423 ' 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 ) },
424 ' 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 ) },
426 ' 40 SOT_FORMATSTR_ID_STARCHART*/ {
"application/x-openoffice-starchart;windows_formatname=\
"StarChartDocument\
"",
"StarChartDocument
",
&::getCppuType( (const Sequence
< sal_Int8
>*)
0 ) },
427 ' 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 ) },
428 ' 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 ) },
430 ' 46 SOT_FORMATSTR_ID_STARMATH*/ {
"application/x-openoffice-starmath;windows_formatname=\
"StarMath\
"",
"StarMath
",
&::getCppuType( (const Sequence
< sal_Int8
>*)
0 ) },
431 ' 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 ) },
432 ' 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 ) },
435 Sub SetupXMLConfiguration()
437 Wizardmode = SBXMLMODE
440 XMLTemplateList = Array(
"vor
",
"sti
",
"stw
" ,
"stc
" ,
"std
")
441 ' chkTemplatePath-Captions
442 GetApplResourceArray(
1009 + iApplSection, ApplCount, sTemplateCheckBox())
443 ' DocumentCheckbox- Captions
444 GetApplResourceArray(
1009 + iApplSection + ApplCount, ApplCount, sDocumentCheckBox())
446 XMLFilterName(
0,
0) =
"sdw|sxw
"
447 XMLFilterName(
0,
1) =
"writer8|writer8
"
448 XMLFilterName(
0,
2) =
"odt|odt
"
449 XMLFilterName(
0,
3) = sDocumentCheckBox(
0)
451 XMLFilterName(
1,
0) =
"sdc|sxc
"
452 XMLFilterName(
1,
1) =
"calc8|calc8
"
453 XMLFilterName(
1,
2) =
"ods|ods
"
454 XMLFilterName(
1,
3) = sDocumentCheckBox(
1)
456 If oFactoryKey.HasByName(
"com.sun.star.drawing.DrawingDocument
") and oFactoryKey.HasByName(
"com.sun.star.presentation.PresentationDocument
") Then
457 XMLFilterName(
2,
0) =
"sdd|sda|sxi|sxd
"
458 XMLFilterName(
2,
1) =
"impress8|draw8|impress8|draw8
"
459 XMLFilterName(
2,
2) =
"odp|odg|odp|odg
"
460 Elseif oFactoryKey.HasByName(
"com.sun.star.drawing.DrawingDocument
") Then
461 XMLFilterName(
2,
0) =
"sda|sxd
"
462 XMLFilterName(
2,
1) =
"draw8|draw8
"
463 XMLFilterName(
2,
2) =
"odg|odg
"
464 Elseif oFactoryKey.HasByName(
"com.sun.star.presentation.PresentationDocument
") Then
465 XMLFilterName(
2,
0) =
"sdd|sxi
"
466 XMLFilterName(
2,
1) =
"impress8|impress8
"
467 XMLFilterName(
2,
2) =
"odp|odp
"
469 XMLFilterName(
2,
3) = sDocumentCheckBox(
2)
472 XMLFilterName(
3,
0) =
"smf|sxm
"
473 XMLFilterName(
3,
1) =
"math8|math8
"
474 XMLFilterName(
3,
2) =
"odf|odf
"
475 XMLFilterName(
3,
3) = sDocumentCheckBox(
3)
477 XMLFilterName(
4,
0) =
"application/x-openoffice-starwriter|application/vnd.stardivision.writer/web|application/vnd.sun.xml.writer|application/vnd.sun.xml.writerweb
"
478 XMLFilterName(
4,
1) =
"writer8_template|writerweb8_writer_template|writer8_template|writerweb8_writer_template
"
479 XMLFilterName(
4,
2) =
"ott|oth|ott|oth
"
480 XMLFilterName(
4,
3) = sTemplateCheckBox(
0)
483 XMLFilterName(
5,
0) =
"application/x-openoffice-starcalc|application/vnd.sun.xml.calc
"
484 XMLFilterName(
5,
1) =
"calc8_template|calc8_template
"
485 XMLFilterName(
5,
2) =
"ots|ots
"
486 XMLFilterName(
5,
3) = sTemplateCheckBox(
1)
488 ' due to bug #
108942# impress templates of the version
4.0 have to be handled in a special way because their mimetype
489 ' falsely points to the draw application.
490 If oFactoryKey.HasByName(
"com.sun.star.drawing.DrawingDocument
") and oFactoryKey.HasByName(
"com.sun.star.presentation.PresentationDocument
") Then
491 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
"
492 XMLFilterName(
6,
1) =
"impress8_template|impress8_template|draw8_template|impress8_template|draw8_template
"
493 XMLFilterName(
6,
2) =
"otp|otp|otg|otp|otg
"
494 Elseif oFactoryKey.HasByName(
"com.sun.star.drawing.DrawingDocument
") Then
495 XMLFilterName(
6,
0) =
"application/x-openoffice-stardraw|application/vnd.sun.xml.draw
"
496 XMLFilterName(
6,
1) =
"draw8_template|draw8_template
"
497 XMLFilterName(
6,
2) =
"otg|otg
"
498 Elseif oFactoryKey.HasByName(
"com.sun.star.presentation.PresentationDocument
") Then
499 XMLFilterName(
6,
0) =
"application/x-openoffice-starimpress|application/x-openoffice-stardraw-
40|application/vnd.sun.xml.impress
"
500 XMLFilterName(
6,
1) =
"impress8_template|impress8_template|impress8_template
"
501 XMLFilterName(
6,
2) =
"otp|otp|otp
"
503 XMLFilterName(
6,
3) = sTemplateCheckBox(
2)
505 If oFactoryKey.HasByName(
"com.sun.star.text.GlobalDocument
") Then
506 XMLFilterName(
7,
0) =
"sgl|sxg
"
507 XMLFilterName(
7,
1) =
"writerglobal8|writerglobal8
"
508 XMLFilterName(
7,
2) =
"odm|odm
"
509 XMLFilterName(
7,
3) = sTemplateCheckBox(
3)
514 Function CheckControlPath(oCheckbox as Object, oTextBox as Object, ByVal bDoEnable as Boolean)
516 If Not bDoEnable Then
517 CheckControlPath = False
518 ElseIf oCheckbox.State =
0 Then
519 CheckControlPath = True
521 sPath = ConvertToUrl(Trim(oTextBox.Text)
522 CheckControlPath = oUcb.Exists(sPath)
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
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(
"com.sun.star.ucb.SimpleFileAccess
")
545 If bGetResources Then
546 If InitResources(
"ImportWizard
",
"imp
") then
547 sNoDirCreation = GetResText(
1050)
548 sMsgDirNotThere = GetResText(
1051)
549 sQueryForNewCreation = GetResText(
1052)
551 CheckTextBoxPath() = False
555 If oTextBox.Enabled Then
557 sShowPath = oTextBox.Text
558 sUrlPath = ConvertToUrl(sShowPath)
559 If Not oLocUcb.Exists(sUrlPath) Then
560 If Not bCreateNew Then
561 ' Sourcedirectories must be existing, Targetdirectories may be created new
562 sQueryMessage = ReplaceString(sMsgDirNotThere, sShowPath,
"%
1")
563 Msgbox(sQueryMessage,
16,sTitle)
564 CheckTextBoxPath() = False
567 sQueryMessage = ReplaceString(sMsgDirNotThere, sShowPath,
"%
1")
568 sQueryMessage = sQueryMessage
& Chr(
13)
& sQueryForNewCreation
569 iCreate = Msgbox (sQueryMessage,
36, sTitle)
571 On Local Error Goto NOVALIDPATH
572 CreateFolder(sUrlPath)
573 If Not oLocUcb.Exists(sUrlPath) Then
577 CheckTextBoxPath() = False
582 CheckTextBoxPath() = True
584 CheckTextBoxPath() = False
587 CheckTextBoxPath() = True
591 sMessageNoDir = ReplaceString(sNoDirCreation, sShowPath,
"%
1")
592 Msgbox(sMessageNoDir,
16, sTitle)
593 CheckTextBoxPath() = False
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
603 Sub SetProgressDisplay(AbsFound as Integer)
604 ImportDialog.LabelRetrieval.Label = sProgressPage_2
& " " & ReplaceString(sProgressPage_5, Str(AbsFound)
& " ",
"%
1")
605 ImportDialog.LabelCurDocumentRetrieval.Label = sProgressFound
& " " & CStr(AbsDocuFound)
& " " & sProgressMoreDocs
606 ImportDialog.LabelCurTemplateRetrieval.Label = sProgressFound
& " " & CStr(AbsTemplateFound)
& " " & sProgressMoreTemplates
609 Sub TakoverFolderName(aEvent as Object)
610 Dim RefControlName as String
612 RefControlName = aEvent.Source.Model.Tag
613 oRefControl = ImportDialogArea.GetControl(RefControlName)
614 GetFolderName(oRefControl.Model)
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