2 * This file is part of the LibreOffice project.
4 * This Source Code Form is subject to the terms of the Mozilla Public
5 * License, v. 2.0. If a copy of the MPL was not distributed with this
6 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 * This file incorporates work covered by the following license notice:
10 * Licensed to the Apache Software Foundation (ASF) under one or more
11 * contributor license agreements. See the NOTICE file distributed
12 * with this work for additional information regarding copyright
13 * ownership. The ASF licenses this file to you under the Apache
14 * License, Version 2.0 (the "License"); you may not use this file
15 * except in compliance with the License. You may obtain a copy of
16 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
22 import java
.io
.PrintWriter
;
24 import lib
.StatusException
;
26 import lib
.TestEnvironment
;
27 import lib
.TestParameters
;
28 import util
.SOfficeFactory
;
30 import com
.sun
.star
.lang
.XMultiServiceFactory
;
31 import com
.sun
.star
.text
.XTextDocument
;
32 import com
.sun
.star
.uno
.UnoRuntime
;
33 import com
.sun
.star
.uno
.XInterface
;
36 * Test for object which is represented by service
37 * <code>com.sun.star.text.Defaults</code> created by a writer
38 * document's <code>XMultiServiceFactory</code>. <p>
40 * Object implements the following interfaces :
42 * <li> <code>com::sun::star::style::ParagraphProperties</code></li>
43 * <li> <code>com::sun::star::style::CharacterPropertiesComplex</code></li>
44 * <li> <code>com::sun::star::style::CharacterPropertiesAsian</code></li>
45 * <li> <code>com::sun::star::text::Defaults</code></li>
46 * <li> <code>com::sun::star::style::CharacterProperties</code></li>
47 * <li> <code>com::sun::star::beans::XPropertySet</code></li>
48 * <li> <code>com::sun::star::style::ParagraphPropertiesComplex</code></li>
51 * @see com.sun.star.style.ParagraphProperties
52 * @see com.sun.star.style.CharacterPropertiesComplex
53 * @see com.sun.star.style.CharacterPropertiesAsian
54 * @see com.sun.star.text.Defaults
55 * @see com.sun.star.style.CharacterProperties
56 * @see com.sun.star.beans.XPropertySet
57 * @see com.sun.star.style.ParagraphPropertiesComplex
58 * @see ifc.style._ParagraphProperties
59 * @see ifc.style._CharacterPropertiesComplex
60 * @see ifc.style._CharacterPropertiesAsian
61 * @see ifc.text._Defaults
62 * @see ifc.style._CharacterProperties
63 * @see ifc.beans._XPropertySet
64 * @see ifc.style._ParagraphPropertiesComplex
66 public class SwXTextDefaults
extends TestCase
{
68 XTextDocument xTextDoc
;
71 * Creates the service <code>com.sun.star.text.Defaults</code>
74 protected TestEnvironment
createTestEnvironment(
75 TestParameters tParam
, PrintWriter log
) {
77 XInterface oObj
= null;
79 XMultiServiceFactory docMSF
= UnoRuntime
.queryInterface(XMultiServiceFactory
.class,xTextDoc
);
83 docMSF
.createInstance("com.sun.star.text.Defaults");
84 } catch (com
.sun
.star
.uno
.Exception e
) {
85 throw new StatusException("Couldn't create Object",e
);
88 TestEnvironment tEnv
= new TestEnvironment(oObj
);
94 * Creates text document.
97 protected void initialize( TestParameters tParam
, PrintWriter log
) {
98 SOfficeFactory SOF
= SOfficeFactory
.getFactory( tParam
.getMSF() );
100 log
.println( "creating a textdocument" );
101 xTextDoc
= SOF
.createTextDoc( null );
102 } catch ( com
.sun
.star
.uno
.Exception e
) {
103 e
.printStackTrace( log
);
104 throw new StatusException( "Couldn't create document", e
);
109 * Disposes text document.
112 protected void cleanup( TestParameters tParam
, PrintWriter log
) {
113 log
.println( " disposing xTextDoc " );
114 util
.DesktopTools
.closeDoc(xTextDoc
);