1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 #include "ImageControl.hxx" 28 #include <com/sun/star/beans/PropertyAttribute.hpp> 29 #include <com/sun/star/beans/XPropertyState.hpp> 30 #ifndef REPORTDESIGN_SHARED_CORESTRINGS_HRC 31 #include "corestrings.hrc" 32 #endif 33 #ifndef REPORTDESIGN_CORE_RESOURCE_HRC_ 34 #include "core_resource.hrc" 35 #endif 36 #include "core_resource.hxx" 37 #include <comphelper/sequence.hxx> 38 #include "Tools.hxx" 39 #include <tools/debug.hxx> 40 #include <comphelper/property.hxx> 41 #include "FormatCondition.hxx" 42 #include <com/sun/star/awt/ImageScaleMode.hpp> 43 #include <com/sun/star/text/ParagraphVertAlign.hpp> 44 #include "ReportHelperImpl.hxx" 45 // ============================================================================= 46 namespace reportdesign 47 { 48 // ============================================================================= 49 using namespace com::sun::star; 50 using namespace comphelper; 51 uno::Sequence< ::rtl::OUString > lcl_getImageOptionals() 52 { 53 ::rtl::OUString pProps[] = { 54 PROPERTY_CHARCOLOR 55 ,PROPERTY_CHAREMPHASIS 56 ,PROPERTY_CHARFONTCHARSET 57 ,PROPERTY_CHARFONTFAMILY 58 ,PROPERTY_CHARFONTNAME 59 ,PROPERTY_CHARFONTPITCH 60 ,PROPERTY_CHARFONTSTYLENAME 61 ,PROPERTY_CHARHEIGHT 62 ,PROPERTY_CHARPOSTURE 63 ,PROPERTY_CHARRELIEF 64 ,PROPERTY_FONTDESCRIPTOR 65 ,PROPERTY_FONTDESCRIPTORASIAN 66 ,PROPERTY_FONTDESCRIPTORCOMPLEX 67 ,PROPERTY_CONTROLTEXTEMPHASISMARK 68 ,PROPERTY_CHARROTATION 69 ,PROPERTY_CHARSCALEWIDTH 70 ,PROPERTY_CHARSTRIKEOUT 71 ,PROPERTY_CHARUNDERLINECOLOR 72 ,PROPERTY_CHARUNDERLINE 73 ,PROPERTY_CHARWEIGHT 74 ,PROPERTY_CHARWORDMODE 75 ,PROPERTY_CHARFLASH 76 ,PROPERTY_CHARAUTOKERNING 77 ,PROPERTY_CHARESCAPEMENTHEIGHT 78 ,PROPERTY_CHARLOCALE 79 ,PROPERTY_CHARESCAPEMENT 80 ,PROPERTY_CHARCASEMAP 81 ,PROPERTY_CHARCOMBINEISON 82 ,PROPERTY_CHARCOMBINEPREFIX 83 ,PROPERTY_CHARCOMBINESUFFIX 84 ,PROPERTY_CHARHIDDEN 85 ,PROPERTY_CHARSHADOWED 86 ,PROPERTY_CHARCONTOURED 87 ,PROPERTY_VISITEDCHARSTYLENAME 88 ,PROPERTY_UNVISITEDCHARSTYLENAME 89 ,PROPERTY_CHARKERNING 90 ,PROPERTY_MASTERFIELDS 91 ,PROPERTY_DETAILFIELDS 92 ,PROPERTY_PARAADJUST 93 , PROPERTY_CHAREMPHASISASIAN 94 , PROPERTY_CHARFONTNAMEASIAN 95 , PROPERTY_CHARFONTSTYLENAMEASIAN 96 , PROPERTY_CHARFONTFAMILYASIAN 97 , PROPERTY_CHARFONTCHARSETASIAN 98 , PROPERTY_CHARFONTPITCHASIAN 99 , PROPERTY_CHARHEIGHTASIAN 100 , PROPERTY_CHARUNDERLINEASIAN 101 , PROPERTY_CHARWEIGHTASIAN 102 , PROPERTY_CHARPOSTUREASIAN 103 , PROPERTY_CHARWORDMODEASIAN 104 , PROPERTY_CHARROTATIONASIAN 105 , PROPERTY_CHARSCALEWIDTHASIAN 106 , PROPERTY_CHARLOCALEASIAN 107 , PROPERTY_CHAREMPHASISCOMPLEX 108 , PROPERTY_CHARFONTNAMECOMPLEX 109 , PROPERTY_CHARFONTSTYLENAMECOMPLEX 110 , PROPERTY_CHARFONTFAMILYCOMPLEX 111 , PROPERTY_CHARFONTCHARSETCOMPLEX 112 , PROPERTY_CHARFONTPITCHCOMPLEX 113 , PROPERTY_CHARHEIGHTCOMPLEX 114 , PROPERTY_CHARUNDERLINECOMPLEX 115 , PROPERTY_CHARWEIGHTCOMPLEX 116 , PROPERTY_CHARPOSTURECOMPLEX 117 , PROPERTY_CHARWORDMODECOMPLEX 118 , PROPERTY_CHARROTATIONCOMPLEX 119 , PROPERTY_CHARSCALEWIDTHCOMPLEX 120 , PROPERTY_CHARLOCALECOMPLEX 121 122 }; 123 return uno::Sequence< ::rtl::OUString >(pProps,sizeof(pProps)/sizeof(pProps[0])); 124 } 125 126 DBG_NAME( rpt_OImageControl ) 127 // ----------------------------------------------------------------------------- 128 OImageControl::OImageControl(uno::Reference< uno::XComponentContext > const & _xContext) 129 :ImageControlBase(m_aMutex) 130 ,ImageControlPropertySet(_xContext,static_cast< Implements >(IMPLEMENTS_PROPERTY_SET),lcl_getImageOptionals()) 131 ,m_aProps(m_aMutex,static_cast< container::XContainer*>( this ),_xContext) 132 ,m_nScaleMode(awt::ImageScaleMode::None) 133 ,m_bPreserveIRI(sal_True) 134 { 135 DBG_CTOR( rpt_OImageControl,NULL); 136 m_aProps.aComponent.m_sName = RPT_RESSTRING(RID_STR_IMAGECONTROL,m_aProps.aComponent.m_xContext->getServiceManager()); 137 } 138 // ----------------------------------------------------------------------------- 139 OImageControl::OImageControl(uno::Reference< uno::XComponentContext > const & _xContext 140 ,const uno::Reference< lang::XMultiServiceFactory>& _xFactory 141 ,uno::Reference< drawing::XShape >& _xShape) 142 :ImageControlBase(m_aMutex) 143 ,ImageControlPropertySet(_xContext,static_cast< Implements >(IMPLEMENTS_PROPERTY_SET),lcl_getImageOptionals()) 144 ,m_aProps(m_aMutex,static_cast< container::XContainer*>( this ),_xContext) 145 ,m_nScaleMode(awt::ImageScaleMode::None) 146 ,m_bPreserveIRI(sal_True) 147 { 148 DBG_CTOR( rpt_OImageControl,NULL); 149 m_aProps.aComponent.m_sName = RPT_RESSTRING(RID_STR_IMAGECONTROL,m_aProps.aComponent.m_xContext->getServiceManager()); 150 m_aProps.aComponent.m_xFactory = _xFactory; 151 osl_incrementInterlockedCount( &m_refCount ); 152 { 153 m_aProps.aComponent.setShape(_xShape,this,m_refCount); 154 } 155 osl_decrementInterlockedCount( &m_refCount ); 156 } 157 // ----------------------------------------------------------------------------- 158 OImageControl::~OImageControl() 159 { 160 DBG_DTOR( rpt_OImageControl,NULL); 161 } 162 // ----------------------------------------------------------------------------- 163 //IMPLEMENT_FORWARD_XINTERFACE2(OImageControl,ImageControlBase,ImageControlPropertySet) 164 IMPLEMENT_FORWARD_REFCOUNT( OImageControl, ImageControlBase ) 165 // -------------------------------------------------------------------------------- 166 uno::Any SAL_CALL OImageControl::queryInterface( const uno::Type& _rType ) throw (uno::RuntimeException) 167 { 168 uno::Any aReturn = ImageControlBase::queryInterface(_rType); 169 if ( !aReturn.hasValue() ) 170 aReturn = ImageControlPropertySet::queryInterface(_rType); 171 172 if ( !aReturn.hasValue() && OReportControlModel::isInterfaceForbidden(_rType) ) 173 return aReturn; 174 175 return aReturn.hasValue() ? aReturn : (m_aProps.aComponent.m_xProxy.is() ? m_aProps.aComponent.m_xProxy->queryAggregation(_rType) : aReturn); 176 } 177 178 // ----------------------------------------------------------------------------- 179 void SAL_CALL OImageControl::dispose() throw(uno::RuntimeException) 180 { 181 ImageControlPropertySet::dispose(); 182 cppu::WeakComponentImplHelperBase::dispose(); 183 } 184 // ----------------------------------------------------------------------------- 185 ::rtl::OUString OImageControl::getImplementationName_Static( ) throw(uno::RuntimeException) 186 { 187 return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.report.OImageControl")); 188 } 189 190 //-------------------------------------------------------------------------- 191 ::rtl::OUString SAL_CALL OImageControl::getImplementationName( ) throw(uno::RuntimeException) 192 { 193 return getImplementationName_Static(); 194 } 195 //-------------------------------------------------------------------------- 196 uno::Sequence< ::rtl::OUString > OImageControl::getSupportedServiceNames_Static( ) throw(uno::RuntimeException) 197 { 198 uno::Sequence< ::rtl::OUString > aServices(1); 199 aServices.getArray()[0] = SERVICE_IMAGECONTROL; 200 201 return aServices; 202 } 203 //------------------------------------------------------------------------------ 204 uno::Reference< uno::XInterface > OImageControl::create(uno::Reference< uno::XComponentContext > const & xContext) 205 { 206 return *(new OImageControl(xContext)); 207 } 208 209 //-------------------------------------------------------------------------- 210 uno::Sequence< ::rtl::OUString > SAL_CALL OImageControl::getSupportedServiceNames( ) throw(uno::RuntimeException) 211 { 212 return getSupportedServiceNames_Static(); 213 } 214 //------------------------------------------------------------------------------ 215 sal_Bool SAL_CALL OImageControl::supportsService(const ::rtl::OUString& ServiceName) throw( uno::RuntimeException ) 216 { 217 return ::comphelper::existsValue(ServiceName,getSupportedServiceNames_Static()); 218 } 219 // ----------------------------------------------------------------------------- 220 // XReportComponent 221 REPORTCOMPONENT_IMPL(OImageControl,m_aProps.aComponent) 222 REPORTCOMPONENT_IMPL2(OImageControl,m_aProps.aComponent) 223 REPORTCOMPONENT_NOMASTERDETAIL(OImageControl) 224 //REPORTCONTROLFORMAT_IMPL(OImageControl,m_aProps.aFormatProperties) 225 NO_REPORTCONTROLFORMAT_IMPL(OImageControl) 226 ::rtl::OUString SAL_CALL OImageControl::getHyperLinkURL() throw (uno::RuntimeException, beans::UnknownPropertyException) 227 { 228 ::osl::MutexGuard aGuard(m_aMutex); 229 return m_aProps.aFormatProperties.sHyperLinkURL; 230 } 231 void SAL_CALL OImageControl::setHyperLinkURL(const ::rtl::OUString & the_value) throw (uno::RuntimeException, beans::UnknownPropertyException) 232 { 233 set(PROPERTY_HYPERLINKURL,the_value,m_aProps.aFormatProperties.sHyperLinkURL); 234 } 235 ::rtl::OUString SAL_CALL OImageControl::getHyperLinkTarget() throw (uno::RuntimeException, beans::UnknownPropertyException) 236 { 237 ::osl::MutexGuard aGuard(m_aMutex); 238 return m_aProps.aFormatProperties.sHyperLinkTarget; 239 } 240 void SAL_CALL OImageControl::setHyperLinkTarget(const ::rtl::OUString & the_value) throw (uno::RuntimeException, beans::UnknownPropertyException) 241 { 242 set(PROPERTY_HYPERLINKTARGET,the_value,m_aProps.aFormatProperties.sHyperLinkTarget); 243 } 244 ::rtl::OUString SAL_CALL OImageControl::getHyperLinkName() throw (uno::RuntimeException, beans::UnknownPropertyException) 245 { 246 ::osl::MutexGuard aGuard(m_aMutex); 247 return m_aProps.aFormatProperties.sHyperLinkName; 248 } 249 void SAL_CALL OImageControl::setHyperLinkName(const ::rtl::OUString & the_value) throw (uno::RuntimeException, beans::UnknownPropertyException) 250 { 251 set(PROPERTY_HYPERLINKNAME,the_value,m_aProps.aFormatProperties.sHyperLinkName); 252 } 253 254 // ----------------------------------------------------------------------------- 255 ::sal_Int32 SAL_CALL OImageControl::getControlBackground() throw (beans::UnknownPropertyException, uno::RuntimeException) 256 { 257 ::osl::MutexGuard aGuard(m_aMutex); 258 return m_aProps.aFormatProperties.m_bBackgroundTransparent ? COL_TRANSPARENT : m_aProps.aFormatProperties.nBackgroundColor; 259 } 260 261 void SAL_CALL OImageControl::setControlBackground( ::sal_Int32 _backgroundcolor ) throw (uno::RuntimeException, beans::UnknownPropertyException) 262 { 263 sal_Bool bTransparent = _backgroundcolor == static_cast<sal_Int32>(COL_TRANSPARENT); 264 setControlBackgroundTransparent(bTransparent); 265 if ( !bTransparent ) 266 set(PROPERTY_CONTROLBACKGROUND,_backgroundcolor,m_aProps.aFormatProperties.nBackgroundColor); 267 } 268 269 ::sal_Bool SAL_CALL OImageControl::getControlBackgroundTransparent() throw (beans::UnknownPropertyException, uno::RuntimeException) 270 { 271 ::osl::MutexGuard aGuard(m_aMutex); 272 return m_aProps.aFormatProperties.m_bBackgroundTransparent; 273 } 274 275 void SAL_CALL OImageControl::setControlBackgroundTransparent( ::sal_Bool _controlbackgroundtransparent ) throw (beans::UnknownPropertyException, uno::RuntimeException) 276 { 277 set(PROPERTY_CONTROLBACKGROUNDTRANSPARENT,_controlbackgroundtransparent,m_aProps.aFormatProperties.m_bBackgroundTransparent); 278 if ( _controlbackgroundtransparent ) 279 set(PROPERTY_CONTROLBACKGROUND,static_cast<sal_Int32>(COL_TRANSPARENT),m_aProps.aFormatProperties.nBackgroundColor); 280 } 281 282 // ----------------------------------------------------------------------------- 283 uno::Reference< beans::XPropertySetInfo > SAL_CALL OImageControl::getPropertySetInfo( ) throw(uno::RuntimeException) 284 { 285 return ImageControlPropertySet::getPropertySetInfo(); 286 } 287 // ----------------------------------------------------------------------------- 288 void SAL_CALL OImageControl::setPropertyValue( const ::rtl::OUString& aPropertyName, const uno::Any& aValue ) throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException) 289 { 290 ImageControlPropertySet::setPropertyValue( aPropertyName, aValue ); 291 } 292 // ----------------------------------------------------------------------------- 293 uno::Any SAL_CALL OImageControl::getPropertyValue( const ::rtl::OUString& PropertyName ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) 294 { 295 return ImageControlPropertySet::getPropertyValue( PropertyName); 296 } 297 // ----------------------------------------------------------------------------- 298 void SAL_CALL OImageControl::addPropertyChangeListener( const ::rtl::OUString& aPropertyName, const uno::Reference< beans::XPropertyChangeListener >& xListener ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) 299 { 300 ImageControlPropertySet::addPropertyChangeListener( aPropertyName, xListener ); 301 } 302 // ----------------------------------------------------------------------------- 303 void SAL_CALL OImageControl::removePropertyChangeListener( const ::rtl::OUString& aPropertyName, const uno::Reference< beans::XPropertyChangeListener >& aListener ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) 304 { 305 ImageControlPropertySet::removePropertyChangeListener( aPropertyName, aListener ); 306 } 307 // ----------------------------------------------------------------------------- 308 void SAL_CALL OImageControl::addVetoableChangeListener( const ::rtl::OUString& PropertyName, const uno::Reference< beans::XVetoableChangeListener >& aListener ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) 309 { 310 ImageControlPropertySet::addVetoableChangeListener( PropertyName, aListener ); 311 } 312 // ----------------------------------------------------------------------------- 313 void SAL_CALL OImageControl::removeVetoableChangeListener( const ::rtl::OUString& PropertyName, const uno::Reference< beans::XVetoableChangeListener >& aListener ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) 314 { 315 ImageControlPropertySet::removeVetoableChangeListener( PropertyName, aListener ); 316 } 317 // ----------------------------------------------------------------------------- 318 // XReportControlModel 319 ::rtl::OUString SAL_CALL OImageControl::getDataField() throw ( beans::UnknownPropertyException, uno::RuntimeException) 320 { 321 ::osl::MutexGuard aGuard(m_aMutex); 322 return m_aProps.aDataField; 323 } 324 // ----------------------------------------------------------------------------- 325 void SAL_CALL OImageControl::setDataField( const ::rtl::OUString& _datafield ) throw (lang::IllegalArgumentException, beans::UnknownPropertyException, uno::RuntimeException) 326 { 327 set(PROPERTY_DATAFIELD,_datafield,m_aProps.aDataField); 328 } 329 // ----------------------------------------------------------------------------- 330 // ----------------------------------------------------------------------------- 331 ::sal_Bool SAL_CALL OImageControl::getPrintWhenGroupChange() throw (beans::UnknownPropertyException, uno::RuntimeException) 332 { 333 ::osl::MutexGuard aGuard(m_aMutex); 334 return m_aProps.bPrintWhenGroupChange; 335 } 336 // ----------------------------------------------------------------------------- 337 void SAL_CALL OImageControl::setPrintWhenGroupChange( ::sal_Bool _printwhengroupchange ) throw (beans::UnknownPropertyException, uno::RuntimeException) 338 { 339 set(PROPERTY_PRINTWHENGROUPCHANGE,_printwhengroupchange,m_aProps.bPrintWhenGroupChange); 340 } 341 // ----------------------------------------------------------------------------- 342 ::rtl::OUString SAL_CALL OImageControl::getConditionalPrintExpression() throw (beans::UnknownPropertyException, uno::RuntimeException) 343 { 344 ::osl::MutexGuard aGuard(m_aMutex); 345 return m_aProps.aConditionalPrintExpression; 346 } 347 // ----------------------------------------------------------------------------- 348 void SAL_CALL OImageControl::setConditionalPrintExpression( const ::rtl::OUString& _conditionalprintexpression ) throw (beans::UnknownPropertyException, uno::RuntimeException) 349 { 350 set(PROPERTY_CONDITIONALPRINTEXPRESSION,_conditionalprintexpression,m_aProps.aConditionalPrintExpression); 351 } 352 353 // ----------------------------------------------------------------------------- 354 355 // XCloneable 356 uno::Reference< util::XCloneable > SAL_CALL OImageControl::createClone( ) throw (uno::RuntimeException) 357 { 358 uno::Reference< report::XReportComponent> xSource = this; 359 uno::Reference< report::XImageControl> xSet(cloneObject(xSource,m_aProps.aComponent.m_xFactory,SERVICE_IMAGECONTROL),uno::UNO_QUERY_THROW); 360 return xSet.get(); 361 } 362 // ----------------------------------------------------------------------------- 363 364 // XImageControl 365 // ----------------------------------------------------------------------------- 366 ::rtl::OUString SAL_CALL OImageControl::getImageURL() throw (uno::RuntimeException) 367 { 368 ::osl::MutexGuard aGuard(m_aMutex); 369 return m_aImageURL; 370 } 371 // ----------------------------------------------------------------------------- 372 void SAL_CALL OImageControl::setImageURL( const ::rtl::OUString& _imageurl ) throw (uno::RuntimeException) 373 { 374 set(PROPERTY_IMAGEURL,_imageurl,m_aImageURL); 375 } 376 // ----------------------------------------------------------------------------- 377 uno::Reference< awt::XImageProducer > SAL_CALL OImageControl::getImageProducer( ) throw (uno::RuntimeException) 378 { 379 return uno::Reference< awt::XImageProducer >(); 380 } 381 // ----------------------------------------------------------------------------- 382 // XChild 383 uno::Reference< uno::XInterface > SAL_CALL OImageControl::getParent( ) throw (uno::RuntimeException) 384 { 385 return OShapeHelper::getParent(this); 386 } 387 // ----------------------------------------------------------------------------- 388 void SAL_CALL OImageControl::setParent( const uno::Reference< uno::XInterface >& Parent ) throw (lang::NoSupportException, uno::RuntimeException) 389 { 390 OShapeHelper::setParent(Parent,this); 391 } 392 uno::Reference< report::XFormatCondition > SAL_CALL OImageControl::createFormatCondition( ) throw (uno::Exception, uno::RuntimeException) 393 { 394 return new OFormatCondition(m_aProps.aComponent.m_xContext); 395 } 396 // ----------------------------------------------------------------------------- 397 // XContainer 398 void SAL_CALL OImageControl::addContainerListener( const uno::Reference< container::XContainerListener >& xListener ) throw (uno::RuntimeException) 399 { 400 m_aProps.addContainerListener(xListener); 401 } 402 // ----------------------------------------------------------------------------- 403 void SAL_CALL OImageControl::removeContainerListener( const uno::Reference< container::XContainerListener >& xListener ) throw (uno::RuntimeException) 404 { 405 m_aProps.removeContainerListener(xListener); 406 } 407 // ----------------------------------------------------------------------------- 408 // XElementAccess 409 uno::Type SAL_CALL OImageControl::getElementType( ) throw (uno::RuntimeException) 410 { 411 return ::getCppuType(static_cast< uno::Reference<report::XFormatCondition>*>(NULL)); 412 } 413 // ----------------------------------------------------------------------------- 414 ::sal_Bool SAL_CALL OImageControl::hasElements( ) throw (uno::RuntimeException) 415 { 416 return m_aProps.hasElements(); 417 } 418 // ----------------------------------------------------------------------------- 419 // XIndexContainer 420 void SAL_CALL OImageControl::insertByIndex( ::sal_Int32 Index, const uno::Any& Element ) throw (lang::IllegalArgumentException, lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException) 421 { 422 m_aProps.insertByIndex(Index,Element); 423 } 424 // ----------------------------------------------------------------------------- 425 void SAL_CALL OImageControl::removeByIndex( ::sal_Int32 Index ) throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException) 426 { 427 m_aProps.removeByIndex(Index); 428 } 429 // ----------------------------------------------------------------------------- 430 // XIndexReplace 431 void SAL_CALL OImageControl::replaceByIndex( ::sal_Int32 Index, const uno::Any& Element ) throw (lang::IllegalArgumentException, lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException) 432 { 433 m_aProps.replaceByIndex(Index,Element); 434 } 435 // ----------------------------------------------------------------------------- 436 // XIndexAccess 437 ::sal_Int32 SAL_CALL OImageControl::getCount( ) throw (uno::RuntimeException) 438 { 439 return m_aProps.getCount(); 440 } 441 // ----------------------------------------------------------------------------- 442 uno::Any SAL_CALL OImageControl::getByIndex( ::sal_Int32 Index ) throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException) 443 { 444 return m_aProps.getByIndex( Index ); 445 } 446 // ----------------------------------------------------------------------------- 447 // ----------------------------------------------------------------------------- 448 // XShape 449 awt::Point SAL_CALL OImageControl::getPosition( ) throw (uno::RuntimeException) 450 { 451 return OShapeHelper::getPosition(this); 452 } 453 // ----------------------------------------------------------------------------- 454 void SAL_CALL OImageControl::setPosition( const awt::Point& aPosition ) throw (uno::RuntimeException) 455 { 456 OShapeHelper::setPosition(aPosition,this); 457 } 458 // ----------------------------------------------------------------------------- 459 awt::Size SAL_CALL OImageControl::getSize( ) throw (uno::RuntimeException) 460 { 461 return OShapeHelper::getSize(this); 462 } 463 // ----------------------------------------------------------------------------- 464 void SAL_CALL OImageControl::setSize( const awt::Size& aSize ) throw (beans::PropertyVetoException, uno::RuntimeException) 465 { 466 OShapeHelper::setSize(aSize,this); 467 } 468 // ----------------------------------------------------------------------------- 469 470 // XShapeDescriptor 471 ::rtl::OUString SAL_CALL OImageControl::getShapeType( ) throw (uno::RuntimeException) 472 { 473 ::osl::MutexGuard aGuard(m_aMutex); 474 if ( m_aProps.aComponent.m_xShape.is() ) 475 return m_aProps.aComponent.m_xShape->getShapeType(); 476 return ::rtl::OUString(); 477 } 478 // ----------------------------------------------------------------------------- 479 ::sal_Int16 SAL_CALL OImageControl::getScaleMode() throw (uno::RuntimeException) 480 { 481 ::osl::MutexGuard aGuard(m_aMutex); 482 return m_nScaleMode; 483 } 484 // ----------------------------------------------------------------------------- 485 void SAL_CALL OImageControl::setScaleMode( ::sal_Int16 _scalemode ) throw (lang::IllegalArgumentException, uno::RuntimeException) 486 { 487 if ( _scalemode < awt::ImageScaleMode::None ||_scalemode > awt::ImageScaleMode::Anisotropic ) 488 throw lang::IllegalArgumentException(); 489 set(PROPERTY_SCALEMODE,_scalemode,m_nScaleMode); 490 } 491 // ----------------------------------------------------------------------------- 492 ::sal_Bool SAL_CALL OImageControl::getPreserveIRI() throw (uno::RuntimeException) 493 { 494 ::osl::MutexGuard aGuard(m_aMutex); 495 return m_bPreserveIRI; 496 } 497 // ----------------------------------------------------------------------------- 498 void SAL_CALL OImageControl::setPreserveIRI( ::sal_Bool _preserveiri ) throw (uno::RuntimeException) 499 { 500 set(PROPERTY_PRESERVEIRI,_preserveiri,m_bPreserveIRI); 501 } 502 // ============================================================================= 503 } // namespace reportdesign 504 // ============================================================================= 505 506