LibreOffice Module svx (master)  1
svdoashp.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 <svx/svdoashp.hxx>
21 #include <svx/unoapi.hxx>
22 #include <svx/unoshape.hxx>
23 #include <ucbhelper/content.hxx>
24 #include <unotools/datetime.hxx>
25 #include <sfx2/lnkbase.hxx>
26 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
27 #include <com/sun/star/loader/CannotActivateFactoryException.hpp>
28 #include <com/sun/star/drawing/XShape.hpp>
29 #include <com/sun/star/drawing/XCustomShapeEngine.hpp>
30 #include <com/sun/star/drawing/PolyPolygonBezierCoords.hpp>
31 #include <com/sun/star/beans/PropertyValue.hpp>
32 #include <com/sun/star/awt/Rectangle.hpp>
33 #include <com/sun/star/uno/XComponentContext.hpp>
36 #include <svl/urihelper.hxx>
37 #include <com/sun/star/uno/Sequence.h>
38 #include <svx/svdogrp.hxx>
39 #include <tools/helpers.hxx>
40 #include <svx/svddrag.hxx>
41 #include <svx/xpool.hxx>
42 #include <svx/xpoly.hxx>
43 #include <svx/svddrgmt.hxx>
44 #include <svx/svdmodel.hxx>
45 #include <svx/svdpage.hxx>
46 #include <svx/svditer.hxx>
47 #include <svx/svdobj.hxx>
48 #include <svx/svdtrans.hxx>
49 #include <svx/svdetc.hxx>
50 #include <svx/svdoedge.hxx>
51 #include <svx/dialmgr.hxx>
52 #include <svx/strings.hrc>
53 #include <editeng/eeitem.hxx>
54 #include <editeng/editstat.hxx>
55 #include <editeng/adjustitem.hxx>
56 #include <svx/svdoutl.hxx>
57 #include <editeng/outlobj.hxx>
58 #include <svx/sdtfchim.hxx>
62 #include <com/sun/star/beans/PropertyValues.hpp>
63 #include <com/sun/star/drawing/EnhancedCustomShapeAdjustmentValue.hpp>
64 #include <com/sun/star/drawing/EnhancedCustomShapeParameterPair.hpp>
65 #include <com/sun/star/drawing/EnhancedCustomShapeTextFrame.hpp>
66 #include <com/sun/star/drawing/EnhancedCustomShapeSegment.hpp>
67 #include <com/sun/star/drawing/EnhancedCustomShapeSegmentCommand.hpp>
69 #include <svx/xlineit0.hxx>
70 #include <svx/xlnclit.hxx>
71 #include <svx/svxids.hrc>
72 #include <svl/whiter.hxx>
75 #include <svx/xlntrit.hxx>
76 #include <svx/xfillit0.hxx>
77 #include <svx/xfltrit.hxx>
78 #include <svx/xflclit.hxx>
79 #include <svx/xflgrit.hxx>
80 #include <svx/xflhtit.hxx>
81 #include <svx/xbtmpit.hxx>
82 #include <vcl/bitmapaccess.hxx>
83 #include <vcl/virdev.hxx>
84 #include <svx/svdview.hxx>
85 #include <svx/sdmetitm.hxx>
86 #include <svx/sdprcitm.hxx>
87 #include <svx/sdshitm.hxx>
88 #include <svx/sdsxyitm.hxx>
89 #include <svx/sdtmfitm.hxx>
90 #include <svx/sdasitm.hxx>
94 #include <svdobjplusdata.hxx>
96 
97 using namespace ::com::sun::star;
98 using namespace ::com::sun::star::uno;
99 using namespace ::com::sun::star::lang;
100 using namespace ::com::sun::star::beans;
101 using namespace ::com::sun::star::drawing;
102 
103 static void lcl_ShapeSegmentFromBinary( EnhancedCustomShapeSegment& rSegInfo, sal_uInt16 nSDat )
104 {
105  switch( nSDat >> 8 )
106  {
107  case 0x00 :
108  rSegInfo.Command = EnhancedCustomShapeSegmentCommand::LINETO;
109  rSegInfo.Count = nSDat & 0xff;
110  if ( !rSegInfo.Count )
111  rSegInfo.Count = 1;
112  break;
113  case 0x20 :
114  rSegInfo.Command = EnhancedCustomShapeSegmentCommand::CURVETO;
115  rSegInfo.Count = nSDat & 0xff;
116  if ( !rSegInfo.Count )
117  rSegInfo.Count = 1;
118  break;
119  case 0x40 :
120  rSegInfo.Command = EnhancedCustomShapeSegmentCommand::MOVETO;
121  rSegInfo.Count = nSDat & 0xff;
122  if ( !rSegInfo.Count )
123  rSegInfo.Count = 1;
124  break;
125  case 0x60 :
126  rSegInfo.Command = EnhancedCustomShapeSegmentCommand::CLOSESUBPATH;
127  rSegInfo.Count = 0;
128  break;
129  case 0x80 :
130  rSegInfo.Command = EnhancedCustomShapeSegmentCommand::ENDSUBPATH;
131  rSegInfo.Count = 0;
132  break;
133  case 0xa1 :
134  rSegInfo.Command = EnhancedCustomShapeSegmentCommand::ANGLEELLIPSETO;
135  rSegInfo.Count = ( nSDat & 0xff ) / 3;
136  break;
137  case 0xa2 :
138  rSegInfo.Command = EnhancedCustomShapeSegmentCommand::ANGLEELLIPSE;
139  rSegInfo.Count = ( nSDat & 0xff ) / 3;
140  break;
141  case 0xa3 :
142  rSegInfo.Command = EnhancedCustomShapeSegmentCommand::ARCTO;
143  rSegInfo.Count = ( nSDat & 0xff ) >> 2;
144  break;
145  case 0xa4 :
146  rSegInfo.Command = EnhancedCustomShapeSegmentCommand::ARC;
147  rSegInfo.Count = ( nSDat & 0xff ) >> 2;
148  break;
149  case 0xa5 :
150  rSegInfo.Command = EnhancedCustomShapeSegmentCommand::CLOCKWISEARCTO;
151  rSegInfo.Count = ( nSDat & 0xff ) >> 2;
152  break;
153  case 0xa6 :
154  rSegInfo.Command = EnhancedCustomShapeSegmentCommand::CLOCKWISEARC;
155  rSegInfo.Count = ( nSDat & 0xff ) >> 2;
156  break;
157  case 0xa7 :
158  rSegInfo.Command = EnhancedCustomShapeSegmentCommand::ELLIPTICALQUADRANTX;
159  rSegInfo.Count = nSDat & 0xff;
160  break;
161  case 0xa8 :
162  rSegInfo.Command = EnhancedCustomShapeSegmentCommand::ELLIPTICALQUADRANTY;
163  rSegInfo.Count = nSDat & 0xff;
164  break;
165  case 0xaa :
166  rSegInfo.Command = EnhancedCustomShapeSegmentCommand::NOFILL;
167  rSegInfo.Count = 0;
168  break;
169  case 0xab :
170  rSegInfo.Command = EnhancedCustomShapeSegmentCommand::NOSTROKE;
171  rSegInfo.Count = 0;
172  break;
173  default:
174  case 0xf8 :
175  rSegInfo.Command = EnhancedCustomShapeSegmentCommand::UNKNOWN;
176  rSegInfo.Count = nSDat;
177  break;
178  }
179 }
180 
181 static MSO_SPT ImpGetCustomShapeType( const SdrObjCustomShape& rCustoShape )
182 {
183  MSO_SPT eRetValue = mso_sptNil;
184 
185  OUString aEngine( rCustoShape.GetMergedItem( SDRATTR_CUSTOMSHAPE_ENGINE ).GetValue() );
186  if ( aEngine.isEmpty() || aEngine == "com.sun.star.drawing.EnhancedCustomShapeEngine" )
187  {
188  OUString sShapeType;
189  const SdrCustomShapeGeometryItem& rGeometryItem( rCustoShape.GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY ) );
190  const Any* pAny = rGeometryItem.GetPropertyValueByName( "Type" );
191  if ( pAny && ( *pAny >>= sShapeType ) )
192  eRetValue = EnhancedCustomShapeTypeNames::Get( sShapeType );
193  }
194  return eRetValue;
195 };
196 
197 static bool ImpVerticalSwitch( const SdrObjCustomShape& rCustoShape )
198 {
199  bool bRet = false;
200  MSO_SPT eShapeType( ImpGetCustomShapeType( rCustoShape ) );
201  switch( eShapeType )
202  {
203  case mso_sptAccentBorderCallout90 : // 2 ortho
204  case mso_sptBorderCallout1 : // 2 diag
205  case mso_sptBorderCallout2 : // 3
206  {
207  bRet = true;
208  }
209  break;
210  default: break;
211  }
212  return bRet;
213 }
214 
215 // #i37011# create a clone with all attributes changed to shadow attributes
216 // and translation executed, too.
217 static SdrObject* ImpCreateShadowObjectClone(const SdrObject& rOriginal, const SfxItemSet& rOriginalSet)
218 {
219  SdrObject* pRetval = nullptr;
220  const bool bShadow(rOriginalSet.Get(SDRATTR_SHADOW).GetValue());
221 
222  if(bShadow)
223  {
224  // create a shadow representing object
225  const sal_Int32 nXDist(rOriginalSet.Get(SDRATTR_SHADOWXDIST).GetValue());
226  const sal_Int32 nYDist(rOriginalSet.Get(SDRATTR_SHADOWYDIST).GetValue());
227  const ::Color aShadowColor(rOriginalSet.Get(SDRATTR_SHADOWCOLOR).GetColorValue());
228  const sal_uInt16 nShadowTransparence(rOriginalSet.Get(SDRATTR_SHADOWTRANSPARENCE).GetValue());
229  pRetval = rOriginal.CloneSdrObject(rOriginal.getSdrModelFromSdrObject());
230  DBG_ASSERT(pRetval, "ImpCreateShadowObjectClone: Could not clone object (!)");
231 
232  // look for used stuff
233  SdrObjListIter aIterator(rOriginal);
234  bool bLineUsed(false);
235  bool bAllFillUsed(false);
236  bool bSolidFillUsed(false);
237  bool bGradientFillUsed(false);
238  bool bHatchFillUsed(false);
239  bool bBitmapFillUsed(false);
240 
241  while(aIterator.IsMore())
242  {
243  SdrObject* pObj = aIterator.Next();
244  drawing::FillStyle eFillStyle = pObj->GetMergedItem(XATTR_FILLSTYLE).GetValue();
245 
246  if(!bLineUsed)
247  {
248  drawing::LineStyle eLineStyle = pObj->GetMergedItem(XATTR_LINESTYLE).GetValue();
249 
250  if(drawing::LineStyle_NONE != eLineStyle)
251  {
252  bLineUsed = true;
253  }
254  }
255 
256  if(!bAllFillUsed)
257  {
258  if(!bSolidFillUsed && drawing::FillStyle_SOLID == eFillStyle)
259  {
260  bSolidFillUsed = true;
261  bAllFillUsed = (bSolidFillUsed && bGradientFillUsed && bHatchFillUsed && bBitmapFillUsed);
262  }
263  if(!bGradientFillUsed && drawing::FillStyle_GRADIENT == eFillStyle)
264  {
265  bGradientFillUsed = true;
266  bAllFillUsed = (bSolidFillUsed && bGradientFillUsed && bHatchFillUsed && bBitmapFillUsed);
267  }
268  if(!bHatchFillUsed && drawing::FillStyle_HATCH == eFillStyle)
269  {
270  bHatchFillUsed = true;
271  bAllFillUsed = (bSolidFillUsed && bGradientFillUsed && bHatchFillUsed && bBitmapFillUsed);
272  }
273  if(!bBitmapFillUsed && drawing::FillStyle_BITMAP == eFillStyle)
274  {
275  bBitmapFillUsed = true;
276  bAllFillUsed = (bSolidFillUsed && bGradientFillUsed && bHatchFillUsed && bBitmapFillUsed);
277  }
278  }
279  }
280 
281  // translate to shadow coordinates
282  pRetval->NbcMove(Size(nXDist, nYDist));
283 
284  // set items as needed
285  SfxItemSet aTempSet(rOriginalSet);
286 
287  // if a SvxWritingModeItem (Top->Bottom) is set the text object
288  // is creating a paraobject, but paraobjects can not be created without model. So
289  // we are preventing the crash by setting the writing mode always left to right,
290  // this is not bad since our shadow geometry does not contain text.
291  aTempSet.Put( SvxWritingModeItem( css::text::WritingMode_LR_TB, SDRATTR_TEXTDIRECTION ) );
292 
293  // no shadow
294  aTempSet.Put(makeSdrShadowItem(false));
295  aTempSet.Put(makeSdrShadowXDistItem(0));
296  aTempSet.Put(makeSdrShadowYDistItem(0));
297 
298  // line color and transparency like shadow
299  if(bLineUsed)
300  {
301  aTempSet.Put(XLineColorItem(OUString(), aShadowColor));
302  aTempSet.Put(XLineTransparenceItem(nShadowTransparence));
303  }
304 
305  // fill color and transparency like shadow
306  if(bSolidFillUsed)
307  {
308  aTempSet.Put(XFillColorItem(OUString(), aShadowColor));
309  aTempSet.Put(XFillTransparenceItem(nShadowTransparence));
310  }
311 
312  // gradient and transparency like shadow
313  if(bGradientFillUsed)
314  {
315  XGradient aGradient(rOriginalSet.Get(XATTR_FILLGRADIENT).GetGradientValue());
316  sal_uInt8 nStartLuminance(aGradient.GetStartColor().GetLuminance());
317  sal_uInt8 nEndLuminance(aGradient.GetEndColor().GetLuminance());
318 
319  if(aGradient.GetStartIntens() != 100)
320  {
321  nStartLuminance = static_cast<sal_uInt8>(nStartLuminance * (static_cast<double>(aGradient.GetStartIntens()) / 100.0));
322  }
323 
324  if(aGradient.GetEndIntens() != 100)
325  {
326  nEndLuminance = static_cast<sal_uInt8>(nEndLuminance * (static_cast<double>(aGradient.GetEndIntens()) / 100.0));
327  }
328 
329  ::Color aStartColor(
330  static_cast<sal_uInt8>((nStartLuminance * aShadowColor.GetRed()) / 256),
331  static_cast<sal_uInt8>((nStartLuminance * aShadowColor.GetGreen()) / 256),
332  static_cast<sal_uInt8>((nStartLuminance * aShadowColor.GetBlue()) / 256));
333 
334  ::Color aEndColor(
335  static_cast<sal_uInt8>((nEndLuminance * aShadowColor.GetRed()) / 256),
336  static_cast<sal_uInt8>((nEndLuminance * aShadowColor.GetGreen()) / 256),
337  static_cast<sal_uInt8>((nEndLuminance * aShadowColor.GetBlue()) / 256));
338 
339  aGradient.SetStartColor(aStartColor);
340  aGradient.SetEndColor(aEndColor);
341  aTempSet.Put(XFillGradientItem(aGradient));
342  aTempSet.Put(XFillTransparenceItem(nShadowTransparence));
343  }
344 
345  // hatch and transparency like shadow
346  if(bHatchFillUsed)
347  {
348  XHatch aHatch(rOriginalSet.Get(XATTR_FILLHATCH).GetHatchValue());
349  aHatch.SetColor(aShadowColor);
350  aTempSet.Put(XFillHatchItem(aHatch));
351  aTempSet.Put(XFillTransparenceItem(nShadowTransparence));
352  }
353 
354  // bitmap and transparency like shadow
355  if(bBitmapFillUsed)
356  {
357  GraphicObject aGraphicObject(rOriginalSet.Get(XATTR_FILLBITMAP).GetGraphicObject());
358  const BitmapEx aBitmapEx(aGraphicObject.GetGraphic().GetBitmapEx());
359 
360  if(!aBitmapEx.IsEmpty())
361  {
363  pVirDev->SetOutputSizePixel(aBitmapEx.GetSizePixel());
364  pVirDev->DrawShadowBitmapEx(aBitmapEx, aShadowColor);
365  aGraphicObject.SetGraphic(Graphic(pVirDev->GetBitmapEx(Point(0,0), aBitmapEx.GetSizePixel())));
366  }
367 
368  aTempSet.Put(XFillBitmapItem(aGraphicObject));
369  aTempSet.Put(XFillTransparenceItem(nShadowTransparence));
370  }
371 
372  // set attributes and paint shadow object
373  pRetval->SetMergedItemSet( aTempSet );
374  }
375  return pRetval;
376 }
377 
378 
379 Reference< XCustomShapeEngine > const & SdrObjCustomShape::GetCustomShapeEngine() const
380 {
381  if (mxCustomShapeEngine.is())
382  return mxCustomShapeEngine;
383 
384  OUString aEngine(GetMergedItem( SDRATTR_CUSTOMSHAPE_ENGINE ).GetValue());
385  if ( aEngine.isEmpty() )
386  aEngine = "com.sun.star.drawing.EnhancedCustomShapeEngine";
387 
389 
390  Reference< XShape > aXShape = GetXShapeForSdrObject(const_cast<SdrObjCustomShape*>(this));
391  if ( aXShape.is() )
392  {
393  Sequence< Any > aArgument( 1 );
394  Sequence< PropertyValue > aPropValues( 1 );
395  aPropValues[ 0 ].Name = "CustomShape";
396  aPropValues[ 0 ].Value <<= aXShape;
397  aArgument[ 0 ] <<= aPropValues;
398  try
399  {
400  Reference<XInterface> xInterface(xContext->getServiceManager()->createInstanceWithArgumentsAndContext(aEngine, aArgument, xContext));
401  if (xInterface.is())
402  mxCustomShapeEngine.set( xInterface, UNO_QUERY );
403  }
404  catch (const css::loader::CannotActivateFactoryException&)
405  {
406  }
407  }
408 
409  return mxCustomShapeEngine;
410 }
411 
413 {
414  if ( !mXRenderedCustomShape.is() )
415  {
416  Reference< XCustomShapeEngine > xCustomShapeEngine( GetCustomShapeEngine() );
417  if ( xCustomShapeEngine.is() )
418  const_cast<SdrObjCustomShape*>(this)->mXRenderedCustomShape = xCustomShapeEngine->render();
419  }
420  SdrObject* pRenderedCustomShape = mXRenderedCustomShape.is()
422  : nullptr;
423  return pRenderedCustomShape;
424 }
425 
426 // #i37011# Shadow geometry creation
428 {
430  {
431  const SdrObject* pSdrObject = GetSdrObjectFromCustomShape();
432  if(pSdrObject)
433  {
434  const SfxItemSet& rOriginalSet = GetObjectItemSet();
435  const bool bShadow(rOriginalSet.Get( SDRATTR_SHADOW ).GetValue());
436 
437  if(bShadow)
438  {
439  // create a clone with all attributes changed to shadow attributes
440  // and translation executed, too.
441  const_cast<SdrObjCustomShape*>(this)->mpLastShadowGeometry =
442  ImpCreateShadowObjectClone(*pSdrObject, rOriginalSet);
443  }
444  }
445  }
446 
447  return mpLastShadowGeometry;
448 }
449 
451 {
452  const OUString sTextPath( "TextPath" );
453  bool bTextPathOn = false;
455  const Any* pAny = rGeometryItem.GetPropertyValueByName( sTextPath, sTextPath );
456  if ( pAny )
457  *pAny >>= bTextPathOn;
458  return bTextPathOn;
459 }
460 
462 {
463  bool bRet = false;
464  OUString sShapeType;
465  const OUString sType( "Type" );
467  const Any* pAny = rGeometryItem.GetPropertyValueByName( sType );
468  if ( pAny )
469  *pAny >>= sShapeType;
471 
472  return bRet;
473 }
474 
476 {
477  bool bMirroredX = false;
479  const OUString sMirroredX( "MirroredX" );
480  css::uno::Any* pAny = aGeometryItem.GetPropertyValueByName( sMirroredX );
481  if ( pAny )
482  *pAny >>= bMirroredX;
483  return bMirroredX;
484 }
486 {
487  bool bMirroredY = false;
489  const OUString sMirroredY( "MirroredY" );
490  css::uno::Any* pAny = aGeometryItem.GetPropertyValueByName( sMirroredY );
491  if ( pAny )
492  *pAny >>= bMirroredY;
493  return bMirroredY;
494 }
495 void SdrObjCustomShape::SetMirroredX( const bool bMirrorX )
496 {
498  const OUString sMirroredX( "MirroredX" );
499  PropertyValue aPropVal;
500  aPropVal.Name = sMirroredX;
501  aPropVal.Value <<= bMirrorX;
502  aGeometryItem.SetPropertyValue( aPropVal );
503  SetMergedItem( aGeometryItem );
504 }
505 void SdrObjCustomShape::SetMirroredY( const bool bMirrorY )
506 {
508  const OUString sMirroredY( "MirroredY" );
509  PropertyValue aPropVal;
510  aPropVal.Name = sMirroredY;
511  aPropVal.Value <<= bMirrorY;
512  aGeometryItem.SetPropertyValue( aPropVal );
513  SetMergedItem( aGeometryItem );
514 }
515 
516 double SdrObjCustomShape::GetExtraTextRotation( const bool bPreRotation ) const
517 {
518  const css::uno::Any* pAny;
520  const OUString sTextRotateAngle( "TextRotateAngle" );
521  const OUString sTextPreRotateAngle( "TextPreRotateAngle" );
522  pAny = rGeometryItem.GetPropertyValueByName( bPreRotation ? sTextPreRotateAngle : sTextRotateAngle );
523  double fExtraTextRotateAngle = 0.0;
524  if ( pAny )
525  *pAny >>= fExtraTextRotateAngle;
526  return fExtraTextRotateAngle;
527 }
528 
530 {
531  const css::uno::Any* pAny;
532  double fTextCameraZRotateAngle = 0.0;
534  const OUString sTextCameraZRotateAngle( "TextCameraZRotateAngle" );
535 
536  pAny = rGeometryItem.GetPropertyValueByName(sTextCameraZRotateAngle);
537 
538  if ( pAny )
539  *pAny >>= fTextCameraZRotateAngle;
540 
541  return fTextCameraZRotateAngle;
542 }
543 
544 
545 
547 {
548  bool bRet = false;
549 
550  Reference< XCustomShapeEngine > xCustomShapeEngine( GetCustomShapeEngine() );
551  if ( xCustomShapeEngine.is() )
552  {
553  awt::Rectangle aR( xCustomShapeEngine->getTextBounds() );
554  if ( aR.Width > 1 && aR.Height > 1 )
555  {
556  rTextBound = tools::Rectangle( Point( aR.X, aR.Y ), Size( aR.Width, aR.Height ) );
557  bRet = true;
558  }
559  }
560  return bRet;
561 }
563 {
564  basegfx::B2DPolyPolygon aRetval;
565  Reference< XCustomShapeEngine > xCustomShapeEngine( GetCustomShapeEngine() );
566  if ( xCustomShapeEngine.is() )
567  {
568  css::drawing::PolyPolygonBezierCoords aBezierCoords = xCustomShapeEngine->getLineGeometry();
569  try
570  {
572  if ( !bBezierAllowed && aRetval.areControlPointsUsed())
573  {
574  aRetval = basegfx::utils::adaptiveSubdivideByAngle(aRetval);
575  }
576  }
577  catch ( const css::lang::IllegalArgumentException & )
578  {
579  }
580  }
581  return aRetval;
582 }
583 
584 std::vector< SdrCustomShapeInteraction > SdrObjCustomShape::GetInteractionHandles() const
585 {
586  std::vector< SdrCustomShapeInteraction > aRet;
587  try
588  {
589  Reference< XCustomShapeEngine > xCustomShapeEngine( GetCustomShapeEngine() );
590  if ( xCustomShapeEngine.is() )
591  {
592  int i;
593  Sequence< Reference< XCustomShapeHandle > > xInteractionHandles( xCustomShapeEngine->getInteraction() );
594  for ( i = 0; i < xInteractionHandles.getLength(); i++ )
595  {
596  if ( xInteractionHandles[ i ].is() )
597  {
598  SdrCustomShapeInteraction aSdrCustomShapeInteraction;
599  aSdrCustomShapeInteraction.xInteraction = xInteractionHandles[ i ];
600  aSdrCustomShapeInteraction.aPosition = xInteractionHandles[ i ]->getPosition();
601 
603  switch( ImpGetCustomShapeType( *this ) )
604  {
605  case mso_sptAccentBorderCallout90 : // 2 ortho
606  {
607  if (i == 0)
609  else if (i == 1)
611  }
612  break;
613 
614  case mso_sptChevron :
615  case mso_sptHomePlate :
617  break;
618 
621  case mso_sptCloudCallout :
623  {
624  if (i == 0)
626  }
627  break;
628 
629  case mso_sptBorderCallout1 : // 2 diag
630  {
631  if (i == 0)
633  else if (i == 1)
635  }
636  break;
637  case mso_sptBorderCallout2 : // 3
638  {
639  if (i == 0)
641  else if (i == 2)
643  }
644  break;
645  case mso_sptCallout90 :
648  case mso_sptCallout1 :
649  case mso_sptCallout2 :
650  case mso_sptCallout3 :
651  case mso_sptAccentCallout1 :
652  case mso_sptAccentCallout2 :
653  case mso_sptAccentCallout3 :
654  case mso_sptBorderCallout3 :
658  {
659  if (i == 0)
661  }
662  break;
663  default: break;
664  }
665  aSdrCustomShapeInteraction.nMode = nMode;
666  aRet.push_back( aSdrCustomShapeInteraction );
667  }
668  }
669  }
670  }
671  catch( const uno::RuntimeException& )
672  {
673  }
674  return aRet;
675 }
676 
677 
678 // BaseProperties section
679 #define DEFAULT_MINIMUM_SIGNED_COMPARE (sal_Int32(0x80000000))
680 #define DEFAULT_MAXIMUM_SIGNED_COMPARE (sal_Int32(0x7fffffff))
681 
682 static sal_Int32 GetNumberOfProperties ( const SvxMSDffHandle* pData )
683 {
684  sal_Int32 nPropertiesNeeded=1; // position is always needed
685  SvxMSDffHandleFlags nFlags = pData->nFlags;
686 
687  if ( nFlags & SvxMSDffHandleFlags::MIRRORED_X )
688  nPropertiesNeeded++;
689  if ( nFlags & SvxMSDffHandleFlags::MIRRORED_Y )
690  nPropertiesNeeded++;
691  if ( nFlags & SvxMSDffHandleFlags::SWITCHED )
692  nPropertiesNeeded++;
693  if ( nFlags & SvxMSDffHandleFlags::POLAR )
694  {
695  nPropertiesNeeded++;
696  if ( nFlags & SvxMSDffHandleFlags::RADIUS_RANGE )
697  {
699  nPropertiesNeeded++;
701  nPropertiesNeeded++;
702  }
703  }
704  else if ( nFlags & SvxMSDffHandleFlags::RANGE )
705  {
707  nPropertiesNeeded++;
709  nPropertiesNeeded++;
711  nPropertiesNeeded++;
713  nPropertiesNeeded++;
714  }
715 
716  return nPropertiesNeeded;
717 }
718 
719 static void lcl_ShapePropertiesFromDFF( const SvxMSDffHandle* pData, css::beans::PropertyValues& rPropValues )
720 {
721  SvxMSDffHandleFlags nFlags = pData->nFlags;
722  sal_Int32 n=0;
723 
724  // POSITION
725  {
726  css::drawing::EnhancedCustomShapeParameterPair aPosition;
727  EnhancedCustomShape2d::SetEnhancedCustomShapeHandleParameter( aPosition.First, pData->nPositionX, true, true );
728  EnhancedCustomShape2d::SetEnhancedCustomShapeHandleParameter( aPosition.Second, pData->nPositionY, true, false );
729  rPropValues[ n ].Name = "Position";
730  rPropValues[ n++ ].Value <<= aPosition;
731  }
732  if ( nFlags & SvxMSDffHandleFlags::MIRRORED_X )
733  {
734  rPropValues[ n ].Name = "MirroredX";
735  rPropValues[ n++ ].Value <<= true;
736  }
737  if ( nFlags & SvxMSDffHandleFlags::MIRRORED_Y )
738  {
739  rPropValues[ n ].Name = "MirroredY";
740  rPropValues[ n++ ].Value <<= true;
741  }
742  if ( nFlags & SvxMSDffHandleFlags::SWITCHED )
743  {
744  rPropValues[ n ].Name = "Switched";
745  rPropValues[ n++ ].Value <<= true;
746  }
747  if ( nFlags & SvxMSDffHandleFlags::POLAR )
748  {
749  css::drawing::EnhancedCustomShapeParameterPair aCenter;
751  bool( nFlags & SvxMSDffHandleFlags::CENTER_X_IS_SPECIAL ), true );
753  bool( nFlags & SvxMSDffHandleFlags::CENTER_Y_IS_SPECIAL ), false );
754  rPropValues[ n ].Name = "Polar";
755  rPropValues[ n++ ].Value <<= aCenter;
756  if ( nFlags & SvxMSDffHandleFlags::RADIUS_RANGE )
757  {
759  {
760  css::drawing::EnhancedCustomShapeParameter aRadiusRangeMinimum;
762  bool( nFlags & SvxMSDffHandleFlags::RANGE_X_MIN_IS_SPECIAL ), true );
763  rPropValues[ n ].Name = "RadiusRangeMinimum";
764  rPropValues[ n++ ].Value <<= aRadiusRangeMinimum;
765  }
767  {
768  css::drawing::EnhancedCustomShapeParameter aRadiusRangeMaximum;
770  bool( nFlags & SvxMSDffHandleFlags::RANGE_X_MAX_IS_SPECIAL ), false );
771  rPropValues[ n ].Name = "RadiusRangeMaximum";
772  rPropValues[ n++ ].Value <<= aRadiusRangeMaximum;
773  }
774  }
775  }
776  else if ( nFlags & SvxMSDffHandleFlags::RANGE )
777  {
779  {
780  css::drawing::EnhancedCustomShapeParameter aRangeXMinimum;
782  bool( nFlags & SvxMSDffHandleFlags::RANGE_X_MIN_IS_SPECIAL ), true );
783  rPropValues[ n ].Name = "RangeXMinimum";
784  rPropValues[ n++ ].Value <<= aRangeXMinimum;
785  }
787  {
788  css::drawing::EnhancedCustomShapeParameter aRangeXMaximum;
790  bool( nFlags & SvxMSDffHandleFlags::RANGE_X_MAX_IS_SPECIAL ), false );
791  rPropValues[ n ].Name = "RangeXMaximum";
792  rPropValues[ n++ ].Value <<= aRangeXMaximum;
793  }
795  {
796  css::drawing::EnhancedCustomShapeParameter aRangeYMinimum;
798  bool( nFlags & SvxMSDffHandleFlags::RANGE_Y_MIN_IS_SPECIAL ), true );
799  rPropValues[ n ].Name = "RangeYMinimum";
800  rPropValues[ n++ ].Value <<= aRangeYMinimum;
801  }
803  {
804  css::drawing::EnhancedCustomShapeParameter aRangeYMaximum;
806  bool( nFlags & SvxMSDffHandleFlags::RANGE_Y_MAX_IS_SPECIAL ), false );
807  rPropValues[ n ].Name = "RangeYMaximum";
808  rPropValues[ n++ ].Value <<= aRangeYMaximum;
809  }
810  }
811 }
812 
813 std::unique_ptr<sdr::properties::BaseProperties> SdrObjCustomShape::CreateObjectSpecificProperties()
814 {
815  return std::make_unique<sdr::properties::CustomShapeProperties>(*this);
816 }
817 
819 : SdrTextObj(rSdrModel)
820  , fObjectRotation(0.0)
821  , mbAdjustingTextFrameWidthAndHeight(false)
822  , mpLastShadowGeometry(nullptr)
823 {
824  bClosedObj = true; // custom shapes may be filled
825  bTextFrame = true;
826 }
827 
829 {
830  // delete buffered display geometry
832 }
833 
834 void SdrObjCustomShape::MergeDefaultAttributes( const OUString* pType )
835 {
836  PropertyValue aPropVal;
837  OUString sShapeType;
838  const OUString sType( "Type" );
840  if ( pType && !pType->isEmpty() )
841  {
842  sal_Int32 nType = pType->toInt32();
843  if ( nType )
844  sShapeType = EnhancedCustomShapeTypeNames::Get( static_cast< MSO_SPT >( nType ) );
845  else
846  sShapeType = *pType;
847 
848  aPropVal.Name = sType;
849  aPropVal.Value <<= sShapeType;
850  aGeometryItem.SetPropertyValue( aPropVal );
851  }
852  else
853  {
854  Any *pAny = aGeometryItem.GetPropertyValueByName( sType );
855  if ( pAny )
856  *pAny >>= sShapeType;
857  }
858  MSO_SPT eSpType = EnhancedCustomShapeTypeNames::Get( sShapeType );
859 
860  const sal_Int32* pDefData = nullptr;
861  const mso_CustomShape* pDefCustomShape = GetCustomShapeContent( eSpType );
862  if ( pDefCustomShape )
863  pDefData = pDefCustomShape->pDefData;
864 
865  css::uno::Sequence< css::drawing::EnhancedCustomShapeAdjustmentValue > seqAdjustmentValues;
866 
867 
868  // AdjustmentValues
869 
870  const OUString sAdjustmentValues( "AdjustmentValues" );
871  const Any* pAny = aGeometryItem.GetPropertyValueByName( sAdjustmentValues );
872  if ( pAny )
873  *pAny >>= seqAdjustmentValues;
874  if ( pDefCustomShape && pDefData ) // now check if we have to default some adjustment values
875  {
876  // first check if there are adjustment values are to be appended
877  sal_Int32 i, nAdjustmentValues = seqAdjustmentValues.getLength();
878  sal_Int32 nAdjustmentDefaults = *pDefData++;
879  if ( nAdjustmentDefaults > nAdjustmentValues )
880  {
881  seqAdjustmentValues.realloc( nAdjustmentDefaults );
882  for ( i = nAdjustmentValues; i < nAdjustmentDefaults; i++ )
883  {
884  seqAdjustmentValues[ i ].Value <<= pDefData[ i ];
885  seqAdjustmentValues[ i ].State = css::beans::PropertyState_DIRECT_VALUE;
886  }
887  }
888  // check if there are defaulted adjustment values that should be filled the hard coded defaults (pDefValue)
889  sal_Int32 nCount = std::min(nAdjustmentValues, nAdjustmentDefaults);
890  for ( i = 0; i < nCount; i++ )
891  {
892  if ( seqAdjustmentValues[ i ].State != css::beans::PropertyState_DIRECT_VALUE )
893  {
894  seqAdjustmentValues[ i ].Value <<= pDefData[ i ];
895  seqAdjustmentValues[ i ].State = css::beans::PropertyState_DIRECT_VALUE;
896  }
897  }
898  }
899  aPropVal.Name = sAdjustmentValues;
900  aPropVal.Value <<= seqAdjustmentValues;
901  aGeometryItem.SetPropertyValue( aPropVal );
902 
903 
904  // Coordsize
905 
906  const OUString sViewBox( "ViewBox" );
907  const Any* pViewBox = aGeometryItem.GetPropertyValueByName( sViewBox );
908  css::awt::Rectangle aViewBox;
909  if ( !pViewBox || !(*pViewBox >>= aViewBox ) )
910  {
911  if ( pDefCustomShape )
912  {
913  aViewBox.X = 0;
914  aViewBox.Y = 0;
915  aViewBox.Width = pDefCustomShape->nCoordWidth;
916  aViewBox.Height= pDefCustomShape->nCoordHeight;
917  aPropVal.Name = sViewBox;
918  aPropVal.Value <<= aViewBox;
919  aGeometryItem.SetPropertyValue( aPropVal );
920  }
921  }
922 
923  const OUString sPath( "Path" );
924 
925 
926  // Path/Coordinates
927 
928  const OUString sCoordinates( "Coordinates" );
929  pAny = aGeometryItem.GetPropertyValueByName( sPath, sCoordinates );
930  if ( !pAny && pDefCustomShape && pDefCustomShape->nVertices && pDefCustomShape->pVertices )
931  {
932  css::uno::Sequence< css::drawing::EnhancedCustomShapeParameterPair> seqCoordinates;
933 
934  sal_Int32 i, nCount = pDefCustomShape->nVertices;
935  seqCoordinates.realloc( nCount );
936  for ( i = 0; i < nCount; i++ )
937  {
938  EnhancedCustomShape2d::SetEnhancedCustomShapeParameter( seqCoordinates[ i ].First, pDefCustomShape->pVertices[ i ].nValA );
939  EnhancedCustomShape2d::SetEnhancedCustomShapeParameter( seqCoordinates[ i ].Second, pDefCustomShape->pVertices[ i ].nValB );
940  }
941  aPropVal.Name = sCoordinates;
942  aPropVal.Value <<= seqCoordinates;
943  aGeometryItem.SetPropertyValue( sPath, aPropVal );
944  }
945 
946  // Path/GluePoints
947  const OUString sGluePoints( "GluePoints" );
948  pAny = aGeometryItem.GetPropertyValueByName( sPath, sGluePoints );
949  if ( !pAny && pDefCustomShape && pDefCustomShape->nGluePoints && pDefCustomShape->pGluePoints )
950  {
951  css::uno::Sequence< css::drawing::EnhancedCustomShapeParameterPair> seqGluePoints;
952  sal_Int32 i, nCount = pDefCustomShape->nGluePoints;
953  seqGluePoints.realloc( nCount );
954  for ( i = 0; i < nCount; i++ )
955  {
956  EnhancedCustomShape2d::SetEnhancedCustomShapeParameter( seqGluePoints[ i ].First, pDefCustomShape->pGluePoints[ i ].nValA );
957  EnhancedCustomShape2d::SetEnhancedCustomShapeParameter( seqGluePoints[ i ].Second, pDefCustomShape->pGluePoints[ i ].nValB );
958  }
959  aPropVal.Name = sGluePoints;
960  aPropVal.Value <<= seqGluePoints;
961  aGeometryItem.SetPropertyValue( sPath, aPropVal );
962  }
963 
964  // Path/Segments
965  const OUString sSegments( "Segments" );
966  pAny = aGeometryItem.GetPropertyValueByName( sPath, sSegments );
967  if ( !pAny && pDefCustomShape && pDefCustomShape->nElements && pDefCustomShape->pElements )
968  {
969  css::uno::Sequence< css::drawing::EnhancedCustomShapeSegment > seqSegments;
970 
971  sal_Int32 i, nCount = pDefCustomShape->nElements;
972  seqSegments.realloc( nCount );
973  for ( i = 0; i < nCount; i++ )
974  {
975  EnhancedCustomShapeSegment& rSegInfo = seqSegments[ i ];
976  sal_uInt16 nSDat = pDefCustomShape->pElements[ i ];
977  lcl_ShapeSegmentFromBinary( rSegInfo, nSDat );
978  }
979  aPropVal.Name = sSegments;
980  aPropVal.Value <<= seqSegments;
981  aGeometryItem.SetPropertyValue( sPath, aPropVal );
982  }
983 
984  // Path/StretchX
985  const OUString sStretchX( "StretchX" );
986  pAny = aGeometryItem.GetPropertyValueByName( sPath, sStretchX );
987  if ( !pAny && pDefCustomShape )
988  {
989  sal_Int32 nXRef = pDefCustomShape->nXRef;
990  if ( nXRef != DEFAULT_MINIMUM_SIGNED_COMPARE )
991  {
992  aPropVal.Name = sStretchX;
993  aPropVal.Value <<= nXRef;
994  aGeometryItem.SetPropertyValue( sPath, aPropVal );
995  }
996  }
997 
998  // Path/StretchY
999  const OUString sStretchY( "StretchY" );
1000  pAny = aGeometryItem.GetPropertyValueByName( sPath, sStretchY );
1001  if ( !pAny && pDefCustomShape )
1002  {
1003  sal_Int32 nYRef = pDefCustomShape->nYRef;
1004  if ( nYRef != DEFAULT_MINIMUM_SIGNED_COMPARE )
1005  {
1006  aPropVal.Name = sStretchY;
1007  aPropVal.Value <<= nYRef;
1008  aGeometryItem.SetPropertyValue( sPath, aPropVal );
1009  }
1010  }
1011 
1012  // Path/TextFrames
1013  const OUString sTextFrames( "TextFrames" );
1014  pAny = aGeometryItem.GetPropertyValueByName( sPath, sTextFrames );
1015  if ( !pAny && pDefCustomShape && pDefCustomShape->nTextRect && pDefCustomShape->pTextRect )
1016  {
1017  css::uno::Sequence< css::drawing::EnhancedCustomShapeTextFrame > seqTextFrames;
1018 
1019  sal_Int32 i, nCount = pDefCustomShape->nTextRect;
1020  seqTextFrames.realloc( nCount );
1021  const SvxMSDffTextRectangles* pRectangles = pDefCustomShape->pTextRect;
1022  for ( i = 0; i < nCount; i++, pRectangles++ )
1023  {
1024  EnhancedCustomShape2d::SetEnhancedCustomShapeParameter( seqTextFrames[ i ].TopLeft.First, pRectangles->nPairA.nValA );
1025  EnhancedCustomShape2d::SetEnhancedCustomShapeParameter( seqTextFrames[ i ].TopLeft.Second, pRectangles->nPairA.nValB );
1026  EnhancedCustomShape2d::SetEnhancedCustomShapeParameter( seqTextFrames[ i ].BottomRight.First, pRectangles->nPairB.nValA );
1027  EnhancedCustomShape2d::SetEnhancedCustomShapeParameter( seqTextFrames[ i ].BottomRight.Second, pRectangles->nPairB.nValB );
1028  }
1029  aPropVal.Name = sTextFrames;
1030  aPropVal.Value <<= seqTextFrames;
1031  aGeometryItem.SetPropertyValue( sPath, aPropVal );
1032  }
1033 
1034  // Equations
1035  const OUString sEquations( "Equations" );
1036  pAny = aGeometryItem.GetPropertyValueByName( sEquations );
1037  if ( !pAny && pDefCustomShape && pDefCustomShape->nCalculation && pDefCustomShape->pCalculation )
1038  {
1039  css::uno::Sequence< OUString > seqEquations;
1040 
1041  sal_Int32 i, nCount = pDefCustomShape->nCalculation;
1042  seqEquations.realloc( nCount );
1043  const SvxMSDffCalculationData* pData = pDefCustomShape->pCalculation;
1044  for ( i = 0; i < nCount; i++, pData++ )
1045  seqEquations[ i ] = EnhancedCustomShape2d::GetEquation( pData->nFlags, pData->nVal[ 0 ], pData->nVal[ 1 ], pData->nVal[ 2 ] );
1046  aPropVal.Name = sEquations;
1047  aPropVal.Value <<= seqEquations;
1048  aGeometryItem.SetPropertyValue( aPropVal );
1049  }
1050 
1051  // Handles
1052  const OUString sHandles( "Handles" );
1053  pAny = aGeometryItem.GetPropertyValueByName( sHandles );
1054  if ( !pAny && pDefCustomShape && pDefCustomShape->nHandles && pDefCustomShape->pHandles )
1055  {
1056  css::uno::Sequence< css::beans::PropertyValues > seqHandles;
1057 
1058  sal_Int32 i, nCount = pDefCustomShape->nHandles;
1059  const SvxMSDffHandle* pData = pDefCustomShape->pHandles;
1060  seqHandles.realloc( nCount );
1061  for ( i = 0; i < nCount; i++, pData++ )
1062  {
1063  sal_Int32 nPropertiesNeeded;
1064  css::beans::PropertyValues& rPropValues = seqHandles[ i ];
1065  nPropertiesNeeded = GetNumberOfProperties( pData );
1066  rPropValues.realloc( nPropertiesNeeded );
1067  lcl_ShapePropertiesFromDFF( pData, rPropValues );
1068  }
1069  aPropVal.Name = sHandles;
1070  aPropVal.Value <<= seqHandles;
1071  aGeometryItem.SetPropertyValue( aPropVal );
1072  }
1073  else if (pAny && sShapeType.startsWith("ooxml-") && sShapeType != "ooxml-non-primitive")
1074  {
1075  // ODF is not able to store the ooxml way of connecting handle to an adjustment
1076  // value by name, e.g. attribute RefX="adj". So the information is lost, when exporting
1077  // a pptx to odp, for example. This part reconstructs this information for the
1078  // ooxml preset shapes from their definition.
1079  css::uno::Sequence<css::beans::PropertyValues> seqHandles;
1080  *pAny >>= seqHandles;
1081  bool bChanged(false);
1082  for (sal_Int32 i = 0; i < seqHandles.getLength(); i++)
1083  {
1084  comphelper::SequenceAsHashMap aHandleProps(seqHandles[i]);
1085  OUString sFirstRefType;
1086  sal_Int32 nFirstAdjRef;
1087  OUString sSecondRefType;
1088  sal_Int32 nSecondAdjRef;
1089  PresetOOXHandleAdj::GetOOXHandleAdjRelation(sShapeType, i, sFirstRefType, nFirstAdjRef,
1090  sSecondRefType, nSecondAdjRef);
1091  if (sFirstRefType != "na" && 0 <= nFirstAdjRef
1092  && nFirstAdjRef < seqAdjustmentValues.getLength())
1093  {
1094  bChanged |= aHandleProps.createItemIfMissing(sFirstRefType, nFirstAdjRef);
1095  }
1096  if (sSecondRefType != "na" && 0 <= nSecondAdjRef
1097  && nSecondAdjRef < seqAdjustmentValues.getLength())
1098  {
1099  bChanged |= aHandleProps.createItemIfMissing(sSecondRefType, nSecondAdjRef);
1100  }
1101  aHandleProps >> seqHandles[i];
1102  }
1103  if (bChanged)
1104  {
1105  aPropVal.Name = sHandles;
1106  aPropVal.Value <<= seqHandles;
1107  aGeometryItem.SetPropertyValue(aPropVal);
1108  }
1109  }
1110 
1111  SetMergedItem( aGeometryItem );
1112 }
1113 
1114 bool SdrObjCustomShape::IsDefaultGeometry( const DefaultType eDefaultType ) const
1115 {
1116  bool bIsDefaultGeometry = false;
1117 
1118  PropertyValue aPropVal;
1119  OUString sShapeType;
1120  const OUString sType( "Type" );
1122 
1123  const Any *pAny = aGeometryItem.GetPropertyValueByName( sType );
1124  if ( pAny )
1125  *pAny >>= sShapeType;
1126 
1127  MSO_SPT eSpType = EnhancedCustomShapeTypeNames::Get( sShapeType );
1128 
1129  const mso_CustomShape* pDefCustomShape = GetCustomShapeContent( eSpType );
1130  const OUString sPath( "Path" );
1131  switch( eDefaultType )
1132  {
1133  case DefaultType::Viewbox :
1134  {
1135  const OUString sViewBox( "ViewBox" );
1136  const Any* pViewBox = const_cast<SdrCustomShapeGeometryItem&>(aGeometryItem).GetPropertyValueByName( sViewBox );
1137  css::awt::Rectangle aViewBox;
1138  if (pViewBox && (*pViewBox >>= aViewBox) && pDefCustomShape)
1139  {
1140  if ( ( aViewBox.Width == pDefCustomShape->nCoordWidth )
1141  && ( aViewBox.Height == pDefCustomShape->nCoordHeight ) )
1142  bIsDefaultGeometry = true;
1143  }
1144  }
1145  break;
1146 
1147  case DefaultType::Path :
1148  {
1149  const OUString sCoordinates( "Coordinates" );
1150  pAny = const_cast<SdrCustomShapeGeometryItem&>(aGeometryItem).GetPropertyValueByName( sPath, sCoordinates );
1151  if ( pAny && pDefCustomShape && pDefCustomShape->nVertices && pDefCustomShape->pVertices )
1152  {
1153  css::uno::Sequence< css::drawing::EnhancedCustomShapeParameterPair> seqCoordinates1, seqCoordinates2;
1154  if ( *pAny >>= seqCoordinates1 )
1155  {
1156  sal_Int32 i, nCount = pDefCustomShape->nVertices;
1157  seqCoordinates2.realloc( nCount );
1158  for ( i = 0; i < nCount; i++ )
1159  {
1160  EnhancedCustomShape2d::SetEnhancedCustomShapeParameter( seqCoordinates2[ i ].First, pDefCustomShape->pVertices[ i ].nValA );
1161  EnhancedCustomShape2d::SetEnhancedCustomShapeParameter( seqCoordinates2[ i ].Second, pDefCustomShape->pVertices[ i ].nValB );
1162  }
1163  if ( seqCoordinates1 == seqCoordinates2 )
1164  bIsDefaultGeometry = true;
1165  }
1166  }
1167  else if ( pDefCustomShape && ( ( pDefCustomShape->nVertices == 0 ) || ( pDefCustomShape->pVertices == nullptr ) ) )
1168  bIsDefaultGeometry = true;
1169  }
1170  break;
1171 
1173  {
1174  const OUString sGluePoints( "GluePoints" );
1175  pAny = const_cast<SdrCustomShapeGeometryItem&>(aGeometryItem).GetPropertyValueByName( sPath, sGluePoints );
1176  if ( pAny && pDefCustomShape && pDefCustomShape->nGluePoints && pDefCustomShape->pGluePoints )
1177  {
1178  css::uno::Sequence< css::drawing::EnhancedCustomShapeParameterPair> seqGluePoints1, seqGluePoints2;
1179  if ( *pAny >>= seqGluePoints1 )
1180  {
1181  sal_Int32 i, nCount = pDefCustomShape->nGluePoints;
1182  seqGluePoints2.realloc( nCount );
1183  for ( i = 0; i < nCount; i++ )
1184  {
1185  EnhancedCustomShape2d::SetEnhancedCustomShapeParameter( seqGluePoints2[ i ].First, pDefCustomShape->pGluePoints[ i ].nValA );
1186  EnhancedCustomShape2d::SetEnhancedCustomShapeParameter( seqGluePoints2[ i ].Second, pDefCustomShape->pGluePoints[ i ].nValB );
1187  }
1188  if ( seqGluePoints1 == seqGluePoints2 )
1189  bIsDefaultGeometry = true;
1190  }
1191  }
1192  else if ( pDefCustomShape && ( pDefCustomShape->nGluePoints == 0 ) )
1193  bIsDefaultGeometry = true;
1194  }
1195  break;
1196 
1197  case DefaultType::Segments :
1198  {
1199  // Path/Segments
1200  const OUString sSegments( "Segments" );
1201  pAny = const_cast<SdrCustomShapeGeometryItem&>(aGeometryItem).GetPropertyValueByName( sPath, sSegments );
1202  if ( pAny )
1203  {
1204  css::uno::Sequence< css::drawing::EnhancedCustomShapeSegment > seqSegments1, seqSegments2;
1205  if ( *pAny >>= seqSegments1 )
1206  {
1207  if ( pDefCustomShape && pDefCustomShape->nElements && pDefCustomShape->pElements )
1208  {
1209  sal_Int32 i, nCount = pDefCustomShape->nElements;
1210  if ( nCount )
1211  {
1212  seqSegments2.realloc( nCount );
1213  for ( i = 0; i < nCount; i++ )
1214  {
1215  EnhancedCustomShapeSegment& rSegInfo = seqSegments2[ i ];
1216  sal_uInt16 nSDat = pDefCustomShape->pElements[ i ];
1217  lcl_ShapeSegmentFromBinary( rSegInfo, nSDat );
1218  }
1219  if ( seqSegments1 == seqSegments2 )
1220  bIsDefaultGeometry = true;
1221  }
1222  }
1223  else
1224  {
1225  // check if it's the default segment description ( M L Z N )
1226  if ( seqSegments1.getLength() == 4 )
1227  {
1228  if ( ( seqSegments1[ 0 ].Command == EnhancedCustomShapeSegmentCommand::MOVETO )
1229  && ( seqSegments1[ 1 ].Command == EnhancedCustomShapeSegmentCommand::LINETO )
1230  && ( seqSegments1[ 2 ].Command == EnhancedCustomShapeSegmentCommand::CLOSESUBPATH )
1231  && ( seqSegments1[ 3 ].Command == EnhancedCustomShapeSegmentCommand::ENDSUBPATH ) )
1232  bIsDefaultGeometry = true;
1233  }
1234  }
1235  }
1236  }
1237  else if ( pDefCustomShape && ( ( pDefCustomShape->nElements == 0 ) || ( pDefCustomShape->pElements == nullptr ) ) )
1238  bIsDefaultGeometry = true;
1239  }
1240  break;
1241 
1242  case DefaultType::StretchX :
1243  {
1244  const OUString sStretchX( "StretchX" );
1245  pAny = const_cast<SdrCustomShapeGeometryItem&>(aGeometryItem).GetPropertyValueByName( sPath, sStretchX );
1246  if ( pAny && pDefCustomShape )
1247  {
1248  sal_Int32 nStretchX = 0;
1249  if ( *pAny >>= nStretchX )
1250  {
1251  if ( pDefCustomShape->nXRef == nStretchX )
1252  bIsDefaultGeometry = true;
1253  }
1254  }
1255  else if ( pDefCustomShape && ( pDefCustomShape->nXRef == DEFAULT_MINIMUM_SIGNED_COMPARE ) )
1256  bIsDefaultGeometry = true;
1257  }
1258  break;
1259 
1260  case DefaultType::StretchY :
1261  {
1262  const OUString sStretchY( "StretchY" );
1263  pAny = const_cast<SdrCustomShapeGeometryItem&>(aGeometryItem).GetPropertyValueByName( sPath, sStretchY );
1264  if ( pAny && pDefCustomShape )
1265  {
1266  sal_Int32 nStretchY = 0;
1267  if ( *pAny >>= nStretchY )
1268  {
1269  if ( pDefCustomShape->nYRef == nStretchY )
1270  bIsDefaultGeometry = true;
1271  }
1272  }
1273  else if ( pDefCustomShape && ( pDefCustomShape->nYRef == DEFAULT_MINIMUM_SIGNED_COMPARE ) )
1274  bIsDefaultGeometry = true;
1275  }
1276  break;
1277 
1278  case DefaultType::Equations :
1279  {
1280  const OUString sEquations( "Equations" );
1281  pAny = const_cast<SdrCustomShapeGeometryItem&>(aGeometryItem).GetPropertyValueByName( sEquations );
1282  if ( pAny && pDefCustomShape && pDefCustomShape->nCalculation && pDefCustomShape->pCalculation )
1283  {
1284  css::uno::Sequence< OUString > seqEquations1, seqEquations2;
1285  if ( *pAny >>= seqEquations1 )
1286  {
1287  sal_Int32 i, nCount = pDefCustomShape->nCalculation;
1288  seqEquations2.realloc( nCount );
1289 
1290  const SvxMSDffCalculationData* pData = pDefCustomShape->pCalculation;
1291  for ( i = 0; i < nCount; i++, pData++ )
1292  seqEquations2[ i ] = EnhancedCustomShape2d::GetEquation( pData->nFlags, pData->nVal[ 0 ], pData->nVal[ 1 ], pData->nVal[ 2 ] );
1293 
1294  if ( seqEquations1 == seqEquations2 )
1295  bIsDefaultGeometry = true;
1296  }
1297  }
1298  else if ( pDefCustomShape && ( ( pDefCustomShape->nCalculation == 0 ) || ( pDefCustomShape->pCalculation == nullptr ) ) )
1299  bIsDefaultGeometry = true;
1300  }
1301  break;
1302 
1304  {
1305  const OUString sTextFrames( "TextFrames" );
1306  pAny = const_cast<SdrCustomShapeGeometryItem&>(aGeometryItem).GetPropertyValueByName( sPath, sTextFrames );
1307  if ( pAny && pDefCustomShape && pDefCustomShape->nTextRect && pDefCustomShape->pTextRect )
1308  {
1309  css::uno::Sequence< css::drawing::EnhancedCustomShapeTextFrame > seqTextFrames1, seqTextFrames2;
1310  if ( *pAny >>= seqTextFrames1 )
1311  {
1312  sal_Int32 i, nCount = pDefCustomShape->nTextRect;
1313  seqTextFrames2.realloc( nCount );
1314  const SvxMSDffTextRectangles* pRectangles = pDefCustomShape->pTextRect;
1315  for ( i = 0; i < nCount; i++, pRectangles++ )
1316  {
1317  EnhancedCustomShape2d::SetEnhancedCustomShapeParameter( seqTextFrames2[ i ].TopLeft.First, pRectangles->nPairA.nValA );
1318  EnhancedCustomShape2d::SetEnhancedCustomShapeParameter( seqTextFrames2[ i ].TopLeft.Second, pRectangles->nPairA.nValB );
1319  EnhancedCustomShape2d::SetEnhancedCustomShapeParameter( seqTextFrames2[ i ].BottomRight.First, pRectangles->nPairB.nValA );
1320  EnhancedCustomShape2d::SetEnhancedCustomShapeParameter( seqTextFrames2[ i ].BottomRight.Second, pRectangles->nPairB.nValB );
1321  }
1322  if ( seqTextFrames1 == seqTextFrames2 )
1323  bIsDefaultGeometry = true;
1324  }
1325  }
1326  else if ( pDefCustomShape && ( ( pDefCustomShape->nTextRect == 0 ) || ( pDefCustomShape->pTextRect == nullptr ) ) )
1327  bIsDefaultGeometry = true;
1328  }
1329  break;
1330  }
1331  return bIsDefaultGeometry;
1332 }
1333 
1335 {
1336  rInfo.bResizeFreeAllowed=fObjectRotation == 0.0;
1337  rInfo.bResizePropAllowed=true;
1338  rInfo.bRotateFreeAllowed=true;
1339  rInfo.bRotate90Allowed =true;
1340  rInfo.bMirrorFreeAllowed=true;
1341  rInfo.bMirror45Allowed =true;
1342  rInfo.bMirror90Allowed =true;
1343  rInfo.bTransparenceAllowed = false;
1344  rInfo.bShearAllowed =true;
1345  rInfo.bEdgeRadiusAllowed=false;
1346  rInfo.bNoContortion =true;
1347 
1348  // #i37011#
1349  if ( mXRenderedCustomShape.is() )
1350  {
1351  const SdrObject* pRenderedCustomShape = GetSdrObjectFromXShape( mXRenderedCustomShape );
1352  if ( pRenderedCustomShape )
1353  {
1354  // #i37262#
1355  // Iterate self over the contained objects, since there are combinations of
1356  // polygon and curve objects. In that case, aInfo.bCanConvToPath and
1357  // aInfo.bCanConvToPoly would be false. What is needed here is an or, not an and.
1358  SdrObjListIter aIterator(*pRenderedCustomShape);
1359  while(aIterator.IsMore())
1360  {
1361  SdrObject* pCandidate = aIterator.Next();
1362  SdrObjTransformInfoRec aInfo;
1363  pCandidate->TakeObjInfo(aInfo);
1364 
1365  // set path and poly conversion if one is possible since
1366  // this object will first be broken
1367  const bool bCanConvToPathOrPoly(aInfo.bCanConvToPath || aInfo.bCanConvToPoly);
1368  if(rInfo.bCanConvToPath != bCanConvToPathOrPoly)
1369  {
1370  rInfo.bCanConvToPath = bCanConvToPathOrPoly;
1371  }
1372 
1373  if(rInfo.bCanConvToPoly != bCanConvToPathOrPoly)
1374  {
1375  rInfo.bCanConvToPoly = bCanConvToPathOrPoly;
1376  }
1377 
1378  if(rInfo.bCanConvToContour != aInfo.bCanConvToContour)
1379  {
1380  rInfo.bCanConvToContour = aInfo.bCanConvToContour;
1381  }
1382 
1383  if(rInfo.bShearAllowed != aInfo.bShearAllowed)
1384  {
1385  rInfo.bShearAllowed = aInfo.bShearAllowed;
1386  }
1387  }
1388  }
1389  }
1390 }
1391 
1393 {
1394  return sal_uInt16(OBJ_CUSTOMSHAPE);
1395 }
1396 
1397 // #115391# This implementation is based on the TextFrame size of the CustomShape and the
1398 // state of the ResizeShapeToFitText flag to correctly set TextMinFrameWidth/Height
1400 {
1401  if (!getSdrModelFromSdrObject().IsCreatingDataObj() && !getSdrModelFromSdrObject().IsPasteResize())
1402  {
1403  const bool bResizeShapeToFitText(GetObjectItem(SDRATTR_TEXT_AUTOGROWHEIGHT).GetValue());
1404  SfxItemSet aSet(
1405  *GetObjectItemSet().GetPool(),
1407  SDRATTR_TEXT_MINFRAMEWIDTH, SDRATTR_TEXT_AUTOGROWWIDTH>{}); // contains SDRATTR_TEXT_MAXFRAMEWIDTH
1408  bool bChanged(false);
1409 
1410  if(bResizeShapeToFitText)
1411  {
1412  // always reset MinWidthHeight to zero to only rely on text size and frame size
1413  // to allow resizing being completely dependent on text size only
1414  aSet.Put(makeSdrTextMinFrameWidthItem(0));
1415  aSet.Put(makeSdrTextMinFrameHeightItem(0));
1416  bChanged = true;
1417  }
1418  else
1419  {
1420  // recreate from CustomShape-specific TextBounds
1421  tools::Rectangle aTextBound(maRect);
1422 
1423  if(GetTextBounds(aTextBound))
1424  {
1425  const long nHDist(GetTextLeftDistance() + GetTextRightDistance());
1426  const long nVDist(GetTextUpperDistance() + GetTextLowerDistance());
1427  const long nTWdt(std::max(long(0), static_cast<long>(aTextBound.GetWidth() - 1 - nHDist)));
1428  const long nTHgt(std::max(long(0), static_cast<long>(aTextBound.GetHeight() - 1 - nVDist)));
1429 
1430  aSet.Put(makeSdrTextMinFrameWidthItem(nTWdt));
1431  aSet.Put(makeSdrTextMinFrameHeightItem(nTHgt));
1432  bChanged = true;
1433  }
1434  }
1435 
1436  if(bChanged)
1437  SetObjectItemSet(aSet);
1438  }
1439 }
1440 
1442 {
1443  maRect = rRect;
1446 
1447  AdaptTextMinSize();
1448 
1449  ImpCheckShear();
1450  SetRectsDirty();
1451  SetChanged();
1452 }
1453 
1455 {
1456  tools::Rectangle aBoundRect0;
1457  if ( pUserCall )
1458  aBoundRect0 = GetLastBoundRect();
1459  NbcSetSnapRect( rRect );
1462 }
1463 
1465 {
1466  maRect = rRect;
1469 
1470  AdaptTextMinSize();
1471 
1472  SetRectsDirty();
1473  SetChanged();
1474 }
1475 
1477 {
1478  tools::Rectangle aBoundRect0;
1479  if ( pUserCall )
1480  aBoundRect0 = GetLastBoundRect();
1481  NbcSetLogicRect(rRect);
1484 }
1485 
1486 void SdrObjCustomShape::Move( const Size& rSiz )
1487 {
1488  if ( rSiz.Width() || rSiz.Height() )
1489  {
1490  tools::Rectangle aBoundRect0;
1491  if ( pUserCall )
1492  aBoundRect0 = GetLastBoundRect();
1493  NbcMove(rSiz);
1494  SetChanged();
1497  }
1498 }
1500 {
1501  SdrTextObj::NbcMove( rSiz );
1502  if ( mXRenderedCustomShape.is() )
1503  {
1504  SdrObject* pRenderedCustomShape = GetSdrObjectFromXShape( mXRenderedCustomShape );
1505  if ( pRenderedCustomShape )
1506  {
1507  // #i97149# the visualisation shape needs to be informed
1508  // about change, too
1509  pRenderedCustomShape->ActionChanged();
1510  pRenderedCustomShape->NbcMove( rSiz );
1511  }
1512  }
1513 
1514  // #i37011# adapt geometry shadow
1516  {
1517  mpLastShadowGeometry->NbcMove( rSiz );
1518  }
1519 }
1520 
1521 void SdrObjCustomShape::NbcResize( const Point& rRef, const Fraction& rxFact, const Fraction& ryFact )
1522 {
1523  // taking care of handles that should not been changed
1524  tools::Rectangle aOld( maRect );
1525  std::vector< SdrCustomShapeInteraction > aInteractionHandles( GetInteractionHandles() );
1526 
1527  SdrTextObj::NbcResize( rRef, rxFact, ryFact );
1528 
1529  if ( ( rxFact.GetNumerator() != rxFact.GetDenominator() )
1530  || ( ryFact.GetNumerator()!= ryFact.GetDenominator() ) )
1531  {
1532  if ( ( ( rxFact.GetNumerator() < 0 ) && ( rxFact.GetDenominator() > 0 ) ) ||
1533  ( ( rxFact.GetNumerator() > 0 ) && ( rxFact.GetDenominator() < 0 ) ) )
1534  {
1535  SetMirroredX( !IsMirroredX() );
1536  }
1537  if ( ( ( ryFact.GetNumerator() < 0 ) && ( ryFact.GetDenominator() > 0 ) ) ||
1538  ( ( ryFact.GetNumerator() > 0 ) && ( ryFact.GetDenominator() < 0 ) ) )
1539  {
1540  SetMirroredY( !IsMirroredY() );
1541  }
1542  }
1543 
1544  for (const auto& rInteraction : aInteractionHandles)
1545  {
1546  try
1547  {
1548  if ( rInteraction.nMode & CustomShapeHandleModes::RESIZE_FIXED )
1549  rInteraction.xInteraction->setControllerPosition( rInteraction.aPosition );
1550  if ( rInteraction.nMode & CustomShapeHandleModes::RESIZE_ABSOLUTE_X )
1551  {
1552  sal_Int32 nX = ( rInteraction.aPosition.X - aOld.Left() ) + maRect.Left();
1553  rInteraction.xInteraction->setControllerPosition( css::awt::Point( nX, rInteraction.xInteraction->getPosition().Y ) );
1554  }
1555  else if ( rInteraction.nMode & CustomShapeHandleModes::RESIZE_ABSOLUTE_NEGX )
1556  {
1557  sal_Int32 nX = maRect.Right() - (aOld.Right() - rInteraction.aPosition.X);
1558  rInteraction.xInteraction->setControllerPosition( css::awt::Point( nX, rInteraction.xInteraction->getPosition().Y ) );
1559  }
1560  if ( rInteraction.nMode & CustomShapeHandleModes::RESIZE_ABSOLUTE_Y )
1561  {
1562  sal_Int32 nY = ( rInteraction.aPosition.Y - aOld.Top() ) + maRect.Top();
1563  rInteraction.xInteraction->setControllerPosition( css::awt::Point( rInteraction.xInteraction->getPosition().X, nY ) );
1564  }
1565  }
1566  catch ( const uno::RuntimeException& )
1567  {
1568  }
1569  }
1571 }
1572 
1573 void SdrObjCustomShape::NbcRotate( const Point& rRef, long nAngle, double sn, double cs )
1574 {
1575  bool bMirroredX = IsMirroredX();
1576  bool bMirroredY = IsMirroredY();
1577 
1578  fObjectRotation = fmod( fObjectRotation, 360.0 );
1579  if ( fObjectRotation < 0 )
1581 
1582  // the rotation angle for ashapes is stored in fObjectRotation, this rotation
1583  // has to be applied to the text object (which is internally using aGeo.nAngle).
1584  SdrTextObj::NbcRotate( maRect.TopLeft(), -aGeo.nRotationAngle, // retrieving the unrotated text object
1585  sin( (-aGeo.nRotationAngle) * F_PI18000 ),
1586  cos( (-aGeo.nRotationAngle) * F_PI18000 ) );
1587  aGeo.nRotationAngle = 0; // resetting aGeo data
1588  aGeo.RecalcSinCos();
1589 
1590  long nW = static_cast<long>( fObjectRotation * 100 ); // applying our object rotation
1591  if ( bMirroredX )
1592  nW = 36000 - nW;
1593  if ( bMirroredY )
1594  nW = 18000 - nW;
1595  nW = nW % 36000;
1596  if ( nW < 0 )
1597  nW = 36000 + nW;
1598  SdrTextObj::NbcRotate( maRect.TopLeft(), nW, // applying text rotation
1599  sin( nW * F_PI18000 ),
1600  cos( nW * F_PI18000 ) );
1601 
1602  int nSwap = 0;
1603  if ( bMirroredX )
1604  nSwap ^= 1;
1605  if ( bMirroredY )
1606  nSwap ^= 1;
1607 
1608  double fAngle = nAngle; // updating to our new object rotation
1609  fAngle /= 100.0;
1610  fObjectRotation = fmod( nSwap ? fObjectRotation - fAngle : fObjectRotation + fAngle, 360.0 );
1611  if ( fObjectRotation < 0 )
1613 
1614  SdrTextObj::NbcRotate( rRef, nAngle, sn, cs ); // applying text rotation
1616 }
1617 
1618 void SdrObjCustomShape::NbcMirror( const Point& rRef1, const Point& rRef2 )
1619 {
1620  // TTTT: Fix for old mirroring, can be removed again in aw080
1621  // storing horizontal and vertical flipping without modifying the rotate angle
1622  // decompose other flipping to rotation and MirrorX.
1623  long ndx = rRef2.X()-rRef1.X();
1624  long ndy = rRef2.Y()-rRef1.Y();
1625 
1626  if(!ndx) // MirroredX
1627  {
1629  SdrTextObj::NbcMirror( rRef1, rRef2 );
1630  }
1631  else
1632  {
1633  if(!ndy) // MirroredY
1634  {
1636  SdrTextObj::NbcMirror( rRef1, rRef2 );
1637  }
1638  else // neither horizontal nor vertical
1639  {
1641 
1642  // call parent
1643  SdrTextObj::NbcMirror( rRef1, rRef2 );
1644 
1645  // update fObjectRotation
1646  long nTextObjRotation = aGeo.nRotationAngle;
1647  double fAngle = nTextObjRotation;
1648 
1649  fAngle /= 100.0;
1650 
1651  bool bSingleFlip = (IsMirroredX()!= IsMirroredY());
1652 
1653  fObjectRotation = fmod( bSingleFlip ? -fAngle : fAngle, 360.0 );
1654 
1655  if ( fObjectRotation < 0 )
1656  {
1657  fObjectRotation = 360.0 + fObjectRotation;
1658  }
1659  }
1660  }
1661 
1663 }
1664 
1665 void SdrObjCustomShape::Shear( const Point& rRef, long nAngle, double tn, bool bVShear )
1666 {
1667  SdrTextObj::Shear( rRef, nAngle, tn, bVShear );
1669 }
1670 void SdrObjCustomShape::NbcShear( const Point& rRef, long nAngle, double tn, bool bVShear )
1671 {
1672  // TTTT: Fix for old mirroring, can be removed again in aw080
1673  SdrTextObj::NbcShear(rRef,nAngle,tn,bVShear);
1674 
1675  // updating fObjectRotation
1676  long nTextObjRotation = aGeo.nRotationAngle;
1677  double fAngle = nTextObjRotation;
1678 
1679  fAngle /= 100.0;
1680 
1681  bool bSingleFlip = (IsMirroredX()!= IsMirroredY());
1682 
1683  fObjectRotation = fmod( bSingleFlip ? -fAngle : fAngle, 360.0 );
1684 
1685  if ( fObjectRotation < 0 )
1686  {
1687  fObjectRotation = 360.0 + fObjectRotation;
1688  }
1689 
1691 }
1692 
1693 
1695 {
1696  sal_Int32 nWdt = ImpGetLineWdt(); // #i25616#
1697 
1698  // #i25616#
1699  if(!LineIsOutsideGeometry())
1700  {
1701  nWdt++;
1702  nWdt /= 2;
1703  }
1704 
1705  Point aPt;
1706  switch (nPosNum) {
1707  case 0: aPt=maRect.TopCenter(); aPt.AdjustY( -nWdt ); break;
1708  case 1: aPt=maRect.RightCenter(); aPt.AdjustX(nWdt ); break;
1709  case 2: aPt=maRect.BottomCenter(); aPt.AdjustY(nWdt ); break;
1710  case 3: aPt=maRect.LeftCenter(); aPt.AdjustX( -nWdt ); break;
1711  }
1714  aPt-=GetSnapRect().Center();
1715  SdrGluePoint aGP(aPt);
1716  aGP.SetPercent(false);
1717  return aGP;
1718 }
1719 
1720 
1721 // #i38892#
1723 {
1724  const SdrObject* pSdrObject = GetSdrObjectFromCustomShape();
1725 
1726  if(pSdrObject)
1727  {
1728  const SdrGluePointList* pSource = pSdrObject->GetGluePointList();
1729 
1730  if(pSource && pSource->GetCount())
1731  {
1733  {
1735  }
1736 
1738 
1739  if(pList)
1740  {
1741  SdrGluePointList aNewList;
1742  sal_uInt16 a;
1743 
1744  for(a = 0; a < pSource->GetCount(); a++)
1745  {
1746  SdrGluePoint aCopy((*pSource)[a]);
1747  aCopy.SetUserDefined(false);
1748  aNewList.Insert(aCopy);
1749  }
1750 
1751  bool bMirroredX = IsMirroredX();
1752  bool bMirroredY = IsMirroredY();
1753 
1754  long nShearAngle = aGeo.nShearAngle;
1755  double fTan = aGeo.nTan;
1756 
1757  if ( aGeo.nRotationAngle || nShearAngle || bMirroredX || bMirroredY )
1758  {
1759  tools::Polygon aPoly( maRect );
1760  if( nShearAngle )
1761  {
1762  sal_uInt16 nPointCount=aPoly.GetSize();
1763  for (sal_uInt16 i=0; i<nPointCount; i++)
1764  ShearPoint(aPoly[i],maRect.Center(), fTan );
1765  }
1766  if ( aGeo.nRotationAngle )
1767  aPoly.Rotate( maRect.Center(), aGeo.nRotationAngle / 10 );
1768 
1769  tools::Rectangle aBoundRect( aPoly.GetBoundRect() );
1770  sal_Int32 nXDiff = aBoundRect.Left() - maRect.Left();
1771  sal_Int32 nYDiff = aBoundRect.Top() - maRect.Top();
1772 
1773  if (nShearAngle && bMirroredX != bMirroredY)
1774  {
1775  nShearAngle = -nShearAngle;
1776  fTan = -fTan;
1777  }
1778 
1779  Point aRef( maRect.GetWidth() / 2, maRect.GetHeight() / 2 );
1780  for ( a = 0; a < aNewList.GetCount(); a++ )
1781  {
1782  SdrGluePoint& rPoint = aNewList[ a ];
1783  Point aGlue( rPoint.GetPos() );
1784  if ( nShearAngle )
1785  ShearPoint( aGlue, aRef, fTan );
1786 
1787  RotatePoint(aGlue, aRef, sin(basegfx::deg2rad(fObjectRotation)),
1789  if ( bMirroredX )
1790  aGlue.setX( maRect.GetWidth() - aGlue.X() );
1791  if ( bMirroredY )
1792  aGlue.setY( maRect.GetHeight() - aGlue.Y() );
1793  aGlue.AdjustX( -nXDiff );
1794  aGlue.AdjustY( -nYDiff );
1795  rPoint.SetPos( aGlue );
1796  }
1797  }
1798 
1799  for(a = 0; a < pList->GetCount(); a++)
1800  {
1801  const SdrGluePoint& rCandidate = (*pList)[a];
1802 
1803  if(rCandidate.IsUserDefined())
1804  {
1805  aNewList.Insert(rCandidate);
1806  }
1807  }
1808 
1809  // copy new list to local. This is NOT very convenient behavior, the local
1810  // GluePointList should not be set, but we delivered by using GetGluePointList(),
1811  // maybe on demand. Since the local object is changed here, this is assumed to
1812  // be a result of GetGluePointList and thus the list is copied
1813  if(pPlusData)
1814  {
1815  pPlusData->SetGluePoints(aNewList);
1816  }
1817  }
1818  }
1819  }
1820 }
1821 
1822 // #i38892#
1824 {
1827 }
1828 
1829 // #i38892#
1831 {
1833  {
1836  }
1837  else
1838  {
1839  return nullptr;
1840  }
1841 }
1842 
1843 
1845 {
1846  const sal_uInt32 nBasicHdlCount(SdrTextObj::GetHdlCount());
1847  return ( GetInteractionHandles().size() + nBasicHdlCount );
1848 }
1849 
1851 {
1852  SdrTextObj::AddToHdlList(rHdlList);
1853 
1854  int nCustomShapeHdlNum = 0;
1855  for (SdrCustomShapeInteraction const & rInteraction : GetInteractionHandles())
1856  {
1857  if ( rInteraction.xInteraction.is() )
1858  {
1859  try
1860  {
1861  css::awt::Point aPosition( rInteraction.xInteraction->getPosition() );
1862  std::unique_ptr<SdrHdl> pH(new SdrHdl( Point( aPosition.X, aPosition.Y ), SdrHdlKind::CustomShape1 ));
1863  pH->SetPointNum( nCustomShapeHdlNum );
1864  pH->SetObj( const_cast<SdrObjCustomShape*>(this) );
1865  rHdlList.AddHdl(std::move(pH));
1866  }
1867  catch ( const uno::RuntimeException& )
1868  {
1869  }
1870  }
1871  ++nCustomShapeHdlNum;
1872  }
1873 }
1874 
1876 {
1877  return true;
1878 }
1879 
1881 {
1882  const SdrHdl* pHdl = rDrag.GetHdl();
1883 
1884  if(pHdl && SdrHdlKind::CustomShape1 == pHdl->GetKind())
1885  {
1886  rDrag.SetEndDragChangesAttributes(true);
1887  rDrag.SetNoSnap();
1888  }
1889  else
1890  {
1891  const SdrHdl* pHdl2 = rDrag.GetHdl();
1892  const SdrHdlKind eHdl((pHdl2 == nullptr) ? SdrHdlKind::Move : pHdl2->GetKind());
1893 
1894  switch( eHdl )
1895  {
1896  case SdrHdlKind::UpperLeft :
1897  case SdrHdlKind::Upper :
1898  case SdrHdlKind::UpperRight :
1899  case SdrHdlKind::Left :
1900  case SdrHdlKind::Right :
1901  case SdrHdlKind::LowerLeft :
1902  case SdrHdlKind::Lower :
1903  case SdrHdlKind::LowerRight :
1904  case SdrHdlKind::Move :
1905  {
1906  break;
1907  }
1908  default:
1909  {
1910  return false;
1911  }
1912  }
1913  }
1914 
1915  return true;
1916 }
1917 
1919 {
1920  tools::Rectangle aOld( maRect );
1921  bool bOldMirroredX( IsMirroredX() );
1922  bool bOldMirroredY( IsMirroredY() );
1923 
1924  tools::Rectangle aNewRect( rNewRect );
1925  aNewRect.Justify();
1926 
1927  std::vector< SdrCustomShapeInteraction > aInteractionHandles( GetInteractionHandles() );
1928 
1929  GeoStat aGeoStat( GetGeoStat() );
1930  if ( aNewRect.TopLeft()!= maRect.TopLeft() &&
1932  {
1933  Point aNewPos( aNewRect.TopLeft() );
1934  if ( aGeo.nShearAngle ) ShearPoint( aNewPos, aOld.TopLeft(), aGeoStat.nTan );
1935  if ( aGeo.nRotationAngle ) RotatePoint(aNewPos, aOld.TopLeft(), aGeoStat.nSin, aGeoStat.nCos );
1936  aNewRect.SetPos( aNewPos );
1937  }
1938  if ( aNewRect != maRect )
1939  {
1940  SetLogicRect( aNewRect );
1942 
1943  if ( rNewRect.Left() > rNewRect.Right() )
1944  {
1945  Point aTop( ( GetSnapRect().Left() + GetSnapRect().Right() ) >> 1, GetSnapRect().Top() );
1946  Point aBottom( aTop.X(), aTop.Y() + 1000 );
1947  NbcMirror( aTop, aBottom );
1948  }
1949  if ( rNewRect.Top() > rNewRect.Bottom() )
1950  {
1951  Point aLeft( GetSnapRect().Left(), ( GetSnapRect().Top() + GetSnapRect().Bottom() ) >> 1 );
1952  Point aRight( aLeft.X() + 1000, aLeft.Y() );
1953  NbcMirror( aLeft, aRight );
1954  }
1955 
1956  for (const auto& rInteraction : aInteractionHandles)
1957  {
1958  try
1959  {
1960  if ( rInteraction.nMode & CustomShapeHandleModes::RESIZE_FIXED )
1961  rInteraction.xInteraction->setControllerPosition( rInteraction.aPosition );
1962  if ( rInteraction.nMode & CustomShapeHandleModes::RESIZE_ABSOLUTE_X ||
1963  rInteraction.nMode & CustomShapeHandleModes::RESIZE_ABSOLUTE_NEGX )
1964  {
1965  if (rInteraction.nMode & CustomShapeHandleModes::RESIZE_ABSOLUTE_NEGX)
1966  bOldMirroredX = !bOldMirroredX;
1967 
1968  sal_Int32 nX;
1969  if ( bOldMirroredX )
1970  {
1971  nX = ( rInteraction.aPosition.X - aOld.Right() );
1972  if ( rNewRect.Left() > rNewRect.Right() )
1973  nX = maRect.Left() - nX;
1974  else
1975  nX += maRect.Right();
1976  }
1977  else
1978  {
1979  nX = ( rInteraction.aPosition.X - aOld.Left() );
1980  if ( rNewRect.Left() > rNewRect.Right() )
1981  nX = maRect.Right() - nX;
1982  else
1983  nX += maRect.Left();
1984  }
1985  rInteraction.xInteraction->setControllerPosition( css::awt::Point( nX, rInteraction.xInteraction->getPosition().Y ) );
1986  }
1987  if ( rInteraction.nMode & CustomShapeHandleModes::RESIZE_ABSOLUTE_Y )
1988  {
1989  sal_Int32 nY;
1990  if ( bOldMirroredY )
1991  {
1992  nY = ( rInteraction.aPosition.Y - aOld.Bottom() );
1993  if ( rNewRect.Top() > rNewRect.Bottom() )
1994  nY = maRect.Top() - nY;
1995  else
1996  nY += maRect.Bottom();
1997  }
1998  else
1999  {
2000  nY = ( rInteraction.aPosition.Y - aOld.Top() );
2001  if ( rNewRect.Top() > rNewRect.Bottom() )
2002  nY = maRect.Bottom() - nY;
2003  else
2004  nY += maRect.Top();
2005  }
2006  rInteraction.xInteraction->setControllerPosition( css::awt::Point( rInteraction.xInteraction->getPosition().X, nY ) );
2007  }
2008  }
2009  catch ( const uno::RuntimeException& )
2010  {
2011  }
2012  }
2013  }
2014 }
2015 
2017  const sal_uInt16 nCustomShapeHdlNum, bool bMoveCalloutRectangle )
2018 {
2019  std::vector< SdrCustomShapeInteraction > aInteractionHandles( GetInteractionHandles() );
2020  if ( nCustomShapeHdlNum < aInteractionHandles.size() )
2021  {
2022  SdrCustomShapeInteraction aInteractionHandle( aInteractionHandles[ nCustomShapeHdlNum ] );
2023  if ( aInteractionHandle.xInteraction.is() )
2024  {
2025  try
2026  {
2027  css::awt::Point aPt( rDestination.X(), rDestination.Y() );
2028  if ( aInteractionHandle.nMode & CustomShapeHandleModes::MOVE_SHAPE && bMoveCalloutRectangle )
2029  {
2030  sal_Int32 nXDiff = aPt.X - aInteractionHandle.aPosition.X;
2031  sal_Int32 nYDiff = aPt.Y - aInteractionHandle.aPosition.Y;
2032 
2033  maRect.Move( nXDiff, nYDiff );
2034  aOutRect.Move( nXDiff, nYDiff );
2035  maSnapRect.Move( nXDiff, nYDiff );
2036  SetRectsDirty(true);
2038 
2039  for (const auto& rInteraction : aInteractionHandles)
2040  {
2041  if ( rInteraction.nMode & CustomShapeHandleModes::RESIZE_FIXED )
2042  {
2043  if ( rInteraction.xInteraction.is() )
2044  rInteraction.xInteraction->setControllerPosition( rInteraction.aPosition );
2045  }
2046  }
2047  }
2048  aInteractionHandle.xInteraction->setControllerPosition( aPt );
2049  }
2050  catch ( const uno::RuntimeException& )
2051  {
2052  }
2053  }
2054  }
2055 }
2056 
2058 {
2059  const SdrHdl* pHdl = rDrag.GetHdl();
2060  const SdrHdlKind eHdl((pHdl == nullptr) ? SdrHdlKind::Move : pHdl->GetKind());
2061 
2062  switch(eHdl)
2063  {
2065  {
2067  DragMoveCustomShapeHdl( rDrag.GetNow(), static_cast<sal_uInt16>(pHdl->GetPointNum()), !rDrag.GetDragMethod()->IsShiftPressed() );
2068  SetRectsDirty();
2070  SetChanged();
2071  break;
2072  }
2073 
2074  case SdrHdlKind::UpperLeft :
2075  case SdrHdlKind::Upper :
2076  case SdrHdlKind::UpperRight :
2077  case SdrHdlKind::Left :
2078  case SdrHdlKind::Right :
2079  case SdrHdlKind::LowerLeft :
2080  case SdrHdlKind::Lower :
2081  case SdrHdlKind::LowerRight :
2082  {
2084  break;
2085  }
2086  case SdrHdlKind::Move :
2087  {
2088  Move(Size(rDrag.GetDX(), rDrag.GetDY()));
2089  break;
2090  }
2091  default: break;
2092  }
2093 
2094  return true;
2095 }
2096 
2097 
2099 {
2100  tools::Rectangle aRect1;
2101  rStat.TakeCreateRect( aRect1 );
2102 
2103  std::vector< SdrCustomShapeInteraction > aInteractionHandles( GetInteractionHandles() );
2104 
2105  sal_uInt32 const nDefaultObjectSizeWidth = 3000; // default width from SDOptions ?
2106  sal_uInt32 const nDefaultObjectSizeHeight= 3000;
2107 
2108  if ( ImpVerticalSwitch( *this ) )
2109  {
2110  SetMirroredX( aRect1.Left() > aRect1.Right() );
2111 
2112  aRect1 = tools::Rectangle( rStat.GetNow(), Size( nDefaultObjectSizeWidth, nDefaultObjectSizeHeight ) );
2113  // subtracting the horizontal difference of the latest handle from shape position
2114  if ( !aInteractionHandles.empty() )
2115  {
2116  sal_Int32 nHandlePos = aInteractionHandles[ aInteractionHandles.size() - 1 ].xInteraction->getPosition().X;
2117  aRect1.Move( maRect.Left() - nHandlePos, 0 );
2118  }
2119  }
2120  ImpJustifyRect( aRect1 );
2121  rStat.SetActionRect( aRect1 );
2122  maRect = aRect1;
2123  SetRectsDirty();
2124 
2125  for (const auto& rInteraction : aInteractionHandles)
2126  {
2127  try
2128  {
2129  if ( rInteraction.nMode & CustomShapeHandleModes::CREATE_FIXED )
2130  rInteraction.xInteraction->setControllerPosition( awt::Point( rStat.GetStart().X(), rStat.GetStart().Y() ) );
2131  }
2132  catch ( const uno::RuntimeException& )
2133  {
2134  }
2135  }
2136 
2138  bSnapRectDirty=true;
2139 }
2140 
2142 {
2143  SdrView* pView = rStat.GetView(); // #i37448#
2144  if( pView && pView->IsSolidDragging() )
2145  {
2147  }
2148  DragCreateObject( rStat );
2149  SetRectsDirty();
2150  return true;
2151 }
2152 
2154 {
2155  DragCreateObject( rStat );
2156 
2157  AdaptTextMinSize();
2158 
2159  SetRectsDirty();
2160  return ( eCmd == SdrCreateCmd::ForceEnd || rStat.GetPointCount() >= 2 );
2161 }
2162 
2164 {
2165  return GetLineGeometry( false );
2166 }
2167 
2168 
2169 // in context with the SdrObjCustomShape the SdrTextAutoGrowHeightItem == true -> Resize Shape to fit text,
2170 // the SdrTextAutoGrowWidthItem == true -> Word wrap text in Shape
2172 {
2173  const SfxItemSet& rSet = GetMergedItemSet();
2174  bool bIsAutoGrowHeight = rSet.Get(SDRATTR_TEXT_AUTOGROWHEIGHT).GetValue();
2175  if ( bIsAutoGrowHeight && IsVerticalWriting() )
2176  bIsAutoGrowHeight = !rSet.Get(SDRATTR_TEXT_WORDWRAP).GetValue();
2177  return bIsAutoGrowHeight;
2178 }
2180 {
2181  const SfxItemSet& rSet = GetMergedItemSet();
2182  bool bIsAutoGrowWidth = rSet.Get(SDRATTR_TEXT_AUTOGROWHEIGHT).GetValue();
2183  if ( bIsAutoGrowWidth && !IsVerticalWriting() )
2184  bIsAutoGrowWidth = !rSet.Get(SDRATTR_TEXT_WORDWRAP).GetValue();
2185  return bIsAutoGrowWidth;
2186 }
2187 
2188 /* The following method is identical to the SdrTextObj::SetVerticalWriting method, the only difference
2189  is that the SdrAutoGrowWidthItem and SdrAutoGrowHeightItem are not exchanged if the vertical writing
2190  mode has been changed */
2191 
2193 {
2195 
2196  OutlinerParaObject* pOutlinerParaObject = GetOutlinerParaObject();
2197 
2198  DBG_ASSERT( pOutlinerParaObject, "SdrTextObj::SetVerticalWriting() without OutlinerParaObject!" );
2199 
2200  if( pOutlinerParaObject )
2201  {
2202  if(pOutlinerParaObject->IsVertical() != bVertical)
2203  {
2204  // get item settings
2205  const SfxItemSet& rSet = GetObjectItemSet();
2206 
2207  // Also exchange horizontal and vertical adjust items
2208  SdrTextHorzAdjust eHorz = rSet.Get(SDRATTR_TEXT_HORZADJUST).GetValue();
2209  SdrTextVertAdjust eVert = rSet.Get(SDRATTR_TEXT_VERTADJUST).GetValue();
2210 
2211  // rescue object size, SetSnapRect below expects logic rect,
2212  // not snap rect.
2213  tools::Rectangle aObjectRect = GetLogicRect();
2214 
2215  // prepare ItemSet to set exchanged width and height items
2216  SfxItemSet aNewSet(*rSet.GetPool(),
2218  // Expanded item ranges to also support horizontal and vertical adjust.
2221 
2222  aNewSet.Put(rSet);
2223 
2224  // Exchange horizontal and vertical adjusts
2225  switch(eVert)
2226  {
2231  }
2232  switch(eHorz)
2233  {
2238  }
2239 
2240  pOutlinerParaObject = GetOutlinerParaObject();
2241  if ( pOutlinerParaObject )
2242  pOutlinerParaObject->SetVertical(bVertical);
2243  SetObjectItemSet( aNewSet );
2244 
2245  // restore object size
2246  SetSnapRect(aObjectRect);
2247  }
2248  }
2249 }
2250 
2251 void SdrObjCustomShape::SuggestTextFrameSize(Size aSuggestedTextFrameSize)
2252 {
2253  m_aSuggestedTextFrameSize = aSuggestedTextFrameSize;
2254 }
2255 
2257 {
2258  // Either we have text or the application has native text and suggested its size to us.
2259  bool bHasText = HasText() || (m_aSuggestedTextFrameSize.Width() != 0 && m_aSuggestedTextFrameSize.Height() != 0);
2260  if ( bHasText && !rR.IsEmpty() )
2261  {
2262  bool bWdtGrow=bWdt && IsAutoGrowWidth();
2263  bool bHgtGrow=bHgt && IsAutoGrowHeight();
2264  if ( bWdtGrow || bHgtGrow )
2265  {
2266  tools::Rectangle aR0(rR);
2267  long nHgt=0,nMinHgt=0,nMaxHgt=0;
2268  long nWdt=0,nMinWdt=0,nMaxWdt=0;
2269  Size aSiz(rR.GetSize()); aSiz.AdjustWidth( -1 ); aSiz.AdjustHeight( -1 );
2270  Size aMaxSiz(100000,100000);
2271  Size aTmpSiz(getSdrModelFromSdrObject().GetMaxObjSize());
2272  if (aTmpSiz.Width()!=0) aMaxSiz.setWidth(aTmpSiz.Width() );
2273  if (aTmpSiz.Height()!=0) aMaxSiz.setHeight(aTmpSiz.Height() );
2274  if (bWdtGrow)
2275  {
2276  nMinWdt=GetMinTextFrameWidth();
2277  nMaxWdt=GetMaxTextFrameWidth();
2278  if (nMaxWdt==0 || nMaxWdt>aMaxSiz.Width()) nMaxWdt=aMaxSiz.Width();
2279  if (nMinWdt<=0) nMinWdt=1;
2280  aSiz.setWidth(nMaxWdt );
2281  }
2282  if (bHgtGrow)
2283  {
2284  nMinHgt=GetMinTextFrameHeight();
2285  nMaxHgt=GetMaxTextFrameHeight();
2286  if (nMaxHgt==0 || nMaxHgt>aMaxSiz.Height()) nMaxHgt=aMaxSiz.Height();
2287  if (nMinHgt<=0) nMinHgt=1;
2288  aSiz.setHeight(nMaxHgt );
2289  }
2290  long nHDist=GetTextLeftDistance()+GetTextRightDistance();
2292  aSiz.AdjustWidth( -nHDist );
2293  aSiz.AdjustHeight( -nVDist );
2294  if ( aSiz.Width() < 2 )
2295  aSiz.setWidth( 2 ); // minimum size=2
2296  if ( aSiz.Height() < 2 )
2297  aSiz.setHeight( 2 ); // minimum size=2
2298 
2299  if (HasText())
2300  {
2301  if(pEdtOutl)
2302  {
2303  pEdtOutl->SetMaxAutoPaperSize( aSiz );
2304  if (bWdtGrow)
2305  {
2306  Size aSiz2(pEdtOutl->CalcTextSize());
2307  nWdt=aSiz2.Width()+1; // a little more tolerance
2308  if (bHgtGrow) nHgt=aSiz2.Height()+1; // a little more tolerance
2309  } else
2310  {
2311  nHgt=pEdtOutl->GetTextHeight()+1; // a little more tolerance
2312  }
2313  }
2314  else
2315  {
2316  Outliner& rOutliner=ImpGetDrawOutliner();
2317  rOutliner.SetPaperSize(aSiz);
2318  rOutliner.SetUpdateMode(true);
2319  // TODO: add the optimization with bPortionInfoChecked again.
2320  OutlinerParaObject* pOutlinerParaObject = GetOutlinerParaObject();
2321  if( pOutlinerParaObject != nullptr )
2322  {
2323  rOutliner.SetText(*pOutlinerParaObject);
2325  }
2326  if ( bWdtGrow )
2327  {
2328  Size aSiz2(rOutliner.CalcTextSize());
2329  nWdt=aSiz2.Width()+1; // a little more tolerance
2330  if ( bHgtGrow )
2331  nHgt=aSiz2.Height()+1; // a little more tolerance
2332  }
2333  else
2334  nHgt = rOutliner.GetTextHeight()+1; // a little more tolerance
2335  rOutliner.Clear();
2336  }
2337  }
2338  else
2339  {
2342  }
2343  if ( nWdt < nMinWdt )
2344  nWdt = nMinWdt;
2345  if ( nWdt > nMaxWdt )
2346  nWdt = nMaxWdt;
2347  nWdt += nHDist;
2348  if ( nWdt < 1 )
2349  nWdt = 1; // nHDist may also be negative
2350  if ( nHgt < nMinHgt )
2351  nHgt = nMinHgt;
2352  if ( nHgt > nMaxHgt )
2353  nHgt = nMaxHgt;
2354  nHgt+=nVDist;
2355  if ( nHgt < 1 )
2356  nHgt = 1; // nVDist may also be negative
2357  long nWdtGrow = nWdt-(rR.Right()-rR.Left());
2358  long nHgtGrow = nHgt-(rR.Bottom()-rR.Top());
2359  if ( nWdtGrow == 0 )
2360  bWdtGrow = false;
2361  if ( nHgtGrow == 0 )
2362  bHgtGrow=false;
2363  if ( bWdtGrow || bHgtGrow )
2364  {
2365  if ( bWdtGrow )
2366  {
2368  if ( eHAdj == SDRTEXTHORZADJUST_LEFT )
2369  rR.AdjustRight(nWdtGrow );
2370  else if ( eHAdj == SDRTEXTHORZADJUST_RIGHT )
2371  rR.AdjustLeft( -nWdtGrow );
2372  else
2373  {
2374  long nWdtGrow2=nWdtGrow/2;
2375  rR.AdjustLeft( -nWdtGrow2 );
2376  rR.SetRight(rR.Left()+nWdt );
2377  }
2378  }
2379  if ( bHgtGrow )
2380  {
2382  if ( eVAdj == SDRTEXTVERTADJUST_TOP )
2383  rR.AdjustBottom(nHgtGrow );
2384  else if ( eVAdj == SDRTEXTVERTADJUST_BOTTOM )
2385  rR.AdjustTop( -nHgtGrow );
2386  else
2387  {
2388  long nHgtGrow2=nHgtGrow/2;
2389  rR.AdjustTop( -nHgtGrow2 );
2390  rR.SetBottom(rR.Top()+nHgt );
2391  }
2392  }
2393  if ( aGeo.nRotationAngle )
2394  {
2395  Point aD1(rR.TopLeft());
2396  aD1-=aR0.TopLeft();
2397  Point aD2(aD1);
2399  aD2-=aD1;
2400  rR.Move(aD2.X(),aD2.Y());
2401  }
2402  return true;
2403  }
2404  }
2405  }
2406  return false;
2407 }
2408 
2410 {
2411  tools::Rectangle aReturnValue;
2412 
2413  tools::Rectangle aOldTextRect( maRect ); // <- initial text rectangle
2414 
2415  tools::Rectangle aNewTextRect( maRect ); // <- new text rectangle returned from the custom shape renderer,
2416  GetTextBounds( aNewTextRect ); // it depends to the current logical shape size
2417 
2418  tools::Rectangle aAdjustedTextRect( aNewTextRect ); // <- new text rectangle is being tested by AdjustTextFrameWidthAndHeight to ensure
2419  if ( AdjustTextFrameWidthAndHeight( aAdjustedTextRect, bHgt, bWdt ) ) // that the new text rectangle is matching the current text size from the outliner
2420  {
2421  if (aAdjustedTextRect != aNewTextRect && aOldTextRect != aAdjustedTextRect &&
2422  aNewTextRect.GetWidth() && aNewTextRect.GetHeight())
2423  {
2424  aReturnValue = maRect;
2425  double fXScale = static_cast<double>(aOldTextRect.GetWidth()) / static_cast<double>(aNewTextRect.GetWidth());
2426  double fYScale = static_cast<double>(aOldTextRect.GetHeight()) / static_cast<double>(aNewTextRect.GetHeight());
2427  double fRightDiff = static_cast<double>( aAdjustedTextRect.Right() - aNewTextRect.Right() ) * fXScale;
2428  double fLeftDiff = static_cast<double>( aAdjustedTextRect.Left() - aNewTextRect.Left() ) * fXScale;
2429  double fTopDiff = static_cast<double>( aAdjustedTextRect.Top() - aNewTextRect.Top() ) * fYScale;
2430  double fBottomDiff= static_cast<double>( aAdjustedTextRect.Bottom()- aNewTextRect.Bottom()) * fYScale;
2431  aReturnValue.AdjustLeft(static_cast<sal_Int32>(fLeftDiff) );
2432  aReturnValue.AdjustRight(static_cast<sal_Int32>(fRightDiff) );
2433  aReturnValue.AdjustTop(static_cast<sal_Int32>(fTopDiff) );
2434  aReturnValue.AdjustBottom(static_cast<sal_Int32>(fBottomDiff) );
2435  }
2436  }
2437  return aReturnValue;
2438 }
2439 
2441 {
2442  tools::Rectangle aNewTextRect = ImpCalculateTextFrame(bHgt, bWdt);
2443  const bool bRet = !aNewTextRect.IsEmpty() && aNewTextRect != maRect;
2445  {
2447 
2448  // taking care of handles that should not been changed
2449  std::vector< SdrCustomShapeInteraction > aInteractionHandles( GetInteractionHandles() );
2450 
2451  maRect = aNewTextRect;
2452  SetRectsDirty();
2453  SetChanged();
2454 
2455  for (const auto& rInteraction : aInteractionHandles)
2456  {
2457  try
2458  {
2459  if ( rInteraction.nMode & CustomShapeHandleModes::RESIZE_FIXED )
2460  rInteraction.xInteraction->setControllerPosition( rInteraction.aPosition );
2461  }
2462  catch ( const uno::RuntimeException& )
2463  {
2464  }
2465  }
2467 
2469  }
2470  return bRet;
2471 }
2472 
2474 {
2475  tools::Rectangle aNewTextRect = ImpCalculateTextFrame( true/*bHgt*/, true/*bWdt*/ );
2476  bool bRet = !aNewTextRect.IsEmpty() && ( aNewTextRect != maRect );
2477  if ( bRet )
2478  {
2479  tools::Rectangle aBoundRect0;
2480  if ( pUserCall )
2481  aBoundRect0 = GetCurrentBoundRect();
2482 
2483  // taking care of handles that should not been changed
2484  std::vector< SdrCustomShapeInteraction > aInteractionHandles( GetInteractionHandles() );
2485 
2486  maRect = aNewTextRect;
2487  SetRectsDirty();
2488 
2489  for (const auto& rInteraction : aInteractionHandles)
2490  {
2491  try
2492  {
2493  if ( rInteraction.nMode & CustomShapeHandleModes::RESIZE_FIXED )
2494  rInteraction.xInteraction->setControllerPosition( rInteraction.aPosition );
2495  }
2496  catch ( const uno::RuntimeException& )
2497  {
2498  }
2499  }
2500 
2502  SetChanged();
2505  }
2506  return bRet;
2507 }
2508 void SdrObjCustomShape::TakeTextEditArea(Size* pPaperMin, Size* pPaperMax, tools::Rectangle* pViewInit, tools::Rectangle* pViewMin) const
2509 {
2510  Size aPaperMin,aPaperMax;
2511  tools::Rectangle aViewInit;
2512  TakeTextAnchorRect( aViewInit );
2513  if ( aGeo.nRotationAngle )
2514  {
2515  Point aCenter(aViewInit.Center());
2516  aCenter-=aViewInit.TopLeft();
2517  Point aCenter0(aCenter);
2518  RotatePoint(aCenter,Point(),aGeo.nSin,aGeo.nCos);
2519  aCenter-=aCenter0;
2520  aViewInit.Move(aCenter.X(),aCenter.Y());
2521  }
2522  Size aAnkSiz(aViewInit.GetSize());
2523  aAnkSiz.AdjustWidth( -1 ); aAnkSiz.AdjustHeight( -1 ); // because GetSize() adds 1
2524  Size aMaxSiz(1000000,1000000);
2525  {
2526  Size aTmpSiz(getSdrModelFromSdrObject().GetMaxObjSize());
2527  if (aTmpSiz.Width()!=0) aMaxSiz.setWidth(aTmpSiz.Width() );
2528  if (aTmpSiz.Height()!=0) aMaxSiz.setHeight(aTmpSiz.Height() );
2529  }
2532 
2533  long nMinWdt = GetMinTextFrameWidth();
2534  long nMinHgt = GetMinTextFrameHeight();
2535  long nMaxWdt = GetMaxTextFrameWidth();
2536  long nMaxHgt = GetMaxTextFrameHeight();
2537  if (nMinWdt<1) nMinWdt=1;
2538  if (nMinHgt<1) nMinHgt=1;
2539  if ( nMaxWdt == 0 || nMaxWdt > aMaxSiz.Width() )
2540  nMaxWdt = aMaxSiz.Width();
2541  if ( nMaxHgt == 0 || nMaxHgt > aMaxSiz.Height() )
2542  nMaxHgt=aMaxSiz.Height();
2543 
2545  {
2546  if ( IsVerticalWriting() )
2547  {
2548  nMaxHgt = aAnkSiz.Height();
2549  nMinHgt = nMaxHgt;
2550  }
2551  else
2552  {
2553  nMaxWdt = aAnkSiz.Width();
2554  nMinWdt = nMaxWdt;
2555  }
2556  }
2557  aPaperMax.setWidth(nMaxWdt );
2558  aPaperMax.setHeight(nMaxHgt );
2559 
2560  aPaperMin.setWidth(nMinWdt );
2561  aPaperMin.setHeight(nMinHgt );
2562 
2563  if ( pViewMin )
2564  {
2565  *pViewMin = aViewInit;
2566 
2567  long nXFree = aAnkSiz.Width() - aPaperMin.Width();
2568  if ( eHAdj == SDRTEXTHORZADJUST_LEFT )
2569  pViewMin->AdjustRight( -nXFree );
2570  else if ( eHAdj == SDRTEXTHORZADJUST_RIGHT )
2571  pViewMin->AdjustLeft(nXFree );
2572  else { pViewMin->AdjustLeft(nXFree / 2 ); pViewMin->SetRight( pViewMin->Left() + aPaperMin.Width() ); }
2573 
2574  long nYFree = aAnkSiz.Height() - aPaperMin.Height();
2575  if ( eVAdj == SDRTEXTVERTADJUST_TOP )
2576  pViewMin->AdjustBottom( -nYFree );
2577  else if ( eVAdj == SDRTEXTVERTADJUST_BOTTOM )
2578  pViewMin->AdjustTop(nYFree );
2579  else { pViewMin->AdjustTop(nYFree / 2 ); pViewMin->SetBottom( pViewMin->Top() + aPaperMin.Height() ); }
2580  }
2581 
2582  if( IsVerticalWriting() )
2583  aPaperMin.setWidth( 0 );
2584  else
2585  aPaperMin.setHeight( 0 );
2586 
2587  if( eHAdj != SDRTEXTHORZADJUST_BLOCK )
2588  aPaperMin.setWidth(0 );
2589 
2590  // For complete vertical adjust support, set paper min height to 0, here.
2591  if(SDRTEXTVERTADJUST_BLOCK != eVAdj )
2592  aPaperMin.setHeight( 0 );
2593 
2594  if (pPaperMin!=nullptr) *pPaperMin=aPaperMin;
2595  if (pPaperMax!=nullptr) *pPaperMax=aPaperMax;
2596  if (pViewInit!=nullptr) *pViewInit=aViewInit;
2597 }
2599 {
2600  SdrTextObj::EndTextEdit( rOutl );
2602 }
2604 {
2605  if ( GetTextBounds( rAnchorRect ) )
2606  {
2607  Point aRotateRef( maSnapRect.Center() );
2608  rAnchorRect.AdjustLeft(GetTextLeftDistance() );
2609  rAnchorRect.AdjustTop(GetTextUpperDistance() );
2610  rAnchorRect.AdjustRight( -(GetTextRightDistance()) );
2611  rAnchorRect.AdjustBottom( -(GetTextLowerDistance()) );
2612  ImpJustifyRect( rAnchorRect );
2613 
2614  if ( rAnchorRect.GetWidth() < 2 )
2615  rAnchorRect.SetRight( rAnchorRect.Left() + 1 ); // minimal width is 2
2616  if ( rAnchorRect.GetHeight() < 2 )
2617  rAnchorRect.SetBottom( rAnchorRect.Top() + 1 ); // minimal height is 2
2618  if ( aGeo.nRotationAngle )
2619  {
2620  Point aP( rAnchorRect.TopLeft() );
2621  RotatePoint( aP, aRotateRef, aGeo.nSin, aGeo. nCos );
2622  rAnchorRect.SetPos( aP );
2623  }
2624  }
2625  else
2626  SdrTextObj::TakeTextAnchorRect( rAnchorRect );
2627 }
2628 void SdrObjCustomShape::TakeTextRect( SdrOutliner& rOutliner, tools::Rectangle& rTextRect, bool bNoEditText,
2629  tools::Rectangle* pAnchorRect, bool /*bLineWidth*/) const
2630 {
2631  tools::Rectangle aAnkRect; // Rect in which we anchor
2632  TakeTextAnchorRect(aAnkRect);
2635  EEControlBits nStat0=rOutliner.GetControlWord();
2636  Size aNullSize;
2637 
2638  rOutliner.SetControlWord(nStat0|EEControlBits::AUTOPAGESIZE);
2639  rOutliner.SetMinAutoPaperSize(aNullSize);
2640  sal_Int32 nMaxAutoPaperWidth = 1000000;
2641  sal_Int32 nMaxAutoPaperHeight= 1000000;
2642 
2643  long nAnkWdt=aAnkRect.GetWidth();
2644  long nAnkHgt=aAnkRect.GetHeight();
2645 
2647  {
2648  if ( IsVerticalWriting() )
2649  nMaxAutoPaperHeight = nAnkHgt;
2650  else
2651  nMaxAutoPaperWidth = nAnkWdt;
2652  }
2653  if(SDRTEXTHORZADJUST_BLOCK == eHAdj && !IsVerticalWriting())
2654  {
2655  rOutliner.SetMinAutoPaperSize(Size(nAnkWdt, 0));
2656  }
2657 
2658  if(SDRTEXTVERTADJUST_BLOCK == eVAdj && IsVerticalWriting())
2659  {
2660  rOutliner.SetMinAutoPaperSize(Size(0, nAnkHgt));
2661  }
2662  rOutliner.SetMaxAutoPaperSize( Size( nMaxAutoPaperWidth, nMaxAutoPaperHeight ) );
2663  rOutliner.SetPaperSize( aNullSize );
2664 
2665  // put text into the Outliner - if necessary the use the text from the EditOutliner
2667  if (pEdtOutl && !bNoEditText)
2668  pPara=pEdtOutl->CreateParaObject().release();
2669 
2670  if (pPara)
2671  {
2672  bool bHitTest(&getSdrModelFromSdrObject().GetHitTestOutliner() == &rOutliner);
2673  const SdrTextObj* pTestObj = rOutliner.GetTextObj();
2674 
2675  if( !pTestObj || !bHitTest || pTestObj != this ||
2676  pTestObj->GetOutlinerParaObject() != GetOutlinerParaObject() )
2677  {
2678  if( bHitTest )
2679  rOutliner.SetTextObj( this );
2680 
2681  rOutliner.SetUpdateMode(true);
2682  rOutliner.SetText(*pPara);
2683  }
2684  }
2685  else
2686  {
2687  rOutliner.SetTextObj( nullptr );
2688  }
2689  if (pEdtOutl && !bNoEditText && pPara)
2690  delete pPara;
2691 
2692  rOutliner.SetUpdateMode(true);
2693  rOutliner.SetControlWord(nStat0);
2694 
2695  SdrText* pText = getActiveText();
2696  if( pText )
2697  pText->CheckPortionInfo( rOutliner );
2698 
2699  Point aTextPos(aAnkRect.TopLeft());
2700  Size aTextSiz(rOutliner.GetPaperSize()); // GetPaperSize() has a little added tolerance, no?
2701 
2702  // For draw objects containing text correct horizontal/vertical alignment if text is bigger
2703  // than the object itself. Without that correction, the text would always be
2704  // formatted to the left edge (or top edge when vertical) of the draw object.
2705 
2706  if( !IsTextFrame() )
2707  {
2708  if(aAnkRect.GetWidth() < aTextSiz.Width() && !IsVerticalWriting())
2709  {
2710  // Horizontal case here. Correct only if eHAdj == SDRTEXTHORZADJUST_BLOCK,
2711  // else the alignment is wanted.
2712  if(SDRTEXTHORZADJUST_BLOCK == eHAdj)
2713  {
2714  SvxAdjust eAdjust = GetObjectItemSet().Get(EE_PARA_JUST).GetAdjust();
2715  switch (eAdjust)
2716  {
2717  case SvxAdjust::Left: eHAdj = SDRTEXTHORZADJUST_LEFT; break;
2718  case SvxAdjust::Right: eHAdj = SDRTEXTHORZADJUST_RIGHT; break;
2719  case SvxAdjust::Center: eHAdj = SDRTEXTHORZADJUST_CENTER; break;
2720  default: break;
2721  }
2722  }
2723  }
2724 
2725  if(aAnkRect.GetHeight() < aTextSiz.Height() && IsVerticalWriting())
2726  {
2727  // Vertical case here. Correct only if eHAdj == SDRTEXTVERTADJUST_BLOCK,
2728  // else the alignment is wanted.
2729  if(SDRTEXTVERTADJUST_BLOCK == eVAdj)
2730  {
2731  eVAdj = SDRTEXTVERTADJUST_CENTER;
2732  }
2733  }
2734  }
2735 
2737  {
2738  long nFreeWdt=aAnkRect.GetWidth()-aTextSiz.Width();
2739  if (eHAdj==SDRTEXTHORZADJUST_CENTER)
2740  aTextPos.AdjustX(nFreeWdt/2 );
2741  if (eHAdj==SDRTEXTHORZADJUST_RIGHT)
2742  aTextPos.AdjustX(nFreeWdt );
2743  }
2745  {
2746  long nFreeHgt=aAnkRect.GetHeight()-aTextSiz.Height();
2747  if (eVAdj==SDRTEXTVERTADJUST_CENTER)
2748  aTextPos.AdjustY(nFreeHgt/2 );
2749  if (eVAdj==SDRTEXTVERTADJUST_BOTTOM)
2750  aTextPos.AdjustY(nFreeHgt );
2751  }
2752  if (aGeo.nRotationAngle!=0)
2753  RotatePoint(aTextPos,aAnkRect.TopLeft(),aGeo.nSin,aGeo.nCos);
2754 
2755  if (pAnchorRect)
2756  *pAnchorRect=aAnkRect;
2757 
2758  // using rTextRect together with ContourFrame doesn't always work correctly
2759  rTextRect=tools::Rectangle(aTextPos,aTextSiz);
2760 }
2761 
2762 void SdrObjCustomShape::NbcSetOutlinerParaObject(std::unique_ptr<OutlinerParaObject> pTextObject)
2763 {
2764  SdrTextObj::NbcSetOutlinerParaObject( std::move(pTextObject) );
2766  SetRectsDirty(true);
2768 }
2769 
2771 {
2772  return CloneHelper< SdrObjCustomShape >(rTargetModel);
2773 }
2774 
2776 {
2777  if( this == &rObj )
2778  return *this;
2779  SdrTextObj::operator=( rObj );
2784  return *this;
2785 }
2786 
2787 
2789 {
2790  OUStringBuffer sName(SvxResId(STR_ObjNameSingulCUSTOMSHAPE));
2791  OUString aNm(GetName());
2792  if (!aNm.isEmpty())
2793  {
2794  sName.append(' ');
2795  sName.append('\'');
2796  sName.append(aNm);
2797  sName.append('\'');
2798  }
2799  return sName.makeStringAndClear();
2800 }
2801 
2803 {
2804  return SvxResId(STR_ObjNamePluralCUSTOMSHAPE);
2805 }
2806 
2808 {
2809  return GetLineGeometry( false );
2810 }
2811 
2813 {
2814  const SdrObject* pSdrObject = GetSdrObjectFromCustomShape();
2815  if ( pSdrObject )
2816  return pSdrObject->TakeContour();
2817  return basegfx::B2DPolyPolygon();
2818 }
2819 
2821 {
2822  // #i37011#
2823  SdrObjectUniquePtr pRetval;
2824  SdrObject* pRenderedCustomShape = nullptr;
2825 
2826  if ( !mXRenderedCustomShape.is() )
2827  {
2828  // force CustomShape
2830  }
2831 
2832  if ( mXRenderedCustomShape.is() )
2833  {
2834  pRenderedCustomShape = GetSdrObjectFromXShape( mXRenderedCustomShape );
2835  }
2836 
2837  if ( pRenderedCustomShape )
2838  {
2839  // Clone to same SdrModel
2840  SdrObject* pCandidate(pRenderedCustomShape->CloneSdrObject(pRenderedCustomShape->getSdrModelFromSdrObject()));
2841  DBG_ASSERT(pCandidate, "SdrObjCustomShape::DoConvertToPolyObj: Could not clone SdrObject (!)");
2842  pRetval = pCandidate->DoConvertToPolyObj(bBezier, bAddText);
2843  SdrObject::Free( pCandidate );
2844 
2845  if(pRetval)
2846  {
2847  const bool bShadow(GetMergedItem(SDRATTR_SHADOW).GetValue());
2848  if(bShadow)
2849  {
2850  pRetval->SetMergedItem(makeSdrShadowItem(true));
2851  }
2852  }
2853 
2854  if(bAddText && HasText() && !IsTextPath())
2855  {
2856  pRetval = ImpConvertAddText(std::move(pRetval), bBezier);
2857  }
2858  }
2859 
2860  return pRetval;
2861 }
2862 
2863 void SdrObjCustomShape::NbcSetStyleSheet( SfxStyleSheet* pNewStyleSheet, bool bDontRemoveHardAttr )
2864 {
2865  // #i40944#
2867  SdrObject::NbcSetStyleSheet( pNewStyleSheet, bDontRemoveHardAttr );
2868 }
2869 
2871 {
2872  // call parent
2873  SdrTextObj::handlePageChange(pOldPage, pNewPage);
2874 
2875  if(nullptr != pNewPage)
2876  {
2877  // invalidating rectangles by SetRectsDirty is not sufficient,
2878  // AdjustTextFrameWidthAndHeight() also has to be made, both
2879  // actions are done by NbcSetSnapRect
2880  tools::Rectangle aTmp( maRect ); //creating temporary rectangle #i61108#
2881  NbcSetSnapRect( aTmp );
2882  }
2883 }
2884 
2886 {
2887  return new SdrAShapeObjGeoData;
2888 }
2889 
2891 {
2892  SdrTextObj::SaveGeoData( rGeo );
2893  SdrAShapeObjGeoData& rAGeo=static_cast<SdrAShapeObjGeoData&>(rGeo);
2895  rAGeo.bMirroredX = IsMirroredX();
2896  rAGeo.bMirroredY = IsMirroredY();
2897 
2898  const OUString sAdjustmentValues( "AdjustmentValues" );
2899  const Any* pAny = GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY ).GetPropertyValueByName( sAdjustmentValues );
2900  if ( pAny )
2901  *pAny >>= rAGeo.aAdjustmentSeq;
2902 }
2903 
2905 {
2906  SdrTextObj::RestGeoData( rGeo );
2907  const SdrAShapeObjGeoData& rAGeo=static_cast<const SdrAShapeObjGeoData&>(rGeo);
2909  SetMirroredX( rAGeo.bMirroredX );
2910  SetMirroredY( rAGeo.bMirroredY );
2911 
2913  const OUString sAdjustmentValues( "AdjustmentValues" );
2914  PropertyValue aPropVal;
2915  aPropVal.Name = sAdjustmentValues;
2916  aPropVal.Value <<= rAGeo.aAdjustmentSeq;
2917  rGeometryItem.SetPropertyValue( aPropVal );
2918  SetMergedItem( rGeometryItem );
2919 
2921 }
2922 
2924 {
2925  // break up matrix
2926  basegfx::B2DTuple aScale;
2927  basegfx::B2DTuple aTranslate;
2928  double fRotate, fShearX;
2929  rMatrix.decompose(aScale, aTranslate, fRotate, fShearX);
2930 
2931  // #i75086# Old DrawingLayer (GeoStat and geometry) does not support holding negative scalings
2932  // in X and Y which equal a 180 degree rotation. Recognize it and react accordingly
2933  if(basegfx::fTools::less(aScale.getX(), 0.0) && basegfx::fTools::less(aScale.getY(), 0.0))
2934  {
2935  aScale.setX(fabs(aScale.getX()));
2936  aScale.setY(fabs(aScale.getY()));
2937  fRotate = fmod(fRotate + F_PI, F_2PI);
2938  }
2939 
2940  // reset object shear and rotations
2941  fObjectRotation = 0.0;
2942  aGeo.nRotationAngle = 0;
2943  aGeo.RecalcSinCos();
2944  aGeo.nShearAngle = 0;
2945  aGeo.RecalcTan();
2946 
2947  // if anchor is used, make position relative to it
2948  if(getSdrModelFromSdrObject().IsWriter())
2949  {
2950  if(GetAnchorPos().X() || GetAnchorPos().Y())
2951  {
2952  aTranslate += basegfx::B2DTuple(GetAnchorPos().X(), GetAnchorPos().Y());
2953  }
2954  }
2955 
2956  // build and set BaseRect (use scale)
2957  Size aSize(FRound(aScale.getX()), FRound(aScale.getY()));
2958  // fdo#47434 We need a valid rectangle here
2959  if( !aSize.Height() ) aSize.setHeight( 1 );
2960  if( !aSize.Width() ) aSize.setWidth( 1 );
2961 
2962  tools::Rectangle aBaseRect(Point(), aSize);
2963  SetSnapRect(aBaseRect);
2964 
2965  // shear?
2966  if(!basegfx::fTools::equalZero(fShearX))
2967  {
2968  GeoStat aGeoStat;
2969  // #i123181# The fix for #121932# here was wrong, the trunk version does not correct the
2970  // mirrored shear values, neither at the object level, nor on the API or XML level. Taking
2971  // back the mirroring of the shear angle
2972  aGeoStat.nShearAngle = FRound(basegfx::rad2deg(atan(fShearX)) * 100.0);
2973  aGeoStat.RecalcTan();
2974  Shear(Point(), aGeoStat.nShearAngle, aGeoStat.nTan, false);
2975  }
2976 
2977  // rotation?
2978  if(!basegfx::fTools::equalZero(fRotate))
2979  {
2980  GeoStat aGeoStat;
2981 
2982  // #i78696#
2983  // fRotate is mathematically correct, but aGeoStat.nRotationAngle is
2984  // mirrored -> mirror value here
2985  aGeoStat.nRotationAngle = NormAngle36000(FRound(-fRotate / F_PI18000));
2986  aGeoStat.RecalcSinCos();
2987  Rotate(Point(), aGeoStat.nRotationAngle, aGeoStat.nSin, aGeoStat.nCos);
2988  }
2989 
2990  // translate?
2991  if(!aTranslate.equalZero())
2992  {
2993  Move(Size(FRound(aTranslate.getX()), FRound(aTranslate.getY())));
2994  }
2995 }
2996 
2997 // taking fObjectRotation instead of aGeo.nAngle
2999 {
3000  // get turn and shear
3001  double fRotate = basegfx::deg2rad(fObjectRotation);
3002  double fShearX = basegfx::deg2rad(aGeo.nShearAngle / 100.0);
3003 
3004  // get aRect, this is the unrotated snaprect
3005  tools::Rectangle aRectangle(maRect);
3006 
3007  bool bMirroredX = IsMirroredX();
3008  bool bMirroredY = IsMirroredY();
3009  if ( bMirroredX || bMirroredY )
3010  { // we have to retrieve the unmirrored rect
3011 
3012  GeoStat aNewGeo( aGeo );
3013 
3014  if ( bMirroredX )
3015  {
3016  tools::Polygon aPol = Rect2Poly(maRect, aNewGeo);
3017  tools::Rectangle aBoundRect( aPol.GetBoundRect() );
3018 
3019  Point aRef1( ( aBoundRect.Left() + aBoundRect.Right() ) >> 1, aBoundRect.Top() );
3020  Point aRef2( aRef1.X(), aRef1.Y() + 1000 );
3021  sal_uInt16 i;
3022  sal_uInt16 nPointCount=aPol.GetSize();
3023  for (i=0; i<nPointCount; i++)
3024  {
3025  MirrorPoint(aPol[i],aRef1,aRef2);
3026  }
3027  // mirror polygon and move it a bit
3028  tools::Polygon aPol0(aPol);
3029  aPol[0]=aPol0[1];
3030  aPol[1]=aPol0[0];
3031  aPol[2]=aPol0[3];
3032  aPol[3]=aPol0[2];
3033  aPol[4]=aPol0[1];
3034  Poly2Rect(aPol,aRectangle,aNewGeo);
3035  }
3036  if ( bMirroredY )
3037  {
3038  tools::Polygon aPol( Rect2Poly( aRectangle, aNewGeo ) );
3039  tools::Rectangle aBoundRect( aPol.GetBoundRect() );
3040 
3041  Point aRef1( aBoundRect.Left(), ( aBoundRect.Top() + aBoundRect.Bottom() ) >> 1 );
3042  Point aRef2( aRef1.X() + 1000, aRef1.Y() );
3043  sal_uInt16 i;
3044  sal_uInt16 nPointCount=aPol.GetSize();
3045  for (i=0; i<nPointCount; i++)
3046  {
3047  MirrorPoint(aPol[i],aRef1,aRef2);
3048  }
3049  // mirror polygon and move it a bit
3050  tools::Polygon aPol0(aPol);
3051  aPol[0]=aPol0[1]; // This was WRONG for vertical (!)
3052  aPol[1]=aPol0[0]; // #i121932# Despite my own comment above
3053  aPol[2]=aPol0[3]; // it was *not* wrong even when the reordering
3054  aPol[3]=aPol0[2]; // *seems* to be specific for X-Mirrorings. Oh
3055  aPol[4]=aPol0[1]; // will I be happy when this old stuff is |gone| with aw080 (!)
3056  Poly2Rect(aPol,aRectangle,aNewGeo);
3057  }
3058  }
3059 
3060  // fill other values
3061  basegfx::B2DTuple aScale(aRectangle.GetWidth(), aRectangle.GetHeight());
3062  basegfx::B2DTuple aTranslate(aRectangle.Left(), aRectangle.Top());
3063 
3064  // position may be relative to anchorpos, convert
3066  {
3067  if(GetAnchorPos().X() || GetAnchorPos().Y())
3068  {
3069  aTranslate -= basegfx::B2DTuple(GetAnchorPos().X(), GetAnchorPos().Y());
3070  }
3071  }
3072 
3073  // build matrix
3075  aScale,
3076  basegfx::fTools::equalZero(fShearX) ? 0.0 : tan(fShearX),
3077  basegfx::fTools::equalZero(fRotate) ? 0.0 : -fRotate,
3078  aTranslate);
3079 
3080  return false;
3081 }
3082 
3083 std::unique_ptr<sdr::contact::ViewContact> SdrObjCustomShape::CreateObjectSpecificViewContact()
3084 {
3085  return std::make_unique<sdr::contact::ViewContactOfSdrObjCustomShape>(*this);
3086 }
3087 
3088 // #i33136#
3089 bool SdrObjCustomShape::doConstructOrthogonal(const OUString& rName)
3090 {
3091  bool bRetval(false);
3092 
3093  if(rName.equalsIgnoreAsciiCase("quadrat"))
3094  {
3095  bRetval = true;
3096  }
3097  else if(rName.equalsIgnoreAsciiCase("round-quadrat"))
3098  {
3099  bRetval = true;
3100  }
3101  else if(rName.equalsIgnoreAsciiCase("circle"))
3102  {
3103  bRetval = true;
3104  }
3105  else if(rName.equalsIgnoreAsciiCase("circle-pie"))
3106  {
3107  bRetval = true;
3108  }
3109  else if(rName.equalsIgnoreAsciiCase("ring"))
3110  {
3111  bRetval = true;
3112  }
3113 
3114  return bRetval;
3115 }
3116 
3117 // #i37011# centralize throw-away of render geometry
3119 {
3120  mXRenderedCustomShape = nullptr;
3122  mpLastShadowGeometry = nullptr;
3123 }
3124 
3125 void SdrObjCustomShape::impl_setUnoShape(const uno::Reference<uno::XInterface>& rxUnoShape)
3126 {
3127  SdrTextObj::impl_setUnoShape(rxUnoShape);
3128 
3129  // The shape engine is created with _current_ shape. This means we
3130  // _must_ reset it when the shape changes.
3131  mxCustomShapeEngine.set(nullptr);
3132 }
3133 
3135 {
3136  OUString sShapeName;
3137  OUString aEngine( GetMergedItem( SDRATTR_CUSTOMSHAPE_ENGINE ).GetValue() );
3138  if ( aEngine.isEmpty()
3139  || aEngine == "com.sun.star.drawing.EnhancedCustomShapeEngine" )
3140  {
3141  OUString sShapeType;
3142  const OUString sType("Type");
3144  const Any* pAny = rGeometryItem.GetPropertyValueByName( sType );
3145  if ( pAny && ( *pAny >>= sShapeType ) )
3146  sShapeName = EnhancedCustomShapeTypeNames::GetAccName( sShapeType );
3147  }
3148  return sShapeName;
3149 }
3150 
3151 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Point TopLeft() const
long Width() const
void SetPos(const Point &rPoint)
tools::Rectangle ImpCalculateTextFrame(const bool bHgt, const bool bWdt)
Definition: svdoashp.cxx:2409
void SetPropertyValue(const css::beans::PropertyValue &rPropVal)
long GetMinTextFrameHeight() const
Definition: svdotext.cxx:1712
long GetWidth() const
void setX(double fX)
virtual void TakeObjInfo(SdrObjTransformInfoRec &rInfo) const
Definition: svdobj.cxx:590
virtual void NbcResize(const Point &rRef, const Fraction &xFact, const Fraction &yFact) override
Definition: svdotxtr.cxx:106
#define XATTR_FILLHATCH
Definition: xdef.hxx:110
uno::Reference< drawing::XShape > GetXShapeForSdrObject(SdrObject *pObj)
returns a StarOffice API wrapper for the given SdrObject
Definition: unoshape.cxx:3955
virtual SdrObjCustomShape * CloneSdrObject(SdrModel &rTargetModel) const override
Definition: svdoashp.cxx:2770
long GetHeight() const
virtual void Shear(const Point &rRef, long nAngle, double tn, bool bVShear) override
Definition: svdoashp.cxx:1665
virtual const tools::Rectangle & GetCurrentBoundRect() const
Definition: svdobj.cxx:881
SVX_DLLPRIVATE void DragCreateObject(SdrDragStat &rDrag)
Definition: svdoashp.cxx:2098
#define SDRATTR_TEXT_WORDWRAP
Definition: svddef.hxx:218
Universal Network Object packed into SvDraw object.
Definition: svdobj.hxx:146
void ShearPoint(Point &rPnt, const Point &rRef, double tn, bool bVShear=false)
Definition: svdtrans.hxx:122
long FRound(double fVal)
#define SDRATTR_CUSTOMSHAPE_ENGINE
Definition: svddef.hxx:393
long AdjustWidth(long n)
SdrObjUserCall * pUserCall
Definition: svdobj.hxx:923
long AdjustX(long nHorzMove)
void ForceOutlinerParaObject()
Definition: svdotext.cxx:1472
SvxMSDffVertPair *const pVertices
std::string GetValue
sal_Int32 ImpGetLineWdt() const
Detects the width of the line. No line ->0.
Definition: svdoattr.cxx:120
long Height() const
double nSin
Definition: svdtrans.hxx:219
const Point & GetStart() const
Definition: svddrag.hxx:92
GeoStat aGeo
Definition: svdotext.hxx:185
SdrHdlKind
Definition: svdhdl.hxx:52
void SetPaperSize(const Size &rSize)
bool IsVertical() const
SdrTextHorzAdjust
Definition: sdtaitm.hxx:53
void Poly2Rect(const tools::Polygon &rPol, tools::Rectangle &rRect, GeoStat &rGeo)
Definition: svdtrans.cxx:486
long AdjustLeft(long nHorzMoveDelta)
long GetMinTextFrameWidth() const
Definition: svdotext.cxx:1722
SdrMetricItem makeSdrTextMinFrameWidthItem(long mnWidth)
Definition: sdtmfitm.hxx:33
virtual void NbcRotate(const Point &rRef, long nAngle, double sn, double cs) override
Definition: svdoashp.cxx:1573
std::shared_ptr< ContentProperties > const pData
virtual std::unique_ptr< sdr::contact::ViewContact > CreateObjectSpecificViewContact() override
Definition: svdoashp.cxx:3083
virtual SdrObjectUniquePtr DoConvertToPolyObj(bool bBezier, bool bAddText) const
Definition: svdobj.cxx:2552
SdrOutliner * pEdtOutl
Definition: svdotext.hxx:196
bool IsTextFrame() const
Definition: svdotext.hxx:343
long nRotationAngle
Definition: svdtrans.hxx:216
static sal_Int32 GetNumberOfProperties(const SvxMSDffHandle *pData)
Definition: svdoashp.cxx:682
double getX() const
sal_Int64 n
#define XATTR_FILLGRADIENT
Definition: xdef.hxx:109
#define SDRATTR_SHADOWTRANSPARENCE
Definition: svddef.hxx:175
virtual void Move(const Size &rSiz) override
Definition: svdoashp.cxx:1486
sal_uInt32 GetPointNum() const
Definition: svdhdl.hxx:222
virtual sal_uInt32 GetHdlCount() const override
Via GetHdlCount the number of Handles can be retrieved.
Definition: svdotxdr.cxx:36
virtual void SetBoundRectDirty()
Definition: svdobj.cxx:336
#define EE_PARA_JUST
virtual void AdaptTextMinSize() override
Definition: svdoashp.cxx:1399
virtual basegfx::B2DPolyPolygon TakeContour() const override
contour for TextToContour
Definition: svdoashp.cxx:2812
#define SDRATTR_SHADOWCOLOR
Definition: svddef.hxx:172
double getY() const
virtual void SaveGeoData(SdrObjGeoData &rGeo) const override
Definition: svdoashp.cxx:2890
virtual void NbcSetLogicRect(const tools::Rectangle &rRect) override
Definition: svdoashp.cxx:1464
SdrObjectUniquePtr ImpConvertAddText(SdrObjectUniquePtr pObj, bool bBezier) const
Definition: svdotxtr.cxx:467
virtual bool MovCreate(SdrDragStat &rStat) override
Definition: svdoashp.cxx:2141
virtual bool EndCreate(SdrDragStat &rStat, SdrCreateCmd eCmd) override
Definition: svdoashp.cxx:2153
static void Free(SdrObject *&_rpObject)
Definition: svdobj.cxx:423
sal_uInt16 GetCount() const
Definition: svdglue.hxx:126
void RecalcTan()
Definition: svdtrans.cxx:462
virtual const tools::Rectangle & GetSnapRect() const override
Definition: svdoattr.cxx:91
EEControlBits
All geometrical data of an arbitrary object for use in undo/redo.
Definition: svdobj.hxx:226
virtual std::unique_ptr< sdr::properties::BaseProperties > CreateObjectSpecificProperties() override
Definition: svdoashp.cxx:813
long NormAngle36000(long a)
Normalize angle to -180.00..179.99.
Definition: svdtrans.cxx:407
constexpr double rad2deg(double v)
virtual void EndTextEdit(SdrOutliner &rOutl)
Definition: svdotxed.cxx:265
SdrObjCustomShape(SdrModel &rSdrModel)
Definition: svdoashp.cxx:818
virtual bool HasText() const override
Definition: svdotxat.cxx:429
virtual void Rotate(const Point &rRef, long nAngle, double sn, double cs)
Definition: svdobj.cxx:1538
long AdjustBottom(long nVertMoveDelta)
virtual void TakeObjInfo(SdrObjTransformInfoRec &rInfo) const override
Definition: svdoashp.cxx:1334
void Move(long nHorzMoveDelta, long nVertMoveDelta)
bool bSnapRectDirty
Definition: svdobj.hxx:928
virtual void NbcMirror(const Point &rRef1, const Point &rRef2) override
Definition: svdotxtr.cxx:236
Point RightCenter() const
bool IsCustomShapeFilledByDefault(MSO_SPT eSpType)
bool IsEmpty() const
Provides information about various ZObject properties.
Definition: svdobj.hxx:248
void SetColor(const Color &rColor)
Definition: xhatch.hxx:45
const SdrHdl * GetHdl() const
Definition: svddrag.hxx:101
long Right() const
virtual bool hasSpecialDrag() const override
The standard transformations (Move,Resize,Rotate,Mirror,Shear) are taken over by the View (TakeXorPol...
Definition: svdoashp.cxx:1875
void SetControlWord(EEControlBits nWord)
#define SDRATTR_CUSTOMSHAPE_GEOMETRY
Definition: svddef.hxx:395
SvxMSDffCalculationData *const pCalculation
bool IsMore() const
Definition: svditer.hxx:62
MSO_SPT
Definition: msdffdef.hxx:275
OUString SvxResId(const char *pId)
Definition: dialmgr.cxx:28
long GetDX() const
Definition: svddrag.hxx:148
bool IsMirroredX() const
Definition: svdoashp.cxx:475
#define X
virtual void SaveGeoData(SdrObjGeoData &rGeo) const override
Definition: svdotext.cxx:1440
B2DHomMatrix createScaleShearXRotateTranslateB2DHomMatrix(double fScaleX, double fScaleY, double fShearX, double fRadiant, double fTranslateX, double fTranslateY)
The transformation of a rectangle into a polygon, by using angle parameters from GeoStat.
Definition: svdtrans.hxx:214
Point BottomCenter() const
int nCount
bool LineIsOutsideGeometry() const
Definition: svdobj.hxx:899
virtual void SetLogicRect(const tools::Rectangle &rRect) override
Definition: svdoashp.cxx:1476
const SfxItemSet & GetObjectItemSet() const
Definition: svdobj.cxx:1906
tools::Rectangle maRect
Definition: svdotext.hxx:182
void SetFixedCellHeight(bool bUseFixedCellHeight)
void TakeCreateRect(tools::Rectangle &rRect) const
Definition: svddrag.cxx:115
static SdrObject * ImpCreateShadowObjectClone(const SdrObject &rOriginal, const SfxItemSet &rOriginalSet)
Definition: svdoashp.cxx:217
bool bClosedObj
Definition: svdobj.hxx:941
long Top() const
EEControlBits GetControlWord() const
const GeoStat & GetGeoStat() const
Definition: svdotext.hxx:399
virtual void impl_setUnoShape(const css::uno::Reference< css::uno::XInterface > &rxUnoShape) override
Sets a new UNO shape.
Definition: svdoashp.cxx:3125
tools::Rectangle maSnapRect
Definition: svdoattr.hxx:42
Point LeftCenter() const
double GetExtraTextRotation(const bool bPreRotation=false) const
Definition: svdoashp.cxx:516
virtual bool IsAutoGrowWidth() const override
Definition: svdoashp.cxx:2179
void MergeDefaultAttributes(const OUString *pType=nullptr)
Definition: svdoashp.cxx:834
virtual void handlePageChange(SdrPage *pOldPage, SdrPage *pNewPage) override
Definition: svdoashp.cxx:2870
css::awt::Point aPosition
Definition: svdoashp.hxx:71
tools::Rectangle ImpDragCalcRect(const SdrDragStat &rDrag) const
Definition: svdotxdr.cxx:72
static bool less(const double &rfValA, const double &rfValB)
double GetCameraRotation() const
Definition: svdoashp.cxx:529
void Rotate(const Point &rCenter, double fSin, double fCos)
#define SDRATTR_SHADOWYDIST
Definition: svddef.hxx:174
virtual bool IsAutoGrowHeight() const override
Definition: svdoashp.cxx:2171
static void lcl_ShapePropertiesFromDFF(const SvxMSDffHandle *pData, css::beans::PropertyValues &rPropValues)
Definition: svdoashp.cxx:719
const SfxPoolItem & GetObjectItem(const sal_uInt16 nWhich) const
Definition: svdobj.cxx:1941
virtual SdrGluePoint GetVertexGluePoint(sal_uInt16 nNum) const override
Definition: svdoashp.cxx:1694
#define SDRATTR_TEXT_HORZADJUST
Definition: svddef.hxx:207
SdrTextHorzAdjust GetTextHorizontalAdjust() const
Definition: svdotext.cxx:326
virtual void NbcSetOutlinerParaObject(std::unique_ptr< OutlinerParaObject > pTextObject) override
Definition: svdoashp.cxx:2762
virtual void TakeTextRect(SdrOutliner &rOutliner, tools::Rectangle &rTextRect, bool bNoEditText, tools::Rectangle *pAnchorRect, bool bLineWidth=true) const override
Definition: svdoashp.cxx:2628
void SetNoSnap(bool bOn=true)
Definition: svddrag.hxx:121
virtual void handlePageChange(SdrPage *pOldPage, SdrPage *pNewPage) override
Definition: svdotext.cxx:459
CustomShapeHandleModes
Definition: svdoashp.hxx:51
Right
void SetEndDragChangesGeoAndAttributes(bool bOn)
Definition: svddrag.hxx:135
SdrTextVertAdjust GetTextVerticalAdjust() const
Definition: svdotext.cxx:358
virtual const SdrGluePointList * GetGluePointList() const
Definition: svdobj.cxx:2225
#define F_PI
double nCos
Definition: svdtrans.hxx:220
OptionalString sType
static OUString GetEquation(const sal_uInt16 nFlags, sal_Int32 nPara1, sal_Int32 nPara2, sal_Int32 nPara3)
long GetTextLeftDistance() const
Left inner spacing to borders.
Definition: svdotext.cxx:1750
void SetText(const OutlinerParaObject &)
#define DBG_ASSERT(sCon, aError)
virtual void NbcSetSnapRect(const tools::Rectangle &rRect) override
Definition: svdoashp.cxx:1441
SvxAdjust
virtual void NbcShear(const Point &rRef, long nAngle, double tn, bool bVShear) override
Definition: svdoashp.cxx:1670
long AdjustY(long nVertMove)
long GetTextRightDistance() const
Right inner spacing to borders.
Definition: svdotext.cxx:1755
uno_Any a
virtual void TakeTextAnchorRect(tools::Rectangle &rAnchorRect) const override
Definition: svdoashp.cxx:2603
bool IsWriter() const
Definition: svdmodel.hxx:576
OUString sName
bool decompose(B2DTuple &rScale, B2DTuple &rTranslate, double &rRotate, double &rShearX) const
void SetVertical(bool bNew)
#define SDRATTR_SHADOWXDIST
Definition: svddef.hxx:173
#define SDRATTR_TEXT_VERTADJUST
Definition: svddef.hxx:202
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: svdoashp.cxx:2885
SdrMetricItem makeSdrTextMinFrameHeightItem(long mnHeight)
Definition: sdtmfitm.hxx:25
tools::Rectangle aOutRect
Definition: svdobj.hxx:921
SvxMSDffHandle *const pHandles
virtual void SetVerticalWriting(bool bVertical) override
Definition: svdoashp.cxx:2192
B2DPolyPolygon UnoPolyPolygonBezierCoordsToB2DPolyPolygon(const css::drawing::PolyPolygonBezierCoords &rPolyPolygonBezierCoordsSource)
virtual void NbcResize(const Point &rRef, const Fraction &xFact, const Fraction &yFact) override
Definition: svdoashp.cxx:1521
void GetOOXHandleAdjRelation(const OUString &sFullOOXShapeName, const sal_Int32 nHandleIndex, OUString &rFirstRefType, sal_Int32 &rFirstAdjValueIndex, OUString &rSecondRefType, sal_Int32 &rSecondAdjValueIndex)
virtual void TakeTextEditArea(Size *pPaperMin, Size *pPaperMax, tools::Rectangle *pViewInit, tools::Rectangle *pViewMin) const override
Definition: svdoashp.cxx:2508
int i
QPRO_FUNC_TYPE const nType
virtual void NbcSetStyleSheet(SfxStyleSheet *pNewStyleSheet, bool bDontRemoveHardAttr) override
Definition: svdoashp.cxx:2863
void BroadcastObjectChange() const
Definition: svdobj.cxx:932
sal_Int32 GetPointCount() const
Definition: svddrag.hxx:91
#define F_2PI
void MirrorPoint(Point &rPnt, const Point &rRef1, const Point &rRef2)
Definition: svdtrans.cxx:103
void SetRight(long v)
SdrTextObj & operator=(const SdrTextObj &rObj)
Definition: svdotext.cxx:1015
void ActionChanged() const
Definition: svdobj.cxx:283
double nTan
Definition: svdtrans.hxx:218
virtual void EndTextEdit(SdrOutliner &rOutl) override
Definition: svdoashp.cxx:2598
long GetMaxTextFrameHeight() const
Definition: svdotext.cxx:1717
virtual void impl_setUnoShape(const css::uno::Reference< css::uno::XInterface > &_rxUnoShape)
Sets a new UNO shape.
Definition: svdobj.cxx:2737
SdrView * GetView() const
Definition: svddrag.hxx:86
static bool equalZero(const double &rfVal)
bool IsDefaultGeometry(const DefaultType eDefaultType) const
Definition: svdoashp.cxx:1114
virtual basegfx::B2DPolyPolygon TakeContour() const
contour for TextToContour
Definition: svdobj.cxx:1103
long Bottom() const
SdrModel & getSdrModelFromSdrObject() const
Definition: svdobj.cxx:299
virtual sal_uInt32 GetHdlCount() const override
Via GetHdlCount the number of Handles can be retrieved.
Definition: svdoashp.cxx:1844
bool createItemIfMissing(const OUString &sKey, const TValueType &aValue)
#define SDRATTR_SHADOW
Definition: svddef.hxx:171
void SetUserDefined(bool bNew)
Definition: svdglue.hxx:95
virtual void TakeTextAnchorRect(::tools::Rectangle &rAnchorRect) const
Definition: svdotext.cxx:603
#define SDRATTR_TEXTDIRECTION
Definition: svddef.hxx:302
void SetPercent(bool bOn)
Definition: svdglue.hxx:89
virtual bool TRGetBaseGeometry(basegfx::B2DHomMatrix &rMatrix, basegfx::B2DPolyPolygon &rPolyPolygon) const override
Definition: svdoashp.cxx:2998
virtual basegfx::B2DPolyPolygon TakeXorPoly() const override
The Xor-Polygon is required by the View to drag the object.
Definition: svdoashp.cxx:2807
size
#define XATTR_LINESTYLE
Definition: xdef.hxx:90
static void SetEnhancedCustomShapeParameter(css::drawing::EnhancedCustomShapeParameter &rParameter, const sal_Int32 nValue)
sal_uInt16 GetSize() const
constexpr double deg2rad(double v)
virtual void AddToHdlList(SdrHdlList &rHdlList) const override
Definition: svdoashp.cxx:1850
tools::Polygon Rect2Poly(const tools::Rectangle &rRect, const GeoStat &rGeo)
Definition: svdtrans.cxx:473
void SetMergedItem(const SfxPoolItem &rItem)
Definition: svdobj.cxx:1921
const SdrObject * GetSdrObjectShadowFromCustomShape() const
Definition: svdoashp.cxx:427
virtual void NbcMove(const Size &rSiz) override
The methods Move, Resize, Rotate, Mirror, Shear, SetSnapRect and SetLogicRect call the corresponding ...
Definition: svdotxtr.cxx:98
void SetEndDragChangesAttributes(bool bOn)
Definition: svddrag.hxx:133
virtual SdrText * getActiveText() const
returns the currently active text.
Definition: svdotext.cxx:2048
#define XATTR_FILLSTYLE
Definition: xdef.hxx:107
const SfxPoolItem & GetMergedItem(const sal_uInt16 nWhich) const
Definition: svdobj.cxx:1946
bool IsShiftPressed() const
Definition: svddrgmt.hxx:196
Abstract DrawObject.
Definition: svdobj.hxx:312
css::uno::Reference< css::drawing::XCustomShapeHandle > xInteraction
Definition: svdoashp.hxx:70
#define SDRATTR_TEXT_MINFRAMEHEIGHT
Definition: svddef.hxx:195
SfxItemPool * GetPool() const
virtual void SetSnapRect(const tools::Rectangle &rRect) override
Definition: svdoashp.cxx:1454
void ImpCheckShear()
Definition: svdotext.cxx:400
virtual bool applySpecialDrag(SdrDragStat &rDrag) override
Definition: svdoashp.cxx:2057
long X() const
long GetTextUpperDistance() const
Top inner spacing to borders.
Definition: svdotext.cxx:1760
SdrObject * mpLastShadowGeometry
Definition: svdoashp.hxx:97
#define DEFAULT_MAXIMUM_SIGNED_COMPARE
Definition: svdoashp.cxx:680
OUString GetName() const
Definition: svdobj.cxx:725
static void lcl_ShapeSegmentFromBinary(EnhancedCustomShapeSegment &rSegInfo, sal_uInt16 nSDat)
Definition: svdoashp.cxx:103
Size GetSize() const
long nShearAngle
Definition: svdtrans.hxx:217
#define Y
SdrMetricItem makeSdrShadowYDistItem(long nDist)
Definition: sdsxyitm.hxx:29
CustomShapeHandleModes nMode
Definition: svdoashp.hxx:72
bool bTextFrame
Definition: svdotext.hxx:231
void SuggestTextFrameSize(Size aSuggestedTextFrameSize)
Allows suggesting the text frame size: in case the application has its own text associated to the sha...
Definition: svdoashp.cxx:2251
css::uno::Reference< css::drawing::XShape > mXRenderedCustomShape
Definition: svdoashp.hxx:92
SdrDragMethod * GetDragMethod() const
Definition: svddrag.hxx:153
void DragMoveCustomShapeHdl(const Point &rDestination, const sal_uInt16 nCustomShapeHdlNum, bool bMoveCalloutRectangle)
Definition: svdoashp.cxx:2016
virtual bool NbcAdjustTextFrameWidthAndHeight(bool bHgt=true, bool bWdt=true) override
Definition: svdoashp.cxx:2440
sal_uInt16 Insert(const SdrGluePoint &rGP)
Definition: svdglue.cxx:297
long GetDY() const
Definition: svddrag.hxx:149
long GetMaxTextFrameWidth() const
Definition: svdotext.cxx:1727
basegfx::B2DPolyPolygon GetLineGeometry(const bool bBezierAllowed) const
Definition: svdoashp.cxx:562
const SdrObject * GetSdrObjectFromCustomShape() const
Definition: svdoashp.cxx:412
virtual void NbcSetOutlinerParaObject(std::unique_ptr< OutlinerParaObject > pTextObject) override
Definition: svdotext.cxx:1371
virtual const tools::Rectangle & GetLastBoundRect() const
Definition: svdobj.cxx:895
SvxMSDffTextRectangles *const pTextRect
SdrObject * Next()
Definition: svditer.hxx:63
void CheckPortionInfo(SdrOutliner &rOutliner)
Definition: svdtext.cxx:43
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
OUString GetCustomShapeName() const
Definition: svdoashp.cxx:3134
void RotatePoint(Point &rPnt, const Point &rRef, double sn, double cs)
Definition: svdtrans.hxx:114
void SetActionRect(const tools::Rectangle &rR)
Definition: svddrag.hxx:157
std::unique_ptr< OutlinerParaObject > CreateParaObject(sal_Int32 nStartPara=0, sal_Int32 nParaCount=EE_PARA_ALL) const
virtual bool IsVerticalWriting() const
Definition: svdotext.cxx:1493
void SetMaxAutoPaperSize(const Size &rSz)
virtual void RestGeoData(const SdrObjGeoData &rGeo) override
Definition: svdotext.cxx:1448
SdrObjCustomShape & operator=(const SdrObjCustomShape &rObj)
Definition: svdoashp.cxx:2775
long AdjustRight(long nHorzMoveDelta)
void ImpCheckCustomGluePointsAreAdded()
Definition: svdoashp.cxx:1722
sal_Int32 GetDenominator() const
B2DPolygon adaptiveSubdivideByAngle(const B2DPolygon &rCandidate, double fAngleBound)
virtual SdrGluePointList * ForceGluePointList()
Definition: svdobj.cxx:2232
void setY(double fY)
SvxMSDffVertPair *const pGluePoints
bool UseNoFillStyle() const
Definition: svdoashp.cxx:461
virtual void TRSetBaseGeometry(const basegfx::B2DHomMatrix &rMatrix, const basegfx::B2DPolyPolygon &rPolyPolygon) override
Definition: svdoashp.cxx:2923
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
bool equalZero() const
virtual void RestGeoData(const SdrObjGeoData &rGeo) override
Definition: svdoashp.cxx:2904
unsigned char sal_uInt8
virtual OutlinerParaObject * GetOutlinerParaObject() const override
Definition: svdotext.cxx:1362
void RecalcSinCos()
Definition: svdtrans.cxx:450
void SetObjectItemSet(const SfxItemSet &rSet)
Definition: svdobj.cxx:1931
virtual void NbcMove(const Size &rSiz)
The methods Move, Resize, Rotate, Mirror, Shear, SetSnapRect and SetLogicRect call the corresponding ...
Definition: svdobj.cxx:1401
State
bool IsSolidDragging() const
Definition: svddrgv.cxx:924
const SfxItemSet & GetMergedItemSet() const
Definition: svdobj.cxx:1911
void SetMirroredX(const bool bMirroredX)
Definition: svdoashp.cxx:495
void SetMinAutoPaperSize(const Size &rSz)
#define SDRATTR_TEXT_AUTOGROWWIDTH
Definition: svddef.hxx:206
bool IsTextPath() const
Definition: svdoashp.cxx:450
virtual bool beginSpecialDrag(SdrDragStat &rDrag) const override
Definition: svdoashp.cxx:1880
static MSO_SPT ImpGetCustomShapeType(const SdrObjCustomShape &rCustoShape)
Definition: svdoashp.cxx:181
virtual SdrObject * CloneSdrObject(SdrModel &rTargetModel) const
Definition: svdobj.cxx:1001
void SetBottom(long v)
virtual const SdrGluePointList * GetGluePointList() const override
Definition: svdoashp.cxx:1823
#define F_PI18000
virtual OUString TakeObjNameSingul() const override
Definition: svdoashp.cxx:2788
static void SetEnhancedCustomShapeHandleParameter(css::drawing::EnhancedCustomShapeParameter &rParameter, const sal_Int32 nPara, const bool bIsSpecialValue, bool bHorz)
Size m_aSuggestedTextFrameSize
Definition: svdoashp.hxx:130
long AdjustTop(long nVertMoveDelta)
Reference< XComponentContext > getProcessComponentContext()
#define DEFAULT_MINIMUM_SIGNED_COMPARE
Definition: svdoashp.cxx:679
void SetMirroredY(const bool bMirroredY)
Definition: svdoashp.cxx:505
sal_Int32 GetNumerator() const
bool GetTextBounds(tools::Rectangle &rTextBound) const
Definition: svdoashp.cxx:546
css::uno::Sequence< css::drawing::EnhancedCustomShapeAdjustmentValue > aAdjustmentSeq
Definition: svdoashp.hxx:48
std::unique_ptr< SdrObject, SdrObjectFreeOp > SdrObjectUniquePtr
Definition: svdobj.hxx:114
virtual SdrObjectUniquePtr DoConvertToPolyObj(bool bBezier, bool bAddText) const override
Definition: svdoashp.cxx:2820
SdrOnOffItem makeSdrShadowItem(bool bShadow)
Definition: sdshitm.hxx:25
const Point & GetPos() const
Definition: svdglue.hxx:82
const Point & GetNow() const
Definition: svddrag.hxx:95
void SetUpdateMode(bool bUpdate)
long Left() const
static bool ImpVerticalSwitch(const SdrObjCustomShape &rCustoShape)
Definition: svdoashp.cxx:197
const Point & GetAnchorPos() const
Definition: svdobj.cxx:1615
virtual OUString TakeObjNamePlural() const override
Definition: svdoashp.cxx:2802
css::uno::Any * GetPropertyValueByName(const OUString &rPropName)
std::unique_ptr< SdrObjPlusData > pPlusData
Definition: svdobj.hxx:925
virtual void SetRectsDirty(bool bNotMyself=false, bool bRecursive=true)
Definition: svdobj.cxx:462
SVX_DLLPRIVATE void DragResizeCustomShape(const tools::Rectangle &rNewRect)
Definition: svdoashp.cxx:1918
virtual void Shear(const Point &rRef, long nAngle, double tn, bool bVShear)
Definition: svdobj.cxx:1558
#define SDRATTR_TEXT_MINFRAMEWIDTH
Definition: svddef.hxx:204
#define XATTR_FILLBITMAP
Definition: xdef.hxx:111
SVX_DLLPUBLIC OUString GetAccName(const OUString &)
virtual bool AdjustTextFrameWidthAndHeight() override
Definition: svdoashp.cxx:2473
void SetTextObj(const SdrTextObj *pObj)
Definition: svdoutl.cxx:43
#define SDRATTR_TEXT_AUTOGROWHEIGHT
Definition: svddef.hxx:196
bool IsUserDefined() const
Definition: svdglue.hxx:94
const mso_CustomShape * GetCustomShapeContent(MSO_SPT eSpType)
css::uno::Reference< css::drawing::XCustomShapeEngine > const & GetCustomShapeEngine() const
Definition: svdoashp.cxx:379
#define SDRATTR_TEXT_USEFIXEDCELLHEIGHT
Definition: svddef.hxx:217
SVX_DLLPUBLIC MSO_SPT Get(const OUString &)
double fObjectRotation
Definition: svdoashp.hxx:46
tools::Rectangle GetBoundRect() const
css::uno::Reference< css::drawing::XCustomShapeEngine > mxCustomShapeEngine
Definition: svdoashp.hxx:94
static bool doConstructOrthogonal(const OUString &rName)
Definition: svdoashp.cxx:3089
A SdrPage contains exactly one SdrObjList and a description of the physical page dimensions (size / m...
Definition: svdpage.hxx:366
Left
SvxMSDffHandleFlags const nFlags
const SdrTextObj * GetTextObj() const
Definition: svdoutl.cxx:89
virtual void NbcRotate(const Point &rRef, long nAngle, double sn, double cs) override
Definition: svdotxtr.cxx:190
void Clear()
virtual void NbcSetStyleSheet(SfxStyleSheet *pNewStyleSheet, bool bDontRemoveHardAttr)
Definition: svdobj.cxx:2180
bool areControlPointsUsed() const
SdrObject * GetSdrObjectFromXShape(const uno::Reference< drawing::XShape > &xShape)
returns the SdrObject from the given StarOffice API wrapper
Definition: unoshape.cxx:3962
virtual SdrGluePointList * ForceGluePointList() override
Definition: svdoashp.cxx:1830
SdrCreateCmd
Definition: svdtypes.hxx:27
virtual void SetChanged()
Definition: svdobj.cxx:956
sal_uLong GetTextHeight() const
virtual void NbcShear(const Point &rRef, long nAngle, double tn, bool bVShear) override
Definition: svdotxtr.cxx:214
virtual void NbcMove(const Size &rSiz) override
The methods Move, Resize, Rotate, Mirror, Shear, SetSnapRect and SetLogicRect call the corresponding ...
Definition: svdoashp.cxx:1499
void setWidth(long nWidth)
bool IsMirroredY() const
Definition: svdoashp.cxx:485
static void ImpJustifyRect(tools::Rectangle &rRect)
Definition: svdotext.cxx:391
SdrOutliner & ImpGetDrawOutliner() const
Definition: svdotext.cxx:1152
Size CalcTextSize()
bool mbAdjustingTextFrameWidthAndHeight
Definition: svdoashp.hxx:80
virtual void NbcMirror(const Point &rRef1, const Point &rRef2) override
Definition: svdoashp.cxx:1618
virtual basegfx::B2DPolyPolygon TakeCreatePoly(const SdrDragStat &rDrag) const override
Polygon dragged by the user when creating the object.
Definition: svdoashp.cxx:2163
virtual void AddToHdlList(SdrHdlList &rHdlList) const override
Definition: svdotxdr.cxx:41
double fObjectRotation
Definition: svdoashp.hxx:79
SdrTextVertAdjust
Definition: sdtaitm.hxx:29
void SendUserCall(SdrUserCallType eUserCall, const tools::Rectangle &rBoundRect) const
Definition: svdobj.cxx:2676
long GetTextLowerDistance() const
Bottom inner spacing to borders.
Definition: svdotext.cxx:1765
void SetPos(const Point &rNewPos)
Definition: svdglue.hxx:83
Point Center() const
void AddHdl(std::unique_ptr< SdrHdl > pHdl)
Definition: svdhdl.cxx:2299
long Y() const
Point TopCenter() const
std::vector< SdrCustomShapeInteraction > GetInteractionHandles() const
Definition: svdoashp.cxx:584
SdrMetricItem makeSdrShadowXDistItem(long nDist)
Definition: sdsxyitm.hxx:25
SdrHdlKind GetKind() const
Definition: svdhdl.hxx:194
virtual sal_uInt16 GetObjIdentifier() const override
Definition: svdoashp.cxx:1392
virtual const tools::Rectangle & GetLogicRect() const override
Definition: svdotxtr.cxx:73
virtual ~SdrObjCustomShape() override
Definition: svdoashp.cxx:828
void setHeight(long nHeight)
const Size & GetPaperSize() const
void InvalidateRenderGeometry()
Definition: svdoashp.cxx:3118