From a0b60051016103f7218407a09013933a793c459a Mon Sep 17 00:00:00 2001 From: Andreas Martens Date: Tue, 28 May 2002 13:05:17 +0000 Subject: Fix #98388#: Moving anchor --- sw/inc/fesh.hxx | 11 +++++++++-- sw/source/core/draw/dview.cxx | 19 ++++++++++++++++--- sw/source/core/frmedt/feshview.cxx | 34 ++++++++++++++++++++++++++++++++-- 3 files changed, 57 insertions(+), 7 deletions(-) diff --git a/sw/inc/fesh.hxx b/sw/inc/fesh.hxx index 10ffdd894b49..81e43a4e8261 100644 --- a/sw/inc/fesh.hxx +++ b/sw/inc/fesh.hxx @@ -2,9 +2,9 @@ * * $RCSfile: fesh.hxx,v $ * - * $Revision: 1.11 $ + * $Revision: 1.12 $ * - * last change: $Author: mib $ $Date: 2002-05-15 13:22:47 $ + * last change: $Author: ama $ $Date: 2002-05-28 14:01:05 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -186,6 +186,11 @@ struct SwGetCurColNumPara #define SW_ENTER_GROUP 2 #define SW_LEAVE_FRAME 4 +#define SW_MOVE_UP 0 +#define SW_MOVE_DOWN 1 +#define SW_MOVE_LEFT 2 +#define SW_MOVE_RIGHT 3 + class SwFEShell : public SwEditShell { SdrViewUserMarker *pChainFrom, @@ -264,6 +269,8 @@ public: int IsObjSelectable( const Point& rPt ); int IsInsideSelectedObj( const Point& rPt ); + sal_Bool MoveAnchor( USHORT nDir ); + //Returnwerte siehe oben FrmType. //pPt: Crsr bzw. DocPos; bStopAtFly: Bei Flys anhalten oder ueber den Anchor weitergehen // Obgleich (0,TRUE) eine Art Standard ist, sind die Parameter nicht defaultet, damit diff --git a/sw/source/core/draw/dview.cxx b/sw/source/core/draw/dview.cxx index ff38918bd856..7f2dadef6ece 100644 --- a/sw/source/core/draw/dview.cxx +++ b/sw/source/core/draw/dview.cxx @@ -2,9 +2,9 @@ * * $RCSfile: dview.cxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: mib $ $Date: 2002-05-15 13:32:21 $ + * last change: $Author: ama $ $Date: 2002-05-28 14:03:33 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -104,6 +104,19 @@ #endif #include "shellres.hxx" +class SwSdrHdl : public SdrHdl +{ +public: + SwSdrHdl(const Point& rPnt ) : SdrHdl( rPnt, HDL_ANCHOR ) {} + virtual BOOL IsFocusHdl() const; +}; + +BOOL SwSdrHdl::IsFocusHdl() const +{ + if( HDL_ANCHOR == eKind ) + return TRUE; + return SdrHdl::IsFocusHdl(); +} const SwFrm *lcl_FindAnchor( const SdrObject *pObj, FASTBOOL bAll ) { @@ -195,7 +208,7 @@ void SwDrawView::AddCustomHdl() } // add anchor handle: - aHdl.AddHdl(new SdrHdl(aPos ,HDL_ANCHOR)); + aHdl.AddHdl( new SwSdrHdl( aPos ) ); } /************************************************************************* diff --git a/sw/source/core/frmedt/feshview.cxx b/sw/source/core/frmedt/feshview.cxx index 7164c77ceacd..39408831f0b0 100644 --- a/sw/source/core/frmedt/feshview.cxx +++ b/sw/source/core/frmedt/feshview.cxx @@ -2,9 +2,9 @@ * * $RCSfile: feshview.cxx,v $ * - * $Revision: 1.7 $ + * $Revision: 1.8 $ * - * last change: $Author: mib $ $Date: 2002-05-15 13:20:30 $ + * last change: $Author: ama $ $Date: 2002-05-28 14:05:17 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -346,6 +346,36 @@ BOOL SwFEShell::SelectObj( const Point& rPt, BYTE nFlag, SdrObject *pObj ) return bRet; } +// First shot, has to be modified... + +sal_Bool SwFEShell::MoveAnchor( USHORT nDir ) +{ + const SdrMarkList* pMrkList; + if( !Imp()->GetDrawView() || + 0 == (pMrkList = &Imp()->GetDrawView()->GetMarkList()) || + 1 != pMrkList->GetMarkCount()) + return sal_False; + SwFrm* pOld; + SdrObject *pObj = pMrkList->GetMark( 0 )->GetObj(); + if( pObj->IsWriterFlyFrame() ) + pOld = ((SwVirtFlyDrawObj*)pObj)->GetFlyFrm()->GetAnchor(); + else + pOld = ((SwDrawContact*)GetUserCall(pObj))->GetAnchor(); + if( pOld ) + { + Point aOld( pOld->Frm().Pos() ); + Point aPt( aOld ); + switch ( nDir ) { + case SW_MOVE_UP: aPt.Y() -= 10; break; + case SW_MOVE_DOWN: aPt.Y() += pOld->Frm().Height() + 10; break; + case SW_MOVE_LEFT: aPt.X() -= 10; break; + case SW_MOVE_RIGHT: aPt.X() += pOld->Frm().Width() + 10; break; + } + aPt = FindAnchorPos( aPt, sal_True ); + return aPt != aOld; + } + return sal_False; +} /************************************************************************* |* -- cgit