22#include <osl/diagnose.h>
88 class VCOfSwFlyDrawObj :
public ViewContactOfSdrObj
100 : ViewContactOfSdrObj(rObj)
117 return std::make_unique<sdr::properties::DefaultProperties>(*
this);
124 return std::make_unique<sdr::contact::VCOfSwFlyDrawObj>(*
this);
140 return SdrInventor::Swg;
145 return SdrObjKind::SwFlyDrawObjIdentifier;
163 class SwVirtFlyDrawObjPrimitive :
public BufferedDecompositionPrimitive2D
171 virtual void create2DDecomposition(Primitive2DContainer& rContainer,
const geometry::ViewInformation2D& rViewInformation)
const override;
174 SwVirtFlyDrawObjPrimitive(
182 virtual bool operator==(
const BasePrimitive2D& rPrimitive)
const override;
184 virtual basegfx::B2DRange getB2DRange(
const geometry::ViewInformation2D& rViewInformation)
const override;
187 virtual void get2DDecomposition(Primitive2DDecompositionVisitor& rVisitor,
const geometry::ViewInformation2D& rViewInformation)
const override;
194 virtual sal_uInt32 getPrimitive2DID()
const override;
202 void SwVirtFlyDrawObjPrimitive::create2DDecomposition(Primitive2DContainer& rContainer,
const geometry::ViewInformation2D& )
const
204 if(getOuterRange().isEmpty())
213 rContainer.push_back(
219 bool SwVirtFlyDrawObjPrimitive::operator==(
const BasePrimitive2D& rPrimitive)
const
221 if(BufferedDecompositionPrimitive2D::operator==(rPrimitive))
223 const SwVirtFlyDrawObjPrimitive& rCompare =
static_cast<const SwVirtFlyDrawObjPrimitive&
>(rPrimitive);
225 return (&getSwVirtFlyDrawObj() == &rCompare.getSwVirtFlyDrawObj()
226 && getOuterRange() == rCompare.getOuterRange());
232 basegfx::B2DRange SwVirtFlyDrawObjPrimitive::getB2DRange(
const geometry::ViewInformation2D& )
const
234 return getOuterRange();
237 void SwVirtFlyDrawObjPrimitive::get2DDecomposition(Primitive2DDecompositionVisitor& rVisitor,
const geometry::ViewInformation2D& rViewInformation)
const
244 getSwVirtFlyDrawObj().wrap_DoPaintObject(rViewInformation);
251 sal_uInt32 SwVirtFlyDrawObjPrimitive::getPrimitive2DID()
const
267 class VCOfSwVirtFlyDrawObj :
public ViewContactOfVirtObj
279 : ViewContactOfVirtObj(rObj)
297 const SdrObject& rReferencedObject = GetSwVirtFlyDrawObj().GetReferencedObj();
300 if (rReferencedObject.
GetObjIdentifier() == SdrObjKind::SwFlyDrawObjIdentifier)
306 if(!aOuterRange.isEmpty())
309 new drawinglayer::primitive2d::SwVirtFlyDrawObjPrimitive(
310 GetSwVirtFlyDrawObj(),
313 rVisitor.
visit(xPrimitive);
326 if (rReferencedObject.
GetObjIdentifier() == SdrObjKind::SwFlyDrawObjIdentifier)
350 if(
dynamic_cast<const SwFlyDrawObj*
>( &rReferencedObject) !=
nullptr)
380 return nullptr != pGrfNd;
399 Degree10 nAngle10 = to<Degree10>(nAngle100);
401 while(nAngle10 < 0_deg10)
403 nAngle10 += 3600_deg10;
414 aMgr.
SetRotation(nOldRot, (nOldRot + nAngle10) % 3600_deg10, aSize);
428 return std::make_unique<sdr::contact::VCOfSwVirtFlyDrawObj>(*
this);
463 explicit RestoreMapMode(
SwViewShell const * pViewShell )
464 : mbMapModeRestored( false )
465 , mpOutDev( pViewShell->GetOut() )
472 GDIMetaFile* pMetaFile = mpOutDev->GetConnectMetaFile();
476 OSL_FAIL(
"MapMode restoration during meta file creation is somehow suspect - using <SetRelativeMapMode(..)>, but not sure, if correct." );
484 mbMapModeRestored =
true;
489 if ( mbMapModeRestored )
496 bool mbMapModeRestored;
515 bool bDrawObject(
true);
527 (void) rViewInformation;
538 RestoreMapMode aRestoreMapModeIfNeeded( pShell );
566 pWritableThis->resetOutRectangle();
638 aRetval.
append(::basegfx::utils::createPolygonFromRect(aSourceRange));
686 if(
GetFlyFrame()->GetAnchorFrame()->IsRightToLeft() &&
691 if(
GetFlyFrame()->GetAnchorFrame()->IsVertical() )
713 if(
GetFlyFrame()->GetAnchorFrame()->IsRightToLeft() &&
716 aFlyRect.
Width() - lXDiff;
718 const Point aTmp( lXDiff, lYDiff );
734 bool bNextLine =
false;
738 if( text::RelOrientation::CHAR == eRelHori )
747 const bool bLeftFrame =
749 bLeftPrt = aFlyRect.
Left() + aFlyRect.
Width() <
751 if ( bLeftFrame || bLeftPrt )
754 aHori.
SetRelationOrient( bLeftFrame ? text::RelOrientation::FRAME : text::RelOrientation::PRINT_AREA );
758 const bool bRightFrame = aFlyRect.
Left() >
761 aHori.
SetRelationOrient( bRightFrame ? text::RelOrientation::FRAME : text::RelOrientation::PRINT_AREA );
768 bool bRelChar = text::RelOrientation::CHAR == eRelVert;
770 GetFlyFrame()->IsFlyInContentFrame() ? text::VertOrientation::CHAR_CENTER :
771 bRelChar && bNextLine ? text::VertOrientation::CHAR_TOP : text::VertOrientation::TOP );
821 const MapMode aMapMode100thmm(MapUnit::Map100thMM);
838 const bool bIsTransformableSwFrame(
842 if(bIsTransformableSwFrame)
861 if (!nOldWidth || !nOldHeight)
892 double fScaleX = ( aGraphicSize.
Width() - aCropRectangle.
Left() - aCropRectangle.
Right() ) /
static_cast<double>(nOldWidth);
893 double fScaleY = ( aGraphicSize.
Height() - aCropRectangle.
Top() - aCropRectangle.
Bottom() ) /
static_cast<double>(nOldHeight);
895 sal_Int32 nDiffLeft = aNewRect.
Left() - aOldRect.
Left();
896 sal_Int32 nDiffTop = aNewRect.
Top() - aOldRect.
Top();
897 sal_Int32 nDiffRight = aNewRect.
Right() - aOldRect.
Right();
898 sal_Int32 nDiffBottom = aNewRect.
Bottom() - aOldRect.
Bottom();
901 sal_Int32 nLeftCrop =
static_cast<sal_Int32
>( aCropRectangle.
Left() + nDiffLeft * fScaleX );
902 sal_Int32 nTopCrop =
static_cast<sal_Int32
>( aCropRectangle.
Top() + nDiffTop * fScaleY );
903 sal_Int32 nRightCrop =
static_cast<sal_Int32
>( aCropRectangle.
Right() - nDiffRight * fScaleX );
904 sal_Int32 nBottomCrop =
static_cast<sal_Int32
>( aCropRectangle.
Bottom() - nDiffBottom * fScaleY );
931 if(bIsTransformableSwFrame)
936 double fRotate, fShearX;
946 aFormerCenter.
getX(),
947 aFormerCenter.
getY(),
964 const Size aDeltaMove(
965 aNewTopLeft.
X() - aOldTopLeft.
X(),
966 aNewTopLeft.
Y() - aOldTopLeft.
Y());
968 if(0 != aDeltaMove.
Width() || 0 != aDeltaMove.
Height())
988 const bool bVertL2RX(pTmpFrame->
IsVertLR());
989 const bool bUseRightEdge((bVertX && !bVertL2RX ) || bRTL);
990 const bool bIsTransformableSwFrame(
996 if(bIsTransformableSwFrame)
1007 aNewMat.
scale(
double(xFact),
double(yFact));
1015 double fRotate, fShearX;
1016 aNewMat.
decompose(aScale, aTranslate, fRotate, fShearX);
1060 nMin += rC.GetLeft() + rC.GetRight() +
MINFLY;
1087 nRelHeight -= 2*aBorder.
Height();
1113 const Point aNewPos(bUseRightEdge ? aRectangle.
Right() + 1 : aRectangle.
Left(), aRectangle.
Top());
1115 if ( aNewPos == aOldPos )
1123 const Size aDeltaMove(
1124 aNewPos.
X() - aOldPos.
X(),
1125 aNewPos.
Y() - aOldPos.
Y());
1130 if(bIsTransformableSwFrame)
1161 NbcCrop( rRef, fxFact, fyFact );
1177 if(
nullptr != pGrfNd)
1239 double fRotate(0.0);
1240 double fShearX(0.0);
1241 aTargetTransform.
decompose(aScale, aTranslate, fRotate, fShearX);
1267 return PointerStyle::RefHand;
1292 aRect.
Pos().setX(aRect.
Pos().getX() + rRec.
nTol);
1293 aRect.
Pos().setY(aRect.
Pos().getY() + rRec.
nTol);
1317 (void)xmlTextWriterStartElement(pWriter, BAD_CAST(
"SwVirtFlyDrawObj"));
1318 (void)xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST(
"ptr"),
"%p",
this);
1319 (void)xmlTextWriterWriteAttribute(
1320 pWriter, BAD_CAST(
"fly-frame"),
1325 (void)xmlTextWriterEndElement(pWriter);
constexpr auto convertTwipToMm100(N n)
static OutputDevice * GetDefaultDevice()
MapMode GetPrefMapMode() const
MapUnit GetMapUnit() const
SAL_WARN_UNUSED_RESULT Point PixelToLogic(const Point &rDevicePt) const
SAL_WARN_UNUSED_RESULT Point LogicToLogic(const Point &rPtSource, const MapMode *pMapModeSource, const MapMode *pMapModeDest) const
constexpr tools::Long Y() const
constexpr tools::Long X() const
virtual void Changed(const SdrObject &rObj, SdrUserCallType eType, const tools::Rectangle &rOldBoundRect)
virtual void dumpAsXml(xmlTextWriterPtr pWriter) const
const tools::Rectangle & getOutRectangle() const
void moveOutRectangle(sal_Int32 nXDelta, sal_Int32 nYDelta)
void BroadcastObjectChange() const
SdrObjUserCall * m_pUserCall
virtual void SetChanged()
virtual SdrObjKind GetObjIdentifier() const
SdrPage * getSdrPageFromSdrObject() const
virtual SdrObject * CheckMacroHit(const SdrObjMacroHitRec &rRec) const
void setOutRectangle(tools::Rectangle const &rRectangle)
const SdrObject & GetReferencedObj() const
virtual void Rotate(const Point &rRef, Degree100 nAngle, double sn, double cs) override
virtual rtl::Reference< SdrObject > getFullDragClone() const override
virtual Degree100 GetRotateAngle() const override
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
constexpr tools::Long Height() const
void setWidth(tools::Long nWidth)
constexpr tools::Long Width() const
void SetTop(sal_Int32 nVal)
void SetLeft(sal_Int32 nVal)
sal_Int32 GetRight() const
void SetBottom(sal_Int32 nVal)
void SetRight(sal_Int32 nVal)
sal_Int32 GetLeft() const
sal_Int32 GetBottom() const
bool IsPosProtected() const
bool IsSizeProtected() const
tools::Long GetHeight() const
tools::Long GetWidth() const
void SetHeight(tools::Long n)
void SetWidth(tools::Long n)
const SwFrame * GetAnchorFrame() const
SwPageFrame * GetPageFrame()
const SwFormatCol & GetCol(bool=true) const
sal_uInt16 CalcRightLine() const
sal_uInt16 CalcLeftLine() const
const SwAttrSet & GetAttrSet() const
const SwAttrSet & GetSwAttrSet() const
Does node has already its own auto-attributes? Access to SwAttrSet.
void SetAttr(const SfxPoolItem &, SwFormat &)
Set attribute in given format.1y If Undo is enabled, the old values is added to the Undo history.
IDocumentUndoRedo & GetIDocumentUndoRedo()
const SwAttrPool & GetAttrPool() const
SwDocShell * GetDocShell()
bool GetCurAttr(SfxItemSet &, const bool bMergeIndentValuesOfNumRule=false) const
void StartAllAction()
For all views of this document.
void SetAttrItem(const SfxPoolItem &, SetAttrMode nFlags=SetAttrMode::DEFAULT, const bool bParagraphSetting=false)
const GraphicObject * GetGraphicObj() const
Flys that are anchored to content (at-para, at-char) but not in content (as-char).
virtual SdrInventor GetObjInventor() const override
virtual std::unique_ptr< sdr::properties::BaseProperties > CreateObjectSpecificProperties() override
virtual rtl::Reference< SdrObject > CloneSdrObject(SdrModel &rTargetModel) const override
virtual std::unique_ptr< sdr::contact::ViewContact > CreateObjectSpecificViewContact() override
virtual SdrObjKind GetObjIdentifier() const override
SwFlyDrawObj(SdrModel &rSdrModel)
virtual ~SwFlyDrawObj() override
virtual void NbcRotate(const Point &rRef, Degree100 nAngle, double sinAngle, double cosAngle) override
void SetRotation(Degree10 nOld, Degree10 nNew, const Size &rUnrotatedSize)
general base class for all free-flowing frames
virtual const SwFlyFrameFormat * GetFormat() const override
static bool IsPaint(SdrObject *pObj, const SwViewShell *pSh)
bool IsFlyInContentFrame() const
bool IsFlyLayFrame() const
virtual Size ChgSize(const Size &aNewSize) override
virtual void PaintSwFrame(vcl::RenderContext &rRenderContext, SwRect const &, SwPrintData const *const pPrintData=nullptr) const override
void ChgRelPos(const Point &rAbsPos)
Change the relative position.
void setSwRect(const SwRect &rNew)
const SwRect & getFrameArea() const
virtual basegfx::B2DHomMatrix getFrameAreaTransformation() const
const SwRect & getFramePrintArea() const
sal_uInt32 GetFrameId() const
Base class of the Writer layout elements.
static SwCache & GetCache()
bool IsRightToLeft() const
SwLayoutFrame * GetUpper()
SwRootFrame * getRootFrame()
bool IsNoTextFrame() const
const SwFrame * Lower() const
const SwContentNode * GetNode() const
Layout frame for SwNoTextNode, i.e. graphics and OLE nodes (including charts).
Of course Writer needs its own rectangles.
void Height(tools::Long nNew)
void Pos(const Point &rNew)
void SSize(const Size &rNew)
bool Contains(const Point &rPOINT) const
void AddHeight(const tools::Long nAdd)
void AddWidth(const tools::Long nAdd)
tools::Rectangle SVRect() const
void Left(const tools::Long nLeft)
void Width(tools::Long nNew)
SwViewShell * GetCurrShell() const
const Size & GetUnrotatedSize() const
Degree10 GetValue() const
static bool isTextBox(const SwFrameFormat *pFormat, sal_uInt16 nType, const SdrObject *pObject=nullptr)
Is the frame format a text box?
bool getBrowseMode() const
vcl::RenderContext * GetOut() const
const SwViewOption * GetViewOptions() const
const MapMode & getPrePostMapMode() const
const SwRect & VisArea() const
sal_Int32 GetBrowseWidth() const
const Size & GetBrowseBorder() const
bool IsDrawingLayerPaintInProgress() const
const SfxItemPool & GetAttrPool() const
virtual void Rotate(const Point &rRef, Degree100 nAngle, double sn, double cs) override
virtual void TakeObjInfo(SdrObjTransformInfoRec &rInfo) const override
virtual void SetLogicRect(const tools::Rectangle &rRect) override
SwVirtFlyDrawObj(SdrModel &rSdrModel, SdrObject &rNew, SwFlyFrame *pFly)
Degree10 getPossibleRotationFromFraphicFrame(Size &rSize) const
virtual void Move(const Size &rSiz) override
virtual bool IsTextBox() const override
virtual ~SwVirtFlyDrawObj() override
void wrap_DoPaintObject(drawinglayer::geometry::ViewInformation2D const &) const
virtual const tools::Rectangle & GetLastBoundRect() const override
SwFlyFrame * GetFlyFrame()
virtual std::unique_ptr< sdr::contact::ViewContact > CreateObjectSpecificViewContact() override
virtual bool HasLimitedRotation() const override
basegfx::B2DRange getInnerBound() const
virtual void RecalcBoundRect() override
basegfx::B2DRange getOuterBound() const
virtual const tools::Rectangle & GetSnapRect() const override
virtual const tools::Rectangle & GetLogicRect() const override
virtual void NbcCrop(const basegfx::B2DPoint &rRef, double fxFact, double fyFact) override
const SwFrameFormat * GetFormat() const
virtual void NbcSetSnapRect(const tools::Rectangle &rRect) override
virtual void addCropHandles(SdrHdlList &rTarget) const override
virtual rtl::Reference< SdrObject > getFullDragClone() const override
virtual void Resize(const Point &rRef, const Fraction &xFact, const Fraction &yFact, bool bUnsetRelative=true) override
bool ContainsSwGrfNode() const
void dumpAsXml(xmlTextWriterPtr pWriter) const override
virtual void NbcMove(const Size &rSiz) override
virtual void NbcResize(const Point &rRef, const Fraction &xFact, const Fraction &yFact) override
virtual void Crop(const basegfx::B2DPoint &rRef, double fxFact, double fyFact) override
virtual Degree100 GetRotateAngle() const override
virtual bool HasMacro() const override
virtual void SetSnapRect(const tools::Rectangle &rRect) override
virtual const tools::Rectangle & GetCurrentBoundRect() const override
virtual ::basegfx::B2DPolyPolygon TakeXorPoly() const override
virtual void RecalcSnapRect() override
virtual void NbcSetLogicRect(const tools::Rectangle &rRect) override
virtual SdrObject * CheckMacroHit(const SdrObjMacroHitRec &rRec) const override
virtual PointerStyle GetMacroPointer(const SdrObjMacroHitRec &rRec) const override
Used by the UI to modify the document model.
bool decompose(B2DTuple &rScale, B2DTuple &rTranslate, double &rRotate, double &rShearX) const
void translate(double fX, double fY)
void scale(double fX, double fY)
void append(const B2DPolygon &rPolygon, sal_uInt32 nCount=1)
void expand(const Tuple2D< TYPE > &rTuple)
virtual void get2DDecomposition(Primitive2DDecompositionVisitor &rVisitor, const geometry::ViewInformation2D &rViewInformation) const override
virtual void visit(const Primitive2DReference &)=0
struct _xmlTextWriter * xmlTextWriterPtr
const SwVirtFlyDrawObj & mrSwVirtFlyDrawObj
const basegfx::B2DRange maOuterRange
constexpr TypedWhichId< SwFormatHoriOrient > RES_HORI_ORIENT(109)
constexpr TypedWhichId< SwFormatVertOrient > RES_VERT_ORIENT(108)
constexpr TypedWhichId< SwFlyFrameFormat > RES_FLYFRMFMT(162)
constexpr TypedWhichId< SwCropGrf > RES_GRFATR_CROPGRF(142)
B2DHomMatrix createRotateAroundPoint(double fPointX, double fPointY, double fRadiant)
B2DTuple absolute(const B2DTuple &rTup)
B2IRange fround(const B2DRange &rRange)
Primitive2DReference createHiddenGeometryPrimitives2D(const basegfx::B2DHomMatrix &rMatrix)
constexpr auto toTwips(N number, Length from)
SVXCORE_DLLPUBLIC void ResizeRect(tools::Rectangle &rRect, const Point &rRef, const Fraction &xFact, const Fraction &yFact)
#define PRIMITIVE2D_ID_SWVIRTFLYDRAWOBJPRIMITIVE2D
sal_uInt16 GetHtmlMode(const SwDocShell *pShell)
bool operator==(const XclFontData &rLeft, const XclFontData &rRight)