xref: /AOO41X/main/qadevOOo/runner/util/TextSectionDsc.java (revision ef39d40d3f5e66cf3f035b3e93783012b340500d)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 package util;
25 import com.sun.star.lang.XMultiServiceFactory;
26 import com.sun.star.uno.XInterface;
27 import com.sun.star.uno.UnoRuntime;
28 import com.sun.star.text.XTextContent;
29 
30 /**
31  * the class TextSectionDsc
32  */
33 public class TextSectionDsc extends InstDescr {
34 
35     final String service = "com.sun.star.text.TextSection";
36     String ifcName = "com.sun.star.text.XTextContent";
37     private String name = null;
38 
39 
TextSectionDsc()40     public TextSectionDsc() {
41         initTextSection();
42     }
43 
TextSectionDsc( String name )44     public TextSectionDsc( String name ) {
45         this.name = name;
46         initTextSection();
47     }
48 
getName()49     public String getName() {
50         return name;
51     }
52 
getIfcName()53     public String getIfcName() {
54         return ifcName;
55     }
56 
getService()57     public String getService() {
58         return service;
59     }
60 
initTextSection()61     private void initTextSection() {
62         try {
63             ifcClass = Class.forName( ifcName );
64         }
65         catch( ClassNotFoundException cnfE ) {
66         }
67     }
createInstance( XMultiServiceFactory docMSF )68     public XInterface createInstance( XMultiServiceFactory docMSF ) {
69         Object ServiceObj = null;
70 
71         try {
72             ServiceObj = docMSF.createInstance( service );
73         }
74         catch( com.sun.star.uno.Exception cssuE ){
75         }
76         XTextContent PG = (XTextContent)UnoRuntime.queryInterface( ifcClass,
77                                                                 ServiceObj );
78         return PG;
79     }
80 }