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