1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: ScSpreadsheetSettingsObj.java,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
33 import java
.io
.PrintWriter
;
35 import lib
.StatusException
;
37 import lib
.TestEnvironment
;
38 import lib
.TestParameters
;
39 import util
.SOfficeFactory
;
41 import com
.sun
.star
.lang
.XComponent
;
42 import com
.sun
.star
.lang
.XMultiServiceFactory
;
43 import com
.sun
.star
.sheet
.XSpreadsheetDocument
;
44 import com
.sun
.star
.uno
.UnoRuntime
;
45 import com
.sun
.star
.uno
.XInterface
;
48 * Test for object which is represented by service
49 * <code>com.sun.star.sheet.SpreadsheetDocumentSettings</code>. <p>
50 * Object implements the following interfaces :
52 * <li> <code>com::sun::star::sheet::SpreadsheetDocumentSettings</code></li>
53 * <li> <code>com::sun::star::beans::XPropertySet</code></li>
55 * @see com.sun.star.sheet.SpreadsheetDocumentSettings
56 * @see com.sun.star.beans.XPropertySet
57 * @see ifc.sheet._SpreadsheetDocumentSettings
58 * @see ifc.beans._XPropertySet
60 public class ScSpreadsheetSettingsObj
extends TestCase
{
61 static XSpreadsheetDocument xSheetDoc
= null;
64 * Creates Spreadsheet document.
66 protected void initialize( TestParameters tParam
, PrintWriter log
) {
67 SOfficeFactory SOF
= SOfficeFactory
.getFactory( (XMultiServiceFactory
)tParam
.getMSF() );
70 log
.println( "creating a Spreadsheet document" );
71 xSheetDoc
= SOF
.createCalcDoc(null);
72 } catch ( com
.sun
.star
.uno
.Exception e
) {
73 // Some exception occures.FAILED
74 e
.printStackTrace( log
);
75 throw new StatusException( "Couldn't create document", e
);
81 * Disposes Spreadsheet document.
83 protected void cleanup( TestParameters tParam
, PrintWriter log
) {
84 log
.println( " disposing xSheetDoc " );
85 XComponent oComp
= (XComponent
)
86 UnoRuntime
.queryInterface (XComponent
.class, xSheetDoc
) ;
87 util
.DesktopTools
.closeDoc(oComp
);
91 * Creating a Testenvironment for the interfaces to be tested.
92 * The spreadsheet document is the instance of the service
93 * <code>com.sun.star.sheet.SpreadsheetDocumentSettings</code>.
95 public synchronized TestEnvironment
createTestEnvironment(
96 TestParameters Param
, PrintWriter log
) throws StatusException
{
98 XInterface oObj
= null;
100 // creation of testobject here
101 // first we write what we are intend to do to log file
102 log
.println( "Creating a test environment" );
106 TestEnvironment tEnv
= new TestEnvironment( oObj
);