coverity#704558 Unchecked dynamic cast
Change-Id: I45ce419c65e0fac28879747787ccf1ebc25e7698
This commit is contained in:
parent
7b4d53699c
commit
5aed432830
@ -3172,52 +3172,56 @@ void OReportController::createControl(const Sequence< PropertyValue >& _aArgs,co
|
|||||||
|
|
||||||
pNewControl = pControl;
|
pNewControl = pControl;
|
||||||
OUnoObject* pObj = dynamic_cast<OUnoObject*>(pControl);
|
OUnoObject* pObj = dynamic_cast<OUnoObject*>(pControl);
|
||||||
uno::Reference<beans::XPropertySet> xUnoProp(pObj->GetUnoControlModel(),uno::UNO_QUERY);
|
assert(pObj);
|
||||||
xShapeProp.set(pObj->getUnoShape(),uno::UNO_QUERY);
|
if(pObj)
|
||||||
uno::Reference<beans::XPropertySetInfo> xShapeInfo = xShapeProp->getPropertySetInfo();
|
|
||||||
uno::Reference<beans::XPropertySetInfo> xInfo = xUnoProp->getPropertySetInfo();
|
|
||||||
|
|
||||||
const OUString sProps[] = { OUString(PROPERTY_NAME)
|
|
||||||
,OUString(PROPERTY_FONTDESCRIPTOR)
|
|
||||||
,OUString(PROPERTY_FONTDESCRIPTORASIAN)
|
|
||||||
,OUString(PROPERTY_FONTDESCRIPTORCOMPLEX)
|
|
||||||
,OUString(PROPERTY_ORIENTATION)
|
|
||||||
,OUString(PROPERTY_BORDER)
|
|
||||||
,OUString(PROPERTY_FORMATSSUPPLIER)
|
|
||||||
,OUString(PROPERTY_BACKGROUNDCOLOR)
|
|
||||||
};
|
|
||||||
for(size_t i = 0; i < sizeof (sProps) / sizeof (sProps[0]); ++i)
|
|
||||||
{
|
{
|
||||||
if ( xInfo->hasPropertyByName(sProps[i]) && xShapeInfo->hasPropertyByName(sProps[i]) )
|
uno::Reference<beans::XPropertySet> xUnoProp(pObj->GetUnoControlModel(),uno::UNO_QUERY);
|
||||||
xUnoProp->setPropertyValue(sProps[i],xShapeProp->getPropertyValue(sProps[i]));
|
xShapeProp.set(pObj->getUnoShape(),uno::UNO_QUERY);
|
||||||
}
|
uno::Reference<beans::XPropertySetInfo> xShapeInfo = xShapeProp->getPropertySetInfo();
|
||||||
|
uno::Reference<beans::XPropertySetInfo> xInfo = xUnoProp->getPropertySetInfo();
|
||||||
|
|
||||||
if ( xInfo->hasPropertyByName(PROPERTY_BORDER) && xShapeInfo->hasPropertyByName(PROPERTY_CONTROLBORDER) )
|
const OUString sProps[] = { OUString(PROPERTY_NAME)
|
||||||
xUnoProp->setPropertyValue(PROPERTY_BORDER,xShapeProp->getPropertyValue(PROPERTY_CONTROLBORDER));
|
,OUString(PROPERTY_FONTDESCRIPTOR)
|
||||||
|
,OUString(PROPERTY_FONTDESCRIPTORASIAN)
|
||||||
|
,OUString(PROPERTY_FONTDESCRIPTORCOMPLEX)
|
||||||
|
,OUString(PROPERTY_ORIENTATION)
|
||||||
|
,OUString(PROPERTY_BORDER)
|
||||||
|
,OUString(PROPERTY_FORMATSSUPPLIER)
|
||||||
|
,OUString(PROPERTY_BACKGROUNDCOLOR)
|
||||||
|
};
|
||||||
|
for(size_t i = 0; i < sizeof (sProps) / sizeof (sProps[0]); ++i)
|
||||||
|
{
|
||||||
|
if ( xInfo->hasPropertyByName(sProps[i]) && xShapeInfo->hasPropertyByName(sProps[i]) )
|
||||||
|
xUnoProp->setPropertyValue(sProps[i],xShapeProp->getPropertyValue(sProps[i]));
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( xInfo->hasPropertyByName(PROPERTY_BORDER) && xShapeInfo->hasPropertyByName(PROPERTY_CONTROLBORDER) )
|
||||||
|
xUnoProp->setPropertyValue(PROPERTY_BORDER,xShapeProp->getPropertyValue(PROPERTY_CONTROLBORDER));
|
||||||
|
|
||||||
|
|
||||||
if ( xInfo->hasPropertyByName(PROPERTY_DATAFIELD) && !_sFunction.isEmpty() )
|
if ( xInfo->hasPropertyByName(PROPERTY_DATAFIELD) && !_sFunction.isEmpty() )
|
||||||
{
|
{
|
||||||
ReportFormula aFunctionFormula( ReportFormula::Expression, _sFunction );
|
ReportFormula aFunctionFormula( ReportFormula::Expression, _sFunction );
|
||||||
xUnoProp->setPropertyValue( PROPERTY_DATAFIELD, uno::makeAny( aFunctionFormula.getCompleteFormula() ) );
|
xUnoProp->setPropertyValue( PROPERTY_DATAFIELD, uno::makeAny( aFunctionFormula.getCompleteFormula() ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
sal_Int32 nFormatKey = aMap.getUnpackedValueOrDefault(PROPERTY_FORMATKEY,sal_Int32(0));
|
sal_Int32 nFormatKey = aMap.getUnpackedValueOrDefault(PROPERTY_FORMATKEY,sal_Int32(0));
|
||||||
if ( nFormatKey && xInfo->hasPropertyByName(PROPERTY_FORMATKEY) )
|
if ( nFormatKey && xInfo->hasPropertyByName(PROPERTY_FORMATKEY) )
|
||||||
xUnoProp->setPropertyValue( PROPERTY_FORMATKEY, uno::makeAny( nFormatKey ) );
|
xUnoProp->setPropertyValue( PROPERTY_FORMATKEY, uno::makeAny( nFormatKey ) );
|
||||||
|
|
||||||
OUString sUrl = aMap.getUnpackedValueOrDefault(PROPERTY_IMAGEURL,OUString());
|
OUString sUrl = aMap.getUnpackedValueOrDefault(PROPERTY_IMAGEURL,OUString());
|
||||||
if ( !sUrl.isEmpty() && xInfo->hasPropertyByName(PROPERTY_IMAGEURL) )
|
if ( !sUrl.isEmpty() && xInfo->hasPropertyByName(PROPERTY_IMAGEURL) )
|
||||||
xUnoProp->setPropertyValue( PROPERTY_IMAGEURL, uno::makeAny( sUrl ) );
|
xUnoProp->setPropertyValue( PROPERTY_IMAGEURL, uno::makeAny( sUrl ) );
|
||||||
|
|
||||||
pObj->CreateMediator(sal_True);
|
pObj->CreateMediator(sal_True);
|
||||||
|
|
||||||
if ( _nObjectId == OBJ_DLG_FIXEDTEXT ) // special case for fixed text
|
if ( _nObjectId == OBJ_DLG_FIXEDTEXT ) // special case for fixed text
|
||||||
xUnoProp->setPropertyValue(PROPERTY_LABEL,uno::makeAny(OUnoObject::GetDefaultName(pObj)));
|
xUnoProp->setPropertyValue(PROPERTY_LABEL,uno::makeAny(OUnoObject::GetDefaultName(pObj)));
|
||||||
else if ( _nObjectId == OBJ_DLG_VFIXEDLINE )
|
else if ( _nObjectId == OBJ_DLG_VFIXEDLINE )
|
||||||
{
|
{
|
||||||
awt::Size aOlSize = xShapeProp->getSize();
|
awt::Size aOlSize = xShapeProp->getSize();
|
||||||
xShapeProp->setSize(awt::Size(aOlSize.Height,aOlSize.Width)); // switch height and width
|
xShapeProp->setSize(awt::Size(aOlSize.Height,aOlSize.Width)); // switch height and width
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user