diff options
author | Armin Le Grand <alg@apache.org> | 2013-09-27 11:20:23 +0000 |
---|---|---|
committer | Armin Le Grand <alg@apache.org> | 2013-09-27 11:20:23 +0000 |
commit | 14a9ddcf6966a9c49e188189051968f5f01f01b3 (patch) | |
tree | 16cb03133a6849d436b53e49e6b219d3f0fe8403 | |
parent | dbd1dea45083d76235568f6b93e86a8ac15f2b97 (diff) |
in-between co with recent changes to have an anchor point for a critical change, not complete
44 files changed, 1339 insertions, 756 deletions
diff --git a/basctl/source/dlged/dlgedfunc.cxx b/basctl/source/dlged/dlgedfunc.cxx index d308e1a39b01..c49052a27196 100644 --- a/basctl/source/dlged/dlgedfunc.cxx +++ b/basctl/source/dlged/dlgedfunc.cxx @@ -241,7 +241,7 @@ sal_Bool DlgEdFunc::KeyInput( const KeyEvent& rKEvt ) const SdrHdlList& rHdlList = pView->GetHdlList(); SdrHdl* pHdl = rHdlList.GetFocusHdl(); - if ( pHdl == 0 ) + if(!pHdl) { // no handle selected if ( pView->IsMoveAllowed() ) @@ -288,53 +288,56 @@ sal_Bool DlgEdFunc::KeyInput( const KeyEvent& rKEvt ) else { // move the handle - if ( pHdl && !aMove.equalZero() ) - { - const basegfx::B2DPoint aStartPoint( pHdl->getPosition() ); - const basegfx::B2DPoint aEndPoint( pHdl->getPosition() + aMove ); - const SdrDragStat& rDragStat = pView->GetDragStat(); - - // start dragging - pView->BegDragObj( aStartPoint, pHdl, 0.0 ); - - if ( pView->IsDragObj() ) - { - const bool bWasNoSnap(rDragStat.IsNoSnap()); - const bool bWasSnapEnabled(pView->IsSnapEnabled()); - - // switch snapping off - if ( !bWasNoSnap ) - { - ((SdrDragStat&)rDragStat).SetNoSnap(true); - } - - if ( bWasSnapEnabled ) - { - pView->SetSnapEnabled( false ); - } - - pView->MovAction( aEndPoint ); - pView->EndDragObj(); - - // restore snap - if ( !bWasNoSnap ) - { - ((SdrDragStat&)rDragStat).SetNoSnap( bWasNoSnap ); - } - - if ( bWasSnapEnabled ) - { - pView->SetSnapEnabled( bWasSnapEnabled ); - } - } - - // make moved handle visible - const basegfx::B2DRange aVisRange( - aEndPoint - basegfx::B2DPoint(100.0, 100.0), - aEndPoint + basegfx::B2DPoint(100.0, 100.0)); - - pView->MakeVisibleAtView( aVisRange, *pWindow ); - } + pView->MoveHandleByVector(*pHdl, aMove, pWindow, 0); + + // TTTT:HANDLE + //if ( pHdl && !aMove.equalZero() ) + //{ + // const basegfx::B2DPoint aStartPoint( pHdl->getPosition() ); + // const basegfx::B2DPoint aEndPoint( pHdl->getPosition() + aMove ); + // const SdrDragStat& rDragStat = pView->GetDragStat(); + // + // // start dragging + // pView->BegDragObj( aStartPoint, pHdl, 0.0 ); + // + // if ( pView->IsDragObj() ) + // { + // const bool bWasNoSnap(rDragStat.IsNoSnap()); + // const bool bWasSnapEnabled(pView->IsSnapEnabled()); + // + // // switch snapping off + // if ( !bWasNoSnap ) + // { + // ((SdrDragStat&)rDragStat).SetNoSnap(true); + // } + // + // if ( bWasSnapEnabled ) + // { + // pView->SetSnapEnabled( false ); + // } + // + // pView->MovAction( aEndPoint ); + // pView->EndDragObj(); + // + // // restore snap + // if ( !bWasNoSnap ) + // { + // ((SdrDragStat&)rDragStat).SetNoSnap( bWasNoSnap ); + // } + // + // if ( bWasSnapEnabled ) + // { + // pView->SetSnapEnabled( bWasSnapEnabled ); + // } + // } + // + // // make moved handle visible + // const basegfx::B2DRange aVisRange( + // aEndPoint - basegfx::B2DPoint(100.0, 100.0), + // aEndPoint + basegfx::B2DPoint(100.0, 100.0)); + // + // pView->MakeVisibleAtView( aVisRange, *pWindow ); + //} } } else diff --git a/basegfx/inc/basegfx/matrix/b2dhommatrixtools.hxx b/basegfx/inc/basegfx/matrix/b2dhommatrixtools.hxx index 24b77edb7c10..0733af8fb54c 100644 --- a/basegfx/inc/basegfx/matrix/b2dhommatrixtools.hxx +++ b/basegfx/inc/basegfx/matrix/b2dhommatrixtools.hxx @@ -166,6 +166,14 @@ namespace basegfx const B2DRange& rSourceRange, const B2DRange& rTargetRange); + /// adapt given transformation to absolute scale given by the B2DRange. This + /// means that rRange.getRange() is used as scale and rRange.getMinimum() is + /// used as translation; mirrorings, shear and rotation will be preserved from + /// the given transformation + B2DHomMatrix adaptB2DHomMatrixToB2DRange( + const B2DHomMatrix& rSource, + const B2DRange& rRange); + /* tooling methods for converting API matrices (drawing::HomogenMatrix3) to B2DHomMatrix */ diff --git a/basegfx/source/matrix/b2dhommatrixtools.cxx b/basegfx/source/matrix/b2dhommatrixtools.cxx index fbbab06822ce..7a5526f030c8 100644 --- a/basegfx/source/matrix/b2dhommatrixtools.cxx +++ b/basegfx/source/matrix/b2dhommatrixtools.cxx @@ -476,6 +476,41 @@ namespace basegfx return aRetval; } + /// adapt given transformation to absolute scale given by the B2DRange. This + /// means that rRange.getRange() is used as scale and rRange.getMinimum() is + /// used as translation; mirrorings, shear and rotation will be preserved from + /// the given transformation + B2DHomMatrix adaptB2DHomMatrixToB2DRange( + const B2DHomMatrix& rSource, + const B2DRange& rRange) + { + // prepare decomposition + const B2DHomMatrixBufferedOnDemandDecompose aSource(rSource); + + // build source range (rRange is relative to this range) + const basegfx::B2DRange aSourceRange( + aSource.getTranslate(), + aSource.getTranslate() + absolute(aSource.getScale())); + + // create a back-transform from source range to unit coordinates + // and apply it + B2DHomMatrix aNew; + B2DPoint aPos(rRange.getMinimum()); + B2DVector aSize(rRange.getRange()); + + aNew.translate(-aSourceRange.getMinimum()); + aNew.scale( + 1.0 / aSourceRange.getWidth(), + 1.0 / aSourceRange.getHeight()); + aPos = aNew * aPos; + aSize = aNew * aSize; + + // aPos/aSize are the relative coordinates in unit coordinates for the + // target coordinate system. pre-multiply target transform to go from + // aPos/aSize to unit coordinates. + return rSource * createScaleTranslateB2DHomMatrix(aSize, aPos); + } + /* tooling methods for converting API matrices (drawing::HomogenMatrix3) to B2DHomMatrix */ diff --git a/cui/source/tabpages/swpossizetabpage.src b/cui/source/tabpages/swpossizetabpage.src index 309b487f0bcf..4a586e87dd9e 100644 --- a/cui/source/tabpages/swpossizetabpage.src +++ b/cui/source/tabpages/swpossizetabpage.src @@ -57,7 +57,7 @@ TabPage RID_SVXPAGE_SWPOSSIZE Left = TRUE ; Repeat = TRUE ; Spin = TRUE ; - Minimum = 5 ; + Minimum = 0; Maximum = 9999 ; DecimalDigits = 2 ; Unit = FUNIT_CM ; @@ -83,7 +83,7 @@ TabPage RID_SVXPAGE_SWPOSSIZE Left = TRUE ; Repeat = TRUE ; Spin = TRUE ; - Minimum = 5 ; + Minimum = 0; Maximum = 9999 ; DecimalDigits = 2 ; Unit = FUNIT_CM ; diff --git a/cui/source/tabpages/transfrm.src b/cui/source/tabpages/transfrm.src index 73da25ecbffe..f0eb0cfe3a33 100644 --- a/cui/source/tabpages/transfrm.src +++ b/cui/source/tabpages/transfrm.src @@ -132,7 +132,7 @@ TabPage RID_SVXPAGE_POSITION_SIZE TabStop = TRUE ; Repeat = TRUE ; Spin = TRUE ; - Minimum = 1 ; + Minimum = 0 ; Maximum = 120000 ; StrictFormat = TRUE ; DecimalDigits = 2 ; @@ -148,7 +148,7 @@ TabPage RID_SVXPAGE_POSITION_SIZE TabStop = TRUE ; Repeat = TRUE ; Spin = TRUE ; - Minimum = 1 ; + Minimum = 0 ; Maximum = 120000 ; StrictFormat = TRUE ; DecimalDigits = 2 ; diff --git a/reportdesign/source/ui/report/ViewsWindow.cxx b/reportdesign/source/ui/report/ViewsWindow.cxx index 35f486d73ea2..c5e348f2c1aa 100644 --- a/reportdesign/source/ui/report/ViewsWindow.cxx +++ b/reportdesign/source/ui/report/ViewsWindow.cxx @@ -1597,7 +1597,7 @@ void OViewsWindow::handleKey(const KeyCode& _rCode) const SdrHdlList& rHdlList = rView.GetHdlList(); SdrHdl* pHdl = rHdlList.GetFocusHdl(); - if ( pHdl == 0 ) + if(!pHdl) { // no handle selected if ( rView.IsMoveAllowed() ) @@ -1710,82 +1710,120 @@ void OViewsWindow::handleKey(const KeyCode& _rCode) } else { - // move the handle - if ( pHdl && !aMove.equalZero() ) - { - const basegfx::B2DPoint aStartPoint( pHdl->getPosition() ); - const basegfx::B2DPoint aEndPoint( pHdl->getPosition() + aMove ); - const SdrDragStat& rDragStat = rView.GetDragStat(); - - // start dragging - rView.BegDragObj( aStartPoint, pHdl, 0.0 ); - - if ( rView.IsDragObj() ) - { - const bool bWasNoSnap = rDragStat.IsNoSnap(); - const bool bWasSnapEnabled = rView.IsSnapEnabled(); - - // switch snapping off - if ( !bWasNoSnap ) - ((SdrDragStat&)rDragStat).SetNoSnap( true ); - if ( bWasSnapEnabled ) - rView.SetSnapEnabled( false ); - - basegfx::B2DRange aNewRange; - bool bCheck = false; - const SdrObjectVector aSelection(rView.getSelectedSdrObjectVectorFromSdrMarkView()); - - for (sal_uInt32 i(0); !bCheck && i < aSelection.size(); ++i ) - { - bCheck = dynamic_cast< OUnoObject* >(aSelection[i]) != NULL - || dynamic_cast< OOle2Obj* >(aSelection[i]) != NULL; - if ( bCheck ) - aNewRange.expand(aSelection[i]->getObjectRange(&rView)); - } - - switch(pHdl->GetKind()) - { - case HDL_LEFT: - case HDL_UPLFT: - case HDL_LWLFT: - case HDL_UPPER: - aNewRange = basegfx::B2DRange( - aNewRange.getMinimum() + aMove, - aNewRange.getMaximum()); - break; - case HDL_UPRGT: - case HDL_RIGHT: - case HDL_LWRGT: - case HDL_LOWER: - aNewRange = basegfx::B2DRange( - aNewRange.getMinimum(), - aNewRange.getMinimum() + aMove); - break; - default: - break; - } - - if ( !(bCheck && isOver(aNewRange,*rReportSection.getPage(),rView)) ) - { - rView.MovAction(aEndPoint); - } + basegfx::B2DRange aNewRange; + bool bCheck(false); + const SdrObjectVector aSelection(rView.getSelectedSdrObjectVectorFromSdrMarkView()); - rView.EndDragObj(); - - // restore snap - if ( !bWasNoSnap ) - ((SdrDragStat&)rDragStat).SetNoSnap( bWasNoSnap ); - if ( bWasSnapEnabled ) - rView.SetSnapEnabled( bWasSnapEnabled ); - } + for (sal_uInt32 i(0); !bCheck && i < aSelection.size(); ++i ) + { + bCheck = dynamic_cast< OUnoObject* >(aSelection[i]) || dynamic_cast< OOle2Obj* >(aSelection[i]); + if ( bCheck ) + aNewRange.expand(aSelection[i]->getObjectRange(&rView)); + } - // make moved handle visible - const basegfx::B2DRange aRange( - aEndPoint - basegfx::B2DPoint(DEFAUL_MOVE_SIZE, DEFAUL_MOVE_SIZE), - aEndPoint + basegfx::B2DPoint(DEFAUL_MOVE_SIZE, DEFAUL_MOVE_SIZE)); + switch(pHdl->GetKind()) + { + case HDL_LEFT: + case HDL_UPLFT: + case HDL_LWLFT: + case HDL_UPPER: + aNewRange = basegfx::B2DRange( + aNewRange.getMinimum() + aMove, + aNewRange.getMaximum()); + break; + case HDL_UPRGT: + case HDL_RIGHT: + case HDL_LWRGT: + case HDL_LOWER: + aNewRange = basegfx::B2DRange( + aNewRange.getMinimum(), + aNewRange.getMaximum() + aMove); + break; + default: + break; + } - rView.MakeVisibleAtView( aRange, rReportSection); + if(!(bCheck && isOver(aNewRange, *rReportSection.getPage(), rView))) + { + // move the handle + rView.MoveHandleByVector(*pHdl, aMove, &rReportSection, 0); } + + // TTTT:HANDLE + //if ( pHdl && !aMove.equalZero() ) + //{ + // const basegfx::B2DPoint aStartPoint( pHdl->getPosition() ); + // const basegfx::B2DPoint aEndPoint( pHdl->getPosition() + aMove ); + // const SdrDragStat& rDragStat = rView.GetDragStat(); + // + // // start dragging + // rView.BegDragObj( aStartPoint, pHdl, 0.0 ); + // + // if ( rView.IsDragObj() ) + // { + // const bool bWasNoSnap = rDragStat.IsNoSnap(); + // const bool bWasSnapEnabled = rView.IsSnapEnabled(); + // + // // switch snapping off + // if ( !bWasNoSnap ) + // ((SdrDragStat&)rDragStat).SetNoSnap( true ); + // if ( bWasSnapEnabled ) + // rView.SetSnapEnabled( false ); + // + // basegfx::B2DRange aNewRange; + // bool bCheck = false; + // const SdrObjectVector aSelection(rView.getSelectedSdrObjectVectorFromSdrMarkView()); + // + // for (sal_uInt32 i(0); !bCheck && i < aSelection.size(); ++i ) + // { + // bCheck = dynamic_cast< OUnoObject* >(aSelection[i]) || dynamic_cast< OOle2Obj* >(aSelection[i]); + // if ( bCheck ) + // aNewRange.expand(aSelection[i]->getObjectRange(&rView)); + // } + // + // switch(pHdl->GetKind()) + // { + // case HDL_LEFT: + // case HDL_UPLFT: + // case HDL_LWLFT: + // case HDL_UPPER: + // aNewRange = basegfx::B2DRange( + // aNewRange.getMinimum() + aMove, + // aNewRange.getMaximum()); + // break; + // case HDL_UPRGT: + // case HDL_RIGHT: + // case HDL_LWRGT: + // case HDL_LOWER: + // aNewRange = basegfx::B2DRange( + // aNewRange.getMinimum(), + // aNewRange.getMaximum() + aMove); + // break; + // default: + // break; + // } + // + // if ( !(bCheck && isOver(aNewRange,*rReportSection.getPage(),rView)) ) + // { + // rView.MovAction(aEndPoint); + // } + // + // rView.EndDragObj(); + // + // // restore snap + // if ( !bWasNoSnap ) + // ((SdrDragStat&)rDragStat).SetNoSnap( bWasNoSnap ); + // if ( bWasSnapEnabled ) + // rView.SetSnapEnabled( bWasSnapEnabled ); + // } + // + // // make moved handle visible + // const basegfx::B2DRange aRange( + // aEndPoint - basegfx::B2DPoint(DEFAUL_MOVE_SIZE, DEFAUL_MOVE_SIZE), + // aEndPoint + basegfx::B2DPoint(DEFAUL_MOVE_SIZE, DEFAUL_MOVE_SIZE)); + // + // rView.MakeVisibleAtView( aRange, rReportSection); + //} } rView.RecreateAllMarkHandles(); diff --git a/sc/source/ui/drawfunc/fudraw.cxx b/sc/source/ui/drawfunc/fudraw.cxx index bda53f4d48ef..b9c4e5e55677 100644 --- a/sc/source/ui/drawfunc/fudraw.cxx +++ b/sc/source/ui/drawfunc/fudraw.cxx @@ -552,7 +552,7 @@ sal_Bool __EXPORT FuDraw::KeyInput(const KeyEvent& rKEvt) const SdrHdlList& rHdlList = pView->GetHdlList(); SdrHdl* pHdl = rHdlList.GetFocusHdl(); - if(0L == pHdl) + if(!pHdl) { // #107086# only take action when move is allowed if(pView->IsMoveAllowed()) @@ -601,45 +601,48 @@ sal_Bool __EXPORT FuDraw::KeyInput(const KeyEvent& rKEvt) else { // move handle with index nHandleIndex - if(pHdl && !aMove.equalZero()) - { - // now move the Handle - const basegfx::B2DPoint aStartPoint(pHdl->getPosition()); - const basegfx::B2DPoint aEndPoint(aStartPoint + aMove); - const SdrDragStat& rDragStat = pView->GetDragStat(); - - // start dragging - pView->BegDragObj(aStartPoint, pHdl, 0.0); - - if(pView->IsDragObj()) - { - const bool bWasNoSnap(rDragStat.IsNoSnap()); - const bool bWasSnapEnabled(pView->IsSnapEnabled()); - - // switch snapping off - if(!bWasNoSnap) - ((SdrDragStat&)rDragStat).SetNoSnap(true); - if(bWasSnapEnabled) - pView->SetSnapEnabled(false); - - pView->MovAction(aEndPoint); - pView->EndDragObj(); - - // restore snap - if(!bWasNoSnap) - ((SdrDragStat&)rDragStat).SetNoSnap(bWasNoSnap); - if(bWasSnapEnabled) - pView->SetSnapEnabled(bWasSnapEnabled); - } - - // make moved handle visible - const basegfx::B2DRange aVisRange( - aEndPoint - basegfx::B2DPoint(100.0, 100.0), - aEndPoint + basegfx::B2DPoint(100.0, 100.0)); - pView->MakeVisibleAtView(aVisRange, *pWindow); - + pView->MoveHandleByVector(*pHdl, aMove, pWindow, 0); + + // TTTT:HANDLE + //if(pHdl && !aMove.equalZero()) + //{ + // // now move the Handle + // const basegfx::B2DPoint aStartPoint(pHdl->getPosition()); + // const basegfx::B2DPoint aEndPoint(aStartPoint + aMove); + // const SdrDragStat& rDragStat = pView->GetDragStat(); + // + // // start dragging + // pView->BegDragObj(aStartPoint, pHdl, 0.0); + // + // if(pView->IsDragObj()) + // { + // const bool bWasNoSnap(rDragStat.IsNoSnap()); + // const bool bWasSnapEnabled(pView->IsSnapEnabled()); + // + // // switch snapping off + // if(!bWasNoSnap) + // ((SdrDragStat&)rDragStat).SetNoSnap(true); + // if(bWasSnapEnabled) + // pView->SetSnapEnabled(false); + // + // pView->MovAction(aEndPoint); + // pView->EndDragObj(); + // + // // restore snap + // if(!bWasNoSnap) + // ((SdrDragStat&)rDragStat).SetNoSnap(bWasNoSnap); + // if(bWasSnapEnabled) + // pView->SetSnapEnabled(bWasSnapEnabled); + // } + // + // // make moved handle visible + // const basegfx::B2DRange aVisRange( + // aEndPoint - basegfx::B2DPoint(100.0, 100.0), + // aEndPoint + basegfx::B2DPoint(100.0, 100.0)); + // pView->MakeVisibleAtView(aVisRange, *pWindow); + // bReturn = sal_True; - } + //} } } } diff --git a/sd/source/ui/animations/motionpathtag.cxx b/sd/source/ui/animations/motionpathtag.cxx index 0d84ee176a9f..95405bc2cec9 100644 --- a/sd/source/ui/animations/motionpathtag.cxx +++ b/sd/source/ui/animations/motionpathtag.cxx @@ -752,48 +752,55 @@ bool MotionPathTag::OnMove( const KeyEvent& rKEvt ) if(pHdl) { - // now move the Handle (fX, fY) - const basegfx::B2DPoint aStartPoint(pHdl->getPosition()); - const basegfx::B2DPoint aEndPoint(aStartPoint + basegfx::B2DPoint(fX, fY)); - - // start dragging + // move the Handle (fX, fY) rtl::Reference< MotionPathTag > xTag( this ); SdrDragMethod* pDragMethod = 0; - if( (pHdl->GetKind() == HDL_MOVE) || (pHdl->GetKind() == HDL_SMARTTAG) ) + + if(HDL_MOVE == pHdl->GetKind() || HDL_SMARTTAG == pHdl->GetKind()) { - pDragMethod = new PathDragMove( mrView, xTag ); + pDragMethod = new PathDragMove(mrView, xTag); } - else if( pHdl->GetKind() == HDL_POLY ) + else if(HDL_POLY == pHdl->GetKind()) { - pDragMethod = new PathDragObjOwn( mrView ); + pDragMethod = new PathDragObjOwn(mrView); } - else if( pHdl->GetKind() != HDL_BWGT ) + else if(HDL_BWGT != pHdl->GetKind()) { - pDragMethod = new PathDragResize( mrView, xTag ); + pDragMethod = new PathDragResize(mrView, xTag); } - mrView.BegDragObj(aStartPoint, pHdl, 0.0, pDragMethod); - - if(mrView.IsDragObj()) - { - const bool bWasNoSnap(mrView.GetDragStat().IsNoSnap()); - const bool bWasSnapEnabled(mrView.IsSnapEnabled()); - - // switch snapping off - if(!bWasNoSnap) - ((SdrDragStat&)mrView.GetDragStat()).SetNoSnap(true); - if(bWasSnapEnabled) - mrView.SetSnapEnabled(false); - - mrView.MovAction(aEndPoint); - mrView.EndDragObj(); - - // restore snap - if(!bWasNoSnap) - ((SdrDragStat&)mrView.GetDragStat()).SetNoSnap(bWasNoSnap); - if(bWasSnapEnabled) - mrView.SetSnapEnabled(bWasSnapEnabled); - } + mrView.MoveHandleByVector(*pHdl, basegfx::B2DVector(fX, fY), 0, pDragMethod); + + // TTTT:HANDLE + //const basegfx::B2DPoint aStartPoint(pHdl->getPosition()); + //const basegfx::B2DPoint aEndPoint(aStartPoint + basegfx::B2DPoint(fX, fY)); + // + //// start dragging + //rtl::Reference< MotionPathTag > xTag( this ); + //SdrDragMethod* pDragMethod = 0; + // + //mrView.BegDragObj(aStartPoint, pHdl, 0.0, pDragMethod); + // + //if(mrView.IsDragObj()) + //{ + // const bool bWasNoSnap(mrView.GetDragStat().IsNoSnap()); + // const bool bWasSnapEnabled(mrView.IsSnapEnabled()); + // + // // switch snapping off + // if(!bWasNoSnap) + // ((SdrDragStat&)mrView.GetDragStat()).SetNoSnap(true); + // if(bWasSnapEnabled) + // mrView.SetSnapEnabled(false); + // + // mrView.MovAction(aEndPoint); + // mrView.EndDragObj(); + // + // // restore snap + // if(!bWasNoSnap) + // ((SdrDragStat&)mrView.GetDragStat()).SetNoSnap(bWasNoSnap); + // if(bWasSnapEnabled) + // mrView.SetSnapEnabled(bWasSnapEnabled); + //} } else { diff --git a/sd/source/ui/func/fupoor.cxx b/sd/source/ui/func/fupoor.cxx index bdaa01a75dd9..defbbda46e4a 100644 --- a/sd/source/ui/func/fupoor.cxx +++ b/sd/source/ui/func/fupoor.cxx @@ -761,7 +761,7 @@ bool FuPoor::KeyInput(const KeyEvent& rKEvt) aMove *= 100; } - if(0L == pHdl) + if(!pHdl) { // #67368# only take action when move is allowed if(mpView->IsMoveAllowed()) @@ -811,44 +811,47 @@ bool FuPoor::KeyInput(const KeyEvent& rKEvt) else { // move handle with index nHandleIndex - if(pHdl && !aMove.equalZero()) - { - // now move the Handle - const basegfx::B2DPoint aStartPoint(pHdl->getPosition()); - const basegfx::B2DPoint aEndPoint(aStartPoint + aMove); - const SdrDragStat& rDragStat = mpView->GetDragStat(); - - // start dragging - mpView->BegDragObj(aStartPoint, pHdl, 0.0); - - if(mpView->IsDragObj()) - { - const bool bWasNoSnap(rDragStat.IsNoSnap()); - const bool bWasSnapEnabled(mpView->IsSnapEnabled()); - - // switch snapping off - if(!bWasNoSnap) - ((SdrDragStat&)rDragStat).SetNoSnap(true); - if(bWasSnapEnabled) - mpView->SetSnapEnabled(false); - - mpView->MovAction(aEndPoint); - mpView->EndDragObj(); - - // restore snap - if(!bWasNoSnap) - ((SdrDragStat&)rDragStat).SetNoSnap(bWasNoSnap); - if(bWasSnapEnabled) - mpView->SetSnapEnabled(bWasSnapEnabled); - } - - // make moved handle visible - const basegfx::B2DRange aVisRange( - aEndPoint - basegfx::B2DPoint(100.0, 100.0), - aEndPoint + basegfx::B2DPoint(100.0, 100.0)); - - mpView->MakeVisibleAtView(aVisRange, *mpWindow); - } + mpView->MoveHandleByVector(*pHdl, aMove, mpWindow, 0); + + // TTTT:HANDLE + //if(pHdl && !aMove.equalZero()) + //{ + // // now move the Handle + // const basegfx::B2DPoint aStartPoint(pHdl->getPosition()); + // const basegfx::B2DPoint aEndPoint(aStartPoint + aMove); + // const SdrDragStat& rDragStat = mpView->GetDragStat(); + // + // // start dragging + // mpView->BegDragObj(aStartPoint, pHdl, 0.0); + // + // if(mpView->IsDragObj()) + // { + // const bool bWasNoSnap(rDragStat.IsNoSnap()); + // const bool bWasSnapEnabled(mpView->IsSnapEnabled()); + // + // // switch snapping off + // if(!bWasNoSnap) + // ((SdrDragStat&)rDragStat).SetNoSnap(true); + // if(bWasSnapEnabled) + // mpView->SetSnapEnabled(false); + // + // mpView->MovAction(aEndPoint); + // mpView->EndDragObj(); + // + // // restore snap + // if(!bWasNoSnap) + // ((SdrDragStat&)rDragStat).SetNoSnap(bWasNoSnap); + // if(bWasSnapEnabled) + // mpView->SetSnapEnabled(bWasSnapEnabled); + // } + // + // // make moved handle visible + // const basegfx::B2DRange aVisRange( + // aEndPoint - basegfx::B2DPoint(100.0, 100.0), + // aEndPoint + basegfx::B2DPoint(100.0, 100.0)); + // + // mpView->MakeVisibleAtView(aVisRange, *mpWindow); + //} } // #109007# diff --git a/sd/source/ui/view/sdview.cxx b/sd/source/ui/view/sdview.cxx index 8d749637cece..883a3cf4cd71 100644 --- a/sd/source/ui/view/sdview.cxx +++ b/sd/source/ui/view/sdview.cxx @@ -1490,8 +1490,13 @@ void View::ChangeMarkedObjectsBulletsNumbering( pOutliner->Clear(); } } - // Broadcast the object change event. - if (!pTextObj->AdjustTextFrameWidthAndHeight()) + + // broadcast if no change from AdjustTextFrameWidthAndHeight + const basegfx::B2DHomMatrix aOld(pTextObj->getSdrObjectTransformation()); + + pTextObj->AdjustTextFrameWidthAndHeight(); + + if(aOld == pTextObj->getSdrObjectTransformation()) { pTextObj->SetChanged(); const SdrObjectChangeBroadcaster aSdrObjectChangeBroadcaster(*pTextObj); diff --git a/svx/inc/svx/sdr/primitive2d/sdrtextprimitive2d.hxx b/svx/inc/svx/sdr/primitive2d/sdrtextprimitive2d.hxx index dbf763a8f5e1..fbc66481ee61 100644 --- a/svx/inc/svx/sdr/primitive2d/sdrtextprimitive2d.hxx +++ b/svx/inc/svx/sdr/primitive2d/sdrtextprimitive2d.hxx @@ -64,11 +64,11 @@ namespace drawinglayer // remember last PageNumber for which a decomposition was made. This is only used // when mbContainsPageField is true, else it is 0 - sal_Int16 mnLastPageNumber; + sal_uInt32 mnLastPageNumber; // remember last PageCount for which a decomposition was made. This is only used // when mbContainsPageCountField is true, else it is 0 - sal_Int16 mnLastPageCount; + sal_uInt32 mnLastPageCount; // #i101443# remember last TextBackgroundColor to decide if a new decomposition is // needed because of background color change diff --git a/svx/inc/svx/sdr/properties/customshapeproperties.hxx b/svx/inc/svx/sdr/properties/customshapeproperties.hxx index 9b4db89316f2..7dd520d9db37 100644 --- a/svx/inc/svx/sdr/properties/customshapeproperties.hxx +++ b/svx/inc/svx/sdr/properties/customshapeproperties.hxx @@ -49,6 +49,10 @@ namespace sdr // react on Item change virtual void ItemChange(const sal_uInt16 nWhich, const SfxPoolItem* pNewItem); + // Called after ItemChange() is done for all items. Allows local reactions on + // specific item changes + virtual void PostItemChange(const sal_uInt16 nWhich); + // clear single item virtual void ClearObjectItem(const sal_uInt16 nWhich = 0); diff --git a/svx/inc/svx/svdglue.hxx b/svx/inc/svx/svdglue.hxx index 8ab548d41992..e36ea8797522 100644 --- a/svx/inc/svx/svdglue.hxx +++ b/svx/inc/svx/svdglue.hxx @@ -19,8 +19,6 @@ * *************************************************************/ - - #ifndef _SVDGLUE_HXX #define _SVDGLUE_HXX @@ -32,6 +30,91 @@ //////////////////////////////////////////////////////////////////////////////////////////////////// +namespace sdr +{ + namespace glue + { + class SVX_DLLPUBLIC Point + { + public: + enum Alignment + { + Alignment_None, + Alignment_Minimum, + Alignment_Center, + Alignment_Maximum + }; + + private: + // position in unit coordinates [0.0 .. 1.0] in X,Y + basegfx::B2DPoint maUnitPosition; + + // escape direction vector. If zero, escape direction is smart. Else + // it will be normalized + basegfx::B2DVector maEscapeVector; + + // horizontal and vertical alignments. If != Alignment_None the + // position will change as distance from the defined anchor position. + // If == Alignment_None position is relative + Alignment meHorizontalAlignment; + Alignment meVerticalAlignment; + + // unique identifier ID. All Points in one list need unique identifiers + // and will be sorted by these. This is administrated by the List class + sal_uInt32 maID; + + /// bitfield + + // needed to separate user-defined points from the ones from CustomShapes + bool mbUserDefined : 1; + + // write access to ID is limited to list class only + void setID(sal_uInt32 nNew) { maID = nNew; } + + protected: + public: + Point( + const basegfx::B2DPoint& rUnitPosition = basegfx::B2DPoint(0.5, 0.5), + const basegfx::B2DVector& rEscapeVector = basegfx::B2DVector(0.0, 0.0), + Alignment eHorizontalAlignment = Alignment_None, + Alignment eVerticalAlignment = Alignment_None, + bool bUserDefined = true) + : maUnitPosition(rUnitPosition), + maEscapeVector(rEscapeVector), + meHorizontalAlignment(eHorizontalAlignment), + meVerticalAlignment(eVerticalAlignment), + maID(0), + mbUserDefined(bUserDefined) + { + } + + // get/set UnitPosition. Always in [0.0 .. 1.0] in Y and Y, will be truncated at set + const basegfx::B2DPoint& getUnitPosition() const { return maUnitPosition; } + void setUnitPosition(const basegfx::B2DPoint& rNew); + + // get/set EscapeVector. Set willl normalize the vector + const basegfx::B2DVector& getEscapeVector() const { return maEscapeVector; } + void setEscapeVector(const basegfx::B2DVector& rNew); + + // get/set HorizontalAlignment + Alignment getHorizontalAlignment() const { return meHorizontalAlignment; } + void setHorizontalAlignment(Alignment eNew) { meHorizontalAlignment = eNew; } + + // get/set VerticalAlignment + Alignment getVerticalAlignment() const { return meVerticalAlignment; } + void setVerticalAlignment(Alignment eNew) { meVerticalAlignment = eNew; } + + // read access to ID (write is private and limitied to list class) + sal_uInt32 getID() const { return maID; } + }; + + + + } // end of namespace glue +} // end of namespace sdr + +//////////////////////////////////////////////////////////////////////////////////////////////////// + #define SDRESC_SMART 0x0000 #define SDRESC_LEFT 0x0001 #define SDRESC_RIGHT 0x0002 diff --git a/svx/inc/svx/svdmrkv.hxx b/svx/inc/svx/svdmrkv.hxx index 8af22f4f8241..b3b84913407c 100644 --- a/svx/inc/svx/svdmrkv.hxx +++ b/svx/inc/svx/svdmrkv.hxx @@ -168,6 +168,7 @@ protected: void SaveMarkHandleFocus(const SdrHdlList& rTarget); virtual void CreateMarkHandles(SdrHdlList& rTarget); void RestoreMarkHandleFocus(SdrHdlList& rTarget); + void AdaptFocusHandleOnMove(const basegfx::B2DVector& rDistance); public: // completely recreate all SdrHdl based controller objects for all views diff --git a/svx/inc/svx/svdoashp.hxx b/svx/inc/svx/svdoashp.hxx index bf113034e1f4..3bbf83539162 100644 --- a/svx/inc/svx/svdoashp.hxx +++ b/svx/inc/svx/svdoashp.hxx @@ -116,7 +116,7 @@ public: void ImpCheckCustomGluePointsAreAdded(); // returns the new text range that corresponds to the current logic range. The return value can be empty if nothing changed. - basegfx::B2DRange ImpCalculateTextFrame(const bool bHgt, const bool bWdt); + basegfx::B2DRange ImpCalculateTextFrame(); public: // #i37011# @@ -127,7 +127,6 @@ public: static basegfx::B2DPolyPolygon GetLineGeometry( const SdrObjCustomShape* pCustomShape, const bool bBezierAllowed ); protected: - String aName; virtual ~SdrObjCustomShape(); @@ -135,6 +134,13 @@ protected: /// method to copy all data from given source virtual void copyDataFromSdrObject(const SdrObject& rSource); + // #115391# new method for SdrObjCustomShape and SdrTextObj to correctly handle and set + // SDRATTR_TEXT_MINFRAMEWIDTH and SDRATTR_TEXT_MINFRAMEHEIGHT based on all settings, necessities + // and object sizes + virtual void AdaptTextMinSize(); + + virtual basegfx::B2DRange AdjustTextFrameWidthAndHeight(const basegfx::B2DRange& rRange) const; + public: /// create a copy, evtl. with a different target model (if given) virtual SdrObject* CloneSdrObject(SdrModel* pTargetModel = 0) const; @@ -187,8 +193,7 @@ public: virtual bool MovCreate(SdrDragStat& rStat); // #i37448# virtual bool EndCreate(SdrDragStat& rStat, SdrCreateCmd eCmd); - virtual basegfx::B2DRange AdjustTextFrameWidthAndHeight(const basegfx::B2DRange& rRange, bool bHgt = true, bool bWdt = true) const; - virtual bool AdjustTextFrameWidthAndHeight(bool bHgt = true, bool bWdt = true); + virtual void AdjustTextFrameWidthAndHeight(); virtual bool IsAutoGrowHeight() const; virtual bool IsAutoGrowWidth() const; virtual void SetVerticalWriting( bool bVertical ); diff --git a/svx/inc/svx/svdobj.hxx b/svx/inc/svx/svdobj.hxx index a30a01269989..e8dbd2200e51 100644 --- a/svx/inc/svx/svdobj.hxx +++ b/svx/inc/svx/svdobj.hxx @@ -448,7 +448,7 @@ protected: virtual void copyDataFromSdrObject(const SdrObject& rSource); public: - bool IsPasteResize() const { return mbPasteResize; } + bool IsPasteResize() const { return mbPasteResize; } // #51139# TTTT: Probably not needed anymore void SetPasteResize(bool bOn) { if(mbPasteResize != bOn) mbPasteResize = bOn; } /// create a copy, evtl. with a different target model (if given) diff --git a/svx/inc/svx/svdotable.hxx b/svx/inc/svx/svdotable.hxx index 78c6d6edf5eb..c70ea07f1b7d 100644 --- a/svx/inc/svx/svdotable.hxx +++ b/svx/inc/svx/svdotable.hxx @@ -116,6 +116,8 @@ protected: /// method to copy all data from given source virtual void copyDataFromSdrObject(const SdrObject& rSource); + virtual basegfx::B2DRange AdjustTextFrameWidthAndHeight(const basegfx::B2DRange& rRange) const; + public: /// create a copy, evtl. with a different target model (if given) virtual SdrObject* CloneSdrObject(SdrModel* pTargetModel = 0) const; @@ -227,8 +229,7 @@ public: virtual sal_uInt16 GetObjIdentifier() const; virtual void SetChanged(); - virtual basegfx::B2DRange AdjustTextFrameWidthAndHeight(const basegfx::B2DRange& rRange, bool bHgt = true, bool bWdt = true) const; - virtual bool AdjustTextFrameWidthAndHeight(bool bHgt = true, bool bWdt = true); + virtual void AdjustTextFrameWidthAndHeight(); virtual void TakeObjNameSingul(String& rName) const; virtual void TakeObjNamePlural(String& rName) const; virtual basegfx::B2DPolyPolygon TakeXorPoly() const; diff --git a/svx/inc/svx/svdotext.hxx b/svx/inc/svx/svdotext.hxx index 581014567010..ca23895cb049 100644 --- a/svx/inc/svx/svdotext.hxx +++ b/svx/inc/svx/svdotext.hxx @@ -252,6 +252,14 @@ protected: // Flag for allowing text animation. Default is sal_true. bool mbTextAnimationAllowed : 1; + /// flag value used in AdaptTextMinSize() to not trigger another adaption + /// when already one is initiated + bool mbAdaptingTextMinSize : 1; + + /// flag value used in AdjustTextFrameWidthAndHeight() to not trigger another adjust + /// when already one is initiated + bool mbAdjustingTextFrameWidthAndHeight : 1; + SdrOutliner& ImpGetDrawOutliner() const; private: @@ -279,8 +287,11 @@ protected: void SetTextSizeDirty() { bTextSizeDirty=true; } void SetEdgeRadius(sal_Int32 nRad); - bool SetMinTextFrameHeight(sal_Int32 nHgt); - bool SetMinTextFrameWidth(sal_Int32 nWdt); + + // #115391# new method for SdrObjCustomShape and SdrTextObj to correctly handle and set + // SDRATTR_TEXT_MINFRAMEWIDTH and SDRATTR_TEXT_MINFRAMEHEIGHT based on all settings, necessities + // and object sizes + virtual void AdaptTextMinSize(); // protected consructor: only a tooling class, do not incarnate SdrTextObj( @@ -294,7 +305,9 @@ protected: virtual void copyDataFromSdrObject(const SdrObject& rSource); // helper for AdjustTextFrameWidthAndHeight which contains the common parts to avoid useless code copying - basegfx::B2DRange ImpAdjustTextFrameWidthAndHeight(const basegfx::B2DRange& rRange, bool bHgt, bool bWdt, bool bCheckAnimation) const; + basegfx::B2DRange ImpAdjustTextFrameWidthAndHeight(const basegfx::B2DRange& rRange, bool bCheckAnimation) const; + + virtual basegfx::B2DRange AdjustTextFrameWidthAndHeight(const basegfx::B2DRange& rRange) const; public: /// create a copy, evtl. with a different target model (if given) @@ -322,8 +335,7 @@ public: bool ReloadLinkedText(bool bForceLoad=false); bool LoadText(const String& rFileName, const String& rFilterName, rtl_TextEncoding eCharSet); - virtual basegfx::B2DRange AdjustTextFrameWidthAndHeight(const basegfx::B2DRange& rRange, bool bHgt = true, bool bWdt = true) const; - virtual bool AdjustTextFrameWidthAndHeight(bool bHgt = true, bool bWdt = true); + virtual void AdjustTextFrameWidthAndHeight(); void ResizeTextAttributes(const Fraction& xFact, const Fraction& yFact); bool IsTextFrame() const { return bTextFrame; } bool IsOutlText() const { return bTextFrame && (eTextKind==OBJ_OUTLINETEXT || eTextKind==OBJ_TITLETEXT); } diff --git a/svx/inc/svx/svdview.hxx b/svx/inc/svx/svdview.hxx index 9e9b3cb04997..a5eeeda41e58 100644 --- a/svx/inc/svx/svdview.hxx +++ b/svx/inc/svx/svdview.hxx @@ -283,6 +283,9 @@ public: SvtAccessibilityOptions& getAccessibilityOptions(); virtual void onAccessibilityOptionsChanged(); + + // TTTT:HANDLE + void MoveHandleByVector(const SdrHdl& rHdl, const basegfx::B2DVector& rDistance, Window* pMakeVisibleWindow, SdrDragMethod* pOwnDragMethod); }; //////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/svx/source/dialog/graphctl.cxx b/svx/source/dialog/graphctl.cxx index e4e866f54332..d94d77c07dd9 100644 --- a/svx/source/dialog/graphctl.cxx +++ b/svx/source/dialog/graphctl.cxx @@ -558,7 +558,7 @@ void GraphCtrl::KeyInput( const KeyEvent& rKEvt ) const SdrHdlList& rHdlList = pView->GetHdlList(); SdrHdl* pHdl = rHdlList.GetFocusHdl(); - if(0L == pHdl) + if(!pHdl) { // #90129# restrict movement to WorkArea const basegfx::B2DRange& rWorkRange = pView->GetWorkArea(); @@ -601,37 +601,40 @@ void GraphCtrl::KeyInput( const KeyEvent& rKEvt ) else { // move handle with index nHandleIndex - if(pHdl && !aMove.equalZero()) - { - // now move the Handle - const basegfx::B2DPoint aStartPoint(pHdl->getPosition()); - const basegfx::B2DPoint aEndPoint(aStartPoint + aMove); - const SdrDragStat& rDragStat = pView->GetDragStat(); - - // start dragging - pView->BegDragObj(aStartPoint, pHdl, 0.0); - - if(pView->IsDragObj()) - { - const bool bWasNoSnap(rDragStat.IsNoSnap()); - const bool bWasSnapEnabled(pView->IsSnapEnabled()); - - // switch snapping off - if(!bWasNoSnap) - ((SdrDragStat&)rDragStat).SetNoSnap(true); - if(bWasSnapEnabled) - pView->SetSnapEnabled(false); - - pView->MovAction(aEndPoint); - pView->EndDragObj(); - - // restore snap - if(!bWasNoSnap) - ((SdrDragStat&)rDragStat).SetNoSnap(bWasNoSnap); - if(bWasSnapEnabled) - pView->SetSnapEnabled(bWasSnapEnabled); - } - } + pView->MoveHandleByVector(*pHdl, aMove, 0, 0); + + // TTTT:HANDLE + //if(pHdl && !aMove.equalZero()) + //{ + // // now move the Handle + // const basegfx::B2DPoint aStartPoint(pHdl->getPosition()); + // const basegfx::B2DPoint aEndPoint(aStartPoint + aMove); + // const SdrDragStat& rDragStat = pView->GetDragStat(); + // + // // start dragging + // pView->BegDragObj(aStartPoint, pHdl, 0.0); + // + // if(pView->IsDragObj()) + // { + // const bool bWasNoSnap(rDragStat.IsNoSnap()); + // const bool bWasSnapEnabled(pView->IsSnapEnabled()); + // + // // switch snapping off + // if(!bWasNoSnap) + // ((SdrDragStat&)rDragStat).SetNoSnap(true); + // if(bWasSnapEnabled) + // pView->SetSnapEnabled(false); + // + // pView->MovAction(aEndPoint); + // pView->EndDragObj(); + // + // // restore snap + // if(!bWasNoSnap) + // ((SdrDragStat&)rDragStat).SetNoSnap(bWasNoSnap); + // if(bWasSnapEnabled) + // pView->SetSnapEnabled(bWasSnapEnabled); + // } + //} } bProc = true; diff --git a/svx/source/sdr/primitive2d/sdrtextprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrtextprimitive2d.cxx index 1f4c3f2a21c5..0a5a6d6f12bd 100644 --- a/svx/source/sdr/primitive2d/sdrtextprimitive2d.cxx +++ b/svx/source/sdr/primitive2d/sdrtextprimitive2d.cxx @@ -45,9 +45,9 @@ using namespace com::sun::star; namespace { - sal_Int16 getPageNumber(const uno::Reference< drawing::XDrawPage >& rxDrawPage) + sal_uInt32 getPageNumber(const uno::Reference< drawing::XDrawPage >& rxDrawPage) { - sal_Int16 nRetval(0); + sal_uInt32 nRetval(0); uno::Reference< beans::XPropertySet > xSet(rxDrawPage, uno::UNO_QUERY); if (xSet.is()) @@ -55,7 +55,10 @@ namespace try { const uno::Any aNumber(xSet->getPropertyValue(::rtl::OUString::createFromAscii("Number"))); - aNumber >>= nRetval; + sal_Int16 aTemp(0); + + aNumber >>= aTemp; + nRetval = aTemp; } catch(const uno::Exception&) { @@ -66,9 +69,9 @@ namespace return nRetval; } - sal_Int16 getPageCount(const uno::Reference< drawing::XDrawPage >& rxDrawPage) + sal_uInt32 getPageCount(const uno::Reference< drawing::XDrawPage >& rxDrawPage) { - sal_Int16 nRetval(0); + sal_uInt32 nRetval(0); SdrPage* pPage = GetSdrPageFromXDrawPage(rxDrawPage); if(pPage) @@ -81,7 +84,8 @@ namespace else { const sal_uInt32 nPageCount(pPage->getSdrModelFromSdrPage().GetPageCount()); - nRetval = ((sal_Int16)nPageCount - 1) / 2; + + nRetval = (nPageCount - 1) / 2; } } @@ -136,8 +140,8 @@ namespace drawinglayer bool bCurrentlyVisualizingPageIsSet(false); Color aNewTextBackgroundColor; bool bNewTextBackgroundColorIsSet(false); - sal_Int16 nCurrentlyValidPageNumber(0); - sal_Int16 nCurrentlyValidPageCount(0); + sal_uInt32 nCurrentlyValidPageNumber(0); + sal_uInt32 nCurrentlyValidPageCount(0); if(getBuffered2DDecomposition().hasElements()) { diff --git a/svx/source/sdr/properties/customshapeproperties.cxx b/svx/source/sdr/properties/customshapeproperties.cxx index cfc1389cf254..73263559b845 100644 --- a/svx/source/sdr/properties/customshapeproperties.cxx +++ b/svx/source/sdr/properties/customshapeproperties.cxx @@ -40,13 +40,19 @@ namespace sdr { void CustomShapeProperties::UpdateTextFrameStatus() { - SdrTextObj& rObj = (SdrTextObj&)GetSdrObject(); - SdrOnOffItem& rAutoGrowHeightItem = - (SdrOnOffItem&)rObj.GetMergedItem( SDRATTR_TEXT_AUTOGROWHEIGHT ); - rObj.bTextFrame = rAutoGrowHeightItem.GetValue() != 0; + SdrObjCustomShape& rObj = static_cast< SdrObjCustomShape& >(GetSdrObject()); + const bool bOld(rObj.bTextFrame); - if ( rObj.bTextFrame ) - rObj.AdjustTextFrameWidthAndHeight(); + rObj.bTextFrame = 0 != static_cast< const SdrOnOffItem& >(GetObjectItemSet().Get(SDRATTR_TEXT_AUTOGROWHEIGHT)).GetValue(); + + if(rObj.bTextFrame != bOld) + { + rObj.InvalidateRenderGeometry(); + + // #115391# Potential recursuin, since it calls SetObjectItemSet again, but rObj.bTextFrame + // will not change again, thus it will be only one level and terminate + rObj.AdaptTextMinSize(); + } } SfxItemSet& CustomShapeProperties::CreateObjectSpecificItemSet(SfxItemPool& rPool) @@ -76,11 +82,11 @@ namespace sdr bool CustomShapeProperties::AllowItemChange(const sal_uInt16 nWhich, const SfxPoolItem* pNewItem ) const { - sal_Bool bAllowItemChange = sal_True; + bool bAllowItemChange = true; if ( !pNewItem ) { if ( ( nWhich >= SDRATTR_CUSTOMSHAPE_FIRST ) && ( nWhich <= SDRATTR_CUSTOMSHAPE_LAST ) ) - bAllowItemChange = sal_False; + bAllowItemChange = false; } if ( bAllowItemChange ) bAllowItemChange = TextProperties::AllowItemChange( nWhich, pNewItem ); @@ -98,7 +104,7 @@ namespace sdr TextProperties::ClearObjectItemDirect( nWhich2 ); nWhich2 = aIter.NextWhich(); } - SfxItemSet aSet((SfxItemPool&)(GetSdrObject().GetObjectItemPool())); + SfxItemSet aSet(GetSdrObject().GetObjectItemPool()); ItemSetChanged(aSet); } else @@ -123,66 +129,58 @@ namespace sdr void CustomShapeProperties::ItemSetChanged(const SfxItemSet& rSet) { - SdrObjCustomShape& rObj = (SdrObjCustomShape&)GetSdrObject(); + // call parent + TextProperties::ItemSetChanged(rSet); + + // update bTextFrame and RenderGeometry + UpdateTextFrameStatus(); + } - if( SFX_ITEM_SET == rSet.GetItemState( SDRATTR_TEXT_AUTOGROWHEIGHT ) ) + void CustomShapeProperties::PostItemChange(const sal_uInt16 nWhich) + { + switch(nWhich) { - rObj.bTextFrame = ((SdrOnOffItem&)rSet.Get( SDRATTR_TEXT_AUTOGROWHEIGHT )).GetValue() != 0; + case SDRATTR_TEXT_AUTOGROWHEIGHT: + { + // #115391# update bTextFrame and RenderGeometry using AdaptTextMinSize() + UpdateTextFrameStatus(); + break; + } + default: + { + break; + } } // call parent - TextProperties::ItemSetChanged(rSet); - - // local changes, removing cached objects - rObj.InvalidateRenderGeometry(); + TextProperties::PostItemChange(nWhich); } void CustomShapeProperties::ItemChange(const sal_uInt16 nWhich, const SfxPoolItem* pNewItem) { - SdrObjCustomShape& rObj = (SdrObjCustomShape&)GetSdrObject(); - //OutlinerParaObject* pParaObj = rObj.GetOutlinerParaObject(); - - if( pNewItem && ( SDRATTR_TEXT_AUTOGROWHEIGHT == nWhich ) ) - { - rObj.bTextFrame = ((SdrOnOffItem*)pNewItem)->GetValue() != 0; - } // call parent TextProperties::ItemChange( nWhich, pNewItem ); - rObj.InvalidateRenderGeometry(); + // update bTextFrame and RenderGeometry + UpdateTextFrameStatus(); } void CustomShapeProperties::SetStyleSheet(SfxStyleSheet* pNewStyleSheet, bool bDontRemoveHardAttr) { + // call parent TextProperties::SetStyleSheet( pNewStyleSheet, bDontRemoveHardAttr ); + + // update bTextFrame and RenderGeometry UpdateTextFrameStatus(); } void CustomShapeProperties::ForceDefaultAttributes() { + // update bTextFrame and RenderGeometry UpdateTextFrameStatus(); -/* SJ: Following is no good if creating customshapes, leading to objects that are white after loading via xml - - SdrTextObj& rObj = (SdrTextObj&)GetSdrObject(); - sal_Bool bTextFrame(rObj.IsTextFrame()); - - // force ItemSet - GetObjectItemSet(); - - if(bTextFrame) - { - mpItemSet->Put(XLineStyleItem(XLINE_NONE)); - mpItemSet->Put(XFillColorItem(String(), Color(COL_WHITE))); - mpItemSet->Put(XFillStyleItem(XFILL_NONE)); - } - else - { - mpItemSet->Put(SvxAdjustItem(SVX_ADJUST_CENTER)); - mpItemSet->Put(SdrTextHorzAdjustItem(SDRTEXTHORZADJUST_CENTER)); - mpItemSet->Put(SdrTextVertAdjustItem(SDRTEXTVERTADJUST_CENTER)); - } -*/ + // SJ: Following is no good if creating customshapes, leading to objects that are white after loading via xml + // This means: Do *not* call parent here is by purpose... } CustomShapeProperties::CustomShapeProperties(SdrObject& rObj) @@ -208,8 +206,7 @@ namespace sdr { TextProperties::Notify( rBC, rHint ); - sal_Bool bRemoveRenderGeometry = sal_False; - + bool bRemoveRenderGeometry = false; const SfxStyleSheetHint *pStyleHint = dynamic_cast< const SfxStyleSheetHint* >( &rHint ); const SfxSimpleHint *pSimpleHint = dynamic_cast< const SfxSimpleHint* >( &rHint ); @@ -219,23 +216,20 @@ namespace sdr { case SFX_STYLESHEET_MODIFIED : case SFX_STYLESHEET_CHANGED : - bRemoveRenderGeometry = sal_True; + bRemoveRenderGeometry = true; break; }; } else if ( pSimpleHint && pSimpleHint->GetId() == SFX_HINT_DATACHANGED ) { - bRemoveRenderGeometry = sal_True; + bRemoveRenderGeometry = true; } + if ( bRemoveRenderGeometry ) { + // update bTextFrame and RenderGeometry UpdateTextFrameStatus(); - - // local changes, removing cached objects - SdrObjCustomShape& rObj = (SdrObjCustomShape&)GetSdrObject(); - rObj.InvalidateRenderGeometry(); } - } } // end of namespace properties } // end of namespace sdr diff --git a/svx/source/sdr/properties/textproperties.cxx b/svx/source/sdr/properties/textproperties.cxx index 7edc6a2c0edd..0bc88c010f77 100644 --- a/svx/source/sdr/properties/textproperties.cxx +++ b/svx/source/sdr/properties/textproperties.cxx @@ -569,10 +569,9 @@ namespace sdr } rObj.SetTextSizeDirty(); - if(rObj.IsTextFrame() && rObj.AdjustTextFrameWidthAndHeight()) + if(rObj.IsTextFrame()) { - // here only repaint wanted - rObj.ActionChanged(); + rObj.AdjustTextFrameWidthAndHeight(); } // #i101556# content of StyleSheet has changed -> new version diff --git a/svx/source/sidebar/possize/PosSizePropertyPanel.cxx b/svx/source/sidebar/possize/PosSizePropertyPanel.cxx index b8a9dbb9fe45..bfac9d081fa1 100644 --- a/svx/source/sidebar/possize/PosSizePropertyPanel.cxx +++ b/svx/source/sidebar/possize/PosSizePropertyPanel.cxx @@ -456,8 +456,9 @@ void PosSizePropertyPanel::HandleContextChange( { case 0: { - mpMtrWidth->SetMin( 2 ); - mpMtrHeight->SetMin( 2 ); + // TTTT: Minimum is 0, added to ressources + // mpMtrWidth->SetMin( 2 ); + // mpMtrHeight->SetMin( 2 ); mpFtPosX->Hide(); mpMtrPosX->Hide(); mpFtPosY->Hide(); @@ -494,8 +495,9 @@ void PosSizePropertyPanel::HandleContextChange( case 1: { - mpMtrWidth->SetMin( 2 ); - mpMtrHeight->SetMin( 2 ); + // TTTT: Minimum is 0, added to ressources + // mpMtrWidth->SetMin( 2 ); + // mpMtrHeight->SetMin( 2 ); mpFtPosX->Hide(); mpMtrPosX->Hide(); mpFtPosY->Hide(); @@ -524,8 +526,9 @@ void PosSizePropertyPanel::HandleContextChange( case 2: { - mpMtrWidth->SetMin( 1 ); - mpMtrHeight->SetMin( 1 ); + // TTTT: Minimum is 0, added to ressources + // mpMtrWidth->SetMin( 1 ); + // mpMtrHeight->SetMin( 1 ); mpFtPosX->Show(); mpMtrPosX->Show(); mpFtPosY->Show(); @@ -556,8 +559,9 @@ void PosSizePropertyPanel::HandleContextChange( case 3: { - mpMtrWidth->SetMin( 1 ); - mpMtrHeight->SetMin( 1 ); + // TTTT: Minimum is 0, added to ressources + // mpMtrWidth->SetMin( 1 ); + // mpMtrHeight->SetMin( 1 ); mpFtPosX->Show(); mpMtrPosX->Show(); mpFtPosY->Show(); diff --git a/svx/source/sidebar/possize/PosSizePropertyPanel.src b/svx/source/sidebar/possize/PosSizePropertyPanel.src index cf931c4a55eb..73a13fe5694c 100644 --- a/svx/source/sidebar/possize/PosSizePropertyPanel.src +++ b/svx/source/sidebar/possize/PosSizePropertyPanel.src @@ -52,6 +52,7 @@ Control RID_SIDEBAR_POSSIZE_PANEL QuickHelpText [ en-US ] = "Enter a width for the selected object."; Repeat = TRUE ; Spin = TRUE ; + Minimum = 0; Maximum = 9999 ; StrictFormat = TRUE ; Unit = FUNIT_INCH; @@ -73,6 +74,7 @@ Control RID_SIDEBAR_POSSIZE_PANEL QuickHelpText [ en-US ] = "Enter a height for the selected object."; Repeat = TRUE ; Spin = TRUE ; + Minimum = 0; Maximum = 9999 ; StrictFormat = TRUE ; Unit = FUNIT_INCH; diff --git a/svx/source/svdraw/svddrgmt.cxx b/svx/source/svdraw/svddrgmt.cxx index 16d8b25c6f0e..ac6841a61abb 100644 --- a/svx/source/svdraw/svddrgmt.cxx +++ b/svx/source/svdraw/svddrgmt.cxx @@ -599,7 +599,23 @@ SdrObject* SdrDragMethod::GetDragObj() const void SdrDragMethod::applyCurrentTransformationToSdrObject(SdrObject& rTarget) { // use get/setSdrObjectTransformation now. This will also work when object has a path - rTarget.setSdrObjectTransformation(getCurrentTransformation() * rTarget.getSdrObjectTransformation()); + basegfx::B2DHomMatrix aObjectMatrix(rTarget.getSdrObjectTransformation()); + + // check for zero-width/height objects + if(basegfx::fTools::equalZero(aObjectMatrix.get(0, 0))) + { + // no width + aObjectMatrix.set(0, 0, 1.0); + } + + if(basegfx::fTools::equalZero(aObjectMatrix.get(1, 1))) + { + // no height + aObjectMatrix.set(1, 1, 1.0); + } + + aObjectMatrix = getCurrentTransformation() * aObjectMatrix; + rTarget.setSdrObjectTransformation(aObjectMatrix); } void SdrDragMethod::applyCurrentTransformationToPolyPolygon(basegfx::B2DPolyPolygon& rTarget) diff --git a/svx/source/svdraw/svdedtv1.cxx b/svx/source/svdraw/svdedtv1.cxx index 0ec42f479a3b..c42b0227dd63 100644 --- a/svx/source/svdraw/svdedtv1.cxx +++ b/svx/source/svdraw/svdedtv1.cxx @@ -251,7 +251,23 @@ void SdrEditView::ResizeMarkedObj(const basegfx::B2DPoint& rRefPoint, const base AddUndo( getSdrModelFromSdrView().GetSdrUndoFactory().CreateUndoGeoObject(*pO)); } - sdr::legacy::transformSdrObject(*pO, aTransformation); + basegfx::B2DHomMatrix aObjectMatrix(pO->getSdrObjectTransformation()); + + // check for zero-width/height objects + if(basegfx::fTools::equalZero(aObjectMatrix.get(0, 0))) + { + // no width + aObjectMatrix.set(0, 0, 1.0); + } + + if(basegfx::fTools::equalZero(aObjectMatrix.get(1, 1))) + { + // no height + aObjectMatrix.set(1, 1, 1.0); + } + + aObjectMatrix = aTransformation * aObjectMatrix; + pO->setSdrObjectTransformation(aObjectMatrix); } if(bUndo) diff --git a/svx/source/svdraw/svdglue.cxx b/svx/source/svdraw/svdglue.cxx index 6c1c15d4e68c..c22941e8f812 100644 --- a/svx/source/svdraw/svdglue.cxx +++ b/svx/source/svdraw/svdglue.cxx @@ -32,6 +32,40 @@ //////////////////////////////////////////////////////////////////////////////////////////////////// +namespace sdr +{ + namespace glue + { + void Point::setUnitPosition(const basegfx::B2DPoint& rNew) + { + const aClampedNew(basegfx::clamp(rNew, 0.0, 1.0)); + + if(aClampedNew != maUnitPosition) + { + maUnitPosition = aClampedNew; + } + } + + void Point::setEscapeVector(const basegfx::B2DVector& rNew) + { + const basegfx::B2DVector aNormalizedNew(rNew.normalize()); + + if(aNormalizedNew != maEscapeVector) + { + maEscapeVector = aNormalizedNew; + } + } + + + + + + + } // end of namespace glue +} // end of namespace sdr + +//////////////////////////////////////////////////////////////////////////////////////////////////// + SdrGluePoint::SdrGluePoint() : mnEscDir(SDRESC_SMART), mnId(0), diff --git a/svx/source/svdraw/svdmrkv.cxx b/svx/source/svdraw/svdmrkv.cxx index 5b7561cd54b5..294a3d42feeb 100644 --- a/svx/source/svdraw/svdmrkv.cxx +++ b/svx/source/svdraw/svdmrkv.cxx @@ -641,6 +641,7 @@ const SdrHdlList& SdrMarkView::GetHdlList() const { if(IsActive()) { + // if a pending refresh of SdrHdl is scheduled, execute it now directly const_cast< SdrMarkView* >(this)->Timeout(); } @@ -649,29 +650,50 @@ const SdrHdlList& SdrMarkView::GetHdlList() const void SdrMarkView::Timeout() { + // stop timer Stop(); + // reset old focus data to invalid (always) + mbSaveOldFocus = false; + if(maViewSdrHandleList.GetHdlCount()) { + // save focus if it exists (for SdrPathObj point selections) SaveMarkHandleFocus(maViewSdrHandleList); + + // clear all handles (delete them and their associated data) maViewSdrHandleList.Clear(); } if(!maViewSdrHandleList.GetHdlCount()) { + // re-create all handles CreateMarkHandles(maViewSdrHandleList); + + // try to restore focus data (for SdrPathObj point selections) RestoreMarkHandleFocus(maViewSdrHandleList); if(maViewSdrHandleList.GetHdlCount()) { - // create overlay objects + // create visualization (all overlay objects based on handles) maViewSdrHandleList.CreateVisualizations(); } } + + if(!maViewSdrHandleList.GetHdlCount()) + { + // reset old focus data when no handles were created for new situation + maViewSdrHandleList.ResetFocusHdl(); + } } void SdrMarkView::RecreateAllMarkHandles() { + // schedule a reset of all SdrHdl; do not do this directly every time, but + // setup the timer to ensure this is done when there will be time. When this would + // be done always directly, too many create/delete cycles of SdrHdl would happen + // in some loops/actions the views perform. The recreation is also triggered + // when someone accesses the SdrHdl list using GetHdlList() (see there) if(!IsActive()) { SetTimeout(1); @@ -681,8 +703,6 @@ void SdrMarkView::RecreateAllMarkHandles() void SdrMarkView::SaveMarkHandleFocus(const SdrHdlList& rTarget) { - mbSaveOldFocus = false; - if(rTarget.GetHdlCount()) { // #105722# remember old focus handle values to search for it again @@ -723,6 +743,100 @@ void SdrMarkView::RestoreMarkHandleFocus(SdrHdlList& rTarget) } } +void SdrMarkView::AdaptFocusHandleOnMove(const basegfx::B2DVector& rDistance) +{ + if(!rDistance.equalZero()) + { + SdrHdl* pFocusHdl = GetHdlList().GetFocusHdl(); + + if(pFocusHdl) + { + if(pFocusHdl->IsFocusHdl() && (pFocusHdl->IsCornerHdl() || pFocusHdl->IsVertexHdl())) + { + const sal_uInt32 aCount(GetHdlList().GetHdlCount()); + + if(aCount) + { + basegfx::B2DRange aCurrent; + + for(sal_uInt32 a(0); a < aCount; a++) + { + SdrHdl* pCandidate = GetHdlList().GetHdlByIndex(a); + + if(pCandidate->IsCornerHdl() || pCandidate->IsVertexHdl()) + { + aCurrent.expand(pCandidate->getPosition()); + } + } + + if(!aCurrent.isEmpty()) + { + SdrHdlKind aNewKind(pFocusHdl->GetKind()); + const basegfx::B2DPoint aEndPoint(pFocusHdl->getPosition() + rDistance); + const bool bStartLeft(HDL_UPLFT == aNewKind || HDL_LEFT == aNewKind || HDL_LWLFT == aNewKind); + const bool bStartRight(HDL_UPRGT == aNewKind || HDL_RIGHT == aNewKind || HDL_LWRGT == aNewKind); + const bool bMirrorLTR(bStartLeft && basegfx::fTools::more(aEndPoint.getX(), aCurrent.getMaxX())); + const bool bMirrorRTL(bStartRight && basegfx::fTools::less(aEndPoint.getX(), aCurrent.getMinX())); + + if(bMirrorLTR) + { + if(HDL_UPLFT == aNewKind) + aNewKind = HDL_UPRGT; + else if(HDL_LEFT == aNewKind) + aNewKind = HDL_RIGHT; + else + aNewKind = HDL_LWRGT; + } + else if(bMirrorRTL) + { + if(HDL_UPRGT == aNewKind) + aNewKind = HDL_UPLFT; + else if(HDL_RIGHT == aNewKind) + aNewKind = HDL_LEFT; + else + aNewKind = HDL_LWLFT; + } + + const bool bStartTop(HDL_UPLFT == aNewKind || HDL_UPPER == aNewKind || HDL_UPRGT == aNewKind); + const bool bStartBottom(HDL_LWLFT == aNewKind || HDL_LOWER == aNewKind || HDL_LWRGT == aNewKind); + const bool bMirrorTTB(bStartTop && basegfx::fTools::more(aEndPoint.getY(), aCurrent.getMaxY())); + const bool bMirrorBTT(bStartBottom && basegfx::fTools::less(aEndPoint.getY(), aCurrent.getMinY())); + + if(bMirrorTTB) + { + if(HDL_UPLFT == aNewKind) + aNewKind = HDL_LWLFT; + else if(HDL_UPPER == aNewKind) + aNewKind = HDL_LOWER; + else + aNewKind = HDL_LWRGT; + } + else if(bMirrorBTT) + { + if(HDL_LWLFT == aNewKind) + aNewKind = HDL_UPLFT; + else if(HDL_LOWER == aNewKind) + aNewKind = HDL_UPPER; + else + aNewKind = HDL_UPRGT; + } + + if(aNewKind != pFocusHdl->GetKind()) + { + SdrHdl* pNewFocus = GetHdlList().GetHdlByKind(aNewKind); + + if(pNewFocus) + { + maViewSdrHandleList.SetFocusHdl(pNewFocus); + } + } + } + } + } + } + } +} + void SdrMarkView::CreateMarkHandles(SdrHdlList& rTarget) { if(rTarget.GetHdlCount()) @@ -837,62 +951,77 @@ void SdrMarkView::CreateMarkHandles(SdrHdlList& rTarget) } else { - const bool bNoWidth(basegfx::fTools::equalZero(rSnapRange.getWidth())); - const bool bNoHeight(basegfx::fTools::equalZero(rSnapRange.getHeight())); - - if (bNoWidth && bNoHeight) - { - new SdrHdl(rTarget, pSingleSelected, HDL_UPLFT, rSnapRange.getMinimum(), true); - } - else if (!bStdDrag && (bNoWidth || bNoHeight)) - { - new SdrHdl(rTarget, pSingleSelected, HDL_UPLFT, rSnapRange.getMinimum(), true); - new SdrHdl(rTarget, pSingleSelected, HDL_LWRGT, rSnapRange.getMaximum(), true); - } - else - { - const basegfx::B2DPoint aCenter(rSnapRange.getCenter()); - - if(!bNoWidth && !bNoHeight) - { - new SdrHdl(rTarget, pSingleSelected, HDL_UPLFT, rSnapRange.getMinimum(), true); - } - - if(!bNoHeight) - { - new SdrHdl(rTarget, pSingleSelected, HDL_UPPER, basegfx::B2DTuple(aCenter.getX(), rSnapRange.getMinY()), true); - } - - if(!bNoWidth && !bNoHeight) - { - new SdrHdl(rTarget, pSingleSelected, HDL_UPRGT, basegfx::B2DTuple(rSnapRange.getMaxX(), rSnapRange.getMinY()), true); - } - - if(!bNoWidth) - { - new SdrHdl(rTarget, pSingleSelected, HDL_LEFT, basegfx::B2DTuple(rSnapRange.getMinX(), aCenter.getY()), true); - } - - if(!bNoWidth) - { - new SdrHdl(rTarget, pSingleSelected, HDL_RIGHT, basegfx::B2DTuple(rSnapRange.getMaxX(), aCenter.getY()), true); - } - - if(!bNoWidth && !bNoHeight) - { - new SdrHdl(rTarget, pSingleSelected, HDL_LWLFT, basegfx::B2DTuple(rSnapRange.getMinX(), rSnapRange.getMaxY()), true); - } - - if(!bNoHeight) - { - new SdrHdl(rTarget, pSingleSelected, HDL_LOWER, basegfx::B2DTuple(aCenter.getX(), rSnapRange.getMaxY()), true); - } + // TTTT: See below, not needed + //const bool bNoWidth(basegfx::fTools::equalZero(rSnapRange.getWidth())); + //const bool bNoHeight(basegfx::fTools::equalZero(rSnapRange.getHeight())); + // + //if (bNoWidth && bNoHeight) + //{ + // new SdrHdl(rTarget, pSingleSelected, HDL_UPLFT, rSnapRange.getMinimum(), true); + //} + //else if (!bStdDrag && (bNoWidth || bNoHeight)) + //{ + // new SdrHdl(rTarget, pSingleSelected, HDL_UPLFT, rSnapRange.getMinimum(), true); + // new SdrHdl(rTarget, pSingleSelected, HDL_LWRGT, rSnapRange.getMaximum(), true); + //} + //else + //{ + // const basegfx::B2DPoint aCenter(rSnapRange.getCenter()); + // + // if(!bNoWidth && !bNoHeight) + // { + // new SdrHdl(rTarget, pSingleSelected, HDL_UPLFT, rSnapRange.getMinimum(), true); + // } + // + // if(!bNoHeight) + // { + // new SdrHdl(rTarget, pSingleSelected, HDL_UPPER, basegfx::B2DTuple(aCenter.getX(), rSnapRange.getMinY()), true); + // } + // + // if(!bNoWidth && !bNoHeight) + // { + // new SdrHdl(rTarget, pSingleSelected, HDL_UPRGT, basegfx::B2DTuple(rSnapRange.getMaxX(), rSnapRange.getMinY()), true); + // } + // + // if(!bNoWidth) + // { + // new SdrHdl(rTarget, pSingleSelected, HDL_LEFT, basegfx::B2DTuple(rSnapRange.getMinX(), aCenter.getY()), true); + // } + // + // if(!bNoWidth) + // { + // new SdrHdl(rTarget, pSingleSelected, HDL_RIGHT, basegfx::B2DTuple(rSnapRange.getMaxX(), aCenter.getY()), true); + // } + // + // if(!bNoWidth && !bNoHeight) + // { + // new SdrHdl(rTarget, pSingleSelected, HDL_LWLFT, basegfx::B2DTuple(rSnapRange.getMinX(), rSnapRange.getMaxY()), true); + // } + // + // if(!bNoHeight) + // { + // new SdrHdl(rTarget, pSingleSelected, HDL_LOWER, basegfx::B2DTuple(aCenter.getX(), rSnapRange.getMaxY()), true); + // } + // + // if(!bNoWidth && !bNoHeight) + // { + // new SdrHdl(rTarget, pSingleSelected, HDL_LWRGT, rSnapRange.getMaximum(), true); + // } + //} + + // always create all handles to allow focus restauration over keyboard moves; prefer + // bottom-right ones to make mouse hits preferred to bottom-right assuming the next + // resize will be dragged to bottom-right + const basegfx::B2DPoint aCenter(rSnapRange.getCenter()); - if(!bNoWidth && !bNoHeight) - { - new SdrHdl(rTarget, pSingleSelected, HDL_LWRGT, rSnapRange.getMaximum(), true); - } - } + new SdrHdl(rTarget, pSingleSelected, HDL_UPLFT, rSnapRange.getMinimum(), true); + new SdrHdl(rTarget, pSingleSelected, HDL_UPPER, basegfx::B2DTuple(aCenter.getX(), rSnapRange.getMinY()), true); + new SdrHdl(rTarget, pSingleSelected, HDL_UPRGT, basegfx::B2DTuple(rSnapRange.getMaxX(), rSnapRange.getMinY()), true); + new SdrHdl(rTarget, pSingleSelected, HDL_LEFT, basegfx::B2DTuple(rSnapRange.getMinX(), aCenter.getY()), true); + new SdrHdl(rTarget, pSingleSelected, HDL_RIGHT, basegfx::B2DTuple(rSnapRange.getMaxX(), aCenter.getY()), true); + new SdrHdl(rTarget, pSingleSelected, HDL_LWLFT, basegfx::B2DTuple(rSnapRange.getMinX(), rSnapRange.getMaxY()), true); + new SdrHdl(rTarget, pSingleSelected, HDL_LOWER, basegfx::B2DTuple(aCenter.getX(), rSnapRange.getMaxY()), true); + new SdrHdl(rTarget, pSingleSelected, HDL_LWRGT, rSnapRange.getMaximum(), true); } } } diff --git a/svx/source/svdraw/svdoashp.cxx b/svx/source/svdraw/svdoashp.cxx index 56e91b828183..0fda7cfd974f 100644 --- a/svx/source/svdraw/svdoashp.cxx +++ b/svx/source/svdraw/svdoashp.cxx @@ -1710,12 +1710,67 @@ sal_uInt16 SdrObjCustomShape::GetObjIdentifier() const return sal_uInt16(OBJ_CUSTOMSHAPE); } +// #115391# This implementation is based on the relative TextFrame size of the CustomShape and the +// state of the ResizeShapeToFitText flag to correctly set TextMinFrameWidth/Height +void SdrObjCustomShape::AdaptTextMinSize() +{ + if(mbAdaptingTextMinSize) + { + // already adapting + return; + } + + mbAdaptingTextMinSize = true; + + if(!IsPasteResize()) + { + const bool bResizeShapeToFitText(0 != static_cast< const SdrOnOffItem& >(GetObjectItem(SDRATTR_TEXT_AUTOGROWHEIGHT)).GetValue()); + SfxItemSet aSet(GetObjectItemSet()); + bool bChanged(false); + + if(bResizeShapeToFitText) + { + // always reset MinWidthHeight to zero to only rely on text size and frame size + // to allow resizing being completely dependent on text size only + aSet.Put(SdrMetricItem(SDRATTR_TEXT_MINFRAMEWIDTH, 0)); + aSet.Put(SdrMetricItem(SDRATTR_TEXT_MINFRAMEHEIGHT, 0)); + bChanged = true; + } + else + { + // recreate from CustomShape-specific TextBounds. getUnifiedTextRange + // is relative to the object (in unit coordinates) and already without + // GetText...Distance values + const basegfx::B2DRange aUnifiedTextRange(getUnifiedTextRange()); + const basegfx::B2DVector aAbsoluteObjectScale(basegfx::absolute(getSdrObjectScale())); + + aSet.Put(SdrMetricItem(SDRATTR_TEXT_MINFRAMEWIDTH, basegfx::fround(aUnifiedTextRange.getWidth() * aAbsoluteObjectScale.getX()))); + aSet.Put(SdrMetricItem(SDRATTR_TEXT_MINFRAMEHEIGHT, basegfx::fround(aUnifiedTextRange.getHeight() * aAbsoluteObjectScale.getY()))); + bChanged = true; + } + + if(bChanged) + { + SetObjectItemSet(aSet); + AdjustTextFrameWidthAndHeight(); + } + } + + mbAdaptingTextMinSize = false; +} + //////////////////////////////////////////////////////////////////////////////////////////////////// void SdrObjCustomShape::setSdrObjectTransformation(const basegfx::B2DHomMatrix& rTransformation) { - // call parent - SdrTextObj::setSdrObjectTransformation(rTransformation); + if(rTransformation != getSdrObjectTransformation()) + { + // call parent + SdrTextObj::setSdrObjectTransformation(rTransformation); + + // #115391# + AdaptTextMinSize(); + } // TTTT: extract mirror flags and trigger SetMirroredX/SetMirroredY // const rtl::OUString sMirroredX( RTL_CONSTASCII_USTRINGPARAM ( "MirroredX" ) ); @@ -2059,29 +2114,10 @@ bool SdrObjCustomShape::EndCreate( SdrDragStat& rStat, SdrCreateCmd eCmd ) { DragCreateObject( rStat ); - if ( bTextFrame ) - { - const Rectangle aOldObjRect(sdr::legacy::GetLogicRect(*this)); - - if ( IsAutoGrowHeight() ) - { - // MinTextHeight - long nHgt=aOldObjRect.GetHeight()-1; - if (nHgt==1) nHgt=0; - SetMinTextFrameHeight( nHgt ); - } - if ( IsAutoGrowWidth() ) - { - // MinTextWidth - long nWdt=aOldObjRect.GetWidth()-1; - if (nWdt==1) nWdt=0; - SetMinTextFrameWidth( nWdt ); - } + // #115391# TTTT: Calls setSdrObjectTransformation and thus AdaptTextMinSize automatically + // AdaptTextMinSize(); + // ActionChanged(); - // Textrahmen neu berechnen - AdjustTextFrameWidthAndHeight(); - } - ActionChanged(); return ( eCmd == SDRCREATE_FORCEEND || rStat.GetPointAnz() >= 2 ); } @@ -2174,17 +2210,19 @@ void SdrObjCustomShape::SetVerticalWriting( bool bVertical ) } } -basegfx::B2DRange SdrObjCustomShape::AdjustTextFrameWidthAndHeight(const basegfx::B2DRange& rRange, bool bHgt, bool bWdt) const +basegfx::B2DRange SdrObjCustomShape::AdjustTextFrameWidthAndHeight(const basegfx::B2DRange& rRange) const { - if(HasText() && !rRange.isEmpty()) + basegfx::B2DRange aRetval(rRange); + + if(HasText() && !rRange.isEmpty()) { - return ImpAdjustTextFrameWidthAndHeight(rRange, bHgt, bWdt, false); + aRetval = ImpAdjustTextFrameWidthAndHeight(rRange, false); } - return rRange; + return aRetval; } -basegfx::B2DRange SdrObjCustomShape::ImpCalculateTextFrame(const bool bHgt, const bool bWdt) +basegfx::B2DRange SdrObjCustomShape::ImpCalculateTextFrame() { basegfx::B2DRange aReturnValue; const basegfx::B2DRange aOldObjRange( @@ -2205,7 +2243,7 @@ basegfx::B2DRange SdrObjCustomShape::ImpCalculateTextFrame(const bool bHgt, cons // new text rectangle is being tested by AdjustTextFrameWidthAndHeight to ensure // that the new text rectangle is matching the current text size from the outliner - const basegfx::B2DRange aAdjustedTextRange(AdjustTextFrameWidthAndHeight(aNewTextRange, bHgt, bWdt)); + const basegfx::B2DRange aAdjustedTextRange(AdjustTextFrameWidthAndHeight(aNewTextRange)); if((aAdjustedTextRange != aNewTextRange) && (aOldTextRange != aAdjustedTextRange)) { @@ -2214,24 +2252,41 @@ basegfx::B2DRange SdrObjCustomShape::ImpCalculateTextFrame(const bool bHgt, cons const basegfx::B2DVector aBottomRightDiff((aAdjustedTextRange.getMaximum() - aNewTextRange.getMaximum()) * aScale); aReturnValue = basegfx::B2DRange( - aReturnValue.getMinimum() + aTopLeftDiff, - aReturnValue.getMaximum() + aBottomRightDiff); + aOldObjRange.getMinimum() + aTopLeftDiff, + aOldObjRange.getMaximum() + aBottomRightDiff); } return aReturnValue; } -bool SdrObjCustomShape::AdjustTextFrameWidthAndHeight(bool bHgt, bool bWdt) +void SdrObjCustomShape::AdjustTextFrameWidthAndHeight() { - const basegfx::B2DRange aNewTextRange(ImpCalculateTextFrame(bHgt, bWdt)); - const basegfx::B2DRange aOldObjRange(getSdrObjectTranslate(), getSdrObjectTranslate() + basegfx::absolute(getSdrObjectScale())); + if(mbAdjustingTextFrameWidthAndHeight) + { + return; + } + + mbAdjustingTextFrameWidthAndHeight = true; + + const basegfx::B2DRange aNewTextRange( + ImpCalculateTextFrame()); + const basegfx::B2DRange aOldObjRange( + getSdrObjectTranslate(), + getSdrObjectTranslate() + basegfx::absolute(getSdrObjectScale())); if(!aNewTextRange.isEmpty() && !aNewTextRange.equal(aOldObjRange)) { // taking care of handles that should not been changed const SdrObjectChangeBroadcaster aSdrObjectChangeBroadcaster(*this); std::vector< SdrCustomShapeInteraction > aInteractionHandles(GetInteractionHandles(this)); - sdr::legacy::SetLogicRange(*this, aNewTextRange); + + // adapt transformation to new range and apply to object + setSdrObjectTransformation( + basegfx::tools::adaptB2DHomMatrixToB2DRange( + getSdrObjectTransformation(), + aNewTextRange)); + + // corrections to InteractionHandles std::vector< SdrCustomShapeInteraction >::iterator aIter(aInteractionHandles.begin()); while(aIter != aInteractionHandles.end()) @@ -2252,11 +2307,9 @@ bool SdrObjCustomShape::AdjustTextFrameWidthAndHeight(bool bHgt, bool bWdt) InvalidateRenderGeometry(); SetChanged(); - - return true; } - return false; + mbAdjustingTextFrameWidthAndHeight = false; } bool SdrObjCustomShape::BegTextEdit( SdrOutliner& rOutl ) diff --git a/svx/source/svdraw/svdobj.cxx b/svx/source/svdraw/svdobj.cxx index 35f0ecb14130..fe4a00eba940 100644 --- a/svx/source/svdraw/svdobj.cxx +++ b/svx/source/svdraw/svdobj.cxx @@ -2608,7 +2608,7 @@ void SdrObject::setSdrObjectTransformation(const basegfx::B2DHomMatrix& rTransfo // pGPL->SetReallyAbsolute(false,*this); //} - if(rTransformation != maSdrObjectTransformation.getB2DHomMatrix()) + if(rTransformation != getSdrObjectTransformation()) { if(GetGluePointList()) { diff --git a/svx/source/svdraw/svdocapt.cxx b/svx/source/svdraw/svdocapt.cxx index e263b1ec659b..22aceede66c6 100644 --- a/svx/source/svdraw/svdocapt.cxx +++ b/svx/source/svdraw/svdocapt.cxx @@ -650,11 +650,14 @@ basegfx::B2DPolyPolygon SdrCaptionObj::TakeCreatePoly(const SdrDragStat& /*rDrag void SdrCaptionObj::setSdrObjectTransformation(const basegfx::B2DHomMatrix& rTransformation) { - SdrRectObj::setSdrObjectTransformation(rTransformation); - - if(mbFixedTail) + if(rTransformation != getSdrObjectTransformation()) { - SetTailPos(GetFixedTailPos()); + SdrRectObj::setSdrObjectTransformation(rTransformation); + + if(mbFixedTail) + { + SetTailPos(GetFixedTailPos()); + } } } diff --git a/svx/source/svdraw/svdoedge.cxx b/svx/source/svdraw/svdoedge.cxx index b741ce590ce8..40c9906d71fe 100644 --- a/svx/source/svdraw/svdoedge.cxx +++ b/svx/source/svdraw/svdoedge.cxx @@ -2430,55 +2430,65 @@ const basegfx::B2DHomMatrix& SdrEdgeObj::getSdrObjectTransformation() const void SdrEdgeObj::setSdrObjectTransformation(const basegfx::B2DHomMatrix& rTransformation) { - // #54102# handle start and end point if not connected - const bool bCon1(maCon1.mpConnectedSdrObject && maCon1.mpConnectedSdrObject->getSdrPageFromSdrObject() == getSdrPageFromSdrObject()); - const bool bCon2(maCon2.mpConnectedSdrObject && maCon2.mpConnectedSdrObject->getSdrPageFromSdrObject() == getSdrPageFromSdrObject()); - const sal_uInt32 nCount(maEdgeTrack.count()); - const bool bApplyTransform(nCount && (!bCon1 || !bCon2 || mbEdgeTrackUserDefined)); - basegfx::B2DHomMatrix aCompleteTransform; - - if(bApplyTransform) + if(rTransformation != getSdrObjectTransformation()) { - // get old transform and invert - aCompleteTransform = getSdrObjectTransformation(); - aCompleteTransform.invert(); - } - - // call parent, set new transform - SdrTextObj::setSdrObjectTransformation(rTransformation); + // #54102# handle start and end point if not connected + const bool bCon1(maCon1.mpConnectedSdrObject && maCon1.mpConnectedSdrObject->getSdrPageFromSdrObject() == getSdrPageFromSdrObject()); + const bool bCon2(maCon2.mpConnectedSdrObject && maCon2.mpConnectedSdrObject->getSdrPageFromSdrObject() == getSdrPageFromSdrObject()); + const sal_uInt32 nCount(maEdgeTrack.count()); + const bool bApplyTransform(nCount && (!bCon1 || !bCon2 || mbEdgeTrackUserDefined)); + basegfx::B2DHomMatrix aCompleteTransform; - if(bApplyTransform) - { - // multiply current transform (after change) to get full change - aCompleteTransform = getSdrObjectTransformation() * aCompleteTransform; - - if(mbEdgeTrackUserDefined) + if(bApplyTransform) { - // #120437# special handling when track is user defined - maEdgeTrack.transform(aCompleteTransform); + // get old transform and invert + aCompleteTransform = getSdrObjectTransformation(); + aCompleteTransform.invert(); } - else + + // call parent, set new transform + SdrTextObj::setSdrObjectTransformation(rTransformation); + + if(bApplyTransform) { - if(!bCon1) + // multiply current transform (after change) to get full change + aCompleteTransform = getSdrObjectTransformation() * aCompleteTransform; + + if(mbEdgeTrackUserDefined) { - // transform first point - maEdgeTrack.setB2DPoint(0, aCompleteTransform * maEdgeTrack.getB2DPoint(0)); - ImpDirtyEdgeTrack(); + // #120437# special handling when track is user defined + maEdgeTrack.transform(aCompleteTransform); } - - if(!bCon2) + else { - // transform last point - maEdgeTrack.setB2DPoint(nCount - 1, aCompleteTransform * maEdgeTrack.getB2DPoint(nCount - 1)); - ImpDirtyEdgeTrack(); + bool bDirtyEdgeTrack(false); + + if(!bCon1) + { + // transform first point + maEdgeTrack.setB2DPoint(0, aCompleteTransform * maEdgeTrack.getB2DPoint(0)); + bDirtyEdgeTrack = true; + } + + if(!bCon2) + { + // transform last point + maEdgeTrack.setB2DPoint(nCount - 1, aCompleteTransform * maEdgeTrack.getB2DPoint(nCount - 1)); + bDirtyEdgeTrack = true; + } + + if(bDirtyEdgeTrack) + { + ImpDirtyEdgeTrack(); + } } } - } - // if resize is not from paste, forget user distances - if(!IsPasteResize()) - { - maEdgeInfo.aObj1Line2 = maEdgeInfo.aObj1Line3 = maEdgeInfo.aObj2Line2 = maEdgeInfo.aObj2Line3 = maEdgeInfo.aMiddleLine = basegfx::B2DPoint(); + // if resize is not from paste, forget user distances + if(!IsPasteResize()) + { + maEdgeInfo.aObj1Line2 = maEdgeInfo.aObj1Line3 = maEdgeInfo.aObj2Line2 = maEdgeInfo.aObj2Line3 = maEdgeInfo.aMiddleLine = basegfx::B2DPoint(); + } } } diff --git a/svx/source/svdraw/svdograf.cxx b/svx/source/svdraw/svdograf.cxx index d6d076dda55d..9a0ec69c9e4e 100644 --- a/svx/source/svdraw/svdograf.cxx +++ b/svx/source/svdraw/svdograf.cxx @@ -970,10 +970,13 @@ void SdrGrafObj::AddToHdlList(SdrHdlList& rHdlList) const void SdrGrafObj::setSdrObjectTransformation(const basegfx::B2DHomMatrix& rTransformation) { - // call parent - SdrRectObj::setSdrObjectTransformation(rTransformation); + if(rTransformation != getSdrObjectTransformation()) + { + // call parent + SdrRectObj::setSdrObjectTransformation(rTransformation); - // TTTT: extract mirror flags and trigger bMirrored (if needed in the future at all) + // TTTT: extract mirror flags and trigger bMirrored (if needed in the future at all) + } } // ----------------------------------------------------------------------------- diff --git a/svx/source/svdraw/svdogrp.cxx b/svx/source/svdraw/svdogrp.cxx index d36b71a3a60b..b6bccfabf0c2 100644 --- a/svx/source/svdraw/svdogrp.cxx +++ b/svx/source/svdraw/svdogrp.cxx @@ -420,9 +420,7 @@ const basegfx::B2DHomMatrix& SdrObjGroup::getSdrObjectTransformation() const void SdrObjGroup::setSdrObjectTransformation(const basegfx::B2DHomMatrix& rTransformation) { - const basegfx::B2DHomMatrix& rCurrent = getSdrObjectTransformation(); - - if(rTransformation != rCurrent) + if(rTransformation != getSdrObjectTransformation()) { const sal_uInt32 nCount(GetObjCount()); @@ -431,7 +429,7 @@ void SdrObjGroup::setSdrObjectTransformation(const basegfx::B2DHomMatrix& rTrans // to apply the transformation to sub-objects, remove current transformation // by using it's inverse, then transform by the new transformation. Prepare // inverse combined with transformation - basegfx::B2DHomMatrix aTransform(rCurrent); + basegfx::B2DHomMatrix aTransform(getSdrObjectTransformation()); aTransform.invert(); aTransform = rTransformation * aTransform; diff --git a/svx/source/svdraw/svdoole2.cxx b/svx/source/svdraw/svdoole2.cxx index d93ba2669146..3f97de707b09 100644 --- a/svx/source/svdraw/svdoole2.cxx +++ b/svx/source/svdraw/svdoole2.cxx @@ -1792,35 +1792,39 @@ Size SdrOle2Obj::GetOrigObjSize( MapMode* pTargetMapMode ) const void SdrOle2Obj::setSdrObjectTransformation(const basegfx::B2DHomMatrix& rTransformation) { - SdrRectObj::setSdrObjectTransformation(rTransformation); - - if(!getSdrModelFromSdrObject().isLocked()) + if(rTransformation != getSdrObjectTransformation()) { - ImpSetVisAreaSize(); + // call parent + SdrRectObj::setSdrObjectTransformation(rTransformation); - // TTTT: - //GetObjRef(); - //if ( xObjRef.is() && ( xObjRef->getStatus( GetAspect() ) & embed::EmbedMisc::MS_EMBED_RECOMPOSEONRESIZE ) ) - //{ - // // if the object needs recompose on resize - // // the client site should be created before the resize will take place - // // check whether there is no client site and create it if necessary - // if ( !SfxInPlaceClient::GetClient( dynamic_cast<SfxObjectShell*>(getSdrModelFromSdrObject().GetPersist()), xObjRef.GetObject() ) - // && !( mpImpl->pLightClient && xObjRef->getClientSite() == uno::Reference< embed::XEmbeddedClient >( mpImpl->pLightClient ) ) ) - // { - // AddOwnLightClient(); - // } - //} + if(!getSdrModelFromSdrObject().isLocked()) + { + ImpSetVisAreaSize(); + + // TTTT: + //GetObjRef(); + //if ( xObjRef.is() && ( xObjRef->getStatus( GetAspect() ) & embed::EmbedMisc::MS_EMBED_RECOMPOSEONRESIZE ) ) + //{ + // // if the object needs recompose on resize + // // the client site should be created before the resize will take place + // // check whether there is no client site and create it if necessary + // if ( !SfxInPlaceClient::GetClient( dynamic_cast<SfxObjectShell*>(getSdrModelFromSdrObject().GetPersist()), xObjRef.GetObject() ) + // && !( mpImpl->pLightClient && xObjRef->getClientSite() == uno::Reference< embed::XEmbeddedClient >( mpImpl->pLightClient ) ) ) + // { + // AddOwnLightClient(); + // } + //} - } + } - if ( xObjRef.is() && IsChart() ) - { - //#i103460# charts do not necessaryly have an own size within ODF files, - //for this case they need to use the size settings from the surrounding frame, - //which is made available with this method as there is no other way - // TTTT: - // xObjRef.SetDefaultSizeForChart( Size( rRect.GetWidth(), rRect.GetHeight() ) ); + if ( xObjRef.is() && IsChart() ) + { + //#i103460# charts do not necessaryly have an own size within ODF files, + //for this case they need to use the size settings from the surrounding frame, + //which is made available with this method as there is no other way + // TTTT: + // xObjRef.SetDefaultSizeForChart( Size( rRect.GetWidth(), rRect.GetHeight() ) ); + } } } diff --git a/svx/source/svdraw/svdopath.cxx b/svx/source/svdraw/svdopath.cxx index 80efe9aaadfb..0ec10ead82c3 100644 --- a/svx/source/svdraw/svdopath.cxx +++ b/svx/source/svdraw/svdopath.cxx @@ -2721,7 +2721,7 @@ void SdrPathObj::impDeleteDAC() const void SdrPathObj::setSdrObjectTransformation(const basegfx::B2DHomMatrix& rTransformation) { - if(rTransformation != maSdrObjectTransformation.getB2DHomMatrix()) + if(rTransformation != getSdrObjectTransformation()) { if(isLine()) { @@ -2745,10 +2745,10 @@ void SdrPathObj::setSdrObjectTransformation(const basegfx::B2DHomMatrix& rTransf maPathPolyPolygon.transform(aCombined); } } - } - // call parent - SdrTextObj::setSdrObjectTransformation(rTransformation); + // call parent + SdrTextObj::setSdrObjectTransformation(rTransformation); + } } bool SdrPathObj::isClosed() const diff --git a/svx/source/svdraw/svdotext.cxx b/svx/source/svdraw/svdotext.cxx index adc2d8b23716..e35b936e85c2 100644 --- a/svx/source/svdraw/svdotext.cxx +++ b/svx/source/svdraw/svdotext.cxx @@ -114,6 +114,8 @@ SdrTextObj::SdrTextObj( // #111096# mbTextAnimationAllowed = sal_True; + mbAdaptingTextMinSize = false; + mbAdjustingTextFrameWidthAndHeight = false; } SdrTextObj::~SdrTextObj() @@ -500,50 +502,60 @@ void SdrTextObj::SetEdgeRadius(sal_Int32 nRad) } } -bool SdrTextObj::SetMinTextFrameHeight(sal_Int32 nHgt) +// #115391# This implementation is based on the absolute object size (getSdrObjectScale()) and the +// states of IsAutoGrowWidth/Height to correctly set TextMinFrameWidth/Height +void SdrTextObj::AdaptTextMinSize() { - if( bTextFrame ) + if(mbAdaptingTextMinSize) { - if( !getSdrModelFromSdrObject().isLocked() ) - { - SetObjectItem(SdrMetricItem(SDRATTR_TEXT_MINFRAMEHEIGHT, nHgt)); - - // #84974# use bDisableAutoWidthOnDragging as - // bDisableAutoHeightOnDragging if vertical. - if(IsVerticalWriting() && bDisableAutoWidthOnDragging) - { - bDisableAutoWidthOnDragging = false; - SetObjectItem(SdrOnOffItem(SDRATTR_TEXT_AUTOGROWHEIGHT, false)); - } - - return true; - } + return; } - return false; -} + mbAdaptingTextMinSize = true; -bool SdrTextObj::SetMinTextFrameWidth(sal_Int32 nWdt) -{ - if(bTextFrame) + if(bTextFrame && !IsPasteResize()) { - if( !getSdrModelFromSdrObject().isLocked() ) + const bool bW(IsAutoGrowWidth()); + const bool bH(IsAutoGrowHeight()); + + if(bW || bH) { - SetObjectItem(SdrMetricItem(SDRATTR_TEXT_MINFRAMEWIDTH, nWdt)); + SfxItemSet aSet(GetObjectItemSet()); - // #84974# use bDisableAutoWidthOnDragging only - // when not vertical. - if(!IsVerticalWriting() && bDisableAutoWidthOnDragging) + if(bW) { - bDisableAutoWidthOnDragging = false; - SetObjectItem(SdrOnOffItem(SDRATTR_TEXT_AUTOGROWWIDTH, false)); + const sal_Int32 nDist(GetTextLeftDistance() + GetTextRightDistance()); + const double fW(std::max(0.0, fabs(getSdrObjectScale().getX()) - double(nDist))); + + aSet.Put(SdrMetricItem(SDRATTR_TEXT_MINFRAMEWIDTH, basegfx::fround(fW))); + + if(!IsVerticalWriting() && bDisableAutoWidthOnDragging) + { + bDisableAutoWidthOnDragging = true; + aSet.Put(SdrOnOffItem(SDRATTR_TEXT_AUTOGROWWIDTH, false)); + } } - return true; + if(bH) + { + const sal_Int32 nDist(GetTextUpperDistance() + GetTextLowerDistance()); + const double fH(std::max(0.0, fabs(getSdrObjectScale().getY()) - double(nDist))); + + aSet.Put(SdrMetricItem(SDRATTR_TEXT_MINFRAMEHEIGHT, basegfx::fround(fH))); + + if(IsVerticalWriting() && bDisableAutoWidthOnDragging) + { + bDisableAutoWidthOnDragging = false; + SetObjectItem(SdrOnOffItem(SDRATTR_TEXT_AUTOGROWHEIGHT, false)); + } + } + + SetObjectItemSet(aSet); + AdjustTextFrameWidthAndHeight(); } } - return false; + mbAdaptingTextMinSize = false; } basegfx::B2DRange SdrTextObj::getUnifiedTextRange() const diff --git a/svx/source/svdraw/svdotxat.cxx b/svx/source/svdraw/svdotxat.cxx index 9efb852c4d0e..c10a6f20a926 100644 --- a/svx/source/svdraw/svdotxat.cxx +++ b/svx/source/svdraw/svdotxat.cxx @@ -59,7 +59,7 @@ //////////////////////////////////////////////////////////////////////////////////////////////////// -basegfx::B2DRange SdrTextObj::AdjustTextFrameWidthAndHeight(const basegfx::B2DRange& rRange, bool bHgt, bool bWdt) const +basegfx::B2DRange SdrTextObj::AdjustTextFrameWidthAndHeight(const basegfx::B2DRange& rRange) const { if(IsTextFrame() && !rRange.isEmpty()) { @@ -68,17 +68,17 @@ basegfx::B2DRange SdrTextObj::AdjustTextFrameWidthAndHeight(const basegfx::B2DRa if(!bFitToSize) { - return ImpAdjustTextFrameWidthAndHeight(rRange, bHgt, bWdt, true); + return ImpAdjustTextFrameWidthAndHeight(rRange, true); } } return rRange; } -basegfx::B2DRange SdrTextObj::ImpAdjustTextFrameWidthAndHeight(const basegfx::B2DRange& rRange, bool bHgt, bool bWdt, bool bCheckAnimation) const +basegfx::B2DRange SdrTextObj::ImpAdjustTextFrameWidthAndHeight(const basegfx::B2DRange& rRange, bool bCheckAnimation) const { - bool bWdtGrow(bWdt && IsAutoGrowWidth()); - bool bHgtGrow(bHgt && IsAutoGrowHeight()); + bool bWdtGrow(IsAutoGrowWidth()); + bool bHgtGrow(IsAutoGrowHeight()); basegfx::B2DRange aRetval(rRange); if(bWdtGrow || bHgtGrow) @@ -220,11 +220,11 @@ basegfx::B2DRange SdrTextObj::ImpAdjustTextFrameWidthAndHeight(const basegfx::B2 // fMinWidth < fWidth < fMaxWidth fWidth = std::min(fMaxWidth, std::max(fWidth, fMinWidth)); - fWidth = std::max(1.0, fWidth += aBorders.getX()); // aBorders.getX() may be negative + fWidth = std::max(1.0, fWidth + aBorders.getX()); // aBorders.getX() may be negative // fMinHeight < fHeight < fMaxHeight fHeight = std::min(fMaxHeight, std::max(fHeight, fMinHeight)); - fHeight = std::max(1.0, fHeight += aBorders.getY()); // aBorders.getY() may be negative + fHeight = std::max(1.0, fHeight + aBorders.getY()); // aBorders.getY() may be negative // get grow sizes const double fWidthGrow(fWidth - aRetval.getWidth()); @@ -248,15 +248,29 @@ basegfx::B2DRange SdrTextObj::ImpAdjustTextFrameWidthAndHeight(const basegfx::B2 if(SDRTEXTHORZADJUST_LEFT == eHAdj) { - aRetval = basegfx::B2DRange(aRetval.getMinX(), aRetval.getMinY(), aRetval.getMaxX() + fWidthGrow, aRetval.getMaxY()); + aRetval = basegfx::B2DRange( + aRetval.getMinX(), + aRetval.getMinY(), + aRetval.getMaxX() + fWidthGrow, + aRetval.getMaxY()); } else if(SDRTEXTHORZADJUST_RIGHT == eHAdj) { - aRetval = basegfx::B2DRange(aRetval.getMinX() - fWidthGrow, aRetval.getMinY(), aRetval.getMaxX(), aRetval.getMaxY()); + aRetval = basegfx::B2DRange( + aRetval.getMinX() - fWidthGrow, + aRetval.getMinY(), + aRetval.getMaxX(), + aRetval.getMaxY()); } else { - aRetval = basegfx::B2DRange(aRetval.getMinX() - (fWidthGrow * 0.5), aRetval.getMinY(), aRetval.getMaxX() + (fWidthGrow * 0.5), aRetval.getMaxY()); + const double fNewMinX(aRetval.getMinX() - (fWidthGrow * 0.5)); + + aRetval = basegfx::B2DRange( + fNewMinX, + aRetval.getMinY(), + fNewMinX + fWidth, + aRetval.getMaxY()); } } @@ -266,77 +280,108 @@ basegfx::B2DRange SdrTextObj::ImpAdjustTextFrameWidthAndHeight(const basegfx::B2 if(SDRTEXTVERTADJUST_TOP == eVAdj) { - aRetval = basegfx::B2DRange(aRetval.getMinX(), aRetval.getMinY(), aRetval.getMaxX(), aRetval.getMaxY() + fHeightGrow); + aRetval = basegfx::B2DRange( + aRetval.getMinX(), + aRetval.getMinY(), + aRetval.getMaxX(), + aRetval.getMaxY() + fHeightGrow); } else if(SDRTEXTVERTADJUST_BOTTOM == eVAdj) { - aRetval = basegfx::B2DRange(aRetval.getMinX(), aRetval.getMinY() - fHeightGrow, aRetval.getMaxX(), aRetval.getMaxY()); + aRetval = basegfx::B2DRange( + aRetval.getMinX(), + aRetval.getMinY() - fHeightGrow, + aRetval.getMaxX(), + aRetval.getMaxY()); } else { - aRetval = basegfx::B2DRange(aRetval.getMinX(), aRetval.getMinY() - (fHeightGrow * 0.5), aRetval.getMaxX(), aRetval.getMaxY() + (fHeightGrow * 0.5)); + const double fNewMinY(aRetval.getMinY() - (fHeightGrow * 0.5)); + + aRetval = basegfx::B2DRange( + aRetval.getMinX(), + fNewMinY, + aRetval.getMaxX(), + fNewMinY + fHeight); } } - if(!aOriginalMinimum.equal(aRetval.getMinimum()) && isRotatedOrSheared()) - { - basegfx::B2DHomMatrix aCorrector( - basegfx::tools::createScaleTranslateB2DHomMatrix( - getSdrObjectScale(), - basegfx::absolute(getSdrObjectTranslate()))); - - aCorrector.invert(); - aCorrector = getSdrObjectTransformation() * aCorrector; - - const basegfx::B2DPoint aCorrectedTopLeft(aCorrector * aRetval.getMinimum()); - - aCorrector.identity(); - aCorrector.translate(aCorrectedTopLeft - aRetval.getMinimum()); - - aRetval.transform(aCorrector); - - // TTTT: Check if the above solution works - // - //const sal_Int32 aOldRotation(sdr::legacy::GetRotateAngle(*this)); - // - //if (aOldRotation) - //{ - // Point aD1(rR.TopLeft()); - // aD1-=aOriginalMinimum; - // Point aD2(aD1); - // RotatePoint(aD2,Point(),sin(aOldRotation*nPi180), cos(aOldRotation*nPi180)); - // aD2-=aD1; - // rR.Move(aD2.X(),aD2.Y()); - //} - } + // TTTT: This is in the way when working with the adapted range and leads to errors. + // Probably no longer needed at all since it formally corrected some strange effects + // which happened because of the way rotations were applied in former versions + // + //if(!aOriginalMinimum.equal(aRetval.getMinimum()) && isRotatedOrSheared()) + //{ + // basegfx::B2DHomMatrix aCorrector( + // basegfx::tools::createScaleTranslateB2DHomMatrix( + // getSdrObjectScale(), + // basegfx::absolute(getSdrObjectTranslate()))); + // + // aCorrector.invert(); + // aCorrector = getSdrObjectTransformation() * aCorrector; + // + // const basegfx::B2DPoint aCorrectedTopLeft(aCorrector * aRetval.getMinimum()); + // + // aCorrector.identity(); + // aCorrector.translate(aCorrectedTopLeft - aRetval.getMinimum()); + // + // aRetval.transform(aCorrector); + // + // // TTTT: Check if the above solution works + // // + // //const sal_Int32 aOldRotation(sdr::legacy::GetRotateAngle(*this)); + // // + // //if (aOldRotation) + // //{ + // // Point aD1(rR.TopLeft()); + // // aD1-=aOriginalMinimum; + // // Point aD2(aD1); + // // RotatePoint(aD2,Point(),sin(aOldRotation*nPi180), cos(aOldRotation*nPi180)); + // // aD2-=aD1; + // // rR.Move(aD2.X(),aD2.Y()); + // //} + //} } } return aRetval; } -bool SdrTextObj::AdjustTextFrameWidthAndHeight(bool bHgt, bool bWdt) +void SdrTextObj::AdjustTextFrameWidthAndHeight() { - const basegfx::B2DRange aOldRange(getSdrObjectTranslate(), getSdrObjectTranslate() + basegfx::absolute(getSdrObjectScale())); - const basegfx::B2DRange aNewRange(AdjustTextFrameWidthAndHeight(aOldRange, bHgt, bWdt)); + if(mbAdjustingTextFrameWidthAndHeight) + { + return; + } + + mbAdjustingTextFrameWidthAndHeight = true; + + const basegfx::B2DRange aOldRange( + getSdrObjectTranslate(), + getSdrObjectTranslate() + basegfx::absolute(getSdrObjectScale())); + const basegfx::B2DRange aNewTextRange(AdjustTextFrameWidthAndHeight(aOldRange)); - if(!aNewRange.equal(aOldRange)) + if(!aNewTextRange.equal(aOldRange)) { const SdrObjectChangeBroadcaster aSdrObjectChangeBroadcaster(*this); - sdr::legacy::SetLogicRange(*this, aNewRange); + SdrCaptionObj* pSdrCaptionObj = dynamic_cast< SdrCaptionObj* >(this); - if(dynamic_cast< SdrCaptionObj* >(this)) + // adapt transformation to new range and apply to object + setSdrObjectTransformation( + basegfx::tools::adaptB2DHomMatrixToB2DRange( + getSdrObjectTransformation(), + aNewTextRange)); + + if(pSdrCaptionObj) { // mal wieder 'nen Hack - ((SdrCaptionObj*)this)->ImpRecalcTail(); + pSdrCaptionObj->ImpRecalcTail(); } SetChanged(); - - return true; } - return false; + mbAdjustingTextFrameWidthAndHeight = false; } void SdrTextObj::ImpSetTextStyleSheetListeners() diff --git a/svx/source/svdraw/svdotxdr.cxx b/svx/source/svdraw/svdotxdr.cxx index 0efbdbce8dc4..c6285669ccc8 100644 --- a/svx/source/svdraw/svdotxdr.cxx +++ b/svx/source/svdraw/svdotxdr.cxx @@ -56,32 +56,8 @@ bool SdrTextObj::EndCreate(SdrDragStat& rStat, SdrCreateCmd eCmd) { bool bRetval(SdrAttrObj::EndCreate(rStat, eCmd)); - if(bTextFrame) - { - const bool bAutoGrowHeight(IsAutoGrowHeight()); - const bool bAutoGrowWidth(IsAutoGrowWidth()); - - if(bAutoGrowHeight || bAutoGrowWidth) - { - const basegfx::B2DVector aAbsScale(basegfx::absolute(getSdrObjectScale())); - - if(bAutoGrowHeight) - { - // MinTextHeight - SetMinTextFrameHeight(basegfx::fround(aAbsScale.getY())); - } - - if(bAutoGrowWidth) - { - // MinTextWidth - SetMinTextFrameWidth(basegfx::fround(aAbsScale.getX())); - } - - // Textrahmen neu berechnen - AdjustTextFrameWidthAndHeight(); - ActionChanged(); - } - } + // #115391# TTTT: Calls setSdrObjectTransformation and thus AdaptTextMinSize automatically + // AdaptTextMinSize(); return bRetval; } diff --git a/svx/source/svdraw/svdotxtr.cxx b/svx/source/svdraw/svdotxtr.cxx index 14f491f197a0..aeff6460d51e 100644 --- a/svx/source/svdraw/svdotxtr.cxx +++ b/svx/source/svdraw/svdotxtr.cxx @@ -49,67 +49,53 @@ void SdrTextObj::setSdrObjectTransformation(const basegfx::B2DHomMatrix& rTransformation) { - // Adapt Width and Height only when text frame (not object with text). - // Also do not do it in edit mode, let the object get as small as the - // minimum frame width/height without changing these. - const bool bTextAdaption(bTextFrame && !IsPasteResize() && !IsInEditMode()); - basegfx::B2DVector aOldSize; - - if(bTextAdaption) - { - aOldSize = basegfx::absolute(getSdrObjectScale()); - } - - // call parent - SdrAttrObj::setSdrObjectTransformation(rTransformation); - - // TTTT: check if the rebuild works - // - //sal_Int32 nHDist=GetTextLeftDistance()+GetTextRightDistance(); - //sal_Int32 nVDist=GetTextUpperDistance()+GetTextLowerDistance(); - //sal_Int32 nTWdt0=aRect.GetWidth ()-1-nHDist; if (nTWdt0<0) nTWdt0=0; - //sal_Int32 nTHgt0=aRect.GetHeight()-1-nVDist; if (nTHgt0<0) nTHgt0=0; - //sal_Int32 nTWdt1=rRect.GetWidth ()-1-nHDist; if (nTWdt1<0) nTWdt1=0; - //sal_Int32 nTHgt1=rRect.GetHeight()-1-nVDist; if (nTHgt1<0) nTHgt1=0; - // if (nTWdt0!=nTWdt1 && IsAutoGrowWidth() ) SetMinTextFrameWidth(nTWdt1); - // if (nTHgt0!=nTHgt1 && IsAutoGrowHeight()) SetMinTextFrameHeight(nTHgt1); - // if (GetFitToSize()==SDRTEXTFIT_RESIZEATTR) { - // ResizeTextAttributes(Fraction(nTWdt1,nTWdt0),Fraction(nTHgt1,nTHgt0)); - // } - // AdjustTextFrameWidthAndHeight(); - - if(bTextAdaption) + if(rTransformation != getSdrObjectTransformation()) { - basegfx::B2DVector aNewSize(basegfx::absolute(getSdrObjectScale())); - - if(!aNewSize.equal(aOldSize)) + // Adapt Width and Height only when text frame (not object with text). + // Also do not do it in edit mode, let the object get as small as the + // minimum frame width/height without changing these. + // TTTT: SDRTEXTFIT_RESIZEATTR Is defined, but seems not to be used + const bool bTextAdaption(bTextFrame && !IsPasteResize() && !IsInEditMode() && SDRTEXTFIT_RESIZEATTR == GetFitToSize()); + basegfx::B2DVector aOldSize; + + if(bTextAdaption) { - const basegfx::B2DVector aBorders( - GetTextLeftDistance() + GetTextRightDistance(), - GetTextUpperDistance() + GetTextLowerDistance()); - - aNewSize -= aBorders; - aOldSize -= aBorders; - - if(IsAutoGrowWidth() && !basegfx::fTools::equal(aOldSize.getX(), aNewSize.getX())) - { - SetMinTextFrameWidth(aNewSize.getX()); - } + aOldSize = basegfx::absolute(getSdrObjectScale()); + } - if(IsAutoGrowHeight() && !basegfx::fTools::equal(aOldSize.getY(), aNewSize.getY())) - { - SetMinTextFrameHeight(aNewSize.getY()); - } + // call parent + SdrAttrObj::setSdrObjectTransformation(rTransformation); + + // TTTT: check if the rebuild works + // + //sal_Int32 nHDist=GetTextLeftDistance()+GetTextRightDistance(); + //sal_Int32 nVDist=GetTextUpperDistance()+GetTextLowerDistance(); + //sal_Int32 nTWdt0=aRect.GetWidth ()-1-nHDist; if (nTWdt0<0) nTWdt0=0; + //sal_Int32 nTHgt0=aRect.GetHeight()-1-nVDist; if (nTHgt0<0) nTHgt0=0; + //sal_Int32 nTWdt1=rRect.GetWidth ()-1-nHDist; if (nTWdt1<0) nTWdt1=0; + //sal_Int32 nTHgt1=rRect.GetHeight()-1-nVDist; if (nTHgt1<0) nTHgt1=0; + // if (nTWdt0!=nTWdt1 && IsAutoGrowWidth() ) SetMinTextFrameWidth(nTWdt1); + // if (nTHgt0!=nTHgt1 && IsAutoGrowHeight()) SetMinTextFrameHeight(nTHgt1); + // if (GetFitToSize()==SDRTEXTFIT_RESIZEATTR) { + // ResizeTextAttributes(Fraction(nTWdt1,nTWdt0),Fraction(nTHgt1,nTHgt0)); + // } + // AdjustTextFrameWidthAndHeight(); + + // #115391# + AdaptTextMinSize(); + + if(bTextAdaption) + { + basegfx::B2DVector aNewSize(basegfx::absolute(getSdrObjectScale())); - if(SDRTEXTFIT_RESIZEATTR == GetFitToSize()) + if(!aNewSize.equal(aOldSize)) { const double fFactorX(aNewSize.getX() / (basegfx::fTools::equalZero(aOldSize.getX()) ? 1.0 : aOldSize.getX())); const double fFactorY(aNewSize.getY() / (basegfx::fTools::equalZero(aOldSize.getY()) ? 1.0 : aOldSize.getY())); ResizeTextAttributes(fFactorX, fFactorY); + AdjustTextFrameWidthAndHeight(); } - - AdjustTextFrameWidthAndHeight(); } } } diff --git a/svx/source/svdraw/svdview.cxx b/svx/source/svdraw/svdview.cxx index abd31d7bcee5..3bba921a8f8c 100644 --- a/svx/source/svdraw/svdview.cxx +++ b/svx/source/svdraw/svdview.cxx @@ -2179,5 +2179,69 @@ void SdrView::SetMasterPagePaintCaching(bool bOn) } } +// TTTT:HANDLE +void SdrView::MoveHandleByVector(const SdrHdl& rHdl, const basegfx::B2DVector& rDistance, Window* pMakeVisibleWindow, SdrDragMethod* pOwnDragMethod) +{ + if(!rDistance.equalZero()) + { + const basegfx::B2DPoint aStartPoint(rHdl.getPosition()); + const basegfx::B2DPoint aEndPoint(aStartPoint + rDistance); + const SdrDragStat& rDragStat = GetDragStat(); + + if(rHdl.IsFocusHdl()) + { + // take evtl. happening mirrorings into account to allow continued keyboard manipulations; e.g. + // when the upper handle is selected and moved down there will be the case where the object gets + // mirrored vertically. To smoothly continue that movement the focus has to change from the upper + // handle to the lower one (and logically similar for all other of the eight handles). This is + // done in the called method, it only changes the focus handle for the next handle recreation + AdaptFocusHandleOnMove(rDistance); + } + + // start dragging + BegDragObj(aStartPoint, &rHdl, 0.0, pOwnDragMethod); + + if(IsDragObj()) + { + const bool bWasNoSnap(rDragStat.IsNoSnap()); + const bool bWasSnapEnabled(IsSnapEnabled()); + + // switch snapping off + if(!bWasNoSnap) + { + const_cast< SdrDragStat& >(rDragStat).SetNoSnap(true); + } + + if(bWasSnapEnabled) + { + SetSnapEnabled(false); + } + + MovAction(aEndPoint); + EndDragObj(); + + // restore snap + if(!bWasNoSnap) + { + const_cast< SdrDragStat& >(rDragStat).SetNoSnap(bWasNoSnap); + } + + if(bWasSnapEnabled) + { + SetSnapEnabled(bWasSnapEnabled); + } + } + + if(pMakeVisibleWindow) + { + const basegfx::B2DRange aVisRange( + aEndPoint - basegfx::B2DPoint(100.0, 100.0), + aEndPoint + basegfx::B2DPoint(100.0, 100.0)); + + MakeVisibleAtView(aVisRange, *pMakeVisibleWindow); + } + } +} + //////////////////////////////////////////////////////////////////////////////////////////////////// // eof diff --git a/svx/source/table/svdotable.cxx b/svx/source/table/svdotable.cxx index 9ce753979170..9a8539690490 100644 --- a/svx/source/table/svdotable.cxx +++ b/svx/source/table/svdotable.cxx @@ -2107,63 +2107,76 @@ void SdrTableObj::AdjustToMaxRange( const basegfx::B2DRange& rMaxRange, bool /* void SdrTableObj::setSdrObjectTransformation(const basegfx::B2DHomMatrix& rTransformation) { - // remember original scaling - const basegfx::B2DVector aScaleBefore(basegfx::absolute(getSdrObjectScale())); + if(rTransformation != getSdrObjectTransformation()) + { + // remember original scaling + const basegfx::B2DVector aScaleBefore(basegfx::absolute(getSdrObjectScale())); - // call parent - SdrTextObj::setSdrObjectTransformation(rTransformation); + // call parent + SdrTextObj::setSdrObjectTransformation(rTransformation); - // get new scaling - const basegfx::B2DVector aNewSize(basegfx::absolute(getSdrObjectScale())); + // get new scaling + const basegfx::B2DVector aNewSize(basegfx::absolute(getSdrObjectScale())); - if(!aScaleBefore.equal(aNewSize)) - { - // react on scale change - AdjustTextFrameWidthAndHeight( - basegfx::fTools::equal(aScaleBefore.getY(), aNewSize.getY()), - basegfx::fTools::equal(aScaleBefore.getX(), aNewSize.getX())); - } + if(!aScaleBefore.equal(aNewSize)) + { + // react on scale change + AdjustTextFrameWidthAndHeight(); + } - if( mpImpl ) - { - Rectangle aRectangle(sdr::legacy::GetLogicRect(*this)); - mpImpl->UpdateCells( aRectangle ); + if( mpImpl ) + { + Rectangle aRectangle(sdr::legacy::GetLogicRect(*this)); + mpImpl->UpdateCells( aRectangle ); + } } } // -------------------------------------------------------------------- -bool SdrTableObj::AdjustTextFrameWidthAndHeight(bool bHgt, bool bWdt) +void SdrTableObj::AdjustTextFrameWidthAndHeight() { - const basegfx::B2DRange aOldRange(getSdrObjectTranslate(), getSdrObjectTranslate() + basegfx::absolute(getSdrObjectScale())); - const basegfx::B2DRange aNewRange(AdjustTextFrameWidthAndHeight(aOldRange, bHgt, bWdt)); - - if(!aOldRange.equal(aNewRange)) + if(mbAdjustingTextFrameWidthAndHeight) { - sdr::legacy::SetLogicRange(*this, aNewRange); + return; + } + + mbAdjustingTextFrameWidthAndHeight = true; - return true; + const basegfx::B2DRange aOldRange( + getSdrObjectTranslate(), + getSdrObjectTranslate() + basegfx::absolute(getSdrObjectScale())); + const basegfx::B2DRange aNewTextRange( + AdjustTextFrameWidthAndHeight(aOldRange)); + + if(!aOldRange.equal(aNewTextRange)) + { + // adapt transformation to new range and apply to object + setSdrObjectTransformation( + basegfx::tools::adaptB2DHomMatrixToB2DRange( + getSdrObjectTransformation(), + aNewTextRange)); } - return false; + mbAdjustingTextFrameWidthAndHeight = false; } // -------------------------------------------------------------------- -basegfx::B2DRange SdrTableObj::AdjustTextFrameWidthAndHeight(const basegfx::B2DRange& rRange, bool bHeight, bool bWidth) const +basegfx::B2DRange SdrTableObj::AdjustTextFrameWidthAndHeight(const basegfx::B2DRange& rRange) const { + basegfx::B2DRange aRetval(rRange); + if(rRange.isEmpty() || !mpImpl || !mpImpl->mxTable.is()) { // no change - return rRange; } else { - basegfx::B2DRange aNewRange(rRange); - - mpImpl->LayoutTable(aNewRange, !bWidth, !bHeight); - return aNewRange; + mpImpl->LayoutTable(aRetval, false, false); } + + return aRetval; } // -------------------------------------------------------------------- diff --git a/sw/source/ui/docvw/edtwin.cxx b/sw/source/ui/docvw/edtwin.cxx index fd7f84e4741c..bbf2ef2695a3 100644 --- a/sw/source/ui/docvw/edtwin.cxx +++ b/sw/source/ui/docvw/edtwin.cxx @@ -1260,35 +1260,39 @@ void SwEditWin::ChangeDrawing( sal_uInt8 nDir ) //now resize if size is protected else if(0 == (nProtect&FLYPROTECT_SIZE)) { - // now move the Handle (nX, nY) - const basegfx::B2DPoint aStartPoint(pHdl->getPosition()); - const basegfx::B2DPoint aEndPoint(aStartPoint + basegfx::B2DPoint(nX, nY)); - const SdrDragStat& rDragStat = pSdrView->GetDragStat(); - - // start dragging - pSdrView->BegDragObj(aStartPoint, pHdl, 0.0); - - if(pSdrView->IsDragObj()) - { - const bool bWasNoSnap(rDragStat.IsNoSnap()); - const bool bWasSnapEnabled(pSdrView->IsSnapEnabled()); - - // switch snapping off - if(!bWasNoSnap) - ((SdrDragStat&)rDragStat).SetNoSnap(true); - if(bWasSnapEnabled) - pSdrView->SetSnapEnabled(false); - - pSdrView->MovAction(aEndPoint); - pSdrView->EndDragObj(); + // move handle with index nHandleIndex + pSdrView->MoveHandleByVector(*pHdl, basegfx::B2DVector(nX, nY), 0, 0); + + // TTTT:HANDLE + //// now move the Handle (nX, nY) + //const basegfx::B2DPoint aStartPoint(pHdl->getPosition()); + //const basegfx::B2DPoint aEndPoint(aStartPoint + basegfx::B2DPoint(nX, nY)); + //const SdrDragStat& rDragStat = pSdrView->GetDragStat(); + // + //// start dragging + //pSdrView->BegDragObj(aStartPoint, pHdl, 0.0); + // + //if(pSdrView->IsDragObj()) + //{ + // const bool bWasNoSnap(rDragStat.IsNoSnap()); + // const bool bWasSnapEnabled(pSdrView->IsSnapEnabled()); + // + // // switch snapping off + // if(!bWasNoSnap) + // ((SdrDragStat&)rDragStat).SetNoSnap(true); + // if(bWasSnapEnabled) + // pSdrView->SetSnapEnabled(false); + // + // pSdrView->MovAction(aEndPoint); + // pSdrView->EndDragObj(); rSh.SetModified(); - // restore snap - if(!bWasNoSnap) - ((SdrDragStat&)rDragStat).SetNoSnap(bWasNoSnap); - if(bWasSnapEnabled) - pSdrView->SetSnapEnabled(bWasSnapEnabled); - } + // // restore snap + // if(!bWasNoSnap) + // ((SdrDragStat&)rDragStat).SetNoSnap(bWasNoSnap); + // if(bWasSnapEnabled) + // pSdrView->SetSnapEnabled(bWasSnapEnabled); + //} } } } |