1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef _LINGUISTIC_SPELLDTA_HXX_
21 #define _LINGUISTIC_SPELLDTA_HXX_
24 #include <com/sun/star/linguistic2/XSpellAlternatives.hpp>
25 #include <com/sun/star/linguistic2/XSetSpellAlternatives.hpp>
26 #include <com/sun/star/linguistic2/XSearchableDictionaryList.hpp>
28 #include <tools/solar.h>
30 #include <uno/lbnames.h>
31 #include <cppuhelper/implbase2.hxx>
32 #include <linguistic/lngdllapi.h>
34 #include <boost/noncopyable.hpp>
36 namespace com
{ namespace sun
{ namespace star
{
37 namespace linguistic2
{
38 class XDictionaryList
;
46 ::com::sun::star::uno::Sequence
< OUString
>
48 ::com::sun::star::uno::Sequence
< OUString
> &rAlt1
,
49 ::com::sun::star::uno::Sequence
< OUString
> &rAlt2
,
50 sal_Bool bAllowDuplicates
);
52 void SeqRemoveNegEntries(
53 ::com::sun::star::uno::Sequence
< OUString
> &rSeq
,
54 ::com::sun::star::uno::Reference
<
55 ::com::sun::star::linguistic2::XSearchableDictionaryList
> &rxDicList
,
56 sal_Int16 nLanguage
);
59 const ::com::sun::star::uno::Sequence
< OUString
> &rSeq
,
60 const OUString
&rTxt
);
62 ///////////////////////////////////////////////////////////////////////////
64 void SearchSimilarText( const OUString
&rText
, sal_Int16 nLanguage
,
65 ::com::sun::star::uno::Reference
<
66 ::com::sun::star::linguistic2::XSearchableDictionaryList
> &xDicList
,
67 std::vector
< OUString
> & rDicListProps
);
69 ///////////////////////////////////////////////////////////////////////////
72 class SpellAlternatives
73 : public cppu::WeakImplHelper2
75 ::com::sun::star::linguistic2::XSpellAlternatives
,
76 ::com::sun::star::linguistic2::XSetSpellAlternatives
78 , private ::boost::noncopyable
80 ::com::sun::star::uno::Sequence
< OUString
> aAlt
; // list of alternatives, may be empty.
82 sal_Int16 nType
; // type of failure
86 LNG_DLLPUBLIC
SpellAlternatives();
87 SpellAlternatives(const OUString
&rWord
, sal_Int16 nLang
, sal_Int16 nFailureType
,
88 const ::com::sun::star::uno::Sequence
< OUString
> &rAlternatives
);
89 virtual ~SpellAlternatives();
92 virtual OUString SAL_CALL
getWord( ) throw (::com::sun::star::uno::RuntimeException
);
93 virtual ::com::sun::star::lang::Locale SAL_CALL
getLocale( ) throw (::com::sun::star::uno::RuntimeException
);
94 virtual ::sal_Int16 SAL_CALL
getFailureType( ) throw (::com::sun::star::uno::RuntimeException
);
95 virtual ::sal_Int16 SAL_CALL
getAlternativesCount( ) throw (::com::sun::star::uno::RuntimeException
);
96 virtual ::com::sun::star::uno::Sequence
< OUString
> SAL_CALL
getAlternatives( ) throw (::com::sun::star::uno::RuntimeException
);
98 // XSetSpellAlternatives
99 virtual void SAL_CALL
setAlternatives( const ::com::sun::star::uno::Sequence
< OUString
>& aAlternatives
) throw (::com::sun::star::uno::RuntimeException
);
100 virtual void SAL_CALL
setFailureType( ::sal_Int16 nFailureType
) throw (::com::sun::star::uno::RuntimeException
);
102 // non-interface specific functions
103 void LNG_DLLPUBLIC
SetWordLanguage(const OUString
&rWord
, sal_Int16 nLang
);
104 void LNG_DLLPUBLIC
SetFailureType(sal_Int16 nTypeP
);
105 void LNG_DLLPUBLIC
SetAlternatives( const ::com::sun::star::uno::Sequence
< OUString
> &rAlt
);
106 static com::sun::star::uno::Reference
< com::sun::star::linguistic2::XSpellAlternatives
> LNG_DLLPUBLIC
CreateSpellAlternatives(
107 const OUString
&rWord
, sal_Int16 nLang
, sal_Int16 nTypeP
, const ::com::sun::star::uno::Sequence
< OUString
> &rAlt
);
111 ///////////////////////////////////////////////////////////////////////////
113 } // namespace linguistic
117 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */