1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 #ifndef SVX_SPELL_PORTIONS_HXX
29 #define SVX_SPELL_PORTIONS_HXX
30 
31 #include <i18npool/lang.h>
32 #include <rtl/ustring.hxx>
33 #include <com/sun/star/uno/Reference.h>
34 #include <com/sun/star/linguistic2/SingleProofreadingError.hpp>
35 #include <com/sun/star/linguistic2/XProofreader.hpp>
36 #include <vector>
37 
38 namespace com{ namespace sun{ namespace star{ namespace linguistic2{
39     class XSpellAlternatives;
40 }}}}
41 
42 namespace svx{
43 /** contains a portion of text that has the same language attributes applied
44     and belongs to the same script type.
45  */
46 struct SpellPortion
47 {
48     /** contains the text of the portion.
49      */
50     rtl::OUString   sText;
51     /** Marks the portion as field, footnote symbol or any other special content that
52      should be protected against unintentional deletion.
53      */
54     bool bIsField;
55     /** Marks the portion hidden content that should not be touched by spell checking
56         and not be removed like redlines. The creator of the portions has to take care
57         for them.
58      */
59     bool bIsHidden;
60     /** contains the language applied to the text. It has to match the script type.
61      */
62     LanguageType    eLanguage;
63     /** for wrong words this reference is filled with the error informations otherwise
64         it's an empty reference
65      */
66     ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XSpellAlternatives> xAlternatives;
67     /** determines whether the error type is a grammar error
68     */
69     bool bIsGrammarError;
70     /** contains the grammar error information
71     */
72     com::sun::star::linguistic2::SingleProofreadingError aGrammarError;
73     /** provides access to the grammar checker interface
74      */
75     ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XProofreader > xGrammarChecker;
76     /** marks portion as to-be-ignored. This is a return parameter.
77      */
78     /** contains the proposed dialog title if the proof reading component provides one.
79      */
80     rtl::OUString   sDialogTitle;
81 
82     bool bIgnoreThisError;
83     SpellPortion() :
84         bIsField(false),
85         bIsHidden(false),
86         eLanguage(LANGUAGE_DONTKNOW),
87         bIsGrammarError(false),
88         bIgnoreThisError(false)
89         {
90             aGrammarError.nErrorStart = aGrammarError.nErrorLength = aGrammarError.nErrorType = 0;
91         }
92 };
93 typedef std::vector<SpellPortion> SpellPortions;
94 }//namespace svx
95 #endif
96