LibreOffice Module sw (master)  1
dflyobj.hxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
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/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
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 .
18  */
19 
20 #ifndef INCLUDED_SW_SOURCE_CORE_INC_DFLYOBJ_HXX
21 #define INCLUDED_SW_SOURCE_CORE_INC_DFLYOBJ_HXX
22 
23 #include <svx/svdovirt.hxx>
24 #include <svx/svdobj.hxx>
25 
26 namespace drawinglayer::geometry { class ViewInformation2D; }
27 
28 class SwFlyFrame;
29 class SwFrameFormat;
30 
31 // DrawObjects for Flys
32 class SwFlyDrawObj final : public SdrObject
33 {
34 private:
35  virtual std::unique_ptr<sdr::properties::BaseProperties> CreateObjectSpecificProperties() override;
37 
38  // #i95264# SwFlyDrawObj needs an own VC since createViewIndependentPrimitive2DSequence()
39  // is called when RecalcBoundRect() is used
40  virtual std::unique_ptr<sdr::contact::ViewContact> CreateObjectSpecificViewContact() override;
41 
42  // protected destructor
43  virtual ~SwFlyDrawObj() override;
44 
45 public:
46  SwFlyDrawObj(SdrModel& rSdrModel);
47 
48  // for instantiation of this class while loading (via factory)
49  virtual SdrInventor GetObjInventor() const override;
50  virtual SdrObjKind GetObjIdentifier() const override;
51  virtual bool IsTextBox() const override { return mbIsTextBox; }
52  void SetTextBox(bool bIsTextBox) { mbIsTextBox = bIsTextBox; }
53 };
54 
55 // virtual objects for Flys
56 // Flys will always be shown with virtual objects. By doing that, they can be
57 // shown multiple times if needed (header/footer).
58 // For example, if an SwFlyFrameFormat is anchored in a header, then all pages will have a separate
59 // SwVirtFlyDrawObj in their headers.
60 class SwVirtFlyDrawObj final : public SdrVirtObj
61 {
62 private:
64 
65  // RotGrfFlyFrame: Helper to access the rotation angle (in 10th degrees, left-handed)
66  // of a GraphicFrame
68 
69  // AW: Need own sdr::contact::ViewContact since AnchorPos from parent is
70  // not used but something own (top left of new SnapRect minus top left
71  // of original SnapRect)
72  virtual std::unique_ptr<sdr::contact::ViewContact> CreateObjectSpecificViewContact() override;
73 
74  // protected destructor
75  virtual ~SwVirtFlyDrawObj() override;
76 
77 public:
78  // for paints triggered form ExecutePrimitive
79  void wrap_DoPaintObject(
81 
82  // for simple access to inner and outer bounds
85 
86  // RotGrfFlyFrame: Check if this is a SwGrfNode
87  bool ContainsSwGrfNode() const;
88 
90  SdrModel& rSdrModel,
91  SdrObject& rNew,
92  SwFlyFrame* pFly);
93 
94  // override method of base class SdrVirtObj
95  virtual void TakeObjInfo( SdrObjTransformInfoRec& rInfo ) const override;
96 
97  // we treat the size calculation completely on ourself here
98  virtual const tools::Rectangle& GetCurrentBoundRect() const override;
99  virtual const tools::Rectangle& GetLastBoundRect() const override;
100  virtual Degree100 GetRotateAngle() const override;
101  virtual void RecalcBoundRect() override;
102  virtual void RecalcSnapRect() override;
103  virtual const tools::Rectangle& GetSnapRect() const override;
104  virtual void SetSnapRect(const tools::Rectangle& rRect) override;
105  virtual void NbcSetSnapRect(const tools::Rectangle& rRect) override;
106  virtual const tools::Rectangle& GetLogicRect() const override;
107  virtual void SetLogicRect(const tools::Rectangle& rRect) override;
108  virtual void NbcSetLogicRect(const tools::Rectangle& rRect) override;
109  virtual ::basegfx::B2DPolyPolygon TakeXorPoly() const override;
110  virtual void NbcMove (const Size& rSiz) override;
111  virtual void NbcResize(const Point& rRef, const Fraction& xFact,
112  const Fraction& yFact) override;
113  virtual void NbcCrop(const basegfx::B2DPoint& rRef, double fxFact, double fyFact) override;
114  virtual void Move (const Size& rSiz) override;
115  virtual void Resize(const Point& rRef, const Fraction& xFact,
116  const Fraction& yFact, bool bUnsetRelative = true) override;
117  virtual void Crop(const basegfx::B2DPoint& rRef, double fxFact, double fyFact) override;
118  virtual void addCropHandles(SdrHdlList& rTarget) const override;
119  virtual void Rotate(const Point& rRef, Degree100 nAngle, double sn, double cs) override;
120 
121  // FullDrag support
122  virtual SdrObjectUniquePtr getFullDragClone() const override;
123 
124  const SwFrameFormat *GetFormat() const;
126 
127  // methods to get pointers for the Fly
129  const SwFlyFrame* GetFlyFrame() const { return m_pFlyFrame; }
130 
131  void SetRect() const;
132 
133  // if a URL is attached to a graphic than this is a macro object
134  virtual bool HasMacro() const override;
135  virtual SdrObject* CheckMacroHit (const SdrObjMacroHitRec& rRec) const override;
136  virtual PointerStyle GetMacroPointer (const SdrObjMacroHitRec& rRec) const override;
137 
138  // RotGrfFlyFrame: If true, this SdrObject supports only limited rotation.
139  virtual bool HasLimitedRotation() const override;
140 
141  virtual bool IsTextBox() const override;
142 };
143 
144 #endif
145 
146 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void SetTextBox(bool bIsTextBox)
Definition: dflyobj.hxx:52
virtual void addCropHandles(SdrHdlList &rTarget) const override
Definition: dflyobj.cxx:1202
basegfx::B2DRange getInnerBound() const
Definition: dflyobj.cxx:336
virtual SdrObjectUniquePtr getFullDragClone() const override
Definition: dflyobj.cxx:1186
void SetRect() const
Definition: dflyobj.cxx:552
SdrInventor
virtual void Rotate(const Point &rRef, Degree100 nAngle, double sn, double cs) override
Definition: dflyobj.cxx:384
SdrObjKind
bool ContainsSwGrfNode() const
Definition: dflyobj.cxx:360
basegfx::B2DRange getOuterBound() const
Definition: dflyobj.cxx:312
virtual ~SwFlyDrawObj() override
Definition: dflyobj.cxx:132
virtual ~SwVirtFlyDrawObj() override
Definition: dflyobj.cxx:434
virtual bool HasMacro() const override
Definition: dflyobj.cxx:1253
SwVirtFlyDrawObj(SdrModel &rSdrModel, SdrObject &rNew, SwFlyFrame *pFly)
Definition: dflyobj.cxx:422
virtual PointerStyle GetMacroPointer(const SdrObjMacroHitRec &rRec) const override
Definition: dflyobj.cxx:1247
virtual void RecalcSnapRect() override
Definition: dflyobj.cxx:576
virtual void NbcResize(const Point &rRef, const Fraction &xFact, const Fraction &yFact) override
Definition: dflyobj.cxx:967
Style of a layout element.
Definition: frmfmt.hxx:58
void wrap_DoPaintObject(drawinglayer::geometry::ViewInformation2D const &) const
Definition: dflyobj.cxx:494
virtual SdrObjKind GetObjIdentifier() const override
Definition: dflyobj.cxx:142
virtual std::unique_ptr< sdr::properties::BaseProperties > CreateObjectSpecificProperties() override
Definition: dflyobj.cxx:113
virtual SdrInventor GetObjInventor() const override
Definition: dflyobj.cxx:137
virtual void NbcSetLogicRect(const tools::Rectangle &rRect) override
Definition: dflyobj.cxx:618
virtual void TakeObjInfo(SdrObjTransformInfoRec &rInfo) const override
Definition: dflyobj.cxx:536
virtual void Resize(const Point &rRef, const Fraction &xFact, const Fraction &yFact, bool bUnsetRelative=true) override
Definition: dflyobj.cxx:1134
virtual SdrObject * CheckMacroHit(const SdrObjMacroHitRec &rRec) const override
Definition: dflyobj.cxx:1259
bool mbIsTextBox
Definition: dflyobj.hxx:36
virtual void NbcCrop(const basegfx::B2DPoint &rRef, double fxFact, double fyFact) override
Definition: dflyobj.cxx:793
virtual bool IsTextBox() const override
Definition: dflyobj.hxx:51
virtual void Move(const Size &rSiz) override
Definition: dflyobj.cxx:1127
SwFlyFrame * m_pFlyFrame
Definition: dflyobj.hxx:63
virtual const tools::Rectangle & GetLogicRect() const override
Definition: dflyobj.cxx:602
SwFlyFrame * GetFlyFrame()
Definition: dflyobj.hxx:128
general base class for all free-flowing frames
Definition: flyfrm.hxx:78
virtual const tools::Rectangle & GetLastBoundRect() const override
Definition: dflyobj.cxx:566
virtual void SetLogicRect(const tools::Rectangle &rRect) override
Definition: dflyobj.cxx:608
virtual void Crop(const basegfx::B2DPoint &rRef, double fxFact, double fyFact) override
Definition: dflyobj.cxx:1142
virtual void NbcSetSnapRect(const tools::Rectangle &rRect) override
Definition: dflyobj.cxx:597
std::unique_ptr< SdrObject, SdrObjectFreeOp > SdrObjectUniquePtr
virtual std::unique_ptr< sdr::contact::ViewContact > CreateObjectSpecificViewContact() override
Definition: dflyobj.cxx:415
PointerStyle
virtual ::basegfx::B2DPolyPolygon TakeXorPoly() const override
Definition: dflyobj.cxx:623
virtual Degree100 GetRotateAngle() const override
Definition: dflyobj.cxx:1173
SwFlyDrawObj(SdrModel &rSdrModel)
Definition: dflyobj.cxx:126
virtual const tools::Rectangle & GetSnapRect() const override
Definition: dflyobj.cxx:581
virtual void RecalcBoundRect() override
Definition: dflyobj.cxx:571
virtual std::unique_ptr< sdr::contact::ViewContact > CreateObjectSpecificViewContact() override
Definition: dflyobj.cxx:119
const SwFlyFrame * GetFlyFrame() const
Definition: dflyobj.hxx:129
virtual bool HasLimitedRotation() const override
Definition: dflyobj.cxx:377
virtual void NbcMove(const Size &rSiz) override
Definition: dflyobj.cxx:635
virtual void SetSnapRect(const tools::Rectangle &rRect) override
Definition: dflyobj.cxx:587
virtual bool IsTextBox() const override
Definition: dflyobj.cxx:1293
const SwFrameFormat * GetFormat() const
Definition: dflyobj.cxx:440
Degree10 getPossibleRotationFromFraphicFrame(Size &rSize) const
Definition: dflyobj.cxx:1150
virtual const tools::Rectangle & GetCurrentBoundRect() const override
Definition: dflyobj.cxx:560