tdf#151073 - enable firebird for appstore build w/o experimental mode
[LibreOffice.git] / include / svx / svdograf.hxx
blobcb88b4c2a770d36a16c02cf259b5dfa26eb69ae1
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 #pragma once
22 #include <com/sun/star/io/XInputStream.hpp>
23 #include <com/sun/star/graphic/XGraphic.hpp>
24 #include <com/sun/star/drawing/BarCode.hpp>
25 #include <vcl/graph.hxx>
26 #include <svx/svdorect.hxx>
27 #include <vcl/GraphicObject.hxx>
28 #include <svx/svxdllapi.h>
29 #include <o3tl/typed_flags_set.hxx>
30 #include <memory>
32 namespace sdr::properties { class GraphicProperties; }
33 namespace sdr::contact { class ViewObjectContactOfGraphic; }
35 /**
36 * Options for GetTransformedGraphic()
38 enum class SdrGrafObjTransformsAttrs
40 NONE = 0x00,
41 MIRROR = 0x01,
42 ROTATE = 0x02,
43 ALL = 0x03,
45 namespace o3tl
47 template<> struct typed_flags<SdrGrafObjTransformsAttrs> : is_typed_flags<SdrGrafObjTransformsAttrs, 0x03> {};
50 class SdrGrafObjGeoData final : public SdrTextObjGeoData
52 public:
53 bool bMirrored;
55 SdrGrafObjGeoData()
56 : bMirrored(false)
61 class GraphicObject;
62 class SdrGraphicLink;
64 /**
65 * This class represents an embedded or linked bitmap graphic object.
67 class SVXCORE_DLLPUBLIC SdrGrafObj final : public SdrRectObj
69 private:
70 // to allow sdr::properties::GraphicProperties access to SetXPolyDirty()
71 friend class sdr::properties::GraphicProperties;
73 // to allow sdr::contact::ViewObjectContactOfGraphic access to ImpUpdateGraphicLink()
74 friend class sdr::contact::ViewObjectContactOfGraphic;
75 friend class SdrExchangeView; // Only for a ForceSwapIn() call.
76 friend class SdrGraphicLink;
78 virtual std::unique_ptr<sdr::contact::ViewContact> CreateObjectSpecificViewContact() override;
79 virtual std::unique_ptr<sdr::properties::BaseProperties> CreateObjectSpecificProperties() override;
81 void ImpSetAttrToGrafInfo(); // Copy values from the pool
82 GraphicAttr aGrafInfo;
84 OUString aFileName; // If it's a Link, the filename can be found in here
85 OUString aFilterName;
86 std::unique_ptr<GraphicObject> mpGraphicObject; // In order to speed up output of bitmaps, especially rotated ones
87 std::unique_ptr<GraphicObject> mpReplacementGraphicObject;
88 SdrGraphicLink* pGraphicLink; // And here a pointer for linked graphics
89 bool bMirrored:1; // True: the graphic is horizontal, which means it's mirrored along the y-axis
91 // Flag for allowing text animation. Default is true.
92 bool mbGrafAnimationAllowed:1;
94 bool mbIsSignatureLine;
95 OUString maSignatureLineId;
96 OUString maSignatureLineSuggestedSignerName;
97 OUString maSignatureLineSuggestedSignerTitle;
98 OUString maSignatureLineSuggestedSignerEmail;
99 OUString maSignatureLineSigningInstructions;
100 bool mbIsSignatureLineShowSignDate;
101 bool mbIsSignatureLineCanAddComment;
102 bool mbSignatureLineIsSigned;
103 css::uno::Reference<css::graphic::XGraphic> mpSignatureLineUnsignedGraphic;
105 std::unique_ptr<css::drawing::BarCode> mpBarCode;
106 void ImpRegisterLink();
107 void ImpDeregisterLink();
108 void ImpSetLinkedGraphic( const Graphic& rGraphic );
109 void onGraphicChanged();
110 GDIMetaFile GetMetaFile(GraphicType &rGraphicType) const;
112 // protected destructor
113 virtual ~SdrGrafObj() override;
115 public:
116 SdrGrafObj(SdrModel& rSdrModel);
117 // Copy constructor
118 SdrGrafObj(SdrModel& rSdrModel, SdrGrafObj const & rSource);
119 SdrGrafObj(
120 SdrModel& rSdrModel,
121 const Graphic& rGrf);
122 SdrGrafObj(
123 SdrModel& rSdrModel,
124 const Graphic& rGrf,
125 const tools::Rectangle& rRect);
127 void SetGraphicObject( const GraphicObject& rGrfObj );
128 const GraphicObject& GetGraphicObject(bool bForceSwapIn = false) const;
129 const GraphicObject* GetReplacementGraphicObject() const;
131 void NbcSetGraphic(const Graphic& rGrf);
132 void SetGraphic(const Graphic& rGrf);
133 const Graphic& GetGraphic() const;
135 Graphic GetTransformedGraphic( SdrGrafObjTransformsAttrs nTransformFlags = SdrGrafObjTransformsAttrs::ALL ) const;
137 GraphicType GetGraphicType() const;
139 GraphicAttr GetGraphicAttr( SdrGrafObjTransformsAttrs nTransformFlags = SdrGrafObjTransformsAttrs::ALL ) const;
141 // Keep ATM for SD.
142 bool IsAnimated() const;
143 bool IsEPS() const;
145 MapMode GetGrafPrefMapMode() const;
146 Size GetGrafPrefSize() const;
148 void SetGrafStreamURL( const OUString& rGraphicStreamURL );
149 OUString const & GetGrafStreamURL() const;
150 Size getOriginalSize() const;
152 private:
153 void ForceSwapIn() const;
155 public:
156 void SetGraphicLink(const OUString& rFileName);
157 void ReleaseGraphicLink();
158 bool IsLinkedGraphic() const;
160 const OUString& GetFileName() const { return aFileName;}
162 void StartAnimation();
164 virtual void TakeObjInfo(SdrObjTransformInfoRec& rInfo) const override;
165 virtual SdrObjKind GetObjIdentifier() const override;
167 virtual OUString TakeObjNameSingul() const override;
168 virtual OUString TakeObjNamePlural() const override;
170 virtual rtl::Reference<SdrObject> CloneSdrObject(SdrModel& rTargetModel) const override;
172 virtual sal_uInt32 GetHdlCount() const override;
173 virtual void AddToHdlList(SdrHdlList& rHdlList) const override;
175 virtual void NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact) override;
176 virtual void NbcMirror(const Point& rRef1, const Point& rRef2) override;
177 virtual std::unique_ptr<SdrObjGeoData> NewGeoData() const override;
178 virtual void SaveGeoData(SdrObjGeoData& rGeo) const override;
179 virtual void RestoreGeoData(const SdrObjGeoData& rGeo) override;
181 bool HasGDIMetaFile() const;
183 // react on model/page change
184 virtual void handlePageChange(SdrPage* pOldPage, SdrPage* pNewPage) override;
186 bool isEmbeddedVectorGraphicData() const;
187 GDIMetaFile getMetafileFromEmbeddedVectorGraphicData() const;
189 virtual rtl::Reference<SdrObject> DoConvertToPolyObj(bool bBezier, bool bAddText) const override;
191 virtual void AdjustToMaxRect( const tools::Rectangle& rMaxRect, bool bShrinkOnly = false ) override;
193 virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override;
195 bool IsMirrored() const { return bMirrored;}
196 void SetMirrored( bool _bMirrored );
198 virtual bool shouldKeepAspectRatio() const override { return true; }
200 // Access to GrafAnimationAllowed flag
201 void SetGrafAnimationAllowed(bool bNew);
203 css::uno::Reference< css::io::XInputStream > getInputStream() const;
205 // #i103116# FullDrag support
206 virtual rtl::Reference<SdrObject> getFullDragClone() const override;
208 // add handles for crop mode when selected
209 virtual void addCropHandles(SdrHdlList& rTarget) const override;
211 // Signature Line
212 void setIsSignatureLine(bool bIsSignatureLine) { mbIsSignatureLine = bIsSignatureLine; }
213 bool isSignatureLine() const { return mbIsSignatureLine; }
215 void setSignatureLineId(const OUString& rSignatureLineId)
217 maSignatureLineId = rSignatureLineId;
220 const OUString& getSignatureLineId() const { return maSignatureLineId; }
222 void setSignatureLineSuggestedSignerName(const OUString& rSuggestedSignerName)
224 maSignatureLineSuggestedSignerName = rSuggestedSignerName;
227 const OUString& getSignatureLineSuggestedSignerName() const
229 return maSignatureLineSuggestedSignerName;
232 void setSignatureLineSuggestedSignerTitle(const OUString& rSuggestedSignerTitle)
234 maSignatureLineSuggestedSignerTitle = rSuggestedSignerTitle;
237 const OUString& getSignatureLineSuggestedSignerTitle() const
239 return maSignatureLineSuggestedSignerTitle;
242 void setSignatureLineSuggestedSignerEmail(const OUString& rSuggestedSignerEmail)
244 maSignatureLineSuggestedSignerEmail = rSuggestedSignerEmail;
246 const OUString& getSignatureLineSuggestedSignerEmail() const
248 return maSignatureLineSuggestedSignerEmail;
251 void setSignatureLineSigningInstructions(const OUString& rSigningInstructions)
253 maSignatureLineSigningInstructions = rSigningInstructions;
256 const OUString& getSignatureLineSigningInstructions() const
258 return maSignatureLineSigningInstructions;
261 void setSignatureLineShowSignDate(bool bIsSignatureLineShowSignDate)
263 mbIsSignatureLineShowSignDate = bIsSignatureLineShowSignDate;
266 bool isSignatureLineShowSignDate() const { return mbIsSignatureLineShowSignDate; }
268 void setSignatureLineCanAddComment(bool bIsSignatureCanAddComment)
270 mbIsSignatureLineCanAddComment = bIsSignatureCanAddComment;
273 bool isSignatureLineCanAddComment() const { return mbIsSignatureLineCanAddComment; }
275 css::uno::Reference<css::graphic::XGraphic> const & getSignatureLineUnsignedGraphic() const
277 return mpSignatureLineUnsignedGraphic;
280 void setSignatureLineUnsignedGraphic(css::uno::Reference<css::graphic::XGraphic> rGraphic)
282 mpSignatureLineUnsignedGraphic = rGraphic;
285 bool isSignatureLineSigned() const { return mbSignatureLineIsSigned; }
287 void setSignatureLineIsSigned(bool bIsSigned) { mbSignatureLineIsSigned = bIsSigned; }
289 // Qr Code
290 void setQrCode(css::drawing::BarCode& rBarCode)
292 mpBarCode = std::make_unique<css::drawing::BarCode>(rBarCode);
295 css::drawing::BarCode* getQrCode() const
297 return mpBarCode.get();
301 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */