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