1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28 // MARKER(update_precomp.py): autogen include statement, do not remove 29 #include "precompiled_stoc.hxx" 30 31 #include "tdmgr_common.hxx" 32 #include "rtl/ustrbuf.hxx" 33 #include "typelib/typedescription.h" 34 #include "com/sun/star/beans/PropertyAttribute.hpp" 35 #include "com/sun/star/reflection/XConstantsTypeDescription.hpp" 36 #include "com/sun/star/reflection/XIndirectTypeDescription.hpp" 37 #include "com/sun/star/reflection/XEnumTypeDescription.hpp" 38 #include "com/sun/star/reflection/XStructTypeDescription.hpp" 39 #include "com/sun/star/reflection/XInterfaceTypeDescription2.hpp" 40 #include "com/sun/star/reflection/XInterfaceMethodTypeDescription.hpp" 41 #include "com/sun/star/reflection/XInterfaceAttributeTypeDescription2.hpp" 42 #include "com/sun/star/reflection/XServiceTypeDescription2.hpp" 43 #include "com/sun/star/reflection/XSingletonTypeDescription2.hpp" 44 45 46 using ::rtl::OUString; 47 using ::rtl::OUStringBuffer; 48 using namespace ::com::sun::star; 49 using namespace ::com::sun::star::uno; 50 using namespace ::stoc_tdmgr; 51 52 namespace { 53 54 OUString getTypeClassName( TypeClass tc ) 55 { 56 typelib_EnumTypeDescription * typeDescr = 0; 57 OUString name = OUSTR("com.sun.star.uno.TypeClass"); 58 typelib_typedescription_getByName( 59 reinterpret_cast<typelib_TypeDescription **>(&typeDescr), name.pData ); 60 OSL_ASSERT( typeDescr != 0 ); 61 if (typeDescr == 0) 62 return OUSTR("Cannot get type description of ") + name; 63 typelib_typedescription_complete( 64 reinterpret_cast<typelib_TypeDescription **>(&typeDescr) ); 65 66 sal_Int32 const * pValues = typeDescr->pEnumValues; 67 sal_Int32 nPos = typeDescr->nEnumValues; 68 while (nPos--) 69 { 70 if (pValues[ nPos ] == (sal_Int32) tc) 71 break; 72 } 73 if (nPos >= 0) 74 name = typeDescr->ppEnumNames[ nPos ]; 75 else 76 name = OUSTR("unknown TypeClass value: ") + 77 OUString::valueOf( (sal_Int32) tc ); 78 79 typelib_typedescription_release( 80 reinterpret_cast<typelib_TypeDescription *>(typeDescr) ); 81 return name; 82 } 83 84 OUString getPropertyFlagsAsString( sal_Int16 attributes ) 85 { 86 OUStringBuffer buf; 87 if ((attributes & beans::PropertyAttribute::MAYBEVOID) != 0) 88 buf.appendAscii( RTL_CONSTASCII_STRINGPARAM("MAYBEVOID, ") ); 89 if ((attributes & beans::PropertyAttribute::BOUND) != 0) 90 buf.appendAscii( RTL_CONSTASCII_STRINGPARAM("BOUND, ") ); 91 if ((attributes & beans::PropertyAttribute::CONSTRAINED) != 0) 92 buf.appendAscii( RTL_CONSTASCII_STRINGPARAM("CONSTRAINED, ") ); 93 if ((attributes & beans::PropertyAttribute::TRANSIENT) != 0) 94 buf.appendAscii( RTL_CONSTASCII_STRINGPARAM("TRANSIENT, ") ); 95 if ((attributes & beans::PropertyAttribute::READONLY) != 0) 96 buf.appendAscii( RTL_CONSTASCII_STRINGPARAM("READONLY, ") ); 97 if ((attributes & beans::PropertyAttribute::MAYBEAMBIGUOUS) != 0) 98 buf.appendAscii( RTL_CONSTASCII_STRINGPARAM("MAYBEAMBIGUOUS, ") ); 99 if ((attributes & beans::PropertyAttribute::MAYBEDEFAULT) != 0) 100 buf.appendAscii( RTL_CONSTASCII_STRINGPARAM("MAYBEDEFAULT, ") ); 101 if ((attributes & beans::PropertyAttribute::REMOVEABLE) != 0) 102 buf.appendAscii( RTL_CONSTASCII_STRINGPARAM("REMOVEABLE, ") ); 103 if ((attributes & beans::PropertyAttribute::OPTIONAL) != 0) 104 buf.appendAscii( RTL_CONSTASCII_STRINGPARAM("OPTIONAL") ); 105 else if (buf.getLength() > 0) 106 buf.setLength( buf.getLength() - 2 ); // truncate ", " 107 return buf.makeStringAndClear(); 108 } 109 110 void typeError( OUString const & msg, OUString const & context ) 111 { 112 OUStringBuffer buf; 113 if (context.getLength() > 0) { 114 buf.append( static_cast<sal_Unicode>('[') ); 115 buf.append( context ); 116 buf.appendAscii( RTL_CONSTASCII_STRINGPARAM("] ") ); 117 } 118 buf.append( msg ); 119 throw IncompatibleTypeException( buf.makeStringAndClear() ); 120 } 121 122 template<typename T> 123 void checkSeq( Sequence< Reference<T> > const & newTypes, 124 Sequence< Reference<T> > const & existingTypes, 125 OUString const & context, 126 bool optionalMode = false ) 127 { 128 sal_Int32 len = newTypes.getLength(); 129 if (len != existingTypes.getLength()) 130 { 131 if (!optionalMode || len < newTypes.getLength()) 132 typeError( OUSTR("Different number of types!"), context ); 133 len = existingTypes.getLength(); 134 } 135 136 Reference<T> const * pNewTypes = newTypes.getConstArray(); 137 Reference<T> const * pExistingTypes = existingTypes.getConstArray(); 138 for ( sal_Int32 pos = 0; pos < len; ++pos ) 139 { 140 OUStringBuffer buf; 141 buf.append( context ); 142 buf.appendAscii( RTL_CONSTASCII_STRINGPARAM(", position ") ); 143 buf.append( pos ); 144 check( pNewTypes[pos].get(), pExistingTypes[pos].get(), 145 buf.makeStringAndClear() ); 146 } 147 } 148 149 void checkEnum( 150 Reference<reflection::XEnumTypeDescription> const & xNewTD, 151 Reference<reflection::XEnumTypeDescription> const & xExistingTD ) 152 { 153 if (xNewTD->getEnumNames() != xExistingTD->getEnumNames()) 154 typeError( OUSTR("ENUM names don't match!"), xNewTD->getName() ); 155 if (xNewTD->getEnumValues() != xExistingTD->getEnumValues()) 156 typeError( OUSTR("ENUM values don't match!"), xNewTD->getName() ); 157 } 158 159 void checkStruct( 160 Reference<reflection::XCompoundTypeDescription> const & xNewTD, 161 Reference<reflection::XCompoundTypeDescription> const & xExistingTD ) 162 { 163 check( xNewTD->getBaseType(), xExistingTD->getBaseType(), 164 xNewTD->getName() + OUSTR(", base type") ); 165 checkSeq( xNewTD->getMemberTypes(), xExistingTD->getMemberTypes(), 166 xNewTD->getName() + OUSTR(", member types") ); 167 168 if (xNewTD->getMemberNames() != xExistingTD->getMemberNames()) 169 typeError( OUSTR("Different member names!"), xNewTD->getName() ); 170 171 if (xNewTD->getTypeClass() == TypeClass_STRUCT) 172 { 173 Reference<reflection::XStructTypeDescription> xNewStructTD( 174 xNewTD, UNO_QUERY ); 175 Reference<reflection::XStructTypeDescription> xExistingStructTD( 176 xExistingTD, UNO_QUERY ); 177 if (xNewStructTD.is() && xExistingStructTD.is()) 178 { 179 if (xNewStructTD->getTypeParameters() != 180 xExistingStructTD->getTypeParameters()) 181 typeError( OUSTR("Different type parameters of instantiated " 182 "polymorphic STRUCT!"), xNewTD->getName() ); 183 checkSeq( xNewStructTD->getTypeArguments(), 184 xExistingStructTD->getTypeArguments(), 185 xNewTD->getName() + OUSTR(", argument types") ); 186 } 187 else if (xNewStructTD.is() || xExistingStructTD.is()) 188 typeError( OUSTR("Mixing polymorphic STRUCT types " 189 "with non-polymorphic!"), xNewTD->getName() ); 190 } 191 } 192 193 void checkInterface( 194 Reference<reflection::XInterfaceTypeDescription2> const & xNewTD, 195 Reference<reflection::XInterfaceTypeDescription2> const & xExistingTD ) 196 { 197 checkSeq( xNewTD->getBaseTypes(), xExistingTD->getBaseTypes(), 198 xNewTD->getName() + OUSTR(", base types") ); 199 checkSeq(xNewTD->getOptionalBaseTypes(),xExistingTD->getOptionalBaseTypes(), 200 xNewTD->getName() + OUSTR(", optional base types") ); 201 checkSeq( xNewTD->getMembers(), xExistingTD->getMembers(), 202 xNewTD->getName() + OUSTR(", members") ); 203 } 204 205 void checkRestParam( Reference<reflection::XParameter> const & xNewParam, 206 Reference<reflection::XParameter> const & xExistingParam, 207 OUString const & context ) 208 { 209 if (xNewParam->isRestParameter() != xExistingParam->isRestParameter()) 210 typeError( OUSTR("Different ... parameters specified!"), context ); 211 } 212 213 void checkRestParam( Reference<reflection::XMethodParameter> const &, 214 Reference<reflection::XMethodParameter> const &, 215 OUString const & ) 216 { 217 } 218 219 template<typename T> 220 void checkParameters( Sequence< Reference<T> > const & newParams, 221 Sequence< Reference<T> > const & existingParams, 222 OUString const & context_ ) 223 { 224 sal_Int32 len = newParams.getLength(); 225 if (len != existingParams.getLength()) 226 typeError( OUSTR("Different number of parameters!"), context_ ); 227 Reference<T> const * pNewParams = newParams.getConstArray(); 228 Reference<T> const * pExistingParams = existingParams.getConstArray(); 229 for ( sal_Int32 pos = 0; pos < len; ++pos ) 230 { 231 Reference<T> const & xNewParam = pNewParams[pos]; 232 Reference<T> const & xExistingParam = pExistingParams[pos]; 233 234 OUStringBuffer buf; 235 buf.append( context_ ); 236 buf.appendAscii( RTL_CONSTASCII_STRINGPARAM(", parameter ") ); 237 buf.append( pos ); 238 OSL_ASSERT( pos == xNewParam->getPosition() && 239 pos == xExistingParam->getPosition() ); 240 OUString context( buf.makeStringAndClear() ); 241 242 if (xNewParam->getName() != xExistingParam->getName()) 243 { 244 buf.appendAscii( RTL_CONSTASCII_STRINGPARAM("Name differs: ") ); 245 buf.append( xNewParam->getName() ); 246 buf.appendAscii( RTL_CONSTASCII_STRINGPARAM(", ") ); 247 buf.append( xExistingParam->getName() ); 248 typeError( buf.makeStringAndClear(), context ); 249 } 250 check( xNewParam->getType(), xExistingParam->getType(), context ); 251 252 if (xNewParam->isIn() != xExistingParam->isIn()) 253 typeError( OUSTR("IN attribute differs!"), context ); 254 if (xNewParam->isOut() != xExistingParam->isOut()) 255 typeError( OUSTR("OUT attribute differs!"), context ); 256 checkRestParam( xNewParam, xExistingParam, context ); 257 } 258 } 259 260 static void checkMethod( 261 Reference<reflection::XInterfaceMethodTypeDescription> const & xNewTD, 262 Reference<reflection::XInterfaceMethodTypeDescription> const & xExistingTD ) 263 { 264 check( xNewTD->getReturnType(), xExistingTD->getReturnType(), 265 xNewTD->getName() ); 266 267 if (xNewTD->isOneway() != xExistingTD->isOneway()) 268 typeError( OUSTR("Methods have differing OneWay attribute!"), 269 xNewTD->getName() ); 270 271 checkParameters( xNewTD->getParameters(), xExistingTD->getParameters(), 272 xNewTD->getName() ); 273 274 checkSeq( xNewTD->getExceptions(), xExistingTD->getExceptions(), 275 xNewTD->getName() + OUSTR(", declared exceptions") ); 276 } 277 278 void checkAttribute( 279 Reference<reflection::XInterfaceAttributeTypeDescription2> const & xNewTD, 280 Reference<reflection::XInterfaceAttributeTypeDescription2> 281 const & xExistingTD ) 282 { 283 if (xNewTD->isReadOnly() != xExistingTD->isReadOnly()) 284 typeError( OUSTR("ReadOnly attribute differs!"), xNewTD->getName() ); 285 286 check( xNewTD->getType(), xExistingTD->getType(), 287 xNewTD->getName() + OUSTR(", attribute type") ); 288 289 if (xNewTD->isBound() != xExistingTD->isBound()) 290 typeError( OUSTR("Bound attribute differs!"), xNewTD->getName() ); 291 292 checkSeq( xNewTD->getGetExceptions(), xExistingTD->getGetExceptions(), 293 xNewTD->getName() + OUSTR(", getter exceptions") ); 294 checkSeq( xNewTD->getSetExceptions(), xExistingTD->getSetExceptions(), 295 xNewTD->getName() + OUSTR(", setter exceptions") ); 296 } 297 298 void checkProperty( 299 Reference<reflection::XPropertyTypeDescription> const & xNewTD, 300 Reference<reflection::XPropertyTypeDescription> const & xExistingTD ) 301 { 302 if (xNewTD->getPropertyFlags() != xExistingTD->getPropertyFlags()) 303 { 304 OUStringBuffer buf; 305 buf.appendAscii( RTL_CONSTASCII_STRINGPARAM( 306 "Different set of property flags: { ") ); 307 buf.append( getPropertyFlagsAsString( 308 xNewTD->getPropertyFlags() ) ); 309 buf.appendAscii( RTL_CONSTASCII_STRINGPARAM(" } (new), { ") ); 310 buf.append( getPropertyFlagsAsString( 311 xExistingTD->getPropertyFlags() ) ); 312 buf.appendAscii( RTL_CONSTASCII_STRINGPARAM(" } (existing)!") ); 313 typeError( buf.makeStringAndClear(), xNewTD->getName() ); 314 } 315 316 check( xNewTD->getPropertyTypeDescription(), 317 xExistingTD->getPropertyTypeDescription(), 318 xNewTD->getName() ); 319 } 320 321 void checkSingleton( 322 Reference<reflection::XSingletonTypeDescription2> const & xNewTD, 323 Reference<reflection::XSingletonTypeDescription2> const & xExistingTD ) 324 { 325 sal_Bool ifaceBased = xNewTD->isInterfaceBased(); 326 if (ifaceBased != xExistingTD->isInterfaceBased()) 327 typeError( 328 OUSTR("Mixing interface and NON-interface based singletons!"), 329 xNewTD->getName() ); 330 if (ifaceBased) 331 check( xNewTD->getInterface(), xExistingTD->getInterface(), 332 xNewTD->getName() ); 333 else 334 check( xNewTD->getService().get(), xExistingTD->getService().get(), 335 xNewTD->getName() ); 336 } 337 338 void checkService( 339 Reference<reflection::XServiceTypeDescription2> const & xNewTD, 340 Reference<reflection::XServiceTypeDescription2> const & xExistingTD ) 341 { 342 sal_Bool singleIfaceBased = xNewTD->isSingleInterfaceBased(); 343 if (singleIfaceBased != xExistingTD->isSingleInterfaceBased()) 344 typeError( OUSTR("Mixing interface and NON-interface based services!"), 345 xNewTD->getName() ); 346 if (singleIfaceBased) 347 { 348 check( xNewTD->getInterface(), xExistingTD->getInterface(), 349 xNewTD->getName() ); 350 Sequence< Reference<reflection::XServiceConstructorDescription> > 351 newCtors( xNewTD->getConstructors() ); 352 Sequence< Reference<reflection::XServiceConstructorDescription> > 353 existingCtors( xExistingTD->getConstructors() ); 354 sal_Int32 len = newCtors.getLength(); 355 if (len != existingCtors.getLength()) 356 typeError( OUSTR("Different number of service constructors!"), 357 xNewTD->getName() ); 358 Reference<reflection::XServiceConstructorDescription> const * 359 pNewCtors = newCtors.getConstArray(); 360 Reference<reflection::XServiceConstructorDescription> const * 361 pExistingCtors = existingCtors.getConstArray(); 362 for ( sal_Int32 pos = 0; pos < len; ++pos ) 363 { 364 Reference<reflection::XServiceConstructorDescription> const & 365 xNewCtor = pNewCtors[pos]; 366 Reference<reflection::XServiceConstructorDescription> const & 367 xExistingCtor = pExistingCtors[pos]; 368 369 if (xNewCtor->getName() != xExistingCtor->getName()) 370 { 371 OUStringBuffer buf; 372 buf.appendAscii( RTL_CONSTASCII_STRINGPARAM( 373 "Different constructor names: ") ); 374 buf.append( xNewCtor->getName() ); 375 buf.appendAscii( RTL_CONSTASCII_STRINGPARAM(" (new), ") ); 376 buf.append( xExistingCtor->getName() ); 377 buf.appendAscii( RTL_CONSTASCII_STRINGPARAM(" (existing)!") ); 378 typeError( buf.makeStringAndClear(), xNewTD->getName() ); 379 } 380 381 OUStringBuffer buf; 382 buf.append( xNewTD->getName() ); 383 buf.appendAscii( RTL_CONSTASCII_STRINGPARAM(", constructor ") ); 384 buf.append( xNewCtor->getName() ); 385 OUString context( buf.makeStringAndClear() ); 386 checkParameters( xNewCtor->getParameters(), 387 xExistingCtor->getParameters(), 388 context ); 389 checkSeq( xNewCtor->getExceptions(), xExistingCtor->getExceptions(), 390 context + OUSTR(", exceptions") ); 391 } 392 } 393 else // old-style service descriptions: 394 { 395 checkSeq( xNewTD->getMandatoryServices(), 396 xExistingTD->getMandatoryServices(), 397 xNewTD->getName() + OUSTR(", mandatory services") ); 398 checkSeq( xNewTD->getOptionalServices(), 399 xExistingTD->getOptionalServices(), 400 xNewTD->getName() + OUSTR(", optional services"), 401 true /* optionalMode */ ); 402 checkSeq( xNewTD->getMandatoryInterfaces(), 403 xExistingTD->getMandatoryInterfaces(), 404 xNewTD->getName() + OUSTR(", mandatory interfaces") ); 405 checkSeq( xNewTD->getOptionalInterfaces(), 406 xExistingTD->getOptionalInterfaces(), 407 xNewTD->getName() + OUSTR(", optional interfaces"), 408 true /* optionalMode */ ); 409 410 Sequence< Reference<reflection::XPropertyTypeDescription> > 411 newProperties( xNewTD->getProperties() ); 412 Sequence< Reference<reflection::XPropertyTypeDescription> > 413 existingProperties( xExistingTD->getProperties() ); 414 checkSeq( newProperties, existingProperties, 415 xNewTD->getName() + OUSTR(", properties"), 416 true /* optionalMode */ ); 417 if (newProperties.getLength() > existingProperties.getLength()) 418 { 419 // check whether all added properties are OPTIONAL: 420 Reference<reflection::XPropertyTypeDescription> const * 421 pNewProperties = newProperties.getConstArray(); 422 for ( sal_Int32 pos = existingProperties.getLength() + 1; 423 pos < newProperties.getLength(); ++pos ) 424 { 425 if ((pNewProperties[pos]->getPropertyFlags() & 426 beans::PropertyAttribute::OPTIONAL) == 0) 427 typeError( OUSTR("New property is not OPTIONAL!"), 428 pNewProperties[pos]->getName() ); 429 } 430 } 431 } 432 } 433 434 } 435 436 namespace stoc_tdmgr { 437 438 void check( Reference<reflection::XTypeDescription> const & xNewTD, 439 Reference<reflection::XTypeDescription> const & xExistingTD, 440 OUString const & context ) 441 { 442 if (xNewTD == xExistingTD) 443 return; 444 if (xNewTD->getName() != xExistingTD->getName()) 445 { 446 OUStringBuffer buf; 447 buf.appendAscii( RTL_CONSTASCII_STRINGPARAM("Different type names: ") ); 448 buf.append( xNewTD->getName() ); 449 buf.appendAscii( RTL_CONSTASCII_STRINGPARAM(" (new), ") ); 450 buf.append( xExistingTD->getName() ); 451 buf.appendAscii( RTL_CONSTASCII_STRINGPARAM(" (existing)!") ); 452 typeError( buf.makeStringAndClear(), context ); 453 } 454 455 TypeClass tc = xNewTD->getTypeClass(); 456 if (tc != xExistingTD->getTypeClass()) 457 { 458 OUStringBuffer buf; 459 buf.append( xNewTD->getName() ); 460 buf.appendAscii( RTL_CONSTASCII_STRINGPARAM( 461 " has different type classes: ") ); 462 buf.append( getTypeClassName( tc ) ); 463 buf.appendAscii( RTL_CONSTASCII_STRINGPARAM(" (new), ") ); 464 buf.append( getTypeClassName( xExistingTD->getTypeClass() ) ); 465 buf.appendAscii( RTL_CONSTASCII_STRINGPARAM(" (existing)!") ); 466 typeError( buf.makeStringAndClear(), context ); 467 } 468 469 switch (tc) 470 { 471 case TypeClass_ENUM: 472 checkEnum( Reference<reflection::XEnumTypeDescription>( 473 xNewTD, UNO_QUERY_THROW ), 474 Reference<reflection::XEnumTypeDescription>( 475 xExistingTD, UNO_QUERY_THROW ) ); 476 break; 477 478 case TypeClass_TYPEDEF: 479 case TypeClass_SEQUENCE: 480 check( Reference<reflection::XIndirectTypeDescription>( 481 xNewTD, UNO_QUERY_THROW )->getReferencedType(), 482 Reference<reflection::XIndirectTypeDescription>( 483 xExistingTD, UNO_QUERY_THROW )->getReferencedType() ); 484 break; 485 486 case TypeClass_STRUCT: 487 case TypeClass_EXCEPTION: 488 checkStruct( Reference<reflection::XCompoundTypeDescription>( 489 xNewTD, UNO_QUERY_THROW ), 490 Reference<reflection::XCompoundTypeDescription>( 491 xExistingTD, UNO_QUERY_THROW ) ); 492 break; 493 494 case TypeClass_INTERFACE: 495 checkInterface( Reference<reflection::XInterfaceTypeDescription2>( 496 xNewTD, UNO_QUERY_THROW ), 497 Reference<reflection::XInterfaceTypeDescription2>( 498 xExistingTD, UNO_QUERY_THROW ) ); 499 break; 500 501 case TypeClass_SERVICE: 502 checkService( Reference<reflection::XServiceTypeDescription2>( 503 xNewTD, UNO_QUERY_THROW ), 504 Reference<reflection::XServiceTypeDescription2>( 505 xExistingTD, UNO_QUERY_THROW ) ); 506 break; 507 508 case TypeClass_INTERFACE_METHOD: 509 checkMethod( Reference<reflection::XInterfaceMethodTypeDescription>( 510 xNewTD, UNO_QUERY_THROW ), 511 Reference<reflection::XInterfaceMethodTypeDescription>( 512 xExistingTD, UNO_QUERY_THROW ) ); 513 break; 514 case TypeClass_INTERFACE_ATTRIBUTE: 515 checkAttribute( 516 Reference<reflection::XInterfaceAttributeTypeDescription2>( 517 xNewTD, UNO_QUERY_THROW ), 518 Reference<reflection::XInterfaceAttributeTypeDescription2>( 519 xExistingTD, UNO_QUERY_THROW ) ); 520 break; 521 522 case TypeClass_PROPERTY: 523 checkProperty( Reference<reflection::XPropertyTypeDescription>( 524 xNewTD, UNO_QUERY_THROW ), 525 Reference<reflection::XPropertyTypeDescription>( 526 xExistingTD, UNO_QUERY_THROW ) ); 527 break; 528 529 case TypeClass_CONSTANT: 530 if (Reference<reflection::XConstantTypeDescription>( 531 xNewTD, UNO_QUERY_THROW )->getConstantValue() != 532 Reference<reflection::XConstantTypeDescription>( 533 xExistingTD, UNO_QUERY_THROW )->getConstantValue()) 534 typeError( OUSTR("Different constant value!"), xNewTD->getName() ); 535 break; 536 case TypeClass_CONSTANTS: 537 checkSeq( Reference<reflection::XConstantsTypeDescription>( 538 xNewTD, UNO_QUERY_THROW )->getConstants(), 539 Reference<reflection::XConstantsTypeDescription>( 540 xExistingTD, UNO_QUERY_THROW )->getConstants(), 541 xNewTD->getName() ); 542 break; 543 544 case TypeClass_SINGLETON: 545 checkSingleton( Reference<reflection::XSingletonTypeDescription2>( 546 xNewTD, UNO_QUERY_THROW ), 547 Reference<reflection::XSingletonTypeDescription2>( 548 xExistingTD, UNO_QUERY_THROW ) ); 549 break; 550 551 default: 552 break; 553 } 554 } 555 556 } 557