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' 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' Be sure that all variables are dimensioned: 37option explicit 38 39 40 41Sub RunTest() 42 43'************************************************************************* 44' SERVICE: 45' com.sun.star.text.TextSection 46'************************************************************************* 47On Error Goto ErrHndl 48 Dim bOK As Boolean 49 50 51 PropertyTester.TestProperty("Condition") 52 53 PropertyTester.TestProperty("IsVisible") 54 55 PropertyTester.TestProperty("IsProtected") 56 57 Dim link As New com.sun.star.text.SectionFileLink 58 link.FileURL = utils.Path2URL(cTestDocsDir + "Iterator.sxw") 59 60 PropertyTester.TestProperty("FileLink", Array(link)) 61 62 PropertyTester.TestProperty("LinkRegion") 63 64 PropertyTester.TestProperty("DDECommandType") 65 66 PropertyTester.TestProperty("DDECommandFile") 67 68 PropertyTester.TestProperty("DDECommandElement") 69 70 PropertyTester.TestProperty("BackGraphicURL") 71 72 PropertyTester.TestProperty("BackGraphicFilter") 73 74 PropertyTester.TestProperty("BackGraphicLocation") 75 76 PropertyTester.TestProperty("FootnoteIsCollectAtTextEnd") 77 78 PropertyTester.TestProperty("FootnoteIsRestartNumbering") 79 80 PropertyTester.TestProperty("FootnoteRestartNumberingAt") 81 82 PropertyTester.TestProperty("FootnoteIsOwnNumbering") 83 84 oObj.FootnoteIsOwnNumbering = true 85 oObj.FootnoteNumberingType = 1 86 PropertyTester.TestProperty("FootnoteNumberingType", Array(com.sun.star.style.NumberingType.ARABIC)) 87 88 PropertyTester.TestProperty("FootnoteNumberingPrefix") 89 90 PropertyTester.TestProperty("FootnoteNumberingSuffix") 91 92 PropertyTester.TestProperty("EndnoteIsCollectAtTextEnd") 93 94 PropertyTester.TestProperty("EndnoteIsRestartNumbering") 95 96 PropertyTester.TestProperty("EndnoteRestartNumberingAt") 97 98 PropertyTester.TestProperty("EndnoteIsOwnNumbering") 99 100 oObj.EndnoteIsOwnNumbering = true 101 oObj.EndnoteNumberingType = 1 102 PropertyTester.TestProperty("EndnoteNumberingType", Array(com.sun.star.style.NumberingType.ARABIC)) 103 104 PropertyTester.TestProperty("EndnoteNumberingPrefix") 105 106 PropertyTester.TestProperty("EndnoteNumberingSuffix") 107 108 PropertyTester.TestProperty("IsAutomaticUpdate") 109 110 Test.StartMethod("TextColumns") 111 Dim oTC As Variant 112 Dim oldVal, newVal, val2set As Integer 113 oTC = oDoc.createInstance("com.sun.star.text.TextColumns") 114 oldVal = oObj.TextColumns.ColumnCount 115 Out.Log("COLUMNS BEFORE: "+oldVal) 116 if (oldVal < 100) then 117 val2set = oldVal + 20 118 else 119 val2set = oldVal - 20 120 Endif 121 Out.Log("COLUMNS TO SET: "+val2set) 122 oTC.ColumnCount = val2set 123 oObj.TextColumns = oTC 124 newVal = oObj.TextColumns.ColumnCount 125 Out.Log("COLUMNS AFTER: "+newVal) 126 bOK = oldVal <> newVal 127 Test.MethodTested("TextColumns", bOK) 128 129 PropertyTester.TestProperty("SectionLeftMargin") 130 131 PropertyTester.TestProperty("SectionRightMargin") 132 133Exit Sub 134ErrHndl: 135 Test.Exception() 136 bOK = false 137 resume next 138End Sub 139</script:module> 140