1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
|
<?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="style_ParagraphProperties" script:language="StarBasic">
'*************************************************************************
'
' DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
'
' Copyright 2008 by Sun Microsystems, Inc.
'
' OpenOffice.org - a multi-platform office productivity suite
'
' $RCSfile: style_ParagraphProperties.xba,v $
'
' $Revision: 1.3 $
'
' This file is part of OpenOffice.org.
'
' OpenOffice.org is free software: you can redistribute it and/or modify
' it under the terms of the GNU Lesser General Public License version 3
' only, as published by the Free Software Foundation.
'
' OpenOffice.org is distributed in the hope that it will be useful,
' but WITHOUT ANY WARRANTY; without even the implied warranty of
' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
' GNU Lesser General Public License version 3 for more details
' (a copy is included in the LICENSE file that accompanied this code).
'
' You should have received a copy of the GNU Lesser General Public License
' version 3 along with OpenOffice.org. If not, see
' <http://www.openoffice.org/license.html>
' for a copy of the LGPLv3 License.
'
'*************************************************************************
'*************************************************************************
' Be sure that all variables are dimensioned:
option explicit
Sub RunTest()
'*************************************************************************
' SERVICE:
' com.sun.star.style.ParagraphProperties
'*************************************************************************
On Error Goto ErrHndl
Dim bOK As Boolean
if hasUnoInterfaces(oObj, "com.sun.star.text.XTextRange") then
oObj.String = "This is an example string from ParagraphProperties..."
end if
Dim nParaAdjust(3) As Integer
nParaAdjust(0) = com.sun.star.style.ParagraphAdjust.LEFT
nParaAdjust(1) = com.sun.star.style.ParagraphAdjust.RIGHT
nParaAdjust(2) = com.sun.star.style.ParagraphAdjust.BLOCK
nParaAdjust(3) = com.sun.star.style.ParagraphAdjust.CENTER
' STRETCH????
Dim nLastLineAdjust(2) As Integer
nLastLineAdjust(0) = com.sun.star.style.ParagraphAdjust.LEFT
nLastLineAdjust(1) = com.sun.star.style.ParagraphAdjust.BLOCK
nLastLineAdjust(2) = com.sun.star.style.ParagraphAdjust.CENTER
' STRETCH????
Out.Log("Starting ...")
PropertyTester.TestProperty("ParaAdjust",nParaAdjust())
PropertyTester.TestProperty("ParaLineSpacing")
PropertyTester.TestProperty("ParaBackColor")
PropertyTester.TestProperty("ParaBackTransparent")
PropertyTester.TestProperty("ParaBackGraphicURL")
PropertyTester.TestProperty("ParaBackGraphicFilter")
PropertyTester.TestProperty("ParaBackGraphicLocation")
Out.Log("set ParaAdjust to com.sun.star.style.ParagraphAdjust.BLOCK")
oObj.ParaAdjust = com.sun.star.style.ParagraphAdjust.BLOCK
PropertyTester.TestProperty("ParaLastLineAdjust",nLastLineAdjust())
oObj.ParaAdjust = com.sun.star.style.ParagraphAdjust.LEFT
PropertyTester.TestProperty("ParaExpandSingleWord")
Dim margins(2) As Integer
margins(0) = 0
margins(1) = 50
margins(2) = 100
PropertyTester.TestProperty("ParaLeftMargin",margins())
PropertyTester.TestProperty("ParaRightMargin",margins())
PropertyTester.TestProperty("ParaTopMargin",margins())
PropertyTester.TestProperty("ParaBottomMargin",margins())
PropertyTester.TestProperty("ParaLineNumberCount")
PropertyTester.TestProperty("ParaLineNumberStartValue")
Dim cPageDescName(0 To 1) As String
cPageDescName(0) = "HTML"
cPageDescName(1) = "Standard"
PropertyTester.TestProperty("PageDescName",cPageDescName())
PropertyTester.TestProperty("PageNumberOffset")
PropertyTester.TestProperty("ParaRegisterModeActive")
PropertyTester.TestProperty("ParaTabStops")
Dim cParaStyleName(0 to 3) As String
cParaStyleName(0) = "Heading 1"
cParaStyleName(1) = "First line indent"
cParaStyleName(2) = "Text body"
cParaStyleName(3) = "Standard"
PropertyTester.TestProperty("ParaStyleName",cParaStyleName())
PropertyTester.TestProperty("DropCapFormat")
PropertyTester.TestProperty("DropCapWholeWord")
PropertyTester.TestProperty("ParaKeepTogether")
PropertyTester.TestProperty("ParaSplit")
Dim nLevel(0 to 1) As Integer
nLevel(0) = 3
nLevel(1) = 0
Out.Log("Set NumberingStyleName to 'List 2' "
if PropertyTester.isAvailable("NumberingStyleName") then
oObj.NumberingStyleName = "List 2"
end if
PropertyTester.TestProperty("NumberingLevel",nLevel())
PropertyTester.TestProperty("NumberingRules")
PropertyTester.TestProperty("NumberingStartValue")
PropertyTester.TestProperty("ParaIsNumberingRestart")
Dim cStyleName(0 to 1) As String
cStyleName(0) = "List 1"
cStyleName(1) = "Numbering 2"
PropertyTester.TestProperty("NumberingStyleName",cStyleName())
PropertyTester.TestProperty("ParaOrphans")
PropertyTester.TestProperty("ParaWidows")
PropertyTester.TestProperty("ParaShadowFormat")
PropertyTester.TestProperty("LeftBorder")
PropertyTester.TestProperty("RightBorder")
PropertyTester.TestProperty("TopBorder")
PropertyTester.TestProperty("BottomBorder")
PropertyTester.TestProperty("BorderDistance")
PropertyTester.TestProperty("LeftBorderDistance")
PropertyTester.TestProperty("RightBorderDistance")
PropertyTester.TestProperty("TopBorderDistance")
PropertyTester.TestProperty("BottomBorderDistance")
PropertyTester.TestProperty("BreakType")
Dim cCharStyles(1) as String
cCharStyles(0) = "Emphasis"
CCharStyles(1) = "Teletype"
PropertyTester.TestProperty("DropCapCharStyleName",cCharStyles())
PropertyTester.TestProperty("ParaFirstLineIndent")
PropertyTester.TestProperty("ParaIsAutoFirstLineIndent")
PropertyTester.TestProperty("ParaHyphenationMaxHyphens")
PropertyTester.TestProperty("ParaHyphenationMaxLeadingChars")
PropertyTester.TestProperty("ParaHyphenationMaxTrailingChars")
Dim VertAlign(0 to 4) as Integer
Dim nCount as Integer
for nCount = 0 to uBound(VertAlign())
VertAlign(nCount) = nCount
next nCount
PropertyTester.TestProperty("ParaVertAlignment", VertAlign())
PropertyTester.TestProperty("ParaUserDefinedAttributes")
PropertyTester.TestProperty("ParaIsHyphenation")
Exit Sub
ErrHndl:
Test.Exception()
bOK = false
resume next
End Sub
</script:module>
|