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 _FMSRCCF_HXX_
21 : #define _FMSRCCF_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 : ::com::sun::star::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 : sal_Bool bLevRelaxed;
67 :
68 : sal_Bool bAllFields;
69 : sal_Bool bUseFormatter;
70 : sal_Bool bBackwards;
71 : sal_Bool bWildcard;
72 : sal_Bool bRegular;
73 : sal_Bool bApproxSearch;
74 : // the last three are mutually exclusive
75 :
76 : sal_Bool bSoundsLikeCJK;
77 :
78 : // ......................................
79 : FmSearchParams();
80 :
81 : sal_Bool isIgnoreWidthCJK( ) const;
82 :
83 0 : sal_Int32 getTransliterationFlags( ) const { return nTransliterationFlags; }
84 0 : void setTransliterationFlags( sal_Int32 _nFlags ) { nTransliterationFlags = _nFlags; }
85 :
86 : sal_Bool isCaseSensitive( ) const;
87 : void setCaseSensitive( sal_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 : sal_Bool m_bIsMatchCase;
108 : sal_Bool m_bIsMatchFullHalfWidthForms;
109 : sal_Bool m_bIsMatchHiraganaKatakana;
110 : sal_Bool m_bIsMatchContractions;
111 : sal_Bool m_bIsMatchMinusDashCho_on;
112 : sal_Bool m_bIsMatchRepeatCharMarks;
113 : sal_Bool m_bIsMatchVariantFormKanji;
114 : sal_Bool m_bIsMatchOldKanaForms;
115 : sal_Bool m_bIsMatch_DiZi_DuZu;
116 : sal_Bool m_bIsMatch_BaVa_HaFa;
117 : sal_Bool m_bIsMatch_TsiThiChi_DhiZi;
118 : sal_Bool m_bIsMatch_HyuIyu_ByuVyu;
119 : sal_Bool m_bIsMatch_SeShe_ZeJe;
120 : sal_Bool m_bIsMatch_IaIya;
121 : sal_Bool m_bIsMatch_KiKu;
122 : sal_Bool m_bIsIgnorePunctuation;
123 : sal_Bool m_bIsIgnoreWhitespace;
124 : sal_Bool m_bIsIgnoreProlongedSoundMark;
125 : sal_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 // _FMSRCCF_HXX_
146 :
147 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|