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