1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: unosrch.cxx,v $
10 * $Revision: 1.19.210.1 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_sw.hxx"
33 #include "unosrch.hxx"
40 #include <vos/mutex.hxx>
41 #include <vcl/svapp.hxx>
42 #include "svx/unolingu.hxx"
43 #include <com/sun/star/util/SearchOptions.hpp>
44 #include <com/sun/star/util/SearchFlags.hpp>
45 #include <com/sun/star/i18n/TransliterationModules.hpp>
46 #include <com/sun/star/beans/PropertyAttribute.hpp>
48 using namespace ::com::sun::star
;
49 using ::rtl::OUString
;
51 /******************************************************************************
53 ******************************************************************************/
55 /* -----------------23.06.99 12:19-------------------
57 --------------------------------------------------*/
58 class SwSearchProperties_Impl
60 beans::PropertyValue
** pValueArr
; //
62 const PropertyEntryVector_t aPropertyEntries
;
64 SwSearchProperties_Impl();
65 ~SwSearchProperties_Impl();
67 void SetProperties(const uno::Sequence
< beans::PropertyValue
>& aSearchAttribs
)
68 throw( beans::UnknownPropertyException
, lang::IllegalArgumentException
, uno::RuntimeException
);
69 const uno::Sequence
< beans::PropertyValue
> GetProperties() const;
71 void FillItemSet(SfxItemSet
& rSet
, sal_Bool bIsValueSearch
) const;
72 sal_Bool
HasAttributes() const;
74 /* -----------------23.06.99 13:08-------------------
76 --------------------------------------------------*/
77 SwSearchProperties_Impl::SwSearchProperties_Impl() :
79 aPropertyEntries( aSwMapProvider
.GetPropertySet(PROPERTY_MAP_TEXT_CURSOR
)->getPropertyMap()->getPropertyEntries())
81 nArrLen
= aPropertyEntries
.size();
82 pValueArr
= new beans::PropertyValue
*[nArrLen
];
83 for(sal_uInt32 i
= 0; i
< nArrLen
; i
++)
86 /* -----------------23.06.99 13:08-------------------
88 --------------------------------------------------*/
89 SwSearchProperties_Impl::~SwSearchProperties_Impl()
91 for(sal_uInt32 i
= 0; i
< nArrLen
; i
++)
95 /* -----------------23.06.99 13:09-------------------
97 --------------------------------------------------*/
98 void SwSearchProperties_Impl::SetProperties(const uno::Sequence
< beans::PropertyValue
>& aSearchAttribs
)
99 throw( beans::UnknownPropertyException
, lang::IllegalArgumentException
, uno::RuntimeException
)
101 const beans::PropertyValue
* pProps
= aSearchAttribs
.getConstArray();
104 //delete all existing values
105 for( i
= 0; i
< nArrLen
; i
++)
111 sal_uInt32 nLen
= aSearchAttribs
.getLength();
112 for(i
= 0; i
< nLen
; i
++)
114 sal_uInt16 nIndex
= 0;
115 PropertyEntryVector_t::const_iterator aIt
= aPropertyEntries
.begin();
116 while(pProps
[i
].Name
!= aIt
->sName
)
120 if( aIt
== aPropertyEntries
.end() )
121 throw beans::UnknownPropertyException();
123 pValueArr
[nIndex
] = new beans::PropertyValue(pProps
[i
]);
126 /* -----------------23.06.99 13:08-------------------
128 --------------------------------------------------*/
129 const uno::Sequence
< beans::PropertyValue
> SwSearchProperties_Impl::GetProperties() const
131 sal_uInt32 nPropCount
= 0;
133 for( i
= 0; i
< nArrLen
; i
++)
137 uno::Sequence
< beans::PropertyValue
> aRet(nPropCount
);
138 beans::PropertyValue
* pProps
= aRet
.getArray();
140 for(i
= 0; i
< nArrLen
; i
++)
144 pProps
[nPropCount
++] = *(pValueArr
[i
]);
149 /* -----------------23.06.99 13:06-------------------
151 --------------------------------------------------*/
152 void SwSearchProperties_Impl::FillItemSet(SfxItemSet
& rSet
, sal_Bool bIsValueSearch
) const
156 SfxPoolItem
* pBoxItem
= 0,
186 *pCrossedOutItem
= 0,
192 PropertyEntryVector_t::const_iterator aIt
= aPropertyEntries
.begin();
193 for(sal_uInt32 i
= 0; i
< nArrLen
; i
++, ++aIt
)
197 SfxPoolItem
* pTempItem
= 0;
202 pBoxItem
= rSet
.GetPool()->GetDefaultItem(aIt
->nWID
).Clone();
203 pTempItem
= pBoxItem
;
207 pBreakItem
= rSet
.GetPool()->GetDefaultItem(aIt
->nWID
).Clone();
208 pTempItem
= pBreakItem
;
210 case RES_CHRATR_AUTOKERN
:
212 pAutoKernItem
= rSet
.GetPool()->GetDefaultItem(aIt
->nWID
).Clone();
213 pTempItem
= pAutoKernItem
;
215 case RES_CHRATR_BACKGROUND
:
217 pBrushItem
= rSet
.GetPool()->GetDefaultItem(aIt
->nWID
).Clone();
218 pTempItem
= pBrushItem
;
220 case RES_CHRATR_CASEMAP
:
222 pCasemapItem
= rSet
.GetPool()->GetDefaultItem(aIt
->nWID
).Clone();
223 pTempItem
= pCasemapItem
;
225 case RES_CHRATR_COLOR
:
227 pCharColorItem
= rSet
.GetPool()->GetDefaultItem(aIt
->nWID
).Clone();
228 pTempItem
= pCharColorItem
;
230 case RES_CHRATR_CONTOUR
:
232 pContourItem
= rSet
.GetPool()->GetDefaultItem(aIt
->nWID
).Clone();
233 pTempItem
= pContourItem
;
235 case RES_CHRATR_CROSSEDOUT
:
237 pCrossedOutItem
= rSet
.GetPool()->GetDefaultItem(aIt
->nWID
).Clone();
238 pTempItem
= pCrossedOutItem
;
240 case RES_CHRATR_ESCAPEMENT
:
242 pEscItem
= rSet
.GetPool()->GetDefaultItem(aIt
->nWID
).Clone();
243 pTempItem
= pEscItem
;
245 case RES_CHRATR_BLINK
:
247 pBlinkItem
= rSet
.GetPool()->GetDefaultItem(aIt
->nWID
).Clone();
248 pTempItem
= pBlinkItem
;
250 case RES_CHRATR_FONT
:
252 pFontItem
= rSet
.GetPool()->GetDefaultItem(aIt
->nWID
).Clone();
253 pTempItem
= pFontItem
;
255 case RES_CHRATR_FONTSIZE
:
257 pFontSizeItem
= rSet
.GetPool()->GetDefaultItem(aIt
->nWID
).Clone();
258 pTempItem
= pFontSizeItem
;
260 case RES_CHRATR_KERNING
:
262 pKernItem
= rSet
.GetPool()->GetDefaultItem(aIt
->nWID
).Clone();
263 pTempItem
= pKernItem
;
265 case RES_CHRATR_LANGUAGE
:
267 pLangItem
= rSet
.GetPool()->GetDefaultItem(aIt
->nWID
).Clone();
268 pTempItem
= pLangItem
;
270 case RES_CHRATR_NOHYPHEN
:
272 pNHyphItem
= rSet
.GetPool()->GetDefaultItem(aIt
->nWID
).Clone();
273 pTempItem
= pNHyphItem
;
275 case RES_CHRATR_POSTURE
:
277 pPostItem
= rSet
.GetPool()->GetDefaultItem(aIt
->nWID
).Clone();
278 pTempItem
= pPostItem
;
280 case RES_CHRATR_SHADOWED
:
282 pShadItem
= rSet
.GetPool()->GetDefaultItem(aIt
->nWID
).Clone();
283 pTempItem
= pShadItem
;
285 case RES_TXTATR_CHARFMT
:
287 pCharFmtItem
= rSet
.GetPool()->GetDefaultItem(aIt
->nWID
).Clone();
288 pTempItem
= pCharFmtItem
;
290 case RES_CHRATR_UNDERLINE
:
292 pULineItem
= rSet
.GetPool()->GetDefaultItem(aIt
->nWID
).Clone();
293 pTempItem
= pULineItem
;
295 case RES_CHRATR_OVERLINE
:
297 pOLineItem
= rSet
.GetPool()->GetDefaultItem(aIt
->nWID
).Clone();
298 pTempItem
= pOLineItem
;
300 case RES_CHRATR_WEIGHT
:
302 pWeightItem
= rSet
.GetPool()->GetDefaultItem(aIt
->nWID
).Clone();
303 pTempItem
= pWeightItem
;
305 case RES_PARATR_DROP
:
307 pDropItem
= rSet
.GetPool()->GetDefaultItem(aIt
->nWID
).Clone();
308 pTempItem
= pDropItem
;
310 case RES_TXTATR_INETFMT
:
312 pInetItem
= rSet
.GetPool()->GetDefaultItem(aIt
->nWID
).Clone();
313 pTempItem
= pInetItem
;
317 pDescItem
= rSet
.GetPool()->GetDefaultItem(aIt
->nWID
).Clone();
318 pTempItem
= pDescItem
;
320 case RES_PARATR_ADJUST
:
322 pAdjItem
= rSet
.GetPool()->GetDefaultItem(aIt
->nWID
).Clone();
323 pTempItem
= pAdjItem
;
327 pBackItem
= rSet
.GetPool()->GetDefaultItem(aIt
->nWID
).Clone();
328 pTempItem
= pBackItem
;
332 pULItem
= rSet
.GetPool()->GetDefaultItem(aIt
->nWID
).Clone();
337 pLRItem
= rSet
.GetPool()->GetDefaultItem(aIt
->nWID
).Clone();
342 pKeepItem
= rSet
.GetPool()->GetDefaultItem(aIt
->nWID
).Clone();
343 pTempItem
= pKeepItem
;
347 pLineNumItem
= rSet
.GetPool()->GetDefaultItem(aIt
->nWID
).Clone();
348 pTempItem
= pLineNumItem
;
350 case RES_PARATR_LINESPACING
:
352 pLineSpaceItem
= rSet
.GetPool()->GetDefaultItem(aIt
->nWID
).Clone();
353 pTempItem
= pLineSpaceItem
;
355 case RES_PARATR_REGISTER
:
357 pRegItem
= rSet
.GetPool()->GetDefaultItem(aIt
->nWID
).Clone();
358 pTempItem
= pRegItem
;
360 case RES_PARATR_SPLIT
:
362 pSplitItem
= rSet
.GetPool()->GetDefaultItem(aIt
->nWID
).Clone();
363 pTempItem
= pSplitItem
;
365 case RES_PARATR_TABSTOP
:
367 pTabItem
= rSet
.GetPool()->GetDefaultItem(aIt
->nWID
).Clone();
368 pTempItem
= pTabItem
;
370 case RES_CHRATR_WORDLINEMODE
:
372 pWLineItem
= rSet
.GetPool()->GetDefaultItem(aIt
->nWID
).Clone();
373 pTempItem
= pWLineItem
;
380 pTempItem
->PutValue(pValueArr
[i
]->Value
, aIt
->nMemberId
);
381 rSet
.Put(*pTempItem
);
384 rSet
.InvalidateItem( pTempItem
->Which() );
391 delete pAutoKernItem
;
396 delete pLineSpaceItem
;
397 delete pLineNumItem
;
409 delete pCharFmtItem
;
415 delete pFontSizeItem
;
419 delete pCrossedOutItem
;
420 delete pContourItem
;
421 delete pCharColorItem
;
422 delete pCasemapItem
;
425 /* -----------------23.06.99 14:18-------------------
427 --------------------------------------------------*/
428 sal_Bool
SwSearchProperties_Impl::HasAttributes() const
430 for(sal_uInt32 i
= 0; i
< nArrLen
; i
++)
436 /*-- 14.12.98 13:07:10 ---------------------------------------------------
438 -----------------------------------------------------------------------*/
439 SwXTextSearch::SwXTextSearch() :
440 pSearchProperties( new SwSearchProperties_Impl
),
441 pReplaceProperties( new SwSearchProperties_Impl
),
442 m_pPropSet(aSwMapProvider
.GetPropertySet(PROPERTY_MAP_TEXT_SEARCH
)),
449 bSimilarity(sal_False
),
450 bLevRelax(sal_False
),
454 bIsValueSearch(sal_True
)
457 /*-- 14.12.98 13:07:12 ---------------------------------------------------
459 -----------------------------------------------------------------------*/
460 SwXTextSearch::~SwXTextSearch()
462 delete pSearchProperties
;
463 delete pReplaceProperties
;
465 /* -----------------------------10.03.00 18:02--------------------------------
467 ---------------------------------------------------------------------------*/
468 const uno::Sequence
< sal_Int8
> & SwXTextSearch::getUnoTunnelId()
470 static uno::Sequence
< sal_Int8
> aSeq
= ::CreateUnoTunnelId();
473 /* -----------------------------10.03.00 18:04--------------------------------
475 ---------------------------------------------------------------------------*/
476 sal_Int64 SAL_CALL
SwXTextSearch::getSomething( const uno::Sequence
< sal_Int8
>& rId
)
477 throw(uno::RuntimeException
)
479 if( rId
.getLength() == 16
480 && 0 == rtl_compareMemory( getUnoTunnelId().getConstArray(),
481 rId
.getConstArray(), 16 ) )
483 return sal::static_int_cast
< sal_Int64
>( reinterpret_cast< sal_IntPtr
>(this) );
487 /*-- 14.12.98 13:07:12---------------------------------------------------
489 -----------------------------------------------------------------------*/
490 OUString
SwXTextSearch::getSearchString(void) throw( uno::RuntimeException
)
492 vos::OGuard
aGuard(Application::GetSolarMutex());
495 /*-- 14.12.98 13:07:12---------------------------------------------------
497 -----------------------------------------------------------------------*/
498 void SwXTextSearch::setSearchString(const OUString
& rString
)
499 throw( uno::RuntimeException
)
501 vos::OGuard
aGuard(Application::GetSolarMutex());
502 sSearchText
= String(rString
);
504 /*-- 14.12.98 13:07:12---------------------------------------------------
506 -----------------------------------------------------------------------*/
507 OUString
SwXTextSearch::getReplaceString(void) throw( uno::RuntimeException
)
509 vos::OGuard
aGuard(Application::GetSolarMutex());
512 /*-- 14.12.98 13:07:12---------------------------------------------------
514 -----------------------------------------------------------------------*/
515 void SwXTextSearch::setReplaceString(const OUString
& rReplaceString
) throw( uno::RuntimeException
)
517 vos::OGuard
aGuard(Application::GetSolarMutex());
518 sReplaceText
= String(rReplaceString
);
520 /*-- 14.12.98 13:07:13---------------------------------------------------
522 -----------------------------------------------------------------------*/
523 uno::Reference
< beans::XPropertySetInfo
> SwXTextSearch::getPropertySetInfo(void) throw( uno::RuntimeException
)
525 static uno::Reference
< beans::XPropertySetInfo
> aRef
= m_pPropSet
->getPropertySetInfo();
528 /*-- 14.12.98 13:07:13---------------------------------------------------
530 -----------------------------------------------------------------------*/
531 void SwXTextSearch::setPropertyValue(const OUString
& rPropertyName
, const uno::Any
& aValue
)
532 throw( beans::UnknownPropertyException
, beans::PropertyVetoException
,
533 lang::IllegalArgumentException
, lang::WrappedTargetException
, uno::RuntimeException
)
535 vos::OGuard
aGuard(Application::GetSolarMutex());
536 const SfxItemPropertySimpleEntry
* pEntry
= m_pPropSet
->getPropertyMap()->getByName(rPropertyName
);
539 if ( pEntry
->nFlags
& beans::PropertyAttribute::READONLY
)
540 throw beans::PropertyVetoException ( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Property is read-only: " ) ) + rPropertyName
, static_cast < cppu::OWeakObject
* > ( this ) );
541 sal_Bool bVal
= FALSE
;
542 if(aValue
.getValueType() == ::getBooleanCppuType())
543 bVal
= *(sal_Bool
*)aValue
.getValue();
546 case WID_SEARCH_ALL
: bAll
= bVal
; break;
547 case WID_WORDS
: bWord
= bVal
; break;
548 case WID_BACKWARDS
: bBack
= bVal
; break;
549 case WID_REGULAR_EXPRESSION
: bExpr
= bVal
; break;
550 case WID_CASE_SENSITIVE
: bCase
= bVal
; break;
551 //case WID_IN_SELECTION : bInSel = bVal; break;
552 case WID_STYLES
: bStyles
= bVal
; break;
553 case WID_SIMILARITY
: bSimilarity
= bVal
; break;
554 case WID_SIMILARITY_RELAX
: bLevRelax
= bVal
; break;
555 case WID_SIMILARITY_EXCHANGE
: aValue
>>= nLevExchange
; break;
556 case WID_SIMILARITY_ADD
: aValue
>>= nLevAdd
; break;
557 case WID_SIMILARITY_REMOVE
: aValue
>>= nLevRemove
;break;
561 throw beans::UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropertyName
, static_cast < cppu::OWeakObject
* > ( this ) );
563 /*-- 14.12.98 13:07:13---------------------------------------------------
565 -----------------------------------------------------------------------*/
566 uno::Any
SwXTextSearch::getPropertyValue(const OUString
& rPropertyName
) throw( beans::UnknownPropertyException
, lang::WrappedTargetException
, uno::RuntimeException
)
568 vos::OGuard
aGuard(Application::GetSolarMutex());
571 const SfxItemPropertySimpleEntry
* pEntry
= m_pPropSet
->getPropertyMap()->getByName(rPropertyName
);
572 sal_Bool bSet
= sal_False
;
578 case WID_SEARCH_ALL
: bSet
= bAll
; goto SET_BOOL
;
579 case WID_WORDS
: bSet
= bWord
; goto SET_BOOL
;
580 case WID_BACKWARDS
: bSet
= bBack
; goto SET_BOOL
;
581 case WID_REGULAR_EXPRESSION
: bSet
= bExpr
; goto SET_BOOL
;
582 case WID_CASE_SENSITIVE
: bSet
= bCase
; goto SET_BOOL
;
583 //case WID_IN_SELECTION : bSet = bInSel; goto SET_BOOL;
584 case WID_STYLES
: bSet
= bStyles
; goto SET_BOOL
;
585 case WID_SIMILARITY
: bSet
= bSimilarity
; goto SET_BOOL
;
586 case WID_SIMILARITY_RELAX
: bSet
= bLevRelax
;
588 aRet
.setValue(&bSet
, ::getBooleanCppuType());
590 case WID_SIMILARITY_EXCHANGE
: nSet
= nLevExchange
; goto SET_UINT16
;
591 case WID_SIMILARITY_ADD
: nSet
= nLevAdd
; goto SET_UINT16
;
592 case WID_SIMILARITY_REMOVE
: nSet
= nLevRemove
;
599 throw beans::UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropertyName
, static_cast < cppu::OWeakObject
* > ( this ) );
602 /*-- 14.12.98 13:07:13---------------------------------------------------
604 -----------------------------------------------------------------------*/
605 void SwXTextSearch::addPropertyChangeListener(const OUString
& /*rPropertyName*/, const uno::Reference
< beans::XPropertyChangeListener
> & /*xListener*/) throw(beans::UnknownPropertyException
, lang::WrappedTargetException
, uno::RuntimeException
)
607 DBG_WARNING("not implemented");
609 /*-- 14.12.98 13:07:13---------------------------------------------------
611 -----------------------------------------------------------------------*/
612 void SwXTextSearch::removePropertyChangeListener(const OUString
& /*rPropertyName*/, const uno::Reference
< beans::XPropertyChangeListener
> & /*xListener*/) throw(beans::UnknownPropertyException
, lang::WrappedTargetException
,uno::RuntimeException
)
614 DBG_WARNING("not implemented");
616 /*-- 14.12.98 13:07:14---------------------------------------------------
618 -----------------------------------------------------------------------*/
619 void SwXTextSearch::addVetoableChangeListener(const OUString
& /*rPropertyName*/, const uno::Reference
< beans::XVetoableChangeListener
> & /*xListener*/) throw(beans::UnknownPropertyException
, lang::WrappedTargetException
,uno::RuntimeException
)
621 DBG_WARNING("not implemented");
623 /*-- 14.12.98 13:07:14---------------------------------------------------
625 -----------------------------------------------------------------------*/
626 void SwXTextSearch::removeVetoableChangeListener(const OUString
& /*rPropertyName*/, const uno::Reference
< beans::XVetoableChangeListener
> & /*xListener*/) throw(beans::UnknownPropertyException
, lang::WrappedTargetException
,uno::RuntimeException
)
628 DBG_WARNING("not implemented");
630 /*-- 14.12.98 13:07:14---------------------------------------------------
632 -----------------------------------------------------------------------*/
633 sal_Bool
SwXTextSearch::getValueSearch(void) throw( uno::RuntimeException
)
635 vos::OGuard
aGuard(Application::GetSolarMutex());
636 return bIsValueSearch
;
638 /*-- 14.12.98 13:07:15---------------------------------------------------
640 -----------------------------------------------------------------------*/
641 void SwXTextSearch::setValueSearch(sal_Bool ValueSearch_
) throw( uno::RuntimeException
)
643 vos::OGuard
aGuard(Application::GetSolarMutex());
644 bIsValueSearch
= ValueSearch_
;
646 /*-- 14.12.98 13:07:15---------------------------------------------------
648 -----------------------------------------------------------------------*/
649 uno::Sequence
< beans::PropertyValue
> SwXTextSearch::getSearchAttributes(void) throw( uno::RuntimeException
)
651 return pSearchProperties
->GetProperties();
653 /*-- 14.12.98 13:07:16---------------------------------------------------
655 -----------------------------------------------------------------------*/
656 void SwXTextSearch::setSearchAttributes(const uno::Sequence
< beans::PropertyValue
>& rSearchAttribs
)
657 throw( beans::UnknownPropertyException
, lang::IllegalArgumentException
, uno::RuntimeException
)
659 pSearchProperties
->SetProperties(rSearchAttribs
);
661 /*-- 14.12.98 13:07:16---------------------------------------------------
663 -----------------------------------------------------------------------*/
664 uno::Sequence
< beans::PropertyValue
> SwXTextSearch::getReplaceAttributes(void)
665 throw( uno::RuntimeException
)
667 return pReplaceProperties
->GetProperties();
669 /*-- 14.12.98 13:07:17---------------------------------------------------
671 -----------------------------------------------------------------------*/
672 void SwXTextSearch::setReplaceAttributes(const uno::Sequence
< beans::PropertyValue
>& rReplaceAttribs
)
673 throw( beans::UnknownPropertyException
, lang::IllegalArgumentException
, uno::RuntimeException
)
675 pReplaceProperties
->SetProperties(rReplaceAttribs
);
677 /* -----------------23.06.99 14:13-------------------
679 --------------------------------------------------*/
680 void SwXTextSearch::FillSearchItemSet(SfxItemSet
& rSet
) const
682 pSearchProperties
->FillItemSet(rSet
, bIsValueSearch
);
684 /* -----------------23.06.99 14:14-------------------
686 --------------------------------------------------*/
687 void SwXTextSearch::FillReplaceItemSet(SfxItemSet
& rSet
) const
689 pReplaceProperties
->FillItemSet(rSet
, bIsValueSearch
);
691 /* -----------------23.06.99 14:17-------------------
693 --------------------------------------------------*/
694 sal_Bool
SwXTextSearch::HasSearchAttributes() const
696 return pSearchProperties
->HasAttributes();
698 /* -----------------23.06.99 14:17-------------------
700 --------------------------------------------------*/
701 sal_Bool
SwXTextSearch::HasReplaceAttributes() const
703 return pReplaceProperties
->HasAttributes();
705 /* -----------------------------19.04.00 14:43--------------------------------
707 ---------------------------------------------------------------------------*/
708 OUString
SwXTextSearch::getImplementationName(void) throw( uno::RuntimeException
)
710 return C2U("SwXTextSearch");
712 /* -----------------------------19.04.00 14:43--------------------------------
714 ---------------------------------------------------------------------------*/
715 BOOL
SwXTextSearch::supportsService(const OUString
& rServiceName
) throw( uno::RuntimeException
)
717 return C2U("com.sun.star.util.SearchDescriptor") == rServiceName
||
718 C2U("com.sun.star.util.ReplaceDescriptor") == rServiceName
;
720 /* -----------------------------19.04.00 14:43--------------------------------
722 ---------------------------------------------------------------------------*/
723 uno::Sequence
< OUString
> SwXTextSearch::getSupportedServiceNames(void) throw( uno::RuntimeException
)
725 uno::Sequence
< OUString
> aRet(2);
726 OUString
* pArray
= aRet
.getArray();
727 pArray
[0] = C2U("com.sun.star.util.SearchDescriptor");
728 pArray
[1] = C2U("com.sun.star.util.ReplaceDescriptor");
732 void SwXTextSearch::FillSearchOptions( util::SearchOptions
& rSearchOpt
) const
736 rSearchOpt
.algorithmType
= util::SearchAlgorithms_APPROXIMATE
;
737 rSearchOpt
.changedChars
= nLevExchange
;
738 rSearchOpt
.deletedChars
= nLevRemove
;
739 rSearchOpt
.insertedChars
= nLevAdd
;
741 rSearchOpt
.searchFlag
|= util::SearchFlags::LEV_RELAXED
;
744 rSearchOpt
.algorithmType
= util::SearchAlgorithms_REGEXP
;
746 rSearchOpt
.algorithmType
= util::SearchAlgorithms_ABSOLUTE
;
748 rSearchOpt
.Locale
= SvxCreateLocale( GetAppLanguage() );
749 rSearchOpt
.searchString
= sSearchText
;
750 rSearchOpt
.replaceString
= sReplaceText
;
753 rSearchOpt
.transliterateFlags
|= i18n::TransliterationModules_IGNORE_CASE
;
755 rSearchOpt
.searchFlag
|= util::SearchFlags::NORM_WORD_ONLY
;
757 // bInSel: 1; // wie geht das?
758 // TODO: pSearch->bStyles!
760 // aSrchParam.SetSrchInSelection(TypeConversion::toBOOL(aVal));