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