1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28 package ifc.document; 29 30 31 import lib.MultiMethodTest; 32 import lib.Status; 33 import lib.StatusException; 34 35 import com.sun.star.document.XExporter; 36 import com.sun.star.lang.XComponent; 37 38 /** 39 * Testing <code>com.sun.star.document.XExporter</code> 40 * interface methods : 41 * <ul> 42 * <li><code> setSourceDocument()</code></li> 43 * </ul> <p> 44 * This test needs the following object relations : 45 * <ul> 46 * <li> <code>'SourceDocument'</code> (of type <code>XComponent</code>): 47 * the source document to be passed to the method. </li> 48 * <ul> <p> 49 * Test is <b> NOT </b> multithread compilant. <p> 50 * @see com.sun.star.document.XExporter 51 */ 52 public class _XExporter extends MultiMethodTest { 53 54 public XExporter oObj = null; 55 public XComponent source = null ; 56 57 /** 58 * Retrieves object relations. 59 * @throws StatusException If one of relations not found. 60 */ 61 public void before() { 62 source = (XComponent) tEnv.getObjRelation("SourceDocument") ; 63 64 if (source == null) throw new StatusException(Status.failed 65 ("Relation not found")) ; 66 } 67 68 /** 69 * Just calls the method. <p> 70 * Has <b> OK </b> status if no runtime exceptions occured. 71 * Usually this interface is supported both with <code>XFilter</code> 72 * where source document setting is checked. 73 */ 74 public void _setSourceDocument() { 75 boolean result = true ; 76 77 try { 78 oObj.setSourceDocument(source); 79 } 80 catch (com.sun.star.lang.IllegalArgumentException ex) { 81 log.println("Exception while checking :"); 82 ex.printStackTrace(log); 83 result = false; 84 } 85 86 tRes.tested("setSourceDocument()", result) ; 87 } 88 } 89 90 91