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