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">
4
5
6'*************************************************************************
7'
8' DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
9'
10' Copyright 2000, 2010 Oracle and/or its affiliates.
11'
12' OpenOffice.org - a multi-platform office productivity suite
13'
14' This file is part of OpenOffice.org.
15'
16' OpenOffice.org is free software: you can redistribute it and/or modify
17' it under the terms of the GNU Lesser General Public License version 3
18' only, as published by the Free Software Foundation.
19'
20' OpenOffice.org is distributed in the hope that it will be useful,
21' but WITHOUT ANY WARRANTY; without even the implied warranty of
22' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
23' GNU Lesser General Public License version 3 for more details
24' (a copy is included in the LICENSE file that accompanied this code).
25'
26' You should have received a copy of the GNU Lesser General Public License
27' version 3 along with OpenOffice.org.  If not, see
28' <http://www.openoffice.org/license.html>
29' for a copy of the LGPLv3 License.
30'
31'*************************************************************************
32*****
33'*************************************************************************
34
35
36
37' Be sure that all variables are dimensioned:
38option explicit
39
40
41' REQUIRED VARIABLES for interface/service tests:
42
43'Required for com.sun.star.text.XText
44Global oCollection As Object
45Global oInstance As Object
46Global aAddons()
47
48
49Sub beforeInsertTextContent()
50
51'*************************************************************************
52' COMPONENT:
53' sw.SwXAutoTextEntry
54'*************************************************************************
55    oDoc.Text.setString("")
56    oObj.applyTo(oDoc.Text.createTextCursor())
57End Sub
58
59Sub afterInsertTextContent()
60    oDoc.Text.setString("")
61    oObj.applyTo(oDoc.Text.createTextCursor())
62End Sub
63
64Sub beforeRemoveTextContent()
65    oDoc.Text.setString("")
66    oObj.applyTo(oDoc.Text.createTextCursor())
67End Sub
68
69Sub afterRemoveTextContent()
70    oDoc.Text.setString("")
71    oObj.applyTo(oDoc.Text.createTextCursor())
72End Sub
73
74Global oGroup As Object
75
76Sub CreateObj()
77On Error Goto ErrHndl
78    Dim oContainer As Object
79    Dim i As Integer
80    Dim oNames As Variant
81
82    oDoc = utils.createDocument("swriter", cObjectName)
83    oContainer = createUNOService( "com.sun.star.text.AutoTextContainer" )
84    Out.Log("Looking for not empty elements")
85    i = 0
86    oGroup = oContainer.getByIndex(i)
87    while (oGroup.getCount &lt; 1)
88        i = i + 1
89        oGroup = oContainer.getByIndex(i)
90    wend
91
92    oNames = oGroup.getElementNames()
93
94    for i = 0 to ubound(oNames)
95        Out.Log("Element " + i + ": " + oNames(i))
96    next i
97
98    oObj = oGroup.getByIndex(0)
99
100    oInstance = oDoc.createInstance("com.sun.star.text.TextTable")
101    oCollection = oDoc.getTextTables()
102
103    oObj.ApplyTo(oDoc.Text.createTextCursor)
104
105Exit Sub
106ErrHndl:
107    Test.Exception()
108End Sub
109</script:module>
110