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 28 #ifndef _SVDOGRAF_HXX 29 #define _SVDOGRAF_HXX 30 31 #include <com/sun/star/io/XInputStream.hpp> 32 #include <vcl/graph.hxx> 33 #include <svx/svdorect.hxx> 34 #include <svtools/grfmgr.hxx> 35 #include "svx/svxdllapi.h" 36 37 ////////////////////////////////////////////////////////////////////////////// 38 // predeclarations 39 40 namespace sdr 41 { 42 namespace properties 43 { 44 class GraphicProperties; 45 } // end of namespace properties 46 namespace contact 47 { 48 class ViewObjectContactOfGraphic; 49 } // end of namespace contact 50 } // end of namespace sdr 51 52 // ----------- 53 // - Defines - 54 // ----------- 55 56 #define SDRGRAFOBJ_TRANSFORMATTR_NONE 0x00000000UL 57 #define SDRGRAFOBJ_TRANSFORMATTR_COLOR 0x00000001UL 58 #define SDRGRAFOBJ_TRANSFORMATTR_MIRROR 0x00000002UL 59 #define SDRGRAFOBJ_TRANSFORMATTR_ROTATE 0x00000004UL 60 #define SDRGRAFOBJ_TRANSFORMATTR_ALL 0xffffffffUL 61 62 // --------------------- 63 // - SdrGrafObjGeoData - 64 // --------------------- 65 66 // #109872# 67 class SdrGrafObjGeoData : public SdrTextObjGeoData 68 { 69 public: 70 sal_Bool bMirrored; 71 72 SdrGrafObjGeoData() 73 : bMirrored(sal_False) 74 { 75 } 76 }; 77 78 // -------------- 79 // - SdrGrafObj - 80 // -------------- 81 82 class GraphicObject; 83 class SdrGraphicLink; 84 85 class SVX_DLLPUBLIC SdrGrafObj : public SdrRectObj 86 { 87 private: 88 // to allow sdr::properties::GraphicProperties access to SetXPolyDirty() 89 friend class sdr::properties::GraphicProperties; 90 91 // to allow sdr::contact::ViewObjectContactOfGraphic access to ImpUpdateGraphicLink() 92 friend class sdr::contact::ViewObjectContactOfGraphic; 93 friend class SdrGraphicLink; 94 95 protected: 96 virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact(); 97 virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties(); 98 99 void ImpSetAttrToGrafInfo(); // Werte vom Pool kopieren 100 void ImpSetGrafInfoToAttr(); // Werte in den Pool kopieren 101 GraphicAttr aGrafInfo; 102 103 Rectangle aCropRect; // Wenn aCropRect nicht Empty ist, dann enthaelt es den sichtbaren 104 // Ausschnitt der Grafik in logischen Eingeiten der Grafik! Also Bitmap->=Pixel 105 String aFileName; // Wenn es sich um einen Link handelt, steht hier der Dateiname drin. 106 String aFilterName; 107 GraphicObject* pGraphic; // Zur Beschleunigung von Bitmapausgaben, besonders von gedrehten. 108 SdrGraphicLink* pGraphicLink; // Und hier noch ein Pointer fuer gelinkte Grafiken 109 bool bMirrored; // True bedeutet, die Grafik ist horizontal, d.h. ueber die Y-Achse gespiegelt auszugeben. 110 111 // #111096# 112 // Flag for allowing text animation. Default is sal_true. 113 unsigned mbGrafAnimationAllowed : 1; 114 115 // #i25616# 116 unsigned mbInsidePaint : 1; 117 unsigned mbIsPreview : 1; 118 119 protected: 120 121 void ImpLinkAnmeldung(); 122 void ImpLinkAbmeldung(); 123 sal_Bool ImpUpdateGraphicLink( sal_Bool bAsynchron = sal_True ) const; 124 void ImpSetLinkedGraphic( const Graphic& rGraphic ); 125 DECL_LINK( ImpSwapHdl, GraphicObject* ); 126 127 public: 128 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 sal_Bool IsAnimated() const; 150 sal_Bool IsEPS() const; 151 sal_Bool IsRenderGraphic() const; 152 sal_Bool HasRenderGraphic() const; 153 sal_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 String& rFileName, const String& rFilterName); 165 void ReleaseGraphicLink(); 166 sal_Bool IsLinkedGraphic() const { return (sal_Bool)aFileName.Len(); } 167 168 void SetFileName(const String& rFileName); 169 const String& GetFileName() const { return aFileName; } 170 void SetFilterName(const String& rFilterName); 171 const String& GetFilterName() const { return aFilterName; } 172 173 void StartAnimation(OutputDevice* pOutDev, const Point& rPoint, const Size& rSize, long nExtraData=0L); 174 void StopAnimation(OutputDevice* pOutDev=NULL, long nExtraData=0L); 175 176 virtual void TakeObjInfo(SdrObjTransformInfoRec& rInfo) const; 177 virtual sal_uInt16 GetObjIdentifier() const; 178 179 virtual void TakeObjNameSingul(String& rName) const; 180 virtual void TakeObjNamePlural(String& rName) const; 181 182 // #i25616# 183 virtual basegfx::B2DPolyPolygon TakeXorPoly() const; 184 185 virtual void operator=(const SdrObject& rObj); 186 187 virtual sal_uInt32 GetHdlCount() const; 188 virtual SdrHdl* GetHdl(sal_uInt32 nHdlNum) const; 189 190 virtual void NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact); 191 virtual void NbcRotate(const Point& rRef, long nWink, double sn, double cs); 192 virtual void NbcMirror(const Point& rRef1, const Point& rRef2); 193 virtual void NbcShear (const Point& rRef, long nWink, double tn, FASTBOOL bVShear); 194 virtual void NbcSetSnapRect(const Rectangle& rRect); 195 virtual void NbcSetLogicRect(const Rectangle& rRect); 196 virtual SdrObjGeoData* NewGeoData() const; 197 virtual void SaveGeoData(SdrObjGeoData& rGeo) const; 198 virtual void RestGeoData(const SdrObjGeoData& rGeo); 199 200 FASTBOOL HasGDIMetaFile() const; 201 const GDIMetaFile* GetGDIMetaFile() const; 202 203 virtual void SetPage(SdrPage* pNewPage); 204 virtual void SetModel(SdrModel* pNewModel); 205 206 virtual SdrObject* DoConvertToPolyObj(sal_Bool bBezier) const; 207 208 virtual void AdjustToMaxRect( const Rectangle& rMaxRect, bool bShrinkOnly = false ); 209 210 virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); 211 212 bool IsMirrored() { return bMirrored; } 213 void SetMirrored( bool _bMirrored ) { bMirrored = _bMirrored; } 214 215 // #111096# 216 // Access to GrafAnimationAllowed flag 217 sal_Bool IsGrafAnimationAllowed() const; 218 void SetGrafAnimationAllowed(sal_Bool bNew); 219 220 // #i25616# 221 sal_Bool IsObjectTransparent() const; 222 223 ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > getInputStream(); 224 225 // #i103116# FullDrag support 226 virtual SdrObject* getFullDragClone() const; 227 }; 228 229 #endif //_SVDOGRAF_HXX 230