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_XNamedRanges" script:
language=
"StarBasic">
6 '*************************************************************************
8 ' DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
10 ' Copyright
2008 by Sun Microsystems, Inc.
12 ' OpenOffice.org - a multi-platform office productivity suite
14 ' $RCSfile: sheet_XNamedRanges.xba,v $
18 ' This file is part of OpenOffice.org.
20 ' OpenOffice.org is free software: you can redistribute it and/or modify
21 ' it under the terms of the GNU Lesser General Public License version
3
22 ' only, as published by the Free Software Foundation.
24 ' OpenOffice.org is distributed in the hope that it will be useful,
25 ' but WITHOUT ANY WARRANTY; without even the implied warranty of
26 ' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
27 ' GNU Lesser General Public License version
3 for more details
28 ' (a copy is included in the LICENSE file that accompanied this code).
30 ' You should have received a copy of the GNU Lesser General Public License
31 ' version
3 along with OpenOffice.org. If not, see
32 '
<http://www.openoffice.org/license.html
>
33 ' for a copy of the LGPLv3 License.
35 '*************************************************************************
36 '*************************************************************************
40 ' Be sure that all variables are dimensioned:
47 '*************************************************************************
49 ' com.sun.star.sheet.XNamedRanges
50 '*************************************************************************
54 Dim outRange As New com.sun.star.table.CellAddress
55 Dim range As New com.sun.star.table.CellRangeAddress
58 Test.StartMethod(
"addNewByName()")
64 oObj.addNewByName(cIfcShortName,
"T4:Y7", outRange,
0)
65 bOK = bOK AND oObj.count = count +
1
66 bOK = bOK AND oObj.hasByName(cIfcShortName)
67 Test.MethodTested(
"addNewByName()", bOK)
69 Test.StartMethod(
"addNewFromTitles()")
80 oDoc.Sheets(
0).getCellByPosition(i,
1).String =
"Col" & i
83 oObj.addNewFromTitles(range, com.sun.star.sheet.Border.TOP)
85 bOK = bOK AND (oObj.count = count +
3)
87 bOK = bOK AND NOT oObj.hasByName(
"Col1")
88 bOK = bOK AND oObj.hasByName(
"Col2")
89 bOK = bOK AND oObj.hasByName(
"Col3")
90 bOK = bOK AND oObj.hasByName(
"Col4")
91 bOK = bOK AND NOT oObj.hasByName(
"Col5")
92 Test.MethodTested(
"addNewFromTitles()", bOK)
94 Test.StartMethod(
"removeByName()")
97 oObj.removeByName(cIfcShortName)
98 bOK = bOK AND (count = oObj.count +
1)
99 bOK = bOK AND NOT oObj.hasByName(cIfcShortName)
100 Test.MethodTested(
"removeByName()", bOK)
102 Test.StartMethod(
"outputList()")
109 for i =
4 to
5 + count
110 oDoc.Sheets(
0).getCellByPosition(
5, i).String =
"a"
111 oDoc.Sheets(
0).getCellByPosition(
6, i).String =
"b"
114 oObj.outputList(outRange)
116 bOK = bOK AND oDoc.Sheets(
0).getCellByPosition(
5,
4).String =
"a"
117 bOK = bOK AND oDoc.Sheets(
0).getCellByPosition(
6,
4).String =
"b"
118 bOK = bOK AND oDoc.Sheets(
0).getCellByPosition(
5,
5 + count).String =
"a"
119 bOK = bOK AND oDoc.Sheets(
0).getCellByPosition(
6,
5 + count).String =
"b"
121 for i =
5 to
4 + count
122 bOK = bOK AND oDoc.Sheets(
0).getCellByPosition(
5, i).String
<> "a"
123 bOK = bOK AND oDoc.Sheets(
0).getCellByPosition(
6, i).String
<> "b"
124 bOK = bOK AND oObj.hasByName(oDoc.Sheets(
0).getCellByPosition(
5, i).String)
127 Test.MethodTested(
"outputList()", bOK)