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_SwXParagraph" script:language="StarBasic">
4
5
6'*************************************************************************
7'
8'  Licensed to the Apache Software Foundation (ASF) under one
9'  or more contributor license agreements.  See the NOTICE file
10'  distributed with this work for additional information
11'  regarding copyright ownership.  The ASF licenses this file
12'  to you under the Apache License, Version 2.0 (the
13'  "License"); you may not use this file except in compliance
14'  with the License.  You may obtain a copy of the License at
15'
16'    http://www.apache.org/licenses/LICENSE-2.0
17'
18'  Unless required by applicable law or agreed to in writing,
19'  software distributed under the License is distributed on an
20'  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
21'  KIND, either express or implied.  See the License for the
22'  specific language governing permissions and limitations
23'  under the License.
24'
25'*************************************************************************
26
27
28
29
30
31
32' REQUIRED VARIABLES for interface/service tests:
33
34' Required for  com.sun.star.lang.XComponent:
35  Global oComponentInstance As Object ' it will be disposed
36  Global bXTextContentImpossible As Boolean
37
38
39Sub CreateObj()
40
41'*************************************************************************
42' COMPONENT:
43' sw.SwXParagraph
44'*************************************************************************
45On Error Goto ErrHndl
46
47    Dim bOK As Boolean
48    Dim nWidth As Integer
49    Dim nHeight As Integer
50    Dim cText As String
51    Dim oCursor As Object
52    Dim i As Integer
53    Dim oInstance As Object
54    Dim oEnum As Object
55
56    bOK = true
57
58    oDoc = utils.createDocument("swriter", cObjectName)
59
60    nWidth = 5000
61    nHeight = 4000
62    cText = ". Zeile : test of " &amp; cObjectName
63
64    oCursor = oDoc.Text.createTextCursor()
65
66    ' write some strings to document
67    for i = 1 to 10
68        oCursor.gotoEnd(false)
69        oDoc.Text.insertString(oCursor,Trim(Str(i)) &amp; cText,false)
70        oDoc.Text.insertControlCharacter(oCursor, 0, false)
71    next i
72
73    oCursor.gotoEnd(false)
74    oInstance = oDoc.createInstance("com.sun.star.text.TextFrame")
75    sSize = createUNOStruct("com.sun.star.awt.Size")
76    sSize.Height = nHeight
77    sSize.Width = nWidth
78    oInstance.Size = sSize
79    oInstance.SizeType = 1
80    oInstance.AnchorType = 0
81    oInstance.Name = cObjectName
82    oInstance.HoriOrient = 2
83    oInstance.VertOrient = 2
84    oDoc.Text.insertTextContent(oCursor, oInstance, false)
85
86    oEnum = oDoc.Text.createEnumeration()
87    oObj = oEnum.nextElement()
88    oComponentInstance = oEnum.nextElement()
89
90	bXTextContentImpossible = TRUE
91
92Exit Sub
93ErrHndl:
94    Test.Exception()
95End Sub
96</script:module>
97