[Libreoffice-commits] core.git: Branch 'feature/RotateFlyFrame3' - sw/source

Armin Le Grand Armin.Le.Grand at cib.de
Tue Nov 14 17:13:16 UTC 2017


 sw/source/core/doc/notxtfrm.cxx  |   14 +-
 sw/source/core/draw/dflyobj.cxx  |  228 +++++++++++++++++++++++++++++++--------
 sw/source/core/inc/flyfrms.hxx   |    4 
 sw/source/core/inc/frame.hxx     |   20 +--
 sw/source/core/inc/notxtfrm.hxx  |    4 
 sw/source/core/layout/fly.cxx    |    1 
 sw/source/core/layout/flycnt.cxx |    2 
 sw/source/core/layout/flylay.cxx |   16 +-
 sw/source/core/layout/wsfrm.cxx  |    6 -
 9 files changed, 216 insertions(+), 79 deletions(-)

New commits:
commit 9a39d5e86da72b21aa64653fb5f098accdc7ee80
Author: Armin Le Grand <Armin.Le.Grand at cib.de>
Date:   Tue Nov 14 18:07:32 2017 +0100

    RotateFlyFrame3: Made interactions work properly
    
    Have now created working interactive Rotation, Scale, Move
    and Crop. Using as much of the old code as possible since
    it does corrections based on BorderWidth/s stuff and similar.
    To do so, need to back-transform and execute in unrotated/
    untransformed state as much as possible. Had some problems
    with SwVirtFlyDrawObj::NbcMove usages and hacks there, had
    to restructure some of these.
    
    Change-Id: Ibedf6d834f96b2f8e9c1ace2a0c984aa26cedc74

diff --git a/sw/source/core/doc/notxtfrm.cxx b/sw/source/core/doc/notxtfrm.cxx
index 3971c9140da2..9432576bdcf4 100644
--- a/sw/source/core/doc/notxtfrm.cxx
+++ b/sw/source/core/doc/notxtfrm.cxx
@@ -473,7 +473,7 @@ const Size& SwNoTextFrame::GetSize() const
 void SwNoTextFrame::MakeAll(vcl::RenderContext* pRenderContext)
 {
     // RotateFlyFrame3 - inner frame. Get rotation and check if used
-    const double fRotation(getFrameRotation());
+    const double fRotation(getLocalFrameRotation());
     const bool bRotated(!basegfx::fTools::equalZero(fRotation));
 
     if(bRotated)
@@ -498,7 +498,7 @@ void SwNoTextFrame::MakeAll(vcl::RenderContext* pRenderContext)
             // is currently beyond scope
             if(pUpperFly->isTransformableSwFrame())
             {
-                pUpperFly->getTransformableSwFrame()->resetAreaDefinitionsToUntransformed();
+                pUpperFly->getTransformableSwFrame()->restoreFrameAreas();
             }
         }
 
@@ -508,7 +508,7 @@ void SwNoTextFrame::MakeAll(vcl::RenderContext* pRenderContext)
         // Reset to BoundAreas will be done below automatically
         if(isTransformableSwFrame())
         {
-            getTransformableSwFrame()->resetAreaDefinitionsToUntransformed();
+            getTransformableSwFrame()->restoreFrameAreas();
         }
     }
 
@@ -549,7 +549,7 @@ void SwNoTextFrame::MakeAll(vcl::RenderContext* pRenderContext)
             // upper frame, so it can bre re-created on the fly
             if(pUpperFly->isTransformableSwFrame())
             {
-                pUpperFly->getTransformableSwFrame()->resetAreaDefinitionsToTransformed();
+                pUpperFly->getTransformableSwFrame()->adaptFrameAreasToTransformations();
             }
         }
 
@@ -566,7 +566,7 @@ void SwNoTextFrame::MakeAll(vcl::RenderContext* pRenderContext)
         getTransformableSwFrame()->createFrameAreaTransformations(
             fRotation,
             aB2DCenter);
-        getTransformableSwFrame()->resetAreaDefinitionsToTransformed();
+        getTransformableSwFrame()->adaptFrameAreasToTransformations();
     }
     else
     {
@@ -615,13 +615,13 @@ void SwNoTextFrame::transform_translate(const Point& rOffset)
                 rOffset.X(), rOffset.Y()));
 
         // transform using TransformableSwFrame
-        getTransformableSwFrame()->doTransform(aTransform);
+        getTransformableSwFrame()->transform(aTransform);
     }
 }
 
 // RotateFlyFrame3 - inner frame
 // Check if we contain a SwGrfNode and get possible rotation from it
-double SwNoTextFrame::getFrameRotation() const
+double SwNoTextFrame::getLocalFrameRotation() const
 {
     const SwNoTextNode* pSwNoTextNode(nullptr != GetNode() ? GetNode()->GetNoTextNode() : nullptr);
 
diff --git a/sw/source/core/draw/dflyobj.cxx b/sw/source/core/draw/dflyobj.cxx
index cc12dd1baad9..e1035a3754fa 100644
--- a/sw/source/core/draw/dflyobj.cxx
+++ b/sw/source/core/draw/dflyobj.cxx
@@ -630,9 +630,18 @@ void SwVirtFlyDrawObj::NbcSetLogicRect(const tools::Rectangle& )
 }
 
 //  SwVirtFlyDrawObj::Move() and Resize()
-
 void SwVirtFlyDrawObj::NbcMove(const Size& rSiz)
 {
+    if(GetFlyFrame()->IsFlyFreeFrame() && static_cast<SwFlyFreeFrame*>(GetFlyFrame())->isTransformableSwFrame())
+    {
+        // When we have a change in transformed state, we need to fall back to the
+        // state without possible transformations. Restore FrameArea and use aOutRect
+        // from old FrameArea. From here, all former actions below should be fine
+        TransformableSwFrame* pTransformableSwFrame(static_cast<SwFlyFreeFrame*>(GetFlyFrame())->getTransformableSwFrame());
+        pTransformableSwFrame->restoreFrameAreas();
+        aOutRect = GetFlyFrame()->getFrameArea().SVRect();
+    }
+
     MoveRect( aOutRect, rSiz );
     const Point aOldPos( GetFlyFrame()->getFrameArea().Pos() );
     const Point aNewPos( aOutRect.TopLeft() );
@@ -649,7 +658,9 @@ void SwVirtFlyDrawObj::NbcMove(const Size& rSiz)
     //anchor must be set. Anchor and the new RelPos is calculated and
     //placed by the Fly itself.
     if( GetFlyFrame()->IsFlyAtContentFrame() )
+    {
         static_cast<SwFlyAtContentFrame*>(GetFlyFrame())->SetAbsPos( aNewPos );
+    }
     else
     {
         const SwFrameFormat *pTmpFormat = GetFormat();
@@ -781,34 +792,63 @@ void SwVirtFlyDrawObj::NbcCrop(const Point& rRef, const Fraction& xFact, const F
 {
     // Get Wrt Shell
     SwWrtShell *pSh = dynamic_cast<SwWrtShell*>( GetFlyFrame()->getRootFrame()->GetCurrShell() );
+
     if (!pSh)
+    {
         return;
+    }
+
+    GraphicObject const *pGraphicObject = pSh->GetGraphicObj();
+
+    if (!pGraphicObject)
+    {
+        return;
+    }
+
+    const bool bIsTransformableSwFrame(
+        GetFlyFrame()->IsFlyFreeFrame() &&
+        static_cast<SwFlyFreeFrame*>(GetFlyFrame())->isTransformableSwFrame());
+
+    if(bIsTransformableSwFrame)
+    {
+        // When we have a change in transformed state, we need to fall back to the
+        // state without possible transformations. Restore FrameArea and use aOutRect
+        // from old FrameArea. From here, all former actions below should be fine
+        TransformableSwFrame* pTransformableSwFrame(static_cast<SwFlyFreeFrame*>(GetFlyFrame())->getTransformableSwFrame());
+        pTransformableSwFrame->restoreFrameAreas();
+        aOutRect = GetFlyFrame()->getFrameArea().SVRect();
+    }
 
     // Compute old and new rect. This will give us the deformation to apply to
     // the object to crop
-    tools::Rectangle aOldRect( aOutRect );
-
-    const long nOldWidth = aOldRect.GetWidth();
-    const long nOldHeight = aOldRect.GetHeight();
+    const long nOldWidth(aOutRect.GetWidth());
+    const long nOldHeight(aOutRect.GetHeight());
 
     if (!nOldWidth || !nOldHeight)
+    {
         return;
+    }
 
     tools::Rectangle aNewRect( aOutRect );
     ResizeRect( aNewRect, rRef, xFact, yFact );
 
     // Get graphic object size in 100th of mm
-    GraphicObject const *pGraphicObject = pSh->GetGraphicObj();
-    if (!pGraphicObject)
-        return;
     const MapMode aMapMode100thmm(MapUnit::Map100thMM);
     Size aGraphicSize(pGraphicObject->GetPrefSize());
+
     if( MapUnit::MapPixel == pGraphicObject->GetPrefMapMode().GetMapUnit() )
+    {
         aGraphicSize = Application::GetDefaultDevice()->PixelToLogic( aGraphicSize, aMapMode100thmm );
+    }
     else
+    {
         aGraphicSize = OutputDevice::LogicToLogic( aGraphicSize, pGraphicObject->GetPrefMapMode(), aMapMode100thmm);
+    }
+
     if( aGraphicSize.Width() == 0 || aGraphicSize.Height() == 0 )
+    {
         return ;
+    }
 
     // Get old values for crop in 10th of mm
     SfxItemSet aSet( pSh->GetAttrPool(), svl::Items<RES_GRFATR_CROPGRF, RES_GRFATR_CROPGRF>{} );
@@ -825,10 +865,10 @@ void SwVirtFlyDrawObj::NbcCrop(const Point& rRef, const Fraction& xFact, const F
     double fScaleX = ( aGraphicSize.Width() - aCropRectangle.Left() - aCropRectangle.Right() ) / (double)nOldWidth;
     double fScaleY = ( aGraphicSize.Height() - aCropRectangle.Top() - aCropRectangle.Bottom() ) / (double)nOldHeight;
 
-    sal_Int32 nDiffLeft = aNewRect.Left() - aOldRect.Left();
-    sal_Int32 nDiffTop = aNewRect.Top() - aOldRect.Top();
-    sal_Int32 nDiffRight = aNewRect.Right() - aOldRect.Right();
-    sal_Int32 nDiffBottom = aNewRect.Bottom() - aOldRect.Bottom();
+    sal_Int32 nDiffLeft = aNewRect.Left() - aOutRect.Left();
+    sal_Int32 nDiffTop = aNewRect.Top() - aOutRect.Top();
+    sal_Int32 nDiffRight = aNewRect.Right() - aOutRect.Right();
+    sal_Int32 nDiffBottom = aNewRect.Bottom() - aOutRect.Bottom();
 
     // Compute new values in 10th of mm
     sal_Int32 nLeftCrop = static_cast<sal_Int32>( aCropRectangle.Left() + nDiffLeft * fScaleX );
@@ -854,31 +894,117 @@ void SwVirtFlyDrawObj::NbcCrop(const Point& rRef, const Fraction& xFact, const F
     aSz.SetHeight(aNewRect.GetHeight());
     pFormat->GetDoc()->SetAttr( aSz, *pFormat );
 
+    if(bIsTransformableSwFrame)
+    {
+        // Need to correct the TopLeft position in rotated state to make
+        // the interaction look correct. First, extract rotation (and others
+        // currently not used)
+        basegfx::B2DVector aScale, aTranslate;
+        double fRotate, fShearX;
+        GetFlyFrame()->getFrameAreaTransformation().decompose(aScale, aTranslate, fRotate, fShearX);
+
+        // calc the center of the unchanged object
+        const basegfx::B2DPoint aFormerCenter(
+            GetFlyFrame()->getFrameAreaTransformation() * basegfx::B2DPoint(0.5, 0.5));
+
+        // define the existing rotaiton around that former center
+        const basegfx::B2DHomMatrix aRotFormerCenter(
+            basegfx::utils::createRotateAroundPoint(
+                aFormerCenter.getX(),
+                aFormerCenter.getY(),
+                fRotate));
+
+        // use the new center of the unrotated object, rotate it around the
+        // former center
+        const Point aNewCenter(aNewRect.Center());
+        const basegfx::B2DPoint aRotNewCenter(
+            aRotFormerCenter * basegfx::B2DPoint(aNewCenter.X(), aNewCenter.Y()));
+
+        // Create the new TopLeft of the unrotated, cropped object by creating
+        // as if re-rceating the unrotated geometry
+        const Point aNewTopLeft(
+            basegfx::fround(aRotNewCenter.getX() - (0.5 * aNewRect.getWidth())),
+            basegfx::fround(aRotNewCenter.getY() - (0.5 * aNewRect.getHeight())));
+
+        // checvk if we have movement and execute if yes
+        const Size aDeltaMove(
+            basegfx::fround(aNewTopLeft.getX() - aOutRect.Left()),
+            basegfx::fround(aNewTopLeft.getY() - aOutRect.Top()));
+
+        if(0 != aDeltaMove.Width() || 0 != aDeltaMove.Height())
+        {
+            NbcMove(aDeltaMove);
+        }
+    }
+
 //    pSh->EndUndo(SwUndoId::END);
     pSh->EndAllAction();
-
 }
 
-void SwVirtFlyDrawObj::NbcResize(const Point& rRef,
-            const Fraction& xFact, const Fraction& yFact)
+void SwVirtFlyDrawObj::NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact)
 {
-    ResizeRect( aOutRect, rRef, xFact, yFact );
-
     const SwFrame* pTmpFrame = GetFlyFrame()->GetAnchorFrame();
+
     if( !pTmpFrame )
+    {
         pTmpFrame = GetFlyFrame();
-    const bool bVertX = pTmpFrame->IsVertical();
+    }
+
+    const bool bVertX(pTmpFrame->IsVertical());
+    const bool bRTL(pTmpFrame->IsRightToLeft());
+    const bool bVertL2RX(pTmpFrame->IsVertLR());
+    const bool bUseRightEdge((bVertX && !bVertL2RX ) || bRTL);
+    const bool bIsTransformableSwFrame(
+        GetFlyFrame()->IsFlyFreeFrame() &&
+        static_cast<SwFlyFreeFrame*>(GetFlyFrame())->isTransformableSwFrame());
+
+    if(bIsTransformableSwFrame)
+    {
+        // When we have a change in transformed state, we need to fall back to the
+        // state without possible transformations.
+        // In the Resize case to correctly handle the changes, apply to the transformation
+        // and extract the new, untransformed state from that modified transformation
+        basegfx::B2DHomMatrix aNewMat(GetFlyFrame()->getFrameAreaTransformation());
+        const basegfx::B2DPoint aRef(rRef.X(), rRef.Y());
+
+        // apply state to already valid transformation
+        aNewMat.translate(-aRef.getX(), -aRef.getY());
+        aNewMat.scale(double(xFact), double(yFact));
+        aNewMat.translate(aRef.getX(), aRef.getY());
+
+        // get center of transfomed state
+        const basegfx::B2DPoint aCenter(aNewMat * basegfx::B2DPoint(0.5, 0.5));
+
+        // decompose to extract scale
+        basegfx::B2DVector aScale, aTranslate;
+        double fRotate, fShearX;
+        aNewMat.decompose(aScale, aTranslate, fRotate, fShearX);
+
+        // create new modified OutRect
+        aOutRect = tools::Rectangle(
+            basegfx::fround(aCenter.getX() - (0.5 * aScale.getX())),
+            basegfx::fround(aCenter.getY() - (0.5 * aScale.getY())),
+            basegfx::fround(aCenter.getX() + (0.5 * aScale.getX())),
+            basegfx::fround(aCenter.getY() + (0.5 * aScale.getY())));
+
+        // restore FrameAreas so that actions below not adapted to new
+        // full transformations take the correct actions
+        TransformableSwFrame* pTransformableSwFrame(static_cast<SwFlyFreeFrame*>(GetFlyFrame())->getTransformableSwFrame());
+        pTransformableSwFrame->restoreFrameAreas();
+    }
+    else
+    {
+        ResizeRect( aOutRect, rRef, xFact, yFact );
+    }
 
-    const bool bRTL = pTmpFrame->IsRightToLeft();
+    // Position may also change, remember old one. This ois now already
+    // the one in the unrotated, old coordinate system
+    Point aOldPos(bUseRightEdge ? GetFlyFrame()->getFrameArea().TopRight() : GetFlyFrame()->getFrameArea().Pos());
 
-    const bool bVertL2RX = pTmpFrame->IsVertLR();
-    const Point aNewPos( ( bVertX && !bVertL2RX ) || bRTL ?
-                         aOutRect.Right() + 1 :
-                         aOutRect.Left(),
-                         aOutRect.Top() );
+    // get target size in old coordinate system
+    Size aSz( aOutRect.Right() - aOutRect.Left() + 1, aOutRect.Bottom()- aOutRect.Top()  + 1 );
 
-    Size aSz( aOutRect.Right() - aOutRect.Left() + 1,
-              aOutRect.Bottom()- aOutRect.Top()  + 1 );
+    // compare with restored FrameArea
     if( aSz != GetFlyFrame()->getFrameArea().SSize() )
     {
         //The width of the columns should not be too narrow
@@ -903,6 +1029,7 @@ void SwVirtFlyDrawObj::NbcResize(const Point& rRef,
         const SwFormatFrameSize aOldFrameSz( pFormat->GetFrameSize() );
         GetFlyFrame()->ChgSize( aSz );
         SwFormatFrameSize aFrameSz( pFormat->GetFrameSize() );
+
         if ( aFrameSz.GetWidthPercent() || aFrameSz.GetHeightPercent() )
         {
             long nRelWidth, nRelHeight;
@@ -910,6 +1037,7 @@ void SwVirtFlyDrawObj::NbcResize(const Point& rRef,
                                 GetFlyFrame()->GetAnchorFrame() :
                                 GetFlyFrame()->GetAnchorFrame()->GetUpper();
             const SwViewShell *pSh = GetFlyFrame()->getRootFrame()->GetCurrShell();
+
             if ( pSh && pRel->IsBodyFrame() &&
                  pSh->GetViewOptions()->getBrowseMode() &&
                  pSh->VisArea().HasArea() )
@@ -924,40 +1052,50 @@ void SwVirtFlyDrawObj::NbcResize(const Point& rRef,
                 nRelWidth  = pRel->getFramePrintArea().Width();
                 nRelHeight = pRel->getFramePrintArea().Height();
             }
+
             if ( aFrameSz.GetWidthPercent() && aFrameSz.GetWidthPercent() != SwFormatFrameSize::SYNCED &&
                  aOldFrameSz.GetWidth() != aFrameSz.GetWidth() )
+            {
                 aFrameSz.SetWidthPercent( sal_uInt8(aSz.Width() * 100.0 / nRelWidth + 0.5) );
+            }
+
             if ( aFrameSz.GetHeightPercent() && aFrameSz.GetHeightPercent() != SwFormatFrameSize::SYNCED &&
                  aOldFrameSz.GetHeight() != aFrameSz.GetHeight() )
+            {
                 aFrameSz.SetHeightPercent( sal_uInt8(aSz.Height() * 100.0 / nRelHeight + 0.5) );
+            }
+
             pFormat->GetDoc()->SetAttr( aFrameSz, *pFormat );
         }
     }
 
-    //Position can also be changed!
-    const Point aOldPos( ( bVertX && !bVertL2RX ) || bRTL ?
-                         GetFlyFrame()->getFrameArea().TopRight() :
-                         GetFlyFrame()->getFrameArea().Pos() );
+    //Position can also be changed, get new one
+    const Point aNewPos(bUseRightEdge ? aOutRect.Right() + 1 : aOutRect.Left(), aOutRect.Top());
+
     if ( aNewPos != aOldPos )
     {
-        //May have been altered by the ChgSize!
-        if( bVertX || bRTL )
+        // Former late change in aOutRect by ChgSize
+        // is now taken into account directly by calculating
+        // aNewPos *after* calling ChgSize (see old code).
+        // Still need to adapt aOutRect since the 'Move' is already applied
+        // here (see ResizeRect) and it's the same SdrObject
+        const Size aDeltaMove(
+                aNewPos.X() - aOldPos.X(),
+                aNewPos.Y() - aOldPos.Y());
+        MoveRect(aOutRect, Size(-aDeltaMove.Width(), -aDeltaMove.Height()));
+
+        // Now, move as needed (no empty delta which was a hack anyways)
+        if(bIsTransformableSwFrame)
         {
-            if( aOutRect.TopRight() != aNewPos )
-            {
-                SwTwips nDeltaX;
-                if ( bVertL2RX )
-                    nDeltaX = aNewPos.X() - aOutRect.Left();
-                else
-                    nDeltaX = aNewPos.X() - aOutRect.Right();
-                SwTwips nDeltaY = aNewPos.Y() - aOutRect.Top();
-                MoveRect( aOutRect, Size( nDeltaX, nDeltaY ) );
-            }
+            // need to save aOutRect to FrameArea, will be restored to aOutRect in
+            // SwVirtFlyDrawObj::NbcMove currently for TransformableSwFrames
+            SwFrameAreaDefinition::FrameAreaWriteAccess aFrm(*GetFlyFrame());
+            aFrm.setSwRect(aOutRect);
         }
-        else if ( aOutRect.TopLeft() != aNewPos )
-            aOutRect.SetPos( aNewPos );
+
+        // keep old hack - not clear what happens here
         bInResize = true;
-        NbcMove( Size( 0, 0 ) );
+        NbcMove(aDeltaMove);
         bInResize = false;
     }
 }
diff --git a/sw/source/core/inc/flyfrms.hxx b/sw/source/core/inc/flyfrms.hxx
index 429ff26b25e8..5334a0269447 100644
--- a/sw/source/core/inc/flyfrms.hxx
+++ b/sw/source/core/inc/flyfrms.hxx
@@ -26,7 +26,7 @@
 // #i28701#
 class SwFlyAtContentFrame;
 
-double getFrameRotation_from_SwNoTextFrame(const SwNoTextFrame& rNoTextFrame);
+double getLocalFrameRotation_from_SwNoTextFrame(const SwNoTextFrame& rNoTextFrame);
 
 // Base class for those Flys that can "move freely" or better that are not
 // bound in Content.
@@ -63,7 +63,7 @@ private:
     // RotateFlyFrame3 - Support for outer Frame of a SwGrfNode
     // Only for local data extraction. To uniquely access information
     // for local transformation, use getFrameArea(Print)Transformation
-    double getFrameRotation() const;
+    double getLocalFrameRotation() const;
 
 protected:
     // #i28701# - new friend class <SwFlyNotify> for access to
diff --git a/sw/source/core/inc/frame.hxx b/sw/source/core/inc/frame.hxx
index b8a2d7ab0370..cb436581adf2 100644
--- a/sw/source/core/inc/frame.hxx
+++ b/sw/source/core/inc/frame.hxx
@@ -207,10 +207,7 @@ public:
     virtual basegfx::B2DHomMatrix getFramePrintAreaTransformation() const;
 
     // RotateFlyFrame3 - Support for Transformations
-    // Diverse transformations, starting with a concrete translate that has
-    // to be mapped and currently directly changes SwRect(s) at SwFrames. For
-    // now stay on sigle actions (*_translate), bu tmaybe later unified to
-    // a single transform with a single B2DHomMatrix to apply
+    // Modify current transformations by applying given translation
     virtual void transform_translate(const Point& rOffset);
 };
 
@@ -228,7 +225,10 @@ private:
     basegfx::B2DHomMatrix   maFrameAreaTransformation;
     basegfx::B2DHomMatrix   maFramePrintAreaTransformation;
 
-    // last saved versions of SwRect(s) from SwFrameAreaDefinition
+    // last saved versions of SwRect(s) from SwFrameAreaDefinition,
+    // set from adaptFrameAreasToTransformations before modifying
+    // SwFrameAreaDefinition(s), used for restore from
+    // restoreFrameAreas
     SwRect                  maSavedFrameArea;
     SwRect                  maSavedFramePrintArea;
 
@@ -262,17 +262,17 @@ public:
     // Tooling method to reset the SwRect(s) in the current
     // SwFrameAreaDefinition which are already apapted to
     // Transformation back to the untransformed state that was
-    // last saved (see resetAreaDefinitionsToTransformed).
+    // last saved (see adaptFrameAreasToTransformations).
     // Only the SwRect(s) are changed back, not the transformations.
-    void resetAreaDefinitionsToUntransformed();
+    void restoreFrameAreas();
 
     // Re-Creates the SwRect(s) as BoundAreas based on the current
     // set Transformations, also saves the last SwRect(s) to the save
     // values.
-    void resetAreaDefinitionsToTransformed();
+    void adaptFrameAreasToTransformations();
 
-    // transform by given B2DHomMatrix
-    void doTransform(const basegfx::B2DHomMatrix aTransform);
+    // Modify current definitions by applying the given transformation
+    void transform(const basegfx::B2DHomMatrix aTransform);
 };
 
 /**
diff --git a/sw/source/core/inc/notxtfrm.hxx b/sw/source/core/inc/notxtfrm.hxx
index 6144b32e58eb..2726a4eb5071 100644
--- a/sw/source/core/inc/notxtfrm.hxx
+++ b/sw/source/core/inc/notxtfrm.hxx
@@ -44,8 +44,8 @@ private:
     // RotateFlyFrame3 - Support for inner frame of a SwGrfNode.
     // Only for local data extraction. To uniquely access information
     // for local transformation, use getFrameArea(Print)Transformation.
-    friend double getFrameRotation_from_SwNoTextFrame(const SwNoTextFrame& rNoTextFrame);
-    double getFrameRotation() const;
+    friend double getLocalFrameRotation_from_SwNoTextFrame(const SwNoTextFrame& rNoTextFrame);
+    double getLocalFrameRotation() const;
 
 protected:
     virtual void MakeAll(vcl::RenderContext* pRenderContext) override;
diff --git a/sw/source/core/layout/fly.cxx b/sw/source/core/layout/fly.cxx
index 66cf55754c6c..d704d7bb104e 100644
--- a/sw/source/core/layout/fly.cxx
+++ b/sw/source/core/layout/fly.cxx
@@ -1966,6 +1966,7 @@ Size SwFlyFrame::ChgSize( const Size& aNewSize )
             }
         }
     }
+
     if ( aAdjustedNewSize != getFrameArea().SSize() )
     {
         SwFrameFormat *pFormat = GetFormat();
diff --git a/sw/source/core/layout/flycnt.cxx b/sw/source/core/layout/flycnt.cxx
index 2b980f904c39..87d3bba45400 100644
--- a/sw/source/core/layout/flycnt.cxx
+++ b/sw/source/core/layout/flycnt.cxx
@@ -1371,9 +1371,7 @@ void SwFlyAtContentFrame::SetAbsPos( const Point &rNew )
         GetPageFrame()->MoveFly( this, pTmpPage );
 
     const Point aRelPos = bVert ? Point( -nY, nX ) : Point( nX, nY );
-
     ChgRelPos( aRelPos );
-
     GetFormat()->GetDoc()->GetIDocumentUndoRedo().EndUndo( SwUndoId::END, nullptr );
 
     if ( pOldPage != FindPageFrame() )
diff --git a/sw/source/core/layout/flylay.cxx b/sw/source/core/layout/flylay.cxx
index fdde46214e86..235cc69bbc13 100644
--- a/sw/source/core/layout/flylay.cxx
+++ b/sw/source/core/layout/flylay.cxx
@@ -156,7 +156,7 @@ void SwFlyFreeFrame::MakeAll(vcl::RenderContext* /*pRenderContext*/)
     const int nLoopControlMax = 10;
 
     // RotateFlyFrame3 - outer frame
-    const double fRotation(getFrameRotation());
+    const double fRotation(getLocalFrameRotation());
     const bool bRotated(!basegfx::fTools::equalZero(fRotation));
 
     if(bRotated)
@@ -166,7 +166,7 @@ void SwFlyFreeFrame::MakeAll(vcl::RenderContext* /*pRenderContext*/)
         // needed. Reset to BoundAreas will be done below automatically
         if(isTransformableSwFrame())
         {
-            getTransformableSwFrame()->resetAreaDefinitionsToUntransformed();
+            getTransformableSwFrame()->restoreFrameAreas();
         }
     }
 
@@ -264,7 +264,7 @@ void SwFlyFreeFrame::MakeAll(vcl::RenderContext* /*pRenderContext*/)
         getTransformableSwFrame()->createFrameAreaTransformations(
             fRotation,
             aB2DCenter);
-        getTransformableSwFrame()->resetAreaDefinitionsToTransformed();
+        getTransformableSwFrame()->adaptFrameAreasToTransformations();
     }
     else
     {
@@ -323,17 +323,17 @@ void SwFlyFreeFrame::transform_translate(const Point& rOffset)
                 rOffset.X(), rOffset.Y()));
 
         // transform using TransformableSwFrame
-        getTransformableSwFrame()->doTransform(aTransform);
+        getTransformableSwFrame()->transform(aTransform);
     }
 }
 
 // RotateFlyFrame3 - outer frame
-double getFrameRotation_from_SwNoTextFrame(const SwNoTextFrame& rNoTextFrame)
+double getLocalFrameRotation_from_SwNoTextFrame(const SwNoTextFrame& rNoTextFrame)
 {
-    return rNoTextFrame.getFrameRotation();
+    return rNoTextFrame.getLocalFrameRotation();
 }
 
-double SwFlyFreeFrame::getFrameRotation() const
+double SwFlyFreeFrame::getLocalFrameRotation() const
 {
     // SwLayoutFrame::Lower() != SwFrame::GetLower(), but SwFrame::GetLower()
     // calls SwLayoutFrame::Lower() when it's a SwLayoutFrame - so use GetLower()
@@ -341,7 +341,7 @@ double SwFlyFreeFrame::getFrameRotation() const
 
     if(nullptr != pSwNoTextFrame)
     {
-        return getFrameRotation_from_SwNoTextFrame(*pSwNoTextFrame);
+        return getLocalFrameRotation_from_SwNoTextFrame(*pSwNoTextFrame);
     }
 
     // no rotation
diff --git a/sw/source/core/layout/wsfrm.cxx b/sw/source/core/layout/wsfrm.cxx
index 136c3d2ff85e..cfff6acaad8a 100644
--- a/sw/source/core/layout/wsfrm.cxx
+++ b/sw/source/core/layout/wsfrm.cxx
@@ -166,7 +166,7 @@ void TransformableSwFrame::createFrameAreaTransformations(
         rFramePrintArea.Left() + rFrameArea.Left(), rFramePrintArea.Top() + rFrameArea.Top());
 }
 
-void TransformableSwFrame::resetAreaDefinitionsToTransformed()
+void TransformableSwFrame::adaptFrameAreasToTransformations()
 {
     if(!getLocalFrameAreaTransformation().isIdentity())
     {
@@ -203,7 +203,7 @@ void TransformableSwFrame::resetAreaDefinitionsToTransformed()
     }
 }
 
-void TransformableSwFrame::resetAreaDefinitionsToUntransformed()
+void TransformableSwFrame::restoreFrameAreas()
 {
     // This can be done fully based on the Transformations currently
     // set (and I did this in the beginning and it may be necessary
@@ -224,7 +224,7 @@ void TransformableSwFrame::resetAreaDefinitionsToUntransformed()
 }
 
 // transform by given B2DHomMatrix
-void TransformableSwFrame::doTransform(const basegfx::B2DHomMatrix aTransform)
+void TransformableSwFrame::transform(const basegfx::B2DHomMatrix aTransform)
 {
     if(!aTransform.isIdentity())
     {


More information about the Libreoffice-commits mailing list