bump product version to 7.2.5.1
[LibreOffice.git] / svx / source / unodraw / unoshape.cxx
blob32e3a5c6768a71d60dd9d05b14da602c43cafd4e
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #include <cppuhelper/supportsservice.hxx>
21 #include <com/sun/star/awt/XBitmap.hpp>
22 #include <com/sun/star/awt/Rectangle.hpp>
23 #include <com/sun/star/drawing/CircleKind.hpp>
24 #include <com/sun/star/lang/NoSupportException.hpp>
25 #include <vcl/svapp.hxx>
26 #include <svl/itemprop.hxx>
27 #include <o3tl/any.hxx>
28 #include <osl/mutex.hxx>
29 #include <editeng/unotext.hxx>
30 #include <svx/svdobj.hxx>
31 #include <svx/svdoole2.hxx>
32 #include <svx/shapepropertynotifier.hxx>
33 #include <comphelper/scopeguard.hxx>
34 #include <comphelper/servicehelper.hxx>
35 #include <toolkit/helper/vclunohelper.hxx>
36 #include <vcl/gfxlink.hxx>
37 #include <vcl/virdev.hxx>
38 #include <svx/sdangitm.hxx>
39 #include <svx/svdlayer.hxx>
40 #include <svx/svdopage.hxx>
41 #include <svx/xflbstit.hxx>
42 #include <svx/xflbmtit.hxx>
43 #include <svx/xlnstit.hxx>
44 #include <svx/xlnedit.hxx>
45 #include <svx/svdmodel.hxx>
46 #include <svx/svdobjkind.hxx>
47 #include <svx/unopage.hxx>
48 #include <svx/unoshape.hxx>
49 #include <svx/unoshtxt.hxx>
50 #include <svx/svdpage.hxx>
51 #include <svx/unoshprp.hxx>
52 #include <svx/svdograf.hxx>
53 #include <svx/unoapi.hxx>
54 #include <svx/svdomeas.hxx>
55 #include <svx/svdpool.hxx>
56 #include <tools/stream.hxx>
57 #include <tools/gen.hxx>
58 #include <tools/UnitConversion.hxx>
59 #include <svx/svdoedge.hxx>
60 #include <svx/svdocapt.hxx>
61 #include <svx/obj3d.hxx>
62 #include <svx/xflftrit.hxx>
63 #include <svx/xtable.hxx>
64 #include <svx/xbtmpit.hxx>
65 #include <svx/xfillit0.hxx>
66 #include <svx/xflgrit.hxx>
67 #include <svx/xflhtit.hxx>
68 #include <svx/xlineit0.hxx>
69 #include <svx/xlndsit.hxx>
70 #include <svx/unomaster.hxx>
71 #include <basegfx/matrix/b2dhommatrix.hxx>
72 #include <basegfx/matrix/b2dhommatrixtools.hxx>
73 #include <basegfx/polygon/b2dpolypolygontools.hxx>
74 #include "gluepts.hxx"
75 #include "shapeimpl.hxx"
76 #include <sal/log.hxx>
78 #include <svx/lathe3d.hxx>
79 #include <extrud3d.hxx>
80 #include <svx/sdr/contact/viewcontact.hxx>
81 #include <drawinglayer/geometry/viewinformation2d.hxx>
82 #include <drawinglayer/primitive2d/transformprimitive2d.hxx>
84 #include <vcl/gdimtf.hxx>
85 #include <vcl/wmf.hxx>
86 #include <svx/sdtfsitm.hxx>
87 #include <svx/svdoutl.hxx>
88 #include <svx/svdopath.hxx>
89 #include <svx/SvxXTextColumns.hxx>
91 #include <memory>
92 #include <optional>
93 #include <vector>
94 #include <iostream>
96 #include <bitmaps.hlst>
98 using namespace ::osl;
99 using namespace ::cppu;
100 using namespace ::com::sun::star;
101 using namespace ::com::sun::star::uno;
102 using namespace ::com::sun::star::lang;
103 using namespace ::com::sun::star::container;
104 using svx::PropertyValueProvider;
106 class GDIMetaFile;
108 struct SvxShapeImpl
110 SvxShape& mrAntiImpl;
111 std::optional<SfxItemSet> mxItemSet;
112 sal_uInt32 mnObjId;
113 SvxShapeMaster* mpMaster;
114 bool mbHasSdrObjectOwnership;
115 bool mbDisposing;
117 /** CL, OD 2005-07-19 #i52126# - this is initially 0 and set when
118 * a SvxShape::Create() call is executed. It is then set to the created
119 * SdrObject so a multiple call to SvxShape::Create() with same SdrObject
120 * is prohibited.
122 ::tools::WeakReference< SdrObject > mpCreatedObj;
124 // for xComponent
125 ::comphelper::OInterfaceContainerHelper2 maDisposeListeners;
126 svx::PropertyChangeNotifier maPropertyNotifier;
128 SvxShapeImpl( SvxShape& _rAntiImpl, ::osl::Mutex& _rMutex )
129 :mrAntiImpl( _rAntiImpl )
130 ,mnObjId( 0 )
131 ,mpMaster( nullptr )
132 ,mbHasSdrObjectOwnership( false )
133 ,mbDisposing( false )
134 ,mpCreatedObj()
135 ,maDisposeListeners( _rMutex )
136 ,maPropertyNotifier( _rAntiImpl, _rMutex )
141 namespace {
143 class ShapePositionProvider : public PropertyValueProvider
145 public:
146 explicit ShapePositionProvider( const SvxShapeImpl& _shapeImpl )
147 :PropertyValueProvider( _shapeImpl.mrAntiImpl, "Position" )
151 protected:
152 virtual void getCurrentValue( Any& _out_rCurrentValue ) const override
154 _out_rCurrentValue <<= static_cast< SvxShape& >( getContext() ).getPosition();
159 class ShapeSizeProvider : public PropertyValueProvider
161 public:
162 explicit ShapeSizeProvider( const SvxShapeImpl& _shapeImpl )
163 :PropertyValueProvider( _shapeImpl.mrAntiImpl, "Size" )
167 protected:
168 virtual void getCurrentValue( Any& _out_rCurrentValue ) const override
170 _out_rCurrentValue <<= static_cast< SvxShape& >( getContext() ).getSize();
174 /// Calculates what scaling factor will be used for autofit text scaling of this shape.
175 sal_Int16 GetTextFitToSizeScale(SdrObject* pObject)
177 SdrTextObj* pTextObj = dynamic_cast<SdrTextObj*>(pObject);
178 if (!pTextObj)
180 return 0;
183 const SfxItemSet& rTextObjSet = pTextObj->GetMergedItemSet();
184 if (rTextObjSet.GetItem<SdrTextFitToSizeTypeItem>(SDRATTR_TEXT_FITTOSIZE)->GetValue()
185 != drawing::TextFitToSizeType_AUTOFIT)
187 return 0;
190 return pTextObj->GetFontScaleY();
194 SvxShape::SvxShape( SdrObject* pObject )
195 : maSize(100,100)
196 , mpImpl( new SvxShapeImpl( *this, maMutex ) )
197 , mbIsMultiPropertyCall(false)
198 , mpPropSet(getSvxMapProvider().GetPropertySet(SVXMAP_SHAPE, SdrObject::GetGlobalDrawObjectItemPool()))
199 , maPropMapEntries(getSvxMapProvider().GetMap(SVXMAP_SHAPE))
200 , mpSdrObjectWeakReference(pObject)
201 , mnLockCount(0)
203 impl_construct();
207 SvxShape::SvxShape( SdrObject* pObject, const SfxItemPropertyMapEntry* pEntries, const SvxItemPropertySet* pPropertySet )
208 : maSize(100,100)
209 , mpImpl( new SvxShapeImpl( *this, maMutex ) )
210 , mbIsMultiPropertyCall(false)
211 , mpPropSet(pPropertySet)
212 , maPropMapEntries(pEntries)
213 , mpSdrObjectWeakReference(pObject)
214 , mnLockCount(0)
216 impl_construct();
220 SvxShape::~SvxShape() noexcept
222 ::SolarMutexGuard aGuard;
224 DBG_ASSERT( mnLockCount == 0, "Locked shape was disposed!" );
226 if ( mpImpl->mpMaster )
227 mpImpl->mpMaster->dispose();
229 if ( HasSdrObject() )
231 EndListening(GetSdrObject()->getSdrModelFromSdrObject());
232 GetSdrObject()->setUnoShape(nullptr);
235 if( HasSdrObjectOwnership() && HasSdrObject() )
237 mpImpl->mbHasSdrObjectOwnership = false;
238 SdrObject* pObject = GetSdrObject();
239 SdrObject::Free( pObject );
242 EndListeningAll(); // call explicitly within SolarMutexGuard
246 void SvxShape::TakeSdrObjectOwnership()
248 mpImpl->mbHasSdrObjectOwnership = true;
252 void SvxShape::InvalidateSdrObject()
254 if(HasSdrObject())
256 EndListening(GetSdrObject()->getSdrModelFromSdrObject());
259 if (HasSdrObjectOwnership())
260 return;
262 mpSdrObjectWeakReference.reset(nullptr);
265 bool SvxShape::HasSdrObjectOwnership() const
267 if ( !mpImpl->mbHasSdrObjectOwnership )
268 return false;
270 OSL_ENSURE( HasSdrObject(), "SvxShape::HasSdrObjectOwnership: have the ownership of an object which I don't know!" );
271 return HasSdrObject();
275 void SvxShape::setShapeKind( sal_uInt32 nKind )
277 mpImpl->mnObjId = nKind;
281 sal_uInt32 SvxShape::getShapeKind() const
283 return mpImpl->mnObjId;
287 void SvxShape::setMaster( SvxShapeMaster* pMaster )
289 mpImpl->mpMaster = pMaster;
293 uno::Any SAL_CALL SvxShape::queryAggregation( const uno::Type& rType )
295 if( mpImpl->mpMaster )
297 uno::Any aAny;
298 if( mpImpl->mpMaster->queryAggregation( rType, aAny ) )
299 return aAny;
302 return SvxShape_UnoImplHelper::queryAggregation(rType);
305 const css::uno::Sequence< sal_Int8 > & SvxShape::getUnoTunnelId() noexcept
307 static const UnoTunnelIdInit theSvxShapeUnoTunnelId;
308 return theSvxShapeUnoTunnelId.getSeq();
311 sal_Int64 SAL_CALL SvxShape::getSomething( const css::uno::Sequence< sal_Int8 >& rId )
313 if( isUnoTunnelId<SvxShape>(rId) )
315 return sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_uIntPtr>(this));
317 else
319 return 0;
324 svx::PropertyChangeNotifier& SvxShape::getShapePropertyChangeNotifier()
326 return mpImpl->maPropertyNotifier;
330 void SvxShape::impl_construct()
332 mpImpl->maPropertyNotifier.registerProvider( svx::ShapeProperty::Position,
333 std::make_shared<ShapePositionProvider>( *mpImpl ) );
334 mpImpl->maPropertyNotifier.registerProvider( svx::ShapeProperty::Size,
335 std::make_shared<ShapeSizeProvider>( *mpImpl ) );
337 if ( HasSdrObject() )
339 StartListening(GetSdrObject()->getSdrModelFromSdrObject());
340 impl_initFromSdrObject();
345 void SvxShape::impl_initFromSdrObject()
347 DBG_TESTSOLARMUTEX();
348 OSL_PRECOND( HasSdrObject(), "SvxShape::impl_initFromSdrObject: not to be called without SdrObject!" );
349 if ( !HasSdrObject() )
350 return;
352 osl_atomic_increment( &m_refCount );
354 GetSdrObject()->setUnoShape(*this);
356 osl_atomic_decrement( &m_refCount );
358 // #i40944#
359 // Do not simply return when no model but do the type corrections
360 // following below.
361 const SdrInventor nInventor = GetSdrObject()->GetObjInventor();
363 // is it one of ours (svx) ?
364 if( !(nInventor == SdrInventor::Default || nInventor == SdrInventor::E3d || nInventor == SdrInventor::FmForm) )
365 return;
367 if(nInventor == SdrInventor::FmForm)
369 mpImpl->mnObjId = OBJ_UNO;
371 else
373 mpImpl->mnObjId = GetSdrObject()->GetObjIdentifier();
374 if( nInventor == SdrInventor::E3d )
375 mpImpl->mnObjId |= E3D_INVENTOR_FLAG;
378 switch(mpImpl->mnObjId)
380 case OBJ_CCUT: // segment of circle
381 case OBJ_CARC: // arc of circle
382 case OBJ_SECT: // sector
383 mpImpl->mnObjId = OBJ_CIRC;
384 break;
389 void SvxShape::Create( SdrObject* pNewObj, SvxDrawPage* /*pNewPage*/ )
391 DBG_TESTSOLARMUTEX();
393 OSL_PRECOND( pNewObj, "SvxShape::Create: invalid new object!" );
394 if ( !pNewObj )
395 return;
397 SdrObject* pCreatedObj = mpImpl->mpCreatedObj.get();
398 OSL_ENSURE( ( pCreatedObj == nullptr ) || ( pCreatedObj == pNewObj ),
399 "SvxShape::Create: the same shape used for two different objects?! Strange ..." );
401 // Correct condition (#i52126#)
402 if ( pCreatedObj == pNewObj )
403 return;
405 // Correct condition (#i52126#)
406 mpImpl->mpCreatedObj = pNewObj;
408 if( HasSdrObject() )
410 EndListening( GetSdrObject()->getSdrModelFromSdrObject() );
413 mpSdrObjectWeakReference.reset( pNewObj );
415 if( HasSdrObject() )
417 StartListening( GetSdrObject()->getSdrModelFromSdrObject() );
420 OSL_ENSURE( !mbIsMultiPropertyCall, "SvxShape::Create: hmm?" );
421 // this was previously set in impl_initFromSdrObject, but I think it was superfluous
422 // (it definitely was in the other context where it was called, but I strongly suppose
423 // it was also superfluous when called from here)
424 impl_initFromSdrObject();
426 ObtainSettingsFromPropertySet( *mpPropSet );
428 // save user call
429 SdrObjUserCall* pUser = GetSdrObject()->GetUserCall();
430 GetSdrObject()->SetUserCall(nullptr);
432 setPosition( maPosition );
433 setSize( maSize );
435 // restore user call after we set the initial size
436 GetSdrObject()->SetUserCall( pUser );
438 // if this shape was already named, use this name
439 if( !maShapeName.isEmpty() )
441 GetSdrObject()->SetName( maShapeName );
442 maShapeName.clear();
446 void SvxShape::ForceMetricToItemPoolMetric(Pair& rPoint) const noexcept
448 DBG_TESTSOLARMUTEX();
449 if(!HasSdrObject())
450 return;
452 MapUnit eMapUnit(GetSdrObject()->getSdrModelFromSdrObject().GetItemPool().GetMetric(0));
453 if(eMapUnit == MapUnit::Map100thMM)
454 return;
456 if (const auto eTo = MapToO3tlLength(eMapUnit); eTo != o3tl::Length::invalid)
458 rPoint.A() = o3tl::convert(rPoint.A(), o3tl::Length::mm100, eTo);
459 rPoint.B() = o3tl::convert(rPoint.B(), o3tl::Length::mm100, eTo);
461 else
463 OSL_FAIL("AW: Missing unit translation to PoolMetric!");
467 void SvxShape::ForceMetricToItemPoolMetric(basegfx::B2DPolyPolygon& rPolyPolygon) const noexcept
469 DBG_TESTSOLARMUTEX();
470 if(!HasSdrObject())
471 return;
473 MapUnit eMapUnit(GetSdrObject()->getSdrModelFromSdrObject().GetItemPool().GetMetric(0));
474 if(eMapUnit == MapUnit::Map100thMM)
475 return;
477 if (const auto eTo = MapToO3tlLength(eMapUnit); eTo != o3tl::Length::invalid)
479 const double fConvert(o3tl::convert(1.0, o3tl::Length::mm100, eTo));
480 rPolyPolygon.transform(basegfx::utils::createScaleB2DHomMatrix(fConvert, fConvert));
482 else
484 OSL_FAIL("Missing unit translation to PoolMetric!");
488 void SvxShape::ForceMetricToItemPoolMetric(basegfx::B2DHomMatrix& rB2DHomMatrix) const noexcept
490 DBG_TESTSOLARMUTEX();
491 if(!HasSdrObject())
492 return;
494 MapUnit eMapUnit(GetSdrObject()->getSdrModelFromSdrObject().GetItemPool().GetMetric(0));
495 if(eMapUnit == MapUnit::Map100thMM)
496 return;
498 if (const auto eTo = MapToO3tlLength(eMapUnit); eTo != o3tl::Length::invalid)
500 const double fConvert(o3tl::convert(1.0, o3tl::Length::mm100, eTo));
501 const basegfx::utils::B2DHomMatrixBufferedDecompose aDecomposedTransform(rB2DHomMatrix);
502 rB2DHomMatrix = basegfx::utils::createScaleShearXRotateTranslateB2DHomMatrix(
503 aDecomposedTransform.getScale() * fConvert,
504 aDecomposedTransform.getShearX(),
505 aDecomposedTransform.getRotate(),
506 aDecomposedTransform.getTranslate() * fConvert);
508 else
510 OSL_FAIL("Missing unit translation to PoolMetric!");
514 void SvxShape::ForceMetricTo100th_mm(Pair& rPoint) const noexcept
516 DBG_TESTSOLARMUTEX();
517 if(!HasSdrObject())
518 return;
520 MapUnit eMapUnit = GetSdrObject()->getSdrModelFromSdrObject().GetItemPool().GetMetric(0);
521 if(eMapUnit == MapUnit::Map100thMM)
522 return;
524 if (const auto eFrom = MapToO3tlLength(eMapUnit); eFrom != o3tl::Length::invalid)
526 rPoint.A() = o3tl::convert(rPoint.A(), eFrom, o3tl::Length::mm100);
527 rPoint.B() = o3tl::convert(rPoint.B(), eFrom, o3tl::Length::mm100);
529 else
531 OSL_FAIL("AW: Missing unit translation to 100th mm!");
535 void SvxShape::ForceMetricTo100th_mm(basegfx::B2DPolyPolygon& rPolyPolygon) const noexcept
537 DBG_TESTSOLARMUTEX();
538 if(!HasSdrObject())
539 return;
541 MapUnit eMapUnit = GetSdrObject()->getSdrModelFromSdrObject().GetItemPool().GetMetric(0);
542 if(eMapUnit == MapUnit::Map100thMM)
543 return;
545 if (const auto eFrom = MapToO3tlLength(eMapUnit); eFrom != o3tl::Length::invalid)
547 const double fConvert(o3tl::convert(1.0, eFrom, o3tl::Length::mm100));
548 rPolyPolygon.transform(basegfx::utils::createScaleB2DHomMatrix(fConvert, fConvert));
550 else
552 OSL_FAIL("Missing unit translation to 100th mm!");
556 void SvxShape::ForceMetricTo100th_mm(basegfx::B2DHomMatrix& rB2DHomMatrix) const noexcept
558 DBG_TESTSOLARMUTEX();
559 if(!HasSdrObject())
560 return;
562 MapUnit eMapUnit = GetSdrObject()->getSdrModelFromSdrObject().GetItemPool().GetMetric(0);
563 if(eMapUnit == MapUnit::Map100thMM)
564 return;
566 if (const auto eFrom = MapToO3tlLength(eMapUnit); eFrom != o3tl::Length::invalid)
568 const double fConvert(o3tl::convert(1.0, eFrom, o3tl::Length::mm100));
569 const basegfx::utils::B2DHomMatrixBufferedDecompose aDecomposedTransform(rB2DHomMatrix);
570 rB2DHomMatrix = basegfx::utils::createScaleShearXRotateTranslateB2DHomMatrix(
571 aDecomposedTransform.getScale() * fConvert,
572 aDecomposedTransform.getShearX(),
573 aDecomposedTransform.getRotate(),
574 aDecomposedTransform.getTranslate() * fConvert);
576 else
578 OSL_FAIL("Missing unit translation to 100th mm!");
582 static void SvxItemPropertySet_ObtainSettingsFromPropertySet(const SvxItemPropertySet& rPropSet,
583 SfxItemSet& rSet, const uno::Reference< beans::XPropertySet >& xSet, const SfxItemPropertyMap* pMap )
585 if(!rPropSet.AreThereOwnUsrAnys())
586 return;
588 const SfxItemPropertyMap& rSrc = rPropSet.getPropertyMap();
590 for(const SfxItemPropertyMapEntry* pSrcProp : rSrc.getPropertyEntries())
592 const sal_uInt16 nWID = pSrcProp->nWID;
593 if(SfxItemPool::IsWhich(nWID)
594 && (nWID < OWN_ATTR_VALUE_START || nWID > OWN_ATTR_VALUE_END)
595 && rPropSet.GetUsrAnyForID(*pSrcProp))
596 rSet.Put(rSet.GetPool()->GetDefaultItem(nWID));
599 for(const SfxItemPropertyMapEntry* pSrcProp : rSrc.getPropertyEntries())
601 if(pSrcProp->nWID)
603 uno::Any* pUsrAny = rPropSet.GetUsrAnyForID(*pSrcProp);
604 if(pUsrAny)
606 // search for equivalent entry in pDst
607 const SfxItemPropertyMapEntry* pEntry = pMap->getByName( pSrcProp->aName );
608 if(pEntry)
610 // entry found
611 if(pEntry->nWID >= OWN_ATTR_VALUE_START && pEntry->nWID <= OWN_ATTR_VALUE_END)
613 // special ID in PropertySet, can only be set
614 // directly at the object
615 xSet->setPropertyValue( pSrcProp->aName, *pUsrAny);
617 else
619 SvxItemPropertySet_setPropertyValue(pEntry, *pUsrAny, rSet);
625 const_cast< SvxItemPropertySet& >(rPropSet).ClearAllUsrAny();
629 void SvxShape::ObtainSettingsFromPropertySet(const SvxItemPropertySet& rPropSet)
631 DBG_TESTSOLARMUTEX();
632 if(HasSdrObject() && rPropSet.AreThereOwnUsrAnys())
634 SfxItemSet aSet( GetSdrObject()->getSdrModelFromSdrObject().GetItemPool(), svl::Items<SDRATTR_START, SDRATTR_END>{});
635 Reference< beans::XPropertySet > xShape( static_cast<OWeakObject*>(this), UNO_QUERY );
636 SvxItemPropertySet_ObtainSettingsFromPropertySet(rPropSet, aSet, xShape, &mpPropSet->getPropertyMap() );
638 GetSdrObject()->SetMergedItemSetAndBroadcast(aSet);
640 GetSdrObject()->ApplyNotPersistAttr( aSet );
644 uno::Any SvxShape::GetBitmap( bool bMetaFile /* = false */ ) const
646 DBG_TESTSOLARMUTEX();
647 uno::Any aAny;
649 if(!HasSdrObject() || nullptr == GetSdrObject()->getSdrPageFromSdrObject())
651 return aAny;
654 // tdf#118662 Emulate old behaviour of XclObjComment (see there)
655 const SdrCaptionObj* pSdrCaptionObj(dynamic_cast<SdrCaptionObj*>(GetSdrObject()));
656 if(nullptr != pSdrCaptionObj && pSdrCaptionObj->isSuppressGetBitmap())
658 return aAny;
661 // tdf#119180 If we do not ask for Metafile and we access a SdrGrafObj,
662 // and content exists and is a Bitmap, take the shortcut.
663 // Do *not* do this for Metafile - as can be seen, requested in that case
664 // is a byte-sequence of a saved WMF format file (see below)
665 if(!bMetaFile)
667 const SdrGrafObj* pSdrGrafObj(dynamic_cast<SdrGrafObj*>(GetSdrObject()));
669 if(nullptr != pSdrGrafObj)
671 const Graphic& rGraphic(pSdrGrafObj->GetGraphic());
673 if(GraphicType::Bitmap == rGraphic.GetType())
675 Reference< awt::XBitmap > xBmp( rGraphic.GetXGraphic(), UNO_QUERY );
676 aAny <<= xBmp;
678 return aAny;
683 // tdf#118662 instead of creating an E3dView instance every time to paint
684 // a single SdrObject, use the existing SdrObject::SingleObjectPainter to
685 // use less resources and runtime
686 if(bMetaFile)
688 ScopedVclPtrInstance< VirtualDevice > pVDev;
689 const tools::Rectangle aBoundRect(GetSdrObject()->GetCurrentBoundRect());
690 GDIMetaFile aMtf;
692 pVDev->SetMapMode(MapMode(MapUnit::Map100thMM));
693 pVDev->EnableOutput(false);
694 aMtf.Record(pVDev);
695 GetSdrObject()->SingleObjectPainter(*pVDev);
696 aMtf.Stop();
697 aMtf.WindStart();
698 aMtf.Move(-aBoundRect.Left(), -aBoundRect.Top());
699 aMtf.SetPrefMapMode(MapMode(MapUnit::Map100thMM));
700 aMtf.SetPrefSize(aBoundRect.GetSize());
702 SvMemoryStream aDestStrm(65535, 65535);
704 ConvertGDIMetaFileToWMF(
705 aMtf,
706 aDestStrm,
707 nullptr,
708 false);
710 const uno::Sequence<sal_Int8> aSeq(
711 static_cast< const sal_Int8* >(aDestStrm.GetData()),
712 aDestStrm.GetEndOfData());
714 aAny <<= aSeq;
716 else
718 drawinglayer::primitive2d::Primitive2DContainer xPrimitives(
719 GetSdrObject()->GetViewContact().getViewIndependentPrimitive2DContainer());
721 if(!xPrimitives.empty())
723 const drawinglayer::geometry::ViewInformation2D aViewInformation2D;
724 basegfx::B2DRange aRange(
725 xPrimitives.getB2DRange(aViewInformation2D));
727 if(!aRange.isEmpty())
729 const MapUnit aSourceMapUnit(GetSdrObject()->getSdrModelFromSdrObject().GetScaleUnit());
731 if(MapUnit::Map100thMM != aSourceMapUnit)
733 // tdf#119180 This is UNO API and thus works in 100th_mm,
734 // so if the MapMode from the used SdrModel is *not* equal
735 // to Map100thMM we need to embed the primitives to an adapting
736 // homogen transformation for correct values
737 const basegfx::B2DHomMatrix aMapTransform(
738 OutputDevice::LogicToLogic(
739 MapMode(aSourceMapUnit),
740 MapMode(MapUnit::Map100thMM)));
742 // Embed primitives to get them in 100th mm
743 const drawinglayer::primitive2d::Primitive2DReference xEmbedRef(
744 new drawinglayer::primitive2d::TransformPrimitive2D(
745 aMapTransform,
746 xPrimitives));
748 xPrimitives = drawinglayer::primitive2d::Primitive2DContainer { xEmbedRef };
750 // Update basegfx::B2DRange aRange, too. Here we have the
751 // choice of transforming the existing value or get newly by
752 // again using 'xPrimitives.getB2DRange(aViewInformation2D)'
753 aRange.transform(aMapTransform);
756 const BitmapEx aBmp(
757 convertPrimitive2DSequenceToBitmapEx(
758 xPrimitives,
759 aRange));
761 Graphic aGraph(aBmp);
763 aGraph.SetPrefSize(aBmp.GetPrefSize());
764 aGraph.SetPrefMapMode(aBmp.GetPrefMapMode());
766 Reference< awt::XBitmap > xBmp( aGraph.GetXGraphic(), UNO_QUERY );
767 aAny <<= xBmp;
772 return aAny;
775 uno::Sequence< uno::Type > SAL_CALL SvxShape::getTypes()
777 if( mpImpl->mpMaster )
779 return mpImpl->mpMaster->getTypes();
781 else
783 return _getTypes();
788 uno::Sequence< uno::Type > const & SvxShape::_getTypes()
790 switch( mpImpl->mnObjId )
792 // shapes without text
793 case OBJ_PAGE:
794 case OBJ_FRAME:
795 case OBJ_OLE2_PLUGIN:
796 case OBJ_OLE2_APPLET:
797 case E3D_CUBEOBJ_ID|E3D_INVENTOR_FLAG:
798 case E3D_SPHEREOBJ_ID|E3D_INVENTOR_FLAG:
799 case E3D_LATHEOBJ_ID|E3D_INVENTOR_FLAG:
800 case E3D_EXTRUDEOBJ_ID|E3D_INVENTOR_FLAG:
801 case E3D_POLYGONOBJ_ID|E3D_INVENTOR_FLAG:
802 case OBJ_MEDIA:
803 case OBJ_TABLE:
805 static uno::Sequence<uno::Type> aTypeSequence{
806 cppu::UnoType<drawing::XShape>::get(),
807 cppu::UnoType<lang::XComponent>::get(),
808 cppu::UnoType<beans::XPropertySet>::get(),
809 cppu::UnoType<beans::XMultiPropertySet>::get(),
810 cppu::UnoType<beans::XPropertyState>::get(),
811 cppu::UnoType<beans::XMultiPropertyStates>::get(),
812 cppu::UnoType<drawing::XGluePointsSupplier>::get(),
813 cppu::UnoType<container::XChild>::get(),
814 cppu::UnoType<lang::XServiceInfo>::get(),
815 cppu::UnoType<lang::XTypeProvider>::get(),
816 cppu::UnoType<lang::XUnoTunnel>::get(),
817 cppu::UnoType<container::XNamed>::get(),
820 return aTypeSequence;
822 // group shape
823 case OBJ_GRUP:
825 static uno::Sequence<uno::Type> aTypeSequence{
826 cppu::UnoType<drawing::XShape>::get(),
827 cppu::UnoType<lang::XComponent>::get(),
828 cppu::UnoType<beans::XPropertySet>::get(),
829 cppu::UnoType<beans::XMultiPropertySet>::get(),
830 cppu::UnoType<beans::XPropertyState>::get(),
831 cppu::UnoType<beans::XMultiPropertyStates>::get(),
832 cppu::UnoType<drawing::XGluePointsSupplier>::get(),
833 cppu::UnoType<container::XChild>::get(),
834 cppu::UnoType<lang::XServiceInfo>::get(),
835 cppu::UnoType<lang::XTypeProvider>::get(),
836 cppu::UnoType<lang::XUnoTunnel>::get(),
837 cppu::UnoType<container::XNamed>::get(),
838 cppu::UnoType<drawing::XShapes>::get(),
839 cppu::UnoType<drawing::XShapeGroup>::get(),
842 return aTypeSequence;
844 // connector shape
845 case OBJ_EDGE:
847 static uno::Sequence<uno::Type> aTypeSequence{
848 cppu::UnoType<drawing::XShape>::get(),
849 cppu::UnoType<lang::XComponent>::get(),
850 cppu::UnoType<beans::XPropertySet>::get(),
851 cppu::UnoType<beans::XMultiPropertySet>::get(),
852 cppu::UnoType<beans::XPropertyState>::get(),
853 cppu::UnoType<beans::XMultiPropertyStates>::get(),
854 cppu::UnoType<drawing::XGluePointsSupplier>::get(),
855 cppu::UnoType<container::XChild>::get(),
856 cppu::UnoType<lang::XServiceInfo>::get(),
857 cppu::UnoType<lang::XTypeProvider>::get(),
858 cppu::UnoType<lang::XUnoTunnel>::get(),
859 cppu::UnoType<container::XNamed>::get(),
860 cppu::UnoType<drawing::XConnectorShape>::get(),
861 // from SvxUnoTextBase::getTypes()
862 cppu::UnoType<text::XTextAppend>::get(),
863 cppu::UnoType<text::XTextCopy>::get(),
864 cppu::UnoType<container::XEnumerationAccess>::get(),
865 cppu::UnoType<text::XTextRangeMover>::get(),
868 return aTypeSequence;
870 // control shape
871 case OBJ_UNO:
873 static uno::Sequence<uno::Type> aTypeSequence{
874 cppu::UnoType<drawing::XShape>::get(),
875 cppu::UnoType<lang::XComponent>::get(),
876 cppu::UnoType<beans::XPropertySet>::get(),
877 cppu::UnoType<beans::XMultiPropertySet>::get(),
878 cppu::UnoType<beans::XPropertyState>::get(),
879 cppu::UnoType<beans::XMultiPropertyStates>::get(),
880 cppu::UnoType<drawing::XGluePointsSupplier>::get(),
881 cppu::UnoType<container::XChild>::get(),
882 cppu::UnoType<lang::XServiceInfo>::get(),
883 cppu::UnoType<lang::XTypeProvider>::get(),
884 cppu::UnoType<lang::XUnoTunnel>::get(),
885 cppu::UnoType<container::XNamed>::get(),
886 cppu::UnoType<drawing::XControlShape>::get(),
889 return aTypeSequence;
891 // 3d scene shape
892 case E3D_SCENE_ID|E3D_INVENTOR_FLAG:
894 static uno::Sequence<uno::Type> aTypeSequence{
895 cppu::UnoType<drawing::XShape>::get(),
896 cppu::UnoType<lang::XComponent>::get(),
897 cppu::UnoType<beans::XPropertySet>::get(),
898 cppu::UnoType<beans::XMultiPropertySet>::get(),
899 cppu::UnoType<beans::XPropertyState>::get(),
900 cppu::UnoType<beans::XMultiPropertyStates>::get(),
901 cppu::UnoType<drawing::XGluePointsSupplier>::get(),
902 cppu::UnoType<container::XChild>::get(),
903 cppu::UnoType<lang::XServiceInfo>::get(),
904 cppu::UnoType<lang::XTypeProvider>::get(),
905 cppu::UnoType<lang::XUnoTunnel>::get(),
906 cppu::UnoType<container::XNamed>::get(),
907 cppu::UnoType<drawing::XShapes>::get(),
910 return aTypeSequence;
912 case OBJ_CUSTOMSHAPE:
914 static uno::Sequence<uno::Type> aTypeSequence{
915 cppu::UnoType<drawing::XShape>::get(),
916 cppu::UnoType<lang::XComponent>::get(),
917 cppu::UnoType<beans::XPropertySet>::get(),
918 cppu::UnoType<beans::XMultiPropertySet>::get(),
919 cppu::UnoType<beans::XPropertyState>::get(),
920 cppu::UnoType<beans::XMultiPropertyStates>::get(),
921 cppu::UnoType<drawing::XGluePointsSupplier>::get(),
922 cppu::UnoType<container::XChild>::get(),
923 cppu::UnoType<lang::XServiceInfo>::get(),
924 cppu::UnoType<lang::XTypeProvider>::get(),
925 cppu::UnoType<lang::XUnoTunnel>::get(),
926 cppu::UnoType<container::XNamed>::get(),
927 // from SvxUnoTextBase::getTypes()
928 cppu::UnoType<text::XText>::get(),
929 cppu::UnoType<container::XEnumerationAccess>::get(),
930 cppu::UnoType<text::XTextRangeMover>::get(),
931 cppu::UnoType<drawing::XEnhancedCustomShapeDefaulter>::get(),
934 return aTypeSequence;
936 // shapes with text
937 case OBJ_RECT:
938 case OBJ_CIRC:
939 case OBJ_MEASURE:
940 case OBJ_LINE:
941 case OBJ_POLY:
942 case OBJ_PLIN:
943 case OBJ_PATHLINE:
944 case OBJ_PATHFILL:
945 case OBJ_FREELINE:
946 case OBJ_FREEFILL:
947 case OBJ_PATHPOLY:
948 case OBJ_PATHPLIN:
949 case OBJ_GRAF:
950 case OBJ_TEXT:
951 case OBJ_CAPTION:
952 case OBJ_OLE2: // #i118485# Moved to shapes with text
953 default:
955 static uno::Sequence<uno::Type> aTypeSequence{
956 cppu::UnoType<drawing::XShape>::get(),
957 cppu::UnoType<lang::XComponent>::get(),
958 cppu::UnoType<beans::XPropertySet>::get(),
959 cppu::UnoType<beans::XMultiPropertySet>::get(),
960 cppu::UnoType<beans::XPropertyState>::get(),
961 cppu::UnoType<beans::XMultiPropertyStates>::get(),
962 cppu::UnoType<drawing::XGluePointsSupplier>::get(),
963 cppu::UnoType<container::XChild>::get(),
964 cppu::UnoType<lang::XServiceInfo>::get(),
965 cppu::UnoType<lang::XTypeProvider>::get(),
966 cppu::UnoType<lang::XUnoTunnel>::get(),
967 cppu::UnoType<container::XNamed>::get(),
968 // from SvxUnoTextBase::getTypes()
969 cppu::UnoType<text::XTextAppend>::get(),
970 cppu::UnoType<text::XTextCopy>::get(),
971 cppu::UnoType<container::XEnumerationAccess>::get(),
972 cppu::UnoType<text::XTextRangeMover>::get(),
975 return aTypeSequence;
981 uno::Sequence< sal_Int8 > SAL_CALL SvxShape::getImplementationId()
983 return css::uno::Sequence<sal_Int8>();
986 void SvxShape::Notify( SfxBroadcaster&, const SfxHint& rHint ) noexcept
988 DBG_TESTSOLARMUTEX();
990 // do cheap checks first, this method is hot
991 if (rHint.GetId() != SfxHintId::ThisIsAnSdrHint)
992 return;
993 const SdrHint* pSdrHint = static_cast<const SdrHint*>(&rHint);
994 if (pSdrHint->GetKind() != SdrHintKind::ModelCleared &&
995 pSdrHint->GetKind() != SdrHintKind::ObjectChange)
996 return;
998 // #i55919# SdrHintKind::ObjectChange is only interesting if it's for this object
999 SdrObject* pSdrObject(GetSdrObject());
1000 if ( !pSdrObject || pSdrHint->GetObject() != pSdrObject )
1001 return;
1003 uno::Reference< uno::XInterface > xSelf( pSdrObject->getWeakUnoShape() );
1004 if( !xSelf.is() )
1006 EndListening(pSdrObject->getSdrModelFromSdrObject());
1007 mpSdrObjectWeakReference.reset(nullptr);
1008 return;
1011 bool bClearMe = false;
1013 switch( pSdrHint->GetKind() )
1015 case SdrHintKind::ObjectChange:
1017 updateShapeKind();
1018 break;
1020 case SdrHintKind::ModelCleared:
1022 bClearMe = true;
1023 break;
1025 default:
1026 break;
1029 if( !bClearMe )
1030 return;
1032 if(!HasSdrObjectOwnership())
1034 if(nullptr != pSdrObject)
1036 EndListening(pSdrObject->getSdrModelFromSdrObject());
1037 pSdrObject->setUnoShape(nullptr);
1040 mpSdrObjectWeakReference.reset(nullptr);
1042 // SdrModel *is* going down, try to Free SdrObject even
1043 // when !HasSdrObjectOwnership
1044 if(nullptr != pSdrObject && !pSdrObject->IsInserted())
1046 SdrObject::Free(pSdrObject);
1050 if(!mpImpl->mbDisposing)
1052 dispose();
1056 // XShape
1059 // The "*LogicRectHack" functions also existed in sch, and those
1060 // duplicate symbols cause Bad Things To Happen (TM) #i9462#.
1061 // Prefixing with 'svx' and marking static to make sure name collisions
1062 // do not occur.
1064 static bool svx_needLogicRectHack( SdrObject const * pObj )
1066 if( pObj->GetObjInventor() == SdrInventor::Default)
1068 switch(pObj->GetObjIdentifier())
1070 case OBJ_GRUP:
1071 case OBJ_LINE:
1072 case OBJ_POLY:
1073 case OBJ_PLIN:
1074 case OBJ_PATHLINE:
1075 case OBJ_PATHFILL:
1076 case OBJ_FREELINE:
1077 case OBJ_FREEFILL:
1078 case OBJ_SPLNLINE:
1079 case OBJ_SPLNFILL:
1080 case OBJ_EDGE:
1081 case OBJ_PATHPOLY:
1082 case OBJ_PATHPLIN:
1083 case OBJ_MEASURE:
1084 return true;
1085 default:
1086 break;
1089 return false;
1093 static tools::Rectangle svx_getLogicRectHack( SdrObject const * pObj )
1095 if(svx_needLogicRectHack(pObj))
1097 return pObj->GetSnapRect();
1099 else
1101 return pObj->GetLogicRect();
1106 static void svx_setLogicRectHack( SdrObject* pObj, const tools::Rectangle& rRect )
1108 if(svx_needLogicRectHack(pObj))
1110 pObj->SetSnapRect( rRect );
1112 else
1114 pObj->SetLogicRect( rRect );
1119 awt::Point SAL_CALL SvxShape::getPosition()
1121 ::SolarMutexGuard aGuard;
1123 if(HasSdrObject())
1125 tools::Rectangle aRect( svx_getLogicRectHack(GetSdrObject()) );
1126 Point aPt( aRect.Left(), aRect.Top() );
1128 // Position is relative to anchor, so recalc to absolute position
1129 if( GetSdrObject()->getSdrModelFromSdrObject().IsWriter() )
1130 aPt -= GetSdrObject()->GetAnchorPos();
1132 ForceMetricTo100th_mm(aPt);
1133 return css::awt::Point( aPt.X(), aPt.Y() );
1135 else
1137 return maPosition;
1142 void SAL_CALL SvxShape::setPosition( const awt::Point& Position )
1144 ::SolarMutexGuard aGuard;
1146 if(HasSdrObject())
1148 // do NOT move 3D objects, this would change the homogen
1149 // transformation matrix
1150 if(dynamic_cast<const E3dCompoundObject* >(GetSdrObject()) == nullptr)
1152 tools::Rectangle aRect( svx_getLogicRectHack(GetSdrObject()) );
1153 Point aLocalPos( Position.X, Position.Y );
1154 ForceMetricToItemPoolMetric(aLocalPos);
1156 // Position is absolute, so recalc to position relative to anchor
1157 if( GetSdrObject()->getSdrModelFromSdrObject().IsWriter() )
1158 aLocalPos += GetSdrObject()->GetAnchorPos();
1160 tools::Long nDX = aLocalPos.X() - aRect.Left();
1161 tools::Long nDY = aLocalPos.Y() - aRect.Top();
1163 GetSdrObject()->Move( Size( nDX, nDY ) );
1164 GetSdrObject()->getSdrModelFromSdrObject().SetChanged();
1168 maPosition = Position;
1172 awt::Size SAL_CALL SvxShape::getSize()
1174 ::SolarMutexGuard aGuard;
1176 if(HasSdrObject())
1178 tools::Rectangle aRect( svx_getLogicRectHack(GetSdrObject()) );
1179 Size aObjSize( aRect.getWidth(), aRect.getHeight() );
1180 ForceMetricTo100th_mm(aObjSize);
1181 return css::awt::Size( aObjSize.getWidth(), aObjSize.getHeight() );
1183 else
1184 return maSize;
1188 void SAL_CALL SvxShape::setSize( const awt::Size& rSize )
1190 ::SolarMutexGuard aGuard;
1192 if(HasSdrObject())
1194 tools::Rectangle aRect( svx_getLogicRectHack(GetSdrObject()) );
1195 Size aLocalSize( rSize.Width, rSize.Height );
1196 ForceMetricToItemPoolMetric(aLocalSize);
1198 if(GetSdrObject()->GetObjInventor() == SdrInventor::Default && GetSdrObject()->GetObjIdentifier() == OBJ_MEASURE )
1200 Fraction aWdt(aLocalSize.Width(),aRect.Right()-aRect.Left());
1201 Fraction aHgt(aLocalSize.Height(),aRect.Bottom()-aRect.Top());
1202 Point aPt = GetSdrObject()->GetSnapRect().TopLeft();
1203 GetSdrObject()->Resize(aPt,aWdt,aHgt);
1205 else
1207 //aRect.SetSize(aLocalSize); // this call subtract 1 // https://bz.apache.org/ooo/show_bug.cgi?id=83193
1208 if ( !aLocalSize.Width() )
1210 aRect.SetWidthEmpty();
1212 else
1213 aRect.setWidth(aLocalSize.Width());
1214 if ( !aLocalSize.Height() )
1216 aRect.SetHeightEmpty();
1218 else
1219 aRect.setHeight(aLocalSize.Height());
1221 svx_setLogicRectHack( GetSdrObject(), aRect );
1224 GetSdrObject()->getSdrModelFromSdrObject().SetChanged();
1226 maSize = rSize;
1230 // XNamed
1231 OUString SAL_CALL SvxShape::getName( )
1233 ::SolarMutexGuard aGuard;
1234 if( HasSdrObject() )
1236 return GetSdrObject()->GetName();
1238 else
1240 return maShapeName;
1245 void SAL_CALL SvxShape::setName( const OUString& aName )
1247 ::SolarMutexGuard aGuard;
1248 if( HasSdrObject() )
1250 GetSdrObject()->SetName( aName );
1252 else
1254 maShapeName = aName;
1258 // XShapeDescriptor
1261 OUString SAL_CALL SvxShape::getShapeType()
1263 if( !maShapeType.getLength() )
1264 return UHashMap::getNameFromId( mpImpl->mnObjId );
1265 else
1266 return maShapeType;
1269 // XComponent
1272 void SAL_CALL SvxShape::dispose()
1274 ::SolarMutexGuard aGuard;
1276 if( mpImpl->mbDisposing )
1277 return; // caught a recursion
1279 mpImpl->mbDisposing = true;
1281 lang::EventObject aEvt;
1282 aEvt.Source = *static_cast<OWeakAggObject*>(this);
1283 mpImpl->maDisposeListeners.disposeAndClear(aEvt);
1284 mpImpl->maPropertyNotifier.disposing();
1286 if ( !HasSdrObject() )
1287 return;
1289 SdrObject* pObject = GetSdrObject();
1291 EndListening( pObject->getSdrModelFromSdrObject() );
1292 bool bFreeSdrObject = false;
1294 if ( pObject->IsInserted() && pObject->getSdrPageFromSdrObject() )
1296 OSL_ENSURE( HasSdrObjectOwnership(), "SvxShape::dispose: is the below code correct?" );
1297 // normally, we are allowed to free the SdrObject only if we have its ownership.
1298 // Why isn't this checked here?
1300 SdrPage* pPage = pObject->getSdrPageFromSdrObject();
1301 // delete the SdrObject from the page
1302 const size_t nCount = pPage->GetObjCount();
1303 for ( size_t nNum = 0; nNum < nCount; ++nNum )
1305 if ( pPage->GetObj( nNum ) == pObject )
1307 OSL_VERIFY( pPage->RemoveObject( nNum ) == pObject );
1308 bFreeSdrObject = true;
1309 break;
1314 pObject->setUnoShape(nullptr);
1316 if ( bFreeSdrObject )
1318 // in case we have the ownership of the SdrObject, a Free
1319 // would do nothing. So ensure the ownership is reset.
1320 mpImpl->mbHasSdrObjectOwnership = false;
1321 SdrObject::Free( pObject );
1326 void SAL_CALL SvxShape::addEventListener( const Reference< lang::XEventListener >& xListener )
1328 mpImpl->maDisposeListeners.addInterface(xListener);
1332 void SAL_CALL SvxShape::removeEventListener( const Reference< lang::XEventListener >& aListener )
1334 mpImpl->maDisposeListeners.removeInterface(aListener);
1337 // XPropertySet
1340 Reference< beans::XPropertySetInfo > SAL_CALL
1341 SvxShape::getPropertySetInfo()
1343 if( mpImpl->mpMaster )
1345 return mpImpl->mpMaster->getPropertySetInfo();
1347 else
1349 return _getPropertySetInfo();
1353 Reference< beans::XPropertySetInfo > const &
1354 SvxShape::_getPropertySetInfo()
1356 return mpPropSet->getPropertySetInfo();
1360 void SAL_CALL SvxShape::addPropertyChangeListener( const OUString& _propertyName, const Reference< beans::XPropertyChangeListener >& _listener )
1362 ::osl::MutexGuard aGuard( maMutex );
1363 mpImpl->maPropertyNotifier.addPropertyChangeListener( _propertyName, _listener );
1367 void SAL_CALL SvxShape::removePropertyChangeListener( const OUString& _propertyName, const Reference< beans::XPropertyChangeListener >& _listener )
1369 ::osl::MutexGuard aGuard( maMutex );
1370 mpImpl->maPropertyNotifier.removePropertyChangeListener( _propertyName, _listener );
1374 void SAL_CALL SvxShape::addVetoableChangeListener( const OUString& , const Reference< beans::XVetoableChangeListener >& )
1376 OSL_FAIL( "SvxShape::addVetoableChangeListener: don't have any vetoable properties, so why ...?" );
1380 void SAL_CALL SvxShape::removeVetoableChangeListener( const OUString& , const Reference< beans::XVetoableChangeListener >& )
1382 OSL_FAIL( "SvxShape::removeVetoableChangeListener: don't have any vetoable properties, so why ...?" );
1386 bool SvxShape::SetFillAttribute( sal_uInt16 nWID, const OUString& rName )
1388 if(HasSdrObject())
1390 SfxItemSet aSet( GetSdrObject()->getSdrModelFromSdrObject().GetItemPool(), {{nWID, nWID}} );
1392 if( SetFillAttribute( nWID, rName, aSet, &GetSdrObject()->getSdrModelFromSdrObject() ) )
1394 //GetSdrObject()->SetItemSetAndBroadcast(aSet);
1395 GetSdrObject()->SetMergedItemSetAndBroadcast(aSet);
1397 return true;
1401 return false;
1405 bool SvxShape::SetFillAttribute( sal_uInt16 nWID, const OUString& rName, SfxItemSet& rSet, SdrModel const * pModel )
1407 // check if an item with the given name and which id is inside the models
1408 // pool or the stylesheet pool, if found it's put in the itemset
1409 if( !SetFillAttribute( nWID, rName, rSet ) )
1411 // we did not find such item in one of the pools, so we check
1412 // the property lists that are loaded for the model for items
1413 // that support such.
1414 OUString aStrName = SvxUnogetInternalNameForItem(nWID, rName);
1416 switch( nWID )
1418 case XATTR_FILLBITMAP:
1420 XBitmapListRef pBitmapList = pModel->GetBitmapList();
1422 if( !pBitmapList.is() )
1423 return false;
1425 tools::Long nPos = pBitmapList->GetIndex(aStrName);
1426 if( nPos == -1 )
1427 return false;
1429 const XBitmapEntry* pEntry = pBitmapList->GetBitmap(nPos);
1430 XFillBitmapItem aBmpItem(rName, pEntry->GetGraphicObject());
1431 rSet.Put(aBmpItem);
1432 break;
1434 case XATTR_FILLGRADIENT:
1436 XGradientListRef pGradientList = pModel->GetGradientList();
1438 if( !pGradientList.is() )
1439 return false;
1441 tools::Long nPos = pGradientList->GetIndex(aStrName);
1442 if( nPos == -1 )
1443 return false;
1445 const XGradientEntry* pEntry = pGradientList->GetGradient(nPos);
1446 XFillGradientItem aGrdItem(rName, pEntry->GetGradient());
1447 rSet.Put( aGrdItem );
1448 break;
1450 case XATTR_FILLHATCH:
1452 XHatchListRef pHatchList = pModel->GetHatchList();
1454 if( !pHatchList.is() )
1455 return false;
1457 tools::Long nPos = pHatchList->GetIndex(aStrName);
1458 if( nPos == -1 )
1459 return false;
1461 const XHatchEntry* pEntry = pHatchList->GetHatch( nPos );
1462 XFillHatchItem aHatchItem(rName, pEntry->GetHatch());
1463 rSet.Put( aHatchItem );
1464 break;
1466 case XATTR_LINEEND:
1467 case XATTR_LINESTART:
1469 XLineEndListRef pLineEndList = pModel->GetLineEndList();
1471 if( !pLineEndList.is() )
1472 return false;
1474 tools::Long nPos = pLineEndList->GetIndex(aStrName);
1475 if( nPos == -1 )
1476 return false;
1478 const XLineEndEntry* pEntry = pLineEndList->GetLineEnd(nPos);
1479 if( sal_uInt16(XATTR_LINEEND) == nWID )
1481 XLineEndItem aLEItem(rName, pEntry->GetLineEnd());
1482 rSet.Put( aLEItem );
1484 else
1486 XLineStartItem aLSItem(rName, pEntry->GetLineEnd());
1487 rSet.Put( aLSItem );
1490 break;
1492 case XATTR_LINEDASH:
1494 XDashListRef pDashList = pModel->GetDashList();
1496 if( !pDashList.is() )
1497 return false;
1499 tools::Long nPos = pDashList->GetIndex(aStrName);
1500 if( nPos == -1 )
1501 return false;
1503 const XDashEntry* pEntry = pDashList->GetDash(nPos);
1504 XLineDashItem aDashItem(rName, pEntry->GetDash());
1505 rSet.Put( aDashItem );
1506 break;
1508 default:
1509 return false;
1513 return true;
1517 bool SvxShape::SetFillAttribute( sal_uInt16 nWID, const OUString& rName, SfxItemSet& rSet )
1519 OUString aName = SvxUnogetInternalNameForItem(nWID, rName);
1521 if (aName.isEmpty())
1523 switch( nWID )
1525 case XATTR_LINEEND:
1526 case XATTR_LINESTART:
1528 const basegfx::B2DPolyPolygon aEmptyPoly;
1529 if( nWID == sal_uInt16(XATTR_LINEEND) )
1530 rSet.Put( XLineEndItem( "", aEmptyPoly ) );
1531 else
1532 rSet.Put( XLineStartItem( "", aEmptyPoly ) );
1534 return true;
1536 case XATTR_FILLFLOATTRANSPARENCE:
1538 // #85953# Set a disabled XFillFloatTransparenceItem
1539 rSet.Put(XFillFloatTransparenceItem());
1541 return true;
1545 return false;
1548 for (const SfxPoolItem* p : rSet.GetPool()->GetItemSurrogates(nWID))
1550 const NameOrIndex* pItem = static_cast<const NameOrIndex*>(p);
1551 if( pItem->GetName() == aName )
1553 rSet.Put( *pItem );
1554 return true;
1558 return false;
1562 void SAL_CALL SvxShape::setPropertyValue( const OUString& rPropertyName, const uno::Any& rVal )
1564 if( mpImpl->mpMaster )
1566 mpImpl->mpMaster->setPropertyValue( rPropertyName, rVal );
1568 else
1570 _setPropertyValue( rPropertyName, rVal );
1574 void SvxShape::_setPropertyValue( const OUString& rPropertyName, const uno::Any& rVal )
1576 ::SolarMutexGuard aGuard;
1578 const SfxItemPropertyMapEntry* pMap = mpPropSet->getPropertyMapEntry(rPropertyName);
1580 if (!HasSdrObject())
1582 // Since we have no actual sdr object right now, remember all
1583 // properties in a list. These properties will be set when the sdr
1584 // object is created.
1586 if (pMap && pMap->nWID)
1588 // FIXME: We should throw a UnknownPropertyException here.
1589 // But since this class is aggregated from classes that
1590 // support additional properties that we don't know here we
1591 // silently store *all* properties, even if they may be not
1592 // supported after creation.
1593 mpPropSet->setPropertyValue( pMap, rVal );
1596 return;
1599 if (rPropertyName == "HandlePathObjScale")
1601 auto pPathObj = dynamic_cast<SdrPathObj*>(GetSdrObject());
1602 if (pPathObj)
1604 bool bHandleScale{};
1605 if (rVal >>= bHandleScale)
1607 pPathObj->SetHandleScale(bHandleScale);
1610 return;
1613 if (!pMap)
1615 // reduce log noise by ignoring two properties that higher level code queries for on all objects
1616 SAL_WARN_IF(rPropertyName != "FromWordArt" && rPropertyName != "GraphicColorMode",
1617 "svx.uno", "Unknown Property: " << rPropertyName);
1618 throw beans::UnknownPropertyException( rPropertyName, static_cast<cppu::OWeakObject*>(this));
1621 if ((pMap->nFlags & beans::PropertyAttribute::READONLY) != 0)
1622 throw beans::PropertyVetoException(
1623 "Readonly property can't be set: " + rPropertyName,
1624 uno::Reference<drawing::XShape>(this));
1626 GetSdrObject()->getSdrModelFromSdrObject().SetChanged();
1628 if (setPropertyValueImpl(rPropertyName, pMap, rVal))
1629 return;
1631 DBG_ASSERT( pMap->nWID == SDRATTR_TEXTDIRECTION || pMap->nWID < SDRATTR_NOTPERSIST_FIRST || pMap->nWID > SDRATTR_NOTPERSIST_LAST, "Not persist item not handled!" );
1632 DBG_ASSERT( pMap->nWID < OWN_ATTR_VALUE_START || pMap->nWID > OWN_ATTR_VALUE_END, "Not item property not handled!" );
1634 bool bIsNotPersist = pMap->nWID >= SDRATTR_NOTPERSIST_FIRST && pMap->nWID <= SDRATTR_NOTPERSIST_LAST && pMap->nWID != SDRATTR_TEXTDIRECTION;
1636 if( pMap->nWID == SDRATTR_CORNER_RADIUS )
1638 sal_Int32 nCornerRadius = 0;
1639 if( !(rVal >>= nCornerRadius) || (nCornerRadius < 0) || (nCornerRadius > 5000000))
1640 throw IllegalArgumentException();
1643 std::optional<SfxItemSet> xLocalSet;
1644 SfxItemSet* pSet;
1645 if( mbIsMultiPropertyCall && !bIsNotPersist )
1647 if( !mpImpl->mxItemSet )
1649 sal_uInt16 aWhichPairTable[] = { pMap->nWID, pMap->nWID, 0, 0 };
1650 mpImpl->mxItemSet.emplace( GetSdrObject()->getSdrModelFromSdrObject().GetItemPool(), aWhichPairTable);
1652 else
1654 mpImpl->mxItemSet->MergeRange(pMap->nWID, pMap->nWID);
1656 pSet = &*mpImpl->mxItemSet;
1658 else
1660 sal_uInt16 aWhichPairTable[] = { pMap->nWID, pMap->nWID, 0, 0 };
1661 xLocalSet.emplace( GetSdrObject()->getSdrModelFromSdrObject().GetItemPool(), aWhichPairTable);
1662 pSet = &*xLocalSet;
1665 if( pSet->GetItemState( pMap->nWID ) != SfxItemState::SET )
1666 pSet->Put(GetSdrObject()->GetMergedItem(pMap->nWID));
1668 if( !SvxUnoTextRangeBase::SetPropertyValueHelper( pMap, rVal, *pSet ))
1670 if( pSet->GetItemState( pMap->nWID ) != SfxItemState::SET )
1672 if(bIsNotPersist)
1674 // not-persistent attribute, get those extra
1675 GetSdrObject()->TakeNotPersistAttr(*pSet);
1679 if( pSet->GetItemState( pMap->nWID ) != SfxItemState::SET )
1681 // get default from ItemPool
1682 if(SfxItemPool::IsWhich(pMap->nWID))
1683 pSet->Put(GetSdrObject()->getSdrModelFromSdrObject().GetItemPool().GetDefaultItem(pMap->nWID));
1686 if( pSet->GetItemState( pMap->nWID ) == SfxItemState::SET )
1688 SvxItemPropertySet_setPropertyValue( pMap, rVal, *pSet );
1692 if(bIsNotPersist)
1694 // set not-persistent attribute extra
1695 GetSdrObject()->ApplyNotPersistAttr( *pSet );
1697 else
1699 // if we have a XMultiProperty call then the item set
1700 // will be set in setPropertyValues later
1701 if( !mbIsMultiPropertyCall )
1702 GetSdrObject()->SetMergedItemSetAndBroadcast( *pSet );
1707 uno::Any SAL_CALL SvxShape::getPropertyValue( const OUString& PropertyName )
1709 if ( mpImpl->mpMaster )
1710 return mpImpl->mpMaster->getPropertyValue( PropertyName );
1711 else
1712 return _getPropertyValue( PropertyName );
1716 uno::Any SvxShape::_getPropertyValue( const OUString& PropertyName )
1718 ::SolarMutexGuard aGuard;
1720 const SfxItemPropertyMapEntry* pMap = mpPropSet->getPropertyMapEntry(PropertyName);
1722 uno::Any aAny;
1723 if(HasSdrObject())
1725 if(pMap == nullptr )
1726 throw beans::UnknownPropertyException( PropertyName, static_cast<cppu::OWeakObject*>(this));
1728 if( !getPropertyValueImpl( PropertyName, pMap, aAny ) )
1730 DBG_ASSERT( pMap->nWID == SDRATTR_TEXTDIRECTION || (pMap->nWID < SDRATTR_NOTPERSIST_FIRST || pMap->nWID > SDRATTR_NOTPERSIST_LAST), "Not persist item not handled!" );
1731 DBG_ASSERT( pMap->nWID < OWN_ATTR_VALUE_START || pMap->nWID > OWN_ATTR_VALUE_END, "Not item property not handled!" );
1733 SfxItemSet aSet( GetSdrObject()->getSdrModelFromSdrObject().GetItemPool(), {{pMap->nWID, pMap->nWID}});
1734 aSet.Put(GetSdrObject()->GetMergedItem(pMap->nWID));
1736 if(SvxUnoTextRangeBase::GetPropertyValueHelper( aSet, pMap, aAny ))
1737 return aAny;
1739 if(!aSet.Count())
1741 if(pMap->nWID >= SDRATTR_NOTPERSIST_FIRST && pMap->nWID <= SDRATTR_NOTPERSIST_LAST)
1743 // not-persistent attribute, get those extra
1744 GetSdrObject()->TakeNotPersistAttr(aSet);
1748 if(!aSet.Count())
1750 // get default from ItemPool
1751 if(SfxItemPool::IsWhich(pMap->nWID))
1752 aSet.Put(GetSdrObject()->getSdrModelFromSdrObject().GetItemPool().GetDefaultItem(pMap->nWID));
1755 if(aSet.Count())
1756 aAny = GetAnyForItem( aSet, pMap );
1759 else
1762 // Fixme: we should return default values for OWN_ATTR !
1764 if(pMap && pMap->nWID)
1765 // FixMe: see setPropertyValue
1766 aAny = mpPropSet->getPropertyValue( pMap );
1769 return aAny;
1773 // XMultiPropertySet
1774 void SAL_CALL SvxShape::setPropertyValues( const css::uno::Sequence< OUString >& aPropertyNames, const css::uno::Sequence< css::uno::Any >& aValues )
1776 ::SolarMutexGuard aSolarGuard;
1778 const sal_Int32 nCount = aPropertyNames.getLength();
1779 const OUString* pNames = aPropertyNames.getConstArray();
1781 const uno::Any* pValues = aValues.getConstArray();
1783 // make sure mbIsMultiPropertyCall and mpImpl->mpItemSet are
1784 // reset even when an exception is thrown
1785 const ::comphelper::ScopeGuard aGuard( [this] () { return this->endSetPropertyValues(); } );
1787 mbIsMultiPropertyCall = true;
1789 if( mpImpl->mpMaster )
1791 for( sal_Int32 nIdx = 0; nIdx < nCount; nIdx++, pNames++, pValues++ )
1795 setPropertyValue( *pNames, *pValues );
1797 catch( beans::UnknownPropertyException& ) {}
1798 catch( uno::Exception& ) {}
1801 else
1803 uno::Reference< beans::XPropertySet > xSet;
1804 queryInterface( cppu::UnoType<beans::XPropertySet>::get()) >>= xSet;
1806 for( sal_Int32 nIdx = 0; nIdx < nCount; nIdx++, pNames++, pValues++ )
1810 xSet->setPropertyValue( *pNames, *pValues );
1812 catch( beans::UnknownPropertyException& ) {}
1813 catch( uno::Exception& ) {}
1817 if( mpImpl->mxItemSet && HasSdrObject() )
1818 GetSdrObject()->SetMergedItemSetAndBroadcast( *mpImpl->mxItemSet );
1822 void SvxShape::endSetPropertyValues()
1824 mbIsMultiPropertyCall = false;
1825 mpImpl->mxItemSet.reset();
1829 css::uno::Sequence< css::uno::Any > SAL_CALL SvxShape::getPropertyValues( const css::uno::Sequence< OUString >& aPropertyNames )
1831 const sal_Int32 nCount = aPropertyNames.getLength();
1832 const OUString* pNames = aPropertyNames.getConstArray();
1834 uno::Sequence< uno::Any > aRet( nCount );
1835 uno::Any* pValue = aRet.getArray();
1837 if( mpImpl->mpMaster )
1839 for( sal_Int32 nIdx = 0; nIdx < nCount; nIdx++, pValue++, pNames++ )
1843 *pValue = getPropertyValue( *pNames );
1845 catch( uno::Exception& )
1847 OSL_FAIL( "SvxShape::getPropertyValues, unknown property asked" );
1851 else
1853 uno::Reference< beans::XPropertySet > xSet;
1854 queryInterface( cppu::UnoType<beans::XPropertySet>::get()) >>= xSet;
1856 for( sal_Int32 nIdx = 0; nIdx < nCount; nIdx++, pValue++, pNames++ )
1860 *pValue = xSet->getPropertyValue( *pNames );
1862 catch( uno::Exception& )
1864 OSL_FAIL( "SvxShape::getPropertyValues, unknown property asked" );
1869 return aRet;
1872 void SAL_CALL SvxShape::addPropertiesChangeListener( const css::uno::Sequence< OUString >& , const css::uno::Reference< css::beans::XPropertiesChangeListener >& )
1876 void SAL_CALL SvxShape::removePropertiesChangeListener( const css::uno::Reference< css::beans::XPropertiesChangeListener >& )
1880 void SAL_CALL SvxShape::firePropertiesChangeEvent( const css::uno::Sequence< OUString >& , const css::uno::Reference< css::beans::XPropertiesChangeListener >& )
1885 uno::Any SvxShape::GetAnyForItem( SfxItemSet const & aSet, const SfxItemPropertyMapEntry* pMap ) const
1887 DBG_TESTSOLARMUTEX();
1888 uno::Any aAny;
1890 switch(pMap->nWID)
1892 case SDRATTR_CIRCSTARTANGLE:
1894 const SfxPoolItem* pPoolItem=nullptr;
1895 if(aSet.GetItemState(SDRATTR_CIRCSTARTANGLE,false,&pPoolItem)==SfxItemState::SET)
1897 Degree100 nAngle = static_cast<const SdrAngleItem*>(pPoolItem)->GetValue();
1898 aAny <<= nAngle.get();
1900 break;
1903 case SDRATTR_CIRCENDANGLE:
1905 const SfxPoolItem* pPoolItem=nullptr;
1906 if (aSet.GetItemState(SDRATTR_CIRCENDANGLE,false,&pPoolItem)==SfxItemState::SET)
1908 Degree100 nAngle = static_cast<const SdrAngleItem*>(pPoolItem)->GetValue();
1909 aAny <<= nAngle.get();
1911 break;
1914 case SDRATTR_CIRCKIND:
1916 if( GetSdrObject()->GetObjInventor() == SdrInventor::Default)
1918 drawing::CircleKind eKind;
1919 switch(GetSdrObject()->GetObjIdentifier())
1921 case OBJ_CIRC: // circle, ellipse
1922 eKind = drawing::CircleKind_FULL;
1923 break;
1924 case OBJ_CCUT: // segment of circle
1925 eKind = drawing::CircleKind_CUT;
1926 break;
1927 case OBJ_CARC: // arc of circle
1928 eKind = drawing::CircleKind_ARC;
1929 break;
1930 case OBJ_SECT: // sector
1931 eKind = drawing::CircleKind_SECTION;
1932 break;
1933 default:
1934 break;
1936 aAny <<= eKind;
1938 break;
1940 default:
1942 // get value from ItemSet
1943 aAny = SvxItemPropertySet_getPropertyValue( pMap, aSet );
1945 if( pMap->aType != aAny.getValueType() )
1947 // since the sfx uint16 item now exports a sal_Int32, we may have to fix this here
1948 if( ( pMap->aType == ::cppu::UnoType<sal_Int16>::get()) && aAny.getValueType() == ::cppu::UnoType<sal_Int32>::get() )
1950 sal_Int32 nValue = 0;
1951 aAny >>= nValue;
1952 aAny <<= static_cast<sal_Int16>(nValue);
1954 else
1956 OSL_FAIL("SvxShape::GetAnyForItem() Returnvalue has wrong Type!" );
1963 return aAny;
1967 // XPropertyState
1968 beans::PropertyState SAL_CALL SvxShape::getPropertyState( const OUString& PropertyName )
1970 if( mpImpl->mpMaster )
1972 return mpImpl->mpMaster->getPropertyState( PropertyName );
1974 else
1976 return _getPropertyState( PropertyName );
1980 beans::PropertyState SvxShape::_getPropertyState( const OUString& PropertyName )
1982 ::SolarMutexGuard aGuard;
1984 const SfxItemPropertyMapEntry* pMap = mpPropSet->getPropertyMapEntry(PropertyName);
1986 if( !HasSdrObject() || pMap == nullptr )
1987 throw beans::UnknownPropertyException( PropertyName, static_cast<cppu::OWeakObject*>(this));
1989 beans::PropertyState eState;
1990 if( !getPropertyStateImpl( pMap, eState ) )
1992 const SfxItemSet& rSet = GetSdrObject()->GetMergedItemSet();
1994 switch( rSet.GetItemState( pMap->nWID, false ) )
1996 case SfxItemState::SET:
1997 eState = beans::PropertyState_DIRECT_VALUE;
1998 break;
1999 case SfxItemState::DEFAULT:
2000 eState = beans::PropertyState_DEFAULT_VALUE;
2001 break;
2002 default:
2003 eState = beans::PropertyState_AMBIGUOUS_VALUE;
2004 break;
2007 // if an item is set, this doesn't mean we want it :)
2008 if( beans::PropertyState_DIRECT_VALUE == eState )
2010 switch( pMap->nWID )
2012 // the following items are disabled by changing the
2013 // fill style or the line style. so there is no need
2014 // to export items without names which should be empty
2015 case XATTR_FILLBITMAP:
2016 case XATTR_FILLGRADIENT:
2017 case XATTR_FILLHATCH:
2018 case XATTR_LINEDASH:
2020 const NameOrIndex* pItem = rSet.GetItem<NameOrIndex>(pMap->nWID);
2021 if( ( pItem == nullptr ) || pItem->GetName().isEmpty() )
2022 eState = beans::PropertyState_DEFAULT_VALUE;
2024 break;
2026 // #i36115#
2027 // If e.g. the LineStart is on NONE and thus the string has length 0, it still
2028 // may be a hard attribute covering the set LineStart of the parent (Style).
2029 // #i37644#
2030 // same is for fill float transparency
2031 case XATTR_LINEEND:
2032 case XATTR_LINESTART:
2033 case XATTR_FILLFLOATTRANSPARENCE:
2035 const NameOrIndex* pItem = rSet.GetItem<NameOrIndex>(pMap->nWID);
2036 if ( pItem == nullptr )
2037 eState = beans::PropertyState_DEFAULT_VALUE;
2039 break;
2043 return eState;
2046 bool SvxShape::setPropertyValueImpl( const OUString&, const SfxItemPropertyMapEntry* pProperty, const css::uno::Any& rValue )
2048 switch( pProperty->nWID )
2050 case OWN_ATTR_CAPTION_POINT:
2052 awt::Point aPnt;
2053 if( rValue >>= aPnt )
2055 Point aVclPoint( aPnt.X, aPnt.Y );
2057 // tdf#117145 metric of SdrModel is app-specific, metric of UNO API is 100thmm
2058 // Need to adapt aVclPoint from 100thmm to app-specific
2059 ForceMetricToItemPoolMetric(aVclPoint);
2061 // #90763# position is relative to top left, make it absolute
2062 basegfx::B2DPolyPolygon aNewPolyPolygon;
2063 basegfx::B2DHomMatrix aNewHomogenMatrix;
2064 GetSdrObject()->TRGetBaseGeometry(aNewHomogenMatrix, aNewPolyPolygon);
2066 aVclPoint.AdjustX(basegfx::fround(aNewHomogenMatrix.get(0, 2)) );
2067 aVclPoint.AdjustY(basegfx::fround(aNewHomogenMatrix.get(1, 2)) );
2069 // #88491# position relative to anchor
2070 if( GetSdrObject()->getSdrModelFromSdrObject().IsWriter() )
2072 aVclPoint += GetSdrObject()->GetAnchorPos();
2075 static_cast<SdrCaptionObj*>(GetSdrObject())->SetTailPos(aVclPoint);
2077 return true;
2079 break;
2081 case OWN_ATTR_TRANSFORMATION:
2083 drawing::HomogenMatrix3 aMatrix;
2084 if(rValue >>= aMatrix)
2086 basegfx::B2DPolyPolygon aNewPolyPolygon;
2087 basegfx::B2DHomMatrix aNewHomogenMatrix;
2089 // tdf#117145 SdrModel data is app-specific
2090 GetSdrObject()->TRGetBaseGeometry(aNewHomogenMatrix, aNewPolyPolygon);
2092 aNewHomogenMatrix.set(0, 0, aMatrix.Line1.Column1);
2093 aNewHomogenMatrix.set(0, 1, aMatrix.Line1.Column2);
2094 aNewHomogenMatrix.set(0, 2, aMatrix.Line1.Column3);
2095 aNewHomogenMatrix.set(1, 0, aMatrix.Line2.Column1);
2096 aNewHomogenMatrix.set(1, 1, aMatrix.Line2.Column2);
2097 aNewHomogenMatrix.set(1, 2, aMatrix.Line2.Column3);
2098 aNewHomogenMatrix.set(2, 0, aMatrix.Line3.Column1);
2099 aNewHomogenMatrix.set(2, 1, aMatrix.Line3.Column2);
2100 aNewHomogenMatrix.set(2, 2, aMatrix.Line3.Column3);
2102 // tdf#117145 metric of SdrModel is app-specific, metric of UNO API is 100thmm
2103 // Need to adapt aNewHomogenMatrix from 100thmm to app-specific
2104 ForceMetricToItemPoolMetric(aNewHomogenMatrix);
2106 GetSdrObject()->TRSetBaseGeometry(aNewHomogenMatrix, aNewPolyPolygon);
2107 return true;
2109 break;
2112 case OWN_ATTR_ZORDER:
2114 sal_Int32 nNewOrdNum = 0;
2115 if(rValue >>= nNewOrdNum)
2117 SdrObjList* pObjList = GetSdrObject()->getParentSdrObjListFromSdrObject();
2118 if( pObjList )
2120 SdrObject* pCheck =
2121 pObjList->SetObjectOrdNum( GetSdrObject()->GetOrdNum(), static_cast<size_t>(nNewOrdNum) );
2122 DBG_ASSERT( pCheck == GetSdrObject(), "GetOrdNum() failed!" );
2124 return true;
2126 break;
2128 case OWN_ATTR_FRAMERECT:
2130 awt::Rectangle aUnoRect;
2131 if(rValue >>= aUnoRect)
2133 Point aTopLeft( aUnoRect.X, aUnoRect.Y );
2134 Size aObjSize( aUnoRect.Width, aUnoRect.Height );
2135 ForceMetricToItemPoolMetric(aTopLeft);
2136 ForceMetricToItemPoolMetric(aObjSize);
2137 tools::Rectangle aRect;
2138 aRect.SetPos(aTopLeft);
2139 aRect.SetSize(aObjSize);
2140 GetSdrObject()->SetSnapRect(aRect);
2141 return true;
2143 break;
2145 case OWN_ATTR_MIRRORED:
2147 bool bMirror;
2148 if(rValue >>= bMirror )
2150 SdrGrafObj* pObj = dynamic_cast< SdrGrafObj* >( GetSdrObject() );
2151 if( pObj )
2152 pObj->SetMirrored(bMirror);
2153 return true;
2155 break;
2157 case OWN_ATTR_EDGE_START_OBJ:
2158 case OWN_ATTR_EDGE_END_OBJ:
2159 case OWN_ATTR_GLUEID_HEAD:
2160 case OWN_ATTR_GLUEID_TAIL:
2161 case OWN_ATTR_EDGE_START_POS:
2162 case OWN_ATTR_EDGE_END_POS:
2163 case OWN_ATTR_EDGE_POLYPOLYGONBEZIER:
2165 SdrEdgeObj* pEdgeObj = dynamic_cast< SdrEdgeObj* >(GetSdrObject());
2166 if(pEdgeObj)
2168 switch(pProperty->nWID)
2170 case OWN_ATTR_EDGE_START_OBJ:
2171 case OWN_ATTR_EDGE_END_OBJ:
2173 Reference< drawing::XShape > xShape;
2174 if( rValue >>= xShape )
2176 SdrObject* pNode = GetSdrObjectFromXShape( xShape );
2177 if( pNode )
2179 pEdgeObj->ConnectToNode( pProperty->nWID == OWN_ATTR_EDGE_START_OBJ, pNode );
2180 pEdgeObj->setGluePointIndex( pProperty->nWID == OWN_ATTR_EDGE_START_OBJ );
2181 return true;
2184 break;
2187 case OWN_ATTR_EDGE_START_POS:
2188 case OWN_ATTR_EDGE_END_POS:
2190 awt::Point aUnoPoint;
2191 if( rValue >>= aUnoPoint )
2193 Point aPoint( aUnoPoint.X, aUnoPoint.Y );
2195 // Reintroduction of fix for issue i59051 (#i108851#)
2196 // perform metric change before applying anchor position,
2197 // because the anchor position is in pool metric.
2198 ForceMetricToItemPoolMetric( aPoint );
2199 if( GetSdrObject()->getSdrModelFromSdrObject().IsWriter() )
2200 aPoint += GetSdrObject()->GetAnchorPos();
2202 pEdgeObj->SetTailPoint( pProperty->nWID == OWN_ATTR_EDGE_START_POS, aPoint );
2203 return true;
2205 break;
2208 case OWN_ATTR_GLUEID_HEAD:
2209 case OWN_ATTR_GLUEID_TAIL:
2211 sal_Int32 nId = 0;
2212 if( rValue >>= nId )
2214 pEdgeObj->setGluePointIndex( pProperty->nWID == OWN_ATTR_GLUEID_HEAD, nId );
2215 return true;
2217 break;
2219 case OWN_ATTR_EDGE_POLYPOLYGONBEZIER:
2221 basegfx::B2DPolyPolygon aNewPolyPolygon;
2223 // #123616# be a little bit more flexible regarding the data type used
2224 if( auto s = o3tl::tryAccess<drawing::PointSequenceSequence>(rValue) )
2226 // get polygpon data from PointSequenceSequence
2227 aNewPolyPolygon = basegfx::utils::UnoPointSequenceSequenceToB2DPolyPolygon(
2228 *s);
2230 else if( auto cs = o3tl::tryAccess<drawing::PolyPolygonBezierCoords>(rValue) )
2232 // get polygpon data from PolyPolygonBezierCoords
2233 aNewPolyPolygon = basegfx::utils::UnoPolyPolygonBezierCoordsToB2DPolyPolygon(
2234 *cs);
2237 if(aNewPolyPolygon.count())
2239 // Reintroduction of fix for issue i59051 (#i108851#)
2240 ForceMetricToItemPoolMetric( aNewPolyPolygon );
2241 if( GetSdrObject()->getSdrModelFromSdrObject().IsWriter() )
2243 Point aPoint( GetSdrObject()->GetAnchorPos() );
2244 aNewPolyPolygon.transform(basegfx::utils::createTranslateB2DHomMatrix(aPoint.X(), aPoint.Y()));
2246 pEdgeObj->SetEdgeTrackPath( aNewPolyPolygon );
2247 return true;
2252 break;
2254 case OWN_ATTR_MEASURE_START_POS:
2255 case OWN_ATTR_MEASURE_END_POS:
2257 SdrMeasureObj* pMeasureObj = dynamic_cast< SdrMeasureObj* >(GetSdrObject());
2258 awt::Point aUnoPoint;
2259 if(pMeasureObj && ( rValue >>= aUnoPoint ) )
2261 Point aPoint( aUnoPoint.X, aUnoPoint.Y );
2263 // Reintroduction of fix for issue #i59051# (#i108851#)
2264 ForceMetricToItemPoolMetric( aPoint );
2265 if( GetSdrObject()->getSdrModelFromSdrObject().IsWriter() )
2266 aPoint += GetSdrObject()->GetAnchorPos();
2268 pMeasureObj->NbcSetPoint( aPoint, pProperty->nWID == OWN_ATTR_MEASURE_START_POS ? 0 : 1 );
2269 pMeasureObj->SetChanged();
2270 pMeasureObj->BroadcastObjectChange();
2271 return true;
2273 break;
2275 case OWN_ATTR_FILLBMP_MODE:
2277 drawing::BitmapMode eMode;
2278 if(!(rValue >>= eMode) )
2280 sal_Int32 nMode = 0;
2281 if(!(rValue >>= nMode))
2282 break;
2284 eMode = static_cast<drawing::BitmapMode>(nMode);
2286 GetSdrObject()->SetMergedItem( XFillBmpStretchItem( eMode == drawing::BitmapMode_STRETCH ) );
2287 GetSdrObject()->SetMergedItem( XFillBmpTileItem( eMode == drawing::BitmapMode_REPEAT ) );
2288 return true;
2291 case SDRATTR_LAYERID:
2293 sal_Int16 nLayerId = sal_Int16();
2294 if( rValue >>= nLayerId )
2296 SdrLayer* pLayer = GetSdrObject()->getSdrModelFromSdrObject().GetLayerAdmin().GetLayerPerID(SdrLayerID(nLayerId));
2297 if( pLayer )
2299 GetSdrObject()->SetLayer(SdrLayerID(nLayerId));
2300 return true;
2303 break;
2306 case SDRATTR_LAYERNAME:
2308 OUString aLayerName;
2309 if( rValue >>= aLayerName )
2311 const SdrLayer* pLayer = GetSdrObject()->getSdrModelFromSdrObject().GetLayerAdmin().GetLayer(aLayerName);
2312 if( pLayer != nullptr )
2314 GetSdrObject()->SetLayer( pLayer->GetID() );
2315 return true;
2318 break;
2320 case SDRATTR_ROTATEANGLE:
2322 sal_Int32 nTmp = 0;
2323 if( rValue >>= nTmp )
2325 Degree100 nAngle(nTmp);
2326 Point aRef1(GetSdrObject()->GetSnapRect().Center());
2327 nAngle -= GetSdrObject()->GetRotateAngle();
2328 if (nAngle)
2330 double nSin = sin(nAngle.get() * F_PI18000);
2331 double nCos = cos(nAngle.get() * F_PI18000);
2332 GetSdrObject()->Rotate(aRef1,nAngle,nSin,nCos);
2334 return true;
2337 break;
2340 case SDRATTR_SHEARANGLE:
2342 sal_Int32 nTmp = 0;
2343 if( rValue >>= nTmp )
2345 Degree100 nShear(nTmp);
2346 nShear -= GetSdrObject()->GetShearAngle();
2347 if(nShear)
2349 Point aRef1(GetSdrObject()->GetSnapRect().Center());
2350 double nTan = tan(nShear.get() * F_PI18000);
2351 GetSdrObject()->Shear(aRef1,nShear,nTan,false);
2352 return true;
2356 break;
2359 case OWN_ATTR_INTEROPGRABBAG:
2361 GetSdrObject()->SetGrabBagItem(rValue);
2362 return true;
2365 case SDRATTR_OBJMOVEPROTECT:
2367 bool bMoveProtect;
2368 if( rValue >>= bMoveProtect )
2370 GetSdrObject()->SetMoveProtect(bMoveProtect);
2371 return true;
2373 break;
2375 case SDRATTR_OBJECTNAME:
2377 OUString aName;
2378 if( rValue >>= aName )
2380 GetSdrObject()->SetName( aName );
2381 return true;
2383 break;
2386 case OWN_ATTR_TEXTFITTOSIZESCALE:
2388 sal_Int16 nMaxScale = 0;
2389 if (rValue >>= nMaxScale)
2391 SdrTextFitToSizeTypeItem aItem(GetSdrObject()->GetMergedItem(SDRATTR_TEXT_FITTOSIZE));
2392 aItem.SetMaxScale(nMaxScale);
2393 GetSdrObject()->SetMergedItem(aItem);
2394 return true;
2396 break;
2399 // #i68101#
2400 case OWN_ATTR_MISC_OBJ_TITLE:
2402 OUString aTitle;
2403 if( rValue >>= aTitle )
2405 GetSdrObject()->SetTitle( aTitle );
2406 return true;
2408 break;
2410 case OWN_ATTR_MISC_OBJ_DESCRIPTION:
2412 OUString aDescription;
2413 if( rValue >>= aDescription )
2415 GetSdrObject()->SetDescription( aDescription );
2416 return true;
2418 break;
2421 case SDRATTR_OBJPRINTABLE:
2423 bool bPrintable;
2424 if( rValue >>= bPrintable )
2426 GetSdrObject()->SetPrintable(bPrintable);
2427 return true;
2429 break;
2431 case SDRATTR_OBJVISIBLE:
2433 bool bVisible;
2434 if( rValue >>= bVisible )
2436 GetSdrObject()->SetVisible(bVisible);
2437 return true;
2439 break;
2441 case SDRATTR_OBJSIZEPROTECT:
2443 bool bResizeProtect;
2444 if( rValue >>= bResizeProtect )
2446 GetSdrObject()->SetResizeProtect(bResizeProtect);
2447 return true;
2449 break;
2451 case OWN_ATTR_PAGE_NUMBER:
2453 sal_Int32 nPageNum = 0;
2454 if( (rValue >>= nPageNum) && ( nPageNum >= 0 ) && ( nPageNum <= 0xffff ) )
2456 SdrPageObj* pPageObj = dynamic_cast< SdrPageObj* >(GetSdrObject());
2457 if( pPageObj )
2459 SdrModel& rModel(pPageObj->getSdrModelFromSdrObject());
2460 SdrPage* pNewPage = nullptr;
2461 const sal_uInt16 nDestinationPageNum(static_cast<sal_uInt16>((nPageNum << 1) - 1));
2463 if(nDestinationPageNum < rModel.GetPageCount())
2465 pNewPage = rModel.GetPage(nDestinationPageNum);
2468 pPageObj->SetReferencedPage(pNewPage);
2471 return true;
2473 break;
2475 case XATTR_FILLBITMAP:
2476 case XATTR_FILLGRADIENT:
2477 case XATTR_FILLHATCH:
2478 case XATTR_FILLFLOATTRANSPARENCE:
2479 case XATTR_LINEEND:
2480 case XATTR_LINESTART:
2481 case XATTR_LINEDASH:
2483 if( pProperty->nMemberId == MID_NAME )
2485 OUString aApiName;
2486 if( rValue >>= aApiName )
2488 if( SetFillAttribute( pProperty->nWID, aApiName ) )
2489 return true;
2491 break;
2493 else
2495 return false;
2499 case OWN_ATTR_TEXTCOLUMNS:
2501 if (auto pTextObj = dynamic_cast<SdrTextObj*>(GetSdrObject()))
2503 css::uno::Reference<css::text::XTextColumns> xTextColumns;
2504 if (rValue >>= xTextColumns)
2506 pTextObj->SetTextColumnsNumber(xTextColumns->getColumnCount());
2507 if (css::uno::Reference<css::beans::XPropertySet> xPropSet{ xTextColumns,
2508 css::uno::UNO_QUERY })
2510 auto aVal = xPropSet->getPropertyValue("AutomaticDistance");
2511 if (sal_Int32 nSpacing; aVal >>= nSpacing)
2512 pTextObj->SetTextColumnsSpacing(nSpacing);
2516 return true;
2519 default:
2521 return false;
2525 OUString sExceptionMessage ("IllegalArgumentException in SvxShape::setPropertyValueImpl."
2526 " Property Type: " + pProperty->aType.getTypeName() + " Property nWID: " + OUString::number(pProperty->nWID)
2527 + " Value Type: " + (rValue.hasValue() ? rValue.getValueTypeName() : "void (no value)"));
2529 throw lang::IllegalArgumentException(sExceptionMessage, nullptr, 1);
2533 bool SvxShape::getPropertyValueImpl( const OUString&, const SfxItemPropertyMapEntry* pProperty, css::uno::Any& rValue )
2535 switch( pProperty->nWID )
2537 case OWN_ATTR_CAPTION_POINT:
2539 Point aVclPoint = static_cast<SdrCaptionObj*>(GetSdrObject())->GetTailPos();
2541 // #88491# make pos relative to anchor
2542 if( GetSdrObject()->getSdrModelFromSdrObject().IsWriter() )
2544 aVclPoint -= GetSdrObject()->GetAnchorPos();
2547 // #90763# pos is absolute, make it relative to top left
2548 basegfx::B2DPolyPolygon aNewPolyPolygon;
2549 basegfx::B2DHomMatrix aNewHomogenMatrix;
2550 GetSdrObject()->TRGetBaseGeometry(aNewHomogenMatrix, aNewPolyPolygon);
2552 aVclPoint.AdjustX( -(basegfx::fround(aNewHomogenMatrix.get(0, 2))) );
2553 aVclPoint.AdjustY( -(basegfx::fround(aNewHomogenMatrix.get(1, 2))) );
2555 // tdf#117145 metric of SdrModel is app-specific, metric of UNO API is 100thmm
2556 // Need to adapt aVclPoint from app-specific to 100thmm
2557 ForceMetricTo100th_mm(aVclPoint);
2559 awt::Point aPnt( aVclPoint.X(), aVclPoint.Y() );
2560 rValue <<= aPnt;
2561 break;
2564 case OWN_ATTR_TRANSFORMATION:
2566 basegfx::B2DPolyPolygon aNewPolyPolygon;
2567 basegfx::B2DHomMatrix aNewHomogenMatrix;
2568 GetSdrObject()->TRGetBaseGeometry(aNewHomogenMatrix, aNewPolyPolygon);
2569 drawing::HomogenMatrix3 aMatrix;
2571 // tdf#117145 metric of SdrModel is app-specific, metric of UNO API is 100thmm
2572 // Need to adapt aNewHomogenMatrix from app-specific to 100thmm
2573 ForceMetricTo100th_mm(aNewHomogenMatrix);
2575 aMatrix.Line1.Column1 = aNewHomogenMatrix.get(0, 0);
2576 aMatrix.Line1.Column2 = aNewHomogenMatrix.get(0, 1);
2577 aMatrix.Line1.Column3 = aNewHomogenMatrix.get(0, 2);
2578 aMatrix.Line2.Column1 = aNewHomogenMatrix.get(1, 0);
2579 aMatrix.Line2.Column2 = aNewHomogenMatrix.get(1, 1);
2580 aMatrix.Line2.Column3 = aNewHomogenMatrix.get(1, 2);
2581 aMatrix.Line3.Column1 = aNewHomogenMatrix.get(2, 0);
2582 aMatrix.Line3.Column2 = aNewHomogenMatrix.get(2, 1);
2583 aMatrix.Line3.Column3 = aNewHomogenMatrix.get(2, 2);
2585 rValue <<= aMatrix;
2587 break;
2590 case OWN_ATTR_ZORDER:
2592 rValue <<= static_cast<sal_Int32>(GetSdrObject()->GetOrdNum());
2593 break;
2596 case OWN_ATTR_BITMAP:
2598 rValue = GetBitmap();
2599 if(!rValue.hasValue())
2600 throw uno::RuntimeException();
2602 break;
2605 case OWN_ATTR_ISFONTWORK:
2607 bool bIsFontwork = false;
2608 if (const SdrTextObj* pTextObj = dynamic_cast<const SdrTextObj*>(GetSdrObject()))
2609 bIsFontwork = pTextObj->IsFontwork();
2610 rValue <<= bIsFontwork;
2611 break;
2614 case OWN_ATTR_FRAMERECT:
2616 tools::Rectangle aRect( GetSdrObject()->GetSnapRect() );
2617 Point aTopLeft( aRect.TopLeft() );
2618 Size aObjSize( aRect.GetWidth(), aRect.GetHeight() );
2619 ForceMetricTo100th_mm(aTopLeft);
2620 ForceMetricTo100th_mm(aObjSize);
2621 css::awt::Rectangle aUnoRect(
2622 aTopLeft.X(), aTopLeft.Y(),
2623 aObjSize.getWidth(), aObjSize.getHeight() );
2624 rValue <<= aUnoRect;
2625 break;
2628 case OWN_ATTR_BOUNDRECT:
2630 tools::Rectangle aRect( GetSdrObject()->GetCurrentBoundRect() );
2631 Point aTopLeft( aRect.TopLeft() );
2632 Size aObjSize( aRect.GetWidth(), aRect.GetHeight() );
2633 ForceMetricTo100th_mm(aTopLeft);
2634 ForceMetricTo100th_mm(aObjSize);
2635 css::awt::Rectangle aUnoRect(
2636 aTopLeft.X(), aTopLeft.Y(),
2637 aObjSize.getWidth(), aObjSize.getHeight() );
2638 rValue <<= aUnoRect;
2639 break;
2642 case OWN_ATTR_LDNAME:
2644 OUString aName( GetSdrObject()->GetName() );
2645 rValue <<= aName;
2646 break;
2649 case OWN_ATTR_LDBITMAP:
2651 OUString sId;
2652 if( GetSdrObject()->GetObjInventor() == SdrInventor::Default && GetSdrObject()->GetObjIdentifier() == OBJ_OLE2 )
2654 sId = RID_UNODRAW_OLE2;
2656 else if( GetSdrObject()->GetObjInventor() == SdrInventor::Default && GetSdrObject()->GetObjIdentifier() == OBJ_GRAF )
2658 sId = RID_UNODRAW_GRAPHICS;
2660 else
2662 sId = RID_UNODRAW_OBJECTS;
2665 BitmapEx aBmp(sId);
2666 Reference<awt::XBitmap> xBmp(VCLUnoHelper::CreateBitmap(aBmp));
2668 rValue <<= xBmp;
2669 break;
2672 case OWN_ATTR_MIRRORED:
2674 bool bMirror = false;
2675 if( HasSdrObject() && dynamic_cast<const SdrGrafObj*>(GetSdrObject()) != nullptr )
2676 bMirror = static_cast<SdrGrafObj*>(GetSdrObject())->IsMirrored();
2678 rValue <<= bMirror;
2679 break;
2682 case OWN_ATTR_EDGE_START_OBJ:
2683 case OWN_ATTR_EDGE_START_POS:
2684 case OWN_ATTR_EDGE_END_POS:
2685 case OWN_ATTR_EDGE_END_OBJ:
2686 case OWN_ATTR_GLUEID_HEAD:
2687 case OWN_ATTR_GLUEID_TAIL:
2688 case OWN_ATTR_EDGE_POLYPOLYGONBEZIER:
2690 SdrEdgeObj* pEdgeObj = dynamic_cast<SdrEdgeObj*>(GetSdrObject());
2691 if(pEdgeObj)
2693 switch(pProperty->nWID)
2695 case OWN_ATTR_EDGE_START_OBJ:
2696 case OWN_ATTR_EDGE_END_OBJ:
2698 SdrObject* pNode = pEdgeObj->GetConnectedNode(pProperty->nWID == OWN_ATTR_EDGE_START_OBJ);
2699 if(pNode)
2701 Reference< drawing::XShape > xShape( GetXShapeForSdrObject( pNode ) );
2702 if(xShape.is())
2703 rValue <<= xShape;
2706 break;
2709 case OWN_ATTR_EDGE_START_POS:
2710 case OWN_ATTR_EDGE_END_POS:
2712 Point aPoint( pEdgeObj->GetTailPoint( pProperty->nWID == OWN_ATTR_EDGE_START_POS ) );
2713 if( GetSdrObject()->getSdrModelFromSdrObject().IsWriter() )
2714 aPoint -= GetSdrObject()->GetAnchorPos();
2716 ForceMetricTo100th_mm( aPoint );
2717 awt::Point aUnoPoint( aPoint.X(), aPoint.Y() );
2719 rValue <<= aUnoPoint;
2720 break;
2722 case OWN_ATTR_GLUEID_HEAD:
2723 case OWN_ATTR_GLUEID_TAIL:
2725 rValue <<= pEdgeObj->getGluePointIndex( pProperty->nWID == OWN_ATTR_GLUEID_HEAD );
2726 break;
2728 case OWN_ATTR_EDGE_POLYPOLYGONBEZIER:
2730 basegfx::B2DPolyPolygon aPolyPoly( pEdgeObj->GetEdgeTrackPath() );
2731 if( GetSdrObject()->getSdrModelFromSdrObject().IsWriter() )
2733 Point aPoint( GetSdrObject()->GetAnchorPos() );
2734 aPolyPoly.transform(basegfx::utils::createTranslateB2DHomMatrix(-aPoint.X(), -aPoint.Y()));
2736 // Reintroduction of fix for issue #i59051# (#i108851#)
2737 ForceMetricTo100th_mm( aPolyPoly );
2738 drawing::PolyPolygonBezierCoords aRetval;
2739 basegfx::utils::B2DPolyPolygonToUnoPolyPolygonBezierCoords( aPolyPoly, aRetval);
2740 rValue <<= aRetval;
2741 break;
2745 break;
2748 case OWN_ATTR_MEASURE_START_POS:
2749 case OWN_ATTR_MEASURE_END_POS:
2751 SdrMeasureObj* pMeasureObj = dynamic_cast<SdrMeasureObj*>(GetSdrObject());
2752 if(pMeasureObj)
2754 Point aPoint( pMeasureObj->GetPoint( pProperty->nWID == OWN_ATTR_MEASURE_START_POS ? 0 : 1 ) );
2755 if( GetSdrObject()->getSdrModelFromSdrObject().IsWriter() )
2756 aPoint -= GetSdrObject()->GetAnchorPos();
2758 // Reintroduction of fix for issue #i59051# (#i108851#)
2759 ForceMetricTo100th_mm( aPoint );
2760 awt::Point aUnoPoint( aPoint.X(), aPoint.Y() );
2762 rValue <<= aUnoPoint;
2763 break;
2765 break;
2768 case OWN_ATTR_FILLBMP_MODE:
2770 const SfxItemSet& rObjItemSet = GetSdrObject()->GetMergedItemSet();
2772 if (rObjItemSet.Get(XATTR_FILLBMP_TILE).GetValue())
2774 rValue <<= drawing::BitmapMode_REPEAT;
2776 else if (rObjItemSet.Get(XATTR_FILLBMP_STRETCH).GetValue())
2778 rValue <<= drawing::BitmapMode_STRETCH;
2780 else
2782 rValue <<= drawing::BitmapMode_NO_REPEAT;
2784 break;
2786 case SDRATTR_LAYERID:
2787 rValue <<= sal_uInt16(sal_uInt8(GetSdrObject()->GetLayer()));
2788 break;
2790 case SDRATTR_LAYERNAME:
2792 SdrLayer* pLayer = GetSdrObject()->getSdrModelFromSdrObject().GetLayerAdmin().GetLayerPerID(GetSdrObject()->GetLayer());
2793 if( pLayer )
2795 rValue <<= pLayer->GetName();
2797 break;
2800 case SDRATTR_ROTATEANGLE:
2801 rValue <<= static_cast<sal_Int32>(GetSdrObject()->GetRotateAngle());
2802 break;
2804 case SDRATTR_SHEARANGLE:
2805 rValue <<= static_cast<sal_Int32>(GetSdrObject()->GetShearAngle());
2806 break;
2808 case OWN_ATTR_INTEROPGRABBAG:
2810 GetSdrObject()->GetGrabBagItem(rValue);
2811 break;
2814 case SDRATTR_OBJMOVEPROTECT:
2815 rValue <<= GetSdrObject()->IsMoveProtect();
2816 break;
2818 case SDRATTR_OBJECTNAME:
2820 OUString aName( GetSdrObject()->GetName() );
2821 rValue <<= aName;
2822 break;
2825 // #i68101#
2826 case OWN_ATTR_MISC_OBJ_TITLE:
2828 OUString aTitle( GetSdrObject()->GetTitle() );
2829 rValue <<= aTitle;
2830 break;
2833 case OWN_ATTR_MISC_OBJ_DESCRIPTION:
2835 OUString aDescription( GetSdrObject()->GetDescription() );
2836 rValue <<= aDescription;
2837 break;
2840 case SDRATTR_OBJPRINTABLE:
2841 rValue <<= GetSdrObject()->IsPrintable();
2842 break;
2844 case SDRATTR_OBJVISIBLE:
2845 rValue <<= GetSdrObject()->IsVisible();
2846 break;
2848 case SDRATTR_OBJSIZEPROTECT:
2849 rValue <<= GetSdrObject()->IsResizeProtect();
2850 break;
2852 case OWN_ATTR_PAGE_NUMBER:
2854 SdrPageObj* pPageObj = dynamic_cast<SdrPageObj*>(GetSdrObject());
2855 if(pPageObj)
2857 SdrPage* pPage = pPageObj->GetReferencedPage();
2858 sal_Int32 nPageNumber = pPage ? pPage->GetPageNum() : 0;
2859 nPageNumber++;
2860 nPageNumber >>= 1;
2861 rValue <<= nPageNumber;
2863 break;
2866 case OWN_ATTR_UINAME_SINGULAR:
2868 rValue <<= GetSdrObject()->TakeObjNameSingul();
2869 break;
2872 case OWN_ATTR_TEXTFITTOSIZESCALE:
2874 rValue <<= GetTextFitToSizeScale(GetSdrObject());
2875 break;
2878 case OWN_ATTR_UINAME_PLURAL:
2880 rValue <<= GetSdrObject()->TakeObjNamePlural();
2881 break;
2883 case OWN_ATTR_METAFILE:
2885 SdrOle2Obj* pObj = dynamic_cast<SdrOle2Obj*>(GetSdrObject());
2886 if( pObj )
2888 const Graphic* pGraphic = pObj->GetGraphic();
2889 if( pGraphic )
2891 bool bIsWMF = false;
2892 if ( pGraphic->IsGfxLink() )
2894 GfxLink aLnk = pGraphic->GetGfxLink();
2895 if ( aLnk.GetType() == GfxLinkType::NativeWmf )
2897 bIsWMF = true;
2898 uno::Sequence<sal_Int8> aSeq(reinterpret_cast<sal_Int8 const *>(aLnk.GetData()), static_cast<sal_Int32>(aLnk.GetDataSize()));
2899 rValue <<= aSeq;
2902 if ( !bIsWMF )
2904 // #119735# just use GetGDIMetaFile, it will create a buffered version of contained bitmap now automatically
2905 GDIMetaFile aMtf(pObj->GetGraphic()->GetGDIMetaFile());
2906 SvMemoryStream aDestStrm( 65535, 65535 );
2907 ConvertGDIMetaFileToWMF( aMtf, aDestStrm, nullptr, false );
2908 const uno::Sequence<sal_Int8> aSeq(
2909 static_cast< const sal_Int8* >(aDestStrm.GetData()),
2910 aDestStrm.GetEndOfData());
2911 rValue <<= aSeq;
2915 else
2917 rValue = GetBitmap( true );
2919 break;
2922 case OWN_ATTR_TEXTCOLUMNS:
2924 if (auto pTextObj = dynamic_cast<const SdrTextObj*>(GetSdrObject()))
2926 if (pTextObj->HasTextColumnsNumber() || pTextObj->HasTextColumnsSpacing())
2928 auto xIf = SvxXTextColumns_createInstance();
2929 css::uno::Reference<css::text::XTextColumns> xCols(xIf, css::uno::UNO_QUERY_THROW);
2930 xCols->setColumnCount(pTextObj->GetTextColumnsNumber());
2931 css::uno::Reference<css::beans::XPropertySet> xProp(xIf, css::uno::UNO_QUERY_THROW);
2932 xProp->setPropertyValue("AutomaticDistance",
2933 css::uno::Any(pTextObj->GetTextColumnsSpacing()));
2934 rValue <<= xIf;
2937 break;
2940 default:
2941 return false;
2943 return true;
2947 bool SvxShape::getPropertyStateImpl( const SfxItemPropertyMapEntry* pProperty, css::beans::PropertyState& rState )
2949 if( pProperty->nWID == OWN_ATTR_FILLBMP_MODE )
2951 const SfxItemSet& rSet = GetSdrObject()->GetMergedItemSet();
2953 if( rSet.GetItemState( XATTR_FILLBMP_STRETCH, false ) == SfxItemState::SET ||
2954 rSet.GetItemState( XATTR_FILLBMP_TILE, false ) == SfxItemState::SET )
2956 rState = beans::PropertyState_DIRECT_VALUE;
2958 else
2960 rState = beans::PropertyState_AMBIGUOUS_VALUE;
2963 else if((( pProperty->nWID >= OWN_ATTR_VALUE_START && pProperty->nWID <= OWN_ATTR_VALUE_END ) ||
2964 ( pProperty->nWID >= SDRATTR_NOTPERSIST_FIRST && pProperty->nWID <= SDRATTR_NOTPERSIST_LAST )) && ( pProperty->nWID != SDRATTR_TEXTDIRECTION ) )
2966 rState = beans::PropertyState_DIRECT_VALUE;
2968 else
2970 return false;
2973 return true;
2977 bool SvxShape::setPropertyToDefaultImpl( const SfxItemPropertyMapEntry* pProperty )
2979 if( pProperty->nWID == OWN_ATTR_FILLBMP_MODE )
2981 GetSdrObject()->ClearMergedItem( XATTR_FILLBMP_STRETCH );
2982 GetSdrObject()->ClearMergedItem( XATTR_FILLBMP_TILE );
2983 return true;
2985 else if((pProperty->nWID >= OWN_ATTR_VALUE_START && pProperty->nWID <= OWN_ATTR_VALUE_END ) ||
2986 ( pProperty->nWID >= SDRATTR_NOTPERSIST_FIRST && pProperty->nWID <= SDRATTR_NOTPERSIST_LAST ))
2988 return true;
2990 else
2992 return false;
2997 uno::Sequence< beans::PropertyState > SAL_CALL SvxShape::getPropertyStates( const uno::Sequence< OUString >& aPropertyName )
2999 const sal_Int32 nCount = aPropertyName.getLength();
3000 uno::Sequence< beans::PropertyState > aRet( nCount );
3002 std::transform(aPropertyName.begin(), aPropertyName.end(), aRet.begin(),
3003 [this](const OUString& rName) -> beans::PropertyState { return getPropertyState(rName); });
3005 return aRet;
3009 void SAL_CALL SvxShape::setPropertyToDefault( const OUString& PropertyName )
3011 if( mpImpl->mpMaster )
3013 mpImpl->mpMaster->setPropertyToDefault( PropertyName );
3015 else
3017 _setPropertyToDefault( PropertyName );
3021 void SvxShape::_setPropertyToDefault( const OUString& PropertyName )
3023 ::SolarMutexGuard aGuard;
3025 const SfxItemPropertyMapEntry* pProperty = mpPropSet->getPropertyMapEntry(PropertyName);
3027 if( !HasSdrObject() || pProperty == nullptr )
3028 throw beans::UnknownPropertyException( PropertyName, static_cast<cppu::OWeakObject*>(this));
3030 if( !setPropertyToDefaultImpl( pProperty ) )
3032 GetSdrObject()->ClearMergedItem( pProperty->nWID );
3035 GetSdrObject()->getSdrModelFromSdrObject().SetChanged();
3039 uno::Any SAL_CALL SvxShape::getPropertyDefault( const OUString& aPropertyName )
3041 if( mpImpl->mpMaster )
3043 return mpImpl->mpMaster->getPropertyDefault( aPropertyName );
3045 else
3047 return _getPropertyDefault( aPropertyName );
3051 uno::Any SvxShape::_getPropertyDefault( const OUString& aPropertyName )
3053 ::SolarMutexGuard aGuard;
3055 const SfxItemPropertyMapEntry* pMap = mpPropSet->getPropertyMapEntry(aPropertyName);
3057 if( !HasSdrObject() || pMap == nullptr )
3058 throw beans::UnknownPropertyException( aPropertyName, static_cast<cppu::OWeakObject*>(this));
3060 if(( pMap->nWID >= OWN_ATTR_VALUE_START && pMap->nWID <= OWN_ATTR_VALUE_END ) ||
3061 ( pMap->nWID >= SDRATTR_NOTPERSIST_FIRST && pMap->nWID <= SDRATTR_NOTPERSIST_LAST ))
3063 return getPropertyValue( aPropertyName );
3066 // get default from ItemPool
3067 if(!SfxItemPool::IsWhich(pMap->nWID))
3068 throw beans::UnknownPropertyException( "No WhichID " + OUString::number(pMap->nWID) + " for " + aPropertyName, static_cast<cppu::OWeakObject*>(this));
3070 SfxItemSet aSet( GetSdrObject()->getSdrModelFromSdrObject().GetItemPool(), {{pMap->nWID, pMap->nWID}});
3071 aSet.Put(GetSdrObject()->getSdrModelFromSdrObject().GetItemPool().GetDefaultItem(pMap->nWID));
3073 return GetAnyForItem( aSet, pMap );
3076 // XMultiPropertyStates
3077 void SvxShape::setAllPropertiesToDefault()
3079 ::SolarMutexGuard aGuard;
3081 if( !HasSdrObject() )
3082 throw lang::DisposedException();
3083 GetSdrObject()->ClearMergedItem(); // nWhich == 0 => all
3085 if(dynamic_cast<const SdrGrafObj*>(GetSdrObject()) != nullptr)
3087 // defaults for graphic objects have changed:
3088 GetSdrObject()->SetMergedItem( XFillStyleItem( drawing::FillStyle_NONE ) );
3089 GetSdrObject()->SetMergedItem( XLineStyleItem( drawing::LineStyle_NONE ) );
3092 // #i68523# special handling for Svx3DCharacterModeItem, this is not saved
3093 // but needs to be sal_True in svx, pool default (false) in sch. Since sch
3094 // does not load lathe or extrude objects, it is possible to set the items
3095 // here.
3096 // For other solution possibilities, see task description.
3097 if( dynamic_cast<const E3dLatheObj* >(GetSdrObject()) != nullptr|| dynamic_cast<const E3dExtrudeObj* >(GetSdrObject()) != nullptr)
3099 GetSdrObject()->SetMergedItem(Svx3DCharacterModeItem(true));
3102 GetSdrObject()->getSdrModelFromSdrObject().SetChanged();
3105 void SvxShape::setPropertiesToDefault(
3106 const uno::Sequence<OUString>& aPropertyNames )
3108 for ( const auto& rPropertyName : aPropertyNames )
3109 setPropertyToDefault( rPropertyName );
3112 uno::Sequence<uno::Any> SvxShape::getPropertyDefaults(
3113 const uno::Sequence<OUString>& aPropertyNames )
3115 ::std::vector<uno::Any> ret;
3116 ret.reserve(aPropertyNames.getLength());
3117 std::transform(aPropertyNames.begin(), aPropertyNames.end(), std::back_inserter(ret),
3118 [this](const OUString& rName) -> uno::Any { return getPropertyDefault(rName); });
3119 return uno::Sequence<uno::Any>( ret.data(), ret.size() );
3123 // XServiceInfo
3125 OUString SAL_CALL SvxShape::getImplementationName()
3127 return "SvxShape";
3130 constexpr OUStringLiteral sUNO_service_style_ParagraphProperties = u"com.sun.star.style.ParagraphProperties";
3131 constexpr OUStringLiteral sUNO_service_style_ParagraphPropertiesComplex = u"com.sun.star.style.ParagraphPropertiesComplex";
3132 constexpr OUStringLiteral sUNO_service_style_ParagraphPropertiesAsian = u"com.sun.star.style.ParagraphPropertiesAsian";
3133 constexpr OUStringLiteral sUNO_service_style_CharacterProperties = u"com.sun.star.style.CharacterProperties";
3134 constexpr OUStringLiteral sUNO_service_style_CharacterPropertiesComplex = u"com.sun.star.style.CharacterPropertiesComplex";
3135 constexpr OUStringLiteral sUNO_service_style_CharacterPropertiesAsian = u"com.sun.star.style.CharacterPropertiesAsian";
3137 constexpr OUStringLiteral sUNO_service_drawing_FillProperties = u"com.sun.star.drawing.FillProperties";
3138 constexpr OUStringLiteral sUNO_service_drawing_TextProperties = u"com.sun.star.drawing.TextProperties";
3139 constexpr OUStringLiteral sUNO_service_drawing_LineProperties = u"com.sun.star.drawing.LineProperties";
3140 constexpr OUStringLiteral sUNO_service_drawing_ConnectorProperties = u"com.sun.star.drawing.ConnectorProperties";
3141 constexpr OUStringLiteral sUNO_service_drawing_MeasureProperties = u"com.sun.star.drawing.MeasureProperties";
3142 constexpr OUStringLiteral sUNO_service_drawing_ShadowProperties = u"com.sun.star.drawing.ShadowProperties";
3144 constexpr OUStringLiteral sUNO_service_drawing_RotationDescriptor = u"com.sun.star.drawing.RotationDescriptor";
3146 constexpr OUStringLiteral sUNO_service_drawing_Text = u"com.sun.star.drawing.Text";
3147 constexpr OUStringLiteral sUNO_service_drawing_GroupShape = u"com.sun.star.drawing.GroupShape";
3149 constexpr OUStringLiteral sUNO_service_drawing_CustomShapeProperties = u"com.sun.star.drawing.CustomShapeProperties";
3150 constexpr OUStringLiteral sUNO_service_drawing_CustomShape = u"com.sun.star.drawing.CustomShape";
3152 constexpr OUStringLiteral sUNO_service_drawing_PolyPolygonDescriptor = u"com.sun.star.drawing.PolyPolygonDescriptor";
3153 constexpr OUStringLiteral sUNO_service_drawing_PolyPolygonBezierDescriptor= u"com.sun.star.drawing.PolyPolygonBezierDescriptor";
3155 constexpr OUStringLiteral sUNO_service_drawing_LineShape = u"com.sun.star.drawing.LineShape";
3156 constexpr OUStringLiteral sUNO_service_drawing_Shape = u"com.sun.star.drawing.Shape";
3157 constexpr OUStringLiteral sUNO_service_drawing_RectangleShape = u"com.sun.star.drawing.RectangleShape";
3158 constexpr OUStringLiteral sUNO_service_drawing_EllipseShape = u"com.sun.star.drawing.EllipseShape";
3159 constexpr OUStringLiteral sUNO_service_drawing_PolyPolygonShape = u"com.sun.star.drawing.PolyPolygonShape";
3160 constexpr OUStringLiteral sUNO_service_drawing_PolyLineShape = u"com.sun.star.drawing.PolyLineShape";
3161 constexpr OUStringLiteral sUNO_service_drawing_OpenBezierShape = u"com.sun.star.drawing.OpenBezierShape";
3162 constexpr OUStringLiteral sUNO_service_drawing_ClosedBezierShape = u"com.sun.star.drawing.ClosedBezierShape";
3163 constexpr OUStringLiteral sUNO_service_drawing_TextShape = u"com.sun.star.drawing.TextShape";
3164 constexpr OUStringLiteral sUNO_service_drawing_GraphicObjectShape = u"com.sun.star.drawing.GraphicObjectShape";
3165 constexpr OUStringLiteral sUNO_service_drawing_OLE2Shape = u"com.sun.star.drawing.OLE2Shape";
3166 constexpr OUStringLiteral sUNO_service_drawing_PageShape = u"com.sun.star.drawing.PageShape";
3167 constexpr OUStringLiteral sUNO_service_drawing_CaptionShape = u"com.sun.star.drawing.CaptionShape";
3168 constexpr OUStringLiteral sUNO_service_drawing_MeasureShape = u"com.sun.star.drawing.MeasureShape";
3169 constexpr OUStringLiteral sUNO_service_drawing_FrameShape = u"com.sun.star.drawing.FrameShape";
3170 constexpr OUStringLiteral sUNO_service_drawing_ControlShape = u"com.sun.star.drawing.ControlShape";
3171 constexpr OUStringLiteral sUNO_service_drawing_ConnectorShape = u"com.sun.star.drawing.ConnectorShape";
3172 constexpr OUStringLiteral sUNO_service_drawing_MediaShape = u"com.sun.star.drawing.MediaShape";
3175 uno::Sequence< OUString > SAL_CALL SvxShape::getSupportedServiceNames()
3177 if( mpImpl->mpMaster )
3179 return mpImpl->mpMaster->getSupportedServiceNames();
3181 else
3183 return _getSupportedServiceNames();
3187 uno::Sequence< OUString > SvxShape::_getSupportedServiceNames()
3189 ::SolarMutexGuard aGuard;
3191 if( HasSdrObject() && GetSdrObject()->GetObjInventor() == SdrInventor::Default)
3193 const sal_uInt16 nIdent = GetSdrObject()->GetObjIdentifier();
3195 switch(nIdent)
3197 case OBJ_GRUP:
3199 static const uno::Sequence<OUString> aSvxShape_GroupServices
3200 = { sUNO_service_drawing_GroupShape,
3201 sUNO_service_drawing_Shape };
3202 return aSvxShape_GroupServices;
3204 case OBJ_CUSTOMSHAPE:
3206 static const uno::Sequence<OUString> aSvxShape_CustomShapeServices
3207 = { sUNO_service_drawing_CustomShape,
3208 sUNO_service_drawing_Shape,
3209 sUNO_service_drawing_CustomShapeProperties,
3210 sUNO_service_drawing_FillProperties,
3211 sUNO_service_drawing_LineProperties,
3212 sUNO_service_drawing_Text,
3213 sUNO_service_drawing_TextProperties,
3214 sUNO_service_style_ParagraphProperties,
3215 sUNO_service_style_ParagraphPropertiesComplex,
3216 sUNO_service_style_ParagraphPropertiesAsian,
3217 sUNO_service_style_CharacterProperties,
3218 sUNO_service_style_CharacterPropertiesComplex,
3219 sUNO_service_style_CharacterPropertiesAsian,
3220 sUNO_service_drawing_ShadowProperties,
3221 sUNO_service_drawing_RotationDescriptor };
3222 return aSvxShape_CustomShapeServices;
3224 case OBJ_LINE:
3226 static const uno::Sequence<OUString> aSvxShape_LineServices
3227 = { sUNO_service_drawing_LineShape,
3229 sUNO_service_drawing_Shape,
3230 sUNO_service_drawing_LineProperties,
3232 sUNO_service_drawing_Text,
3233 sUNO_service_drawing_TextProperties,
3234 sUNO_service_style_ParagraphProperties,
3235 sUNO_service_style_ParagraphPropertiesComplex,
3236 sUNO_service_style_ParagraphPropertiesAsian,
3237 sUNO_service_style_CharacterProperties,
3238 sUNO_service_style_CharacterPropertiesComplex,
3239 sUNO_service_style_CharacterPropertiesAsian,
3241 sUNO_service_drawing_PolyPolygonDescriptor,
3242 sUNO_service_drawing_ShadowProperties,
3243 sUNO_service_drawing_RotationDescriptor };
3244 return aSvxShape_LineServices;
3247 case OBJ_RECT:
3249 static const uno::Sequence<OUString> aSvxShape_RectServices
3250 = { sUNO_service_drawing_RectangleShape,
3252 sUNO_service_drawing_Shape,
3253 sUNO_service_drawing_FillProperties,
3254 sUNO_service_drawing_LineProperties,
3255 sUNO_service_drawing_Text,
3256 sUNO_service_drawing_TextProperties,
3257 sUNO_service_style_ParagraphProperties,
3258 sUNO_service_style_ParagraphPropertiesComplex,
3259 sUNO_service_style_ParagraphPropertiesAsian,
3260 sUNO_service_style_CharacterProperties,
3261 sUNO_service_style_CharacterPropertiesComplex,
3262 sUNO_service_style_CharacterPropertiesAsian,
3264 sUNO_service_drawing_ShadowProperties,
3265 sUNO_service_drawing_RotationDescriptor };
3266 return aSvxShape_RectServices;
3269 case OBJ_CIRC:
3270 case OBJ_SECT:
3271 case OBJ_CARC:
3272 case OBJ_CCUT:
3274 static const uno::Sequence<OUString> aSvxShape_CircServices
3275 = { sUNO_service_drawing_EllipseShape,
3277 sUNO_service_drawing_Shape,
3278 sUNO_service_drawing_FillProperties,
3279 sUNO_service_drawing_LineProperties,
3281 sUNO_service_drawing_Text,
3282 sUNO_service_drawing_TextProperties,
3283 sUNO_service_style_ParagraphProperties,
3284 sUNO_service_style_ParagraphPropertiesComplex,
3285 sUNO_service_style_ParagraphPropertiesAsian,
3286 sUNO_service_style_CharacterProperties,
3287 sUNO_service_style_CharacterPropertiesComplex,
3288 sUNO_service_style_CharacterPropertiesAsian,
3290 sUNO_service_drawing_ShadowProperties,
3291 sUNO_service_drawing_RotationDescriptor };
3292 return aSvxShape_CircServices;
3295 case OBJ_PATHPLIN:
3296 case OBJ_PLIN:
3298 static const uno::Sequence<OUString> aSvxShape_PathServices
3299 = { sUNO_service_drawing_PolyLineShape,
3301 sUNO_service_drawing_Shape,
3302 sUNO_service_drawing_LineProperties,
3304 sUNO_service_drawing_PolyPolygonDescriptor,
3306 sUNO_service_drawing_Text,
3307 sUNO_service_drawing_TextProperties,
3308 sUNO_service_style_ParagraphProperties,
3309 sUNO_service_style_ParagraphPropertiesComplex,
3310 sUNO_service_style_ParagraphPropertiesAsian,
3311 sUNO_service_style_CharacterProperties,
3312 sUNO_service_style_CharacterPropertiesComplex,
3313 sUNO_service_style_CharacterPropertiesAsian,
3315 sUNO_service_drawing_ShadowProperties,
3316 sUNO_service_drawing_RotationDescriptor };
3317 return aSvxShape_PathServices;
3320 case OBJ_PATHPOLY:
3321 case OBJ_POLY:
3323 static const uno::Sequence<OUString> aSvxShape_PolyServices
3324 = { sUNO_service_drawing_PolyPolygonShape,
3326 sUNO_service_drawing_Shape,
3327 sUNO_service_drawing_LineProperties,
3328 sUNO_service_drawing_FillProperties,
3330 sUNO_service_drawing_PolyPolygonDescriptor,
3332 sUNO_service_drawing_Text,
3333 sUNO_service_drawing_TextProperties,
3334 sUNO_service_style_ParagraphProperties,
3335 sUNO_service_style_ParagraphPropertiesComplex,
3336 sUNO_service_style_ParagraphPropertiesAsian,
3337 sUNO_service_style_CharacterProperties,
3338 sUNO_service_style_CharacterPropertiesComplex,
3339 sUNO_service_style_CharacterPropertiesAsian,
3341 sUNO_service_drawing_ShadowProperties,
3342 sUNO_service_drawing_RotationDescriptor };
3343 return aSvxShape_PolyServices;
3346 case OBJ_FREELINE:
3347 case OBJ_PATHLINE:
3349 static const uno::Sequence<OUString> aSvxShape_FreeLineServices
3350 = { sUNO_service_drawing_OpenBezierShape,
3352 sUNO_service_drawing_Shape,
3353 sUNO_service_drawing_LineProperties,
3354 sUNO_service_drawing_FillProperties,
3356 sUNO_service_drawing_PolyPolygonBezierDescriptor,
3358 sUNO_service_drawing_Text,
3359 sUNO_service_drawing_TextProperties,
3360 sUNO_service_style_ParagraphProperties,
3361 sUNO_service_style_ParagraphPropertiesComplex,
3362 sUNO_service_style_ParagraphPropertiesAsian,
3363 sUNO_service_style_CharacterProperties,
3364 sUNO_service_style_CharacterPropertiesComplex,
3365 sUNO_service_style_CharacterPropertiesAsian,
3367 sUNO_service_drawing_ShadowProperties,
3368 sUNO_service_drawing_RotationDescriptor };
3369 return aSvxShape_FreeLineServices;
3372 case OBJ_FREEFILL:
3373 case OBJ_PATHFILL:
3375 static const uno::Sequence<OUString> aSvxShape_FreeFillServices
3376 = { sUNO_service_drawing_ClosedBezierShape,
3378 sUNO_service_drawing_Shape,
3379 sUNO_service_drawing_LineProperties,
3380 sUNO_service_drawing_FillProperties,
3382 sUNO_service_drawing_PolyPolygonBezierDescriptor,
3384 sUNO_service_drawing_Text,
3385 sUNO_service_drawing_TextProperties,
3386 sUNO_service_style_ParagraphProperties,
3387 sUNO_service_style_ParagraphPropertiesComplex,
3388 sUNO_service_style_ParagraphPropertiesAsian,
3389 sUNO_service_style_CharacterProperties,
3390 sUNO_service_style_CharacterPropertiesComplex,
3391 sUNO_service_style_CharacterPropertiesAsian,
3393 sUNO_service_drawing_ShadowProperties,
3394 sUNO_service_drawing_RotationDescriptor };
3395 return aSvxShape_FreeFillServices;
3398 case OBJ_OUTLINETEXT:
3399 case OBJ_TITLETEXT:
3400 case OBJ_TEXT:
3402 static const uno::Sequence<OUString> aSvxShape_TextServices
3403 = { sUNO_service_drawing_TextShape,
3405 sUNO_service_drawing_Shape,
3406 sUNO_service_drawing_FillProperties,
3407 sUNO_service_drawing_LineProperties,
3409 sUNO_service_drawing_Text,
3410 sUNO_service_drawing_TextProperties,
3411 sUNO_service_style_ParagraphProperties,
3412 sUNO_service_style_ParagraphPropertiesComplex,
3413 sUNO_service_style_ParagraphPropertiesAsian,
3414 sUNO_service_style_CharacterProperties,
3415 sUNO_service_style_CharacterPropertiesComplex,
3416 sUNO_service_style_CharacterPropertiesAsian,
3418 sUNO_service_drawing_ShadowProperties,
3419 sUNO_service_drawing_RotationDescriptor };
3420 return aSvxShape_TextServices;
3423 case OBJ_GRAF:
3425 static const uno::Sequence<OUString> aSvxShape_GrafServices
3426 = { sUNO_service_drawing_GraphicObjectShape,
3428 sUNO_service_drawing_Shape,
3430 sUNO_service_drawing_Text,
3431 sUNO_service_drawing_TextProperties,
3432 sUNO_service_style_ParagraphProperties,
3433 sUNO_service_style_ParagraphPropertiesComplex,
3434 sUNO_service_style_ParagraphPropertiesAsian,
3435 sUNO_service_style_CharacterProperties,
3436 sUNO_service_style_CharacterPropertiesComplex,
3437 sUNO_service_style_CharacterPropertiesAsian,
3439 sUNO_service_drawing_ShadowProperties,
3440 sUNO_service_drawing_RotationDescriptor};
3441 return aSvxShape_GrafServices;
3444 case OBJ_OLE2:
3446 static const uno::Sequence<OUString> aSvxShape_Ole2Services
3447 = { sUNO_service_drawing_OLE2Shape,
3448 sUNO_service_drawing_Shape,
3450 // #i118485# Added Text, Shadow and Rotation
3451 sUNO_service_drawing_Text,
3452 sUNO_service_drawing_TextProperties,
3453 sUNO_service_style_ParagraphProperties,
3454 sUNO_service_style_ParagraphPropertiesComplex,
3455 sUNO_service_style_ParagraphPropertiesAsian,
3456 sUNO_service_style_CharacterProperties,
3457 sUNO_service_style_CharacterPropertiesComplex,
3458 sUNO_service_style_CharacterPropertiesAsian,
3460 sUNO_service_drawing_ShadowProperties,
3461 sUNO_service_drawing_RotationDescriptor };
3462 return aSvxShape_Ole2Services;
3465 case OBJ_CAPTION:
3467 static const uno::Sequence<OUString> aSvxShape_CaptionServices
3468 = { sUNO_service_drawing_CaptionShape,
3470 sUNO_service_drawing_Shape,
3471 sUNO_service_drawing_FillProperties,
3472 sUNO_service_drawing_LineProperties,
3474 sUNO_service_drawing_Text,
3475 sUNO_service_drawing_TextProperties,
3476 sUNO_service_style_ParagraphProperties,
3477 sUNO_service_style_ParagraphPropertiesComplex,
3478 sUNO_service_style_ParagraphPropertiesAsian,
3479 sUNO_service_style_CharacterProperties,
3480 sUNO_service_style_CharacterPropertiesComplex,
3481 sUNO_service_style_CharacterPropertiesAsian,
3483 sUNO_service_drawing_ShadowProperties,
3484 sUNO_service_drawing_RotationDescriptor };
3485 return aSvxShape_CaptionServices;
3488 case OBJ_PAGE:
3490 static const uno::Sequence<OUString> aSvxShape_PageServices
3491 = { sUNO_service_drawing_PageShape,
3492 sUNO_service_drawing_Shape };
3493 return aSvxShape_PageServices;
3496 case OBJ_MEASURE:
3498 static const uno::Sequence<OUString> aSvxShape_MeasureServices
3499 = { sUNO_service_drawing_MeasureShape,
3501 sUNO_service_drawing_MeasureProperties,
3503 sUNO_service_drawing_Shape,
3504 sUNO_service_drawing_LineProperties,
3506 sUNO_service_drawing_Text,
3507 sUNO_service_drawing_TextProperties,
3508 sUNO_service_style_ParagraphProperties,
3509 sUNO_service_style_ParagraphPropertiesComplex,
3510 sUNO_service_style_ParagraphPropertiesAsian,
3511 sUNO_service_style_CharacterProperties,
3512 sUNO_service_style_CharacterPropertiesComplex,
3513 sUNO_service_style_CharacterPropertiesAsian,
3515 sUNO_service_drawing_PolyPolygonDescriptor,
3516 sUNO_service_drawing_ShadowProperties,
3517 sUNO_service_drawing_RotationDescriptor };
3518 return aSvxShape_MeasureServices;
3521 case OBJ_FRAME:
3523 static const uno::Sequence<OUString> aSvxShape_FrameServices
3524 = { sUNO_service_drawing_FrameShape,
3525 sUNO_service_drawing_Shape };
3526 return aSvxShape_FrameServices;
3529 case OBJ_UNO:
3531 static const uno::Sequence<OUString> aSvxShape_UnoServices
3532 = { sUNO_service_drawing_ControlShape,
3533 sUNO_service_drawing_Shape };
3534 return aSvxShape_UnoServices;
3537 case OBJ_EDGE:
3539 static const uno::Sequence<OUString> aSvxShape_EdgeServices
3540 = { sUNO_service_drawing_ConnectorShape,
3541 sUNO_service_drawing_ConnectorProperties,
3543 sUNO_service_drawing_Shape,
3544 sUNO_service_drawing_LineProperties,
3546 sUNO_service_drawing_Text,
3547 sUNO_service_drawing_TextProperties,
3548 sUNO_service_style_ParagraphProperties,
3549 sUNO_service_style_ParagraphPropertiesComplex,
3550 sUNO_service_style_ParagraphPropertiesAsian,
3551 sUNO_service_style_CharacterProperties,
3552 sUNO_service_style_CharacterPropertiesComplex,
3553 sUNO_service_style_CharacterPropertiesAsian,
3555 sUNO_service_drawing_PolyPolygonDescriptor,
3556 sUNO_service_drawing_ShadowProperties,
3557 sUNO_service_drawing_RotationDescriptor };
3558 return aSvxShape_EdgeServices;
3560 case OBJ_MEDIA:
3562 static const uno::Sequence<OUString> aSvxShape_MediaServices
3563 = { sUNO_service_drawing_MediaShape,
3564 sUNO_service_drawing_Shape };
3565 return aSvxShape_MediaServices;
3569 else if( HasSdrObject() && GetSdrObject()->GetObjInventor() == SdrInventor::FmForm)
3571 #if OSL_DEBUG_LEVEL > 0
3572 const sal_uInt16 nIdent = GetSdrObject()->GetObjIdentifier();
3573 OSL_ENSURE( nIdent == OBJ_UNO, "SvxShape::_getSupportedServiceNames: SdrInventor::FmForm, but no UNO object?" );
3574 #endif
3575 static const uno::Sequence<OUString> aSvxShape_UnoServices
3576 = { sUNO_service_drawing_ControlShape,
3577 sUNO_service_drawing_Shape };
3578 return aSvxShape_UnoServices;
3580 OSL_FAIL( "SvxShape::_getSupportedServiceNames: could not determine object type!" );
3581 uno::Sequence< OUString > aSeq;
3582 return aSeq;
3585 sal_Bool SAL_CALL SvxShape::supportsService( const OUString& ServiceName )
3587 return cppu::supportsService(this, ServiceName);
3590 // XGluePointsSupplier
3591 uno::Reference< container::XIndexContainer > SAL_CALL SvxShape::getGluePoints()
3593 ::SolarMutexGuard aGuard;
3594 uno::Reference< container::XIndexContainer > xGluePoints( mxGluePoints );
3596 if( HasSdrObject() && !xGluePoints.is() )
3598 uno::Reference< container::XIndexContainer > xNew( SvxUnoGluePointAccess_createInstance( GetSdrObject() ), uno::UNO_QUERY );
3599 mxGluePoints = xGluePoints = xNew;
3602 return xGluePoints;
3605 // XChild
3606 uno::Reference<uno::XInterface> SAL_CALL SvxShape::getParent()
3608 ::SolarMutexGuard aGuard;
3609 const SdrObject* pSdrObject(GetSdrObject());
3611 if(nullptr != pSdrObject)
3613 const SdrObjList* pParentSdrObjList(GetSdrObject()->getParentSdrObjListFromSdrObject());
3615 if(nullptr != pParentSdrObjList)
3617 // SdrObject is member of a SdrObjList. That may be a SdrObject
3618 // (SdrObjGroup or E3dScene) or a SdrPage.
3619 // Check for SdrObject first - using getSdrPageFromSdrObjList
3620 // *will* get the SdrPage even when the SdrObject is deep buried
3621 // in a construct of SdrObjGroup.
3622 // We want to ask for the direct parent here...
3623 SdrObject* pParentSdrObject(pParentSdrObjList->getSdrObjectFromSdrObjList());
3625 if(nullptr != pParentSdrObject)
3627 // SdrObject is member of a SdrObject-based Group (SdrObjGroup or E3dScene).
3628 return pParentSdrObject->getUnoShape();
3630 else
3632 SdrPage* pParentSdrPage(pParentSdrObjList->getSdrPageFromSdrObjList());
3634 if(nullptr != pParentSdrPage)
3636 // SdrObject is inserted to a SdrPage. Since
3637 // we checked for getSdrObjectFromSdrObjList first,
3638 // we can even say that it is directly member of that
3639 // SdrPage.
3640 return pParentSdrPage->getUnoPage();
3644 // not member of any SdrObjList, no parent
3645 OSL_FAIL( "SvxShape::getParent( ): unexpected Parent SdrObjList" );
3649 // no SdrObject, no parent
3650 return uno::Reference<uno::XInterface>();
3653 void SAL_CALL SvxShape::setParent( const css::uno::Reference< css::uno::XInterface >& )
3655 throw lang::NoSupportException();
3659 /** called from the XActionLockable interface methods on initial locking */
3660 void SvxShape::lock()
3665 /** called from the XActionLockable interface methods on final unlock */
3666 void SvxShape::unlock()
3671 // XActionLockable
3672 sal_Bool SAL_CALL SvxShape::isActionLocked( )
3674 ::SolarMutexGuard aGuard;
3676 return mnLockCount != 0;
3680 void SAL_CALL SvxShape::addActionLock( )
3682 ::SolarMutexGuard aGuard;
3684 DBG_ASSERT( mnLockCount < 0xffff, "lock overflow in SvxShape!" );
3685 mnLockCount++;
3687 if( mnLockCount == 1 )
3688 lock();
3692 void SAL_CALL SvxShape::removeActionLock( )
3694 ::SolarMutexGuard aGuard;
3696 DBG_ASSERT( mnLockCount > 0, "lock underflow in SvxShape!" );
3697 mnLockCount--;
3699 if( mnLockCount == 0 )
3700 unlock();
3704 void SAL_CALL SvxShape::setActionLocks( sal_Int16 nLock )
3706 ::SolarMutexGuard aGuard;
3708 if( (mnLockCount == 0) && (nLock != 0) )
3709 unlock();
3711 if( (mnLockCount != 0) && (nLock == 0) )
3712 lock();
3714 mnLockCount = static_cast<sal_uInt16>(nLock);
3718 sal_Int16 SAL_CALL SvxShape::resetActionLocks( )
3720 ::SolarMutexGuard aGuard;
3722 if( mnLockCount != 0 )
3723 unlock();
3725 sal_Int16 nOldLocks = static_cast<sal_Int16>(mnLockCount);
3726 mnLockCount = 0;
3728 return nOldLocks;
3732 /** since polygon shapes can change their kind during editing, we have
3733 to recheck it here.
3734 Circle shapes also change their kind, but they are all treated equal
3735 so no update is necessary.
3737 void SvxShape::updateShapeKind()
3739 switch( mpImpl->mnObjId )
3741 case OBJ_LINE:
3742 case OBJ_POLY:
3743 case OBJ_PLIN:
3744 case OBJ_PATHLINE:
3745 case OBJ_PATHFILL:
3746 case OBJ_FREELINE:
3747 case OBJ_FREEFILL:
3748 case OBJ_PATHPOLY:
3749 case OBJ_PATHPLIN:
3751 const sal_uInt32 nId = GetSdrObject()->GetObjIdentifier();
3753 if( nId != mpImpl->mnObjId )
3755 mpImpl->mnObjId = nId;
3758 break;
3763 SvxShapeText::SvxShapeText(SdrObject* pObject)
3764 : SvxShape( pObject, getSvxMapProvider().GetMap(SVXMAP_TEXT), getSvxMapProvider().GetPropertySet(SVXMAP_TEXT, SdrObject::GetGlobalDrawObjectItemPool()) ), SvxUnoTextBase( ImplGetSvxUnoOutlinerTextCursorSvxPropertySet() )
3766 if( pObject )
3767 SetEditSource( new SvxTextEditSource( pObject, nullptr ) );
3771 SvxShapeText::SvxShapeText(SdrObject* pObject, const SfxItemPropertyMapEntry* pPropertyMap, const SvxItemPropertySet* pPropertySet)
3772 : SvxShape( pObject, pPropertyMap, pPropertySet ), SvxUnoTextBase( ImplGetSvxUnoOutlinerTextCursorSvxPropertySet() )
3774 if( pObject )
3775 SetEditSource( new SvxTextEditSource( pObject, nullptr ) );
3779 SvxShapeText::~SvxShapeText() noexcept
3781 // check if only this instance is registered at the ranges
3782 DBG_ASSERT( (nullptr == GetEditSource()) || (GetEditSource()->getRanges().size()==1),
3783 "svx::SvxShapeText::~SvxShapeText(), text shape with living text ranges destroyed!");
3786 void SvxShapeText::Create( SdrObject* pNewObj, SvxDrawPage* pNewPage )
3788 if( pNewObj && (nullptr == GetEditSource()))
3789 SetEditSource( new SvxTextEditSource( pNewObj, nullptr ) );
3790 SvxShape::Create( pNewObj, pNewPage );
3793 // XInterface
3795 uno::Any SAL_CALL SvxShapeText::queryInterface( const uno::Type & rType )
3797 return SvxShape::queryInterface( rType );
3801 uno::Any SAL_CALL SvxShapeText::queryAggregation( const uno::Type & rType )
3803 uno::Any aAny( SvxShape::queryAggregation( rType ) );
3804 if( aAny.hasValue() )
3805 return aAny;
3807 return SvxUnoTextBase::queryAggregation( rType );
3811 // XServiceInfo
3813 OUString SAL_CALL SvxShapeText::getImplementationName()
3815 return "SvxShapeText";
3819 uno::Sequence< OUString > SAL_CALL SvxShapeText::getSupportedServiceNames()
3821 return SvxShape::getSupportedServiceNames();
3825 sal_Bool SAL_CALL SvxShapeText::supportsService( const OUString& ServiceName )
3827 return cppu::supportsService(static_cast<SvxShape*>(this), ServiceName);
3830 // XTypeProvider
3832 uno::Sequence< uno::Type > SAL_CALL SvxShapeText::getTypes()
3834 return SvxShape::getTypes();
3837 sal_Int64 SAL_CALL SvxShapeText::getSomething( const css::uno::Sequence< sal_Int8 >& rId )
3839 const sal_Int64 nReturn = SvxShape::getSomething( rId );
3840 if( nReturn )
3841 return nReturn;
3843 return SvxUnoTextBase::getSomething( rId );
3847 uno::Sequence< sal_Int8 > SAL_CALL SvxShapeText::getImplementationId()
3849 return css::uno::Sequence<sal_Int8>();
3853 /** called from the XActionLockable interface methods on initial locking */
3854 void SvxShapeText::lock()
3856 SvxTextEditSource* pEditSource = static_cast<SvxTextEditSource*>(GetEditSource());
3857 if( pEditSource )
3858 pEditSource->lock();
3862 /** called from the XActionLockable interface methods on final unlock */
3863 void SvxShapeText::unlock()
3865 SvxTextEditSource* pEditSource = static_cast<SvxTextEditSource*>(GetEditSource());
3866 if( pEditSource )
3867 pEditSource->unlock();
3870 // css::text::XTextRange
3871 uno::Reference< text::XTextRange > SAL_CALL SvxShapeText::getStart()
3873 ::SolarMutexGuard aGuard;
3874 SvxTextForwarder* pForwarder = mpEditSource ? mpEditSource->GetTextForwarder() : nullptr;
3875 if( pForwarder )
3876 ::GetSelection( maSelection, pForwarder );
3877 return SvxUnoTextBase::getStart();
3881 uno::Reference< text::XTextRange > SAL_CALL SvxShapeText::getEnd()
3883 ::SolarMutexGuard aGuard;
3884 SvxTextForwarder* pForwarder = mpEditSource ? mpEditSource->GetTextForwarder() : nullptr;
3885 if( pForwarder )
3886 ::GetSelection( maSelection, pForwarder );
3887 return SvxUnoTextBase::getEnd();
3890 OUString SAL_CALL SvxShapeText::getString()
3892 ::SolarMutexGuard aGuard;
3893 SvxTextForwarder* pForwarder = mpEditSource ? mpEditSource->GetTextForwarder() : nullptr;
3894 if( pForwarder )
3895 ::GetSelection( maSelection, pForwarder );
3896 return SvxUnoTextBase::getString();
3900 void SAL_CALL SvxShapeText::setString( const OUString& aString )
3902 ::SolarMutexGuard aGuard;
3903 SvxTextForwarder* pForwarder = mpEditSource ? mpEditSource->GetTextForwarder() : nullptr;
3904 if( pForwarder )
3905 ::GetSelection( maSelection, pForwarder );
3906 SvxUnoTextBase::setString( aString );
3909 // override these for special property handling in subcasses. Return true if property is handled
3910 bool SvxShapeText::setPropertyValueImpl( const OUString& rName, const SfxItemPropertyMapEntry* pProperty, const css::uno::Any& rValue )
3912 // HACK-fix #99090#
3913 // since SdrTextObj::SetVerticalWriting exchanges
3914 // SDRATTR_TEXT_AUTOGROWWIDTH and SDRATTR_TEXT_AUTOGROWHEIGHT,
3915 // we have to set the textdirection here
3917 if( pProperty->nWID == SDRATTR_TEXTDIRECTION )
3919 SdrTextObj* pTextObj = dynamic_cast< SdrTextObj* >( GetSdrObject() );
3920 if( pTextObj )
3922 css::text::WritingMode eMode;
3923 if( rValue >>= eMode )
3925 pTextObj->SetVerticalWriting( eMode == css::text::WritingMode_TB_RL );
3928 return true;
3930 return SvxShape::setPropertyValueImpl( rName, pProperty, rValue );
3933 bool SvxShapeText::getPropertyValueImpl( const OUString& rName, const SfxItemPropertyMapEntry* pProperty, css::uno::Any& rValue )
3935 if( pProperty->nWID == SDRATTR_TEXTDIRECTION )
3937 SdrTextObj* pTextObj = dynamic_cast< SdrTextObj* >( GetSdrObject() );
3938 if( pTextObj && pTextObj->IsVerticalWriting() )
3939 rValue <<= css::text::WritingMode_TB_RL;
3940 else
3941 rValue <<= css::text::WritingMode_LR_TB;
3942 return true;
3945 return SvxShape::getPropertyValueImpl( rName, pProperty, rValue );
3948 bool SvxShapeText::getPropertyStateImpl( const SfxItemPropertyMapEntry* pProperty, css::beans::PropertyState& rState )
3950 return SvxShape::getPropertyStateImpl( pProperty, rState );
3953 bool SvxShapeText::setPropertyToDefaultImpl( const SfxItemPropertyMapEntry* pProperty )
3955 return SvxShape::setPropertyToDefaultImpl( pProperty );
3958 SvxShapeRect::SvxShapeRect(SdrObject* pObj)
3959 : SvxShapeText( pObj, getSvxMapProvider().GetMap(SVXMAP_SHAPE), getSvxMapProvider().GetPropertySet(SVXMAP_SHAPE, SdrObject::GetGlobalDrawObjectItemPool()))
3963 SvxShapeRect::~SvxShapeRect() noexcept
3967 uno::Any SAL_CALL SvxShapeRect::queryInterface( const uno::Type & rType )
3969 return SvxShapeText::queryInterface( rType );
3972 uno::Any SAL_CALL SvxShapeRect::queryAggregation( const uno::Type & rType )
3974 return SvxShapeText::queryAggregation( rType );
3977 // XServiceInfo
3979 uno::Sequence< OUString > SvxShapeRect::getSupportedServiceNames()
3981 return SvxShape::getSupportedServiceNames();
3984 /** returns a StarOffice API wrapper for the given SdrObject */
3985 uno::Reference< drawing::XShape > GetXShapeForSdrObject( SdrObject* pObj ) noexcept
3987 uno::Reference< drawing::XShape > xShape( pObj->getUnoShape(), uno::UNO_QUERY );
3988 return xShape;
3991 /** returns the SdrObject from the given StarOffice API wrapper */
3992 SdrObject* GetSdrObjectFromXShape( const uno::Reference< drawing::XShape >& xShape ) noexcept
3994 SvxShape* pShape = comphelper::getUnoTunnelImplementation<SvxShape>( xShape );
3995 return pShape ? pShape->GetSdrObject() : nullptr;
3999 SdrObject* SdrObject::getSdrObjectFromXShape( const css::uno::Reference< css::uno::XInterface >& xInt )
4001 SvxShape* pSvxShape = comphelper::getUnoTunnelImplementation<SvxShape>( xInt );
4002 return pSvxShape ? pSvxShape->GetSdrObject() : nullptr;
4005 uno::Any SvxItemPropertySet_getPropertyValue( const SfxItemPropertyMapEntry* pMap, const SfxItemSet& rSet )
4007 if(!pMap || !pMap->nWID)
4008 return uno::Any();
4010 // Check is for items that store either metric values if they are positive or percentage if they are negative.
4011 bool bDontConvertNegativeValues = ( pMap->nWID == XATTR_FILLBMP_SIZEX || pMap->nWID == XATTR_FILLBMP_SIZEY );
4012 return SvxItemPropertySet::getPropertyValue( pMap, rSet, (pMap->nWID != SDRATTR_XMLATTRIBUTES), bDontConvertNegativeValues );
4015 void SvxItemPropertySet_setPropertyValue( const SfxItemPropertyMapEntry* pMap, const uno::Any& rVal, SfxItemSet& rSet )
4017 if(!pMap || !pMap->nWID)
4018 return;
4020 bool bDontConvertNegativeValues = ( pMap->nWID == XATTR_FILLBMP_SIZEX || pMap->nWID == XATTR_FILLBMP_SIZEY );
4021 SvxItemPropertySet::setPropertyValue( pMap, rVal, rSet, bDontConvertNegativeValues );
4024 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */