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 .
20 #ifndef INCLUDED_SVX_SVDOGRAF_HXX
21 #define INCLUDED_SVX_SVDOGRAF_HXX
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>
28 #include <o3tl/typed_flags_set.hxx>
34 class GraphicProperties
;
35 } // end of namespace properties
38 class ViewObjectContactOfGraphic
;
39 } // end of namespace contact
40 } // end of namespace sdr
42 /* options for GetTransformedGraphic() */
43 enum class SdrGrafObjTransformsAttrs
53 template<> struct typed_flags
<SdrGrafObjTransformsAttrs
> : is_typed_flags
<SdrGrafObjTransformsAttrs
, 7> {};
56 class SdrGrafObjGeoData
: public SdrTextObjGeoData
71 * This class represents an embedded or linked bitmap graphic object.
73 class SVX_DLLPUBLIC SdrGrafObj
: public SdrRectObj
76 // to allow sdr::properties::GraphicProperties access to SetXPolyDirty()
77 friend class sdr::properties::GraphicProperties
;
79 // to allow sdr::contact::ViewObjectContactOfGraphic access to ImpUpdateGraphicLink()
80 friend class sdr::contact::ViewObjectContactOfGraphic
;
81 friend class SdrExchangeView
; // Only for a ForceSwapIn() call.
82 friend class SdrGraphicLink
;
85 virtual sdr::contact::ViewContact
* CreateObjectSpecificViewContact() SAL_OVERRIDE
;
86 virtual sdr::properties::BaseProperties
* CreateObjectSpecificProperties() SAL_OVERRIDE
;
88 void ImpSetAttrToGrafInfo(); // Werte vom Pool kopieren
89 GraphicAttr aGrafInfo
;
91 OUString aFileName
; // Wenn es sich um einen Link handelt, steht hier der Dateiname drin.
94 GraphicObject
* pGraphic
; // Zur Beschleunigung von Bitmapausgaben, besonders von gedrehten.
95 GraphicObject
* mpReplacementGraphic
;
96 SdrGraphicLink
* pGraphicLink
; // Und hier noch ein Pointer fuer gelinkte Grafiken
97 bool bMirrored
:1; // True bedeutet, die Grafik ist horizontal, d.h. ueber die Y-Achse gespiegelt auszugeben.
100 // Flag for allowing text animation. Default is sal_true.
101 bool mbGrafAnimationAllowed
:1;
104 bool mbInsidePaint
:1;
109 void ImpLinkAnmeldung();
110 void ImpLinkAbmeldung();
111 bool ImpUpdateGraphicLink( bool bAsynchron
= true ) const;
112 void ImpSetLinkedGraphic( const Graphic
& rGraphic
);
113 DECL_LINK( ImpSwapHdl
, GraphicObject
* );
114 void onGraphicChanged();
120 SdrGrafObj(const Graphic
& rGrf
);
121 SdrGrafObj(const Graphic
& rGrf
, const Rectangle
& rRect
);
122 virtual ~SdrGrafObj();
124 void SetGraphicObject( const GraphicObject
& rGrfObj
);
125 const GraphicObject
& GetGraphicObject(bool bForceSwapIn
= false) const;
126 const GraphicObject
* GetReplacementGraphicObject() const;
128 void NbcSetGraphic(const Graphic
& rGrf
);
129 void SetGraphic(const Graphic
& rGrf
);
130 const Graphic
& GetGraphic() const;
132 Graphic
GetTransformedGraphic( SdrGrafObjTransformsAttrs nTransformFlags
= SdrGrafObjTransformsAttrs::ALL
) const;
134 GraphicType
GetGraphicType() const;
138 bool IsAnimated() const;
140 bool IsSwappedOut() const;
142 const MapMode
& GetGrafPrefMapMode() const;
143 const Size
& GetGrafPrefSize() const;
145 void SetGrafStreamURL( const OUString
& rGraphicStreamURL
);
146 OUString
GetGrafStreamURL() const;
149 void ForceSwapIn() const;
152 void SetGraphicLink(const OUString
& rFileName
, const OUString
& rReferer
, const OUString
& rFilterName
);
153 void ReleaseGraphicLink();
154 bool IsLinkedGraphic() const;
156 const OUString
& GetFileName() const { return aFileName
;}
157 const OUString
& GetFilterName() const { return aFilterName
;}
159 void StartAnimation(OutputDevice
* pOutDev
, const Point
& rPoint
, const Size
& rSize
, long nExtraData
=0L);
161 virtual void TakeObjInfo(SdrObjTransformInfoRec
& rInfo
) const SAL_OVERRIDE
;
162 virtual sal_uInt16
GetObjIdentifier() const SAL_OVERRIDE
;
164 virtual OUString
TakeObjNameSingul() const SAL_OVERRIDE
;
165 virtual OUString
TakeObjNamePlural() const SAL_OVERRIDE
;
168 virtual basegfx::B2DPolyPolygon
TakeXorPoly() const SAL_OVERRIDE
;
170 virtual SdrGrafObj
* Clone() const SAL_OVERRIDE
;
171 SdrGrafObj
& operator=(const SdrGrafObj
& rObj
);
173 virtual sal_uInt32
GetHdlCount() const SAL_OVERRIDE
;
174 virtual SdrHdl
* GetHdl(sal_uInt32 nHdlNum
) const SAL_OVERRIDE
;
176 virtual void NbcResize(const Point
& rRef
, const Fraction
& xFact
, const Fraction
& yFact
) SAL_OVERRIDE
;
177 virtual void NbcRotate(const Point
& rRef
, long nAngle
, double sn
, double cs
) SAL_OVERRIDE
;
178 virtual void NbcMirror(const Point
& rRef1
, const Point
& rRef2
) SAL_OVERRIDE
;
179 virtual void NbcShear (const Point
& rRef
, long nAngle
, double tn
, bool bVShear
) SAL_OVERRIDE
;
180 virtual void NbcSetSnapRect(const Rectangle
& rRect
) SAL_OVERRIDE
;
181 virtual void NbcSetLogicRect(const Rectangle
& rRect
) SAL_OVERRIDE
;
182 virtual SdrObjGeoData
* NewGeoData() const SAL_OVERRIDE
;
183 virtual void SaveGeoData(SdrObjGeoData
& rGeo
) const SAL_OVERRIDE
;
184 virtual void RestGeoData(const SdrObjGeoData
& rGeo
) SAL_OVERRIDE
;
186 bool HasGDIMetaFile() const;
188 virtual void SetPage(SdrPage
* pNewPage
) SAL_OVERRIDE
;
189 virtual void SetModel(SdrModel
* pNewModel
) SAL_OVERRIDE
;
191 bool isEmbeddedSvg() const;
192 GDIMetaFile
getMetafileFromEmbeddedSvg() const;
194 virtual SdrObject
* DoConvertToPolyObj(bool bBezier
, bool bAddText
) const SAL_OVERRIDE
;
196 virtual void AdjustToMaxRect( const Rectangle
& rMaxRect
, bool bShrinkOnly
= false ) SAL_OVERRIDE
;
198 virtual void Notify( SfxBroadcaster
& rBC
, const SfxHint
& rHint
) SAL_OVERRIDE
;
200 bool IsMirrored() const { return bMirrored
;}
201 void SetMirrored( bool _bMirrored
);
204 // Access to GrafAnimationAllowed flag
205 void SetGrafAnimationAllowed(bool bNew
);
207 ::com::sun::star::uno::Reference
< ::com::sun::star::io::XInputStream
> getInputStream();
209 // #i103116# FullDrag support
210 virtual SdrObject
* getFullDragClone() const SAL_OVERRIDE
;
212 // add handles for crop mode when selected
213 virtual void addCropHandles(SdrHdlList
& rTarget
) const SAL_OVERRIDE
;
216 #endif // INCLUDED_SVX_SVDOGRAF_HXX
218 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */