Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #include <cppuhelper/typeprovider.hxx>
21 : #include <cppuhelper/supportsservice.hxx>
22 : #include <com/sun/star/awt/XBitmap.hpp>
23 : #include <com/sun/star/awt/Rectangle.hpp>
24 : #include <com/sun/star/drawing/CircleKind.hpp>
25 : #include <com/sun/star/embed/NoVisualAreaSizeException.hpp>
26 : #include <vcl/svapp.hxx>
27 : #include <svl/itemprop.hxx>
28 : #include <vcl/fltcall.hxx>
29 : #include <osl/mutex.hxx>
30 : #include <editeng/unotext.hxx>
31 : #include <svx/svdobj.hxx>
32 : #include <svx/svdoole2.hxx>
33 : #include "svx/shapepropertynotifier.hxx"
34 : #include <comphelper/extract.hxx>
35 : #include <comphelper/scopeguard.hxx>
36 : #include <comphelper/servicehelper.hxx>
37 : #include <comphelper/serviceinfohelper.hxx>
38 : #include <toolkit/helper/vclunohelper.hxx>
39 : #include <vcl/gfxlink.hxx>
40 : #include <vcl/virdev.hxx>
41 : #include <sfx2/objsh.hxx>
42 : #include <sfx2/viewsh.hxx>
43 : #include "svx/svdopage.hxx"
44 : #include "svx/xflbstit.hxx"
45 : #include "svx/xflbmtit.hxx"
46 : #include "svx/xlnstit.hxx"
47 : #include "svx/xlnedit.hxx"
48 : #include "svx/svdogrp.hxx"
49 : #include "svx/scene3d.hxx"
50 : #include "svx/svdmodel.hxx"
51 : #include "svx/globl3d.hxx"
52 : #include "svx/fmglob.hxx"
53 : #include "svx/unopage.hxx"
54 : #include "svx/view3d.hxx"
55 : #include "svx/unoshape.hxx"
56 : #include "svx/svxids.hrc"
57 : #include "svx/unoshtxt.hxx"
58 : #include "svx/svdpage.hxx"
59 : #include "svx/unoshprp.hxx"
60 : #include "svx/sxciaitm.hxx"
61 : #include "svx/svdograf.hxx"
62 : #include "svx/unoapi.hxx"
63 : #include "svx/svdomeas.hxx"
64 : #include "svx/svdpagv.hxx"
65 : #include "svx/svdpool.hxx"
66 : #include <tools/gen.hxx>
67 : #include "svx/dialmgr.hxx"
68 : #include "svx/dialogs.hrc"
69 : #include "svx/svdocapt.hxx"
70 : #include <svx/obj3d.hxx>
71 : #include <tools/diagnose_ex.h>
72 : #include "svx/xflftrit.hxx"
73 : #include "svx/xtable.hxx"
74 : #include "svx/xbtmpit.hxx"
75 : #include "svx/xflgrit.hxx"
76 : #include "svx/xflhtit.hxx"
77 : #include "svx/xlndsit.hxx"
78 : #include "svdglob.hxx"
79 : #include "svx/svdstr.hrc"
80 : #include "svx/unomaster.hxx"
81 : #include <editeng/outlobj.hxx>
82 : #include <basegfx/matrix/b2dhommatrix.hxx>
83 : #include <basegfx/matrix/b2dhommatrixtools.hxx>
84 : #include <basegfx/polygon/b2dpolypolygontools.hxx>
85 : #include <basegfx/tools/unotools.hxx>
86 : #include "gluepts.hxx"
87 : #include "shapeimpl.hxx"
88 : #include <sal/log.hxx>
89 :
90 : #include <vector>
91 :
92 : #include "svx/lathe3d.hxx"
93 : #include "svx/extrud3d.hxx"
94 :
95 : #include <boost/bind.hpp>
96 : #include <boost/scoped_ptr.hpp>
97 : #include <vcl/wmf.hxx>
98 :
99 : using namespace ::osl;
100 : using namespace ::cppu;
101 : using namespace ::com::sun::star;
102 : using namespace ::com::sun::star::uno;
103 : using namespace ::com::sun::star::lang;
104 : using namespace ::com::sun::star::container;
105 : using ::svx::PropertyValueProvider;
106 : using ::svx::IPropertyValueProvider;
107 :
108 : class GDIMetaFile;
109 :
110 127926 : struct SvxShapeImpl
111 : {
112 : SvxShape& mrAntiImpl;
113 : SfxItemSet* mpItemSet;
114 : sal_uInt32 mnObjId;
115 : SvxShapeMaster* mpMaster;
116 : bool mbHasSdrObjectOwnership;
117 : bool mbDisposing;
118 :
119 : /** CL, OD 2005-07-19 #i52126# - this is initially 0 and set when
120 : * a SvxShape::Create() call is executed. It is then set to the created
121 : * SdrObject so a multiple call to SvxShape::Create() with same SdrObject
122 : * is prohibited.
123 : */
124 : ::tools::WeakReference< SdrObject > mpCreatedObj;
125 :
126 : // for xComponent
127 : ::cppu::OInterfaceContainerHelper maDisposeListeners;
128 : ::svx::PropertyChangeNotifier maPropertyNotifier;
129 :
130 128386 : SvxShapeImpl( SvxShape& _rAntiImpl, ::osl::Mutex& _rMutex )
131 : :mrAntiImpl( _rAntiImpl )
132 : ,mpItemSet( NULL )
133 : ,mnObjId( 0 )
134 : ,mpMaster( NULL )
135 : ,mbHasSdrObjectOwnership( false )
136 : ,mbDisposing( false )
137 : ,mpCreatedObj()
138 : ,maDisposeListeners( _rMutex )
139 128386 : ,maPropertyNotifier( _rAntiImpl, _rMutex )
140 : {
141 128386 : }
142 : };
143 :
144 255852 : class ShapePositionProvider : public PropertyValueProvider
145 : {
146 : public:
147 128386 : ShapePositionProvider( const SvxShapeImpl& _shapeImpl )
148 128386 : :PropertyValueProvider( _shapeImpl.mrAntiImpl, "Position" )
149 : {
150 128386 : }
151 :
152 : protected:
153 0 : virtual void getCurrentValue( Any& _out_rCurrentValue ) const SAL_OVERRIDE
154 : {
155 0 : _out_rCurrentValue <<= static_cast< SvxShape& >( getContext() ).getPosition();
156 0 : }
157 : };
158 :
159 :
160 255852 : class ShapeSizeProvider : public PropertyValueProvider
161 : {
162 : public:
163 128386 : ShapeSizeProvider( const SvxShapeImpl& _shapeImpl )
164 128386 : :PropertyValueProvider( _shapeImpl.mrAntiImpl, "Size" )
165 : {
166 128386 : }
167 :
168 : protected:
169 0 : virtual void getCurrentValue( Any& _out_rCurrentValue ) const SAL_OVERRIDE
170 : {
171 0 : _out_rCurrentValue <<= static_cast< SvxShape& >( getContext() ).getSize();
172 0 : }
173 : };
174 :
175 2 : SvxShape::SvxShape( SdrObject* pObject ) throw( uno::RuntimeException )
176 : : maSize(100,100)
177 2 : , mpImpl( new SvxShapeImpl( *this, maMutex ) )
178 : , mbIsMultiPropertyCall(false)
179 2 : , mpPropSet(getSvxMapProvider().GetPropertySet(SVXMAP_SHAPE, SdrObject::GetGlobalDrawObjectItemPool()))
180 2 : , maPropMapEntries(getSvxMapProvider().GetMap(SVXMAP_SHAPE))
181 : , mpObj(pObject)
182 : , mpModel(NULL)
183 8 : , mnLockCount(0)
184 : {
185 2 : impl_construct();
186 2 : }
187 :
188 :
189 128384 : SvxShape::SvxShape( SdrObject* pObject, const SfxItemPropertyMapEntry* pEntries, const SvxItemPropertySet* pPropertySet ) throw( uno::RuntimeException )
190 : : maSize(100,100)
191 128384 : , mpImpl( new SvxShapeImpl( *this, maMutex ) )
192 : , mbIsMultiPropertyCall(false)
193 : , mpPropSet(pPropertySet)
194 : , maPropMapEntries(pEntries)
195 : , mpObj(pObject)
196 : , mpModel(NULL)
197 256768 : , mnLockCount(0)
198 : {
199 128384 : impl_construct();
200 128384 : }
201 :
202 :
203 0 : SvxShape::SvxShape() throw( uno::RuntimeException )
204 : : maSize(100,100)
205 0 : , mpImpl( new SvxShapeImpl( *this, maMutex ) )
206 : , mbIsMultiPropertyCall(false)
207 0 : , mpPropSet(getSvxMapProvider().GetPropertySet(SVXMAP_SHAPE, SdrObject::GetGlobalDrawObjectItemPool()))
208 0 : , maPropMapEntries(getSvxMapProvider().GetMap(SVXMAP_SHAPE))
209 : , mpObj(NULL)
210 : , mpModel(NULL)
211 0 : , mnLockCount(0)
212 : {
213 0 : impl_construct();
214 0 : }
215 :
216 :
217 257822 : SvxShape::~SvxShape() throw()
218 : {
219 127926 : ::SolarMutexGuard aGuard;
220 :
221 : DBG_ASSERT( mnLockCount == 0, "Locked shape was disposed!" );
222 :
223 127926 : if ( mpModel )
224 118058 : EndListening( *mpModel );
225 :
226 127926 : if ( mpImpl->mpMaster )
227 20914 : mpImpl->mpMaster->dispose();
228 :
229 127926 : if ( mpObj.is() )
230 100427 : mpObj->setUnoShape(NULL);
231 :
232 127926 : if( HasSdrObjectOwnership() && mpObj.is() )
233 : {
234 5448 : mpImpl->mbHasSdrObjectOwnership = false;
235 5448 : SdrObject* pObject = mpObj.get();
236 5448 : SdrObject::Free( pObject );
237 : }
238 :
239 127926 : delete mpImpl, mpImpl = NULL;
240 :
241 127926 : EndListeningAll(); // call explictily within SolarMutexGuard
242 129896 : }
243 :
244 :
245 :
246 5448 : void SvxShape::TakeSdrObjectOwnership()
247 : {
248 5448 : mpImpl->mbHasSdrObjectOwnership = true;
249 5448 : }
250 :
251 :
252 :
253 185184 : bool SvxShape::HasSdrObjectOwnership() const
254 : {
255 185184 : if ( !mpImpl->mbHasSdrObjectOwnership )
256 179736 : return false;
257 :
258 : OSL_ENSURE( mpObj.is(), "SvxShape::HasSdrObjectOwnership: have the ownership of an object which I don't know!" );
259 5448 : return mpObj.is();
260 : }
261 :
262 :
263 :
264 125974 : void SvxShape::setShapeKind( sal_uInt32 nKind )
265 : {
266 125974 : mpImpl->mnObjId = nKind;
267 125974 : }
268 :
269 :
270 :
271 41828 : sal_uInt32 SvxShape::getShapeKind() const
272 : {
273 41828 : return mpImpl->mnObjId;
274 : }
275 :
276 :
277 :
278 41828 : void SvxShape::setMaster( SvxShapeMaster* pMaster )
279 : {
280 41828 : mpImpl->mpMaster = pMaster;
281 41828 : }
282 :
283 :
284 :
285 2077407 : uno::Any SAL_CALL SvxShape::queryAggregation( const uno::Type& rType ) throw (uno::RuntimeException, std::exception)
286 : {
287 2077407 : if( mpImpl->mpMaster )
288 : {
289 218036 : uno::Any aAny;
290 218036 : if( mpImpl->mpMaster->queryAggregation( rType, aAny ) )
291 98 : return aAny;
292 : }
293 :
294 2077309 : return SvxShape_UnoImplHelper::queryAggregation(rType);
295 : }
296 :
297 : namespace
298 : {
299 : class theSvxShapeUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theSvxShapeUnoTunnelId > {};
300 : }
301 :
302 923128 : const ::com::sun::star::uno::Sequence< sal_Int8 > & SvxShape::getUnoTunnelId() throw()
303 : {
304 923128 : return theSvxShapeUnoTunnelId::get().getSeq();
305 : }
306 :
307 :
308 345384 : SvxShape* SvxShape::getImplementation( const uno::Reference< uno::XInterface >& xInt )
309 : {
310 345384 : uno::Reference< lang::XUnoTunnel > xUT( xInt, ::com::sun::star::uno::UNO_QUERY );
311 345384 : if( xUT.is() )
312 317223 : return reinterpret_cast<SvxShape*>(sal::static_int_cast<sal_uIntPtr>(xUT->getSomething( SvxShape::getUnoTunnelId())));
313 : else
314 28161 : return NULL;
315 : }
316 :
317 :
318 485473 : sal_Int64 SAL_CALL SvxShape::getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& rId ) throw(::com::sun::star::uno::RuntimeException, std::exception) \
319 : {
320 485473 : if( rId.getLength() == 16 && 0 == memcmp( getUnoTunnelId().getConstArray(), rId.getConstArray(), 16 ) )
321 : {
322 435679 : return sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_uIntPtr>(this));
323 : }
324 : else
325 : {
326 49794 : return 0;
327 : }
328 : }
329 :
330 :
331 393509 : ::svx::PropertyChangeNotifier& SvxShape::getShapePropertyChangeNotifier()
332 : {
333 393509 : return mpImpl->maPropertyNotifier;
334 : }
335 :
336 :
337 128386 : void SvxShape::impl_construct()
338 : {
339 : mpImpl->maPropertyNotifier.registerProvider( ::svx::eShapePosition,
340 128386 : ::svx::PPropertyValueProvider( new ShapePositionProvider( *mpImpl ) ) );
341 : mpImpl->maPropertyNotifier.registerProvider( ::svx::eShapeSize,
342 128386 : ::svx::PPropertyValueProvider( new ShapeSizeProvider( *mpImpl ) ) );
343 :
344 128386 : if ( mpObj.is() )
345 61610 : impl_initFromSdrObject();
346 128386 : }
347 :
348 :
349 128878 : void SvxShape::impl_initFromSdrObject()
350 : {
351 : DBG_TESTSOLARMUTEX();
352 : OSL_PRECOND( mpObj.is(), "SvxShape::impl_initFromSdrObject: not to be called without SdrObject!" );
353 128878 : if ( !mpObj.is() )
354 128878 : return;
355 :
356 128878 : osl_atomic_increment( &m_refCount );
357 : {
358 128878 : mpObj->setUnoShape(*this);
359 : }
360 128878 : osl_atomic_decrement( &m_refCount );
361 :
362 128878 : mpModel = mpObj->GetModel();
363 :
364 : // #i40944#
365 : // Do not simply return when no model but do the type corrections
366 : // following below.
367 128878 : if(mpModel)
368 : {
369 122756 : StartListening( *mpModel );
370 : }
371 :
372 128878 : const sal_uInt32 nInventor = mpObj->GetObjInventor();
373 :
374 : // is it one of ours (svx) ?
375 128878 : if( nInventor == SdrInventor || nInventor == E3dInventor || nInventor == FmFormInventor )
376 : {
377 128878 : if(nInventor == FmFormInventor)
378 : {
379 1428 : mpImpl->mnObjId = OBJ_UNO;
380 : }
381 : else
382 : {
383 127450 : mpImpl->mnObjId = mpObj->GetObjIdentifier();
384 127450 : if( nInventor == E3dInventor )
385 5543 : mpImpl->mnObjId |= E3D_INVENTOR_FLAG;
386 : }
387 :
388 128878 : switch(mpImpl->mnObjId)
389 : {
390 : case OBJ_CCUT: // Kreisabschnitt
391 : case OBJ_CARC: // Kreisbogen
392 : case OBJ_SECT: // Kreissektor
393 70 : mpImpl->mnObjId = OBJ_CIRC;
394 70 : break;
395 :
396 : case E3D_SCENE_ID | E3D_INVENTOR_FLAG:
397 0 : mpImpl->mnObjId = E3D_POLYSCENE_ID | E3D_INVENTOR_FLAG;
398 0 : break;
399 : }
400 : }
401 : }
402 :
403 :
404 67268 : void SvxShape::Create( SdrObject* pNewObj, SvxDrawPage* /*pNewPage*/ )
405 : {
406 : DBG_TESTSOLARMUTEX();
407 :
408 : OSL_PRECOND( pNewObj, "SvxShape::Create: invalid new object!" );
409 67268 : if ( !pNewObj )
410 67268 : return;
411 :
412 67268 : SdrObject* pCreatedObj = mpImpl->mpCreatedObj.get();
413 : OSL_ENSURE( ( pCreatedObj == NULL ) || ( pCreatedObj == pNewObj ),
414 : "SvxShape::Create: the same shape used for two different objects?! Strange ..." );
415 :
416 : // Correct condition (#i52126#)
417 67268 : if ( pCreatedObj != pNewObj )
418 : {
419 : DBG_ASSERT( pNewObj->GetModel(), "no model for SdrObject?" );
420 : // Correct condition (#i52126#)
421 67268 : mpImpl->mpCreatedObj = pNewObj;
422 :
423 67268 : if( mpObj.is() && mpObj->GetModel() )
424 : {
425 0 : EndListening( *mpObj->GetModel() );
426 : }
427 :
428 67268 : mpObj.reset( pNewObj );
429 :
430 : OSL_ENSURE( !mbIsMultiPropertyCall, "SvxShape::Create: hmm?" );
431 : // this was previously set in impl_initFromSdrObject, but I think it was superfluous
432 : // (it definitely was in the other context where it was called, but I strongly suppose
433 : // it was also superfluous when called from here)
434 67268 : impl_initFromSdrObject();
435 :
436 67268 : ObtainSettingsFromPropertySet( *mpPropSet );
437 :
438 : // save user call
439 67268 : SdrObjUserCall* pUser = mpObj->GetUserCall();
440 67268 : mpObj->SetUserCall(NULL);
441 :
442 67268 : setPosition( maPosition );
443 67268 : setSize( maSize );
444 :
445 : // restore user call after we set the initial size
446 67268 : mpObj->SetUserCall( pUser );
447 :
448 : // if this shape was already named, use this name
449 67268 : if( !maShapeName.isEmpty() )
450 : {
451 1874 : mpObj->SetName( maShapeName );
452 1874 : maShapeName = OUString();
453 : }
454 : }
455 : }
456 :
457 :
458 :
459 658 : void SvxShape::ChangeModel( SdrModel* pNewModel )
460 : {
461 : DBG_TESTSOLARMUTEX();
462 658 : if( mpObj.is() && mpObj->GetModel() )
463 : {
464 0 : if( mpObj->GetModel() != pNewModel )
465 : {
466 0 : EndListening( *mpObj->GetModel() );
467 : }
468 : }
469 :
470 : // Always listen to new model (#i52126#)
471 658 : if( pNewModel )
472 : {
473 658 : StartListening( *pNewModel );
474 : }
475 :
476 : // HACK #i53696# ChangeModel should be virtual, but it isn't. can't change that for 2.0.1
477 658 : SvxShapeText* pShapeText = dynamic_cast< SvxShapeText* >( this );
478 658 : if( pShapeText )
479 : {
480 658 : SvxTextEditSource* pTextEditSource = dynamic_cast< SvxTextEditSource* >( pShapeText->GetEditSource() );
481 658 : if( pTextEditSource )
482 0 : pTextEditSource->ChangeModel( pNewModel );
483 : }
484 :
485 658 : mpModel = pNewModel;
486 :
487 658 : if( mpImpl->mpMaster )
488 6 : mpImpl->mpMaster->modelChanged( pNewModel );
489 658 : }
490 :
491 :
492 :
493 197264 : void SvxShape::ForceMetricToItemPoolMetric(Pair& rPoint) const throw()
494 : {
495 : DBG_TESTSOLARMUTEX();
496 197264 : if(mpModel)
497 : {
498 197264 : SfxMapUnit eMapUnit = mpModel->GetItemPool().GetMetric(0);
499 197264 : if(eMapUnit != SFX_MAPUNIT_100TH_MM)
500 : {
501 25106 : switch(eMapUnit)
502 : {
503 : case SFX_MAPUNIT_TWIP :
504 : {
505 25106 : rPoint.A() = MM_TO_TWIPS(rPoint.A());
506 25106 : rPoint.B() = MM_TO_TWIPS(rPoint.B());
507 25106 : break;
508 : }
509 : default:
510 : {
511 : OSL_FAIL("AW: Missing unit translation to PoolMetric!");
512 : }
513 : }
514 : }
515 : }
516 197264 : }
517 :
518 : // Reintroduction of fix for issue i59051 (#i108851#)
519 2 : void SvxShape::ForceMetricToItemPoolMetric(basegfx::B2DPolyPolygon& rPolyPolygon) const throw()
520 : {
521 : DBG_TESTSOLARMUTEX();
522 2 : if(mpModel)
523 : {
524 2 : SfxMapUnit eMapUnit = mpModel->GetItemPool().GetMetric(0);
525 2 : if(eMapUnit != SFX_MAPUNIT_100TH_MM)
526 : {
527 0 : switch(eMapUnit)
528 : {
529 : case SFX_MAPUNIT_TWIP :
530 : {
531 0 : basegfx::B2DHomMatrix aTransform;
532 0 : const double fMMToTWIPS(72.0 / 127.0);
533 :
534 0 : aTransform.scale(fMMToTWIPS, fMMToTWIPS);
535 0 : rPolyPolygon.transform(aTransform);
536 0 : break;
537 : }
538 : default:
539 : {
540 : OSL_FAIL("Missing unit translation to PoolMetric!");
541 : }
542 : }
543 : }
544 : }
545 2 : }
546 :
547 :
548 111275 : void SvxShape::ForceMetricTo100th_mm(Pair& rPoint) const throw()
549 : {
550 : DBG_TESTSOLARMUTEX();
551 111275 : SfxMapUnit eMapUnit = SFX_MAPUNIT_100TH_MM;
552 111275 : if(mpModel)
553 : {
554 111275 : eMapUnit = mpModel->GetItemPool().GetMetric(0);
555 111275 : if(eMapUnit != SFX_MAPUNIT_100TH_MM)
556 : {
557 19882 : switch(eMapUnit)
558 : {
559 : case SFX_MAPUNIT_TWIP :
560 : {
561 19882 : rPoint.A() = TWIPS_TO_MM(rPoint.A());
562 19882 : rPoint.B() = TWIPS_TO_MM(rPoint.B());
563 19882 : break;
564 : }
565 : default:
566 : {
567 : OSL_FAIL("AW: Missing unit translation to 100th mm!");
568 : }
569 : }
570 : }
571 : }
572 111275 : }
573 :
574 : // Reintroduction of fix for issue i59051 (#i108851#)
575 2 : void SvxShape::ForceMetricTo100th_mm(basegfx::B2DPolyPolygon& rPolyPolygon) const throw()
576 : {
577 : DBG_TESTSOLARMUTEX();
578 2 : SfxMapUnit eMapUnit = SFX_MAPUNIT_100TH_MM;
579 2 : if(mpModel)
580 : {
581 2 : eMapUnit = mpModel->GetItemPool().GetMetric(0);
582 2 : if(eMapUnit != SFX_MAPUNIT_100TH_MM)
583 : {
584 2 : switch(eMapUnit)
585 : {
586 : case SFX_MAPUNIT_TWIP :
587 : {
588 2 : basegfx::B2DHomMatrix aTransform;
589 2 : const double fTWIPSToMM(127.0 / 72.0);
590 2 : aTransform.scale(fTWIPSToMM, fTWIPSToMM);
591 2 : rPolyPolygon.transform(aTransform);
592 2 : break;
593 : }
594 : default:
595 : {
596 : OSL_FAIL("Missing unit translation to 100th mm!");
597 : }
598 : }
599 : }
600 : }
601 2 : }
602 :
603 :
604 380 : void SvxItemPropertySet_ObtainSettingsFromPropertySet(const SvxItemPropertySet& rPropSet,
605 : SfxItemSet& rSet, uno::Reference< beans::XPropertySet > xSet, const SfxItemPropertyMap* pMap )
606 : {
607 380 : if(rPropSet.AreThereOwnUsrAnys())
608 : {
609 380 : const SfxItemPropertyMap& rSrc = rPropSet.getPropertyMap();
610 380 : PropertyEntryVector_t aSrcPropVector = rSrc.getPropertyEntries();
611 380 : PropertyEntryVector_t::const_iterator aSrcIt = aSrcPropVector.begin();
612 64750 : while(aSrcIt != aSrcPropVector.end())
613 : {
614 63990 : if(aSrcIt->nWID)
615 : {
616 63054 : uno::Any* pUsrAny = rPropSet.GetUsrAnyForID(aSrcIt->nWID);
617 63054 : if(pUsrAny)
618 : {
619 : // Aequivalenten Eintrag in pDst suchen
620 1048 : const SfxItemPropertySimpleEntry* pEntry = pMap->getByName( aSrcIt->sName );
621 1048 : if(pEntry)
622 : {
623 : // entry found
624 1048 : if(pEntry->nWID >= OWN_ATTR_VALUE_START && pEntry->nWID <= OWN_ATTR_VALUE_END)
625 : {
626 : // Special ID im PropertySet, kann nur direkt am
627 : // Objekt gesetzt werden+
628 220 : xSet->setPropertyValue( aSrcIt->sName, *pUsrAny);
629 : }
630 : else
631 : {
632 828 : if(SfxItemPool::IsWhich(pEntry->nWID))
633 828 : rSet.Put(rSet.GetPool()->GetDefaultItem(pEntry->nWID));
634 : // setzen
635 828 : SvxItemPropertySet_setPropertyValue(rPropSet, pEntry, *pUsrAny, rSet);
636 : }
637 : }
638 : }
639 : }
640 :
641 : // next entry
642 63990 : ++aSrcIt;
643 : }
644 380 : const_cast< SvxItemPropertySet& >(rPropSet).ClearAllUsrAny();
645 : }
646 380 : }
647 :
648 :
649 67268 : void SvxShape::ObtainSettingsFromPropertySet(const SvxItemPropertySet& rPropSet)
650 : {
651 : DBG_TESTSOLARMUTEX();
652 67268 : if(mpObj.is() && rPropSet.AreThereOwnUsrAnys() && mpModel)
653 : {
654 380 : SfxItemSet aSet( mpModel->GetItemPool(), SDRATTR_START, SDRATTR_END);
655 760 : Reference< beans::XPropertySet > xShape( (OWeakObject*)this, UNO_QUERY );
656 380 : SvxItemPropertySet_ObtainSettingsFromPropertySet(rPropSet, aSet, xShape, &mpPropSet->getPropertyMap() );
657 :
658 380 : mpObj->SetMergedItemSetAndBroadcast(aSet);
659 :
660 760 : mpObj->ApplyNotPersistAttr( aSet );
661 : }
662 67268 : }
663 :
664 516 : uno::Any SvxShape::GetBitmap( bool bMetaFile /* = false */ ) const
665 : throw (uno::RuntimeException, std::exception)
666 : {
667 : DBG_TESTSOLARMUTEX();
668 516 : uno::Any aAny;
669 :
670 516 : if( !mpObj.is() || mpModel == NULL || !mpObj->IsInserted() || NULL == mpObj->GetPage() )
671 0 : return aAny;
672 :
673 1032 : VirtualDevice aVDev;
674 516 : aVDev.SetMapMode(MapMode(MAP_100TH_MM));
675 :
676 516 : SdrModel* pModel = mpObj->GetModel();
677 516 : SdrPage* pPage = mpObj->GetPage();
678 :
679 1032 : boost::scoped_ptr<E3dView> pView(new E3dView( pModel, &aVDev ));
680 516 : pView->hideMarkHandles();
681 516 : SdrPageView* pPageView = pView->ShowSdrPage(pPage);
682 :
683 516 : SdrObject *pTempObj = mpObj.get();
684 516 : pView->MarkObj(pTempObj,pPageView);
685 :
686 516 : Rectangle aRect(pTempObj->GetCurrentBoundRect());
687 516 : aRect.Justify();
688 516 : Size aSize(aRect.GetSize());
689 :
690 1032 : GDIMetaFile aMtf( pView->GetMarkedObjMetaFile() );
691 516 : if( bMetaFile )
692 : {
693 0 : SvMemoryStream aDestStrm( 65535, 65535 );
694 0 : ConvertGDIMetaFileToWMF( aMtf, aDestStrm, NULL, false );
695 : const uno::Sequence<sal_Int8> aSeq(
696 0 : static_cast< const sal_Int8* >(aDestStrm.GetData()),
697 0 : aDestStrm.GetEndOfData());
698 0 : aAny.setValue( &aSeq, ::getCppuType((const uno::Sequence< sal_Int8 >*)0) );
699 : }
700 : else
701 : {
702 516 : Graphic aGraph(aMtf);
703 516 : aGraph.SetPrefSize(aSize);
704 516 : aGraph.SetPrefMapMode(MAP_100TH_MM);
705 :
706 1032 : Reference< awt::XBitmap > xBmp( aGraph.GetXGraphic(), UNO_QUERY );
707 1032 : aAny <<= xBmp;
708 : }
709 :
710 516 : pView->UnmarkAll();
711 :
712 516 : return aAny;
713 : }
714 :
715 0 : uno::Sequence< uno::Type > SAL_CALL SvxShape::getTypes()
716 : throw (uno::RuntimeException, std::exception)
717 : {
718 0 : if( mpImpl->mpMaster )
719 : {
720 0 : return mpImpl->mpMaster->getTypes();
721 : }
722 : else
723 : {
724 0 : return _getTypes();
725 : }
726 : }
727 :
728 :
729 :
730 0 : uno::Sequence< uno::Type > SAL_CALL SvxShape::_getTypes()
731 : throw(uno::RuntimeException)
732 : {
733 0 : switch( mpImpl->mnObjId )
734 : {
735 : // shapes without text
736 : case OBJ_PAGE:
737 : case OBJ_FRAME:
738 : case OBJ_OLE2_PLUGIN:
739 : case OBJ_OLE2_APPLET:
740 : case E3D_CUBEOBJ_ID|E3D_INVENTOR_FLAG:
741 : case E3D_SPHEREOBJ_ID|E3D_INVENTOR_FLAG:
742 : case E3D_LATHEOBJ_ID|E3D_INVENTOR_FLAG:
743 : case E3D_EXTRUDEOBJ_ID|E3D_INVENTOR_FLAG:
744 : case E3D_POLYGONOBJ_ID|E3D_INVENTOR_FLAG:
745 : case OBJ_MEDIA:
746 : {
747 0 : static ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > aTypeSequence;
748 :
749 0 : if( aTypeSequence.getLength() == 0 )
750 : {
751 : // Ready for multithreading; get global mutex for first call of this method only! see before
752 0 : MutexGuard aGuard( osl::Mutex::getGlobalMutex() ) ;
753 :
754 : // Control these pointer again ... it can be, that another instance will be faster then these!
755 0 : if( aTypeSequence.getLength() == 0 )
756 : {
757 0 : aTypeSequence.realloc( 12 );
758 0 : uno::Type* pTypes = aTypeSequence.getArray();
759 :
760 0 : *pTypes++ = cppu::UnoType<drawing::XShape>::get();
761 0 : *pTypes++ = cppu::UnoType<lang::XComponent>::get();
762 0 : *pTypes++ = cppu::UnoType<beans::XPropertySet>::get();
763 0 : *pTypes++ = cppu::UnoType<beans::XMultiPropertySet>::get();
764 0 : *pTypes++ = cppu::UnoType<beans::XPropertyState>::get();
765 0 : *pTypes++ = cppu::UnoType<beans::XMultiPropertyStates>::get();
766 0 : *pTypes++ = cppu::UnoType<drawing::XGluePointsSupplier>::get();
767 0 : *pTypes++ = cppu::UnoType<container::XChild>::get();
768 0 : *pTypes++ = cppu::UnoType<lang::XServiceInfo>::get();
769 0 : *pTypes++ = cppu::UnoType<lang::XTypeProvider>::get();
770 0 : *pTypes++ = cppu::UnoType<lang::XUnoTunnel>::get();
771 0 : *pTypes++ = cppu::UnoType<container::XNamed>::get();
772 0 : }
773 : }
774 0 : return aTypeSequence;
775 : }
776 : // group shape
777 : case OBJ_GRUP:
778 : {
779 0 : static ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > aTypeSequence;
780 :
781 0 : if( aTypeSequence.getLength() == 0 )
782 : {
783 : // Ready for multithreading; get global mutex for first call of this method only! see before
784 0 : MutexGuard aGuard( osl::Mutex::getGlobalMutex() ) ;
785 :
786 : // Control these pointer again ... it can be, that another instance will be faster then these!
787 0 : if( aTypeSequence.getLength() == 0 )
788 : {
789 0 : aTypeSequence.realloc( 14 );
790 0 : uno::Type* pTypes = aTypeSequence.getArray();
791 :
792 0 : *pTypes++ = cppu::UnoType<drawing::XShape>::get();
793 0 : *pTypes++ = cppu::UnoType<lang::XComponent>::get();
794 0 : *pTypes++ = cppu::UnoType<beans::XPropertySet>::get();
795 0 : *pTypes++ = cppu::UnoType<beans::XMultiPropertySet>::get();
796 0 : *pTypes++ = cppu::UnoType<beans::XPropertyState>::get();
797 0 : *pTypes++ = cppu::UnoType<beans::XMultiPropertyStates>::get();
798 0 : *pTypes++ = cppu::UnoType<drawing::XGluePointsSupplier>::get();
799 0 : *pTypes++ = cppu::UnoType<container::XChild>::get();
800 0 : *pTypes++ = cppu::UnoType<lang::XServiceInfo>::get();
801 0 : *pTypes++ = cppu::UnoType<lang::XTypeProvider>::get();
802 0 : *pTypes++ = cppu::UnoType<lang::XUnoTunnel>::get();
803 0 : *pTypes++ = cppu::UnoType<container::XNamed>::get();
804 0 : *pTypes++ = cppu::UnoType<drawing::XShapes>::get();
805 0 : *pTypes++ = cppu::UnoType<drawing::XShapeGroup>::get();
806 0 : }
807 : }
808 0 : return aTypeSequence;
809 : }
810 : // connector shape
811 : case OBJ_EDGE:
812 : {
813 0 : static ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > aTypeSequence;
814 :
815 0 : if( aTypeSequence.getLength() == 0 )
816 : {
817 : // Ready for multithreading; get global mutex for first call of this method only! see before
818 0 : MutexGuard aGuard( osl::Mutex::getGlobalMutex() ) ;
819 :
820 : // Control these pointer again ... it can be, that another instance will be faster then these!
821 0 : if( aTypeSequence.getLength() == 0 )
822 : {
823 0 : aTypeSequence.realloc( 17 );
824 0 : uno::Type* pTypes = aTypeSequence.getArray();
825 :
826 0 : *pTypes++ = cppu::UnoType<drawing::XShape>::get();
827 0 : *pTypes++ = cppu::UnoType<lang::XComponent>::get();
828 0 : *pTypes++ = cppu::UnoType<beans::XPropertySet>::get();
829 0 : *pTypes++ = cppu::UnoType<beans::XMultiPropertySet>::get();
830 0 : *pTypes++ = cppu::UnoType<beans::XPropertyState>::get();
831 0 : *pTypes++ = cppu::UnoType<beans::XMultiPropertyStates>::get();
832 0 : *pTypes++ = cppu::UnoType<drawing::XGluePointsSupplier>::get();
833 0 : *pTypes++ = cppu::UnoType<container::XChild>::get();
834 0 : *pTypes++ = cppu::UnoType<lang::XServiceInfo>::get();
835 0 : *pTypes++ = cppu::UnoType<lang::XTypeProvider>::get();
836 0 : *pTypes++ = cppu::UnoType<lang::XUnoTunnel>::get();
837 0 : *pTypes++ = cppu::UnoType<container::XNamed>::get();
838 0 : *pTypes++ = cppu::UnoType<drawing::XConnectorShape>::get();
839 : // from SvxUnoTextBase::getTypes()
840 0 : *pTypes++ = cppu::UnoType<text::XTextAppend>::get();
841 0 : *pTypes++ = cppu::UnoType<text::XTextCopy>::get();
842 0 : *pTypes++ = cppu::UnoType<container::XEnumerationAccess>::get();
843 0 : *pTypes++ = cppu::UnoType<text::XTextRangeMover>::get();
844 0 : }
845 : }
846 0 : return aTypeSequence;
847 : }
848 : // control shape
849 : case OBJ_UNO:
850 : {
851 0 : static ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > aTypeSequence;
852 :
853 0 : if( aTypeSequence.getLength() == 0 )
854 : {
855 : // Ready for multithreading; get global mutex for first call of this method only! see before
856 0 : MutexGuard aGuard( osl::Mutex::getGlobalMutex() ) ;
857 :
858 : // Control these pointer again ... it can be, that another instance will be faster then these!
859 0 : if( aTypeSequence.getLength() == 0 )
860 : {
861 0 : aTypeSequence.realloc( 13 );
862 0 : uno::Type* pTypes = aTypeSequence.getArray();
863 :
864 0 : *pTypes++ = cppu::UnoType<drawing::XShape>::get();
865 0 : *pTypes++ = cppu::UnoType<lang::XComponent>::get();
866 0 : *pTypes++ = cppu::UnoType<beans::XPropertySet>::get();
867 0 : *pTypes++ = cppu::UnoType<beans::XMultiPropertySet>::get();
868 0 : *pTypes++ = cppu::UnoType<beans::XPropertyState>::get();
869 0 : *pTypes++ = cppu::UnoType<beans::XMultiPropertyStates>::get();
870 0 : *pTypes++ = cppu::UnoType<drawing::XGluePointsSupplier>::get();
871 0 : *pTypes++ = cppu::UnoType<container::XChild>::get();
872 0 : *pTypes++ = cppu::UnoType<lang::XServiceInfo>::get();
873 0 : *pTypes++ = cppu::UnoType<lang::XTypeProvider>::get();
874 0 : *pTypes++ = cppu::UnoType<lang::XUnoTunnel>::get();
875 0 : *pTypes++ = cppu::UnoType<container::XNamed>::get();
876 0 : *pTypes++ = cppu::UnoType<drawing::XControlShape>::get();
877 0 : }
878 : }
879 0 : return aTypeSequence;
880 : }
881 : // 3d scene shape
882 : case E3D_POLYSCENE_ID|E3D_INVENTOR_FLAG:
883 : {
884 0 : static ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > aTypeSequence;
885 :
886 0 : if( aTypeSequence.getLength() == 0 )
887 : {
888 : // Ready for multithreading; get global mutex for first call of this method only! see before
889 0 : MutexGuard aGuard( osl::Mutex::getGlobalMutex() ) ;
890 :
891 : // Control these pointer again ... it can be, that another instance will be faster then these!
892 0 : if( aTypeSequence.getLength() == 0 )
893 : {
894 0 : aTypeSequence.realloc( 13 );
895 0 : uno::Type* pTypes = aTypeSequence.getArray();
896 :
897 0 : *pTypes++ = cppu::UnoType<drawing::XShape>::get();
898 0 : *pTypes++ = cppu::UnoType<lang::XComponent>::get();
899 0 : *pTypes++ = cppu::UnoType<beans::XPropertySet>::get();
900 0 : *pTypes++ = cppu::UnoType<beans::XMultiPropertySet>::get();
901 0 : *pTypes++ = cppu::UnoType<beans::XPropertyState>::get();
902 0 : *pTypes++ = cppu::UnoType<beans::XMultiPropertyStates>::get();
903 0 : *pTypes++ = cppu::UnoType<drawing::XGluePointsSupplier>::get();
904 0 : *pTypes++ = cppu::UnoType<container::XChild>::get();
905 0 : *pTypes++ = cppu::UnoType<lang::XServiceInfo>::get();
906 0 : *pTypes++ = cppu::UnoType<lang::XTypeProvider>::get();
907 0 : *pTypes++ = cppu::UnoType<lang::XUnoTunnel>::get();
908 0 : *pTypes++ = cppu::UnoType<container::XNamed>::get();
909 0 : *pTypes++ = cppu::UnoType<drawing::XShapes>::get();
910 0 : }
911 : }
912 0 : return aTypeSequence;
913 : }
914 : case OBJ_CUSTOMSHAPE:
915 : {
916 0 : static ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > aTypeSequence;
917 :
918 0 : if( aTypeSequence.getLength() == 0 )
919 : {
920 : // Ready for multithreading; get global mutex for first call of this method only! see before
921 0 : MutexGuard aGuard( osl::Mutex::getGlobalMutex() ) ;
922 :
923 : // Control these pointer again ... it can be, that another instance will be faster then these!
924 0 : if( aTypeSequence.getLength() == 0 )
925 : {
926 0 : aTypeSequence.realloc( 16 );
927 0 : uno::Type* pTypes = aTypeSequence.getArray();
928 :
929 0 : *pTypes++ = cppu::UnoType<drawing::XShape>::get();
930 0 : *pTypes++ = cppu::UnoType<lang::XComponent>::get();
931 0 : *pTypes++ = cppu::UnoType<beans::XPropertySet>::get();
932 0 : *pTypes++ = cppu::UnoType<beans::XMultiPropertySet>::get();
933 0 : *pTypes++ = cppu::UnoType<beans::XPropertyState>::get();
934 0 : *pTypes++ = cppu::UnoType<beans::XMultiPropertyStates>::get();
935 0 : *pTypes++ = cppu::UnoType<drawing::XGluePointsSupplier>::get();
936 0 : *pTypes++ = cppu::UnoType<container::XChild>::get();
937 0 : *pTypes++ = cppu::UnoType<lang::XServiceInfo>::get();
938 0 : *pTypes++ = cppu::UnoType<lang::XTypeProvider>::get();
939 0 : *pTypes++ = cppu::UnoType<lang::XUnoTunnel>::get();
940 0 : *pTypes++ = cppu::UnoType<container::XNamed>::get();
941 : // from SvxUnoTextBase::getTypes()
942 0 : *pTypes++ = cppu::UnoType<text::XText>::get();
943 0 : *pTypes++ = cppu::UnoType<container::XEnumerationAccess>::get();
944 0 : *pTypes++ = cppu::UnoType<text::XTextRangeMover>::get();
945 0 : *pTypes++ = cppu::UnoType<drawing::XEnhancedCustomShapeDefaulter>::get();
946 0 : }
947 : }
948 0 : return aTypeSequence;
949 : }
950 : // shapes with text
951 : case OBJ_RECT:
952 : case OBJ_CIRC:
953 : case OBJ_MEASURE:
954 : case OBJ_LINE:
955 : case OBJ_POLY:
956 : case OBJ_PLIN:
957 : case OBJ_PATHLINE:
958 : case OBJ_PATHFILL:
959 : case OBJ_FREELINE:
960 : case OBJ_FREEFILL:
961 : case OBJ_PATHPOLY:
962 : case OBJ_PATHPLIN:
963 : case OBJ_GRAF:
964 : case OBJ_TEXT:
965 : case OBJ_CAPTION:
966 : case OBJ_TABLE:
967 : case OBJ_OLE2: // #i118485# Moved to shapes with text
968 : default:
969 : {
970 0 : static ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > aTypeSequence;
971 :
972 0 : if( aTypeSequence.getLength() == 0 )
973 : {
974 : // Ready for multithreading; get global mutex for first call of this method only! see before
975 0 : MutexGuard aGuard( osl::Mutex::getGlobalMutex() ) ;
976 :
977 : // Control these pointer again ... it can be, that another instance will be faster then these!
978 0 : if( aTypeSequence.getLength() == 0 )
979 : {
980 0 : aTypeSequence.realloc( 16 );
981 0 : uno::Type* pTypes = aTypeSequence.getArray();
982 :
983 0 : *pTypes++ = cppu::UnoType<drawing::XShape>::get();
984 0 : *pTypes++ = cppu::UnoType<lang::XComponent>::get();
985 0 : *pTypes++ = cppu::UnoType<beans::XPropertySet>::get();
986 0 : *pTypes++ = cppu::UnoType<beans::XMultiPropertySet>::get();
987 0 : *pTypes++ = cppu::UnoType<beans::XPropertyState>::get();
988 0 : *pTypes++ = cppu::UnoType<beans::XMultiPropertyStates>::get();
989 0 : *pTypes++ = cppu::UnoType<drawing::XGluePointsSupplier>::get();
990 0 : *pTypes++ = cppu::UnoType<container::XChild>::get();
991 0 : *pTypes++ = cppu::UnoType<lang::XServiceInfo>::get();
992 0 : *pTypes++ = cppu::UnoType<lang::XTypeProvider>::get();
993 0 : *pTypes++ = cppu::UnoType<lang::XUnoTunnel>::get();
994 0 : *pTypes++ = cppu::UnoType<container::XNamed>::get();
995 : // from SvxUnoTextBase::getTypes()
996 0 : *pTypes++ = cppu::UnoType<text::XTextAppend>::get();
997 0 : *pTypes++ = cppu::UnoType<text::XTextCopy>::get();
998 0 : *pTypes++ = cppu::UnoType<container::XEnumerationAccess>::get();
999 0 : *pTypes++ = cppu::UnoType<text::XTextRangeMover>::get();
1000 0 : }
1001 : }
1002 0 : return aTypeSequence;
1003 : }
1004 : }
1005 : }
1006 :
1007 :
1008 :
1009 0 : uno::Sequence< sal_Int8 > SAL_CALL SvxShape::getImplementationId()
1010 : throw (uno::RuntimeException, std::exception)
1011 : {
1012 0 : return css::uno::Sequence<sal_Int8>();
1013 : }
1014 :
1015 3381463 : void SvxShape::Notify( SfxBroadcaster&, const SfxHint& rHint ) throw()
1016 : {
1017 : DBG_TESTSOLARMUTEX();
1018 3381463 : if( !mpObj.is() )
1019 3307835 : return;
1020 :
1021 : // #i55919# HINT_OBJCHG is only interesting if it's for this object
1022 :
1023 3348786 : const SdrHint* pSdrHint = dynamic_cast<const SdrHint*>(&rHint);
1024 9939437 : if (!pSdrHint || ( /* (pSdrHint->GetKind() != HINT_OBJREMOVED) && */
1025 6692912 : (pSdrHint->GetKind() != HINT_MODELCLEARED) &&
1026 : // #110094#-9 (pSdrHint->GetKind() != HINT_OBJLISTCLEAR) &&
1027 5153917 : ((pSdrHint->GetKind() != HINT_OBJCHG || pSdrHint->GetObject() != mpObj.get() ))))
1028 3242481 : return;
1029 :
1030 106305 : uno::Reference< uno::XInterface > xSelf( mpObj->getWeakUnoShape() );
1031 106305 : if( !xSelf.is() )
1032 : {
1033 0 : mpObj.reset( NULL );
1034 0 : return;
1035 : }
1036 :
1037 106305 : bool bClearMe = false;
1038 :
1039 106305 : switch( pSdrHint->GetKind() )
1040 : {
1041 : case HINT_OBJCHG:
1042 : {
1043 102877 : updateShapeKind();
1044 102877 : break;
1045 : }
1046 : case HINT_MODELCLEARED:
1047 : {
1048 3428 : bClearMe = true;
1049 3428 : mpModel = NULL;
1050 3428 : break;
1051 : }
1052 : default:
1053 0 : break;
1054 : };
1055 :
1056 106305 : if( bClearMe )
1057 : {
1058 3428 : if( !HasSdrObjectOwnership() ) {
1059 3428 : if( mpObj.is() )
1060 3428 : mpObj->setUnoShape( NULL );
1061 3428 : mpObj.reset( NULL );
1062 : }
1063 3428 : if ( !mpImpl->mbDisposing )
1064 3428 : dispose();
1065 106305 : }
1066 : }
1067 :
1068 : // XShape
1069 :
1070 :
1071 : // The "*LogicRectHack" functions also existed in sch, and those
1072 : // duplicate symbols cause Bad Things To Happen (TM) #i9462#.
1073 : // Prefixing with 'svx' and marking static to make sure name collisions
1074 : // do not occur.
1075 :
1076 400592 : static bool svx_needLogicRectHack( SdrObject* pObj )
1077 : {
1078 400592 : if( pObj->GetObjInventor() == SdrInventor)
1079 : {
1080 387201 : switch(pObj->GetObjIdentifier())
1081 : {
1082 : case OBJ_GRUP:
1083 : case OBJ_LINE:
1084 : case OBJ_POLY:
1085 : case OBJ_PLIN:
1086 : case OBJ_PATHLINE:
1087 : case OBJ_PATHFILL:
1088 : case OBJ_FREELINE:
1089 : case OBJ_FREEFILL:
1090 : case OBJ_SPLNLINE:
1091 : case OBJ_SPLNFILL:
1092 : case OBJ_EDGE:
1093 : case OBJ_PATHPOLY:
1094 : case OBJ_PATHPLIN:
1095 : case OBJ_MEASURE:
1096 157705 : return true;
1097 : }
1098 : }
1099 242887 : return false;
1100 : }
1101 :
1102 :
1103 :
1104 299371 : static Rectangle svx_getLogicRectHack( SdrObject* pObj )
1105 : {
1106 299371 : if(svx_needLogicRectHack(pObj))
1107 : {
1108 102612 : return pObj->GetSnapRect();
1109 : }
1110 : else
1111 : {
1112 196759 : return pObj->GetLogicRect();
1113 : }
1114 : }
1115 :
1116 :
1117 :
1118 101221 : static void svx_setLogicRectHack( SdrObject* pObj, const Rectangle& rRect )
1119 : {
1120 101221 : if(svx_needLogicRectHack(pObj))
1121 : {
1122 55093 : pObj->SetSnapRect( rRect );
1123 : }
1124 : else
1125 : {
1126 46128 : pObj->SetLogicRect( rRect );
1127 : }
1128 101221 : }
1129 :
1130 :
1131 :
1132 105553 : awt::Point SAL_CALL SvxShape::getPosition() throw(uno::RuntimeException, std::exception)
1133 : {
1134 105553 : ::SolarMutexGuard aGuard;
1135 :
1136 105553 : if( mpObj.is() && mpModel)
1137 : {
1138 46455 : Rectangle aRect( svx_getLogicRectHack(mpObj.get()) );
1139 46455 : Point aPt( aRect.Left(), aRect.Top() );
1140 :
1141 : // Position is relativ to anchor, so recalc to absolut position
1142 46455 : if( mpModel->IsWriter() )
1143 3954 : aPt -= mpObj->GetAnchorPos();
1144 :
1145 46455 : ForceMetricTo100th_mm(aPt);
1146 46455 : return ::com::sun::star::awt::Point( aPt.X(), aPt.Y() );
1147 : }
1148 : else
1149 : {
1150 59098 : return maPosition;
1151 105553 : }
1152 : }
1153 :
1154 :
1155 102029 : void SAL_CALL SvxShape::setPosition( const awt::Point& Position ) throw(uno::RuntimeException, std::exception)
1156 : {
1157 102029 : ::SolarMutexGuard aGuard;
1158 :
1159 102029 : if( mpObj.is() && mpModel )
1160 : {
1161 : // do NOT move 3D objects, this would change the homogen
1162 : // transformation matrix
1163 100099 : if(!mpObj->ISA(E3dCompoundObject))
1164 : {
1165 96001 : Rectangle aRect( svx_getLogicRectHack(mpObj.get()) );
1166 96001 : Point aLocalPos( Position.X, Position.Y );
1167 96001 : ForceMetricToItemPoolMetric(aLocalPos);
1168 :
1169 : // Position ist absolut, relativ zum Anker stellen
1170 96001 : if( mpModel->IsWriter() )
1171 13448 : aLocalPos += mpObj->GetAnchorPos();
1172 :
1173 96001 : long nDX = aLocalPos.X() - aRect.Left();
1174 96001 : long nDY = aLocalPos.Y() - aRect.Top();
1175 :
1176 96001 : mpObj->Move( Size( nDX, nDY ) );
1177 96001 : mpModel->SetChanged();
1178 : }
1179 : }
1180 :
1181 102029 : maPosition = Position;
1182 102029 : }
1183 :
1184 :
1185 127064 : awt::Size SAL_CALL SvxShape::getSize() throw(uno::RuntimeException, std::exception)
1186 : {
1187 127064 : ::SolarMutexGuard aGuard;
1188 :
1189 127064 : if( mpObj.is() && mpModel)
1190 : {
1191 61340 : Rectangle aRect( svx_getLogicRectHack(mpObj.get()) );
1192 61340 : Size aObjSize( aRect.getWidth(), aRect.getHeight() );
1193 61340 : ForceMetricTo100th_mm(aObjSize);
1194 61340 : return ::com::sun::star::awt::Size( aObjSize.getWidth(), aObjSize.getHeight() );
1195 : }
1196 : else
1197 65724 : return maSize;
1198 : }
1199 :
1200 :
1201 103417 : void SAL_CALL SvxShape::setSize( const awt::Size& rSize )
1202 : throw(beans::PropertyVetoException, uno::RuntimeException, std::exception)
1203 : {
1204 103417 : ::SolarMutexGuard aGuard;
1205 :
1206 103417 : if( mpObj.is() && mpModel)
1207 : {
1208 : // #i123539# optimization for 3D chart object generation: do not use UNO
1209 : // API commmands to get the range, this is too expensive since for 3D
1210 : // scenes it may recalculate the whole scene since in AOO this depends
1211 : // on the contained geometry (layouted to show all content)
1212 101223 : const bool b3DConstruction(dynamic_cast< E3dObject* >(mpObj.get()) && mpModel->isLocked());
1213 : Rectangle aRect(
1214 : b3DConstruction ?
1215 : Rectangle(maPosition.X, maPosition.Y, maSize.Width, maSize.Height) :
1216 101223 : svx_getLogicRectHack(mpObj.get()) );
1217 101223 : Size aLocalSize( rSize.Width, rSize.Height );
1218 101223 : ForceMetricToItemPoolMetric(aLocalSize);
1219 :
1220 101223 : if(mpObj->GetObjInventor() == SdrInventor && mpObj->GetObjIdentifier() == OBJ_MEASURE )
1221 : {
1222 2 : Fraction aWdt(aLocalSize.Width(),aRect.Right()-aRect.Left());
1223 2 : Fraction aHgt(aLocalSize.Height(),aRect.Bottom()-aRect.Top());
1224 2 : Point aPt = mpObj->GetSnapRect().TopLeft();
1225 2 : mpObj->Resize(aPt,aWdt,aHgt);
1226 : }
1227 : else
1228 : {
1229 : //aRect.SetSize(aLocalSize); // this call substract 1 // http://www.openoffice.org/issues/show_bug.cgi?id=83193
1230 101221 : if ( !aLocalSize.Width() )
1231 : {
1232 22725 : aRect.Right() = RECT_EMPTY;
1233 : }
1234 : else
1235 78496 : aRect.setWidth(aLocalSize.Width());
1236 101221 : if ( !aLocalSize.Height() )
1237 : {
1238 22779 : aRect.Bottom() = RECT_EMPTY;
1239 : }
1240 : else
1241 78442 : aRect.setHeight(aLocalSize.Height());
1242 :
1243 101221 : svx_setLogicRectHack( mpObj.get(), aRect );
1244 : }
1245 :
1246 101223 : mpModel->SetChanged();
1247 : }
1248 103417 : maSize = rSize;
1249 103417 : }
1250 :
1251 :
1252 :
1253 : // XNamed
1254 260 : OUString SAL_CALL SvxShape::getName( ) throw(::com::sun::star::uno::RuntimeException, std::exception)
1255 : {
1256 260 : ::SolarMutexGuard aGuard;
1257 260 : if( mpObj.is() )
1258 : {
1259 260 : return mpObj->GetName();
1260 : }
1261 : else
1262 : {
1263 0 : return maShapeName;
1264 260 : }
1265 : }
1266 :
1267 :
1268 :
1269 3404 : void SAL_CALL SvxShape::setName( const OUString& aName ) throw(::com::sun::star::uno::RuntimeException, std::exception)
1270 : {
1271 3404 : ::SolarMutexGuard aGuard;
1272 3404 : if( mpObj.is() )
1273 : {
1274 1530 : mpObj->SetName( aName );
1275 : }
1276 : else
1277 : {
1278 1874 : maShapeName = aName;
1279 3404 : }
1280 3404 : }
1281 :
1282 : // XShapeDescriptor
1283 :
1284 :
1285 145564 : OUString SAL_CALL SvxShape::getShapeType() throw(uno::RuntimeException, std::exception)
1286 : {
1287 145564 : if( !maShapeType.getLength() )
1288 140770 : return UHashMap::getNameFromId( mpImpl->mnObjId );
1289 : else
1290 4794 : return maShapeType;
1291 : }
1292 :
1293 : // XComponent
1294 :
1295 :
1296 4428 : void SAL_CALL SvxShape::dispose() throw(uno::RuntimeException, std::exception)
1297 : {
1298 4428 : ::SolarMutexGuard aGuard;
1299 :
1300 4428 : if( mpImpl->mbDisposing )
1301 4542 : return; // caught a recursion
1302 :
1303 4314 : mpImpl->mbDisposing = true;
1304 :
1305 8628 : lang::EventObject aEvt;
1306 4314 : aEvt.Source = *(OWeakAggObject*) this;
1307 4314 : mpImpl->maDisposeListeners.disposeAndClear(aEvt);
1308 4314 : mpImpl->maPropertyNotifier.disposing();
1309 :
1310 4314 : if ( mpObj.is() )
1311 : {
1312 0 : bool bFreeSdrObject = false;
1313 :
1314 0 : if ( mpObj->IsInserted() && mpObj->GetPage() )
1315 : {
1316 : OSL_ENSURE( HasSdrObjectOwnership(), "SvxShape::dispose: is the below code correct?" );
1317 : // normally, we are allowed to free the SdrObject only if we have its ownership.
1318 : // Why isn't this checked here?
1319 :
1320 0 : SdrPage* pPage = mpObj->GetPage();
1321 : // SdrObject aus der Page loeschen
1322 0 : const size_t nCount = pPage->GetObjCount();
1323 0 : for ( size_t nNum = 0; nNum < nCount; ++nNum )
1324 : {
1325 0 : if ( pPage->GetObj( nNum ) == mpObj.get() )
1326 : {
1327 0 : OSL_VERIFY( pPage->RemoveObject( nNum ) == mpObj.get() );
1328 0 : bFreeSdrObject = true;
1329 0 : break;
1330 : }
1331 : }
1332 : }
1333 :
1334 0 : mpObj->setUnoShape(NULL);
1335 :
1336 0 : if ( bFreeSdrObject )
1337 : {
1338 : // in case we have the ownership of the SdrObject, a Free
1339 : // would do nothing. So ensure the ownership is reset.
1340 0 : mpImpl->mbHasSdrObjectOwnership = false;
1341 0 : SdrObject* pObject = mpObj.get();
1342 0 : SdrObject::Free( pObject );
1343 : }
1344 : }
1345 :
1346 4314 : if( mpModel )
1347 : {
1348 886 : EndListening( *mpModel );
1349 886 : mpModel = NULL;
1350 4314 : }
1351 : }
1352 :
1353 :
1354 :
1355 232 : void SAL_CALL SvxShape::addEventListener( const Reference< lang::XEventListener >& xListener )
1356 : throw(uno::RuntimeException, std::exception)
1357 : {
1358 232 : mpImpl->maDisposeListeners.addInterface(xListener);
1359 232 : }
1360 :
1361 :
1362 :
1363 230 : void SAL_CALL SvxShape::removeEventListener( const Reference< lang::XEventListener >& aListener ) throw(uno::RuntimeException, std::exception)
1364 : {
1365 230 : mpImpl->maDisposeListeners.removeInterface(aListener);
1366 230 : }
1367 :
1368 : // XPropertySet
1369 :
1370 :
1371 :
1372 : Reference< beans::XPropertySetInfo > SAL_CALL
1373 88094 : SvxShape::getPropertySetInfo() throw(uno::RuntimeException, std::exception)
1374 : {
1375 88094 : if( mpImpl->mpMaster )
1376 : {
1377 21760 : return mpImpl->mpMaster->getPropertySetInfo();
1378 : }
1379 : else
1380 : {
1381 66334 : return _getPropertySetInfo();
1382 : }
1383 : }
1384 :
1385 : Reference< beans::XPropertySetInfo > SAL_CALL
1386 66436 : SvxShape::_getPropertySetInfo() throw(uno::RuntimeException)
1387 : {
1388 66436 : return mpPropSet->getPropertySetInfo();
1389 : }
1390 :
1391 :
1392 :
1393 0 : void SAL_CALL SvxShape::addPropertyChangeListener( const OUString& _propertyName, const Reference< beans::XPropertyChangeListener >& _listener ) throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException, std::exception)
1394 : {
1395 0 : ::osl::MutexGuard aGuard( maMutex );
1396 0 : mpImpl->maPropertyNotifier.addPropertyChangeListener( _propertyName, _listener );
1397 0 : }
1398 :
1399 :
1400 :
1401 0 : void SAL_CALL SvxShape::removePropertyChangeListener( const OUString& _propertyName, const Reference< beans::XPropertyChangeListener >& _listener ) throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException, std::exception)
1402 : {
1403 0 : ::osl::MutexGuard aGuard( maMutex );
1404 0 : mpImpl->maPropertyNotifier.removePropertyChangeListener( _propertyName, _listener );
1405 0 : }
1406 :
1407 :
1408 :
1409 0 : void SAL_CALL SvxShape::addVetoableChangeListener( const OUString& , const Reference< beans::XVetoableChangeListener >& ) throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException, std::exception)
1410 : {
1411 : OSL_FAIL( "SvxShape::addVetoableChangeListener: don't have any vetoable properties, so why ...?" );
1412 0 : }
1413 :
1414 :
1415 :
1416 0 : void SAL_CALL SvxShape::removeVetoableChangeListener( const OUString& , const Reference< beans::XVetoableChangeListener >& ) throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException, std::exception)
1417 : {
1418 : OSL_FAIL( "SvxShape::removeVetoableChangeListener: don't have any vetoable properties, so why ...?" );
1419 0 : }
1420 :
1421 :
1422 :
1423 4297 : bool SAL_CALL SvxShape::SetFillAttribute( sal_Int32 nWID, const OUString& rName )
1424 : {
1425 4297 : SfxItemSet aSet( mpModel->GetItemPool(), (sal_uInt16)nWID, (sal_uInt16)nWID );
1426 :
1427 4297 : if( SetFillAttribute( nWID, rName, aSet, mpModel ) )
1428 : {
1429 : //mpObj->SetItemSetAndBroadcast(aSet);
1430 3851 : mpObj->SetMergedItemSetAndBroadcast(aSet);
1431 :
1432 3851 : return true;
1433 : }
1434 : else
1435 : {
1436 446 : return false;
1437 4297 : }
1438 : }
1439 :
1440 :
1441 :
1442 4297 : bool SAL_CALL SvxShape::SetFillAttribute( sal_Int32 nWID, const OUString& rName, SfxItemSet& rSet, SdrModel* pModel )
1443 : {
1444 : // check if an item with the given name and which id is inside the models
1445 : // pool or the stylesheet pool, if found its puttet in the itemse
1446 4297 : if( !SetFillAttribute( nWID, rName, rSet ) )
1447 : {
1448 : // we did not find such item in one of the pools, so we check
1449 : // the property lists that are loaded for the model for items
1450 : // that support such.
1451 446 : OUString aStrName = SvxUnogetInternalNameForItem((sal_Int16)nWID, rName);
1452 :
1453 446 : switch( nWID )
1454 : {
1455 : case XATTR_FILLBITMAP:
1456 : {
1457 0 : XBitmapListRef pBitmapList = pModel->GetBitmapList();
1458 :
1459 0 : if( !pBitmapList.is() )
1460 0 : return false;
1461 :
1462 0 : long nPos = pBitmapList->GetIndex(aStrName);
1463 0 : if( nPos == -1 )
1464 0 : return false;
1465 :
1466 0 : XBitmapEntry* pEntry = pBitmapList->GetBitmap( nPos );
1467 0 : XFillBitmapItem aBmpItem;
1468 0 : aBmpItem.SetWhich( XATTR_FILLBITMAP );
1469 0 : aBmpItem.SetName( rName );
1470 0 : aBmpItem.SetGraphicObject(pEntry->GetGraphicObject());
1471 0 : rSet.Put( aBmpItem );
1472 0 : break;
1473 : }
1474 : case XATTR_FILLGRADIENT:
1475 : {
1476 0 : XGradientListRef pGradientList = pModel->GetGradientList();
1477 :
1478 0 : if( !pGradientList.is() )
1479 0 : return false;
1480 :
1481 0 : long nPos = pGradientList->GetIndex(aStrName);
1482 0 : if( nPos == -1 )
1483 0 : return false;
1484 :
1485 0 : XGradientEntry* pEntry = pGradientList->GetGradient( nPos );
1486 0 : XFillGradientItem aGrdItem;
1487 0 : aGrdItem.SetWhich( XATTR_FILLGRADIENT );
1488 0 : aGrdItem.SetName( rName );
1489 0 : aGrdItem.SetGradientValue( pEntry->GetGradient() );
1490 0 : rSet.Put( aGrdItem );
1491 0 : break;
1492 : }
1493 : case XATTR_FILLHATCH:
1494 : {
1495 0 : XHatchListRef pHatchList = pModel->GetHatchList();
1496 :
1497 0 : if( !pHatchList.is() )
1498 0 : return false;
1499 :
1500 0 : long nPos = pHatchList->GetIndex(aStrName);
1501 0 : if( nPos == -1 )
1502 0 : return false;
1503 :
1504 0 : XHatchEntry* pEntry = pHatchList->GetHatch( nPos );
1505 0 : XFillHatchItem aHatchItem;
1506 0 : aHatchItem.SetWhich( XATTR_FILLHATCH );
1507 0 : aHatchItem.SetName( rName );
1508 0 : aHatchItem.SetHatchValue( pEntry->GetHatch() );
1509 0 : rSet.Put( aHatchItem );
1510 0 : break;
1511 : }
1512 : case XATTR_LINEEND:
1513 : case XATTR_LINESTART:
1514 : {
1515 0 : XLineEndListRef pLineEndList = pModel->GetLineEndList();
1516 :
1517 0 : if( !pLineEndList.is() )
1518 0 : return false;
1519 :
1520 0 : long nPos = pLineEndList->GetIndex(aStrName);
1521 0 : if( nPos == -1 )
1522 0 : return false;
1523 :
1524 0 : XLineEndEntry* pEntry = pLineEndList->GetLineEnd( nPos );
1525 0 : if( XATTR_LINEEND == nWID )
1526 : {
1527 0 : XLineEndItem aLEItem;
1528 0 : aLEItem.SetWhich( XATTR_LINEEND );
1529 0 : aLEItem.SetName( rName );
1530 0 : aLEItem.SetLineEndValue( pEntry->GetLineEnd() );
1531 0 : rSet.Put( aLEItem );
1532 : }
1533 : else
1534 : {
1535 0 : XLineStartItem aLSItem;
1536 0 : aLSItem.SetWhich( XATTR_LINESTART );
1537 0 : aLSItem.SetName( rName );
1538 0 : aLSItem.SetLineStartValue( pEntry->GetLineEnd() );
1539 0 : rSet.Put( aLSItem );
1540 : }
1541 :
1542 0 : break;
1543 : }
1544 : case XATTR_LINEDASH:
1545 : {
1546 446 : XDashListRef pDashList = pModel->GetDashList();
1547 :
1548 446 : if( !pDashList.is() )
1549 0 : return false;
1550 :
1551 446 : long nPos = pDashList->GetIndex(aStrName);
1552 446 : if( nPos == -1 )
1553 446 : return false;
1554 :
1555 0 : XDashEntry* pEntry = pDashList->GetDash( nPos );
1556 0 : XLineDashItem aDashItem;
1557 0 : aDashItem.SetWhich( XATTR_LINEDASH );
1558 0 : aDashItem.SetName( rName );
1559 0 : aDashItem.SetDashValue( pEntry->GetDash() );
1560 0 : rSet.Put( aDashItem );
1561 0 : break;
1562 : }
1563 : default:
1564 0 : return false;
1565 0 : }
1566 : }
1567 :
1568 3851 : return true;
1569 : }
1570 :
1571 :
1572 :
1573 4443 : bool SAL_CALL SvxShape::SetFillAttribute( sal_Int32 nWID, const OUString& rName, SfxItemSet& rSet )
1574 : {
1575 4443 : OUString aName = SvxUnogetInternalNameForItem((sal_Int16)nWID, rName);
1576 :
1577 4443 : if (aName.isEmpty())
1578 : {
1579 715 : switch( nWID )
1580 : {
1581 : case XATTR_LINEEND:
1582 : case XATTR_LINESTART:
1583 : {
1584 8 : const OUString aEmpty;
1585 16 : const basegfx::B2DPolyPolygon aEmptyPoly;
1586 8 : if( nWID == XATTR_LINEEND )
1587 4 : rSet.Put( XLineEndItem( aEmpty, aEmptyPoly ) );
1588 : else
1589 4 : rSet.Put( XLineStartItem( aEmpty, aEmptyPoly ) );
1590 :
1591 16 : return true;
1592 : }
1593 : case XATTR_FILLFLOATTRANSPARENCE:
1594 : {
1595 : // #85953# Set a disabled XFillFloatTransparenceItem
1596 261 : rSet.Put(XFillFloatTransparenceItem());
1597 :
1598 261 : return true;
1599 : }
1600 : }
1601 :
1602 446 : return false;
1603 : }
1604 :
1605 3728 : const SfxItemPool* pPool = rSet.GetPool();
1606 :
1607 3728 : const OUString aSearchName( aName );
1608 3728 : const sal_uInt32 nCount = pPool->GetItemCount2((sal_uInt16)nWID);
1609 : const NameOrIndex* pItem;
1610 :
1611 9419 : for( sal_uInt32 nSurrogate = 0; nSurrogate < nCount; nSurrogate++ )
1612 : {
1613 9417 : pItem = static_cast<const NameOrIndex*>(pPool->GetItem2((sal_uInt16)nWID, nSurrogate));
1614 9417 : if( pItem && ( pItem->GetName() == aSearchName ) )
1615 : {
1616 3726 : rSet.Put( *pItem );
1617 3726 : return true;
1618 : }
1619 : }
1620 :
1621 2 : return false;
1622 : }
1623 :
1624 :
1625 :
1626 1094669 : void SAL_CALL SvxShape::setPropertyValue( const OUString& rPropertyName, const uno::Any& rVal )
1627 : throw(beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException, std::exception)
1628 : {
1629 1094669 : if( mpImpl->mpMaster )
1630 : {
1631 59336 : mpImpl->mpMaster->setPropertyValue( rPropertyName, rVal );
1632 : }
1633 : else
1634 : {
1635 1035333 : _setPropertyValue( rPropertyName, rVal );
1636 : }
1637 1092608 : }
1638 :
1639 1090179 : void SAL_CALL SvxShape::_setPropertyValue( const OUString& rPropertyName, const uno::Any& rVal )
1640 : throw(beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException, std::exception)
1641 : {
1642 1090179 : ::SolarMutexGuard aGuard;
1643 :
1644 1090179 : const SfxItemPropertySimpleEntry* pMap = mpPropSet->getPropertyMapEntry(rPropertyName);
1645 :
1646 1090179 : if( mpObj.is() && mpModel )
1647 : {
1648 1089073 : if( pMap == NULL )
1649 364 : throw beans::UnknownPropertyException();
1650 :
1651 1088709 : if( (pMap->nFlags & beans::PropertyAttribute::READONLY ) != 0 )
1652 : throw beans::PropertyVetoException(
1653 : ( OUString(
1654 : "Readonly property can't be set: " )
1655 0 : + rPropertyName ),
1656 0 : uno::Reference< drawing::XShape >( this ) );
1657 :
1658 1088709 : mpModel->SetChanged();
1659 :
1660 1088709 : if(!setPropertyValueImpl( rPropertyName, pMap, rVal ) )
1661 : {
1662 : DBG_ASSERT( pMap->nWID == SDRATTR_TEXTDIRECTION || pMap->nWID < SDRATTR_NOTPERSIST_FIRST || pMap->nWID > SDRATTR_NOTPERSIST_LAST, "Not persist item not handled!" );
1663 : DBG_ASSERT( pMap->nWID < OWN_ATTR_VALUE_START || pMap->nWID > OWN_ATTR_VALUE_END, "Not item property not handled!" );
1664 :
1665 961712 : bool bIsNotPersist = pMap->nWID >= SDRATTR_NOTPERSIST_FIRST && pMap->nWID <= SDRATTR_NOTPERSIST_LAST && pMap->nWID != SDRATTR_TEXTDIRECTION;
1666 :
1667 961712 : if( pMap->nWID == SDRATTR_ECKENRADIUS )
1668 : {
1669 28 : sal_Int32 nCornerRadius = 0;
1670 28 : if( !(rVal >>= nCornerRadius) || (nCornerRadius < 0) || (nCornerRadius > 5000000))
1671 0 : throw IllegalArgumentException();
1672 : }
1673 :
1674 : SfxItemSet* pSet;
1675 961712 : if( mbIsMultiPropertyCall && !bIsNotPersist )
1676 : {
1677 1828006 : if( mpImpl->mpItemSet == NULL )
1678 : {
1679 34535 : pSet = mpImpl->mpItemSet = mpObj->GetMergedItemSet().Clone();
1680 : }
1681 : else
1682 : {
1683 879468 : pSet = mpImpl->mpItemSet;
1684 : }
1685 : }
1686 : else
1687 : {
1688 47709 : pSet = new SfxItemSet( mpModel->GetItemPool(), pMap->nWID, pMap->nWID);
1689 : }
1690 :
1691 961712 : if( pSet->GetItemState( pMap->nWID ) != SfxItemState::SET )
1692 701704 : pSet->Put(mpObj->GetMergedItem(pMap->nWID));
1693 :
1694 961712 : if( !SvxUnoTextRangeBase::SetPropertyValueHelper( *pSet, pMap, rVal, *pSet ))
1695 : {
1696 961712 : if( pSet->GetItemState( pMap->nWID ) != SfxItemState::SET )
1697 : {
1698 0 : if(bIsNotPersist)
1699 : {
1700 : // Not-Persistent Attribute, hole diese extra
1701 0 : mpObj->TakeNotPersistAttr(*pSet, false);
1702 : }
1703 : }
1704 :
1705 961712 : if( pSet->GetItemState( pMap->nWID ) != SfxItemState::SET )
1706 : {
1707 : // Default aus ItemPool holen
1708 0 : if(SfxItemPool::IsWhich(pMap->nWID))
1709 0 : pSet->Put(mpModel->GetItemPool().GetDefaultItem(pMap->nWID));
1710 : }
1711 :
1712 961712 : if( pSet->GetItemState( pMap->nWID ) == SfxItemState::SET )
1713 : {
1714 961712 : SvxItemPropertySet_setPropertyValue( *mpPropSet, pMap, rVal, *pSet );
1715 : }
1716 : }
1717 :
1718 961712 : if(bIsNotPersist)
1719 : {
1720 : // Not-Persist Attribute extra setzen
1721 0 : mpObj->ApplyNotPersistAttr( *pSet );
1722 0 : delete pSet;
1723 : }
1724 : else
1725 : {
1726 : // if we have a XMultiProperty call then the item set
1727 : // will be set in setPropertyValues later
1728 961712 : if( !mbIsMultiPropertyCall )
1729 : {
1730 47709 : mpObj->SetMergedItemSetAndBroadcast( *pSet );
1731 :
1732 47709 : delete pSet;
1733 : }
1734 : }
1735 2049830 : return;
1736 : }
1737 : }
1738 : else
1739 : {
1740 : // since we have no actual sdr object right now
1741 : // remember all properties in a list. These
1742 : // properties will be set when the sdr object is
1743 : // created
1744 :
1745 1106 : if(pMap && pMap->nWID)
1746 : // Fixme: We should throw a UnknownPropertyException here.
1747 : // But since this class is aggregated from classes
1748 : // that support additional properties that we don't
1749 : // know here we silently store *all* properties, even
1750 : // if they may be not supported after creation
1751 1090 : mpPropSet->setPropertyValue( pMap, rVal );
1752 128467 : }
1753 : }
1754 :
1755 :
1756 :
1757 154342 : uno::Any SAL_CALL SvxShape::getPropertyValue( const OUString& PropertyName )
1758 : throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException, std::exception)
1759 : {
1760 154342 : if ( mpImpl->mpMaster )
1761 58784 : return mpImpl->mpMaster->getPropertyValue( PropertyName );
1762 : else
1763 95558 : return _getPropertyValue( PropertyName );
1764 : }
1765 :
1766 :
1767 :
1768 149806 : uno::Any SvxShape::_getPropertyValue( const OUString& PropertyName )
1769 : throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
1770 : {
1771 149806 : ::SolarMutexGuard aGuard;
1772 :
1773 149806 : const SfxItemPropertySimpleEntry* pMap = mpPropSet->getPropertyMapEntry(PropertyName);
1774 :
1775 149806 : uno::Any aAny;
1776 149806 : if( mpObj.is() && mpModel )
1777 : {
1778 148518 : if(pMap == NULL )
1779 4478 : throw beans::UnknownPropertyException();
1780 :
1781 144040 : if( !getPropertyValueImpl( PropertyName, pMap, aAny ) )
1782 : {
1783 : DBG_ASSERT( pMap->nWID == SDRATTR_TEXTDIRECTION || (pMap->nWID < SDRATTR_NOTPERSIST_FIRST || pMap->nWID > SDRATTR_NOTPERSIST_LAST), "Not persist item not handled!" );
1784 : DBG_ASSERT( pMap->nWID < OWN_ATTR_VALUE_START || pMap->nWID > OWN_ATTR_VALUE_END, "Not item property not handled!" );
1785 :
1786 91910 : SfxItemSet aSet( mpModel->GetItemPool(), pMap->nWID, pMap->nWID);
1787 91910 : aSet.Put(mpObj->GetMergedItem(pMap->nWID));
1788 :
1789 91910 : if(SvxUnoTextRangeBase::GetPropertyValueHelper( aSet, pMap, aAny ))
1790 0 : return aAny;
1791 :
1792 91910 : if(!aSet.Count())
1793 : {
1794 0 : if(pMap->nWID >= SDRATTR_NOTPERSIST_FIRST && pMap->nWID <= SDRATTR_NOTPERSIST_LAST)
1795 : {
1796 : // Not-Persistent Attribute, hole diese extra
1797 0 : mpObj->TakeNotPersistAttr(aSet, false);
1798 : }
1799 : }
1800 :
1801 91910 : if(!aSet.Count())
1802 : {
1803 : // Default aus ItemPool holen
1804 0 : if(SfxItemPool::IsWhich(pMap->nWID))
1805 0 : aSet.Put(mpModel->GetItemPool().GetDefaultItem(pMap->nWID));
1806 : }
1807 :
1808 91910 : if(aSet.Count())
1809 91910 : aAny = GetAnyForItem( aSet, pMap );
1810 : }
1811 : }
1812 : else
1813 : {
1814 :
1815 : // Fixme: we should return default values for OWN_ATTR !
1816 :
1817 1288 : if(pMap && pMap->nWID)
1818 : // FixMe: see setPropertyValue
1819 600 : aAny = mpPropSet->getPropertyValue( pMap );
1820 :
1821 : }
1822 149806 : return aAny;
1823 : }
1824 :
1825 :
1826 :
1827 : // XMultiPropertySet
1828 34723 : void SAL_CALL SvxShape::setPropertyValues( const ::com::sun::star::uno::Sequence< OUString >& aPropertyNames, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aValues ) throw (::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException, std::exception)
1829 : {
1830 34723 : ::SolarMutexGuard aSolarGuard;
1831 :
1832 34723 : const sal_Int32 nCount = aPropertyNames.getLength();
1833 34723 : const OUString* pNames = aPropertyNames.getConstArray();
1834 :
1835 34723 : const uno::Any* pValues = aValues.getConstArray();
1836 :
1837 : // make sure mbIsMultiPropertyCall and mpImpl->mpItemSet are
1838 : // reseted even when an exception is thrown
1839 69446 : const ::comphelper::ScopeGuard aGuard( boost::bind( &SvxShape::endSetPropertyValues, this ) );
1840 :
1841 34723 : mbIsMultiPropertyCall = true;
1842 :
1843 34723 : if( mpImpl->mpMaster )
1844 : {
1845 46186 : for( sal_Int32 nIdx = 0; nIdx < nCount; nIdx++, pNames++, pValues++ )
1846 : {
1847 : try
1848 : {
1849 41478 : setPropertyValue( *pNames, *pValues );
1850 : }
1851 308 : catch( beans::UnknownPropertyException& e )
1852 : {
1853 : (void)e;
1854 : }
1855 4 : catch( uno::Exception& ex )
1856 : {
1857 : (void)ex;
1858 : }
1859 : }
1860 : }
1861 : else
1862 : {
1863 30015 : uno::Reference< beans::XPropertySet > xSet;
1864 30015 : queryInterface( cppu::UnoType<beans::XPropertySet>::get()) >>= xSet;
1865 :
1866 929681 : for( sal_Int32 nIdx = 0; nIdx < nCount; nIdx++, pNames++, pValues++ )
1867 : {
1868 : try
1869 : {
1870 899666 : xSet->setPropertyValue( *pNames, *pValues );
1871 : }
1872 40 : catch( beans::UnknownPropertyException& e )
1873 : {
1874 : (void)e;
1875 : }
1876 446 : catch( uno::Exception& ex )
1877 : {
1878 : (void)ex;
1879 : }
1880 30015 : }
1881 : }
1882 :
1883 34723 : if( mpImpl->mpItemSet && mpObj.is() )
1884 69258 : mpObj->SetMergedItemSetAndBroadcast( *mpImpl->mpItemSet );
1885 34723 : }
1886 :
1887 :
1888 :
1889 34723 : void SvxShape::endSetPropertyValues()
1890 : {
1891 34723 : mbIsMultiPropertyCall = false;
1892 34723 : if( mpImpl->mpItemSet )
1893 : {
1894 34535 : delete mpImpl->mpItemSet;
1895 34535 : mpImpl->mpItemSet = 0;
1896 : }
1897 34723 : }
1898 :
1899 :
1900 :
1901 232 : ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > SAL_CALL SvxShape::getPropertyValues( const ::com::sun::star::uno::Sequence< OUString >& aPropertyNames ) throw (::com::sun::star::uno::RuntimeException, std::exception)
1902 : {
1903 232 : const sal_Int32 nCount = aPropertyNames.getLength();
1904 232 : const OUString* pNames = aPropertyNames.getConstArray();
1905 :
1906 232 : uno::Sequence< uno::Any > aRet( nCount );
1907 232 : uno::Any* pValue = aRet.getArray();;
1908 :
1909 232 : if( mpImpl->mpMaster )
1910 : {
1911 1366 : for( sal_Int32 nIdx = 0; nIdx < nCount; nIdx++, pValue++, pNames++ )
1912 : {
1913 : try
1914 : {
1915 1192 : *pValue = getPropertyValue( *pNames );
1916 : }
1917 0 : catch( uno::Exception& )
1918 : {
1919 : OSL_FAIL( "SvxShape::getPropertyValues, unknown property asked" );
1920 : }
1921 : }
1922 : }
1923 : else
1924 : {
1925 58 : uno::Reference< beans::XPropertySet > xSet;
1926 58 : queryInterface( cppu::UnoType<beans::XPropertySet>::get()) >>= xSet;
1927 :
1928 756 : for( sal_Int32 nIdx = 0; nIdx < nCount; nIdx++, pValue++, pNames++ )
1929 : {
1930 : try
1931 : {
1932 698 : *pValue = xSet->getPropertyValue( *pNames );
1933 : }
1934 0 : catch( uno::Exception& )
1935 : {
1936 : OSL_FAIL( "SvxShape::getPropertyValues, unknown property asked" );
1937 : }
1938 58 : }
1939 : }
1940 :
1941 232 : return aRet;
1942 : }
1943 :
1944 0 : void SAL_CALL SvxShape::addPropertiesChangeListener( const ::com::sun::star::uno::Sequence< OUString >& , const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener >& ) throw (::com::sun::star::uno::RuntimeException, std::exception)
1945 : {
1946 0 : }
1947 :
1948 0 : void SAL_CALL SvxShape::removePropertiesChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener >& ) throw (::com::sun::star::uno::RuntimeException, std::exception)
1949 : {
1950 0 : }
1951 :
1952 0 : void SAL_CALL SvxShape::firePropertiesChangeEvent( const ::com::sun::star::uno::Sequence< OUString >& , const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener >& ) throw (::com::sun::star::uno::RuntimeException, std::exception)
1953 : {
1954 0 : }
1955 :
1956 :
1957 :
1958 91910 : uno::Any SvxShape::GetAnyForItem( SfxItemSet& aSet, const SfxItemPropertySimpleEntry* pMap ) const
1959 : {
1960 : DBG_TESTSOLARMUTEX();
1961 91910 : uno::Any aAny;
1962 :
1963 91910 : switch(pMap->nWID)
1964 : {
1965 : case SDRATTR_CIRCSTARTANGLE:
1966 : {
1967 0 : const SfxPoolItem* pPoolItem=NULL;
1968 0 : if(aSet.GetItemState(SDRATTR_CIRCSTARTANGLE,false,&pPoolItem)==SfxItemState::SET)
1969 : {
1970 0 : sal_Int32 nAngle = static_cast<const SdrAngleItem*>(pPoolItem)->GetValue();
1971 0 : aAny <<= nAngle;
1972 : }
1973 0 : break;
1974 : }
1975 :
1976 : case SDRATTR_CIRCENDANGLE:
1977 : {
1978 0 : const SfxPoolItem* pPoolItem=NULL;
1979 0 : if (aSet.GetItemState(SDRATTR_CIRCENDANGLE,false,&pPoolItem)==SfxItemState::SET)
1980 : {
1981 0 : sal_Int32 nAngle = static_cast<const SdrAngleItem*>(pPoolItem)->GetValue();
1982 0 : aAny <<= nAngle;
1983 : }
1984 0 : break;
1985 : }
1986 :
1987 : case SDRATTR_CIRCKIND:
1988 : {
1989 8 : if( mpObj->GetObjInventor() == SdrInventor)
1990 : {
1991 : drawing::CircleKind eKind;
1992 8 : switch(mpObj->GetObjIdentifier())
1993 : {
1994 : case OBJ_CIRC: // Kreis, Ellipse
1995 8 : eKind = drawing::CircleKind_FULL;
1996 8 : break;
1997 : case OBJ_CCUT: // Kreisabschnitt
1998 0 : eKind = drawing::CircleKind_CUT;
1999 0 : break;
2000 : case OBJ_CARC: // Kreisbogen
2001 0 : eKind = drawing::CircleKind_ARC;
2002 0 : break;
2003 : case OBJ_SECT: // Kreissektor
2004 0 : eKind = drawing::CircleKind_SECTION;
2005 0 : break;
2006 : }
2007 8 : aAny <<= eKind;
2008 : }
2009 8 : break;
2010 : }
2011 : default:
2012 : {
2013 : // Hole Wert aus ItemSet
2014 91902 : aAny = SvxItemPropertySet_getPropertyValue( *mpPropSet, pMap, aSet );
2015 :
2016 91902 : if( pMap->aType != aAny.getValueType() )
2017 : {
2018 : // since the sfx uint16 item now exports a sal_Int32, we may have to fix this here
2019 6750 : if( ( pMap->aType == ::cppu::UnoType<sal_Int16>::get()) && aAny.getValueType() == ::cppu::UnoType<sal_Int32>::get() )
2020 : {
2021 6750 : sal_Int32 nValue = 0;
2022 6750 : aAny >>= nValue;
2023 6750 : aAny <<= (sal_Int16)nValue;
2024 : }
2025 : else
2026 : {
2027 : OSL_FAIL("SvxShape::GetAnyForItem() Returnvalue has wrong Type!" );
2028 : }
2029 : }
2030 :
2031 : }
2032 : }
2033 :
2034 91910 : return aAny;
2035 : }
2036 :
2037 :
2038 :
2039 : // XPropertyState
2040 21866 : beans::PropertyState SAL_CALL SvxShape::getPropertyState( const OUString& PropertyName )
2041 : throw(beans::UnknownPropertyException, uno::RuntimeException, std::exception)
2042 : {
2043 21866 : if( mpImpl->mpMaster )
2044 : {
2045 16136 : return mpImpl->mpMaster->getPropertyState( PropertyName );
2046 : }
2047 : else
2048 : {
2049 5730 : return _getPropertyState( PropertyName );
2050 : }
2051 : }
2052 :
2053 19106 : beans::PropertyState SAL_CALL SvxShape::_getPropertyState( const OUString& PropertyName )
2054 : throw(beans::UnknownPropertyException, uno::RuntimeException)
2055 : {
2056 19106 : ::SolarMutexGuard aGuard;
2057 :
2058 19106 : const SfxItemPropertySimpleEntry* pMap = mpPropSet->getPropertyMapEntry(PropertyName);
2059 :
2060 19106 : if( !mpObj.is() || pMap == NULL )
2061 0 : throw beans::UnknownPropertyException();
2062 :
2063 : beans::PropertyState eState;
2064 19106 : if( !getPropertyStateImpl( pMap, eState ) )
2065 : {
2066 18614 : const SfxItemSet& rSet = mpObj->GetMergedItemSet();
2067 :
2068 18614 : switch( rSet.GetItemState( pMap->nWID, false ) )
2069 : {
2070 : case SfxItemState::READONLY:
2071 : case SfxItemState::SET:
2072 2370 : eState = beans::PropertyState_DIRECT_VALUE;
2073 2370 : break;
2074 : case SfxItemState::DEFAULT:
2075 16134 : eState = beans::PropertyState_DEFAULT_VALUE;
2076 16134 : break;
2077 : default:
2078 110 : eState = beans::PropertyState_AMBIGUOUS_VALUE;
2079 110 : break;
2080 : }
2081 :
2082 : // if a item is set, this doesn't mean we want it :)
2083 18614 : if( ( beans::PropertyState_DIRECT_VALUE == eState ) )
2084 : {
2085 2370 : switch( pMap->nWID )
2086 : {
2087 : // the following items are disabled by changing the
2088 : // fill style or the line style. so there is no need
2089 : // to export items without names which should be empty
2090 : case XATTR_FILLBITMAP:
2091 : case XATTR_FILLGRADIENT:
2092 : case XATTR_FILLHATCH:
2093 : case XATTR_LINEDASH:
2094 : {
2095 0 : const NameOrIndex* pItem = static_cast<const NameOrIndex*>(rSet.GetItem((sal_uInt16)pMap->nWID));
2096 0 : if( ( pItem == NULL ) || pItem->GetName().isEmpty() )
2097 0 : eState = beans::PropertyState_DEFAULT_VALUE;
2098 : }
2099 0 : break;
2100 :
2101 : // #i36115#
2102 : // If e.g. the LineStart is on NONE and thus the string has length 0, it still
2103 : // may be a hard attribute covering the set LineStart of the parent (Style).
2104 : // #i37644#
2105 : // same is for fill float transparency
2106 : case XATTR_LINEEND:
2107 : case XATTR_LINESTART:
2108 : case XATTR_FILLFLOATTRANSPARENCE:
2109 : {
2110 4 : const NameOrIndex* pItem = static_cast<const NameOrIndex*>(rSet.GetItem((sal_uInt16)pMap->nWID));
2111 4 : if ( pItem == NULL )
2112 0 : eState = beans::PropertyState_DEFAULT_VALUE;
2113 : }
2114 4 : break;
2115 : }
2116 : }
2117 : }
2118 19106 : return eState;
2119 : }
2120 :
2121 1062694 : bool SvxShape::setPropertyValueImpl( const OUString&, const SfxItemPropertySimpleEntry* pProperty, const ::com::sun::star::uno::Any& rValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException, std::exception)
2122 : {
2123 1062694 : switch( pProperty->nWID )
2124 : {
2125 : case OWN_ATTR_CAPTION_POINT:
2126 : {
2127 32 : awt::Point aPnt;
2128 32 : if( rValue >>= aPnt )
2129 : {
2130 32 : Point aVclPoint( aPnt.X, aPnt.Y );
2131 :
2132 : // #90763# position is relative to top left, make it absolute
2133 32 : basegfx::B2DPolyPolygon aNewPolyPolygon;
2134 64 : basegfx::B2DHomMatrix aNewHomogenMatrix;
2135 32 : mpObj->TRGetBaseGeometry(aNewHomogenMatrix, aNewPolyPolygon);
2136 :
2137 32 : aVclPoint.X() += basegfx::fround(aNewHomogenMatrix.get(0, 2));
2138 32 : aVclPoint.Y() += basegfx::fround(aNewHomogenMatrix.get(1, 2));
2139 :
2140 : // #88657# metric of pool maybe twips (writer)
2141 32 : ForceMetricToItemPoolMetric(aVclPoint);
2142 :
2143 : // #88491# position relative to anchor
2144 32 : if( mpModel->IsWriter() )
2145 : {
2146 0 : aVclPoint += mpObj->GetAnchorPos();
2147 : }
2148 :
2149 32 : static_cast<SdrCaptionObj*>(mpObj.get())->SetTailPos(aVclPoint);
2150 :
2151 64 : return true;
2152 : }
2153 0 : break;
2154 : }
2155 : case OWN_ATTR_TRANSFORMATION:
2156 : {
2157 28979 : drawing::HomogenMatrix3 aMatrix;
2158 28979 : if(rValue >>= aMatrix)
2159 : {
2160 27778 : basegfx::B2DPolyPolygon aNewPolyPolygon;
2161 55556 : basegfx::B2DHomMatrix aNewHomogenMatrix;
2162 :
2163 27778 : mpObj->TRGetBaseGeometry(aNewHomogenMatrix, aNewPolyPolygon);
2164 :
2165 27778 : aNewHomogenMatrix.set(0, 0, aMatrix.Line1.Column1);
2166 27778 : aNewHomogenMatrix.set(0, 1, aMatrix.Line1.Column2);
2167 27778 : aNewHomogenMatrix.set(0, 2, aMatrix.Line1.Column3);
2168 27778 : aNewHomogenMatrix.set(1, 0, aMatrix.Line2.Column1);
2169 27778 : aNewHomogenMatrix.set(1, 1, aMatrix.Line2.Column2);
2170 27778 : aNewHomogenMatrix.set(1, 2, aMatrix.Line2.Column3);
2171 27778 : aNewHomogenMatrix.set(2, 0, aMatrix.Line3.Column1);
2172 27778 : aNewHomogenMatrix.set(2, 1, aMatrix.Line3.Column2);
2173 27778 : aNewHomogenMatrix.set(2, 2, aMatrix.Line3.Column3);
2174 :
2175 27778 : mpObj->TRSetBaseGeometry(aNewHomogenMatrix, aNewPolyPolygon);
2176 55556 : return true;
2177 : }
2178 1201 : break;
2179 : }
2180 :
2181 : case OWN_ATTR_ZORDER:
2182 : {
2183 6753 : sal_Int32 nNewOrdNum = 0;
2184 6753 : if(rValue >>= nNewOrdNum)
2185 : {
2186 6753 : SdrObjList* pObjList = mpObj->GetObjList();
2187 6753 : if( pObjList )
2188 : {
2189 : #ifdef DBG_UTIL
2190 : SdrObject* pCheck =
2191 : #endif
2192 6753 : pObjList->SetObjectOrdNum( mpObj->GetOrdNum(), static_cast<size_t>(nNewOrdNum) );
2193 : DBG_ASSERT( pCheck == mpObj.get(), "GetOrdNum() failed!" );
2194 : }
2195 6753 : return true;
2196 : }
2197 0 : break;
2198 : }
2199 : case OWN_ATTR_FRAMERECT:
2200 : {
2201 0 : awt::Rectangle aUnoRect;
2202 0 : if(rValue >>= aUnoRect)
2203 : {
2204 0 : Point aTopLeft( aUnoRect.X, aUnoRect.Y );
2205 0 : Size aObjSize( aUnoRect.Width, aUnoRect.Height );
2206 0 : ForceMetricToItemPoolMetric(aTopLeft);
2207 0 : ForceMetricToItemPoolMetric(aObjSize);
2208 0 : Rectangle aRect;
2209 0 : aRect.SetPos(aTopLeft);
2210 0 : aRect.SetSize(aObjSize);
2211 0 : mpObj->SetSnapRect(aRect);
2212 0 : return true;
2213 : }
2214 0 : break;
2215 : }
2216 : case OWN_ATTR_MIRRORED:
2217 : {
2218 : bool bMirror;
2219 56 : if(rValue >>= bMirror )
2220 : {
2221 56 : SdrGrafObj* pObj = dynamic_cast< SdrGrafObj* >( mpObj.get() );
2222 56 : if( pObj )
2223 56 : pObj->SetMirrored(bMirror);
2224 56 : return true;
2225 : }
2226 0 : break;
2227 : }
2228 : case OWN_ATTR_EDGE_START_OBJ:
2229 : case OWN_ATTR_EDGE_END_OBJ:
2230 : case OWN_ATTR_GLUEID_HEAD:
2231 : case OWN_ATTR_GLUEID_TAIL:
2232 : case OWN_ATTR_EDGE_START_POS:
2233 : case OWN_ATTR_EDGE_END_POS:
2234 : case OWN_ATTR_EDGE_POLYPOLYGONBEZIER:
2235 : {
2236 30 : SdrEdgeObj* pEdgeObj = dynamic_cast< SdrEdgeObj* >(mpObj.get());
2237 30 : if(pEdgeObj)
2238 : {
2239 30 : switch(pProperty->nWID)
2240 : {
2241 : case OWN_ATTR_EDGE_START_OBJ:
2242 : case OWN_ATTR_EDGE_END_OBJ:
2243 : {
2244 12 : Reference< drawing::XShape > xShape;
2245 12 : if( rValue >>= xShape )
2246 : {
2247 12 : SdrObject* pNode = GetSdrObjectFromXShape( xShape );
2248 12 : if( pNode )
2249 : {
2250 12 : pEdgeObj->ConnectToNode( pProperty->nWID == OWN_ATTR_EDGE_START_OBJ, pNode );
2251 12 : pEdgeObj->setGluePointIndex( pProperty->nWID == OWN_ATTR_EDGE_START_OBJ, -1 );
2252 12 : return true;
2253 : }
2254 : }
2255 0 : break;
2256 : }
2257 :
2258 : case OWN_ATTR_EDGE_START_POS:
2259 : case OWN_ATTR_EDGE_END_POS:
2260 : {
2261 4 : awt::Point aUnoPoint;
2262 4 : if( rValue >>= aUnoPoint )
2263 : {
2264 4 : Point aPoint( aUnoPoint.X, aUnoPoint.Y );
2265 :
2266 : // Reintroduction of fix for issue i59051 (#i108851#)
2267 : // perform metric change before applying anchor position,
2268 : // because the anchor position is in pool metric.
2269 4 : ForceMetricToItemPoolMetric( aPoint );
2270 4 : if( mpModel->IsWriter() )
2271 0 : aPoint += mpObj->GetAnchorPos();
2272 :
2273 4 : pEdgeObj->SetTailPoint( pProperty->nWID == OWN_ATTR_EDGE_START_POS, aPoint );
2274 4 : return true;
2275 : }
2276 0 : break;
2277 : }
2278 :
2279 : case OWN_ATTR_GLUEID_HEAD:
2280 : case OWN_ATTR_GLUEID_TAIL:
2281 : {
2282 12 : sal_Int32 nId = 0;
2283 12 : if( rValue >>= nId )
2284 : {
2285 12 : pEdgeObj->setGluePointIndex( pProperty->nWID == OWN_ATTR_GLUEID_HEAD, nId );
2286 12 : return true;
2287 : }
2288 0 : break;
2289 : }
2290 : case OWN_ATTR_EDGE_POLYPOLYGONBEZIER:
2291 : {
2292 2 : basegfx::B2DPolyPolygon aNewPolyPolygon;
2293 :
2294 : // #123616# be a little bit more flexible regardin gthe data type used
2295 2 : if( rValue.getValueType() == ::getCppuType(( const drawing::PointSequenceSequence*)0))
2296 : {
2297 : // get polygpon data from PointSequenceSequence
2298 0 : aNewPolyPolygon = basegfx::tools::UnoPointSequenceSequenceToB2DPolyPolygon(
2299 0 : *(const drawing::PointSequenceSequence*)rValue.getValue());
2300 : }
2301 2 : else if( rValue.getValueType() == cppu::UnoType<drawing::PolyPolygonBezierCoords>::get())
2302 : {
2303 : // get polygpon data from PolyPolygonBezierCoords
2304 4 : aNewPolyPolygon = basegfx::tools::UnoPolyPolygonBezierCoordsToB2DPolyPolygon(
2305 4 : *(const drawing::PolyPolygonBezierCoords*)rValue.getValue());
2306 : }
2307 :
2308 2 : if(aNewPolyPolygon.count())
2309 : {
2310 : // Reintroduction of fix for issue i59051 (#i108851#)
2311 2 : ForceMetricToItemPoolMetric( aNewPolyPolygon );
2312 2 : if( mpModel->IsWriter() )
2313 : {
2314 0 : Point aPoint( mpObj->GetAnchorPos() );
2315 0 : aNewPolyPolygon.transform(basegfx::tools::createTranslateB2DHomMatrix(aPoint.X(), aPoint.Y()));
2316 : }
2317 2 : pEdgeObj->SetEdgeTrackPath( aNewPolyPolygon );
2318 2 : return true;
2319 0 : }
2320 : }
2321 : }
2322 : }
2323 0 : break;
2324 : }
2325 : case OWN_ATTR_MEASURE_START_POS:
2326 : case OWN_ATTR_MEASURE_END_POS:
2327 : {
2328 4 : SdrMeasureObj* pMeasureObj = dynamic_cast< SdrMeasureObj* >(mpObj.get());
2329 4 : awt::Point aUnoPoint;
2330 4 : if(pMeasureObj && ( rValue >>= aUnoPoint ) )
2331 : {
2332 4 : Point aPoint( aUnoPoint.X, aUnoPoint.Y );
2333 :
2334 : // Reintroduction of fix for issue #i59051# (#i108851#)
2335 4 : ForceMetricToItemPoolMetric( aPoint );
2336 4 : if( mpModel->IsWriter() )
2337 4 : aPoint += mpObj->GetAnchorPos();
2338 :
2339 4 : pMeasureObj->NbcSetPoint( aPoint, pProperty->nWID == OWN_ATTR_MEASURE_START_POS ? 0L : 1L );
2340 4 : pMeasureObj->SetChanged();
2341 4 : pMeasureObj->BroadcastObjectChange();
2342 4 : return true;
2343 : }
2344 0 : break;
2345 : }
2346 : case OWN_ATTR_FILLBMP_MODE:
2347 : {
2348 : drawing::BitmapMode eMode;
2349 9342 : if(!(rValue >>= eMode) )
2350 : {
2351 0 : sal_Int32 nMode = 0;
2352 0 : if(!(rValue >>= nMode))
2353 0 : break;
2354 :
2355 0 : eMode = (drawing::BitmapMode)nMode;
2356 : }
2357 9342 : mpObj->SetMergedItem( XFillBmpStretchItem( eMode == drawing::BitmapMode_STRETCH ) );
2358 9342 : mpObj->SetMergedItem( XFillBmpTileItem( eMode == drawing::BitmapMode_REPEAT ) );
2359 9342 : return true;
2360 : }
2361 :
2362 : case SDRATTR_LAYERID:
2363 : {
2364 52 : sal_Int16 nLayerId = sal_Int16();
2365 52 : if( rValue >>= nLayerId )
2366 : {
2367 52 : SdrLayer* pLayer = mpModel->GetLayerAdmin().GetLayerPerID((unsigned char)nLayerId);
2368 52 : if( pLayer )
2369 : {
2370 52 : mpObj->SetLayer((unsigned char)nLayerId);
2371 52 : return true;
2372 : }
2373 : }
2374 0 : break;
2375 : }
2376 :
2377 : case SDRATTR_LAYERNAME:
2378 : {
2379 3178 : OUString aLayerName;
2380 3178 : if( rValue >>= aLayerName )
2381 : {
2382 3178 : const SdrLayer* pLayer=mpModel->GetLayerAdmin().GetLayer(aLayerName, true);
2383 3178 : if( pLayer != NULL )
2384 : {
2385 3132 : mpObj->SetLayer( pLayer->GetID() );
2386 3132 : return true;
2387 : }
2388 : }
2389 46 : break;
2390 : }
2391 : case SDRATTR_ROTATEANGLE:
2392 : {
2393 2076 : sal_Int32 nAngle = 0;
2394 2076 : if( rValue >>= nAngle )
2395 : {
2396 2076 : Point aRef1(mpObj->GetSnapRect().Center());
2397 2076 : nAngle -= mpObj->GetRotateAngle();
2398 2076 : if (nAngle!=0)
2399 : {
2400 190 : double nSin=sin(nAngle*nPi180);
2401 190 : double nCos=cos(nAngle*nPi180);
2402 190 : mpObj->Rotate(aRef1,nAngle,nSin,nCos);
2403 : }
2404 2076 : return true;
2405 : }
2406 :
2407 0 : break;
2408 : }
2409 :
2410 : case SDRATTR_SHEARANGLE:
2411 : {
2412 0 : sal_Int32 nShear = 0;
2413 0 : if( rValue >>= nShear )
2414 : {
2415 0 : nShear -= mpObj->GetShearAngle();
2416 0 : if(nShear != 0 )
2417 : {
2418 0 : Point aRef1(mpObj->GetSnapRect().Center());
2419 0 : double nTan=tan(nShear*nPi180);
2420 0 : mpObj->Shear(aRef1,nShear,nTan,false);
2421 0 : return true;
2422 : }
2423 : }
2424 :
2425 0 : break;
2426 : }
2427 :
2428 : case OWN_ATTR_INTEROPGRABBAG:
2429 : {
2430 13620 : mpObj->SetGrabBagItem(rValue);
2431 13620 : return true;
2432 : }
2433 :
2434 : case SDRATTR_OBJMOVEPROTECT:
2435 : {
2436 : bool bMoveProtect;
2437 134 : if( rValue >>= bMoveProtect )
2438 : {
2439 134 : mpObj->SetMoveProtect(bMoveProtect);
2440 134 : return true;
2441 : }
2442 0 : break;
2443 : }
2444 : case SDRATTR_OBJECTNAME:
2445 : {
2446 28665 : OUString aName;
2447 28665 : if( rValue >>= aName )
2448 : {
2449 28665 : mpObj->SetName( aName );
2450 28665 : return true;
2451 : }
2452 0 : break;
2453 : }
2454 :
2455 : // #i68101#
2456 : case OWN_ATTR_MISC_OBJ_TITLE:
2457 : {
2458 1648 : OUString aTitle;
2459 1648 : if( rValue >>= aTitle )
2460 : {
2461 1648 : mpObj->SetTitle( aTitle );
2462 1648 : return true;
2463 : }
2464 0 : break;
2465 : }
2466 : case OWN_ATTR_MISC_OBJ_DESCRIPTION:
2467 : {
2468 1686 : OUString aDescription;
2469 1686 : if( rValue >>= aDescription )
2470 : {
2471 1686 : mpObj->SetDescription( aDescription );
2472 1686 : return true;
2473 : }
2474 0 : break;
2475 : }
2476 :
2477 : case SDRATTR_OBJPRINTABLE:
2478 : {
2479 : bool bPrintable;
2480 0 : if( rValue >>= bPrintable )
2481 : {
2482 0 : mpObj->SetPrintable(bPrintable);
2483 0 : return true;
2484 : }
2485 0 : break;
2486 : }
2487 : case SDRATTR_OBJVISIBLE:
2488 : {
2489 : bool bVisible;
2490 4 : if( rValue >>= bVisible )
2491 : {
2492 4 : mpObj->SetVisible(bVisible);
2493 4 : return true;
2494 : }
2495 0 : break;
2496 : }
2497 : case SDRATTR_OBJSIZEPROTECT:
2498 : {
2499 : bool bResizeProtect;
2500 134 : if( rValue >>= bResizeProtect )
2501 : {
2502 134 : mpObj->SetResizeProtect(bResizeProtect);
2503 134 : return true;
2504 : }
2505 0 : break;
2506 : }
2507 : case OWN_ATTR_PAGE_NUMBER:
2508 : {
2509 292 : sal_Int32 nPageNum = 0;
2510 292 : if( (rValue >>= nPageNum) && ( nPageNum >= 0 ) && ( nPageNum <= 0xffff ) )
2511 : {
2512 292 : SdrPageObj* pPageObj = dynamic_cast< SdrPageObj* >(mpObj.get());
2513 292 : if( pPageObj )
2514 : {
2515 258 : SdrModel* pModel = pPageObj->GetModel();
2516 258 : SdrPage* pNewPage = 0L;
2517 258 : const sal_uInt16 nDestinationPageNum((sal_uInt16)((nPageNum << 1L) - 1L));
2518 :
2519 258 : if(pModel)
2520 : {
2521 258 : if(nDestinationPageNum < pModel->GetPageCount())
2522 : {
2523 68 : pNewPage = pModel->GetPage(nDestinationPageNum);
2524 : }
2525 : }
2526 :
2527 258 : pPageObj->SetReferencedPage(pNewPage);
2528 : }
2529 :
2530 292 : return true;
2531 : }
2532 0 : break;
2533 : }
2534 : case XATTR_FILLBITMAP:
2535 : case XATTR_FILLGRADIENT:
2536 : case XATTR_FILLHATCH:
2537 : case XATTR_FILLFLOATTRANSPARENCE:
2538 : case XATTR_LINEEND:
2539 : case XATTR_LINESTART:
2540 : case XATTR_LINEDASH:
2541 : {
2542 5037 : if( pProperty->nMemberId == MID_NAME )
2543 : {
2544 4297 : OUString aApiName;
2545 4297 : if( rValue >>= aApiName )
2546 : {
2547 4297 : if( SetFillAttribute( pProperty->nWID, aApiName ) )
2548 3851 : return true;
2549 : }
2550 446 : break;
2551 : }
2552 : else
2553 : {
2554 740 : return false;
2555 : }
2556 : }
2557 : default:
2558 : {
2559 960972 : return false;
2560 : }
2561 : }
2562 1693 : throw lang::IllegalArgumentException();
2563 : }
2564 :
2565 :
2566 :
2567 138780 : bool SvxShape::getPropertyValueImpl( const OUString&, const SfxItemPropertySimpleEntry* pProperty, ::com::sun::star::uno::Any& rValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException, std::exception)
2568 : {
2569 138780 : switch( pProperty->nWID )
2570 : {
2571 : case OWN_ATTR_CAPTION_POINT:
2572 : {
2573 4 : Point aVclPoint = static_cast<SdrCaptionObj*>(mpObj.get())->GetTailPos();
2574 :
2575 : // #88491# make pos relative to anchor
2576 4 : if( mpModel->IsWriter() )
2577 : {
2578 0 : aVclPoint -= mpObj->GetAnchorPos();
2579 : }
2580 :
2581 : // #88657# metric of pool maybe twips (writer)
2582 4 : ForceMetricTo100th_mm(aVclPoint);
2583 :
2584 : // #90763# pos is absolute, make it relative to top left
2585 4 : basegfx::B2DPolyPolygon aNewPolyPolygon;
2586 8 : basegfx::B2DHomMatrix aNewHomogenMatrix;
2587 4 : mpObj->TRGetBaseGeometry(aNewHomogenMatrix, aNewPolyPolygon);
2588 :
2589 4 : aVclPoint.X() -= basegfx::fround(aNewHomogenMatrix.get(0, 2));
2590 4 : aVclPoint.Y() -= basegfx::fround(aNewHomogenMatrix.get(1, 2));
2591 :
2592 4 : awt::Point aPnt( aVclPoint.X(), aVclPoint.Y() );
2593 4 : rValue <<= aPnt;
2594 8 : break;
2595 : }
2596 :
2597 : case OWN_ATTR_TRANSFORMATION:
2598 : {
2599 1832 : basegfx::B2DPolyPolygon aNewPolyPolygon;
2600 3664 : basegfx::B2DHomMatrix aNewHomogenMatrix;
2601 1832 : mpObj->TRGetBaseGeometry(aNewHomogenMatrix, aNewPolyPolygon);
2602 1832 : drawing::HomogenMatrix3 aMatrix;
2603 :
2604 1832 : aMatrix.Line1.Column1 = aNewHomogenMatrix.get(0, 0);
2605 1832 : aMatrix.Line1.Column2 = aNewHomogenMatrix.get(0, 1);
2606 1832 : aMatrix.Line1.Column3 = aNewHomogenMatrix.get(0, 2);
2607 1832 : aMatrix.Line2.Column1 = aNewHomogenMatrix.get(1, 0);
2608 1832 : aMatrix.Line2.Column2 = aNewHomogenMatrix.get(1, 1);
2609 1832 : aMatrix.Line2.Column3 = aNewHomogenMatrix.get(1, 2);
2610 1832 : aMatrix.Line3.Column1 = aNewHomogenMatrix.get(2, 0);
2611 1832 : aMatrix.Line3.Column2 = aNewHomogenMatrix.get(2, 1);
2612 1832 : aMatrix.Line3.Column3 = aNewHomogenMatrix.get(2, 2);
2613 :
2614 1832 : rValue <<= aMatrix;
2615 :
2616 3664 : break;
2617 : }
2618 :
2619 : case OWN_ATTR_ZORDER:
2620 : {
2621 2034 : rValue <<= (sal_Int32)mpObj->GetOrdNum();
2622 2034 : break;
2623 : }
2624 :
2625 : case OWN_ATTR_BITMAP:
2626 : {
2627 516 : rValue = GetBitmap();
2628 516 : if(!rValue.hasValue())
2629 0 : throw uno::RuntimeException();
2630 :
2631 516 : break;
2632 : }
2633 :
2634 : case OWN_ATTR_ISFONTWORK:
2635 : {
2636 1628 : rValue <<= mpObj->ISA(SdrTextObj) && static_cast<SdrTextObj*>(mpObj.get())->IsFontwork();
2637 1628 : break;
2638 : }
2639 :
2640 : case OWN_ATTR_FRAMERECT:
2641 : {
2642 0 : Rectangle aRect( mpObj->GetSnapRect() );
2643 0 : Point aTopLeft( aRect.TopLeft() );
2644 0 : Size aObjSize( aRect.GetWidth(), aRect.GetHeight() );
2645 0 : ForceMetricTo100th_mm(aTopLeft);
2646 0 : ForceMetricTo100th_mm(aObjSize);
2647 : ::com::sun::star::awt::Rectangle aUnoRect(
2648 0 : aTopLeft.X(), aTopLeft.Y(),
2649 0 : aObjSize.getWidth(), aObjSize.getHeight() );
2650 0 : rValue <<= aUnoRect;
2651 0 : break;
2652 : }
2653 :
2654 : case OWN_ATTR_BOUNDRECT:
2655 : {
2656 476 : Rectangle aRect( mpObj->GetCurrentBoundRect() );
2657 476 : Point aTopLeft( aRect.TopLeft() );
2658 476 : Size aObjSize( aRect.GetWidth(), aRect.GetHeight() );
2659 476 : ForceMetricTo100th_mm(aTopLeft);
2660 476 : ForceMetricTo100th_mm(aObjSize);
2661 : ::com::sun::star::awt::Rectangle aUnoRect(
2662 952 : aTopLeft.X(), aTopLeft.Y(),
2663 1428 : aObjSize.getWidth(), aObjSize.getHeight() );
2664 476 : rValue <<= aUnoRect;
2665 476 : break;
2666 : }
2667 :
2668 : case OWN_ATTR_LDNAME:
2669 : {
2670 0 : OUString aName( mpObj->GetName() );
2671 0 : rValue <<= aName;
2672 0 : break;
2673 : }
2674 :
2675 : case OWN_ATTR_LDBITMAP:
2676 : {
2677 : sal_uInt16 nId;
2678 0 : if( mpObj->GetObjInventor() == SdrInventor && mpObj->GetObjIdentifier() == OBJ_OLE2 )
2679 : {
2680 0 : nId = RID_UNODRAW_OLE2;
2681 : }
2682 0 : else if( mpObj->GetObjInventor() == SdrInventor && mpObj->GetObjIdentifier() == OBJ_GRAF )
2683 : {
2684 0 : nId = RID_UNODRAW_GRAPHICS;
2685 : }
2686 : else
2687 : {
2688 0 : nId = RID_UNODRAW_OBJECTS;
2689 : }
2690 :
2691 0 : BitmapEx aBmp( SVX_RES(nId) );
2692 0 : Reference< awt::XBitmap > xBmp( VCLUnoHelper::CreateBitmap( aBmp ) );
2693 :
2694 0 : rValue <<= xBmp;
2695 0 : break;
2696 : }
2697 :
2698 : case OWN_ATTR_MIRRORED:
2699 : {
2700 92 : bool bMirror = false;
2701 92 : if( mpObj.is() && mpObj->ISA(SdrGrafObj) )
2702 92 : bMirror = static_cast<SdrGrafObj*>(mpObj.get())->IsMirrored();
2703 :
2704 92 : rValue <<= bMirror;
2705 92 : break;
2706 : }
2707 :
2708 : case OWN_ATTR_EDGE_START_OBJ:
2709 : case OWN_ATTR_EDGE_START_POS:
2710 : case OWN_ATTR_EDGE_END_POS:
2711 : case OWN_ATTR_EDGE_END_OBJ:
2712 : case OWN_ATTR_GLUEID_HEAD:
2713 : case OWN_ATTR_GLUEID_TAIL:
2714 : case OWN_ATTR_EDGE_POLYPOLYGONBEZIER:
2715 : {
2716 222 : SdrEdgeObj* pEdgeObj = dynamic_cast<SdrEdgeObj*>(mpObj.get());
2717 222 : if(pEdgeObj)
2718 : {
2719 222 : switch(pProperty->nWID)
2720 : {
2721 : case OWN_ATTR_EDGE_START_OBJ:
2722 : case OWN_ATTR_EDGE_END_OBJ:
2723 : {
2724 112 : SdrObject* pNode = pEdgeObj->GetConnectedNode(pProperty->nWID == OWN_ATTR_EDGE_START_OBJ);
2725 112 : if(pNode)
2726 : {
2727 4 : Reference< drawing::XShape > xShape( GetXShapeForSdrObject( pNode ) );
2728 4 : if(xShape.is())
2729 4 : rValue <<= xShape;
2730 :
2731 : }
2732 112 : break;
2733 : }
2734 :
2735 : case OWN_ATTR_EDGE_START_POS:
2736 : case OWN_ATTR_EDGE_END_POS:
2737 : {
2738 108 : Point aPoint( pEdgeObj->GetTailPoint( pProperty->nWID == OWN_ATTR_EDGE_START_POS ) );
2739 108 : if( mpModel->IsWriter() )
2740 108 : aPoint -= mpObj->GetAnchorPos();
2741 :
2742 108 : ForceMetricTo100th_mm( aPoint );
2743 108 : awt::Point aUnoPoint( aPoint.X(), aPoint.Y() );
2744 :
2745 108 : rValue <<= aUnoPoint;
2746 108 : break;
2747 : }
2748 : case OWN_ATTR_GLUEID_HEAD:
2749 : case OWN_ATTR_GLUEID_TAIL:
2750 : {
2751 0 : rValue <<= (sal_Int32)pEdgeObj->getGluePointIndex( pProperty->nWID == OWN_ATTR_GLUEID_HEAD );
2752 0 : break;
2753 : }
2754 : case OWN_ATTR_EDGE_POLYPOLYGONBEZIER:
2755 : {
2756 2 : basegfx::B2DPolyPolygon aPolyPoly( pEdgeObj->GetEdgeTrackPath() );
2757 2 : if( mpModel->IsWriter() )
2758 : {
2759 2 : Point aPoint( mpObj->GetAnchorPos() );
2760 2 : aPolyPoly.transform(basegfx::tools::createTranslateB2DHomMatrix(-aPoint.X(), -aPoint.Y()));
2761 : }
2762 : // Reintroduction of fix for issue #i59051# (#i108851#)
2763 2 : ForceMetricTo100th_mm( aPolyPoly );
2764 4 : drawing::PolyPolygonBezierCoords aRetval;
2765 2 : basegfx::unotools::b2DPolyPolygonToPolyPolygonBezier( aPolyPoly, aRetval);
2766 2 : rValue <<= aRetval;
2767 4 : break;
2768 : }
2769 : }
2770 : }
2771 222 : break;
2772 : }
2773 :
2774 : case OWN_ATTR_MEASURE_START_POS:
2775 : case OWN_ATTR_MEASURE_END_POS:
2776 : {
2777 0 : SdrMeasureObj* pMeasureObj = dynamic_cast<SdrMeasureObj*>(mpObj.get());
2778 0 : if(pMeasureObj)
2779 : {
2780 0 : Point aPoint( pMeasureObj->GetPoint( pProperty->nWID == OWN_ATTR_MEASURE_START_POS ? 0 : 1 ) );
2781 0 : if( mpModel->IsWriter() )
2782 0 : aPoint -= mpObj->GetAnchorPos();
2783 :
2784 : // Reintroduction of fix for issue #i59051# (#i108851#)
2785 0 : ForceMetricTo100th_mm( aPoint );
2786 0 : awt::Point aUnoPoint( aPoint.X(), aPoint.Y() );
2787 :
2788 0 : rValue <<= aUnoPoint;
2789 0 : break;
2790 : }
2791 0 : break;
2792 : }
2793 :
2794 : case OWN_ATTR_FILLBMP_MODE:
2795 : {
2796 540 : const SfxItemSet& rObjItemSet = mpObj->GetMergedItemSet();
2797 :
2798 540 : const XFillBmpStretchItem* pStretchItem = static_cast<const XFillBmpStretchItem*>(&rObjItemSet.Get(XATTR_FILLBMP_STRETCH));
2799 540 : const XFillBmpTileItem* pTileItem = static_cast<const XFillBmpTileItem*>(&rObjItemSet.Get(XATTR_FILLBMP_TILE));
2800 :
2801 540 : if( pTileItem && pTileItem->GetValue() )
2802 : {
2803 528 : rValue <<= drawing::BitmapMode_REPEAT;
2804 : }
2805 12 : else if( pStretchItem && pStretchItem->GetValue() )
2806 : {
2807 12 : rValue <<= drawing::BitmapMode_STRETCH;
2808 : }
2809 : else
2810 : {
2811 0 : rValue <<= drawing::BitmapMode_NO_REPEAT;
2812 : }
2813 540 : break;
2814 : }
2815 : case SDRATTR_LAYERID:
2816 562 : rValue <<= (sal_Int16)mpObj->GetLayer();
2817 562 : break;
2818 :
2819 : case SDRATTR_LAYERNAME:
2820 : {
2821 668 : SdrLayer* pLayer = mpModel->GetLayerAdmin().GetLayerPerID(mpObj->GetLayer());
2822 668 : if( pLayer )
2823 : {
2824 668 : OUString aName( pLayer->GetName() );
2825 668 : rValue <<= aName;
2826 : }
2827 668 : break;
2828 : }
2829 :
2830 : case SDRATTR_ROTATEANGLE:
2831 3908 : rValue <<= (sal_Int32)mpObj->GetRotateAngle();
2832 3908 : break;
2833 :
2834 : case SDRATTR_SHEARANGLE:
2835 0 : rValue <<= (sal_Int32)mpObj->GetShearAngle();
2836 0 : break;
2837 :
2838 : case OWN_ATTR_INTEROPGRABBAG:
2839 : {
2840 25942 : mpObj->GetGrabBagItem(rValue);
2841 25942 : break;
2842 : }
2843 :
2844 : case SDRATTR_OBJMOVEPROTECT:
2845 626 : rValue = uno::makeAny( mpObj->IsMoveProtect() );
2846 626 : break;
2847 :
2848 : case SDRATTR_OBJECTNAME:
2849 : {
2850 2196 : OUString aName( mpObj->GetName() );
2851 2196 : rValue <<= aName;
2852 2196 : break;
2853 : }
2854 :
2855 : // #i68101#
2856 : case OWN_ATTR_MISC_OBJ_TITLE:
2857 : {
2858 144 : OUString aTitle( mpObj->GetTitle() );
2859 144 : rValue <<= aTitle;
2860 144 : break;
2861 : }
2862 :
2863 : case OWN_ATTR_MISC_OBJ_DESCRIPTION:
2864 : {
2865 264 : OUString aDescription( mpObj->GetDescription() );
2866 264 : rValue <<= aDescription;
2867 264 : break;
2868 : }
2869 :
2870 : case SDRATTR_OBJPRINTABLE:
2871 2266 : rValue <<= mpObj->IsPrintable();
2872 2266 : break;
2873 :
2874 : case SDRATTR_OBJVISIBLE:
2875 2266 : rValue <<= mpObj->IsVisible();
2876 2266 : break;
2877 :
2878 : case SDRATTR_OBJSIZEPROTECT:
2879 642 : rValue <<= mpObj->IsResizeProtect();
2880 642 : break;
2881 :
2882 : case OWN_ATTR_PAGE_NUMBER:
2883 : {
2884 42 : SdrPageObj* pPageObj = dynamic_cast<SdrPageObj*>(mpObj.get());
2885 42 : if(pPageObj)
2886 : {
2887 42 : SdrPage* pPage = pPageObj->GetReferencedPage();
2888 42 : sal_Int32 nPageNumber = (pPage) ? pPage->GetPageNum() : 0L;
2889 42 : nPageNumber++;
2890 42 : nPageNumber >>= 1;
2891 42 : rValue <<= nPageNumber;
2892 : }
2893 42 : break;
2894 : }
2895 :
2896 : case OWN_ATTR_UINAME_SINGULAR:
2897 : {
2898 0 : rValue <<= mpObj->TakeObjNameSingul();
2899 0 : break;
2900 : }
2901 :
2902 : case OWN_ATTR_UINAME_PLURAL:
2903 : {
2904 0 : rValue <<= mpObj->TakeObjNamePlural();
2905 0 : break;
2906 : }
2907 : case OWN_ATTR_METAFILE:
2908 : {
2909 0 : SdrOle2Obj* pObj = dynamic_cast<SdrOle2Obj*>(mpObj.get());
2910 0 : if( pObj )
2911 : {
2912 0 : const Graphic* pGraphic = pObj->GetGraphic();
2913 0 : if( pGraphic )
2914 : {
2915 0 : bool bIsWMF = false;
2916 0 : if ( pGraphic->IsLink() )
2917 : {
2918 0 : GfxLink aLnk = pGraphic->GetLink();
2919 0 : if ( aLnk.GetType() == GFX_LINK_TYPE_NATIVE_WMF )
2920 : {
2921 0 : bIsWMF = true;
2922 0 : uno::Sequence<sal_Int8> aSeq((sal_Int8*)aLnk.GetData(), (sal_Int32) aLnk.GetDataSize());
2923 0 : rValue <<= aSeq;
2924 0 : }
2925 : }
2926 0 : if ( !bIsWMF )
2927 : {
2928 : // #119735# just use GetGDIMetaFile, it will create a bufferd version of contained bitmap now automatically
2929 0 : GDIMetaFile aMtf(pObj->GetGraphic()->GetGDIMetaFile());
2930 0 : SvMemoryStream aDestStrm( 65535, 65535 );
2931 0 : ConvertGDIMetaFileToWMF( aMtf, aDestStrm, NULL, false );
2932 : const uno::Sequence<sal_Int8> aSeq(
2933 0 : static_cast< const sal_Int8* >(aDestStrm.GetData()),
2934 0 : aDestStrm.GetEndOfData());
2935 0 : rValue <<= aSeq;
2936 : }
2937 : }
2938 : }
2939 : else
2940 : {
2941 0 : rValue = GetBitmap( true );
2942 : }
2943 0 : break;
2944 : }
2945 :
2946 :
2947 : default:
2948 91910 : return false;
2949 : }
2950 46870 : return true;
2951 : }
2952 :
2953 :
2954 :
2955 19106 : bool SvxShape::getPropertyStateImpl( const SfxItemPropertySimpleEntry* pProperty, ::com::sun::star::beans::PropertyState& rState ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException)
2956 : {
2957 19106 : if( pProperty->nWID == OWN_ATTR_FILLBMP_MODE )
2958 : {
2959 228 : const SfxItemSet& rSet = mpObj->GetMergedItemSet();
2960 :
2961 456 : if( rSet.GetItemState( XATTR_FILLBMP_STRETCH, false ) == SfxItemState::SET ||
2962 228 : rSet.GetItemState( XATTR_FILLBMP_TILE, false ) == SfxItemState::SET )
2963 : {
2964 0 : rState = beans::PropertyState_DIRECT_VALUE;
2965 : }
2966 : else
2967 : {
2968 228 : rState = beans::PropertyState_AMBIGUOUS_VALUE;
2969 : }
2970 : }
2971 37740 : else if((( pProperty->nWID >= OWN_ATTR_VALUE_START && pProperty->nWID <= OWN_ATTR_VALUE_END ) ||
2972 26512 : ( pProperty->nWID >= SDRATTR_NOTPERSIST_FIRST && pProperty->nWID <= SDRATTR_NOTPERSIST_LAST )) && ( pProperty->nWID != SDRATTR_TEXTDIRECTION ) )
2973 : {
2974 264 : rState = beans::PropertyState_DIRECT_VALUE;
2975 : }
2976 : else
2977 : {
2978 18614 : return false;
2979 : }
2980 :
2981 492 : return true;
2982 : }
2983 :
2984 :
2985 :
2986 0 : bool SvxShape::setPropertyToDefaultImpl( const SfxItemPropertySimpleEntry* pProperty ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException)
2987 : {
2988 0 : if( pProperty->nWID == OWN_ATTR_FILLBMP_MODE )
2989 : {
2990 0 : mpObj->ClearMergedItem( XATTR_FILLBMP_STRETCH );
2991 0 : mpObj->ClearMergedItem( XATTR_FILLBMP_TILE );
2992 0 : return true;
2993 : }
2994 0 : else if((pProperty->nWID >= OWN_ATTR_VALUE_START && pProperty->nWID <= OWN_ATTR_VALUE_END ) ||
2995 0 : ( pProperty->nWID >= SDRATTR_NOTPERSIST_FIRST && pProperty->nWID <= SDRATTR_NOTPERSIST_LAST ))
2996 : {
2997 0 : return true;
2998 : }
2999 : else
3000 : {
3001 0 : return false;
3002 : }
3003 : }
3004 :
3005 :
3006 :
3007 248 : uno::Sequence< beans::PropertyState > SAL_CALL SvxShape::getPropertyStates( const uno::Sequence< OUString >& aPropertyName )
3008 : throw(beans::UnknownPropertyException, uno::RuntimeException, std::exception)
3009 : {
3010 248 : const sal_Int32 nCount = aPropertyName.getLength();
3011 248 : const OUString* pNames = aPropertyName.getConstArray();
3012 :
3013 248 : uno::Sequence< beans::PropertyState > aRet( nCount );
3014 248 : beans::PropertyState* pState = aRet.getArray();
3015 :
3016 16384 : for( sal_Int32 nIdx = 0; nIdx < nCount; nIdx++ )
3017 16136 : pState[nIdx] = getPropertyState( pNames[nIdx] );
3018 :
3019 248 : return aRet;
3020 : }
3021 :
3022 :
3023 :
3024 0 : void SAL_CALL SvxShape::setPropertyToDefault( const OUString& PropertyName )
3025 : throw(beans::UnknownPropertyException, uno::RuntimeException, std::exception)
3026 : {
3027 0 : if( mpImpl->mpMaster )
3028 : {
3029 0 : mpImpl->mpMaster->setPropertyToDefault( PropertyName );
3030 : }
3031 : else
3032 : {
3033 0 : _setPropertyToDefault( PropertyName );
3034 : }
3035 0 : }
3036 :
3037 0 : void SAL_CALL SvxShape::_setPropertyToDefault( const OUString& PropertyName )
3038 : throw(beans::UnknownPropertyException, uno::RuntimeException)
3039 : {
3040 0 : ::SolarMutexGuard aGuard;
3041 :
3042 0 : const SfxItemPropertySimpleEntry* pProperty = mpPropSet->getPropertyMapEntry(PropertyName);
3043 :
3044 0 : if( !mpObj.is() || mpModel == NULL || pProperty == NULL )
3045 0 : throw beans::UnknownPropertyException();
3046 :
3047 0 : if( !setPropertyToDefaultImpl( pProperty ) )
3048 : {
3049 0 : mpObj->ClearMergedItem( pProperty->nWID );
3050 : }
3051 :
3052 0 : mpModel->SetChanged();
3053 0 : }
3054 :
3055 :
3056 :
3057 0 : uno::Any SAL_CALL SvxShape::getPropertyDefault( const OUString& aPropertyName )
3058 : throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException, std::exception)
3059 : {
3060 0 : if( mpImpl->mpMaster )
3061 : {
3062 0 : return mpImpl->mpMaster->getPropertyDefault( aPropertyName );
3063 : }
3064 : else
3065 : {
3066 0 : return _getPropertyDefault( aPropertyName );
3067 : }
3068 : }
3069 :
3070 0 : uno::Any SAL_CALL SvxShape::_getPropertyDefault( const OUString& aPropertyName )
3071 : throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
3072 : {
3073 0 : ::SolarMutexGuard aGuard;
3074 :
3075 0 : const SfxItemPropertySimpleEntry* pMap = mpPropSet->getPropertyMapEntry(aPropertyName);
3076 :
3077 0 : if( !mpObj.is() || pMap == NULL || mpModel == NULL )
3078 0 : throw beans::UnknownPropertyException();
3079 :
3080 0 : if(( pMap->nWID >= OWN_ATTR_VALUE_START && pMap->nWID <= OWN_ATTR_VALUE_END ) ||
3081 0 : ( pMap->nWID >= SDRATTR_NOTPERSIST_FIRST && pMap->nWID <= SDRATTR_NOTPERSIST_LAST ))
3082 : {
3083 0 : return getPropertyValue( aPropertyName );
3084 : }
3085 :
3086 : // Default aus ItemPool holen
3087 0 : if(!SfxItemPool::IsWhich(pMap->nWID))
3088 0 : throw beans::UnknownPropertyException();
3089 :
3090 0 : SfxItemSet aSet( mpModel->GetItemPool(), pMap->nWID, pMap->nWID);
3091 0 : aSet.Put(mpModel->GetItemPool().GetDefaultItem(pMap->nWID));
3092 :
3093 0 : return GetAnyForItem( aSet, pMap );
3094 : }
3095 :
3096 : // XMultiPropertyStates
3097 3922 : void SvxShape::setAllPropertiesToDefault() throw (uno::RuntimeException, std::exception)
3098 : {
3099 3922 : ::SolarMutexGuard aGuard;
3100 :
3101 3922 : if( !mpObj.is() )
3102 0 : throw lang::DisposedException();
3103 3922 : mpObj->ClearMergedItem(); // nWhich == 0 => all
3104 :
3105 3922 : if(mpObj->ISA(SdrGrafObj))
3106 : {
3107 : // defaults for graphic objects have changed:
3108 56 : mpObj->SetMergedItem( XFillStyleItem( drawing::FillStyle_NONE ) );
3109 56 : mpObj->SetMergedItem( XLineStyleItem( XLINE_NONE ) );
3110 : }
3111 :
3112 : // #i68523# special handling for Svx3DCharacterModeItem, this is not saved
3113 : // but needs to be sal_True in svx, pool default (false) in sch. Since sch
3114 : // does not load lathe or extrude objects, it is possible to set the items
3115 : // here.
3116 : // For other solution possibilities, see task description.
3117 3922 : if(mpObj->ISA(E3dLatheObj) || mpObj->ISA(E3dExtrudeObj))
3118 : {
3119 0 : mpObj->SetMergedItem(Svx3DCharacterModeItem(true));
3120 : }
3121 :
3122 3922 : mpModel->SetChanged();
3123 3922 : }
3124 :
3125 0 : void SvxShape::setPropertiesToDefault(
3126 : const uno::Sequence<OUString>& aPropertyNames )
3127 : throw (beans::UnknownPropertyException, uno::RuntimeException, std::exception)
3128 : {
3129 0 : for ( sal_Int32 pos = 0; pos < aPropertyNames.getLength(); ++pos )
3130 0 : setPropertyToDefault( aPropertyNames[pos] );
3131 0 : }
3132 :
3133 0 : uno::Sequence<uno::Any> SvxShape::getPropertyDefaults(
3134 : const uno::Sequence<OUString>& aPropertyNames )
3135 : throw (beans::UnknownPropertyException, lang::WrappedTargetException,
3136 : uno::RuntimeException, std::exception)
3137 : {
3138 0 : ::std::vector<uno::Any> ret;
3139 0 : for ( sal_Int32 pos = 0; pos < aPropertyNames.getLength(); ++pos )
3140 0 : ret.push_back( getPropertyDefault( aPropertyNames[pos] ) );
3141 0 : return uno::Sequence<uno::Any>( &ret[0], ret.size() );
3142 : }
3143 :
3144 :
3145 :
3146 :
3147 : // XServiceInfo
3148 :
3149 0 : OUString SAL_CALL SvxShape::getImplementationName()
3150 : throw(uno::RuntimeException, std::exception)
3151 : {
3152 0 : static OUString aServiceName("SvxShape");
3153 0 : return aServiceName;
3154 : }
3155 :
3156 : #define STAR_NAMESPACE "com.sun.star."
3157 :
3158 : const char* sUNO_service_style_ParagraphProperties = STAR_NAMESPACE "style.ParagraphProperties";
3159 : const char* sUNO_service_style_ParagraphPropertiesComplex = STAR_NAMESPACE "style.ParagraphPropertiesComplex";
3160 : const char* sUNO_service_style_ParagraphPropertiesAsian = STAR_NAMESPACE "style.ParagraphPropertiesAsian";
3161 : const char* sUNO_service_style_CharacterProperties = STAR_NAMESPACE "style.CharacterProperties";
3162 : const char* sUNO_service_style_CharacterPropertiesComplex = STAR_NAMESPACE "style.CharacterPropertiesComplex";
3163 : const char* sUNO_service_style_CharacterPropertiesAsian = STAR_NAMESPACE "style.CharacterPropertiesAsian";
3164 :
3165 : const char* sUNO_service_drawing_FillProperties = STAR_NAMESPACE "drawing.FillProperties";
3166 : const char* sUNO_service_drawing_TextProperties = STAR_NAMESPACE "drawing.TextProperties";
3167 : const char* sUNO_service_drawing_LineProperties = STAR_NAMESPACE "drawing.LineProperties";
3168 : const char* sUNO_service_drawing_ConnectorProperties = STAR_NAMESPACE "drawing.ConnectorProperties";
3169 : const char* sUNO_service_drawing_MeasureProperties = STAR_NAMESPACE "drawing.MeasureProperties";
3170 : const char* sUNO_service_drawing_ShadowProperties = STAR_NAMESPACE "drawing.ShadowProperties";
3171 :
3172 : const char* sUNO_service_drawing_RotationDescriptor = STAR_NAMESPACE "drawing.RotationDescriptor";
3173 :
3174 : const char* sUNO_service_drawing_Text = STAR_NAMESPACE "drawing.Text";
3175 : const char* sUNO_service_drawing_GroupShape = STAR_NAMESPACE "drawing.GroupShape";
3176 :
3177 : const char* sUNO_service_drawing_CustomShapeProperties = STAR_NAMESPACE "drawing.CustomShapeProperties";
3178 : const char* sUNO_service_drawing_CustomShape = STAR_NAMESPACE "drawing.CustomShape";
3179 :
3180 : const char* sUNO_service_drawing_PolyPolygonDescriptor = STAR_NAMESPACE "drawing.PolyPolygonDescriptor";
3181 : const char* sUNO_service_drawing_PolyPolygonBezierDescriptor= STAR_NAMESPACE "drawing.PolyPolygonBezierDescriptor";
3182 :
3183 : const char* sUNO_service_drawing_LineShape = STAR_NAMESPACE "drawing.LineShape";
3184 : const char* sUNO_service_drawing_Shape = STAR_NAMESPACE "drawing.Shape";
3185 : const char* sUNO_service_drawing_RectangleShape = STAR_NAMESPACE "drawing.RectangleShape";
3186 : const char* sUNO_service_drawing_EllipseShape = STAR_NAMESPACE "drawing.EllipseShape";
3187 : const char* sUNO_service_drawing_PolyPolygonShape = STAR_NAMESPACE "drawing.PolyPolygonShape";
3188 : const char* sUNO_service_drawing_PolyLineShape = STAR_NAMESPACE "drawing.PolyLineShape";
3189 : const char* sUNO_service_drawing_OpenBezierShape = STAR_NAMESPACE "drawing.OpenBezierShape";
3190 : const char* sUNO_service_drawing_ClosedBezierShape = STAR_NAMESPACE "drawing.ClosedBezierShape";
3191 : const char* sUNO_service_drawing_TextShape = STAR_NAMESPACE "drawing.TextShape";
3192 : const char* sUNO_service_drawing_GraphicObjectShape = STAR_NAMESPACE "drawing.GraphicObjectShape";
3193 : const char* sUNO_service_drawing_OLE2Shape = STAR_NAMESPACE "drawing.OLE2Shape";
3194 : const char* sUNO_service_drawing_PageShape = STAR_NAMESPACE "drawing.PageShape";
3195 : const char* sUNO_service_drawing_CaptionShape = STAR_NAMESPACE "drawing.CaptionShape";
3196 : const char* sUNO_service_drawing_MeasureShape = STAR_NAMESPACE "drawing.MeasureShape";
3197 : const char* sUNO_service_drawing_FrameShape = STAR_NAMESPACE "drawing.FrameShape";
3198 : const char* sUNO_service_drawing_ControlShape = STAR_NAMESPACE "drawing.ControlShape";
3199 : const char* sUNO_service_drawing_ConnectorShape = STAR_NAMESPACE "drawing.ConnectorShape";
3200 : const char* sUNO_service_drawing_MediaShape = STAR_NAMESPACE "drawing.MediaShape";
3201 :
3202 :
3203 36080 : uno::Sequence< OUString > SAL_CALL SvxShape::getSupportedServiceNames()
3204 : throw(uno::RuntimeException, std::exception)
3205 : {
3206 36080 : if( mpImpl->mpMaster )
3207 : {
3208 7832 : return mpImpl->mpMaster->getSupportedServiceNames();
3209 : }
3210 : else
3211 : {
3212 28248 : return _getSupportedServiceNames();
3213 : }
3214 : }
3215 :
3216 36080 : uno::Sequence< OUString > SAL_CALL SvxShape::_getSupportedServiceNames()
3217 : throw(uno::RuntimeException)
3218 : {
3219 36080 : ::SolarMutexGuard aGuard;
3220 :
3221 36080 : if( mpObj.is() && mpObj->GetObjInventor() == SdrInventor)
3222 : {
3223 35864 : const sal_uInt16 nIdent = mpObj->GetObjIdentifier();
3224 :
3225 35864 : switch(nIdent)
3226 : {
3227 : case OBJ_GRUP:
3228 : {
3229 : static uno::Sequence< OUString > *pSeq = 0;
3230 1230 : if( 0 == pSeq )
3231 : {
3232 24 : static uno::Sequence< OUString > SvxShape_GroupServices;
3233 :
3234 : comphelper::ServiceInfoHelper::addToSequence( SvxShape_GroupServices, 2,
3235 : sUNO_service_drawing_GroupShape,
3236 24 : sUNO_service_drawing_Shape );
3237 :
3238 24 : pSeq = &SvxShape_GroupServices;
3239 : }
3240 :
3241 1230 : return *pSeq;
3242 : }
3243 : case OBJ_CUSTOMSHAPE:
3244 : {
3245 : static uno::Sequence< OUString > *pSeq = 0;
3246 26722 : if( 0 == pSeq )
3247 : {
3248 32 : static uno::Sequence< OUString > SvxShape_CustomShapeServices;
3249 :
3250 : comphelper::ServiceInfoHelper::addToSequence( SvxShape_CustomShapeServices, 13,
3251 : sUNO_service_drawing_CustomShape,
3252 : sUNO_service_drawing_Shape,
3253 : sUNO_service_drawing_CustomShapeProperties,
3254 : sUNO_service_drawing_FillProperties,
3255 : sUNO_service_drawing_LineProperties,
3256 : sUNO_service_drawing_Text,
3257 : sUNO_service_drawing_TextProperties,
3258 : sUNO_service_style_ParagraphProperties,
3259 : sUNO_service_style_ParagraphPropertiesComplex,
3260 : sUNO_service_style_ParagraphPropertiesAsian,
3261 : sUNO_service_style_CharacterProperties,
3262 : sUNO_service_style_CharacterPropertiesComplex,
3263 : sUNO_service_style_CharacterPropertiesAsian,
3264 : sUNO_service_drawing_ShadowProperties,
3265 32 : sUNO_service_drawing_RotationDescriptor);
3266 32 : pSeq = &SvxShape_CustomShapeServices;
3267 : }
3268 26722 : return *pSeq;
3269 : }
3270 : case OBJ_LINE:
3271 : {
3272 : static uno::Sequence< OUString > *pSeq = 0;
3273 656 : if( 0 == pSeq )
3274 : {
3275 16 : static uno::Sequence< OUString > SvxShape_LineServices;
3276 :
3277 : comphelper::ServiceInfoHelper::addToSequence( SvxShape_LineServices,14,
3278 : sUNO_service_drawing_LineShape,
3279 :
3280 : sUNO_service_drawing_Shape,
3281 : sUNO_service_drawing_LineProperties,
3282 :
3283 : sUNO_service_drawing_Text,
3284 : sUNO_service_drawing_TextProperties,
3285 : sUNO_service_style_ParagraphProperties,
3286 : sUNO_service_style_ParagraphPropertiesComplex,
3287 : sUNO_service_style_ParagraphPropertiesAsian,
3288 : sUNO_service_style_CharacterProperties,
3289 : sUNO_service_style_CharacterPropertiesComplex,
3290 : sUNO_service_style_CharacterPropertiesAsian,
3291 :
3292 : sUNO_service_drawing_PolyPolygonDescriptor,
3293 : sUNO_service_drawing_ShadowProperties,
3294 16 : sUNO_service_drawing_RotationDescriptor);
3295 :
3296 16 : pSeq = &SvxShape_LineServices;
3297 : }
3298 656 : return *pSeq;
3299 : }
3300 :
3301 : case OBJ_RECT:
3302 : {
3303 : static uno::Sequence< OUString > *pSeq = 0;
3304 694 : if( 0 == pSeq )
3305 : {
3306 14 : static uno::Sequence< OUString > SvxShape_RectServices;
3307 :
3308 : comphelper::ServiceInfoHelper::addToSequence( SvxShape_RectServices,14,
3309 : sUNO_service_drawing_RectangleShape,
3310 :
3311 : sUNO_service_drawing_Shape,
3312 : sUNO_service_drawing_FillProperties,
3313 : sUNO_service_drawing_LineProperties,
3314 : sUNO_service_drawing_Text,
3315 : sUNO_service_drawing_TextProperties,
3316 : sUNO_service_style_ParagraphProperties,
3317 : sUNO_service_style_ParagraphPropertiesComplex,
3318 : sUNO_service_style_ParagraphPropertiesAsian,
3319 : sUNO_service_style_CharacterProperties,
3320 : sUNO_service_style_CharacterPropertiesComplex,
3321 : sUNO_service_style_CharacterPropertiesAsian,
3322 :
3323 : sUNO_service_drawing_ShadowProperties,
3324 14 : sUNO_service_drawing_RotationDescriptor);
3325 14 : pSeq = &SvxShape_RectServices;
3326 : }
3327 694 : return *pSeq;
3328 : }
3329 :
3330 : case OBJ_CIRC:
3331 : case OBJ_SECT:
3332 : case OBJ_CARC:
3333 : case OBJ_CCUT:
3334 : {
3335 : static uno::Sequence< OUString > *pSeq = 0;
3336 12 : if( 0 == pSeq )
3337 : {
3338 2 : static uno::Sequence< OUString > SvxShape_CircServices;
3339 :
3340 : comphelper::ServiceInfoHelper::addToSequence( SvxShape_CircServices,14,
3341 : sUNO_service_drawing_EllipseShape,
3342 :
3343 : sUNO_service_drawing_Shape,
3344 : sUNO_service_drawing_FillProperties,
3345 : sUNO_service_drawing_LineProperties,
3346 :
3347 : sUNO_service_drawing_Text,
3348 : sUNO_service_drawing_TextProperties,
3349 : sUNO_service_style_ParagraphProperties,
3350 : sUNO_service_style_ParagraphPropertiesComplex,
3351 : sUNO_service_style_ParagraphPropertiesAsian,
3352 : sUNO_service_style_CharacterProperties,
3353 : sUNO_service_style_CharacterPropertiesComplex,
3354 : sUNO_service_style_CharacterPropertiesAsian,
3355 :
3356 : sUNO_service_drawing_ShadowProperties,
3357 2 : sUNO_service_drawing_RotationDescriptor);
3358 :
3359 2 : pSeq = &SvxShape_CircServices;
3360 : }
3361 :
3362 12 : return *pSeq;
3363 : }
3364 :
3365 : case OBJ_PATHPLIN:
3366 : case OBJ_PLIN:
3367 : {
3368 : static uno::Sequence< OUString > *pSeq = 0;
3369 62 : if( 0 == pSeq )
3370 : {
3371 4 : static uno::Sequence< OUString > SvxShape_PathServices;
3372 : comphelper::ServiceInfoHelper::addToSequence( SvxShape_PathServices,14,
3373 : sUNO_service_drawing_PolyLineShape,
3374 :
3375 : sUNO_service_drawing_Shape,
3376 : sUNO_service_drawing_LineProperties,
3377 :
3378 : sUNO_service_drawing_PolyPolygonDescriptor,
3379 :
3380 : sUNO_service_drawing_Text,
3381 : sUNO_service_drawing_TextProperties,
3382 : sUNO_service_style_ParagraphProperties,
3383 : sUNO_service_style_ParagraphPropertiesComplex,
3384 : sUNO_service_style_ParagraphPropertiesAsian,
3385 : sUNO_service_style_CharacterProperties,
3386 : sUNO_service_style_CharacterPropertiesComplex,
3387 : sUNO_service_style_CharacterPropertiesAsian,
3388 :
3389 : sUNO_service_drawing_ShadowProperties,
3390 4 : sUNO_service_drawing_RotationDescriptor);
3391 4 : pSeq = &SvxShape_PathServices;
3392 : }
3393 62 : return *pSeq;
3394 : }
3395 :
3396 : case OBJ_PATHPOLY:
3397 : case OBJ_POLY:
3398 : {
3399 : static uno::Sequence< OUString > *pSeq = 0;
3400 880 : if( 0 == pSeq )
3401 : {
3402 10 : static uno::Sequence< OUString > SvxShape_PolyServices;
3403 : comphelper::ServiceInfoHelper::addToSequence( SvxShape_PolyServices,15,
3404 : sUNO_service_drawing_PolyPolygonShape,
3405 :
3406 : sUNO_service_drawing_Shape,
3407 : sUNO_service_drawing_LineProperties,
3408 : sUNO_service_drawing_FillProperties,
3409 :
3410 : sUNO_service_drawing_PolyPolygonDescriptor,
3411 :
3412 : sUNO_service_drawing_Text,
3413 : sUNO_service_drawing_TextProperties,
3414 : sUNO_service_style_ParagraphProperties,
3415 : sUNO_service_style_ParagraphPropertiesComplex,
3416 : sUNO_service_style_ParagraphPropertiesAsian,
3417 : sUNO_service_style_CharacterProperties,
3418 : sUNO_service_style_CharacterPropertiesComplex,
3419 : sUNO_service_style_CharacterPropertiesAsian,
3420 :
3421 : sUNO_service_drawing_ShadowProperties,
3422 10 : sUNO_service_drawing_RotationDescriptor);
3423 :
3424 10 : pSeq = &SvxShape_PolyServices;
3425 : }
3426 880 : return *pSeq;
3427 : }
3428 :
3429 : case OBJ_FREELINE:
3430 : case OBJ_PATHLINE:
3431 : {
3432 : static uno::Sequence< OUString > *pSeq = 0;
3433 92 : if( 0 == pSeq )
3434 : {
3435 6 : static uno::Sequence< OUString > SvxShape_FreeLineServices;
3436 :
3437 : comphelper::ServiceInfoHelper::addToSequence( SvxShape_FreeLineServices,15,
3438 : sUNO_service_drawing_OpenBezierShape,
3439 :
3440 : sUNO_service_drawing_Shape,
3441 : sUNO_service_drawing_LineProperties,
3442 : sUNO_service_drawing_FillProperties,
3443 :
3444 : sUNO_service_drawing_PolyPolygonBezierDescriptor,
3445 :
3446 : sUNO_service_drawing_Text,
3447 : sUNO_service_drawing_TextProperties,
3448 : sUNO_service_style_ParagraphProperties,
3449 : sUNO_service_style_ParagraphPropertiesComplex,
3450 : sUNO_service_style_ParagraphPropertiesAsian,
3451 : sUNO_service_style_CharacterProperties,
3452 : sUNO_service_style_CharacterPropertiesComplex,
3453 : sUNO_service_style_CharacterPropertiesAsian,
3454 :
3455 : sUNO_service_drawing_ShadowProperties,
3456 6 : sUNO_service_drawing_RotationDescriptor);
3457 :
3458 6 : pSeq = &SvxShape_FreeLineServices;
3459 : }
3460 :
3461 92 : return *pSeq;
3462 : }
3463 :
3464 : case OBJ_FREEFILL:
3465 : case OBJ_PATHFILL:
3466 : {
3467 : static uno::Sequence< OUString > *pSeq = 0;
3468 1660 : if( 0 == pSeq )
3469 : {
3470 10 : static uno::Sequence< OUString > SvxShape_FreeFillServices;
3471 : comphelper::ServiceInfoHelper::addToSequence( SvxShape_FreeFillServices,15,
3472 : sUNO_service_drawing_ClosedBezierShape,
3473 :
3474 : sUNO_service_drawing_Shape,
3475 : sUNO_service_drawing_LineProperties,
3476 : sUNO_service_drawing_FillProperties,
3477 :
3478 : sUNO_service_drawing_PolyPolygonBezierDescriptor,
3479 :
3480 : sUNO_service_drawing_Text,
3481 : sUNO_service_drawing_TextProperties,
3482 : sUNO_service_style_ParagraphProperties,
3483 : sUNO_service_style_ParagraphPropertiesComplex,
3484 : sUNO_service_style_ParagraphPropertiesAsian,
3485 : sUNO_service_style_CharacterProperties,
3486 : sUNO_service_style_CharacterPropertiesComplex,
3487 : sUNO_service_style_CharacterPropertiesAsian,
3488 :
3489 : sUNO_service_drawing_ShadowProperties,
3490 10 : sUNO_service_drawing_RotationDescriptor);
3491 :
3492 10 : pSeq = &SvxShape_FreeFillServices;
3493 : }
3494 1660 : return *pSeq;
3495 : }
3496 :
3497 : case OBJ_OUTLINETEXT:
3498 : case OBJ_TITLETEXT:
3499 : case OBJ_TEXT:
3500 : {
3501 : static uno::Sequence< OUString > *pSeq = 0;
3502 1556 : if( 0 == pSeq )
3503 : {
3504 10 : static uno::Sequence< OUString > SvxShape_TextServices;
3505 : comphelper::ServiceInfoHelper::addToSequence( SvxShape_TextServices,14,
3506 : sUNO_service_drawing_TextShape,
3507 :
3508 : sUNO_service_drawing_Shape,
3509 : sUNO_service_drawing_FillProperties,
3510 : sUNO_service_drawing_LineProperties,
3511 :
3512 : sUNO_service_drawing_Text,
3513 : sUNO_service_drawing_TextProperties,
3514 : sUNO_service_style_ParagraphProperties,
3515 : sUNO_service_style_ParagraphPropertiesComplex,
3516 : sUNO_service_style_ParagraphPropertiesAsian,
3517 : sUNO_service_style_CharacterProperties,
3518 : sUNO_service_style_CharacterPropertiesComplex,
3519 : sUNO_service_style_CharacterPropertiesAsian,
3520 :
3521 : sUNO_service_drawing_ShadowProperties,
3522 10 : sUNO_service_drawing_RotationDescriptor);
3523 :
3524 10 : pSeq = &SvxShape_TextServices;
3525 : }
3526 1556 : return *pSeq;
3527 : }
3528 :
3529 : case OBJ_GRAF:
3530 : {
3531 : static uno::Sequence< OUString > *pSeq = 0;
3532 1892 : if( 0 == pSeq )
3533 : {
3534 26 : static uno::Sequence< OUString > SvxShape_GrafServices;
3535 : comphelper::ServiceInfoHelper::addToSequence( SvxShape_GrafServices, 12,
3536 : sUNO_service_drawing_GraphicObjectShape,
3537 :
3538 : sUNO_service_drawing_Shape,
3539 :
3540 : sUNO_service_drawing_Text,
3541 : sUNO_service_drawing_TextProperties,
3542 : sUNO_service_style_ParagraphProperties,
3543 : sUNO_service_style_ParagraphPropertiesComplex,
3544 : sUNO_service_style_ParagraphPropertiesAsian,
3545 : sUNO_service_style_CharacterProperties,
3546 : sUNO_service_style_CharacterPropertiesComplex,
3547 : sUNO_service_style_CharacterPropertiesAsian,
3548 :
3549 : sUNO_service_drawing_ShadowProperties,
3550 26 : sUNO_service_drawing_RotationDescriptor);
3551 :
3552 26 : pSeq = &SvxShape_GrafServices;
3553 : }
3554 1892 : return *pSeq;
3555 : }
3556 :
3557 : case OBJ_OLE2:
3558 : {
3559 : static uno::Sequence< OUString > *pSeq = 0;
3560 344 : if( 0 == pSeq )
3561 : {
3562 12 : static uno::Sequence< OUString > SvxShape_Ole2Services;
3563 :
3564 : comphelper::ServiceInfoHelper::addToSequence( SvxShape_Ole2Services, 12,
3565 : sUNO_service_drawing_OLE2Shape,
3566 : sUNO_service_drawing_Shape,
3567 :
3568 : // #i118485# Added Text, Shadow and Rotation
3569 : sUNO_service_drawing_Text,
3570 : sUNO_service_drawing_TextProperties,
3571 : sUNO_service_style_ParagraphProperties,
3572 : sUNO_service_style_ParagraphPropertiesComplex,
3573 : sUNO_service_style_ParagraphPropertiesAsian,
3574 : sUNO_service_style_CharacterProperties,
3575 : sUNO_service_style_CharacterPropertiesComplex,
3576 : sUNO_service_style_CharacterPropertiesAsian,
3577 :
3578 : sUNO_service_drawing_ShadowProperties,
3579 12 : sUNO_service_drawing_RotationDescriptor);
3580 :
3581 12 : pSeq = &SvxShape_Ole2Services;
3582 : }
3583 344 : return *pSeq;
3584 : }
3585 :
3586 : case OBJ_CAPTION:
3587 : {
3588 : static uno::Sequence< OUString > *pSeq = 0;
3589 4 : if( 0 == pSeq )
3590 : {
3591 2 : static uno::Sequence< OUString > SvxShape_CaptionServices;
3592 :
3593 : comphelper::ServiceInfoHelper::addToSequence( SvxShape_CaptionServices,14,
3594 : sUNO_service_drawing_CaptionShape,
3595 :
3596 : sUNO_service_drawing_Shape,
3597 : sUNO_service_drawing_FillProperties,
3598 : sUNO_service_drawing_LineProperties,
3599 :
3600 : sUNO_service_drawing_Text,
3601 : sUNO_service_drawing_TextProperties,
3602 : sUNO_service_style_ParagraphProperties,
3603 : sUNO_service_style_ParagraphPropertiesComplex,
3604 : sUNO_service_style_ParagraphPropertiesAsian,
3605 : sUNO_service_style_CharacterProperties,
3606 : sUNO_service_style_CharacterPropertiesComplex,
3607 : sUNO_service_style_CharacterPropertiesAsian,
3608 :
3609 : sUNO_service_drawing_ShadowProperties,
3610 2 : sUNO_service_drawing_RotationDescriptor);
3611 :
3612 2 : pSeq = &SvxShape_CaptionServices;
3613 : }
3614 :
3615 4 : return *pSeq;
3616 : }
3617 :
3618 : case OBJ_PAGE:
3619 : {
3620 : static uno::Sequence< OUString > *pSeq = 0;
3621 0 : if( 0 == pSeq )
3622 : {
3623 0 : static uno::Sequence< OUString > SvxShape_PageServices;
3624 :
3625 : comphelper::ServiceInfoHelper::addToSequence( SvxShape_PageServices, 2,
3626 : sUNO_service_drawing_PageShape,
3627 0 : sUNO_service_drawing_Shape );
3628 :
3629 0 : pSeq = &SvxShape_PageServices;
3630 : }
3631 :
3632 0 : return *pSeq;
3633 : }
3634 :
3635 : case OBJ_MEASURE:
3636 : {
3637 : static uno::Sequence< OUString > *pSeq = 0;
3638 0 : if( 0 == pSeq )
3639 : {
3640 0 : static uno::Sequence< OUString > SvxShape_MeasureServices;
3641 : comphelper::ServiceInfoHelper::addToSequence( SvxShape_MeasureServices,15,
3642 : sUNO_service_drawing_MeasureShape,
3643 :
3644 : sUNO_service_drawing_MeasureProperties,
3645 :
3646 : sUNO_service_drawing_Shape,
3647 : sUNO_service_drawing_LineProperties,
3648 :
3649 : sUNO_service_drawing_Text,
3650 : sUNO_service_drawing_TextProperties,
3651 : sUNO_service_style_ParagraphProperties,
3652 : sUNO_service_style_ParagraphPropertiesComplex,
3653 : sUNO_service_style_ParagraphPropertiesAsian,
3654 : sUNO_service_style_CharacterProperties,
3655 : sUNO_service_style_CharacterPropertiesComplex,
3656 : sUNO_service_style_CharacterPropertiesAsian,
3657 :
3658 : sUNO_service_drawing_PolyPolygonDescriptor,
3659 : sUNO_service_drawing_ShadowProperties,
3660 0 : sUNO_service_drawing_RotationDescriptor);
3661 :
3662 0 : pSeq = &SvxShape_MeasureServices;
3663 : }
3664 :
3665 0 : return *pSeq;
3666 : }
3667 :
3668 : case OBJ_FRAME:
3669 : {
3670 : static uno::Sequence< OUString > *pSeq = 0;
3671 0 : if( 0 == pSeq )
3672 : {
3673 0 : static uno::Sequence< OUString > SvxShape_FrameServices;
3674 :
3675 : comphelper::ServiceInfoHelper::addToSequence( SvxShape_FrameServices, 2,
3676 : sUNO_service_drawing_FrameShape,
3677 0 : sUNO_service_drawing_Shape );
3678 :
3679 0 : pSeq = &SvxShape_FrameServices;
3680 : }
3681 :
3682 0 : return *pSeq;
3683 : }
3684 :
3685 : case OBJ_UNO:
3686 : {
3687 : static uno::Sequence< OUString > *pSeq = 0;
3688 0 : if( 0 == pSeq )
3689 : {
3690 0 : static uno::Sequence< OUString > SvxShape_UnoServices;
3691 : comphelper::ServiceInfoHelper::addToSequence( SvxShape_UnoServices, 2,
3692 : sUNO_service_drawing_ControlShape,
3693 0 : sUNO_service_drawing_Shape );
3694 :
3695 0 : pSeq = &SvxShape_UnoServices;
3696 : }
3697 0 : return *pSeq;
3698 : }
3699 :
3700 : case OBJ_EDGE:
3701 : {
3702 : static uno::Sequence< OUString > *pSeq = 0;
3703 0 : if( 0 == pSeq )
3704 : {
3705 0 : static uno::Sequence< OUString > SvxShape_EdgeServices;
3706 :
3707 : comphelper::ServiceInfoHelper::addToSequence( SvxShape_EdgeServices,15,
3708 : sUNO_service_drawing_ConnectorShape,
3709 : sUNO_service_drawing_ConnectorProperties,
3710 :
3711 : sUNO_service_drawing_Shape,
3712 : sUNO_service_drawing_LineProperties,
3713 :
3714 : sUNO_service_drawing_Text,
3715 : sUNO_service_drawing_TextProperties,
3716 : sUNO_service_style_ParagraphProperties,
3717 : sUNO_service_style_ParagraphPropertiesComplex,
3718 : sUNO_service_style_ParagraphPropertiesAsian,
3719 : sUNO_service_style_CharacterProperties,
3720 : sUNO_service_style_CharacterPropertiesComplex,
3721 : sUNO_service_style_CharacterPropertiesAsian,
3722 :
3723 : sUNO_service_drawing_PolyPolygonDescriptor,
3724 : sUNO_service_drawing_ShadowProperties,
3725 0 : sUNO_service_drawing_RotationDescriptor);
3726 :
3727 0 : pSeq = &SvxShape_EdgeServices;
3728 : }
3729 0 : return *pSeq;
3730 : }
3731 : case OBJ_MEDIA:
3732 : {
3733 : static uno::Sequence< OUString > *pSeq = 0;
3734 0 : if( 0 == pSeq )
3735 : {
3736 0 : static uno::Sequence< OUString > SvxShape_MediaServices;
3737 :
3738 : comphelper::ServiceInfoHelper::addToSequence( SvxShape_MediaServices, 2,
3739 : sUNO_service_drawing_MediaShape,
3740 0 : sUNO_service_drawing_Shape);
3741 :
3742 0 : pSeq = &SvxShape_MediaServices;
3743 : }
3744 0 : return *pSeq;
3745 : }
3746 : }
3747 : }
3748 216 : else if( mpObj.is() && mpObj->GetObjInventor() == FmFormInventor)
3749 : {
3750 : #if OSL_DEBUG_LEVEL > 0
3751 : const sal_uInt16 nIdent = mpObj->GetObjIdentifier();
3752 : OSL_ENSURE( nIdent == OBJ_UNO, "SvxShape::_getSupportedServiceNames: FmFormInventor, but no UNO object?" );
3753 : #endif
3754 : static uno::Sequence< OUString > *pSeq = 0;
3755 2 : if( 0 == pSeq )
3756 : {
3757 2 : static uno::Sequence< OUString > SvxShape_UnoServices;
3758 : comphelper::ServiceInfoHelper::addToSequence( SvxShape_UnoServices, 2,
3759 : sUNO_service_drawing_ControlShape,
3760 2 : sUNO_service_drawing_Shape );
3761 :
3762 2 : pSeq = &SvxShape_UnoServices;
3763 : }
3764 2 : return *pSeq;
3765 : }
3766 : OSL_FAIL( "SvxShape::_getSupportedServiceNames: could not determine object type!" );
3767 274 : uno::Sequence< OUString > aSeq;
3768 274 : return aSeq;
3769 : }
3770 :
3771 150 : sal_Bool SAL_CALL SvxShape::supportsService( const OUString& ServiceName ) throw ( uno::RuntimeException, std::exception )
3772 : {
3773 150 : return cppu::supportsService(this, ServiceName);
3774 : }
3775 :
3776 : // XGluePointsSupplier
3777 132 : uno::Reference< container::XIndexContainer > SAL_CALL SvxShape::getGluePoints()
3778 : throw(uno::RuntimeException, std::exception)
3779 : {
3780 132 : ::SolarMutexGuard aGuard;
3781 132 : uno::Reference< container::XIndexContainer > xGluePoints( mxGluePoints );
3782 :
3783 132 : if( mpObj.is() && !xGluePoints.is() )
3784 : {
3785 132 : uno::Reference< container::XIndexContainer > xNew( SvxUnoGluePointAccess_createInstance( mpObj.get() ), uno::UNO_QUERY );
3786 132 : mxGluePoints = xGluePoints = xNew;
3787 : }
3788 :
3789 132 : return xGluePoints;
3790 : }
3791 :
3792 :
3793 :
3794 : // XChild
3795 104 : uno::Reference< uno::XInterface > SAL_CALL SvxShape::getParent( )
3796 : throw(uno::RuntimeException, std::exception)
3797 : {
3798 104 : ::SolarMutexGuard aGuard;
3799 :
3800 104 : if( mpObj.is() && mpObj->GetObjList() )
3801 : {
3802 104 : SdrObjList* pObjList = mpObj->GetObjList();
3803 :
3804 104 : switch( pObjList->GetListKind() )
3805 : {
3806 : case SDROBJLIST_GROUPOBJ:
3807 28 : if( pObjList->GetOwnerObj()->ISA( SdrObjGroup ) )
3808 28 : return PTR_CAST( SdrObjGroup, pObjList->GetOwnerObj())->getUnoShape();
3809 0 : else if( pObjList->GetOwnerObj()->ISA( E3dScene ) )
3810 0 : return PTR_CAST( E3dScene, pObjList->GetOwnerObj())->getUnoShape();
3811 0 : break;
3812 : case SDROBJLIST_DRAWPAGE:
3813 : case SDROBJLIST_MASTERPAGE:
3814 76 : return PTR_CAST( SdrPage, pObjList )->getUnoPage();
3815 : default:
3816 : OSL_FAIL( "SvxShape::getParent( ): unexpected SdrObjListKind" );
3817 0 : break;
3818 : }
3819 : }
3820 :
3821 0 : uno::Reference< uno::XInterface > xParent;
3822 0 : return xParent;
3823 : }
3824 :
3825 :
3826 :
3827 0 : void SAL_CALL SvxShape::setParent( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& )
3828 : throw(lang::NoSupportException, uno::RuntimeException, std::exception)
3829 : {
3830 0 : throw lang::NoSupportException();
3831 : }
3832 :
3833 :
3834 :
3835 : /** called from the XActionLockable interface methods on initial locking */
3836 1466 : void SvxShape::lock()
3837 : {
3838 1466 : }
3839 :
3840 :
3841 :
3842 : /** called from the XActionLockable interface methods on final unlock */
3843 1466 : void SvxShape::unlock()
3844 : {
3845 1466 : }
3846 :
3847 :
3848 :
3849 : // XActionLockable
3850 27182 : sal_Bool SAL_CALL SvxShape::isActionLocked( ) throw (::com::sun::star::uno::RuntimeException, std::exception)
3851 : {
3852 27182 : ::SolarMutexGuard aGuard;
3853 :
3854 27182 : return mnLockCount != 0;
3855 : }
3856 :
3857 :
3858 :
3859 9788 : void SAL_CALL SvxShape::addActionLock( ) throw (::com::sun::star::uno::RuntimeException, std::exception)
3860 : {
3861 9788 : ::SolarMutexGuard aGuard;
3862 :
3863 : DBG_ASSERT( mnLockCount < 0xffff, "lock overflow in SvxShape!" );
3864 9788 : mnLockCount++;
3865 :
3866 9788 : if( mnLockCount == 1 )
3867 9788 : lock();
3868 9788 : }
3869 :
3870 :
3871 :
3872 9788 : void SAL_CALL SvxShape::removeActionLock( ) throw (::com::sun::star::uno::RuntimeException, std::exception)
3873 : {
3874 9788 : ::SolarMutexGuard aGuard;
3875 :
3876 : DBG_ASSERT( mnLockCount > 0, "lock underflow in SvxShape!" );
3877 9788 : mnLockCount--;
3878 :
3879 9788 : if( mnLockCount == 0 )
3880 9788 : unlock();
3881 9788 : }
3882 :
3883 :
3884 :
3885 5534 : void SAL_CALL SvxShape::setActionLocks( sal_Int16 nLock ) throw (::com::sun::star::uno::RuntimeException, std::exception )
3886 : {
3887 5534 : ::SolarMutexGuard aGuard;
3888 :
3889 5534 : if( (mnLockCount == 0) && (nLock != 0) )
3890 5534 : unlock();
3891 :
3892 5534 : if( (mnLockCount != 0) && (nLock == 0) )
3893 0 : lock();
3894 :
3895 5534 : mnLockCount = (sal_uInt16)nLock;
3896 5534 : }
3897 :
3898 :
3899 :
3900 7942 : sal_Int16 SAL_CALL SvxShape::resetActionLocks( ) throw (::com::sun::star::uno::RuntimeException, std::exception)
3901 : {
3902 7942 : ::SolarMutexGuard aGuard;
3903 :
3904 7942 : if( mnLockCount != 0 )
3905 5534 : unlock();
3906 :
3907 7942 : sal_Int16 nOldLocks = (sal_Int16)mnLockCount;
3908 7942 : mnLockCount = 0;
3909 :
3910 7942 : return nOldLocks;
3911 : }
3912 :
3913 :
3914 :
3915 : /** since polygon shapes can change theire kind during editing, we have
3916 : to recheck it here.
3917 : Circle shapes also change theire kind, but theire all treated equal
3918 : so no update is necessary.
3919 : */
3920 102877 : void SvxShape::updateShapeKind()
3921 : {
3922 102877 : switch( mpImpl->mnObjId )
3923 : {
3924 : case OBJ_LINE:
3925 : case OBJ_POLY:
3926 : case OBJ_PLIN:
3927 : case OBJ_PATHLINE:
3928 : case OBJ_PATHFILL:
3929 : case OBJ_FREELINE:
3930 : case OBJ_FREEFILL:
3931 : case OBJ_PATHPOLY:
3932 : case OBJ_PATHPLIN:
3933 : {
3934 11971 : const sal_uInt32 nId = mpObj->GetObjIdentifier();
3935 :
3936 11971 : if( nId != mpImpl->mnObjId )
3937 : {
3938 616 : mpImpl->mnObjId = nId;
3939 :
3940 : }
3941 11971 : break;
3942 : }
3943 : }
3944 102877 : }
3945 :
3946 28118 : SvxShapeText::SvxShapeText( SdrObject* pObject ) throw ()
3947 28118 : : SvxShape( pObject, getSvxMapProvider().GetMap(SVXMAP_TEXT), getSvxMapProvider().GetPropertySet(SVXMAP_TEXT, SdrObject::GetGlobalDrawObjectItemPool()) ), SvxUnoTextBase( ImplGetSvxUnoOutlinerTextCursorSvxPropertySet() )
3948 : {
3949 28118 : if( pObject && pObject->GetModel() )
3950 12207 : SetEditSource( new SvxTextEditSource( pObject, 0 ) );
3951 28118 : }
3952 :
3953 :
3954 58248 : SvxShapeText::SvxShapeText( SdrObject* pObject, const SfxItemPropertyMapEntry* pPropertyMap, const SvxItemPropertySet* pPropertySet ) throw ()
3955 58248 : : SvxShape( pObject, pPropertyMap, pPropertySet ), SvxUnoTextBase( ImplGetSvxUnoOutlinerTextCursorSvxPropertySet() )
3956 : {
3957 58248 : if( pObject && pObject->GetModel() )
3958 30132 : SetEditSource( new SvxTextEditSource( pObject, 0 ) );
3959 58248 : }
3960 :
3961 :
3962 113978 : SvxShapeText::~SvxShapeText() throw ()
3963 : {
3964 : // check if only this instance is registered at the ranges
3965 : DBG_ASSERT( (NULL == GetEditSource()) || (GetEditSource()->getRanges().size()==1),
3966 : "svx::SvxShapeText::~SvxShapeText(), text shape with living text ranges destroyed!");
3967 113978 : }
3968 :
3969 40085 : void SvxShapeText::Create( SdrObject* pNewObj, SvxDrawPage* pNewPage )
3970 : {
3971 40085 : if( pNewObj && (NULL == GetEditSource()))
3972 40081 : SetEditSource( new SvxTextEditSource( pNewObj, 0 ) );
3973 40085 : SvxShape::Create( pNewObj, pNewPage );
3974 40085 : }
3975 :
3976 : // XInterface
3977 :
3978 1034494 : uno::Any SAL_CALL SvxShapeText::queryInterface( const uno::Type & rType )
3979 : throw( uno::RuntimeException, std::exception )
3980 : {
3981 1034494 : return SvxShape::queryInterface( rType );
3982 : }
3983 :
3984 :
3985 :
3986 1404404 : uno::Any SAL_CALL SvxShapeText::queryAggregation( const uno::Type & rType )
3987 : throw( uno::RuntimeException, std::exception )
3988 : {
3989 1404404 : uno::Any aAny( SvxShape::queryAggregation( rType ) );
3990 1404404 : if( aAny.hasValue() )
3991 1340240 : return aAny;
3992 :
3993 64164 : return SvxUnoTextBase::queryAggregation( rType );
3994 : }
3995 :
3996 :
3997 :
3998 4041893 : void SAL_CALL SvxShapeText::acquire() throw()
3999 : {
4000 4041893 : SvxShape::acquire();
4001 4041893 : }
4002 :
4003 :
4004 4041591 : void SAL_CALL SvxShapeText::release() throw()
4005 : {
4006 4041591 : SvxShape::release();
4007 4041591 : }
4008 :
4009 : // XServiceInfo
4010 :
4011 0 : OUString SAL_CALL SvxShapeText::getImplementationName() throw( uno::RuntimeException, std::exception )
4012 : {
4013 0 : static OUString aServiceName("SvxShapeText");
4014 0 : return aServiceName;
4015 : }
4016 :
4017 :
4018 34096 : uno::Sequence< OUString > SAL_CALL SvxShapeText::getSupportedServiceNames() throw( uno::RuntimeException, std::exception )
4019 : {
4020 34096 : return SvxShape::getSupportedServiceNames();
4021 : }
4022 :
4023 :
4024 7682 : sal_Bool SAL_CALL SvxShapeText::supportsService( const OUString& ServiceName ) throw ( uno::RuntimeException, std::exception )
4025 : {
4026 7682 : return cppu::supportsService(static_cast<SvxShape*>(this), ServiceName);
4027 : }
4028 :
4029 : // XTypeProvider
4030 :
4031 0 : uno::Sequence< uno::Type > SAL_CALL SvxShapeText::getTypes()
4032 : throw( uno::RuntimeException, std::exception )
4033 : {
4034 0 : return SvxShape::getTypes();
4035 : }
4036 :
4037 319176 : sal_Int64 SAL_CALL SvxShapeText::getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& rId ) throw(::com::sun::star::uno::RuntimeException, std::exception) \
4038 : {
4039 319176 : const sal_Int64 nReturn = SvxShape::getSomething( rId );
4040 319176 : if( nReturn )
4041 272656 : return nReturn;
4042 :
4043 46520 : return SvxUnoTextBase::getSomething( rId );
4044 : }
4045 :
4046 :
4047 0 : uno::Sequence< sal_Int8 > SAL_CALL SvxShapeText::getImplementationId()
4048 : throw( uno::RuntimeException, std::exception )
4049 : {
4050 0 : return css::uno::Sequence<sal_Int8>();
4051 : }
4052 :
4053 :
4054 :
4055 : /** called from the XActionLockable interface methods on initial locking */
4056 8322 : void SvxShapeText::lock()
4057 : {
4058 8322 : SvxTextEditSource* pEditSource = static_cast<SvxTextEditSource*>(GetEditSource());
4059 8322 : if( pEditSource )
4060 8322 : pEditSource->lock();
4061 8322 : }
4062 :
4063 :
4064 :
4065 : /** called from the XActionLockable interface methods on final unlock */
4066 19390 : void SvxShapeText::unlock()
4067 : {
4068 19390 : SvxTextEditSource* pEditSource = static_cast<SvxTextEditSource*>(GetEditSource());
4069 19390 : if( pEditSource )
4070 19390 : pEditSource->unlock();
4071 19390 : }
4072 :
4073 : // ::com::sun::star::text::XTextRange
4074 2 : uno::Reference< text::XTextRange > SAL_CALL SvxShapeText::getStart() throw(uno::RuntimeException, std::exception)
4075 : {
4076 2 : ::SolarMutexGuard aGuard;
4077 2 : SvxTextForwarder* pForwarder = mpEditSource ? mpEditSource->GetTextForwarder() : NULL;
4078 2 : if( pForwarder )
4079 2 : ::GetSelection( maSelection, pForwarder );
4080 2 : return SvxUnoTextBase::getStart();
4081 :
4082 : }
4083 :
4084 4 : uno::Reference< text::XTextRange > SAL_CALL SvxShapeText::getEnd() throw(uno::RuntimeException, std::exception)
4085 : {
4086 4 : ::SolarMutexGuard aGuard;
4087 4 : SvxTextForwarder* pForwarder = mpEditSource ? mpEditSource->GetTextForwarder() : NULL;
4088 4 : if( pForwarder )
4089 4 : ::GetSelection( maSelection, pForwarder );
4090 4 : return SvxUnoTextBase::getEnd();
4091 : }
4092 :
4093 3006 : OUString SAL_CALL SvxShapeText::getString() throw(uno::RuntimeException, std::exception)
4094 : {
4095 3006 : ::SolarMutexGuard aGuard;
4096 3006 : SvxTextForwarder* pForwarder = mpEditSource ? mpEditSource->GetTextForwarder() : NULL;
4097 3006 : if( pForwarder )
4098 3006 : ::GetSelection( maSelection, pForwarder );
4099 3006 : return SvxUnoTextBase::getString();
4100 : }
4101 :
4102 :
4103 14393 : void SAL_CALL SvxShapeText::setString( const OUString& aString ) throw(uno::RuntimeException, std::exception)
4104 : {
4105 14393 : ::SolarMutexGuard aGuard;
4106 14393 : SvxTextForwarder* pForwarder = mpEditSource ? mpEditSource->GetTextForwarder() : NULL;
4107 14393 : if( pForwarder )
4108 14393 : ::GetSelection( maSelection, pForwarder );
4109 14393 : SvxUnoTextBase::setString( aString );
4110 14393 : }
4111 :
4112 : // overide these for special property handling in subcasses. Return true if property is handled
4113 1021896 : bool SvxShapeText::setPropertyValueImpl( const OUString& rName, const SfxItemPropertySimpleEntry* pProperty, const ::com::sun::star::uno::Any& rValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException, std::exception)
4114 : {
4115 : // HACK-fix #99090#
4116 : // since SdrTextObj::SetVerticalWriting exchanges
4117 : // SDRATTR_TEXT_AUTOGROWWIDTH and SDRATTR_TEXT_AUTOGROWHEIGHT,
4118 : // we have to set the textdirection here
4119 :
4120 1021896 : if( pProperty->nWID == SDRATTR_TEXTDIRECTION )
4121 : {
4122 896 : SdrTextObj* pTextObj = dynamic_cast< SdrTextObj* >( mpObj.get() );
4123 896 : if( pTextObj )
4124 : {
4125 : com::sun::star::text::WritingMode eMode;
4126 896 : if( rValue >>= eMode )
4127 : {
4128 896 : pTextObj->SetVerticalWriting( eMode == com::sun::star::text::WritingMode_TB_RL );
4129 : }
4130 : }
4131 896 : return true;
4132 : }
4133 1021000 : return SvxShape::setPropertyValueImpl( rName, pProperty, rValue );
4134 : }
4135 :
4136 45542 : bool SvxShapeText::getPropertyValueImpl( const OUString& rName, const SfxItemPropertySimpleEntry* pProperty, ::com::sun::star::uno::Any& rValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException, std::exception)
4137 : {
4138 45542 : if( pProperty->nWID == SDRATTR_TEXTDIRECTION )
4139 : {
4140 1414 : SdrTextObj* pTextObj = dynamic_cast< SdrTextObj* >( mpObj.get() );
4141 1414 : if( pTextObj && pTextObj->IsVerticalWriting() )
4142 0 : rValue <<= com::sun::star::text::WritingMode_TB_RL;
4143 : else
4144 1414 : rValue <<= com::sun::star::text::WritingMode_LR_TB;
4145 1414 : return true;
4146 : }
4147 :
4148 44128 : return SvxShape::getPropertyValueImpl( rName, pProperty, rValue );
4149 : }
4150 :
4151 19086 : bool SvxShapeText::getPropertyStateImpl( const SfxItemPropertySimpleEntry* pProperty, ::com::sun::star::beans::PropertyState& rState ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException)
4152 : {
4153 19086 : return SvxShape::getPropertyStateImpl( pProperty, rState );
4154 : }
4155 :
4156 0 : bool SvxShapeText::setPropertyToDefaultImpl( const SfxItemPropertySimpleEntry* pProperty ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException)
4157 : {
4158 0 : return SvxShape::setPropertyToDefaultImpl( pProperty );
4159 : }
4160 :
4161 14716 : SvxShapeRect::SvxShapeRect( SdrObject* pObj ) throw()
4162 14716 : : SvxShapeText( pObj, getSvxMapProvider().GetMap(SVXMAP_SHAPE), getSvxMapProvider().GetPropertySet(SVXMAP_SHAPE, SdrObject::GetGlobalDrawObjectItemPool()))
4163 : {
4164 14716 : }
4165 :
4166 29428 : SvxShapeRect::~SvxShapeRect() throw()
4167 : {
4168 29428 : }
4169 :
4170 129803 : uno::Any SAL_CALL SvxShapeRect::queryInterface( const uno::Type & rType ) throw(uno::RuntimeException, std::exception)
4171 : {
4172 129803 : return SvxShapeText::queryInterface( rType );
4173 : }
4174 :
4175 135995 : uno::Any SAL_CALL SvxShapeRect::queryAggregation( const uno::Type & rType ) throw(uno::RuntimeException, std::exception)
4176 : {
4177 135995 : return SvxShapeText::queryAggregation( rType );
4178 : }
4179 :
4180 431490 : void SAL_CALL SvxShapeRect::acquire() throw()
4181 : {
4182 431490 : OWeakAggObject::acquire();
4183 431490 : }
4184 :
4185 431450 : void SAL_CALL SvxShapeRect::release() throw()
4186 : {
4187 431450 : OWeakAggObject::release();
4188 431450 : }
4189 :
4190 : // XServiceInfo
4191 :
4192 694 : uno::Sequence< OUString > SvxShapeRect::getSupportedServiceNames(void) throw( uno::RuntimeException, std::exception )
4193 : {
4194 694 : return SvxShape::getSupportedServiceNames();
4195 : }
4196 :
4197 : /** returns a StarOffice API wrapper for the given SdrObject */
4198 17050 : uno::Reference< drawing::XShape > GetXShapeForSdrObject( SdrObject* pObj ) throw ()
4199 : {
4200 17050 : uno::Reference< drawing::XShape > xShape( pObj->getUnoShape(), uno::UNO_QUERY );
4201 17050 : return xShape;
4202 : }
4203 :
4204 : /** returns the SdrObject from the given StarOffice API wrapper */
4205 67749 : SdrObject* GetSdrObjectFromXShape( uno::Reference< drawing::XShape > xShape ) throw()
4206 : {
4207 67749 : SvxShape* pShape = SvxShape::getImplementation( xShape );
4208 67749 : return pShape ? pShape->GetSdrObject() : 0;
4209 : }
4210 :
4211 :
4212 :
4213 130 : SdrObject* SdrObject::getSdrObjectFromXShape( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& xInt )
4214 : {
4215 130 : SvxShape* pSvxShape = SvxShape::getImplementation( xInt );
4216 130 : return pSvxShape ? pSvxShape->GetSdrObject() : 0;
4217 : }
4218 :
4219 108054 : uno::Any SvxItemPropertySet_getPropertyValue( const SvxItemPropertySet& rPropSet, const SfxItemPropertySimpleEntry* pMap, const SfxItemSet& rSet )
4220 : {
4221 108054 : if(!pMap || !pMap->nWID)
4222 0 : return uno::Any();
4223 :
4224 : // Check is for items that store either metric values if thei are positiv or percentage if thei are negativ.
4225 108054 : bool bDontConvertNegativeValues = ( pMap->nWID == XATTR_FILLBMP_SIZEX || pMap->nWID == XATTR_FILLBMP_SIZEY );
4226 108054 : return rPropSet.getPropertyValue( pMap, rSet, (pMap->nWID != SDRATTR_XMLATTRIBUTES), bDontConvertNegativeValues );
4227 : }
4228 :
4229 1025416 : void SvxItemPropertySet_setPropertyValue( const SvxItemPropertySet& rPropSet, const SfxItemPropertySimpleEntry* pMap, const uno::Any& rVal, SfxItemSet& rSet )
4230 : {
4231 1025416 : if(!pMap || !pMap->nWID)
4232 1025416 : return;
4233 :
4234 1025416 : bool bDontConvertNegativeValues = ( pMap->nWID == XATTR_FILLBMP_SIZEX || pMap->nWID == XATTR_FILLBMP_SIZEY );
4235 1025416 : rPropSet.setPropertyValue( pMap, rVal, rSet, bDontConvertNegativeValues );
4236 651 : }
4237 :
4238 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|