nss: upgrade to release 3.73
[LibreOffice.git] / include / svx / svdograf.hxx
blob27f38203edbe064adc946f9d33714bc181579ef6
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 <com/sun/star/graphic/XGraphic.hpp>
25 #include <com/sun/star/drawing/QRCode.hpp>
26 #include <vcl/graph.hxx>
27 #include <svx/svdorect.hxx>
28 #include <vcl/GraphicObject.hxx>
29 #include <svx/svxdllapi.h>
30 #include <o3tl/typed_flags_set.hxx>
31 #include <memory>
33 namespace sdr
35 namespace properties
37 class GraphicProperties;
38 } // end of namespace properties
39 namespace contact
41 class ViewObjectContactOfGraphic;
42 } // end of namespace contact
43 } // end of namespace sdr
45 /**
46 * Options for GetTransformedGraphic()
48 enum class SdrGrafObjTransformsAttrs
50 NONE = 0x00,
51 MIRROR = 0x01,
52 ROTATE = 0x02,
53 ALL = 0x03,
55 namespace o3tl
57 template<> struct typed_flags<SdrGrafObjTransformsAttrs> : is_typed_flags<SdrGrafObjTransformsAttrs, 0x03> {};
60 class SdrGrafObjGeoData final : public SdrTextObjGeoData
62 public:
63 bool bMirrored;
65 SdrGrafObjGeoData()
66 : bMirrored(false)
71 class GraphicObject;
72 class SdrGraphicLink;
74 /**
75 * This class represents an embedded or linked bitmap graphic object.
77 class SVXCORE_DLLPUBLIC SdrGrafObj : public SdrRectObj
79 private:
80 // to allow sdr::properties::GraphicProperties access to SetXPolyDirty()
81 friend class sdr::properties::GraphicProperties;
83 // to allow sdr::contact::ViewObjectContactOfGraphic access to ImpUpdateGraphicLink()
84 friend class sdr::contact::ViewObjectContactOfGraphic;
85 friend class SdrExchangeView; // Only for a ForceSwapIn() call.
86 friend class SdrGraphicLink;
88 virtual std::unique_ptr<sdr::contact::ViewContact> CreateObjectSpecificViewContact() override;
89 virtual std::unique_ptr<sdr::properties::BaseProperties> CreateObjectSpecificProperties() override;
91 void ImpSetAttrToGrafInfo(); // Copy values from the pool
92 GraphicAttr aGrafInfo;
94 OUString aFileName; // If it's a Link, the filename can be found in here
95 OUString aFilterName;
96 std::unique_ptr<GraphicObject> mpGraphicObject; // In order to speed up output of bitmaps, especially rotated ones
97 std::unique_ptr<GraphicObject> mpReplacementGraphicObject;
98 SdrGraphicLink* pGraphicLink; // And here a pointer for linked graphics
99 bool bMirrored:1; // True: the graphic is horizontal, which means it's mirrored along the y-axis
101 // Flag for allowing text animation. Default is true.
102 bool mbGrafAnimationAllowed:1;
104 bool mbIsSignatureLine;
105 OUString maSignatureLineId;
106 OUString maSignatureLineSuggestedSignerName;
107 OUString maSignatureLineSuggestedSignerTitle;
108 OUString maSignatureLineSuggestedSignerEmail;
109 OUString maSignatureLineSigningInstructions;
110 bool mbIsSignatureLineShowSignDate;
111 bool mbIsSignatureLineCanAddComment;
112 bool mbSignatureLineIsSigned;
113 css::uno::Reference<css::graphic::XGraphic> mpSignatureLineUnsignedGraphic;
115 std::unique_ptr<css::drawing::QRCode> mpQrCode;
116 void ImpRegisterLink();
117 void ImpDeregisterLink();
118 void ImpSetLinkedGraphic( const Graphic& rGraphic );
119 void onGraphicChanged();
120 GDIMetaFile GetMetaFile(GraphicType &rGraphicType) const;
122 protected:
123 // protected destructor
124 virtual ~SdrGrafObj() override;
126 public:
127 SdrGrafObj(SdrModel& rSdrModel);
128 SdrGrafObj(
129 SdrModel& rSdrModel,
130 const Graphic& rGrf);
131 SdrGrafObj(
132 SdrModel& rSdrModel,
133 const Graphic& rGrf,
134 const tools::Rectangle& rRect);
136 void SetGraphicObject( const GraphicObject& rGrfObj );
137 const GraphicObject& GetGraphicObject(bool bForceSwapIn = false) const;
138 const GraphicObject* GetReplacementGraphicObject() const;
140 void NbcSetGraphic(const Graphic& rGrf);
141 void SetGraphic(const Graphic& rGrf);
142 const Graphic& GetGraphic() const;
144 Graphic GetTransformedGraphic( SdrGrafObjTransformsAttrs nTransformFlags = SdrGrafObjTransformsAttrs::ALL ) const;
146 GraphicType GetGraphicType() const;
148 GraphicAttr GetGraphicAttr( SdrGrafObjTransformsAttrs nTransformFlags = SdrGrafObjTransformsAttrs::ALL ) const;
150 // Keep ATM for SD.
151 bool IsAnimated() const;
152 bool IsEPS() const;
154 MapMode GetGrafPrefMapMode() const;
155 Size GetGrafPrefSize() const;
157 void SetGrafStreamURL( const OUString& rGraphicStreamURL );
158 OUString const & GetGrafStreamURL() const;
159 Size getOriginalSize() const;
161 private:
162 void ForceSwapIn() const;
164 public:
165 void SetGraphicLink(const OUString& rFileName);
166 void ReleaseGraphicLink();
167 bool IsLinkedGraphic() const;
169 const OUString& GetFileName() const { return aFileName;}
171 void StartAnimation();
173 virtual void TakeObjInfo(SdrObjTransformInfoRec& rInfo) const override;
174 virtual SdrObjKind GetObjIdentifier() const override;
176 virtual OUString TakeObjNameSingul() const override;
177 virtual OUString TakeObjNamePlural() const override;
179 virtual SdrGrafObj* CloneSdrObject(SdrModel& rTargetModel) const override;
180 SdrGrafObj& operator=(const SdrGrafObj& rObj);
182 virtual sal_uInt32 GetHdlCount() const override;
183 virtual void AddToHdlList(SdrHdlList& rHdlList) const override;
185 virtual void NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact) override;
186 virtual void NbcMirror(const Point& rRef1, const Point& rRef2) override;
187 virtual SdrObjGeoData* NewGeoData() const override;
188 virtual void SaveGeoData(SdrObjGeoData& rGeo) const override;
189 virtual void RestGeoData(const SdrObjGeoData& rGeo) override;
191 bool HasGDIMetaFile() const;
193 // react on model/page change
194 virtual void handlePageChange(SdrPage* pOldPage, SdrPage* pNewPage) override;
196 bool isEmbeddedVectorGraphicData() const;
197 GDIMetaFile getMetafileFromEmbeddedVectorGraphicData() const;
199 virtual SdrObjectUniquePtr DoConvertToPolyObj(bool bBezier, bool bAddText) const override;
201 virtual void AdjustToMaxRect( const tools::Rectangle& rMaxRect, bool bShrinkOnly = false ) override;
203 virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override;
205 bool IsMirrored() const { return bMirrored;}
206 void SetMirrored( bool _bMirrored );
208 virtual bool shouldKeepAspectRatio() const override { return true; }
210 // Access to GrafAnimationAllowed flag
211 void SetGrafAnimationAllowed(bool bNew);
213 css::uno::Reference< css::io::XInputStream > getInputStream() const;
215 // #i103116# FullDrag support
216 virtual SdrObjectUniquePtr getFullDragClone() const override;
218 // add handles for crop mode when selected
219 virtual void addCropHandles(SdrHdlList& rTarget) const override;
221 // Signature Line
222 void setIsSignatureLine(bool bIsSignatureLine) { mbIsSignatureLine = bIsSignatureLine; }
223 bool isSignatureLine() const { return mbIsSignatureLine; }
225 void setSignatureLineId(const OUString& rSignatureLineId)
227 maSignatureLineId = rSignatureLineId;
230 const OUString& getSignatureLineId() const { return maSignatureLineId; }
232 void setSignatureLineSuggestedSignerName(const OUString& rSuggestedSignerName)
234 maSignatureLineSuggestedSignerName = rSuggestedSignerName;
237 const OUString& getSignatureLineSuggestedSignerName() const
239 return maSignatureLineSuggestedSignerName;
242 void setSignatureLineSuggestedSignerTitle(const OUString& rSuggestedSignerTitle)
244 maSignatureLineSuggestedSignerTitle = rSuggestedSignerTitle;
247 const OUString& getSignatureLineSuggestedSignerTitle() const
249 return maSignatureLineSuggestedSignerTitle;
252 void setSignatureLineSuggestedSignerEmail(const OUString& rSuggestedSignerEmail)
254 maSignatureLineSuggestedSignerEmail = rSuggestedSignerEmail;
256 const OUString& getSignatureLineSuggestedSignerEmail() const
258 return maSignatureLineSuggestedSignerEmail;
261 void setSignatureLineSigningInstructions(const OUString& rSigningInstructions)
263 maSignatureLineSigningInstructions = rSigningInstructions;
266 const OUString& getSignatureLineSigningInstructions() const
268 return maSignatureLineSigningInstructions;
271 void setSignatureLineShowSignDate(bool bIsSignatureLineShowSignDate)
273 mbIsSignatureLineShowSignDate = bIsSignatureLineShowSignDate;
276 bool isSignatureLineShowSignDate() const { return mbIsSignatureLineShowSignDate; }
278 void setSignatureLineCanAddComment(bool bIsSignatureCanAddComment)
280 mbIsSignatureLineCanAddComment = bIsSignatureCanAddComment;
283 bool isSignatureLineCanAddComment() const { return mbIsSignatureLineCanAddComment; }
285 css::uno::Reference<css::graphic::XGraphic> const & getSignatureLineUnsignedGraphic() const
287 return mpSignatureLineUnsignedGraphic;
290 void setSignatureLineUnsignedGraphic(css::uno::Reference<css::graphic::XGraphic> rGraphic)
292 mpSignatureLineUnsignedGraphic = rGraphic;
295 bool isSignatureLineSigned() const { return mbSignatureLineIsSigned; }
297 void setSignatureLineIsSigned(bool bIsSigned) { mbSignatureLineIsSigned = bIsSigned; }
299 // Qr Code
300 void setQrCode(css::drawing::QRCode& rQrCode)
302 mpQrCode = std::make_unique<css::drawing::QRCode>(rQrCode);
305 css::drawing::QRCode* getQrCode() const
307 return mpQrCode.get();
311 #endif // INCLUDED_SVX_SVDOGRAF_HXX
313 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */