Line data Source code
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 :
20 : #ifndef INCLUDED_SVX_FMSRCCFG_HXX
21 : #define INCLUDED_SVX_FMSRCCFG_HXX
22 :
23 : #include <unotools/configvaluecontainer.hxx>
24 : #include <com/sun/star/uno/Sequence.hxx>
25 : #include <svx/svxdllapi.h>
26 :
27 :
28 :
29 : #define MATCHING_ANYWHERE 0
30 : #define MATCHING_BEGINNING 1
31 : #define MATCHING_END 2
32 : #define MATCHING_WHOLETEXT 3
33 :
34 : // this constants should NOT be just changed, since the SearchDialog performs no conversion of the settings of
35 : // its ListBox, but instead just passes them along to the appropriate methods of SearchEngine
36 : // (so if you change the constants or the order of the listbox entries in the dialog, then the other has
37 : // to be adapted)
38 :
39 :
40 :
41 : namespace svxform
42 : {
43 :
44 :
45 :
46 : // = struct FmSearchParams - parameters of a search
47 :
48 :
49 0 : struct SVX_DLLPUBLIC FmSearchParams
50 : {
51 : protected:
52 : sal_Int32 nTransliterationFlags;
53 : // they're way too sensitive for direct access ....
54 :
55 : public:
56 : // no bit fields at all (want to pass the addresses to the OConfigurationValueContainer)
57 : css::uno::Sequence< OUString >
58 : aHistory;
59 : OUString sSingleSearchField;
60 :
61 : sal_Int16 nSearchForType;
62 : sal_Int16 nPosition;
63 : sal_Int16 nLevOther;
64 : sal_Int16 nLevShorter;
65 : sal_Int16 nLevLonger;
66 : bool bLevRelaxed;
67 :
68 : bool bAllFields;
69 : bool bUseFormatter;
70 : bool bBackwards;
71 : bool bWildcard;
72 : bool bRegular;
73 : bool bApproxSearch;
74 : // the last three are mutually exclusive
75 :
76 : bool bSoundsLikeCJK;
77 :
78 :
79 : FmSearchParams();
80 :
81 : bool isIgnoreWidthCJK( ) const;
82 :
83 0 : sal_Int32 getTransliterationFlags( ) const { return nTransliterationFlags; }
84 0 : void setTransliterationFlags( sal_Int32 _nFlags ) { nTransliterationFlags = _nFlags; }
85 :
86 : bool isCaseSensitive( ) const;
87 : void setCaseSensitive( bool _bCase );
88 : };
89 :
90 :
91 : // = class FmSearchConfigItem - a ConfigItem, that remembers search parameters
92 :
93 :
94 : class SVX_DLLPUBLIC FmSearchConfigItem
95 : :protected FmSearchParams
96 : ,public ::utl::OConfigurationValueContainer
97 : // order matters!
98 : {
99 : private:
100 : ::osl::Mutex m_aMutex;
101 :
102 : // wrapper properties:
103 : // some of the members of FmSearchParams are must be translated to be stored in the configuration
104 : OUString m_sSearchForType;
105 : OUString m_sSearchPosition;
106 :
107 : bool m_bIsMatchCase;
108 : bool m_bIsMatchFullHalfWidthForms;
109 : bool m_bIsMatchHiraganaKatakana;
110 : bool m_bIsMatchContractions;
111 : bool m_bIsMatchMinusDashCho_on;
112 : bool m_bIsMatchRepeatCharMarks;
113 : bool m_bIsMatchVariantFormKanji;
114 : bool m_bIsMatchOldKanaForms;
115 : bool m_bIsMatch_DiZi_DuZu;
116 : bool m_bIsMatch_BaVa_HaFa;
117 : bool m_bIsMatch_TsiThiChi_DhiZi;
118 : bool m_bIsMatch_HyuIyu_ByuVyu;
119 : bool m_bIsMatch_SeShe_ZeJe;
120 : bool m_bIsMatch_IaIya;
121 : bool m_bIsMatch_KiKu;
122 : bool m_bIsIgnorePunctuation;
123 : bool m_bIsIgnoreWhitespace;
124 : bool m_bIsIgnoreProlongedSoundMark;
125 : bool m_bIsIgnoreMiddleDot;
126 :
127 : public:
128 : FmSearchConfigItem();
129 : ~FmSearchConfigItem();
130 :
131 : const FmSearchParams& getParams( ) const;
132 : void setParams( const FmSearchParams& _rParams );
133 :
134 : private:
135 : SVX_DLLPRIVATE void implTranslateFromConfig( );
136 : SVX_DLLPRIVATE void implTranslateToConfig( );
137 : };
138 :
139 :
140 : } // namespace svxform
141 :
142 :
143 :
144 :
145 : #endif // INCLUDED_SVX_FMSRCCFG_HXX
146 :
147 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|