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#include <swdllapi.h>
27
28namespace drawinglayer::geometry { class ViewInformation2D; }
29
30class SwFlyFrame;
31class SwFrameFormat;
32
33// DrawObjects for Flys
34class SwFlyDrawObj final : public SdrObject
35{
36private:
37 virtual std::unique_ptr<sdr::properties::BaseProperties> CreateObjectSpecificProperties() override;
39
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;
43
44 // protected destructor
45 virtual ~SwFlyDrawObj() override;
46
47public:
48 SwFlyDrawObj(SdrModel& rSdrModel);
49
50 // for instantiation of this class while loading (via factory
51 virtual rtl::Reference<SdrObject> CloneSdrObject(SdrModel& rTargetModel) const override;
52
53 virtual SdrInventor GetObjInventor() const override;
54 virtual SdrObjKind GetObjIdentifier() const override;
55 virtual bool IsTextBox() const override { return mbIsTextBox; }
56 void SetTextBox(bool bIsTextBox) { mbIsTextBox = bIsTextBox; }
57
58 virtual void NbcRotate(const Point& rRef, Degree100 nAngle, double sinAngle, double cosAngle) override;
59};
60
61// virtual objects for Flys
62// Flys will always be shown with virtual objects. By doing that, they can be
63// shown multiple times if needed (header/footer).
64// For example, if an SwFlyFrameFormat is anchored in a header, then all pages will have a separate
65// SwVirtFlyDrawObj in their headers.
67{
68private:
70
71 // RotGrfFlyFrame: Helper to access the rotation angle (in 10th degrees, left-handed)
72 // of a GraphicFrame
73 Degree10 getPossibleRotationFromFraphicFrame(Size& rSize) const;
74
75 // AW: Need own sdr::contact::ViewContact since AnchorPos from parent is
76 // not used but something own (top left of new SnapRect minus top left
77 // of original SnapRect)
78 virtual std::unique_ptr<sdr::contact::ViewContact> CreateObjectSpecificViewContact() override;
79
80 // protected destructor
81 virtual ~SwVirtFlyDrawObj() override;
82
83public:
84 // for paints triggered form ExecutePrimitive
85 void wrap_DoPaintObject(
87
88 // for simple access to inner and outer bounds
89 basegfx::B2DRange getOuterBound() const;
90 basegfx::B2DRange getInnerBound() const;
91
92 // RotGrfFlyFrame: Check if this is a SwGrfNode
93 bool ContainsSwGrfNode() const;
94
96 SdrModel& rSdrModel,
97 SdrObject& rNew,
98 SwFlyFrame* pFly);
99
100 // override method of base class SdrVirtObj
101 virtual void TakeObjInfo( SdrObjTransformInfoRec& rInfo ) const override;
102
103 // we treat the size calculation completely on ourself here
104 virtual const tools::Rectangle& GetCurrentBoundRect() const override;
105 virtual const tools::Rectangle& GetLastBoundRect() const override;
106 virtual Degree100 GetRotateAngle() const override;
107 virtual void RecalcBoundRect() override;
108 virtual void RecalcSnapRect() override;
109 virtual const tools::Rectangle& GetSnapRect() const override;
110 virtual void SetSnapRect(const tools::Rectangle& rRect) override;
111 virtual void NbcSetSnapRect(const tools::Rectangle& rRect) override;
112 virtual const tools::Rectangle& GetLogicRect() const override;
113 virtual void SetLogicRect(const tools::Rectangle& rRect) override;
114 virtual void NbcSetLogicRect(const tools::Rectangle& rRect) override;
115 virtual ::basegfx::B2DPolyPolygon TakeXorPoly() const override;
116 virtual void NbcMove (const Size& rSiz) override;
117 virtual void NbcResize(const Point& rRef, const Fraction& xFact,
118 const Fraction& yFact) override;
119 virtual void NbcCrop(const basegfx::B2DPoint& rRef, double fxFact, double fyFact) override;
120 virtual void Move (const Size& rSiz) override;
121 virtual void Resize(const Point& rRef, const Fraction& xFact,
122 const Fraction& yFact, bool bUnsetRelative = true) override;
123 virtual void Crop(const basegfx::B2DPoint& rRef, double fxFact, double fyFact) override;
124 virtual void addCropHandles(SdrHdlList& rTarget) const override;
125 virtual void Rotate(const Point& rRef, Degree100 nAngle, double sn, double cs) override;
126
127
128 // FullDrag support
129 virtual rtl::Reference<SdrObject> getFullDragClone() const override;
130
131 const SwFrameFormat *GetFormat() const;
133
134 // methods to get pointers for the Fly
135 SwFlyFrame* GetFlyFrame() { return m_pFlyFrame; }
136 const SwFlyFrame* GetFlyFrame() const { return m_pFlyFrame; }
137
138 void SetRect() const;
139
140 // if a URL is attached to a graphic than this is a macro object
141 virtual bool HasMacro() const override;
142 virtual SdrObject* CheckMacroHit (const SdrObjMacroHitRec& rRec) const override;
143 virtual PointerStyle GetMacroPointer (const SdrObjMacroHitRec& rRec) const override;
144
145 // RotGrfFlyFrame: If true, this SdrObject supports only limited rotation.
146 virtual bool HasLimitedRotation() const override;
147
148 virtual bool IsTextBox() const override;
149 void dumpAsXml(xmlTextWriterPtr pWriter) const override;
150};
151
152#endif
153
154/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual void dumpAsXml(xmlTextWriterPtr pWriter) const
virtual void NbcCrop(const basegfx::B2DPoint &rRef, double fxFact, double fyFact)
virtual void Crop(const basegfx::B2DPoint &rRef, double fxFact, double fyFact)
virtual bool IsTextBox() const
virtual void addCropHandles(SdrHdlList &rTarget) const
virtual void Move(const Size &rSiz) override
virtual bool HasLimitedRotation() const override
virtual void NbcMove(const Size &rSiz) override
virtual PointerStyle GetMacroPointer(const SdrObjMacroHitRec &rRec) const override
virtual std::unique_ptr< sdr::contact::ViewContact > CreateObjectSpecificViewContact() override
virtual const tools::Rectangle & GetCurrentBoundRect() const override
virtual void Rotate(const Point &rRef, Degree100 nAngle, double sn, double cs) override
virtual void RecalcSnapRect() override
virtual void TakeObjInfo(SdrObjTransformInfoRec &rInfo) const override
virtual void NbcSetSnapRect(const tools::Rectangle &rRect) override
virtual void SetSnapRect(const tools::Rectangle &rRect) override
virtual rtl::Reference< SdrObject > getFullDragClone() const override
virtual void SetLogicRect(const tools::Rectangle &rRect) override
virtual const tools::Rectangle & GetLogicRect() const override
virtual void RecalcBoundRect() override
virtual basegfx::B2DPolyPolygon TakeXorPoly() const override
virtual void NbcSetLogicRect(const tools::Rectangle &rRect) override
virtual Degree100 GetRotateAngle() const override
virtual bool HasMacro() const override
virtual void NbcResize(const Point &rRef, const Fraction &xFact, const Fraction &yFact) override
virtual const tools::Rectangle & GetSnapRect() const override
virtual SdrObject * CheckMacroHit(const SdrObjMacroHitRec &rRec) const override
virtual const tools::Rectangle & GetLastBoundRect() const override
virtual void Resize(const Point &rRef, const Fraction &xFact, const Fraction &yFact, bool bUnsetRelative=true) override
virtual SdrInventor GetObjInventor() const override
Definition: dflyobj.cxx:138
bool mbIsTextBox
Definition: dflyobj.hxx:38
virtual std::unique_ptr< sdr::properties::BaseProperties > CreateObjectSpecificProperties() override
Definition: dflyobj.cxx:114
virtual rtl::Reference< SdrObject > CloneSdrObject(SdrModel &rTargetModel) const override
Definition: dflyobj.cxx:148
virtual std::unique_ptr< sdr::contact::ViewContact > CreateObjectSpecificViewContact() override
Definition: dflyobj.cxx:120
virtual bool IsTextBox() const override
Definition: dflyobj.hxx:55
virtual SdrObjKind GetObjIdentifier() const override
Definition: dflyobj.cxx:143
SwFlyDrawObj(SdrModel &rSdrModel)
Definition: dflyobj.cxx:127
void SetTextBox(bool bIsTextBox)
Definition: dflyobj.hxx:56
virtual ~SwFlyDrawObj() override
Definition: dflyobj.cxx:133
virtual void NbcRotate(const Point &rRef, Degree100 nAngle, double sinAngle, double cosAngle) override
Definition: dflyobj.cxx:153
general base class for all free-flowing frames
Definition: flyfrm.hxx:79
Style of a layout element.
Definition: frmfmt.hxx:72
SwFlyFrame * m_pFlyFrame
Definition: dflyobj.hxx:69
SwFlyFrame * GetFlyFrame()
Definition: dflyobj.hxx:135
const SwFlyFrame * GetFlyFrame() const
Definition: dflyobj.hxx:136
struct _xmlTextWriter * xmlTextWriterPtr
virtual SotClipboardFormatId GetFormat(const TransferableDataHelper &aHelper) override
PointerStyle
SdrInventor
SdrObjKind
#define SW_DLLPUBLIC
Definition: swdllapi.h:28