LibreOffice Module svx (master)  1
svdograf.cxx
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 #include <unotools/streamwrap.hxx>
21 
22 #include <sfx2/lnkbase.hxx>
23 #include <tools/helpers.hxx>
24 #include <tools/stream.hxx>
25 #include <sot/exchange.hxx>
26 #include <sot/formats.hxx>
27 #include <vcl/GraphicObject.hxx>
28 #include <vcl/svapp.hxx>
29 
30 #include <sfx2/linkmgr.hxx>
31 #include <svx/dialmgr.hxx>
32 #include <svx/strings.hrc>
33 #include <svx/svdhdl.hxx>
34 #include <svx/svdmodel.hxx>
35 #include <svx/svdpage.hxx>
36 #include <svx/svdograf.hxx>
37 #include <svx/svdogrp.hxx>
38 #include <svx/xbtmpit.hxx>
39 #include <svx/xfillit0.hxx>
40 #include <svx/xflbmtit.hxx>
41 #include "svdfmtf.hxx"
42 #include <sdgcoitm.hxx>
43 #include <svx/sdgcpitm.hxx>
44 #include <svx/sdggaitm.hxx>
45 #include <sdginitm.hxx>
46 #include <svx/sdgluitm.hxx>
47 #include <svx/sdgmoitm.hxx>
48 #include <sdgtritm.hxx>
54 #include <memory>
55 
56 using namespace ::com::sun::star;
57 using namespace ::com::sun::star::uno;
58 using namespace ::com::sun::star::io;
59 
61 {
63 
64 public:
65  explicit SdrGraphicLink(SdrGrafObj& rObj);
66 
67  virtual void Closed() override;
68 
69  virtual ::sfx2::SvBaseLink::UpdateResult DataChanged(
70  const OUString& rMimeType, const css::uno::Any & rValue ) override;
71 
72  void Connect() { GetRealObject(); }
73 };
74 
77 , rGrafObj( rObj )
78 {
79  SetSynchron( false );
80 }
81 
83  const OUString& rMimeType, const css::uno::Any & rValue )
84 {
86  sfx2::LinkManager* pLinkManager(rModel.GetLinkManager());
87 
88  if( pLinkManager && rValue.hasValue() )
89  {
91 
92  Graphic aGraphic;
93  if (sfx2::LinkManager::GetGraphicFromAny(rMimeType, rValue, rGrafObj.aReferer, aGraphic, nullptr))
94  {
95  rGrafObj.ImpSetLinkedGraphic(aGraphic);
96  }
98  {
99  // broadcasting, to update slide sorter
101  }
102  }
103  return SUCCESS;
104 }
105 
107 {
108  // close connection; set pLink of the object to NULL, as link instance is just about getting destructed.
110  rGrafObj.pGraphicLink=nullptr;
112  SvBaseLink::Closed();
113 }
114 
115 std::unique_ptr<sdr::properties::BaseProperties> SdrGrafObj::CreateObjectSpecificProperties()
116 {
117  return std::make_unique<sdr::properties::GraphicProperties>(*this);
118 }
119 
120 
121 // DrawContact section
122 
123 std::unique_ptr<sdr::contact::ViewContact> SdrGrafObj::CreateObjectSpecificViewContact()
124 {
125  return std::make_unique<sdr::contact::ViewContactOfGraphic>(*this);
126 }
127 
128 
129 // check if SVG and if try to get ObjectInfoPrimitive2D and extract info
130 
132 {
133  if (!mpGraphicObject || !mpGraphicObject->GetGraphic().isAvailable())
134  return;
135 
136  const VectorGraphicDataPtr& rVectorGraphicDataPtr = mpGraphicObject->GetGraphic().getVectorGraphicData();
137 
138  if (!rVectorGraphicDataPtr.get())
139  return;
140 
141  // Skip for PDF as it is only a bitmap primitive in a sequence and
142  // doesn't contain metadata. However getting the primitive sequence
143  // will also trigger a premature rendering of the PDF.
144  if (rVectorGraphicDataPtr->getVectorGraphicDataType() == VectorGraphicDataType::Pdf)
145  return;
146 
147  const drawinglayer::primitive2d::Primitive2DContainer aSequence(rVectorGraphicDataPtr->getPrimitive2DSequence());
148 
149  if (aSequence.empty())
150  return;
151 
153  drawinglayer::processor2d::ObjectInfoPrimitiveExtractor2D aProcessor(aViewInformation2D);
154 
155  aProcessor.process(aSequence);
156 
157  const drawinglayer::primitive2d::ObjectInfoPrimitive2D* pResult = aProcessor.getResult();
158 
159  if (!pResult)
160  return;
161 
162  OUString aName = pResult->getName();
163  OUString aTitle = pResult->getTitle();
164  OUString aDesc = pResult->getDesc();
165 
166  if(!aName.isEmpty())
167  {
168  SetName(aName);
169  }
170 
171  if(!aTitle.isEmpty())
172  {
173  SetTitle(aTitle);
174  }
175 
176  if(!aDesc.isEmpty())
177  {
178  SetDescription(aDesc);
179  }
180 }
181 
183 : SdrRectObj(rSdrModel)
184  ,mpGraphicObject(new GraphicObject)
185  ,pGraphicLink(nullptr)
186  ,bMirrored(false)
187  ,mbIsSignatureLine(false)
188  ,mbIsSignatureLineShowSignDate(true)
189  ,mbIsSignatureLineCanAddComment(false)
190  ,mbSignatureLineIsSigned(false)
191 {
193 
194  // #i118485# Shear allowed and possible now
195  bNoShear = false;
196 
197  mbGrafAnimationAllowed = true;
198 
199  // #i25616#
201 
202  // #i25616#
204 }
205 
207  SdrModel& rSdrModel,
208  const Graphic& rGraphic,
209  const tools::Rectangle& rRect)
210 : SdrRectObj(rSdrModel, rRect)
211  ,mpGraphicObject(new GraphicObject(rGraphic))
212  ,pGraphicLink(nullptr)
213  ,bMirrored(false)
214  ,mbIsSignatureLine(false)
215  ,mbIsSignatureLineShowSignDate(true)
216  ,mbIsSignatureLineCanAddComment(false)
217  ,mbSignatureLineIsSigned(false)
218 {
220 
221  // #i118485# Shear allowed and possible now
222  bNoShear = false;
223 
224  mbGrafAnimationAllowed = true;
225 
226  // #i25616#
228 
229  // #i25616#
231 }
232 
234  SdrModel& rSdrModel,
235  const Graphic& rGraphic)
236 : SdrRectObj(rSdrModel)
237  ,mpGraphicObject(new GraphicObject(rGraphic))
238  ,pGraphicLink(nullptr)
239  ,bMirrored(false)
240  ,mbIsSignatureLine(false)
241  ,mbIsSignatureLineShowSignDate(true)
242  ,mbIsSignatureLineCanAddComment(false)
243  ,mbSignatureLineIsSigned(false)
244 {
246 
247  // #i118485# Shear allowed and possible now
248  bNoShear = false;
249 
250  mbGrafAnimationAllowed = true;
251 
252  // #i25616#
254 
255  // #i25616#
257 }
258 
260 {
262 }
263 
264 void SdrGrafObj::SetGraphicObject(const GraphicObject& rGraphicObject)
265 {
266  mpGraphicObject.reset(new GraphicObject(rGraphicObject));
268  mpGraphicObject->SetUserData();
269  SetChanged();
272 }
273 
274 const GraphicObject& SdrGrafObj::GetGraphicObject(bool bForceSwapIn) const
275 {
276  if (bForceSwapIn)
277  ForceSwapIn();
278  return *mpGraphicObject;
279 }
280 
282 {
284  {
285  const VectorGraphicDataPtr& rVectorGraphicDataPtr = mpGraphicObject->GetGraphic().getVectorGraphicData();
286 
287  if (rVectorGraphicDataPtr.get())
288  {
289  const_cast< SdrGrafObj* >(this)->mpReplacementGraphicObject.reset(new GraphicObject(rVectorGraphicDataPtr->getReplacement()));
290  }
291  else if (mpGraphicObject->GetGraphic().GetType() == GraphicType::GdiMetafile)
292  {
293  // Replacement graphic for PDF and metafiles is just the bitmap.
294  const_cast<SdrGrafObj*>(this)->mpReplacementGraphicObject.reset(new GraphicObject(mpGraphicObject->GetGraphic().GetBitmapEx()));
295  }
296  }
297 
298  return mpReplacementGraphicObject.get();
299 }
300 
301 void SdrGrafObj::NbcSetGraphic(const Graphic& rGraphic)
302 {
303  mpGraphicObject->SetGraphic(rGraphic);
305  mpGraphicObject->SetUserData();
307 }
308 
309 void SdrGrafObj::SetGraphic( const Graphic& rGraphic )
310 {
311  if (!rGraphic.getOriginURL().isEmpty())
312  {
314  aFileName = rGraphic.getOriginURL();
315  aReferer = "";
316  aFilterName = "";
317  }
318  NbcSetGraphic(rGraphic);
319  if (!rGraphic.getOriginURL().isEmpty())
320  {
321  ImpRegisterLink();
322  mpGraphicObject->SetUserData();
323  }
324  SetChanged();
326  ForceSwapIn();
327 }
328 
330 {
331  return mpGraphicObject->GetGraphic();
332 }
333 
335 {
336  // Refactored most of the code to GraphicObject, where
337  // everybody can use e.g. the cropping functionality
338  MapMode aDestMap(
339  getSdrModelFromSdrObject().GetScaleUnit(),
340  Point(),
341  getSdrModelFromSdrObject().GetScaleFraction(),
342  getSdrModelFromSdrObject().GetScaleFraction());
343  const Size aDestSize( GetLogicRect().GetSize() );
344  GraphicAttr aActAttr = GetGraphicAttr(nTransformFlags);
345 
346  // Delegate to moved code in GraphicObject
347  return GetGraphicObject().GetTransformedGraphic( aDestSize, aDestMap, aActAttr );
348 }
349 
351 {
352  return mpGraphicObject->GetType();
353 }
354 
356 {
357  GraphicAttr aActAttr;
358 
360  if( SdrGrafObjTransformsAttrs::NONE != nTransformFlags &&
361  GraphicType::NONE != eType )
362  {
363  const bool bMirror = bool( nTransformFlags & SdrGrafObjTransformsAttrs::MIRROR );
364  const bool bRotate = bool( nTransformFlags & SdrGrafObjTransformsAttrs::ROTATE ) &&
365  (aGeo.nRotationAngle && aGeo.nRotationAngle != 18000);
366 
367  // Need cropping info earlier
368  const_cast<SdrGrafObj*>(this)->ImpSetAttrToGrafInfo();
369 
370  // Actually transform the graphic only in this case.
371  // Cropping always happens, though.
372  aActAttr = aGrafInfo;
373 
374  if( bMirror )
375  {
376  sal_uInt16 nMirrorCase = ( aGeo.nRotationAngle == 18000 ) ? ( bMirrored ? 3 : 4 ) : ( bMirrored ? 2 : 1 );
377  bool bHMirr = nMirrorCase == 2 || nMirrorCase == 4;
378  bool bVMirr = nMirrorCase == 3 || nMirrorCase == 4;
379 
380  aActAttr.SetMirrorFlags( ( bHMirr ? BmpMirrorFlags::Horizontal : BmpMirrorFlags::NONE ) | ( bVMirr ? BmpMirrorFlags::Vertical : BmpMirrorFlags::NONE ) );
381  }
382 
383  if( bRotate )
384  aActAttr.SetRotation( sal_uInt16(aGeo.nRotationAngle / 10) );
385  }
386 
387  return aActAttr;
388 }
389 
391 {
392  return mpGraphicObject->IsAnimated();
393 }
394 
395 bool SdrGrafObj::IsEPS() const
396 {
397  return mpGraphicObject->IsEPS();
398 }
399 
401 {
402  return mpGraphicObject->GetPrefMapMode();
403 }
404 
406 {
407  return mpGraphicObject->GetPrefSize();
408 }
409 
410 void SdrGrafObj::SetGrafStreamURL( const OUString& rGraphicStreamURL )
411 {
412  if( rGraphicStreamURL.isEmpty() )
413  {
414  mpGraphicObject->SetUserData();
415  }
416  else if(getSdrModelFromSdrObject().IsSwapGraphics() )
417  {
418  mpGraphicObject->SetUserData( rGraphicStreamURL );
419  }
420 }
421 
422 OUString const & SdrGrafObj::GetGrafStreamURL() const
423 {
424  return mpGraphicObject->GetUserData();
425 }
426 
428 {
429  Size aSize = GetGrafPrefSize();
430 
431  if (aGrafInfo.IsCropped())
432  {
437  const long aCroppedWidth(aSize.getWidth() - aCroppedLeft + aCroppedRight);
438  const long aCroppedHeight(aSize.getHeight() - aCroppedTop + aCroppedBottom);
439 
440  aSize = Size ( aCroppedWidth, aCroppedHeight);
441  }
442 
443  if ( GetGrafPrefMapMode().GetMapUnit() == MapUnit::MapPixel )
444  aSize = Application::GetDefaultDevice()->PixelToLogic(aSize, MapMode(getSdrModelFromSdrObject().GetScaleUnit()));
445  else
447 
448  return aSize;
449 }
450 
451 // TODO Remove
453 {
454  if (pGraphicLink && (mpGraphicObject->GetType() == GraphicType::NONE ||
455  mpGraphicObject->GetType() == GraphicType::Default) )
456  {
457  pGraphicLink->Update();
458  }
459 }
460 
462 {
463  sfx2::LinkManager* pLinkManager(getSdrModelFromSdrObject().GetLinkManager());
464 
465  if( pLinkManager != nullptr && pGraphicLink == nullptr )
466  {
467  if (!aFileName.isEmpty())
468  {
469  pGraphicLink = new SdrGraphicLink( *this );
470  pLinkManager->InsertFileLink(
471  *pGraphicLink, OBJECT_CLIENT_GRF, aFileName, (aFilterName.isEmpty() ? nullptr : &aFilterName));
473  }
474  }
475 }
476 
478 {
479  sfx2::LinkManager* pLinkManager(getSdrModelFromSdrObject().GetLinkManager());
480 
481  if( pLinkManager != nullptr && pGraphicLink!=nullptr)
482  {
483  // When using Remove, the *pGraphicLink is implicitly deleted
484  pLinkManager->Remove( pGraphicLink );
485  pGraphicLink=nullptr;
486  }
487 }
488 
489 void SdrGrafObj::SetGraphicLink(const OUString& rFileName, const OUString& /*rReferer*/, const OUString& /*rFilterName*/)
490 {
491  Graphic aGraphic;
492  aGraphic.setOriginURL(rFileName);
493  SetGraphic(aGraphic);
494 }
495 
497 {
499  aFileName.clear();
500  aReferer.clear();
501  aFilterName.clear();
502 }
503 
505 {
506  return !mpGraphicObject->GetGraphic().getOriginURL().isEmpty();
507 }
508 
510 {
511  bool bNoPresGrf = ( mpGraphicObject->GetType() != GraphicType::NONE ) && !bEmptyPresObj;
512 
513  rInfo.bResizeFreeAllowed = aGeo.nRotationAngle % 9000 == 0 ||
514  aGeo.nRotationAngle % 18000 == 0 ||
515  aGeo.nRotationAngle % 27000 == 0;
516 
517  rInfo.bResizePropAllowed = true;
518  rInfo.bRotateFreeAllowed = bNoPresGrf;
519  rInfo.bRotate90Allowed = bNoPresGrf;
520  rInfo.bMirrorFreeAllowed = bNoPresGrf;
521  rInfo.bMirror45Allowed = bNoPresGrf;
523  rInfo.bTransparenceAllowed = false;
524 
525  // #i118485# Shear allowed and possible now
526  rInfo.bShearAllowed = true;
527 
528  rInfo.bEdgeRadiusAllowed=false;
529  rInfo.bCanConvToPath = !IsEPS();
530  rInfo.bCanConvToPathLineToArea = false;
531  rInfo.bCanConvToPolyLineToArea = false;
532  rInfo.bCanConvToPoly = !IsEPS();
534 }
535 
537 {
538  return sal_uInt16( OBJ_GRAF );
539 }
540 
542 {
543  const bool bIsChanged(getSdrModelFromSdrObject().IsChanged());
544  NbcSetGraphic( rGraphic );
545  ActionChanged();
547  getSdrModelFromSdrObject().SetChanged(bIsChanged);
548 }
549 
551 {
552  if (!mpGraphicObject)
553  return OUString();
554 
555  const VectorGraphicDataPtr& rVectorGraphicDataPtr = mpGraphicObject->GetGraphic().getVectorGraphicData();
556 
557  OUStringBuffer sName;
558 
559  if(rVectorGraphicDataPtr.get())
560  {
561  switch (rVectorGraphicDataPtr->getVectorGraphicDataType())
562  {
563  case VectorGraphicDataType::Wmf:
564  {
565  sName.append(SvxResId(STR_ObjNameSingulGRAFWMF));
566  break;
567  }
568  case VectorGraphicDataType::Emf:
569  {
570  sName.append(SvxResId(STR_ObjNameSingulGRAFEMF));
571  break;
572  }
573  default: // case VectorGraphicDataType::Svg:
574  {
575  sName.append(SvxResId(STR_ObjNameSingulGRAFSVG));
576  break;
577  }
578  }
579  }
580  else
581  {
582  switch( mpGraphicObject->GetType() )
583  {
584  case GraphicType::Bitmap:
585  {
586  const char* pId = ( ( mpGraphicObject->IsTransparent() || GetObjectItem( SDRATTR_GRAFTRANSPARENCE ).GetValue() ) ?
587  ( IsLinkedGraphic() ? STR_ObjNameSingulGRAFBMPTRANSLNK : STR_ObjNameSingulGRAFBMPTRANS ) :
588  ( IsLinkedGraphic() ? STR_ObjNameSingulGRAFBMPLNK : STR_ObjNameSingulGRAFBMP ) );
589 
590  sName.append(SvxResId(pId));
591  }
592  break;
593 
594  case GraphicType::GdiMetafile:
595  sName.append(SvxResId(IsLinkedGraphic() ? STR_ObjNameSingulGRAFMTFLNK : STR_ObjNameSingulGRAFMTF));
596  break;
597 
598  case GraphicType::NONE:
599  sName.append(SvxResId(IsLinkedGraphic() ? STR_ObjNameSingulGRAFNONELNK : STR_ObjNameSingulGRAFNONE));
600  break;
601 
602  default:
603  sName.append(SvxResId(IsLinkedGraphic() ? STR_ObjNameSingulGRAFLNK : STR_ObjNameSingulGRAF));
604  break;
605  }
606  }
607 
608  const OUString aName(GetName());
609 
610  if (!aName.isEmpty())
611  {
612  sName.append(" '");
613  sName.append(aName);
614  sName.append('\'' );
615  }
616 
617  return sName.makeStringAndClear();
618 }
619 
621 {
622  if (!mpGraphicObject)
623  return OUString();
624 
625  const VectorGraphicDataPtr& rVectorGraphicDataPtr = mpGraphicObject->GetGraphic().getVectorGraphicData();
626 
627  OUStringBuffer sName;
628 
629  if(rVectorGraphicDataPtr.get())
630  {
631  switch (rVectorGraphicDataPtr->getVectorGraphicDataType())
632  {
633  case VectorGraphicDataType::Wmf:
634  {
635  sName.append(SvxResId(STR_ObjNamePluralGRAFWMF));
636  break;
637  }
638  case VectorGraphicDataType::Emf:
639  {
640  sName.append(SvxResId(STR_ObjNamePluralGRAFEMF));
641  break;
642  }
643  default: // case VectorGraphicDataType::Svg:
644  {
645  sName.append(SvxResId(STR_ObjNamePluralGRAFSVG));
646  break;
647  }
648  }
649  }
650  else
651  {
652  switch(mpGraphicObject->GetType())
653  {
654  case GraphicType::Bitmap:
655  {
656  const char* pId = ( ( mpGraphicObject->IsTransparent() || GetObjectItem( SDRATTR_GRAFTRANSPARENCE ).GetValue() ) ?
657  ( IsLinkedGraphic() ? STR_ObjNamePluralGRAFBMPTRANSLNK : STR_ObjNamePluralGRAFBMPTRANS ) :
658  ( IsLinkedGraphic() ? STR_ObjNamePluralGRAFBMPLNK : STR_ObjNamePluralGRAFBMP ) );
659 
660  sName.append(SvxResId(pId));
661  }
662  break;
663 
664  case GraphicType::GdiMetafile:
665  sName.append(SvxResId(IsLinkedGraphic() ? STR_ObjNamePluralGRAFMTFLNK : STR_ObjNamePluralGRAFMTF));
666  break;
667 
668  case GraphicType::NONE:
669  sName.append(SvxResId(IsLinkedGraphic() ? STR_ObjNamePluralGRAFNONELNK : STR_ObjNamePluralGRAFNONE));
670  break;
671 
672  default:
673  sName.append(SvxResId(IsLinkedGraphic() ? STR_ObjNamePluralGRAFLNK : STR_ObjNamePluralGRAF));
674  break;
675  }
676  }
677 
678  const OUString aName(GetName());
679 
680  if (!aName.isEmpty())
681  {
682  sName.append(" '");
683  sName.append(aName);
684  sName.append('\'');
685  }
686 
687  return sName.makeStringAndClear();
688 }
689 
691 {
692  // call parent
694 
695  // #i103116# the full drag clone leads to problems
696  // with linked graphics, so reset the link in this
697  // temporary interaction object and load graphic
698  if(pRetval && IsLinkedGraphic())
699  {
700  static_cast< SdrGrafObj* >(pRetval.get())->ReleaseGraphicLink();
701  }
702 
703  return pRetval;
704 }
705 
707 {
708  return CloneHelper< SdrGrafObj >(rTargetModel);
709 }
710 
712 {
713  if( this == &rObj )
714  return *this;
715  SdrRectObj::operator=( rObj );
716 
717  aFileName = rObj.aFileName;
718  aFilterName = rObj.aFilterName;
719  bMirrored = rObj.bMirrored;
720 
729  mbSignatureLineIsSigned = false;
731 
732  if(rObj.mpQrCode)
733  {
734  mpQrCode = std::make_unique<css::drawing::QRCode>(*rObj.mpQrCode);
735  }
736  else
737  {
738  mpQrCode.reset();
739  }
740 
743  else
744  mpGraphicObject->SetGraphic( rObj.GetGraphic(), &rObj.GetGraphicObject() );
745 
746  if( rObj.IsLinkedGraphic() )
747  {
749  }
750 
752  return *this;
753 }
754 
755 sal_uInt32 SdrGrafObj::GetHdlCount() const
756 {
757  return 8;
758 }
759 
761 {
762  SdrHdlList tempList(nullptr);
763  SdrRectObj::AddToHdlList( tempList );
764  tempList.RemoveHdl(0);
765  tempList.MoveTo(rHdlList);
766 }
767 
768 void SdrGrafObj::NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact)
769 {
770  SdrRectObj::NbcResize( rRef, xFact, yFact );
771 
772  bool bMirrX = xFact.GetNumerator() < 0;
773  bool bMirrY = yFact.GetNumerator() < 0;
774 
775  if( bMirrX != bMirrY )
776  bMirrored = !bMirrored;
777 }
778 
779 void SdrGrafObj::NbcMirror(const Point& rRef1, const Point& rRef2)
780 {
781  SdrRectObj::NbcMirror(rRef1,rRef2);
782  bMirrored = !bMirrored;
783 }
784 
786 {
787  return new SdrGrafObjGeoData;
788 }
789 
791 {
793  SdrGrafObjGeoData& rGGeo=static_cast<SdrGrafObjGeoData&>(rGeo);
794  rGGeo.bMirrored=bMirrored;
795 }
796 
798 {
800  const SdrGrafObjGeoData& rGGeo=static_cast<const SdrGrafObjGeoData&>(rGeo);
801  bMirrored=rGGeo.bMirrored;
802 }
803 
804 void SdrGrafObj::handlePageChange(SdrPage* pOldPage, SdrPage* pNewPage)
805 {
806  const bool bRemove(pNewPage == nullptr && pOldPage != nullptr);
807  const bool bInsert(pNewPage != nullptr && pOldPage == nullptr);
808 
809  if( bRemove )
810  {
811  // No SwapIn necessary here, because if something's not loaded, it can't be animated either.
812  if( mpGraphicObject->IsAnimated())
813  mpGraphicObject->StopAnimation();
814 
815  if( pGraphicLink != nullptr )
817  }
818 
819  // call parent
820  SdrRectObj::handlePageChange(pOldPage, pNewPage);
821 
822  if (!aFileName.isEmpty() && bInsert)
823  {
824  ImpRegisterLink();
825  }
826 }
827 
829 {
831 }
832 
834 {
835  return( mpGraphicObject->GetType() == GraphicType::GdiMetafile );
836 }
837 
839 {
840  return GraphicType::Bitmap == GetGraphicType() && GetGraphic().getVectorGraphicData().get();
841 }
842 
844 {
845  GDIMetaFile aRetval;
846 
848  {
850  const tools::Rectangle aBoundRect(GetCurrentBoundRect());
851  const MapMode aMap(
852  getSdrModelFromSdrObject().GetScaleUnit(),
853  Point(),
854  getSdrModelFromSdrObject().GetScaleFraction(),
855  getSdrModelFromSdrObject().GetScaleFraction());
856 
857  pOut->EnableOutput(false);
858  pOut->SetMapMode(aMap);
859  aRetval.Record(pOut);
860  SingleObjectPainter(*pOut);
861  aRetval.Stop();
862  aRetval.WindStart();
863  aRetval.Move(-aBoundRect.Left(), -aBoundRect.Top());
864  aRetval.SetPrefMapMode(aMap);
865  aRetval.SetPrefSize(aBoundRect.GetSize());
866  }
867 
868  return aRetval;
869 }
870 
872 {
874  {
875  // Embedded Vector Graphic Data
876  // There is currently no helper to create SdrObjects from primitives (even if I'm thinking
877  // about writing one for some time). To get the roundtrip to SdrObjects it is necessary to
878  // use the old converter path over the MetaFile mechanism. Create Metafile from Svg
879  // primitives here pretty directly
880  rGraphicType = GraphicType::GdiMetafile;
882  }
883  else if (GraphicType::GdiMetafile == rGraphicType)
884  {
886  }
887  return GDIMetaFile();
888 }
889 
891 {
892  return mpGraphicObject->GetGraphic().getPageNumber();
893 }
894 
895 SdrObjectUniquePtr SdrGrafObj::DoConvertToPolyObj(bool bBezier, bool bAddText ) const
896 {
897  SdrObject* pRetval = nullptr;
898  GraphicType aGraphicType(GetGraphicType());
899  GDIMetaFile aMtf(GetMetaFile(aGraphicType));
900  switch(aGraphicType)
901  {
902  case GraphicType::GdiMetafile:
903  {
904  // Sort into group and return ONLY those objects that can be created from the MetaFile.
905  ImpSdrGDIMetaFileImport aFilter(
907  GetLayer(),
908  maRect);
910 
911  if(aFilter.DoImport(aMtf, *pGrp->GetSubList(), 0))
912  {
913  {
914  // copy transformation
915  GeoStat aGeoStat(GetGeoStat());
916 
917  if(aGeoStat.nShearAngle)
918  {
919  aGeoStat.RecalcTan();
920  pGrp->NbcShear(maRect.TopLeft(), aGeoStat.nShearAngle, aGeoStat.nTan, false);
921  }
922 
923  if(aGeoStat.nRotationAngle)
924  {
925  aGeoStat.RecalcSinCos();
926  pGrp->NbcRotate(maRect.TopLeft(), aGeoStat.nRotationAngle, aGeoStat.nSin, aGeoStat.nCos);
927  }
928  }
929 
930  pRetval = pGrp;
931  pGrp->NbcSetLayer(GetLayer());
932 
933  if(bAddText)
934  {
935  pRetval = ImpConvertAddText(SdrObjectUniquePtr(pRetval), bBezier).release();
936  }
937 
938  // convert all children
939  if( pRetval )
940  {
941  SdrObject* pHalfDone = pRetval;
942  pRetval = pRetval->DoConvertToPolyObj(bBezier, bAddText).release();
943  SdrObject::Free( pHalfDone ); // resulting object is newly created
944 
945  if( pRetval )
946  {
947  // flatten subgroups. As we call
948  // DoConvertToPolyObj() on the resulting group
949  // objects, subgroups can exist (e.g. text is
950  // a group object for every line).
951  SdrObjList* pList = pRetval->GetSubList();
952  if( pList )
953  pList->FlattenGroups();
954  }
955  }
956  }
957  else
958  {
959  // always use SdrObject::Free(...) for SdrObjects (!)
960  SdrObject* pTemp(pGrp);
961  SdrObject::Free(pTemp);
962  }
963 
964  // #i118485# convert line and fill
965  SdrObjectUniquePtr pLineFill = SdrRectObj::DoConvertToPolyObj(bBezier, false);
966 
967  if(pLineFill)
968  {
969  if(pRetval)
970  {
971  pGrp = dynamic_cast< SdrObjGroup* >(pRetval);
972 
973  if(!pGrp)
974  {
976  pGrp->NbcSetLayer(GetLayer());
977  pGrp->GetSubList()->NbcInsertObject(pRetval);
978  }
979 
980  pGrp->GetSubList()->NbcInsertObject(pLineFill.release(), 0);
981  }
982  else
983  {
984  pRetval = pLineFill.release();
985  }
986  }
987 
988  break;
989  }
990  case GraphicType::Bitmap:
991  {
992  // create basic object and add fill
993  pRetval = SdrRectObj::DoConvertToPolyObj(bBezier, bAddText).release();
994 
995  // save bitmap as an attribute
996  if(pRetval)
997  {
998  // retrieve bitmap for the fill
1000 
1001  aSet.Put(XFillStyleItem(drawing::FillStyle_BITMAP));
1002  const BitmapEx aBitmapEx(GetTransformedGraphic().GetBitmapEx());
1003  aSet.Put(XFillBitmapItem(OUString(), Graphic(aBitmapEx)));
1004  aSet.Put(XFillBmpTileItem(false));
1005 
1006  pRetval->SetMergedItemSet(aSet);
1007  }
1008  break;
1009  }
1010  case GraphicType::NONE:
1011  case GraphicType::Default:
1012  {
1013  pRetval = SdrRectObj::DoConvertToPolyObj(bBezier, bAddText).release();
1014  break;
1015  }
1016  }
1017 
1018  return SdrObjectUniquePtr(pRetval);
1019 }
1020 
1021 void SdrGrafObj::Notify( SfxBroadcaster& rBC, const SfxHint& rHint )
1022 {
1023  SetXPolyDirty();
1024  SdrRectObj::Notify( rBC, rHint );
1026 }
1027 
1028 
1029 void SdrGrafObj::SetMirrored( bool _bMirrored )
1030 {
1031  bMirrored = _bMirrored;
1032 }
1033 
1035 {
1036  const SfxItemSet& rSet = GetObjectItemSet();
1037  const sal_uInt16 nTrans = rSet.Get( SDRATTR_GRAFTRANSPARENCE ).GetValue();
1038  const SdrGrafCropItem& rCrop = rSet.Get( SDRATTR_GRAFCROP );
1039 
1040  aGrafInfo.SetLuminance( rSet.Get( SDRATTR_GRAFLUMINANCE ).GetValue() );
1041  aGrafInfo.SetContrast( rSet.Get( SDRATTR_GRAFCONTRAST ).GetValue() );
1042  aGrafInfo.SetChannelR( rSet.Get( SDRATTR_GRAFRED ).GetValue() );
1043  aGrafInfo.SetChannelG( rSet.Get( SDRATTR_GRAFGREEN ).GetValue() );
1044  aGrafInfo.SetChannelB( rSet.Get( SDRATTR_GRAFBLUE ).GetValue() );
1045  aGrafInfo.SetGamma( rSet.Get( SDRATTR_GRAFGAMMA ).GetValue() * 0.01 );
1046  aGrafInfo.SetTransparency( static_cast<sal_uInt8>(FRound( std::min( nTrans, sal_uInt16(100) ) * 2.55 )) );
1047  aGrafInfo.SetInvert( rSet.Get( SDRATTR_GRAFINVERT ).GetValue() );
1048  aGrafInfo.SetDrawMode( rSet.Get( SDRATTR_GRAFMODE ).GetValue() );
1049  aGrafInfo.SetCrop( rCrop.GetLeft(), rCrop.GetTop(), rCrop.GetRight(), rCrop.GetBottom() );
1050 
1051  SetXPolyDirty();
1052  SetRectsDirty();
1053 }
1054 
1055 void SdrGrafObj::AdjustToMaxRect( const tools::Rectangle& rMaxRect, bool bShrinkOnly )
1056 {
1057  Size aSize;
1058  Size aMaxSize( rMaxRect.GetSize() );
1059  if (mpGraphicObject->GetPrefMapMode().GetMapUnit() == MapUnit::MapPixel)
1060  aSize = Application::GetDefaultDevice()->PixelToLogic(mpGraphicObject->GetPrefSize(), MapMode(MapUnit::Map100thMM));
1061  else
1062  aSize = OutputDevice::LogicToLogic( mpGraphicObject->GetPrefSize(),
1063  mpGraphicObject->GetPrefMapMode(),
1064  MapMode( MapUnit::Map100thMM ) );
1065 
1066  if( aSize.Height() != 0 && aSize.Width() != 0 )
1067  {
1068  Point aPos( rMaxRect.TopLeft() );
1069 
1070  // if the graphic is too large, fit it to page
1071  if ( (!bShrinkOnly ||
1072  ( aSize.Height() > aMaxSize.Height() ) ||
1073  ( aSize.Width() > aMaxSize.Width() ) )&&
1074  aSize.Height() && aMaxSize.Height() )
1075  {
1076  float fGrfWH = static_cast<float>(aSize.Width()) /
1077  static_cast<float>(aSize.Height());
1078  float fWinWH = static_cast<float>(aMaxSize.Width()) /
1079  static_cast<float>(aMaxSize.Height());
1080 
1081  // Scale graphic to page size
1082  if ( fGrfWH < fWinWH )
1083  {
1084  aSize.setWidth( static_cast<long>(aMaxSize.Height() * fGrfWH) );
1085  aSize.setHeight( aMaxSize.Height() );
1086  }
1087  else if ( fGrfWH > 0.F )
1088  {
1089  aSize.setWidth( aMaxSize.Width() );
1090  aSize.setHeight( static_cast<long>(aMaxSize.Width() / fGrfWH) );
1091  }
1092 
1093  aPos = rMaxRect.Center();
1094  }
1095 
1096  if( bShrinkOnly )
1097  aPos = maRect.TopLeft();
1098 
1099  aPos.AdjustX( -(aSize.Width() / 2) );
1100  aPos.AdjustY( -(aSize.Height() / 2) );
1101  SetLogicRect( tools::Rectangle( aPos, aSize ) );
1102  }
1103 }
1104 
1106 {
1107  if(mbGrafAnimationAllowed != bNew)
1108  {
1109  mbGrafAnimationAllowed = bNew;
1110  ActionChanged();
1111  }
1112 }
1113 
1115 {
1117 
1118  if (mpGraphicObject && GetGraphic().IsGfxLink())
1119  {
1120  Graphic aGraphic( GetGraphic() );
1121  GfxLink aLink( aGraphic.GetGfxLink() );
1122  sal_uInt32 nSize = aLink.GetDataSize();
1123  const void* pSourceData = static_cast<const void*>(aLink.GetData());
1124  if( nSize && pSourceData )
1125  {
1126  sal_uInt8 * pBuffer = new sal_uInt8[ nSize ];
1127  memcpy( pBuffer, pSourceData, nSize );
1128 
1129  SvMemoryStream* pStream = new SvMemoryStream( static_cast<void*>(pBuffer), static_cast<std::size_t>(nSize), StreamMode::READ );
1130  pStream->ObjectOwnsMemory( true );
1131  xStream.set( new utl::OInputStreamWrapper( pStream, true ) );
1132  }
1133  }
1134 
1135  if (!xStream.is() && !aFileName.isEmpty())
1136  {
1137  SvFileStream* pStream = new SvFileStream( aFileName, StreamMode::READ );
1138  xStream.set( new utl::OInputStreamWrapper( pStream ) );
1139  }
1140 
1141  return xStream;
1142 }
1143 
1144 // moved crop handle creation here; this is the object type using them
1146 {
1147  basegfx::B2DHomMatrix aMatrix;
1148  basegfx::B2DPolyPolygon aPolyPolygon;
1149 
1150  // get object transformation
1151  TRGetBaseGeometry(aMatrix, aPolyPolygon);
1152 
1153  // part of object transformation correction, but used later, so defined outside next scope
1154  double fShearX(0.0), fRotate(0.0);
1155 
1156  { // TTTT correct shear, it comes currently mirrored from TRGetBaseGeometry, can be removed with aw080
1157  basegfx::B2DTuple aScale;
1158  basegfx::B2DTuple aTranslate;
1159 
1160  aMatrix.decompose(aScale, aTranslate, fRotate, fShearX);
1161 
1162  if(!basegfx::fTools::equalZero(fShearX))
1163  {
1164  // shearX is used, correct it
1165  fShearX = -fShearX;
1166  }
1167 
1169  aScale,
1170  fShearX,
1171  fRotate,
1172  aTranslate);
1173  }
1174 
1175  // get crop values
1176  const SdrGrafCropItem& rCrop = GetMergedItem(SDRATTR_GRAFCROP);
1177 
1178  if(rCrop.GetLeft() || rCrop.GetTop() || rCrop.GetRight() ||rCrop.GetBottom())
1179  {
1180  // decompose object transformation to have current translate and scale
1181  basegfx::B2DVector aScale, aTranslate;
1182  double fLclRotate, fLclShearX;
1183 
1184  aMatrix.decompose(aScale, aTranslate, fLclRotate, fLclShearX);
1185 
1186  if(!aScale.equalZero())
1187  {
1188  // get crop scale
1189  const basegfx::B2DVector aCropScaleFactor(
1190  GetGraphicObject().calculateCropScaling(
1191  aScale.getX(),
1192  aScale.getY(),
1193  rCrop.GetLeft(),
1194  rCrop.GetTop(),
1195  rCrop.GetRight(),
1196  rCrop.GetBottom()));
1197 
1198  // apply crop scale
1199  const double fCropLeft(rCrop.GetLeft() * aCropScaleFactor.getX());
1200  const double fCropTop(rCrop.GetTop() * aCropScaleFactor.getY());
1201  const double fCropRight(rCrop.GetRight() * aCropScaleFactor.getX());
1202  const double fCropBottom(rCrop.GetBottom() * aCropScaleFactor.getY());
1203  basegfx::B2DHomMatrix aMatrixForCropViewHdl(aMatrix);
1204 
1205  if(IsMirrored())
1206  {
1207  // create corrected new matrix, TTTT can be removed with aw080
1208  // the old mirror only can mirror horizontally; the vertical mirror
1209  // is faked by using the horizontal and 180 degree rotation. Since
1210  // the object can be rotated differently from 180 degree, this is
1211  // not safe to detect. Just correct horizontal mirror (which is
1212  // in IsMirrored()) and keep the rotation angle
1213  // caution: Do not modify aMatrix, it is used below to calculate
1214  // the exact handle positions
1215  basegfx::B2DHomMatrix aPreMultiply;
1216 
1217  // mirrored X, apply
1218  aPreMultiply.translate(-0.5, 0.0);
1219  aPreMultiply.scale(-1.0, 1.0);
1220  aPreMultiply.translate(0.5, 0.0);
1221 
1222  aMatrixForCropViewHdl = aMatrixForCropViewHdl * aPreMultiply;
1223  }
1224 
1225  rTarget.AddHdl(
1226  std::make_unique<SdrCropViewHdl>(
1227  aMatrixForCropViewHdl,
1229  fCropLeft,
1230  fCropTop,
1231  fCropRight,
1232  fCropBottom));
1233  }
1234  }
1235 
1236  basegfx::B2DPoint aPos;
1237 
1238  aPos = aMatrix * basegfx::B2DPoint(0.0, 0.0);
1239  rTarget.AddHdl(std::make_unique<SdrCropHdl>(Point(basegfx::fround(aPos.getX()), basegfx::fround(aPos.getY())), SdrHdlKind::UpperLeft, fShearX, fRotate));
1240  aPos = aMatrix * basegfx::B2DPoint(0.5, 0.0);
1241  rTarget.AddHdl(std::make_unique<SdrCropHdl>(Point(basegfx::fround(aPos.getX()), basegfx::fround(aPos.getY())), SdrHdlKind::Upper, fShearX, fRotate));
1242  aPos = aMatrix * basegfx::B2DPoint(1.0, 0.0);
1243  rTarget.AddHdl(std::make_unique<SdrCropHdl>(Point(basegfx::fround(aPos.getX()), basegfx::fround(aPos.getY())), SdrHdlKind::UpperRight, fShearX, fRotate));
1244  aPos = aMatrix * basegfx::B2DPoint(0.0, 0.5);
1245  rTarget.AddHdl(std::make_unique<SdrCropHdl>(Point(basegfx::fround(aPos.getX()), basegfx::fround(aPos.getY())), SdrHdlKind::Left , fShearX, fRotate));
1246  aPos = aMatrix * basegfx::B2DPoint(1.0, 0.5);
1247  rTarget.AddHdl(std::make_unique<SdrCropHdl>(Point(basegfx::fround(aPos.getX()), basegfx::fround(aPos.getY())), SdrHdlKind::Right, fShearX, fRotate));
1248  aPos = aMatrix * basegfx::B2DPoint(0.0, 1.0);
1249  rTarget.AddHdl(std::make_unique<SdrCropHdl>(Point(basegfx::fround(aPos.getX()), basegfx::fround(aPos.getY())), SdrHdlKind::LowerLeft, fShearX, fRotate));
1250  aPos = aMatrix * basegfx::B2DPoint(0.5, 1.0);
1251  rTarget.AddHdl(std::make_unique<SdrCropHdl>(Point(basegfx::fround(aPos.getX()), basegfx::fround(aPos.getY())), SdrHdlKind::Lower, fShearX, fRotate));
1252  aPos = aMatrix * basegfx::B2DPoint(1.0, 1.0);
1253  rTarget.AddHdl(std::make_unique<SdrCropHdl>(Point(basegfx::fround(aPos.getX()), basegfx::fround(aPos.getY())), SdrHdlKind::LowerRight, fShearX, fRotate));
1254 }
1255 
1256 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual void RestGeoData(const SdrObjGeoData &rGeo) override
Definition: svdograf.cxx:797
std::unique_ptr< SdrHdl > RemoveHdl(size_t nNum)
Definition: svdhdl.cxx:2234
#define SDRATTR_GRAFRED
Definition: svddef.hxx:313
Point TopLeft() const
virtual void AdjustToMaxRect(const tools::Rectangle &rMaxRect, bool bShrinkOnly=false) override
Definition: svdograf.cxx:1055
long Width() const
bool IsEPS() const
Definition: svdograf.cxx:395
void SetTransparency(sal_uInt8 cTransparency)
OUString aFilterName
Definition: svdograf.hxx:98
virtual SdrObjectUniquePtr DoConvertToPolyObj(bool bBezier, bool bAddText) const override
Definition: svdograf.cxx:895
void SetGamma(double fGamma)
OutlineText, special text object for StarDraw.
Definition: svdobj.hxx:136
bool mbIsSignatureLineCanAddComment
Definition: svdograf.hxx:114
GDIMetaFile getMetafileFromEmbeddedVectorGraphicData() const
Definition: svdograf.cxx:843
OUString maSignatureLineId
Definition: svdograf.hxx:108
virtual void addCropHandles(SdrHdlList &rTarget) const override
Definition: svdograf.cxx:1145
bool bEmptyPresObj
Definition: svdobj.hxx:937
const VectorGraphicDataPtr & getVectorGraphicData() const
void NbcSetGraphic(const Graphic &rGrf)
Definition: svdograf.cxx:301
virtual const tools::Rectangle & GetCurrentBoundRect() const
Definition: svdobj.cxx:853
void ImpRegisterLink()
Definition: svdograf.cxx:461
long FRound(double fVal)
virtual void NbcMirror(const Point &rRef1, const Point &rRef2) override
Definition: svdorect.cxx:484
friend class SdrGraphicLink
Definition: svdograf.hxx:88
Point LogicToLogic(const Point &rPtSource, const MapMode *pMapModeSource, const MapMode *pMapModeDest) const
#define SDRATTR_GRAFMODE
Definition: svddef.hxx:321
long Height() const
virtual void NbcResize(const Point &rRef, const Fraction &xFact, const Fraction &yFact) override
Definition: svdograf.cxx:768
double nSin
Definition: svdtrans.hxx:219
GeoStat aGeo
Definition: svdotext.hxx:185
#define SDRATTR_GRAFGAMMA
Definition: svddef.hxx:318
GDIMetaFile GetMetaFile(GraphicType &rGraphicType) const
Definition: svdograf.cxx:871
void SetMirrored(bool _bMirrored)
Definition: svdograf.cxx:1029
sal_Int32 getEmbeddedPageNumber() const
Returns the page number of the embedded data (typically to re-render or import it).
Definition: svdograf.cxx:890
void SetInvert(bool bInvert)
virtual void NbcInsertObject(SdrObject *pObj, size_t nPos=SAL_MAX_SIZE)
Definition: svdpage.cxx:300
long GetRightCrop() const
virtual void NbcSetLayer(SdrLayerID nLayer) override
Definition: svdogrp.cxx:149
virtual SdrObjectUniquePtr DoConvertToPolyObj(bool bBezier, bool bAddText) const
Definition: svdobj.cxx:2524
long nRotationAngle
Definition: svdtrans.hxx:216
double getX() const
GraphicType
void SetPrefSize(const Size &rSize)
Size getOriginalSize() const
Definition: svdograf.cxx:427
void SetMirrorFlags(BmpMirrorFlags nMirrFlags)
void setOriginURL(OUString const &rOriginURL)
double getY() const
SdrObjectUniquePtr ImpConvertAddText(SdrObjectUniquePtr pObj, bool bBezier) const
Definition: svdotxtr.cxx:463
OUString aFileName
Definition: svdograf.hxx:96
virtual void AddToHdlList(SdrHdlList &rHdlList) const override
Definition: svdograf.cxx:760
virtual void handlePageChange(SdrPage *pOldPage, SdrPage *pNewPage) override
Definition: svdograf.cxx:804
const GraphicObject & GetGraphicObject(bool bForceSwapIn=false) const
Definition: svdograf.cxx:274
#define SDRATTR_GRAFINVERT
Definition: svddef.hxx:320
std::unique_ptr< GraphicObject > mpGraphicObject
Definition: svdograf.hxx:99
#define SDRATTR_GRAFGREEN
Definition: svddef.hxx:314
static void Free(SdrObject *&_rpObject)
Definition: svdobj.cxx:395
long GetTopCrop() const
OUString maSignatureLineSuggestedSignerEmail
Definition: svdograf.hxx:111
void RecalcTan()
Definition: svdtrans.cxx:462
virtual SdrObjectUniquePtr getFullDragClone() const override
Definition: svdotext.cxx:2025
GraphicType GetGraphicType() const
Definition: svdograf.cxx:350
All geometrical data of an arbitrary object for use in undo/redo.
Definition: svdobj.hxx:226
void SetDrawMode(GraphicDrawMode eDrawMode)
virtual SdrObjList * GetSubList() const
Definition: svdobj.cxx:646
Graphic GetTransformedGraphic(const Size &rDestSize, const MapMode &rDestMap, const GraphicAttr &rAttr) const
Size GetGrafPrefSize() const
Definition: svdograf.cxx:405
virtual SdrObjectUniquePtr getFullDragClone() const override
Definition: svdograf.cxx:690
void ImpSetLinkedGraphic(const Graphic &rGraphic)
Definition: svdograf.cxx:541
Rectangle objects (rectangle, circle, ...)
Definition: svdorect.hxx:39
static OutputDevice * GetDefaultDevice()
HashMap_OWString_Interface aMap
Provides information about various ZObject properties.
Definition: svdobj.hxx:248
#define OBJECT_CLIENT_GRF
void ImpDeregisterLink()
Definition: svdograf.cxx:477
MapUnit GetScaleUnit() const
Definition: svdmodel.hxx:367
void Record(OutputDevice *pOutDev)
Reference< XInputStream > xStream
OUString SvxResId(const char *pId)
Definition: dialmgr.cxx:28
virtual void SaveGeoData(SdrObjGeoData &rGeo) const override
Definition: svdotext.cxx:1432
B2DHomMatrix createScaleShearXRotateTranslateB2DHomMatrix(double fScaleX, double fScaleY, double fShearX, double fRadiant, double fTranslateX, double fTranslateY)
virtual std::unique_ptr< sdr::contact::ViewContact > CreateObjectSpecificViewContact() override
Definition: svdograf.cxx:123
The transformation of a rectangle into a polygon, by using angle parameters from GeoStat.
Definition: svdtrans.hxx:214
void ForceSwapIn() const
Definition: svdograf.cxx:452
void SetGraphic(const Graphic &rGrf)
Definition: svdograf.cxx:309
virtual SdrObjectUniquePtr DoConvertToPolyObj(bool bBezier, bool bAddText) const override
Definition: svdorect.cxx:542
void SetGraphicObject(const GraphicObject &rGrfObj)
Definition: svdograf.cxx:264
virtual void Notify(SfxBroadcaster &rBC, const SfxHint &rHint) override
Detects when a stylesheet is changed.
Definition: svdograf.cxx:1021
const SfxItemSet & GetObjectItemSet() const
Definition: svdobj.cxx:1878
oslFileHandle & pOut
virtual OUString TakeObjNameSingul() const override
Definition: svdograf.cxx:550
tools::Rectangle maRect
Definition: svdotext.hxx:182
const GDIMetaFile & GetGDIMetaFile() const
void SetMergedItemSet(const SfxItemSet &rSet, bool bClearAllItems=false)
Definition: svdobj.cxx:1908
bool bNoShear
Definition: svdotext.hxx:232
void SetGrafStreamURL(const OUString &rGraphicStreamURL)
Definition: svdograf.cxx:410
long Top() const
SotClipboardFormatId
const GeoStat & GetGeoStat() const
Definition: svdotext.hxx:399
bool mbSignatureLineIsSigned
Definition: svdograf.hxx:115
virtual void SetChanged(bool bFlg=true)
Definition: svdmodel.cxx:1260
B2IRange fround(const B2DRange &rRange)
OUString maSignatureLineSigningInstructions
Definition: svdograf.hxx:112
DocumentType eType
const SfxPoolItem & GetObjectItem(const sal_uInt16 nWhich) const
Definition: svdobj.cxx:1913
virtual void SaveGeoData(SdrObjGeoData &rGeo) const override
Definition: svdograf.cxx:790
long GetLeftCrop() const
bool IsAnimated() const
Definition: svdograf.cxx:390
virtual void handlePageChange(SdrPage *pOldPage, SdrPage *pNewPage) override
Definition: svdotext.cxx:442
virtual void NbcShear(const Point &rRef, long nAngle, double tn, bool bVShear) override
Definition: svdogrp.cxx:451
Graphic GetTransformedGraphic(SdrGrafObjTransformsAttrs nTransformFlags=SdrGrafObjTransformsAttrs::ALL) const
Definition: svdograf.cxx:334
bool mbSupportTextIndentingOnLineWidthChange
Definition: svdobj.hxx:948
OUString maSignatureLineSuggestedSignerName
Definition: svdograf.hxx:109
double nCos
Definition: svdtrans.hxx:220
bool IsCropped() const
css::uno::Reference< css::graphic::XGraphic > mpSignatureLineUnsignedGraphic
Definition: svdograf.hxx:116
void MoveTo(SdrHdlList &rOther)
Definition: svdhdl.cxx:2328
void Remove(SvBaseLink const *pLink)
void SetContrast(short nContrastPercent)
void SingleObjectPainter(OutputDevice &rOut) const
Definition: svdobj.cxx:950
OUString sName
bool decompose(B2DTuple &rScale, B2DTuple &rTranslate, double &rRotate, double &rShearX) const
void SetCrop(long nLeft_100TH_MM, long nTop_100TH_MM, long nRight_100TH_MM, long nBottom_100TH_MM)
const GraphicObject * GetReplacementGraphicObject() const
Definition: svdograf.cxx:281
#define SDRATTR_GRAFCROP
Definition: svddef.hxx:322
const Graphic & GetGraphic() const
Definition: svdograf.cxx:329
void InsertFileLink(sfx2::SvBaseLink &, sal_uInt16 nFileType, const OUString &rFileNm, const OUString *pFilterNm=nullptr, const OUString *pRange=nullptr)
void SetGraphicLink(const OUString &rFileName, const OUString &rReferer, const OUString &rFilterName)
Definition: svdograf.cxx:489
void BroadcastObjectChange() const
Definition: svdobj.cxx:904
const primitive2d::ObjectInfoPrimitive2D * getResult() const
bool mbIsSignatureLine
Definition: svdograf.hxx:107
void ActionChanged() const
Definition: svdobj.cxx:256
double nTan
Definition: svdtrans.hxx:218
size_t DoImport(const GDIMetaFile &rMtf, SdrObjList &rDestList, size_t nInsPos, SvdProgressInfo *pProgrInfo=nullptr)
Definition: svdfmtf.cxx:210
virtual std::unique_ptr< sdr::properties::BaseProperties > CreateObjectSpecificProperties() override
Definition: svdograf.cxx:115
void SetChannelG(short nChannelGPercent)
static bool equalZero(const double &rfVal)
void SetXPolyDirty()
Definition: svdorect.cxx:93
virtual ~SdrGrafObj() override
Definition: svdograf.cxx:259
SdrGraphicLink * pGraphicLink
Definition: svdograf.hxx:101
virtual void NbcRotate(const Point &rRef, long nAngle, double sn, double cs) override
Definition: svdogrp.cxx:417
void scale(double fX, double fY)
SdrModel & getSdrModelFromSdrObject() const
Definition: svdobj.cxx:272
void onGraphicChanged()
Definition: svdograf.cxx:131
void process(const primitive2d::Primitive2DContainer &rSource)
virtual void SetLogicRect(const tools::Rectangle &rRect)
Definition: svdobj.cxx:1630
virtual SdrObjList * GetSubList() const override
Definition: svdogrp.cxx:169
OUString getOriginURL() const
MapUnit GetMapUnit() const
virtual void TakeObjInfo(SdrObjTransformInfoRec &rInfo) const override
Definition: svdograf.cxx:509
const SfxPoolItem & GetMergedItem(const sal_uInt16 nWhich) const
Definition: svdobj.cxx:1918
void SetChannelR(short nChannelRPercent)
void WindStart()
This class represents an embedded or linked bitmap graphic object.
Definition: svdograf.hxx:79
GfxLink GetGfxLink() const
SdrGrafObjTransformsAttrs
Options for GetTransformedGraphic()
Definition: svdograf.hxx:50
Abstract DrawObject.
Definition: svdobj.hxx:312
#define SDRATTR_GRAFBLUE
Definition: svddef.hxx:315
void SetGrafAnimationAllowed(bool bNew)
Definition: svdograf.cxx:1105
OUString GetName() const
Definition: svdobj.cxx:697
Size GetSize() const
long nShearAngle
Definition: svdtrans.hxx:217
void SetChannelB(short nChannelBPercent)
virtual SdrLayerID GetLayer() const
Definition: svdobj.cxx:576
Point PixelToLogic(const Point &rDevicePt) const
std::shared_ptr< VectorGraphicData > VectorGraphicDataPtr
css::uno::Reference< css::io::XInputStream > getInputStream() const
Definition: svdograf.cxx:1114
bool IsLinkedGraphic() const
Definition: svdograf.cxx:504
static bool GetDisplayNames(const SvBaseLink *, OUString *pType, OUString *pFile=nullptr, OUString *pLink=nullptr, OUString *pFilter=nullptr)
std::unique_ptr< css::drawing::QRCode > mpQrCode
Definition: svdograf.hxx:118
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
SdrRectObj & operator=(const SdrRectObj &rCopy)
Definition: svdorect.cxx:250
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
bool equalZero() const
unsigned char sal_uInt8
void RecalcSinCos()
Definition: svdtrans.cxx:450
#define SDRATTR_GRAFLUMINANCE
Definition: svddef.hxx:316
virtual void NbcResize(const Point &rRef, const Fraction &xFact, const Fraction &yFact) override
Definition: svdorect.cxx:466
virtual OUString TakeObjNamePlural() const override
Definition: svdograf.cxx:620
static SotClipboardFormatId GetFormatIdFromMimeType(const OUString &rMimeType)
void SetLuminance(short nLuminancePercent)
void Move(long nX, long nY)
OUString aName
std::unique_ptr< GraphicObject > mpReplacementGraphicObject
Definition: svdograf.hxx:100
void ObjectOwnsMemory(bool bOwn)
bool HasGDIMetaFile() const
Definition: svdograf.cxx:833
virtual SdrGrafObj * CloneSdrObject(SdrModel &rTargetModel) const override
Definition: svdograf.cxx:706
#define SDRATTR_GRAFTRANSPARENCE
Definition: svddef.hxx:319
void SetDescription(const OUString &rStr)
Definition: svdobj.cxx:751
SdrGrafObj(SdrModel &rSdrModel)
Definition: svdograf.cxx:182
OUString aReferer
Definition: svdograf.hxx:97
bool bMirrored
Definition: svdograf.hxx:102
sal_Int32 GetNumerator() const
std::unique_ptr< SdrObject, SdrObjectFreeOp > SdrObjectUniquePtr
Definition: svdobj.hxx:114
void ReleaseGraphicLink()
Definition: svdograf.cxx:496
long Left() const
void translate(double fX, double fY)
long GetBottomCrop() const
virtual void NbcMirror(const Point &rRef1, const Point &rRef2) override
Definition: svdograf.cxx:779
GraphicAttr aGrafInfo
Definition: svdograf.hxx:94
virtual void RestGeoData(const SdrObjGeoData &rGeo) override
Definition: svdorect.cxx:576
virtual void SetRectsDirty(bool bNotMyself=false, bool bRecursive=true)
Definition: svdobj.cxx:434
virtual void AddToHdlList(SdrHdlList &rHdlList) const override
Definition: svdorect.cxx:299
virtual 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: svdograf.cxx:785
bool IsMirrored() const
Definition: svdograf.hxx:211
#define SDRATTR_GRAFCONTRAST
Definition: svddef.hxx:317
virtual bool TRGetBaseGeometry(basegfx::B2DHomMatrix &rMatrix, basegfx::B2DPolyPolygon &rPolyPolygon) const override
Definition: svdotext.cxx:1577
bool LineGeometryUsageIsNecessary() const
Definition: svdobj.cxx:961
bool mbGrafAnimationAllowed
Definition: svdograf.hxx:105
SdrGrafObj & operator=(const SdrGrafObj &rObj)
Definition: svdograf.cxx:711
A SdrPage contains exactly one SdrObjList and a description of the physical page dimensions (size / m...
Definition: svdpage.hxx:366
void ImpSetAttrToGrafInfo()
Definition: svdograf.cxx:1034
long getHeight() const
static bool GetGraphicFromAny(const OUString &rMimeType, const css::uno::Any &rValue, const OUString &rReferer, Graphic &rGrf, weld::Window *pParentWin)
static SotClipboardFormatId RegisterStatusInfoId()
GraphicAttr GetGraphicAttr(SdrGrafObjTransformsAttrs nTransformFlags=SdrGrafObjTransformsAttrs::ALL) const
Definition: svdograf.cxx:355
virtual void SetChanged()
Definition: svdobj.cxx:928
long getWidth() const
void SetName(const OUString &rStr)
Definition: svdobj.cxx:663
void setWidth(long nWidth)
virtual sal_uInt16 GetObjIdentifier() const override
Definition: svdograf.cxx:536
bool isEmbeddedVectorGraphicData() const
Definition: svdograf.cxx:838
void SetTitle(const OUString &rStr)
Definition: svdobj.cxx:707
bool mbLineIsOutsideGeometry
Definition: svdobj.hxx:946
void SetRotation(sal_uInt16 nRotate10)
OUString const & GetGrafStreamURL() const
Definition: svdograf.cxx:422
OUString maSignatureLineSuggestedSignerTitle
Definition: svdograf.hxx:110
SfxLinkUpdateMode
MapMode GetGrafPrefMapMode() const
Definition: svdograf.cxx:400
Point Center() const
bool mbIsSignatureLineShowSignDate
Definition: svdograf.hxx:113
void AddHdl(std::unique_ptr< SdrHdl > pHdl)
Definition: svdhdl.cxx:2294
void FlattenGroups()
Makes the object list flat, i.e.
Definition: svdpage.cxx:796
virtual sal_uInt32 GetHdlCount() const override
Via GetHdlCount the number of Handles can be retrieved.
Definition: svdograf.cxx:755
void SetPrefMapMode(const MapMode &rMapMode)
void StartAnimation()
Definition: svdograf.cxx:828
virtual void Notify(SfxBroadcaster &rBC, const SfxHint &rHint) override
Detects when a stylesheet is changed.
Definition: svdorect.cxx:570
virtual const tools::Rectangle & GetLogicRect() const override
Definition: svdotxtr.cxx:69
void setHeight(long nHeight)