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="text_TextSection" script:language="StarBasic"> 4 5 6'************************************************************************* 7' 8' Licensed to the Apache Software Foundation (ASF) under one 9' or more contributor license agreements. See the NOTICE file 10' distributed with this work for additional information 11' regarding copyright ownership. The ASF licenses this file 12' to you under the Apache License, Version 2.0 (the 13' "License"); you may not use this file except in compliance 14' with the License. You may obtain a copy of the License at 15' 16' http://www.apache.org/licenses/LICENSE-2.0 17' 18' Unless required by applicable law or agreed to in writing, 19' software distributed under the License is distributed on an 20' "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 21' KIND, either express or implied. See the License for the 22' specific language governing permissions and limitations 23' under the License. 24' 25'************************************************************************* 26 27 28 29 30 31' Be sure that all variables are dimensioned: 32option explicit 33 34 35 36Sub RunTest() 37 38'************************************************************************* 39' SERVICE: 40' com.sun.star.text.TextSection 41'************************************************************************* 42On Error Goto ErrHndl 43 Dim bOK As Boolean 44 45 46 PropertyTester.TestProperty("Condition") 47 48 PropertyTester.TestProperty("IsVisible") 49 50 PropertyTester.TestProperty("IsProtected") 51 52 Dim link As New com.sun.star.text.SectionFileLink 53 link.FileURL = utils.Path2URL(cTestDocsDir + "Iterator.sxw") 54 55 PropertyTester.TestProperty("FileLink", Array(link)) 56 57 PropertyTester.TestProperty("LinkRegion") 58 59 PropertyTester.TestProperty("DDECommandType") 60 61 PropertyTester.TestProperty("DDECommandFile") 62 63 PropertyTester.TestProperty("DDECommandElement") 64 65 PropertyTester.TestProperty("BackGraphicURL") 66 67 PropertyTester.TestProperty("BackGraphicFilter") 68 69 PropertyTester.TestProperty("BackGraphicLocation") 70 71 PropertyTester.TestProperty("FootnoteIsCollectAtTextEnd") 72 73 PropertyTester.TestProperty("FootnoteIsRestartNumbering") 74 75 PropertyTester.TestProperty("FootnoteRestartNumberingAt") 76 77 PropertyTester.TestProperty("FootnoteIsOwnNumbering") 78 79 oObj.FootnoteIsOwnNumbering = true 80 oObj.FootnoteNumberingType = 1 81 PropertyTester.TestProperty("FootnoteNumberingType", Array(com.sun.star.style.NumberingType.ARABIC)) 82 83 PropertyTester.TestProperty("FootnoteNumberingPrefix") 84 85 PropertyTester.TestProperty("FootnoteNumberingSuffix") 86 87 PropertyTester.TestProperty("EndnoteIsCollectAtTextEnd") 88 89 PropertyTester.TestProperty("EndnoteIsRestartNumbering") 90 91 PropertyTester.TestProperty("EndnoteRestartNumberingAt") 92 93 PropertyTester.TestProperty("EndnoteIsOwnNumbering") 94 95 oObj.EndnoteIsOwnNumbering = true 96 oObj.EndnoteNumberingType = 1 97 PropertyTester.TestProperty("EndnoteNumberingType", Array(com.sun.star.style.NumberingType.ARABIC)) 98 99 PropertyTester.TestProperty("EndnoteNumberingPrefix") 100 101 PropertyTester.TestProperty("EndnoteNumberingSuffix") 102 103 PropertyTester.TestProperty("IsAutomaticUpdate") 104 105 Test.StartMethod("TextColumns") 106 Dim oTC As Variant 107 Dim oldVal, newVal, val2set As Integer 108 oTC = oDoc.createInstance("com.sun.star.text.TextColumns") 109 oldVal = oObj.TextColumns.ColumnCount 110 Out.Log("COLUMNS BEFORE: "+oldVal) 111 if (oldVal < 100) then 112 val2set = oldVal + 20 113 else 114 val2set = oldVal - 20 115 Endif 116 Out.Log("COLUMNS TO SET: "+val2set) 117 oTC.ColumnCount = val2set 118 oObj.TextColumns = oTC 119 newVal = oObj.TextColumns.ColumnCount 120 Out.Log("COLUMNS AFTER: "+newVal) 121 bOK = oldVal <> newVal 122 Test.MethodTested("TextColumns", bOK) 123 124 PropertyTester.TestProperty("SectionLeftMargin") 125 126 PropertyTester.TestProperty("SectionRightMargin") 127 128Exit Sub 129ErrHndl: 130 Test.Exception() 131 bOK = false 132 resume next 133End Sub 134</script:module> 135