1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: hyphenimp.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
32 #ifndef _LINGU2_HYPHENIMP_HXX_
33 #define _LINGU2_HYPHENIMP_HXX_
35 #include <uno/lbnames.h> // CPPU_CURRENT_LANGUAGE_BINDING_NAME macro, which specify the environment type
36 #include <cppuhelper/implbase1.hxx> // helper for implementations
37 #include <cppuhelper/implbase6.hxx> // helper for implementations
38 #include <com/sun/star/lang/XComponent.hpp>
39 #include <com/sun/star/lang/XInitialization.hpp>
40 #include <com/sun/star/lang/XServiceDisplayName.hpp>
41 #include <com/sun/star/beans/XPropertySet.hpp>
42 #include <com/sun/star/beans/PropertyValues.hpp>
43 #include <com/sun/star/lang/XServiceInfo.hpp>
44 #include <com/sun/star/linguistic2/XHyphenator.hpp>
45 #include <com/sun/star/linguistic2/XSearchableDictionaryList.hpp>
46 #include <com/sun/star/linguistic2/XLinguServiceEventBroadcaster.hpp>
47 #include <tools/table.hxx>
49 #include <unotools/charclass.hxx>
51 #include <linguistic/misc.hxx>
52 #include <linguistic/lngprophelp.hxx>
54 #include <lingutil.hxx>
57 using namespace ::rtl
;
58 using namespace ::com::sun::star::uno
;
59 using namespace ::com::sun::star::beans
;
60 using namespace ::com::sun::star::lang
;
61 using namespace ::com::sun::star::linguistic2
;
64 ///////////////////////////////////////////////////////////////////////////
71 rtl_TextEncoding aEnc
;
78 public cppu::WeakImplHelper6
81 XLinguServiceEventBroadcaster
,
88 Sequence
< Locale
> aSuppLocales
;
92 ::cppu::OInterfaceContainerHelper aEvtListeners
;
93 Reference
< XPropertyChangeListener
> xPropHelper
;
94 Reference
< XMultiServiceFactory
> rSMgr
;
95 linguistic::PropertyHelper_Hyphen
* pPropHelper
;
98 // disallow copy-constructor and assignment-operator for now
99 Hyphenator(const Hyphenator
&);
100 Hyphenator
& operator = (const Hyphenator
&);
102 linguistic::PropertyHelper_Hyphen
& GetPropHelper_Impl();
103 linguistic::PropertyHelper_Hyphen
& GetPropHelper()
105 return pPropHelper
? *pPropHelper
: GetPropHelper_Impl();
111 virtual ~Hyphenator();
113 // XSupportedLocales (for XHyphenator)
114 virtual Sequence
< Locale
> SAL_CALL
getLocales()
115 throw(RuntimeException
);
116 virtual sal_Bool SAL_CALL
hasLocale( const Locale
& rLocale
)
117 throw(RuntimeException
);
120 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::linguistic2::XHyphenatedWord
> SAL_CALL
121 hyphenate( const ::rtl::OUString
& aWord
,
122 const ::com::sun::star::lang::Locale
& aLocale
,
123 sal_Int16 nMaxLeading
,
124 const ::com::sun::star::beans::PropertyValues
& aProperties
)
125 throw(::com::sun::star::lang::IllegalArgumentException
,
126 ::com::sun::star::uno::RuntimeException
);
128 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::linguistic2::XHyphenatedWord
> SAL_CALL
129 queryAlternativeSpelling( const ::rtl::OUString
& aWord
,
130 const ::com::sun::star::lang::Locale
& aLocale
,
132 const ::com::sun::star::beans::PropertyValues
& aProperties
)
133 throw(::com::sun::star::lang::IllegalArgumentException
,
134 ::com::sun::star::uno::RuntimeException
);
136 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::linguistic2::XPossibleHyphens
> SAL_CALL
137 createPossibleHyphens( const ::rtl::OUString
& aWord
,
138 const ::com::sun::star::lang::Locale
& aLocale
,
139 const ::com::sun::star::beans::PropertyValues
& aProperties
)
140 throw(::com::sun::star::lang::IllegalArgumentException
,
141 ::com::sun::star::uno::RuntimeException
);
143 // XLinguServiceEventBroadcaster
144 virtual sal_Bool SAL_CALL
145 addLinguServiceEventListener(
146 const Reference
< XLinguServiceEventListener
>& rxLstnr
)
147 throw(RuntimeException
);
148 virtual sal_Bool SAL_CALL
149 removeLinguServiceEventListener(
150 const Reference
< XLinguServiceEventListener
>& rxLstnr
)
151 throw(RuntimeException
);
153 // XServiceDisplayName
154 virtual OUString SAL_CALL
155 getServiceDisplayName( const Locale
& rLocale
)
156 throw(RuntimeException
);
159 virtual void SAL_CALL
160 initialize( const Sequence
< Any
>& rArguments
)
161 throw(Exception
, RuntimeException
);
164 virtual void SAL_CALL
166 throw(RuntimeException
);
167 virtual void SAL_CALL
168 addEventListener( const Reference
< XEventListener
>& rxListener
)
169 throw(RuntimeException
);
170 virtual void SAL_CALL
171 removeEventListener( const Reference
< XEventListener
>& rxListener
)
172 throw(RuntimeException
);
174 ////////////////////////////////////////////////////////////
175 // Service specific part
179 virtual OUString SAL_CALL
180 getImplementationName()
181 throw(RuntimeException
);
182 virtual sal_Bool SAL_CALL
183 supportsService( const OUString
& rServiceName
)
184 throw(RuntimeException
);
185 virtual Sequence
< OUString
> SAL_CALL
186 getSupportedServiceNames()
187 throw(RuntimeException
);
190 static inline OUString
191 getImplementationName_Static() throw();
192 static Sequence
< OUString
>
193 getSupportedServiceNames_Static() throw();
198 sal_uInt16 SAL_CALL
capitalType(const OUString
&, CharClass
*);
199 OUString SAL_CALL
makeLowerCase(const OUString
&, CharClass
*);
200 OUString SAL_CALL
makeUpperCase(const OUString
&, CharClass
*);
201 OUString SAL_CALL
makeInitCap(const OUString
&, CharClass
*);
204 inline OUString
Hyphenator::getImplementationName_Static() throw()
206 return A2OU( "org.openoffice.lingu.LibHnjHyphenator" );
210 ///////////////////////////////////////////////////////////////////////////