Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 :
20 : #ifndef INCLUDED_SVX_SVDOGRAF_HXX
21 : #define INCLUDED_SVX_SVDOGRAF_HXX
22 :
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 :
29 : namespace sdr
30 : {
31 : namespace properties
32 : {
33 : class GraphicProperties;
34 : } // end of namespace properties
35 : namespace contact
36 : {
37 : class ViewObjectContactOfGraphic;
38 : } // end of namespace contact
39 : } // end of namespace sdr
40 :
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
46 :
47 0 : class SdrGrafObjGeoData : public SdrTextObjGeoData
48 : {
49 : public:
50 : bool bMirrored;
51 :
52 2 : SdrGrafObjGeoData()
53 2 : : bMirrored(false)
54 : {
55 2 : }
56 : };
57 :
58 : class GraphicObject;
59 : class SdrGraphicLink;
60 :
61 : /**
62 : * This class represents an embedded or linked bitmap graphic object.
63 : */
64 : class SVX_DLLPUBLIC SdrGrafObj : public SdrRectObj
65 : {
66 : private:
67 : // to allow sdr::properties::GraphicProperties access to SetXPolyDirty()
68 : friend class sdr::properties::GraphicProperties;
69 :
70 : // to allow sdr::contact::ViewObjectContactOfGraphic access to ImpUpdateGraphicLink()
71 : friend class sdr::contact::ViewObjectContactOfGraphic;
72 : friend class SdrGraphicLink;
73 :
74 : private:
75 : virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact() SAL_OVERRIDE;
76 : virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties() SAL_OVERRIDE;
77 :
78 : void ImpSetAttrToGrafInfo(); // Werte vom Pool kopieren
79 : GraphicAttr aGrafInfo;
80 :
81 : OUString aFileName; // Wenn es sich um einen Link handelt, steht hier der Dateiname drin.
82 : OUString aReferer;
83 : OUString aFilterName;
84 : GraphicObject* pGraphic; // Zur Beschleunigung von Bitmapausgaben, besonders von gedrehten.
85 : GraphicObject* mpReplacementGraphic;
86 : SdrGraphicLink* pGraphicLink; // Und hier noch ein Pointer fuer gelinkte Grafiken
87 : bool bMirrored:1; // True bedeutet, die Grafik ist horizontal, d.h. ueber die Y-Achse gespiegelt auszugeben.
88 :
89 : // #111096#
90 : // Flag for allowing text animation. Default is sal_true.
91 : bool mbGrafAnimationAllowed:1;
92 :
93 : // #i25616#
94 : bool mbInsidePaint:1;
95 : bool mbIsPreview:1;
96 :
97 : private:
98 :
99 : void ImpLinkAnmeldung();
100 : void ImpLinkAbmeldung();
101 : bool ImpUpdateGraphicLink( bool bAsynchron = true ) const;
102 : void ImpSetLinkedGraphic( const Graphic& rGraphic );
103 : DECL_LINK( ImpSwapHdl, GraphicObject* );
104 : void onGraphicChanged();
105 :
106 : public:
107 : TYPEINFO_OVERRIDE();
108 :
109 : SdrGrafObj();
110 : SdrGrafObj(const Graphic& rGrf);
111 : SdrGrafObj(const Graphic& rGrf, const Rectangle& rRect);
112 : virtual ~SdrGrafObj();
113 :
114 : void SetGraphicObject( const GraphicObject& rGrfObj );
115 : const GraphicObject& GetGraphicObject(bool bForceSwapIn = false) const;
116 : const GraphicObject* GetReplacementGraphicObject() const;
117 :
118 : void NbcSetGraphic(const Graphic& rGrf);
119 : void SetGraphic(const Graphic& rGrf);
120 : const Graphic& GetGraphic() const;
121 :
122 : Graphic GetTransformedGraphic( sal_uIntPtr nTransformFlags = SDRGRAFOBJ_TRANSFORMATTR_ALL ) const;
123 :
124 : GraphicType GetGraphicType() const;
125 :
126 : // #111096#
127 : // Keep ATM for SD.
128 : bool IsAnimated() const;
129 : bool IsEPS() const;
130 : bool IsSwappedOut() const;
131 :
132 : const MapMode& GetGrafPrefMapMode() const;
133 : const Size& GetGrafPrefSize() const;
134 :
135 : void SetGrafStreamURL( const OUString& rGraphicStreamURL );
136 : OUString GetGrafStreamURL() const;
137 :
138 : void ForceSwapIn() const;
139 : void ForceSwapOut() const;
140 :
141 : void SetGraphicLink(const OUString& rFileName, const OUString& rReferer, const OUString& rFilterName);
142 : void ReleaseGraphicLink();
143 : bool IsLinkedGraphic() const;
144 :
145 542 : const OUString& GetFileName() const { return aFileName;}
146 0 : const OUString& GetFilterName() const { return aFilterName;}
147 :
148 : void StartAnimation(OutputDevice* pOutDev, const Point& rPoint, const Size& rSize, long nExtraData=0L);
149 :
150 : virtual void TakeObjInfo(SdrObjTransformInfoRec& rInfo) const SAL_OVERRIDE;
151 : virtual sal_uInt16 GetObjIdentifier() const SAL_OVERRIDE;
152 :
153 : virtual OUString TakeObjNameSingul() const SAL_OVERRIDE;
154 : virtual OUString TakeObjNamePlural() const SAL_OVERRIDE;
155 :
156 : // #i25616#
157 : virtual basegfx::B2DPolyPolygon TakeXorPoly() const SAL_OVERRIDE;
158 :
159 : virtual SdrGrafObj* Clone() const SAL_OVERRIDE;
160 : SdrGrafObj& operator=(const SdrGrafObj& rObj);
161 :
162 : virtual sal_uInt32 GetHdlCount() const SAL_OVERRIDE;
163 : virtual SdrHdl* GetHdl(sal_uInt32 nHdlNum) const SAL_OVERRIDE;
164 :
165 : virtual void NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact) SAL_OVERRIDE;
166 : virtual void NbcRotate(const Point& rRef, long nWink, double sn, double cs) SAL_OVERRIDE;
167 : virtual void NbcMirror(const Point& rRef1, const Point& rRef2) SAL_OVERRIDE;
168 : virtual void NbcShear (const Point& rRef, long nWink, double tn, bool bVShear) SAL_OVERRIDE;
169 : virtual void NbcSetSnapRect(const Rectangle& rRect) SAL_OVERRIDE;
170 : virtual void NbcSetLogicRect(const Rectangle& rRect) SAL_OVERRIDE;
171 : virtual SdrObjGeoData* NewGeoData() const SAL_OVERRIDE;
172 : virtual void SaveGeoData(SdrObjGeoData& rGeo) const SAL_OVERRIDE;
173 : virtual void RestGeoData(const SdrObjGeoData& rGeo) SAL_OVERRIDE;
174 :
175 : bool HasGDIMetaFile() const;
176 :
177 : virtual void SetPage(SdrPage* pNewPage) SAL_OVERRIDE;
178 : virtual void SetModel(SdrModel* pNewModel) SAL_OVERRIDE;
179 :
180 : bool isEmbeddedSvg() const;
181 : GDIMetaFile getMetafileFromEmbeddedSvg() const;
182 :
183 : virtual SdrObject* DoConvertToPolyObj(bool bBezier, bool bAddText) const SAL_OVERRIDE;
184 :
185 : virtual void AdjustToMaxRect( const Rectangle& rMaxRect, bool bShrinkOnly = false ) SAL_OVERRIDE;
186 :
187 : virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) SAL_OVERRIDE;
188 :
189 2160 : bool IsMirrored() const { return bMirrored;}
190 : void SetMirrored( bool _bMirrored );
191 :
192 : // #111096#
193 : // Access to GrafAnimationAllowed flag
194 : void SetGrafAnimationAllowed(bool bNew);
195 :
196 : ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > getInputStream();
197 :
198 : // #i103116# FullDrag support
199 : virtual SdrObject* getFullDragClone() const SAL_OVERRIDE;
200 :
201 : // add handles for crop mode when selected
202 : void addCropHandles(SdrHdlList& rTarget) const;
203 : };
204 :
205 : #endif // INCLUDED_SVX_SVDOGRAF_HXX
206 :
207 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|