1*63ce064aSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*63ce064aSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*63ce064aSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*63ce064aSAndrew Rist  * distributed with this work for additional information
6*63ce064aSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*63ce064aSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*63ce064aSAndrew Rist  * "License"); you may not use this file except in compliance
9*63ce064aSAndrew Rist  * with the License.  You may obtain a copy of the License at
10*63ce064aSAndrew Rist  *
11*63ce064aSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*63ce064aSAndrew Rist  *
13*63ce064aSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*63ce064aSAndrew Rist  * software distributed under the License is distributed on an
15*63ce064aSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*63ce064aSAndrew Rist  * KIND, either express or implied.  See the License for the
17*63ce064aSAndrew Rist  * specific language governing permissions and limitations
18*63ce064aSAndrew Rist  * under the License.
19*63ce064aSAndrew Rist  *
20*63ce064aSAndrew Rist  *************************************************************/
21*63ce064aSAndrew Rist 
22*63ce064aSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifndef _LINGUISTIC_GRAMMARCHECKER_HXX_
25cdf0e10cSrcweir #define _LINGUISTIC_GRAMMARCHECKER_HXX_
26cdf0e10cSrcweir 
27cdf0e10cSrcweir 
28cdf0e10cSrcweir #include <com/sun/star/lang/XComponent.hpp>
29cdf0e10cSrcweir #include <com/sun/star/lang/XServiceInfo.hpp>
30cdf0e10cSrcweir #include <com/sun/star/linguistic2/XGrammarChecker.hpp>
31cdf0e10cSrcweir #include <com/sun/star/linguistic2/SingleGrammarError.hpp>
32cdf0e10cSrcweir #include <com/sun/star/linguistic2/XSupportedLocales.hpp>
33cdf0e10cSrcweir 
34cdf0e10cSrcweir #include <cppuhelper/implbase3.hxx>
35cdf0e10cSrcweir #include <cppuhelper/interfacecontainer.h>
36cdf0e10cSrcweir 
37cdf0e10cSrcweir #include <map>
38cdf0e10cSrcweir 
39cdf0e10cSrcweir 
40cdf0e10cSrcweir class GrammarChecker:
41cdf0e10cSrcweir     public cppu::WeakImplHelper3
42cdf0e10cSrcweir     <
43cdf0e10cSrcweir         ::com::sun::star::linguistic2::XGrammarChecker,
44cdf0e10cSrcweir         ::com::sun::star::lang::XComponent,
45cdf0e10cSrcweir         ::com::sun::star::lang::XServiceInfo
46cdf0e10cSrcweir     >
47cdf0e10cSrcweir {
48cdf0e10cSrcweir //    com::sun::star::uno::Reference< uno::XComponentContext > m_xContext;
49cdf0e10cSrcweir 
50cdf0e10cSrcweir     // disallow use of copy c-tor and assignment operator
51cdf0e10cSrcweir     GrammarChecker( const GrammarChecker & );
52cdf0e10cSrcweir     GrammarChecker & operator = ( const GrammarChecker & );
53cdf0e10cSrcweir 
54cdf0e10cSrcweir public:
55cdf0e10cSrcweir     explicit GrammarChecker( /* uno::Reference< uno::XComponentContext > const & rXContext */ );
56cdf0e10cSrcweir     virtual ~GrammarChecker();
57cdf0e10cSrcweir 
58cdf0e10cSrcweir     // XSupportedLocales
59cdf0e10cSrcweir     virtual ::sal_Bool SAL_CALL hasLocale( const ::com::sun::star::lang::Locale & aLocale) throw (::com::sun::star::uno::RuntimeException);
60cdf0e10cSrcweir     virtual ::com::sun::star::uno::Sequence< ::com::sun::star::lang::Locale > SAL_CALL getLocales(  ) throw ( ::com::sun::star::uno::RuntimeException );
61cdf0e10cSrcweir 
62cdf0e10cSrcweir 	// XGrammarChecker
63cdf0e10cSrcweir     virtual ::sal_Bool SAL_CALL isSpellChecker(  ) throw (::com::sun::star::uno::RuntimeException);
64cdf0e10cSrcweir     virtual void SAL_CALL startDocument( ::sal_Int32 nDocId ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
65cdf0e10cSrcweir     virtual void SAL_CALL startParagraph( ::sal_Int32 nDocId ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
66cdf0e10cSrcweir     virtual void SAL_CALL endParagraph( ::sal_Int32 nDocId ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
67cdf0e10cSrcweir     virtual void SAL_CALL endDocument( ::sal_Int32 nDocId ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
68cdf0e10cSrcweir     virtual ::com::sun::star::linguistic2::GrammarCheckingResult SAL_CALL doGrammarChecking( ::sal_Int32 nDocId, const ::rtl::OUString& aText, const ::com::sun::star::lang::Locale& aLocale, ::sal_Int32 nStartOfSentencePos, ::sal_Int32 nSuggestedEndOfSentencePos, const ::com::sun::star::uno::Sequence< ::sal_Int32 >& aLanguagePortions, const ::com::sun::star::uno::Sequence< ::com::sun::star::lang::Locale >& aLanguagePortionsLocales ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
69cdf0e10cSrcweir     virtual ::sal_Bool SAL_CALL hasOptionsDialog(  ) throw (::com::sun::star::uno::RuntimeException);
70cdf0e10cSrcweir     virtual void SAL_CALL runOptionsDialog(  ) throw (::com::sun::star::uno::RuntimeException);
71cdf0e10cSrcweir 
72cdf0e10cSrcweir     // XComponent
73cdf0e10cSrcweir     virtual void SAL_CALL dispose(  ) throw (::com::sun::star::uno::RuntimeException);
74cdf0e10cSrcweir     virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener ) throw ( ::com::sun::star::uno::RuntimeException );
75cdf0e10cSrcweir     virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
76cdf0e10cSrcweir 
77cdf0e10cSrcweir     // XServiceInfo
78cdf0e10cSrcweir 	virtual ::rtl::OUString SAL_CALL getImplementationName() throw (::com::sun::star::uno::RuntimeException);
79cdf0e10cSrcweir 	virtual ::sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException);
80cdf0e10cSrcweir 	virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw (::com::sun::star::uno::RuntimeException);
81cdf0e10cSrcweir 
82cdf0e10cSrcweir 	static inline ::rtl::OUString getImplementationName_Static();
83cdf0e10cSrcweir 	static ::com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_Static() throw();
84cdf0e10cSrcweir 
85cdf0e10cSrcweir 	::com::sun::star::uno::Sequence< ::com::sun::star::linguistic2::SingleGrammarError > GrammarCheckingInDummy(
86cdf0e10cSrcweir         ::sal_Int32 nDocId, const ::rtl::OUString &rFlatParaText, const ::com::sun::star::lang::Locale & rLocale,
87cdf0e10cSrcweir 	    ::sal_Int32 nStartOfSentencePos, ::sal_Int32 nSuggestedSentenceEndPos );
88cdf0e10cSrcweir 
89cdf0e10cSrcweir 
GetMutex()90cdf0e10cSrcweir     inline ::osl::Mutex & GetMutex()
91cdf0e10cSrcweir     {
92cdf0e10cSrcweir         static osl::Mutex aMutex;
93cdf0e10cSrcweir         return aMutex;
94cdf0e10cSrcweir     }
95cdf0e10cSrcweir };
96cdf0e10cSrcweir 
getImplementationName_Static()97cdf0e10cSrcweir inline ::rtl::OUString GrammarChecker::getImplementationName_Static()
98cdf0e10cSrcweir {
99cdf0e10cSrcweir     return A2OU( "com.sun.star.lingu2.GrammarChecker" );
100cdf0e10cSrcweir }
101cdf0e10cSrcweir 
102cdf0e10cSrcweir 
103cdf0e10cSrcweir #endif
104cdf0e10cSrcweir 
105