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