summaryrefslogtreecommitdiff
path: root/sw/source/core/draw/dflyobj.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'sw/source/core/draw/dflyobj.cxx')
-rw-r--r--sw/source/core/draw/dflyobj.cxx175
1 files changed, 104 insertions, 71 deletions
diff --git a/sw/source/core/draw/dflyobj.cxx b/sw/source/core/draw/dflyobj.cxx
index 93a66ba6b625..26254ad9e9f2 100644
--- a/sw/source/core/draw/dflyobj.cxx
+++ b/sw/source/core/draw/dflyobj.cxx
@@ -19,7 +19,9 @@
#include <hintids.hxx>
#include <comphelper/lok.hxx>
+#include <osl/diagnose.h>
#include <tools/mapunit.hxx>
+#include <tools/UnitConversion.hxx>
#include <svx/svdhdl.hxx>
#include <svx/svdtrans.hxx>
#include <editeng/protitem.hxx>
@@ -59,7 +61,7 @@
// AW: For VCOfDrawVirtObj and stuff
#include <svx/sdr/contact/viewcontactofvirtobj.hxx>
-#include <drawinglayer/primitive2d/baseprimitive2d.hxx>
+#include <drawinglayer/primitive2d/BufferedDecompositionPrimitive2D.hxx>
#include <drawinglayer/geometry/viewinformation2d.hxx>
#include <sw_primitivetypes2d.hxx>
#include <drawinglayer/primitive2d/sdrdecompositiontools2d.hxx>
@@ -90,7 +92,7 @@ namespace sdr::contact
*
* @note ONLY based on model data
*/
- virtual drawinglayer::primitive2d::Primitive2DContainer createViewIndependentPrimitive2DSequence() const override;
+ virtual void createViewIndependentPrimitive2DSequence(drawinglayer::primitive2d::Primitive2DDecompositionVisitor& rVisitor) const override;
public:
/// basic constructor, used from SdrObject.
@@ -102,10 +104,9 @@ namespace sdr::contact
}
- drawinglayer::primitive2d::Primitive2DContainer VCOfSwFlyDrawObj::createViewIndependentPrimitive2DSequence() const
+ void VCOfSwFlyDrawObj::createViewIndependentPrimitive2DSequence(drawinglayer::primitive2d::Primitive2DDecompositionVisitor&) const
{
// currently gets not visualized, return empty sequence
- return drawinglayer::primitive2d::Primitive2DContainer();
}
} // end of namespace sdr::contact
@@ -141,7 +142,17 @@ SdrInventor SwFlyDrawObj::GetObjInventor() const
SdrObjKind SwFlyDrawObj::GetObjIdentifier() const
{
- return SwFlyDrawObjIdentifier;
+ return SdrObjKind::SwFlyDrawObjIdentifier;
+}
+
+rtl::Reference<SdrObject> SwFlyDrawObj::CloneSdrObject(SdrModel& rTargetModel) const
+{
+ return new SwFlyDrawObj(rTargetModel);
+}
+
+void SwFlyDrawObj::NbcRotate(const Point& /*rRef*/, Degree100 /*nAngle*/, double /*sinAngle*/, double /*cosAngle*/)
+{
+ assert(false);
}
// TODO: Need own primitive to get the FlyFrame paint working
@@ -157,14 +168,13 @@ namespace drawinglayer::primitive2d
protected:
/// method which is to be used to implement the local decomposition of a 2D primitive
- virtual void create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& rViewInformation) const override;
+ virtual Primitive2DReference create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const override;
public:
SwVirtFlyDrawObjPrimitive(
const SwVirtFlyDrawObj& rSwVirtFlyDrawObj,
const basegfx::B2DRange &rOuterRange)
- : BufferedDecompositionPrimitive2D(),
- mrSwVirtFlyDrawObj(rSwVirtFlyDrawObj),
+ : mrSwVirtFlyDrawObj(rSwVirtFlyDrawObj),
maOuterRange(rOuterRange)
{
}
@@ -189,10 +199,10 @@ namespace drawinglayer::primitive2d
namespace drawinglayer::primitive2d
{
- void SwVirtFlyDrawObjPrimitive::create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& /*rViewInformation*/) const
+ Primitive2DReference SwVirtFlyDrawObjPrimitive::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const
{
if(getOuterRange().isEmpty())
- return;
+ return nullptr;
// currently this SW object has no primitive representation. As long as this is the case,
// create invisible geometry to allow correct HitTest and BoundRect calculations for the
@@ -200,10 +210,10 @@ namespace drawinglayer::primitive2d
// the old SwVirtFlyDrawObj::CheckHit implementation are handled now in SwDrawView::PickObj;
// this removed the 'hack' to get a view from inside model data or to react on null-tolerance
// as it was done in the old implementation
- rContainer.push_back(
+ return
createHiddenGeometryPrimitives2D(
true,
- getOuterRange()));
+ getOuterRange());
}
bool SwVirtFlyDrawObjPrimitive::operator==(const BasePrimitive2D& rPrimitive) const
@@ -238,7 +248,10 @@ namespace drawinglayer::primitive2d
}
// provide unique ID
- ImplPrimitive2DIDBlock(SwVirtFlyDrawObjPrimitive, PRIMITIVE2D_ID_SWVIRTFLYDRAWOBJPRIMITIVE2D)
+ sal_uInt32 SwVirtFlyDrawObjPrimitive::getPrimitive2DID() const
+ {
+ return PRIMITIVE2D_ID_SWVIRTFLYDRAWOBJPRIMITIVE2D;
+ }
} // end of namespace drawinglayer::primitive2d
@@ -258,7 +271,7 @@ namespace sdr::contact
*
* @note ONLY based on model data
*/
- virtual drawinglayer::primitive2d::Primitive2DContainer createViewIndependentPrimitive2DSequence() const override;
+ virtual void createViewIndependentPrimitive2DSequence(drawinglayer::primitive2d::Primitive2DDecompositionVisitor& rVisitor) const override;
public:
/// basic constructor, used from SdrObject.
@@ -279,12 +292,12 @@ namespace sdr::contact
namespace sdr::contact
{
- drawinglayer::primitive2d::Primitive2DContainer VCOfSwVirtFlyDrawObj::createViewIndependentPrimitive2DSequence() const
+ void VCOfSwVirtFlyDrawObj::createViewIndependentPrimitive2DSequence(drawinglayer::primitive2d::Primitive2DDecompositionVisitor& rVisitor) const
{
- drawinglayer::primitive2d::Primitive2DContainer xRetval;
const SdrObject& rReferencedObject = GetSwVirtFlyDrawObj().GetReferencedObj();
- if(dynamic_cast<const SwFlyDrawObj*>( &rReferencedObject) != nullptr)
+ // check if it is a SwFlyDrawObj*
+ if (rReferencedObject.GetObjIdentifier() == SdrObjKind::SwFlyDrawObjIdentifier)
{
// create an own specialized primitive which is used as repaint callpoint and HitTest
// for HitTest processor (see primitive implementation above)
@@ -297,12 +310,10 @@ namespace sdr::contact
GetSwVirtFlyDrawObj(),
aOuterRange));
- xRetval = drawinglayer::primitive2d::Primitive2DContainer { xPrimitive };
+ rVisitor.visit(xPrimitive);
}
}
-
- return xRetval;
- }
+ }
} // end of namespace sdr::contact
@@ -311,7 +322,8 @@ basegfx::B2DRange SwVirtFlyDrawObj::getOuterBound() const
basegfx::B2DRange aOuterRange;
const SdrObject& rReferencedObject = GetReferencedObj();
- if(dynamic_cast<const SwFlyDrawObj*>( &rReferencedObject) != nullptr)
+ // check if it is a SwFlyDrawObj*
+ if (rReferencedObject.GetObjIdentifier() == SdrObjKind::SwFlyDrawObjIdentifier)
{
const SwFlyFrame* pFlyFrame = GetFlyFrame();
@@ -384,7 +396,7 @@ void SwVirtFlyDrawObj::Rotate(const Point& rRef, Degree100 nAngle100, double sn,
{
// RotGrfFlyFrame: Here is where the positively completed rotate interaction is executed.
// Rotation is in 1/100th degree and may be signed (!)
- Degree10 nAngle10 = toDegree10(nAngle100);
+ Degree10 nAngle10 = to<Degree10>(nAngle100);
while(nAngle10 < 0_deg10)
{
@@ -430,8 +442,7 @@ SwVirtFlyDrawObj::SwVirtFlyDrawObj(
SwVirtFlyDrawObj::~SwVirtFlyDrawObj()
{
- if ( getSdrPageFromSdrObject() ) //Withdraw SdrPage the responsibility.
- getSdrPageFromSdrObject()->RemoveObject( GetOrdNum() );
+ assert (!getSdrPageFromSdrObject() && "should have already been removed");
}
const SwFrameFormat *SwVirtFlyDrawObj::GetFormat() const
@@ -456,7 +467,7 @@ namespace
if ( pViewShell->getPrePostMapMode() == mpOutDev->GetMapMode() )
return;
- mpOutDev->Push(PushFlags::MAPMODE);
+ mpOutDev->Push(vcl::PushFlags::MAPMODE);
GDIMetaFile* pMetaFile = mpOutDev->GetConnectMetaFile();
if ( pMetaFile &&
@@ -548,16 +559,17 @@ void SwVirtFlyDrawObj::TakeObjInfo( SdrObjTransformInfoRec& rInfo ) const
void SwVirtFlyDrawObj::SetRect() const
{
+ auto* pWritableThis = const_cast<SwVirtFlyDrawObj*>(this);
if ( GetFlyFrame()->getFrameArea().HasArea() )
- const_cast<SwVirtFlyDrawObj*>(this)->m_aOutRect = GetFlyFrame()->getFrameArea().SVRect();
+ pWritableThis->setOutRectangle(GetFlyFrame()->getFrameArea().SVRect());
else
- const_cast<SwVirtFlyDrawObj*>(this)->m_aOutRect = tools::Rectangle();
+ pWritableThis->resetOutRectangle();
}
const tools::Rectangle& SwVirtFlyDrawObj::GetCurrentBoundRect() const
{
SetRect();
- return m_aOutRect;
+ return getOutRectangle();
}
const tools::Rectangle& SwVirtFlyDrawObj::GetLastBoundRect() const
@@ -578,7 +590,7 @@ void SwVirtFlyDrawObj::RecalcSnapRect()
const tools::Rectangle& SwVirtFlyDrawObj::GetSnapRect() const
{
SetRect();
- return m_aOutRect;
+ return getOutRectangle();
}
void SwVirtFlyDrawObj::SetSnapRect(const tools::Rectangle& )
@@ -599,7 +611,7 @@ void SwVirtFlyDrawObj::NbcSetSnapRect(const tools::Rectangle& )
const tools::Rectangle& SwVirtFlyDrawObj::GetLogicRect() const
{
SetRect();
- return m_aOutRect;
+ return getOutRectangle();
}
void SwVirtFlyDrawObj::SetLogicRect(const tools::Rectangle& )
@@ -638,13 +650,14 @@ void SwVirtFlyDrawObj::NbcMove(const Size& rSiz)
// working properly. Restore FrameArea and use aOutRect from old FrameArea.
TransformableSwFrame* pTransformableSwFrame(static_cast<SwFlyFreeFrame*>(GetFlyFrame())->getTransformableSwFrame());
pTransformableSwFrame->restoreFrameAreas();
- m_aOutRect = GetFlyFrame()->getFrameArea().SVRect();
+ setOutRectangle(GetFlyFrame()->getFrameArea().SVRect());
}
- m_aOutRect.Move( rSiz );
+ moveOutRectangle(rSiz.Width(), rSiz.Height());
+
const Point aOldPos( GetFlyFrame()->getFrameArea().Pos() );
- const Point aNewPos( m_aOutRect.TopLeft() );
- const SwRect aFlyRect( m_aOutRect );
+ const Point aNewPos(getOutRectangle().TopLeft());
+ const SwRect aFlyRect(getOutRectangle());
//If the Fly has an automatic align (right or top),
//so preserve the automatic.
@@ -833,7 +846,7 @@ void SwVirtFlyDrawObj::NbcCrop(const basegfx::B2DPoint& rRef, double fxFact, dou
// working properly. Restore FrameArea and use aOutRect from old FrameArea.
TransformableSwFrame* pTransformableSwFrame(static_cast<SwFlyFreeFrame*>(GetFlyFrame())->getTransformableSwFrame());
pTransformableSwFrame->restoreFrameAreas();
- m_aOutRect = GetFlyFrame()->getFrameArea().SVRect();
+ setOutRectangle(GetFlyFrame()->getFrameArea().SVRect());
}
// Compute old and new rect. This will give us the deformation to apply to
@@ -853,8 +866,8 @@ void SwVirtFlyDrawObj::NbcCrop(const basegfx::B2DPoint& rRef, double fxFact, dou
// rRef is relative to the Crop-Action, si in X/Y-Ranges of [0.0 .. 1.0],
// to get the correct absolute position, transform using the old Rect
const Point aRef(
- aOldRect.Left() + basegfx::fround(aOldRect.GetWidth() * rRef.getX()),
- aOldRect.Top() + basegfx::fround(aOldRect.GetHeight() * rRef.getY()));
+ aOldRect.Left() + basegfx::fround<tools::Long>(aOldRect.GetWidth() * rRef.getX()),
+ aOldRect.Top() + basegfx::fround<tools::Long>(aOldRect.GetHeight() * rRef.getY()));
// apply transformation, use old ResizeRect for now
tools::Rectangle aNewRect( aOldRect );
@@ -865,7 +878,7 @@ void SwVirtFlyDrawObj::NbcCrop(const basegfx::B2DPoint& rRef, double fxFact, dou
Fraction(fyFact));
// Get old values for crop in 10th of mm
- SfxItemSet aSet( pSh->GetAttrPool(), svl::Items<RES_GRFATR_CROPGRF, RES_GRFATR_CROPGRF>{} );
+ SfxItemSetFixed<RES_GRFATR_CROPGRF, RES_GRFATR_CROPGRF> aSet( pSh->GetAttrPool() );
pSh->GetCurAttr( aSet );
SwCropGrf aCrop( aSet.Get(RES_GRFATR_CROPGRF) );
@@ -895,17 +908,17 @@ void SwVirtFlyDrawObj::NbcCrop(const basegfx::B2DPoint& rRef, double fxFact, dou
// pSh->StartUndo(SwUndoId::START);
// Set new crop values in twips
- aCrop.SetLeft (convertMm100ToTwip(nLeftCrop));
- aCrop.SetTop (convertMm100ToTwip(nTopCrop));
- aCrop.SetRight (convertMm100ToTwip(nRightCrop));
- aCrop.SetBottom(convertMm100ToTwip(nBottomCrop));
+ aCrop.SetLeft (o3tl::toTwips(nLeftCrop, o3tl::Length::mm100));
+ aCrop.SetTop (o3tl::toTwips(nTopCrop, o3tl::Length::mm100));
+ aCrop.SetRight (o3tl::toTwips(nRightCrop, o3tl::Length::mm100));
+ aCrop.SetBottom(o3tl::toTwips(nBottomCrop, o3tl::Length::mm100));
pSh->SetAttrItem(aCrop);
// Set new frame size
SwFrameFormat *pFormat = GetFormat();
SwFormatFrameSize aSz( pFormat->GetFrameSize() );
- const tools::Long aNewWidth(aNewRect.GetWidth() + (m_aOutRect.GetWidth() - aOldRect.GetWidth()));
- const tools::Long aNewHeight(aNewRect.GetHeight() + (m_aOutRect.GetHeight() - aOldRect.GetHeight()));
+ const tools::Long aNewWidth(aNewRect.GetWidth() + (getOutRectangle().GetWidth() - aOldRect.GetWidth()));
+ const tools::Long aNewHeight(aNewRect.GetHeight() + (getOutRectangle().GetHeight() - aOldRect.GetHeight()));
aSz.SetWidth(aNewWidth);
aSz.SetHeight(aNewHeight);
pFormat->GetDoc()->SetAttr( aSz, *pFormat );
@@ -943,8 +956,8 @@ void SwVirtFlyDrawObj::NbcCrop(const basegfx::B2DPoint& rRef, double fxFact, dou
// Create the new TopLeft of the unrotated, cropped object by creating
// as if re-creating the unrotated geometry
aNewTopLeft = Point(
- basegfx::fround(aRotNewCenter.getX() - (0.5 * aNewRect.getWidth())),
- basegfx::fround(aRotNewCenter.getY() - (0.5 * aNewRect.getHeight())));
+ basegfx::fround<tools::Long>(aRotNewCenter.getX() - (0.5 * aNewRect.getOpenWidth())),
+ basegfx::fround<tools::Long>(aRotNewCenter.getY() - (0.5 * aNewRect.getOpenHeight())));
}
// check if we have movement and execute if yes
@@ -978,6 +991,8 @@ void SwVirtFlyDrawObj::NbcResize(const Point& rRef, const Fraction& xFact, const
GetFlyFrame()->IsFlyFreeFrame() &&
static_cast< SwFlyFreeFrame* >(GetFlyFrame())->isTransformableSwFrame());
+ tools::Rectangle aRectangle;
+
if(bIsTransformableSwFrame)
{
// When we have a change in transformed state, we need to fall back to the
@@ -1002,11 +1017,11 @@ void SwVirtFlyDrawObj::NbcResize(const Point& rRef, const Fraction& xFact, const
const basegfx::B2DVector aAbsScale(basegfx::absolute(aScale));
// create new modified, but untransformed OutRect
- m_aOutRect = tools::Rectangle(
- basegfx::fround(aCenter.getX() - (0.5 * aAbsScale.getX())),
- basegfx::fround(aCenter.getY() - (0.5 * aAbsScale.getY())),
- basegfx::fround(aCenter.getX() + (0.5 * aAbsScale.getX())),
- basegfx::fround(aCenter.getY() + (0.5 * aAbsScale.getY())));
+ setOutRectangle(tools::Rectangle(
+ basegfx::fround<tools::Long>(aCenter.getX() - (0.5 * aAbsScale.getX())),
+ basegfx::fround<tools::Long>(aCenter.getY() - (0.5 * aAbsScale.getY())),
+ basegfx::fround<tools::Long>(aCenter.getX() + (0.5 * aAbsScale.getX())),
+ basegfx::fround<tools::Long>(aCenter.getY() + (0.5 * aAbsScale.getY()))));
// restore FrameAreas so that actions below not adapted to new
// full transformations take the correct actions
@@ -1015,7 +1030,9 @@ void SwVirtFlyDrawObj::NbcResize(const Point& rRef, const Fraction& xFact, const
}
else
{
- ResizeRect( m_aOutRect, rRef, xFact, yFact );
+ aRectangle = getOutRectangle();
+ ResizeRect(aRectangle, rRef, xFact, yFact);
+ setOutRectangle(aRectangle);
}
// Position may also change, remember old one. This is now already
@@ -1023,7 +1040,8 @@ void SwVirtFlyDrawObj::NbcResize(const Point& rRef, const Fraction& xFact, const
Point aOldPos(bUseRightEdge ? GetFlyFrame()->getFrameArea().TopRight() : GetFlyFrame()->getFrameArea().Pos());
// get target size in old coordinate system
- Size aSz( m_aOutRect.Right() - m_aOutRect.Left() + 1, m_aOutRect.Bottom()- m_aOutRect.Top() + 1 );
+ aRectangle = getOutRectangle();
+ Size aSz(aRectangle.Right() - aRectangle.Left() + 1, aRectangle.Bottom() - aRectangle.Top() + 1);
// compare with restored FrameArea
if( aSz != GetFlyFrame()->getFrameArea().SSize() )
@@ -1091,7 +1109,8 @@ void SwVirtFlyDrawObj::NbcResize(const Point& rRef, const Fraction& xFact, const
}
//Position can also be changed, get new one
- const Point aNewPos(bUseRightEdge ? m_aOutRect.Right() + 1 : m_aOutRect.Left(), m_aOutRect.Top());
+ aRectangle = getOutRectangle();
+ const Point aNewPos(bUseRightEdge ? aRectangle.Right() + 1 : aRectangle.Left(), aRectangle.Top());
if ( aNewPos == aOldPos )
return;
@@ -1104,7 +1123,8 @@ void SwVirtFlyDrawObj::NbcResize(const Point& rRef, const Fraction& xFact, const
const Size aDeltaMove(
aNewPos.X() - aOldPos.X(),
aNewPos.Y() - aOldPos.Y());
- m_aOutRect.Move(-aDeltaMove.Width(), -aDeltaMove.Height());
+
+ moveOutRectangle(-aDeltaMove.Width(), -aDeltaMove.Height());
// Now, move as needed (no empty delta which was a hack anyways)
if(bIsTransformableSwFrame)
@@ -1112,7 +1132,7 @@ void SwVirtFlyDrawObj::NbcResize(const Point& rRef, const Fraction& xFact, const
// need to save aOutRect to FrameArea, will be restored to aOutRect in
// SwVirtFlyDrawObj::NbcMove currently for TransformableSwFrames
SwFrameAreaDefinition::FrameAreaWriteAccess aFrm(*GetFlyFrame());
- aFrm.setSwRect(m_aOutRect);
+ aFrm.setSwRect(SwRect(getOutRectangle()));
}
// keep old hack - not clear what happens here
@@ -1172,7 +1192,7 @@ Degree100 SwVirtFlyDrawObj::GetRotateAngle() const
if(ContainsSwGrfNode())
{
Size aSize;
- return toDegree100(getPossibleRotationFromFraphicFrame(aSize));
+ return to<Degree100>(getPossibleRotationFromFraphicFrame(aSize));
}
else
{
@@ -1180,10 +1200,10 @@ Degree100 SwVirtFlyDrawObj::GetRotateAngle() const
}
}
-SdrObjectUniquePtr SwVirtFlyDrawObj::getFullDragClone() const
+rtl::Reference<SdrObject> SwVirtFlyDrawObj::getFullDragClone() const
{
// call parent
- SdrObjectUniquePtr pRetval = SdrVirtObj::getFullDragClone();
+ rtl::Reference<SdrObject> pRetval = SdrVirtObj::getFullDragClone();
if(pRetval && GetFlyFrame() && ContainsSwGrfNode())
{
@@ -1222,21 +1242,21 @@ void SwVirtFlyDrawObj::addCropHandles(SdrHdlList& rTarget) const
basegfx::B2DPoint aPos;
aPos = aTargetTransform * basegfx::B2DPoint(0.0, 0.0);
- rTarget.AddHdl(std::make_unique<SdrCropHdl>(Point(basegfx::fround(aPos.getX()), basegfx::fround(aPos.getY())), SdrHdlKind::UpperLeft, fShearX, fRotate));
+ rTarget.AddHdl(std::make_unique<SdrCropHdl>(Point(basegfx::fround<tools::Long>(aPos.getX()), basegfx::fround<tools::Long>(aPos.getY())), SdrHdlKind::UpperLeft, fShearX, fRotate));
aPos = aTargetTransform * basegfx::B2DPoint(0.5, 0.0);
- rTarget.AddHdl(std::make_unique<SdrCropHdl>(Point(basegfx::fround(aPos.getX()), basegfx::fround(aPos.getY())), SdrHdlKind::Upper, fShearX, fRotate));
+ rTarget.AddHdl(std::make_unique<SdrCropHdl>(Point(basegfx::fround<tools::Long>(aPos.getX()), basegfx::fround<tools::Long>(aPos.getY())), SdrHdlKind::Upper, fShearX, fRotate));
aPos = aTargetTransform * basegfx::B2DPoint(1.0, 0.0);
- rTarget.AddHdl(std::make_unique<SdrCropHdl>(Point(basegfx::fround(aPos.getX()), basegfx::fround(aPos.getY())), SdrHdlKind::UpperRight, fShearX, fRotate));
+ rTarget.AddHdl(std::make_unique<SdrCropHdl>(Point(basegfx::fround<tools::Long>(aPos.getX()), basegfx::fround<tools::Long>(aPos.getY())), SdrHdlKind::UpperRight, fShearX, fRotate));
aPos = aTargetTransform * basegfx::B2DPoint(0.0, 0.5);
- rTarget.AddHdl(std::make_unique<SdrCropHdl>(Point(basegfx::fround(aPos.getX()), basegfx::fround(aPos.getY())), SdrHdlKind::Left , fShearX, fRotate));
+ rTarget.AddHdl(std::make_unique<SdrCropHdl>(Point(basegfx::fround<tools::Long>(aPos.getX()), basegfx::fround<tools::Long>(aPos.getY())), SdrHdlKind::Left , fShearX, fRotate));
aPos = aTargetTransform * basegfx::B2DPoint(1.0, 0.5);
- rTarget.AddHdl(std::make_unique<SdrCropHdl>(Point(basegfx::fround(aPos.getX()), basegfx::fround(aPos.getY())), SdrHdlKind::Right, fShearX, fRotate));
+ rTarget.AddHdl(std::make_unique<SdrCropHdl>(Point(basegfx::fround<tools::Long>(aPos.getX()), basegfx::fround<tools::Long>(aPos.getY())), SdrHdlKind::Right, fShearX, fRotate));
aPos = aTargetTransform * basegfx::B2DPoint(0.0, 1.0);
- rTarget.AddHdl(std::make_unique<SdrCropHdl>(Point(basegfx::fround(aPos.getX()), basegfx::fround(aPos.getY())), SdrHdlKind::LowerLeft, fShearX, fRotate));
+ rTarget.AddHdl(std::make_unique<SdrCropHdl>(Point(basegfx::fround<tools::Long>(aPos.getX()), basegfx::fround<tools::Long>(aPos.getY())), SdrHdlKind::LowerLeft, fShearX, fRotate));
aPos = aTargetTransform * basegfx::B2DPoint(0.5, 1.0);
- rTarget.AddHdl(std::make_unique<SdrCropHdl>(Point(basegfx::fround(aPos.getX()), basegfx::fround(aPos.getY())), SdrHdlKind::Lower, fShearX, fRotate));
+ rTarget.AddHdl(std::make_unique<SdrCropHdl>(Point(basegfx::fround<tools::Long>(aPos.getX()), basegfx::fround<tools::Long>(aPos.getY())), SdrHdlKind::Lower, fShearX, fRotate));
aPos = aTargetTransform * basegfx::B2DPoint(1.0, 1.0);
- rTarget.AddHdl(std::make_unique<SdrCropHdl>(Point(basegfx::fround(aPos.getX()), basegfx::fround(aPos.getY())), SdrHdlKind::LowerRight, fShearX, fRotate));
+ rTarget.AddHdl(std::make_unique<SdrCropHdl>(Point(basegfx::fround<tools::Long>(aPos.getX()), basegfx::fround<tools::Long>(aPos.getY())), SdrHdlKind::LowerRight, fShearX, fRotate));
}
// Macro
@@ -1267,14 +1287,14 @@ SdrObject* SwVirtFlyDrawObj::CheckMacroHit( const SdrObjMacroHitRec& rRec ) cons
else
aRect = m_pFlyFrame->getFrameArea();
- if( aRect.IsInside( rRec.aPos ) )
+ if( aRect.Contains( rRec.aPos ) )
{
aRect.Pos().setX(aRect.Pos().getX() + rRec.nTol);
aRect.Pos().setY(aRect.Pos().getY() + rRec.nTol);
aRect.AddHeight( -(2 * rRec.nTol) );
aRect.AddWidth( -(2 * rRec.nTol) );
- if( aRect.IsInside( rRec.aPos ) )
+ if( aRect.Contains( rRec.aPos ) )
{
if( !rURL.GetMap() ||
m_pFlyFrame->GetFormat()->GetIMapObject( rRec.aPos, m_pFlyFrame ))
@@ -1289,7 +1309,20 @@ SdrObject* SwVirtFlyDrawObj::CheckMacroHit( const SdrObjMacroHitRec& rRec ) cons
bool SwVirtFlyDrawObj::IsTextBox() const
{
- return SwTextBoxHelper::isTextBox(GetFormat(), RES_FLYFRMFMT);
+ return SwTextBoxHelper::isTextBox(GetFormat(), RES_FLYFRMFMT, this);
+}
+
+void SwVirtFlyDrawObj::dumpAsXml(xmlTextWriterPtr pWriter) const
+{
+ (void)xmlTextWriterStartElement(pWriter, BAD_CAST("SwVirtFlyDrawObj"));
+ (void)xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("ptr"), "%p", this);
+ (void)xmlTextWriterWriteAttribute(
+ pWriter, BAD_CAST("fly-frame"),
+ BAD_CAST(OString::number(m_pFlyFrame->GetFrameId()).getStr()));
+
+ SdrVirtObj::dumpAsXml(pWriter);
+
+ (void)xmlTextWriterEndElement(pWriter);
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */