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_ParagraphProperties" 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.ParagraphProperties
41*b1cdbd2cSJim Jagielski'*************************************************************************
42*b1cdbd2cSJim JagielskiOn Error Goto ErrHndl
43*b1cdbd2cSJim Jagielski    Dim bOK As Boolean
44*b1cdbd2cSJim Jagielski
45*b1cdbd2cSJim Jagielski    if hasUnoInterfaces(oObj, "com.sun.star.text.XTextRange") then
46*b1cdbd2cSJim Jagielski        oObj.String = "This is an example string from ParagraphProperties..."
47*b1cdbd2cSJim Jagielski    end if
48*b1cdbd2cSJim Jagielski
49*b1cdbd2cSJim Jagielski    Dim nParaAdjust(3) As Integer
50*b1cdbd2cSJim Jagielski    nParaAdjust(0) = com.sun.star.style.ParagraphAdjust.LEFT
51*b1cdbd2cSJim Jagielski    nParaAdjust(1) = com.sun.star.style.ParagraphAdjust.RIGHT
52*b1cdbd2cSJim Jagielski    nParaAdjust(2) = com.sun.star.style.ParagraphAdjust.BLOCK
53*b1cdbd2cSJim Jagielski    nParaAdjust(3) = com.sun.star.style.ParagraphAdjust.CENTER
54*b1cdbd2cSJim Jagielski    ' STRETCH????
55*b1cdbd2cSJim Jagielski
56*b1cdbd2cSJim Jagielski    Dim nLastLineAdjust(2) As Integer
57*b1cdbd2cSJim Jagielski    nLastLineAdjust(0) = com.sun.star.style.ParagraphAdjust.LEFT
58*b1cdbd2cSJim Jagielski    nLastLineAdjust(1) = com.sun.star.style.ParagraphAdjust.BLOCK
59*b1cdbd2cSJim Jagielski    nLastLineAdjust(2) = com.sun.star.style.ParagraphAdjust.CENTER
60*b1cdbd2cSJim Jagielski    ' STRETCH????
61*b1cdbd2cSJim Jagielski
62*b1cdbd2cSJim Jagielski    Out.Log("Starting ...")
63*b1cdbd2cSJim Jagielski
64*b1cdbd2cSJim Jagielski    PropertyTester.TestProperty("ParaAdjust",nParaAdjust())
65*b1cdbd2cSJim Jagielski
66*b1cdbd2cSJim Jagielski    PropertyTester.TestProperty("ParaLineSpacing")
67*b1cdbd2cSJim Jagielski
68*b1cdbd2cSJim Jagielski    PropertyTester.TestProperty("ParaBackColor")
69*b1cdbd2cSJim Jagielski
70*b1cdbd2cSJim Jagielski    PropertyTester.TestProperty("ParaBackTransparent")
71*b1cdbd2cSJim Jagielski
72*b1cdbd2cSJim Jagielski    PropertyTester.TestProperty("ParaBackGraphicURL")
73*b1cdbd2cSJim Jagielski
74*b1cdbd2cSJim Jagielski    PropertyTester.TestProperty("ParaBackGraphicFilter")
75*b1cdbd2cSJim Jagielski
76*b1cdbd2cSJim Jagielski    PropertyTester.TestProperty("ParaBackGraphicLocation")
77*b1cdbd2cSJim Jagielski
78*b1cdbd2cSJim Jagielski    Out.Log("set ParaAdjust to com.sun.star.style.ParagraphAdjust.BLOCK")
79*b1cdbd2cSJim Jagielski    oObj.ParaAdjust = com.sun.star.style.ParagraphAdjust.BLOCK
80*b1cdbd2cSJim Jagielski    PropertyTester.TestProperty("ParaLastLineAdjust",nLastLineAdjust())
81*b1cdbd2cSJim Jagielski    oObj.ParaAdjust = com.sun.star.style.ParagraphAdjust.LEFT
82*b1cdbd2cSJim Jagielski
83*b1cdbd2cSJim Jagielski    PropertyTester.TestProperty("ParaExpandSingleWord")
84*b1cdbd2cSJim Jagielski
85*b1cdbd2cSJim Jagielski    Dim margins(2) As Integer
86*b1cdbd2cSJim Jagielski    margins(0) = 0
87*b1cdbd2cSJim Jagielski    margins(1) = 50
88*b1cdbd2cSJim Jagielski    margins(2) = 100
89*b1cdbd2cSJim Jagielski
90*b1cdbd2cSJim Jagielski    PropertyTester.TestProperty("ParaLeftMargin",margins())
91*b1cdbd2cSJim Jagielski
92*b1cdbd2cSJim Jagielski    PropertyTester.TestProperty("ParaRightMargin",margins())
93*b1cdbd2cSJim Jagielski
94*b1cdbd2cSJim Jagielski    PropertyTester.TestProperty("ParaTopMargin",margins())
95*b1cdbd2cSJim Jagielski
96*b1cdbd2cSJim Jagielski    PropertyTester.TestProperty("ParaBottomMargin",margins())
97*b1cdbd2cSJim Jagielski
98*b1cdbd2cSJim Jagielski    PropertyTester.TestProperty("ParaLineNumberCount")
99*b1cdbd2cSJim Jagielski
100*b1cdbd2cSJim Jagielski    PropertyTester.TestProperty("ParaLineNumberStartValue")
101*b1cdbd2cSJim Jagielski
102*b1cdbd2cSJim Jagielski    Dim cPageDescName(0 To 1) As String
103*b1cdbd2cSJim Jagielski    cPageDescName(0) = "HTML"
104*b1cdbd2cSJim Jagielski    cPageDescName(1) = "Standard"
105*b1cdbd2cSJim Jagielski    PropertyTester.TestProperty("PageDescName",cPageDescName())
106*b1cdbd2cSJim Jagielski
107*b1cdbd2cSJim Jagielski    PropertyTester.TestProperty("PageNumberOffset")
108*b1cdbd2cSJim Jagielski
109*b1cdbd2cSJim Jagielski    PropertyTester.TestProperty("ParaRegisterModeActive")
110*b1cdbd2cSJim Jagielski
111*b1cdbd2cSJim Jagielski    PropertyTester.TestProperty("ParaTabStops")
112*b1cdbd2cSJim Jagielski
113*b1cdbd2cSJim Jagielski    Dim cParaStyleName(0 to 3) As String
114*b1cdbd2cSJim Jagielski    cParaStyleName(0) = "Heading 1"
115*b1cdbd2cSJim Jagielski    cParaStyleName(1) = "First line indent"
116*b1cdbd2cSJim Jagielski    cParaStyleName(2) = "Text body"
117*b1cdbd2cSJim Jagielski    cParaStyleName(3) = "Standard"
118*b1cdbd2cSJim Jagielski    PropertyTester.TestProperty("ParaStyleName",cParaStyleName())
119*b1cdbd2cSJim Jagielski
120*b1cdbd2cSJim Jagielski    PropertyTester.TestProperty("DropCapFormat")
121*b1cdbd2cSJim Jagielski
122*b1cdbd2cSJim Jagielski    PropertyTester.TestProperty("DropCapWholeWord")
123*b1cdbd2cSJim Jagielski
124*b1cdbd2cSJim Jagielski    PropertyTester.TestProperty("ParaKeepTogether")
125*b1cdbd2cSJim Jagielski
126*b1cdbd2cSJim Jagielski    PropertyTester.TestProperty("ParaSplit")
127*b1cdbd2cSJim Jagielski
128*b1cdbd2cSJim Jagielski    Dim nLevel(0 to 1) As Integer
129*b1cdbd2cSJim Jagielski    nLevel(0) = 3
130*b1cdbd2cSJim Jagielski    nLevel(1) = 0
131*b1cdbd2cSJim Jagielski    Out.Log("Set NumberingStyleName to 'List 2' "
132*b1cdbd2cSJim Jagielski    if PropertyTester.isAvailable("NumberingStyleName") then
133*b1cdbd2cSJim Jagielski        oObj.NumberingStyleName = "List 2"
134*b1cdbd2cSJim Jagielski    end if
135*b1cdbd2cSJim Jagielski    PropertyTester.TestProperty("NumberingLevel",nLevel())
136*b1cdbd2cSJim Jagielski
137*b1cdbd2cSJim Jagielski    PropertyTester.TestProperty("NumberingRules")
138*b1cdbd2cSJim Jagielski
139*b1cdbd2cSJim Jagielski    PropertyTester.TestProperty("NumberingStartValue")
140*b1cdbd2cSJim Jagielski
141*b1cdbd2cSJim Jagielski    PropertyTester.TestProperty("ParaIsNumberingRestart")
142*b1cdbd2cSJim Jagielski
143*b1cdbd2cSJim Jagielski    Dim cStyleName(0 to 1) As String
144*b1cdbd2cSJim Jagielski    cStyleName(0) = "List 1"
145*b1cdbd2cSJim Jagielski    cStyleName(1) = "Numbering 2"
146*b1cdbd2cSJim Jagielski    PropertyTester.TestProperty("NumberingStyleName",cStyleName())
147*b1cdbd2cSJim Jagielski
148*b1cdbd2cSJim Jagielski    PropertyTester.TestProperty("ParaOrphans")
149*b1cdbd2cSJim Jagielski
150*b1cdbd2cSJim Jagielski    PropertyTester.TestProperty("ParaWidows")
151*b1cdbd2cSJim Jagielski
152*b1cdbd2cSJim Jagielski    PropertyTester.TestProperty("ParaShadowFormat")
153*b1cdbd2cSJim Jagielski
154*b1cdbd2cSJim Jagielski    PropertyTester.TestProperty("LeftBorder")
155*b1cdbd2cSJim Jagielski
156*b1cdbd2cSJim Jagielski    PropertyTester.TestProperty("RightBorder")
157*b1cdbd2cSJim Jagielski
158*b1cdbd2cSJim Jagielski    PropertyTester.TestProperty("TopBorder")
159*b1cdbd2cSJim Jagielski
160*b1cdbd2cSJim Jagielski    PropertyTester.TestProperty("BottomBorder")
161*b1cdbd2cSJim Jagielski
162*b1cdbd2cSJim Jagielski    PropertyTester.TestProperty("BorderDistance")
163*b1cdbd2cSJim Jagielski
164*b1cdbd2cSJim Jagielski    PropertyTester.TestProperty("LeftBorderDistance")
165*b1cdbd2cSJim Jagielski
166*b1cdbd2cSJim Jagielski    PropertyTester.TestProperty("RightBorderDistance")
167*b1cdbd2cSJim Jagielski
168*b1cdbd2cSJim Jagielski    PropertyTester.TestProperty("TopBorderDistance")
169*b1cdbd2cSJim Jagielski
170*b1cdbd2cSJim Jagielski    PropertyTester.TestProperty("BottomBorderDistance")
171*b1cdbd2cSJim Jagielski
172*b1cdbd2cSJim Jagielski    PropertyTester.TestProperty("BreakType")
173*b1cdbd2cSJim Jagielski
174*b1cdbd2cSJim Jagielski	Dim cCharStyles(1) as String
175*b1cdbd2cSJim Jagielski	cCharStyles(0) = "Emphasis"
176*b1cdbd2cSJim Jagielski	CCharStyles(1) = "Teletype"
177*b1cdbd2cSJim Jagielski
178*b1cdbd2cSJim Jagielski    PropertyTester.TestProperty("DropCapCharStyleName",cCharStyles())
179*b1cdbd2cSJim Jagielski
180*b1cdbd2cSJim Jagielski    PropertyTester.TestProperty("ParaFirstLineIndent")
181*b1cdbd2cSJim Jagielski
182*b1cdbd2cSJim Jagielski    PropertyTester.TestProperty("ParaIsAutoFirstLineIndent")
183*b1cdbd2cSJim Jagielski
184*b1cdbd2cSJim Jagielski    PropertyTester.TestProperty("ParaHyphenationMaxHyphens")
185*b1cdbd2cSJim Jagielski
186*b1cdbd2cSJim Jagielski    PropertyTester.TestProperty("ParaHyphenationMaxLeadingChars")
187*b1cdbd2cSJim Jagielski
188*b1cdbd2cSJim Jagielski    PropertyTester.TestProperty("ParaHyphenationMaxTrailingChars")
189*b1cdbd2cSJim Jagielski
190*b1cdbd2cSJim Jagielski	Dim VertAlign(0 to 4) as Integer
191*b1cdbd2cSJim Jagielski	Dim nCount as Integer
192*b1cdbd2cSJim Jagielski	for nCount = 0 to uBound(VertAlign())
193*b1cdbd2cSJim Jagielski		VertAlign(nCount) = nCount
194*b1cdbd2cSJim Jagielski	next nCount
195*b1cdbd2cSJim Jagielski    PropertyTester.TestProperty("ParaVertAlignment", VertAlign())
196*b1cdbd2cSJim Jagielski
197*b1cdbd2cSJim Jagielski    PropertyTester.TestProperty("ParaUserDefinedAttributes")
198*b1cdbd2cSJim Jagielski
199*b1cdbd2cSJim Jagielski    PropertyTester.TestProperty("ParaIsHyphenation")
200*b1cdbd2cSJim Jagielski
201*b1cdbd2cSJim JagielskiExit Sub
202*b1cdbd2cSJim JagielskiErrHndl:
203*b1cdbd2cSJim Jagielski    Test.Exception()
204*b1cdbd2cSJim Jagielski    bOK = false
205*b1cdbd2cSJim Jagielski    resume next
206*b1cdbd2cSJim JagielskiEnd Sub
207*b1cdbd2cSJim Jagielski</script:module>
208