summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArmin Le Grand <Armin.Le.Grand@cib.de>2017-11-09 11:35:09 +0100
committerArmin Le Grand <Armin.Le.Grand@cib.de>2017-11-18 13:07:45 +0100
commit4cee8018792c732aac638bd82c754ade915a4db9 (patch)
treec9c98e4d621674449766d2054d710b6ef02bb5d0
parentc82cb453eb56fb37ad36cff6becde9d753eb829d (diff)
RotateFlyFrame3: Added basic transformation support
In lcl_MoveAllLowers SwFrame(s) were directly modified, not even by calling any member method what makes it hard to react on changes to geometric definition(s). Added logic to Transform a SwFrame, currently basic by using e.g. SwFrame::Ltransform_translate, may be later unified to general Transformation usage with a homogen Matrix Change-Id: I7582fbd1472e12e481adacedda2e65cc0c282eac
-rw-r--r--sw/source/core/doc/notxtfrm.cxx19
-rw-r--r--sw/source/core/inc/flyfrms.hxx3
-rw-r--r--sw/source/core/inc/frame.hxx16
-rw-r--r--sw/source/core/inc/notxtfrm.hxx3
-rw-r--r--sw/source/core/layout/flylay.cxx20
-rw-r--r--sw/source/core/layout/pagechg.cxx16
-rw-r--r--sw/source/core/layout/wsfrm.cxx34
7 files changed, 98 insertions, 13 deletions
diff --git a/sw/source/core/doc/notxtfrm.cxx b/sw/source/core/doc/notxtfrm.cxx
index b4fb5485d02e..897e9f6d1121 100644
--- a/sw/source/core/doc/notxtfrm.cxx
+++ b/sw/source/core/doc/notxtfrm.cxx
@@ -578,6 +578,25 @@ basegfx::B2DHomMatrix SwNoTextFrame::getFramePrintAreaTransformation() const
return SwContentFrame::getFramePrintAreaTransformation();
}
+// RotateFlyFrame3 - Support for Transformations
+void SwNoTextFrame::transform_translate(const Point& rOffset)
+{
+ // call parent - this will do the basic transform for SwRect(s)
+ // in the SwFrameAreaDefinition
+ SwContentFrame::transform_translate(rOffset);
+
+ // check if the Transformations need to be adapted
+ if(isTransformationUsed())
+ {
+ const basegfx::B2DHomMatrix aTransform(
+ basegfx::utils::createTranslateB2DHomMatrix(
+ rOffset.X(), rOffset.Y()));
+
+ // transform using TransformableSwFrame
+ doTransform(aTransform);
+ }
+}
+
// RotateFlyFrame3 - inner frame
// Check if we contain a SwGrfNode and get possible rotation from it
double SwNoTextFrame::getFrameRotation() const
diff --git a/sw/source/core/inc/flyfrms.hxx b/sw/source/core/inc/flyfrms.hxx
index b4f66f9d22d3..c388d80a0c0b 100644
--- a/sw/source/core/inc/flyfrms.hxx
+++ b/sw/source/core/inc/flyfrms.hxx
@@ -128,6 +128,9 @@ public:
// RotateFlyFrame3 - Support for Transformations
virtual basegfx::B2DHomMatrix getFrameAreaTransformation() const override;
virtual basegfx::B2DHomMatrix getFramePrintAreaTransformation() const override;
+
+ // RotateFlyFrame3 - Support for Transformations
+ virtual void transform_translate(const Point& rOffset) override;
};
// Flys that are bound to LayoutFrames and not to Content
diff --git a/sw/source/core/inc/frame.hxx b/sw/source/core/inc/frame.hxx
index 2d0a1c321372..7cb12dadad1a 100644
--- a/sw/source/core/inc/frame.hxx
+++ b/sw/source/core/inc/frame.hxx
@@ -205,6 +205,13 @@ public:
// SwFrame of a SwFlyFrame)
virtual basegfx::B2DHomMatrix getFrameAreaTransformation() const;
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
+ virtual void transform_translate(const Point& rOffset);
};
/// RotateFlyFrame3: Helper class when you want to make your SwFrame derivate
@@ -290,6 +297,15 @@ public:
// state when itz was necessary to reset them temporarily (see above)
void resetAreaDefinitionsToTransformed(
SwFrameAreaDefinition& rSwFrameAreaDefinition);
+
+ // check if used
+ bool isTransformationUsed() const
+ {
+ return !maFrameAreaTransformation.isIdentity() || !maFramePrintAreaTransformation.isIdentity();
+ }
+
+ // transform by given B2DHomMatrix
+ void doTransform(const basegfx::B2DHomMatrix aTransform);
};
/**
diff --git a/sw/source/core/inc/notxtfrm.hxx b/sw/source/core/inc/notxtfrm.hxx
index 43f020496599..0054078890a4 100644
--- a/sw/source/core/inc/notxtfrm.hxx
+++ b/sw/source/core/inc/notxtfrm.hxx
@@ -68,6 +68,9 @@ public:
// RotateFlyFrame3 - Support for Transformations
virtual basegfx::B2DHomMatrix getFrameAreaTransformation() const override;
virtual basegfx::B2DHomMatrix getFramePrintAreaTransformation() const override;
+
+ // RotateFlyFrame3 - Support for Transformations
+ virtual void transform_translate(const Point& rOffset) override;
};
#endif
diff --git a/sw/source/core/layout/flylay.cxx b/sw/source/core/layout/flylay.cxx
index 2c8cc422dd25..7a9aa676dfdc 100644
--- a/sw/source/core/layout/flylay.cxx
+++ b/sw/source/core/layout/flylay.cxx
@@ -41,6 +41,7 @@
#include <viewimp.hxx>
#include <IDocumentSettingAccess.hxx>
#include <IDocumentDrawModelAccess.hxx>
+#include <basegfx/matrix/b2dhommatrixtools.hxx>
using namespace ::com::sun::star;
@@ -294,6 +295,25 @@ basegfx::B2DHomMatrix SwFlyFreeFrame::getFramePrintAreaTransformation() const
return SwFlyFrame::getFramePrintAreaTransformation();
}
+// RotateFlyFrame3 - Support for Transformations
+void SwFlyFreeFrame::transform_translate(const Point& rOffset)
+{
+ // call parent - this will do the basic transform for SwRect(s)
+ // in the SwFrameAreaDefinition
+ SwFlyFrame::transform_translate(rOffset);
+
+ // check if the Transformations need to be adapted
+ if(isTransformationUsed())
+ {
+ const basegfx::B2DHomMatrix aTransform(
+ basegfx::utils::createTranslateB2DHomMatrix(
+ rOffset.X(), rOffset.Y()));
+
+ // transform using TransformableSwFrame
+ doTransform(aTransform);
+ }
+}
+
// RotateFlyFrame3 - outer frame
double getFrameRotation_from_SwNoTextFrame(const SwNoTextFrame& rNoTextFrame)
{
diff --git a/sw/source/core/layout/pagechg.cxx b/sw/source/core/layout/pagechg.cxx
index 716642b03fa5..72f86fc8fd69 100644
--- a/sw/source/core/layout/pagechg.cxx
+++ b/sw/source/core/layout/pagechg.cxx
@@ -1927,19 +1927,9 @@ static void lcl_MoveAllLowers( SwFrame* pFrame, const Point& rOffset )
const SwRect aFrame( pFrame->getFrameArea() );
// first move the current frame
- {
- SwFrameAreaDefinition::FrameAreaWriteAccess aFrm(*pFrame);
-
- if (aFrm.Pos().X() != FAR_AWAY)
- {
- aFrm.Pos().X() += rOffset.X();
- }
-
- if (aFrm.Pos().Y() != FAR_AWAY)
- {
- aFrm.Pos().Y() += rOffset.Y();
- }
- }
+ // RotateFlyFrame3: moved to transform_translate instead of
+ // direct modification to allow the SwFrame evtl. needed own reactions
+ pFrame->transform_translate(rOffset);
// Don't forget accessibility:
if( pFrame->IsAccessibleFrame() )
diff --git a/sw/source/core/layout/wsfrm.cxx b/sw/source/core/layout/wsfrm.cxx
index 972083bd273d..a67a70d46c76 100644
--- a/sw/source/core/layout/wsfrm.cxx
+++ b/sw/source/core/layout/wsfrm.cxx
@@ -129,6 +129,23 @@ basegfx::B2DHomMatrix SwFrameAreaDefinition::getFramePrintAreaTransformation() c
rFramePrintArea.Top() + rFrameArea.Top());
}
+void SwFrameAreaDefinition::transform_translate(const Point& rOffset)
+{
+ // RotateFlyFrame3: default is to change the FrameArea, FramePrintArea needs no
+ // change since it is relative to FrameArea
+ SwFrameAreaDefinition::FrameAreaWriteAccess aFrm(*this);
+
+ if (aFrm.Pos().X() != FAR_AWAY)
+ {
+ aFrm.Pos().X() += rOffset.X();
+ }
+
+ if (aFrm.Pos().Y() != FAR_AWAY)
+ {
+ aFrm.Pos().Y() += rOffset.Y();
+ }
+}
+
void TransformableSwFrame::createFrameAreaTransformations(
const SwFrameAreaDefinition& rSwFrameAreaDefinition,
double fRotation,
@@ -255,6 +272,23 @@ void TransformableSwFrame::resetAreaDefinitionsToTransformed(
rSwFrameAreaDefinition);
}
+// transform by given B2DHomMatrix
+void TransformableSwFrame::doTransform(const basegfx::B2DHomMatrix aTransform)
+{
+ if(!aTransform.isIdentity())
+ {
+ if(!maFrameAreaTransformation.isIdentity())
+ {
+ maFrameAreaTransformation *= aTransform;
+ }
+
+ if(!maFramePrintAreaTransformation.isIdentity())
+ {
+ maFramePrintAreaTransformation *= aTransform;
+ }
+ }
+}
+
SwFrame::SwFrame( SwModify *pMod, SwFrame* pSib )
: SwFrameAreaDefinition(),
SwClient( pMod ),