merge the formfield patch from ooo-build
[ooovba.git] / qadevOOo / tests / basic / mod / sw / SwXAutoTextEntry / sw_SwXAutoTextEntry.xba
blob42b135517e890056614cc7362779340fcc7355d7
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="sw_SwXAutoTextEntry" script:language="StarBasic">
6 '*************************************************************************
8 ' DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
9 '
10 ' Copyright 2008 by Sun Microsystems, Inc.
12 ' OpenOffice.org - a multi-platform office productivity suite
14 ' $RCSfile: sw_SwXAutoTextEntry.xba,v $
16 ' $Revision: 1.3 $
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:
41 option explicit
44 ' REQUIRED VARIABLES for interface/service tests:
46 'Required for com.sun.star.text.XText
47 Global oCollection As Object
48 Global oInstance As Object
49 Global aAddons()
52 Sub beforeInsertTextContent()
54 '*************************************************************************
55 ' COMPONENT:
56 ' sw.SwXAutoTextEntry
57 '*************************************************************************
58 oDoc.Text.setString("")
59 oObj.applyTo(oDoc.Text.createTextCursor())
60 End Sub
62 Sub afterInsertTextContent()
63 oDoc.Text.setString("")
64 oObj.applyTo(oDoc.Text.createTextCursor())
65 End Sub
67 Sub beforeRemoveTextContent()
68 oDoc.Text.setString("")
69 oObj.applyTo(oDoc.Text.createTextCursor())
70 End Sub
72 Sub afterRemoveTextContent()
73 oDoc.Text.setString("")
74 oObj.applyTo(oDoc.Text.createTextCursor())
75 End Sub
77 Global oGroup As Object
79 Sub CreateObj()
80 On Error Goto ErrHndl
81 Dim oContainer As Object
82 Dim i As Integer
83 Dim oNames As Variant
85 oDoc = utils.createDocument("swriter", cObjectName)
86 oContainer = createUNOService( "com.sun.star.text.AutoTextContainer" )
87 Out.Log("Looking for not empty elements")
88 i = 0
89 oGroup = oContainer.getByIndex(i)
90 while (oGroup.getCount &lt; 1)
91 i = i + 1
92 oGroup = oContainer.getByIndex(i)
93 wend
95 oNames = oGroup.getElementNames()
97 for i = 0 to ubound(oNames)
98 Out.Log("Element " + i + ": " + oNames(i))
99 next i
101 oObj = oGroup.getByIndex(0)
103 oInstance = oDoc.createInstance("com.sun.star.text.TextTable")
104 oCollection = oDoc.getTextTables()
106 oObj.ApplyTo(oDoc.Text.createTextCursor)
108 Exit Sub
109 ErrHndl:
110 Test.Exception()
111 End Sub
112 </script:module>