1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
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>
28 struct SpellErrorDescription
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
;
40 SpellErrorDescription( bool bGrammar
,
42 css::lang::Locale _aLocale
,
43 const css::uno::Sequence
< OUString
>& rSuggestions
,
44 css::uno::Reference
< css::linguistic2::XProofreader
> _xGrammarChecker
,
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(std::move( aText
)),
54 aLocale(std::move( _aLocale
)),
55 xGrammarChecker(std::move( _xGrammarChecker
)),
56 aSuggestions( rSuggestions
)
59 sDialogTitle
= *pDialogTitle
;
61 sExplanation
= *pExplanation
;
63 sExplanationURL
= *pExplanationURL
;
68 SpellErrorDescription()
69 : bIsGrammarError(false)
73 bool operator==( const SpellErrorDescription
& rDesc
) const
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
;
88 css::uno::Sequence
<css::uno::Any
> toSequence() const
90 css::uno::Sequence
<css::uno::Any
> aEntries
{ css::uno::Any(bIsGrammarError
),
91 css::uno::Any(sErrorText
),
92 css::uno::Any(sDialogTitle
),
93 css::uno::Any(sExplanation
),
94 css::uno::Any(sExplanationURL
),
95 css::uno::Any(aLocale
),
96 css::uno::Any(xGrammarChecker
),
97 css::uno::Any(aSuggestions
),
98 css::uno::Any(sRuleId
) };
102 void fromSequence(const css::uno::Sequence
<css::uno::Any
>& rEntries
)
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
;
118 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */