Line data Source code
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 <drawinglayer/geometry/viewinformation2d.hxx>
24 : #include <svx/svdovirt.hxx>
25 :
26 : class SwFlyFrm;
27 : class SwFrameFormat;
28 : class SdrObjMacroHitRec;
29 :
30 : const sal_uInt32 SWGInventor = sal_uInt32('S')*0x00000001 +
31 : sal_uInt32('W')*0x00000100 +
32 : sal_uInt32('G')*0x00010000;
33 :
34 : const sal_uInt16 SwFlyDrawObjIdentifier = 0x0001;
35 :
36 : // DrawObjects for Flys
37 : class SwFlyDrawObj : public SdrObject
38 : {
39 : private:
40 : virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties() SAL_OVERRIDE;
41 :
42 : protected:
43 : // #i95264# SwFlyDrawObj needs an own VC since createViewIndependentPrimitive2DSequence()
44 : // is called when RecalcBoundRect() is used
45 : virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact() SAL_OVERRIDE;
46 :
47 : public:
48 : TYPEINFO_OVERRIDE();
49 :
50 : SwFlyDrawObj();
51 : virtual ~SwFlyDrawObj();
52 :
53 : // for instantiation of this class while loading (via factory)
54 : virtual sal_uInt32 GetObjInventor() const SAL_OVERRIDE;
55 : virtual sal_uInt16 GetObjIdentifier() const SAL_OVERRIDE;
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).
61 : class SwVirtFlyDrawObj : public SdrVirtObj
62 : {
63 : private:
64 : SwFlyFrm *pFlyFrm;
65 :
66 : protected:
67 : // AW: Need own sdr::contact::ViewContact since AnchorPos from parent is
68 : // not used but something own (top left of new SnapRect minus top left
69 : // of original SnapRect)
70 : virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact() SAL_OVERRIDE;
71 :
72 : public:
73 : // for paints triggered form ExecutePrimitive
74 : void wrap_DoPaintObject(
75 : drawinglayer::geometry::ViewInformation2D const&) const;
76 :
77 : // for simple access to inner and outer bounds
78 : basegfx::B2DRange getOuterBound() const;
79 : basegfx::B2DRange getInnerBound() const;
80 :
81 : TYPEINFO_OVERRIDE();
82 :
83 : SwVirtFlyDrawObj(SdrObject& rNew, SwFlyFrm* pFly);
84 : virtual ~SwVirtFlyDrawObj();
85 :
86 : // override method of base class SdrVirtObj
87 : virtual void TakeObjInfo( SdrObjTransformInfoRec& rInfo ) const SAL_OVERRIDE;
88 :
89 : // we treat the size calculation completely on ourself here
90 : virtual const Rectangle& GetCurrentBoundRect() const SAL_OVERRIDE;
91 : virtual const Rectangle& GetLastBoundRect() const SAL_OVERRIDE;
92 : virtual void RecalcBoundRect() SAL_OVERRIDE;
93 : virtual void RecalcSnapRect() SAL_OVERRIDE;
94 : virtual const Rectangle& GetSnapRect() const SAL_OVERRIDE;
95 : virtual void SetSnapRect(const Rectangle& rRect) SAL_OVERRIDE;
96 : virtual void NbcSetSnapRect(const Rectangle& rRect) SAL_OVERRIDE;
97 : virtual const Rectangle& GetLogicRect() const SAL_OVERRIDE;
98 : virtual void SetLogicRect(const Rectangle& rRect) SAL_OVERRIDE;
99 : virtual void NbcSetLogicRect(const Rectangle& rRect) SAL_OVERRIDE;
100 : virtual ::basegfx::B2DPolyPolygon TakeXorPoly() const SAL_OVERRIDE;
101 : virtual void NbcMove (const Size& rSiz) SAL_OVERRIDE;
102 : virtual void NbcResize(const Point& rRef, const Fraction& xFact,
103 : const Fraction& yFact) SAL_OVERRIDE;
104 : virtual void NbcCrop(const Point& rRef, const Fraction& xFact, const Fraction& yFact) SAL_OVERRIDE;
105 : virtual void Move (const Size& rSiz) SAL_OVERRIDE;
106 : virtual void Resize(const Point& rRef, const Fraction& xFact,
107 : const Fraction& yFact, bool bUnsetRelative = true) SAL_OVERRIDE;
108 : virtual void Crop(const Point& rRef, const Fraction& xFact, const Fraction& yFact) SAL_OVERRIDE;
109 : virtual void addCropHandles(SdrHdlList& rTarget) const SAL_OVERRIDE;
110 :
111 : const SwFrameFormat *GetFormat() const;
112 : SwFrameFormat *GetFormat();
113 :
114 : // methods to get pointers for the Fly
115 28758 : SwFlyFrm* GetFlyFrm() { return pFlyFrm; }
116 106568 : const SwFlyFrm* GetFlyFrm() const { return pFlyFrm; }
117 :
118 : void SetRect() const;
119 :
120 : // if an URL is attached to a graphic than this is a macro object
121 : virtual bool HasMacro() const SAL_OVERRIDE;
122 : virtual SdrObject* CheckMacroHit (const SdrObjMacroHitRec& rRec) const SAL_OVERRIDE;
123 : virtual Pointer GetMacroPointer (const SdrObjMacroHitRec& rRec) const SAL_OVERRIDE;
124 :
125 : // FullDrag support
126 : virtual bool supportsFullDrag() const SAL_OVERRIDE;
127 : virtual SdrObject* getFullDragClone() const SAL_OVERRIDE;
128 : };
129 :
130 : #endif
131 :
132 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|