merge the formfield patch from ooo-build
[ooovba.git] / linguistic / inc / spelldta.hxx
blob0d3022db7da8845dbf9d7b89cc05d5038dad9438
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: spelldta.hxx,v $
10 * $Revision: 1.6 $
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 ************************************************************************/
31 #ifndef _LINGUISTIC_SPELLDTA_HXX_
32 #define _LINGUISTIC_SPELLDTA_HXX_
34 #include <vector>
35 #include <com/sun/star/linguistic2/XSpellAlternatives.hpp>
36 #include <com/sun/star/linguistic2/XSetSpellAlternatives.hpp>
38 #include <tools/solar.h>
40 #include <uno/lbnames.h> // CPPU_CURRENT_LANGUAGE_BINDING_NAME macro, which specify the environment type
41 #include <cppuhelper/implbase2.hxx>
43 namespace com { namespace sun { namespace star {
44 namespace linguistic2 {
45 class XDictionaryList;
47 } } }
50 namespace linguistic
53 ///////////////////////////////////////////////////////////////////////////
55 ::com::sun::star::uno::Reference<
56 ::com::sun::star::linguistic2::XSpellAlternatives >
57 MergeProposals(
58 ::com::sun::star::uno::Reference<
59 ::com::sun::star::linguistic2::XSpellAlternatives > &rxAlt1,
60 ::com::sun::star::uno::Reference<
61 ::com::sun::star::linguistic2::XSpellAlternatives > &rxAlt2 );
63 ::com::sun::star::uno::Sequence< ::rtl::OUString >
64 MergeProposalSeqs(
65 ::com::sun::star::uno::Sequence< ::rtl::OUString > &rAlt1,
66 ::com::sun::star::uno::Sequence< ::rtl::OUString > &rAlt2,
67 BOOL bAllowDuplicates );
69 void SeqRemoveNegEntries(
70 ::com::sun::star::uno::Sequence< ::rtl::OUString > &rSeq,
71 ::com::sun::star::uno::Reference<
72 ::com::sun::star::linguistic2::XDictionaryList > &rxDicList,
73 INT16 nLanguage );
75 BOOL SeqHasEntry(
76 const ::com::sun::star::uno::Sequence< ::rtl::OUString > &rSeq,
77 const ::rtl::OUString &rTxt);
79 ///////////////////////////////////////////////////////////////////////////
81 void SearchSimilarText( const rtl::OUString &rText, INT16 nLanguage,
82 ::com::sun::star::uno::Reference<
83 ::com::sun::star::linguistic2::XDictionaryList > &xDicList,
84 std::vector< rtl::OUString > & rDicListProps );
86 ///////////////////////////////////////////////////////////////////////////
89 class SpellAlternatives :
90 public cppu::WeakImplHelper2
92 ::com::sun::star::linguistic2::XSpellAlternatives,
93 ::com::sun::star::linguistic2::XSetSpellAlternatives
96 ::com::sun::star::uno::Sequence< ::rtl::OUString > aAlt; // list of alternatives, may be empty.
97 ::rtl::OUString aWord;
98 INT16 nType; // type of failure
99 INT16 nLanguage;
101 // disallow copy-constructor and assignment-operator for now
102 SpellAlternatives(const SpellAlternatives &);
103 SpellAlternatives & operator = (const SpellAlternatives &);
105 public:
106 SpellAlternatives();
107 SpellAlternatives(const ::rtl::OUString &rWord, INT16 nLang, INT16 nFailureType,
108 const ::rtl::OUString &rRplcWord );
109 SpellAlternatives(const ::rtl::OUString &rWord, INT16 nLang, INT16 nFailureType,
110 const ::com::sun::star::uno::Sequence< ::rtl::OUString > &rAlternatives );
111 virtual ~SpellAlternatives();
113 // XSpellAlternatives
114 virtual ::rtl::OUString SAL_CALL getWord( ) throw (::com::sun::star::uno::RuntimeException);
115 virtual ::com::sun::star::lang::Locale SAL_CALL getLocale( ) throw (::com::sun::star::uno::RuntimeException);
116 virtual ::sal_Int16 SAL_CALL getFailureType( ) throw (::com::sun::star::uno::RuntimeException);
117 virtual ::sal_Int16 SAL_CALL getAlternativesCount( ) throw (::com::sun::star::uno::RuntimeException);
118 virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getAlternatives( ) throw (::com::sun::star::uno::RuntimeException);
120 // XSetSpellAlternatives
121 virtual void SAL_CALL setAlternatives( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aAlternatives ) throw (::com::sun::star::uno::RuntimeException);
122 virtual void SAL_CALL setFailureType( ::sal_Int16 nFailureType ) throw (::com::sun::star::uno::RuntimeException);
124 // non-interface specific functions
125 void SetWordLanguage(const ::rtl::OUString &rWord, INT16 nLang);
126 void SetFailureType(INT16 nTypeP);
127 void SetAlternatives(
128 const ::com::sun::star::uno::Sequence< ::rtl::OUString > &rAlt );
132 ///////////////////////////////////////////////////////////////////////////
134 } // namespace linguistic
136 #endif