xref: /aoo4110/main/svx/inc/svx/fmsrccfg.hxx (revision b1cdbd2c)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef _FMSRCCF_HXX_
25 #define _FMSRCCF_HXX_
26 
27 #include <tools/string.hxx>
28 #include <unotools/configvaluecontainer.hxx>
29 #include <com/sun/star/uno/Sequence.hxx>
30 #include "svx/svxdllapi.h"
31 
32 // ===================================================================================================
33 
34 #define MATCHING_ANYWHERE		0
35 #define MATCHING_BEGINNING		1
36 #define MATCHING_END			2
37 #define MATCHING_WHOLETEXT		3
38 
39 // diese Konstanten duerfen NICHT einfach geaendert werden, da der SearchDialog aus den Einstellungen seiner ListBox
40 // keine Umrechnungen vornimmt, sondern die einfach in die entsprechenden Methoden der SearchEngine steckt
41 // (wenn man also die Konstanten oder die Reihenfolge der Listbox-Eintraege im Dialog aendert, muss das jeweils andere
42 // angepasst werden)
43 
44 
45 //........................................................................
46 namespace svxform
47 {
48 //........................................................................
49 
50 	// ===================================================================================================
51 	// = struct FmSearchParams - Parameter einer Suche
52 	// ===================================================================================================
53 
54 	struct SVX_DLLPUBLIC FmSearchParams
55 	{
56 	protected:
57 		sal_Int32		nTransliterationFlags;
58 			// they're way too sensitive for direct access ....
59 
60 	public:
61 		// no bit fields at all (want to pass the addresses to the OConfigurationValueContainer)
62 		::com::sun::star::uno::Sequence< ::rtl::OUString >
63 						aHistory;
64 		::rtl::OUString	sSingleSearchField;
65 
66 		sal_Int16		nSearchForType;
67 		sal_Int16		nPosition;
68 		sal_Int16		nLevOther;
69 		sal_Int16		nLevShorter;
70 		sal_Int16		nLevLonger;
71 		sal_Bool		bLevRelaxed;
72 
73 		sal_Bool		bAllFields;
74 		sal_Bool		bUseFormatter;
75 		sal_Bool		bBackwards;
76 		sal_Bool		bWildcard;
77 		sal_Bool		bRegular;
78 		sal_Bool		bApproxSearch;
79 			// the last three are mutually exclusive
80 
81 		sal_Bool		bSoundsLikeCJK;
82 
83 		// ......................................
84 		FmSearchParams();
85 
86 		sal_Bool	isIgnoreWidthCJK( ) const;
87 		void		setIgnoreWidthCJK( sal_Bool _bIgnore );
88 
getTransliterationFlagssvxform::FmSearchParams89 		sal_Int32	getTransliterationFlags( ) const { return nTransliterationFlags; }
setTransliterationFlagssvxform::FmSearchParams90 		void		setTransliterationFlags( sal_Int32 _nFlags ) { nTransliterationFlags = _nFlags; }
91 
92 		sal_Bool	isCaseSensitive( ) const;
93 		void		setCaseSensitive( sal_Bool _bCase );
94 	};
95 
96 	// ===================================================================================================
97 	// = class FmSearchConfigItem - ein ConfigItem, dass sich Suchparameter merkt
98 	// ===================================================================================================
99 
100 	class SVX_DLLPUBLIC FmSearchConfigItem
101 				:protected	FmSearchParams
102 				,public		::utl::OConfigurationValueContainer
103 				// order matters!
104 	{
105 	private:
106 		::osl::Mutex	m_aMutex;
107 
108 		// wrapper properties:
109 		// some of the members of FmSearchParams are must be translated to be stored in the configuration
110 		::rtl::OUString		m_sSearchForType;
111 		::rtl::OUString		m_sSearchPosition;
112 
113 		sal_Bool			m_bIsMatchCase;
114 		sal_Bool			m_bIsMatchFullHalfWidthForms;
115 		sal_Bool			m_bIsMatchHiraganaKatakana;
116 		sal_Bool			m_bIsMatchContractions;
117 		sal_Bool			m_bIsMatchMinusDashCho_on;
118 		sal_Bool			m_bIsMatchRepeatCharMarks;
119 		sal_Bool			m_bIsMatchVariantFormKanji;
120 		sal_Bool			m_bIsMatchOldKanaForms;
121 		sal_Bool			m_bIsMatch_DiZi_DuZu;
122 		sal_Bool			m_bIsMatch_BaVa_HaFa;
123 		sal_Bool			m_bIsMatch_TsiThiChi_DhiZi;
124 		sal_Bool			m_bIsMatch_HyuIyu_ByuVyu;
125 		sal_Bool			m_bIsMatch_SeShe_ZeJe;
126 		sal_Bool			m_bIsMatch_IaIya;
127 		sal_Bool			m_bIsMatch_KiKu;
128 		sal_Bool			m_bIsIgnorePunctuation;
129 		sal_Bool			m_bIsIgnoreWhitespace;
130 		sal_Bool			m_bIsIgnoreProlongedSoundMark;
131 		sal_Bool			m_bIsIgnoreMiddleDot;
132 
133 	public:
134 		FmSearchConfigItem();
135 		~FmSearchConfigItem();
136 
137 		const FmSearchParams&	getParams( ) const;
138 		void					setParams( const FmSearchParams& _rParams );
139 
140 	private:
141 		SVX_DLLPRIVATE void	implTranslateFromConfig( );
142 		SVX_DLLPRIVATE void	implTranslateToConfig( );
143 	};
144 
145 //........................................................................
146 }	// namespace svxform
147 //........................................................................
148 
149 // ===================================================================================================
150 
151 #endif // _FMSRCCF_HXX_
152 
153