summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorDaniel Rentz [dr] <daniel.rentz@oracle.com>2011-01-05 20:06:03 +0100
committerMichael Meeks <michael.meeks@suse.com>2012-12-04 07:17:06 +0000
commit1b39a9b8dc6023b50f266a4ab07ed43ebee16ea2 (patch)
tree6ae3c952cbc2b57f5fe680c3b9b3fc8a2db8a578 /sc
parentc40fa0a254530945db54bac192c7a52400238988 (diff)
dr78: #i96587# remove ScAnnotationShapeObj class, use generic ScShapeObj
for note captions. Conflicts: sc/inc/notesuno.hxx sc/inc/shapeuno.hxx sc/source/ui/unoobj/notesuno.cxx sc/source/ui/unoobj/shapeuno.cxx
Diffstat (limited to 'sc')
-rw-r--r--sc/inc/notesuno.hxx196
-rw-r--r--sc/inc/shapeuno.hxx13
-rw-r--r--sc/source/ui/unoobj/notesuno.cxx497
-rw-r--r--sc/source/ui/unoobj/shapeuno.cxx54
4 files changed, 81 insertions, 679 deletions
diff --git a/sc/inc/notesuno.hxx b/sc/inc/notesuno.hxx
index 42e79d5bcee7..0b1e06aee95b 100644
--- a/sc/inc/notesuno.hxx
+++ b/sc/inc/notesuno.hxx
@@ -29,18 +29,14 @@
#ifndef SC_NOTESUNO_HXX
#define SC_NOTESUNO_HXX
-#include "address.hxx"
-#include <svl/lstner.hxx>
#include <com/sun/star/sheet/XSheetAnnotation.hpp>
#include <com/sun/star/sheet/XSheetAnnotationShapeSupplier.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/container/XChild.hpp>
#include <com/sun/star/text/XSimpleText.hpp>
-#include <com/sun/star/text/XTextRangeMover.hpp>
-#include <com/sun/star/drawing/XShape.hpp>
#include <cppuhelper/implbase5.hxx>
-#include <cppuhelper/implbase10.hxx>
-
+#include <svl/lstner.hxx>
+#include "address.hxx"
class ScDocShell;
class SvxUnoText;
@@ -130,194 +126,6 @@ private:
SvxUnoText* pUnoText;
};
-class ScAnnotationShapeObj : public cppu::WeakImplHelper10<
- com::sun::star::lang::XComponent,
- com::sun::star::container::XChild,
- com::sun::star::text::XText,
- com::sun::star::container::XEnumerationAccess,
- com::sun::star::text::XTextRangeMover,
- com::sun::star::drawing::XShape,
- com::sun::star::beans::XPropertySet,
- com::sun::star::beans::XMultiPropertySet,
- com::sun::star::beans::XPropertyState,
- com::sun::star::lang::XServiceInfo >,
- public SfxListener
-{
-private:
- ScDocShell* pDocShell;
- ScAddress aCellPos;
- SvxUnoText* pUnoText;
- com::sun::star::uno::Reference < com::sun::star::drawing::XShape > xShape;
-
-private:
- SvxUnoText& GetUnoText();
- com::sun::star::uno::Reference < com::sun::star::drawing::XShape > GetXShape();
-
-public:
- ScAnnotationShapeObj(ScDocShell* pDocSh, const ScAddress& rPos);
- virtual ~ScAnnotationShapeObj();
-
- virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
-
- // XChild
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL
- getParent() throw(::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setParent( const ::com::sun::star::uno::Reference<
- ::com::sun::star::uno::XInterface >& Parent )
- throw(::com::sun::star::lang::NoSupportException,
- ::com::sun::star::uno::RuntimeException);
-
- // XElementAccess
- virtual ::com::sun::star::uno::Type SAL_CALL getElementType( ) throw (::com::sun::star::uno::RuntimeException);
- virtual ::sal_Bool SAL_CALL hasElements( ) throw (::com::sun::star::uno::RuntimeException);
-
- // XEnumerationAccess
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumeration > SAL_CALL
- createEnumeration( ) throw (::com::sun::star::uno::RuntimeException);
-
- // XTextRangeMover
- virtual void SAL_CALL moveTextRange( const ::com::sun::star::uno::Reference<
- ::com::sun::star::text::XTextRange >& xRange,
- ::sal_Int16 nParagraphs )
- throw (::com::sun::star::uno::RuntimeException);
-
- // XText
- virtual void SAL_CALL insertTextContent( const ::com::sun::star::uno::Reference<
- ::com::sun::star::text::XTextRange >& xRange,
- const ::com::sun::star::uno::Reference<
- ::com::sun::star::text::XTextContent >& xContent,
- ::sal_Bool bAbsorb )
- throw (::com::sun::star::lang::IllegalArgumentException,
- ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL removeTextContent( const ::com::sun::star::uno::Reference<
- ::com::sun::star::text::XTextContent >& xContent )
- throw (::com::sun::star::container::NoSuchElementException,
- ::com::sun::star::uno::RuntimeException);
-
- // XSimpleText
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextCursor > SAL_CALL
- createTextCursor() throw(::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextCursor > SAL_CALL
- createTextCursorByRange( const ::com::sun::star::uno::Reference<
- ::com::sun::star::text::XTextRange >& aTextPosition )
- throw(::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL insertString( const ::com::sun::star::uno::Reference<
- ::com::sun::star::text::XTextRange >& xRange,
- const ::rtl::OUString& aString, sal_Bool bAbsorb )
- throw(::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL insertControlCharacter( const ::com::sun::star::uno::Reference<
- ::com::sun::star::text::XTextRange >& xRange,
- sal_Int16 nControlCharacter, sal_Bool bAbsorb )
- throw(::com::sun::star::lang::IllegalArgumentException,
- ::com::sun::star::uno::RuntimeException);
-
- // XTextRange
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XText > SAL_CALL
- getText() throw(::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > SAL_CALL
- getStart() throw(::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > SAL_CALL
- getEnd() throw(::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getString() throw(::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setString( const ::rtl::OUString& aString )
- throw(::com::sun::star::uno::RuntimeException);
-
- // XShapeDescriptor
- virtual ::rtl::OUString SAL_CALL getShapeType( ) throw (::com::sun::star::uno::RuntimeException);
-
- // XShape
- virtual ::com::sun::star::awt::Point SAL_CALL getPosition( ) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setPosition( const ::com::sun::star::awt::Point& aPosition ) throw (::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::awt::Size SAL_CALL getSize( ) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setSize( const ::com::sun::star::awt::Size& aSize )
- throw (::com::sun::star::beans::PropertyVetoException, ::com::sun::star::uno::RuntimeException);
-
- // XPropertyState
- virtual ::com::sun::star::beans::PropertyState SAL_CALL getPropertyState( const ::rtl::OUString& PropertyName )
- throw (::com::sun::star::beans::UnknownPropertyException,
- ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyState > SAL_CALL getPropertyStates(
- const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyName )
- throw (::com::sun::star::beans::UnknownPropertyException,
- ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setPropertyToDefault( const ::rtl::OUString& PropertyName )
- throw (::com::sun::star::beans::UnknownPropertyException,
- ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Any SAL_CALL getPropertyDefault( const ::rtl::OUString& aPropertyName )
- throw (::com::sun::star::beans::UnknownPropertyException,
- ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
-
- // XPropertySet
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( )
- throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue )
- 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);
- virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& PropertyName )
- throw (::com::sun::star::beans::UnknownPropertyException,
- ::com::sun::star::lang::WrappedTargetException,
- ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName,
- const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener )
- throw (::com::sun::star::beans::UnknownPropertyException,
- ::com::sun::star::lang::WrappedTargetException,
- ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& aPropertyName,
- const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& aListener )
- throw (::com::sun::star::beans::UnknownPropertyException,
- ::com::sun::star::lang::WrappedTargetException,
- ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& PropertyName,
- const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener )
- throw (::com::sun::star::beans::UnknownPropertyException,
- ::com::sun::star::lang::WrappedTargetException,
- ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& PropertyName,
- const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener )
- throw (::com::sun::star::beans::UnknownPropertyException,
- ::com::sun::star::lang::WrappedTargetException,
- ::com::sun::star::uno::RuntimeException);
-
- // XMultiPropertySet
- virtual void SAL_CALL setPropertyValues( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames,
- const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aValues )
- throw (::com::sun::star::beans::PropertyVetoException,
- ::com::sun::star::lang::IllegalArgumentException,
- ::com::sun::star::lang::WrappedTargetException,
- ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > SAL_CALL getPropertyValues(
- const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames )
- throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL addPropertiesChangeListener( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames,
- const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener >& xListener )
- throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL removePropertiesChangeListener( const ::com::sun::star::uno::Reference<
- ::com::sun::star::beans::XPropertiesChangeListener >& xListener )
- throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL firePropertiesChangeEvent( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames,
- const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener >& xListener )
- throw (::com::sun::star::uno::RuntimeException);
-
- // XComponent
- virtual void SAL_CALL dispose( ) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener )
- throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener )
- throw (::com::sun::star::uno::RuntimeException);
-
- // XServiceInfo
- virtual ::rtl::OUString SAL_CALL getImplementationName()
- throw(::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName )
- throw(::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames()
- throw(::com::sun::star::uno::RuntimeException);
-};
-
-
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/inc/shapeuno.hxx b/sc/inc/shapeuno.hxx
index c376f14e2f53..53f3902a072e 100644
--- a/sc/inc/shapeuno.hxx
+++ b/sc/inc/shapeuno.hxx
@@ -37,6 +37,7 @@
#include <com/sun/star/lang/XTypeProvider.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/document/XEventsSupplier.hpp>
+#include <com/sun/star/container/XChild.hpp>
#include <cppuhelper/implbase5.hxx>
#include <cppuhelper/implbase1.hxx>
@@ -68,8 +69,11 @@ typedef ::cppu::WeakImplHelper5 < ::com::sun::star::beans::XPropertySet
> ScShapeObj_Base;
typedef ::cppu::ImplHelper1 < ::com::sun::star::text::XText
> ScShapeObj_TextBase;
+typedef ::cppu::ImplHelper1 < ::com::sun::star::container::XChild
+ > ScShapeObj_ChildBase;
class ScShapeObj :public ScShapeObj_Base
,public ScShapeObj_TextBase
+ ,public ScShapeObj_ChildBase
{
private:
friend ScMacroInfo* ScShapeObj_getShapeHyperMacroInfo( ScShapeObj* pShape, sal_Bool bCreate );
@@ -79,7 +83,8 @@ private:
::com::sun::star::beans::XPropertyState* pShapePropertyState;
::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > mxPropSetInfo;
com::sun::star::uno::Sequence< sal_Int8 >* pImplementationId;
- sal_Bool bIsTextShape;
+ bool bIsTextShape;
+ bool bIsNoteCaption;
bool bInitializedNotifier;
SdrObject* GetSdrObject() const throw();
@@ -222,6 +227,12 @@ public:
virtual void SAL_CALL setString( const ::rtl::OUString& aString )
throw(::com::sun::star::uno::RuntimeException);
+ // XChild
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL getParent()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setParent( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& xParent )
+ throw (::com::sun::star::lang::NoSupportException, ::com::sun::star::uno::RuntimeException);
+
// XTypeProvider
virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes()
throw(::com::sun::star::uno::RuntimeException);
diff --git a/sc/source/ui/unoobj/notesuno.cxx b/sc/source/ui/unoobj/notesuno.cxx
index 297f7c43c42e..763a3fc62134 100644
--- a/sc/source/ui/unoobj/notesuno.cxx
+++ b/sc/source/ui/unoobj/notesuno.cxx
@@ -26,38 +26,22 @@
*
************************************************************************/
-#include <svl/smplhint.hxx>
-
+#include "notesuno.hxx"
-#include "rangelst.hxx"
+#include <svl/smplhint.hxx>
#include <editeng/unotext.hxx>
#include <svx/svdpool.hxx>
#include <svx/svdobj.hxx>
-#include <vcl/svapp.hxx>
-#include "notesuno.hxx"
-#include "textuno.hxx"
-#include "cellsuno.hxx" // getParent
+#include <svx/unoshape.hxx>
+#include <svx/svdocapt.hxx>
+
+#include "postit.hxx"
+#include "cellsuno.hxx"
#include "docsh.hxx"
#include "docfunc.hxx"
#include "hints.hxx"
#include "editsrc.hxx"
#include "miscuno.hxx"
-#include "fielduno.hxx"
-
-// setVisible:
-#include <svx/svdundo.hxx>
-#include "drwlayer.hxx"
-#include "detfunc.hxx"
-#include "undocell.hxx"
-#include "userdat.hxx"
-#include <editeng/outlobj.hxx>
-#include "editeng/unofield.hxx"
-#include <svx/unoshape.hxx>
-#include <svx/svdocapt.hxx>
-#include <svx/svditer.hxx>
-#include <svx/svdpage.hxx>
-#include <com/sun/star/drawing/XShapeDescriptor.hpp>
-#include <editeng/unoprnms.hxx>
using namespace com::sun::star;
@@ -80,7 +64,7 @@ static const SvxItemPropertySet* lcl_GetAnnotationPropertySet()
//------------------------------------------------------------------------
SC_SIMPLE_SERVICE_INFO( ScAnnotationObj, "ScAnnotationObj", "com.sun.star.sheet.CellAnnotation" )
-SC_SIMPLE_SERVICE_INFO( ScAnnotationShapeObj, "ScAnnotationShapeObj", "com.sun.star.sheet.CellAnnotationShape" )
+//SC_SIMPLE_SERVICE_INFO( ScAnnotationShapeObj, "ScAnnotationShapeObj", "com.sun.star.sheet.CellAnnotationShape" )
//------------------------------------------------------------------------
@@ -253,7 +237,11 @@ uno::Reference < drawing::XShape > SAL_CALL ScAnnotationObj::getAnnotationShape(
throw(::com::sun::star::uno::RuntimeException)
{
SolarMutexGuard aGuard;
- return new ScAnnotationShapeObj(pDocShell, aCellPos);
+ uno::Reference < drawing::XShape > xShape;
+ if( const ScPostIt* pNote = ImplGetNote() )
+ if( SdrObject* pCaption = pNote->GetOrCreateCaption( aCellPos ) )
+ xShape.set( pCaption->getUnoShape(), uno::UNO_QUERY );
+ return xShape;
}
SvxUnoText& ScAnnotationObj::GetUnoText()
@@ -272,463 +260,4 @@ const ScPostIt* ScAnnotationObj::ImplGetNote() const
{
return pDocShell ? pDocShell->GetDocument()->GetNotes( aCellPos.Tab() )->findByAddress(aCellPos) : 0;
}
-//------------------------------------------------------------------------
-
-ScAnnotationShapeObj::ScAnnotationShapeObj(ScDocShell* pDocSh, const ScAddress& rPos) :
- pDocShell( pDocSh ),
- aCellPos( rPos ),
- pUnoText( NULL )
-{
- pDocShell->GetDocument()->AddUnoObject(*this);
-
- // pUnoText is allocated on demand (GetUnoText)
- // can't be aggregated because getString/setString is handled here
-}
-
-SvxUnoText& ScAnnotationShapeObj::GetUnoText()
-{
- if (!pUnoText)
- {
- ScAnnotationEditSource aEditSource( pDocShell, aCellPos );
- pUnoText = new SvxUnoText( &aEditSource, lcl_GetAnnotationPropertySet(),
- uno::Reference<text::XText>() );
- pUnoText->acquire();
- }
- return *pUnoText;
-}
-
-uno::Reference < drawing::XShape > ScAnnotationShapeObj::GetXShape()
-{
- if (!xShape.is())
- if( ScPostIt* pNote = pDocShell->GetDocument()->GetNotes( aCellPos.Tab() )->findByAddress(aCellPos) )
- if( SdrObject* pCaption = pNote->GetOrCreateCaption( aCellPos ) )
- xShape.set( pCaption->getUnoShape(), uno::UNO_QUERY );
- return xShape;
-}
-
-ScAnnotationShapeObj::~ScAnnotationShapeObj()
-{
- if (pDocShell)
- pDocShell->GetDocument()->RemoveUnoObject(*this);
- if (pUnoText)
- pUnoText->release();
-}
-
-void ScAnnotationShapeObj::Notify( SfxBroadcaster&, const SfxHint& rHint )
-{
- if ( rHint.ISA( ScUpdateRefHint ) )
- {
-// const ScUpdateRefHint& rRef = (const ScUpdateRefHint&)rHint;
-
- //! Ref-Update
- }
- else if ( rHint.ISA( SfxSimpleHint ) &&
- ((const SfxSimpleHint&)rHint).GetId() == SFX_HINT_DYING )
- {
- pDocShell = NULL; // ungueltig geworden
- }
-}
-
-
-// XChild
-
-uno::Reference<uno::XInterface> SAL_CALL ScAnnotationShapeObj::getParent() throw(uno::RuntimeException)
-{
- SolarMutexGuard aGuard;
-
- // Parent der Notiz ist die zugehoerige Zelle
- //! existierendes Objekt finden und zurueckgeben ???
-
- if (pDocShell)
- return (cppu::OWeakObject*)new ScCellObj( pDocShell, aCellPos );
-
- return NULL;
-}
-
-void SAL_CALL ScAnnotationShapeObj::setParent( const uno::Reference<uno::XInterface>& /* Parent */ )
- throw(lang::NoSupportException, uno::RuntimeException)
-{
- // hamma nich
- //! Exception oder so ??!
-}
-
-// XElementAccess
-uno::Type SAL_CALL ScAnnotationShapeObj::getElementType( ) throw (uno::RuntimeException)
-{
- SolarMutexGuard aGuard;
-
- return GetUnoText().getElementType();
-}
-
-sal_Bool SAL_CALL ScAnnotationShapeObj::hasElements( ) throw (uno::RuntimeException)
-{
- SolarMutexGuard aGuard;
-
- return GetUnoText().hasElements();
-}
-
-// XEnumerationAccess
-uno::Reference< container::XEnumeration > SAL_CALL ScAnnotationShapeObj::createEnumeration( ) throw (uno::RuntimeException)
-{
- SolarMutexGuard aGuard;
-
- return GetUnoText().createEnumeration();
-}
-
-// XTextRangeMover
-void SAL_CALL ScAnnotationShapeObj::moveTextRange( const uno::Reference< text::XTextRange >& xRange, sal_Int16 nParagraphs )
- throw (uno::RuntimeException)
-{
- SolarMutexGuard aGuard;
-
- GetUnoText().moveTextRange( xRange, nParagraphs );
-}
-
-// XText
-void SAL_CALL ScAnnotationShapeObj::insertTextContent( const uno::Reference< text::XTextRange >& xRange,
- const uno::Reference< text::XTextContent >& xContent, sal_Bool bAbsorb )
- throw (lang::IllegalArgumentException,
- uno::RuntimeException)
-{
- SolarMutexGuard aGuard;
- GetUnoText().insertTextContent(xRange, xContent, bAbsorb);
-}
-
-void SAL_CALL ScAnnotationShapeObj::removeTextContent( const uno::Reference< text::XTextContent >& xContent )
- throw (container::NoSuchElementException,
- uno::RuntimeException)
-{
- SolarMutexGuard aGuard;
-
- GetUnoText().removeTextContent( xContent );
-}
-
-// XSimpleText
-
-uno::Reference<text::XTextCursor> SAL_CALL ScAnnotationShapeObj::createTextCursor()
- throw(uno::RuntimeException)
-{
- SolarMutexGuard aGuard;
- // Notizen brauchen keine Extrawurst
- return GetUnoText().createTextCursor();
-}
-
-uno::Reference<text::XTextCursor> SAL_CALL ScAnnotationShapeObj::createTextCursorByRange(
- const uno::Reference<text::XTextRange>& aTextPosition )
- throw(uno::RuntimeException)
-{
- SolarMutexGuard aGuard;
- // Notizen brauchen keine Extrawurst
- return GetUnoText().createTextCursorByRange(aTextPosition);
-}
-
-rtl::OUString SAL_CALL ScAnnotationShapeObj::getString() throw(uno::RuntimeException)
-{
- SolarMutexGuard aGuard;
- return GetUnoText().getString();
-}
-
-void SAL_CALL ScAnnotationShapeObj::setString( const rtl::OUString& aText ) throw(uno::RuntimeException)
-{
- SolarMutexGuard aGuard;
- GetUnoText().setString(aText);
-}
-
-void SAL_CALL ScAnnotationShapeObj::insertString( const uno::Reference<text::XTextRange>& xRange,
- const rtl::OUString& aString, sal_Bool bAbsorb )
- throw(uno::RuntimeException)
-{
- SolarMutexGuard aGuard;
- GetUnoText().insertString( xRange, aString, bAbsorb );
-}
-
-void SAL_CALL ScAnnotationShapeObj::insertControlCharacter( const uno::Reference<text::XTextRange>& xRange,
- sal_Int16 nControlCharacter, sal_Bool bAbsorb )
- throw(lang::IllegalArgumentException, uno::RuntimeException)
-{
- SolarMutexGuard aGuard;
- GetUnoText().insertControlCharacter( xRange, nControlCharacter, bAbsorb );
-}
-
-uno::Reference<text::XText> SAL_CALL ScAnnotationShapeObj::getText() throw(uno::RuntimeException)
-{
- SolarMutexGuard aGuard;
- return GetUnoText().getText();
-}
-
-uno::Reference<text::XTextRange> SAL_CALL ScAnnotationShapeObj::getStart() throw(uno::RuntimeException)
-{
- SolarMutexGuard aGuard;
- return GetUnoText().getStart();
-}
-
-uno::Reference<text::XTextRange> SAL_CALL ScAnnotationShapeObj::getEnd() throw(uno::RuntimeException)
-{
- SolarMutexGuard aGuard;
- return GetUnoText().getEnd();
-}
-
-// XShapeDescriptor
-::rtl::OUString SAL_CALL ScAnnotationShapeObj::getShapeType( )
- throw (uno::RuntimeException)
-{
- SolarMutexGuard aGuard;
- uno::Reference < drawing::XShapeDescriptor > xDesc(GetXShape(), uno::UNO_QUERY);
- if (xDesc.is())
- return xDesc->getShapeType();
- return rtl::OUString();
-}
-
-// XShape
-awt::Point SAL_CALL ScAnnotationShapeObj::getPosition( )
- throw (uno::RuntimeException)
-{
- SolarMutexGuard aGuard;
- GetXShape();
- return xShape.is() ? xShape->getPosition() : awt::Point();
-}
-
-void SAL_CALL ScAnnotationShapeObj::setPosition( const awt::Point& aPosition )
- throw (uno::RuntimeException)
-{
- SolarMutexGuard aGuard;
- GetXShape();
- if( xShape.is() )
- xShape->setPosition(aPosition);
-}
-
-awt::Size SAL_CALL ScAnnotationShapeObj::getSize( )
- throw (uno::RuntimeException)
-{
- SolarMutexGuard aGuard;
- GetXShape();
- return xShape.is() ? xShape->getSize() : awt::Size();
-}
-
-void SAL_CALL ScAnnotationShapeObj::setSize( const awt::Size& aSize )
- throw (beans::PropertyVetoException, uno::RuntimeException)
-{
- SolarMutexGuard aGuard;
- GetXShape();
- if( xShape.is() )
- xShape->setSize(aSize);
-}
-
-// XPropertyState
-beans::PropertyState SAL_CALL ScAnnotationShapeObj::getPropertyState( const rtl::OUString& PropertyName )
- throw (beans::UnknownPropertyException,
- uno::RuntimeException)
-{
- SolarMutexGuard aGuard;
- uno::Reference < beans::XPropertyState > xState (GetXShape(), uno::UNO_QUERY);
- if (xState.is())
- return xState->getPropertyState( PropertyName );
- return beans::PropertyState();
-}
-
-uno::Sequence< beans::PropertyState > SAL_CALL ScAnnotationShapeObj::getPropertyStates(
- const uno::Sequence< rtl::OUString >& aPropertyName )
- throw (beans::UnknownPropertyException,
- uno::RuntimeException)
-{
- SolarMutexGuard aGuard;
- uno::Reference < beans::XPropertyState > xState (GetXShape(), uno::UNO_QUERY);
- if (xState.is())
- return xState->getPropertyStates( aPropertyName );
- return uno::Sequence< beans::PropertyState >();
-}
-
-void SAL_CALL ScAnnotationShapeObj::setPropertyToDefault( const ::rtl::OUString& PropertyName )
- throw (::com::sun::star::beans::UnknownPropertyException,
- ::com::sun::star::uno::RuntimeException)
-{
- SolarMutexGuard aGuard;
- uno::Reference < beans::XPropertyState > xState (GetXShape(), uno::UNO_QUERY);
- if (xState.is())
- xState->setPropertyToDefault( PropertyName );
-}
-
-uno::Any SAL_CALL ScAnnotationShapeObj::getPropertyDefault( const rtl::OUString& aPropertyName )
- throw (beans::UnknownPropertyException,
- lang::WrappedTargetException, uno::RuntimeException)
-{
- SolarMutexGuard aGuard;
- uno::Reference < beans::XPropertyState > xState (GetXShape(), uno::UNO_QUERY);
- if (xState.is())
- return xState->getPropertyDefault( aPropertyName );
- return uno::Any();
-}
-
-// XPropertySet
-uno::Reference< beans::XPropertySetInfo > SAL_CALL ScAnnotationShapeObj::getPropertySetInfo( )
- throw (uno::RuntimeException)
-{
- SolarMutexGuard aGuard;
- uno::Reference < beans::XPropertySet > xProp (GetXShape(), uno::UNO_QUERY);
- if (xProp.is())
- return xProp->getPropertySetInfo();
- return uno::Reference< beans::XPropertySetInfo >();
-}
-
-void SAL_CALL ScAnnotationShapeObj::setPropertyValue( const rtl::OUString& aPropertyName, const uno::Any& aValue )
- throw (beans::UnknownPropertyException,
- beans::PropertyVetoException,
- lang::IllegalArgumentException,
- lang::WrappedTargetException,
- uno::RuntimeException)
-{
- SolarMutexGuard aGuard;
- uno::Reference < beans::XPropertySet > xProp (GetXShape(), uno::UNO_QUERY);
- if (xProp.is())
- xProp->setPropertyValue( aPropertyName, aValue );
-}
-
-uno::Any SAL_CALL ScAnnotationShapeObj::getPropertyValue( const rtl::OUString& PropertyName )
- throw (beans::UnknownPropertyException,
- lang::WrappedTargetException,
- uno::RuntimeException)
-{
- SolarMutexGuard aGuard;
- uno::Reference < beans::XPropertySet > xProp (GetXShape(), uno::UNO_QUERY);
- if (xProp.is())
- return xProp->getPropertyValue( PropertyName );
- return uno::Any();
-}
-
-void SAL_CALL ScAnnotationShapeObj::addPropertyChangeListener( const rtl::OUString& aPropertyName,
- const uno::Reference< beans::XPropertyChangeListener >& xListener )
- throw (beans::UnknownPropertyException,
- lang::WrappedTargetException,
- uno::RuntimeException)
-{
- SolarMutexGuard aGuard;
- uno::Reference < beans::XPropertySet > xProp (GetXShape(), uno::UNO_QUERY);
- if (xProp.is())
- return xProp->addPropertyChangeListener( aPropertyName, xListener );
-}
-
-void SAL_CALL ScAnnotationShapeObj::removePropertyChangeListener( const rtl::OUString& aPropertyName,
- const uno::Reference< beans::XPropertyChangeListener >& aListener )
- throw (beans::UnknownPropertyException,
- lang::WrappedTargetException,
- uno::RuntimeException)
-{
- SolarMutexGuard aGuard;
- uno::Reference < beans::XPropertySet > xProp (GetXShape(), uno::UNO_QUERY);
- if (xProp.is())
- return xProp->removePropertyChangeListener( aPropertyName, aListener );
-}
-
-void SAL_CALL ScAnnotationShapeObj::addVetoableChangeListener( const rtl::OUString& PropertyName,
- const uno::Reference< beans::XVetoableChangeListener >& aListener )
- throw (beans::UnknownPropertyException,
- lang::WrappedTargetException,
- uno::RuntimeException)
-{
- SolarMutexGuard aGuard;
- uno::Reference < beans::XPropertySet > xProp (GetXShape(), uno::UNO_QUERY);
- if (xProp.is())
- return xProp->addVetoableChangeListener( PropertyName, aListener );
-}
-
-void SAL_CALL ScAnnotationShapeObj::removeVetoableChangeListener( const rtl::OUString& PropertyName,
- const uno::Reference< beans::XVetoableChangeListener >& aListener )
- throw (beans::UnknownPropertyException,
- lang::WrappedTargetException,
- uno::RuntimeException)
-{
- SolarMutexGuard aGuard;
- uno::Reference < beans::XPropertySet > xProp (GetXShape(), uno::UNO_QUERY);
- if (xProp.is())
- return xProp->removeVetoableChangeListener( PropertyName, aListener );
-}
-
- // XMultiPropertySet
-void SAL_CALL ScAnnotationShapeObj::setPropertyValues( const uno::Sequence< rtl::OUString >& aPropertyNames,
- const uno::Sequence< uno::Any >& aValues )
- throw (beans::PropertyVetoException,
- lang::IllegalArgumentException,
- lang::WrappedTargetException,
- uno::RuntimeException)
-{
- SolarMutexGuard aGuard;
- uno::Reference < beans::XMultiPropertySet > xProp (GetXShape(), uno::UNO_QUERY);
- if (xProp.is())
- xProp->setPropertyValues( aPropertyNames, aValues );
-}
-
-uno::Sequence< uno::Any > SAL_CALL ScAnnotationShapeObj::getPropertyValues(
- const uno::Sequence< rtl::OUString >& aPropertyNames )
- throw (uno::RuntimeException)
-{
- SolarMutexGuard aGuard;
- uno::Reference < beans::XMultiPropertySet > xProp (GetXShape(), uno::UNO_QUERY);
- if (xProp.is())
- return xProp->getPropertyValues( aPropertyNames );
- return uno::Sequence< uno::Any >();
-}
-
-void SAL_CALL ScAnnotationShapeObj::addPropertiesChangeListener( const uno::Sequence< rtl::OUString >& aPropertyNames,
- const uno::Reference< beans::XPropertiesChangeListener >& xListener )
- throw (uno::RuntimeException)
-{
- SolarMutexGuard aGuard;
- uno::Reference < beans::XMultiPropertySet > xProp (GetXShape(), uno::UNO_QUERY);
- if (xProp.is())
- xProp->addPropertiesChangeListener( aPropertyNames, xListener );
-}
-
-void SAL_CALL ScAnnotationShapeObj::removePropertiesChangeListener( const uno::Reference< beans::XPropertiesChangeListener >& xListener )
- throw (uno::RuntimeException)
-{
- SolarMutexGuard aGuard;
- uno::Reference < beans::XMultiPropertySet > xProp (GetXShape(), uno::UNO_QUERY);
- if (xProp.is())
- xProp->removePropertiesChangeListener( xListener );
-}
-
-void SAL_CALL ScAnnotationShapeObj::firePropertiesChangeEvent( const uno::Sequence< rtl::OUString >& aPropertyNames,
- const uno::Reference< beans::XPropertiesChangeListener >& xListener )
- throw (uno::RuntimeException)
-{
- SolarMutexGuard aGuard;
- uno::Reference < beans::XMultiPropertySet > xProp (GetXShape(), uno::UNO_QUERY);
- if (xProp.is())
- xProp->firePropertiesChangeEvent( aPropertyNames, xListener );
-}
-
- // XComponent
-void SAL_CALL ScAnnotationShapeObj::dispose( ) throw (uno::RuntimeException)
-{
- SolarMutexGuard aGuard;
- uno::Reference < lang::XComponent > xComp (GetXShape(), uno::UNO_QUERY);
- if (xComp.is())
- xComp->dispose();
- if (xShape.is())
- xShape.clear();
-}
-
-void SAL_CALL ScAnnotationShapeObj::addEventListener( const uno::Reference< lang::XEventListener >& xListener )
- throw (uno::RuntimeException)
-{
- SolarMutexGuard aGuard;
- uno::Reference < lang::XComponent > xComp (GetXShape(), uno::UNO_QUERY);
- if (xComp.is())
- xComp->addEventListener( xListener );
-}
-
-void SAL_CALL ScAnnotationShapeObj::removeEventListener( const uno::Reference< lang::XEventListener >& aListener )
- throw (uno::RuntimeException)
-{
- SolarMutexGuard aGuard;
- uno::Reference < lang::XComponent > xComp (GetXShape(), uno::UNO_QUERY);
- if (xComp.is())
- xComp->removeEventListener( aListener );
-}
-
-//------------------------------------------------------------------------
-
-
-
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/unoobj/shapeuno.cxx b/sc/source/ui/unoobj/shapeuno.cxx
index d723dac26657..ce1a64710afb 100644
--- a/sc/source/ui/unoobj/shapeuno.cxx
+++ b/sc/source/ui/unoobj/shapeuno.cxx
@@ -113,6 +113,7 @@ ScShapeObj::ScShapeObj( uno::Reference<drawing::XShape>& xShape ) :
pShapePropertyState(NULL),
pImplementationId(NULL),
bIsTextShape(false),
+ bIsNoteCaption(false),
bInitializedNotifier(false)
{
comphelper::increment( m_refCount );
@@ -137,6 +138,7 @@ ScShapeObj::ScShapeObj( uno::Reference<drawing::XShape>& xShape ) :
SdrObject* pObj = GetSdrObject();
if ( pObj )
{
+ bIsNoteCaption = ScDrawLayer::IsNoteCaption( pObj );
lcl_initializeNotifier( *pObj, *this );
bInitializedNotifier = true;
}
@@ -161,6 +163,9 @@ uno::Any SAL_CALL ScShapeObj::queryInterface( const uno::Type& rType )
if ( !aRet.hasValue() && bIsTextShape )
aRet = ScShapeObj_TextBase::queryInterface( rType );
+ if ( !aRet.hasValue() && bIsNoteCaption )
+ aRet = ScShapeObj_ChildBase::queryInterface( rType );
+
if ( !aRet.hasValue() && mxShapeAgg.is() )
aRet = mxShapeAgg->queryAggregation( rType );
@@ -1286,6 +1291,48 @@ void SAL_CALL ScShapeObj::setString( const rtl::OUString& aText ) throw(uno::Run
throw uno::RuntimeException();
}
+// XChild
+
+uno::Reference< uno::XInterface > SAL_CALL ScShapeObj::getParent() throw (uno::RuntimeException)
+{
+ ScUnoGuard aGuard;
+
+ // receive cell position from caption object (parent of a note caption is the note cell)
+ SdrObject* pObj = GetSdrObject();
+ if( pObj )
+ {
+ ScDrawLayer* pModel = (ScDrawLayer*)pObj->GetModel();
+ SdrPage* pPage = pObj->GetPage();
+ if ( pModel )
+ {
+ ScDocument* pDoc = pModel->GetDocument();
+ if ( pDoc )
+ {
+ SfxObjectShell* pObjSh = pDoc->GetDocumentShell();
+ if ( pObjSh && pObjSh->ISA(ScDocShell) )
+ {
+ ScDocShell* pDocSh = (ScDocShell*)pObjSh;
+
+ SCTAB nTab = 0;
+ if ( lcl_GetPageNum( pPage, *pModel, nTab ) )
+ {
+ const ScDrawObjData* pCaptData = ScDrawLayer::GetNoteCaptionData( pObj, nTab );
+ if( pCaptData )
+ return static_cast< ::cppu::OWeakObject* >( new ScCellObj( pDocSh, pCaptData->maStart ) );
+ }
+ }
+ }
+ }
+ }
+
+ return 0;
+}
+
+void SAL_CALL ScShapeObj::setParent( const uno::Reference< uno::XInterface >& ) throw (lang::NoSupportException, uno::RuntimeException)
+{
+ throw lang::NoSupportException();
+}
+
// XTypeProvider
uno::Sequence<uno::Type> SAL_CALL ScShapeObj::getTypes() throw(uno::RuntimeException)
@@ -1504,6 +1551,13 @@ uno::Sequence< ::rtl::OUString > SAL_CALL ScShapeObj::getSupportedServiceNames(
aSupported.realloc( aSupported.getLength() + 1 );
aSupported[ aSupported.getLength() - 1 ] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.sheet.Shape" ) );
+
+ if( bIsNoteCaption )
+ {
+ aSupported.realloc( aSupported.getLength() + 1 );
+ aSupported[ aSupported.getLength() - 1 ] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.sheet.CellAnnotationShape" ) );
+ }
+
return aSupported;
}