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