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