Date: prev next · Thread: first prev next last
2013 Archives by date, by thread · List index


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



Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.