1 <?xml version=
"1.0" encoding=
"UTF-8"?>
2 <!DOCTYPE script:module PUBLIC
"-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
3 <script:module xmlns:
script=
"http://openoffice.org/2000/script" script:
name=
"forms_OCurrencyModel" script:
language=
"StarBasic">
6 '*************************************************************************
8 ' DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
10 ' Copyright
2008 by Sun Microsystems, Inc.
12 ' OpenOffice.org - a multi-platform office productivity suite
14 ' $RCSfile: forms_OCurrencyModel.xba,v $
18 ' This file is part of OpenOffice.org.
20 ' OpenOffice.org is free software: you can redistribute it and/or modify
21 ' it under the terms of the GNU Lesser General Public License version
3
22 ' only, as published by the Free Software Foundation.
24 ' OpenOffice.org is distributed in the hope that it will be useful,
25 ' but WITHOUT ANY WARRANTY; without even the implied warranty of
26 ' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
27 ' GNU Lesser General Public License version
3 for more details
28 ' (a copy is included in the LICENSE file that accompanied this code).
30 ' You should have received a copy of the GNU Lesser General Public License
31 ' version
3 along with OpenOffice.org. If not, see
32 '
<http://www.openoffice.org/license.html
>
33 ' for a copy of the LGPLv3 License.
35 '*************************************************************************
36 '*************************************************************************
40 ' Be sure that all variables are dimensioned:
44 ' REQUIRED VARIABLES for interface/service tests:
47 Global oComponentInstance As Object
50 Global oPersistInstance As Object
52 ' for XUpdateBroadcaster
53 Global bCustomUpdate As Boolean
55 Global oForm As Object
60 '*************************************************************************
62 ' forms.OCurrencyModel
63 '*************************************************************************
67 Dim oShape As Object, oDrawPage As Object
70 ' --- create a document if needed
72 oDoc = utils.createDocument(
"swriter", cObjectName)
74 oShape = toolkittools.addControlToDefaultForm(
"CurrencyField",
1000,
1000,
2000,
1000)
75 oObj = oShape.getControl()
76 oShape = toolkittools.addControlToDefaultForm(
"CurrencyField",
1000,
3000,
2000,
1000)
77 oComponentInstance = oShape.getControl()
78 oShape = toolkittools.addControlToDefaultForm(
"CurrencyField",
1000,
5000,
2000,
1000)
79 oPersistInstance = oShape.getControl()
81 'get control from document
82 oDrawPage = oDoc.DrawPage
83 oForm = oDrawPage.Forms.getByName(
"Standard")
85 oForm.DataSourceName =
"Bibliography"
86 oForm.Command =
"biblio"
87 oForm.CommandType = com.sun.star.sdb.CommandType.TABLE
89 oObj.DataField =
"Pages"
93 ' for XUpdateBroadcaster
102 Global aChangedValue As Double
104 ' for XBoundComponent
106 On Error Goto ErrHndl
107 Out.Log(
"prepareCommit() called.")
108 if NOT (isNull(oObj.Value) OR isEmpty(oObj.Value)) then
109 aChangedValue = oObj.Value +
1
113 oObj.Value = aChangedValue
120 ' for XBoundComponent
121 Function checkCommit() As Boolean
122 On Error Goto ErrHndl
123 Out.Log(
"checkCommit() called.")
124 Dim rowValue As Variant
126 rowValue = oForm.getDouble(oForm.findColumn(
"Pages"))
127 Out.Log(
"Value was set to " + aChangedValue )
128 Out.Log(
"the value in current row is " + rowValue)
129 checkCommit() = (rowValue = aChangedValue)
136 ' for XUpdateBroadcaster
137 Sub UpdateComponent()
138 oObj.Value = oObj.Value +
1