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