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