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