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' 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' REQUIRED VARIABLES for interface/service tests:
38
39' Required for  com.sun.star.lang.XComponent:
40  Global oComponentInstance As Object ' it will be disposed
41  Global bXTextContentImpossible As Boolean
42
43
44Sub CreateObj()
45
46'*************************************************************************
47' COMPONENT:
48' sw.SwXParagraph
49'*************************************************************************
50On Error Goto ErrHndl
51
52    Dim bOK As Boolean
53    Dim nWidth As Integer
54    Dim nHeight As Integer
55    Dim cText As String
56    Dim oCursor As Object
57    Dim i As Integer
58    Dim oInstance As Object
59    Dim oEnum As Object
60
61    bOK = true
62
63    oDoc = utils.createDocument("swriter", cObjectName)
64
65    nWidth = 5000
66    nHeight = 4000
67    cText = ". Zeile : test of " &amp; cObjectName
68
69    oCursor = oDoc.Text.createTextCursor()
70
71    ' write some strings to document
72    for i = 1 to 10
73        oCursor.gotoEnd(false)
74        oDoc.Text.insertString(oCursor,Trim(Str(i)) &amp; cText,false)
75        oDoc.Text.insertControlCharacter(oCursor, 0, false)
76    next i
77
78    oCursor.gotoEnd(false)
79    oInstance = oDoc.createInstance("com.sun.star.text.TextFrame")
80    sSize = createUNOStruct("com.sun.star.awt.Size")
81    sSize.Height = nHeight
82    sSize.Width = nWidth
83    oInstance.Size = sSize
84    oInstance.SizeType = 1
85    oInstance.AnchorType = 0
86    oInstance.Name = cObjectName
87    oInstance.HoriOrient = 2
88    oInstance.VertOrient = 2
89    oDoc.Text.insertTextContent(oCursor, oInstance, false)
90
91    oEnum = oDoc.Text.createEnumeration()
92    oObj = oEnum.nextElement()
93    oComponentInstance = oEnum.nextElement()
94
95	bXTextContentImpossible = TRUE
96
97Exit Sub
98ErrHndl:
99    Test.Exception()
100End Sub
101</script:module>
102