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 $
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_sd.hxx"
33 #include <vcl/svapp.hxx>
34 #include <vos/mutex.hxx>
36 #ifndef SVX_UNOSHAPE_HXX
37 #include <svx/unoshape.hxx>
39 #include <svx/unoprov.hxx>
40 #include <svx/unotext.hxx>
42 #include <comphelper/extract.hxx>
44 #include <rtl/memory.h>
46 #include "unohelp.hxx"
47 #include "unoprnms.hxx"
48 #include "unosrch.hxx"
50 using namespace ::vos
;
51 using namespace ::rtl
;
52 using namespace ::com::sun::star
;
54 #define WID_SEARCH_BACKWARDS 0
55 #define WID_SEARCH_CASE 1
56 #define WID_SEARCH_WORDS 2
58 const SfxItemPropertyMapEntry
* ImplGetSearchPropertyMap()
60 static const SfxItemPropertyMapEntry aSearchPropertyMap_Impl
[] =
62 { MAP_CHAR_LEN(UNO_NAME_SEARCH_BACKWARDS
), WID_SEARCH_BACKWARDS
, &::getBooleanCppuType(), 0, 0 },
63 { MAP_CHAR_LEN(UNO_NAME_SEARCH_CASE
), WID_SEARCH_CASE
, &::getBooleanCppuType(), 0, 0 },
64 { MAP_CHAR_LEN(UNO_NAME_SEARCH_WORDS
), WID_SEARCH_WORDS
, &::getBooleanCppuType(), 0, 0 },
68 return aSearchPropertyMap_Impl
;
71 class SearchContext_impl
73 uno::Reference
< drawing::XShapes
> mxShapes
;
75 SearchContext_impl
* mpParent
;
78 SearchContext_impl( uno::Reference
< drawing::XShapes
> xShapes
, SearchContext_impl
* pParent
= NULL
)
79 : mxShapes( xShapes
), mnIndex( -1 ), mpParent( pParent
) {}
82 uno::Reference
< drawing::XShape
> firstShape()
88 uno::Reference
< drawing::XShape
> nextShape()
90 uno::Reference
< drawing::XShape
> xShape
;
92 if( mxShapes
.is() && mxShapes
->getCount() > mnIndex
)
94 mxShapes
->getByIndex( mnIndex
) >>= xShape
;
99 SearchContext_impl
* getParent() const { return mpParent
; }
102 /* ================================================================= */
103 /** this class implements a search or replace operation on a given
104 page or a given sdrobj
107 SdUnoSearchReplaceShape::SdUnoSearchReplaceShape( drawing::XDrawPage
* pPage
) throw()
112 SdUnoSearchReplaceShape::SdUnoSearchReplaceShape( drawing::XShape
* pShape
) throw()
117 SdUnoSearchReplaceShape::~SdUnoSearchReplaceShape() throw()
121 // util::XReplaceable
122 uno::Reference
< util::XReplaceDescriptor
> SAL_CALL
SdUnoSearchReplaceShape::createReplaceDescriptor()
123 throw( uno::RuntimeException
)
125 return new SdUnoSearchReplaceDescriptor(sal_True
);
128 sal_Int32 SAL_CALL
SdUnoSearchReplaceShape::replaceAll( const uno::Reference
< util::XSearchDescriptor
>& xDesc
)
129 throw( uno::RuntimeException
)
131 SdUnoSearchReplaceDescriptor
* pDescr
= SdUnoSearchReplaceDescriptor::getImplementation( xDesc
);
135 sal_Int32 nFound
= 0;
137 uno::Reference
< drawing::XShapes
> xShapes
;
138 uno::Reference
< drawing::XShape
> xShape
;
140 SearchContext_impl
* pContext
= NULL
;
143 uno::Reference
< drawing::XDrawPage
> xPage( mpPage
);
145 xPage
->queryInterface( ITYPE( drawing::XShapes
) ) >>= xShapes
;
147 if( xShapes
.is() && (xShapes
->getCount() > 0) )
149 pContext
= new SearchContext_impl( xShapes
);
150 xShape
= pContext
->firstShape();
165 uno::Reference
< text::XText
> xText(xShape
, uno::UNO_QUERY
);
166 uno::Reference
< text::XTextRange
> xRange(xText
, uno::UNO_QUERY
);
167 uno::Reference
< text::XTextRange
> xFound
;
171 xFound
= Search( xRange
, pDescr
);
175 xFound
->setString( pDescr
->getReplaceString() );
176 xRange
= xFound
->getEnd();
179 // done with xShape -> get next shape
181 // test if its a group
182 uno::Reference
< drawing::XShapes
> xGroupShape( xShape
, uno::UNO_QUERY
);
183 if( xGroupShape
.is() && ( xGroupShape
->getCount() > 0 ) )
185 pContext
= new SearchContext_impl( xGroupShape
, pContext
);
186 xShape
= pContext
->firstShape();
191 xShape
= pContext
->nextShape();
196 // test parent contexts for next shape if none
197 // is found in the current context
198 while( pContext
&& !xShape
.is() )
200 if( pContext
->getParent() )
202 SearchContext_impl
* pOldContext
= pContext
;
203 pContext
= pContext
->getParent();
205 xShape
= pContext
->nextShape();
220 uno::Reference
< ::com::sun::star::util::XSearchDescriptor
> SAL_CALL
SdUnoSearchReplaceShape::createSearchDescriptor( )
221 throw(::com::sun::star::uno::RuntimeException
)
223 return new SdUnoSearchReplaceDescriptor(sal_False
);
226 uno::Reference
< ::com::sun::star::container::XIndexAccess
> SAL_CALL
SdUnoSearchReplaceShape::findAll( const ::com::sun::star::uno::Reference
< ::com::sun::star::util::XSearchDescriptor
>& xDesc
)
227 throw(::com::sun::star::uno::RuntimeException
)
229 SdUnoSearchReplaceDescriptor
* pDescr
= SdUnoSearchReplaceDescriptor::getImplementation( xDesc
);
231 return uno::Reference
< container::XIndexAccess
> ();
234 sal_Int32 nSequence
= 32;
235 sal_Int32 nFound
= 0;
237 uno::Sequence
< uno::Reference
< uno::XInterface
> > aSeq( nSequence
);
239 uno::Reference
< uno::XInterface
> * pArray
= aSeq
.getArray();
241 uno::Reference
< drawing::XShapes
> xShapes
;
242 uno::Reference
< drawing::XShape
> xShape
;
244 SearchContext_impl
* pContext
= NULL
;
247 uno::Reference
< drawing::XDrawPage
> xPage( mpPage
);
248 xPage
->queryInterface( ITYPE( drawing::XShapes
) ) >>= xShapes
;
250 if( xShapes
.is() && xShapes
->getCount() > 0 )
252 pContext
= new SearchContext_impl( xShapes
);
253 xShape
= pContext
->firstShape();
267 uno::Reference
< text::XText
> xText(xShape
, uno::UNO_QUERY
);
268 uno::Reference
< text::XTextRange
> xRange(xText
, uno::UNO_QUERY
);
269 uno::Reference
< text::XTextRange
> xFound
;
273 xFound
= Search( xRange
, pDescr
);
277 if( nFound
>= nSequence
)
280 aSeq
.realloc( nSequence
);
281 pArray
= aSeq
.getArray();
284 pArray
[nFound
++] = xFound
;
286 xRange
= xFound
->getEnd();
288 // done with shape -> get next shape
290 // test if its a group
291 uno::Reference
< drawing::XShapes
> xGroupShape
;
292 uno::Any
aAny( xShape
->queryInterface( ITYPE( drawing::XShapes
)));
294 if( (aAny
>>= xGroupShape
) && xGroupShape
->getCount() > 0 )
296 pContext
= new SearchContext_impl( xGroupShape
, pContext
);
297 xShape
= pContext
->firstShape();
302 xShape
= pContext
->nextShape();
307 // test parent contexts for next shape if none
308 // is found in the current context
309 while( pContext
&& !xShape
.is() )
311 if( pContext
->getParent() )
313 SearchContext_impl
* pOldContext
= pContext
;
314 pContext
= pContext
->getParent();
316 xShape
= pContext
->nextShape();
327 if( nFound
!= nSequence
)
328 aSeq
.realloc( nFound
);
330 return (container::XIndexAccess
*)new SdUnoFindAllAccess( aSeq
);
333 uno::Reference
< ::com::sun::star::uno::XInterface
> SAL_CALL
SdUnoSearchReplaceShape::findFirst( const ::com::sun::star::uno::Reference
< ::com::sun::star::util::XSearchDescriptor
>& xDesc
)
334 throw(::com::sun::star::uno::RuntimeException
)
336 uno::Reference
< text::XTextRange
> xRange( GetCurrentShape(), uno::UNO_QUERY
);
338 return findNext( xRange
, xDesc
);
340 return uno::Reference
< uno::XInterface
> ();
343 uno::Reference
< drawing::XShape
> SdUnoSearchReplaceShape::GetCurrentShape() const throw()
345 uno::Reference
< drawing::XShape
> xShape
;
349 uno::Reference
< drawing::XDrawPage
> xPage( mpPage
);
350 uno::Reference
< container::XIndexAccess
> xShapes( xPage
, uno::UNO_QUERY
);
353 if(xShapes
->getCount() > 0)
355 xShapes
->getByIndex(0) >>= xShape
;
368 uno::Reference
< ::com::sun::star::uno::XInterface
> SAL_CALL
SdUnoSearchReplaceShape::findNext( const ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XInterface
>& xStartAt
, const ::com::sun::star::uno::Reference
< ::com::sun::star::util::XSearchDescriptor
>& xDesc
)
369 throw(::com::sun::star::uno::RuntimeException
)
371 SdUnoSearchReplaceDescriptor
* pDescr
= SdUnoSearchReplaceDescriptor::getImplementation( xDesc
);
373 uno::Reference
< uno::XInterface
> xFound
;
375 uno::Reference
< text::XTextRange
> xRange( xStartAt
, uno::UNO_QUERY
);
376 if(pDescr
&& xRange
.is() )
379 uno::Reference
< text::XTextRange
> xCurrentRange( xStartAt
, uno::UNO_QUERY
);
381 uno::Reference
< drawing::XShape
> xCurrentShape( GetShape( xCurrentRange
) );
383 while(!xFound
.is() && xRange
.is())
385 xFound
= Search( xRange
, pDescr
);
388 // we need a new starting range now
393 uno::Reference
< drawing::XDrawPage
> xPage( mpPage
);
395 // we do a page wide search, so skip to the next shape here
396 uno::Reference
< container::XIndexAccess
> xShapes( xPage
, uno::UNO_QUERY
);
398 // get next shape on our page
401 uno::Reference
< drawing::XShape
> xFound2( GetNextShape( xShapes
, xCurrentShape
) );
402 if( xFound2
.is() && (xFound2
.get() != xCurrentShape
.get()) )
403 xCurrentShape
= xFound2
;
405 xCurrentShape
= NULL
;
407 xCurrentShape
->queryInterface( ITYPE( text::XTextRange
) ) >>= xRange
;
408 if(!(xCurrentShape
.is() && (xRange
.is())))
414 // we search only in this shape, so end search if we have
415 // not found anything
423 /** this method returns the shape that follows xCurrentShape in the shape collection xShapes.
424 It steps recursive into groupshapes and returns the xCurrentShape if it is the last
425 shape in this collection */
426 uno::Reference
< drawing::XShape
> SdUnoSearchReplaceShape::GetNextShape( uno::Reference
< container::XIndexAccess
> xShapes
, uno::Reference
< drawing::XShape
> xCurrentShape
) throw()
428 uno::Reference
< drawing::XShape
> xFound
;
431 if(xShapes
.is() && xCurrentShape
.is())
433 const sal_Int32 nCount
= xShapes
->getCount();
434 for( sal_Int32 i
= 0; i
< nCount
; i
++ )
436 uno::Reference
< drawing::XShape
> xSearchShape
;
437 xShapes
->getByIndex(i
) >>= xSearchShape
;
439 if( xSearchShape
.is() )
441 uno::Reference
< container::XIndexAccess
> xGroup( xSearchShape
, uno::UNO_QUERY
);
443 if( xCurrentShape
.get() == xSearchShape
.get() )
445 if( xGroup
.is() && xGroup
->getCount() > 0 )
447 xGroup
->getByIndex( 0 ) >>= xFound
;
453 xShapes
->getByIndex( i
) >>= xFound
;
455 xFound
= xCurrentShape
;
460 else if( xGroup
.is() )
462 xFound
= GetNextShape( xGroup
, xCurrentShape
);
465 if( xFound
.get() == xCurrentShape
.get() )
467 // the current shape was found at the end of the group
471 xShapes
->getByIndex(i
) >>= xFound
;
484 uno::Reference
< text::XTextRange
> SdUnoSearchReplaceShape::Search( uno::Reference
< text::XTextRange
> xText
, SdUnoSearchReplaceDescriptor
* pDescr
) throw()
487 return uno::Reference
< text::XTextRange
> ();
489 uno::Reference
< text::XText
> xParent( xText
->getText() );
493 uno::Any
aAny( xText
->queryInterface( ITYPE( text::XText
)) );
497 const OUString
aText( xParent
->getString() );
499 const sal_Int32 nTextLen
= aText
.getLength();
501 sal_Int32
* pConvertPos
= new sal_Int32
[nTextLen
+2];
502 sal_Int32
* pConvertPara
= new sal_Int32
[nTextLen
+2];
505 const sal_Unicode
* pText
= aText
;
507 sal_Int32
* pPos
= pConvertPos
;
508 sal_Int32
* pPara
= pConvertPara
;
510 sal_Int32 nLastPos
= 0, nLastPara
= 0;
512 uno::Reference
< container::XEnumerationAccess
> xEnumAccess( xParent
, uno::UNO_QUERY
);
514 // first we fill the arrys with the position and paragraph for every character
516 if( xEnumAccess
.is() )
518 uno::Reference
< container::XEnumeration
> xParaEnum( xEnumAccess
->createEnumeration() );
520 while(xParaEnum
->hasMoreElements())
522 uno::Reference
< text::XTextContent
> xParagraph( xParaEnum
->nextElement(), uno::UNO_QUERY
);
523 if( xParagraph
.is() )
524 xEnumAccess
.query( xParagraph
);
528 if( xEnumAccess
.is() )
530 uno::Reference
< container::XEnumeration
> xPortionEnum( xEnumAccess
->createEnumeration() );
531 if( xPortionEnum
.is() )
533 while(xPortionEnum
->hasMoreElements())
535 uno::Reference
< text::XTextRange
> xPortion( xPortionEnum
->nextElement(), uno::UNO_QUERY
);
538 const OUString
aPortion( xPortion
->getString() );
539 const sal_Int32 nLen
= aPortion
.getLength();
541 ESelection
aStartSel( GetSelection( xPortion
->getStart() ) );
542 ESelection
aEndSel( GetSelection( xPortion
->getEnd() ) );
544 // special case for empty portions with content or length one portions with content (fields)
545 if( (aStartSel
.nStartPos
== aEndSel
.nStartPos
) || ( (aStartSel
.nStartPos
== (aEndSel
.nStartPos
- 1)) && (nLen
> 1) ) )
547 for( sal_Int32 i
= 0; i
< nLen
; i
++ )
549 if( ndbg
< (nTextLen
+2) )
551 *pPos
++ = aStartSel
.nStartPos
;
552 *pPara
++ = aStartSel
.nStartPara
;
559 DBG_ERROR( "array overflow while searching" );
563 nLastPos
= aStartSel
.nStartPos
;
568 for( sal_Int32 i
= 0; i
< nLen
; i
++ )
570 if( ndbg
< (nTextLen
+2) )
572 *pPos
++ = aStartSel
.nStartPos
++;
573 *pPara
++ = aStartSel
.nStartPara
;
580 DBG_ERROR( "array overflow while searching" );
584 nLastPos
= aStartSel
.nStartPos
- 1;
585 DBG_ASSERT( aEndSel
.nStartPos
== aStartSel
.nStartPos
, "Search is not working" );
587 nLastPara
= aStartSel
.nStartPara
;
593 if( ndbg
< (nTextLen
+2) )
595 *pPos
++ = nLastPos
+ 1;
596 *pPara
++ = nLastPara
;
603 DBG_ERROR( "array overflow while searching" );
608 uno::Reference
< text::XText
> xFound
;
611 uno::Reference
< text::XTextRange
> xRangeRef( xText
, uno::UNO_QUERY
);
613 aSel
= GetSelection( xRangeRef
);
616 sal_Int32 nEndPos
= 0;
617 for( nStartPos
= 0; nStartPos
< nTextLen
; nStartPos
++ )
619 if( pConvertPara
[nStartPos
] == aSel
.nStartPara
&& pConvertPos
[nStartPos
] == aSel
.nStartPos
)
623 if( Search( aText
, nStartPos
, nEndPos
, pDescr
) )
625 if( nStartPos
<= nTextLen
&& nEndPos
<= nTextLen
)
627 ESelection
aSelection( (USHORT
)pConvertPara
[nStartPos
], (USHORT
)pConvertPos
[nStartPos
],
628 (USHORT
)pConvertPara
[nEndPos
], (USHORT
)pConvertPos
[nEndPos
] );
629 SvxUnoTextRange
*pRange
;
631 SvxUnoTextBase
* pParent
= SvxUnoTextBase::getImplementation( xParent
);
635 pRange
= new SvxUnoTextRange( *pParent
);
636 xFound
= (text::XText
*)pRange
;
637 pRange
->SetSelection(aSelection
);
639 // pDescr->SetStartPos( nEndPos );
644 DBG_ERROR("Array overflow while searching!");
648 delete[] pConvertPos
;
649 delete[] pConvertPara
;
651 return uno::Reference
< text::XTextRange
> ( xFound
, uno::UNO_QUERY
);
654 sal_Bool
SdUnoSearchReplaceShape::Search( const OUString
& rText
, sal_Int32
& nStartPos
, sal_Int32
& nEndPos
, SdUnoSearchReplaceDescriptor
* pDescr
) throw()
656 OUString
aSearchStr( pDescr
->getSearchString() );
657 OUString
aText( rText
);
659 if( !pDescr
->IsCaseSensitive() )
661 aText
.toAsciiLowerCase();
662 aSearchStr
.toAsciiLowerCase();
665 sal_Int32 nFound
= aText
.indexOf( aSearchStr
, nStartPos
);
669 nEndPos
= nFound
+ aSearchStr
.getLength();
671 if(pDescr
->IsWords())
673 if( (nStartPos
> 0 && aText
.getStr()[nStartPos
-1] > ' ') ||
674 (nEndPos
< aText
.getLength() && aText
.getStr()[nEndPos
] > ' ') )
677 return Search( aText
, nStartPos
, nEndPos
, pDescr
);
687 ESelection
SdUnoSearchReplaceShape::GetSelection( uno::Reference
< text::XTextRange
> xTextRange
) throw()
690 SvxUnoTextRangeBase
* pRange
= SvxUnoTextRangeBase::getImplementation( xTextRange
);
693 aSel
= pRange
->GetSelection();
698 uno::Reference
< drawing::XShape
> SdUnoSearchReplaceShape::GetShape( uno::Reference
< text::XTextRange
> xTextRange
) throw()
700 uno::Reference
< drawing::XShape
> xShape
;
704 uno::Reference
< text::XText
> xText( xTextRange
->getText() );
710 xText
->queryInterface( ITYPE( drawing::XShape
)) >>= xShape
;
713 uno::Reference
< text::XText
> xParent( xText
->getText() );
714 if(!xParent
.is() || xText
.get() == xParent
.get())
719 } while( !xShape
.is() );
726 /* ================================================================= */
727 /** this class holds the parameters and status of a search or replace
728 operation performed by class SdUnoSearchReplaceShape
731 UNO3_GETIMPLEMENTATION_IMPL( SdUnoSearchReplaceDescriptor
);
733 SdUnoSearchReplaceDescriptor::SdUnoSearchReplaceDescriptor( sal_Bool bReplace
) throw()
735 mpPropSet
= new SvxItemPropertySet(ImplGetSearchPropertyMap());
737 mbBackwards
= sal_False
;
738 mbCaseSensitive
= sal_False
;
741 mbReplace
= bReplace
;
744 SdUnoSearchReplaceDescriptor::~SdUnoSearchReplaceDescriptor() throw()
750 OUString SAL_CALL
SdUnoSearchReplaceDescriptor::getSearchString()
751 throw(::com::sun::star::uno::RuntimeException
)
756 void SAL_CALL
SdUnoSearchReplaceDescriptor::setSearchString( const OUString
& aString
)
757 throw(::com::sun::star::uno::RuntimeException
)
759 maSearchStr
= aString
;
762 // XReplaceDescriptor
763 OUString SAL_CALL
SdUnoSearchReplaceDescriptor::getReplaceString()
764 throw(::com::sun::star::uno::RuntimeException
)
769 void SAL_CALL
SdUnoSearchReplaceDescriptor::setReplaceString( const ::rtl::OUString
& aReplaceString
)
770 throw(::com::sun::star::uno::RuntimeException
)
772 maReplaceStr
= aReplaceString
;
776 uno::Reference
< ::com::sun::star::beans::XPropertySetInfo
> SAL_CALL
SdUnoSearchReplaceDescriptor::getPropertySetInfo()
777 throw(::com::sun::star::uno::RuntimeException
)
779 OGuard
aGuard( Application::GetSolarMutex() );
780 return mpPropSet
->getPropertySetInfo();
783 void SAL_CALL
SdUnoSearchReplaceDescriptor::setPropertyValue( const ::rtl::OUString
& aPropertyName
, const ::com::sun::star::uno::Any
& aValue
)
784 throw(::com::sun::star::beans::UnknownPropertyException
, ::com::sun::star::beans::PropertyVetoException
, ::com::sun::star::lang::IllegalArgumentException
, ::com::sun::star::lang::WrappedTargetException
, ::com::sun::star::uno::RuntimeException
)
786 OGuard
aGuard( Application::GetSolarMutex() );
788 const SfxItemPropertySimpleEntry
* pEntry
= mpPropSet
->getPropertyMapEntry(aPropertyName
);
790 sal_Bool bOk
= sal_False
;
792 switch( pEntry
? pEntry
->nWID
: -1 )
794 case WID_SEARCH_BACKWARDS
:
795 bOk
= (aValue
>>= mbBackwards
);
797 case WID_SEARCH_CASE
:
798 bOk
= (aValue
>>= mbCaseSensitive
);
800 case WID_SEARCH_WORDS
:
801 bOk
= (aValue
>>= mbWords
);
804 throw beans::UnknownPropertyException();
808 throw lang::IllegalArgumentException();
811 uno::Any SAL_CALL
SdUnoSearchReplaceDescriptor::getPropertyValue( const ::rtl::OUString
& PropertyName
)
812 throw(::com::sun::star::beans::UnknownPropertyException
, ::com::sun::star::lang::WrappedTargetException
, ::com::sun::star::uno::RuntimeException
)
814 OGuard
aGuard( Application::GetSolarMutex() );
818 const SfxItemPropertySimpleEntry
* pEntry
= mpPropSet
->getPropertyMapEntry(PropertyName
);
820 switch( pEntry
? pEntry
->nWID
: -1 )
822 case WID_SEARCH_BACKWARDS
:
823 aAny
<<= (sal_Bool
)mbBackwards
;
825 case WID_SEARCH_CASE
:
826 aAny
<<= (sal_Bool
)mbCaseSensitive
;
828 case WID_SEARCH_WORDS
:
829 aAny
<<= (sal_Bool
)mbWords
;
832 throw beans::UnknownPropertyException();
838 void SAL_CALL
SdUnoSearchReplaceDescriptor::addPropertyChangeListener( const ::rtl::OUString
& , const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertyChangeListener
>& ) throw(::com::sun::star::beans::UnknownPropertyException
, ::com::sun::star::lang::WrappedTargetException
, ::com::sun::star::uno::RuntimeException
) {}
839 void SAL_CALL
SdUnoSearchReplaceDescriptor::removePropertyChangeListener( const ::rtl::OUString
& , const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertyChangeListener
>& ) throw(::com::sun::star::beans::UnknownPropertyException
, ::com::sun::star::lang::WrappedTargetException
, ::com::sun::star::uno::RuntimeException
) {}
840 void SAL_CALL
SdUnoSearchReplaceDescriptor::addVetoableChangeListener( const ::rtl::OUString
& , const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XVetoableChangeListener
>& ) throw(::com::sun::star::beans::UnknownPropertyException
, ::com::sun::star::lang::WrappedTargetException
, ::com::sun::star::uno::RuntimeException
) {}
841 void SAL_CALL
SdUnoSearchReplaceDescriptor::removeVetoableChangeListener( const ::rtl::OUString
& , const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XVetoableChangeListener
>& ) throw(::com::sun::star::beans::UnknownPropertyException
, ::com::sun::star::lang::WrappedTargetException
, ::com::sun::star::uno::RuntimeException
) {}
844 /* ================================================================= */
846 SdUnoFindAllAccess::SdUnoFindAllAccess( uno::Sequence
< uno::Reference
< uno::XInterface
> >& rSequence
) throw()
847 :maSequence( rSequence
)
851 SdUnoFindAllAccess::~SdUnoFindAllAccess() throw()
856 uno::Type SAL_CALL
SdUnoFindAllAccess::getElementType()
857 throw(::com::sun::star::uno::RuntimeException
)
859 return ITYPE( text::XTextRange
);
862 sal_Bool SAL_CALL
SdUnoFindAllAccess::hasElements()
863 throw(::com::sun::star::uno::RuntimeException
)
865 return maSequence
.getLength() > 0;
869 sal_Int32 SAL_CALL
SdUnoFindAllAccess::getCount()
870 throw(::com::sun::star::uno::RuntimeException
)
872 return maSequence
.getLength();
875 uno::Any SAL_CALL
SdUnoFindAllAccess::getByIndex( sal_Int32 Index
)
876 throw(::com::sun::star::lang::IndexOutOfBoundsException
, ::com::sun::star::lang::WrappedTargetException
, ::com::sun::star::uno::RuntimeException
)
880 if( Index
< 0 || Index
>= getCount() )
881 throw lang::IndexOutOfBoundsException();
883 const uno::Reference
< uno::XInterface
> *pRefs
= maSequence
.getConstArray();
885 aAny
<<= pRefs
[ Index
];