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 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_sw.hxx"
26 #include "SwSmartTagMgr.hxx"
27 
28 #include <vos/mutex.hxx>
29 #include <vcl/svapp.hxx>
30 #include <swmodule.hxx>
31 
32 #ifndef _DOCSH_HXX
33 #include <docsh.hxx>
34 #endif
35 
36 using namespace com::sun::star;
37 using namespace com::sun::star::uno;
38 
39 SwSmartTagMgr* SwSmartTagMgr::mpTheSwSmartTagMgr = 0;
40 
Get()41 SwSmartTagMgr& SwSmartTagMgr::Get()
42 {
43     if ( !mpTheSwSmartTagMgr )
44     {
45         mpTheSwSmartTagMgr = new SwSmartTagMgr( SwDocShell::Factory().GetModuleName() );
46         mpTheSwSmartTagMgr->Init( rtl::OUString::createFromAscii("Writer") );
47     }
48     return *mpTheSwSmartTagMgr;
49 }
50 
SwSmartTagMgr(const rtl::OUString & rModuleName)51 SwSmartTagMgr::SwSmartTagMgr( const rtl::OUString& rModuleName ) :
52     SmartTagMgr( rModuleName )
53 {
54 }
55 
~SwSmartTagMgr()56 SwSmartTagMgr::~SwSmartTagMgr()
57 {
58 }
59 
60 // ::com::sun::star::util::XModifyListener
modified(const lang::EventObject & rEO)61 void SwSmartTagMgr::modified( const lang::EventObject& rEO ) throw( RuntimeException )
62 {
63 	vos::OGuard aGuard(Application::GetSolarMutex());
64 
65     // Installed recognizers have changed. We remove all existing smart tags:
66     SW_MOD()->CheckSpellChanges( sal_False, sal_True, sal_True, sal_True );
67 
68     SmartTagMgr::modified( rEO );
69 }
70 
71 // ::com::sun::star::util::XChangesListener
changesOccurred(const util::ChangesEvent & rEvent)72 void SwSmartTagMgr::changesOccurred( const util::ChangesEvent& rEvent ) throw( RuntimeException)
73 {
74 	vos::OGuard aGuard(Application::GetSolarMutex());
75 
76     // Configuration has changed. We remove all existing smart tags:
77     SW_MOD()->CheckSpellChanges( sal_False, sal_True, sal_True, sal_True );
78 
79     SmartTagMgr::changesOccurred( rEvent );
80 }
81 
82 /*
83 SmartTagMgr& SwSmartTagMgr::Get()
84 {
85     if ( !pSmartTagMgr )
86         pSmartTagMgr = new SmartTagMgr( SwDocShell::Factory().GetModuleName() );
87 
88      return *pSmartTagMgr;
89 }
90 */
91 
92