[Libreoffice-commits] core.git: Branch 'feature/RotGrfFlyFrame' - include/basegfx svx/source sw/source

Armin Le Grand Armin.Le.Grand at cib.de
Fri Sep 29 08:44:50 UTC 2017


 include/basegfx/matrix/b2dhommatrixtools.hxx |    1 
 svx/source/svdraw/svddrgmt.cxx               |   34 +++++++++++++--------------
 sw/source/core/doc/notxtfrm.cxx              |   21 ++++++++++++++++
 3 files changed, 39 insertions(+), 17 deletions(-)

New commits:
commit 336c3c961c971025d1b541cf82bc57cf14efc511
Author: Armin Le Grand <Armin.Le.Grand at cib.de>
Date:   Fri Sep 29 10:42:43 2017 +0200

    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

diff --git a/include/basegfx/matrix/b2dhommatrixtools.hxx b/include/basegfx/matrix/b2dhommatrixtools.hxx
index 1a2706cd1378..ed347a44a636 100644
--- a/include/basegfx/matrix/b2dhommatrixtools.hxx
+++ b/include/basegfx/matrix/b2dhommatrixtools.hxx
@@ -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 tools
 
diff --git a/svx/source/svdraw/svddrgmt.cxx b/svx/source/svdraw/svddrgmt.cxx
index 5790e0280c59..d7913114e7f0 100644
--- a/svx/source/svdraw/svddrgmt.cxx
+++ b/svx/source/svdraw/svddrgmt.cxx
@@ -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::tools::B2DHomMatrixBufferedDecompose aDecomp(aObjectTransform);
+        const basegfx::tools::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::tools::B2DHomMatrixBufferedDecompose aDecomp(aOriginalMatrix);
+        const basegfx::tools::B2DHomMatrixBufferedDecompose aTmpDecomp(aOriginalMatrix);
 
-        if(!basegfx::fTools::equalZero(aDecomp.getShearX()))
+        if(!basegfx::fTools::equalZero(aTmpDecomp.getShearX()))
         {
             bShearCorrected = true;
             aOriginalMatrix = basegfx::tools::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::tools::B2DHomMatrixBufferedDecompose aDecomp(aOriginalMatrix);
+    const basegfx::tools::B2DHomMatrixBufferedDecompose aOriginalMatrixDecomp(aOriginalMatrix);
 
     // prepare unsheared/unrotated versions of the old and new transformation
     const basegfx::B2DHomMatrix aOriginalMatrixNoShearNoRotate(
         basegfx::tools::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::tools::B2DHomMatrixBufferedDecompose aDecomp(aNewObjectMatrix);
+            const basegfx::tools::B2DHomMatrixBufferedDecompose aTmpDecomp(aNewObjectMatrix);
 
             aNewObjectMatrix = basegfx::tools::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
diff --git a/sw/source/core/doc/notxtfrm.cxx b/sw/source/core/doc/notxtfrm.cxx
index 550f862b5754..5149b8f62e66 100644
--- a/sw/source/core/doc/notxtfrm.cxx
+++ b/sw/source/core/doc/notxtfrm.cxx
@@ -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


More information about the Libreoffice-commits mailing list