fdo#46808, Convert awt::UnoControlDialogModel to new style problem

Noel Grandin noel at peralex.com
Fri May 24 04:30:29 PDT 2013


Hi

OK, so it turns out that my change
     fdo#46808, Convert awt::UnoControlDialogModel to new style
http://cgit.freedesktop.org/libreoffice/core/commit/?id=6c61b20a8d4a6dcac28801cde82a211fb7e30654
has been causing some problems, notably around getting and setting 
properties.

Miklos did all of the debugging, and figuring out how to work-around the 
problem.

I'm writing down my notes in case anyone can shed light on WHY this is 
happening.

The problem is that after my change, this:
       Reference< beans::XPropertySet > xDlgPSet( xDialogModel, UNO_QUERY )
       Any aStringResourceManagerAny;
       aStringResourceManagerAny <<= xStringResourceManager;
       xDlgPSet->setPropertyValue( aResourceResolverPropName, 
aStringResourceManagerAny );
is not equivalent to this:
      Any aStringResourceManagerAny;
      aStringResourceManagerAny <<= xStringResourceManager;
      xDialogModel->setPropertyValue( aResourceResolverPropName, 
aStringResourceManagerAny );

For context the type hierarchy looks like this:
    UnoControlDialogModel --> ControlModelContainerBase --> 
UnoControlModel --> ::cppu::OPropertySetHelper

So when my new code calls setPropertyValue, it ends up here:
     // overrides to resolve ambiguity
     virtual void  UnoControlDialogModel::setPropertyValue(const 
OUString& p1, Any& p2)  throw (some stuff)
     {
         return 
UnoControlDialogModel_Base::ControlModelContainerBase::setPropertyValue(p1, 
p2);
     }
which calls into this:
     void UnoControlModel::setPropertyValue( const OUString& 
rPropertyName, :Any& rValue ) throw(some stuff)
     {
         sal_Int32 nPropId = 0;
         {
             ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
             nPropId = (sal_Int32) GetPropertyId( rPropertyName );
             DBG_ASSERT( nPropId, "Invalid ID in 
UnoControlModel::setPropertyValue" );
          }
          if( nPropId )
              setFastPropertyValue( nPropId, rValue );
          else
              throw ::com::sun::star::beans::UnknownPropertyException();
     }
but if we first cast to Reference<XPropertySet>, and then do the call, 
we end up in
     cppu::OPropertySetHelper::setPropertyValue()
and all is well.

Now why on earth UnoControlModel feels that it needs to override that, 
instead of just letting OPropertySetHelper handle it, I do not know.
It appears to be doing some weird stuff with font properties, but that 
does not explain the need for this override.



Disclaimer: http://www.peralex.com/disclaimer.html




More information about the LibreOffice mailing list