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 INCLUDED_LINGUISTIC_SPELLDTA_HXX
21 #define INCLUDED_LINGUISTIC_SPELLDTA_HXX
24 #include <com/sun/star/linguistic2/XSpellAlternatives.hpp>
25 #include <com/sun/star/linguistic2/XSetSpellAlternatives.hpp>
26 #include <cppuhelper/implbase.hxx>
27 #include <linguistic/lngdllapi.h>
28 #include <i18nlangtag/lang.h>
29 #include <config_options.h>
31 namespace com::sun::star::linguistic2
{ class XSearchableDictionaryList
; }
37 std::vector
< OUString
>
39 std::vector
< OUString
> &rAlt1
,
40 std::vector
< OUString
> &rAlt2
);
42 void SeqRemoveNegEntries(
43 std::vector
< OUString
> &rSeq
,
44 css::uno::Reference
< css::linguistic2::XSearchableDictionaryList
> const &rxDicList
,
45 LanguageType nLanguage
);
47 void SearchSimilarText( const OUString
&rText
, LanguageType nLanguage
,
48 css::uno::Reference
< css::linguistic2::XSearchableDictionaryList
> const &xDicList
,
49 std::vector
< OUString
> & rDicListProps
);
52 class SpellAlternatives final
53 : public cppu::WeakImplHelper
55 css::linguistic2::XSpellAlternatives
,
56 css::linguistic2::XSetSpellAlternatives
59 css::uno::Sequence
< OUString
> aAlt
; // list of alternatives, may be empty.
61 sal_Int16 nType
; // type of failure
62 LanguageType nLanguage
;
65 UNLESS_MERGELIBS(LNG_DLLPUBLIC
) SpellAlternatives();
66 SpellAlternatives(OUString aWord
, LanguageType nLang
,
67 const css::uno::Sequence
< OUString
> &rAlternatives
);
68 virtual ~SpellAlternatives() override
;
69 SpellAlternatives(const SpellAlternatives
&) = delete;
70 SpellAlternatives
& operator=( const SpellAlternatives
& ) = delete;
73 virtual OUString SAL_CALL
getWord( ) override
;
74 virtual css::lang::Locale SAL_CALL
getLocale( ) override
;
75 virtual ::sal_Int16 SAL_CALL
getFailureType( ) override
;
76 virtual ::sal_Int16 SAL_CALL
getAlternativesCount( ) override
;
77 virtual css::uno::Sequence
< OUString
> SAL_CALL
getAlternatives( ) override
;
79 // XSetSpellAlternatives
80 virtual void SAL_CALL
setAlternatives( const css::uno::Sequence
< OUString
>& aAlternatives
) override
;
81 virtual void SAL_CALL
setFailureType( ::sal_Int16 nFailureType
) override
;
83 // non-interface specific functions
84 void UNLESS_MERGELIBS(LNG_DLLPUBLIC
) SetWordLanguage(const OUString
&rWord
, LanguageType nLang
);
85 void UNLESS_MERGELIBS(LNG_DLLPUBLIC
) SetFailureType(sal_Int16 nTypeP
);
86 void UNLESS_MERGELIBS(LNG_DLLPUBLIC
) SetAlternatives( const css::uno::Sequence
< OUString
> &rAlt
);
87 static css::uno::Reference
< css::linguistic2::XSpellAlternatives
> UNLESS_MERGELIBS(LNG_DLLPUBLIC
) CreateSpellAlternatives(
88 const OUString
&rWord
, LanguageType nLang
, sal_Int16 nTypeP
, const css::uno::Sequence
< OUString
> &rAlt
);
91 } // namespace linguistic
95 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */