Branch libreoffice-5-0-4
[LibreOffice.git] / include / linguistic / spelldta.hxx
blob9bdfe83345167e06e6571ab36ce1779291490b52
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 INCLUDED_LINGUISTIC_SPELLDTA_HXX
21 #define INCLUDED_LINGUISTIC_SPELLDTA_HXX
23 #include <vector>
24 #include <com/sun/star/linguistic2/XSpellAlternatives.hpp>
25 #include <com/sun/star/linguistic2/XSetSpellAlternatives.hpp>
26 #include <com/sun/star/linguistic2/XSearchableDictionaryList.hpp>
27 #include <cppuhelper/implbase2.hxx>
28 #include <linguistic/lngdllapi.h>
29 #include <boost/noncopyable.hpp>
31 namespace com { namespace sun { namespace star {
32 namespace linguistic2 {
33 class XDictionaryList;
35 } } }
38 namespace linguistic
41 ::com::sun::star::uno::Sequence< OUString >
42 MergeProposalSeqs(
43 ::com::sun::star::uno::Sequence< OUString > &rAlt1,
44 ::com::sun::star::uno::Sequence< OUString > &rAlt2,
45 bool bAllowDuplicates );
47 void SeqRemoveNegEntries(
48 ::com::sun::star::uno::Sequence< OUString > &rSeq,
49 ::com::sun::star::uno::Reference<
50 ::com::sun::star::linguistic2::XSearchableDictionaryList > &rxDicList,
51 sal_Int16 nLanguage );
53 bool SeqHasEntry(
54 const ::com::sun::star::uno::Sequence< OUString > &rSeq,
55 const OUString &rTxt);
57 void SearchSimilarText( const OUString &rText, sal_Int16 nLanguage,
58 ::com::sun::star::uno::Reference<
59 ::com::sun::star::linguistic2::XSearchableDictionaryList > &xDicList,
60 std::vector< OUString > & rDicListProps );
63 class SpellAlternatives
64 : public cppu::WeakImplHelper2
66 ::com::sun::star::linguistic2::XSpellAlternatives,
67 ::com::sun::star::linguistic2::XSetSpellAlternatives
69 , private ::boost::noncopyable
71 ::com::sun::star::uno::Sequence< OUString > aAlt; // list of alternatives, may be empty.
72 OUString aWord;
73 sal_Int16 nType; // type of failure
74 sal_Int16 nLanguage;
76 public:
77 LNG_DLLPUBLIC SpellAlternatives();
78 SpellAlternatives(const OUString &rWord, sal_Int16 nLang, sal_Int16 nFailureType,
79 const ::com::sun::star::uno::Sequence< OUString > &rAlternatives );
80 virtual ~SpellAlternatives();
82 // XSpellAlternatives
83 virtual OUString SAL_CALL getWord( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
84 virtual ::com::sun::star::lang::Locale SAL_CALL getLocale( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
85 virtual ::sal_Int16 SAL_CALL getFailureType( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
86 virtual ::sal_Int16 SAL_CALL getAlternativesCount( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
87 virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getAlternatives( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
89 // XSetSpellAlternatives
90 virtual void SAL_CALL setAlternatives( const ::com::sun::star::uno::Sequence< OUString >& aAlternatives ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
91 virtual void SAL_CALL setFailureType( ::sal_Int16 nFailureType ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
93 // non-interface specific functions
94 void LNG_DLLPUBLIC SetWordLanguage(const OUString &rWord, sal_Int16 nLang);
95 void LNG_DLLPUBLIC SetFailureType(sal_Int16 nTypeP);
96 void LNG_DLLPUBLIC SetAlternatives( const ::com::sun::star::uno::Sequence< OUString > &rAlt );
97 static com::sun::star::uno::Reference < com::sun::star::linguistic2::XSpellAlternatives > LNG_DLLPUBLIC CreateSpellAlternatives(
98 const OUString &rWord, sal_Int16 nLang, sal_Int16 nTypeP, const ::com::sun::star::uno::Sequence< OUString > &rAlt );
101 } // namespace linguistic
103 #endif
105 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */