1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include <vcl/svapp.hxx>
21 #include <osl/mutex.hxx>
23 #include <svx/unoshape.hxx>
24 #include <svx/svdpool.hxx>
25 #include <svx/unoprov.hxx>
26 #include <editeng/unotext.hxx>
28 #include <comphelper/extract.hxx>
30 #include "unohelp.hxx"
31 #include "unoprnms.hxx"
32 #include "unosrch.hxx"
34 using namespace ::rtl
;
35 using namespace ::com::sun::star
;
37 #define WID_SEARCH_BACKWARDS 0
38 #define WID_SEARCH_CASE 1
39 #define WID_SEARCH_WORDS 2
41 const SfxItemPropertyMapEntry
* ImplGetSearchPropertyMap()
43 static const SfxItemPropertyMapEntry aSearchPropertyMap_Impl
[] =
45 { MAP_CHAR_LEN(UNO_NAME_SEARCH_BACKWARDS
), WID_SEARCH_BACKWARDS
, &::getBooleanCppuType(), 0, 0 },
46 { MAP_CHAR_LEN(UNO_NAME_SEARCH_CASE
), WID_SEARCH_CASE
, &::getBooleanCppuType(), 0, 0 },
47 { MAP_CHAR_LEN(UNO_NAME_SEARCH_WORDS
), WID_SEARCH_WORDS
, &::getBooleanCppuType(), 0, 0 },
51 return aSearchPropertyMap_Impl
;
54 class SearchContext_impl
56 uno::Reference
< drawing::XShapes
> mxShapes
;
58 SearchContext_impl
* mpParent
;
61 SearchContext_impl( uno::Reference
< drawing::XShapes
> xShapes
, SearchContext_impl
* pParent
= NULL
)
62 : mxShapes( xShapes
), mnIndex( -1 ), mpParent( pParent
) {}
65 uno::Reference
< drawing::XShape
> firstShape()
71 uno::Reference
< drawing::XShape
> nextShape()
73 uno::Reference
< drawing::XShape
> xShape
;
75 if( mxShapes
.is() && mxShapes
->getCount() > mnIndex
)
77 mxShapes
->getByIndex( mnIndex
) >>= xShape
;
82 SearchContext_impl
* getParent() const { return mpParent
; }
85 /* ================================================================= */
86 /** this class implements a search or replace operation on a given
87 page or a given sdrobj
90 SdUnoSearchReplaceShape::SdUnoSearchReplaceShape( drawing::XDrawPage
* pPage
) throw()
95 SdUnoSearchReplaceShape::~SdUnoSearchReplaceShape() throw()
100 uno::Reference
< util::XReplaceDescriptor
> SAL_CALL
SdUnoSearchReplaceShape::createReplaceDescriptor()
101 throw( uno::RuntimeException
)
103 return new SdUnoSearchReplaceDescriptor(sal_True
);
106 sal_Int32 SAL_CALL
SdUnoSearchReplaceShape::replaceAll( const uno::Reference
< util::XSearchDescriptor
>& xDesc
)
107 throw( uno::RuntimeException
)
109 SdUnoSearchReplaceDescriptor
* pDescr
= SdUnoSearchReplaceDescriptor::getImplementation( xDesc
);
113 sal_Int32 nFound
= 0;
115 uno::Reference
< drawing::XShapes
> xShapes
;
116 uno::Reference
< drawing::XShape
> xShape
;
118 SearchContext_impl
* pContext
= NULL
;
121 uno::Reference
< drawing::XDrawPage
> xPage( mpPage
);
123 xShapes
.set( xPage
, uno::UNO_QUERY
);
125 if( xShapes
.is() && (xShapes
->getCount() > 0) )
127 pContext
= new SearchContext_impl( xShapes
);
128 xShape
= pContext
->firstShape();
143 uno::Reference
< text::XText
> xText(xShape
, uno::UNO_QUERY
);
144 uno::Reference
< text::XTextRange
> xRange(xText
, uno::UNO_QUERY
);
145 uno::Reference
< text::XTextRange
> xFound
;
149 xFound
= Search( xRange
, pDescr
);
153 xFound
->setString( pDescr
->getReplaceString() );
154 xRange
= xFound
->getEnd();
157 // done with xShape -> get next shape
159 // test if its a group
160 uno::Reference
< drawing::XShapes
> xGroupShape( xShape
, uno::UNO_QUERY
);
161 if( xGroupShape
.is() && ( xGroupShape
->getCount() > 0 ) )
163 pContext
= new SearchContext_impl( xGroupShape
, pContext
);
164 xShape
= pContext
->firstShape();
169 xShape
= pContext
->nextShape();
174 // test parent contexts for next shape if none
175 // is found in the current context
176 while( pContext
&& !xShape
.is() )
178 if( pContext
->getParent() )
180 SearchContext_impl
* pOldContext
= pContext
;
181 pContext
= pContext
->getParent();
183 xShape
= pContext
->nextShape();
198 uno::Reference
< ::com::sun::star::util::XSearchDescriptor
> SAL_CALL
SdUnoSearchReplaceShape::createSearchDescriptor( )
199 throw(::com::sun::star::uno::RuntimeException
)
201 return new SdUnoSearchReplaceDescriptor(sal_False
);
204 uno::Reference
< ::com::sun::star::container::XIndexAccess
> SAL_CALL
SdUnoSearchReplaceShape::findAll( const ::com::sun::star::uno::Reference
< ::com::sun::star::util::XSearchDescriptor
>& xDesc
)
205 throw(::com::sun::star::uno::RuntimeException
)
207 SdUnoSearchReplaceDescriptor
* pDescr
= SdUnoSearchReplaceDescriptor::getImplementation( xDesc
);
209 return uno::Reference
< container::XIndexAccess
> ();
212 sal_Int32 nSequence
= 32;
213 sal_Int32 nFound
= 0;
215 uno::Sequence
< uno::Reference
< uno::XInterface
> > aSeq( nSequence
);
217 uno::Reference
< uno::XInterface
> * pArray
= aSeq
.getArray();
219 uno::Reference
< drawing::XShapes
> xShapes
;
220 uno::Reference
< drawing::XShape
> xShape
;
222 SearchContext_impl
* pContext
= NULL
;
225 uno::Reference
< drawing::XDrawPage
> xPage( mpPage
);
226 xShapes
.set( xPage
, uno::UNO_QUERY
);
228 if( xShapes
.is() && xShapes
->getCount() > 0 )
230 pContext
= new SearchContext_impl( xShapes
);
231 xShape
= pContext
->firstShape();
245 uno::Reference
< text::XText
> xText(xShape
, uno::UNO_QUERY
);
246 uno::Reference
< text::XTextRange
> xRange(xText
, uno::UNO_QUERY
);
247 uno::Reference
< text::XTextRange
> xFound
;
251 xFound
= Search( xRange
, pDescr
);
255 if( nFound
>= nSequence
)
258 aSeq
.realloc( nSequence
);
259 pArray
= aSeq
.getArray();
262 pArray
[nFound
++] = xFound
;
264 xRange
= xFound
->getEnd();
266 // done with shape -> get next shape
268 // test if its a group
269 uno::Reference
< drawing::XShapes
> xGroupShape
;
270 xGroupShape
.set( xShape
, uno::UNO_QUERY
);
272 if( xGroupShape
.is() && xGroupShape
->getCount() > 0 )
274 pContext
= new SearchContext_impl( xGroupShape
, pContext
);
275 xShape
= pContext
->firstShape();
280 xShape
= pContext
->nextShape();
285 // test parent contexts for next shape if none
286 // is found in the current context
287 while( pContext
&& !xShape
.is() )
289 if( pContext
->getParent() )
291 SearchContext_impl
* pOldContext
= pContext
;
292 pContext
= pContext
->getParent();
294 xShape
= pContext
->nextShape();
305 if( nFound
!= nSequence
)
306 aSeq
.realloc( nFound
);
308 return (container::XIndexAccess
*)new SdUnoFindAllAccess( aSeq
);
311 uno::Reference
< ::com::sun::star::uno::XInterface
> SAL_CALL
SdUnoSearchReplaceShape::findFirst( const ::com::sun::star::uno::Reference
< ::com::sun::star::util::XSearchDescriptor
>& xDesc
)
312 throw(::com::sun::star::uno::RuntimeException
)
314 uno::Reference
< text::XTextRange
> xRange( GetCurrentShape(), uno::UNO_QUERY
);
316 return findNext( xRange
, xDesc
);
318 return uno::Reference
< uno::XInterface
> ();
321 uno::Reference
< drawing::XShape
> SdUnoSearchReplaceShape::GetCurrentShape() const throw()
323 uno::Reference
< drawing::XShape
> xShape
;
327 uno::Reference
< drawing::XDrawPage
> xPage( mpPage
);
328 uno::Reference
< container::XIndexAccess
> xShapes( xPage
, uno::UNO_QUERY
);
331 if(xShapes
->getCount() > 0)
333 xShapes
->getByIndex(0) >>= xShape
;
346 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
)
347 throw(::com::sun::star::uno::RuntimeException
)
349 SdUnoSearchReplaceDescriptor
* pDescr
= SdUnoSearchReplaceDescriptor::getImplementation( xDesc
);
351 uno::Reference
< uno::XInterface
> xFound
;
353 uno::Reference
< text::XTextRange
> xRange( xStartAt
, uno::UNO_QUERY
);
354 if(pDescr
&& xRange
.is() )
357 uno::Reference
< text::XTextRange
> xCurrentRange( xStartAt
, uno::UNO_QUERY
);
359 uno::Reference
< drawing::XShape
> xCurrentShape( GetShape( xCurrentRange
) );
361 while(!xFound
.is() && xRange
.is())
363 xFound
= Search( xRange
, pDescr
);
366 // we need a new starting range now
371 uno::Reference
< drawing::XDrawPage
> xPage( mpPage
);
373 // we do a page wide search, so skip to the next shape here
374 uno::Reference
< container::XIndexAccess
> xShapes( xPage
, uno::UNO_QUERY
);
376 // get next shape on our page
379 uno::Reference
< drawing::XShape
> xFound2( GetNextShape( xShapes
, xCurrentShape
) );
380 if( xFound2
.is() && (xFound2
.get() != xCurrentShape
.get()) )
381 xCurrentShape
= xFound2
;
383 xCurrentShape
= NULL
;
385 xRange
.set( xCurrentShape
, uno::UNO_QUERY
);
386 if(!(xCurrentShape
.is() && (xRange
.is())))
392 // we search only in this shape, so end search if we have
393 // not found anything
401 /** this method returns the shape that follows xCurrentShape in the shape collection xShapes.
402 It steps recursive into groupshapes and returns the xCurrentShape if it is the last
403 shape in this collection */
404 uno::Reference
< drawing::XShape
> SdUnoSearchReplaceShape::GetNextShape( uno::Reference
< container::XIndexAccess
> xShapes
, uno::Reference
< drawing::XShape
> xCurrentShape
) throw()
406 uno::Reference
< drawing::XShape
> xFound
;
409 if(xShapes
.is() && xCurrentShape
.is())
411 const sal_Int32 nCount
= xShapes
->getCount();
412 for( sal_Int32 i
= 0; i
< nCount
; i
++ )
414 uno::Reference
< drawing::XShape
> xSearchShape
;
415 xShapes
->getByIndex(i
) >>= xSearchShape
;
417 if( xSearchShape
.is() )
419 uno::Reference
< container::XIndexAccess
> xGroup( xSearchShape
, uno::UNO_QUERY
);
421 if( xCurrentShape
.get() == xSearchShape
.get() )
423 if( xGroup
.is() && xGroup
->getCount() > 0 )
425 xGroup
->getByIndex( 0 ) >>= xFound
;
431 xShapes
->getByIndex( i
) >>= xFound
;
433 xFound
= xCurrentShape
;
438 else if( xGroup
.is() )
440 xFound
= GetNextShape( xGroup
, xCurrentShape
);
443 if( xFound
.get() == xCurrentShape
.get() )
445 // the current shape was found at the end of the group
449 xShapes
->getByIndex(i
) >>= xFound
;
462 uno::Reference
< text::XTextRange
> SdUnoSearchReplaceShape::Search( uno::Reference
< text::XTextRange
> xText
, SdUnoSearchReplaceDescriptor
* pDescr
) throw()
465 return uno::Reference
< text::XTextRange
> ();
467 uno::Reference
< text::XText
> xParent( xText
->getText() );
471 xParent
.set( xText
, uno::UNO_QUERY
);
474 const OUString
aText( xParent
->getString() );
476 const sal_Int32 nTextLen
= aText
.getLength();
478 sal_Int32
* pConvertPos
= new sal_Int32
[nTextLen
+2];
479 sal_Int32
* pConvertPara
= new sal_Int32
[nTextLen
+2];
482 const sal_Unicode
* pText
= aText
.getStr();
484 sal_Int32
* pPos
= pConvertPos
;
485 sal_Int32
* pPara
= pConvertPara
;
487 sal_Int32 nLastPos
= 0, nLastPara
= 0;
489 uno::Reference
< container::XEnumerationAccess
> xEnumAccess( xParent
, uno::UNO_QUERY
);
491 // first we fill the arrys with the position and paragraph for every character
493 if( xEnumAccess
.is() )
495 uno::Reference
< container::XEnumeration
> xParaEnum( xEnumAccess
->createEnumeration() );
497 while(xParaEnum
->hasMoreElements())
499 uno::Reference
< text::XTextContent
> xParagraph( xParaEnum
->nextElement(), uno::UNO_QUERY
);
500 if( xParagraph
.is() )
501 xEnumAccess
.query( xParagraph
);
505 if( xEnumAccess
.is() )
507 uno::Reference
< container::XEnumeration
> xPortionEnum( xEnumAccess
->createEnumeration() );
508 if( xPortionEnum
.is() )
510 while(xPortionEnum
->hasMoreElements())
512 uno::Reference
< text::XTextRange
> xPortion( xPortionEnum
->nextElement(), uno::UNO_QUERY
);
515 const OUString
aPortion( xPortion
->getString() );
516 const sal_Int32 nLen
= aPortion
.getLength();
518 ESelection
aStartSel( GetSelection( xPortion
->getStart() ) );
519 ESelection
aEndSel( GetSelection( xPortion
->getEnd() ) );
521 // special case for empty portions with content or length one portions with content (fields)
522 if( (aStartSel
.nStartPos
== aEndSel
.nStartPos
) || ( (aStartSel
.nStartPos
== (aEndSel
.nStartPos
- 1)) && (nLen
> 1) ) )
524 for( sal_Int32 i
= 0; i
< nLen
; i
++ )
526 if( ndbg
< (nTextLen
+2) )
528 *pPos
++ = aStartSel
.nStartPos
;
529 *pPara
++ = aStartSel
.nStartPara
;
536 OSL_FAIL( "array overflow while searching" );
540 nLastPos
= aStartSel
.nStartPos
;
545 for( sal_Int32 i
= 0; i
< nLen
; i
++ )
547 if( ndbg
< (nTextLen
+2) )
549 *pPos
++ = aStartSel
.nStartPos
++;
550 *pPara
++ = aStartSel
.nStartPara
;
557 OSL_FAIL( "array overflow while searching" );
561 nLastPos
= aStartSel
.nStartPos
- 1;
562 DBG_ASSERT( aEndSel
.nStartPos
== aStartSel
.nStartPos
, "Search is not working" );
564 nLastPara
= aStartSel
.nStartPara
;
570 if( ndbg
< (nTextLen
+2) )
572 *pPos
++ = nLastPos
+ 1;
573 *pPara
++ = nLastPara
;
580 OSL_FAIL( "array overflow while searching" );
585 uno::Reference
< text::XText
> xFound
;
588 uno::Reference
< text::XTextRange
> xRangeRef( xText
, uno::UNO_QUERY
);
590 aSel
= GetSelection( xRangeRef
);
593 sal_Int32 nEndPos
= 0;
594 for( nStartPos
= 0; nStartPos
< nTextLen
; nStartPos
++ )
596 if( pConvertPara
[nStartPos
] == aSel
.nStartPara
&& pConvertPos
[nStartPos
] == aSel
.nStartPos
)
600 if( Search( aText
, nStartPos
, nEndPos
, pDescr
) )
602 if( nStartPos
<= nTextLen
&& nEndPos
<= nTextLen
)
604 ESelection
aSelection( pConvertPara
[nStartPos
], (sal_uInt16
)pConvertPos
[nStartPos
],
605 pConvertPara
[nEndPos
], (sal_uInt16
)pConvertPos
[nEndPos
] );
606 SvxUnoTextRange
*pRange
;
608 SvxUnoTextBase
* pParent
= SvxUnoTextBase::getImplementation( xParent
);
612 pRange
= new SvxUnoTextRange( *pParent
);
613 xFound
= (text::XText
*)pRange
;
614 pRange
->SetSelection(aSelection
);
620 OSL_FAIL("Array overflow while searching!");
624 delete[] pConvertPos
;
625 delete[] pConvertPara
;
627 return uno::Reference
< text::XTextRange
> ( xFound
, uno::UNO_QUERY
);
630 sal_Bool
SdUnoSearchReplaceShape::Search( const OUString
& rText
, sal_Int32
& nStartPos
, sal_Int32
& nEndPos
, SdUnoSearchReplaceDescriptor
* pDescr
) throw()
632 OUString
aSearchStr( pDescr
->getSearchString() );
633 OUString
aText( rText
);
635 if( !pDescr
->IsCaseSensitive() )
637 aText
= aText
.toAsciiLowerCase();
638 aSearchStr
= aSearchStr
.toAsciiLowerCase();
641 sal_Int32 nFound
= aText
.indexOf( aSearchStr
, nStartPos
);
645 nEndPos
= nFound
+ aSearchStr
.getLength();
647 if(pDescr
->IsWords())
649 if( (nStartPos
> 0 && aText
.getStr()[nStartPos
-1] > ' ') ||
650 (nEndPos
< aText
.getLength() && aText
.getStr()[nEndPos
] > ' ') )
653 return Search( aText
, nStartPos
, nEndPos
, pDescr
);
663 ESelection
SdUnoSearchReplaceShape::GetSelection( uno::Reference
< text::XTextRange
> xTextRange
) throw()
666 SvxUnoTextRangeBase
* pRange
= SvxUnoTextRangeBase::getImplementation( xTextRange
);
669 aSel
= pRange
->GetSelection();
674 uno::Reference
< drawing::XShape
> SdUnoSearchReplaceShape::GetShape( uno::Reference
< text::XTextRange
> xTextRange
) throw()
676 uno::Reference
< drawing::XShape
> xShape
;
680 uno::Reference
< text::XText
> xText( xTextRange
->getText() );
686 xShape
.set( xText
, uno::UNO_QUERY
);
689 uno::Reference
< text::XText
> xParent( xText
->getText() );
690 if(!xParent
.is() || xText
.get() == xParent
.get())
695 } while( !xShape
.is() );
702 /* ================================================================= */
703 /** this class holds the parameters and status of a search or replace
704 operation performed by class SdUnoSearchReplaceShape
707 UNO3_GETIMPLEMENTATION_IMPL( SdUnoSearchReplaceDescriptor
);
709 SdUnoSearchReplaceDescriptor::SdUnoSearchReplaceDescriptor( sal_Bool bReplace
) throw()
711 mpPropSet
= new SvxItemPropertySet(ImplGetSearchPropertyMap(), SdrObject::GetGlobalDrawObjectItemPool());
713 mbBackwards
= sal_False
;
714 mbCaseSensitive
= sal_False
;
717 mbReplace
= bReplace
;
720 SdUnoSearchReplaceDescriptor::~SdUnoSearchReplaceDescriptor() throw()
726 OUString SAL_CALL
SdUnoSearchReplaceDescriptor::getSearchString()
727 throw(::com::sun::star::uno::RuntimeException
)
732 void SAL_CALL
SdUnoSearchReplaceDescriptor::setSearchString( const OUString
& aString
)
733 throw(::com::sun::star::uno::RuntimeException
)
735 maSearchStr
= aString
;
738 // XReplaceDescriptor
739 OUString SAL_CALL
SdUnoSearchReplaceDescriptor::getReplaceString()
740 throw(::com::sun::star::uno::RuntimeException
)
745 void SAL_CALL
SdUnoSearchReplaceDescriptor::setReplaceString( const OUString
& aReplaceString
)
746 throw(::com::sun::star::uno::RuntimeException
)
748 maReplaceStr
= aReplaceString
;
752 uno::Reference
< ::com::sun::star::beans::XPropertySetInfo
> SAL_CALL
SdUnoSearchReplaceDescriptor::getPropertySetInfo()
753 throw(::com::sun::star::uno::RuntimeException
)
755 SolarMutexGuard aGuard
;
756 return mpPropSet
->getPropertySetInfo();
759 void SAL_CALL
SdUnoSearchReplaceDescriptor::setPropertyValue( const OUString
& aPropertyName
, const ::com::sun::star::uno::Any
& aValue
)
760 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
)
762 SolarMutexGuard aGuard
;
764 const SfxItemPropertySimpleEntry
* pEntry
= mpPropSet
->getPropertyMapEntry(aPropertyName
);
766 sal_Bool bOk
= sal_False
;
768 switch( pEntry
? pEntry
->nWID
: -1 )
770 case WID_SEARCH_BACKWARDS
:
771 bOk
= (aValue
>>= mbBackwards
);
773 case WID_SEARCH_CASE
:
774 bOk
= (aValue
>>= mbCaseSensitive
);
776 case WID_SEARCH_WORDS
:
777 bOk
= (aValue
>>= mbWords
);
780 throw beans::UnknownPropertyException();
784 throw lang::IllegalArgumentException();
787 uno::Any SAL_CALL
SdUnoSearchReplaceDescriptor::getPropertyValue( const OUString
& PropertyName
)
788 throw(::com::sun::star::beans::UnknownPropertyException
, ::com::sun::star::lang::WrappedTargetException
, ::com::sun::star::uno::RuntimeException
)
790 SolarMutexGuard aGuard
;
794 const SfxItemPropertySimpleEntry
* pEntry
= mpPropSet
->getPropertyMapEntry(PropertyName
);
796 switch( pEntry
? pEntry
->nWID
: -1 )
798 case WID_SEARCH_BACKWARDS
:
799 aAny
<<= (sal_Bool
)mbBackwards
;
801 case WID_SEARCH_CASE
:
802 aAny
<<= (sal_Bool
)mbCaseSensitive
;
804 case WID_SEARCH_WORDS
:
805 aAny
<<= (sal_Bool
)mbWords
;
808 throw beans::UnknownPropertyException();
814 void SAL_CALL
SdUnoSearchReplaceDescriptor::addPropertyChangeListener( const 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
) {}
815 void SAL_CALL
SdUnoSearchReplaceDescriptor::removePropertyChangeListener( const 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
) {}
816 void SAL_CALL
SdUnoSearchReplaceDescriptor::addVetoableChangeListener( const 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
) {}
817 void SAL_CALL
SdUnoSearchReplaceDescriptor::removeVetoableChangeListener( const 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
) {}
820 /* ================================================================= */
822 SdUnoFindAllAccess::SdUnoFindAllAccess( uno::Sequence
< uno::Reference
< uno::XInterface
> >& rSequence
) throw()
823 :maSequence( rSequence
)
827 SdUnoFindAllAccess::~SdUnoFindAllAccess() throw()
832 uno::Type SAL_CALL
SdUnoFindAllAccess::getElementType()
833 throw(::com::sun::star::uno::RuntimeException
)
835 return ITYPE( text::XTextRange
);
838 sal_Bool SAL_CALL
SdUnoFindAllAccess::hasElements()
839 throw(::com::sun::star::uno::RuntimeException
)
841 return maSequence
.getLength() > 0;
845 sal_Int32 SAL_CALL
SdUnoFindAllAccess::getCount()
846 throw(::com::sun::star::uno::RuntimeException
)
848 return maSequence
.getLength();
851 uno::Any SAL_CALL
SdUnoFindAllAccess::getByIndex( sal_Int32 Index
)
852 throw(::com::sun::star::lang::IndexOutOfBoundsException
, ::com::sun::star::lang::WrappedTargetException
, ::com::sun::star::uno::RuntimeException
)
856 if( Index
< 0 || Index
>= getCount() )
857 throw lang::IndexOutOfBoundsException();
859 const uno::Reference
< uno::XInterface
> *pRefs
= maSequence
.getConstArray();
861 aAny
<<= pRefs
[ Index
];
865 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */