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 #pragma once
20 
21 #include <com/sun/star/uno/Reference.h>
22 #include <com/sun/star/uno/Sequence.h>
23 #include <com/sun/star/lang/Locale.hpp>
24 #include <com/sun/star/linguistic2/XProofreader.hpp>
25 
26 namespace svx{
28 {
30  OUString sErrorText;
31  OUString sDialogTitle;
32  OUString sExplanation;
33  OUString sExplanationURL;
34  css::lang::Locale aLocale;
35  css::uno::Reference< css::linguistic2::XProofreader > xGrammarChecker;
36  css::uno::Sequence< OUString > aSuggestions;
37  OUString sRuleId;
38 
39  SpellErrorDescription( bool bGrammar,
40  const OUString& rText,
41  const css::lang::Locale& rLocale,
42  const css::uno::Sequence< OUString >& rSuggestions,
43  css::uno::Reference< css::linguistic2::XProofreader > const & rxGrammarChecker,
44  const OUString* pDialogTitle = nullptr,
45  const OUString* pExplanation = nullptr,
46  const OUString* pRuleId = nullptr,
47  const OUString* pExplanationURL = nullptr ) :
48  bIsGrammarError( bGrammar ),
49  sErrorText( rText ),
50  sDialogTitle( ),
51  sExplanation( ),
52  sExplanationURL( ),
53  aLocale( rLocale ),
54  xGrammarChecker( rxGrammarChecker ),
55  aSuggestions( rSuggestions )
56  {
57  if( pDialogTitle )
58  sDialogTitle = *pDialogTitle;
59  if( pExplanation )
60  sExplanation = *pExplanation;
61  if( pExplanationURL )
62  sExplanationURL = *pExplanationURL;
63  if( pRuleId )
64  sRuleId = *pRuleId;
65  };
66 
68  : bIsGrammarError(false)
69  {
70  }
71 
72  bool operator==( const SpellErrorDescription& rDesc ) const
73  {
74  return bIsGrammarError == rDesc.bIsGrammarError &&
75  sErrorText == rDesc.sErrorText &&
76  aLocale.Language == rDesc.aLocale.Language &&
77  aLocale.Country == rDesc.aLocale.Country &&
78  aLocale.Variant == rDesc.aLocale.Variant &&
79  aSuggestions == rDesc.aSuggestions &&
80  xGrammarChecker == rDesc.xGrammarChecker &&
81  sDialogTitle == rDesc.sDialogTitle &&
82  sExplanation == rDesc.sExplanation &&
83  sExplanationURL == rDesc.sExplanationURL &&
84  sRuleId == rDesc.sRuleId;
85  }
86 
87  css::uno::Sequence<css::uno::Any> toSequence() const
88  {
89  css::uno::Sequence<css::uno::Any> aEntries(9);
90  aEntries[0] <<= bIsGrammarError;
91  aEntries[1] <<= sErrorText;
92  aEntries[2] <<= sDialogTitle;
93  aEntries[3] <<= sExplanation;
94  aEntries[4] <<= sExplanationURL;
95  aEntries[5] <<= aLocale;
96  aEntries[6] <<= xGrammarChecker;
97  aEntries[7] <<= aSuggestions;
98  aEntries[8] <<= sRuleId;
99  return aEntries;
100  }
101 
102  void fromSequence(const css::uno::Sequence<css::uno::Any>& rEntries)
103  {
104  rEntries[0] >>= bIsGrammarError;
105  rEntries[1] >>= sErrorText;
106  rEntries[2] >>= sDialogTitle;
107  rEntries[3] >>= sExplanation;
108  rEntries[4] >>= sExplanationURL;
109  rEntries[5] >>= aLocale;
110  rEntries[6] >>= xGrammarChecker;
111  rEntries[7] >>= aSuggestions;
112  rEntries[8] >>= sRuleId;
113  }
114 };
115 
116 }//namespace svx
117 
118 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
css::uno::Sequence< css::uno::Any > toSequence() const
Definition: SpellAttrib.hxx:87
bool operator==(const SpellErrorDescription &rDesc) const
Definition: SpellAttrib.hxx:72
css::uno::Sequence< OUString > aSuggestions
Definition: SpellAttrib.hxx:36
css::uno::Reference< css::linguistic2::XProofreader > xGrammarChecker
Definition: SpellAttrib.hxx:35
css::lang::Locale aLocale
Definition: SpellAttrib.hxx:34
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:39
ScXMLEditAttributeMap::Entry const aEntries[]
void fromSequence(const css::uno::Sequence< css::uno::Any > &rEntries)