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 import com.sun.star.lang.Locale;
25 
26 public class XPossibleHyphens_impl implements
27     com.sun.star.linguistic2.XPossibleHyphens
28 {
29     String              aWord;
30     String              aHyphWord;
31     short[]             aOrigHyphenPos;
32     Locale              aLang;
33 
XPossibleHyphens_impl( String aWord, Locale aLang, String aHyphWord, short[] aOrigHyphenPos)34     public XPossibleHyphens_impl(
35             String      aWord,
36             Locale      aLang,
37             String      aHyphWord,
38             short[]     aOrigHyphenPos)
39     {
40         this.aWord = aWord;
41         this.aLang = aLang;
42         this.aHyphWord = aHyphWord;
43         this.aOrigHyphenPos = aOrigHyphenPos;
44 
45         //!! none of these cases should ever occur!
46         //!! values provided only for safety
47         if (this.aWord == null)
48             this.aWord = new String();
49         if (this.aLang == null)
50             this.aLang = new Locale();
51         if (this.aHyphWord == null)
52             this.aHyphWord = new String();
53 
54         // having no hyphenation positions is OK though.
55         // still for safety an empty existing array has to be provided.
56         if (this.aOrigHyphenPos == null)
57             this.aOrigHyphenPos = new short[]{};
58     }
59 
60     // XPossibleHyphens
getWord()61     public String getWord() throws com.sun.star.uno.RuntimeException
62     {
63         return aWord;
64     }
65 
getLocale()66     public Locale getLocale() throws com.sun.star.uno.RuntimeException
67     {
68         return aLang;
69     }
getPossibleHyphens()70     public String getPossibleHyphens() throws com.sun.star.uno.RuntimeException
71     {
72         return aHyphWord;
73     }
getHyphenationPositions()74     public short[] getHyphenationPositions() throws com.sun.star.uno.RuntimeException
75     {
76         return aOrigHyphenPos;
77     }
78 };
79