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