diff options
author | Niklas Nebel <nn@openoffice.org> | 2002-11-27 17:20:44 +0000 |
---|---|---|
committer | Niklas Nebel <nn@openoffice.org> | 2002-11-27 17:20:44 +0000 |
commit | c06bdae03d08b0ded134e7d98b770caabbc34629 (patch) | |
tree | 90194dc19360520786508337e6876ecb10994464 /sc | |
parent | #105394#; reload imported data depending on UpdateDocMode (diff) | |
download | core-c06bdae03d08b0ded134e7d98b770caabbc34629.tar.gz core-c06bdae03d08b0ded134e7d98b770caabbc34629.zip |
#105585# text cursor subclass for text in drawing objects
Diffstat (limited to 'sc')
-rw-r--r-- | sc/inc/textuno.hxx | 26 | ||||
-rw-r--r-- | sc/source/ui/unoobj/textuno.cxx | 66 |
2 files changed, 88 insertions, 4 deletions
diff --git a/sc/inc/textuno.hxx b/sc/inc/textuno.hxx index dabbac583c52..89303795c11f 100644 --- a/sc/inc/textuno.hxx +++ b/sc/inc/textuno.hxx @@ -2,9 +2,9 @@ * * $RCSfile: textuno.hxx,v $ * - * $Revision: 1.11 $ + * $Revision: 1.12 $ * - * last change: $Author: sab $ $Date: 2002-10-01 16:33:19 $ + * last change: $Author: nn $ $Date: 2002-11-27 18:20:24 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -358,6 +358,28 @@ public: com::sun::star::uno::XInterface> xObj ); }; +class ScDrawTextCursor : public SvxUnoTextCursor +{ +private: + com::sun::star::uno::Reference< com::sun::star::text::XText > xParentText; + +public: + ScDrawTextCursor(const ScDrawTextCursor& rOther); + ScDrawTextCursor( const com::sun::star::uno::Reference< + com::sun::star::text::XText >& xParent, + const SvxUnoTextBase& rText ); + virtual ~ScDrawTextCursor() throw(); + + // SvxUnoTextCursor methods reimplemented here: + 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); +}; + + // ScAnnotationTextCursor isn't needed anymore - SvxUnoTextCursor is used instead diff --git a/sc/source/ui/unoobj/textuno.cxx b/sc/source/ui/unoobj/textuno.cxx index e59506407f6b..5eda88564372 100644 --- a/sc/source/ui/unoobj/textuno.cxx +++ b/sc/source/ui/unoobj/textuno.cxx @@ -2,9 +2,9 @@ * * $RCSfile: textuno.cxx,v $ * - * $Revision: 1.17 $ + * $Revision: 1.18 $ * - * last change: $Author: sab $ $Date: 2002-10-01 16:33:47 $ + * last change: $Author: nn $ $Date: 2002-11-27 18:20:44 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -882,6 +882,68 @@ ScHeaderFooterTextCursor* ScHeaderFooterTextCursor::getImplementation( //------------------------------------------------------------------------ +ScDrawTextCursor::ScDrawTextCursor(const ScDrawTextCursor& rOther) : + SvxUnoTextCursor( rOther ), + xParentText( rOther.xParentText ) +{ +} + +ScDrawTextCursor::ScDrawTextCursor( const uno::Reference<text::XText>& xParent, + const SvxUnoTextBase& rText ) : + SvxUnoTextCursor( rText ), + xParentText( xParent ) + +{ +} + +ScDrawTextCursor::~ScDrawTextCursor() throw() +{ +} + +// SvxUnoTextCursor methods reimplemented here to return the right objects: + +uno::Reference<text::XText> SAL_CALL ScDrawTextCursor::getText() throw(uno::RuntimeException) +{ + ScUnoGuard aGuard; + return xParentText; +} + +uno::Reference<text::XTextRange> SAL_CALL ScDrawTextCursor::getStart() throw(uno::RuntimeException) +{ + ScUnoGuard aGuard; + + //! use other object for range than cursor? + + ScDrawTextCursor* pNew = new ScDrawTextCursor( *this ); + uno::Reference<text::XTextRange> xRange( static_cast<SvxUnoTextRangeBase*>(pNew) ); + + ESelection aNewSel = GetSelection(); + aNewSel.nEndPara = aNewSel.nStartPara; + aNewSel.nEndPos = aNewSel.nStartPos; + pNew->SetSelection( aNewSel ); + + return xRange; +} + +uno::Reference<text::XTextRange> SAL_CALL ScDrawTextCursor::getEnd() throw(uno::RuntimeException) +{ + ScUnoGuard aGuard; + + //! use other object for range than cursor? + + ScDrawTextCursor* pNew = new ScDrawTextCursor( *this ); + uno::Reference<text::XTextRange> xRange( static_cast<SvxUnoTextRangeBase*>(pNew) ); + + ESelection aNewSel = GetSelection(); + aNewSel.nStartPara = aNewSel.nEndPara; + aNewSel.nStartPos = aNewSel.nEndPos; + pNew->SetSelection( aNewSel ); + + return xRange; +} + +//------------------------------------------------------------------------ + ScSimpleEditSourceHelper::ScSimpleEditSourceHelper() { SfxItemPool* pEnginePool = EditEngine::CreatePool(); |