1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef SVX_SPELL_PORTIONS_HXX
25 #define SVX_SPELL_PORTIONS_HXX
26 
27 #include <i18npool/lang.h>
28 #include <rtl/ustring.hxx>
29 #include <com/sun/star/uno/Reference.h>
30 #include <com/sun/star/linguistic2/SingleProofreadingError.hpp>
31 #include <com/sun/star/linguistic2/XProofreader.hpp>
32 #include <vector>
33 
34 namespace com{ namespace sun{ namespace star{ namespace linguistic2{
35     class XSpellAlternatives;
36 }}}}
37 
38 namespace svx{
39 /** contains a portion of text that has the same language attributes applied
40     and belongs to the same script type.
41  */
42 struct SpellPortion
43 {
44     /** contains the text of the portion.
45      */
46     rtl::OUString   sText;
47     /** Marks the portion as field, footnote symbol or any other special content that
48      should be protected against unintentional deletion.
49      */
50     bool bIsField;
51     /** Marks the portion hidden content that should not be touched by spell checking
52         and not be removed like redlines. The creator of the portions has to take care
53         for them.
54      */
55     bool bIsHidden;
56     /** contains the language applied to the text. It has to match the script type.
57      */
58     LanguageType    eLanguage;
59     /** for wrong words this reference is filled with the error informations otherwise
60         it's an empty reference
61      */
62     ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XSpellAlternatives> xAlternatives;
63     /** determines whether the error type is a grammar error
64     */
65     bool bIsGrammarError;
66     /** contains the grammar error information
67     */
68     com::sun::star::linguistic2::SingleProofreadingError aGrammarError;
69     /** provides access to the grammar checker interface
70      */
71     ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XProofreader > xGrammarChecker;
72     /** marks portion as to-be-ignored. This is a return parameter.
73      */
74     /** contains the proposed dialog title if the proof reading component provides one.
75      */
76     rtl::OUString   sDialogTitle;
77 
78     bool bIgnoreThisError;
SpellPortionsvx::SpellPortion79     SpellPortion() :
80         bIsField(false),
81         bIsHidden(false),
82         eLanguage(LANGUAGE_DONTKNOW),
83         bIsGrammarError(false),
84         bIgnoreThisError(false)
85         {
86             aGrammarError.nErrorStart = aGrammarError.nErrorLength = aGrammarError.nErrorType = 0;
87         }
88 };
89 typedef std::vector<SpellPortion> SpellPortions;
90 }//namespace svx
91 #endif
92