LibreOffice Module svx (master) 1
svdograf.hxx
Go to the documentation of this file.
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#pragma once
21
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>
30#include <memory>
31
32namespace sdr::properties { class GraphicProperties; }
33namespace sdr::contact { class ViewObjectContactOfGraphic; }
34
39{
40 NONE = 0x00,
41 MIRROR = 0x01,
42 ROTATE = 0x02,
43 ALL = 0x03,
44};
45namespace o3tl
46{
47 template<> struct typed_flags<SdrGrafObjTransformsAttrs> : is_typed_flags<SdrGrafObjTransformsAttrs, 0x03> {};
48}
49
51{
52public:
54
56 : bMirrored(false)
57 {
58 }
59};
60
61class GraphicObject;
62class SdrGraphicLink;
63
68{
69private:
70 // to allow sdr::properties::GraphicProperties access to SetXPolyDirty()
72
73 // to allow sdr::contact::ViewObjectContactOfGraphic access to ImpUpdateGraphicLink()
75 friend class SdrExchangeView; // Only for a ForceSwapIn() call.
76 friend class SdrGraphicLink;
77
78 virtual std::unique_ptr<sdr::contact::ViewContact> CreateObjectSpecificViewContact() override;
79 virtual std::unique_ptr<sdr::properties::BaseProperties> CreateObjectSpecificProperties() override;
80
81 void ImpSetAttrToGrafInfo(); // Copy values from the pool
83
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
90
91 // Flag for allowing text animation. Default is true.
93
103 css::uno::Reference<css::graphic::XGraphic> mpSignatureLineUnsignedGraphic;
104
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;
111
112 // protected destructor
113 virtual ~SdrGrafObj() override;
114
115public:
116 SdrGrafObj(SdrModel& rSdrModel);
117 // Copy constructor
118 SdrGrafObj(SdrModel& rSdrModel, SdrGrafObj const & rSource);
120 SdrModel& rSdrModel,
121 const Graphic& rGrf);
123 SdrModel& rSdrModel,
124 const Graphic& rGrf,
125 const tools::Rectangle& rRect);
126
127 void SetGraphicObject( const GraphicObject& rGrfObj );
128 const GraphicObject& GetGraphicObject(bool bForceSwapIn = false) const;
129 const GraphicObject* GetReplacementGraphicObject() const;
130
131 void NbcSetGraphic(const Graphic& rGrf);
132 void SetGraphic(const Graphic& rGrf);
133 const Graphic& GetGraphic() const;
134
135 Graphic GetTransformedGraphic( SdrGrafObjTransformsAttrs nTransformFlags = SdrGrafObjTransformsAttrs::ALL ) const;
136
137 GraphicType GetGraphicType() const;
138
139 GraphicAttr GetGraphicAttr( SdrGrafObjTransformsAttrs nTransformFlags = SdrGrafObjTransformsAttrs::ALL ) const;
140
141 // Keep ATM for SD.
142 bool IsAnimated() const;
143 bool IsEPS() const;
144
145 MapMode GetGrafPrefMapMode() const;
146 Size GetGrafPrefSize() const;
147
148 void SetGrafStreamURL( const OUString& rGraphicStreamURL );
149 OUString const & GetGrafStreamURL() const;
150 Size getOriginalSize() const;
151
152private:
153 void ForceSwapIn() const;
154
155public:
156 void SetGraphicLink(const OUString& rFileName);
157 void ReleaseGraphicLink();
158 bool IsLinkedGraphic() const;
159
160 const OUString& GetFileName() const { return aFileName;}
161
162 void StartAnimation();
163
164 virtual void TakeObjInfo(SdrObjTransformInfoRec& rInfo) const override;
165 virtual SdrObjKind GetObjIdentifier() const override;
166
167 virtual OUString TakeObjNameSingul() const override;
168 virtual OUString TakeObjNamePlural() const override;
169
170 virtual rtl::Reference<SdrObject> CloneSdrObject(SdrModel& rTargetModel) const override;
171
172 virtual sal_uInt32 GetHdlCount() const override;
173 virtual void AddToHdlList(SdrHdlList& rHdlList) const override;
174
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;
180
181 bool HasGDIMetaFile() const;
182
183 // react on model/page change
184 virtual void handlePageChange(SdrPage* pOldPage, SdrPage* pNewPage) override;
185
186 bool isEmbeddedVectorGraphicData() const;
187 GDIMetaFile getMetafileFromEmbeddedVectorGraphicData() const;
188
189 virtual rtl::Reference<SdrObject> DoConvertToPolyObj(bool bBezier, bool bAddText) const override;
190
191 virtual void AdjustToMaxRect( const tools::Rectangle& rMaxRect, bool bShrinkOnly = false ) override;
192
193 virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override;
194
195 bool IsMirrored() const { return bMirrored;}
196 void SetMirrored( bool _bMirrored );
197
198 virtual bool shouldKeepAspectRatio() const override { return true; }
199
200 // Access to GrafAnimationAllowed flag
201 void SetGrafAnimationAllowed(bool bNew);
202
203 css::uno::Reference< css::io::XInputStream > getInputStream() const;
204
205 // #i103116# FullDrag support
206 virtual rtl::Reference<SdrObject> getFullDragClone() const override;
207
208 // add handles for crop mode when selected
209 virtual void addCropHandles(SdrHdlList& rTarget) const override;
210
211 // Signature Line
212 void setIsSignatureLine(bool bIsSignatureLine) { mbIsSignatureLine = bIsSignatureLine; }
213 bool isSignatureLine() const { return mbIsSignatureLine; }
214
215 void setSignatureLineId(const OUString& rSignatureLineId)
216 {
217 maSignatureLineId = rSignatureLineId;
218 }
219
220 const OUString& getSignatureLineId() const { return maSignatureLineId; }
221
222 void setSignatureLineSuggestedSignerName(const OUString& rSuggestedSignerName)
223 {
224 maSignatureLineSuggestedSignerName = rSuggestedSignerName;
225 }
226
228 {
229 return maSignatureLineSuggestedSignerName;
230 }
231
232 void setSignatureLineSuggestedSignerTitle(const OUString& rSuggestedSignerTitle)
233 {
234 maSignatureLineSuggestedSignerTitle = rSuggestedSignerTitle;
235 }
236
238 {
239 return maSignatureLineSuggestedSignerTitle;
240 }
241
242 void setSignatureLineSuggestedSignerEmail(const OUString& rSuggestedSignerEmail)
243 {
244 maSignatureLineSuggestedSignerEmail = rSuggestedSignerEmail;
245 }
247 {
248 return maSignatureLineSuggestedSignerEmail;
249 }
250
251 void setSignatureLineSigningInstructions(const OUString& rSigningInstructions)
252 {
253 maSignatureLineSigningInstructions = rSigningInstructions;
254 }
255
257 {
258 return maSignatureLineSigningInstructions;
259 }
260
261 void setSignatureLineShowSignDate(bool bIsSignatureLineShowSignDate)
262 {
263 mbIsSignatureLineShowSignDate = bIsSignatureLineShowSignDate;
264 }
265
266 bool isSignatureLineShowSignDate() const { return mbIsSignatureLineShowSignDate; }
267
268 void setSignatureLineCanAddComment(bool bIsSignatureCanAddComment)
269 {
270 mbIsSignatureLineCanAddComment = bIsSignatureCanAddComment;
271 }
272
273 bool isSignatureLineCanAddComment() const { return mbIsSignatureLineCanAddComment; }
274
275 css::uno::Reference<css::graphic::XGraphic> const & getSignatureLineUnsignedGraphic() const
276 {
277 return mpSignatureLineUnsignedGraphic;
278 }
279
280 void setSignatureLineUnsignedGraphic(css::uno::Reference<css::graphic::XGraphic> rGraphic)
281 {
282 mpSignatureLineUnsignedGraphic = rGraphic;
283 }
284
285 bool isSignatureLineSigned() const { return mbSignatureLineIsSigned; }
286
287 void setSignatureLineIsSigned(bool bIsSigned) { mbSignatureLineIsSigned = bIsSigned; }
288
289 // Qr Code
290 void setQrCode(css::drawing::BarCode& rBarCode)
291 {
292 mpBarCode = std::make_unique<css::drawing::BarCode>(rBarCode);
293 }
294
295 css::drawing::BarCode* getQrCode() const
296 {
297 return mpBarCode.get();
298 }
299};
300
301/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
This class represents an embedded or linked bitmap graphic object.
Definition: svdograf.hxx:68
void setSignatureLineSuggestedSignerEmail(const OUString &rSuggestedSignerEmail)
Definition: svdograf.hxx:242
void setSignatureLineSigningInstructions(const OUString &rSigningInstructions)
Definition: svdograf.hxx:251
void setIsSignatureLine(bool bIsSignatureLine)
Definition: svdograf.hxx:212
OUString maSignatureLineSigningInstructions
Definition: svdograf.hxx:99
OUString maSignatureLineId
Definition: svdograf.hxx:95
css::uno::Reference< css::graphic::XGraphic > const & getSignatureLineUnsignedGraphic() const
Definition: svdograf.hxx:275
bool mbGrafAnimationAllowed
Definition: svdograf.hxx:92
void setSignatureLineIsSigned(bool bIsSigned)
Definition: svdograf.hxx:287
bool mbSignatureLineIsSigned
Definition: svdograf.hxx:102
void setSignatureLineId(const OUString &rSignatureLineId)
Definition: svdograf.hxx:215
bool isSignatureLineSigned() const
Definition: svdograf.hxx:285
bool mbIsSignatureLineShowSignDate
Definition: svdograf.hxx:100
const OUString & GetFileName() const
Definition: svdograf.hxx:160
void setSignatureLineShowSignDate(bool bIsSignatureLineShowSignDate)
Definition: svdograf.hxx:261
OUString aFilterName
Definition: svdograf.hxx:85
void setSignatureLineCanAddComment(bool bIsSignatureCanAddComment)
Definition: svdograf.hxx:268
std::unique_ptr< GraphicObject > mpReplacementGraphicObject
Definition: svdograf.hxx:87
OUString maSignatureLineSuggestedSignerEmail
Definition: svdograf.hxx:98
bool isSignatureLine() const
Definition: svdograf.hxx:213
void setSignatureLineUnsignedGraphic(css::uno::Reference< css::graphic::XGraphic > rGraphic)
Definition: svdograf.hxx:280
bool isSignatureLineShowSignDate() const
Definition: svdograf.hxx:266
void setSignatureLineSuggestedSignerName(const OUString &rSuggestedSignerName)
Definition: svdograf.hxx:222
const OUString & getSignatureLineSuggestedSignerTitle() const
Definition: svdograf.hxx:237
OUString maSignatureLineSuggestedSignerTitle
Definition: svdograf.hxx:97
const OUString & getSignatureLineSuggestedSignerName() const
Definition: svdograf.hxx:227
std::unique_ptr< GraphicObject > mpGraphicObject
Definition: svdograf.hxx:86
const OUString & getSignatureLineId() const
Definition: svdograf.hxx:220
bool bMirrored
Definition: svdograf.hxx:89
OUString aFileName
Definition: svdograf.hxx:84
bool mbIsSignatureLine
Definition: svdograf.hxx:94
bool IsMirrored() const
Definition: svdograf.hxx:195
virtual bool shouldKeepAspectRatio() const override
Whether the aspect ratio should be kept by default when resizing.
Definition: svdograf.hxx:198
SdrGraphicLink * pGraphicLink
Definition: svdograf.hxx:88
OUString maSignatureLineSuggestedSignerName
Definition: svdograf.hxx:96
std::unique_ptr< css::drawing::BarCode > mpBarCode
Definition: svdograf.hxx:105
const OUString & getSignatureLineSigningInstructions() const
Definition: svdograf.hxx:256
css::uno::Reference< css::graphic::XGraphic > mpSignatureLineUnsignedGraphic
Definition: svdograf.hxx:103
GraphicAttr aGrafInfo
Definition: svdograf.hxx:82
css::drawing::BarCode * getQrCode() const
Definition: svdograf.hxx:295
bool isSignatureLineCanAddComment() const
Definition: svdograf.hxx:273
void setQrCode(css::drawing::BarCode &rBarCode)
Definition: svdograf.hxx:290
const OUString & getSignatureLineSuggestedSignerEmail() const
Definition: svdograf.hxx:246
bool mbIsSignatureLineCanAddComment
Definition: svdograf.hxx:101
void setSignatureLineSuggestedSignerTitle(const OUString &rSuggestedSignerTitle)
Definition: svdograf.hxx:232
All geometrical data of an arbitrary object for use in undo/redo.
Definition: svdobj.hxx:171
Provides information about various ZObject properties.
Definition: svdobj.hxx:193
virtual void AdjustToMaxRect(const tools::Rectangle &rMaxRect, bool bShrinkOnly=false)
Definition: svdobj.cxx:1680
virtual void addCropHandles(SdrHdlList &rTarget) const
Definition: svdobj.cxx:1215
A SdrPage contains exactly one SdrObjList and a description of the physical page dimensions (size / m...
Definition: svdpage.hxx:377
Rectangle objects (rectangle, circle, ...)
Definition: svdorect.hxx:39
virtual std::unique_ptr< sdr::properties::BaseProperties > CreateObjectSpecificProperties() override
Definition: svdorect.cxx:39
virtual void NbcResize(const Point &rRef, const Fraction &xFact, const Fraction &yFact) override
Definition: svdorect.cxx:451
virtual rtl::Reference< SdrObject > DoConvertToPolyObj(bool bBezier, bool bAddText) const override
Definition: svdorect.cxx:527
virtual sal_uInt32 GetHdlCount() const override
Via GetHdlCount the number of Handles can be retrieved.
Definition: svdorect.cxx:281
virtual SdrObjKind GetObjIdentifier() const override
Definition: svdorect.cxx:171
virtual OUString TakeObjNamePlural() const override
Definition: svdorect.cxx:226
virtual rtl::Reference< SdrObject > CloneSdrObject(SdrModel &rTargetModel) const override
Definition: svdorect.cxx:247
virtual void TakeObjInfo(SdrObjTransformInfoRec &rInfo) const override
Definition: svdorect.cxx:145
virtual void AddToHdlList(SdrHdlList &rHdlList) const override
Definition: svdorect.cxx:286
virtual void Notify(SfxBroadcaster &rBC, const SfxHint &rHint) override
Detects when a stylesheet is changed.
Definition: svdorect.cxx:555
virtual OUString TakeObjNameSingul() const override
Definition: svdorect.cxx:200
virtual void RestoreGeoData(const SdrObjGeoData &rGeo) override
Definition: svdorect.cxx:561
virtual std::unique_ptr< sdr::contact::ViewContact > CreateObjectSpecificViewContact() override
Definition: svdorect.cxx:47
virtual void NbcMirror(const Point &rRef1, const Point &rRef2) override
Definition: svdorect.cxx:469
virtual std::unique_ptr< SdrObjGeoData > NewGeoData() const override
A derived class must override these 3 methods if it has own geometric data that must be saved for Und...
Definition: svdotext.cxx:1395
virtual void SaveGeoData(SdrObjGeoData &rGeo) const override
Definition: svdotext.cxx:1400
SVX_DLLPRIVATE void ImpDeregisterLink()
Definition: svdotxln.cxx:266
SVX_DLLPRIVATE void ImpRegisterLink()
Definition: svdotxln.cxx:254
virtual void handlePageChange(SdrPage *pOldPage, SdrPage *pNewPage) override
Definition: svdotext.cxx:474
virtual rtl::Reference< SdrObject > getFullDragClone() const override
Definition: svdotext.cxx:2033
GraphicType
NONE
void SetMirrored(tools::Long &nPageLeftMargin, tools::Long &nPageRightMargin, tools::Long &nPageTopMargin, tools::Long &nPageBottomMargin, bool &bMirrored)
SdrObjKind
Definition: svdobjkind.hxx:25
SdrGrafObjTransformsAttrs
Options for GetTransformedGraphic()
Definition: svdograf.hxx:39
#define SVXCORE_DLLPUBLIC
Definition: svxdllapi.h:35