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="Layouter" script:language="StarBasic">Option Explicit
4*cdf0e10cSrcweir
5*cdf0e10cSrcweirPublic oProgressbar as Object
6*cdf0e10cSrcweirPublic ProgressValue as Integer
7*cdf0e10cSrcweirPublic oDocument as Object
8*cdf0e10cSrcweirPublic oController as Object
9*cdf0e10cSrcweirPublic oForm as Object
10*cdf0e10cSrcweirPublic oDrawPage as Object
11*cdf0e10cSrcweirPublic oPageStyle as Object
12*cdf0e10cSrcweir
13*cdf0e10cSrcweirPublic nMaxColRightX as Long
14*cdf0e10cSrcweirPublic nMaxTCWidth as Long
15*cdf0e10cSrcweirPublic nMaxRowRightX as Long
16*cdf0e10cSrcweirPublic nMaxRowY as Long
17*cdf0e10cSrcweirPublic nSecMaxRowY as Long
18*cdf0e10cSrcweirPublic MaxIndex as Integer
19*cdf0e10cSrcweirPublic CurIndex as Integer
20*cdf0e10cSrcweir
21*cdf0e10cSrcweirPublic Const cVertDistance = 200
22*cdf0e10cSrcweirPublic Const cHoriDistance = 300
23*cdf0e10cSrcweir
24*cdf0e10cSrcweirPublic nPageWidth as Long
25*cdf0e10cSrcweirPublic nPageHeight as Long
26*cdf0e10cSrcweirPublic nFormWidth as Long
27*cdf0e10cSrcweirPublic nFormHeight as Long
28*cdf0e10cSrcweirPublic nMaxHoriPos as Long
29*cdf0e10cSrcweirPublic nMaxVertPos as Long
30*cdf0e10cSrcweir
31*cdf0e10cSrcweirPublic CONST SBALIGNLEFT = 0
32*cdf0e10cSrcweirPublic CONST SBALIGNRIGHT = 2
33*cdf0e10cSrcweir
34*cdf0e10cSrcweirPublic Const SBNOBORDER = 0
35*cdf0e10cSrcweirPublic Const SB3DBORDER = 1
36*cdf0e10cSrcweirPublic Const SBSIMPLEBORDER = 2
37*cdf0e10cSrcweir
38*cdf0e10cSrcweirPublic CurArrangement as Integer
39*cdf0e10cSrcweirPublic CurBorderType as Integer
40*cdf0e10cSrcweirPublic CurAlignmode as Integer
41*cdf0e10cSrcweir
42*cdf0e10cSrcweirPublic OldAlignMode as Integer
43*cdf0e10cSrcweirPublic OldBorderType as Integer
44*cdf0e10cSrcweirPublic OldArrangement as Integer
45*cdf0e10cSrcweir
46*cdf0e10cSrcweirPublic Const cColumnarLeft = 1
47*cdf0e10cSrcweirPublic Const cColumnarTop = 2
48*cdf0e10cSrcweirPublic Const cTabled = 3
49*cdf0e10cSrcweirPublic Const cLeftJustified = 4
50*cdf0e10cSrcweirPublic Const cTopJustified = 5
51*cdf0e10cSrcweir
52*cdf0e10cSrcweirPublic Const cXOffset = 1000
53*cdf0e10cSrcweirPublic Const cYOffset = 700
54*cdf0e10cSrcweir&apos; This is the viewed space that we lose because of the symbol bars
55*cdf0e10cSrcweirPublic Const cSymbolMargin = 2000
56*cdf0e10cSrcweirPublic Const MaxFieldIndex = 200
57*cdf0e10cSrcweir
58*cdf0e10cSrcweirPublic Const cControlCollectionCount = 9
59*cdf0e10cSrcweirPublic Const cLabel 		= 1
60*cdf0e10cSrcweirPublic Const cTextBox 		= 2
61*cdf0e10cSrcweirPublic Const cCheckBox	 	= 3
62*cdf0e10cSrcweirPublic Const cDateBox 		= 4
63*cdf0e10cSrcweirPublic Const cTimeBox 		= 5
64*cdf0e10cSrcweirPublic Const cNumericBox 	= 6
65*cdf0e10cSrcweirPublic Const cCurrencyBox 	= 7
66*cdf0e10cSrcweirPublic Const cGridControl	= 8
67*cdf0e10cSrcweirPublic Const cImageControl	= 9
68*cdf0e10cSrcweir
69*cdf0e10cSrcweirPublic Styles(100, 8) as String
70*cdf0e10cSrcweir
71*cdf0e10cSrcweirPublic CurControlType as Integer
72*cdf0e10cSrcweirPublic CurFieldlength as Double
73*cdf0e10cSrcweirPublic CurFieldType as Integer
74*cdf0e10cSrcweirPublic CurFieldName as String
75*cdf0e10cSrcweirPublic CurControlName as String
76*cdf0e10cSrcweirPublic CurFormatKey as Long
77*cdf0e10cSrcweirPublic CurDefaultValue
78*cdf0e10cSrcweirPublic CurIsCurrency as Boolean
79*cdf0e10cSrcweirPublic CurScale as Integer
80*cdf0e10cSrcweirPublic CurHelpText as String
81*cdf0e10cSrcweir
82*cdf0e10cSrcweirPublic FieldMetaValues(MaxFieldIndex, 8)
83*cdf0e10cSrcweir&apos; Description of this List:
84*cdf0e10cSrcweir&apos;	CurFieldType = FieldMetaValues(Index,0)
85*cdf0e10cSrcweir&apos;	CurFieldLength = FieldMetaValues(Index,1)
86*cdf0e10cSrcweir&apos;	CurControlType = FieldMetaValues(Index,2)	(ControlType eg. cLabel, cTextbox usw.)
87*cdf0e10cSrcweir&apos;	CurControlName = FieldMetaValues(Index,3)
88*cdf0e10cSrcweir&apos;	CurFormatKey = FieldMetaValues(Index,4)
89*cdf0e10cSrcweir&apos;	CurDefaultValue = FieldMetaValues(Index,5)
90*cdf0e10cSrcweir&apos;	CurIsCurrency = FieldMetaValues(Index,6)
91*cdf0e10cSrcweir&apos;	CurScale = FieldMetaValues(Index,7)
92*cdf0e10cSrcweir&apos;	CurHelpText = FieldMetaValues(Index,8)
93*cdf0e10cSrcweir
94*cdf0e10cSrcweirPublic FieldNames(MaxFieldIndex) as string
95*cdf0e10cSrcweirPublic oModelService(cControlCollectionCount) as String
96*cdf0e10cSrcweirPublic oGridModel as Object
97*cdf0e10cSrcweir
98*cdf0e10cSrcweir
99*cdf0e10cSrcweirFunction InsertControl(oContainer as Object, oControlObject as object, aPoint as Object, aSize as Object)
100*cdf0e10cSrcweirDim oShape as object
101*cdf0e10cSrcweir	oShape = oDocument.CreateInstance (&quot;com.sun.star.drawing.ControlShape&quot;)
102*cdf0e10cSrcweir	oShape.Size = aSize
103*cdf0e10cSrcweir	oShape.Position = aPoint
104*cdf0e10cSrcweir	oShape.AnchorType = com.sun.star.text.TextContentAnchorType.AT_PARAGRAPH
105*cdf0e10cSrcweir	oShape.control = oControlObject
106*cdf0e10cSrcweir	oContainer.Add(oShape)
107*cdf0e10cSrcweir	InsertControl() = oShape
108*cdf0e10cSrcweirEnd Function
109*cdf0e10cSrcweir
110*cdf0e10cSrcweir
111*cdf0e10cSrcweirFunction ArrangeControls()
112*cdf0e10cSrcweirDim oShape as Object
113*cdf0e10cSrcweirDim i as Integer
114*cdf0e10cSrcweir	oProgressbar = oDocument.GetCurrentController.GetFrame.CreateStatusIndicator
115*cdf0e10cSrcweir	oProgressbar.Start(&quot;&quot;, MaxIndex)
116*cdf0e10cSrcweir	If oDBForm.HasbyName(&quot;Grid1&quot;) Then
117*cdf0e10cSrcweir		RemoveShapes()
118*cdf0e10cSrcweir	End If
119*cdf0e10cSrcweir	ToggleLayoutPage(False)
120*cdf0e10cSrcweir	Select Case CurArrangement
121*cdf0e10cSrcweir		Case cTabled
122*cdf0e10cSrcweir			PositionGridControl(MaxIndex)
123*cdf0e10cSrcweir		Case Else
124*cdf0e10cSrcweir			PositionControls(MaxIndex)
125*cdf0e10cSrcweir	End Select
126*cdf0e10cSrcweir	ToggleLayoutPage(True)
127*cdf0e10cSrcweir	oProgressbar.End
128*cdf0e10cSrcweirEnd Function
129*cdf0e10cSrcweir
130*cdf0e10cSrcweir
131*cdf0e10cSrcweirSub OpenFormDocument()
132*cdf0e10cSrcweirDim NoArgs() as new com.sun.star.beans.PropertyValue
133*cdf0e10cSrcweirDim oViewSettings as Object
134*cdf0e10cSrcweir	oDocument = CreateNewDocument(&quot;swriter&quot;)
135*cdf0e10cSrcweir	oProgressbar = oDocument.GetCurrentController.GetFrame.CreateStatusIndicator()
136*cdf0e10cSrcweir	oProgressbar.Start(&quot;&quot;, 100)
137*cdf0e10cSrcweir	oDocument.ApplyFormDesignMode = False
138*cdf0e10cSrcweir	oController = oDocument.GetCurrentController
139*cdf0e10cSrcweir	oViewSettings = oDocument.CurrentController.ViewSettings
140*cdf0e10cSrcweir	oViewSettings.ShowTableBoundaries = False
141*cdf0e10cSrcweir	oViewSettings.ShowOnlineLayout = True
142*cdf0e10cSrcweir	oDrawPage = oDocument.DrawPage
143*cdf0e10cSrcweir	oPageStyle = oDocument.StyleFamilies.GetByName(&quot;PageStyles&quot;).GetByName(&quot;Standard&quot;)
144*cdf0e10cSrcweirEnd Sub
145*cdf0e10cSrcweir
146*cdf0e10cSrcweir
147*cdf0e10cSrcweirSub	InitializeLabelValues()
148*cdf0e10cSrcweirDim oLabelModel as Object
149*cdf0e10cSrcweirDim oTBModel as Object
150*cdf0e10cSrcweirDim oLabelShape as Object
151*cdf0e10cSrcweirDim oTBShape as Object
152*cdf0e10cSrcweirDim aTBSize As New com.sun.star.awt.Size
153*cdf0e10cSrcweirDim aLabelSize As New com.sun.star.awt.Size
154*cdf0e10cSrcweirDim aPoint As New com.sun.star.awt.Point
155*cdf0e10cSrcweirDim aSize As New com.sun.star.awt.Size
156*cdf0e10cSrcweirDim oLocControl as Object
157*cdf0e10cSrcweirDim oLocPeer as Object
158*cdf0e10cSrcweir	oLabelModel =  CreateUnoService(&quot;com.sun.star.form.component.FixedText&quot;)
159*cdf0e10cSrcweir	oTBModel =  CreateUnoService(&quot;com.sun.star.form.component.TextField&quot;)
160*cdf0e10cSrcweir
161*cdf0e10cSrcweir	Set oLabelShape = InsertControl(oDrawPage, oLabelModel, aPoint, aLabelSize)
162*cdf0e10cSrcweir	Set oTBShape = InsertControl(oDrawPage, oTBModel, aPoint, aSize)
163*cdf0e10cSrcweir
164*cdf0e10cSrcweir	oLocPeer = oController.GetControl(oLabelModel).Peer
165*cdf0e10cSrcweir	XPixelFactor = 100000/oLocPeer.GetInfo.PixelPerMeterX
166*cdf0e10cSrcweir	YPixelFactor = 100000/oLocPeer.GetInfo.PixelPerMeterY
167*cdf0e10cSrcweir	aLabelSize = GetPeerSize(oLabelModel, oLocControl, &quot;The quick brown fox...&quot;)
168*cdf0e10cSrcweir	nTCHeight = (aLabelSize.Height+1) * YPixelFactor
169*cdf0e10cSrcweir	aTBSize = GetPeerSize(oTBModel, oLocControl, &quot;The quick brown fox...&quot;)
170*cdf0e10cSrcweir	nDBRefHeight = (aTBSize.Height+1) * YPixelFactor
171*cdf0e10cSrcweir	BasicLabelDiffHeight = Clng((nDBRefHeight - nTCHeight)/2)
172*cdf0e10cSrcweir	oDrawPage.Remove(oLabelShape)
173*cdf0e10cSrcweir	oDrawPage.Remove(oTBShape)
174*cdf0e10cSrcweirEnd Sub
175*cdf0e10cSrcweir
176*cdf0e10cSrcweir
177*cdf0e10cSrcweirSub ConfigurePageStyle()
178*cdf0e10cSrcweirDim aPageSize As New com.sun.star.awt.Size
179*cdf0e10cSrcweirDim aSize As New com.sun.star.awt.Size
180*cdf0e10cSrcweir	oPageStyle.IsLandscape = True
181*cdf0e10cSrcweir	aPageSize = oPageStyle.Size
182*cdf0e10cSrcweir	nPageWidth = aPageSize.Width
183*cdf0e10cSrcweir	nPageHeight = aPageSize.Height
184*cdf0e10cSrcweir	aSize.Width = nPageHeight
185*cdf0e10cSrcweir	aSize.Height = nPageWidth
186*cdf0e10cSrcweir	oPageStyle.Size = aSize
187*cdf0e10cSrcweir	nPageWidth = nPageHeight
188*cdf0e10cSrcweir	nPageHeight = oPageStyle.Size.Height
189*cdf0e10cSrcweir	nFormWidth = nPageWidth - oPageStyle.RightMargin - oPageStyle.LeftMargin - 2 * cXOffset
190*cdf0e10cSrcweir	nFormHeight = nPageHeight - oPageStyle.TopMargin - oPageStyle.BottomMargin - 2 * cYOffset - cSymbolMargin
191*cdf0e10cSrcweirEnd Sub
192*cdf0e10cSrcweir
193*cdf0e10cSrcweir
194*cdf0e10cSrcweir&apos; Modify the Borders of the Controls
195*cdf0e10cSrcweirSub ChangeBorderLayouts(oEvent as Object)
196*cdf0e10cSrcweirDim oModel as Object
197*cdf0e10cSrcweirDim i as Integer
198*cdf0e10cSrcweirDim oCurModel as Object
199*cdf0e10cSrcweirDim sLocText as String
200*cdf0e10cSrcweirDim oGroupShape as Object
201*cdf0e10cSrcweirDim s as Integer
202*cdf0e10cSrcweir	If Not bDebug Then
203*cdf0e10cSrcweir		On Local Error GoTo WIZARDERROR
204*cdf0e10cSrcweir	End If
205*cdf0e10cSrcweir	oModel = oEvent.Source.Model
206*cdf0e10cSrcweir	SwitchBorderMode(Val(Right(oModel.Name,1)))
207*cdf0e10cSrcweir	ToggleLayoutPage(False)
208*cdf0e10cSrcweir	If CurArrangement = cTabled Then
209*cdf0e10cSrcweir		oGridModel.Border = CurBorderType
210*cdf0e10cSrcweir	Else
211*cdf0e10cSrcweir		If OldBorderType &lt;&gt; CurBorderType Then
212*cdf0e10cSrcweir			For i = 0 To MaxIndex
213*cdf0e10cSrcweir				If oDBShapeList(i).SupportsService(&quot;com.sun.star.drawing.GroupShape&quot;) Then
214*cdf0e10cSrcweir					oGroupShape = oDBShapeList(i)
215*cdf0e10cSrcweir					For s = 0 To oGroupShape.Count-1
216*cdf0e10cSrcweir						oGroupShape(s).Control.Border = CurBorderType
217*cdf0e10cSrcweir					Next s
218*cdf0e10cSrcweir				Else
219*cdf0e10cSrcweir					If oDBModelList(i).PropertySetInfo.HasPropertyByName(&quot;Border&quot;) Then
220*cdf0e10cSrcweir						oDBModelList(i).Border = CurBorderType
221*cdf0e10cSrcweir					End If
222*cdf0e10cSrcweir				End If
223*cdf0e10cSrcweir			Next i
224*cdf0e10cSrcweir		End If
225*cdf0e10cSrcweir	End If
226*cdf0e10cSrcweir	ToggleLayoutPage(True)
227*cdf0e10cSrcweirWIZARDERROR:
228*cdf0e10cSrcweir	If Err &lt;&gt; 0 Then
229*cdf0e10cSrcweir		Msgbox(sMsgErrMsg, 16, GetProductName())
230*cdf0e10cSrcweir		Resume LOCERROR
231*cdf0e10cSrcweir		LOCERROR:
232*cdf0e10cSrcweir		DlgFormDB.Dispose()
233*cdf0e10cSrcweir	End If
234*cdf0e10cSrcweirEnd Sub
235*cdf0e10cSrcweir
236*cdf0e10cSrcweir
237*cdf0e10cSrcweirSub ChangeLabelAlignments(oEvent as Object)
238*cdf0e10cSrcweirDim i as Integer
239*cdf0e10cSrcweirDim oSize as New com.sun.star.awt.Size
240*cdf0e10cSrcweirDim oModel as Object
241*cdf0e10cSrcweir	If Not bDebug Then
242*cdf0e10cSrcweir		On Local Error GoTo WIZARDERROR
243*cdf0e10cSrcweir	End If
244*cdf0e10cSrcweir	oModel = oEvent.Source.Model
245*cdf0e10cSrcweir	SwitchAlignMode(Val(Right(oModel.Name,1)))
246*cdf0e10cSrcweir	ToggleLayoutPage(False)
247*cdf0e10cSrcweir	If OldAlignMode &lt;&gt; CurAlignMode Then
248*cdf0e10cSrcweir		For i = 0 To MaxIndex
249*cdf0e10cSrcweir			oTCShapeList(i).GetControl.Align = CurAlignmode
250*cdf0e10cSrcweir		Next i
251*cdf0e10cSrcweir	End If
252*cdf0e10cSrcweir	If CurAlignmode = com.sun.star.awt.TextAlign.RIGHT Then
253*cdf0e10cSrcweir		For i = 0 To Ubound(oTCShapeList())
254*cdf0e10cSrcweir			oSize = oTCShapeList(i).Size
255*cdf0e10cSrcweir			oSize.Width = oDBShapeList(i).Position.X - oTCShapeList(i).Position.X - cHoriDistance
256*cdf0e10cSrcweir			oTCShapeList(i).Size = oSize
257*cdf0e10cSrcweir		Next i
258*cdf0e10cSrcweir	End If
259*cdf0e10cSrcweir
260*cdf0e10cSrcweirWIZARDERROR:
261*cdf0e10cSrcweir	If Err &lt;&gt; 0 Then
262*cdf0e10cSrcweir		Msgbox(sMsgErrMsg, 16, GetProductName())
263*cdf0e10cSrcweir		Resume LOCERROR
264*cdf0e10cSrcweir		LOCERROR:
265*cdf0e10cSrcweir	End If
266*cdf0e10cSrcweir	ToggleLayoutPage(True)
267*cdf0e10cSrcweirEnd Sub
268*cdf0e10cSrcweir
269*cdf0e10cSrcweir
270*cdf0e10cSrcweirSub ChangeArrangemode(oEvent as Object)
271*cdf0e10cSrcweirDim oModel as Object
272*cdf0e10cSrcweir	If Not bDebug Then
273*cdf0e10cSrcweir		On Local Error GoTo WIZARDERROR
274*cdf0e10cSrcweir	End If
275*cdf0e10cSrcweir	oModel = oEvent.Source.Model
276*cdf0e10cSrcweir	SwitchArrangementButtons(Val(Right(oModel.Name,1)))
277*cdf0e10cSrcweir	oModel.State = 1
278*cdf0e10cSrcweir	DlgFormDB.GetControl(&quot;cmdArrange&quot; &amp; OldArrangement).Model.State = 0
279*cdf0e10cSrcweir	If CurArrangement &lt;&gt; OldArrangement Then
280*cdf0e10cSrcweir		ArrangeControls()
281*cdf0e10cSrcweir		Select Case CurArrangement
282*cdf0e10cSrcweir			Case cTabled
283*cdf0e10cSrcweir				ToggleBorderGroup(False)
284*cdf0e10cSrcweir				ToggleAlignGroup(False)
285*cdf0e10cSrcweir			Case Else &apos; cColumnarTop,cLeftJustified, cTopJustified
286*cdf0e10cSrcweir				ToggleAlignGroup(CurArrangement = cColumnarLeft)
287*cdf0e10cSrcweir				If CurArrangement = cColumnarTop Then
288*cdf0e10cSrcweir					If CurAlignMode = com.sun.star.awt.TextAlign.RIGHT Then
289*cdf0e10cSrcweir						DialogModel.optAlign0.State = 1
290*cdf0e10cSrcweir						CurAlignMode = com.sun.star.awt.TextAlign.LEFT
291*cdf0e10cSrcweir						OldAlignMode = com.sun.star.awt.TextAlign.RIGHT
292*cdf0e10cSrcweir					End If
293*cdf0e10cSrcweir				End If
294*cdf0e10cSrcweir				ControlCaptionstoStandardLayout()
295*cdf0e10cSrcweir				oDBForm.Load
296*cdf0e10cSrcweir		End Select
297*cdf0e10cSrcweir	End If
298*cdf0e10cSrcweirWIZARDERROR:
299*cdf0e10cSrcweir	If Err &lt;&gt; 0 Then
300*cdf0e10cSrcweir		Msgbox(sMsgErrMsg, 16, GetProductName())
301*cdf0e10cSrcweir		Resume LOCERROR
302*cdf0e10cSrcweir		LOCERROR:
303*cdf0e10cSrcweir	End If
304*cdf0e10cSrcweirEnd Sub
305*cdf0e10cSrcweir
306*cdf0e10cSrcweir
307*cdf0e10cSrcweirSub	ToggleBorderGroup(bDoEnable as Boolean)
308*cdf0e10cSrcweir	With DialogModel
309*cdf0e10cSrcweir		.hlnBorderLayout.Enabled = bDoEnable
310*cdf0e10cSrcweir		.optBorder0.Enabled = bDoEnable	 	&apos; 0: No border
311*cdf0e10cSrcweir		.optBorder1.Enabled = bDoEnable		&apos; 1: 3D border
312*cdf0e10cSrcweir		.optBorder2.Enabled = bDoEnable		&apos; 2: simple border
313*cdf0e10cSrcweir	End With
314*cdf0e10cSrcweirEnd Sub
315*cdf0e10cSrcweir
316*cdf0e10cSrcweir
317*cdf0e10cSrcweirSub	ToggleAlignGroup(ByVal bDoEnable as Boolean)
318*cdf0e10cSrcweir	With DialogModel
319*cdf0e10cSrcweir		If bDoEnable Then
320*cdf0e10cSrcweir			bDoEnable = CurArrangement = cColumnarLeft
321*cdf0e10cSrcweir		End If
322*cdf0e10cSrcweir		.hlnAlign.Enabled = bDoEnable
323*cdf0e10cSrcweir		.optAlign0.Enabled = bDoEnable
324*cdf0e10cSrcweir		.optAlign2.Enabled = bDoEnable
325*cdf0e10cSrcweir	End With
326*cdf0e10cSrcweirEnd Sub
327*cdf0e10cSrcweir
328*cdf0e10cSrcweir
329*cdf0e10cSrcweirSub ToggleLayoutPage(bDoEnable as Boolean, Optional FocusControlName as String)
330*cdf0e10cSrcweir	DialogModel.Enabled = bDoEnable
331*cdf0e10cSrcweir	If bDoEnable Then
332*cdf0e10cSrcweir		If Not bDebug Then
333*cdf0e10cSrcweir			oDocument.UnlockControllers()
334*cdf0e10cSrcweir		End If
335*cdf0e10cSrcweir		ToggleOptionButtons(DialogModel,(bWithBackGraphic = True))
336*cdf0e10cSrcweir		ToggleAlignGroup(bDoEnable)
337*cdf0e10cSrcweir		ToggleBorderGroup(bDoEnable)
338*cdf0e10cSrcweir	Else
339*cdf0e10cSrcweir		If Not bDebug Then
340*cdf0e10cSrcweir			oDocument.LockControllers()
341*cdf0e10cSrcweir		End If
342*cdf0e10cSrcweir	End If
343*cdf0e10cSrcweir	If Not IsMissing(FocusControlName) Then
344*cdf0e10cSrcweir		DlgFormDB.GetControl(FocusControlName).SetFocus()
345*cdf0e10cSrcweir	End If
346*cdf0e10cSrcweirEnd Sub
347*cdf0e10cSrcweir
348*cdf0e10cSrcweir
349*cdf0e10cSrcweirSub DestroyControlShapes(oDrawPage as Object)
350*cdf0e10cSrcweirDim i as Integer
351*cdf0e10cSrcweirDim oShape as Object
352*cdf0e10cSrcweir	For i = oDrawPage.Count-1 To 0 Step -1
353*cdf0e10cSrcweir		oShape = oDrawPage.GetByIndex(i)
354*cdf0e10cSrcweir		If oShape.ShapeType = &quot;com.sun.star.drawing.ControlShape&quot; Then
355*cdf0e10cSrcweir			oShape.Dispose()
356*cdf0e10cSrcweir		End If
357*cdf0e10cSrcweir	Next i
358*cdf0e10cSrcweirEnd Sub
359*cdf0e10cSrcweir
360*cdf0e10cSrcweir
361*cdf0e10cSrcweirSub SwitchArrangementButtons(ByVal LocArrangement as Integer)
362*cdf0e10cSrcweir	OldArrangement = CurArrangement
363*cdf0e10cSrcweir	CurArrangement = LocArrangement
364*cdf0e10cSrcweir	If OldArrangement &lt;&gt; 0 Then
365*cdf0e10cSrcweir		DlgFormDB.GetControl(&quot;cmdArrange&quot; &amp; OldArrangement).Model.State = 0
366*cdf0e10cSrcweir	End If
367*cdf0e10cSrcweir	DlgFormDB.GetControl(&quot;cmdArrange&quot; &amp; CurArrangement).Model.State = 1
368*cdf0e10cSrcweirEnd Sub
369*cdf0e10cSrcweir
370*cdf0e10cSrcweir
371*cdf0e10cSrcweirSub SwitchBorderMode(ByVal LocBorderType as Integer)
372*cdf0e10cSrcweir	OldBorderType = CurBorderType
373*cdf0e10cSrcweir	CurBorderType = LocBorderType
374*cdf0e10cSrcweirEnd Sub
375*cdf0e10cSrcweir
376*cdf0e10cSrcweir
377*cdf0e10cSrcweirSub SwitchAlignMode(ByVal LocAlignMode as Integer)
378*cdf0e10cSrcweir	OldAlignMode = CurAlignMode
379*cdf0e10cSrcweir	CurAlignMode = LocAlignMode
380*cdf0e10cSrcweirEnd Sub</script:module>