Update ooo320-m1
[ooovba.git] / sc / source / ui / unoobj / notesuno.cxx
blob2e025f21c16d7daf1878cbc1099831106d9801bb
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
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 $
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 SvxItemPropertySet* lcl_GetAnnotationPropertySet()
69 static SfxItemPropertyMapEntry aAnnotationPropertyMap_Impl[] =
71 {0,0,0,0,0,0}
73 static SvxItemPropertySet aAnnotationPropertySet_Impl( aAnnotationPropertyMap_Impl );
74 return &aAnnotationPropertySet_Impl;
77 //------------------------------------------------------------------------
79 SC_SIMPLE_SERVICE_INFO( ScAnnotationObj, "ScAnnotationObj", "com.sun.star.sheet.CellAnnotation" )
80 SC_SIMPLE_SERVICE_INFO( ScAnnotationShapeObj, "ScAnnotationShapeObj", "com.sun.star.sheet.CellAnnotationShape" )
82 //------------------------------------------------------------------------
84 ScAnnotationObj::ScAnnotationObj(ScDocShell* pDocSh, const ScAddress& rPos) :
85 pDocShell( pDocSh ),
86 aCellPos( rPos ),
87 pUnoText( NULL )
89 pDocShell->GetDocument()->AddUnoObject(*this);
91 // pUnoText is allocated on demand (GetUnoText)
92 // can't be aggregated because getString/setString is handled here
95 ScAnnotationObj::~ScAnnotationObj()
97 if (pDocShell)
98 pDocShell->GetDocument()->RemoveUnoObject(*this);
100 if (pUnoText)
101 pUnoText->release();
104 void ScAnnotationObj::Notify( SfxBroadcaster&, const SfxHint& rHint )
106 if ( rHint.ISA( ScUpdateRefHint ) )
108 // const ScUpdateRefHint& rRef = (const ScUpdateRefHint&)rHint;
110 //! Ref-Update
112 else if ( rHint.ISA( SfxSimpleHint ) &&
113 ((const SfxSimpleHint&)rHint).GetId() == SFX_HINT_DYING )
115 pDocShell = NULL; // ungueltig geworden
120 // XChild
122 uno::Reference<uno::XInterface> SAL_CALL ScAnnotationObj::getParent() throw(uno::RuntimeException)
124 ScUnoGuard aGuard;
126 // Parent der Notiz ist die zugehoerige Zelle
127 //! existierendes Objekt finden und zurueckgeben ???
129 if (pDocShell)
130 return (cppu::OWeakObject*)new ScCellObj( pDocShell, aCellPos );
132 return NULL;
135 void SAL_CALL ScAnnotationObj::setParent( const uno::Reference<uno::XInterface>& /* Parent */ )
136 throw(lang::NoSupportException, uno::RuntimeException)
138 // hamma nich
139 //! Exception oder so ??!
142 // XSimpleText
144 uno::Reference<text::XTextCursor> SAL_CALL ScAnnotationObj::createTextCursor()
145 throw(uno::RuntimeException)
147 ScUnoGuard aGuard;
148 // Notizen brauchen keine Extrawurst
149 return GetUnoText().createTextCursor();
152 uno::Reference<text::XTextCursor> SAL_CALL ScAnnotationObj::createTextCursorByRange(
153 const uno::Reference<text::XTextRange>& aTextPosition )
154 throw(uno::RuntimeException)
156 ScUnoGuard aGuard;
157 // Notizen brauchen keine Extrawurst
158 return GetUnoText().createTextCursorByRange(aTextPosition);
161 rtl::OUString SAL_CALL ScAnnotationObj::getString() throw(uno::RuntimeException)
163 ScUnoGuard aGuard;
164 return GetUnoText().getString();
167 void SAL_CALL ScAnnotationObj::setString( const rtl::OUString& aText ) throw(uno::RuntimeException)
169 ScUnoGuard aGuard;
170 GetUnoText().setString(aText);
173 void SAL_CALL ScAnnotationObj::insertString( const uno::Reference<text::XTextRange>& xRange,
174 const rtl::OUString& aString, sal_Bool bAbsorb )
175 throw(uno::RuntimeException)
177 ScUnoGuard aGuard;
178 GetUnoText().insertString( xRange, aString, bAbsorb );
181 void SAL_CALL ScAnnotationObj::insertControlCharacter( const uno::Reference<text::XTextRange>& xRange,
182 sal_Int16 nControlCharacter, sal_Bool bAbsorb )
183 throw(lang::IllegalArgumentException, uno::RuntimeException)
185 ScUnoGuard aGuard;
186 GetUnoText().insertControlCharacter( xRange, nControlCharacter, bAbsorb );
189 uno::Reference<text::XText> SAL_CALL ScAnnotationObj::getText() throw(uno::RuntimeException)
191 ScUnoGuard aGuard;
192 return GetUnoText().getText();
195 uno::Reference<text::XTextRange> SAL_CALL ScAnnotationObj::getStart() throw(uno::RuntimeException)
197 ScUnoGuard aGuard;
198 return GetUnoText().getStart();
201 uno::Reference<text::XTextRange> SAL_CALL ScAnnotationObj::getEnd() throw(uno::RuntimeException)
203 ScUnoGuard aGuard;
204 return GetUnoText().getEnd();
207 // XSheetAnnotation
209 table::CellAddress SAL_CALL ScAnnotationObj::getPosition() throw(uno::RuntimeException)
211 ScUnoGuard aGuard;
212 table::CellAddress aAdr;
213 aAdr.Sheet = aCellPos.Tab();
214 aAdr.Column = aCellPos.Col();
215 aAdr.Row = aCellPos.Row();
216 return aAdr;
219 rtl::OUString SAL_CALL ScAnnotationObj::getAuthor() throw(uno::RuntimeException)
221 ScUnoGuard aGuard;
222 const ScPostIt* pNote = ImplGetNote();
223 return pNote ? pNote->GetAuthor() : rtl::OUString();
226 rtl::OUString SAL_CALL ScAnnotationObj::getDate() throw(uno::RuntimeException)
228 ScUnoGuard aGuard;
229 const ScPostIt* pNote = ImplGetNote();
230 return pNote ? pNote->GetDate() : rtl::OUString();
233 sal_Bool SAL_CALL ScAnnotationObj::getIsVisible() throw(uno::RuntimeException)
235 ScUnoGuard aGuard;
236 const ScPostIt* pNote = ImplGetNote();
237 return pNote && pNote->IsCaptionShown();
240 void SAL_CALL ScAnnotationObj::setIsVisible( sal_Bool bIsVisible ) throw(uno::RuntimeException)
242 ScUnoGuard aGuard;
243 // show/hide note with undo action
244 if( pDocShell )
245 pDocShell->GetDocFunc().ShowNote( aCellPos, bIsVisible );
248 // XSheetAnnotationShapeSupplier
249 uno::Reference < drawing::XShape > SAL_CALL ScAnnotationObj::getAnnotationShape()
250 throw(::com::sun::star::uno::RuntimeException)
252 ScUnoGuard aGuard;
253 return new ScAnnotationShapeObj(pDocShell, aCellPos);
256 SvxUnoText& ScAnnotationObj::GetUnoText()
258 if (!pUnoText)
260 ScAnnotationEditSource aEditSource( pDocShell, aCellPos );
261 pUnoText = new SvxUnoText( &aEditSource, lcl_GetAnnotationPropertySet(),
262 uno::Reference<text::XText>() );
263 pUnoText->acquire();
265 return *pUnoText;
268 const ScPostIt* ScAnnotationObj::ImplGetNote() const
270 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_GetAnnotationPropertySet(),
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->GetOrCreateCaption( aCellPos ) )
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 //------------------------------------------------------------------------