Kaydet (Commit) 73360bdf authored tarafından Armin Le Grand's avatar Armin Le Grand

RotGrfFlyFrame: Implemented Handle Update on rotation change

WIth rotaiton being allowed the handle visualisation may be
dependent on this, so it is necessary to refresh their
visualisation on rotation chnage, e.g. for crop handles

Change-Id: I218e326894999381fc4058b7eba432491a0cf23b
üst a6fc51cb
......@@ -229,6 +229,7 @@ namespace basegfx
const B2DVector& getScale() const { const_cast< B2DHomMatrixBufferedOnDemandDecompose* >(this)->impCheckDecompose(); return maScale; }
const B2DVector& getTranslate() const { const_cast< B2DHomMatrixBufferedOnDemandDecompose* >(this)->impCheckDecompose(); return maTranslate; }
double getRotate() const { const_cast< B2DHomMatrixBufferedOnDemandDecompose* >(this)->impCheckDecompose(); return mfRotate; }
double getShearX() const { const_cast< B2DHomMatrixBufferedOnDemandDecompose* >(this)->impCheckDecompose(); return mfShearX; }
};
} // end of namespace utils
......
......@@ -595,14 +595,14 @@ void SdrDragMethod::applyCurrentTransformationToSdrObject(SdrObject& rTarget)
{
// do something special since the object size is in the polygon
// break up matrix to get the scale
const basegfx::utils::B2DHomMatrixBufferedDecompose aDecomp(aObjectTransform);
const basegfx::utils::B2DHomMatrixBufferedDecompose aTmpDecomp(aObjectTransform);
// get polygon's position and size
const basegfx::B2DRange aPolyRange(aObjectPolyPolygon.getB2DRange());
// get the scaling factors (do not mirror, this is in the object transformation)
const double fScaleX(fabs(aDecomp.getScale().getX()) / (basegfx::fTools::equalZero(aPolyRange.getWidth()) ? 1.0 : aPolyRange.getWidth()));
const double fScaleY(fabs(aDecomp.getScale().getY()) / (basegfx::fTools::equalZero(aPolyRange.getHeight()) ? 1.0 : aPolyRange.getHeight()));
const double fScaleX(fabs(aTmpDecomp.getScale().getX()) / (basegfx::fTools::equalZero(aPolyRange.getWidth()) ? 1.0 : aPolyRange.getWidth()));
const double fScaleY(fabs(aTmpDecomp.getScale().getY()) / (basegfx::fTools::equalZero(aPolyRange.getHeight()) ? 1.0 : aPolyRange.getHeight()));
// prepare transform matrix for polygon
basegfx::B2DHomMatrix aPolyTransform(
......@@ -3657,16 +3657,16 @@ bool SdrDragCrop::EndSdrDrag(bool /*bCopy*/)
pObj->TRGetBaseGeometry(aOriginalMatrix, aPolyPolygon);
{ // correct shear, it comes currently mirrored from TRGetBaseGeometry, can be removed with aw080
const basegfx::utils::B2DHomMatrixBufferedDecompose aDecomp(aOriginalMatrix);
const basegfx::utils::B2DHomMatrixBufferedDecompose aTmpDecomp(aOriginalMatrix);
if(!basegfx::fTools::equalZero(aDecomp.getShearX()))
if(!basegfx::fTools::equalZero(aTmpDecomp.getShearX()))
{
bShearCorrected = true;
aOriginalMatrix = basegfx::utils::createScaleShearXRotateTranslateB2DHomMatrix(
aDecomp.getScale(),
-aDecomp.getShearX(),
aDecomp.getRotate(),
aDecomp.getTranslate());
aTmpDecomp.getScale(),
-aTmpDecomp.getShearX(),
aTmpDecomp.getRotate(),
aTmpDecomp.getTranslate());
}
}
......@@ -3740,13 +3740,13 @@ bool SdrDragCrop::EndSdrDrag(bool /*bCopy*/)
// aDiscreteChangeMatrix, go to concrete sizes now.
// Create the unrotated original rectangle and the unrotated modified
// rectangle as Ranges
const basegfx::utils::B2DHomMatrixBufferedDecompose aDecomp(aOriginalMatrix);
const basegfx::utils::B2DHomMatrixBufferedDecompose aOriginalMatrixDecomp(aOriginalMatrix);
// prepare unsheared/unrotated versions of the old and new transformation
const basegfx::B2DHomMatrix aOriginalMatrixNoShearNoRotate(
basegfx::utils::createScaleTranslateB2DHomMatrix(
basegfx::absolute(aDecomp.getScale()),
aDecomp.getTranslate()));
basegfx::absolute(aOriginalMatrixDecomp.getScale()),
aOriginalMatrixDecomp.getTranslate()));
// create the ranges for these
basegfx::B2DRange aRangeOriginalNoShearNoRotate(0.0, 0.0, 1.0, 1.0);
......@@ -3784,13 +3784,13 @@ bool SdrDragCrop::EndSdrDrag(bool /*bCopy*/)
if(bShearCorrected)
{
// back-correct shear
const basegfx::utils::B2DHomMatrixBufferedDecompose aDecomp(aNewObjectMatrix);
const basegfx::utils::B2DHomMatrixBufferedDecompose aTmpDecomp(aNewObjectMatrix);
aNewObjectMatrix = basegfx::utils::createScaleShearXRotateTranslateB2DHomMatrix(
aDecomp.getScale(),
-aDecomp.getShearX(),
aDecomp.getRotate(),
aDecomp.getTranslate());
aTmpDecomp.getScale(),
-aTmpDecomp.getShearX(),
aTmpDecomp.getRotate(),
aTmpDecomp.getTranslate());
}
// apply change to object by applying the unit coordinate change followed
......
......@@ -626,6 +626,27 @@ void SwNoTextFrame::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew )
GetItemState( n, false ))
{
CLEARCACHE
if(RES_GRFATR_ROTATION == n)
{
// RotGrfFlyFrame: Update Handles in view, these may be rotation-dependent
// (e.g. crop handles) and need a visualisation update
if ( GetNode()->GetNodeType() == SwNodeType::Grf )
{
SwGrfNode* pNd = static_cast<SwGrfNode*>( GetNode());
SwViewShell *pVSh = pNd->GetDoc()->getIDocumentLayoutAccess().GetCurrentViewShell();
if(pVSh)
{
SdrView* pDrawView = pVSh->GetDrawView();
if(pDrawView)
{
pDrawView->AdjustMarkHdl(nullptr);
}
}
}
}
break;
}
if( RES_GRFATR_END == n ) // not found
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment