1cdf0e10cSrcweir<?xml version="1.0" encoding="UTF-8"?>
2cdf0e10cSrcweir<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
3*3e02b54dSAndrew Rist<!--***********************************************************
4*3e02b54dSAndrew Rist *
5*3e02b54dSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
6*3e02b54dSAndrew Rist * or more contributor license agreements.  See the NOTICE file
7*3e02b54dSAndrew Rist * distributed with this work for additional information
8*3e02b54dSAndrew Rist * regarding copyright ownership.  The ASF licenses this file
9*3e02b54dSAndrew Rist * to you under the Apache License, Version 2.0 (the
10*3e02b54dSAndrew Rist * "License"); you may not use this file except in compliance
11*3e02b54dSAndrew Rist * with the License.  You may obtain a copy of the License at
12*3e02b54dSAndrew Rist *
13*3e02b54dSAndrew Rist *   http://www.apache.org/licenses/LICENSE-2.0
14*3e02b54dSAndrew Rist *
15*3e02b54dSAndrew Rist * Unless required by applicable law or agreed to in writing,
16*3e02b54dSAndrew Rist * software distributed under the License is distributed on an
17*3e02b54dSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
18*3e02b54dSAndrew Rist * KIND, either express or implied.  See the License for the
19*3e02b54dSAndrew Rist * specific language governing permissions and limitations
20*3e02b54dSAndrew Rist * under the License.
21*3e02b54dSAndrew Rist *
22*3e02b54dSAndrew Rist ***********************************************************-->
23cdf0e10cSrcweir<script:module xmlns:script="http://openoffice.org/2000/script" script:name="ModuleControls" script:language="StarBasic">Option Explicit
24cdf0e10cSrcweir
25cdf0e10cSrcweirPublic DlgOverwrite as Object
26cdf0e10cSrcweirPublic Const SBOVERWRITEUNDEFINED as Integer = 0
27cdf0e10cSrcweirPublic Const SBOVERWRITECANCEL as Integer = 2
28cdf0e10cSrcweirPublic Const SBOVERWRITEQUERY as Integer = 7
29cdf0e10cSrcweirPublic Const SBOVERWRITEALWAYS as Integer = 6
30cdf0e10cSrcweirPublic Const SBOVERWRITENEVER as Integer = 8
31cdf0e10cSrcweirPublic iGeneralOverwrite as Integer
32cdf0e10cSrcweir
33cdf0e10cSrcweir
34cdf0e10cSrcweir
35cdf0e10cSrcweir&apos; Accepts the name of a control and returns the respective control model as object
36cdf0e10cSrcweir&apos; The Container can either be a whole document or a specific sheet of a Calc-Document
37cdf0e10cSrcweir&apos; &apos;CName&apos; is the name of the Control
38cdf0e10cSrcweirFunction getControlModel(oContainer as Object, CName as String)
39cdf0e10cSrcweirDim aForm, oForms as Object
40cdf0e10cSrcweirDim i as Integer
41cdf0e10cSrcweir	oForms = oContainer.Drawpage.GetForms
42cdf0e10cSrcweir	For i = 0 To oForms.Count-1
43cdf0e10cSrcweir		aForm = oForms.GetbyIndex(i)
44cdf0e10cSrcweir		If aForm.HasByName(CName) Then
45cdf0e10cSrcweir			GetControlModel = aForm.GetbyName(CName)
46cdf0e10cSrcweir			Exit Function
47cdf0e10cSrcweir		End If
48cdf0e10cSrcweir	Next i
49cdf0e10cSrcweir	Msgbox(&quot;No Control with the name &apos;&quot; &amp; CName &amp; &quot;&apos; found&quot; , 16, GetProductName())
50cdf0e10cSrcweirEnd Function
51cdf0e10cSrcweir
52cdf0e10cSrcweir
53cdf0e10cSrcweir
54cdf0e10cSrcweir&apos; Gets the Shape of a Control( e. g. to reset the size or Position of the control
55cdf0e10cSrcweir&apos; Parameters:
56cdf0e10cSrcweir&apos; The &apos;oContainer&apos; is the Document or a specific sheet of a Calc - Document
57cdf0e10cSrcweir&apos; &apos;CName&apos; is the Name of the Control
58cdf0e10cSrcweirFunction GetControlShape(oContainer as Object,CName as String)
59cdf0e10cSrcweirDim i as integer
60cdf0e10cSrcweirDim aShape as Object
61cdf0e10cSrcweir	For i = 0 to oContainer.DrawPage.Count-1
62cdf0e10cSrcweir		aShape = oContainer.DrawPage(i)
63cdf0e10cSrcweir		If HasUnoInterfaces(aShape, &quot;com.sun.star.drawing.XControlShape&quot;) then
64cdf0e10cSrcweir			If ashape.Control.Name = CName then
65cdf0e10cSrcweir				GetControlShape = aShape
66cdf0e10cSrcweir				exit Function
67cdf0e10cSrcweir			End If
68cdf0e10cSrcweir		End If
69cdf0e10cSrcweir	Next
70cdf0e10cSrcweirEnd Function
71cdf0e10cSrcweir
72cdf0e10cSrcweir
73cdf0e10cSrcweir&apos; Returns the View of a Control
74cdf0e10cSrcweir&apos; Parameters:
75cdf0e10cSrcweir&apos; The &apos;oContainer&apos; is the Document or a specific sheet of a Calc - Document
76cdf0e10cSrcweir&apos; The &apos;oController&apos; is always directly attached to the Document
77cdf0e10cSrcweir&apos; &apos;CName&apos; is the Name of the Control
78cdf0e10cSrcweirFunction getControlView(oContainer , oController as Object, CName as String) as Object
79cdf0e10cSrcweirDim aForm, oForms, oControlModel as Object
80cdf0e10cSrcweirDim i as Integer
81cdf0e10cSrcweir	oForms = oContainer.DrawPage.Forms
82cdf0e10cSrcweir	For i = 0 To oForms.Count-1
83cdf0e10cSrcweir		aForm = oforms.GetbyIndex(i)
84cdf0e10cSrcweir		If aForm.HasByName(CName) Then
85cdf0e10cSrcweir			oControlModel = aForm.GetbyName(CName)
86cdf0e10cSrcweir			GetControlView = oController.GetControl(oControlModel)
87cdf0e10cSrcweir			Exit Function
88cdf0e10cSrcweir		End If
89cdf0e10cSrcweir	Next i
90cdf0e10cSrcweir	Msgbox(&quot;No Control with the name &apos;&quot; &amp; CName &amp; &quot;&apos; found&quot; , 16, GetProductName())
91cdf0e10cSrcweirEnd Function
92cdf0e10cSrcweir
93cdf0e10cSrcweir
94cdf0e10cSrcweir
95cdf0e10cSrcweir&apos; Parameters:
96cdf0e10cSrcweir&apos; The &apos;oContainer&apos; is the Document or a specific sheet of a Calc - Document
97cdf0e10cSrcweir&apos; &apos;CName&apos; is the Name of the Control
98cdf0e10cSrcweirFunction DisposeControl(oContainer as Object, CName as String) as Boolean
99cdf0e10cSrcweirDim aControl as Object
100cdf0e10cSrcweir
101cdf0e10cSrcweir	aControl = GetControlModel(oContainer,CName)
102cdf0e10cSrcweir	If not IsNull(aControl) Then
103cdf0e10cSrcweir		aControl.Dispose()
104cdf0e10cSrcweir		DisposeControl = True
105cdf0e10cSrcweir	Else
106cdf0e10cSrcweir		DisposeControl = False
107cdf0e10cSrcweir	End If
108cdf0e10cSrcweirEnd Function
109cdf0e10cSrcweir
110cdf0e10cSrcweir
111cdf0e10cSrcweir&apos; Returns a sequence of a group of controls like option buttons or checkboxes
112cdf0e10cSrcweir&apos; The &apos;oContainer&apos; is the Document or a specific sheet of a Calc - Document
113cdf0e10cSrcweir&apos; &apos;sGroupName&apos; is the Name of the Controlgroup
114cdf0e10cSrcweirFunction GetControlGroupModel(oContainer as Object, sGroupName as String )
115cdf0e10cSrcweirDim aForm, oForms As Object
116cdf0e10cSrcweirDim aControlModel() As Object
117cdf0e10cSrcweirDim i as integer
118cdf0e10cSrcweir
119cdf0e10cSrcweir	oForms = oContainer.DrawPage.Forms
120cdf0e10cSrcweir	For i = 0 To oForms.Count-1
121cdf0e10cSrcweir		aForm = oForms(i)
122cdf0e10cSrcweir		If aForm.HasbyName(sGroupName) Then
123cdf0e10cSrcweir			aForm.GetGroupbyName(sGroupName,aControlModel)
124cdf0e10cSrcweir			GetControlGroupModel = aControlModel
125cdf0e10cSrcweir			Exit Function
126cdf0e10cSrcweir		End If
127cdf0e10cSrcweir	Next i
128cdf0e10cSrcweir	Msgbox(&quot;No Controlgroup with the name &apos;&quot; &amp; sGroupName &amp; &quot;&apos; found&quot; , 16, GetProductName())
129cdf0e10cSrcweirEnd Function
130cdf0e10cSrcweir
131cdf0e10cSrcweir
132cdf0e10cSrcweir&apos; Returns the Referencevalue of a group of e.g. option buttons or check boxes
133cdf0e10cSrcweir&apos; &apos;oControlGroup&apos; is a sequence of the Control objects
134cdf0e10cSrcweirFunction GetRefValue(oControlGroup() as Object)
135cdf0e10cSrcweirDim i as Integer
136cdf0e10cSrcweir	For i = 0 To Ubound(oControlGroup())
137cdf0e10cSrcweir&apos;		oControlGroup(i).DefaultState = oControlGroup(i).State
138cdf0e10cSrcweir		If oControlGroup(i).State Then
139cdf0e10cSrcweir			GetRefValue = oControlGroup(i).RefValue
140cdf0e10cSrcweir			exit Function
141cdf0e10cSrcweir		End If
142cdf0e10cSrcweir	Next
143cdf0e10cSrcweir	GetRefValue() = -1
144cdf0e10cSrcweirEnd Function
145cdf0e10cSrcweir
146cdf0e10cSrcweir
147cdf0e10cSrcweirFunction GetRefValueOfControlGroup(oContainer as Object, GroupName as String)
148cdf0e10cSrcweirDim oOptGroup() as Object
149cdf0e10cSrcweirDim iRef as Integer
150cdf0e10cSrcweir	oOptGroup() = GetControlGroupModel(oContainer, GroupName)
151cdf0e10cSrcweir	iRef = GetRefValue(oOptGroup())
152cdf0e10cSrcweir	GetRefValueofControlGroup = iRef
153cdf0e10cSrcweirEnd Function
154cdf0e10cSrcweir
155cdf0e10cSrcweir
156cdf0e10cSrcweirFunction GetOptionGroupValue(oContainer as Object, OptGroupName as String) as Boolean
157cdf0e10cSrcweirDim oRulesOptions() as Object
158cdf0e10cSrcweir	oRulesOptions() = GetControlGroupModel(oContainer, OptGroupName)
159cdf0e10cSrcweir	GetOptionGroupValue = oRulesOptions(0).State
160cdf0e10cSrcweirEnd Function
161cdf0e10cSrcweir
162cdf0e10cSrcweir
163cdf0e10cSrcweir
164cdf0e10cSrcweirFunction WriteOptValueToCell(oSheet as Object, OptGroupName as String, iCol as Integer, iRow as Integer) as Boolean
165cdf0e10cSrcweirDim bOptValue as Boolean
166cdf0e10cSrcweirDim oCell as Object
167cdf0e10cSrcweir	bOptValue = GetOptionGroupValue(oSheet, OptGroupName)
168cdf0e10cSrcweir	oCell = oSheet.GetCellByPosition(iCol, iRow)
169cdf0e10cSrcweir	oCell.SetValue(ABS(CInt(bOptValue)))
170cdf0e10cSrcweir	WriteOptValueToCell() = bOptValue
171cdf0e10cSrcweirEnd Function
172cdf0e10cSrcweir
173cdf0e10cSrcweir
174cdf0e10cSrcweirFunction LoadDialog(Libname as String, DialogName as String, Optional oLibContainer)
175cdf0e10cSrcweirDim oLib as Object
176cdf0e10cSrcweirDim oLibDialog as Object
177cdf0e10cSrcweirDim oRuntimeDialog as Object
178cdf0e10cSrcweir	If IsMissing(oLibContainer ) then
179cdf0e10cSrcweir		oLibContainer = DialogLibraries
180cdf0e10cSrcweir	End If
181cdf0e10cSrcweir	oLibContainer.LoadLibrary(LibName)
182cdf0e10cSrcweir	oLib = oLibContainer.GetByName(Libname)
183cdf0e10cSrcweir	oLibDialog = oLib.GetByName(DialogName)
184cdf0e10cSrcweir	oRuntimeDialog = CreateUnoDialog(oLibDialog)
185cdf0e10cSrcweir	LoadDialog() = oRuntimeDialog
186cdf0e10cSrcweirEnd Function
187cdf0e10cSrcweir
188cdf0e10cSrcweir
189cdf0e10cSrcweirSub GetFolderName(oRefModel as Object)
190cdf0e10cSrcweirDim oFolderDialog as Object
191cdf0e10cSrcweirDim iAccept as Integer
192cdf0e10cSrcweirDim sPath as String
193cdf0e10cSrcweirDim InitPath as String
194cdf0e10cSrcweirDim RefControlName as String
195cdf0e10cSrcweirDim oUcb as object
196cdf0e10cSrcweir	&apos;Note: The following services have to be called in the following order
197cdf0e10cSrcweir	&apos; because otherwise Basic does not remove the FileDialog Service
198cdf0e10cSrcweir	oFolderDialog = CreateUnoService(&quot;com.sun.star.ui.dialogs.FolderPicker&quot;)
199cdf0e10cSrcweir	oUcb = createUnoService(&quot;com.sun.star.ucb.SimpleFileAccess&quot;)
200cdf0e10cSrcweir	InitPath = ConvertToUrl(oRefModel.Text)
201cdf0e10cSrcweir	If InitPath = &quot;&quot; Then
202cdf0e10cSrcweir		InitPath = GetPathSettings(&quot;Work&quot;)
203cdf0e10cSrcweir	End If
204cdf0e10cSrcweir	If oUcb.Exists(InitPath) Then
205cdf0e10cSrcweir		oFolderDialog.SetDisplayDirectory(InitPath)
206cdf0e10cSrcweir	End If
207cdf0e10cSrcweir	iAccept = oFolderDialog.Execute()
208cdf0e10cSrcweir	If iAccept = 1 Then
209cdf0e10cSrcweir		sPath = oFolderDialog.GetDirectory()
210cdf0e10cSrcweir		If oUcb.Exists(sPath) Then
211cdf0e10cSrcweir			oRefModel.Text = ConvertFromUrl(sPath)
212cdf0e10cSrcweir		End If
213cdf0e10cSrcweir	End If
214cdf0e10cSrcweirEnd Sub
215cdf0e10cSrcweir
216cdf0e10cSrcweir
217cdf0e10cSrcweirSub GetFileName(oRefModel as Object, Filternames())
218cdf0e10cSrcweirDim oFileDialog as Object
219cdf0e10cSrcweirDim iAccept as Integer
220cdf0e10cSrcweirDim sPath as String
221cdf0e10cSrcweirDim InitPath as String
222cdf0e10cSrcweirDim RefControlName as String
223cdf0e10cSrcweirDim oUcb as object
224cdf0e10cSrcweir&apos;Dim ListAny(0)
225cdf0e10cSrcweir	&apos;Note: The following services have to be called in the following order
226cdf0e10cSrcweir	&apos; because otherwise Basic does not remove the FileDialog Service
227cdf0e10cSrcweir	oFileDialog = CreateUnoService(&quot;com.sun.star.ui.dialogs.FilePicker&quot;)
228cdf0e10cSrcweir	oUcb = createUnoService(&quot;com.sun.star.ucb.SimpleFileAccess&quot;)
229cdf0e10cSrcweir	&apos;ListAny(0) = com.sun.star.ui.dialogs.TemplateDescription.FILEOPEN_SIMPLE
230cdf0e10cSrcweir	&apos;oFileDialog.initialize(ListAny())
231cdf0e10cSrcweir	AddFiltersToDialog(FilterNames(), oFileDialog)
232cdf0e10cSrcweir	InitPath = ConvertToUrl(oRefModel.Text)
233cdf0e10cSrcweir	If InitPath = &quot;&quot; Then
234cdf0e10cSrcweir		InitPath = GetPathSettings(&quot;Work&quot;)
235cdf0e10cSrcweir	End If
236cdf0e10cSrcweir	If oUcb.Exists(InitPath) Then
237cdf0e10cSrcweir		oFileDialog.SetDisplayDirectory(InitPath)
238cdf0e10cSrcweir	End If
239cdf0e10cSrcweir	iAccept = oFileDialog.Execute()
240cdf0e10cSrcweir	If iAccept = 1 Then
241cdf0e10cSrcweir		sPath = oFileDialog.Files(0)
242cdf0e10cSrcweir		If oUcb.Exists(sPath) Then
243cdf0e10cSrcweir			oRefModel.Text = ConvertFromUrl(sPath)
244cdf0e10cSrcweir		End If
245cdf0e10cSrcweir	End If
246cdf0e10cSrcweir	oFileDialog.Dispose()
247cdf0e10cSrcweirEnd Sub
248cdf0e10cSrcweir
249cdf0e10cSrcweir
250cdf0e10cSrcweirFunction StoreDocument(oDocument as Object, FilterNames() as String, DefaultName as String, DisplayDirectory as String, Optional iAddProcedure as Integer) as String
251cdf0e10cSrcweirDim NoArgs() as New com.sun.star.beans.PropertyValue
252cdf0e10cSrcweirDim oStoreProperties(0) as New com.sun.star.beans.PropertyValue
253cdf0e10cSrcweirDim oStoreDialog as Object
254cdf0e10cSrcweirDim iAccept as Integer
255cdf0e10cSrcweirDim sPath as String
256cdf0e10cSrcweirDim ListAny(0) as Long
257cdf0e10cSrcweirDim UIFilterName as String
258cdf0e10cSrcweirDim FilterName as String
259cdf0e10cSrcweirDim FilterIndex as Integer
260cdf0e10cSrcweir	ListAny(0) = com.sun.star.ui.dialogs.TemplateDescription.FILESAVE_AUTOEXTENSION_PASSWORD
261cdf0e10cSrcweir	oStoreDialog = CreateUnoService(&quot;com.sun.star.ui.dialogs.FilePicker&quot;)
262cdf0e10cSrcweir	oStoreDialog.Initialize(ListAny())
263cdf0e10cSrcweir	AddFiltersToDialog(FilterNames(), oStoreDialog)
264cdf0e10cSrcweir	oStoreDialog.SetDisplayDirectory(DisplayDirectory)
265cdf0e10cSrcweir	oStoreDialog.SetDefaultName(DefaultName)
266cdf0e10cSrcweir	oStoreDialog.setValue(com.sun.star.ui.dialogs.ExtendedFilePickerElementIds.CHECKBOX_AUTOEXTENSION,0, true)
267cdf0e10cSrcweir
268cdf0e10cSrcweir	iAccept = oStoreDialog.Execute()
269cdf0e10cSrcweir	If iAccept = 1 Then
270cdf0e10cSrcweir		sPath = oStoreDialog.Files(0)
271cdf0e10cSrcweir		UIFilterName = oStoreDialog.GetCurrentFilter()
272cdf0e10cSrcweir		FilterIndex = IndexInArray(UIFilterName, FilterNames())
273cdf0e10cSrcweir		FilterName = FilterNames(FilterIndex,2)
274cdf0e10cSrcweir		If Not IsMissing(iAddProcedure) Then
275cdf0e10cSrcweir			Select Case iAddProcedure
276cdf0e10cSrcweir				Case 1
277cdf0e10cSrcweir					CommitLastDocumentChanges(sPath)
278cdf0e10cSrcweir			End Select
279cdf0e10cSrcweir		End If
280cdf0e10cSrcweir		On Local Error Goto NOSAVING
281cdf0e10cSrcweir		If FilterName = &quot;&quot;  Then
282cdf0e10cSrcweir			&apos; Todo: Catch the case that a document that has to be overwritten is writeportected (e.g. it is open)
283cdf0e10cSrcweir			oDocument.StoreAsUrl(sPath, NoArgs())
284cdf0e10cSrcweir		Else
285cdf0e10cSrcweir			oStoreProperties(0).Name = &quot;FilterName&quot;
286cdf0e10cSrcweir			oStoreProperties(0).Value = FilterName
287cdf0e10cSrcweir			oDocument.StoreAsUrl(sPath, oStoreProperties())
288cdf0e10cSrcweir		End If
289cdf0e10cSrcweir	End If
290cdf0e10cSrcweir	oStoreDialog.dispose()
291cdf0e10cSrcweir	StoreDocument() = sPath
292cdf0e10cSrcweir	Exit Function
293cdf0e10cSrcweirNOSAVING:
294cdf0e10cSrcweir	If Err &lt;&gt; 0 Then
295cdf0e10cSrcweir&apos;		Msgbox(&quot;Document cannot be saved under &apos;&quot; &amp; ConvertFromUrl(sPath) &amp; &quot;&apos;&quot;, 48, GetProductName())
296cdf0e10cSrcweir		sPath = &quot;&quot;
297cdf0e10cSrcweir		oStoreDialog.dispose()
298cdf0e10cSrcweir		Resume NOERROR
299cdf0e10cSrcweir		NOERROR:
300cdf0e10cSrcweir	End If
301cdf0e10cSrcweirEnd Function
302cdf0e10cSrcweir
303cdf0e10cSrcweir
304cdf0e10cSrcweirSub AddFiltersToDialog(FilterNames() as String, oDialog as Object)
305cdf0e10cSrcweirDim i as Integer
306cdf0e10cSrcweirDim MaxIndex as Integer
307cdf0e10cSrcweirDim ViewFiltername as String
308cdf0e10cSrcweirDim oProdNameAccess as Object
309cdf0e10cSrcweirDim sProdName as String
310cdf0e10cSrcweir	oProdNameAccess = GetRegistryKeyContent(&quot;org.openoffice.Setup/Product&quot;)
311cdf0e10cSrcweir	sProdName = oProdNameAccess.getByName(&quot;ooName&quot;)
312cdf0e10cSrcweir	MaxIndex = Ubound(FilterNames(), 1)
313cdf0e10cSrcweir	For i = 0 To MaxIndex
314cdf0e10cSrcweir		Filternames(i,0) = ReplaceString(Filternames(i,0), sProdName,&quot;%productname%&quot;)
315cdf0e10cSrcweir		oDialog.AppendFilter(FilterNames(i,0), FilterNames(i,1))
316cdf0e10cSrcweir	Next i
317cdf0e10cSrcweir	oDialog.SetCurrentFilter(FilterNames(0,0)
318cdf0e10cSrcweirEnd Sub
319cdf0e10cSrcweir
320cdf0e10cSrcweir
321cdf0e10cSrcweirSub SwitchMousePointer(oWindowPeer as Object, bDoEnable as Boolean)
322cdf0e10cSrcweirDim oWindowPointer as Object
323cdf0e10cSrcweir	oWindowPointer = CreateUnoService(&quot;com.sun.star.awt.Pointer&quot;)
324cdf0e10cSrcweir	If bDoEnable Then
325cdf0e10cSrcweir		oWindowPointer.SetType(com.sun.star.awt.SystemPointer.ARROW)
326cdf0e10cSrcweir	Else
327cdf0e10cSrcweir		oWindowPointer.SetType(com.sun.star.awt.SystemPointer.WAIT)
328cdf0e10cSrcweir	End If
329cdf0e10cSrcweir	oWindowPeer.SetPointer(oWindowPointer)
330cdf0e10cSrcweirEnd Sub
331cdf0e10cSrcweir
332cdf0e10cSrcweir
333cdf0e10cSrcweirSub ShowOverwriteAllDialog(FilePath as String, sTitle as String)
334cdf0e10cSrcweirDim QueryString as String
335cdf0e10cSrcweirDim LocRetValue as Integer
336cdf0e10cSrcweirDim lblYes as String
337cdf0e10cSrcweirDim lblNo as String
338cdf0e10cSrcweirDim lblYesToAll as String
339cdf0e10cSrcweirDim lblCancel as String
340cdf0e10cSrcweirDim OverwriteModel as Object
341cdf0e10cSrcweir	If InitResources(GetProductName(), &quot;dbw&quot;) Then
342cdf0e10cSrcweir		QueryString = GetResText(507)
343cdf0e10cSrcweir		QueryString = ReplaceString(QueryString, ConvertFromUrl(FilePath), &quot;&lt;PATH&gt;&quot;)
344cdf0e10cSrcweir		If Len(QueryString) &gt; 190 Then
345cdf0e10cSrcweir			QueryString = DeleteStr(QueryString, &quot;.&lt;BR&gt;&quot;)
346cdf0e10cSrcweir		End If
347cdf0e10cSrcweir		QueryString = ReplaceString(QueryString, chr(13), &quot;&lt;BR&gt;&quot;)
348cdf0e10cSrcweir		lblYes = GetResText(508)
349cdf0e10cSrcweir		lblYesToAll = GetResText(509)
350cdf0e10cSrcweir		lblNo = GetResText(510)
351cdf0e10cSrcweir		lblCancel = GetResText(511)
352cdf0e10cSrcweir		DlgOverwrite = LoadDialog(&quot;Tools&quot;, &quot;DlgOverwriteAll&quot;)
353cdf0e10cSrcweir		DlgOverwrite.Title = sTitle
354cdf0e10cSrcweir		OverwriteModel = DlgOverwrite.Model
355cdf0e10cSrcweir		OverwriteModel.cmdYes.Label = lblYes
356cdf0e10cSrcweir		OverwriteModel.cmdYesToAll.Label = lblYesToAll
357cdf0e10cSrcweir		OverwriteModel.cmdNo.Label = lblNo
358cdf0e10cSrcweir		OverwriteModel.cmdCancel.Label = lblCancel
359cdf0e10cSrcweir		OverwriteModel.lblQueryforSave.Label = QueryString
360cdf0e10cSrcweir		OverwriteModel.cmdNo.DefaultButton = True
361cdf0e10cSrcweir		DlgOverwrite.GetControl(&quot;cmdNo&quot;).SetFocus()
362cdf0e10cSrcweir		iGeneralOverwrite = 999
363cdf0e10cSrcweir		LocRetValue = DlgOverwrite.execute()
364cdf0e10cSrcweir		If iGeneralOverwrite = 999 Then
365cdf0e10cSrcweir			iGeneralOverwrite = SBOVERWRITECANCEL
366cdf0e10cSrcweir		End If
367cdf0e10cSrcweir		DlgOverwrite.dispose()
368cdf0e10cSrcweir	Else
369cdf0e10cSrcweir		iGeneralOverwrite = SBOVERWRITECANCEL
370cdf0e10cSrcweir	End If
371cdf0e10cSrcweirEnd Sub
372cdf0e10cSrcweir
373cdf0e10cSrcweir
374cdf0e10cSrcweirSub SetOVERWRITEToQuery()
375cdf0e10cSrcweir	iGeneralOverwrite = SBOVERWRITEQUERY
376cdf0e10cSrcweir	DlgOverwrite.EndExecute()
377cdf0e10cSrcweirEnd Sub
378cdf0e10cSrcweir
379cdf0e10cSrcweir
380cdf0e10cSrcweirSub SetOVERWRITEToAlways()
381cdf0e10cSrcweir	iGeneralOverwrite = SBOVERWRITEALWAYS
382cdf0e10cSrcweir	DlgOverwrite.EndExecute()
383cdf0e10cSrcweirEnd Sub
384cdf0e10cSrcweir
385cdf0e10cSrcweir
386cdf0e10cSrcweirSub SetOVERWRITEToNever()
387cdf0e10cSrcweir	iGeneralOverwrite = SBOVERWRITENEVER
388cdf0e10cSrcweir	DlgOverwrite.EndExecute()
389cdf0e10cSrcweirEnd Sub
390*3e02b54dSAndrew Rist</script:module>
391