1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
23 #include <com/sun/star/io/XInputStream.hpp>
24 #include <vcl/graph.hxx>
25 #include <svx/svdorect.hxx>
26 #include <svtools/grfmgr.hxx>
27 #include "svx/svxdllapi.h"
33 class GraphicProperties
;
34 } // end of namespace properties
37 class ViewObjectContactOfGraphic
;
38 } // end of namespace contact
39 } // end of namespace sdr
41 #define SDRGRAFOBJ_TRANSFORMATTR_NONE 0x00000000UL
42 #define SDRGRAFOBJ_TRANSFORMATTR_COLOR 0x00000001UL
43 #define SDRGRAFOBJ_TRANSFORMATTR_MIRROR 0x00000002UL
44 #define SDRGRAFOBJ_TRANSFORMATTR_ROTATE 0x00000004UL
45 #define SDRGRAFOBJ_TRANSFORMATTR_ALL 0xffffffffUL
47 class SdrGrafObjGeoData
: public SdrTextObjGeoData
62 * This class represents an embedded or linked bitmap graphic object.
64 class SVX_DLLPUBLIC SdrGrafObj
: public SdrRectObj
67 // to allow sdr::properties::GraphicProperties access to SetXPolyDirty()
68 friend class sdr::properties::GraphicProperties
;
70 // to allow sdr::contact::ViewObjectContactOfGraphic access to ImpUpdateGraphicLink()
71 friend class sdr::contact::ViewObjectContactOfGraphic
;
72 friend class SdrGraphicLink
;
75 virtual sdr::contact::ViewContact
* CreateObjectSpecificViewContact();
76 virtual sdr::properties::BaseProperties
* CreateObjectSpecificProperties();
78 void ImpSetAttrToGrafInfo(); // Werte vom Pool kopieren
79 GraphicAttr aGrafInfo
;
81 OUString aFileName
; // Wenn es sich um einen Link handelt, steht hier der Dateiname drin.
83 GraphicObject
* pGraphic
; // Zur Beschleunigung von Bitmapausgaben, besonders von gedrehten.
84 GraphicObject
* mpReplacementGraphic
;
85 SdrGraphicLink
* pGraphicLink
; // Und hier noch ein Pointer fuer gelinkte Grafiken
86 bool bMirrored
:1; // True bedeutet, die Grafik ist horizontal, d.h. ueber die Y-Achse gespiegelt auszugeben.
89 // Flag for allowing text animation. Default is sal_true.
90 bool mbGrafAnimationAllowed
:1;
98 void ImpLinkAnmeldung();
99 void ImpLinkAbmeldung();
100 bool ImpUpdateGraphicLink( bool bAsynchron
= true ) const;
101 void ImpSetLinkedGraphic( const Graphic
& rGraphic
);
102 DECL_LINK( ImpSwapHdl
, GraphicObject
* );
103 void onGraphicChanged();
109 SdrGrafObj(const Graphic
& rGrf
);
110 SdrGrafObj(const Graphic
& rGrf
, const Rectangle
& rRect
);
111 virtual ~SdrGrafObj();
113 void SetGraphicObject( const GraphicObject
& rGrfObj
);
114 const GraphicObject
& GetGraphicObject(bool bForceSwapIn
= false) const;
115 const GraphicObject
* GetReplacementGraphicObject() const;
117 void NbcSetGraphic(const Graphic
& rGrf
);
118 void SetGraphic(const Graphic
& rGrf
);
119 const Graphic
& GetGraphic() const;
121 Graphic
GetTransformedGraphic( sal_uIntPtr nTransformFlags
= SDRGRAFOBJ_TRANSFORMATTR_ALL
) const;
123 GraphicType
GetGraphicType() const;
127 bool IsAnimated() const;
129 bool IsSwappedOut() const;
131 const MapMode
& GetGrafPrefMapMode() const;
132 const Size
& GetGrafPrefSize() const;
134 void SetGrafStreamURL( const String
& rGraphicStreamURL
);
135 String
GetGrafStreamURL() const;
137 void ForceSwapIn() const;
138 void ForceSwapOut() const;
140 void SetGraphicLink(const OUString
& rFileName
, const String
& rFilterName
);
141 void ReleaseGraphicLink();
142 bool IsLinkedGraphic() const;
144 const OUString
& GetFileName() const;
145 const OUString
& GetFilterName() const;
147 void StartAnimation(OutputDevice
* pOutDev
, const Point
& rPoint
, const Size
& rSize
, long nExtraData
=0L);
149 virtual void TakeObjInfo(SdrObjTransformInfoRec
& rInfo
) const;
150 virtual sal_uInt16
GetObjIdentifier() const;
152 virtual void TakeObjNameSingul(String
& rName
) const;
153 virtual void TakeObjNamePlural(String
& rName
) const;
156 virtual basegfx::B2DPolyPolygon
TakeXorPoly() const;
158 virtual SdrGrafObj
* Clone() const;
159 SdrGrafObj
& operator=(const SdrGrafObj
& rObj
);
161 virtual sal_uInt32
GetHdlCount() const;
162 virtual SdrHdl
* GetHdl(sal_uInt32 nHdlNum
) const;
164 virtual void NbcResize(const Point
& rRef
, const Fraction
& xFact
, const Fraction
& yFact
);
165 virtual void NbcRotate(const Point
& rRef
, long nWink
, double sn
, double cs
);
166 virtual void NbcMirror(const Point
& rRef1
, const Point
& rRef2
);
167 virtual void NbcShear (const Point
& rRef
, long nWink
, double tn
, bool bVShear
);
168 virtual void NbcSetSnapRect(const Rectangle
& rRect
);
169 virtual void NbcSetLogicRect(const Rectangle
& rRect
);
170 virtual SdrObjGeoData
* NewGeoData() const;
171 virtual void SaveGeoData(SdrObjGeoData
& rGeo
) const;
172 virtual void RestGeoData(const SdrObjGeoData
& rGeo
);
174 bool HasGDIMetaFile() const;
176 virtual void SetPage(SdrPage
* pNewPage
);
177 virtual void SetModel(SdrModel
* pNewModel
);
179 bool isEmbeddedSvg() const;
180 GDIMetaFile
getMetafileFromEmbeddedSvg() const;
182 virtual SdrObject
* DoConvertToPolyObj(sal_Bool bBezier
, bool bAddText
) const;
184 virtual void AdjustToMaxRect( const Rectangle
& rMaxRect
, bool bShrinkOnly
= false );
186 virtual void Notify( SfxBroadcaster
& rBC
, const SfxHint
& rHint
);
188 bool IsMirrored() const;
189 void SetMirrored( bool _bMirrored
);
192 // Access to GrafAnimationAllowed flag
193 void SetGrafAnimationAllowed(bool bNew
);
195 ::com::sun::star::uno::Reference
< ::com::sun::star::io::XInputStream
> getInputStream();
197 // #i103116# FullDrag support
198 virtual SdrObject
* getFullDragClone() const;
201 #endif //_SVDOGRAF_HXX
203 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */