xref: /trunk/main/sw/source/core/inc/dflyobj.hxx (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 #ifndef _DFLYOBJ_HXX
28 #define _DFLYOBJ_HXX
29 #include <svx/svdovirt.hxx>
30 
31 class SwFlyFrm;
32 class SwFrmFmt;
33 class SdrObjMacroHitRec;
34 
35 const sal_uInt32 SWGInventor =  sal_uInt32('S')*0x00000001+
36                             sal_uInt32('W')*0x00000100+
37                             sal_uInt32('G')*0x00010000;
38 
39 const sal_uInt16 SwFlyDrawObjIdentifier = 0x0001;
40 const sal_uInt16 SwDrawFirst            = 0x0001;
41 
42 //---------------------------------------
43 //SwFlyDrawObj, Die DrawObjekte fuer Flys.
44 
45 class SwFlyDrawObj : public SdrObject
46 {
47 private:
48     virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties();
49 
50 protected:
51     // #i95264# SwFlyDrawObj needs an own VC since createViewIndependentPrimitive2DSequence()
52     // is called when RecalcBoundRect() is used
53     virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact();
54 
55 public:
56     TYPEINFO();
57 
58     SwFlyDrawObj();
59     ~SwFlyDrawObj();
60 
61     //Damit eine Instanz dieser Klasse beim laden erzeugt werden kann
62     //(per Factory).
63     virtual sal_uInt32 GetObjInventor()     const;
64     virtual sal_uInt16 GetObjIdentifier()   const;
65     virtual sal_uInt16 GetObjVersion()      const;
66 };
67 
68 //---------------------------------------
69 //SwVirtFlyDrawObj, die virtuellen Objekte fuer Flys.
70 //Flys werden immer mit virtuellen Objekten angezeigt. Nur so koennen sie
71 //ggf. mehrfach angezeigt werden (Kopf-/Fusszeilen).
72 
73 class SwVirtFlyDrawObj : public SdrVirtObj
74 {
75 private:
76     SwFlyFrm *pFlyFrm;
77 
78 protected:
79     // AW: Need own sdr::contact::ViewContact since AnchorPos from parent is
80     // not used but something own (top left of new SnapRect minus top left
81     // of original SnapRect)
82     virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact();
83 
84 public:
85     // for paints triggered form ExecutePrimitive
86     void wrap_DoPaintObject() const;
87 
88     // for simple access to inner and outer bounds
89     basegfx::B2DRange getOuterBound() const;
90     basegfx::B2DRange getInnerBound() const;
91 
92 public:
93     TYPEINFO();
94 
95     SwVirtFlyDrawObj(SdrObject& rNew, SwFlyFrm* pFly);
96     ~SwVirtFlyDrawObj();
97 
98     //Ueberladene Methoden der Basisklasse SdrVirtObj
99     virtual void     TakeObjInfo( SdrObjTransformInfoRec& rInfo ) const;
100 
101     //Wir nehemen die Groessenbehandlung vollstaendig selbst in die Hand.
102     virtual const Rectangle& GetCurrentBoundRect() const;
103     virtual const Rectangle& GetLastBoundRect() const;
104     virtual       void       RecalcBoundRect();
105     virtual       void       RecalcSnapRect();
106     virtual const Rectangle& GetSnapRect()  const;
107     virtual       void       SetSnapRect(const Rectangle& rRect);
108     virtual       void       NbcSetSnapRect(const Rectangle& rRect);
109     virtual const Rectangle& GetLogicRect() const;
110     virtual       void       SetLogicRect(const Rectangle& rRect);
111     virtual       void       NbcSetLogicRect(const Rectangle& rRect);
112     virtual ::basegfx::B2DPolyPolygon TakeXorPoly() const;
113     virtual       void       NbcMove  (const Size& rSiz);
114     virtual       void       NbcResize(const Point& rRef, const Fraction& xFact,
115                                        const Fraction& yFact);
116     virtual       void       Move  (const Size& rSiz);
117     virtual       void       Resize(const Point& rRef, const Fraction& xFact,
118                                     const Fraction& yFact);
119 
120     const SwFrmFmt *GetFmt() const;
121           SwFrmFmt *GetFmt();
122 
123     // Get Methoden fuer die Fly Verpointerung
124           SwFlyFrm* GetFlyFrm()         { return pFlyFrm; }
125     const SwFlyFrm* GetFlyFrm() const   { return pFlyFrm; }
126 
127     void SetRect() const;
128 
129     // ist eine URL an einer Grafik gesetzt, dann ist das ein Makro-Object
130     virtual FASTBOOL HasMacro() const;
131     virtual SdrObject* CheckMacroHit       (const SdrObjMacroHitRec& rRec) const;
132     virtual Pointer    GetMacroPointer     (const SdrObjMacroHitRec& rRec) const;
133 
134     // FullDrag support
135     virtual bool supportsFullDrag() const;
136     virtual SdrObject* getFullDragClone() const;
137 };
138 
139 
140 #endif
141