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="style_ParagraphProperties" 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' Be sure that all variables are dimensioned:
32option explicit
33
34
35
36Sub RunTest()
37
38'*************************************************************************
39' SERVICE:
40' com.sun.star.style.ParagraphProperties
41'*************************************************************************
42On Error Goto ErrHndl
43    Dim bOK As Boolean
44
45    if hasUnoInterfaces(oObj, "com.sun.star.text.XTextRange") then
46        oObj.String = "This is an example string from ParagraphProperties..."
47    end if
48
49    Dim nParaAdjust(3) As Integer
50    nParaAdjust(0) = com.sun.star.style.ParagraphAdjust.LEFT
51    nParaAdjust(1) = com.sun.star.style.ParagraphAdjust.RIGHT
52    nParaAdjust(2) = com.sun.star.style.ParagraphAdjust.BLOCK
53    nParaAdjust(3) = com.sun.star.style.ParagraphAdjust.CENTER
54    ' STRETCH????
55
56    Dim nLastLineAdjust(2) As Integer
57    nLastLineAdjust(0) = com.sun.star.style.ParagraphAdjust.LEFT
58    nLastLineAdjust(1) = com.sun.star.style.ParagraphAdjust.BLOCK
59    nLastLineAdjust(2) = com.sun.star.style.ParagraphAdjust.CENTER
60    ' STRETCH????
61
62    Out.Log("Starting ...")
63
64    PropertyTester.TestProperty("ParaAdjust",nParaAdjust())
65
66    PropertyTester.TestProperty("ParaLineSpacing")
67
68    PropertyTester.TestProperty("ParaBackColor")
69
70    PropertyTester.TestProperty("ParaBackTransparent")
71
72    PropertyTester.TestProperty("ParaBackGraphicURL")
73
74    PropertyTester.TestProperty("ParaBackGraphicFilter")
75
76    PropertyTester.TestProperty("ParaBackGraphicLocation")
77
78    Out.Log("set ParaAdjust to com.sun.star.style.ParagraphAdjust.BLOCK")
79    oObj.ParaAdjust = com.sun.star.style.ParagraphAdjust.BLOCK
80    PropertyTester.TestProperty("ParaLastLineAdjust",nLastLineAdjust())
81    oObj.ParaAdjust = com.sun.star.style.ParagraphAdjust.LEFT
82
83    PropertyTester.TestProperty("ParaExpandSingleWord")
84
85    Dim margins(2) As Integer
86    margins(0) = 0
87    margins(1) = 50
88    margins(2) = 100
89
90    PropertyTester.TestProperty("ParaLeftMargin",margins())
91
92    PropertyTester.TestProperty("ParaRightMargin",margins())
93
94    PropertyTester.TestProperty("ParaTopMargin",margins())
95
96    PropertyTester.TestProperty("ParaBottomMargin",margins())
97
98    PropertyTester.TestProperty("ParaLineNumberCount")
99
100    PropertyTester.TestProperty("ParaLineNumberStartValue")
101
102    Dim cPageDescName(0 To 1) As String
103    cPageDescName(0) = "HTML"
104    cPageDescName(1) = "Standard"
105    PropertyTester.TestProperty("PageDescName",cPageDescName())
106
107    PropertyTester.TestProperty("PageNumberOffset")
108
109    PropertyTester.TestProperty("ParaRegisterModeActive")
110
111    PropertyTester.TestProperty("ParaTabStops")
112
113    Dim cParaStyleName(0 to 3) As String
114    cParaStyleName(0) = "Heading 1"
115    cParaStyleName(1) = "First line indent"
116    cParaStyleName(2) = "Text body"
117    cParaStyleName(3) = "Standard"
118    PropertyTester.TestProperty("ParaStyleName",cParaStyleName())
119
120    PropertyTester.TestProperty("DropCapFormat")
121
122    PropertyTester.TestProperty("DropCapWholeWord")
123
124    PropertyTester.TestProperty("ParaKeepTogether")
125
126    PropertyTester.TestProperty("ParaSplit")
127
128    Dim nLevel(0 to 1) As Integer
129    nLevel(0) = 3
130    nLevel(1) = 0
131    Out.Log("Set NumberingStyleName to 'List 2' "
132    if PropertyTester.isAvailable("NumberingStyleName") then
133        oObj.NumberingStyleName = "List 2"
134    end if
135    PropertyTester.TestProperty("NumberingLevel",nLevel())
136
137    PropertyTester.TestProperty("NumberingRules")
138
139    PropertyTester.TestProperty("NumberingStartValue")
140
141    PropertyTester.TestProperty("ParaIsNumberingRestart")
142
143    Dim cStyleName(0 to 1) As String
144    cStyleName(0) = "List 1"
145    cStyleName(1) = "Numbering 2"
146    PropertyTester.TestProperty("NumberingStyleName",cStyleName())
147
148    PropertyTester.TestProperty("ParaOrphans")
149
150    PropertyTester.TestProperty("ParaWidows")
151
152    PropertyTester.TestProperty("ParaShadowFormat")
153
154    PropertyTester.TestProperty("LeftBorder")
155
156    PropertyTester.TestProperty("RightBorder")
157
158    PropertyTester.TestProperty("TopBorder")
159
160    PropertyTester.TestProperty("BottomBorder")
161
162    PropertyTester.TestProperty("BorderDistance")
163
164    PropertyTester.TestProperty("LeftBorderDistance")
165
166    PropertyTester.TestProperty("RightBorderDistance")
167
168    PropertyTester.TestProperty("TopBorderDistance")
169
170    PropertyTester.TestProperty("BottomBorderDistance")
171
172    PropertyTester.TestProperty("BreakType")
173
174	Dim cCharStyles(1) as String
175	cCharStyles(0) = "Emphasis"
176	CCharStyles(1) = "Teletype"
177
178    PropertyTester.TestProperty("DropCapCharStyleName",cCharStyles())
179
180    PropertyTester.TestProperty("ParaFirstLineIndent")
181
182    PropertyTester.TestProperty("ParaIsAutoFirstLineIndent")
183
184    PropertyTester.TestProperty("ParaHyphenationMaxHyphens")
185
186    PropertyTester.TestProperty("ParaHyphenationMaxLeadingChars")
187
188    PropertyTester.TestProperty("ParaHyphenationMaxTrailingChars")
189
190	Dim VertAlign(0 to 4) as Integer
191	Dim nCount as Integer
192	for nCount = 0 to uBound(VertAlign())
193		VertAlign(nCount) = nCount
194	next nCount
195    PropertyTester.TestProperty("ParaVertAlignment", VertAlign())
196
197    PropertyTester.TestProperty("ParaUserDefinedAttributes")
198
199    PropertyTester.TestProperty("ParaIsHyphenation")
200
201Exit Sub
202ErrHndl:
203    Test.Exception()
204    bOK = false
205    resume next
206End Sub
207</script:module>
208