LibreOffice Module svx (master) 1
unoshape.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19
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>
37#include <vcl/gfxlink.hxx>
38#include <vcl/virdev.hxx>
39#include <svx/sdangitm.hxx>
40#include <svx/svdlayer.hxx>
41#include <svx/svdopage.hxx>
42#include <svx/xflbstit.hxx>
43#include <svx/xflbmtit.hxx>
44#include <svx/xlnstit.hxx>
45#include <svx/xlnedit.hxx>
46#include <svx/xlnclit.hxx>
47#include <svx/svdmodel.hxx>
48#include <svx/svdobjkind.hxx>
49#include <svx/unopage.hxx>
50#include <svx/unoshape.hxx>
51#include <svx/unoshtxt.hxx>
52#include <svx/svdpage.hxx>
53#include <svx/unoshprp.hxx>
54#include <svx/svdograf.hxx>
55#include <svx/unoapi.hxx>
56#include <svx/svdomeas.hxx>
57#include <svx/svdpool.hxx>
59#include <tools/stream.hxx>
60#include <tools/gen.hxx>
62#include <svx/svdoedge.hxx>
63#include <svx/svdocapt.hxx>
64#include <svx/obj3d.hxx>
65#include <svx/xflftrit.hxx>
66#include <svx/xtable.hxx>
67#include <svx/xbtmpit.hxx>
68#include <svx/xfillit0.hxx>
69#include <svx/xflgrit.hxx>
70#include <svx/xflhtit.hxx>
71#include <svx/xlineit0.hxx>
72#include <svx/xlndsit.hxx>
73#include <svx/unomaster.hxx>
77#include "gluepts.hxx"
78#include "shapeimpl.hxx"
79#include <sal/log.hxx>
80
81#include <svx/lathe3d.hxx>
82#include <extrud3d.hxx>
87
88#include <vcl/gdimtf.hxx>
89#include <vcl/wmf.hxx>
90#include <svx/sdtfsitm.hxx>
91#include <svx/svdopath.hxx>
93#include <svx/xflclit.hxx>
95
96#include <memory>
97#include <optional>
98#include <vector>
99#include <iostream>
100
101#include <bitmaps.hlst>
102
103using namespace ::osl;
104using namespace ::cppu;
105using namespace ::com::sun::star;
106using namespace ::com::sun::star::uno;
107using namespace ::com::sun::star::lang;
108using namespace ::com::sun::star::container;
110
111class GDIMetaFile;
112
114{
115 std::optional<SfxItemSet> mxItemSet;
119
126
127 // for xComponent
130
131 SvxShapeImpl( SvxShape& _rAntiImpl )
133 ,mpMaster( nullptr )
134 ,mbDisposing( false )
135 ,maPropertyNotifier( _rAntiImpl )
136 {
137 }
138};
139
140namespace {
141
142class ShapePositionProvider : public PropertyValueProvider
143{
144public:
145 static constexpr OUStringLiteral sPosition = u"Position";
146 explicit ShapePositionProvider( SvxShape& _shape )
147 :PropertyValueProvider( _shape, sPosition )
148 {
149 }
150
151protected:
152 virtual void getCurrentValue( Any& _out_rCurrentValue ) const override
153 {
154 _out_rCurrentValue <<= static_cast< SvxShape& >( getContext() ).getPosition();
155 }
156};
157
158
159class ShapeSizeProvider : public PropertyValueProvider
160{
161public:
162 static constexpr OUStringLiteral sSize = u"Size";
163 explicit ShapeSizeProvider( SvxShape& _shape )
164 :PropertyValueProvider( _shape, sSize )
165 {
166 }
167
168protected:
169 virtual void getCurrentValue( Any& _out_rCurrentValue ) const override
170 {
171 _out_rCurrentValue <<= static_cast< SvxShape& >( getContext() ).getSize();
172 }
173};
174
176double GetTextFitToSizeScale(SdrObject* pObject)
177{
178 SdrTextObj* pTextObj = DynCastSdrTextObj(pObject);
179 if (!pTextObj)
180 {
181 return 0;
182 }
183
184 const SfxItemSet& rTextObjSet = pTextObj->GetMergedItemSet();
186 != drawing::TextFitToSizeType_AUTOFIT)
187 {
188 return 0;
189 }
190
191 return pTextObj->GetFontScale();
192}
193}
194
196: maSize(100,100)
197, mpImpl( new SvxShapeImpl( *this ) )
198, mbIsMultiPropertyCall(false)
199, mpPropSet(getSvxMapProvider().GetPropertySet(SVXMAP_SHAPE, SdrObject::GetGlobalDrawObjectItemPool()))
200, maPropMapEntries(getSvxMapProvider().GetMap(SVXMAP_SHAPE))
201, mxSdrObject(pObject)
202, mnLockCount(0)
203{
205}
206
207
209: maSize(100,100)
210, mpImpl( new SvxShapeImpl( *this ) )
211, mbIsMultiPropertyCall(false)
212, mpPropSet(pPropertySet)
213, maPropMapEntries(pEntries)
214, mxSdrObject(pObject)
215, mnLockCount(0)
216{
218}
219
220
222{
223 ::SolarMutexGuard aGuard;
224
225 DBG_ASSERT( mnLockCount == 0, "Locked shape was disposed!" );
226
227 if ( mpImpl->mpMaster )
228 mpImpl->mpMaster->dispose();
229
230 if ( mxSdrObject )
231 {
232 EndListening(mxSdrObject->getSdrModelFromSdrObject());
233 mxSdrObject->setUnoShape(nullptr);
234 mxSdrObject.clear();
235 }
236
237 EndListeningAll(); // call explicitly within SolarMutexGuard
238}
239
240
242{
243 if(mxSdrObject)
244 {
245 EndListening(mxSdrObject->getSdrModelFromSdrObject());
246 mxSdrObject.clear();
247 }
248};
249
251{
252 mpImpl->mnObjId = nKind;
253}
254
257{
258 return mpImpl->mnObjId;
259}
260
261
263{
264 mpImpl->mpMaster = pMaster;
265}
266
267
269{
270 if( mpImpl->mpMaster )
271 {
272 uno::Any aAny;
273 if( mpImpl->mpMaster->queryAggregation( rType, aAny ) )
274 return aAny;
275 }
276
278}
279
280const css::uno::Sequence< sal_Int8 > & SvxShape::getUnoTunnelId() noexcept
281{
282 static const comphelper::UnoIdInit theSvxShapeUnoTunnelId;
283 return theSvxShapeUnoTunnelId.getSeq();
284}
285
286sal_Int64 SAL_CALL SvxShape::getSomething( const css::uno::Sequence< sal_Int8 >& rId )
287{
288 return comphelper::getSomethingImpl(rId, this);
289}
290
291
293{
294 std::unique_lock g(m_aMutex);
295 mpImpl->maPropertyNotifier.notifyPropertyChange(g, eProp);
296}
297
298void SvxShape::registerProvider(svx::ShapePropertyProviderId eProp, std::unique_ptr<svx::PropertyValueProvider> provider)
299{
300 mpImpl->maPropertyNotifier.registerProvider(eProp, std::move(provider));
301}
302
304{
305 mpImpl->maPropertyNotifier.registerProvider( svx::ShapePropertyProviderId::Position,
306 std::make_unique<ShapePositionProvider>( *this ) );
307 mpImpl->maPropertyNotifier.registerProvider( svx::ShapePropertyProviderId::Size,
308 std::make_unique<ShapeSizeProvider>( *this ) );
309
310 if ( HasSdrObject() )
311 {
312 StartListening(GetSdrObject()->getSdrModelFromSdrObject());
314 }
315}
316
317
319{
321 OSL_PRECOND( HasSdrObject(), "SvxShape::impl_initFromSdrObject: not to be called without SdrObject!" );
322 if ( !HasSdrObject() )
323 return;
324
325 osl_atomic_increment( &m_refCount );
326 {
327 GetSdrObject()->setUnoShape(this);
328 }
329 osl_atomic_decrement( &m_refCount );
330
331 // #i40944#
332 // Do not simply return when no model but do the type corrections
333 // following below.
334 const SdrInventor nInventor = GetSdrObject()->GetObjInventor();
335
336 // is it one of ours (svx) ?
337 if( !(nInventor == SdrInventor::Default || nInventor == SdrInventor::E3d || nInventor == SdrInventor::FmForm) )
338 return;
339
340 if(nInventor == SdrInventor::FmForm)
341 {
342 mpImpl->mnObjId = SdrObjKind::UNO;
343 }
344 else
345 {
346 mpImpl->mnObjId = GetSdrObject()->GetObjIdentifier();
347 }
348
349 switch(mpImpl->mnObjId)
350 {
351 case SdrObjKind::CircleCut: // segment of circle
352 case SdrObjKind::CircleArc: // arc of circle
353 case SdrObjKind::CircleSection: // sector
355 break;
356 default: ;
357 }
358}
359
360
361void SvxShape::Create( SdrObject* pNewObj, SvxDrawPage* /*pNewPage*/ )
362{
364
365 assert( pNewObj && "SvxShape::Create: invalid new object!" );
366 if ( !pNewObj )
367 return;
368
369 rtl::Reference<SdrObject> pCreatedObj = mpImpl->mxCreatedObj.get();
370 assert( ( !pCreatedObj || ( pCreatedObj == pNewObj ) ) &&
371 "SvxShape::Create: the same shape used for two different objects?! Strange ..." );
372
373 // Correct condition (#i52126#)
374 if ( pCreatedObj == pNewObj )
375 return;
376
377 // Correct condition (#i52126#)
378 mpImpl->mxCreatedObj = pNewObj;
379
380 if( HasSdrObject() )
381 {
382 EndListening( GetSdrObject()->getSdrModelFromSdrObject() );
383 }
384
385 mxSdrObject = pNewObj;
386
387 if( HasSdrObject() )
388 {
389 StartListening( GetSdrObject()->getSdrModelFromSdrObject() );
390 }
391
392 OSL_ENSURE( !mbIsMultiPropertyCall, "SvxShape::Create: hmm?" );
393 // this was previously set in impl_initFromSdrObject, but I think it was superfluous
394 // (it definitely was in the other context where it was called, but I strongly suppose
395 // it was also superfluous when called from here)
397
399
400 // save user call
402 GetSdrObject()->SetUserCall(nullptr);
403
405 setSize( maSize );
406
407 // restore user call after we set the initial size
408 GetSdrObject()->SetUserCall( pUser );
409
410 // if this shape was already named, use this name
411 if( !maShapeName.isEmpty() )
412 {
414 maShapeName.clear();
415 }
416}
417
418void SvxShape::ForceMetricToItemPoolMetric(Pair& rPoint) const noexcept
419{
421 if(!HasSdrObject())
422 return;
423
424 MapUnit eMapUnit(GetSdrObject()->getSdrModelFromSdrObject().GetItemPool().GetMetric(0));
425 if(eMapUnit == MapUnit::Map100thMM)
426 return;
427
428 if (const auto eTo = MapToO3tlLength(eMapUnit); eTo != o3tl::Length::invalid)
429 {
430 rPoint.A() = o3tl::convert(rPoint.A(), o3tl::Length::mm100, eTo);
431 rPoint.B() = o3tl::convert(rPoint.B(), o3tl::Length::mm100, eTo);
432 }
433 else
434 {
435 OSL_FAIL("AW: Missing unit translation to PoolMetric!");
436 }
437}
438
440{
442 if(!HasSdrObject())
443 return;
444
445 GetSdrObject()->ForceMetricToItemPoolMetric(rPolyPolygon);
446}
447
449{
451 if(!HasSdrObject())
452 return;
453
454 MapUnit eMapUnit(GetSdrObject()->getSdrModelFromSdrObject().GetItemPool().GetMetric(0));
455 if(eMapUnit == MapUnit::Map100thMM)
456 return;
457
458 if (const auto eTo = MapToO3tlLength(eMapUnit); eTo != o3tl::Length::invalid)
459 {
460 const double fConvert(o3tl::convert(1.0, o3tl::Length::mm100, eTo));
461 const basegfx::utils::B2DHomMatrixBufferedDecompose aDecomposedTransform(rB2DHomMatrix);
463 aDecomposedTransform.getScale() * fConvert,
464 aDecomposedTransform.getShearX(),
465 aDecomposedTransform.getRotate(),
466 aDecomposedTransform.getTranslate() * fConvert);
467 }
468 else
469 {
470 OSL_FAIL("Missing unit translation to PoolMetric!");
471 }
472}
473
474void SvxShape::ForceMetricTo100th_mm(Pair& rPoint) const noexcept
475{
477 if(!HasSdrObject())
478 return;
479
480 MapUnit eMapUnit = GetSdrObject()->getSdrModelFromSdrObject().GetItemPool().GetMetric(0);
481 if(eMapUnit == MapUnit::Map100thMM)
482 return;
483
484 if (const auto eFrom = MapToO3tlLength(eMapUnit); eFrom != o3tl::Length::invalid)
485 {
486 rPoint.A() = o3tl::convert(rPoint.A(), eFrom, o3tl::Length::mm100);
487 rPoint.B() = o3tl::convert(rPoint.B(), eFrom, o3tl::Length::mm100);
488 }
489 else
490 {
491 OSL_FAIL("AW: Missing unit translation to 100th mm!");
492 }
493}
494
496{
498 if(!HasSdrObject())
499 return;
500
501 MapUnit eMapUnit = GetSdrObject()->getSdrModelFromSdrObject().GetItemPool().GetMetric(0);
502 if(eMapUnit == MapUnit::Map100thMM)
503 return;
504
505 if (const auto eFrom = MapToO3tlLength(eMapUnit); eFrom != o3tl::Length::invalid)
506 {
507 const double fConvert(o3tl::convert(1.0, eFrom, o3tl::Length::mm100));
508 rPolyPolygon.transform(basegfx::utils::createScaleB2DHomMatrix(fConvert, fConvert));
509 }
510 else
511 {
512 OSL_FAIL("Missing unit translation to 100th mm!");
513 }
514}
515
517{
519 if(!HasSdrObject())
520 return;
521
522 MapUnit eMapUnit = GetSdrObject()->getSdrModelFromSdrObject().GetItemPool().GetMetric(0);
523 if(eMapUnit == MapUnit::Map100thMM)
524 return;
525
526 if (const auto eFrom = MapToO3tlLength(eMapUnit); eFrom != o3tl::Length::invalid)
527 {
528 const double fConvert(o3tl::convert(1.0, eFrom, o3tl::Length::mm100));
529 const basegfx::utils::B2DHomMatrixBufferedDecompose aDecomposedTransform(rB2DHomMatrix);
531 aDecomposedTransform.getScale() * fConvert,
532 aDecomposedTransform.getShearX(),
533 aDecomposedTransform.getRotate(),
534 aDecomposedTransform.getTranslate() * fConvert);
535 }
536 else
537 {
538 OSL_FAIL("Missing unit translation to 100th mm!");
539 }
540}
541
543 SfxItemSet& rSet, const uno::Reference< beans::XPropertySet >& xSet, const SfxItemPropertyMap* pMap )
544{
545 if(!rAnys.AreThereOwnUsrAnys())
546 return;
547
548 const SfxItemPropertyMap& rSrc = rPropSet.getPropertyMap();
549
550 for(const SfxItemPropertyMapEntry* pSrcProp : rSrc.getPropertyEntries())
551 {
552 const sal_uInt16 nWID = pSrcProp->nWID;
553 if(SfxItemPool::IsWhich(nWID)
554 && (nWID < OWN_ATTR_VALUE_START || nWID > OWN_ATTR_VALUE_END)
555 && rAnys.GetUsrAnyForID(*pSrcProp))
557 }
558
559 for(const SfxItemPropertyMapEntry* pSrcProp : rSrc.getPropertyEntries())
560 {
561 if(pSrcProp->nWID)
562 {
563 uno::Any* pUsrAny = rAnys.GetUsrAnyForID(*pSrcProp);
564 if(pUsrAny)
565 {
566 // search for equivalent entry in pDst
567 const SfxItemPropertyMapEntry* pEntry = pMap->getByName( pSrcProp->aName );
568 if(pEntry)
569 {
570 // entry found
571 if(pEntry->nWID >= OWN_ATTR_VALUE_START && pEntry->nWID <= OWN_ATTR_VALUE_END)
572 {
573 // special ID in PropertySet, can only be set
574 // directly at the object
575 xSet->setPropertyValue( pSrcProp->aName, *pUsrAny);
576 }
577 else
578 {
579 SvxItemPropertySet_setPropertyValue(pEntry, *pUsrAny, rSet);
580 }
581 }
582 }
583 }
584 }
585 rAnys.ClearAllUsrAny();
586}
587
588
590{
593 {
594 SfxItemSetFixed<SDRATTR_START, SDRATTR_END> aSet( GetSdrObject()->getSdrModelFromSdrObject().GetItemPool() );
595 Reference< beans::XPropertySet > xShape(this);
597
599
601 }
602}
603
604uno::Any SvxShape::GetBitmap( bool bMetaFile /* = false */ ) const
605{
607 uno::Any aAny;
608
609 if(!HasSdrObject() || nullptr == GetSdrObject()->getSdrPageFromSdrObject())
610 {
611 return aAny;
612 }
613
614 // tdf#118662 Emulate old behaviour of XclObjComment (see there)
615 const SdrCaptionObj* pSdrCaptionObj(dynamic_cast<SdrCaptionObj*>(GetSdrObject()));
616 if(nullptr != pSdrCaptionObj && pSdrCaptionObj->isSuppressGetBitmap())
617 {
618 return aAny;
619 }
620
621 // tdf#119180 If we do not ask for Metafile and we access a SdrGrafObj,
622 // and content exists and is a Bitmap, take the shortcut.
623 // Do *not* do this for Metafile - as can be seen, requested in that case
624 // is a byte-sequence of a saved WMF format file (see below)
625 if(!bMetaFile)
626 {
627 const SdrGrafObj* pSdrGrafObj(dynamic_cast<SdrGrafObj*>(GetSdrObject()));
628
629 if(nullptr != pSdrGrafObj)
630 {
631 const Graphic& rGraphic(pSdrGrafObj->GetGraphic());
632
633 if(GraphicType::Bitmap == rGraphic.GetType())
634 {
635 Reference< awt::XBitmap > xBmp( rGraphic.GetXGraphic(), UNO_QUERY );
636 aAny <<= xBmp;
637
638 return aAny;
639 }
640 }
641 }
642
643 // tdf#118662 instead of creating an E3dView instance every time to paint
644 // a single SdrObject, use the existing SdrObject::SingleObjectPainter to
645 // use less resources and runtime
646 if(bMetaFile)
647 {
649 const tools::Rectangle aBoundRect(GetSdrObject()->GetCurrentBoundRect());
650 GDIMetaFile aMtf;
651
652 pVDev->SetMapMode(MapMode(MapUnit::Map100thMM));
653 pVDev->EnableOutput(false);
654 aMtf.Record(pVDev);
656 aMtf.Stop();
657 aMtf.WindStart();
658 aMtf.Move(-aBoundRect.Left(), -aBoundRect.Top());
659 aMtf.SetPrefMapMode(MapMode(MapUnit::Map100thMM));
660 aMtf.SetPrefSize(aBoundRect.GetSize());
661
662 SvMemoryStream aDestStrm(65535, 65535);
663
665 aMtf,
666 aDestStrm,
667 nullptr,
668 false);
669
670 const uno::Sequence<sal_Int8> aSeq(
671 static_cast< const sal_Int8* >(aDestStrm.GetData()),
672 aDestStrm.GetEndOfData());
673
674 aAny <<= aSeq;
675 }
676 else
677 {
680
681 if(!xPrimitives.empty())
682 {
683 const drawinglayer::geometry::ViewInformation2D aViewInformation2D;
684 basegfx::B2DRange aRange(
685 xPrimitives.getB2DRange(aViewInformation2D));
686
687 if(!aRange.isEmpty())
688 {
689 const MapUnit aSourceMapUnit(GetSdrObject()->getSdrModelFromSdrObject().GetScaleUnit());
690
691 if(MapUnit::Map100thMM != aSourceMapUnit)
692 {
693 // tdf#119180 This is UNO API and thus works in 100th_mm,
694 // so if the MapMode from the used SdrModel is *not* equal
695 // to Map100thMM we need to embed the primitives to an adapting
696 // homogen transformation for correct values
697 const basegfx::B2DHomMatrix aMapTransform(
699 MapMode(aSourceMapUnit),
700 MapMode(MapUnit::Map100thMM)));
701
702 // Embed primitives to get them in 100th mm
705 aMapTransform,
706 std::move(xPrimitives)));
707
708 xPrimitives = drawinglayer::primitive2d::Primitive2DContainer { xEmbedRef };
709
710 // Update basegfx::B2DRange aRange, too. Here we have the
711 // choice of transforming the existing value or get newly by
712 // again using 'xPrimitives.getB2DRange(aViewInformation2D)'
713 aRange.transform(aMapTransform);
714 }
715
716 const BitmapEx aBmp(
718 std::move(xPrimitives),
719 aRange));
720
721 Graphic aGraph(aBmp);
722
723 aGraph.SetPrefSize(aBmp.GetPrefSize());
724 aGraph.SetPrefMapMode(aBmp.GetPrefMapMode());
725
726 Reference< awt::XBitmap > xBmp( aGraph.GetXGraphic(), UNO_QUERY );
727 aAny <<= xBmp;
728 }
729 }
730 }
731
732 return aAny;
733}
734
735uno::Sequence< uno::Type > SAL_CALL SvxShape::getTypes()
736{
737 if( mpImpl->mpMaster )
738 {
739 return mpImpl->mpMaster->getTypes();
740 }
741 else
742 {
743 return _getTypes();
744 }
745}
746
747
748uno::Sequence< uno::Type > const & SvxShape::_getTypes()
749{
750 switch( mpImpl->mnObjId )
751 {
752 // shapes without text
753 case SdrObjKind::Page:
764 {
765 static uno::Sequence<uno::Type> aTypeSequence{
778 };
779
780 return aTypeSequence;
781 }
782 // group shape
784 {
785 static uno::Sequence<uno::Type> aTypeSequence{
800 };
801
802 return aTypeSequence;
803 }
804 // connector shape
805 case SdrObjKind::Edge:
806 {
807 static uno::Sequence<uno::Type> aTypeSequence{
821 // from SvxUnoTextBase::getTypes()
826 };
827
828 return aTypeSequence;
829 }
830 // control shape
831 case SdrObjKind::UNO:
832 {
833 static uno::Sequence<uno::Type> aTypeSequence{
847 };
848
849 return aTypeSequence;
850 }
851 // 3d scene shape
853 {
854 static uno::Sequence<uno::Type> aTypeSequence{
868 };
869
870 return aTypeSequence;
871 }
873 {
874 static uno::Sequence<uno::Type> aTypeSequence{
887 // from SvxUnoTextBase::getTypes()
892 };
893
894 return aTypeSequence;
895 }
896 // shapes with text
900 case SdrObjKind::Line:
910 case SdrObjKind::Text:
912 case SdrObjKind::OLE2: // #i118485# Moved to shapes with text
913 default:
914 {
915 static uno::Sequence<uno::Type> aTypeSequence{
928 // from SvxUnoTextBase::getTypes()
933 };
934
935 return aTypeSequence;
936 }
937 }
938}
939
940
941uno::Sequence< sal_Int8 > SAL_CALL SvxShape::getImplementationId()
942{
943 return css::uno::Sequence<sal_Int8>();
944}
945
946void SvxShape::Notify( SfxBroadcaster&, const SfxHint& rHint ) noexcept
947{
949
950 // do cheap checks first, this method is hot
951 if (rHint.GetId() != SfxHintId::ThisIsAnSdrHint)
952 return;
953 if( !mxSdrObject )
954 return;
955 const SdrHint* pSdrHint = static_cast<const SdrHint*>(&rHint);
956 // #i55919# SdrHintKind::ObjectChange is only interesting if it's for this object
957 if ((pSdrHint->GetKind() != SdrHintKind::ModelCleared) &&
958 (pSdrHint->GetKind() != SdrHintKind::ObjectChange || pSdrHint->GetObject() != mxSdrObject.get() ))
959 return;
960
961 // prevent object being deleted from under us
962 rtl::Reference<SdrObject> xSdrSelf(mxSdrObject);
963 uno::Reference< uno::XInterface > xSelf( mxSdrObject->getWeakUnoShape() );
964 if( !xSelf.is() )
965 {
966 EndListening(mxSdrObject->getSdrModelFromSdrObject());
967 mxSdrObject.clear();
968 return;
969 }
970
971 if (pSdrHint->GetKind() == SdrHintKind::ObjectChange)
972 {
973 updateShapeKind();
974 }
975 else // (pSdrHint->GetKind() == SdrHintKind::ModelCleared)
976 {
977 EndListening(mxSdrObject->getSdrModelFromSdrObject());
978 mxSdrObject->setUnoShape(nullptr);
979 mxSdrObject.clear();
980
981 if(!mpImpl->mbDisposing)
982 dispose();
983 }
984}
985
986// XShape
987
988
989// The "*LogicRectHack" functions also existed in sch, and those
990// duplicate symbols cause Bad Things To Happen (TM) #i9462#.
991// Prefixing with 'svx' and marking static to make sure name collisions
992// do not occur.
993
994static bool svx_needLogicRectHack( SdrObject const * pObj )
995{
997 {
998 switch(pObj->GetObjIdentifier())
999 {
1000 case SdrObjKind::Group:
1001 case SdrObjKind::Line:
1008 case SdrObjKind::Edge:
1012 return true;
1013 default:
1014 break;
1015 }
1016 }
1017 return false;
1018}
1019
1020
1022{
1023 if(svx_needLogicRectHack(pObj))
1024 {
1025 return pObj->GetSnapRect();
1026 }
1027 else
1028 {
1029 return pObj->GetLogicRect();
1030 }
1031}
1032
1033
1034static void svx_setLogicRectHack( SdrObject* pObj, const tools::Rectangle& rRect )
1035{
1036 if(svx_needLogicRectHack(pObj))
1037 {
1038 pObj->SetSnapRect( rRect );
1039 }
1040 else
1041 {
1042 pObj->SetLogicRect( rRect );
1043 }
1044}
1045
1046
1047awt::Point SAL_CALL SvxShape::getPosition()
1048{
1049 ::SolarMutexGuard aGuard;
1050
1051 if(HasSdrObject())
1052 {
1054 Point aPt( aRect.Left(), aRect.Top() );
1055
1056 // Position is relative to anchor, so recalc to absolute position
1057 if( GetSdrObject()->getSdrModelFromSdrObject().IsWriter() )
1058 aPt -= GetSdrObject()->GetAnchorPos();
1059
1061 return css::awt::Point( aPt.X(), aPt.Y() );
1062 }
1063 else
1064 {
1065 return maPosition;
1066 }
1067}
1068
1069
1070void SAL_CALL SvxShape::setPosition( const awt::Point& Position )
1071{
1072 ::SolarMutexGuard aGuard;
1073
1074 if(HasSdrObject())
1075 {
1076 // do NOT move 3D objects, this would change the homogen
1077 // transformation matrix
1078 if(dynamic_cast<const E3dCompoundObject* >(GetSdrObject()) == nullptr)
1079 {
1081 Point aLocalPos( Position.X, Position.Y );
1082 ForceMetricToItemPoolMetric(aLocalPos);
1083
1084 // Position is absolute, so recalc to position relative to anchor
1085 if( GetSdrObject()->getSdrModelFromSdrObject().IsWriter() )
1086 aLocalPos += GetSdrObject()->GetAnchorPos();
1087
1088 tools::Long nDX = aLocalPos.X() - aRect.Left();
1089 tools::Long nDY = aLocalPos.Y() - aRect.Top();
1090
1091 GetSdrObject()->Move( Size( nDX, nDY ) );
1093 }
1094 }
1095
1097}
1098
1099
1100awt::Size SAL_CALL SvxShape::getSize()
1101{
1102 ::SolarMutexGuard aGuard;
1103
1104 if(HasSdrObject())
1105 {
1107 Size aObjSize( aRect.getOpenWidth(), aRect.getOpenHeight() );
1108 ForceMetricTo100th_mm(aObjSize);
1109 return css::awt::Size( aObjSize.getWidth(), aObjSize.getHeight() );
1110 }
1111 else
1112 return maSize;
1113}
1114
1115
1116void SAL_CALL SvxShape::setSize( const awt::Size& rSize )
1117{
1118 ::SolarMutexGuard aGuard;
1119
1120 if(HasSdrObject())
1121 {
1123 Size aLocalSize( rSize.Width, rSize.Height );
1124 ForceMetricToItemPoolMetric(aLocalSize);
1125
1126 if(GetSdrObject()->GetObjInventor() == SdrInventor::Default && GetSdrObject()->GetObjIdentifier() == SdrObjKind::Measure )
1127 {
1128 Fraction aWdt(aLocalSize.Width(),aRect.Right()-aRect.Left());
1129 Fraction aHgt(aLocalSize.Height(),aRect.Bottom()-aRect.Top());
1131 GetSdrObject()->Resize(aPt,aWdt,aHgt);
1132 }
1133 else
1134 {
1135 //aRect.SetSize(aLocalSize); // this call subtract 1 // https://bz.apache.org/ooo/show_bug.cgi?id=83193
1136 if ( !aLocalSize.Width() )
1137 {
1138 aRect.SetWidthEmpty();
1139 }
1140 else
1141 aRect.setWidth(aLocalSize.Width());
1142 if ( !aLocalSize.Height() )
1143 {
1144 aRect.SetHeightEmpty();
1145 }
1146 else
1147 aRect.setHeight(aLocalSize.Height());
1148
1150 }
1151
1153 }
1154 maSize = rSize;
1155}
1156
1157
1158// XNamed
1159OUString SAL_CALL SvxShape::getName( )
1160{
1161 ::SolarMutexGuard aGuard;
1162 if( HasSdrObject() )
1163 {
1164 return GetSdrObject()->GetName();
1165 }
1166 else
1167 {
1168 return maShapeName;
1169 }
1170}
1171
1172
1173void SAL_CALL SvxShape::setName( const OUString& aName )
1174{
1175 ::SolarMutexGuard aGuard;
1176 if( HasSdrObject() )
1177 {
1179 }
1180 else
1181 {
1183 }
1184}
1185
1186// XShapeDescriptor
1187
1188
1189OUString SAL_CALL SvxShape::getShapeType()
1190{
1191 if( !maShapeType.getLength() )
1192 return UHashMap::getNameFromId( mpImpl->mnObjId );
1193 else
1194 return maShapeType;
1195}
1196
1197// XComponent
1198
1199
1200void SAL_CALL SvxShape::dispose()
1201{
1202 std::unique_lock g(m_aMutex);
1203
1204 if( mpImpl->mbDisposing )
1205 return; // caught a recursion
1206
1207 mpImpl->mbDisposing = true;
1208
1209 lang::EventObject aEvt;
1210 aEvt.Source = *static_cast<OWeakAggObject*>(this);
1211 mpImpl->maDisposeListeners.disposeAndClear(g, aEvt);
1212 mpImpl->maPropertyNotifier.disposing(g);
1213
1215 if (!pObject)
1216 return;
1217
1218 EndListening( pObject->getSdrModelFromSdrObject() );
1219
1220 if ( pObject->IsInserted() && pObject->getSdrPageFromSdrObject() )
1221 {
1222 SdrPage* pPage = pObject->getSdrPageFromSdrObject();
1223 // delete the SdrObject from the page
1224 const size_t nCount = pPage->GetObjCount();
1225 for ( size_t nNum = 0; nNum < nCount; ++nNum )
1226 {
1227 if ( pPage->GetObj( nNum ) == pObject.get() )
1228 {
1229 OSL_VERIFY( pPage->RemoveObject( nNum ) == pObject );
1230 break;
1231 }
1232 }
1233 }
1234
1235 mxSdrObject.clear();
1236 pObject->setUnoShape(nullptr);
1237}
1238
1239
1240void SAL_CALL SvxShape::addEventListener( const Reference< lang::XEventListener >& xListener )
1241{
1242 std::unique_lock g(m_aMutex);
1243 mpImpl->maDisposeListeners.addInterface(g, xListener);
1244}
1245
1246
1247void SAL_CALL SvxShape::removeEventListener( const Reference< lang::XEventListener >& aListener )
1248{
1249 std::unique_lock g(m_aMutex);
1250 mpImpl->maDisposeListeners.removeInterface(g, aListener);
1251}
1252
1253// XPropertySet
1254
1255
1256Reference< beans::XPropertySetInfo > SAL_CALL
1258{
1259 if( mpImpl->mpMaster )
1260 {
1261 return mpImpl->mpMaster->getPropertySetInfo();
1262 }
1263 else
1264 {
1265 return _getPropertySetInfo();
1266 }
1267}
1268
1269Reference< beans::XPropertySetInfo > const &
1271{
1272 return mpPropSet->getPropertySetInfo();
1273}
1274
1275
1276void SAL_CALL SvxShape::addPropertyChangeListener( const OUString& _propertyName, const Reference< beans::XPropertyChangeListener >& _listener )
1277{
1278 std::unique_lock g(m_aMutex);
1279 mpImpl->maPropertyNotifier.addPropertyChangeListener( g, _propertyName, _listener );
1280}
1281
1282
1283void SAL_CALL SvxShape::removePropertyChangeListener( const OUString& _propertyName, const Reference< beans::XPropertyChangeListener >& _listener )
1284{
1285 std::unique_lock g(m_aMutex);
1286 mpImpl->maPropertyNotifier.removePropertyChangeListener( g, _propertyName, _listener );
1287}
1288
1289
1290void SAL_CALL SvxShape::addVetoableChangeListener( const OUString& , const Reference< beans::XVetoableChangeListener >& )
1291{
1292 OSL_FAIL( "SvxShape::addVetoableChangeListener: don't have any vetoable properties, so why ...?" );
1293}
1294
1295
1296void SAL_CALL SvxShape::removeVetoableChangeListener( const OUString& , const Reference< beans::XVetoableChangeListener >& )
1297{
1298 OSL_FAIL( "SvxShape::removeVetoableChangeListener: don't have any vetoable properties, so why ...?" );
1299}
1300
1301
1302bool SvxShape::SetFillAttribute( sal_uInt16 nWID, const OUString& rName )
1303{
1304 if(HasSdrObject())
1305 {
1306 SfxItemSet aSet( GetSdrObject()->getSdrModelFromSdrObject().GetItemPool(), nWID, nWID );
1307
1308 if( SetFillAttribute( nWID, rName, aSet, &GetSdrObject()->getSdrModelFromSdrObject() ) )
1309 {
1310 //GetSdrObject()->SetItemSetAndBroadcast(aSet);
1312
1313 return true;
1314 }
1315 }
1316
1317 return false;
1318}
1319
1320
1321bool SvxShape::SetFillAttribute( sal_uInt16 nWID, const OUString& rName, SfxItemSet& rSet, SdrModel const * pModel )
1322{
1323 // check if an item with the given name and which id is inside the models
1324 // pool or the stylesheet pool, if found it's put in the itemset
1325 if( !SetFillAttribute( nWID, rName, rSet ) )
1326 {
1327 // we did not find such item in one of the pools, so we check
1328 // the property lists that are loaded for the model for items
1329 // that support such.
1330 OUString aStrName = SvxUnogetInternalNameForItem(nWID, rName);
1331
1332 switch( nWID )
1333 {
1334 case XATTR_FILLBITMAP:
1335 {
1336 XBitmapListRef pBitmapList = pModel->GetBitmapList();
1337
1338 if( !pBitmapList.is() )
1339 return false;
1340
1341 tools::Long nPos = pBitmapList->GetIndex(aStrName);
1342 if( nPos == -1 )
1343 return false;
1344
1345 const XBitmapEntry* pEntry = pBitmapList->GetBitmap(nPos);
1346 XFillBitmapItem aBmpItem(rName, pEntry->GetGraphicObject());
1347 rSet.Put(aBmpItem);
1348 break;
1349 }
1350 case XATTR_FILLGRADIENT:
1351 {
1352 XGradientListRef pGradientList = pModel->GetGradientList();
1353
1354 if( !pGradientList.is() )
1355 return false;
1356
1357 tools::Long nPos = pGradientList->GetIndex(aStrName);
1358 if( nPos == -1 )
1359 return false;
1360
1361 const XGradientEntry* pEntry = pGradientList->GetGradient(nPos);
1362 XFillGradientItem aGrdItem(rName, pEntry->GetGradient());
1363 rSet.Put( aGrdItem );
1364 break;
1365 }
1366 case XATTR_FILLHATCH:
1367 {
1368 XHatchListRef pHatchList = pModel->GetHatchList();
1369
1370 if( !pHatchList.is() )
1371 return false;
1372
1373 tools::Long nPos = pHatchList->GetIndex(aStrName);
1374 if( nPos == -1 )
1375 return false;
1376
1377 const XHatchEntry* pEntry = pHatchList->GetHatch( nPos );
1378 XFillHatchItem aHatchItem(rName, pEntry->GetHatch());
1379 rSet.Put( aHatchItem );
1380 break;
1381 }
1382 case XATTR_LINEEND:
1383 case XATTR_LINESTART:
1384 {
1385 XLineEndListRef pLineEndList = pModel->GetLineEndList();
1386
1387 if( !pLineEndList.is() )
1388 return false;
1389
1390 tools::Long nPos = pLineEndList->GetIndex(aStrName);
1391 if( nPos == -1 )
1392 return false;
1393
1394 const XLineEndEntry* pEntry = pLineEndList->GetLineEnd(nPos);
1395 if( sal_uInt16(XATTR_LINEEND) == nWID )
1396 {
1397 XLineEndItem aLEItem(rName, pEntry->GetLineEnd());
1398 rSet.Put( aLEItem );
1399 }
1400 else
1401 {
1402 XLineStartItem aLSItem(rName, pEntry->GetLineEnd());
1403 rSet.Put( aLSItem );
1404 }
1405
1406 break;
1407 }
1408 case XATTR_LINEDASH:
1409 {
1410 XDashListRef pDashList = pModel->GetDashList();
1411
1412 if( !pDashList.is() )
1413 return false;
1414
1415 tools::Long nPos = pDashList->GetIndex(aStrName);
1416 if( nPos == -1 )
1417 return false;
1418
1419 const XDashEntry* pEntry = pDashList->GetDash(nPos);
1420 XLineDashItem aDashItem(rName, pEntry->GetDash());
1421 rSet.Put( aDashItem );
1422 break;
1423 }
1424 default:
1425 return false;
1426 }
1427 }
1428
1429 return true;
1430}
1431
1432
1433bool SvxShape::SetFillAttribute( sal_uInt16 nWID, const OUString& rName, SfxItemSet& rSet )
1434{
1435 OUString aName = SvxUnogetInternalNameForItem(nWID, rName);
1436
1437 if (aName.isEmpty())
1438 {
1439 switch( nWID )
1440 {
1441 case XATTR_LINEEND:
1442 case XATTR_LINESTART:
1443 {
1444 const basegfx::B2DPolyPolygon aEmptyPoly;
1445 if( nWID == sal_uInt16(XATTR_LINEEND) )
1446 rSet.Put( XLineEndItem( "", aEmptyPoly ) );
1447 else
1448 rSet.Put( XLineStartItem( "", aEmptyPoly ) );
1449
1450 return true;
1451 }
1453 {
1454 // #85953# Set a disabled XFillFloatTransparenceItem
1456
1457 return true;
1458 }
1459 }
1460
1461 return false;
1462 }
1463
1464 for (const SfxPoolItem* p : rSet.GetPool()->GetItemSurrogates(nWID))
1465 {
1466 const NameOrIndex* pItem = static_cast<const NameOrIndex*>(p);
1467 if( pItem->GetName() == aName )
1468 {
1469 rSet.Put( *pItem );
1470 return true;
1471 }
1472 }
1473
1474 return false;
1475}
1476
1477
1478void SAL_CALL SvxShape::setPropertyValue( const OUString& rPropertyName, const uno::Any& rVal )
1479{
1480 if( mpImpl->mpMaster )
1481 {
1482 mpImpl->mpMaster->setPropertyValue( rPropertyName, rVal );
1483 }
1484 else
1485 {
1486 _setPropertyValue( rPropertyName, rVal );
1487 }
1488}
1489
1490void SvxShape::_setPropertyValue( const OUString& rPropertyName, const uno::Any& rVal )
1491{
1492 ::SolarMutexGuard aGuard;
1493
1494 const SfxItemPropertyMapEntry* pMap = mpPropSet->getPropertyMapEntry(rPropertyName);
1495
1496 if (!HasSdrObject())
1497 {
1498 // Since we have no actual sdr object right now, remember all
1499 // properties in a list. These properties will be set when the sdr
1500 // object is created.
1501
1502 if (pMap && pMap->nWID)
1503 {
1504 // FIXME: We should throw a UnknownPropertyException here.
1505 // But since this class is aggregated from classes that
1506 // support additional properties that we don't know here we
1507 // silently store *all* properties, even if they may be not
1508 // supported after creation.
1510 }
1511
1512 return;
1513 }
1514
1515 if (rPropertyName == "HandlePathObjScale")
1516 {
1517 auto pPathObj = dynamic_cast<SdrPathObj*>(GetSdrObject());
1518 if (pPathObj)
1519 {
1520 bool bHandleScale{};
1521 if (rVal >>= bHandleScale)
1522 {
1523 pPathObj->SetHandleScale(bHandleScale);
1524 }
1525 }
1526 return;
1527 }
1528
1529 if (!pMap)
1530 {
1531 // reduce log noise by ignoring two properties that higher level code queries for on all objects
1532 SAL_WARN_IF(rPropertyName != "FromWordArt" && rPropertyName != "GraphicColorMode",
1533 "svx.uno", "Unknown Property: " << rPropertyName);
1534 throw beans::UnknownPropertyException( rPropertyName, getXWeak());
1535 }
1536
1537 if ((pMap->nFlags & beans::PropertyAttribute::READONLY) != 0)
1538 throw beans::PropertyVetoException(
1539 "Readonly property can't be set: " + rPropertyName,
1540 uno::Reference<drawing::XShape>(this));
1541
1543
1544 if (setPropertyValueImpl(rPropertyName, pMap, rVal))
1545 return;
1546
1547 DBG_ASSERT( pMap->nWID == SDRATTR_TEXTDIRECTION || pMap->nWID < SDRATTR_NOTPERSIST_FIRST || pMap->nWID > SDRATTR_NOTPERSIST_LAST, "Not persist item not handled!" );
1548 DBG_ASSERT( pMap->nWID < OWN_ATTR_VALUE_START || pMap->nWID > OWN_ATTR_VALUE_END, "Not item property not handled!" );
1549
1550 bool bIsNotPersist = pMap->nWID >= SDRATTR_NOTPERSIST_FIRST && pMap->nWID <= SDRATTR_NOTPERSIST_LAST && pMap->nWID != SDRATTR_TEXTDIRECTION;
1551
1552 if( pMap->nWID == SDRATTR_CORNER_RADIUS )
1553 {
1554 sal_Int32 nCornerRadius = 0;
1555 if( !(rVal >>= nCornerRadius) || (nCornerRadius < 0) || (nCornerRadius > 5000000))
1556 throw IllegalArgumentException();
1557 }
1558
1559 std::optional<SfxItemSet> xLocalSet;
1560 SfxItemSet* pSet;
1561 if( mbIsMultiPropertyCall && !bIsNotPersist )
1562 {
1563 if( !mpImpl->mxItemSet )
1564 {
1565 mpImpl->mxItemSet.emplace( GetSdrObject()->GetProperties().CreateObjectSpecificItemSet( GetSdrObject()->getSdrModelFromSdrObject().GetItemPool() ) );
1566 }
1567 pSet = &*mpImpl->mxItemSet;
1568 }
1569 else
1570 {
1571 xLocalSet.emplace( GetSdrObject()->getSdrModelFromSdrObject().GetItemPool(), pMap->nWID, pMap->nWID);
1572 pSet = &*xLocalSet;
1573 }
1574
1575 if( pSet->GetItemState( pMap->nWID ) != SfxItemState::SET )
1576 pSet->Put(GetSdrObject()->GetMergedItem(pMap->nWID));
1577
1578 if( !SvxUnoTextRangeBase::SetPropertyValueHelper( pMap, rVal, *pSet ))
1579 {
1580 if( pSet->GetItemState( pMap->nWID ) != SfxItemState::SET )
1581 {
1582 if(bIsNotPersist)
1583 {
1584 // not-persistent attribute, get those extra
1586 }
1587 }
1588
1589 if( pSet->GetItemState( pMap->nWID ) != SfxItemState::SET )
1590 {
1591 // get default from ItemPool
1592 if(SfxItemPool::IsWhich(pMap->nWID))
1593 pSet->Put(GetSdrObject()->getSdrModelFromSdrObject().GetItemPool().GetDefaultItem(pMap->nWID));
1594 }
1595
1596 if( pSet->GetItemState( pMap->nWID ) == SfxItemState::SET )
1597 {
1598 SvxItemPropertySet_setPropertyValue( pMap, rVal, *pSet );
1599 }
1600 }
1601
1602 if(bIsNotPersist)
1603 {
1604 // set not-persistent attribute extra
1606 }
1607 else
1608 {
1609 // if we have a XMultiProperty call then the item set
1610 // will be set in setPropertyValues later
1613 }
1614}
1615
1616
1617uno::Any SAL_CALL SvxShape::getPropertyValue( const OUString& PropertyName )
1618{
1619 if ( mpImpl->mpMaster )
1620 return mpImpl->mpMaster->getPropertyValue( PropertyName );
1621 else
1622 return _getPropertyValue( PropertyName );
1623}
1624
1625
1626uno::Any SvxShape::_getPropertyValue( const OUString& PropertyName )
1627{
1628 ::SolarMutexGuard aGuard;
1629
1630 const SfxItemPropertyMapEntry* pMap = mpPropSet->getPropertyMapEntry(PropertyName);
1631
1632 uno::Any aAny;
1633 if(HasSdrObject())
1634 {
1635 if(pMap == nullptr )
1636 throw beans::UnknownPropertyException( PropertyName, getXWeak());
1637
1638 if( !getPropertyValueImpl( PropertyName, pMap, aAny ) )
1639 {
1640 DBG_ASSERT( pMap->nWID == SDRATTR_TEXTDIRECTION || (pMap->nWID < SDRATTR_NOTPERSIST_FIRST || pMap->nWID > SDRATTR_NOTPERSIST_LAST), "Not persist item not handled!" );
1641 DBG_ASSERT( pMap->nWID < OWN_ATTR_VALUE_START || pMap->nWID > OWN_ATTR_VALUE_END, "Not item property not handled!" );
1642
1643 SfxItemSet aSet( GetSdrObject()->getSdrModelFromSdrObject().GetItemPool(), pMap->nWID, pMap->nWID );
1644 aSet.Put(GetSdrObject()->GetMergedItem(pMap->nWID));
1645
1646 if(SvxUnoTextRangeBase::GetPropertyValueHelper( aSet, pMap, aAny ))
1647 return aAny;
1648
1649 if(!aSet.Count())
1650 {
1652 {
1653 // not-persistent attribute, get those extra
1655 }
1656 }
1657
1658 if(!aSet.Count())
1659 {
1660 // get default from ItemPool
1661 if(SfxItemPool::IsWhich(pMap->nWID))
1662 aSet.Put(GetSdrObject()->getSdrModelFromSdrObject().GetItemPool().GetDefaultItem(pMap->nWID));
1663 }
1664
1665 if(aSet.Count())
1666 aAny = GetAnyForItem( aSet, pMap );
1667 }
1668 }
1669 else
1670 {
1671
1672// Fixme: we should return default values for OWN_ATTR !
1673
1674 if(pMap && pMap->nWID)
1675// FixMe: see setPropertyValue
1676 aAny = mpPropSet->getPropertyValue( pMap, maUrsAnys );
1677
1678 }
1679 return aAny;
1680}
1681
1682
1683// XMultiPropertySet
1684void SAL_CALL SvxShape::setPropertyValues( const css::uno::Sequence< OUString >& aPropertyNames, const css::uno::Sequence< css::uno::Any >& aValues )
1685{
1686 ::SolarMutexGuard aSolarGuard;
1687
1688 const sal_Int32 nCount = aPropertyNames.getLength();
1689 if (nCount != aValues.getLength())
1690 throw css::lang::IllegalArgumentException("lengths do not match",
1691 getXWeak(), -1);
1692
1693 const OUString* pNames = aPropertyNames.getConstArray();
1694 const uno::Any* pValues = aValues.getConstArray();
1695
1696 // make sure mbIsMultiPropertyCall and mpImpl->mpItemSet are
1697 // reset even when an exception is thrown
1698 const ::comphelper::ScopeGuard aGuard( [this] () { return this->endSetPropertyValues(); } );
1699
1700 mbIsMultiPropertyCall = true;
1701
1702 if( mpImpl->mpMaster )
1703 {
1704 for( sal_Int32 nIdx = 0; nIdx < nCount; nIdx++, pNames++, pValues++ )
1705 {
1706 try
1707 {
1708 setPropertyValue( *pNames, *pValues );
1709 }
1710 catch (beans::UnknownPropertyException&)
1711 {
1713 }
1714 catch (uno::Exception&)
1715 {
1717 }
1718 }
1719 }
1720 else
1721 {
1722 uno::Reference< beans::XPropertySet > xSet;
1724
1725 for( sal_Int32 nIdx = 0; nIdx < nCount; nIdx++, pNames++, pValues++ )
1726 {
1727 try
1728 {
1729 xSet->setPropertyValue( *pNames, *pValues );
1730 }
1731 catch (beans::UnknownPropertyException&)
1732 {
1734 }
1735 catch (uno::Exception&)
1736 {
1738 }
1739 }
1740 }
1741
1742 if( mpImpl->mxItemSet && HasSdrObject() )
1744}
1745
1746
1748{
1749 mbIsMultiPropertyCall = false;
1750 mpImpl->mxItemSet.reset();
1751}
1752
1753
1754css::uno::Sequence< css::uno::Any > SAL_CALL SvxShape::getPropertyValues( const css::uno::Sequence< OUString >& aPropertyNames )
1755{
1756 const sal_Int32 nCount = aPropertyNames.getLength();
1757 const OUString* pNames = aPropertyNames.getConstArray();
1758
1759 uno::Sequence< uno::Any > aRet( nCount );
1760 uno::Any* pValue = aRet.getArray();
1761
1762 if( mpImpl->mpMaster )
1763 {
1764 for( sal_Int32 nIdx = 0; nIdx < nCount; nIdx++, pValue++, pNames++ )
1765 {
1766 try
1767 {
1768 *pValue = getPropertyValue( *pNames );
1769 }
1770 catch( uno::Exception& )
1771 {
1772 OSL_FAIL( "SvxShape::getPropertyValues, unknown property asked" );
1773 }
1774 }
1775 }
1776 else
1777 {
1778 uno::Reference< beans::XPropertySet > xSet;
1780
1781 for( sal_Int32 nIdx = 0; nIdx < nCount; nIdx++, pValue++, pNames++ )
1782 {
1783 try
1784 {
1785 *pValue = xSet->getPropertyValue( *pNames );
1786 }
1787 catch( uno::Exception& )
1788 {
1789 OSL_FAIL( "SvxShape::getPropertyValues, unknown property asked" );
1790 }
1791 }
1792 }
1793
1794 return aRet;
1795}
1796
1797void SAL_CALL SvxShape::addPropertiesChangeListener( const css::uno::Sequence< OUString >& , const css::uno::Reference< css::beans::XPropertiesChangeListener >& )
1798{
1799}
1800
1801void SAL_CALL SvxShape::removePropertiesChangeListener( const css::uno::Reference< css::beans::XPropertiesChangeListener >& )
1802{
1803}
1804
1805void SAL_CALL SvxShape::firePropertiesChangeEvent( const css::uno::Sequence< OUString >& , const css::uno::Reference< css::beans::XPropertiesChangeListener >& )
1806{
1807}
1808
1809
1811{
1813 uno::Any aAny;
1814
1815 switch(pMap->nWID)
1816 {
1818 {
1819 if(const SdrAngleItem* pPoolItem = aSet.GetItemIfSet(SDRATTR_CIRCSTARTANGLE,false))
1820 {
1821 Degree100 nAngle = pPoolItem->GetValue();
1822 aAny <<= nAngle.get();
1823 }
1824 break;
1825 }
1826
1828 {
1829 if (const SdrAngleItem* pPoolItem = aSet.GetItemIfSet(SDRATTR_CIRCENDANGLE,false))
1830 {
1831 Degree100 nAngle = pPoolItem->GetValue();
1832 aAny <<= nAngle.get();
1833 }
1834 break;
1835 }
1836
1837 case SDRATTR_CIRCKIND:
1838 {
1839 if( GetSdrObject()->GetObjInventor() == SdrInventor::Default)
1840 {
1841 drawing::CircleKind eKind;
1842 switch(GetSdrObject()->GetObjIdentifier())
1843 {
1844 case SdrObjKind::CircleOrEllipse: // circle, ellipse
1845 eKind = drawing::CircleKind_FULL;
1846 break;
1847 case SdrObjKind::CircleCut: // segment of circle
1848 eKind = drawing::CircleKind_CUT;
1849 break;
1850 case SdrObjKind::CircleArc: // arc of circle
1851 eKind = drawing::CircleKind_ARC;
1852 break;
1853 case SdrObjKind::CircleSection: // sector
1854 eKind = drawing::CircleKind_SECTION;
1855 break;
1856 default:
1857 break;
1858 }
1859 aAny <<= eKind;
1860 }
1861 break;
1862 }
1863 default:
1864 {
1865 // get value from ItemSet
1866 aAny = SvxItemPropertySet_getPropertyValue( pMap, aSet );
1867
1868 if( pMap->aType != aAny.getValueType() )
1869 {
1870 // since the sfx uint16 item now exports a sal_Int32, we may have to fix this here
1871 if( ( pMap->aType == ::cppu::UnoType<sal_Int16>::get()) && aAny.getValueType() == ::cppu::UnoType<sal_Int32>::get() )
1872 {
1873 sal_Int32 nValue = 0;
1874 aAny >>= nValue;
1875 aAny <<= static_cast<sal_Int16>(nValue);
1876 }
1877 else
1878 {
1879 OSL_FAIL("SvxShape::GetAnyForItem() Returnvalue has wrong Type!" );
1880 }
1881 }
1882
1883 }
1884 }
1885
1886 return aAny;
1887}
1888
1889
1890// XPropertyState
1891beans::PropertyState SAL_CALL SvxShape::getPropertyState( const OUString& PropertyName )
1892{
1893 if( mpImpl->mpMaster )
1894 {
1895 return mpImpl->mpMaster->getPropertyState( PropertyName );
1896 }
1897 else
1898 {
1899 return _getPropertyState( PropertyName );
1900 }
1901}
1902
1903beans::PropertyState SvxShape::_getPropertyState( const OUString& PropertyName )
1904{
1905 ::SolarMutexGuard aGuard;
1906
1907 const SfxItemPropertyMapEntry* pMap = mpPropSet->getPropertyMapEntry(PropertyName);
1908
1909 if( !HasSdrObject() || pMap == nullptr )
1910 throw beans::UnknownPropertyException( PropertyName, getXWeak());
1911
1912 beans::PropertyState eState;
1913 if( !getPropertyStateImpl( pMap, eState ) )
1914 {
1916
1917 switch( rSet.GetItemState( pMap->nWID, false ) )
1918 {
1919 case SfxItemState::SET:
1920 eState = beans::PropertyState_DIRECT_VALUE;
1921 break;
1922 case SfxItemState::DEFAULT:
1923 eState = beans::PropertyState_DEFAULT_VALUE;
1924 break;
1925 default:
1926 eState = beans::PropertyState_AMBIGUOUS_VALUE;
1927 break;
1928 }
1929
1930 // if an item is set, this doesn't mean we want it :)
1931 if( beans::PropertyState_DIRECT_VALUE == eState )
1932 {
1933 switch( pMap->nWID )
1934 {
1935 // the following items are disabled by changing the
1936 // fill style or the line style. so there is no need
1937 // to export items without names which should be empty
1938 case XATTR_FILLBITMAP:
1939 case XATTR_FILLGRADIENT:
1940 case XATTR_FILLHATCH:
1941 case XATTR_LINEDASH:
1942 {
1943 const NameOrIndex* pItem = rSet.GetItem<NameOrIndex>(pMap->nWID);
1944 if( ( pItem == nullptr ) || pItem->GetName().isEmpty() )
1945 eState = beans::PropertyState_DEFAULT_VALUE;
1946 }
1947 break;
1948
1949 // #i36115#
1950 // If e.g. the LineStart is on NONE and thus the string has length 0, it still
1951 // may be a hard attribute covering the set LineStart of the parent (Style).
1952 // #i37644#
1953 // same is for fill float transparency
1954 case XATTR_LINEEND:
1955 case XATTR_LINESTART:
1957 {
1958 const NameOrIndex* pItem = rSet.GetItem<NameOrIndex>(pMap->nWID);
1959 if ( pItem == nullptr )
1960 eState = beans::PropertyState_DEFAULT_VALUE;
1961 }
1962 break;
1963 case XATTR_FILLCOLOR:
1964 if (pMap->nMemberId == MID_COLOR_THEME_INDEX)
1965 {
1966 const XFillColorItem* pColor = rSet.GetItem<XFillColorItem>(pMap->nWID);
1969 {
1970 eState = beans::PropertyState_DEFAULT_VALUE;
1971 }
1972 }
1973 else if (pMap->nMemberId == MID_COLOR_LUM_MOD)
1974 {
1975 const XFillColorItem* pColor = rSet.GetItem<XFillColorItem>(pMap->nWID);
1976 sal_Int16 nLumMod = 10000;
1977 for (auto const& rTransform : pColor->getComplexColor().getTransformations())
1978 {
1979 if (rTransform.meType == model::TransformationType::LumMod)
1980 nLumMod = rTransform.mnValue;
1981 }
1982 if (nLumMod == 10000)
1983 {
1984 eState = beans::PropertyState_DEFAULT_VALUE;
1985 }
1986 }
1987 else if (pMap->nMemberId == MID_COLOR_LUM_OFF)
1988 {
1989 const XFillColorItem* pColor = rSet.GetItem<XFillColorItem>(pMap->nWID);
1990 sal_Int16 nLumOff = 0;
1991 for (auto const& rTransform : pColor->getComplexColor().getTransformations())
1992 {
1993 if (rTransform.meType == model::TransformationType::LumOff)
1994 nLumOff = rTransform.mnValue;
1995 }
1996 if (nLumOff == 0)
1997 {
1998 eState = beans::PropertyState_DEFAULT_VALUE;
1999 }
2000 }
2001 else if (pMap->nMemberId == MID_COMPLEX_COLOR)
2002 {
2003 auto const* pColor = rSet.GetItem<XFillColorItem>(pMap->nWID);
2004 if (pColor->getComplexColor().getType() == model::ColorType::Unused)
2005 {
2006 eState = beans::PropertyState_DEFAULT_VALUE;
2007 }
2008 }
2009 break;
2010 case XATTR_LINECOLOR:
2011 if (pMap->nMemberId == MID_COMPLEX_COLOR)
2012 {
2013 auto const* pColor = rSet.GetItem<XLineColorItem>(pMap->nWID);
2014 if (pColor->getComplexColor().getType() == model::ColorType::Unused)
2015 {
2016 eState = beans::PropertyState_DEFAULT_VALUE;
2017 }
2018 }
2019 break;
2020 }
2021 }
2022 }
2023 return eState;
2024}
2025
2026bool SvxShape::setPropertyValueImpl( const OUString&, const SfxItemPropertyMapEntry* pProperty, const css::uno::Any& rValue )
2027{
2029 switch( pProperty->nWID )
2030 {
2032 {
2033 awt::Point aPnt;
2034 if( rValue >>= aPnt )
2035 {
2036 Point aVclPoint( aPnt.X, aPnt.Y );
2037
2038 // tdf#117145 metric of SdrModel is app-specific, metric of UNO API is 100thmm
2039 // Need to adapt aVclPoint from 100thmm to app-specific
2040 ForceMetricToItemPoolMetric(aVclPoint);
2041
2042 // #90763# position is relative to top left, make it absolute
2043 basegfx::B2DPolyPolygon aNewPolyPolygon;
2044 basegfx::B2DHomMatrix aNewHomogenMatrix;
2045 pSdrObject->TRGetBaseGeometry(aNewHomogenMatrix, aNewPolyPolygon);
2046
2047 aVclPoint.AdjustX(basegfx::fround(aNewHomogenMatrix.get(0, 2)) );
2048 aVclPoint.AdjustY(basegfx::fround(aNewHomogenMatrix.get(1, 2)) );
2049
2050 // #88491# position relative to anchor
2051 if( pSdrObject->getSdrModelFromSdrObject().IsWriter() )
2052 {
2053 aVclPoint += pSdrObject->GetAnchorPos();
2054 }
2055
2056 static_cast<SdrCaptionObj*>(pSdrObject.get())->SetTailPos(aVclPoint);
2057
2058 return true;
2059 }
2060 break;
2061 }
2063 {
2064 drawing::HomogenMatrix3 aMatrix;
2065 if(rValue >>= aMatrix)
2066 {
2067 basegfx::B2DPolyPolygon aNewPolyPolygon;
2068 basegfx::B2DHomMatrix aNewHomogenMatrix;
2069
2070 // tdf#117145 SdrModel data is app-specific
2071 pSdrObject->TRGetBaseGeometry(aNewHomogenMatrix, aNewPolyPolygon);
2072
2073 aNewHomogenMatrix.set(0, 0, aMatrix.Line1.Column1);
2074 aNewHomogenMatrix.set(0, 1, aMatrix.Line1.Column2);
2075 aNewHomogenMatrix.set(0, 2, aMatrix.Line1.Column3);
2076 aNewHomogenMatrix.set(1, 0, aMatrix.Line2.Column1);
2077 aNewHomogenMatrix.set(1, 1, aMatrix.Line2.Column2);
2078 aNewHomogenMatrix.set(1, 2, aMatrix.Line2.Column3);
2079 // For this to be a valid 2D transform matrix, the last row must be [0,0,1]
2080 assert( aMatrix.Line3.Column1 == 0 );
2081 assert( aMatrix.Line3.Column2 == 0 );
2082 assert( aMatrix.Line3.Column3 == 1 );
2083
2084 // tdf#117145 metric of SdrModel is app-specific, metric of UNO API is 100thmm
2085 // Need to adapt aNewHomogenMatrix from 100thmm to app-specific
2086 ForceMetricToItemPoolMetric(aNewHomogenMatrix);
2087
2088 pSdrObject->TRSetBaseGeometry(aNewHomogenMatrix, aNewPolyPolygon);
2089 return true;
2090 }
2091 break;
2092 }
2093
2094 case OWN_ATTR_ZORDER:
2095 {
2096 sal_Int32 nNewOrdNum = 0;
2097 if(rValue >>= nNewOrdNum)
2098 {
2099 SdrObjList* pObjList = pSdrObject->getParentSdrObjListFromSdrObject();
2100 if( pObjList )
2101 pObjList->SetExistingObjectOrdNum( pSdrObject.get(), static_cast<size_t>(nNewOrdNum) );
2102 return true;
2103 }
2104 break;
2105 }
2106 case OWN_ATTR_FRAMERECT:
2107 {
2108 awt::Rectangle aUnoRect;
2109 if(rValue >>= aUnoRect)
2110 {
2111 Point aTopLeft( aUnoRect.X, aUnoRect.Y );
2112 Size aObjSize( aUnoRect.Width, aUnoRect.Height );
2115 tools::Rectangle aRect(aTopLeft, aObjSize);
2116 pSdrObject->SetSnapRect(aRect);
2117 return true;
2118 }
2119 break;
2120 }
2121 case OWN_ATTR_MIRRORED:
2122 {
2123 bool bMirror;
2124 if(rValue >>= bMirror )
2125 {
2126 SdrGrafObj* pObj = dynamic_cast< SdrGrafObj* >( pSdrObject.get() );
2127 if( pObj )
2128 pObj->SetMirrored(bMirror);
2129 return true;
2130 }
2131 break;
2132 }
2140 {
2141 SdrEdgeObj* pEdgeObj = dynamic_cast< SdrEdgeObj* >(pSdrObject.get());
2142 if(pEdgeObj)
2143 {
2144 switch(pProperty->nWID)
2145 {
2148 {
2149 Reference< drawing::XShape > xShape;
2150 if( rValue >>= xShape )
2151 {
2153 if( pNode )
2154 {
2155 pEdgeObj->ConnectToNode( pProperty->nWID == OWN_ATTR_EDGE_START_OBJ, pNode );
2156 pEdgeObj->setGluePointIndex( pProperty->nWID == OWN_ATTR_EDGE_START_OBJ );
2157 return true;
2158 }
2159 }
2160 break;
2161 }
2162
2165 {
2166 awt::Point aUnoPoint;
2167 if( rValue >>= aUnoPoint )
2168 {
2169 Point aPoint( aUnoPoint.X, aUnoPoint.Y );
2170
2171 // Reintroduction of fix for issue i59051 (#i108851#)
2172 // perform metric change before applying anchor position,
2173 // because the anchor position is in pool metric.
2175 if( pSdrObject->getSdrModelFromSdrObject().IsWriter() )
2176 aPoint += pSdrObject->GetAnchorPos();
2177
2178 pEdgeObj->SetTailPoint( pProperty->nWID == OWN_ATTR_EDGE_START_POS, aPoint );
2179 return true;
2180 }
2181 break;
2182 }
2183
2186 {
2187 sal_Int32 nId = 0;
2188 if( rValue >>= nId )
2189 {
2190 pEdgeObj->setGluePointIndex( pProperty->nWID == OWN_ATTR_GLUEID_HEAD, nId );
2191 return true;
2192 }
2193 break;
2194 }
2196 {
2197 basegfx::B2DPolyPolygon aNewPolyPolygon;
2198
2199 // #123616# be a little bit more flexible regarding the data type used
2200 if( auto s = o3tl::tryAccess<drawing::PointSequenceSequence>(rValue) )
2201 {
2202 // get polygpon data from PointSequenceSequence
2204 *s);
2205 }
2206 else if( auto cs = o3tl::tryAccess<drawing::PolyPolygonBezierCoords>(rValue) )
2207 {
2208 // get polygpon data from PolyPolygonBezierCoords
2210 *cs);
2211 }
2212
2213 if(aNewPolyPolygon.count())
2214 {
2215 // Reintroduction of fix for issue i59051 (#i108851#)
2216 ForceMetricToItemPoolMetric( aNewPolyPolygon );
2217 if( pSdrObject->getSdrModelFromSdrObject().IsWriter() )
2218 {
2219 Point aPoint( pSdrObject->GetAnchorPos() );
2220 aNewPolyPolygon.transform(basegfx::utils::createTranslateB2DHomMatrix(aPoint.X(), aPoint.Y()));
2221 }
2222 pEdgeObj->SetEdgeTrackPath( aNewPolyPolygon );
2223 return true;
2224 }
2225 }
2226 }
2227 }
2228 break;
2229 }
2232 {
2233 SdrMeasureObj* pMeasureObj = dynamic_cast< SdrMeasureObj* >(pSdrObject.get());
2234 awt::Point aUnoPoint;
2235 if(pMeasureObj && ( rValue >>= aUnoPoint ) )
2236 {
2237 Point aPoint( aUnoPoint.X, aUnoPoint.Y );
2238
2239 // Reintroduction of fix for issue #i59051# (#i108851#)
2241 if( pSdrObject->getSdrModelFromSdrObject().IsWriter() )
2242 aPoint += pSdrObject->GetAnchorPos();
2243
2244 pMeasureObj->NbcSetPoint( aPoint, pProperty->nWID == OWN_ATTR_MEASURE_START_POS ? 0 : 1 );
2245 pMeasureObj->SetChanged();
2246 pMeasureObj->BroadcastObjectChange();
2247 return true;
2248 }
2249 break;
2250 }
2252 {
2253 drawing::BitmapMode eMode;
2254 if(!(rValue >>= eMode) )
2255 {
2256 sal_Int32 nMode = 0;
2257 if(!(rValue >>= nMode))
2258 break;
2259
2260 eMode = static_cast<drawing::BitmapMode>(nMode);
2261 }
2262 pSdrObject->SetMergedItem( XFillBmpStretchItem( eMode == drawing::BitmapMode_STRETCH ) );
2263 pSdrObject->SetMergedItem( XFillBmpTileItem( eMode == drawing::BitmapMode_REPEAT ) );
2264 return true;
2265 }
2266
2267 case SDRATTR_LAYERID:
2268 {
2269 sal_Int16 nLayerId = sal_Int16();
2270 if( rValue >>= nLayerId )
2271 {
2272 SdrLayer* pLayer = pSdrObject->getSdrModelFromSdrObject().GetLayerAdmin().GetLayerPerID(SdrLayerID(nLayerId));
2273 if( pLayer )
2274 {
2275 pSdrObject->SetLayer(SdrLayerID(nLayerId));
2276 return true;
2277 }
2278 }
2279 break;
2280 }
2281
2282 case SDRATTR_LAYERNAME:
2283 {
2284 OUString aLayerName;
2285 if( rValue >>= aLayerName )
2286 {
2287 const SdrLayer* pLayer = pSdrObject->getSdrModelFromSdrObject().GetLayerAdmin().GetLayer(aLayerName);
2288 if( pLayer != nullptr )
2289 {
2290 pSdrObject->SetLayer( pLayer->GetID() );
2291 return true;
2292 }
2293 }
2294 break;
2295 }
2297 {
2298 sal_Int32 nTmp = 0;
2299 if( rValue >>= nTmp )
2300 {
2301 Degree100 nAngle(nTmp);
2302 Point aRef1(pSdrObject->GetSnapRect().Center());
2303 nAngle -= pSdrObject->GetRotateAngle();
2304 if (nAngle)
2305 {
2306 double nSin = sin(toRadians(nAngle));
2307 double nCos = cos(toRadians(nAngle));
2308 pSdrObject->Rotate(aRef1,nAngle,nSin,nCos);
2309 }
2310 return true;
2311 }
2312
2313 break;
2314 }
2315
2316 case SDRATTR_SHEARANGLE:
2317 {
2318 sal_Int32 nTmp = 0;
2319 if( rValue >>= nTmp )
2320 {
2321 Degree100 nShear(nTmp);
2322 nShear -= pSdrObject->GetShearAngle();
2323 if(nShear)
2324 {
2325 Point aRef1(pSdrObject->GetSnapRect().Center());
2326 double nTan = tan(toRadians(nShear));
2327 pSdrObject->Shear(aRef1,nShear,nTan,false);
2328 return true;
2329 }
2330 }
2331
2332 break;
2333 }
2334
2336 {
2337 pSdrObject->SetGrabBagItem(rValue);
2338 return true;
2339 }
2340
2342 {
2343 bool bMoveProtect;
2344 if( rValue >>= bMoveProtect )
2345 {
2346 pSdrObject->SetMoveProtect(bMoveProtect);
2347 return true;
2348 }
2349 break;
2350 }
2351 case SDRATTR_OBJECTNAME:
2352 {
2353 OUString aName;
2354 if( rValue >>= aName )
2355 {
2356 pSdrObject->SetName( aName );
2357 return true;
2358 }
2359 break;
2360 }
2361
2363 {
2364 double nMaxScale = 0.0;
2365 if (rValue >>= nMaxScale)
2366 {
2367 SdrTextFitToSizeTypeItem aItem(pSdrObject->GetMergedItem(SDRATTR_TEXT_FITTOSIZE));
2368 aItem.SetMaxScale(nMaxScale);
2369 pSdrObject->SetMergedItem(aItem);
2370 return true;
2371 }
2372 break;
2373 }
2374
2375 // #i68101#
2377 {
2378 OUString aTitle;
2379 if( rValue >>= aTitle )
2380 {
2381 pSdrObject->SetTitle( aTitle );
2382 return true;
2383 }
2384 break;
2385 }
2387 {
2388 OUString aDescription;
2389 if( rValue >>= aDescription )
2390 {
2391 pSdrObject->SetDescription( aDescription );
2392 return true;
2393 }
2394 break;
2395 }
2397 {
2398 bool isDecorative;
2399 if (rValue >>= isDecorative)
2400 {
2401 pSdrObject->SetDecorative(isDecorative);
2402 return true;
2403 }
2404 break;
2405 }
2406
2408 {
2409 bool bPrintable;
2410 if( rValue >>= bPrintable )
2411 {
2412 pSdrObject->SetPrintable(bPrintable);
2413 return true;
2414 }
2415 break;
2416 }
2417 case SDRATTR_OBJVISIBLE:
2418 {
2419 bool bVisible;
2420 if( rValue >>= bVisible )
2421 {
2422 pSdrObject->SetVisible(bVisible);
2423 return true;
2424 }
2425 break;
2426 }
2428 {
2429 bool bResizeProtect;
2430 if( rValue >>= bResizeProtect )
2431 {
2432 pSdrObject->SetResizeProtect(bResizeProtect);
2433 return true;
2434 }
2435 break;
2436 }
2438 {
2439 sal_Int32 nPageNum = 0;
2440 if( (rValue >>= nPageNum) && ( nPageNum >= 0 ) && ( nPageNum <= 0xffff ) )
2441 {
2442 SdrPageObj* pPageObj = dynamic_cast< SdrPageObj* >(pSdrObject.get());
2443 if( pPageObj )
2444 {
2445 SdrModel& rModel(pPageObj->getSdrModelFromSdrObject());
2446 SdrPage* pNewPage = nullptr;
2447 const sal_uInt16 nDestinationPageNum(static_cast<sal_uInt16>((nPageNum << 1) - 1));
2448
2449 if(nDestinationPageNum < rModel.GetPageCount())
2450 {
2451 pNewPage = rModel.GetPage(nDestinationPageNum);
2452 }
2453
2454 pPageObj->SetReferencedPage(pNewPage);
2455 }
2456
2457 return true;
2458 }
2459 break;
2460 }
2461 case XATTR_FILLBITMAP:
2462 case XATTR_FILLGRADIENT:
2463 case XATTR_FILLHATCH:
2465 case XATTR_LINEEND:
2466 case XATTR_LINESTART:
2467 case XATTR_LINEDASH:
2468 {
2469 if( pProperty->nMemberId == MID_NAME )
2470 {
2471 OUString aApiName;
2472 if( rValue >>= aApiName )
2473 {
2474 if( SetFillAttribute( pProperty->nWID, aApiName ) )
2475 return true;
2476 }
2477 break;
2478 }
2479 else
2480 {
2481 return false;
2482 }
2483 }
2484
2486 {
2487 if (auto pTextObj = DynCastSdrTextObj(pSdrObject.get()))
2488 {
2489 css::uno::Reference<css::text::XTextColumns> xTextColumns;
2490 if (rValue >>= xTextColumns)
2491 {
2492 pTextObj->SetTextColumnsNumber(xTextColumns->getColumnCount());
2493 if (css::uno::Reference<css::beans::XPropertySet> xPropSet{ xTextColumns,
2494 css::uno::UNO_QUERY })
2495 {
2496 auto aVal = xPropSet->getPropertyValue("AutomaticDistance");
2497 if (sal_Int32 nSpacing; aVal >>= nSpacing)
2498 pTextObj->SetTextColumnsSpacing(nSpacing);
2499 }
2500 }
2501 }
2502 return true;
2503 }
2504
2505 case OWN_ATTR_HYPERLINK:
2506 {
2507 OUString sHyperlink;
2508 if (rValue >>= sHyperlink)
2509 {
2510 pSdrObject->setHyperlink(sHyperlink);
2511 return true;
2512 }
2513 break;
2514 }
2515
2517 {
2518 SvxFrameDirectionItem aItem(SvxFrameDirection::Environment, SDRATTR_WRITINGMODE2);
2519 aItem.PutValue(rValue, 0);
2520 GetSdrObject()->SetMergedItem(aItem);
2521 return true;
2522 break;
2523 }
2524
2525 default:
2526 {
2527 return false;
2528 }
2529 }
2530
2531 OUString sExceptionMessage(
2532 "IllegalArgumentException in SvxShape::setPropertyValueImpl."
2533 " Property Type: "
2534 + pProperty->aType.getTypeName() + " Property Name: " + pProperty->aName
2535 + " Property nWID: " + OUString::number(pProperty->nWID)
2536 + " Value Type: " + (rValue.hasValue() ? rValue.getValueTypeName() : "void (no value)"));
2537
2538 throw lang::IllegalArgumentException(sExceptionMessage, nullptr, 1);
2539}
2540
2541
2542bool SvxShape::getPropertyValueImpl( const OUString&, const SfxItemPropertyMapEntry* pProperty, css::uno::Any& rValue )
2543{
2544 switch( pProperty->nWID )
2545 {
2547 {
2548 Point aVclPoint = static_cast<SdrCaptionObj*>(GetSdrObject())->GetTailPos();
2549
2550 // #88491# make pos relative to anchor
2552 {
2553 aVclPoint -= GetSdrObject()->GetAnchorPos();
2554 }
2555
2556 // #90763# pos is absolute, make it relative to top left
2557 basegfx::B2DPolyPolygon aNewPolyPolygon;
2558 basegfx::B2DHomMatrix aNewHomogenMatrix;
2559 GetSdrObject()->TRGetBaseGeometry(aNewHomogenMatrix, aNewPolyPolygon);
2560
2561 aVclPoint.AdjustX( -(basegfx::fround(aNewHomogenMatrix.get(0, 2))) );
2562 aVclPoint.AdjustY( -(basegfx::fround(aNewHomogenMatrix.get(1, 2))) );
2563
2564 // tdf#117145 metric of SdrModel is app-specific, metric of UNO API is 100thmm
2565 // Need to adapt aVclPoint from app-specific to 100thmm
2566 ForceMetricTo100th_mm(aVclPoint);
2567
2568 awt::Point aPnt( aVclPoint.X(), aVclPoint.Y() );
2569 rValue <<= aPnt;
2570 break;
2571 }
2572
2574 {
2575 basegfx::B2DPolyPolygon aNewPolyPolygon;
2576 basegfx::B2DHomMatrix aNewHomogenMatrix;
2577 GetSdrObject()->TRGetBaseGeometry(aNewHomogenMatrix, aNewPolyPolygon);
2578 drawing::HomogenMatrix3 aMatrix;
2579
2580 // tdf#117145 metric of SdrModel is app-specific, metric of UNO API is 100thmm
2581 // Need to adapt aNewHomogenMatrix from app-specific to 100thmm
2582 ForceMetricTo100th_mm(aNewHomogenMatrix);
2583
2584 aMatrix.Line1.Column1 = aNewHomogenMatrix.get(0, 0);
2585 aMatrix.Line1.Column2 = aNewHomogenMatrix.get(0, 1);
2586 aMatrix.Line1.Column3 = aNewHomogenMatrix.get(0, 2);
2587 aMatrix.Line2.Column1 = aNewHomogenMatrix.get(1, 0);
2588 aMatrix.Line2.Column2 = aNewHomogenMatrix.get(1, 1);
2589 aMatrix.Line2.Column3 = aNewHomogenMatrix.get(1, 2);
2590 aMatrix.Line3.Column1 = 0;
2591 aMatrix.Line3.Column2 = 0;
2592 aMatrix.Line3.Column3 = 1;
2593
2594 rValue <<= aMatrix;
2595
2596 break;
2597 }
2598
2599 case OWN_ATTR_ZORDER:
2600 {
2601 rValue <<= static_cast<sal_Int32>(GetSdrObject()->GetOrdNum());
2602 break;
2603 }
2604
2605 case OWN_ATTR_BITMAP:
2606 {
2607 rValue = GetBitmap();
2608 if(!rValue.hasValue())
2609 throw uno::RuntimeException();
2610
2611 break;
2612 }
2613
2615 {
2616 bool bIsFontwork = false;
2617 if (const SdrTextObj* pTextObj = DynCastSdrTextObj(GetSdrObject()))
2618 bIsFontwork = pTextObj->IsFontwork();
2619 rValue <<= bIsFontwork;
2620 break;
2621 }
2622
2623 case OWN_ATTR_FRAMERECT:
2624 {
2625 tools::Rectangle aRect( GetSdrObject()->GetSnapRect() );
2626 Point aTopLeft( aRect.TopLeft() );
2627 Size aObjSize( aRect.GetWidth(), aRect.GetHeight() );
2628 ForceMetricTo100th_mm(aTopLeft);
2629 ForceMetricTo100th_mm(aObjSize);
2630 css::awt::Rectangle aUnoRect(
2631 aTopLeft.X(), aTopLeft.Y(),
2632 aObjSize.getWidth(), aObjSize.getHeight() );
2633 rValue <<= aUnoRect;
2634 break;
2635 }
2636
2637 case OWN_ATTR_BOUNDRECT:
2638 {
2639 tools::Rectangle aRect( GetSdrObject()->GetCurrentBoundRect() );
2640 Point aTopLeft( aRect.TopLeft() );
2641 Size aObjSize( aRect.GetWidth(), aRect.GetHeight() );
2642 ForceMetricTo100th_mm(aTopLeft);
2643 ForceMetricTo100th_mm(aObjSize);
2644 css::awt::Rectangle aUnoRect(
2645 aTopLeft.X(), aTopLeft.Y(),
2646 aObjSize.getWidth(), aObjSize.getHeight() );
2647 rValue <<= aUnoRect;
2648 break;
2649 }
2650
2651 case OWN_ATTR_LDNAME:
2652 {
2653 OUString aName( GetSdrObject()->GetName() );
2654 rValue <<= aName;
2655 break;
2656 }
2657
2658 case OWN_ATTR_LDBITMAP:
2659 {
2660 OUString sId;
2661 if( GetSdrObject()->GetObjInventor() == SdrInventor::Default && GetSdrObject()->GetObjIdentifier() == SdrObjKind::OLE2 )
2662 {
2663 sId = RID_UNODRAW_OLE2;
2664 }
2665 else if( GetSdrObject()->GetObjInventor() == SdrInventor::Default && GetSdrObject()->GetObjIdentifier() == SdrObjKind::Graphic )
2666 {
2667 sId = RID_UNODRAW_GRAPHICS;
2668 }
2669 else
2670 {
2671 sId = RID_UNODRAW_OBJECTS;
2672 }
2673
2674 BitmapEx aBmp(sId);
2675 Reference<awt::XBitmap> xBmp(VCLUnoHelper::CreateBitmap(aBmp));
2676
2677 rValue <<= xBmp;
2678 break;
2679 }
2680
2681 case OWN_ATTR_MIRRORED:
2682 {
2683 bool bMirror = false;
2684 if( HasSdrObject() )
2685 if (auto pGrafObj = dynamic_cast<SdrGrafObj*>(GetSdrObject()) )
2686 bMirror = pGrafObj->IsMirrored();
2687
2688 rValue <<= bMirror;
2689 break;
2690 }
2691
2699 {
2700 SdrEdgeObj* pEdgeObj = dynamic_cast<SdrEdgeObj*>(GetSdrObject());
2701 if(pEdgeObj)
2702 {
2703 switch(pProperty->nWID)
2704 {
2707 {
2708 SdrObject* pNode = pEdgeObj->GetConnectedNode(pProperty->nWID == OWN_ATTR_EDGE_START_OBJ);
2709 if(pNode)
2710 {
2711 Reference< drawing::XShape > xShape( GetXShapeForSdrObject( pNode ) );
2712 if(xShape.is())
2713 rValue <<= xShape;
2714
2715 }
2716 break;
2717 }
2718
2721 {
2722 Point aPoint( pEdgeObj->GetTailPoint( pProperty->nWID == OWN_ATTR_EDGE_START_POS ) );
2723 if( GetSdrObject()->getSdrModelFromSdrObject().IsWriter() )
2724 aPoint -= GetSdrObject()->GetAnchorPos();
2725
2726 ForceMetricTo100th_mm( aPoint );
2727 awt::Point aUnoPoint( aPoint.X(), aPoint.Y() );
2728
2729 rValue <<= aUnoPoint;
2730 break;
2731 }
2734 {
2735 rValue <<= pEdgeObj->getGluePointIndex( pProperty->nWID == OWN_ATTR_GLUEID_HEAD );
2736 break;
2737 }
2739 {
2740 basegfx::B2DPolyPolygon aPolyPoly( pEdgeObj->GetEdgeTrackPath() );
2741 if( GetSdrObject()->getSdrModelFromSdrObject().IsWriter() )
2742 {
2743 Point aPoint( GetSdrObject()->GetAnchorPos() );
2744 aPolyPoly.transform(basegfx::utils::createTranslateB2DHomMatrix(-aPoint.X(), -aPoint.Y()));
2745 }
2746 // Reintroduction of fix for issue #i59051# (#i108851#)
2747 ForceMetricTo100th_mm( aPolyPoly );
2748 drawing::PolyPolygonBezierCoords aRetval;
2750 rValue <<= aRetval;
2751 break;
2752 }
2753 }
2754 }
2755 break;
2756 }
2757
2760 {
2761 SdrMeasureObj* pMeasureObj = dynamic_cast<SdrMeasureObj*>(GetSdrObject());
2762 if(pMeasureObj)
2763 {
2764 Point aPoint( pMeasureObj->GetPoint( pProperty->nWID == OWN_ATTR_MEASURE_START_POS ? 0 : 1 ) );
2765 if( GetSdrObject()->getSdrModelFromSdrObject().IsWriter() )
2766 aPoint -= GetSdrObject()->GetAnchorPos();
2767
2768 // Reintroduction of fix for issue #i59051# (#i108851#)
2769 ForceMetricTo100th_mm( aPoint );
2770 awt::Point aUnoPoint( aPoint.X(), aPoint.Y() );
2771
2772 rValue <<= aUnoPoint;
2773 break;
2774 }
2775 break;
2776 }
2777
2779 {
2780 const SfxItemSet& rObjItemSet = GetSdrObject()->GetMergedItemSet();
2781
2782 if (rObjItemSet.Get(XATTR_FILLBMP_TILE).GetValue())
2783 {
2784 rValue <<= drawing::BitmapMode_REPEAT;
2785 }
2786 else if (rObjItemSet.Get(XATTR_FILLBMP_STRETCH).GetValue())
2787 {
2788 rValue <<= drawing::BitmapMode_STRETCH;
2789 }
2790 else
2791 {
2792 rValue <<= drawing::BitmapMode_NO_REPEAT;
2793 }
2794 break;
2795 }
2796 case SDRATTR_LAYERID:
2797 rValue <<= GetSdrObject()->GetLayer().get();
2798 break;
2799
2800 case SDRATTR_LAYERNAME:
2801 {
2803 if( pLayer )
2804 {
2805 rValue <<= pLayer->GetName();
2806 }
2807 break;
2808 }
2809
2811 rValue <<= static_cast<sal_Int32>(GetSdrObject()->GetRotateAngle());
2812 break;
2813
2814 case SDRATTR_SHEARANGLE:
2815 rValue <<= static_cast<sal_Int32>(GetSdrObject()->GetShearAngle());
2816 break;
2817
2819 {
2820 GetSdrObject()->GetGrabBagItem(rValue);
2821 break;
2822 }
2823
2825 rValue <<= GetSdrObject()->IsMoveProtect();
2826 break;
2827
2828 case SDRATTR_OBJECTNAME:
2829 {
2830 OUString aName( GetSdrObject()->GetName() );
2831 rValue <<= aName;
2832 break;
2833 }
2834
2835 // #i68101#
2837 {
2838 OUString aTitle( GetSdrObject()->GetTitle() );
2839 rValue <<= aTitle;
2840 break;
2841 }
2842
2844 {
2845 OUString aDescription( GetSdrObject()->GetDescription() );
2846 rValue <<= aDescription;
2847 break;
2848 }
2849
2851 {
2852 bool const isDecorative(GetSdrObject()->IsDecorative());
2853 rValue <<= isDecorative;
2854 break;
2855 }
2856
2858 rValue <<= GetSdrObject()->IsPrintable();
2859 break;
2860
2861 case SDRATTR_OBJVISIBLE:
2862 rValue <<= GetSdrObject()->IsVisible();
2863 break;
2864
2866 rValue <<= GetSdrObject()->IsResizeProtect();
2867 break;
2868
2870 {
2871 SdrPageObj* pPageObj = dynamic_cast<SdrPageObj*>(GetSdrObject());
2872 if(pPageObj)
2873 {
2874 SdrPage* pPage = pPageObj->GetReferencedPage();
2875 sal_Int32 nPageNumber = pPage ? pPage->GetPageNum() : 0;
2876 nPageNumber++;
2877 nPageNumber >>= 1;
2878 rValue <<= nPageNumber;
2879 }
2880 break;
2881 }
2882
2884 {
2885 rValue <<= GetSdrObject()->TakeObjNameSingul();
2886 break;
2887 }
2888
2890 {
2891 double nScale = GetTextFitToSizeScale(GetSdrObject());
2892 rValue <<= nScale;
2893 break;
2894 }
2895
2897 {
2898 rValue <<= GetSdrObject()->TakeObjNamePlural();
2899 break;
2900 }
2901 case OWN_ATTR_METAFILE:
2902 {
2903 SdrOle2Obj* pObj = dynamic_cast<SdrOle2Obj*>(GetSdrObject());
2904 if( pObj )
2905 {
2906 const Graphic* pGraphic = pObj->GetGraphic();
2907 if( pGraphic )
2908 {
2909 bool bIsWMF = false;
2910 if ( pGraphic->IsGfxLink() )
2911 {
2912 GfxLink aLnk = pGraphic->GetGfxLink();
2913 if ( aLnk.GetType() == GfxLinkType::NativeWmf )
2914 {
2915 bIsWMF = true;
2916 uno::Sequence<sal_Int8> aSeq(reinterpret_cast<sal_Int8 const *>(aLnk.GetData()), static_cast<sal_Int32>(aLnk.GetDataSize()));
2917 rValue <<= aSeq;
2918 }
2919 }
2920 if ( !bIsWMF )
2921 {
2922 // #119735# just use GetGDIMetaFile, it will create a buffered version of contained bitmap now automatically
2923 GDIMetaFile aMtf(pObj->GetGraphic()->GetGDIMetaFile());
2924 SvMemoryStream aDestStrm( 65535, 65535 );
2925 ConvertGDIMetaFileToWMF( aMtf, aDestStrm, nullptr, false );
2926 const uno::Sequence<sal_Int8> aSeq(
2927 static_cast< const sal_Int8* >(aDestStrm.GetData()),
2928 aDestStrm.GetEndOfData());
2929 rValue <<= aSeq;
2930 }
2931 }
2932 }
2933 else
2934 {
2935 rValue = GetBitmap( true );
2936 }
2937 break;
2938 }
2939
2941 {
2942 if (auto pTextObj = DynCastSdrTextObj(GetSdrObject()))
2943 {
2944 if (pTextObj->HasTextColumnsNumber() || pTextObj->HasTextColumnsSpacing())
2945 {
2946 auto xIf = SvxXTextColumns_createInstance();
2947 css::uno::Reference<css::text::XTextColumns> xCols(xIf, css::uno::UNO_QUERY_THROW);
2948 xCols->setColumnCount(pTextObj->GetTextColumnsNumber());
2949 css::uno::Reference<css::beans::XPropertySet> xProp(xIf, css::uno::UNO_QUERY_THROW);
2950 xProp->setPropertyValue("AutomaticDistance",
2951 css::uno::Any(pTextObj->GetTextColumnsSpacing()));
2952 rValue <<= xIf;
2953 }
2954 }
2955 break;
2956 }
2957
2958 case OWN_ATTR_HYPERLINK:
2959 {
2960 rValue <<= GetSdrObject()->getHyperlink();
2961 break;
2962 }
2963
2964 default:
2965 return false;
2966 }
2967 return true;
2968}
2969
2970
2971bool SvxShape::getPropertyStateImpl( const SfxItemPropertyMapEntry* pProperty, css::beans::PropertyState& rState )
2972{
2973 if( pProperty->nWID == OWN_ATTR_FILLBMP_MODE )
2974 {
2976
2977 if( rSet.GetItemState( XATTR_FILLBMP_STRETCH, false ) == SfxItemState::SET ||
2978 rSet.GetItemState( XATTR_FILLBMP_TILE, false ) == SfxItemState::SET )
2979 {
2980 rState = beans::PropertyState_DIRECT_VALUE;
2981 }
2982 else
2983 {
2984 rState = beans::PropertyState_AMBIGUOUS_VALUE;
2985 }
2986 }
2987 else if((( pProperty->nWID >= OWN_ATTR_VALUE_START && pProperty->nWID <= OWN_ATTR_VALUE_END ) ||
2988 ( pProperty->nWID >= SDRATTR_NOTPERSIST_FIRST && pProperty->nWID <= SDRATTR_NOTPERSIST_LAST )) && ( pProperty->nWID != SDRATTR_TEXTDIRECTION ) )
2989 {
2990 rState = beans::PropertyState_DIRECT_VALUE;
2991 }
2992 else
2993 {
2994 return false;
2995 }
2996
2997 return true;
2998}
2999
3000
3002{
3003 if( pProperty->nWID == OWN_ATTR_FILLBMP_MODE )
3004 {
3007 return true;
3008 }
3009 else if((pProperty->nWID >= OWN_ATTR_VALUE_START && pProperty->nWID <= OWN_ATTR_VALUE_END ) ||
3010 ( pProperty->nWID >= SDRATTR_NOTPERSIST_FIRST && pProperty->nWID <= SDRATTR_NOTPERSIST_LAST ))
3011 {
3012 return true;
3013 }
3014 else
3015 {
3016 return false;
3017 }
3018}
3019
3020
3021uno::Sequence< beans::PropertyState > SAL_CALL SvxShape::getPropertyStates( const uno::Sequence< OUString >& aPropertyName )
3022{
3023 const sal_Int32 nCount = aPropertyName.getLength();
3024 uno::Sequence< beans::PropertyState > aRet( nCount );
3025
3026 std::transform(aPropertyName.begin(), aPropertyName.end(), aRet.getArray(),
3027 [this](const OUString& rName) -> beans::PropertyState { return getPropertyState(rName); });
3028
3029 return aRet;
3030}
3031
3032
3033void SAL_CALL SvxShape::setPropertyToDefault( const OUString& PropertyName )
3034{
3035 if( mpImpl->mpMaster )
3036 {
3037 mpImpl->mpMaster->setPropertyToDefault( PropertyName );
3038 }
3039 else
3040 {
3041 _setPropertyToDefault( PropertyName );
3042 }
3043}
3044
3045void SvxShape::_setPropertyToDefault( const OUString& PropertyName )
3046{
3047 ::SolarMutexGuard aGuard;
3048
3049 const SfxItemPropertyMapEntry* pProperty = mpPropSet->getPropertyMapEntry(PropertyName);
3050
3051 if( !HasSdrObject() || pProperty == nullptr )
3052 throw beans::UnknownPropertyException( PropertyName, getXWeak());
3053
3054 if( !setPropertyToDefaultImpl( pProperty ) )
3055 {
3056 GetSdrObject()->ClearMergedItem( pProperty->nWID );
3057 }
3058
3060}
3061
3062
3063uno::Any SAL_CALL SvxShape::getPropertyDefault( const OUString& aPropertyName )
3064{
3065 if( mpImpl->mpMaster )
3066 {
3067 return mpImpl->mpMaster->getPropertyDefault( aPropertyName );
3068 }
3069 else
3070 {
3071 return _getPropertyDefault( aPropertyName );
3072 }
3073}
3074
3075uno::Any SvxShape::_getPropertyDefault( const OUString& aPropertyName )
3076{
3077 ::SolarMutexGuard aGuard;
3078
3079 const SfxItemPropertyMapEntry* pMap = mpPropSet->getPropertyMapEntry(aPropertyName);
3080
3081 if( !HasSdrObject() || pMap == nullptr )
3082 throw beans::UnknownPropertyException( aPropertyName, getXWeak());
3083
3084 if(( pMap->nWID >= OWN_ATTR_VALUE_START && pMap->nWID <= OWN_ATTR_VALUE_END ) ||
3086 {
3087 return getPropertyValue( aPropertyName );
3088 }
3089
3090 // get default from ItemPool
3091 if(!SfxItemPool::IsWhich(pMap->nWID))
3092 throw beans::UnknownPropertyException( "No WhichID " + OUString::number(pMap->nWID) + " for " + aPropertyName, getXWeak());
3093
3094 SfxItemSet aSet( GetSdrObject()->getSdrModelFromSdrObject().GetItemPool(), pMap->nWID, pMap->nWID );
3095 aSet.Put(GetSdrObject()->getSdrModelFromSdrObject().GetItemPool().GetDefaultItem(pMap->nWID));
3096
3097 return GetAnyForItem( aSet, pMap );
3098}
3099
3100// XMultiPropertyStates
3102{
3103 ::SolarMutexGuard aGuard;
3104
3105 SdrObject* pSdrObj = GetSdrObject();
3106 if( !pSdrObj )
3107 throw lang::DisposedException();
3108 pSdrObj->ClearMergedItem(); // nWhich == 0 => all
3109
3110 const SdrObjKind nObjId = pSdrObj->GetObjIdentifier();
3111 if(nObjId == SdrObjKind::Graphic) // SdrGrafObj
3112 {
3113 // defaults for graphic objects have changed:
3114 pSdrObj->SetMergedItem( XFillStyleItem( drawing::FillStyle_NONE ) );
3115 pSdrObj->SetMergedItem( XLineStyleItem( drawing::LineStyle_NONE ) );
3116 }
3117
3118 // #i68523# special handling for Svx3DCharacterModeItem, this is not saved
3119 // but needs to be sal_True in svx, pool default (false) in sch. Since sch
3120 // does not load lathe or extrude objects, it is possible to set the items
3121 // here.
3122 // For other solution possibilities, see task description.
3123 if( nObjId == SdrObjKind::E3D_Lathe /*E3dLatheObj*/ || nObjId == SdrObjKind::E3D_Extrusion /*E3dExtrudeObj*/ )
3124 {
3125 pSdrObj->SetMergedItem(Svx3DCharacterModeItem(true));
3126 }
3127
3129}
3130
3132 const uno::Sequence<OUString>& aPropertyNames )
3133{
3134 for ( const auto& rPropertyName : aPropertyNames )
3135 setPropertyToDefault( rPropertyName );
3136}
3137
3138uno::Sequence<uno::Any> SvxShape::getPropertyDefaults(
3139 const uno::Sequence<OUString>& aPropertyNames )
3140{
3141 ::std::vector<uno::Any> ret;
3142 ret.reserve(aPropertyNames.getLength());
3143 std::transform(aPropertyNames.begin(), aPropertyNames.end(), std::back_inserter(ret),
3144 [this](const OUString& rName) -> uno::Any { return getPropertyDefault(rName); });
3145 return uno::Sequence<uno::Any>( ret.data(), ret.size() );
3146}
3147
3148
3149// XServiceInfo
3150
3152{
3153 return "SvxShape";
3154}
3155
3156constexpr OUStringLiteral sUNO_service_style_ParagraphProperties = u"com.sun.star.style.ParagraphProperties";
3157constexpr OUStringLiteral sUNO_service_style_ParagraphPropertiesComplex = u"com.sun.star.style.ParagraphPropertiesComplex";
3158constexpr OUStringLiteral sUNO_service_style_ParagraphPropertiesAsian = u"com.sun.star.style.ParagraphPropertiesAsian";
3159constexpr OUStringLiteral sUNO_service_style_CharacterProperties = u"com.sun.star.style.CharacterProperties";
3160constexpr OUStringLiteral sUNO_service_style_CharacterPropertiesComplex = u"com.sun.star.style.CharacterPropertiesComplex";
3161constexpr OUStringLiteral sUNO_service_style_CharacterPropertiesAsian = u"com.sun.star.style.CharacterPropertiesAsian";
3162
3163constexpr OUStringLiteral sUNO_service_drawing_FillProperties = u"com.sun.star.drawing.FillProperties";
3164constexpr OUStringLiteral sUNO_service_drawing_TextProperties = u"com.sun.star.drawing.TextProperties";
3165constexpr OUStringLiteral sUNO_service_drawing_LineProperties = u"com.sun.star.drawing.LineProperties";
3166constexpr OUStringLiteral sUNO_service_drawing_ConnectorProperties = u"com.sun.star.drawing.ConnectorProperties";
3167constexpr OUStringLiteral sUNO_service_drawing_MeasureProperties = u"com.sun.star.drawing.MeasureProperties";
3168constexpr OUStringLiteral sUNO_service_drawing_ShadowProperties = u"com.sun.star.drawing.ShadowProperties";
3169
3170constexpr OUStringLiteral sUNO_service_drawing_RotationDescriptor = u"com.sun.star.drawing.RotationDescriptor";
3171
3172constexpr OUStringLiteral sUNO_service_drawing_Text = u"com.sun.star.drawing.Text";
3173constexpr OUStringLiteral sUNO_service_drawing_GroupShape = u"com.sun.star.drawing.GroupShape";
3174
3175constexpr OUStringLiteral sUNO_service_drawing_CustomShapeProperties = u"com.sun.star.drawing.CustomShapeProperties";
3176constexpr OUStringLiteral sUNO_service_drawing_CustomShape = u"com.sun.star.drawing.CustomShape";
3177
3178constexpr OUStringLiteral sUNO_service_drawing_PolyPolygonDescriptor = u"com.sun.star.drawing.PolyPolygonDescriptor";
3179constexpr OUStringLiteral sUNO_service_drawing_PolyPolygonBezierDescriptor= u"com.sun.star.drawing.PolyPolygonBezierDescriptor";
3180
3181constexpr OUStringLiteral sUNO_service_drawing_LineShape = u"com.sun.star.drawing.LineShape";
3182constexpr OUStringLiteral sUNO_service_drawing_Shape = u"com.sun.star.drawing.Shape";
3183constexpr OUStringLiteral sUNO_service_drawing_RectangleShape = u"com.sun.star.drawing.RectangleShape";
3184constexpr OUStringLiteral sUNO_service_drawing_EllipseShape = u"com.sun.star.drawing.EllipseShape";
3185constexpr OUStringLiteral sUNO_service_drawing_PolyPolygonShape = u"com.sun.star.drawing.PolyPolygonShape";
3186constexpr OUStringLiteral sUNO_service_drawing_PolyLineShape = u"com.sun.star.drawing.PolyLineShape";
3187constexpr OUStringLiteral sUNO_service_drawing_OpenBezierShape = u"com.sun.star.drawing.OpenBezierShape";
3188constexpr OUStringLiteral sUNO_service_drawing_ClosedBezierShape = u"com.sun.star.drawing.ClosedBezierShape";
3189constexpr OUStringLiteral sUNO_service_drawing_TextShape = u"com.sun.star.drawing.TextShape";
3190constexpr OUStringLiteral sUNO_service_drawing_GraphicObjectShape = u"com.sun.star.drawing.GraphicObjectShape";
3191constexpr OUStringLiteral sUNO_service_drawing_OLE2Shape = u"com.sun.star.drawing.OLE2Shape";
3192constexpr OUStringLiteral sUNO_service_drawing_PageShape = u"com.sun.star.drawing.PageShape";
3193constexpr OUStringLiteral sUNO_service_drawing_CaptionShape = u"com.sun.star.drawing.CaptionShape";
3194constexpr OUStringLiteral sUNO_service_drawing_MeasureShape = u"com.sun.star.drawing.MeasureShape";
3195constexpr OUStringLiteral sUNO_service_drawing_FrameShape = u"com.sun.star.drawing.FrameShape";
3196constexpr OUStringLiteral sUNO_service_drawing_ControlShape = u"com.sun.star.drawing.ControlShape";
3197constexpr OUStringLiteral sUNO_service_drawing_ConnectorShape = u"com.sun.star.drawing.ConnectorShape";
3198constexpr OUStringLiteral sUNO_service_drawing_MediaShape = u"com.sun.star.drawing.MediaShape";
3199
3200
3201uno::Sequence< OUString > SAL_CALL SvxShape::getSupportedServiceNames()
3202{
3203 if( mpImpl->mpMaster )
3204 {
3205 return mpImpl->mpMaster->getSupportedServiceNames();
3206 }
3207 else
3208 {
3210 }
3211}
3212
3213uno::Sequence< OUString > SvxShape::_getSupportedServiceNames()
3214{
3215 ::SolarMutexGuard aGuard;
3216
3217 if( HasSdrObject() && GetSdrObject()->GetObjInventor() == SdrInventor::Default)
3218 {
3219 const SdrObjKind nIdent = GetSdrObject()->GetObjIdentifier();
3220
3221 switch(nIdent)
3222 {
3223 case SdrObjKind::Group:
3224 {
3225 static const uno::Sequence<OUString> aSvxShape_GroupServices
3228 return aSvxShape_GroupServices;
3229 }
3231 {
3232 static const uno::Sequence<OUString> aSvxShape_CustomShapeServices
3248 return aSvxShape_CustomShapeServices;
3249 }
3250 case SdrObjKind::Line:
3251 {
3252 static const uno::Sequence<OUString> aSvxShape_LineServices
3254
3257
3266
3270 return aSvxShape_LineServices;
3271 }
3272
3274 {
3275 static const uno::Sequence<OUString> aSvxShape_RectServices
3277
3289
3292 return aSvxShape_RectServices;
3293 }
3294
3299 {
3300 static const uno::Sequence<OUString> aSvxShape_CircServices
3302
3306
3315
3318 return aSvxShape_CircServices;
3319 }
3320
3323 {
3324 static const uno::Sequence<OUString> aSvxShape_PathServices
3326
3329
3331
3340
3343 return aSvxShape_PathServices;
3344 }
3345
3348 {
3349 static const uno::Sequence<OUString> aSvxShape_PolyServices
3351
3355
3357
3366
3369 return aSvxShape_PolyServices;
3370 }
3371
3374 {
3375 static const uno::Sequence<OUString> aSvxShape_FreeLineServices
3377
3381
3383
3392
3395 return aSvxShape_FreeLineServices;
3396 }
3397
3400 {
3401 static const uno::Sequence<OUString> aSvxShape_FreeFillServices
3403
3407
3409
3418
3421 return aSvxShape_FreeFillServices;
3422 }
3423
3426 case SdrObjKind::Text:
3427 {
3428 static const uno::Sequence<OUString> aSvxShape_TextServices
3430
3434
3443
3446 return aSvxShape_TextServices;
3447 }
3448
3450 {
3451 static const uno::Sequence<OUString> aSvxShape_GrafServices
3453
3455
3464
3467 return aSvxShape_GrafServices;
3468 }
3469
3470 case SdrObjKind::OLE2:
3471 {
3472 static const uno::Sequence<OUString> aSvxShape_Ole2Services
3475
3476 // #i118485# Added Text, Shadow and Rotation
3485
3488 return aSvxShape_Ole2Services;
3489 }
3490
3492 {
3493 static const uno::Sequence<OUString> aSvxShape_CaptionServices
3495
3499
3508
3511 return aSvxShape_CaptionServices;
3512 }
3513
3514 case SdrObjKind::Page:
3515 {
3516 static const uno::Sequence<OUString> aSvxShape_PageServices
3519 return aSvxShape_PageServices;
3520 }
3521
3523 {
3524 static const uno::Sequence<OUString> aSvxShape_MeasureServices
3526
3528
3531
3540
3544 return aSvxShape_MeasureServices;
3545 }
3546
3548 {
3549 static const uno::Sequence<OUString> aSvxShape_FrameServices
3552 return aSvxShape_FrameServices;
3553 }
3554
3555 case SdrObjKind::UNO:
3556 {
3557 static const uno::Sequence<OUString> aSvxShape_UnoServices
3560 return aSvxShape_UnoServices;
3561 }
3562
3563 case SdrObjKind::Edge:
3564 {
3565 static const uno::Sequence<OUString> aSvxShape_EdgeServices
3568
3571
3580
3584 return aSvxShape_EdgeServices;
3585 }
3586 case SdrObjKind::Media:
3587 {
3588 static const uno::Sequence<OUString> aSvxShape_MediaServices
3591 return aSvxShape_MediaServices;
3592 }
3593 default: ;
3594 }
3595 }
3596 else if( HasSdrObject() && GetSdrObject()->GetObjInventor() == SdrInventor::FmForm)
3597 {
3598#if OSL_DEBUG_LEVEL > 0
3599 const SdrObjKind nIdent = GetSdrObject()->GetObjIdentifier();
3600 OSL_ENSURE( nIdent == SdrObjKind::UNO, "SvxShape::_getSupportedServiceNames: SdrInventor::FmForm, but no UNO object?" );
3601#endif
3602 static const uno::Sequence<OUString> aSvxShape_UnoServices
3605 return aSvxShape_UnoServices;
3606 }
3607 OSL_FAIL( "SvxShape::_getSupportedServiceNames: could not determine object type!" );
3608 uno::Sequence< OUString > aSeq;
3609 return aSeq;
3610}
3611
3612sal_Bool SAL_CALL SvxShape::supportsService( const OUString& ServiceName )
3613{
3614 return cppu::supportsService(this, ServiceName);
3615}
3616
3617// XGluePointsSupplier
3618uno::Reference< container::XIndexContainer > SAL_CALL SvxShape::getGluePoints()
3619{
3620 ::SolarMutexGuard aGuard;
3621 uno::Reference< container::XIndexContainer > xGluePoints( mxGluePoints );
3622
3623 if( HasSdrObject() && !xGluePoints.is() )
3624 {
3625 uno::Reference< container::XIndexContainer > xNew( SvxUnoGluePointAccess_createInstance( GetSdrObject() ), uno::UNO_QUERY );
3626 mxGluePoints = xGluePoints = xNew;
3627 }
3628
3629 return xGluePoints;
3630}
3631
3632// XChild
3633uno::Reference<uno::XInterface> SAL_CALL SvxShape::getParent()
3634{
3635 ::SolarMutexGuard aGuard;
3636 const SdrObject* pSdrObject(GetSdrObject());
3637
3638 if(nullptr != pSdrObject)
3639 {
3640 const SdrObjList* pParentSdrObjList(GetSdrObject()->getParentSdrObjListFromSdrObject());
3641
3642 if(nullptr != pParentSdrObjList)
3643 {
3644 // SdrObject is member of a SdrObjList. That may be a SdrObject
3645 // (SdrObjGroup or E3dScene) or a SdrPage.
3646 // Check for SdrObject first - using getSdrPageFromSdrObjList
3647 // *will* get the SdrPage even when the SdrObject is deep buried
3648 // in a construct of SdrObjGroup.
3649 // We want to ask for the direct parent here...
3650 SdrObject* pParentSdrObject(pParentSdrObjList->getSdrObjectFromSdrObjList());
3651
3652 if(nullptr != pParentSdrObject)
3653 {
3654 // SdrObject is member of a SdrObject-based Group (SdrObjGroup or E3dScene).
3655 return pParentSdrObject->getUnoShape();
3656 }
3657 else
3658 {
3659 SdrPage* pParentSdrPage(pParentSdrObjList->getSdrPageFromSdrObjList());
3660
3661 if(nullptr != pParentSdrPage)
3662 {
3663 // SdrObject is inserted to a SdrPage. Since
3664 // we checked for getSdrObjectFromSdrObjList first,
3665 // we can even say that it is directly member of that
3666 // SdrPage.
3667 return pParentSdrPage->getUnoPage();
3668 }
3669 }
3670
3671 // not member of any SdrObjList, no parent
3672 OSL_FAIL( "SvxShape::getParent( ): unexpected Parent SdrObjList" );
3673 }
3674 }
3675
3676 // no SdrObject, no parent
3677 return uno::Reference<uno::XInterface>();
3678}
3679
3680void SAL_CALL SvxShape::setParent( const css::uno::Reference< css::uno::XInterface >& )
3681{
3682 throw lang::NoSupportException();
3683}
3684
3685
3688{
3689}
3690
3691
3694{
3695}
3696
3697
3698// XActionLockable
3700{
3701 ::SolarMutexGuard aGuard;
3702
3703 return mnLockCount != 0;
3704}
3705
3706
3708{
3709 ::SolarMutexGuard aGuard;
3710
3711 DBG_ASSERT( mnLockCount < 0xffff, "lock overflow in SvxShape!" );
3712 mnLockCount++;
3713
3714 if( mnLockCount == 1 )
3715 lock();
3716}
3717
3718
3720{
3721 ::SolarMutexGuard aGuard;
3722
3723 DBG_ASSERT( mnLockCount > 0, "lock underflow in SvxShape!" );
3724 mnLockCount--;
3725
3726 if( mnLockCount == 0 )
3727 unlock();
3728}
3729
3730
3731void SAL_CALL SvxShape::setActionLocks( sal_Int16 nLock )
3732{
3733 ::SolarMutexGuard aGuard;
3734
3735 if( (mnLockCount == 0) && (nLock != 0) )
3736 unlock();
3737
3738 if( (mnLockCount != 0) && (nLock == 0) )
3739 lock();
3740
3741 mnLockCount = static_cast<sal_uInt16>(nLock);
3742}
3743
3744
3745sal_Int16 SAL_CALL SvxShape::resetActionLocks( )
3746{
3747 ::SolarMutexGuard aGuard;
3748
3749 if( mnLockCount != 0 )
3750 unlock();
3751
3752 sal_Int16 nOldLocks = static_cast<sal_Int16>(mnLockCount);
3753 mnLockCount = 0;
3754
3755 return nOldLocks;
3756}
3757
3758
3765{
3766 switch( mpImpl->mnObjId )
3767 {
3768 case SdrObjKind::Line:
3777 {
3779
3780 if( nId != mpImpl->mnObjId )
3781 {
3782 mpImpl->mnObjId = nId;
3783
3784 }
3785 break;
3786 }
3787 default: ;
3788 }
3789}
3790
3793{
3794 if( pObject )
3795 SetEditSource( new SvxTextEditSource( pObject, nullptr ) );
3796}
3797
3798
3801{
3802 if( pObject )
3803 SetEditSource( new SvxTextEditSource( pObject, nullptr ) );
3804}
3805
3806
3808{
3809 // check if only this instance is registered at the ranges
3810 DBG_ASSERT( (nullptr == GetEditSource()) || (GetEditSource()->getRanges().size()==1),
3811 "svx::SvxShapeText::~SvxShapeText(), text shape with living text ranges destroyed!");
3812}
3813
3814void SvxShapeText::Create( SdrObject* pNewObj, SvxDrawPage* pNewPage )
3815{
3816 if( pNewObj && (nullptr == GetEditSource()))
3817 SetEditSource( new SvxTextEditSource( pNewObj, nullptr ) );
3818 SvxShape::Create( pNewObj, pNewPage );
3819}
3820
3821// XInterface
3822
3824{
3825 return SvxShape::queryInterface( rType );
3826}
3827
3828
3830{
3831 uno::Any aAny( SvxShape::queryAggregation( rType ) );
3832 if( aAny.hasValue() )
3833 return aAny;
3834
3835 return SvxUnoTextBase::queryAggregation( rType );
3836}
3837
3838
3839// XServiceInfo
3840
3842{
3843 return "SvxShapeText";
3844}
3845
3846
3847uno::Sequence< OUString > SAL_CALL SvxShapeText::getSupportedServiceNames()
3848{
3850}
3851
3852
3853sal_Bool SAL_CALL SvxShapeText::supportsService( const OUString& ServiceName )
3854{
3855 return cppu::supportsService(static_cast<SvxShape*>(this), ServiceName);
3856}
3857
3858 // XTypeProvider
3859
3860uno::Sequence< uno::Type > SAL_CALL SvxShapeText::getTypes()
3861{
3862 return SvxShape::getTypes();
3863}
3864
3865sal_Int64 SAL_CALL SvxShapeText::getSomething( const css::uno::Sequence< sal_Int8 >& rId )
3866{
3867 const sal_Int64 nReturn = SvxShape::getSomething( rId );
3868 if( nReturn )
3869 return nReturn;
3870
3871 return SvxUnoTextBase::getSomething( rId );
3872}
3873
3874
3875uno::Sequence< sal_Int8 > SAL_CALL SvxShapeText::getImplementationId()
3876{
3877 return css::uno::Sequence<sal_Int8>();
3878}
3879
3880
3883{
3884 SvxTextEditSource* pEditSource = static_cast<SvxTextEditSource*>(GetEditSource());
3885 if( pEditSource )
3886 pEditSource->lock();
3887}
3888
3889
3892{
3893 SvxTextEditSource* pEditSource = static_cast<SvxTextEditSource*>(GetEditSource());
3894 if( pEditSource )
3895 pEditSource->unlock();
3896}
3897
3898// css::text::XTextRange
3899uno::Reference< text::XTextRange > SAL_CALL SvxShapeText::getStart()
3900{
3901 ::SolarMutexGuard aGuard;
3902 SvxTextForwarder* pForwarder = mpEditSource ? mpEditSource->GetTextForwarder() : nullptr;
3903 if( pForwarder )
3904 ::GetSelection( maSelection, pForwarder );
3905 return SvxUnoTextBase::getStart();
3906
3907}
3908
3909uno::Reference< text::XTextRange > SAL_CALL SvxShapeText::getEnd()
3910{
3911 ::SolarMutexGuard aGuard;
3912 SvxTextForwarder* pForwarder = mpEditSource ? mpEditSource->GetTextForwarder() : nullptr;
3913 if( pForwarder )
3914 ::GetSelection( maSelection, pForwarder );
3915 return SvxUnoTextBase::getEnd();
3916}
3917
3918OUString SAL_CALL SvxShapeText::getString()
3919{
3920 ::SolarMutexGuard aGuard;
3921 SvxTextForwarder* pForwarder = mpEditSource ? mpEditSource->GetTextForwarder() : nullptr;
3922 if( pForwarder )
3923 ::GetSelection( maSelection, pForwarder );
3925}
3926
3927
3928void SAL_CALL SvxShapeText::setString( const OUString& aString )
3929{
3930 ::SolarMutexGuard aGuard;
3931 SvxTextForwarder* pForwarder = mpEditSource ? mpEditSource->GetTextForwarder() : nullptr;
3932 if( pForwarder )
3933 ::GetSelection( maSelection, pForwarder );
3934 SvxUnoTextBase::setString( aString );
3935}
3936
3937// override these for special property handling in subcasses. Return true if property is handled
3938bool SvxShapeText::setPropertyValueImpl( const OUString& rName, const SfxItemPropertyMapEntry* pProperty, const css::uno::Any& rValue )
3939{
3940 // HACK-fix #99090#
3941 // since SdrTextObj::SetVerticalWriting exchanges
3942 // SDRATTR_TEXT_AUTOGROWWIDTH and SDRATTR_TEXT_AUTOGROWHEIGHT,
3943 // we have to set the textdirection here
3944
3945 if( pProperty->nWID == SDRATTR_TEXTDIRECTION )
3946 {
3947 SdrTextObj* pTextObj = DynCastSdrTextObj( GetSdrObject() );
3948 if( pTextObj )
3949 {
3950 css::text::WritingMode eMode;
3951 if( rValue >>= eMode )
3952 {
3953 pTextObj->SetVerticalWriting( eMode == css::text::WritingMode_TB_RL );
3954 }
3955 }
3956 return true;
3957 }
3958 return SvxShape::setPropertyValueImpl( rName, pProperty, rValue );
3959}
3960
3961bool SvxShapeText::getPropertyValueImpl( const OUString& rName, const SfxItemPropertyMapEntry* pProperty, css::uno::Any& rValue )
3962{
3963 if( pProperty->nWID == SDRATTR_TEXTDIRECTION )
3964 {
3965 SdrTextObj* pTextObj = DynCastSdrTextObj( GetSdrObject() );
3966 if( pTextObj && pTextObj->IsVerticalWriting() )
3967 rValue <<= css::text::WritingMode_TB_RL;
3968 else
3969 rValue <<= css::text::WritingMode_LR_TB;
3970 return true;
3971 }
3972
3973 return SvxShape::getPropertyValueImpl( rName, pProperty, rValue );
3974}
3975
3976bool SvxShapeText::getPropertyStateImpl( const SfxItemPropertyMapEntry* pProperty, css::beans::PropertyState& rState )
3977{
3978 return SvxShape::getPropertyStateImpl( pProperty, rState );
3979}
3980
3982{
3983 return SvxShape::setPropertyToDefaultImpl( pProperty );
3984}
3985
3987: SvxShapeText( pObj, getSvxMapProvider().GetMap(SVXMAP_SHAPE), getSvxMapProvider().GetPropertySet(SVXMAP_SHAPE, SdrObject::GetGlobalDrawObjectItemPool()))
3988{
3989}
3990
3992{
3993}
3994
3996{
3997 return SvxShapeText::queryInterface( rType );
3998}
3999
4001{
4002 return SvxShapeText::queryAggregation( rType );
4003}
4004
4005// XServiceInfo
4006
4008{
4010}
4011
4013uno::Reference< drawing::XShape > GetXShapeForSdrObject( SdrObject* pObj ) noexcept
4014{
4015 uno::Reference< drawing::XShape > xShape( pObj->getUnoShape(), uno::UNO_QUERY );
4016 return xShape;
4017}
4018
4019
4020SdrObject* SdrObject::getSdrObjectFromXShape( const css::uno::Reference< css::uno::XInterface >& xInt )
4021{
4022 SvxShape* pSvxShape = comphelper::getFromUnoTunnel<SvxShape>( xInt );
4023 return pSvxShape ? pSvxShape->GetSdrObject() : nullptr;
4024}
4025
4027{
4028 if(!pMap || !pMap->nWID)
4029 return uno::Any();
4030
4031 // Check is for items that store either metric values if they are positive or percentage if they are negative.
4032 bool bDontConvertNegativeValues = ( pMap->nWID == XATTR_FILLBMP_SIZEX || pMap->nWID == XATTR_FILLBMP_SIZEY );
4033 return SvxItemPropertySet::getPropertyValue( pMap, rSet, (pMap->nWID != SDRATTR_XMLATTRIBUTES), bDontConvertNegativeValues );
4034}
4035
4037{
4038 if(!pMap || !pMap->nWID)
4039 return;
4040
4041 bool bDontConvertNegativeValues = ( pMap->nWID == XATTR_FILLBMP_SIZEX || pMap->nWID == XATTR_FILLBMP_SIZEY );
4042 SvxItemPropertySet::setPropertyValue( pMap, rVal, rSet, bDontConvertNegativeValues );
4043}
4044
4045/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
const PropertyValue * pValues
geometry::RealSize2D maSize
css::uno::Reference< css::uno::XInterface > SvxXTextColumns_createInstance() noexcept
constexpr o3tl::Length MapToO3tlLength(MapUnit eU, o3tl::Length ePixelValue=o3tl::Length::px)
const MapMode & GetPrefMapMode() const
const Size & GetPrefSize() const
void Move(tools::Long nX, tools::Long nY)
void WindStart()
void SetPrefMapMode(const MapMode &rMapMode)
void Record(OutputDevice *pOutDev)
void SetPrefSize(const Size &rSize)
css::uno::Reference< css::graphic::XGraphic > GetXGraphic() const
void SetPrefMapMode(const MapMode &rPrefMapMode)
const GDIMetaFile & GetGDIMetaFile() const
GraphicType GetType() const
GfxLink GetGfxLink() const
bool IsGfxLink() const
void SetPrefSize(const Size &rPrefSize)
OUString const & GetName() const
Definition: xit.hxx:53
SAL_WARN_UNUSED_RESULT Point LogicToLogic(const Point &rPtSource, const MapMode *pMapModeSource, const MapMode *pMapModeDest) const
constexpr tools::Long Y() const
tools::Long AdjustY(tools::Long nVertMove)
tools::Long AdjustX(tools::Long nHorzMove)
constexpr tools::Long X() const
bool isSuppressGetBitmap() const
Definition: svdocapt.hxx:84
Utility class SdrEdgeObj.
Definition: svdoedge.hxx:130
void ConnectToNode(bool bTail1, SdrObject *pObj) override
Definition: svdoedge.cxx:471
sal_Int32 getGluePointIndex(bool bTail)
this method is used by the api to return a gluepoint id for a connection.
Definition: svdoedge.cxx:2602
void SetEdgeTrackPath(const basegfx::B2DPolyPolygon &rPoly)
Definition: svdoedge.cxx:1713
void SetTailPoint(bool bTail, const Point &rPt)
Definition: svdoedge.cxx:2559
void setGluePointIndex(bool bTail, sal_Int32 nId=-1)
this method is used by the api to set a gluepoint for a connection nId == -1 : The best default point...
Definition: svdoedge.cxx:2570
SdrObject * GetConnectedNode(bool bTail1) const override
Definition: svdoedge.cxx:495
basegfx::B2DPolyPolygon GetEdgeTrackPath() const
Definition: svdoedge.cxx:1733
Point GetTailPoint(bool bTail) const
Definition: svdoedge.cxx:2534
This class represents an embedded or linked bitmap graphic object.
Definition: svdograf.hxx:68
const Graphic & GetGraphic() const
Definition: svdograf.cxx:381
void SetMirrored(bool _bMirrored)
Definition: svdograf.cxx:1025
SdrHintKind GetKind() const
Definition: svdmodel.hxx:133
const SdrObject * GetObject() const
Definition: svdmodel.hxx:132
SdrLayer * GetLayerPerID(SdrLayerID nID)
Definition: svdlayer.hxx:145
SdrLayerID GetID() const
Definition: svdlayer.hxx:94
const OUString & GetName() const
Definition: svdlayer.hxx:77
virtual Point GetPoint(sal_uInt32 i) const override
Definition: svdomeas.cxx:1090
virtual void NbcSetPoint(const Point &rPnt, sal_uInt32 i) override
Definition: svdomeas.cxx:1095
XBitmapListRef GetBitmapList() const
Definition: svdmodel.hxx:531
virtual void SetChanged(bool bFlg=true)
Definition: svdmodel.cxx:1143
XDashListRef GetDashList() const
Definition: svdmodel.hxx:528
XGradientListRef GetGradientList() const
Definition: svdmodel.hxx:534
bool IsWriter() const
Definition: svdmodel.hxx:579
XLineEndListRef GetLineEndList() const
Definition: svdmodel.hxx:533
XHatchListRef GetHatchList() const
Definition: svdmodel.hxx:529
const SdrPage * GetPage(sal_uInt16 nPgNum) const
Definition: svdmodel.cxx:1860
const SdrLayerAdmin & GetLayerAdmin() const
Definition: svdmodel.hxx:315
sal_uInt16 GetPageCount() const
Definition: svdmodel.cxx:1870
virtual SdrPage * getSdrPageFromSdrObjList() const
Definition: svdpage.cxx:122
SdrObject * GetObj(size_t nNum) const
Definition: svdpage.cxx:785
size_t GetObjCount() const
Definition: svdpage.cxx:779
void SetExistingObjectOrdNum(SdrObject *pExistingObj, size_t nNewObjNum)
Modify ZOrder of an SdrObject, object must already be in the list.
Definition: svdpage.cxx:525
virtual rtl::Reference< SdrObject > RemoveObject(size_t nObjNum)
Definition: svdpage.cxx:373
virtual SdrObject * getSdrObjectFromSdrObjList() const
Definition: svdpage.cxx:128
Abstract DrawObject.
Definition: svdobj.hxx:260
static SdrObject * getSdrObjectFromXShape(const css::uno::Reference< css::uno::XInterface > &xInt)
Definition: unoshape.cxx:4020
bool IsResizeProtect() const
Definition: svdobj.hxx:758
SdrObjUserCall * GetUserCall() const
Definition: svdobj.hxx:837
const Point & GetAnchorPos() const
Definition: svdobj.cxx:1653
const OUString & getHyperlink() const
Definition: svdobj.hxx:883
virtual OUString TakeObjNamePlural() const
Definition: svdobj.cxx:1097
virtual void setUnoShape(const css::uno::Reference< css::drawing::XShape > &_rxUnoShape)
Sets a new UNO representation of the shape.
Definition: svdobj.cxx:2824
void BroadcastObjectChange() const
Definition: svdobj.cxx:1018
bool IsMoveProtect() const
Definition: svdobj.hxx:756
void SetUserCall(SdrObjUserCall *pUser)
Definition: svdobj.cxx:2757
void SingleObjectPainter(OutputDevice &rOut) const
Definition: svdobj.cxx:1064
virtual SdrInventor GetObjInventor() const
Definition: svdobj.cxx:621
virtual css::uno::Reference< css::drawing::XShape > getUnoShape()
Definition: svdobj.cxx:2866
virtual void Move(const Size &rSiz)
Definition: svdobj.cxx:1531
SdrModel & getSdrModelFromSdrObject() const
Definition: svdobj.cxx:289
virtual const tools::Rectangle & GetSnapRect() const
Definition: svdobj.cxx:1662
virtual void SetLogicRect(const tools::Rectangle &rRect)
Definition: svdobj.cxx:1696
virtual const OUString & GetName() const
Definition: svdobj.cxx:771
sdr::contact::ViewContact & GetViewContact() const
Definition: svdobj.cxx:261
void SetMergedItemSetAndBroadcast(const SfxItemSet &rSet, bool bClearAllItems=false)
Definition: svdobj.cxx:2014
virtual void SetChanged()
Definition: svdobj.cxx:1042
virtual SdrObjKind GetObjIdentifier() const
Definition: svdobj.cxx:626
virtual void SetSnapRect(const tools::Rectangle &rRect)
Definition: svdobj.cxx:1687
bool IsVisible() const
Definition: svdobj.hxx:762
const SfxItemSet & GetMergedItemSet() const
Definition: svdobj.cxx:1974
virtual OUString TakeObjNameSingul() const
Definition: svdobj.cxx:1087
void ClearMergedItem(const sal_uInt16 nWhich=0)
Definition: svdobj.cxx:1989
bool IsPrintable() const
Definition: svdobj.hxx:760
virtual SdrLayerID GetLayer() const
Definition: svdobj.cxx:645
void SetMergedItem(const SfxPoolItem &rItem)
Definition: svdobj.cxx:1984
void GetGrabBagItem(css::uno::Any &rVal) const
Definition: svdobj.cxx:922
void TakeNotPersistAttr(SfxItemSet &rAttr) const
Definition: svdobj.cxx:2200
virtual void SetName(const OUString &rStr, const bool bSetChanged=true)
Definition: svdobj.cxx:734
void ApplyNotPersistAttr(const SfxItemSet &rAttr)
Definition: svdobj.cxx:2019
virtual bool TRGetBaseGeometry(basegfx::B2DHomMatrix &rMatrix, basegfx::B2DPolyPolygon &rPolyPolygon) const
Definition: svdobj.cxx:2981
virtual const tools::Rectangle & GetLogicRect() const
Definition: svdobj.cxx:1672
virtual void Resize(const Point &rRef, const Fraction &xFact, const Fraction &yFact, bool bUnsetRelative=true)
Definition: svdobj.cxx:1548
const Graphic * GetGraphic() const
Definition: svdoole2.cxx:1700
void SetReferencedPage(SdrPage *pNewPage)
Definition: svdopage.cxx:104
SdrPage * GetReferencedPage() const
Definition: svdopage.hxx:55
A SdrPage contains exactly one SdrObjList and a description of the physical page dimensions (size / m...
Definition: svdpage.hxx:379
css::uno::Reference< css::uno::XInterface > const & getUnoPage()
Definition: svdpage.cxx:1769
sal_uInt16 GetPageNum() const
Definition: svdpage.cxx:1603
void SetHandleScale(bool bHandleScale)
Scaling is ignored from the transform matrix by default, to not break compatibility.
Definition: svdopath.cxx:2879
void SetMaxScale(double nMaxScale)
Definition: sdtfsitm.hxx:62
bool HasTextColumnsSpacing() const
Definition: svdotext.cxx:1864
sal_Int32 GetTextColumnsSpacing() const
Definition: svdotext.cxx:1869
void SetTextColumnsSpacing(sal_Int32 nSpacing)
Definition: svdotext.cxx:1874
double GetFontScale() const
Definition: svdotext.cxx:1241
virtual bool IsFontwork() const
Definition: svdotext.cxx:1801
virtual void SetVerticalWriting(bool bVertical)
Definition: svdotext.cxx:1568
void SetTextColumnsNumber(sal_Int16 nColumns)
Definition: svdotext.cxx:1859
bool HasTextColumnsNumber() const
Definition: svdotext.cxx:1849
sal_Int16 GetTextColumnsNumber() const
Definition: svdotext.cxx:1854
virtual bool IsVerticalWriting() const
Definition: svdotext.cxx:1552
EnumT GetValue() const
Item2Range GetItemSurrogates(sal_uInt16 nWhich) const
const SfxPoolItem & GetDefaultItem(sal_uInt16 nWhich) const
static bool IsWhich(sal_uInt16 nId)
const SfxItemPropertyMapEntry * getByName(std::u16string_view rName) const
const o3tl::sorted_vector< const SfxItemPropertyMapEntry *, SfxItemPropertyMapCompare > & getPropertyEntries() const
SfxItemPool * GetPool() const
sal_uInt16 Count() const
const T * GetItemIfSet(TypedWhichId< T > nWhich, bool bSrchInParent=true) const
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
const SfxPoolItem * GetItem(sal_uInt16 nWhich, bool bSearchInParent=true) const
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
void StartListening(SfxBroadcaster &rBroadcaster, DuplicateHandling eDuplicateHanding=DuplicateHandling::Unexpected)
void EndListeningAll()
void EndListening(SfxBroadcaster &rBroadcaster, bool bRemoveAllDuplicates=false)
constexpr tools::Long getHeight() const
constexpr tools::Long Height() const
constexpr tools::Long getWidth() const
constexpr tools::Long Width() const
const void * GetData()
std::size_t GetEndOfData() const
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt8 nMemberId) override
css::uno::Any * GetUsrAnyForID(SfxItemPropertyMapEntry const &entry) const
bool AreThereOwnUsrAnys() const
css::uno::Reference< css::beans::XPropertySetInfo > const & getPropertySetInfo() const
const SfxItemPropertyMapEntry * getPropertyMapEntry(std::u16string_view rName) const
static void setPropertyValue(const SfxItemPropertyMapEntry *pMap, const css::uno::Any &rVal, SfxItemSet &rSet, bool bDontConvertNegativeValues)
const SfxItemPropertyMap & getPropertyMap() const
css::uno::Any getPropertyValue(const SfxItemPropertyMapEntry *pMap, SvxItemPropertySetUsrAnys &rAnys) const
this abstract class is the interface for an instance that likes to enhance the functionality of compo...
Definition: unomaster.hxx:34
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
Definition: unoshape.cxx:4007
SVXCORE_DLLPUBLIC SvxShapeRect(SdrObject *pObj)
Definition: unoshape.cxx:3986
virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type &rType) override
Definition: unoshape.cxx:3995
virtual ~SvxShapeRect() noexcept override
Definition: unoshape.cxx:3991
virtual css::uno::Any SAL_CALL queryAggregation(const css::uno::Type &rType) override
Definition: unoshape.cxx:4000
virtual css::uno::Reference< css::text::XTextRange > SAL_CALL getStart() override
Definition: unoshape.cxx:3899
virtual OUString SAL_CALL getString() override
Definition: unoshape.cxx:3918
virtual bool setPropertyToDefaultImpl(const SfxItemPropertyMapEntry *pProperty) override
Definition: unoshape.cxx:3981
virtual void SAL_CALL setString(const OUString &aString) override
Definition: unoshape.cxx:3928
virtual bool getPropertyValueImpl(const OUString &rName, const SfxItemPropertyMapEntry *pProperty, css::uno::Any &rValue) override
Definition: unoshape.cxx:3961
virtual css::uno::Any SAL_CALL queryAggregation(const css::uno::Type &rType) override
Definition: unoshape.cxx:3829
virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override
Definition: unoshape.cxx:3875
virtual bool getPropertyStateImpl(const SfxItemPropertyMapEntry *pProperty, css::beans::PropertyState &rState) override
Definition: unoshape.cxx:3976
virtual ~SvxShapeText() noexcept override
Definition: unoshape.cxx:3807
virtual void unlock() override
called from the XActionLockable interface methods on final unlock
Definition: unoshape.cxx:3891
virtual void lock() override
called from the XActionLockable interface methods on initial locking
Definition: unoshape.cxx:3882
SvxShapeText(SdrObject *pObj)
Definition: unoshape.cxx:3791
virtual sal_Int64 SAL_CALL getSomething(const css::uno::Sequence< sal_Int8 > &aIdentifier) override
Definition: unoshape.cxx:3865
virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override
Definition: unoshape.cxx:3860
virtual OUString SAL_CALL getImplementationName() override
Definition: unoshape.cxx:3841
virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type &rType) override
Definition: unoshape.cxx:3823
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
Definition: unoshape.cxx:3847
virtual bool setPropertyValueImpl(const OUString &rName, const SfxItemPropertyMapEntry *pProperty, const css::uno::Any &rValue) override
Definition: unoshape.cxx:3938
virtual css::uno::Reference< css::text::XTextRange > SAL_CALL getEnd() override
Definition: unoshape.cxx:3909
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
Definition: unoshape.cxx:3853
virtual void Create(SdrObject *pNewOpj, SvxDrawPage *pNewPage) override
Definition: unoshape.cxx:3814
virtual css::uno::Sequence< css::uno::Any > SAL_CALL getPropertyDefaults(const css::uno::Sequence< OUString > &aPropertyNames) override
Definition: unoshape.cxx:3138
OUString maShapeType
Definition: unoshape.hxx:318
void ForceMetricTo100th_mm(Pair &rPoint) const noexcept
Definition: unoshape.cxx:474
virtual css::uno::Any SAL_CALL getPropertyDefault(const OUString &aPropertyName) override
Definition: unoshape.cxx:3063
virtual css::uno::Reference< css::container::XIndexContainer > SAL_CALL getGluePoints() override
Definition: unoshape.cxx:3618
virtual css::awt::Point SAL_CALL getPosition() override
Definition: unoshape.cxx:1047
SvxItemPropertySetUsrAnys maUrsAnys
Definition: unoshape.hxx:326
virtual bool getPropertyValueImpl(const OUString &rName, const SfxItemPropertyMapEntry *pProperty, css::uno::Any &rValue)
Definition: unoshape.cxx:2542
virtual OUString SAL_CALL getName() override
Definition: unoshape.cxx:1159
virtual void SAL_CALL dispose() override
Definition: unoshape.cxx:1200
void InvalidateSdrObject()
Definition: unoshape.cxx:241
virtual void Notify(SfxBroadcaster &rBC, const SfxHint &rHint) noexcept override
Definition: unoshape.cxx:946
virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override
Definition: unoshape.cxx:735
rtl::Reference< SdrObject > mxSdrObject
Definition: unoshape.hxx:328
virtual void SAL_CALL setParent(const css::uno::Reference< css::uno::XInterface > &Parent) override
Definition: unoshape.cxx:3680
virtual bool getPropertyStateImpl(const SfxItemPropertyMapEntry *pProperty, css::beans::PropertyState &rState)
Definition: unoshape.cxx:2971
void notifyPropertyChange(svx::ShapePropertyProviderId eProp)
Definition: unoshape.cxx:292
void _setPropertyToDefault(const OUString &PropertyName)
Definition: unoshape.cxx:3045
SvxShape(SdrObject *pObj)
Definition: unoshape.cxx:195
virtual void lock()
called from the XActionLockable interface methods on initial locking
Definition: unoshape.cxx:3687
void setMaster(SvxShapeMaster *pMaster)
Definition: unoshape.cxx:262
virtual ~SvxShape() noexcept override
Definition: unoshape.cxx:221
virtual void SAL_CALL addActionLock() override
Definition: unoshape.cxx:3707
bool SetFillAttribute(sal_uInt16 nWID, const OUString &rName)
Definition: unoshape.cxx:1302
bool mbIsMultiPropertyCall
Definition: unoshape.hxx:322
css::uno::Sequence< OUString > _getSupportedServiceNames()
Definition: unoshape.cxx:3213
virtual void Create(SdrObject *pNewOpj, SvxDrawPage *pNewPage)
Definition: unoshape.cxx:361
virtual void SAL_CALL addPropertyChangeListener(const OUString &aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &xListener) override
Definition: unoshape.cxx:1276
bool HasSdrObject() const
Definition: unoshape.hxx:173
virtual css::awt::Size SAL_CALL getSize() override
Definition: unoshape.cxx:1100
void updateShapeKind()
since polygon shapes can change their kind during editing, we have to recheck it here.
Definition: unoshape.cxx:3764
virtual void SAL_CALL setActionLocks(sal_Int16 nLock) override
Definition: unoshape.cxx:3731
virtual void SAL_CALL setSize(const css::awt::Size &aSize) override
Definition: unoshape.cxx:1116
virtual void SAL_CALL setPropertyValues(const css::uno::Sequence< OUString > &aPropertyNames, const css::uno::Sequence< css::uno::Any > &aValues) override
Definition: unoshape.cxx:1684
virtual void SAL_CALL setName(const OUString &aName) override
Definition: unoshape.cxx:1173
virtual void SAL_CALL removePropertiesChangeListener(const css::uno::Reference< css::beans::XPropertiesChangeListener > &xListener) override
Definition: unoshape.cxx:1801
sal_uInt16 mnLockCount
used from the XActionLockable interface
Definition: unoshape.hxx:330
css::uno::Sequence< css::uno::Type > const & _getTypes()
Definition: unoshape.cxx:748
css::beans::PropertyState _getPropertyState(const OUString &PropertyName)
Definition: unoshape.cxx:1903
css::uno::Any _getPropertyDefault(const OUString &aPropertyName)
Definition: unoshape.cxx:3075
OUString maShapeName
Definition: unoshape.hxx:319
css::uno::WeakReference< css::container::XIndexContainer > mxGluePoints
Definition: unoshape.hxx:324
virtual css::uno::Any SAL_CALL getPropertyValue(const OUString &PropertyName) override
Definition: unoshape.cxx:1617
std::mutex m_aMutex
Definition: unoshape.hxx:315
virtual void SAL_CALL setPropertiesToDefault(const css::uno::Sequence< OUString > &aPropertyNames) override
Definition: unoshape.cxx:3131
virtual void unlock()
called from the XActionLockable interface methods on final unlock
Definition: unoshape.cxx:3693
std::unique_ptr< SvxShapeImpl > mpImpl
these members are used to optimize XMultiProperty calls
Definition: unoshape.hxx:321
virtual void SAL_CALL setPropertyValue(const OUString &aPropertyName, const css::uno::Any &aValue) override
Definition: unoshape.cxx:1478
virtual OUString SAL_CALL getShapeType() override
Definition: unoshape.cxx:1189
virtual css::uno::Sequence< css::uno::Any > SAL_CALL getPropertyValues(const css::uno::Sequence< OUString > &aPropertyNames) override
Definition: unoshape.cxx:1754
virtual void SAL_CALL removeVetoableChangeListener(const OUString &PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &aListener) override
Definition: unoshape.cxx:1296
const SvxItemPropertySet * mpPropSet
Definition: unoshape.hxx:325
virtual void SAL_CALL addPropertiesChangeListener(const css::uno::Sequence< OUString > &aPropertyNames, const css::uno::Reference< css::beans::XPropertiesChangeListener > &xListener) override
Definition: unoshape.cxx:1797
css::uno::Reference< css::beans::XPropertySetInfo > const & _getPropertySetInfo()
same as SetFillAttribute but for property names instead of which ids, and the property found is retur...
Definition: unoshape.cxx:1270
SdrObjKind getShapeKind() const
Definition: unoshape.cxx:256
css::uno::Any _getPropertyValue(const OUString &PropertyName)
Definition: unoshape.cxx:1626
css::awt::Size maSize
Definition: unoshape.hxx:316
void _setPropertyValue(const OUString &aPropertyName, const css::uno::Any &aValue)
Definition: unoshape.cxx:1490
virtual sal_Int16 SAL_CALL resetActionLocks() override
Definition: unoshape.cxx:3745
virtual bool setPropertyToDefaultImpl(const SfxItemPropertyMapEntry *pProperty)
Definition: unoshape.cxx:3001
virtual void SAL_CALL setPropertyToDefault(const OUString &PropertyName) override
Definition: unoshape.cxx:3033
virtual void SAL_CALL setAllPropertiesToDefault() override
Definition: unoshape.cxx:3101
virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override
Definition: unoshape.cxx:1257
css::uno::Any GetAnyForItem(SfxItemSet const &aSet, const SfxItemPropertyMapEntry *pMap) const
Definition: unoshape.cxx:1810
virtual void SAL_CALL setPosition(const css::awt::Point &aPosition) override
Definition: unoshape.cxx:1070
void setShapeKind(SdrObjKind nKind)
Definition: unoshape.cxx:250
css::uno::Any GetBitmap(bool bMetaFile=false) const
Definition: unoshape.cxx:604
virtual css::uno::Reference< css::uno::XInterface > SAL_CALL getParent() override
Definition: unoshape.cxx:3633
virtual sal_Bool SAL_CALL isActionLocked() override
Definition: unoshape.cxx:3699
void ObtainSettingsFromPropertySet(const SvxItemPropertySet &rPropSet)
Definition: unoshape.cxx:589
virtual css::uno::Sequence< css::beans::PropertyState > SAL_CALL getPropertyStates(const css::uno::Sequence< OUString > &aPropertyName) override
Definition: unoshape.cxx:3021
virtual css::beans::PropertyState SAL_CALL getPropertyState(const OUString &PropertyName) override
Definition: unoshape.cxx:1891
virtual void SAL_CALL removeEventListener(const css::uno::Reference< css::lang::XEventListener > &aListener) override
Definition: unoshape.cxx:1247
virtual void SAL_CALL firePropertiesChangeEvent(const css::uno::Sequence< OUString > &aPropertyNames, const css::uno::Reference< css::beans::XPropertiesChangeListener > &xListener) override
Definition: unoshape.cxx:1805
virtual void SAL_CALL addVetoableChangeListener(const OUString &PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &aListener) override
Definition: unoshape.cxx:1290
virtual void SAL_CALL removePropertyChangeListener(const OUString &aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &aListener) override
Definition: unoshape.cxx:1283
void endSetPropertyValues()
Definition: unoshape.cxx:1747
virtual OUString SAL_CALL getImplementationName() override
Definition: unoshape.cxx:3151
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
Definition: unoshape.cxx:3201
void registerProvider(svx::ShapePropertyProviderId eProp, std::unique_ptr< svx::PropertyValueProvider > provider)
Definition: unoshape.cxx:298
virtual void SAL_CALL removeActionLock() override
Definition: unoshape.cxx:3719
virtual void SAL_CALL addEventListener(const css::uno::Reference< css::lang::XEventListener > &xListener) override
Definition: unoshape.cxx:1240
SdrObject * GetSdrObject() const
Definition: unoshape.hxx:172
void ForceMetricToItemPoolMetric(Pair &rPoint) const noexcept
Definition: unoshape.cxx:418
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
Definition: unoshape.cxx:3612
virtual bool setPropertyValueImpl(const OUString &rName, const SfxItemPropertyMapEntry *pProperty, const css::uno::Any &rValue)
Definition: unoshape.cxx:2026
SVX_DLLPRIVATE void impl_initFromSdrObject()
initializes SdrObj-dependent members.
Definition: unoshape.cxx:318
SVX_DLLPRIVATE void impl_construct()
CTOR-Impl.
Definition: unoshape.cxx:303
css::awt::Point maPosition
Definition: unoshape.hxx:317
virtual css::uno::Any SAL_CALL queryAggregation(const css::uno::Type &aType) override
Definition: unoshape.cxx:268
virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override
Definition: unoshape.cxx:941
virtual void SAL_CALL setString(const OUString &aString) override
virtual css::uno::Any SAL_CALL queryAggregation(const css::uno::Type &rType)
virtual OUString SAL_CALL getString() override
virtual css::uno::Reference< css::text::XTextRange > SAL_CALL getEnd() override
virtual css::uno::Reference< css::text::XTextRange > SAL_CALL getStart() override
static OUString getNameFromId(SdrObjKind nId)
Definition: unoprov.cxx:841
static css::uno::Reference< css::awt::XBitmap > CreateBitmap(const BitmapEx &rBitmap)
const GraphicObject & GetGraphicObject() const
Definition: xtable.hxx:125
const model::ComplexColor & getComplexColor() const
Definition: xcolit.hxx:54
const XDash & GetDash() const
Definition: xtable.hxx:80
const basegfx::BGradient & GetGradient() const
Definition: xtable.hxx:110
const XHatch & GetHatch() const
Definition: xtable.hxx:95
const basegfx::B2DPolyPolygon & GetLineEnd() const
Definition: xtable.hxx:65
void set(sal_uInt16 nRow, sal_uInt16 nColumn, double fValue)
double get(sal_uInt16 nRow, sal_uInt16 nColumn) const
void transform(const basegfx::B2DHomMatrix &rMatrix)
sal_uInt32 count() const
BASEGFX_DLLPUBLIC void transform(const B2DHomMatrix &rMatrix)
bool isEmpty() const
const css::uno::Sequence< sal_Int8 > & getSeq() const
oslInterlockedCount m_refCount
css::uno::Type const & get()
virtual css::uno::Any SAL_CALL queryInterface(css::uno::Type const &rType) SAL_OVERRIDE
virtual css::uno::Any SAL_CALL queryAggregation(css::uno::Type const &rType) SAL_OVERRIDE
basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D &aViewInformation) const
ColorType getType() const
std::vector< Transformation > const & getTransformations() const
ThemeColorType getSchemeType() const
void getViewIndependentPrimitive2DContainer(drawinglayer::primitive2d::Primitive2DDecompositionVisitor &rVisitor) const
helper class for notifying XPropertyChangeListeners
Default provider for a property value.
::cppu::OWeakObject & getContext() const
virtual void getCurrentValue(css::uno::Any &_out_rValue) const
returns the current value of the property which the provider is responsible for
constexpr tools::Long GetWidth() const
constexpr tools::Long Top() const
constexpr Point TopLeft() const
tools::Long getOpenHeight() const
void setWidth(tools::Long n)
constexpr Size GetSize() const
constexpr tools::Long Right() const
constexpr tools::Long GetHeight() const
void setHeight(tools::Long n)
tools::Long getOpenWidth() const
constexpr tools::Long Left() const
constexpr tools::Long Bottom() const
int nCount
#define DBG_ASSERT(sCon, aError)
#define DBG_TESTSOLARMUTEX()
double toRadians(D x)
#define DBG_UNHANDLED_EXCEPTION(...)
virtual void IsDecorative(bool &rIsDecorative) override
virtual OUString GetName() const override
virtual void GetDescription(OUString &rName) override
float u
EmbeddedObjectRef * pObject
sal_Int16 nValue
Definition: fmsrccfg.cxx:81
uno::Reference< uno::XInterface > SvxUnoGluePointAccess_createInstance(SdrObject *pObject)
Create a SvxUnoGluePointAccess.
Definition: gluepts.cxx:517
OUString aName
Mode eMode
void * p
sal_uInt16 nPos
Sequence< sal_Int8 > aSeq
#define SAL_WARN_IF(condition, area, stream)
MapUnit
#define MID_COLOR_LUM_MOD
#define MID_COMPLEX_COLOR
#define MID_NAME
#define MID_COLOR_THEME_INDEX
#define MID_COLOR_LUM_OFF
NONE
B2DHomMatrix createScaleB2DHomMatrix(double fScaleX, double fScaleY)
B2DPolyPolygon UnoPointSequenceSequenceToB2DPolyPolygon(const css::drawing::PointSequenceSequence &rPointSequenceSequenceSource)
B2DHomMatrix createTranslateB2DHomMatrix(double fTranslateX, double fTranslateY)
void B2DPolyPolygonToUnoPolyPolygonBezierCoords(const B2DPolyPolygon &rPolyPolygon, css::drawing::PolyPolygonBezierCoords &rPolyPolygonBezierCoordsRetval)
B2DHomMatrix createScaleShearXRotateTranslateB2DHomMatrix(double fScaleX, double fScaleY, double fShearX, double fRadiant, double fTranslateX, double fTranslateY)
B2DPolyPolygon UnoPolyPolygonBezierCoordsToB2DPolyPolygon(const css::drawing::PolyPolygonBezierCoords &rPolyPolygonBezierCoordsSource)
B2IRange fround(const B2DRange &rRange)
size
sal_Int64 getSomethingImpl(const css::uno::Sequence< sal_Int8 > &rId, T *pThis, FallbackToGetSomethingOf< Base >={})
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)
BitmapEx convertPrimitive2DContainerToBitmapEx(primitive2d::Primitive2DContainer &&rSequence, const basegfx::B2DRange &rTargetRange, sal_uInt32 nMaximumQuadraticPixels, const o3tl::Length eTargetUnit, const std::optional< Size > &rTargetDPI)
constexpr Point convert(const Point &rPoint, o3tl::Length eFrom, o3tl::Length eTo)
void dispose()
long Long
UNOTOOLS_DLLPUBLIC bool GetTitle(OUString const &url, OUString *title)
sal_Int16 nId
SvxUnoPropertyMapProvider & getSvxMapProvider()
Definition: unoprov.cxx:868
static SfxItemSet & rSet
css::uno::Type aType
::comphelper::OInterfaceContainerHelper4< css::lang::XEventListener > maDisposeListeners
Definition: unoshape.cxx:128
svx::PropertyChangeNotifier maPropertyNotifier
Definition: unoshape.cxx:129
SvxShapeImpl(SvxShape &_rAntiImpl)
Definition: unoshape.cxx:131
::unotools::WeakReference< SdrObject > mxCreatedObj
CL, OD 2005-07-19 #i52126# - this is initially 0 and set when a SvxShape::Create() call is executed.
Definition: unoshape.cxx:125
std::optional< SfxItemSet > mxItemSet
Definition: unoshape.cxx:115
SvxShapeMaster * mpMaster
Definition: unoshape.cxx:117
SdrObjKind mnObjId
Definition: unoshape.cxx:116
bool mbDisposing
Definition: unoshape.cxx:118
UNDERLYING_TYPE get() const
bool hasValue()
constexpr TypedWhichId< SdrAngleItem > SDRATTR_CIRCSTARTANGLE(SDRATTR_CIRC_FIRST+1)
constexpr TypedWhichId< SdrShearAngleItem > SDRATTR_SHEARANGLE(SDRATTR_NOTPERSIST_FIRST+17)
constexpr TypedWhichId< SdrCircKindItem > SDRATTR_CIRCKIND(SDRATTR_CIRC_FIRST+0)
constexpr TypedWhichId< SdrLayerNameItem > SDRATTR_LAYERNAME(SDRATTR_NOTPERSIST_FIRST+4)
constexpr TypedWhichId< SdrTextFitToSizeTypeItem > SDRATTR_TEXT_FITTOSIZE(SDRATTR_MISC_FIRST+3)
constexpr TypedWhichId< SvXMLAttrContainerItem > SDRATTR_XMLATTRIBUTES(SDRATTR_MISC_FIRST+22)
constexpr TypedWhichId< SdrLayerIdItem > SDRATTR_LAYERID(SDRATTR_NOTPERSIST_FIRST+3)
constexpr TypedWhichId< SdrObjPrintableItem > SDRATTR_OBJPRINTABLE(SDRATTR_NOTPERSIST_FIRST+2)
constexpr TypedWhichId< SdrAngleItem > SDRATTR_CIRCENDANGLE(SDRATTR_CIRC_FIRST+2)
constexpr TypedWhichId< SdrYesNoItem > SDRATTR_OBJSIZEPROTECT(SDRATTR_NOTPERSIST_FIRST+1)
constexpr TypedWhichId< SdrObjVisibleItem > SDRATTR_OBJVISIBLE(SDRATTR_NOTPERSIST_FIRST+35)
constexpr TypedWhichId< SdrYesNoItem > SDRATTR_OBJMOVEPROTECT(SDRATTR_NOTPERSIST_FIRST+0)
constexpr TypedWhichId< SfxStringItem > SDRATTR_OBJECTNAME(SDRATTR_NOTPERSIST_FIRST+5)
constexpr sal_uInt16 SDRATTR_NOTPERSIST_LAST(SDRATTR_OBJVISIBLE)
constexpr TypedWhichId< SvxWritingModeItem > SDRATTR_TEXTDIRECTION(SDRATTR_NOTPERSIST_FIRST+34)
constexpr TypedWhichId< SdrMetricItem > SDRATTR_CORNER_RADIUS(SDRATTR_MISC_FIRST+0)
constexpr TypedWhichId< SvxFrameDirectionItem > SDRATTR_WRITINGMODE2(SDRATTR_WRITINGMODE2_FIRST+0)
constexpr sal_uInt16 SDRATTR_NOTPERSIST_FIRST(SDRATTR_CIRC_LAST+1)
constexpr TypedWhichId< SdrAngleItem > SDRATTR_ROTATEANGLE(SDRATTR_NOTPERSIST_FIRST+16)
SdrTextObj * DynCastSdrTextObj(SdrObject *pObj)
Definition: svdobj.cxx:3212
SdrInventor
Definition: svdobj.hxx:98
SdrObjKind
Definition: svdobjkind.hxx:25
@ Group
abstract object (SdrObject)
@ Measure
object that represents a SdrPage
@ Page
Polyline represented by SdrPathObj.
@ Caption
connector object
@ Media
custom shape
@ PathFill
open Bezier-curve
@ OLE2Applet
table
@ Line
object group
@ Polygon
circle cut
@ Table
media shape
@ FreehandLine
closed Bezier-curve
@ UNO
continuously activated OLE (PlugIn-Frame or similar)
@ PathLine
PolyLine.
@ CustomShape
Universal Network Object packed into SvDraw object.
@ CircleOrEllipse
rectangle (round corners optional)
@ PathPoly
caption object
@ Text
closed free-hand line
@ OLE2
foreign graphic (StarView Graphic)
@ OLEPluginFrame
measurement object
@ Graphic
OutlineText, special text object for StarDraw.
@ CircleCut
circle arc
@ Rectangle
line
@ PathPolyLine
Polygon/PolyPolygon represented by SdrPathObj.
@ CircleSection
circle, ellipse
@ OutlineText
TitleText, special text object for StarDraw.
@ CircleArc
circle section
@ PolyLine
polygon, PolyPolygon
@ Edge
OLE object.
@ TitleText
text object
@ FreehandFill
open free-hand line
o3tl::strong_int< sal_Int16, struct SdrLayerIDTag > SdrLayerID
Definition: svdtypes.hxx:56
bool bVisible
unsigned char sal_Bool
signed char sal_Int8
OUString sId
OUString SvxUnogetInternalNameForItem(const sal_uInt16 nWhich, const OUString &rApiName)
if the given name is a predefined api name it is replaced by the predefined name for the current lang...
Definition: unoprov.cxx:2024
#define SVXMAP_SHAPE
Sorter.
Definition: unoprov.hxx:52
#define SVXMAP_TEXT
Definition: unoprov.hxx:72
constexpr OUStringLiteral sUNO_service_drawing_OLE2Shape
Definition: unoshape.cxx:3191
constexpr OUStringLiteral sUNO_service_style_CharacterPropertiesAsian
Definition: unoshape.cxx:3161
constexpr OUStringLiteral sUNO_service_drawing_EllipseShape
Definition: unoshape.cxx:3184
constexpr OUStringLiteral sUNO_service_style_CharacterProperties
Definition: unoshape.cxx:3159
constexpr OUStringLiteral sUNO_service_drawing_PolyPolygonShape
Definition: unoshape.cxx:3185
constexpr OUStringLiteral sUNO_service_drawing_CaptionShape
Definition: unoshape.cxx:3193
constexpr OUStringLiteral sUNO_service_drawing_MeasureProperties
Definition: unoshape.cxx:3167
constexpr OUStringLiteral sUNO_service_drawing_ConnectorShape
Definition: unoshape.cxx:3197
constexpr OUStringLiteral sUNO_service_style_CharacterPropertiesComplex
Definition: unoshape.cxx:3160
constexpr OUStringLiteral sUNO_service_drawing_TextProperties
Definition: unoshape.cxx:3164
constexpr OUStringLiteral sUNO_service_drawing_GraphicObjectShape
Definition: unoshape.cxx:3190
constexpr OUStringLiteral sUNO_service_drawing_ClosedBezierShape
Definition: unoshape.cxx:3188
constexpr OUStringLiteral sUNO_service_drawing_PageShape
Definition: unoshape.cxx:3192
static bool svx_needLogicRectHack(SdrObject const *pObj)
Definition: unoshape.cxx:994
constexpr OUStringLiteral sUNO_service_drawing_FillProperties
Definition: unoshape.cxx:3163
constexpr OUStringLiteral sUNO_service_drawing_LineShape
Definition: unoshape.cxx:3181
static void svx_setLogicRectHack(SdrObject *pObj, const tools::Rectangle &rRect)
Definition: unoshape.cxx:1034
constexpr OUStringLiteral sUNO_service_drawing_CustomShapeProperties
Definition: unoshape.cxx:3175
constexpr OUStringLiteral sUNO_service_drawing_Shape
Definition: unoshape.cxx:3182
constexpr OUStringLiteral sUNO_service_style_ParagraphProperties
Definition: unoshape.cxx:3156
constexpr OUStringLiteral sUNO_service_drawing_MeasureShape
Definition: unoshape.cxx:3194
constexpr OUStringLiteral sUNO_service_drawing_ConnectorProperties
Definition: unoshape.cxx:3166
constexpr OUStringLiteral sUNO_service_drawing_CustomShape
Definition: unoshape.cxx:3176
constexpr OUStringLiteral sUNO_service_drawing_PolyLineShape
Definition: unoshape.cxx:3186
void SvxItemPropertySet_setPropertyValue(const SfxItemPropertyMapEntry *pMap, const uno::Any &rVal, SfxItemSet &rSet)
Definition: unoshape.cxx:4036
constexpr OUStringLiteral sUNO_service_style_ParagraphPropertiesAsian
Definition: unoshape.cxx:3158
constexpr OUStringLiteral sUNO_service_drawing_Text
Definition: unoshape.cxx:3172
constexpr OUStringLiteral sUNO_service_drawing_PolyPolygonDescriptor
Definition: unoshape.cxx:3178
constexpr OUStringLiteral sUNO_service_drawing_RectangleShape
Definition: unoshape.cxx:3183
constexpr OUStringLiteral sUNO_service_drawing_GroupShape
Definition: unoshape.cxx:3173
constexpr OUStringLiteral sUNO_service_drawing_PolyPolygonBezierDescriptor
Definition: unoshape.cxx:3179
uno::Any SvxItemPropertySet_getPropertyValue(const SfxItemPropertyMapEntry *pMap, const SfxItemSet &rSet)
Definition: unoshape.cxx:4026
constexpr OUStringLiteral sUNO_service_drawing_MediaShape
Definition: unoshape.cxx:3198
constexpr OUStringLiteral sUNO_service_style_ParagraphPropertiesComplex
Definition: unoshape.cxx:3157
constexpr OUStringLiteral sUNO_service_drawing_TextShape
Definition: unoshape.cxx:3189
constexpr OUStringLiteral sUNO_service_drawing_RotationDescriptor
Definition: unoshape.cxx:3170
constexpr OUStringLiteral sUNO_service_drawing_ShadowProperties
Definition: unoshape.cxx:3168
static void SvxItemPropertySet_ObtainSettingsFromPropertySet(const SvxItemPropertySet &rPropSet, SvxItemPropertySetUsrAnys &rAnys, SfxItemSet &rSet, const uno::Reference< beans::XPropertySet > &xSet, const SfxItemPropertyMap *pMap)
Definition: unoshape.cxx:542
constexpr OUStringLiteral sUNO_service_drawing_ControlShape
Definition: unoshape.cxx:3196
constexpr OUStringLiteral sUNO_service_drawing_LineProperties
Definition: unoshape.cxx:3165
constexpr OUStringLiteral sUNO_service_drawing_FrameShape
Definition: unoshape.cxx:3195
constexpr OUStringLiteral sUNO_service_drawing_OpenBezierShape
Definition: unoshape.cxx:3187
uno::Reference< drawing::XShape > GetXShapeForSdrObject(SdrObject *pObj) noexcept
returns a StarOffice API wrapper for the given SdrObject
Definition: unoshape.cxx:4013
static tools::Rectangle svx_getLogicRectHack(SdrObject const *pObj)
Definition: unoshape.cxx:1021
#define OWN_ATTR_MISC_OBJ_TITLE
Definition: unoshprp.hxx:167
#define OWN_ATTR_METAFILE
Definition: unoshprp.hxx:96
#define OWN_ATTR_HYPERLINK
Definition: unoshprp.hxx:198
#define OWN_ATTR_INTEROPGRABBAG
Definition: unoshprp.hxx:182
#define OWN_ATTR_EDGE_START_OBJ
Definition: unoshprp.hxx:90
#define OWN_ATTR_MEASURE_END_POS
Definition: unoshprp.hxx:110
#define OWN_ATTR_FILLBMP_MODE
Definition: unoshprp.hxx:114
#define OWN_ATTR_EDGE_POLYPOLYGONBEZIER
Definition: unoshprp.hxx:178
#define OWN_ATTR_TRANSFORMATION
Definition: unoshprp.hxx:115
#define OWN_ATTR_FRAMERECT
Definition: unoshprp.hxx:94
#define OWN_ATTR_TEXTCOLUMNS
Definition: unoshprp.hxx:197
#define OWN_ATTR_LDNAME
Definition: unoshprp.hxx:99
#define OWN_ATTR_BITMAP
Definition: unoshprp.hxx:89
#define OWN_ATTR_CAPTION_POINT
Definition: unoshprp.hxx:148
#define OWN_ATTR_LDBITMAP
Definition: unoshprp.hxx:100
#define OWN_ATTR_GLUEID_HEAD
Definition: unoshprp.hxx:107
#define OWN_ATTR_EDGE_START_POS
Definition: unoshprp.hxx:91
#define OWN_ATTR_MISC_OBJ_DECORATIVE
Definition: unoshprp.hxx:199
#define OWN_ATTR_PAGE_NUMBER
Definition: unoshprp.hxx:149
#define OWN_ATTR_GLUEID_TAIL
Definition: unoshprp.hxx:106
#define OWN_ATTR_BOUNDRECT
Definition: unoshprp.hxx:98
#define OWN_ATTR_MISC_OBJ_DESCRIPTION
Definition: unoshprp.hxx:168
#define OWN_ATTR_MEASURE_START_POS
Definition: unoshprp.hxx:109
#define OWN_ATTR_UINAME_SINGULAR
Definition: unoshprp.hxx:159
#define OWN_ATTR_EDGE_END_POS
Definition: unoshprp.hxx:93
#define OWN_ATTR_MIRRORED
Definition: unoshprp.hxx:104
#define OWN_ATTR_ZORDER
Definition: unoshprp.hxx:108
#define OWN_ATTR_TEXTFITTOSIZESCALE
Definition: unoshprp.hxx:196
#define OWN_ATTR_EDGE_END_OBJ
Definition: unoshprp.hxx:92
#define OWN_ATTR_ISFONTWORK
Definition: unoshprp.hxx:97
#define OWN_ATTR_UINAME_PLURAL
Definition: unoshprp.hxx:160
const SvxItemPropertySet * ImplGetSvxUnoOutlinerTextCursorSvxPropertySet()
VCL_DLLPUBLIC bool ConvertGDIMetaFileToWMF(const GDIMetaFile &rMTF, SvStream &rTargetStream, FilterConfigItem const *pConfigItem, bool bPlaceable=true)
constexpr TypedWhichId< XFillColorItem > XATTR_FILLCOLOR(XATTR_FILL_FIRST+1)
constexpr TypedWhichId< XLineColorItem > XATTR_LINECOLOR(XATTR_LINE_FIRST+3)
constexpr TypedWhichId< SfxMetricItem > XATTR_FILLBMP_SIZEX(XATTR_FILL_FIRST+9)
constexpr TypedWhichId< XLineDashItem > XATTR_LINEDASH(XATTR_LINE_FIRST+1)
constexpr TypedWhichId< XLineEndItem > XATTR_LINEEND(XATTR_LINE_FIRST+5)
constexpr TypedWhichId< XLineStartItem > XATTR_LINESTART(XATTR_LINE_FIRST+4)
constexpr TypedWhichId< XFillBmpSizeYItem > XATTR_FILLBMP_SIZEY(XATTR_FILL_FIRST+10)
constexpr TypedWhichId< XFillBmpStretchItem > XATTR_FILLBMP_STRETCH(XATTR_FILL_FIRST+16)
constexpr TypedWhichId< XFillHatchItem > XATTR_FILLHATCH(XATTR_FILL_FIRST+3)
constexpr TypedWhichId< XFillBmpTileItem > XATTR_FILLBMP_TILE(XATTR_FILL_FIRST+7)
constexpr TypedWhichId< XFillBitmapItem > XATTR_FILLBITMAP(XATTR_FILL_FIRST+4)
constexpr TypedWhichId< XFillFloatTransparenceItem > XATTR_FILLFLOATTRANSPARENCE(XATTR_FILL_FIRST+11)
constexpr TypedWhichId< XFillGradientItem > XATTR_FILLGRADIENT(XATTR_FILL_FIRST+2)