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="sheet_XViewSplitable" 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 34Dim XSplitPos As Long 35Dim YSplitPos As Long 36 37 38Sub RunTest() 39 40'************************************************************************* 41' INTERFACE: 42' com.sun.star.sheet.XViewSplitable 43'************************************************************************* 44On Error Goto ErrHndl 45 Dim bOK As Boolean 46 47 Test.StartMethod("splitAtPosition()") 48 bOK = true 49 ' Only one of XViewSplitable::getIsWindowSplit() and 50 ' XViewFreezable::hasFrozenPanes() can be true 51 52 oObj.freezeAtPosition(10, 10) 53 bOK = bOK AND oObj.hasFrozenPanes() 54 SplitAt(100, 200) 55 bOK = bOK AND NOT oObj.hasFrozenPanes() 56 Test.MethodTested("splitAtPosition()", bOK) 57 58 Test.StartMethod("getIsWindowSplit()") 59 bOK = true 60 SplitAt(0, 0) 61 bOK = bOK AND NOT oObj.getIsWindowSplit() 62 SplitAt(50, 50) 63 bOK = bOK AND oObj.getIsWindowSplit() 64 65 Test.MethodTested("getIsWindowSplit()", bOK) 66 67 Test.StartMethod("getSplitHorizontal()") 68 bOK = true 69 SplitAt(0, 0) 70 bOK = bOK AND oObj.getSplitHorizontal() = XSplitPos 71 SplitAt(0, 100) 72 bOK = bOK AND oObj.getSplitHorizontal() = XSplitPos 73 SplitAt(100, 0) 74 bOK = bOK AND oObj.getSplitHorizontal() = XSplitPos 75 SplitAt(100, 100) 76 bOK = bOK AND oObj.getSplitHorizontal() = XSplitPos 77 Test.MethodTested("getSplitHorizontal()", bOK) 78 79 Test.StartMethod("getSplitVertical()") 80 bOK = true 81 SplitAt(0, 0) 82 bOK = bOK AND oObj.getSplitVertical() = YSplitPos 83 SplitAt(100, 0) 84 bOK = bOK AND oObj.getSplitVertical() = YSplitPos 85 SplitAt(100, 100) 86 bOK = bOK AND oObj.getSplitVertical() = YSplitPos 87 SplitAt(0, 100) 88 bOK = bOK AND oObj.getSplitVertical() = YSplitPos 89 Test.MethodTested("getSplitVertical()", bOK) 90 91 Test.StartMethod("getSplitColumn()") 92 bOK = true 93 SplitAt(0, 0) 94 bOK = bOK AND oObj.getSplitColumn() = 0 95 SplitAt(0, 100) 96 bOK = bOK AND oObj.getSplitColumn() = 0 97 SplitAt(100, 100) 98 bOK = bOK AND oObj.getSplitColumn() <> 0 99 SplitAt(100, 0) 100 bOK = bOK AND oObj.getSplitColumn() <> 0 101 Test.MethodTested("getSplitColumn()", bOK) 102 103 Test.StartMethod("getSplitRow()") 104 bOK = true 105 SplitAt(0, 0) 106 bOK = bOK AND oObj.getSplitRow() = 0 107 SplitAt(100, 0) 108 bOK = bOK AND oObj.getSplitRow() = 0 109 SplitAt(100, 100) 110 bOK = bOK AND oObj.getSplitRow() <> 0 111 SplitAt(0, 100) 112 bOK = bOK AND oObj.getSplitRow() <> 0 113 Test.MethodTested("getSplitRow()", bOK) 114 115Exit Sub 116ErrHndl: 117 Test.Exception() 118 bOK = false 119 resume next 120End Sub 121 122Sub SplitAt(x As Long, y As Long) 123 Out.Log("Spliting At position (" & x & ", " & y & ")") 124 oObj.SplitAtPosition(x, y) 125 XSplitPos = x 126 YSplitPos = y 127End Sub 128</script:module> 129