sync master with lastest vba changes
[ooovba.git] / sc / source / ui / unoobj / notesuno.cxx
blobe699dfd1e8509654810635f4f7e874c3be8ab4ad
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: notesuno.cxx,v $
10 * $Revision: 1.11.128.4 $
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_sc.hxx"
33 #include <svtools/smplhint.hxx>
36 #include "rangelst.hxx"
37 #include <svx/unotext.hxx>
39 #include "notesuno.hxx"
40 #include "textuno.hxx"
41 #include "cellsuno.hxx" // getParent
42 #include "docsh.hxx"
43 #include "docfunc.hxx"
44 #include "hints.hxx"
45 #include "editsrc.hxx"
46 #include "miscuno.hxx"
48 // setVisible:
49 #include <svx/svdundo.hxx>
50 #include "drwlayer.hxx"
51 #include "detfunc.hxx"
52 #include "undocell.hxx"
53 #include "unoguard.hxx"
54 #include "userdat.hxx"
55 #include <svx/outlobj.hxx>
56 #include <svx/unoshape.hxx>
57 #include <svx/svdocapt.hxx>
58 #include <svx/svditer.hxx>
59 #include <svx/svdpage.hxx>
60 #include <com/sun/star/drawing/XShapeDescriptor.hpp>
62 using namespace com::sun::star;
64 //------------------------------------------------------------------------
66 // keine Properties fuer Text in Notizen
67 const SfxItemPropertyMap* lcl_GetAnnotationPropertyMap()
69 static SfxItemPropertyMap aAnnotationPropertyMap_Impl[] =
71 {0,0,0,0,0,0}
73 return aAnnotationPropertyMap_Impl;
76 //------------------------------------------------------------------------
78 SC_SIMPLE_SERVICE_INFO( ScAnnotationObj, "ScAnnotationObj", "com.sun.star.sheet.CellAnnotation" )
79 SC_SIMPLE_SERVICE_INFO( ScAnnotationShapeObj, "ScAnnotationShapeObj", "com.sun.star.sheet.CellAnnotationShape" )
81 //------------------------------------------------------------------------
83 ScAnnotationObj::ScAnnotationObj(ScDocShell* pDocSh, const ScAddress& rPos) :
84 pDocShell( pDocSh ),
85 aCellPos( rPos ),
86 pUnoText( NULL )
88 pDocShell->GetDocument()->AddUnoObject(*this);
90 // pUnoText is allocated on demand (GetUnoText)
91 // can't be aggregated because getString/setString is handled here
94 ScAnnotationObj::~ScAnnotationObj()
96 if (pDocShell)
97 pDocShell->GetDocument()->RemoveUnoObject(*this);
99 if (pUnoText)
100 pUnoText->release();
103 void ScAnnotationObj::Notify( SfxBroadcaster&, const SfxHint& rHint )
105 if ( rHint.ISA( ScUpdateRefHint ) )
107 // const ScUpdateRefHint& rRef = (const ScUpdateRefHint&)rHint;
109 //! Ref-Update
111 else if ( rHint.ISA( SfxSimpleHint ) &&
112 ((const SfxSimpleHint&)rHint).GetId() == SFX_HINT_DYING )
114 pDocShell = NULL; // ungueltig geworden
119 // XChild
121 uno::Reference<uno::XInterface> SAL_CALL ScAnnotationObj::getParent() throw(uno::RuntimeException)
123 ScUnoGuard aGuard;
125 // Parent der Notiz ist die zugehoerige Zelle
126 //! existierendes Objekt finden und zurueckgeben ???
128 if (pDocShell)
129 return (cppu::OWeakObject*)new ScCellObj( pDocShell, aCellPos );
131 return NULL;
134 void SAL_CALL ScAnnotationObj::setParent( const uno::Reference<uno::XInterface>& /* Parent */ )
135 throw(lang::NoSupportException, uno::RuntimeException)
137 // hamma nich
138 //! Exception oder so ??!
141 // XSimpleText
143 uno::Reference<text::XTextCursor> SAL_CALL ScAnnotationObj::createTextCursor()
144 throw(uno::RuntimeException)
146 ScUnoGuard aGuard;
147 // Notizen brauchen keine Extrawurst
148 return GetUnoText().createTextCursor();
151 uno::Reference<text::XTextCursor> SAL_CALL ScAnnotationObj::createTextCursorByRange(
152 const uno::Reference<text::XTextRange>& aTextPosition )
153 throw(uno::RuntimeException)
155 ScUnoGuard aGuard;
156 // Notizen brauchen keine Extrawurst
157 return GetUnoText().createTextCursorByRange(aTextPosition);
160 rtl::OUString SAL_CALL ScAnnotationObj::getString() throw(uno::RuntimeException)
162 ScUnoGuard aGuard;
163 return GetUnoText().getString();
166 void SAL_CALL ScAnnotationObj::setString( const rtl::OUString& aText ) throw(uno::RuntimeException)
168 ScUnoGuard aGuard;
169 GetUnoText().setString(aText);
172 void SAL_CALL ScAnnotationObj::insertString( const uno::Reference<text::XTextRange>& xRange,
173 const rtl::OUString& aString, sal_Bool bAbsorb )
174 throw(uno::RuntimeException)
176 ScUnoGuard aGuard;
177 GetUnoText().insertString( xRange, aString, bAbsorb );
180 void SAL_CALL ScAnnotationObj::insertControlCharacter( const uno::Reference<text::XTextRange>& xRange,
181 sal_Int16 nControlCharacter, sal_Bool bAbsorb )
182 throw(lang::IllegalArgumentException, uno::RuntimeException)
184 ScUnoGuard aGuard;
185 GetUnoText().insertControlCharacter( xRange, nControlCharacter, bAbsorb );
188 uno::Reference<text::XText> SAL_CALL ScAnnotationObj::getText() throw(uno::RuntimeException)
190 ScUnoGuard aGuard;
191 return GetUnoText().getText();
194 uno::Reference<text::XTextRange> SAL_CALL ScAnnotationObj::getStart() throw(uno::RuntimeException)
196 ScUnoGuard aGuard;
197 return GetUnoText().getStart();
200 uno::Reference<text::XTextRange> SAL_CALL ScAnnotationObj::getEnd() throw(uno::RuntimeException)
202 ScUnoGuard aGuard;
203 return GetUnoText().getEnd();
206 // XSheetAnnotation
208 table::CellAddress SAL_CALL ScAnnotationObj::getPosition() throw(uno::RuntimeException)
210 ScUnoGuard aGuard;
211 table::CellAddress aAdr;
212 aAdr.Sheet = aCellPos.Tab();
213 aAdr.Column = aCellPos.Col();
214 aAdr.Row = aCellPos.Row();
215 return aAdr;
218 rtl::OUString SAL_CALL ScAnnotationObj::getAuthor() throw(uno::RuntimeException)
220 ScUnoGuard aGuard;
221 const ScPostIt* pNote = ImplGetNote();
222 return pNote ? pNote->GetAuthor() : EMPTY_STRING;
225 rtl::OUString SAL_CALL ScAnnotationObj::getDate() throw(uno::RuntimeException)
227 ScUnoGuard aGuard;
228 const ScPostIt* pNote = ImplGetNote();
229 return pNote ? pNote->GetDate() : EMPTY_STRING;
232 sal_Bool SAL_CALL ScAnnotationObj::getIsVisible() throw(uno::RuntimeException)
234 ScUnoGuard aGuard;
235 const ScPostIt* pNote = ImplGetNote();
236 return pNote && pNote->IsCaptionShown();
239 void SAL_CALL ScAnnotationObj::setIsVisible( sal_Bool bIsVisible ) throw(uno::RuntimeException)
241 ScUnoGuard aGuard;
242 // show/hide note with undo action
243 if( pDocShell )
244 pDocShell->GetDocFunc().ShowNote( aCellPos, bIsVisible );
247 // XSheetAnnotationShapeSupplier
248 uno::Reference < drawing::XShape > SAL_CALL ScAnnotationObj::getAnnotationShape()
249 throw(::com::sun::star::uno::RuntimeException)
251 ScUnoGuard aGuard;
252 return new ScAnnotationShapeObj(pDocShell, aCellPos);
255 SvxUnoText& ScAnnotationObj::GetUnoText()
257 if (!pUnoText)
259 ScAnnotationEditSource aEditSource( pDocShell, aCellPos );
260 pUnoText = new SvxUnoText( &aEditSource, lcl_GetAnnotationPropertyMap(),
261 uno::Reference<text::XText>() );
262 pUnoText->acquire();
264 return *pUnoText;
267 const ScPostIt* ScAnnotationObj::ImplGetNote() const
269 return pDocShell ? pDocShell->GetDocument()->GetNote( aCellPos ) : 0;
272 //------------------------------------------------------------------------
274 ScAnnotationShapeObj::ScAnnotationShapeObj(ScDocShell* pDocSh, const ScAddress& rPos) :
275 pDocShell( pDocSh ),
276 aCellPos( rPos ),
277 pUnoText( NULL )
279 pDocShell->GetDocument()->AddUnoObject(*this);
281 // pUnoText is allocated on demand (GetUnoText)
282 // can't be aggregated because getString/setString is handled here
285 SvxUnoText& ScAnnotationShapeObj::GetUnoText()
287 if (!pUnoText)
289 ScAnnotationEditSource aEditSource( pDocShell, aCellPos );
290 pUnoText = new SvxUnoText( &aEditSource, lcl_GetAnnotationPropertyMap(),
291 uno::Reference<text::XText>() );
292 pUnoText->acquire();
294 return *pUnoText;
297 uno::Reference < drawing::XShape > ScAnnotationShapeObj::GetXShape()
299 if (!xShape.is())
300 if( ScPostIt* pNote = pDocShell->GetDocument()->GetNote( aCellPos ) )
301 if( SdrObject* pCaption = pNote->GetCaption() )
302 xShape.set( pCaption->getUnoShape(), uno::UNO_QUERY );
303 return xShape;
306 ScAnnotationShapeObj::~ScAnnotationShapeObj()
308 if (pDocShell)
309 pDocShell->GetDocument()->RemoveUnoObject(*this);
310 if (pUnoText)
311 pUnoText->release();
314 void ScAnnotationShapeObj::Notify( SfxBroadcaster&, const SfxHint& rHint )
316 if ( rHint.ISA( ScUpdateRefHint ) )
318 // const ScUpdateRefHint& rRef = (const ScUpdateRefHint&)rHint;
320 //! Ref-Update
322 else if ( rHint.ISA( SfxSimpleHint ) &&
323 ((const SfxSimpleHint&)rHint).GetId() == SFX_HINT_DYING )
325 pDocShell = NULL; // ungueltig geworden
330 // XChild
332 uno::Reference<uno::XInterface> SAL_CALL ScAnnotationShapeObj::getParent() throw(uno::RuntimeException)
334 ScUnoGuard aGuard;
336 // Parent der Notiz ist die zugehoerige Zelle
337 //! existierendes Objekt finden und zurueckgeben ???
339 if (pDocShell)
340 return (cppu::OWeakObject*)new ScCellObj( pDocShell, aCellPos );
342 return NULL;
345 void SAL_CALL ScAnnotationShapeObj::setParent( const uno::Reference<uno::XInterface>& /* Parent */ )
346 throw(lang::NoSupportException, uno::RuntimeException)
348 // hamma nich
349 //! Exception oder so ??!
352 // XElementAccess
353 uno::Type SAL_CALL ScAnnotationShapeObj::getElementType( ) throw (uno::RuntimeException)
355 ScUnoGuard aGuard;
357 return GetUnoText().getElementType();
360 sal_Bool SAL_CALL ScAnnotationShapeObj::hasElements( ) throw (uno::RuntimeException)
362 ScUnoGuard aGuard;
364 return GetUnoText().hasElements();
367 // XEnumerationAccess
368 uno::Reference< container::XEnumeration > SAL_CALL ScAnnotationShapeObj::createEnumeration( ) throw (uno::RuntimeException)
370 ScUnoGuard aGuard;
372 return GetUnoText().createEnumeration();
375 // XTextRangeMover
376 void SAL_CALL ScAnnotationShapeObj::moveTextRange( const uno::Reference< text::XTextRange >& xRange, sal_Int16 nParagraphs )
377 throw (uno::RuntimeException)
379 ScUnoGuard aGuard;
381 GetUnoText().moveTextRange( xRange, nParagraphs );
384 // XText
385 void SAL_CALL ScAnnotationShapeObj::insertTextContent( const uno::Reference< text::XTextRange >& xRange,
386 const uno::Reference< text::XTextContent >& xContent, sal_Bool bAbsorb )
387 throw (lang::IllegalArgumentException,
388 uno::RuntimeException)
390 ScUnoGuard aGuard;
392 GetUnoText().insertTextContent( xRange, xContent, bAbsorb );
395 void SAL_CALL ScAnnotationShapeObj::removeTextContent( const uno::Reference< text::XTextContent >& xContent )
396 throw (container::NoSuchElementException,
397 uno::RuntimeException)
399 ScUnoGuard aGuard;
401 GetUnoText().removeTextContent( xContent );
404 // XSimpleText
406 uno::Reference<text::XTextCursor> SAL_CALL ScAnnotationShapeObj::createTextCursor()
407 throw(uno::RuntimeException)
409 ScUnoGuard aGuard;
410 // Notizen brauchen keine Extrawurst
411 return GetUnoText().createTextCursor();
414 uno::Reference<text::XTextCursor> SAL_CALL ScAnnotationShapeObj::createTextCursorByRange(
415 const uno::Reference<text::XTextRange>& aTextPosition )
416 throw(uno::RuntimeException)
418 ScUnoGuard aGuard;
419 // Notizen brauchen keine Extrawurst
420 return GetUnoText().createTextCursorByRange(aTextPosition);
423 rtl::OUString SAL_CALL ScAnnotationShapeObj::getString() throw(uno::RuntimeException)
425 ScUnoGuard aGuard;
426 return GetUnoText().getString();
429 void SAL_CALL ScAnnotationShapeObj::setString( const rtl::OUString& aText ) throw(uno::RuntimeException)
431 ScUnoGuard aGuard;
432 GetUnoText().setString(aText);
435 void SAL_CALL ScAnnotationShapeObj::insertString( const uno::Reference<text::XTextRange>& xRange,
436 const rtl::OUString& aString, sal_Bool bAbsorb )
437 throw(uno::RuntimeException)
439 ScUnoGuard aGuard;
440 GetUnoText().insertString( xRange, aString, bAbsorb );
443 void SAL_CALL ScAnnotationShapeObj::insertControlCharacter( const uno::Reference<text::XTextRange>& xRange,
444 sal_Int16 nControlCharacter, sal_Bool bAbsorb )
445 throw(lang::IllegalArgumentException, uno::RuntimeException)
447 ScUnoGuard aGuard;
448 GetUnoText().insertControlCharacter( xRange, nControlCharacter, bAbsorb );
451 uno::Reference<text::XText> SAL_CALL ScAnnotationShapeObj::getText() throw(uno::RuntimeException)
453 ScUnoGuard aGuard;
454 return GetUnoText().getText();
457 uno::Reference<text::XTextRange> SAL_CALL ScAnnotationShapeObj::getStart() throw(uno::RuntimeException)
459 ScUnoGuard aGuard;
460 return GetUnoText().getStart();
463 uno::Reference<text::XTextRange> SAL_CALL ScAnnotationShapeObj::getEnd() throw(uno::RuntimeException)
465 ScUnoGuard aGuard;
466 return GetUnoText().getEnd();
469 // XShapeDescriptor
470 ::rtl::OUString SAL_CALL ScAnnotationShapeObj::getShapeType( )
471 throw (uno::RuntimeException)
473 ScUnoGuard aGuard;
474 uno::Reference < drawing::XShapeDescriptor > xDesc(GetXShape(), uno::UNO_QUERY);
475 if (xDesc.is())
476 return xDesc->getShapeType();
477 return rtl::OUString();
480 // XShape
481 awt::Point SAL_CALL ScAnnotationShapeObj::getPosition( )
482 throw (uno::RuntimeException)
484 ScUnoGuard aGuard;
485 GetXShape();
486 return xShape.is() ? xShape->getPosition() : awt::Point();
489 void SAL_CALL ScAnnotationShapeObj::setPosition( const awt::Point& aPosition )
490 throw (uno::RuntimeException)
492 ScUnoGuard aGuard;
493 GetXShape();
494 if( xShape.is() )
495 xShape->setPosition(aPosition);
498 awt::Size SAL_CALL ScAnnotationShapeObj::getSize( )
499 throw (uno::RuntimeException)
501 ScUnoGuard aGuard;
502 GetXShape();
503 return xShape.is() ? xShape->getSize() : awt::Size();
506 void SAL_CALL ScAnnotationShapeObj::setSize( const awt::Size& aSize )
507 throw (beans::PropertyVetoException, uno::RuntimeException)
509 ScUnoGuard aGuard;
510 GetXShape();
511 if( xShape.is() )
512 xShape->setSize(aSize);
515 // XPropertyState
516 beans::PropertyState SAL_CALL ScAnnotationShapeObj::getPropertyState( const rtl::OUString& PropertyName )
517 throw (beans::UnknownPropertyException,
518 uno::RuntimeException)
520 ScUnoGuard aGuard;
521 uno::Reference < beans::XPropertyState > xState (GetXShape(), uno::UNO_QUERY);
522 if (xState.is())
523 return xState->getPropertyState( PropertyName );
524 return beans::PropertyState();
527 uno::Sequence< beans::PropertyState > SAL_CALL ScAnnotationShapeObj::getPropertyStates(
528 const uno::Sequence< rtl::OUString >& aPropertyName )
529 throw (beans::UnknownPropertyException,
530 uno::RuntimeException)
532 ScUnoGuard aGuard;
533 uno::Reference < beans::XPropertyState > xState (GetXShape(), uno::UNO_QUERY);
534 if (xState.is())
535 return xState->getPropertyStates( aPropertyName );
536 return uno::Sequence< beans::PropertyState >();
539 void SAL_CALL ScAnnotationShapeObj::setPropertyToDefault( const ::rtl::OUString& PropertyName )
540 throw (::com::sun::star::beans::UnknownPropertyException,
541 ::com::sun::star::uno::RuntimeException)
543 ScUnoGuard aGuard;
544 uno::Reference < beans::XPropertyState > xState (GetXShape(), uno::UNO_QUERY);
545 if (xState.is())
546 xState->setPropertyToDefault( PropertyName );
549 uno::Any SAL_CALL ScAnnotationShapeObj::getPropertyDefault( const rtl::OUString& aPropertyName )
550 throw (beans::UnknownPropertyException,
551 lang::WrappedTargetException, uno::RuntimeException)
553 ScUnoGuard aGuard;
554 uno::Reference < beans::XPropertyState > xState (GetXShape(), uno::UNO_QUERY);
555 if (xState.is())
556 return xState->getPropertyDefault( aPropertyName );
557 return uno::Any();
560 // XPropertySet
561 uno::Reference< beans::XPropertySetInfo > SAL_CALL ScAnnotationShapeObj::getPropertySetInfo( )
562 throw (uno::RuntimeException)
564 ScUnoGuard aGuard;
565 uno::Reference < beans::XPropertySet > xProp (GetXShape(), uno::UNO_QUERY);
566 if (xProp.is())
567 return xProp->getPropertySetInfo();
568 return uno::Reference< beans::XPropertySetInfo >();
571 void SAL_CALL ScAnnotationShapeObj::setPropertyValue( const rtl::OUString& aPropertyName, const uno::Any& aValue )
572 throw (beans::UnknownPropertyException,
573 beans::PropertyVetoException,
574 lang::IllegalArgumentException,
575 lang::WrappedTargetException,
576 uno::RuntimeException)
578 ScUnoGuard aGuard;
579 uno::Reference < beans::XPropertySet > xProp (GetXShape(), uno::UNO_QUERY);
580 if (xProp.is())
581 xProp->setPropertyValue( aPropertyName, aValue );
584 uno::Any SAL_CALL ScAnnotationShapeObj::getPropertyValue( const rtl::OUString& PropertyName )
585 throw (beans::UnknownPropertyException,
586 lang::WrappedTargetException,
587 uno::RuntimeException)
589 ScUnoGuard aGuard;
590 uno::Reference < beans::XPropertySet > xProp (GetXShape(), uno::UNO_QUERY);
591 if (xProp.is())
592 return xProp->getPropertyValue( PropertyName );
593 return uno::Any();
596 void SAL_CALL ScAnnotationShapeObj::addPropertyChangeListener( const rtl::OUString& aPropertyName,
597 const uno::Reference< beans::XPropertyChangeListener >& xListener )
598 throw (beans::UnknownPropertyException,
599 lang::WrappedTargetException,
600 uno::RuntimeException)
602 ScUnoGuard aGuard;
603 uno::Reference < beans::XPropertySet > xProp (GetXShape(), uno::UNO_QUERY);
604 if (xProp.is())
605 return xProp->addPropertyChangeListener( aPropertyName, xListener );
608 void SAL_CALL ScAnnotationShapeObj::removePropertyChangeListener( const rtl::OUString& aPropertyName,
609 const uno::Reference< beans::XPropertyChangeListener >& aListener )
610 throw (beans::UnknownPropertyException,
611 lang::WrappedTargetException,
612 uno::RuntimeException)
614 ScUnoGuard aGuard;
615 uno::Reference < beans::XPropertySet > xProp (GetXShape(), uno::UNO_QUERY);
616 if (xProp.is())
617 return xProp->removePropertyChangeListener( aPropertyName, aListener );
620 void SAL_CALL ScAnnotationShapeObj::addVetoableChangeListener( const rtl::OUString& PropertyName,
621 const uno::Reference< beans::XVetoableChangeListener >& aListener )
622 throw (beans::UnknownPropertyException,
623 lang::WrappedTargetException,
624 uno::RuntimeException)
626 ScUnoGuard aGuard;
627 uno::Reference < beans::XPropertySet > xProp (GetXShape(), uno::UNO_QUERY);
628 if (xProp.is())
629 return xProp->addVetoableChangeListener( PropertyName, aListener );
632 void SAL_CALL ScAnnotationShapeObj::removeVetoableChangeListener( const rtl::OUString& PropertyName,
633 const uno::Reference< beans::XVetoableChangeListener >& aListener )
634 throw (beans::UnknownPropertyException,
635 lang::WrappedTargetException,
636 uno::RuntimeException)
638 ScUnoGuard aGuard;
639 uno::Reference < beans::XPropertySet > xProp (GetXShape(), uno::UNO_QUERY);
640 if (xProp.is())
641 return xProp->removeVetoableChangeListener( PropertyName, aListener );
644 // XMultiPropertySet
645 void SAL_CALL ScAnnotationShapeObj::setPropertyValues( const uno::Sequence< rtl::OUString >& aPropertyNames,
646 const uno::Sequence< uno::Any >& aValues )
647 throw (beans::PropertyVetoException,
648 lang::IllegalArgumentException,
649 lang::WrappedTargetException,
650 uno::RuntimeException)
652 ScUnoGuard aGuard;
653 uno::Reference < beans::XMultiPropertySet > xProp (GetXShape(), uno::UNO_QUERY);
654 if (xProp.is())
655 xProp->setPropertyValues( aPropertyNames, aValues );
658 uno::Sequence< uno::Any > SAL_CALL ScAnnotationShapeObj::getPropertyValues(
659 const uno::Sequence< rtl::OUString >& aPropertyNames )
660 throw (uno::RuntimeException)
662 ScUnoGuard aGuard;
663 uno::Reference < beans::XMultiPropertySet > xProp (GetXShape(), uno::UNO_QUERY);
664 if (xProp.is())
665 return xProp->getPropertyValues( aPropertyNames );
666 return uno::Sequence< uno::Any >();
669 void SAL_CALL ScAnnotationShapeObj::addPropertiesChangeListener( const uno::Sequence< rtl::OUString >& aPropertyNames,
670 const uno::Reference< beans::XPropertiesChangeListener >& xListener )
671 throw (uno::RuntimeException)
673 ScUnoGuard aGuard;
674 uno::Reference < beans::XMultiPropertySet > xProp (GetXShape(), uno::UNO_QUERY);
675 if (xProp.is())
676 xProp->addPropertiesChangeListener( aPropertyNames, xListener );
679 void SAL_CALL ScAnnotationShapeObj::removePropertiesChangeListener( const uno::Reference< beans::XPropertiesChangeListener >& xListener )
680 throw (uno::RuntimeException)
682 ScUnoGuard aGuard;
683 uno::Reference < beans::XMultiPropertySet > xProp (GetXShape(), uno::UNO_QUERY);
684 if (xProp.is())
685 xProp->removePropertiesChangeListener( xListener );
688 void SAL_CALL ScAnnotationShapeObj::firePropertiesChangeEvent( const uno::Sequence< rtl::OUString >& aPropertyNames,
689 const uno::Reference< beans::XPropertiesChangeListener >& xListener )
690 throw (uno::RuntimeException)
692 ScUnoGuard aGuard;
693 uno::Reference < beans::XMultiPropertySet > xProp (GetXShape(), uno::UNO_QUERY);
694 if (xProp.is())
695 xProp->firePropertiesChangeEvent( aPropertyNames, xListener );
698 // XComponent
699 void SAL_CALL ScAnnotationShapeObj::dispose( ) throw (uno::RuntimeException)
701 ScUnoGuard aGuard;
702 uno::Reference < lang::XComponent > xComp (GetXShape(), uno::UNO_QUERY);
703 if (xComp.is())
704 xComp->dispose();
705 if (xShape.is())
706 xShape.clear();
709 void SAL_CALL ScAnnotationShapeObj::addEventListener( const uno::Reference< lang::XEventListener >& xListener )
710 throw (uno::RuntimeException)
712 ScUnoGuard aGuard;
713 uno::Reference < lang::XComponent > xComp (GetXShape(), uno::UNO_QUERY);
714 if (xComp.is())
715 xComp->addEventListener( xListener );
718 void SAL_CALL ScAnnotationShapeObj::removeEventListener( const uno::Reference< lang::XEventListener >& aListener )
719 throw (uno::RuntimeException)
721 ScUnoGuard aGuard;
722 uno::Reference < lang::XComponent > xComp (GetXShape(), uno::UNO_QUERY);
723 if (xComp.is())
724 xComp->removeEventListener( aListener );
727 //------------------------------------------------------------------------