1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 #ifndef _SVDOGRAF_HXX 25 #define _SVDOGRAF_HXX 26 27 #include <com/sun/star/io/XInputStream.hpp> 28 #include <vcl/graph.hxx> 29 #include <svx/svdorect.hxx> 30 #include <svtools/grfmgr.hxx> 31 #include "svx/svxdllapi.h" 32 33 ////////////////////////////////////////////////////////////////////////////// 34 // predeclarations 35 36 namespace sdr 37 { 38 namespace properties 39 { 40 class GraphicProperties; 41 } // end of namespace properties 42 namespace contact 43 { 44 class ViewObjectContactOfGraphic; 45 } // end of namespace contact 46 } // end of namespace sdr 47 48 // ----------- 49 // - Defines - 50 // ----------- 51 52 #define SDRGRAFOBJ_TRANSFORMATTR_NONE 0x00000000UL 53 #define SDRGRAFOBJ_TRANSFORMATTR_COLOR 0x00000001UL 54 #define SDRGRAFOBJ_TRANSFORMATTR_MIRROR 0x00000002UL 55 #define SDRGRAFOBJ_TRANSFORMATTR_ROTATE 0x00000004UL 56 #define SDRGRAFOBJ_TRANSFORMATTR_ALL 0xffffffffUL 57 58 // --------------------- 59 // - SdrGrafObjGeoData - 60 // --------------------- 61 62 // #109872# 63 class SdrGrafObjGeoData : public SdrTextObjGeoData 64 { 65 public: 66 sal_Bool bMirrored; 67 68 SdrGrafObjGeoData() 69 : bMirrored(sal_False) 70 { 71 } 72 }; 73 74 // -------------- 75 // - SdrGrafObj - 76 // -------------- 77 78 class GraphicObject; 79 class SdrGraphicLink; 80 81 class SVX_DLLPUBLIC SdrGrafObj : public SdrRectObj 82 { 83 private: 84 // to allow sdr::properties::GraphicProperties access to SetXPolyDirty() 85 friend class sdr::properties::GraphicProperties; 86 87 // to allow sdr::contact::ViewObjectContactOfGraphic access to ImpUpdateGraphicLink() 88 friend class sdr::contact::ViewObjectContactOfGraphic; 89 friend class SdrGraphicLink; 90 91 protected: 92 virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact(); 93 virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties(); 94 95 void ImpSetAttrToGrafInfo(); // Werte vom Pool kopieren 96 void ImpSetGrafInfoToAttr(); // Werte in den Pool kopieren 97 GraphicAttr aGrafInfo; 98 99 Rectangle aCropRect; // Wenn aCropRect nicht Empty ist, dann enthaelt es den sichtbaren 100 // Ausschnitt der Grafik in logischen Eingeiten der Grafik! Also Bitmap->=Pixel 101 String aFileName; // Wenn es sich um einen Link handelt, steht hier der Dateiname drin. 102 String aFilterName; 103 GraphicObject* pGraphic; // Zur Beschleunigung von Bitmapausgaben, besonders von gedrehten. 104 SdrGraphicLink* pGraphicLink; // Und hier noch ein Pointer fuer gelinkte Grafiken 105 bool bMirrored; // True bedeutet, die Grafik ist horizontal, d.h. ueber die Y-Achse gespiegelt auszugeben. 106 107 // #111096# 108 // Flag for allowing text animation. Default is sal_true. 109 unsigned mbGrafAnimationAllowed : 1; 110 111 // #i25616# 112 unsigned mbInsidePaint : 1; 113 unsigned mbIsPreview : 1; 114 115 protected: 116 117 void ImpLinkAnmeldung(); 118 void ImpLinkAbmeldung(); 119 sal_Bool ImpUpdateGraphicLink( sal_Bool bAsynchron = sal_True ) const; 120 void ImpSetLinkedGraphic( const Graphic& rGraphic ); 121 DECL_LINK( ImpSwapHdl, GraphicObject* ); 122 123 public: 124 125 TYPEINFO(); 126 127 SdrGrafObj(); 128 SdrGrafObj(const Graphic& rGrf); 129 SdrGrafObj(const Graphic& rGrf, const Rectangle& rRect); 130 virtual ~SdrGrafObj(); 131 132 void SetGraphicObject( const GraphicObject& rGrfObj ); 133 const GraphicObject& GetGraphicObject( bool bForceSwapIn = false) const; 134 135 void NbcSetGraphic(const Graphic& rGrf); 136 void SetGraphic(const Graphic& rGrf); 137 const Graphic& GetGraphic() const; 138 139 Graphic GetTransformedGraphic( sal_uIntPtr nTransformFlags = SDRGRAFOBJ_TRANSFORMATTR_ALL ) const; 140 141 GraphicType GetGraphicType() const; 142 143 // #111096# 144 // Keep ATM for SD. 145 sal_Bool IsAnimated() const; 146 sal_Bool IsEPS() const; 147 sal_Bool IsRenderGraphic() const; 148 sal_Bool HasRenderGraphic() const; 149 sal_Bool IsSwappedOut() const; 150 151 const MapMode& GetGrafPrefMapMode() const; 152 const Size& GetGrafPrefSize() const; 153 154 void SetGrafStreamURL( const String& rGraphicStreamURL ); 155 String GetGrafStreamURL() const; 156 157 void ForceSwapIn() const; 158 void ForceSwapOut() const; 159 160 void SetGraphicLink(const String& rFileName, const String& rFilterName); 161 void ReleaseGraphicLink(); 162 sal_Bool IsLinkedGraphic() const { return (sal_Bool)aFileName.Len(); } 163 164 void SetFileName(const String& rFileName); 165 const String& GetFileName() const { return aFileName; } 166 void SetFilterName(const String& rFilterName); 167 const String& GetFilterName() const { return aFilterName; } 168 169 void StartAnimation(OutputDevice* pOutDev, const Point& rPoint, const Size& rSize, long nExtraData=0L); 170 void StopAnimation(OutputDevice* pOutDev=NULL, long nExtraData=0L); 171 172 virtual void TakeObjInfo(SdrObjTransformInfoRec& rInfo) const; 173 virtual sal_uInt16 GetObjIdentifier() const; 174 175 virtual void TakeObjNameSingul(String& rName) const; 176 virtual void TakeObjNamePlural(String& rName) const; 177 178 // #i25616# 179 virtual basegfx::B2DPolyPolygon TakeXorPoly() const; 180 181 virtual void operator=(const SdrObject& rObj); 182 183 virtual sal_uInt32 GetHdlCount() const; 184 virtual SdrHdl* GetHdl(sal_uInt32 nHdlNum) const; 185 186 virtual void NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact); 187 virtual void NbcRotate(const Point& rRef, long nWink, double sn, double cs); 188 virtual void NbcMirror(const Point& rRef1, const Point& rRef2); 189 virtual void NbcShear (const Point& rRef, long nWink, double tn, FASTBOOL bVShear); 190 virtual void NbcSetSnapRect(const Rectangle& rRect); 191 virtual void NbcSetLogicRect(const Rectangle& rRect); 192 virtual SdrObjGeoData* NewGeoData() const; 193 virtual void SaveGeoData(SdrObjGeoData& rGeo) const; 194 virtual void RestGeoData(const SdrObjGeoData& rGeo); 195 196 FASTBOOL HasGDIMetaFile() const; 197 const GDIMetaFile* GetGDIMetaFile() const; 198 199 virtual void SetPage(SdrPage* pNewPage); 200 virtual void SetModel(SdrModel* pNewModel); 201 202 virtual SdrObject* DoConvertToPolyObj(sal_Bool bBezier, bool bAddText) const; 203 204 virtual void AdjustToMaxRect( const Rectangle& rMaxRect, bool bShrinkOnly = false ); 205 206 virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); 207 208 bool IsMirrored() { return bMirrored; } 209 void SetMirrored( bool _bMirrored ) { bMirrored = _bMirrored; } 210 211 // #111096# 212 // Access to GrafAnimationAllowed flag 213 sal_Bool IsGrafAnimationAllowed() const; 214 void SetGrafAnimationAllowed(sal_Bool bNew); 215 216 // #i25616# 217 sal_Bool IsObjectTransparent() const; 218 219 ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > getInputStream(); 220 221 // #i103116# FullDrag support 222 virtual SdrObject* getFullDragClone() const; 223 }; 224 225 #endif //_SVDOGRAF_HXX 226