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