|  | <?xml version="1.0" encoding="UTF-8"?> | 
|  | <!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd"> | 
|  | <script:module xmlns:script="http://openoffice.org/2000/script" script:name="sw_SwXAutoTextEntry" script:language="StarBasic"> | 
|  |  | 
|  |  | 
|  | '************************************************************************* | 
|  | ' | 
|  | '  Licensed to the Apache Software Foundation (ASF) under one | 
|  | '  or more contributor license agreements.  See the NOTICE file | 
|  | '  distributed with this work for additional information | 
|  | '  regarding copyright ownership.  The ASF licenses this file | 
|  | '  to you under the Apache License, Version 2.0 (the | 
|  | '  "License"); you may not use this file except in compliance | 
|  | '  with the License.  You may obtain a copy of the License at | 
|  | ' | 
|  | '    http://www.apache.org/licenses/LICENSE-2.0 | 
|  | ' | 
|  | '  Unless required by applicable law or agreed to in writing, | 
|  | '  software distributed under the License is distributed on an | 
|  | '  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | 
|  | '  KIND, either express or implied.  See the License for the | 
|  | '  specific language governing permissions and limitations | 
|  | '  under the License. | 
|  | ' | 
|  | '************************************************************************* | 
|  |  | 
|  |  | 
|  |  | 
|  |  | 
|  |  | 
|  | ' Be sure that all variables are dimensioned: | 
|  | option explicit | 
|  |  | 
|  |  | 
|  | ' REQUIRED VARIABLES for interface/service tests: | 
|  |  | 
|  | 'Required for com.sun.star.text.XText | 
|  | Global oCollection As Object | 
|  | Global oInstance As Object | 
|  | Global aAddons() | 
|  |  | 
|  |  | 
|  | Sub beforeInsertTextContent() | 
|  |  | 
|  | '************************************************************************* | 
|  | ' COMPONENT: | 
|  | ' sw.SwXAutoTextEntry | 
|  | '************************************************************************* | 
|  | oDoc.Text.setString("") | 
|  | oObj.applyTo(oDoc.Text.createTextCursor()) | 
|  | End Sub | 
|  |  | 
|  | Sub afterInsertTextContent() | 
|  | oDoc.Text.setString("") | 
|  | oObj.applyTo(oDoc.Text.createTextCursor()) | 
|  | End Sub | 
|  |  | 
|  | Sub beforeRemoveTextContent() | 
|  | oDoc.Text.setString("") | 
|  | oObj.applyTo(oDoc.Text.createTextCursor()) | 
|  | End Sub | 
|  |  | 
|  | Sub afterRemoveTextContent() | 
|  | oDoc.Text.setString("") | 
|  | oObj.applyTo(oDoc.Text.createTextCursor()) | 
|  | End Sub | 
|  |  | 
|  | Global oGroup As Object | 
|  |  | 
|  | Sub CreateObj() | 
|  | On Error Goto ErrHndl | 
|  | Dim oContainer As Object | 
|  | Dim i As Integer | 
|  | Dim oNames As Variant | 
|  |  | 
|  | oDoc = utils.createDocument("swriter", cObjectName) | 
|  | oContainer = createUNOService( "com.sun.star.text.AutoTextContainer" ) | 
|  | Out.Log("Looking for not empty elements") | 
|  | i = 0 | 
|  | oGroup = oContainer.getByIndex(i) | 
|  | while (oGroup.getCount < 1) | 
|  | i = i + 1 | 
|  | oGroup = oContainer.getByIndex(i) | 
|  | wend | 
|  |  | 
|  | oNames = oGroup.getElementNames() | 
|  |  | 
|  | for i = 0 to ubound(oNames) | 
|  | Out.Log("Element " + i + ": " + oNames(i)) | 
|  | next i | 
|  |  | 
|  | oObj = oGroup.getByIndex(0) | 
|  |  | 
|  | oInstance = oDoc.createInstance("com.sun.star.text.TextTable") | 
|  | oCollection = oDoc.getTextTables() | 
|  |  | 
|  | oObj.ApplyTo(oDoc.Text.createTextCursor) | 
|  |  | 
|  | Exit Sub | 
|  | ErrHndl: | 
|  | Test.Exception() | 
|  | End Sub | 
|  | </script:module> |