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 .
19 #ifndef INCLUDED_I18NUTIL_SEARCHOPT_HXX
20 #define INCLUDED_I18NUTIL_SEARCHOPT_HXX
22 #include <sal/types.h>
23 #include <com/sun/star/lang/Locale.hpp>
24 #include <com/sun/star/util/SearchAlgorithms.hpp>
25 #include <com/sun/star/util/SearchOptions2.hpp>
26 #include <i18nutil/transliteration.hxx>
32 * This is a wrapper around com::sun::star::util::SearchOptions
33 * but using the more type-safe TransliterationFlags enum.
35 struct SAL_WARN_UNUSED SearchOptions
{
36 css::util::SearchAlgorithms algorithmType
;
38 OUString searchString
;
39 OUString replaceString
;
40 css::lang::Locale Locale
;
41 sal_Int32 changedChars
;
42 sal_Int32 deletedChars
;
43 sal_Int32 insertedChars
;
44 TransliterationFlags transliterateFlags
;
46 SearchOptions
& operator=(css::util::SearchOptions
const & other
)
48 algorithmType
= other
.algorithmType
;
49 searchFlag
= other
.searchFlag
;
50 searchString
= other
.searchString
;
51 replaceString
= other
.replaceString
;
52 Locale
= other
.Locale
;
53 changedChars
= other
.changedChars
;
54 deletedChars
= other
.deletedChars
;
55 insertedChars
= other
.insertedChars
;
56 transliterateFlags
= static_cast<TransliterationFlags
>(other
.transliterateFlags
);
61 : algorithmType(::css::util::SearchAlgorithms_ABSOLUTE
)
69 , transliterateFlags(TransliterationFlags::NONE
)
73 SearchOptions(const css::util::SearchAlgorithms
& algorithmType_
, const sal_Int32 searchFlag_
,
74 const OUString
& searchString_
, const OUString
& replaceString_
,
75 const css::lang::Locale
& Locale_
,
76 const sal_Int32 changedChars_
, const sal_Int32 deletedChars_
, const sal_Int32 insertedChars_
,
77 const TransliterationFlags
& transliterateFlags_
)
78 : algorithmType(algorithmType_
)
79 , searchFlag(searchFlag_
)
80 , searchString(searchString_
)
81 , replaceString(replaceString_
)
83 , changedChars(changedChars_
)
84 , deletedChars(deletedChars_
)
85 , insertedChars(insertedChars_
)
86 , transliterateFlags(transliterateFlags_
)
92 * This is a wrapper around com::sun::star::util::SearchOptions and SearchOptions2,
93 * but using the more type-safe TransliterationFlags enum.
95 struct SAL_WARN_UNUSED SearchOptions2
: public SearchOptions
{
97 sal_Int16 AlgorithmType2
;
98 sal_Int32 WildcardEscapeCharacter
;
100 SearchOptions2
& operator=(css::util::SearchOptions2
const & other
)
102 SearchOptions::operator=(other
);
103 AlgorithmType2
= other
.AlgorithmType2
;
104 WildcardEscapeCharacter
= other
.WildcardEscapeCharacter
;
109 css::util::SearchOptions2
toUnoSearchOptions2() const
111 return css::util::SearchOptions2(algorithmType
, searchFlag
,
112 searchString
, replaceString
,
114 changedChars
, deletedChars
, insertedChars
,
115 static_cast<sal_Int32
>(transliterateFlags
),
116 AlgorithmType2
, WildcardEscapeCharacter
);
122 , WildcardEscapeCharacter(0)
125 SearchOptions2(const css::util::SearchAlgorithms
& algorithmType_
, const sal_Int32 searchFlag_
,
126 const OUString
& searchString_
, const OUString
& replaceString_
,
127 const css::lang::Locale
& Locale_
,
128 const sal_Int32 changedChars_
, const sal_Int32 deletedChars_
, const sal_Int32 insertedChars_
,
129 const TransliterationFlags
& transliterateFlags_
,
130 const sal_Int16 AlgorithmType2_
, const sal_Int32 WildcardEscapeCharacter_
)
131 : SearchOptions(algorithmType_
, searchFlag_
, searchString_
, replaceString_
, Locale_
, changedChars_
, deletedChars_
, insertedChars_
, transliterateFlags_
)
132 , AlgorithmType2(AlgorithmType2_
)
133 , WildcardEscapeCharacter(WildcardEscapeCharacter_
)
141 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */