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>
33 * This is a wrapper around com::sun::star::util::SearchOptions
34 * but using the more type-safe TransliterationFlags enum.
36 struct SAL_WARN_UNUSED SearchOptions
{
37 css::util::SearchAlgorithms algorithmType
;
39 OUString searchString
;
40 OUString replaceString
;
41 css::lang::Locale Locale
;
42 sal_Int32 changedChars
;
43 sal_Int32 deletedChars
;
44 sal_Int32 insertedChars
;
45 TransliterationFlags transliterateFlags
;
47 SearchOptions
& operator=(css::util::SearchOptions
const & other
)
49 algorithmType
= other
.algorithmType
;
50 searchFlag
= other
.searchFlag
;
51 searchString
= other
.searchString
;
52 replaceString
= other
.replaceString
;
53 Locale
= other
.Locale
;
54 changedChars
= other
.changedChars
;
55 deletedChars
= other
.deletedChars
;
56 insertedChars
= other
.insertedChars
;
57 transliterateFlags
= static_cast<TransliterationFlags
>(other
.transliterateFlags
);
62 : algorithmType(::css::util::SearchAlgorithms_ABSOLUTE
)
67 , transliterateFlags(TransliterationFlags::NONE
)
71 SearchOptions(const css::util::SearchAlgorithms
& algorithmType_
, const sal_Int32 searchFlag_
,
72 OUString searchString_
, OUString replaceString_
,
73 css::lang::Locale Locale_
,
74 const sal_Int32 changedChars_
, const sal_Int32 deletedChars_
, const sal_Int32 insertedChars_
,
75 const TransliterationFlags
& transliterateFlags_
)
76 : algorithmType(algorithmType_
)
77 , searchFlag(searchFlag_
)
78 , searchString(std::move(searchString_
))
79 , replaceString(std::move(replaceString_
))
80 , Locale(std::move(Locale_
))
81 , changedChars(changedChars_
)
82 , deletedChars(deletedChars_
)
83 , insertedChars(insertedChars_
)
84 , transliterateFlags(transliterateFlags_
)
90 * This is a wrapper around com::sun::star::util::SearchOptions and SearchOptions2,
91 * but using the more type-safe TransliterationFlags enum.
93 struct SAL_WARN_UNUSED SearchOptions2
: public SearchOptions
{
95 sal_Int16 AlgorithmType2
;
96 sal_Int32 WildcardEscapeCharacter
;
98 SearchOptions2
& operator=(css::util::SearchOptions2
const & other
)
100 SearchOptions::operator=(other
);
101 AlgorithmType2
= other
.AlgorithmType2
;
102 WildcardEscapeCharacter
= other
.WildcardEscapeCharacter
;
107 css::util::SearchOptions2
toUnoSearchOptions2() const
109 return css::util::SearchOptions2(algorithmType
, searchFlag
,
110 searchString
, replaceString
,
112 changedChars
, deletedChars
, insertedChars
,
113 static_cast<sal_Int32
>(transliterateFlags
),
114 AlgorithmType2
, WildcardEscapeCharacter
);
119 , WildcardEscapeCharacter(0)
122 SearchOptions2(const css::util::SearchAlgorithms
& algorithmType_
, const sal_Int32 searchFlag_
,
123 const OUString
& searchString_
, const OUString
& replaceString_
,
124 const css::lang::Locale
& Locale_
,
125 const sal_Int32 changedChars_
, const sal_Int32 deletedChars_
, const sal_Int32 insertedChars_
,
126 const TransliterationFlags
& transliterateFlags_
,
127 const sal_Int16 AlgorithmType2_
, const sal_Int32 WildcardEscapeCharacter_
)
128 : SearchOptions(algorithmType_
, searchFlag_
, searchString_
, replaceString_
, Locale_
, changedChars_
, deletedChars_
, insertedChars_
, transliterateFlags_
)
129 , AlgorithmType2(AlgorithmType2_
)
130 , WildcardEscapeCharacter(WildcardEscapeCharacter_
)
138 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */