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 const sal_uInt16 SwFlyDrawObjIdentifier = 0x0001;
32 
33 // DrawObjects for Flys
34 class SwFlyDrawObj : public SdrObject
35 {
36 private:
37  virtual std::unique_ptr<sdr::properties::BaseProperties> CreateObjectSpecificProperties() override;
39 
40 protected:
41  // #i95264# SwFlyDrawObj needs an own VC since createViewIndependentPrimitive2DSequence()
42  // is called when RecalcBoundRect() is used
43  virtual std::unique_ptr<sdr::contact::ViewContact> CreateObjectSpecificViewContact() override;
44 
45  // protected destructor
46  virtual ~SwFlyDrawObj() override;
47 
48 public:
49  SwFlyDrawObj(SdrModel& rSdrModel);
50 
51  // for instantiation of this class while loading (via factory)
52  virtual SdrInventor GetObjInventor() const override;
53  virtual sal_uInt16 GetObjIdentifier() const override;
54  virtual bool IsTextBox() const override { return mbIsTextBox; }
55  void SetTextBox(bool bIsTextBox) { mbIsTextBox = bIsTextBox; }
56 };
57 
58 // virtual objects for Flys
59 // Flys will always be shown with virtual objects. By doing that, they can be
60 // shown multiple times if needed (header/footer).
62 {
63 private:
65 
66  // RotGrfFlyFrame: Helper to access the rotation angle (in 10th degrees, left-handed)
67  // of a GraphicFrame
68  sal_uInt16 getPossibleRotationFromFraphicFrame(Size& rSize) const;
69 
70 protected:
71  // AW: Need own sdr::contact::ViewContact since AnchorPos from parent is
72  // not used but something own (top left of new SnapRect minus top left
73  // of original SnapRect)
74  virtual std::unique_ptr<sdr::contact::ViewContact> CreateObjectSpecificViewContact() override;
75 
76  // protected destructor
77  virtual ~SwVirtFlyDrawObj() override;
78 
79 public:
80  // for paints triggered form ExecutePrimitive
81  void wrap_DoPaintObject(
83 
84  // for simple access to inner and outer bounds
87 
88  // RotGrfFlyFrame: Check if this is a SwGrfNode
89  bool ContainsSwGrfNode() const;
90 
92  SdrModel& rSdrModel,
93  SdrObject& rNew,
94  SwFlyFrame* pFly);
95 
96  // override method of base class SdrVirtObj
97  virtual void TakeObjInfo( SdrObjTransformInfoRec& rInfo ) const override;
98 
99  // we treat the size calculation completely on ourself here
100  virtual const tools::Rectangle& GetCurrentBoundRect() const override;
101  virtual const tools::Rectangle& GetLastBoundRect() const override;
102  virtual long GetRotateAngle() const override;
103  virtual void RecalcBoundRect() override;
104  virtual void RecalcSnapRect() override;
105  virtual const tools::Rectangle& GetSnapRect() const override;
106  virtual void SetSnapRect(const tools::Rectangle& rRect) override;
107  virtual void NbcSetSnapRect(const tools::Rectangle& rRect) override;
108  virtual const tools::Rectangle& GetLogicRect() const override;
109  virtual void SetLogicRect(const tools::Rectangle& rRect) override;
110  virtual void NbcSetLogicRect(const tools::Rectangle& rRect) override;
111  virtual ::basegfx::B2DPolyPolygon TakeXorPoly() const override;
112  virtual void NbcMove (const Size& rSiz) override;
113  virtual void NbcResize(const Point& rRef, const Fraction& xFact,
114  const Fraction& yFact) override;
115  virtual void NbcCrop(const basegfx::B2DPoint& rRef, double fxFact, double fyFact) override;
116  virtual void Move (const Size& rSiz) override;
117  virtual void Resize(const Point& rRef, const Fraction& xFact,
118  const Fraction& yFact, bool bUnsetRelative = true) override;
119  virtual void Crop(const basegfx::B2DPoint& rRef, double fxFact, double fyFact) override;
120  virtual void addCropHandles(SdrHdlList& rTarget) const override;
121  virtual void Rotate(const Point& rRef, long nAngle, double sn, double cs) override;
122 
123  // FullDrag support
124  virtual SdrObjectUniquePtr getFullDragClone() const override;
125 
126  const SwFrameFormat *GetFormat() const;
128 
129  // methods to get pointers for the Fly
131  const SwFlyFrame* GetFlyFrame() const { return m_pFlyFrame; }
132 
133  void SetRect() const;
134 
135  // if a URL is attached to a graphic than this is a macro object
136  virtual bool HasMacro() const override;
137  virtual SdrObject* CheckMacroHit (const SdrObjMacroHitRec& rRec) const override;
138  virtual PointerStyle GetMacroPointer (const SdrObjMacroHitRec& rRec) const override;
139 
140  // RotGrfFlyFrame: If true, this SdrObject supports only limited rotation.
141  virtual bool HasLimitedRotation() const override;
142 
143  virtual bool IsTextBox() const override;
144 };
145 
146 #endif
147 
148 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void SetTextBox(bool bIsTextBox)
Definition: dflyobj.hxx:55
virtual void addCropHandles(SdrHdlList &rTarget) const override
Definition: dflyobj.cxx:1214
basegfx::B2DRange getInnerBound() const
Definition: dflyobj.cxx:348
virtual SdrObjectUniquePtr getFullDragClone() const override
Definition: dflyobj.cxx:1198
void SetRect() const
Definition: dflyobj.cxx:564
SdrInventor
bool ContainsSwGrfNode() const
Definition: dflyobj.cxx:372
basegfx::B2DRange getOuterBound() const
Definition: dflyobj.cxx:324
virtual ~SwFlyDrawObj() override
Definition: dflyobj.cxx:135
virtual long GetRotateAngle() const override
Definition: dflyobj.cxx:1185
virtual ~SwVirtFlyDrawObj() override
Definition: dflyobj.cxx:446
virtual bool HasMacro() const override
Definition: dflyobj.cxx:1265
virtual sal_uInt16 GetObjIdentifier() const override
Definition: dflyobj.cxx:145
SwVirtFlyDrawObj(SdrModel &rSdrModel, SdrObject &rNew, SwFlyFrame *pFly)
Definition: dflyobj.cxx:434
virtual PointerStyle GetMacroPointer(const SdrObjMacroHitRec &rRec) const override
Definition: dflyobj.cxx:1259
virtual void RecalcSnapRect() override
Definition: dflyobj.cxx:588
virtual void NbcResize(const Point &rRef, const Fraction &xFact, const Fraction &yFact) override
Definition: dflyobj.cxx:979
Style of a layout element.
Definition: frmfmt.hxx:57
void wrap_DoPaintObject(drawinglayer::geometry::ViewInformation2D const &) const
Definition: dflyobj.cxx:506
virtual std::unique_ptr< sdr::properties::BaseProperties > CreateObjectSpecificProperties() override
Definition: dflyobj.cxx:116
virtual SdrInventor GetObjInventor() const override
Definition: dflyobj.cxx:140
virtual void NbcSetLogicRect(const tools::Rectangle &rRect) override
Definition: dflyobj.cxx:630
const sal_uInt16 SwFlyDrawObjIdentifier
Definition: dflyobj.hxx:31
virtual void TakeObjInfo(SdrObjTransformInfoRec &rInfo) const override
Definition: dflyobj.cxx:548
virtual void Resize(const Point &rRef, const Fraction &xFact, const Fraction &yFact, bool bUnsetRelative=true) override
Definition: dflyobj.cxx:1146
virtual SdrObject * CheckMacroHit(const SdrObjMacroHitRec &rRec) const override
Definition: dflyobj.cxx:1271
sal_uInt16 getPossibleRotationFromFraphicFrame(Size &rSize) const
Definition: dflyobj.cxx:1162
bool mbIsTextBox
Definition: dflyobj.hxx:38
virtual void NbcCrop(const basegfx::B2DPoint &rRef, double fxFact, double fyFact) override
Definition: dflyobj.cxx:805
virtual bool IsTextBox() const override
Definition: dflyobj.hxx:54
virtual void Move(const Size &rSiz) override
Definition: dflyobj.cxx:1139
SwFlyFrame * m_pFlyFrame
Definition: dflyobj.hxx:64
virtual const tools::Rectangle & GetLogicRect() const override
Definition: dflyobj.cxx:614
SwFlyFrame * GetFlyFrame()
Definition: dflyobj.hxx:130
general base class for all free-flowing frames
Definition: flyfrm.hxx:60
virtual const tools::Rectangle & GetLastBoundRect() const override
Definition: dflyobj.cxx:578
virtual void SetLogicRect(const tools::Rectangle &rRect) override
Definition: dflyobj.cxx:620
virtual void Crop(const basegfx::B2DPoint &rRef, double fxFact, double fyFact) override
Definition: dflyobj.cxx:1154
virtual void NbcSetSnapRect(const tools::Rectangle &rRect) override
Definition: dflyobj.cxx:609
std::unique_ptr< SdrObject, SdrObjectFreeOp > SdrObjectUniquePtr
virtual std::unique_ptr< sdr::contact::ViewContact > CreateObjectSpecificViewContact() override
Definition: dflyobj.cxx:427
PointerStyle
virtual ::basegfx::B2DPolyPolygon TakeXorPoly() const override
Definition: dflyobj.cxx:635
SwFlyDrawObj(SdrModel &rSdrModel)
Definition: dflyobj.cxx:129
virtual const tools::Rectangle & GetSnapRect() const override
Definition: dflyobj.cxx:593
virtual void RecalcBoundRect() override
Definition: dflyobj.cxx:583
virtual std::unique_ptr< sdr::contact::ViewContact > CreateObjectSpecificViewContact() override
Definition: dflyobj.cxx:122
const SwFlyFrame * GetFlyFrame() const
Definition: dflyobj.hxx:131
virtual bool HasLimitedRotation() const override
Definition: dflyobj.cxx:389
virtual void Rotate(const Point &rRef, long nAngle, double sn, double cs) override
Definition: dflyobj.cxx:396
virtual void NbcMove(const Size &rSiz) override
Definition: dflyobj.cxx:647
virtual void SetSnapRect(const tools::Rectangle &rRect) override
Definition: dflyobj.cxx:599
virtual bool IsTextBox() const override
Definition: dflyobj.cxx:1305
const SwFrameFormat * GetFormat() const
Definition: dflyobj.cxx:452
virtual const tools::Rectangle & GetCurrentBoundRect() const override
Definition: dflyobj.cxx:572