xref: /aoo41x/main/cui/source/dialogs/SpellAttrib.hxx (revision c4eee24d)
1*c4eee24dSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*c4eee24dSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*c4eee24dSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*c4eee24dSAndrew Rist  * distributed with this work for additional information
6*c4eee24dSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*c4eee24dSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*c4eee24dSAndrew Rist  * "License"); you may not use this file except in compliance
9*c4eee24dSAndrew Rist  * with the License.  You may obtain a copy of the License at
10*c4eee24dSAndrew Rist  *
11*c4eee24dSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*c4eee24dSAndrew Rist  *
13*c4eee24dSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*c4eee24dSAndrew Rist  * software distributed under the License is distributed on an
15*c4eee24dSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*c4eee24dSAndrew Rist  * KIND, either express or implied.  See the License for the
17*c4eee24dSAndrew Rist  * specific language governing permissions and limitations
18*c4eee24dSAndrew Rist  * under the License.
19*c4eee24dSAndrew Rist  *
20*c4eee24dSAndrew Rist  *************************************************************/
21*c4eee24dSAndrew Rist 
22*c4eee24dSAndrew Rist 
23cdf0e10cSrcweir #ifndef _SVX_SPELL_ATTRIB
24cdf0e10cSrcweir #define _SVX_SPELL_ATTRIB
25cdf0e10cSrcweir 
26cdf0e10cSrcweir #include <svtools/txtattr.hxx>
27cdf0e10cSrcweir #include <i18npool/lang.h>
28cdf0e10cSrcweir #include <com/sun/star/uno/Reference.h>
29cdf0e10cSrcweir #include <com/sun/star/uno/Sequence.h>
30cdf0e10cSrcweir #include <com/sun/star/lang/Locale.hpp>
31cdf0e10cSrcweir #include <com/sun/star/linguistic2/XProofreader.hpp>
32cdf0e10cSrcweir #include <tools/color.hxx>
33cdf0e10cSrcweir //namespace com{ namespace sun{ namespace star{ namespace linguistic2{
34cdf0e10cSrcweir //    class XSpellAlternatives;
35cdf0e10cSrcweir //}}}}
36cdf0e10cSrcweir 
37cdf0e10cSrcweir #define TEXTATTR_SPELL_ERROR            (TEXTATTR_USER_START + 1)
38cdf0e10cSrcweir #define TEXTATTR_SPELL_LANGUAGE         (TEXTATTR_USER_START + 2)
39cdf0e10cSrcweir #define TEXTATTR_SPELL_BACKGROUND       (TEXTATTR_USER_START + 3)
40cdf0e10cSrcweir 
41cdf0e10cSrcweir namespace svx{
42cdf0e10cSrcweir struct SpellErrorDescription
43cdf0e10cSrcweir {
44cdf0e10cSrcweir     bool                                                bIsGrammarError;
45cdf0e10cSrcweir     ::rtl::OUString                                     sErrorText;
46cdf0e10cSrcweir     ::rtl::OUString                                     sDialogTitle;
47cdf0e10cSrcweir     ::rtl::OUString                                     sExplanation;
48cdf0e10cSrcweir     ::com::sun::star::lang::Locale                      aLocale;
49cdf0e10cSrcweir     ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XProofreader > xGrammarChecker;
50cdf0e10cSrcweir     ::rtl::OUString                                     sServiceName; //service name of GrammarChecker/SpellChecker
51cdf0e10cSrcweir     ::com::sun::star::uno::Sequence< ::rtl::OUString >  aSuggestions;
52cdf0e10cSrcweir     ::rtl::OUString                                     sRuleId;
53cdf0e10cSrcweir 
SpellErrorDescriptionsvx::SpellErrorDescription54cdf0e10cSrcweir     SpellErrorDescription() :
55cdf0e10cSrcweir         bIsGrammarError( false ){}
56cdf0e10cSrcweir 
SpellErrorDescriptionsvx::SpellErrorDescription57cdf0e10cSrcweir     SpellErrorDescription( bool bGrammar,
58cdf0e10cSrcweir                       const ::rtl::OUString& rText,
59cdf0e10cSrcweir                       const ::com::sun::star::lang::Locale& rLocale,
60cdf0e10cSrcweir                       const ::com::sun::star::uno::Sequence< ::rtl::OUString >& rSuggestions,
61cdf0e10cSrcweir                       ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XProofreader > rxGrammarChecker,
62cdf0e10cSrcweir                       const ::rtl::OUString& rServiceName,
63cdf0e10cSrcweir                       const ::rtl::OUString* pDialogTitle = 0,
64cdf0e10cSrcweir                       const ::rtl::OUString* pExplanation = 0,
65cdf0e10cSrcweir                       const ::rtl::OUString* pRuleId = 0 ) :
66cdf0e10cSrcweir         bIsGrammarError( bGrammar ),
67cdf0e10cSrcweir         sErrorText( rText ),
68cdf0e10cSrcweir         aLocale( rLocale ),
69cdf0e10cSrcweir         xGrammarChecker( rxGrammarChecker ),
70cdf0e10cSrcweir         sServiceName( rServiceName ),
71cdf0e10cSrcweir         aSuggestions( rSuggestions )
72cdf0e10cSrcweir         {
73cdf0e10cSrcweir             if( pDialogTitle )
74cdf0e10cSrcweir                 sDialogTitle = *pDialogTitle;
75cdf0e10cSrcweir             if( pExplanation )
76cdf0e10cSrcweir                 sExplanation = *pExplanation;
77cdf0e10cSrcweir             if( pRuleId )
78cdf0e10cSrcweir                 sRuleId = *pRuleId;
79cdf0e10cSrcweir         };
80cdf0e10cSrcweir 
operator ==svx::SpellErrorDescription81cdf0e10cSrcweir     int operator==( const SpellErrorDescription& rDesc ) const
82cdf0e10cSrcweir     {
83cdf0e10cSrcweir         return bIsGrammarError == rDesc.bIsGrammarError &&
84cdf0e10cSrcweir                 sErrorText.equals( rDesc.sErrorText ) &&
85cdf0e10cSrcweir                 aLocale.Language.equals( rDesc.aLocale.Language ) &&
86cdf0e10cSrcweir                 aLocale.Country.equals( rDesc.aLocale.Country ) &&
87cdf0e10cSrcweir                 aLocale.Variant.equals( rDesc.aLocale.Variant ) &&
88cdf0e10cSrcweir                 aSuggestions == rDesc.aSuggestions &&
89cdf0e10cSrcweir                 xGrammarChecker == rDesc.xGrammarChecker &&
90cdf0e10cSrcweir                 sDialogTitle.equals( rDesc.sDialogTitle ) &&
91cdf0e10cSrcweir                 sExplanation.equals( rDesc.sExplanation ) &&
92cdf0e10cSrcweir                 sRuleId == rDesc.sRuleId;
93cdf0e10cSrcweir     }
94cdf0e10cSrcweir };
95cdf0e10cSrcweir /* -----------------10.09.2003 14:23-----------------
96cdf0e10cSrcweir 
97cdf0e10cSrcweir  --------------------------------------------------*/
98cdf0e10cSrcweir class SpellErrorAttrib : public TextAttrib
99cdf0e10cSrcweir {
100cdf0e10cSrcweir public:
101cdf0e10cSrcweir 
102cdf0e10cSrcweir private:
103cdf0e10cSrcweir     //com::sun::star::uno::Reference<com::sun::star::linguistic2::XSpellAlternatives> m_xAlternatives;
104cdf0e10cSrcweir     SpellErrorDescription        m_aSpellErrorDescription;
105cdf0e10cSrcweir 
106cdf0e10cSrcweir                             //not accessible
107cdf0e10cSrcweir                             SpellErrorAttrib();
108cdf0e10cSrcweir public:
109cdf0e10cSrcweir //                            SpellErrorAttrib(com::sun::star::uno::Reference<com::sun::star::linguistic2::XSpellAlternatives> xAlternatives);
110cdf0e10cSrcweir                             SpellErrorAttrib( const SpellErrorDescription& );
111cdf0e10cSrcweir                             SpellErrorAttrib( const SpellErrorAttrib& rAttr );
112cdf0e10cSrcweir                             ~SpellErrorAttrib();
113cdf0e10cSrcweir 
GetErrorDescription() const114cdf0e10cSrcweir     const SpellErrorDescription& GetErrorDescription() const { return m_aSpellErrorDescription; }
115cdf0e10cSrcweir 
116cdf0e10cSrcweir 
117cdf0e10cSrcweir     virtual void            SetFont( Font& rFont ) const;
118cdf0e10cSrcweir     virtual TextAttrib*     Clone() const;
119cdf0e10cSrcweir     virtual int             operator==( const TextAttrib& rAttr ) const;
120cdf0e10cSrcweir };
121cdf0e10cSrcweir /* -----------------10.09.2003 14:23-----------------
122cdf0e10cSrcweir 
123cdf0e10cSrcweir  --------------------------------------------------*/
124cdf0e10cSrcweir class SpellLanguageAttrib : public TextAttrib
125cdf0e10cSrcweir {
126cdf0e10cSrcweir     LanguageType m_eLanguage;
127cdf0e10cSrcweir 
128cdf0e10cSrcweir                             //not accessible
129cdf0e10cSrcweir                             SpellLanguageAttrib();
130cdf0e10cSrcweir 
131cdf0e10cSrcweir public:
132cdf0e10cSrcweir                             SpellLanguageAttrib(LanguageType eLanguage);
133cdf0e10cSrcweir                             SpellLanguageAttrib( const SpellLanguageAttrib& rAttr );
134cdf0e10cSrcweir                             ~SpellLanguageAttrib();
135cdf0e10cSrcweir 
GetLanguage() const136cdf0e10cSrcweir     LanguageType            GetLanguage() const {return m_eLanguage;}
SetLanguage(LanguageType eLang)137cdf0e10cSrcweir     void                    SetLanguage(LanguageType eLang)
138cdf0e10cSrcweir                                         {m_eLanguage = eLang;}
139cdf0e10cSrcweir 
140cdf0e10cSrcweir 
141cdf0e10cSrcweir     virtual void            SetFont( Font& rFont ) const;
142cdf0e10cSrcweir     virtual TextAttrib*     Clone() const;
143cdf0e10cSrcweir     virtual int             operator==( const TextAttrib& rAttr ) const;
144cdf0e10cSrcweir };
145cdf0e10cSrcweir /* -----------------31.10.2003 16:01-----------------
146cdf0e10cSrcweir 
147cdf0e10cSrcweir  --------------------------------------------------*/
148cdf0e10cSrcweir class SpellBackgroundAttrib : public TextAttrib
149cdf0e10cSrcweir {
150cdf0e10cSrcweir     Color   m_aBackgroundColor;
151cdf0e10cSrcweir 
152cdf0e10cSrcweir                             //not accessible
153cdf0e10cSrcweir                             SpellBackgroundAttrib();
154cdf0e10cSrcweir 
155cdf0e10cSrcweir public:
156cdf0e10cSrcweir                             SpellBackgroundAttrib(const Color& rCol);
157cdf0e10cSrcweir                             SpellBackgroundAttrib( const SpellBackgroundAttrib& rAttr );
158cdf0e10cSrcweir                             ~SpellBackgroundAttrib();
159cdf0e10cSrcweir 
GetColor() const160cdf0e10cSrcweir     const   Color&          GetColor() const { return m_aBackgroundColor;}
SetColor(const Color & rNewCol)161cdf0e10cSrcweir     void                    SetColor( const Color& rNewCol ){m_aBackgroundColor = rNewCol;}
162cdf0e10cSrcweir 
163cdf0e10cSrcweir 
164cdf0e10cSrcweir     virtual void            SetFont( Font& rFont ) const;
165cdf0e10cSrcweir     virtual TextAttrib*     Clone() const;
166cdf0e10cSrcweir     virtual int             operator==( const TextAttrib& rAttr ) const;
167cdf0e10cSrcweir };
168cdf0e10cSrcweir }//namespace svx
169cdf0e10cSrcweir #endif
170