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.linguistic2.XLinguServiceEventBroadcaster;
25 import com.sun.star.linguistic2.XLinguServiceEventListener;
26 import com.sun.star.linguistic2.LinguServiceEvent;
27 import com.sun.star.linguistic2.LinguServiceEventFlags;
28 import com.sun.star.beans.XPropertySet;
29 import com.sun.star.beans.XPropertyChangeListener;
30 import com.sun.star.beans.PropertyChangeEvent;
31 import com.sun.star.lang.EventObject;
32 import com.sun.star.uno.XInterface;
33 import com.sun.star.uno.UnoRuntime;
34 
35 import java.util.ArrayList;
36 
37 public class PropChgHelper_Hyph extends PropChgHelper
38 {
PropChgHelper_Hyph( XInterface xEvtSource, String[] aPropNames )39     public PropChgHelper_Hyph(
40             XInterface      xEvtSource,
41             String[]        aPropNames )
42     {
43         super( xEvtSource, aPropNames );
44     }
45 
46     //************************
47 	// XPropertyChangeListener
48     //************************
propertyChange( PropertyChangeEvent aEvt )49     public void propertyChange( PropertyChangeEvent aEvt )
50             throws com.sun.star.uno.RuntimeException
51     {
52         {
53             short nLngSvcFlags = 0;
54             if (aEvt.PropertyName.equals( "IsIgnoreControlCharacters" ))
55             {
56                 // nothing to be done
57             }
58             else if (aEvt.PropertyName.equals( "IsUseDictionaryList" ) ||
59                      aEvt.PropertyName.equals( "IsGermanPreReform" ) ||
60                      aEvt.PropertyName.equals( "HyphMinLeading" ) ||
61                      aEvt.PropertyName.equals( "HyphMinTrailing" ) ||
62                      aEvt.PropertyName.equals( "HyphMinWordLength" ))
63             {
64                 nLngSvcFlags = LinguServiceEventFlags.HYPHENATE_AGAIN;
65             }
66 
67             if (nLngSvcFlags != 0)
68             {
69                 LinguServiceEvent aEvent = new LinguServiceEvent( GetEvtSource(), nLngSvcFlags );
70                 LaunchEvent( aEvent );
71             }
72         }
73     }
74 };
75 
76