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