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