86 class VCOfSwFlyDrawObj :
public ViewContactOfSdrObj
98 : ViewContactOfSdrObj(rObj)
116 return std::make_unique<sdr::properties::DefaultProperties>(*this);
123 return std::make_unique<sdr::contact::VCOfSwFlyDrawObj>(*this);
139 return SdrInventor::Swg;
152 class SwVirtFlyDrawObjPrimitive :
public BufferedDecompositionPrimitive2D
160 virtual void create2DDecomposition(Primitive2DContainer& rContainer,
const geometry::ViewInformation2D& rViewInformation)
const override;
163 SwVirtFlyDrawObjPrimitive(
166 : BufferedDecompositionPrimitive2D(),
167 mrSwVirtFlyDrawObj(rSwVirtFlyDrawObj),
168 maOuterRange(rOuterRange)
172 virtual bool operator==(
const BasePrimitive2D& rPrimitive)
const override;
174 virtual basegfx::B2DRange getB2DRange(
const geometry::ViewInformation2D& rViewInformation)
const override;
177 virtual void get2DDecomposition(Primitive2DDecompositionVisitor& rVisitor,
const geometry::ViewInformation2D& rViewInformation)
const override;
184 virtual sal_uInt32 getPrimitive2DID()
const override;
192 void SwVirtFlyDrawObjPrimitive::create2DDecomposition(Primitive2DContainer& rContainer,
const geometry::ViewInformation2D& )
const
194 if(getOuterRange().isEmpty())
203 rContainer.push_back(
209 bool SwVirtFlyDrawObjPrimitive::operator==(
const BasePrimitive2D& rPrimitive)
const
211 if(BufferedDecompositionPrimitive2D::operator==(rPrimitive))
213 const SwVirtFlyDrawObjPrimitive& rCompare =
static_cast<const SwVirtFlyDrawObjPrimitive&
>(rPrimitive);
215 return (&getSwVirtFlyDrawObj() == &rCompare.getSwVirtFlyDrawObj()
216 && getOuterRange() == rCompare.getOuterRange());
222 basegfx::B2DRange SwVirtFlyDrawObjPrimitive::getB2DRange(
const geometry::ViewInformation2D& )
const
224 return getOuterRange();
227 void SwVirtFlyDrawObjPrimitive::get2DDecomposition(Primitive2DDecompositionVisitor& rVisitor,
const geometry::ViewInformation2D& rViewInformation)
const
234 getSwVirtFlyDrawObj().wrap_DoPaintObject(rViewInformation);
254 class VCOfSwVirtFlyDrawObj :
public ViewContactOfVirtObj
266 : ViewContactOfVirtObj(rObj)
285 const SdrObject& rReferencedObject = GetSwVirtFlyDrawObj().GetReferencedObj();
287 if(dynamic_cast<const SwFlyDrawObj*>( &rReferencedObject) !=
nullptr)
293 if(!aOuterRange.isEmpty())
296 new drawinglayer::primitive2d::SwVirtFlyDrawObjPrimitive(
297 GetSwVirtFlyDrawObj(),
314 if(dynamic_cast<const SwFlyDrawObj*>( &rReferencedObject) !=
nullptr)
322 if(!aOuterRectangle.IsEmpty())
338 if(dynamic_cast<const SwFlyDrawObj*>( &rReferencedObject) !=
nullptr)
346 if(!aInnerRectangle.IsEmpty())
364 const SwNoTextFrame *
const pNTF(static_cast<const SwNoTextFrame*>(pFlyFrame->
Lower()));
368 return nullptr != pGrfNd;
389 while(nAngle10 < 0_deg10)
391 nAngle10 += 3600_deg10;
402 aMgr.
SetRotation(nOldRot, (nOldRot + nAngle10) % 3600_deg10, aSize);
416 return std::make_unique<sdr::contact::VCOfSwVirtFlyDrawObj>(*this);
452 explicit RestoreMapMode(
SwViewShell const * pViewShell )
453 : mbMapModeRestored( false )
454 , mpOutDev( pViewShell->GetOut() )
459 mpOutDev->Push(PushFlags::MAPMODE);
461 GDIMetaFile* pMetaFile = mpOutDev->GetConnectMetaFile();
465 OSL_FAIL(
"MapMode restoration during meta file creation is somehow suspect - using <SetRelativeMapMode(..)>, but not sure, if correct." );
473 mbMapModeRestored =
true;
478 if ( mbMapModeRestored )
485 bool mbMapModeRestored;
504 bool bDrawObject(
true);
516 (
void) rViewInformation;
527 RestoreMapMode aRestoreMapModeIfNeeded( pShell );
634 if(
GetFlyFrame()->IsFlyFreeFrame() && static_cast< SwFlyFreeFrame* >(
GetFlyFrame())->isTransformableSwFrame())
678 if(
GetFlyFrame()->GetAnchorFrame()->IsVertical() )
700 if(
GetFlyFrame()->GetAnchorFrame()->IsRightToLeft() &&
703 aFlyRect.Width() - lXDiff;
705 const Point aTmp( lXDiff, lYDiff );
721 bool bNextLine =
false;
723 if( !
GetFlyFrame()->IsAutoPos() || text::RelOrientation::PAGE_FRAME != aHori.GetRelationOrient() )
725 if( text::RelOrientation::CHAR == eRelHori )
727 aHori.SetHoriOrient( text::HoriOrientation::LEFT );
728 aHori.SetRelationOrient( text::RelOrientation::CHAR );
734 const bool bLeftFrame =
736 bLeftPrt = aFlyRect.Left() + aFlyRect.Width() <
738 if ( bLeftFrame || bLeftPrt )
740 aHori.SetHoriOrient( text::HoriOrientation::LEFT );
741 aHori.SetRelationOrient( bLeftFrame ? text::RelOrientation::FRAME : text::RelOrientation::PRINT_AREA );
745 const bool bRightFrame = aFlyRect.Left() >
747 aHori.SetHoriOrient( text::HoriOrientation::RIGHT );
748 aHori.SetRelationOrient( bRightFrame ? text::RelOrientation::FRAME : text::RelOrientation::PRINT_AREA );
755 bool bRelChar = text::RelOrientation::CHAR == eRelVert;
757 GetFlyFrame()->IsFlyInContentFrame() ? text::VertOrientation::CHAR_CENTER :
758 bRelChar && bNextLine ? text::VertOrientation::CHAR_TOP : text::VertOrientation::TOP );
760 aVert.SetRelationOrient( text::RelOrientation::CHAR );
762 aVert.SetRelationOrient( text::RelOrientation::PRINT_AREA );
772 aHori.SetHoriOrient( eHori );
773 aHori.SetRelationOrient( eRelHori );
779 aVert.SetVertOrient( eVert );
780 aVert.SetRelationOrient( eRelVert );
808 const MapMode aMapMode100thmm(MapUnit::Map100thMM);
820 if( aGraphicSize.IsEmpty() )
825 const bool bIsTransformableSwFrame(
827 static_cast< SwFlyFreeFrame* >(
GetFlyFrame())->isTransformableSwFrame());
829 if(bIsTransformableSwFrame)
848 if (!nOldWidth || !nOldHeight)
879 double fScaleX = ( aGraphicSize.Width() - aCropRectangle.Left() - aCropRectangle.Right() ) / static_cast<double>(nOldWidth);
880 double fScaleY = ( aGraphicSize.Height() - aCropRectangle.Top() - aCropRectangle.Bottom() ) / static_cast<double>(nOldHeight);
882 sal_Int32 nDiffLeft = aNewRect.
Left() - aOldRect.
Left();
883 sal_Int32 nDiffTop = aNewRect.
Top() - aOldRect.
Top();
884 sal_Int32 nDiffRight = aNewRect.
Right() - aOldRect.
Right();
885 sal_Int32 nDiffBottom = aNewRect.
Bottom() - aOldRect.
Bottom();
888 sal_Int32 nLeftCrop =
static_cast<sal_Int32
>( aCropRectangle.Left() + nDiffLeft * fScaleX );
889 sal_Int32 nTopCrop =
static_cast<sal_Int32
>( aCropRectangle.Top() + nDiffTop * fScaleY );
890 sal_Int32 nRightCrop =
static_cast<sal_Int32
>( aCropRectangle.Right() - nDiffRight * fScaleX );
891 sal_Int32 nBottomCrop =
static_cast<sal_Int32
>( aCropRectangle.Bottom() - nDiffBottom * fScaleY );
909 aSz.SetWidth(aNewWidth);
910 aSz.SetHeight(aNewHeight);
918 if(bIsTransformableSwFrame)
923 double fRotate, fShearX;
933 aFormerCenter.
getX(),
934 aFormerCenter.
getY(),
951 const Size aDeltaMove(
952 aNewTopLeft.X() - aOldTopLeft.X(),
953 aNewTopLeft.Y() - aOldTopLeft.Y());
955 if(0 != aDeltaMove.Width() || 0 != aDeltaMove.Height())
975 const bool bVertL2RX(pTmpFrame->
IsVertLR());
976 const bool bUseRightEdge((bVertX && !bVertL2RX ) || bRTL);
977 const bool bIsTransformableSwFrame(
979 static_cast< SwFlyFreeFrame* >(
GetFlyFrame())->isTransformableSwFrame());
981 if(bIsTransformableSwFrame)
991 aNewMat.
translate(-aRef.getX(), -aRef.getY());
992 aNewMat.
scale(
double(xFact),
double(yFact));
993 aNewMat.
translate(aRef.getX(), aRef.getY());
1000 double fRotate, fShearX;
1001 aNewMat.
decompose(aScale, aTranslate, fRotate, fShearX);
1014 pTransformableSwFrame->restoreFrameAreas();
1042 nMin += rC.GetLeft() + rC.GetRight() +
MINFLY;
1046 aSz.setWidth( std::max( aSz.Width(), nMin ) );
1054 if ( aFrameSz.GetWidthPercent() || aFrameSz.GetHeightPercent() )
1069 nRelHeight -= 2*aBorder.
Height();
1078 aOldFrameSz.GetWidth() != aFrameSz.GetWidth() )
1080 aFrameSz.SetWidthPercent(
sal_uInt8(aSz.Width() * 100.0 / nRelWidth + 0.5) );
1084 aOldFrameSz.GetHeight() != aFrameSz.GetHeight() )
1086 aFrameSz.SetHeightPercent(
sal_uInt8(aSz.Height() * 100.0 / nRelHeight + 0.5) );
1096 if ( aNewPos == aOldPos )
1104 const Size aDeltaMove(
1105 aNewPos.X() - aOldPos.X(),
1106 aNewPos.Y() - aOldPos.Y());
1110 if(bIsTransformableSwFrame)
1141 NbcCrop( rRef, fxFact, fyFact );
1157 if(
nullptr != pGrfNd)
1219 double fRotate(0.0);
1220 double fShearX(0.0);
1221 aTargetTransform.
decompose(aScale, aTranslate, fRotate, fShearX);
1226 aPos = aTargetTransform * basegfx::B2DPoint(0.5, 0.0);
1228 aPos = aTargetTransform * basegfx::B2DPoint(1.0, 0.0);
1230 aPos = aTargetTransform * basegfx::B2DPoint(0.0, 0.5);
1232 aPos = aTargetTransform * basegfx::B2DPoint(1.0, 0.5);
1234 aPos = aTargetTransform * basegfx::B2DPoint(0.0, 1.0);
1236 aPos = aTargetTransform * basegfx::B2DPoint(0.5, 1.0);
1238 aPos = aTargetTransform * basegfx::B2DPoint(1.0, 1.0);
1247 return PointerStyle::RefHand;
1272 aRect.
Pos().setX(aRect.
Pos().getX() + rRec.
nTol);
1273 aRect.
Pos().setY(aRect.
Pos().getY() + rRec.
nTol);
1281 return const_cast<SwVirtFlyDrawObj*>(
this);
vcl::RenderContext * GetOut() const
Base class of the Writer layout elements.
void expand(const B2DTuple &rTuple)
bool IsFlyLayFrame() const
virtual const SwFlyFrameFormat * GetFormat() const override
virtual void addCropHandles(SdrHdlList &rTarget) const override
B2DTuple absolute(const B2DTuple &rTup)
SwDocShell * GetDocShell()
Point LogicToLogic(const Point &rPtSource, const MapMode *pMapModeSource, const MapMode *pMapModeDest) const
virtual void get2DDecomposition(Primitive2DDecompositionVisitor &rVisitor, const geometry::ViewInformation2D &rViewInformation) const override
basegfx::B2DRange getInnerBound() const
void Left(const tools::Long nLeft)
void setSwRect(const SwRect &rNew)
virtual SdrObjectUniquePtr getFullDragClone() const override
const SwRect & getFramePrintArea() const
static SwCache & GetCache()
void Pos(const Point &rNew)
tools::Rectangle m_aOutRect
IDocumentUndoRedo & GetIDocumentUndoRedo()
const Size & GetUnrotatedSize() const
Of course Writer needs its own rectangles.
bool IsSizeProtected() const
virtual void PaintSwFrame(vcl::RenderContext &rRenderContext, SwRect const &, SwPrintData const *const pPrintData=nullptr) const override
virtual basegfx::B2DHomMatrix getFrameAreaTransformation() const
virtual void Rotate(const Point &rRef, Degree100 nAngle, double sn, double cs) override
sal_Int32 GetBrowseWidth() const
constexpr TypedWhichId< SwFlyFrameFormat > RES_FLYFRMFMT(156)
bool ContainsSwGrfNode() const
constexpr auto convertTwipToMm100(N n)
const MapMode & getPrePostMapMode() const
static OutputDevice * GetDefaultDevice()
virtual SdrObject * CheckMacroHit(const SdrObjMacroHitRec &rRec) const
Used by the UI to modify the document model.
virtual void Rotate(const Point &rRef, Degree100 nAngle, double sn, double cs) override
Degree100 toDegree100(Degree10 x)
constexpr TypedWhichId< SwFormatVertOrient > RES_VERT_ORIENT(102)
sal_uInt16 CalcLeftLine() const
constexpr TypedWhichId< SwFormatHoriOrient > RES_HORI_ORIENT(103)
SdrPage * getSdrPageFromSdrObject() const
const SwRect & getFrameArea() const
const BorderLinePrimitive2D *pCandidateB assert(pCandidateA)
bool getBrowseMode() const
#define PRIMITIVE2D_ID_SWVIRTFLYDRAWOBJPRIMITIVE2D
void SetAttr(const SfxPoolItem &, SwFormat &)
Set attribute in given format.1y If Undo is enabled, the old values is added to the Undo history...
Degree10 toDegree10(Degree100 x)
basegfx::B2DRange getOuterBound() const
static bool isTextBox(const SwFrameFormat *pFormat, sal_uInt16 nType)
Is the frame format a text box?
virtual ~SwFlyDrawObj() override
void Width(tools::Long nNew)
const SdrObject & GetReferencedObj() const
virtual ~SwVirtFlyDrawObj() override
bool IsFlyInContentFrame() const
virtual bool HasMacro() const override
B2IRange fround(const B2DRange &rRange)
virtual void Changed(const SdrObject &rObj, SdrUserCallType eType, const tools::Rectangle &rOldBoundRect)
const SwVirtFlyDrawObj & mrSwVirtFlyDrawObj
MapMode GetPrefMapMode() const
SwVirtFlyDrawObj(SdrModel &rSdrModel, SdrObject &rNew, SwFlyFrame *pFly)
bool IsColumnFrame() const
virtual PointerStyle GetMacroPointer(const SdrObjMacroHitRec &rRec) const override
virtual void RecalcSnapRect() override
const SfxItemPool & GetAttrPool() const
void ResizeRect(tools::Rectangle &rRect, const Point &rRef, const Fraction &rxFact, const Fraction &ryFact)
virtual void NbcResize(const Point &rRef, const Fraction &xFact, const Fraction &yFact) override
void wrap_DoPaintObject(drawinglayer::geometry::ViewInformation2D const &) const
const SwFormatCol & GetCol(bool=true) const
virtual SdrObjKind GetObjIdentifier() const override
virtual std::unique_ptr< sdr::properties::BaseProperties > CreateObjectSpecificProperties() override
const SwRect & VisArea() const
virtual SdrInventor GetObjInventor() const override
virtual void NbcSetLogicRect(const tools::Rectangle &rRect) override
bool decompose(B2DTuple &rScale, B2DTuple &rTranslate, double &rRotate, double &rShearX) const
SwPageFrame * FindPageFrame()
constexpr TypedWhichId< SwCropGrf > RES_GRFATR_CROPGRF(134)
const SwFrame * Lower() const
void SetAttrItem(const SfxPoolItem &, SetAttrMode nFlags=SetAttrMode::DEFAULT, const bool bParagraphSetting=false)
void BroadcastObjectChange() const
B2DPolygon createPolygonFromRect(const B2DRectangle &rRect, double fRadiusX, double fRadiusY)
sal_uInt16 GetHtmlMode(const SwDocShell *pShell)
virtual void TakeObjInfo(SdrObjTransformInfoRec &rInfo) const override
const GraphicObject * GetGraphicObj() const
virtual void Resize(const Point &rRef, const Fraction &xFact, const Fraction &yFact, bool bUnsetRelative=true) override
SwLayoutFrame * GetUpper()
void AddHeight(const tools::Long nAdd)
virtual SdrObject * CheckMacroHit(const SdrObjMacroHitRec &rRec) const override
void scale(double fX, double fY)
SdrObjUserCall * m_pUserCall
sal_uInt32 GetOrdNum() const
constexpr auto convertMm100ToTwip(N n)
const SwAttrSet & GetAttrSet() const
void AddWidth(const tools::Long nAdd)
MapUnit GetMapUnit() const
virtual void NbcCrop(const basegfx::B2DPoint &rRef, double fxFact, double fyFact) override
const SwRotationGrf & GetRotationGrf(bool=true) const
void SSize(const Size &rNew)
virtual SdrObject * RemoveObject(size_t nObjNum)
virtual void Move(const Size &rSiz) override
Degree10 GetValue() const
Point PixelToLogic(const Point &rDevicePt) const
virtual void DoDrawUndo(bool const bDoUndo)=0
Enable/Disable Undo for Drawing objects.
void append(const B2DPolygon &rPolygon, sal_uInt32 nCount=1)
virtual const tools::Rectangle & GetLogicRect() const override
ImplPrimitive2DIDBlock(OverlayStaticRectanglePrimitive, PRIMITIVE2D_ID_OVERLAYRECTANGLEPRIMITIVE) OverlayBitmapExPrimitive
css::uno::Reference< css::graphic::XPrimitive2D > Primitive2DReference
const SwContentNode * GetNode() const
SwFlyFrame * GetFlyFrame()
virtual Degree100 GetRotateAngle() const override
tools::Rectangle SVRect() const
general base class for all free-flowing frames
constexpr tools::Long Height() const
SwPageFrame * GetPageFrame()
const SwViewOption * GetViewOptions() const
virtual const tools::Rectangle & GetLastBoundRect() const override
virtual void SetLogicRect(const tools::Rectangle &rRect) override
B2DHomMatrix createRotateAroundPoint(double fPointX, double fPointY, double fRadiant)
virtual Size ChgSize(const Size &aNewSize) override
bool IsInside(const Point &rPOINT) const
bool IsNoTextFrame() const
Primitive2DReference createHiddenGeometryPrimitives2D(const basegfx::B2DHomMatrix &rMatrix)
bool IsRightToLeft() const
virtual void Crop(const basegfx::B2DPoint &rRef, double fxFact, double fyFact) override
virtual void NbcSetSnapRect(const tools::Rectangle &rRect) override
const Size & GetBrowseBorder() const
std::unique_ptr< SdrObject, SdrObjectFreeOp > SdrObjectUniquePtr
virtual std::unique_ptr< sdr::contact::ViewContact > CreateObjectSpecificViewContact() override
void translate(double fX, double fY)
static bool IsPaint(SdrObject *pObj, const SwViewShell *pSh)
virtual ::basegfx::B2DPolyPolygon TakeXorPoly() const override
bool GetCurAttr(SfxItemSet &, const bool bMergeIndentValuesOfNumRule=false) const
const SwAttrSet & GetSwAttrSet() const
Does node has already its own auto-attributes? Access to SwAttrSet.
virtual Degree100 GetRotateAngle() const override
SwFlyDrawObj(SdrModel &rSdrModel)
virtual const tools::Rectangle & GetSnapRect() const override
const basegfx::B2DRange maOuterRange
virtual void RecalcBoundRect() override
virtual std::unique_ptr< sdr::contact::ViewContact > CreateObjectSpecificViewContact() override
const SwFrame * GetAnchorFrame() const
virtual SdrObjectUniquePtr getFullDragClone() const override
virtual bool HasLimitedRotation() const override
virtual void SetChanged()
void StartAllAction()
For all views of this document.
SwViewShell * GetCurrShell() const
void ChgRelPos(const Point &rAbsPos)
Change the relative position.
void Height(tools::Long nNew)
bool operator==(const ScCsvLayoutData &rData1, const ScCsvLayoutData &rData2)
bool IsDrawingLayerPaintInProgress() const
virtual void NbcMove(const Size &rSiz) override
virtual void SetSnapRect(const tools::Rectangle &rRect) override
SwRootFrame * getRootFrame()
void SetRotation(Degree10 nOld, Degree10 nNew, const Size &rUnrotatedSize)
virtual bool IsTextBox() const override
const SwFrameFormat * GetFormat() const
void AddHdl(std::unique_ptr< SdrHdl > pHdl)
const SwAttrPool & GetAttrPool() const
bool IsPosProtected() const
sal_uInt16 CalcRightLine() const
Degree10 getPossibleRotationFromFraphicFrame(Size &rSize) const
virtual const tools::Rectangle & GetCurrentBoundRect() const override