LibreOffice Module sw (master)  1
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
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 .
18  */
23 #include <svx/svdovirt.hxx>
24 #include <svx/svdobj.hxx>
26 namespace drawinglayer::geometry { class ViewInformation2D; }
28 class SwFlyFrame;
29 class SwFrameFormat;
31 const sal_uInt16 SwFlyDrawObjIdentifier = 0x0001;
33 // DrawObjects for Flys
34 class SwFlyDrawObj : public SdrObject
35 {
36 private:
37  virtual std::unique_ptr<sdr::properties::BaseProperties> CreateObjectSpecificProperties() override;
39 protected:
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);
50  // for instantiation of this class while loading (via factory)
51  virtual SdrInventor GetObjInventor() const override;
52  virtual sal_uInt16 GetObjIdentifier() const override;
53 };
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).
59 {
60 private:
63  // RotGrfFlyFrame: Helper to access the rotation angle (in 10th degrees, left-handed)
64  // of a GraphicFrame
65  sal_uInt16 getPossibleRotationFromFraphicFrame(Size& rSize) const;
67 protected:
68  // AW: Need own sdr::contact::ViewContact since AnchorPos from parent is
69  // not used but something own (top left of new SnapRect minus top left
70  // of original SnapRect)
71  virtual std::unique_ptr<sdr::contact::ViewContact> CreateObjectSpecificViewContact() override;
73  // protected destructor
74  virtual ~SwVirtFlyDrawObj() override;
76 public:
77  // for paints triggered form ExecutePrimitive
78  void wrap_DoPaintObject(
81  // for simple access to inner and outer bounds
85  // RotGrfFlyFrame: Check if this is a SwGrfNode
86  bool ContainsSwGrfNode() const;
89  SdrModel& rSdrModel,
90  SdrObject& rNew,
91  SwFlyFrame* pFly);
93  // override method of base class SdrVirtObj
94  virtual void TakeObjInfo( SdrObjTransformInfoRec& rInfo ) const override;
96  // we treat the size calculation completely on ourself here
97  virtual const tools::Rectangle& GetCurrentBoundRect() const override;
98  virtual const tools::Rectangle& GetLastBoundRect() const override;
99  virtual long GetRotateAngle() const override;
100  virtual void RecalcBoundRect() override;
101  virtual void RecalcSnapRect() override;
102  virtual const tools::Rectangle& GetSnapRect() const override;
103  virtual void SetSnapRect(const tools::Rectangle& rRect) override;
104  virtual void NbcSetSnapRect(const tools::Rectangle& rRect) override;
105  virtual const tools::Rectangle& GetLogicRect() const override;
106  virtual void SetLogicRect(const tools::Rectangle& rRect) override;
107  virtual void NbcSetLogicRect(const tools::Rectangle& rRect) override;
108  virtual ::basegfx::B2DPolyPolygon TakeXorPoly() const override;
109  virtual void NbcMove (const Size& rSiz) override;
110  virtual void NbcResize(const Point& rRef, const Fraction& xFact,
111  const Fraction& yFact) override;
112  virtual void NbcCrop(const basegfx::B2DPoint& rRef, double fxFact, double fyFact) override;
113  virtual void Move (const Size& rSiz) override;
114  virtual void Resize(const Point& rRef, const Fraction& xFact,
115  const Fraction& yFact, bool bUnsetRelative = true) override;
116  virtual void Crop(const basegfx::B2DPoint& rRef, double fxFact, double fyFact) override;
117  virtual void addCropHandles(SdrHdlList& rTarget) const override;
118  virtual void Rotate(const Point& rRef, long nAngle, double sn, double cs) override;
120  // FullDrag support
121  virtual SdrObject* getFullDragClone() const override;
123  const SwFrameFormat *GetFormat() const;
126  // methods to get pointers for the Fly
128  const SwFlyFrame* GetFlyFrame() const { return m_pFlyFrame; }
130  void SetRect() const;
132  // if a URL is attached to a graphic than this is a macro object
133  virtual bool HasMacro() const override;
134  virtual SdrObject* CheckMacroHit (const SdrObjMacroHitRec& rRec) const override;
135  virtual PointerStyle GetMacroPointer (const SdrObjMacroHitRec& rRec) const override;
137  // RotGrfFlyFrame: If true, this SdrObject supports only limited rotation.
138  virtual bool HasLimitedRotation() const override;
140  virtual bool IsTextBox() const override;
141 };
143 #endif
145 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual SdrObject * getFullDragClone() const override
Definition: dflyobj.cxx:1187
virtual void addCropHandles(SdrHdlList &rTarget) const override
Definition: dflyobj.cxx:1203
basegfx::B2DRange getInnerBound() const
Definition: dflyobj.cxx:337
void SetRect() const
Definition: dflyobj.cxx:553
bool ContainsSwGrfNode() const
Definition: dflyobj.cxx:361
basegfx::B2DRange getOuterBound() const
Definition: dflyobj.cxx:313
virtual ~SwFlyDrawObj() override
Definition: dflyobj.cxx:132
virtual long GetRotateAngle() const override
Definition: dflyobj.cxx:1174
virtual ~SwVirtFlyDrawObj() override
Definition: dflyobj.cxx:435
virtual bool HasMacro() const override
Definition: dflyobj.cxx:1254
virtual sal_uInt16 GetObjIdentifier() const override
Definition: dflyobj.cxx:142
SwVirtFlyDrawObj(SdrModel &rSdrModel, SdrObject &rNew, SwFlyFrame *pFly)
Definition: dflyobj.cxx:423
virtual PointerStyle GetMacroPointer(const SdrObjMacroHitRec &rRec) const override
Definition: dflyobj.cxx:1248
virtual void RecalcSnapRect() override
Definition: dflyobj.cxx:577
virtual void NbcResize(const Point &rRef, const Fraction &xFact, const Fraction &yFact) override
Definition: dflyobj.cxx:968
Style of a layout element.
Definition: frmfmt.hxx:57
void wrap_DoPaintObject(drawinglayer::geometry::ViewInformation2D const &) const
Definition: dflyobj.cxx:495
virtual std::unique_ptr< sdr::properties::BaseProperties > CreateObjectSpecificProperties() override
Definition: dflyobj.cxx:114
virtual SdrInventor GetObjInventor() const override
Definition: dflyobj.cxx:137
virtual void NbcSetLogicRect(const tools::Rectangle &rRect) override
Definition: dflyobj.cxx:619
const sal_uInt16 SwFlyDrawObjIdentifier
Definition: dflyobj.hxx:31
virtual void TakeObjInfo(SdrObjTransformInfoRec &rInfo) const override
Definition: dflyobj.cxx:537
virtual void Resize(const Point &rRef, const Fraction &xFact, const Fraction &yFact, bool bUnsetRelative=true) override
Definition: dflyobj.cxx:1135
virtual SdrObject * CheckMacroHit(const SdrObjMacroHitRec &rRec) const override
Definition: dflyobj.cxx:1260
sal_uInt16 getPossibleRotationFromFraphicFrame(Size &rSize) const
Definition: dflyobj.cxx:1151
virtual void NbcCrop(const basegfx::B2DPoint &rRef, double fxFact, double fyFact) override
Definition: dflyobj.cxx:794
virtual void Move(const Size &rSiz) override
Definition: dflyobj.cxx:1128
SwFlyFrame * m_pFlyFrame
Definition: dflyobj.hxx:61
virtual const tools::Rectangle & GetLogicRect() const override
Definition: dflyobj.cxx:603
SwFlyFrame * GetFlyFrame()
Definition: dflyobj.hxx:127
general base class for all free-flowing frames
Definition: flyfrm.hxx:60
virtual const tools::Rectangle & GetLastBoundRect() const override
Definition: dflyobj.cxx:567
virtual void SetLogicRect(const tools::Rectangle &rRect) override
Definition: dflyobj.cxx:609
virtual void Crop(const basegfx::B2DPoint &rRef, double fxFact, double fyFact) override
Definition: dflyobj.cxx:1143
virtual void NbcSetSnapRect(const tools::Rectangle &rRect) override
Definition: dflyobj.cxx:598
virtual std::unique_ptr< sdr::contact::ViewContact > CreateObjectSpecificViewContact() override
Definition: dflyobj.cxx:416
virtual ::basegfx::B2DPolyPolygon TakeXorPoly() const override
Definition: dflyobj.cxx:624
SwFlyDrawObj(SdrModel &rSdrModel)
Definition: dflyobj.cxx:127
virtual const tools::Rectangle & GetSnapRect() const override
Definition: dflyobj.cxx:582
virtual void RecalcBoundRect() override
Definition: dflyobj.cxx:572
virtual std::unique_ptr< sdr::contact::ViewContact > CreateObjectSpecificViewContact() override
Definition: dflyobj.cxx:120
const SwFlyFrame * GetFlyFrame() const
Definition: dflyobj.hxx:128
virtual bool HasLimitedRotation() const override
Definition: dflyobj.cxx:378
virtual void Rotate(const Point &rRef, long nAngle, double sn, double cs) override
Definition: dflyobj.cxx:385
virtual void NbcMove(const Size &rSiz) override
Definition: dflyobj.cxx:636
virtual void SetSnapRect(const tools::Rectangle &rRect) override
Definition: dflyobj.cxx:588
virtual bool IsTextBox() const override
Definition: dflyobj.cxx:1294
const SwFrameFormat * GetFormat() const
Definition: dflyobj.cxx:441
virtual const tools::Rectangle & GetCurrentBoundRect() const override
Definition: dflyobj.cxx:561