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  * describes a Bookmark to be inserted in a container
32  */
33 public class BookmarkDsc extends InstDescr {
34 
35     final String service = "com.sun.star.text.Bookmark";
36     String ifcName = "com.sun.star.text.XTextContent";
37     private String name = null;
38 
39 
BookmarkDsc()40     public BookmarkDsc() {
41             initBookmark();
42     }
43 
BookmarkDsc( String name )44     public BookmarkDsc( String name ) {
45             this.name = name;
46             initBookmark();
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 
initBookmark()61     private void initBookmark() {
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 BM = (XTextContent)UnoRuntime.queryInterface( ifcClass,
77                                                                                                                             ServiceObj );
78             return BM;
79     }
80 }