Version 7.6.3.2-android, tag libreoffice-7.6.3.2-android
[LibreOffice.git] / sw / source / core / inc / dflyobj.hxx
blobfe43f24c904514f7ddf718d10e370f9aee611205
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef INCLUDED_SW_SOURCE_CORE_INC_DFLYOBJ_HXX
21 #define INCLUDED_SW_SOURCE_CORE_INC_DFLYOBJ_HXX
23 #include <svx/svdovirt.hxx>
24 #include <svx/svdobj.hxx>
26 #include <swdllapi.h>
28 namespace drawinglayer::geometry { class ViewInformation2D; }
30 class SwFlyFrame;
31 class SwFrameFormat;
33 // DrawObjects for Flys
34 class SwFlyDrawObj final : public SdrObject
36 private:
37 virtual std::unique_ptr<sdr::properties::BaseProperties> CreateObjectSpecificProperties() override;
38 bool mbIsTextBox;
40 // #i95264# SwFlyDrawObj needs an own VC since createViewIndependentPrimitive2DSequence()
41 // is called when RecalcBoundRect() is used
42 virtual std::unique_ptr<sdr::contact::ViewContact> CreateObjectSpecificViewContact() override;
44 // protected destructor
45 virtual ~SwFlyDrawObj() override;
47 public:
48 SwFlyDrawObj(SdrModel& rSdrModel);
49 SwFlyDrawObj(SdrModel& rSdrModel, SwFlyDrawObj const& rSource);
51 // for instantiation of this class while loading (via factory
52 virtual rtl::Reference<SdrObject> CloneSdrObject(SdrModel& rTargetModel) const override;
54 virtual SdrInventor GetObjInventor() const override;
55 virtual SdrObjKind GetObjIdentifier() const override;
56 virtual bool IsTextBox() const override { return mbIsTextBox; }
57 void SetTextBox(bool bIsTextBox) { mbIsTextBox = bIsTextBox; }
59 virtual void NbcRotate(const Point& rRef, Degree100 nAngle, double sinAngle, double cosAngle) override;
62 // virtual objects for Flys
63 // Flys will always be shown with virtual objects. By doing that, they can be
64 // shown multiple times if needed (header/footer).
65 // For example, if an SwFlyFrameFormat is anchored in a header, then all pages will have a separate
66 // SwVirtFlyDrawObj in their headers.
67 class SW_DLLPUBLIC SwVirtFlyDrawObj final : public SdrVirtObj
69 private:
70 SwFlyFrame *m_pFlyFrame;
72 // RotGrfFlyFrame: Helper to access the rotation angle (in 10th degrees, left-handed)
73 // of a GraphicFrame
74 Degree10 getPossibleRotationFromFraphicFrame(Size& rSize) const;
76 // AW: Need own sdr::contact::ViewContact since AnchorPos from parent is
77 // not used but something own (top left of new SnapRect minus top left
78 // of original SnapRect)
79 virtual std::unique_ptr<sdr::contact::ViewContact> CreateObjectSpecificViewContact() override;
81 // protected destructor
82 virtual ~SwVirtFlyDrawObj() override;
84 public:
85 // for paints triggered form ExecutePrimitive
86 void wrap_DoPaintObject(
87 drawinglayer::geometry::ViewInformation2D const&) const;
89 // for simple access to inner and outer bounds
90 basegfx::B2DRange getOuterBound() const;
91 basegfx::B2DRange getInnerBound() const;
93 // RotGrfFlyFrame: Check if this is a SwGrfNode
94 bool ContainsSwGrfNode() const;
96 SwVirtFlyDrawObj(
97 SdrModel& rSdrModel,
98 SdrObject& rNew,
99 SwFlyFrame* pFly);
101 // override method of base class SdrVirtObj
102 virtual void TakeObjInfo( SdrObjTransformInfoRec& rInfo ) const override;
104 // we treat the size calculation completely on ourself here
105 virtual const tools::Rectangle& GetCurrentBoundRect() const override;
106 virtual const tools::Rectangle& GetLastBoundRect() const override;
107 virtual Degree100 GetRotateAngle() const override;
108 virtual void RecalcBoundRect() override;
109 virtual void RecalcSnapRect() override;
110 virtual const tools::Rectangle& GetSnapRect() const override;
111 virtual void SetSnapRect(const tools::Rectangle& rRect) override;
112 virtual void NbcSetSnapRect(const tools::Rectangle& rRect) override;
113 virtual const tools::Rectangle& GetLogicRect() const override;
114 virtual void SetLogicRect(const tools::Rectangle& rRect) override;
115 virtual void NbcSetLogicRect(const tools::Rectangle& rRect) override;
116 virtual ::basegfx::B2DPolyPolygon TakeXorPoly() const override;
117 virtual void NbcMove (const Size& rSiz) override;
118 virtual void NbcResize(const Point& rRef, const Fraction& xFact,
119 const Fraction& yFact) override;
120 virtual void NbcCrop(const basegfx::B2DPoint& rRef, double fxFact, double fyFact) override;
121 virtual void Move (const Size& rSiz) override;
122 virtual void Resize(const Point& rRef, const Fraction& xFact,
123 const Fraction& yFact, bool bUnsetRelative = true) override;
124 virtual void Crop(const basegfx::B2DPoint& rRef, double fxFact, double fyFact) override;
125 virtual void addCropHandles(SdrHdlList& rTarget) const override;
126 virtual void Rotate(const Point& rRef, Degree100 nAngle, double sn, double cs) override;
129 // FullDrag support
130 virtual rtl::Reference<SdrObject> getFullDragClone() const override;
132 const SwFrameFormat *GetFormat() const;
133 SwFrameFormat *GetFormat();
135 // methods to get pointers for the Fly
136 SwFlyFrame* GetFlyFrame() { return m_pFlyFrame; }
137 const SwFlyFrame* GetFlyFrame() const { return m_pFlyFrame; }
139 void SetRect() const;
141 // if a URL is attached to a graphic than this is a macro object
142 virtual bool HasMacro() const override;
143 virtual SdrObject* CheckMacroHit (const SdrObjMacroHitRec& rRec) const override;
144 virtual PointerStyle GetMacroPointer (const SdrObjMacroHitRec& rRec) const override;
146 // RotGrfFlyFrame: If true, this SdrObject supports only limited rotation.
147 virtual bool HasLimitedRotation() const override;
149 virtual bool IsTextBox() const override;
150 void dumpAsXml(xmlTextWriterPtr pWriter) const override;
153 #endif
155 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */