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