LibreOffice Module cui (master)  1
SpellAttrib.hxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
5  * This Source Code Form is subject to the terms of the Mozilla Public
6  * License, v. 2.0. If a copy of the MPL was not distributed with this
7  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
11  * Licensed to the Apache Software Foundation (ASF) under one or more
12  * contributor license agreements. See the NOTICE file distributed
13  * with this work for additional information regarding copyright
14  * ownership. The ASF licenses this file to you under the Apache
15  * License, Version 2.0 (the "License"); you may not use this file
16  * except in compliance with the License. You may obtain a copy of
17  * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18  */
19 #ifndef INCLUDED_CUI_SOURCE_DIALOGS_SPELLATTRIB_HXX
20 #define INCLUDED_CUI_SOURCE_DIALOGS_SPELLATTRIB_HXX
21 
22 #include <com/sun/star/uno/Reference.h>
23 #include <com/sun/star/uno/Sequence.h>
24 #include <com/sun/star/lang/Locale.hpp>
25 #include <com/sun/star/linguistic2/XProofreader.hpp>
26 
27 namespace svx{
29 {
31  OUString sErrorText;
32  OUString sDialogTitle;
33  OUString sExplanation;
34  OUString sExplanationURL;
35  css::lang::Locale aLocale;
36  css::uno::Reference< css::linguistic2::XProofreader > xGrammarChecker;
37  css::uno::Sequence< OUString > aSuggestions;
38  OUString sRuleId;
39 
40  SpellErrorDescription( bool bGrammar,
41  const OUString& rText,
42  const css::lang::Locale& rLocale,
43  const css::uno::Sequence< OUString >& rSuggestions,
44  css::uno::Reference< css::linguistic2::XProofreader > const & rxGrammarChecker,
45  const OUString* pDialogTitle = nullptr,
46  const OUString* pExplanation = nullptr,
47  const OUString* pRuleId = nullptr,
48  const OUString* pExplanationURL = nullptr ) :
49  bIsGrammarError( bGrammar ),
50  sErrorText( rText ),
51  sDialogTitle( ),
52  sExplanation( ),
53  sExplanationURL( ),
54  aLocale( rLocale ),
55  xGrammarChecker( rxGrammarChecker ),
56  aSuggestions( rSuggestions )
57  {
58  if( pDialogTitle )
59  sDialogTitle = *pDialogTitle;
60  if( pExplanation )
61  sExplanation = *pExplanation;
62  if( pExplanationURL )
63  sExplanationURL = *pExplanationURL;
64  if( pRuleId )
65  sRuleId = *pRuleId;
66  };
67 
69  : bIsGrammarError(false)
70  {
71  }
72 
73  bool operator==( const SpellErrorDescription& rDesc ) const
74  {
75  return bIsGrammarError == rDesc.bIsGrammarError &&
76  sErrorText == rDesc.sErrorText &&
77  aLocale.Language == rDesc.aLocale.Language &&
78  aLocale.Country == rDesc.aLocale.Country &&
79  aLocale.Variant == rDesc.aLocale.Variant &&
80  aSuggestions == rDesc.aSuggestions &&
81  xGrammarChecker == rDesc.xGrammarChecker &&
82  sDialogTitle == rDesc.sDialogTitle &&
83  sExplanation == rDesc.sExplanation &&
84  sExplanationURL == rDesc.sExplanationURL &&
85  sRuleId == rDesc.sRuleId;
86  }
87 
88  css::uno::Sequence<css::uno::Any> toSequence() const
89  {
90  css::uno::Sequence<css::uno::Any> aEntries(9);
91  aEntries[0] <<= bIsGrammarError;
92  aEntries[1] <<= sErrorText;
93  aEntries[2] <<= sDialogTitle;
94  aEntries[3] <<= sExplanation;
95  aEntries[4] <<= sExplanationURL;
96  aEntries[5] <<= aLocale;
97  aEntries[6] <<= xGrammarChecker;
98  aEntries[7] <<= aSuggestions;
99  aEntries[8] <<= sRuleId;
100  return aEntries;
101  }
102 
103  void fromSequence(const css::uno::Sequence<css::uno::Any>& rEntries)
104  {
105  rEntries[0] >>= bIsGrammarError;
106  rEntries[1] >>= sErrorText;
107  rEntries[2] >>= sDialogTitle;
108  rEntries[3] >>= sExplanation;
109  rEntries[4] >>= sExplanationURL;
110  rEntries[5] >>= aLocale;
111  rEntries[6] >>= xGrammarChecker;
112  rEntries[7] >>= aSuggestions;
113  rEntries[8] >>= sRuleId;
114  }
115 };
116 
117 }//namespace svx
118 #endif
119 
120 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
css::uno::Sequence< css::uno::Any > toSequence() const
Definition: SpellAttrib.hxx:88
bool operator==(const SpellErrorDescription &rDesc) const
Definition: SpellAttrib.hxx:73
css::uno::Sequence< OUString > aSuggestions
Definition: SpellAttrib.hxx:37
css::uno::Reference< css::linguistic2::XProofreader > xGrammarChecker
Definition: SpellAttrib.hxx:36
css::lang::Locale aLocale
Definition: SpellAttrib.hxx:35
SpellErrorDescription(bool bGrammar, const OUString &rText, const css::lang::Locale &rLocale, const css::uno::Sequence< OUString > &rSuggestions, css::uno::Reference< css::linguistic2::XProofreader > const &rxGrammarChecker, const OUString *pDialogTitle=nullptr, const OUString *pExplanation=nullptr, const OUString *pRuleId=nullptr, const OUString *pExplanationURL=nullptr)
Definition: SpellAttrib.hxx:40
ScXMLEditAttributeMap::Entry const aEntries[]
void fromSequence(const css::uno::Sequence< css::uno::Any > &rEntries)