Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #ifndef _SVDOGRAF_HXX
30 : : #define _SVDOGRAF_HXX
31 : :
32 : : #include <com/sun/star/io/XInputStream.hpp>
33 : : #include <vcl/graph.hxx>
34 : : #include <svx/svdorect.hxx>
35 : : #include <svtools/grfmgr.hxx>
36 : : #include "svx/svxdllapi.h"
37 : :
38 : : //////////////////////////////////////////////////////////////////////////////
39 : : // predeclarations
40 : :
41 : : namespace sdr
42 : : {
43 : : namespace properties
44 : : {
45 : : class GraphicProperties;
46 : : } // end of namespace properties
47 : : namespace contact
48 : : {
49 : : class ViewObjectContactOfGraphic;
50 : : } // end of namespace contact
51 : : } // end of namespace sdr
52 : :
53 : : // -----------
54 : : // - Defines -
55 : : // -----------
56 : :
57 : : #define SDRGRAFOBJ_TRANSFORMATTR_NONE 0x00000000UL
58 : : #define SDRGRAFOBJ_TRANSFORMATTR_COLOR 0x00000001UL
59 : : #define SDRGRAFOBJ_TRANSFORMATTR_MIRROR 0x00000002UL
60 : : #define SDRGRAFOBJ_TRANSFORMATTR_ROTATE 0x00000004UL
61 : : #define SDRGRAFOBJ_TRANSFORMATTR_ALL 0xffffffffUL
62 : :
63 : : // ---------------------
64 : : // - SdrGrafObjGeoData -
65 : : // ---------------------
66 : :
67 : : // #109872#
68 [ # # ]: 0 : class SdrGrafObjGeoData : public SdrTextObjGeoData
69 : : {
70 : : public:
71 : : sal_Bool bMirrored;
72 : :
73 : : SdrGrafObjGeoData()
74 : : : bMirrored(false)
75 : : {
76 : : }
77 : : };
78 : :
79 : : // --------------
80 : : // - SdrGrafObj -
81 : : // --------------
82 : :
83 : : class GraphicObject;
84 : : class SdrGraphicLink;
85 : :
86 : : /**
87 : : * This class represents an embedded or linked bitmap graphic object.
88 : : */
89 : : class SVX_DLLPUBLIC SdrGrafObj : public SdrRectObj
90 : : {
91 : : private:
92 : : // to allow sdr::properties::GraphicProperties access to SetXPolyDirty()
93 : : friend class sdr::properties::GraphicProperties;
94 : :
95 : : // to allow sdr::contact::ViewObjectContactOfGraphic access to ImpUpdateGraphicLink()
96 : : friend class sdr::contact::ViewObjectContactOfGraphic;
97 : : friend class SdrGraphicLink;
98 : :
99 : : private:
100 : : virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact();
101 : : virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties();
102 : :
103 : : void ImpSetAttrToGrafInfo(); // Werte vom Pool kopieren
104 : : GraphicAttr aGrafInfo;
105 : :
106 : : rtl::OUString aFileName; // Wenn es sich um einen Link handelt, steht hier der Dateiname drin.
107 : : rtl::OUString aFilterName;
108 : : GraphicObject* pGraphic; // Zur Beschleunigung von Bitmapausgaben, besonders von gedrehten.
109 : : SdrGraphicLink* pGraphicLink; // Und hier noch ein Pointer fuer gelinkte Grafiken
110 : : bool bMirrored:1; // True bedeutet, die Grafik ist horizontal, d.h. ueber die Y-Achse gespiegelt auszugeben.
111 : :
112 : : // #111096#
113 : : // Flag for allowing text animation. Default is sal_true.
114 : : bool mbGrafAnimationAllowed:1;
115 : :
116 : : // #i25616#
117 : : bool mbInsidePaint:1;
118 : : bool mbIsPreview:1;
119 : :
120 : : private:
121 : :
122 : : void ImpLinkAnmeldung();
123 : : void ImpLinkAbmeldung();
124 : : bool ImpUpdateGraphicLink( bool bAsynchron = true ) const;
125 : : void ImpSetLinkedGraphic( const Graphic& rGraphic );
126 : : DECL_LINK( ImpSwapHdl, GraphicObject* );
127 : :
128 : : public:
129 : : TYPEINFO();
130 : :
131 : : SdrGrafObj();
132 : : SdrGrafObj(const Graphic& rGrf);
133 : : SdrGrafObj(const Graphic& rGrf, const Rectangle& rRect);
134 : : virtual ~SdrGrafObj();
135 : :
136 : : void SetGraphicObject( const GraphicObject& rGrfObj );
137 : : const GraphicObject& GetGraphicObject(bool bForceSwapIn = false) const;
138 : :
139 : : void NbcSetGraphic(const Graphic& rGrf);
140 : : void SetGraphic(const Graphic& rGrf);
141 : : const Graphic& GetGraphic() const;
142 : :
143 : : Graphic GetTransformedGraphic( sal_uIntPtr nTransformFlags = SDRGRAFOBJ_TRANSFORMATTR_ALL ) const;
144 : :
145 : : GraphicType GetGraphicType() const;
146 : :
147 : : // #111096#
148 : : // Keep ATM for SD.
149 : : bool IsAnimated() const;
150 : : bool IsEPS() const;
151 : : bool IsRenderGraphic() const;
152 : : bool HasRenderGraphic() const;
153 : : bool IsSwappedOut() const;
154 : :
155 : : const MapMode& GetGrafPrefMapMode() const;
156 : : const Size& GetGrafPrefSize() const;
157 : :
158 : : void SetGrafStreamURL( const String& rGraphicStreamURL );
159 : : String GetGrafStreamURL() const;
160 : :
161 : : void ForceSwapIn() const;
162 : : void ForceSwapOut() const;
163 : :
164 : : void SetGraphicLink(const rtl::OUString& rFileName, const String& rFilterName);
165 : : void ReleaseGraphicLink();
166 : : bool IsLinkedGraphic() const;
167 : :
168 : : const rtl::OUString& GetFileName() const;
169 : : const rtl::OUString& GetFilterName() const;
170 : :
171 : : void StartAnimation(OutputDevice* pOutDev, const Point& rPoint, const Size& rSize, long nExtraData=0L);
172 : :
173 : : virtual void TakeObjInfo(SdrObjTransformInfoRec& rInfo) const;
174 : : virtual sal_uInt16 GetObjIdentifier() const;
175 : :
176 : : virtual void TakeObjNameSingul(String& rName) const;
177 : : virtual void TakeObjNamePlural(String& rName) const;
178 : :
179 : : // #i25616#
180 : : virtual basegfx::B2DPolyPolygon TakeXorPoly() const;
181 : :
182 : : virtual SdrGrafObj* Clone() const;
183 : : SdrGrafObj& operator=(const SdrGrafObj& rObj);
184 : :
185 : : virtual sal_uInt32 GetHdlCount() const;
186 : : virtual SdrHdl* GetHdl(sal_uInt32 nHdlNum) const;
187 : :
188 : : virtual void NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact);
189 : : virtual void NbcRotate(const Point& rRef, long nWink, double sn, double cs);
190 : : virtual void NbcMirror(const Point& rRef1, const Point& rRef2);
191 : : virtual void NbcShear (const Point& rRef, long nWink, double tn, bool bVShear);
192 : : virtual void NbcSetSnapRect(const Rectangle& rRect);
193 : : virtual void NbcSetLogicRect(const Rectangle& rRect);
194 : : virtual SdrObjGeoData* NewGeoData() const;
195 : : virtual void SaveGeoData(SdrObjGeoData& rGeo) const;
196 : : virtual void RestGeoData(const SdrObjGeoData& rGeo);
197 : :
198 : : bool HasGDIMetaFile() const;
199 : :
200 : : virtual void SetPage(SdrPage* pNewPage);
201 : : virtual void SetModel(SdrModel* pNewModel);
202 : :
203 : : virtual SdrObject* DoConvertToPolyObj(sal_Bool bBezier) const;
204 : :
205 : : virtual void AdjustToMaxRect( const Rectangle& rMaxRect, bool bShrinkOnly = false );
206 : :
207 : : virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
208 : :
209 : : bool IsMirrored() const;
210 : : void SetMirrored( bool _bMirrored );
211 : :
212 : : // #111096#
213 : : // Access to GrafAnimationAllowed flag
214 : : void SetGrafAnimationAllowed(bool bNew);
215 : :
216 : : ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > getInputStream();
217 : :
218 : : // #i103116# FullDrag support
219 : : virtual SdrObject* getFullDragClone() const;
220 : : };
221 : :
222 : : #endif //_SVDOGRAF_HXX
223 : :
224 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|