1*efeef26fSAndrew Rist /**************************************************************
2cdf0e10cSrcweir *
3*efeef26fSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
4*efeef26fSAndrew Rist * or more contributor license agreements. See the NOTICE file
5*efeef26fSAndrew Rist * distributed with this work for additional information
6*efeef26fSAndrew Rist * regarding copyright ownership. The ASF licenses this file
7*efeef26fSAndrew Rist * to you under the Apache License, Version 2.0 (the
8*efeef26fSAndrew Rist * "License"); you may not use this file except in compliance
9*efeef26fSAndrew Rist * with the License. You may obtain a copy of the License at
10cdf0e10cSrcweir *
11*efeef26fSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir *
13*efeef26fSAndrew Rist * Unless required by applicable law or agreed to in writing,
14*efeef26fSAndrew Rist * software distributed under the License is distributed on an
15*efeef26fSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*efeef26fSAndrew Rist * KIND, either express or implied. See the License for the
17*efeef26fSAndrew Rist * specific language governing permissions and limitations
18*efeef26fSAndrew Rist * under the License.
19cdf0e10cSrcweir *
20*efeef26fSAndrew Rist *************************************************************/
21*efeef26fSAndrew Rist
22*efeef26fSAndrew Rist
23cdf0e10cSrcweir
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_sw.hxx"
26cdf0e10cSrcweir
27cdf0e10cSrcweir #include "unosrch.hxx"
28cdf0e10cSrcweir #include <doc.hxx>
29cdf0e10cSrcweir #include <hints.hxx>
30cdf0e10cSrcweir #include <unomap.hxx>
31cdf0e10cSrcweir #include <unobaseclass.hxx>
32cdf0e10cSrcweir #include <unomid.h>
33cdf0e10cSrcweir
34cdf0e10cSrcweir #include <vos/mutex.hxx>
35cdf0e10cSrcweir #include <vcl/svapp.hxx>
36cdf0e10cSrcweir #include "editeng/unolingu.hxx"
37cdf0e10cSrcweir #include <com/sun/star/util/SearchOptions.hpp>
38cdf0e10cSrcweir #include <com/sun/star/util/SearchFlags.hpp>
39cdf0e10cSrcweir #include <com/sun/star/i18n/TransliterationModules.hpp>
40cdf0e10cSrcweir #include <com/sun/star/beans/PropertyAttribute.hpp>
41cdf0e10cSrcweir
42cdf0e10cSrcweir using namespace ::com::sun::star;
43cdf0e10cSrcweir using ::rtl::OUString;
44cdf0e10cSrcweir
45cdf0e10cSrcweir /******************************************************************************
46cdf0e10cSrcweir *
47cdf0e10cSrcweir ******************************************************************************/
48cdf0e10cSrcweir
49cdf0e10cSrcweir /* -----------------23.06.99 12:19-------------------
50cdf0e10cSrcweir
51cdf0e10cSrcweir --------------------------------------------------*/
52cdf0e10cSrcweir class SwSearchProperties_Impl
53cdf0e10cSrcweir {
54cdf0e10cSrcweir beans::PropertyValue** pValueArr; //
55cdf0e10cSrcweir sal_uInt32 nArrLen;
56cdf0e10cSrcweir const PropertyEntryVector_t aPropertyEntries;
57cdf0e10cSrcweir public:
58cdf0e10cSrcweir SwSearchProperties_Impl();
59cdf0e10cSrcweir ~SwSearchProperties_Impl();
60cdf0e10cSrcweir
61cdf0e10cSrcweir void SetProperties(const uno::Sequence< beans::PropertyValue >& aSearchAttribs)
62cdf0e10cSrcweir throw( beans::UnknownPropertyException, lang::IllegalArgumentException, uno::RuntimeException );
63cdf0e10cSrcweir const uno::Sequence< beans::PropertyValue > GetProperties() const;
64cdf0e10cSrcweir
65cdf0e10cSrcweir void FillItemSet(SfxItemSet& rSet, sal_Bool bIsValueSearch) const;
66cdf0e10cSrcweir sal_Bool HasAttributes() const;
67cdf0e10cSrcweir };
68cdf0e10cSrcweir /* -----------------23.06.99 13:08-------------------
69cdf0e10cSrcweir
70cdf0e10cSrcweir --------------------------------------------------*/
SwSearchProperties_Impl()71cdf0e10cSrcweir SwSearchProperties_Impl::SwSearchProperties_Impl() :
72cdf0e10cSrcweir nArrLen(0),
73cdf0e10cSrcweir aPropertyEntries( aSwMapProvider.GetPropertySet(PROPERTY_MAP_TEXT_CURSOR)->getPropertyMap()->getPropertyEntries())
74cdf0e10cSrcweir {
75cdf0e10cSrcweir nArrLen = aPropertyEntries.size();
76cdf0e10cSrcweir pValueArr = new beans::PropertyValue*[nArrLen];
77cdf0e10cSrcweir for(sal_uInt32 i = 0; i < nArrLen; i++)
78cdf0e10cSrcweir pValueArr[i] = 0;
79cdf0e10cSrcweir }
80cdf0e10cSrcweir /* -----------------23.06.99 13:08-------------------
81cdf0e10cSrcweir
82cdf0e10cSrcweir --------------------------------------------------*/
~SwSearchProperties_Impl()83cdf0e10cSrcweir SwSearchProperties_Impl::~SwSearchProperties_Impl()
84cdf0e10cSrcweir {
85cdf0e10cSrcweir for(sal_uInt32 i = 0; i < nArrLen; i++)
86cdf0e10cSrcweir delete pValueArr[i];
87cdf0e10cSrcweir delete[] pValueArr;
88cdf0e10cSrcweir }
89cdf0e10cSrcweir /* -----------------23.06.99 13:09-------------------
90cdf0e10cSrcweir
91cdf0e10cSrcweir --------------------------------------------------*/
SetProperties(const uno::Sequence<beans::PropertyValue> & aSearchAttribs)92cdf0e10cSrcweir void SwSearchProperties_Impl::SetProperties(const uno::Sequence< beans::PropertyValue >& aSearchAttribs)
93cdf0e10cSrcweir throw( beans::UnknownPropertyException, lang::IllegalArgumentException, uno::RuntimeException )
94cdf0e10cSrcweir {
95cdf0e10cSrcweir const beans::PropertyValue* pProps = aSearchAttribs.getConstArray();
96cdf0e10cSrcweir sal_uInt32 i;
97cdf0e10cSrcweir
98cdf0e10cSrcweir //delete all existing values
99cdf0e10cSrcweir for( i = 0; i < nArrLen; i++)
100cdf0e10cSrcweir {
101cdf0e10cSrcweir delete pValueArr[i];
102cdf0e10cSrcweir pValueArr[i] = 0;
103cdf0e10cSrcweir }
104cdf0e10cSrcweir
105cdf0e10cSrcweir sal_uInt32 nLen = aSearchAttribs.getLength();
106cdf0e10cSrcweir for(i = 0; i < nLen; i++)
107cdf0e10cSrcweir {
108cdf0e10cSrcweir sal_uInt16 nIndex = 0;
109cdf0e10cSrcweir PropertyEntryVector_t::const_iterator aIt = aPropertyEntries.begin();
110cdf0e10cSrcweir while(pProps[i].Name != aIt->sName)
111cdf0e10cSrcweir {
112cdf0e10cSrcweir ++aIt;
113cdf0e10cSrcweir nIndex++;
114cdf0e10cSrcweir if( aIt == aPropertyEntries.end() )
115cdf0e10cSrcweir throw beans::UnknownPropertyException();
116cdf0e10cSrcweir }
117cdf0e10cSrcweir pValueArr[nIndex] = new beans::PropertyValue(pProps[i]);
118cdf0e10cSrcweir }
119cdf0e10cSrcweir }
120cdf0e10cSrcweir /* -----------------23.06.99 13:08-------------------
121cdf0e10cSrcweir
122cdf0e10cSrcweir --------------------------------------------------*/
GetProperties() const123cdf0e10cSrcweir const uno::Sequence< beans::PropertyValue > SwSearchProperties_Impl::GetProperties() const
124cdf0e10cSrcweir {
125cdf0e10cSrcweir sal_uInt32 nPropCount = 0;
126cdf0e10cSrcweir sal_uInt32 i;
127cdf0e10cSrcweir for( i = 0; i < nArrLen; i++)
128cdf0e10cSrcweir if(pValueArr[i])
129cdf0e10cSrcweir nPropCount++;
130cdf0e10cSrcweir
131cdf0e10cSrcweir uno::Sequence< beans::PropertyValue > aRet(nPropCount);
132cdf0e10cSrcweir beans::PropertyValue* pProps = aRet.getArray();
133cdf0e10cSrcweir nPropCount = 0;
134cdf0e10cSrcweir for(i = 0; i < nArrLen; i++)
135cdf0e10cSrcweir {
136cdf0e10cSrcweir if(pValueArr[i])
137cdf0e10cSrcweir {
138cdf0e10cSrcweir pProps[nPropCount++] = *(pValueArr[i]);
139cdf0e10cSrcweir }
140cdf0e10cSrcweir }
141cdf0e10cSrcweir return aRet;
142cdf0e10cSrcweir }
143cdf0e10cSrcweir /* -----------------23.06.99 13:06-------------------
144cdf0e10cSrcweir
145cdf0e10cSrcweir --------------------------------------------------*/
FillItemSet(SfxItemSet & rSet,sal_Bool bIsValueSearch) const146cdf0e10cSrcweir void SwSearchProperties_Impl::FillItemSet(SfxItemSet& rSet, sal_Bool bIsValueSearch) const
147cdf0e10cSrcweir {
148cdf0e10cSrcweir //
149cdf0e10cSrcweir
150cdf0e10cSrcweir SfxPoolItem* pBoxItem = 0,
151cdf0e10cSrcweir *pBreakItem = 0,
152cdf0e10cSrcweir *pAutoKernItem = 0,
153cdf0e10cSrcweir *pWLineItem = 0,
154cdf0e10cSrcweir *pTabItem = 0,
155cdf0e10cSrcweir *pSplitItem = 0,
156cdf0e10cSrcweir *pRegItem = 0,
157cdf0e10cSrcweir *pLineSpaceItem = 0,
158cdf0e10cSrcweir *pLineNumItem = 0,
159cdf0e10cSrcweir *pKeepItem = 0,
160cdf0e10cSrcweir *pLRItem = 0,
161cdf0e10cSrcweir *pULItem = 0,
162cdf0e10cSrcweir *pBackItem = 0,
163cdf0e10cSrcweir *pAdjItem = 0,
164cdf0e10cSrcweir *pDescItem = 0,
165cdf0e10cSrcweir *pInetItem = 0,
166cdf0e10cSrcweir *pDropItem = 0,
167cdf0e10cSrcweir *pWeightItem = 0,
168cdf0e10cSrcweir *pULineItem = 0,
169cdf0e10cSrcweir *pOLineItem = 0,
170cdf0e10cSrcweir *pCharFmtItem = 0,
171cdf0e10cSrcweir *pShadItem = 0,
172cdf0e10cSrcweir *pPostItem = 0,
173cdf0e10cSrcweir *pNHyphItem = 0,
174cdf0e10cSrcweir *pLangItem = 0,
175cdf0e10cSrcweir *pKernItem = 0,
176cdf0e10cSrcweir *pFontSizeItem = 0,
177cdf0e10cSrcweir *pFontItem = 0,
178cdf0e10cSrcweir *pBlinkItem = 0,
179cdf0e10cSrcweir *pEscItem = 0,
180cdf0e10cSrcweir *pCrossedOutItem = 0,
181cdf0e10cSrcweir *pContourItem = 0,
182cdf0e10cSrcweir *pCharColorItem = 0,
183cdf0e10cSrcweir *pCasemapItem = 0,
184cdf0e10cSrcweir *pBrushItem = 0,
185cdf0e10cSrcweir *pFontCJKItem = 0,
186cdf0e10cSrcweir *pFontSizeCJKItem = 0,
187cdf0e10cSrcweir *pCJKLangItem = 0,
188cdf0e10cSrcweir *pCJKPostureItem = 0,
189cdf0e10cSrcweir *pCJKWeightItem = 0,
190cdf0e10cSrcweir *pFontCTLItem = 0,
191cdf0e10cSrcweir *pFontSizeCTLItem = 0,
192cdf0e10cSrcweir *pCTLLangItem = 0,
193cdf0e10cSrcweir *pCTLPostureItem = 0,
194cdf0e10cSrcweir *pCTLWeightItem = 0;
195cdf0e10cSrcweir
196cdf0e10cSrcweir PropertyEntryVector_t::const_iterator aIt = aPropertyEntries.begin();
197cdf0e10cSrcweir for(sal_uInt32 i = 0; i < nArrLen; i++, ++aIt)
198cdf0e10cSrcweir {
199cdf0e10cSrcweir if(pValueArr[i])
200cdf0e10cSrcweir {
201cdf0e10cSrcweir SfxPoolItem* pTempItem = 0;
202cdf0e10cSrcweir switch(aIt->nWID)
203cdf0e10cSrcweir {
204cdf0e10cSrcweir case RES_BOX:
205cdf0e10cSrcweir if(!pBoxItem)
206cdf0e10cSrcweir pBoxItem = rSet.GetPool()->GetDefaultItem(aIt->nWID).Clone();
207cdf0e10cSrcweir pTempItem = pBoxItem;
208cdf0e10cSrcweir break;
209cdf0e10cSrcweir case RES_BREAK:
210cdf0e10cSrcweir if(!pBreakItem)
211cdf0e10cSrcweir pBreakItem = rSet.GetPool()->GetDefaultItem(aIt->nWID).Clone();
212cdf0e10cSrcweir pTempItem = pBreakItem;
213cdf0e10cSrcweir break;
214cdf0e10cSrcweir case RES_CHRATR_AUTOKERN:
215cdf0e10cSrcweir if(!pAutoKernItem)
216cdf0e10cSrcweir pAutoKernItem = rSet.GetPool()->GetDefaultItem(aIt->nWID).Clone();
217cdf0e10cSrcweir pTempItem = pAutoKernItem;
218cdf0e10cSrcweir break;
219cdf0e10cSrcweir case RES_CHRATR_BACKGROUND:
220cdf0e10cSrcweir if(!pBrushItem)
221cdf0e10cSrcweir pBrushItem = rSet.GetPool()->GetDefaultItem(aIt->nWID).Clone();
222cdf0e10cSrcweir pTempItem = pBrushItem;
223cdf0e10cSrcweir break;
224cdf0e10cSrcweir case RES_CHRATR_CASEMAP:
225cdf0e10cSrcweir if(!pCasemapItem)
226cdf0e10cSrcweir pCasemapItem = rSet.GetPool()->GetDefaultItem(aIt->nWID).Clone();
227cdf0e10cSrcweir pTempItem = pCasemapItem;
228cdf0e10cSrcweir break;
229cdf0e10cSrcweir case RES_CHRATR_COLOR:
230cdf0e10cSrcweir if(!pCharColorItem)
231cdf0e10cSrcweir pCharColorItem = rSet.GetPool()->GetDefaultItem(aIt->nWID).Clone();
232cdf0e10cSrcweir pTempItem = pCharColorItem;
233cdf0e10cSrcweir break;
234cdf0e10cSrcweir case RES_CHRATR_CONTOUR:
235cdf0e10cSrcweir if(!pContourItem)
236cdf0e10cSrcweir pContourItem = rSet.GetPool()->GetDefaultItem(aIt->nWID).Clone();
237cdf0e10cSrcweir pTempItem = pContourItem;
238cdf0e10cSrcweir break;
239cdf0e10cSrcweir case RES_CHRATR_CROSSEDOUT:
240cdf0e10cSrcweir if(!pCrossedOutItem)
241cdf0e10cSrcweir pCrossedOutItem = rSet.GetPool()->GetDefaultItem(aIt->nWID).Clone();
242cdf0e10cSrcweir pTempItem = pCrossedOutItem;
243cdf0e10cSrcweir break;
244cdf0e10cSrcweir case RES_CHRATR_ESCAPEMENT:
245cdf0e10cSrcweir if(!pEscItem)
246cdf0e10cSrcweir pEscItem = rSet.GetPool()->GetDefaultItem(aIt->nWID).Clone();
247cdf0e10cSrcweir pTempItem = pEscItem;
248cdf0e10cSrcweir break;
249cdf0e10cSrcweir case RES_CHRATR_BLINK:
250cdf0e10cSrcweir if(!pBlinkItem)
251cdf0e10cSrcweir pBlinkItem = rSet.GetPool()->GetDefaultItem(aIt->nWID).Clone();
252cdf0e10cSrcweir pTempItem = pBlinkItem;
253cdf0e10cSrcweir break;
254cdf0e10cSrcweir case RES_CHRATR_FONT:
255cdf0e10cSrcweir if(!pFontItem)
256cdf0e10cSrcweir pFontItem = rSet.GetPool()->GetDefaultItem(aIt->nWID).Clone();
257cdf0e10cSrcweir pTempItem = pFontItem;
258cdf0e10cSrcweir break;
259cdf0e10cSrcweir case RES_CHRATR_FONTSIZE:
260cdf0e10cSrcweir if(!pFontSizeItem)
261cdf0e10cSrcweir pFontSizeItem = rSet.GetPool()->GetDefaultItem(aIt->nWID).Clone();
262cdf0e10cSrcweir pTempItem = pFontSizeItem;
263cdf0e10cSrcweir break;
264cdf0e10cSrcweir case RES_CHRATR_KERNING:
265cdf0e10cSrcweir if(!pKernItem)
266cdf0e10cSrcweir pKernItem = rSet.GetPool()->GetDefaultItem(aIt->nWID).Clone();
267cdf0e10cSrcweir pTempItem = pKernItem;
268cdf0e10cSrcweir break;
269cdf0e10cSrcweir case RES_CHRATR_LANGUAGE:
270cdf0e10cSrcweir if(!pLangItem)
271cdf0e10cSrcweir pLangItem = rSet.GetPool()->GetDefaultItem(aIt->nWID).Clone();
272cdf0e10cSrcweir pTempItem = pLangItem;
273cdf0e10cSrcweir break;
274cdf0e10cSrcweir case RES_CHRATR_NOHYPHEN:
275cdf0e10cSrcweir if(!pNHyphItem)
276cdf0e10cSrcweir pNHyphItem = rSet.GetPool()->GetDefaultItem(aIt->nWID).Clone();
277cdf0e10cSrcweir pTempItem = pNHyphItem;
278cdf0e10cSrcweir break;
279cdf0e10cSrcweir case RES_CHRATR_POSTURE:
280cdf0e10cSrcweir if(!pPostItem)
281cdf0e10cSrcweir pPostItem = rSet.GetPool()->GetDefaultItem(aIt->nWID).Clone();
282cdf0e10cSrcweir pTempItem = pPostItem;
283cdf0e10cSrcweir break;
284cdf0e10cSrcweir case RES_CHRATR_SHADOWED:
285cdf0e10cSrcweir if(!pShadItem)
286cdf0e10cSrcweir pShadItem = rSet.GetPool()->GetDefaultItem(aIt->nWID).Clone();
287cdf0e10cSrcweir pTempItem = pShadItem;
288cdf0e10cSrcweir break;
289cdf0e10cSrcweir case RES_TXTATR_CHARFMT:
290cdf0e10cSrcweir if(!pCharFmtItem)
291cdf0e10cSrcweir pCharFmtItem = rSet.GetPool()->GetDefaultItem(aIt->nWID).Clone();
292cdf0e10cSrcweir pTempItem = pCharFmtItem;
293cdf0e10cSrcweir break;
294cdf0e10cSrcweir case RES_CHRATR_UNDERLINE:
295cdf0e10cSrcweir if(!pULineItem)
296cdf0e10cSrcweir pULineItem = rSet.GetPool()->GetDefaultItem(aIt->nWID).Clone();
297cdf0e10cSrcweir pTempItem = pULineItem;
298cdf0e10cSrcweir break;
299cdf0e10cSrcweir case RES_CHRATR_OVERLINE:
300cdf0e10cSrcweir if(!pOLineItem)
301cdf0e10cSrcweir pOLineItem = rSet.GetPool()->GetDefaultItem(aIt->nWID).Clone();
302cdf0e10cSrcweir pTempItem = pOLineItem;
303cdf0e10cSrcweir break;
304cdf0e10cSrcweir case RES_CHRATR_WEIGHT:
305cdf0e10cSrcweir if(!pWeightItem)
306cdf0e10cSrcweir pWeightItem = rSet.GetPool()->GetDefaultItem(aIt->nWID).Clone();
307cdf0e10cSrcweir pTempItem = pWeightItem;
308cdf0e10cSrcweir break;
309cdf0e10cSrcweir case RES_PARATR_DROP:
310cdf0e10cSrcweir if(!pDropItem)
311cdf0e10cSrcweir pDropItem = rSet.GetPool()->GetDefaultItem(aIt->nWID).Clone();
312cdf0e10cSrcweir pTempItem = pDropItem;
313cdf0e10cSrcweir break;
314cdf0e10cSrcweir case RES_TXTATR_INETFMT:
315cdf0e10cSrcweir if(!pInetItem)
316cdf0e10cSrcweir pInetItem = rSet.GetPool()->GetDefaultItem(aIt->nWID).Clone();
317cdf0e10cSrcweir pTempItem = pInetItem;
318cdf0e10cSrcweir break;
319cdf0e10cSrcweir case RES_PAGEDESC:
320cdf0e10cSrcweir if(!pDescItem)
321cdf0e10cSrcweir pDescItem = rSet.GetPool()->GetDefaultItem(aIt->nWID).Clone();
322cdf0e10cSrcweir pTempItem = pDescItem;
323cdf0e10cSrcweir break;
324cdf0e10cSrcweir case RES_PARATR_ADJUST:
325cdf0e10cSrcweir if(!pAdjItem)
326cdf0e10cSrcweir pAdjItem = rSet.GetPool()->GetDefaultItem(aIt->nWID).Clone();
327cdf0e10cSrcweir pTempItem = pAdjItem;
328cdf0e10cSrcweir break;
329cdf0e10cSrcweir case RES_BACKGROUND:
330cdf0e10cSrcweir if(!pBackItem)
331cdf0e10cSrcweir pBackItem = rSet.GetPool()->GetDefaultItem(aIt->nWID).Clone();
332cdf0e10cSrcweir pTempItem = pBackItem;
333cdf0e10cSrcweir break;
334cdf0e10cSrcweir case RES_UL_SPACE:
335cdf0e10cSrcweir if(!pULItem)
336cdf0e10cSrcweir pULItem = rSet.GetPool()->GetDefaultItem(aIt->nWID).Clone();
337cdf0e10cSrcweir pTempItem = pULItem;
338cdf0e10cSrcweir break;
339cdf0e10cSrcweir case RES_LR_SPACE:
340cdf0e10cSrcweir if(!pLRItem)
341cdf0e10cSrcweir pLRItem = rSet.GetPool()->GetDefaultItem(aIt->nWID).Clone();
342cdf0e10cSrcweir pTempItem = pLRItem;
343cdf0e10cSrcweir break;
344cdf0e10cSrcweir case RES_KEEP:
345cdf0e10cSrcweir if(!pKeepItem)
346cdf0e10cSrcweir pKeepItem = rSet.GetPool()->GetDefaultItem(aIt->nWID).Clone();
347cdf0e10cSrcweir pTempItem = pKeepItem;
348cdf0e10cSrcweir break;
349cdf0e10cSrcweir case RES_LINENUMBER:
350cdf0e10cSrcweir if(!pLineNumItem)
351cdf0e10cSrcweir pLineNumItem = rSet.GetPool()->GetDefaultItem(aIt->nWID).Clone();
352cdf0e10cSrcweir pTempItem = pLineNumItem;
353cdf0e10cSrcweir break;
354cdf0e10cSrcweir case RES_PARATR_LINESPACING:
355cdf0e10cSrcweir if(!pLineSpaceItem)
356cdf0e10cSrcweir pLineSpaceItem = rSet.GetPool()->GetDefaultItem(aIt->nWID).Clone();
357cdf0e10cSrcweir pTempItem = pLineSpaceItem;
358cdf0e10cSrcweir break;
359cdf0e10cSrcweir case RES_PARATR_REGISTER:
360cdf0e10cSrcweir if(!pRegItem)
361cdf0e10cSrcweir pRegItem = rSet.GetPool()->GetDefaultItem(aIt->nWID).Clone();
362cdf0e10cSrcweir pTempItem = pRegItem;
363cdf0e10cSrcweir break;
364cdf0e10cSrcweir case RES_PARATR_SPLIT:
365cdf0e10cSrcweir if(!pSplitItem)
366cdf0e10cSrcweir pSplitItem = rSet.GetPool()->GetDefaultItem(aIt->nWID).Clone();
367cdf0e10cSrcweir pTempItem = pSplitItem;
368cdf0e10cSrcweir break;
369cdf0e10cSrcweir case RES_PARATR_TABSTOP:
370cdf0e10cSrcweir if(!pTabItem)
371cdf0e10cSrcweir pTabItem = rSet.GetPool()->GetDefaultItem(aIt->nWID).Clone();
372cdf0e10cSrcweir pTempItem = pTabItem;
373cdf0e10cSrcweir break;
374cdf0e10cSrcweir case RES_CHRATR_WORDLINEMODE:
375cdf0e10cSrcweir if(!pWLineItem)
376cdf0e10cSrcweir pWLineItem = rSet.GetPool()->GetDefaultItem(aIt->nWID).Clone();
377cdf0e10cSrcweir pTempItem = pWLineItem;
378cdf0e10cSrcweir break;
379cdf0e10cSrcweir case RES_CHRATR_CJK_FONT:
380cdf0e10cSrcweir if(!pFontCJKItem )
381cdf0e10cSrcweir pFontCJKItem = rSet.GetPool()->GetDefaultItem(aIt->nWID).Clone();
382cdf0e10cSrcweir pTempItem = pFontCJKItem;
383cdf0e10cSrcweir break;
384cdf0e10cSrcweir case RES_CHRATR_CJK_FONTSIZE:
385cdf0e10cSrcweir if(!pFontSizeCJKItem )
386cdf0e10cSrcweir pFontSizeCJKItem = rSet.GetPool()->GetDefaultItem(aIt->nWID).Clone();
387cdf0e10cSrcweir pTempItem = pFontSizeCJKItem;
388cdf0e10cSrcweir break;
389cdf0e10cSrcweir case RES_CHRATR_CJK_LANGUAGE:
390cdf0e10cSrcweir if(!pCJKLangItem )
391cdf0e10cSrcweir pCJKLangItem = rSet.GetPool()->GetDefaultItem(aIt->nWID).Clone();
392cdf0e10cSrcweir pTempItem = pCJKLangItem;
393cdf0e10cSrcweir break;
394cdf0e10cSrcweir case RES_CHRATR_CJK_POSTURE:
395cdf0e10cSrcweir if(!pCJKPostureItem )
396cdf0e10cSrcweir pCJKPostureItem = rSet.GetPool()->GetDefaultItem(aIt->nWID).Clone();
397cdf0e10cSrcweir pTempItem = pCJKPostureItem;
398cdf0e10cSrcweir break;
399cdf0e10cSrcweir case RES_CHRATR_CJK_WEIGHT:
400cdf0e10cSrcweir if(!pCJKWeightItem )
401cdf0e10cSrcweir pCJKWeightItem = rSet.GetPool()->GetDefaultItem(aIt->nWID).Clone();
402cdf0e10cSrcweir pTempItem = pCJKWeightItem;
403cdf0e10cSrcweir break;
404cdf0e10cSrcweir case RES_CHRATR_CTL_FONT:
405cdf0e10cSrcweir if(!pFontCTLItem )
406cdf0e10cSrcweir pFontCTLItem = rSet.GetPool()->GetDefaultItem(aIt->nWID).Clone();
407cdf0e10cSrcweir pTempItem = pFontCTLItem;
408cdf0e10cSrcweir break;
409cdf0e10cSrcweir case RES_CHRATR_CTL_FONTSIZE:
410cdf0e10cSrcweir if(!pFontSizeCTLItem )
411cdf0e10cSrcweir pFontSizeCTLItem = rSet.GetPool()->GetDefaultItem(aIt->nWID).Clone();
412cdf0e10cSrcweir pTempItem = pFontSizeCTLItem;
413cdf0e10cSrcweir break;
414cdf0e10cSrcweir case RES_CHRATR_CTL_LANGUAGE:
415cdf0e10cSrcweir if(!pCTLLangItem )
416cdf0e10cSrcweir pCTLLangItem = rSet.GetPool()->GetDefaultItem(aIt->nWID).Clone();
417cdf0e10cSrcweir pTempItem = pCTLLangItem;
418cdf0e10cSrcweir break;
419cdf0e10cSrcweir case RES_CHRATR_CTL_POSTURE:
420cdf0e10cSrcweir if(!pCTLPostureItem )
421cdf0e10cSrcweir pCTLPostureItem = rSet.GetPool()->GetDefaultItem(aIt->nWID).Clone();
422cdf0e10cSrcweir pTempItem = pCTLPostureItem;
423cdf0e10cSrcweir break;
424cdf0e10cSrcweir case RES_CHRATR_CTL_WEIGHT:
425cdf0e10cSrcweir if(!pCTLWeightItem )
426cdf0e10cSrcweir pCTLWeightItem = rSet.GetPool()->GetDefaultItem(aIt->nWID).Clone();
427cdf0e10cSrcweir pTempItem = pCTLWeightItem;
428cdf0e10cSrcweir break;
429cdf0e10cSrcweir }
430cdf0e10cSrcweir if(pTempItem)
431cdf0e10cSrcweir {
432cdf0e10cSrcweir if(bIsValueSearch)
433cdf0e10cSrcweir {
434cdf0e10cSrcweir pTempItem->PutValue(pValueArr[i]->Value, aIt->nMemberId);
435cdf0e10cSrcweir rSet.Put(*pTempItem);
436cdf0e10cSrcweir }
437cdf0e10cSrcweir else
438cdf0e10cSrcweir rSet.InvalidateItem( pTempItem->Which() );
439cdf0e10cSrcweir }
440cdf0e10cSrcweir }
441cdf0e10cSrcweir }
442cdf0e10cSrcweir delete pBoxItem;
443cdf0e10cSrcweir delete pBreakItem;
444cdf0e10cSrcweir delete pBreakItem ;
445cdf0e10cSrcweir delete pAutoKernItem ;
446cdf0e10cSrcweir delete pWLineItem;
447cdf0e10cSrcweir delete pTabItem;
448cdf0e10cSrcweir delete pSplitItem;
449cdf0e10cSrcweir delete pRegItem;
450cdf0e10cSrcweir delete pLineSpaceItem ;
451cdf0e10cSrcweir delete pLineNumItem ;
452cdf0e10cSrcweir delete pKeepItem;
453cdf0e10cSrcweir delete pLRItem ;
454cdf0e10cSrcweir delete pULItem ;
455cdf0e10cSrcweir delete pBackItem;
456cdf0e10cSrcweir delete pAdjItem;
457cdf0e10cSrcweir delete pDescItem;
458cdf0e10cSrcweir delete pInetItem;
459cdf0e10cSrcweir delete pDropItem;
460cdf0e10cSrcweir delete pWeightItem;
461cdf0e10cSrcweir delete pULineItem;
462cdf0e10cSrcweir delete pOLineItem;
463cdf0e10cSrcweir delete pCharFmtItem ;
464cdf0e10cSrcweir delete pShadItem;
465cdf0e10cSrcweir delete pPostItem;
466cdf0e10cSrcweir delete pNHyphItem;
467cdf0e10cSrcweir delete pLangItem;
468cdf0e10cSrcweir delete pKernItem;
469cdf0e10cSrcweir delete pFontSizeItem ;
470cdf0e10cSrcweir delete pFontItem;
471cdf0e10cSrcweir delete pBlinkItem;
472cdf0e10cSrcweir delete pEscItem;
473cdf0e10cSrcweir delete pCrossedOutItem;
474cdf0e10cSrcweir delete pContourItem ;
475cdf0e10cSrcweir delete pCharColorItem;
476cdf0e10cSrcweir delete pCasemapItem ;
477cdf0e10cSrcweir delete pBrushItem ;
478cdf0e10cSrcweir }
479cdf0e10cSrcweir /* -----------------23.06.99 14:18-------------------
480cdf0e10cSrcweir
481cdf0e10cSrcweir --------------------------------------------------*/
HasAttributes() const482cdf0e10cSrcweir sal_Bool SwSearchProperties_Impl::HasAttributes() const
483cdf0e10cSrcweir {
484cdf0e10cSrcweir for(sal_uInt32 i = 0; i < nArrLen; i++)
485cdf0e10cSrcweir if(pValueArr[i])
486cdf0e10cSrcweir return sal_True;
487cdf0e10cSrcweir return sal_False;
488cdf0e10cSrcweir }
489cdf0e10cSrcweir
490cdf0e10cSrcweir /*-- 14.12.98 13:07:10 ---------------------------------------------------
491cdf0e10cSrcweir
492cdf0e10cSrcweir -----------------------------------------------------------------------*/
SwXTextSearch()493cdf0e10cSrcweir SwXTextSearch::SwXTextSearch() :
494cdf0e10cSrcweir pSearchProperties( new SwSearchProperties_Impl),
495cdf0e10cSrcweir pReplaceProperties( new SwSearchProperties_Impl),
496cdf0e10cSrcweir m_pPropSet(aSwMapProvider.GetPropertySet(PROPERTY_MAP_TEXT_SEARCH)),
497cdf0e10cSrcweir bAll(sal_False),
498cdf0e10cSrcweir bWord(sal_False),
499cdf0e10cSrcweir bBack(sal_False),
500cdf0e10cSrcweir bExpr(sal_False),
501cdf0e10cSrcweir bCase(sal_False),
502cdf0e10cSrcweir bStyles(sal_False),
503cdf0e10cSrcweir bSimilarity(sal_False),
504cdf0e10cSrcweir bLevRelax(sal_False),
505cdf0e10cSrcweir nLevExchange(2),
506cdf0e10cSrcweir nLevAdd(2),
507cdf0e10cSrcweir nLevRemove(2),
508cdf0e10cSrcweir bIsValueSearch(sal_True)
509cdf0e10cSrcweir {
510cdf0e10cSrcweir }
511cdf0e10cSrcweir /*-- 14.12.98 13:07:12 ---------------------------------------------------
512cdf0e10cSrcweir
513cdf0e10cSrcweir -----------------------------------------------------------------------*/
~SwXTextSearch()514cdf0e10cSrcweir SwXTextSearch::~SwXTextSearch()
515cdf0e10cSrcweir {
516cdf0e10cSrcweir delete pSearchProperties;
517cdf0e10cSrcweir delete pReplaceProperties;
518cdf0e10cSrcweir }
519cdf0e10cSrcweir /* -----------------------------10.03.00 18:02--------------------------------
520cdf0e10cSrcweir
521cdf0e10cSrcweir ---------------------------------------------------------------------------*/
getUnoTunnelId()522cdf0e10cSrcweir const uno::Sequence< sal_Int8 > & SwXTextSearch::getUnoTunnelId()
523cdf0e10cSrcweir {
524cdf0e10cSrcweir static uno::Sequence< sal_Int8 > aSeq = ::CreateUnoTunnelId();
525cdf0e10cSrcweir return aSeq;
526cdf0e10cSrcweir }
527cdf0e10cSrcweir /* -----------------------------10.03.00 18:04--------------------------------
528cdf0e10cSrcweir
529cdf0e10cSrcweir ---------------------------------------------------------------------------*/
getSomething(const uno::Sequence<sal_Int8> & rId)530cdf0e10cSrcweir sal_Int64 SAL_CALL SwXTextSearch::getSomething( const uno::Sequence< sal_Int8 >& rId )
531cdf0e10cSrcweir throw(uno::RuntimeException)
532cdf0e10cSrcweir {
533cdf0e10cSrcweir if( rId.getLength() == 16
534cdf0e10cSrcweir && 0 == rtl_compareMemory( getUnoTunnelId().getConstArray(),
535cdf0e10cSrcweir rId.getConstArray(), 16 ) )
536cdf0e10cSrcweir {
537cdf0e10cSrcweir return sal::static_int_cast< sal_Int64 >( reinterpret_cast< sal_IntPtr >(this) );
538cdf0e10cSrcweir }
539cdf0e10cSrcweir return 0;
540cdf0e10cSrcweir }
541cdf0e10cSrcweir /*-- 14.12.98 13:07:12---------------------------------------------------
542cdf0e10cSrcweir
543cdf0e10cSrcweir -----------------------------------------------------------------------*/
getSearchString(void)544cdf0e10cSrcweir OUString SwXTextSearch::getSearchString(void) throw( uno::RuntimeException )
545cdf0e10cSrcweir {
546cdf0e10cSrcweir vos::OGuard aGuard(Application::GetSolarMutex());
547cdf0e10cSrcweir return sSearchText;
548cdf0e10cSrcweir }
549cdf0e10cSrcweir /*-- 14.12.98 13:07:12---------------------------------------------------
550cdf0e10cSrcweir
551cdf0e10cSrcweir -----------------------------------------------------------------------*/
setSearchString(const OUString & rString)552cdf0e10cSrcweir void SwXTextSearch::setSearchString(const OUString& rString)
553cdf0e10cSrcweir throw( uno::RuntimeException )
554cdf0e10cSrcweir {
555cdf0e10cSrcweir vos::OGuard aGuard(Application::GetSolarMutex());
556cdf0e10cSrcweir sSearchText = String(rString);
557cdf0e10cSrcweir }
558cdf0e10cSrcweir /*-- 14.12.98 13:07:12---------------------------------------------------
559cdf0e10cSrcweir
560cdf0e10cSrcweir -----------------------------------------------------------------------*/
getReplaceString(void)561cdf0e10cSrcweir OUString SwXTextSearch::getReplaceString(void) throw( uno::RuntimeException )
562cdf0e10cSrcweir {
563cdf0e10cSrcweir vos::OGuard aGuard(Application::GetSolarMutex());
564cdf0e10cSrcweir return sReplaceText;
565cdf0e10cSrcweir }
566cdf0e10cSrcweir /*-- 14.12.98 13:07:12---------------------------------------------------
567cdf0e10cSrcweir
568cdf0e10cSrcweir -----------------------------------------------------------------------*/
setReplaceString(const OUString & rReplaceString)569cdf0e10cSrcweir void SwXTextSearch::setReplaceString(const OUString& rReplaceString) throw( uno::RuntimeException )
570cdf0e10cSrcweir {
571cdf0e10cSrcweir vos::OGuard aGuard(Application::GetSolarMutex());
572cdf0e10cSrcweir sReplaceText = String(rReplaceString);
573cdf0e10cSrcweir }
574cdf0e10cSrcweir /*-- 14.12.98 13:07:13---------------------------------------------------
575cdf0e10cSrcweir
576cdf0e10cSrcweir -----------------------------------------------------------------------*/
getPropertySetInfo(void)577cdf0e10cSrcweir uno::Reference< beans::XPropertySetInfo > SwXTextSearch::getPropertySetInfo(void) throw( uno::RuntimeException )
578cdf0e10cSrcweir {
579cdf0e10cSrcweir static uno::Reference< beans::XPropertySetInfo > aRef = m_pPropSet->getPropertySetInfo();
580cdf0e10cSrcweir return aRef;
581cdf0e10cSrcweir }
582cdf0e10cSrcweir /*-- 14.12.98 13:07:13---------------------------------------------------
583cdf0e10cSrcweir
584cdf0e10cSrcweir -----------------------------------------------------------------------*/
setPropertyValue(const OUString & rPropertyName,const uno::Any & aValue)585cdf0e10cSrcweir void SwXTextSearch::setPropertyValue(const OUString& rPropertyName, const uno::Any& aValue)
586cdf0e10cSrcweir throw( beans::UnknownPropertyException, beans::PropertyVetoException,
587cdf0e10cSrcweir lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException )
588cdf0e10cSrcweir {
589cdf0e10cSrcweir vos::OGuard aGuard(Application::GetSolarMutex());
590cdf0e10cSrcweir const SfxItemPropertySimpleEntry* pEntry = m_pPropSet->getPropertyMap()->getByName(rPropertyName);
591cdf0e10cSrcweir if(pEntry)
592cdf0e10cSrcweir {
593cdf0e10cSrcweir if ( pEntry->nFlags & beans::PropertyAttribute::READONLY)
594cdf0e10cSrcweir throw beans::PropertyVetoException ( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Property is read-only: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
595cdf0e10cSrcweir sal_Bool bVal = sal_False;
596cdf0e10cSrcweir if(aValue.getValueType() == ::getBooleanCppuType())
597cdf0e10cSrcweir bVal = *(sal_Bool*)aValue.getValue();
598cdf0e10cSrcweir switch(pEntry->nWID)
599cdf0e10cSrcweir {
600cdf0e10cSrcweir case WID_SEARCH_ALL : bAll = bVal; break;
601cdf0e10cSrcweir case WID_WORDS: bWord = bVal; break;
602cdf0e10cSrcweir case WID_BACKWARDS : bBack = bVal; break;
603cdf0e10cSrcweir case WID_REGULAR_EXPRESSION : bExpr = bVal; break;
604cdf0e10cSrcweir case WID_CASE_SENSITIVE : bCase = bVal; break;
605cdf0e10cSrcweir //case WID_IN_SELECTION : bInSel = bVal; break;
606cdf0e10cSrcweir case WID_STYLES : bStyles = bVal; break;
607cdf0e10cSrcweir case WID_SIMILARITY : bSimilarity = bVal; break;
608cdf0e10cSrcweir case WID_SIMILARITY_RELAX: bLevRelax = bVal; break;
609cdf0e10cSrcweir case WID_SIMILARITY_EXCHANGE: aValue >>= nLevExchange; break;
610cdf0e10cSrcweir case WID_SIMILARITY_ADD: aValue >>= nLevAdd; break;
611cdf0e10cSrcweir case WID_SIMILARITY_REMOVE : aValue >>= nLevRemove;break;
612cdf0e10cSrcweir };
613cdf0e10cSrcweir }
614cdf0e10cSrcweir else
615cdf0e10cSrcweir throw beans::UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
616cdf0e10cSrcweir }
617cdf0e10cSrcweir /*-- 14.12.98 13:07:13---------------------------------------------------
618cdf0e10cSrcweir
619cdf0e10cSrcweir -----------------------------------------------------------------------*/
getPropertyValue(const OUString & rPropertyName)620cdf0e10cSrcweir uno::Any SwXTextSearch::getPropertyValue(const OUString& rPropertyName) throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
621cdf0e10cSrcweir {
622cdf0e10cSrcweir vos::OGuard aGuard(Application::GetSolarMutex());
623cdf0e10cSrcweir uno::Any aRet;
624cdf0e10cSrcweir
625cdf0e10cSrcweir const SfxItemPropertySimpleEntry* pEntry = m_pPropSet->getPropertyMap()->getByName(rPropertyName);
626cdf0e10cSrcweir sal_Bool bSet = sal_False;
627cdf0e10cSrcweir sal_Int16 nSet = 0;
628cdf0e10cSrcweir if(pEntry)
629cdf0e10cSrcweir {
630cdf0e10cSrcweir switch(pEntry->nWID)
631cdf0e10cSrcweir {
632cdf0e10cSrcweir case WID_SEARCH_ALL : bSet = bAll; goto SET_BOOL;
633cdf0e10cSrcweir case WID_WORDS: bSet = bWord; goto SET_BOOL;
634cdf0e10cSrcweir case WID_BACKWARDS : bSet = bBack; goto SET_BOOL;
635cdf0e10cSrcweir case WID_REGULAR_EXPRESSION : bSet = bExpr; goto SET_BOOL;
636cdf0e10cSrcweir case WID_CASE_SENSITIVE : bSet = bCase; goto SET_BOOL;
637cdf0e10cSrcweir //case WID_IN_SELECTION : bSet = bInSel; goto SET_BOOL;
638cdf0e10cSrcweir case WID_STYLES : bSet = bStyles; goto SET_BOOL;
639cdf0e10cSrcweir case WID_SIMILARITY : bSet = bSimilarity; goto SET_BOOL;
640cdf0e10cSrcweir case WID_SIMILARITY_RELAX: bSet = bLevRelax;
641cdf0e10cSrcweir SET_BOOL:
642cdf0e10cSrcweir aRet.setValue(&bSet, ::getBooleanCppuType());
643cdf0e10cSrcweir break;
644cdf0e10cSrcweir case WID_SIMILARITY_EXCHANGE: nSet = nLevExchange; goto SET_UINT16;
645cdf0e10cSrcweir case WID_SIMILARITY_ADD: nSet = nLevAdd; goto SET_UINT16;
646cdf0e10cSrcweir case WID_SIMILARITY_REMOVE : nSet = nLevRemove;
647cdf0e10cSrcweir SET_UINT16:
648cdf0e10cSrcweir aRet <<= nSet;
649cdf0e10cSrcweir break;
650cdf0e10cSrcweir };
651cdf0e10cSrcweir }
652cdf0e10cSrcweir else
653cdf0e10cSrcweir throw beans::UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
654cdf0e10cSrcweir return aRet;
655cdf0e10cSrcweir }
656cdf0e10cSrcweir /*-- 14.12.98 13:07:13---------------------------------------------------
657cdf0e10cSrcweir
658cdf0e10cSrcweir -----------------------------------------------------------------------*/
addPropertyChangeListener(const OUString &,const uno::Reference<beans::XPropertyChangeListener> &)659cdf0e10cSrcweir void SwXTextSearch::addPropertyChangeListener(const OUString& /*rPropertyName*/, const uno::Reference< beans::XPropertyChangeListener > & /*xListener*/) throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
660cdf0e10cSrcweir {
661cdf0e10cSrcweir DBG_WARNING("not implemented");
662cdf0e10cSrcweir }
663cdf0e10cSrcweir /*-- 14.12.98 13:07:13---------------------------------------------------
664cdf0e10cSrcweir
665cdf0e10cSrcweir -----------------------------------------------------------------------*/
removePropertyChangeListener(const OUString &,const uno::Reference<beans::XPropertyChangeListener> &)666cdf0e10cSrcweir void SwXTextSearch::removePropertyChangeListener(const OUString& /*rPropertyName*/, const uno::Reference< beans::XPropertyChangeListener > & /*xListener*/) throw(beans::UnknownPropertyException, lang::WrappedTargetException,uno::RuntimeException )
667cdf0e10cSrcweir {
668cdf0e10cSrcweir DBG_WARNING("not implemented");
669cdf0e10cSrcweir }
670cdf0e10cSrcweir /*-- 14.12.98 13:07:14---------------------------------------------------
671cdf0e10cSrcweir
672cdf0e10cSrcweir -----------------------------------------------------------------------*/
addVetoableChangeListener(const OUString &,const uno::Reference<beans::XVetoableChangeListener> &)673cdf0e10cSrcweir void SwXTextSearch::addVetoableChangeListener(const OUString& /*rPropertyName*/, const uno::Reference< beans::XVetoableChangeListener > & /*xListener*/) throw(beans::UnknownPropertyException, lang::WrappedTargetException,uno::RuntimeException )
674cdf0e10cSrcweir {
675cdf0e10cSrcweir DBG_WARNING("not implemented");
676cdf0e10cSrcweir }
677cdf0e10cSrcweir /*-- 14.12.98 13:07:14---------------------------------------------------
678cdf0e10cSrcweir
679cdf0e10cSrcweir -----------------------------------------------------------------------*/
removeVetoableChangeListener(const OUString &,const uno::Reference<beans::XVetoableChangeListener> &)680cdf0e10cSrcweir void SwXTextSearch::removeVetoableChangeListener(const OUString& /*rPropertyName*/, const uno::Reference< beans::XVetoableChangeListener > & /*xListener*/) throw(beans::UnknownPropertyException, lang::WrappedTargetException,uno::RuntimeException )
681cdf0e10cSrcweir {
682cdf0e10cSrcweir DBG_WARNING("not implemented");
683cdf0e10cSrcweir }
684cdf0e10cSrcweir /*-- 14.12.98 13:07:14---------------------------------------------------
685cdf0e10cSrcweir
686cdf0e10cSrcweir -----------------------------------------------------------------------*/
getValueSearch(void)687cdf0e10cSrcweir sal_Bool SwXTextSearch::getValueSearch(void) throw( uno::RuntimeException )
688cdf0e10cSrcweir {
689cdf0e10cSrcweir vos::OGuard aGuard(Application::GetSolarMutex());
690cdf0e10cSrcweir return bIsValueSearch;
691cdf0e10cSrcweir }
692cdf0e10cSrcweir /*-- 14.12.98 13:07:15---------------------------------------------------
693cdf0e10cSrcweir
694cdf0e10cSrcweir -----------------------------------------------------------------------*/
setValueSearch(sal_Bool ValueSearch_)695cdf0e10cSrcweir void SwXTextSearch::setValueSearch(sal_Bool ValueSearch_) throw( uno::RuntimeException )
696cdf0e10cSrcweir {
697cdf0e10cSrcweir vos::OGuard aGuard(Application::GetSolarMutex());
698cdf0e10cSrcweir bIsValueSearch = ValueSearch_;
699cdf0e10cSrcweir }
700cdf0e10cSrcweir /*-- 14.12.98 13:07:15---------------------------------------------------
701cdf0e10cSrcweir
702cdf0e10cSrcweir -----------------------------------------------------------------------*/
getSearchAttributes(void)703cdf0e10cSrcweir uno::Sequence< beans::PropertyValue > SwXTextSearch::getSearchAttributes(void) throw( uno::RuntimeException )
704cdf0e10cSrcweir {
705cdf0e10cSrcweir return pSearchProperties->GetProperties();
706cdf0e10cSrcweir }
707cdf0e10cSrcweir /*-- 14.12.98 13:07:16---------------------------------------------------
708cdf0e10cSrcweir
709cdf0e10cSrcweir -----------------------------------------------------------------------*/
setSearchAttributes(const uno::Sequence<beans::PropertyValue> & rSearchAttribs)710cdf0e10cSrcweir void SwXTextSearch::setSearchAttributes(const uno::Sequence< beans::PropertyValue >& rSearchAttribs)
711cdf0e10cSrcweir throw( beans::UnknownPropertyException, lang::IllegalArgumentException, uno::RuntimeException )
712cdf0e10cSrcweir {
713cdf0e10cSrcweir pSearchProperties->SetProperties(rSearchAttribs);
714cdf0e10cSrcweir }
715cdf0e10cSrcweir /*-- 14.12.98 13:07:16---------------------------------------------------
716cdf0e10cSrcweir
717cdf0e10cSrcweir -----------------------------------------------------------------------*/
getReplaceAttributes(void)718cdf0e10cSrcweir uno::Sequence< beans::PropertyValue > SwXTextSearch::getReplaceAttributes(void)
719cdf0e10cSrcweir throw( uno::RuntimeException )
720cdf0e10cSrcweir {
721cdf0e10cSrcweir return pReplaceProperties->GetProperties();
722cdf0e10cSrcweir }
723cdf0e10cSrcweir /*-- 14.12.98 13:07:17---------------------------------------------------
724cdf0e10cSrcweir
725cdf0e10cSrcweir -----------------------------------------------------------------------*/
setReplaceAttributes(const uno::Sequence<beans::PropertyValue> & rReplaceAttribs)726cdf0e10cSrcweir void SwXTextSearch::setReplaceAttributes(const uno::Sequence< beans::PropertyValue >& rReplaceAttribs)
727cdf0e10cSrcweir throw( beans::UnknownPropertyException, lang::IllegalArgumentException, uno::RuntimeException )
728cdf0e10cSrcweir {
729cdf0e10cSrcweir pReplaceProperties->SetProperties(rReplaceAttribs);
730cdf0e10cSrcweir }
731cdf0e10cSrcweir /* -----------------23.06.99 14:13-------------------
732cdf0e10cSrcweir
733cdf0e10cSrcweir --------------------------------------------------*/
FillSearchItemSet(SfxItemSet & rSet) const734cdf0e10cSrcweir void SwXTextSearch::FillSearchItemSet(SfxItemSet& rSet) const
735cdf0e10cSrcweir {
736cdf0e10cSrcweir pSearchProperties->FillItemSet(rSet, bIsValueSearch);
737cdf0e10cSrcweir }
738cdf0e10cSrcweir /* -----------------23.06.99 14:14-------------------
739cdf0e10cSrcweir
740cdf0e10cSrcweir --------------------------------------------------*/
FillReplaceItemSet(SfxItemSet & rSet) const741cdf0e10cSrcweir void SwXTextSearch::FillReplaceItemSet(SfxItemSet& rSet) const
742cdf0e10cSrcweir {
743cdf0e10cSrcweir pReplaceProperties->FillItemSet(rSet, bIsValueSearch);
744cdf0e10cSrcweir }
745cdf0e10cSrcweir /* -----------------23.06.99 14:17-------------------
746cdf0e10cSrcweir
747cdf0e10cSrcweir --------------------------------------------------*/
HasSearchAttributes() const748cdf0e10cSrcweir sal_Bool SwXTextSearch::HasSearchAttributes() const
749cdf0e10cSrcweir {
750cdf0e10cSrcweir return pSearchProperties->HasAttributes();
751cdf0e10cSrcweir }
752cdf0e10cSrcweir /* -----------------23.06.99 14:17-------------------
753cdf0e10cSrcweir
754cdf0e10cSrcweir --------------------------------------------------*/
HasReplaceAttributes() const755cdf0e10cSrcweir sal_Bool SwXTextSearch::HasReplaceAttributes() const
756cdf0e10cSrcweir {
757cdf0e10cSrcweir return pReplaceProperties->HasAttributes();
758cdf0e10cSrcweir }
759cdf0e10cSrcweir /* -----------------------------19.04.00 14:43--------------------------------
760cdf0e10cSrcweir
761cdf0e10cSrcweir ---------------------------------------------------------------------------*/
getImplementationName(void)762cdf0e10cSrcweir OUString SwXTextSearch::getImplementationName(void) throw( uno::RuntimeException )
763cdf0e10cSrcweir {
764cdf0e10cSrcweir return C2U("SwXTextSearch");
765cdf0e10cSrcweir }
766cdf0e10cSrcweir /* -----------------------------19.04.00 14:43--------------------------------
767cdf0e10cSrcweir
768cdf0e10cSrcweir ---------------------------------------------------------------------------*/
supportsService(const OUString & rServiceName)769cdf0e10cSrcweir sal_Bool SwXTextSearch::supportsService(const OUString& rServiceName) throw( uno::RuntimeException )
770cdf0e10cSrcweir {
771cdf0e10cSrcweir return C2U("com.sun.star.util.SearchDescriptor") == rServiceName ||
772cdf0e10cSrcweir C2U("com.sun.star.util.ReplaceDescriptor") == rServiceName;
773cdf0e10cSrcweir }
774cdf0e10cSrcweir /* -----------------------------19.04.00 14:43--------------------------------
775cdf0e10cSrcweir
776cdf0e10cSrcweir ---------------------------------------------------------------------------*/
getSupportedServiceNames(void)777cdf0e10cSrcweir uno::Sequence< OUString > SwXTextSearch::getSupportedServiceNames(void) throw( uno::RuntimeException )
778cdf0e10cSrcweir {
779cdf0e10cSrcweir uno::Sequence< OUString > aRet(2);
780cdf0e10cSrcweir OUString* pArray = aRet.getArray();
781cdf0e10cSrcweir pArray[0] = C2U("com.sun.star.util.SearchDescriptor");
782cdf0e10cSrcweir pArray[1] = C2U("com.sun.star.util.ReplaceDescriptor");
783cdf0e10cSrcweir return aRet;
784cdf0e10cSrcweir }
785cdf0e10cSrcweir
FillSearchOptions(util::SearchOptions & rSearchOpt) const786cdf0e10cSrcweir void SwXTextSearch::FillSearchOptions( util::SearchOptions& rSearchOpt ) const
787cdf0e10cSrcweir {
788cdf0e10cSrcweir if( bSimilarity )
789cdf0e10cSrcweir {
790cdf0e10cSrcweir rSearchOpt.algorithmType = util::SearchAlgorithms_APPROXIMATE;
791cdf0e10cSrcweir rSearchOpt.changedChars = nLevExchange;
792cdf0e10cSrcweir rSearchOpt.deletedChars = nLevRemove;
793cdf0e10cSrcweir rSearchOpt.insertedChars = nLevAdd;
794cdf0e10cSrcweir if( bLevRelax )
795cdf0e10cSrcweir rSearchOpt.searchFlag |= util::SearchFlags::LEV_RELAXED;
796cdf0e10cSrcweir }
797cdf0e10cSrcweir else if( bExpr )
798cdf0e10cSrcweir rSearchOpt.algorithmType = util::SearchAlgorithms_REGEXP;
799cdf0e10cSrcweir else
800cdf0e10cSrcweir rSearchOpt.algorithmType = util::SearchAlgorithms_ABSOLUTE;
801cdf0e10cSrcweir
802cdf0e10cSrcweir rSearchOpt.Locale = SvxCreateLocale( GetAppLanguage() );
803cdf0e10cSrcweir rSearchOpt.searchString = sSearchText;
804cdf0e10cSrcweir rSearchOpt.replaceString = sReplaceText;
805cdf0e10cSrcweir
806cdf0e10cSrcweir if( !bCase )
807cdf0e10cSrcweir rSearchOpt.transliterateFlags |= i18n::TransliterationModules_IGNORE_CASE;
808cdf0e10cSrcweir if( bWord )
809cdf0e10cSrcweir rSearchOpt.searchFlag |= util::SearchFlags::NORM_WORD_ONLY;
810cdf0e10cSrcweir
811cdf0e10cSrcweir // bInSel: 1; // wie geht das?
812cdf0e10cSrcweir // TODO: pSearch->bStyles!
813cdf0e10cSrcweir // inSelection??
814cdf0e10cSrcweir // aSrchParam.SetSrchInSelection(TypeConversion::toBOOL(aVal));
815cdf0e10cSrcweir }
816cdf0e10cSrcweir
817cdf0e10cSrcweir
818cdf0e10cSrcweir
819