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_CharacterProperties" 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' Be sure that all variables are dimensioned:
38option explicit
39
40
41
42Sub RunTest()
43
44'*************************************************************************
45' SERVICE:
46' com.sun.star.style.CharacterProperties
47'*************************************************************************
48On Error Goto ErrHndl
49    Dim bOK As Boolean
50    Dim oStyleFamilies, oCharStyles As Variant
51
52    PropertyTester.TestProperty("CharFontName")
53
54    PropertyTester.TestProperty("CharFontStyleName")
55
56    Dim aFamilys(6) As Integer
57    with com.sun.star.awt.FontFamily
58        aFamilys(0) = .DONTKNOW
59        aFamilys(1) = .DECORATIVE
60        aFamilys(2) = .MODERN
61        aFamilys(3) = .ROMAN
62        aFamilys(4) = .SCRIPT
63        aFamilys(5) = .SWISS
64        aFamilys(6) = .SYSTEM
65    end with
66    PropertyTester.TestProperty("CharFontFamily",aFamilys())
67
68    Dim aCharSetArray(10) As Integer
69    with com.sun.star.awt.CharSet
70        aCharSetArray(0) = .DONTKNOW
71        aCharSetArray(1) = .ANSI
72        aCharSetArray(2) = .MAC
73        aCharSetArray(3) = .IBMPC_437
74        aCharSetArray(4) = .IBMPC_850
75        aCharSetArray(5) = .IBMPC_860
76        aCharSetArray(6) = .IBMPC_861
77        aCharSetArray(7) = .IBMPC_863
78        aCharSetArray(8) = .IBMPC_865
79        aCharSetArray(9) = .SYSTEM
80        aCharSetArray(10) = .SYMBOL
81    end with
82
83    PropertyTester.TestProperty("CharFontCharSet",aCharSetArray())
84
85    Dim aFontPitchArray(3) As Integer
86    with com.sun.star.awt.FontPitch
87        aFontPitchArray(0) = .DONTKNOW
88        aFontPitchArray(1) = .FIXED
89        aFontPitchArray(2) = .VARIABLE
90    end with
91    PropertyTester.TestProperty("CharFontPitch",aFontPitchArray())
92
93    PropertyTester.TestProperty("CharColor")
94
95    Dim vCharEsc (0 to 4) As Integer
96    vCharEsc(0) = -100
97    vCharEsc(1) = 100
98    vCharEsc(2) = -63
99    vCharEsc(3) = 76
100    vCharEsc(4) = 0
101    PropertyTester.TestProperty("CharEscapement",vCharEsc())
102
103    Dim aHeightArray(3) As Double
104    aHeightArray(0) = 10
105    aHeightArray(1) = 20.1
106    aHeightArray(2) = 25.2
107    aHeightArray(3) = 30.3
108    PropertyTester.TestProperty("CharHeight",aHeightArray())
109
110    Dim aUnderlineArray(18) As Integer
111    with com.sun.star.awt.FontUnderline
112        aUnderlineArray(0) = .NONE
113        aUnderlineArray(1) = .SINGLE
114        aUnderlineArray(2) = .DOUBLE
115        aUnderlineArray(3) = .DOTTED
116        aUnderlineArray(4) = .DONTKNOW
117        aUnderlineArray(5) = .DASH
118        aUnderlineArray(6) = .LONGDASH
119        aUnderlineArray(7) = .DASHDOT
120        aUnderlineArray(8) = .DASHDOTDOT
121        aUnderlineArray(9) = .SMALLWAVE
122        aUnderlineArray(10) = .WAVE
123        aUnderlineArray(11) = .DOUBLEWAVE
124        aUnderlineArray(12) = .BOLD
125        aUnderlineArray(13) = .BOLDDOTTED
126        aUnderlineArray(14) = .BOLDDASH
127        aUnderlineArray(15) = .BOLDLONGDASH
128        aUnderlineArray(16) = .BOLDDASHDOT
129        aUnderlineArray(17) = .BOLDDASHDOTDOT
130        aUnderlineArray(18) = .BOLDWAVE
131    end with
132    PropertyTester.TestProperty("CharUnderline",aUnderlineArray())
133
134    Dim aWeightArray(9) As Integer
135    with com.sun.star.awt.FontWeight
136        aWeightArray(0) = .DONTKNOW
137        aWeightArray(1) = .THIN
138        aWeightArray(2) = .ULTRALIGHT
139        aWeightArray(3) = .LIGHT
140        aWeightArray(4) = .SEMILIGHT
141        aWeightArray(5) = .NORMAL
142        aWeightArray(6) = .SEMIBOLD
143        aWeightArray(7) = .BOLD
144        aWeightArray(8) = .ULTRABOLD
145        aWeightArray(9) = .BLACK
146    end with
147
148    PropertyTester.TestProperty("CharWeight",aWeightArray())
149
150    PropertyTester.TestProperty("CharPosture")
151
152    PropertyTester.TestProperty("CharAutoKerning")
153
154    PropertyTester.TestProperty("CharBackColor")
155
156    PropertyTester.TestProperty("CharBackTransparent")
157
158    Dim aCaseMaps(4) As Integer
159    with com.sun.star.style.CaseMap
160        aCaseMaps(0) = .NONE
161        aCaseMaps(1) = .UPPERCASE
162        aCaseMaps(2) = .LOWERCASE
163        aCaseMaps(3) = .TITLE
164        aCaseMaps(4) = .SMALLCAPS
165    end with
166    PropertyTester.TestProperty("CharCaseMap",aCaseMaps())
167
168    PropertyTester.TestProperty("CharCrossedOut")
169
170    PropertyTester.TestProperty("CharFlash")
171
172    Dim aStrikeoutArray(6) As Integer
173    with com.sun.star.awt.FontStrikeout
174        aStrikeoutArray(0) = .NONE
175        aStrikeoutArray(1) = .SINGLE
176        aStrikeoutArray(2) = .DOUBLE
177        aStrikeoutArray(3) = .DONTKNOW
178        aStrikeoutArray(4) = .BOLD
179        aStrikeoutArray(5) = .SLASH
180        aStrikeoutArray(6) = .X
181    end with
182    PropertyTester.TestProperty("CharStrikeout",aStrikeoutArray())
183
184    PropertyTester.TestProperty("CharWordMode")
185
186    PropertyTester.TestProperty("CharKerning")
187
188    PropertyTester.TestProperty("CharLocale")
189
190    PropertyTester.TestProperty("CharKeepTogether")
191
192    PropertyTester.TestProperty("CharNoLineBreak")
193
194    PropertyTester.TestProperty("CharShadowed")
195
196    PropertyTester.TestProperty("CharFontType")
197
198    PropertyTester.TestProperty("CharContoured")
199
200    PropertyTester.TestProperty("CharCombineIsOn")
201
202    oObj.setPropertyValue("CharCombineIsOn", true)
203    Dim aPrifixes(1) As String
204    aPrifixes(0) = "("
205    aPrifixes(1) = "["
206    PropertyTester.TestProperty("CharCombinePrefix", aPrifixes())
207
208    Dim aSuffixes(1) As String
209    aSuffixes(0) = ")"
210    aSuffixes(1) = "]"
211    PropertyTester.TestProperty("CharCombineSuffix", aSuffixes())
212
213    Dim aCharEmphasizeArr(8) As Integer
214    with com.sun.star.text.FontEmphasis
215        aCharEmphasizeArr(0) = .NONE
216        aCharEmphasizeArr(1) = .DOT_ABOVE
217        aCharEmphasizeArr(2) = .CIRCLE_ABOVE
218        aCharEmphasizeArr(3) = .DISK_ABOVE
219        aCharEmphasizeArr(4) = .ACCENT_ABOVE
220        aCharEmphasizeArr(5) = .DOT_BELOW
221        aCharEmphasizeArr(6) = .CIRCLE_BELOW
222        aCharEmphasizeArr(7) = .DISK_BELOW
223        aCharEmphasizeArr(8) = .ACCENT_BELOW
224    end with
225    PropertyTester.TestProperty("CharEmphasize",aCharEmphasizeArr())
226
227    Dim aReliefs(2) As Integer
228    with com.sun.star.text.FontRelief
229        aReliefs(0) = .NONE
230        aReliefs(1) = .EMBOSSED
231        aReliefs(2) = .ENGRAVED
232    end with
233    PropertyTester.TestProperty("CharRelief",aReliefs())
234
235    PropertyTester.TestProperty("CharRotationIsFitToLine")
236
237    PropertyTester.TestProperty("CharScaleWidth")
238
239    Dim aRotat(2) As Integer
240    aRotat(0) = 900
241    aRotat(1) = 2700
242    aRotat(2) = 0
243    PropertyTester.TestProperty("CharRotation",aRotat())
244
245    PropertyTester.TestProperty("RubyText")
246
247    PropertyTester.TestProperty("RubyIsAbove")
248
249    Dim aAdjusts(5) As Integer
250    aAdjusts(0) = com.sun.star.text.RubyAdjust.LEFT
251    aAdjusts(1) = com.sun.star.text.RubyAdjust.CENTER
252    aAdjusts(2) = com.sun.star.text.RubyAdjust.RIGHT
253    aAdjusts(3) = com.sun.star.text.RubyAdjust.LEFT
254    aAdjusts(4) = com.sun.star.text.RubyAdjust.BLOCK
255    aAdjusts(5) = com.sun.star.text.RubyAdjust.INDENT_BLOCK
256    PropertyTester.TestProperty("RubyAdjust", aAdjusts())
257
258    Dim aCharStyleNames() As String
259    oStyleFamilies = oDoc.StyleFamilies
260    oCharStyles = oStyleFamilies.getByIndex(0)
261    aCharStyleNames() = oCharStyles.Elementnames()
262    aCharStyleNames(0) = aCharStyleNames(2) ' "Standard" the same as "", exclude it...
263
264    PropertyTester.TestProperty("RubyCharStyleName",aCharStyleNames())
265
266    PropertyTester.TestProperty("CharStyleName",aCharStyleNames())
267
268    PropertyTester.TestProperty("CharRotationIsFitToLine")
269    PropertyTester.TestProperty("CharScaleWidth")
270    PropertyTester.TestProperty("HyperLinkURL")
271    PropertyTester.TestProperty("HyperLinkTarget")
272    PropertyTester.TestProperty("HyperLinkName")
273
274	Dim nHeight(0 to 2) as Integer
275		nHeight(0)=1
276		nHeight(1)=33
277		nHeight(2)=100
278	PropertyTester.TestProperty("CharEscapementHeight", nHeight())
279
280    PropertyTester.TestProperty("CharNoHyphenation")
281    PropertyTester.TestProperty("CharUnderlineHasColor")
282	oObj.CharUnderlineHasColor = TRUE
283    PropertyTester.TestProperty("CharUnderlineColor")
284
285    ReCreateObj()
286
287Exit Sub
288ErrHndl:
289    Test.Exception()
290    bOK = false
291    resume next
292End Sub
293</script:module>
294