1*b1cdbd2cSJim Jagielski<?xml version="1.0" encoding="UTF-8"?>
2*b1cdbd2cSJim Jagielski<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
3*b1cdbd2cSJim Jagielski<script:module xmlns:script="http://openoffice.org/2000/script" script:name="style_CharacterProperties" script:language="StarBasic">
4*b1cdbd2cSJim Jagielski
5*b1cdbd2cSJim Jagielski
6*b1cdbd2cSJim Jagielski'*************************************************************************
7*b1cdbd2cSJim Jagielski'
8*b1cdbd2cSJim Jagielski'  Licensed to the Apache Software Foundation (ASF) under one
9*b1cdbd2cSJim Jagielski'  or more contributor license agreements.  See the NOTICE file
10*b1cdbd2cSJim Jagielski'  distributed with this work for additional information
11*b1cdbd2cSJim Jagielski'  regarding copyright ownership.  The ASF licenses this file
12*b1cdbd2cSJim Jagielski'  to you under the Apache License, Version 2.0 (the
13*b1cdbd2cSJim Jagielski'  "License"); you may not use this file except in compliance
14*b1cdbd2cSJim Jagielski'  with the License.  You may obtain a copy of the License at
15*b1cdbd2cSJim Jagielski'
16*b1cdbd2cSJim Jagielski'    http://www.apache.org/licenses/LICENSE-2.0
17*b1cdbd2cSJim Jagielski'
18*b1cdbd2cSJim Jagielski'  Unless required by applicable law or agreed to in writing,
19*b1cdbd2cSJim Jagielski'  software distributed under the License is distributed on an
20*b1cdbd2cSJim Jagielski'  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
21*b1cdbd2cSJim Jagielski'  KIND, either express or implied.  See the License for the
22*b1cdbd2cSJim Jagielski'  specific language governing permissions and limitations
23*b1cdbd2cSJim Jagielski'  under the License.
24*b1cdbd2cSJim Jagielski'
25*b1cdbd2cSJim Jagielski'*************************************************************************
26*b1cdbd2cSJim Jagielski
27*b1cdbd2cSJim Jagielski
28*b1cdbd2cSJim Jagielski
29*b1cdbd2cSJim Jagielski
30*b1cdbd2cSJim Jagielski
31*b1cdbd2cSJim Jagielski' Be sure that all variables are dimensioned:
32*b1cdbd2cSJim Jagielskioption explicit
33*b1cdbd2cSJim Jagielski
34*b1cdbd2cSJim Jagielski
35*b1cdbd2cSJim Jagielski
36*b1cdbd2cSJim JagielskiSub RunTest()
37*b1cdbd2cSJim Jagielski
38*b1cdbd2cSJim Jagielski'*************************************************************************
39*b1cdbd2cSJim Jagielski' SERVICE:
40*b1cdbd2cSJim Jagielski' com.sun.star.style.CharacterProperties
41*b1cdbd2cSJim Jagielski'*************************************************************************
42*b1cdbd2cSJim JagielskiOn Error Goto ErrHndl
43*b1cdbd2cSJim Jagielski    Dim bOK As Boolean
44*b1cdbd2cSJim Jagielski    Dim oStyleFamilies, oCharStyles As Variant
45*b1cdbd2cSJim Jagielski
46*b1cdbd2cSJim Jagielski    PropertyTester.TestProperty("CharFontName")
47*b1cdbd2cSJim Jagielski
48*b1cdbd2cSJim Jagielski    PropertyTester.TestProperty("CharFontStyleName")
49*b1cdbd2cSJim Jagielski
50*b1cdbd2cSJim Jagielski    Dim aFamilys(6) As Integer
51*b1cdbd2cSJim Jagielski    with com.sun.star.awt.FontFamily
52*b1cdbd2cSJim Jagielski        aFamilys(0) = .DONTKNOW
53*b1cdbd2cSJim Jagielski        aFamilys(1) = .DECORATIVE
54*b1cdbd2cSJim Jagielski        aFamilys(2) = .MODERN
55*b1cdbd2cSJim Jagielski        aFamilys(3) = .ROMAN
56*b1cdbd2cSJim Jagielski        aFamilys(4) = .SCRIPT
57*b1cdbd2cSJim Jagielski        aFamilys(5) = .SWISS
58*b1cdbd2cSJim Jagielski        aFamilys(6) = .SYSTEM
59*b1cdbd2cSJim Jagielski    end with
60*b1cdbd2cSJim Jagielski    PropertyTester.TestProperty("CharFontFamily",aFamilys())
61*b1cdbd2cSJim Jagielski
62*b1cdbd2cSJim Jagielski    Dim aCharSetArray(10) As Integer
63*b1cdbd2cSJim Jagielski    with com.sun.star.awt.CharSet
64*b1cdbd2cSJim Jagielski        aCharSetArray(0) = .DONTKNOW
65*b1cdbd2cSJim Jagielski        aCharSetArray(1) = .ANSI
66*b1cdbd2cSJim Jagielski        aCharSetArray(2) = .MAC
67*b1cdbd2cSJim Jagielski        aCharSetArray(3) = .IBMPC_437
68*b1cdbd2cSJim Jagielski        aCharSetArray(4) = .IBMPC_850
69*b1cdbd2cSJim Jagielski        aCharSetArray(5) = .IBMPC_860
70*b1cdbd2cSJim Jagielski        aCharSetArray(6) = .IBMPC_861
71*b1cdbd2cSJim Jagielski        aCharSetArray(7) = .IBMPC_863
72*b1cdbd2cSJim Jagielski        aCharSetArray(8) = .IBMPC_865
73*b1cdbd2cSJim Jagielski        aCharSetArray(9) = .SYSTEM
74*b1cdbd2cSJim Jagielski        aCharSetArray(10) = .SYMBOL
75*b1cdbd2cSJim Jagielski    end with
76*b1cdbd2cSJim Jagielski
77*b1cdbd2cSJim Jagielski    PropertyTester.TestProperty("CharFontCharSet",aCharSetArray())
78*b1cdbd2cSJim Jagielski
79*b1cdbd2cSJim Jagielski    Dim aFontPitchArray(3) As Integer
80*b1cdbd2cSJim Jagielski    with com.sun.star.awt.FontPitch
81*b1cdbd2cSJim Jagielski        aFontPitchArray(0) = .DONTKNOW
82*b1cdbd2cSJim Jagielski        aFontPitchArray(1) = .FIXED
83*b1cdbd2cSJim Jagielski        aFontPitchArray(2) = .VARIABLE
84*b1cdbd2cSJim Jagielski    end with
85*b1cdbd2cSJim Jagielski    PropertyTester.TestProperty("CharFontPitch",aFontPitchArray())
86*b1cdbd2cSJim Jagielski
87*b1cdbd2cSJim Jagielski    PropertyTester.TestProperty("CharColor")
88*b1cdbd2cSJim Jagielski
89*b1cdbd2cSJim Jagielski    Dim vCharEsc (0 to 4) As Integer
90*b1cdbd2cSJim Jagielski    vCharEsc(0) = -100
91*b1cdbd2cSJim Jagielski    vCharEsc(1) = 100
92*b1cdbd2cSJim Jagielski    vCharEsc(2) = -63
93*b1cdbd2cSJim Jagielski    vCharEsc(3) = 76
94*b1cdbd2cSJim Jagielski    vCharEsc(4) = 0
95*b1cdbd2cSJim Jagielski    PropertyTester.TestProperty("CharEscapement",vCharEsc())
96*b1cdbd2cSJim Jagielski
97*b1cdbd2cSJim Jagielski    Dim aHeightArray(3) As Double
98*b1cdbd2cSJim Jagielski    aHeightArray(0) = 10
99*b1cdbd2cSJim Jagielski    aHeightArray(1) = 20.1
100*b1cdbd2cSJim Jagielski    aHeightArray(2) = 25.2
101*b1cdbd2cSJim Jagielski    aHeightArray(3) = 30.3
102*b1cdbd2cSJim Jagielski    PropertyTester.TestProperty("CharHeight",aHeightArray())
103*b1cdbd2cSJim Jagielski
104*b1cdbd2cSJim Jagielski    Dim aUnderlineArray(18) As Integer
105*b1cdbd2cSJim Jagielski    with com.sun.star.awt.FontUnderline
106*b1cdbd2cSJim Jagielski        aUnderlineArray(0) = .NONE
107*b1cdbd2cSJim Jagielski        aUnderlineArray(1) = .SINGLE
108*b1cdbd2cSJim Jagielski        aUnderlineArray(2) = .DOUBLE
109*b1cdbd2cSJim Jagielski        aUnderlineArray(3) = .DOTTED
110*b1cdbd2cSJim Jagielski        aUnderlineArray(4) = .DONTKNOW
111*b1cdbd2cSJim Jagielski        aUnderlineArray(5) = .DASH
112*b1cdbd2cSJim Jagielski        aUnderlineArray(6) = .LONGDASH
113*b1cdbd2cSJim Jagielski        aUnderlineArray(7) = .DASHDOT
114*b1cdbd2cSJim Jagielski        aUnderlineArray(8) = .DASHDOTDOT
115*b1cdbd2cSJim Jagielski        aUnderlineArray(9) = .SMALLWAVE
116*b1cdbd2cSJim Jagielski        aUnderlineArray(10) = .WAVE
117*b1cdbd2cSJim Jagielski        aUnderlineArray(11) = .DOUBLEWAVE
118*b1cdbd2cSJim Jagielski        aUnderlineArray(12) = .BOLD
119*b1cdbd2cSJim Jagielski        aUnderlineArray(13) = .BOLDDOTTED
120*b1cdbd2cSJim Jagielski        aUnderlineArray(14) = .BOLDDASH
121*b1cdbd2cSJim Jagielski        aUnderlineArray(15) = .BOLDLONGDASH
122*b1cdbd2cSJim Jagielski        aUnderlineArray(16) = .BOLDDASHDOT
123*b1cdbd2cSJim Jagielski        aUnderlineArray(17) = .BOLDDASHDOTDOT
124*b1cdbd2cSJim Jagielski        aUnderlineArray(18) = .BOLDWAVE
125*b1cdbd2cSJim Jagielski    end with
126*b1cdbd2cSJim Jagielski    PropertyTester.TestProperty("CharUnderline",aUnderlineArray())
127*b1cdbd2cSJim Jagielski
128*b1cdbd2cSJim Jagielski    Dim aWeightArray(9) As Integer
129*b1cdbd2cSJim Jagielski    with com.sun.star.awt.FontWeight
130*b1cdbd2cSJim Jagielski        aWeightArray(0) = .DONTKNOW
131*b1cdbd2cSJim Jagielski        aWeightArray(1) = .THIN
132*b1cdbd2cSJim Jagielski        aWeightArray(2) = .ULTRALIGHT
133*b1cdbd2cSJim Jagielski        aWeightArray(3) = .LIGHT
134*b1cdbd2cSJim Jagielski        aWeightArray(4) = .SEMILIGHT
135*b1cdbd2cSJim Jagielski        aWeightArray(5) = .NORMAL
136*b1cdbd2cSJim Jagielski        aWeightArray(6) = .SEMIBOLD
137*b1cdbd2cSJim Jagielski        aWeightArray(7) = .BOLD
138*b1cdbd2cSJim Jagielski        aWeightArray(8) = .ULTRABOLD
139*b1cdbd2cSJim Jagielski        aWeightArray(9) = .BLACK
140*b1cdbd2cSJim Jagielski    end with
141*b1cdbd2cSJim Jagielski
142*b1cdbd2cSJim Jagielski    PropertyTester.TestProperty("CharWeight",aWeightArray())
143*b1cdbd2cSJim Jagielski
144*b1cdbd2cSJim Jagielski    PropertyTester.TestProperty("CharPosture")
145*b1cdbd2cSJim Jagielski
146*b1cdbd2cSJim Jagielski    PropertyTester.TestProperty("CharAutoKerning")
147*b1cdbd2cSJim Jagielski
148*b1cdbd2cSJim Jagielski    PropertyTester.TestProperty("CharBackColor")
149*b1cdbd2cSJim Jagielski
150*b1cdbd2cSJim Jagielski    PropertyTester.TestProperty("CharBackTransparent")
151*b1cdbd2cSJim Jagielski
152*b1cdbd2cSJim Jagielski    Dim aCaseMaps(4) As Integer
153*b1cdbd2cSJim Jagielski    with com.sun.star.style.CaseMap
154*b1cdbd2cSJim Jagielski        aCaseMaps(0) = .NONE
155*b1cdbd2cSJim Jagielski        aCaseMaps(1) = .UPPERCASE
156*b1cdbd2cSJim Jagielski        aCaseMaps(2) = .LOWERCASE
157*b1cdbd2cSJim Jagielski        aCaseMaps(3) = .TITLE
158*b1cdbd2cSJim Jagielski        aCaseMaps(4) = .SMALLCAPS
159*b1cdbd2cSJim Jagielski    end with
160*b1cdbd2cSJim Jagielski    PropertyTester.TestProperty("CharCaseMap",aCaseMaps())
161*b1cdbd2cSJim Jagielski
162*b1cdbd2cSJim Jagielski    PropertyTester.TestProperty("CharCrossedOut")
163*b1cdbd2cSJim Jagielski
164*b1cdbd2cSJim Jagielski    PropertyTester.TestProperty("CharFlash")
165*b1cdbd2cSJim Jagielski
166*b1cdbd2cSJim Jagielski    Dim aStrikeoutArray(6) As Integer
167*b1cdbd2cSJim Jagielski    with com.sun.star.awt.FontStrikeout
168*b1cdbd2cSJim Jagielski        aStrikeoutArray(0) = .NONE
169*b1cdbd2cSJim Jagielski        aStrikeoutArray(1) = .SINGLE
170*b1cdbd2cSJim Jagielski        aStrikeoutArray(2) = .DOUBLE
171*b1cdbd2cSJim Jagielski        aStrikeoutArray(3) = .DONTKNOW
172*b1cdbd2cSJim Jagielski        aStrikeoutArray(4) = .BOLD
173*b1cdbd2cSJim Jagielski        aStrikeoutArray(5) = .SLASH
174*b1cdbd2cSJim Jagielski        aStrikeoutArray(6) = .X
175*b1cdbd2cSJim Jagielski    end with
176*b1cdbd2cSJim Jagielski    PropertyTester.TestProperty("CharStrikeout",aStrikeoutArray())
177*b1cdbd2cSJim Jagielski
178*b1cdbd2cSJim Jagielski    PropertyTester.TestProperty("CharWordMode")
179*b1cdbd2cSJim Jagielski
180*b1cdbd2cSJim Jagielski    PropertyTester.TestProperty("CharKerning")
181*b1cdbd2cSJim Jagielski
182*b1cdbd2cSJim Jagielski    PropertyTester.TestProperty("CharLocale")
183*b1cdbd2cSJim Jagielski
184*b1cdbd2cSJim Jagielski    PropertyTester.TestProperty("CharKeepTogether")
185*b1cdbd2cSJim Jagielski
186*b1cdbd2cSJim Jagielski    PropertyTester.TestProperty("CharNoLineBreak")
187*b1cdbd2cSJim Jagielski
188*b1cdbd2cSJim Jagielski    PropertyTester.TestProperty("CharShadowed")
189*b1cdbd2cSJim Jagielski
190*b1cdbd2cSJim Jagielski    PropertyTester.TestProperty("CharFontType")
191*b1cdbd2cSJim Jagielski
192*b1cdbd2cSJim Jagielski    PropertyTester.TestProperty("CharContoured")
193*b1cdbd2cSJim Jagielski
194*b1cdbd2cSJim Jagielski    PropertyTester.TestProperty("CharCombineIsOn")
195*b1cdbd2cSJim Jagielski
196*b1cdbd2cSJim Jagielski    oObj.setPropertyValue("CharCombineIsOn", true)
197*b1cdbd2cSJim Jagielski    Dim aPrifixes(1) As String
198*b1cdbd2cSJim Jagielski    aPrifixes(0) = "("
199*b1cdbd2cSJim Jagielski    aPrifixes(1) = "["
200*b1cdbd2cSJim Jagielski    PropertyTester.TestProperty("CharCombinePrefix", aPrifixes())
201*b1cdbd2cSJim Jagielski
202*b1cdbd2cSJim Jagielski    Dim aSuffixes(1) As String
203*b1cdbd2cSJim Jagielski    aSuffixes(0) = ")"
204*b1cdbd2cSJim Jagielski    aSuffixes(1) = "]"
205*b1cdbd2cSJim Jagielski    PropertyTester.TestProperty("CharCombineSuffix", aSuffixes())
206*b1cdbd2cSJim Jagielski
207*b1cdbd2cSJim Jagielski    Dim aCharEmphasizeArr(8) As Integer
208*b1cdbd2cSJim Jagielski    with com.sun.star.text.FontEmphasis
209*b1cdbd2cSJim Jagielski        aCharEmphasizeArr(0) = .NONE
210*b1cdbd2cSJim Jagielski        aCharEmphasizeArr(1) = .DOT_ABOVE
211*b1cdbd2cSJim Jagielski        aCharEmphasizeArr(2) = .CIRCLE_ABOVE
212*b1cdbd2cSJim Jagielski        aCharEmphasizeArr(3) = .DISK_ABOVE
213*b1cdbd2cSJim Jagielski        aCharEmphasizeArr(4) = .ACCENT_ABOVE
214*b1cdbd2cSJim Jagielski        aCharEmphasizeArr(5) = .DOT_BELOW
215*b1cdbd2cSJim Jagielski        aCharEmphasizeArr(6) = .CIRCLE_BELOW
216*b1cdbd2cSJim Jagielski        aCharEmphasizeArr(7) = .DISK_BELOW
217*b1cdbd2cSJim Jagielski        aCharEmphasizeArr(8) = .ACCENT_BELOW
218*b1cdbd2cSJim Jagielski    end with
219*b1cdbd2cSJim Jagielski    PropertyTester.TestProperty("CharEmphasize",aCharEmphasizeArr())
220*b1cdbd2cSJim Jagielski
221*b1cdbd2cSJim Jagielski    Dim aReliefs(2) As Integer
222*b1cdbd2cSJim Jagielski    with com.sun.star.text.FontRelief
223*b1cdbd2cSJim Jagielski        aReliefs(0) = .NONE
224*b1cdbd2cSJim Jagielski        aReliefs(1) = .EMBOSSED
225*b1cdbd2cSJim Jagielski        aReliefs(2) = .ENGRAVED
226*b1cdbd2cSJim Jagielski    end with
227*b1cdbd2cSJim Jagielski    PropertyTester.TestProperty("CharRelief",aReliefs())
228*b1cdbd2cSJim Jagielski
229*b1cdbd2cSJim Jagielski    PropertyTester.TestProperty("CharRotationIsFitToLine")
230*b1cdbd2cSJim Jagielski
231*b1cdbd2cSJim Jagielski    PropertyTester.TestProperty("CharScaleWidth")
232*b1cdbd2cSJim Jagielski
233*b1cdbd2cSJim Jagielski    Dim aRotat(2) As Integer
234*b1cdbd2cSJim Jagielski    aRotat(0) = 900
235*b1cdbd2cSJim Jagielski    aRotat(1) = 2700
236*b1cdbd2cSJim Jagielski    aRotat(2) = 0
237*b1cdbd2cSJim Jagielski    PropertyTester.TestProperty("CharRotation",aRotat())
238*b1cdbd2cSJim Jagielski
239*b1cdbd2cSJim Jagielski    PropertyTester.TestProperty("RubyText")
240*b1cdbd2cSJim Jagielski
241*b1cdbd2cSJim Jagielski    PropertyTester.TestProperty("RubyIsAbove")
242*b1cdbd2cSJim Jagielski
243*b1cdbd2cSJim Jagielski    Dim aAdjusts(5) As Integer
244*b1cdbd2cSJim Jagielski    aAdjusts(0) = com.sun.star.text.RubyAdjust.LEFT
245*b1cdbd2cSJim Jagielski    aAdjusts(1) = com.sun.star.text.RubyAdjust.CENTER
246*b1cdbd2cSJim Jagielski    aAdjusts(2) = com.sun.star.text.RubyAdjust.RIGHT
247*b1cdbd2cSJim Jagielski    aAdjusts(3) = com.sun.star.text.RubyAdjust.LEFT
248*b1cdbd2cSJim Jagielski    aAdjusts(4) = com.sun.star.text.RubyAdjust.BLOCK
249*b1cdbd2cSJim Jagielski    aAdjusts(5) = com.sun.star.text.RubyAdjust.INDENT_BLOCK
250*b1cdbd2cSJim Jagielski    PropertyTester.TestProperty("RubyAdjust", aAdjusts())
251*b1cdbd2cSJim Jagielski
252*b1cdbd2cSJim Jagielski    Dim aCharStyleNames() As String
253*b1cdbd2cSJim Jagielski    oStyleFamilies = oDoc.StyleFamilies
254*b1cdbd2cSJim Jagielski    oCharStyles = oStyleFamilies.getByIndex(0)
255*b1cdbd2cSJim Jagielski    aCharStyleNames() = oCharStyles.Elementnames()
256*b1cdbd2cSJim Jagielski    aCharStyleNames(0) = aCharStyleNames(2) ' "Standard" the same as "", exclude it...
257*b1cdbd2cSJim Jagielski
258*b1cdbd2cSJim Jagielski    PropertyTester.TestProperty("RubyCharStyleName",aCharStyleNames())
259*b1cdbd2cSJim Jagielski
260*b1cdbd2cSJim Jagielski    PropertyTester.TestProperty("CharStyleName",aCharStyleNames())
261*b1cdbd2cSJim Jagielski
262*b1cdbd2cSJim Jagielski    PropertyTester.TestProperty("CharRotationIsFitToLine")
263*b1cdbd2cSJim Jagielski    PropertyTester.TestProperty("CharScaleWidth")
264*b1cdbd2cSJim Jagielski    PropertyTester.TestProperty("HyperLinkURL")
265*b1cdbd2cSJim Jagielski    PropertyTester.TestProperty("HyperLinkTarget")
266*b1cdbd2cSJim Jagielski    PropertyTester.TestProperty("HyperLinkName")
267*b1cdbd2cSJim Jagielski
268*b1cdbd2cSJim Jagielski	Dim nHeight(0 to 2) as Integer
269*b1cdbd2cSJim Jagielski		nHeight(0)=1
270*b1cdbd2cSJim Jagielski		nHeight(1)=33
271*b1cdbd2cSJim Jagielski		nHeight(2)=100
272*b1cdbd2cSJim Jagielski	PropertyTester.TestProperty("CharEscapementHeight", nHeight())
273*b1cdbd2cSJim Jagielski
274*b1cdbd2cSJim Jagielski    PropertyTester.TestProperty("CharNoHyphenation")
275*b1cdbd2cSJim Jagielski    PropertyTester.TestProperty("CharUnderlineHasColor")
276*b1cdbd2cSJim Jagielski	oObj.CharUnderlineHasColor = TRUE
277*b1cdbd2cSJim Jagielski    PropertyTester.TestProperty("CharUnderlineColor")
278*b1cdbd2cSJim Jagielski
279*b1cdbd2cSJim Jagielski    ReCreateObj()
280*b1cdbd2cSJim Jagielski
281*b1cdbd2cSJim JagielskiExit Sub
282*b1cdbd2cSJim JagielskiErrHndl:
283*b1cdbd2cSJim Jagielski    Test.Exception()
284*b1cdbd2cSJim Jagielski    bOK = false
285*b1cdbd2cSJim Jagielski    resume next
286*b1cdbd2cSJim JagielskiEnd Sub
287*b1cdbd2cSJim Jagielski</script:module>
288