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