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