Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 :
20 : #include <vcl/svapp.hxx>
21 : #include <osl/mutex.hxx>
22 : #include <rtl/instance.hxx>
23 :
24 : #include <editeng/eeitem.hxx>
25 : #include <editeng/flditem.hxx>
26 : #include <editeng/unofield.hxx>
27 : #include <editeng/unotext.hxx>
28 : #include <comphelper/servicehelper.hxx>
29 : #include <comphelper/serviceinfohelper.hxx>
30 : #include <cppuhelper/supportsservice.hxx>
31 :
32 : using namespace ::rtl;
33 : using namespace ::cppu;
34 : using namespace ::com::sun::star;
35 :
36 : #define QUERYINT( xint ) \
37 : if( rType == ::getCppuType((const uno::Reference< xint >*)0) ) \
38 : return uno::makeAny(uno::Reference< xint >(this))
39 :
40 :
41 : // SvxUnoTextContentEnumeration
42 :
43 :
44 0 : SvxUnoTextContentEnumeration::SvxUnoTextContentEnumeration( const SvxUnoTextBase& _rText ) throw()
45 0 : : mrText( _rText )
46 : {
47 0 : mxParentText = const_cast<SvxUnoTextBase*>(&_rText);
48 0 : if( mrText.GetEditSource() )
49 0 : mpEditSource = mrText.GetEditSource()->Clone();
50 : else
51 0 : mpEditSource = NULL;
52 0 : mnNextParagraph = 0;
53 0 : }
54 :
55 0 : SvxUnoTextContentEnumeration::~SvxUnoTextContentEnumeration() throw()
56 : {
57 0 : delete mpEditSource;
58 0 : }
59 :
60 : // container::XEnumeration
61 0 : sal_Bool SAL_CALL SvxUnoTextContentEnumeration::hasMoreElements(void)
62 : throw( uno::RuntimeException, std::exception )
63 : {
64 0 : SolarMutexGuard aGuard;
65 0 : if( mpEditSource && mpEditSource->GetTextForwarder() )
66 0 : return mnNextParagraph < mpEditSource->GetTextForwarder()->GetParagraphCount();
67 : else
68 0 : return sal_False;
69 : }
70 :
71 0 : uno::Any SvxUnoTextContentEnumeration::nextElement(void) throw( container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException, std::exception )
72 : {
73 0 : SolarMutexGuard aGuard;
74 :
75 0 : if(!hasMoreElements())
76 0 : throw container::NoSuchElementException();
77 :
78 0 : SvxUnoTextContent* pContent = 0;
79 :
80 0 : const SvxUnoTextRangeBaseList& rRanges( mpEditSource->getRanges() );
81 0 : SvxUnoTextRangeBaseList::const_iterator aIter;
82 0 : for( aIter = rRanges.begin(); (aIter != rRanges.end()) && (pContent == 0); ++aIter )
83 : {
84 0 : SvxUnoTextContent* pIterContent = dynamic_cast< SvxUnoTextContent* >( (*aIter ) );
85 0 : if( pIterContent && (pIterContent->mnParagraph == mnNextParagraph) )
86 0 : pContent = pIterContent;
87 : }
88 :
89 0 : if( pContent == 0 )
90 0 : pContent = new SvxUnoTextContent( mrText, mnNextParagraph );
91 :
92 0 : mnNextParagraph++;
93 :
94 0 : uno::Reference< text::XTextContent > xRef( pContent );
95 0 : return uno::makeAny( xRef );
96 : }
97 :
98 :
99 : // class SvxUnoTextContent
100 :
101 :
102 0 : SvxUnoTextContent::SvxUnoTextContent( const SvxUnoTextBase& rText, sal_Int32 nPara ) throw()
103 : : SvxUnoTextRangeBase(rText)
104 : , mnParagraph(nPara)
105 : , mrParentText(rText)
106 : , maDisposeListeners(maDisposeContainerMutex)
107 0 : , mbDisposing( false )
108 : {
109 0 : mxParentText = const_cast<SvxUnoTextBase*>(&rText);
110 0 : if( GetEditSource() && GetEditSource()->GetTextForwarder() )
111 0 : SetSelection( ESelection( mnParagraph,0, mnParagraph, GetEditSource()->GetTextForwarder()->GetTextLen( mnParagraph ) ) );
112 0 : }
113 :
114 0 : SvxUnoTextContent::SvxUnoTextContent( const SvxUnoTextContent& rContent ) throw()
115 : : SvxUnoTextRangeBase(rContent)
116 : , text::XTextContent()
117 : , container::XEnumerationAccess()
118 : , lang::XTypeProvider()
119 : , cppu::OWeakAggObject()
120 : , mrParentText(rContent.mrParentText)
121 : , maDisposeListeners(maDisposeContainerMutex)
122 0 : , mbDisposing( false )
123 : {
124 0 : mxParentText = rContent.mxParentText;
125 0 : mnParagraph = rContent.mnParagraph;
126 0 : SetSelection( rContent.GetSelection() );
127 0 : }
128 :
129 0 : SvxUnoTextContent::~SvxUnoTextContent() throw()
130 : {
131 0 : }
132 :
133 : // uno::XInterface
134 0 : uno::Any SAL_CALL SvxUnoTextContent::queryAggregation( const uno::Type & rType ) throw( uno::RuntimeException, std::exception )
135 : {
136 0 : QUERYINT( text::XTextRange );
137 0 : else QUERYINT( beans::XMultiPropertyStates );
138 0 : else QUERYINT( beans::XPropertySet );
139 0 : else QUERYINT( beans::XMultiPropertySet );
140 0 : else QUERYINT( beans::XPropertyState );
141 0 : else QUERYINT( text::XTextContent );
142 0 : else QUERYINT( text::XTextRangeCompare );
143 0 : else QUERYINT( lang::XComponent );
144 0 : else QUERYINT( container::XEnumerationAccess );
145 0 : else QUERYINT( container::XElementAccess );
146 0 : else QUERYINT( lang::XServiceInfo );
147 0 : else QUERYINT( lang::XTypeProvider );
148 0 : else QUERYINT( lang::XUnoTunnel );
149 : else
150 0 : return OWeakAggObject::queryAggregation( rType );
151 : }
152 :
153 0 : uno::Any SAL_CALL SvxUnoTextContent::queryInterface( const uno::Type & rType ) throw( uno::RuntimeException, std::exception )
154 : {
155 0 : return OWeakAggObject::queryInterface(rType);
156 : }
157 :
158 0 : void SAL_CALL SvxUnoTextContent::acquire() throw( )
159 : {
160 0 : OWeakAggObject::acquire();
161 0 : }
162 :
163 0 : void SAL_CALL SvxUnoTextContent::release() throw( )
164 : {
165 0 : OWeakAggObject::release();
166 0 : }
167 :
168 : // XTypeProvider
169 :
170 : namespace
171 : {
172 : struct theSvxUnoTextContentTypes :
173 : public rtl::StaticWithInit<uno::Sequence<uno::Type>, theSvxUnoTextContentTypes>
174 : {
175 0 : uno::Sequence<uno::Type> operator () ()
176 : {
177 0 : uno::Sequence< uno::Type > aTypeSequence;
178 :
179 0 : aTypeSequence.realloc( 11 ); // !DANGER! keep this updated
180 0 : uno::Type* pTypes = aTypeSequence.getArray();
181 :
182 0 : *pTypes++ = ::getCppuType(( const uno::Reference< text::XTextRange >*)0);
183 0 : *pTypes++ = ::getCppuType(( const uno::Reference< beans::XPropertySet >*)0);
184 0 : *pTypes++ = ::getCppuType(( const uno::Reference< beans::XMultiPropertySet >*)0);
185 0 : *pTypes++ = ::getCppuType(( const uno::Reference< beans::XMultiPropertyStates >*)0);
186 0 : *pTypes++ = ::getCppuType(( const uno::Reference< beans::XPropertyState >*)0);
187 0 : *pTypes++ = ::getCppuType(( const uno::Reference< text::XTextRangeCompare >*)0);
188 0 : *pTypes++ = ::getCppuType(( const uno::Reference< text::XTextContent >*)0);
189 0 : *pTypes++ = ::getCppuType(( const uno::Reference< container::XEnumerationAccess >*)0);
190 0 : *pTypes++ = ::getCppuType(( const uno::Reference< lang::XServiceInfo >*)0);
191 0 : *pTypes++ = ::getCppuType(( const uno::Reference< lang::XTypeProvider >*)0);
192 0 : *pTypes++ = ::getCppuType(( const uno::Reference< lang::XUnoTunnel >*)0);
193 :
194 0 : return aTypeSequence;
195 : }
196 : };
197 : }
198 :
199 0 : uno::Sequence< uno::Type > SAL_CALL SvxUnoTextContent::getTypes()
200 : throw (uno::RuntimeException, std::exception)
201 : {
202 0 : return theSvxUnoTextContentTypes::get();
203 : }
204 :
205 0 : uno::Sequence< sal_Int8 > SAL_CALL SvxUnoTextContent::getImplementationId()
206 : throw (uno::RuntimeException, std::exception)
207 : {
208 0 : return css::uno::Sequence<sal_Int8>();
209 : }
210 :
211 : // text::XTextRange
212 :
213 0 : uno::Reference< text::XText > SAL_CALL SvxUnoTextContent::getText()
214 : throw(uno::RuntimeException, std::exception)
215 : {
216 0 : return mxParentText;
217 : }
218 :
219 : // text::XTextContent
220 0 : void SAL_CALL SvxUnoTextContent::attach( const uno::Reference< text::XTextRange >& )
221 : throw(lang::IllegalArgumentException, uno::RuntimeException, std::exception)
222 : {
223 0 : }
224 :
225 0 : uno::Reference< text::XTextRange > SAL_CALL SvxUnoTextContent::getAnchor() throw( uno::RuntimeException, std::exception )
226 : {
227 0 : return uno::Reference< text::XTextRange >::query( mxParentText );
228 : }
229 :
230 : // XComponent
231 :
232 0 : void SAL_CALL SvxUnoTextContent::dispose()
233 : throw(uno::RuntimeException, std::exception)
234 : {
235 0 : SolarMutexGuard aGuard;
236 :
237 0 : if( mbDisposing )
238 0 : return; // catched a recursion
239 :
240 0 : mbDisposing = true;
241 :
242 0 : lang::EventObject aEvt;
243 0 : aEvt.Source = *(OWeakAggObject*) this;
244 0 : maDisposeListeners.disposeAndClear(aEvt);
245 :
246 0 : if( mxParentText.is() )
247 0 : mxParentText->removeTextContent( this );
248 : }
249 :
250 0 : void SAL_CALL SvxUnoTextContent::addEventListener( const uno::Reference< lang::XEventListener >& xListener )
251 : throw(uno::RuntimeException, std::exception)
252 : {
253 0 : maDisposeListeners.addInterface(xListener);
254 0 : }
255 :
256 0 : void SAL_CALL SvxUnoTextContent::removeEventListener( const uno::Reference< lang::XEventListener >& aListener )
257 : throw(uno::RuntimeException, std::exception)
258 : {
259 0 : maDisposeListeners.removeInterface(aListener);
260 0 : }
261 :
262 : // XEnumerationAccess
263 :
264 0 : uno::Reference< container::XEnumeration > SAL_CALL SvxUnoTextContent::createEnumeration( )
265 : throw(uno::RuntimeException, std::exception)
266 : {
267 0 : SolarMutexGuard aGuard;
268 :
269 0 : return new SvxUnoTextRangeEnumeration( mrParentText, mnParagraph );
270 : }
271 :
272 : // XElementAccess ( container::XEnumerationAccess )
273 :
274 0 : uno::Type SAL_CALL SvxUnoTextContent::getElementType()
275 : throw(uno::RuntimeException, std::exception)
276 : {
277 0 : return ::getCppuType((const uno::Reference< text::XTextRange >*)0);
278 : }
279 :
280 0 : sal_Bool SAL_CALL SvxUnoTextContent::hasElements()
281 : throw(uno::RuntimeException, std::exception)
282 : {
283 0 : SolarMutexGuard aGuard;
284 :
285 0 : SvxTextForwarder* pForwarder = GetEditSource() ? GetEditSource()->GetTextForwarder() : NULL;
286 0 : if( pForwarder )
287 : {
288 0 : std::vector<sal_Int32> aPortions;
289 0 : pForwarder->GetPortions( mnParagraph, aPortions );
290 0 : return !aPortions.empty();
291 : }
292 : else
293 : {
294 0 : return 0;
295 0 : }
296 : }
297 :
298 : // XPropertySet
299 :
300 0 : void SAL_CALL SvxUnoTextContent::setPropertyValue( const OUString& aPropertyName, const uno::Any& aValue )
301 : throw(beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException, std::exception)
302 : {
303 0 : _setPropertyValue( aPropertyName, aValue, mnParagraph );
304 0 : }
305 :
306 0 : uno::Any SAL_CALL SvxUnoTextContent::getPropertyValue( const OUString& PropertyName )
307 : throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException, std::exception)
308 : {
309 0 : return _getPropertyValue( PropertyName, mnParagraph );
310 : }
311 :
312 : // XMultiPropertySet
313 0 : void SAL_CALL SvxUnoTextContent::setPropertyValues( const uno::Sequence< OUString >& aPropertyNames, const uno::Sequence< uno::Any >& aValues ) throw (beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException, std::exception)
314 : {
315 0 : _setPropertyValues( aPropertyNames, aValues, mnParagraph );
316 0 : }
317 :
318 0 : uno::Sequence< uno::Any > SAL_CALL SvxUnoTextContent::getPropertyValues( const uno::Sequence< OUString >& aPropertyNames ) throw (uno::RuntimeException, std::exception)
319 : {
320 0 : return _getPropertyValues( aPropertyNames, mnParagraph );
321 : }
322 :
323 : /*// XTolerantMultiPropertySet
324 : uno::Sequence< beans::SetPropertyTolerantFailed > SAL_CALL SvxUnoTextContent::setPropertyValuesTolerant( const uno::Sequence< OUString >& aPropertyNames, const uno::Sequence< uno::Any >& aValues ) throw (lang::IllegalArgumentException, uno::RuntimeException)
325 : {
326 : return _setPropertyValuesTolerant(aPropertyNames, aValues, mnParagraph);
327 : }
328 :
329 : uno::Sequence< beans::GetPropertyTolerantResult > SAL_CALL SvxUnoTextContent::getPropertyValuesTolerant( const uno::Sequence< OUString >& aPropertyNames ) throw (uno::RuntimeException)
330 : {
331 : return _getPropertyValuesTolerant(aPropertyNames, mnParagraph);
332 : }
333 :
334 : uno::Sequence< beans::GetDirectPropertyTolerantResult > SAL_CALL SvxUnoTextContent::getDirectPropertyValuesTolerant( const uno::Sequence< OUString >& aPropertyNames )
335 : throw (uno::RuntimeException)
336 : {
337 : return _getDirectPropertyValuesTolerant(aPropertyNames, mnParagraph);
338 : }*/
339 :
340 : // beans::XPropertyState
341 0 : beans::PropertyState SAL_CALL SvxUnoTextContent::getPropertyState( const OUString& PropertyName )
342 : throw(beans::UnknownPropertyException, uno::RuntimeException, std::exception)
343 : {
344 0 : return _getPropertyState( PropertyName, mnParagraph );
345 : }
346 :
347 0 : uno::Sequence< beans::PropertyState > SAL_CALL SvxUnoTextContent::getPropertyStates( const uno::Sequence< OUString >& aPropertyName )
348 : throw(beans::UnknownPropertyException, uno::RuntimeException, std::exception)
349 : {
350 0 : return _getPropertyStates( aPropertyName, mnParagraph );
351 : }
352 :
353 0 : void SAL_CALL SvxUnoTextContent::setPropertyToDefault( const OUString& PropertyName )
354 : throw(beans::UnknownPropertyException, uno::RuntimeException, std::exception)
355 : {
356 0 : _setPropertyToDefault( PropertyName, mnParagraph );
357 0 : }
358 :
359 : // lang::XServiceInfo
360 :
361 0 : OUString SAL_CALL SvxUnoTextContent::getImplementationName()
362 : throw(uno::RuntimeException, std::exception)
363 : {
364 0 : return OUString("SvxUnoTextContent");
365 : }
366 :
367 0 : uno::Sequence< OUString > SAL_CALL SvxUnoTextContent::getSupportedServiceNames()
368 : throw(uno::RuntimeException, std::exception)
369 : {
370 0 : uno::Sequence< OUString > aSeq( SvxUnoTextRangeBase::getSupportedServiceNames() );
371 : comphelper::ServiceInfoHelper::addToSequence( aSeq, 5, "com.sun.star.style.ParagraphProperties",
372 : "com.sun.star.style.ParagraphPropertiesComplex",
373 : "com.sun.star.style.ParagraphPropertiesAsian",
374 : "com.sun.star.text.TextContent",
375 0 : "com.sun.star.text.Paragraph");
376 0 : return aSeq;
377 : }
378 :
379 :
380 : // class SvxUnoTextRangeEnumeration
381 :
382 :
383 0 : SvxUnoTextRangeEnumeration::SvxUnoTextRangeEnumeration( const SvxUnoTextBase& rText, sal_Int32 nPara ) throw()
384 : : mxParentText( const_cast<SvxUnoTextBase*>(&rText) ),
385 : mrParentText( rText ),
386 : mnParagraph( nPara ),
387 0 : mnNextPortion( 0 )
388 : {
389 0 : mpEditSource = rText.GetEditSource() ? rText.GetEditSource()->Clone() : NULL;
390 :
391 0 : if( mpEditSource && mpEditSource->GetTextForwarder() )
392 : {
393 0 : mpPortions = new std::vector<sal_Int32>;
394 0 : mpEditSource->GetTextForwarder()->GetPortions( nPara, *mpPortions );
395 : }
396 : else
397 : {
398 0 : mpPortions = NULL;
399 : }
400 0 : }
401 :
402 0 : SvxUnoTextRangeEnumeration::~SvxUnoTextRangeEnumeration() throw()
403 : {
404 0 : delete mpEditSource;
405 0 : delete mpPortions;
406 0 : }
407 :
408 : // container::XEnumeration
409 :
410 0 : sal_Bool SAL_CALL SvxUnoTextRangeEnumeration::hasMoreElements()
411 : throw(uno::RuntimeException, std::exception)
412 : {
413 0 : SolarMutexGuard aGuard;
414 :
415 0 : return mpPortions && mnNextPortion < mpPortions->size();
416 : }
417 :
418 0 : uno::Any SAL_CALL SvxUnoTextRangeEnumeration::nextElement()
419 : throw(container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException, std::exception)
420 : {
421 0 : SolarMutexGuard aGuard;
422 :
423 0 : if( mpPortions == NULL || mnNextPortion >= mpPortions->size() )
424 0 : throw container::NoSuchElementException();
425 :
426 0 : sal_uInt16 nStartPos = 0;
427 0 : if (mnNextPortion > 0)
428 0 : nStartPos = mpPortions->at(mnNextPortion-1);
429 0 : sal_uInt16 nEndPos = mpPortions->at(mnNextPortion);
430 0 : ESelection aSel( mnParagraph, nStartPos, mnParagraph, nEndPos );
431 :
432 0 : uno::Reference< text::XTextRange > xRange;
433 :
434 0 : const SvxUnoTextRangeBaseList& rRanges( mpEditSource->getRanges() );
435 :
436 0 : SvxUnoTextRange* pRange = 0;
437 :
438 0 : SvxUnoTextRangeBaseList::const_iterator aIter;
439 0 : for( aIter = rRanges.begin(); (aIter != rRanges.end()) && (pRange == 0); ++aIter )
440 : {
441 0 : SvxUnoTextRange* pIterRange = dynamic_cast< SvxUnoTextRange* >( (*aIter ) );
442 0 : if( pIterRange && pIterRange->mbPortion && (aSel.IsEqual( pIterRange->maSelection ) ) )
443 0 : pRange = pIterRange;
444 : }
445 :
446 0 : if( pRange == 0 )
447 : {
448 0 : pRange = new SvxUnoTextRange( mrParentText, true );
449 0 : pRange->SetSelection(aSel);
450 : }
451 :
452 0 : xRange = pRange;
453 :
454 0 : mnNextPortion++;
455 :
456 0 : return uno::makeAny( xRange );
457 : }
458 :
459 0 : SvxUnoTextCursor::SvxUnoTextCursor( const SvxUnoTextBase& rText ) throw()
460 : : SvxUnoTextRangeBase(rText),
461 0 : mxParentText( const_cast<SvxUnoTextBase*>(&rText) )
462 : {
463 0 : }
464 :
465 0 : SvxUnoTextCursor::SvxUnoTextCursor( const SvxUnoTextCursor& rCursor ) throw()
466 : : SvxUnoTextRangeBase(rCursor)
467 : , text::XTextCursor()
468 : , lang::XTypeProvider()
469 : , cppu::OWeakAggObject()
470 0 : , mxParentText(rCursor.mxParentText)
471 : {
472 0 : }
473 :
474 0 : SvxUnoTextCursor::~SvxUnoTextCursor() throw()
475 : {
476 0 : }
477 :
478 : // Comment out automatically - [getIdlClass(es) or queryInterface]
479 : // Please use the XTypeProvider!
480 : //sal_Bool SvxUnoTextCursor::queryInterface( uno::Uik aUIK, Reference< uno::XInterface > & xRef)
481 0 : uno::Any SAL_CALL SvxUnoTextCursor::queryAggregation( const uno::Type & rType )
482 : throw(uno::RuntimeException, std::exception)
483 : {
484 0 : if( rType == ::getCppuType((const uno::Reference< text::XTextRange >*)0) )
485 0 : return uno::makeAny(uno::Reference< text::XTextRange >((text::XText*)(this)));
486 0 : else QUERYINT( text::XTextCursor );
487 0 : else QUERYINT( beans::XMultiPropertyStates );
488 0 : else QUERYINT( beans::XPropertySet );
489 0 : else QUERYINT( beans::XMultiPropertySet );
490 0 : else QUERYINT( beans::XPropertyState );
491 0 : else QUERYINT( text::XTextRangeCompare );
492 0 : else QUERYINT( lang::XServiceInfo );
493 0 : else QUERYINT( lang::XTypeProvider );
494 0 : else QUERYINT( lang::XUnoTunnel );
495 : else
496 0 : return OWeakAggObject::queryAggregation( rType );
497 : }
498 :
499 0 : uno::Any SAL_CALL SvxUnoTextCursor::queryInterface( const uno::Type & rType )
500 : throw(uno::RuntimeException, std::exception)
501 : {
502 0 : return OWeakAggObject::queryInterface(rType);
503 : }
504 :
505 0 : void SAL_CALL SvxUnoTextCursor::acquire() throw ( )
506 : {
507 0 : OWeakAggObject::acquire();
508 0 : }
509 :
510 0 : void SAL_CALL SvxUnoTextCursor::release() throw ( )
511 : {
512 0 : OWeakAggObject::release();
513 0 : }
514 :
515 : namespace
516 : {
517 : struct theSvxUnoTextCursorTypes :
518 : public rtl::StaticWithInit<uno::Sequence<uno::Type>, theSvxUnoTextCursorTypes>
519 : {
520 0 : uno::Sequence<uno::Type> operator () ()
521 : {
522 0 : uno::Sequence< uno::Type > aTypeSequence;
523 :
524 0 : aTypeSequence.realloc( 10 ); // !DANGER! keep this updated
525 0 : uno::Type* pTypes = aTypeSequence.getArray();
526 :
527 0 : *pTypes++ = ::getCppuType(( const uno::Reference< text::XTextRange >*)0);
528 0 : *pTypes++ = ::getCppuType(( const uno::Reference< text::XTextCursor >*)0);
529 0 : *pTypes++ = ::getCppuType(( const uno::Reference< beans::XPropertySet >*)0);
530 0 : *pTypes++ = ::getCppuType(( const uno::Reference< beans::XMultiPropertySet >*)0);
531 0 : *pTypes++ = ::getCppuType(( const uno::Reference< beans::XMultiPropertyStates >*)0);
532 0 : *pTypes++ = ::getCppuType(( const uno::Reference< beans::XPropertyState >*)0);
533 0 : *pTypes++ = ::getCppuType(( const uno::Reference< text::XTextRangeCompare >*)0);
534 0 : *pTypes++ = ::getCppuType(( const uno::Reference< lang::XServiceInfo >*)0);
535 0 : *pTypes++ = ::getCppuType(( const uno::Reference< lang::XTypeProvider >*)0);
536 0 : *pTypes++ = ::getCppuType(( const uno::Reference< lang::XUnoTunnel >*)0);
537 :
538 0 : return aTypeSequence;
539 : }
540 : };
541 : }
542 :
543 : // XTypeProvider
544 0 : uno::Sequence< uno::Type > SAL_CALL SvxUnoTextCursor::getTypes()
545 : throw(uno::RuntimeException, std::exception)
546 : {
547 0 : return theSvxUnoTextCursorTypes::get();
548 : }
549 :
550 0 : uno::Sequence< sal_Int8 > SAL_CALL SvxUnoTextCursor::getImplementationId()
551 : throw (uno::RuntimeException, std::exception)
552 : {
553 0 : return css::uno::Sequence<sal_Int8>();
554 : }
555 :
556 : // text::XTextCursor
557 0 : void SAL_CALL SvxUnoTextCursor::collapseToStart()
558 : throw(uno::RuntimeException, std::exception)
559 : {
560 0 : SolarMutexGuard aGuard;
561 0 : CollapseToStart();
562 0 : }
563 :
564 0 : void SAL_CALL SvxUnoTextCursor::collapseToEnd()
565 : throw(uno::RuntimeException, std::exception)
566 : {
567 0 : SolarMutexGuard aGuard;
568 0 : CollapseToEnd();
569 0 : }
570 :
571 0 : sal_Bool SAL_CALL SvxUnoTextCursor::isCollapsed()
572 : throw(uno::RuntimeException, std::exception)
573 : {
574 0 : SolarMutexGuard aGuard;
575 0 : return IsCollapsed();
576 : }
577 :
578 0 : sal_Bool SAL_CALL SvxUnoTextCursor::goLeft( sal_Int16 nCount, sal_Bool bExpand )
579 : throw(uno::RuntimeException, std::exception)
580 : {
581 0 : SolarMutexGuard aGuard;
582 0 : return GoLeft( nCount, bExpand );
583 : }
584 :
585 0 : sal_Bool SAL_CALL SvxUnoTextCursor::goRight( sal_Int16 nCount, sal_Bool bExpand )
586 : throw(uno::RuntimeException, std::exception)
587 : {
588 0 : SolarMutexGuard aGuard;
589 0 : return GoRight( nCount, bExpand );
590 : }
591 :
592 0 : void SAL_CALL SvxUnoTextCursor::gotoStart( sal_Bool bExpand )
593 : throw(uno::RuntimeException, std::exception)
594 : {
595 0 : SolarMutexGuard aGuard;
596 0 : GotoStart( bExpand );
597 0 : }
598 :
599 0 : void SAL_CALL SvxUnoTextCursor::gotoEnd( sal_Bool bExpand )
600 : throw(uno::RuntimeException, std::exception)
601 : {
602 0 : SolarMutexGuard aGuard;
603 0 : GotoEnd( bExpand );
604 0 : }
605 :
606 0 : void SAL_CALL SvxUnoTextCursor::gotoRange( const uno::Reference< text::XTextRange >& xRange, sal_Bool bExpand )
607 : throw(uno::RuntimeException, std::exception)
608 : {
609 0 : if( !xRange.is() )
610 0 : return;
611 :
612 0 : SvxUnoTextRangeBase* pRange = SvxUnoTextRangeBase::getImplementation( xRange );
613 :
614 0 : if( pRange )
615 : {
616 0 : ESelection aNewSel = pRange->GetSelection();
617 :
618 0 : if( bExpand )
619 : {
620 0 : const ESelection& rOldSel = GetSelection();
621 0 : aNewSel.nStartPara = rOldSel.nStartPara;
622 0 : aNewSel.nStartPos = rOldSel.nStartPos;
623 : }
624 :
625 0 : SetSelection( aNewSel );
626 : }
627 : }
628 :
629 : // text::XTextRange (rest in SvxTextRange)
630 0 : uno::Reference< text::XText > SAL_CALL SvxUnoTextCursor::getText(void) throw( uno::RuntimeException, std::exception )
631 : {
632 0 : return mxParentText;
633 : }
634 :
635 0 : uno::Reference< text::XTextRange > SAL_CALL SvxUnoTextCursor::getStart()
636 : throw(uno::RuntimeException, std::exception)
637 : {
638 0 : return SvxUnoTextRangeBase::getStart();
639 : }
640 :
641 0 : uno::Reference< text::XTextRange > SAL_CALL SvxUnoTextCursor::getEnd()
642 : throw(uno::RuntimeException, std::exception)
643 : {
644 0 : return SvxUnoTextRangeBase::getEnd();
645 : }
646 :
647 0 : OUString SAL_CALL SvxUnoTextCursor::getString() throw( uno::RuntimeException, std::exception )
648 : {
649 0 : return SvxUnoTextRangeBase::getString();
650 : }
651 :
652 0 : void SAL_CALL SvxUnoTextCursor::setString( const OUString& aString ) throw(uno::RuntimeException, std::exception)
653 : {
654 0 : SvxUnoTextRangeBase::setString(aString);
655 0 : }
656 : // lang::XServiceInfo
657 0 : OUString SAL_CALL SvxUnoTextCursor::getImplementationName() throw(uno::RuntimeException, std::exception)
658 : {
659 0 : return OUString("SvxUnoTextCursor");
660 : }
661 :
662 0 : sal_Bool SAL_CALL SvxUnoTextCursor::supportsService( const OUString& ServiceName ) throw(uno::RuntimeException, std::exception)
663 : {
664 0 : return cppu::supportsService( this, ServiceName );
665 : }
666 :
667 0 : uno::Sequence< OUString > SAL_CALL SvxUnoTextCursor::getSupportedServiceNames() throw(uno::RuntimeException, std::exception)
668 : {
669 0 : uno::Sequence< OUString > aSeq( SvxUnoTextRangeBase::getSupportedServiceNames() );
670 : comphelper::ServiceInfoHelper::addToSequence( aSeq, 4,"com.sun.star.style.ParagraphProperties",
671 : "com.sun.star.style.ParagraphPropertiesComplex",
672 : "com.sun.star.style.ParagraphPropertiesAsian",
673 0 : "com.sun.star.text.TextCursor");
674 0 : return aSeq;
675 : }
676 :
677 :
678 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|