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