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_XDatabaseRange" 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' INTERFACE: 45' com.sun.star.sheet.XDatabaseRange 46'************************************************************************* 47On Error Goto ErrHndl 48 Dim bOK As Boolean 49 Dim oldDA, oSD, oFD, oID, oSTD As Object 50 Dim newDA As New com.sun.star.table.CellRangeAddress 51 52 Test.StartMethod("getDataArea()") 53 Test.StartMethod("setDataArea()") 54 bOK = true 55 oldDA = oObj.getDataArea() 56 newDA.Sheet = 0 57 newDA.StartColumn = 5 58 newDA.StartRow = 6 59 newDA.EndColumn = 10 60 newDA.EndRow = 8 61 oObj.setDataArea(newDA) 62 bOK = bOK AND oObj.getDataArea().Sheet = newDA.Sheet 63 bOK = bOK AND oObj.getDataArea().StartColumn = newDA.StartColumn 64 bOK = bOK AND oObj.getDataArea().StartRow = newDA.StartRow 65 bOK = bOK AND oObj.getDataArea().EndColumn = newDA.EndColumn 66 bOK = bOK AND oObj.getDataArea().EndRow = newDA.EndRow 67 oObj.setDataArea(oldDA) 68 Test.MethodTested("getDataArea()", bOK) 69 Test.MethodTested("setDataArea()", bOK) 70 71 Test.StartMethod("getSortDescriptor()") 72 bOK = true 73 oSD = oObj.getSortDescriptor() 74 bOK = bOK AND isArray(oSD) 75 Test.MethodTested("getSortDescriptor()", bOK) 76 77 Test.StartMethod("getFilterDescriptor()") 78 bOK = true 79 oFD = oObj.getFilterDescriptor() 80 bOK = bOK AND hasUnoInterfaces(oFD, "com.sun.star.sheet.XSheetFilterDescriptor") 81 Test.MethodTested("getFilterDescriptor()", bOK) 82 83 Test.StartMethod("getSubTotalDescriptor()") 84 bOK = true 85 oSTD = oObj.getSubTotalDescriptor() 86 bOK = bOK AND hasUnoInterfaces(oSTD, "com.sun.star.sheet.XSubTotalDescriptor") 87 Test.MethodTested("getSubTotalDescriptor()", bOK) 88 89 Test.StartMethod("getImportDescriptor()") 90 bOK = true 91 oID = oObj.getImportDescriptor() 92 bOK = bOK AND isArray(oID) 93 Test.MethodTested("getImportDescriptor()", bOK) 94 95 Test.StartMethod("refresh()") 96 bOK = true 97 oObj.refresh() 98 Test.MethodTested("refresh()", bOK) 99 100Exit Sub 101ErrHndl: 102 Test.Exception() 103 bOK = false 104 resume next 105End Sub 106</script:module> 107