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