Kaydet (Commit) 79416bdb authored tarafından Michael Stahl's avatar Michael Stahl

sw: fix un-safe casts in SwXNumberingRules

At least they check that the pointer they reinterpret-cast without checking
the type isn't null!

Change-Id: I07770e274598b1c476b4c297ac1d388b7ca576e5
üst 7bbda9b2
...@@ -1938,15 +1938,15 @@ void SwXNumberingRules::SetPropertiesToNumFmt( ...@@ -1938,15 +1938,15 @@ void SwXNumberingRules::SetPropertiesToNumFmt(
case 17: //UNO_NAME_BULLET_FONT, case 17: //UNO_NAME_BULLET_FONT,
{ {
assert( !pDocShell ); assert( !pDocShell );
awt::FontDescriptor* pDesc = (awt::FontDescriptor*)pProp->Value.getValue(); awt::FontDescriptor desc;
if(pDesc) if (pProp->Value >>= desc)
{ {
// #i93725# // #i93725#
// do not accept "empty" font // do not accept "empty" font
if ( !pDesc->Name.isEmpty() ) if (!desc.Name.isEmpty())
{ {
vcl::Font aFont; vcl::Font aFont;
SvxUnoFontDescriptor::ConvertToFont( *pDesc, aFont ); SvxUnoFontDescriptor::ConvertToFont(desc, aFont);
aFmt.SetBulletFont(&aFont); aFmt.SetBulletFont(&aFont);
} }
} }
...@@ -2016,8 +2016,8 @@ void SwXNumberingRules::SetPropertiesToNumFmt( ...@@ -2016,8 +2016,8 @@ void SwXNumberingRules::SetPropertiesToNumFmt(
case 21: //UNO_NAME_GRAPHIC_BITMAP, case 21: //UNO_NAME_GRAPHIC_BITMAP,
{ {
assert( !pDocShell ); assert( !pDocShell );
uno::Reference< awt::XBitmap >* pBitmap = (uno::Reference< awt::XBitmap > *)pProp->Value.getValue(); uno::Reference<awt::XBitmap> xBitmap;
if(pBitmap) if (pProp->Value >>= xBitmap)
{ {
if(!pSetBrush) if(!pSetBrush)
{ {
...@@ -2030,7 +2030,7 @@ void SwXNumberingRules::SetPropertiesToNumFmt( ...@@ -2030,7 +2030,7 @@ void SwXNumberingRules::SetPropertiesToNumFmt(
pSetBrush = new SvxBrushItem(OUString(), OUString(), GPOS_AREA, RES_BACKGROUND); pSetBrush = new SvxBrushItem(OUString(), OUString(), GPOS_AREA, RES_BACKGROUND);
} }
BitmapEx aBmp = VCLUnoHelper::GetBitmap( *pBitmap ); BitmapEx aBmp = VCLUnoHelper::GetBitmap(xBitmap);
Graphic aNewGr(aBmp); Graphic aNewGr(aBmp);
pSetBrush->SetGraphic( aNewGr ); pSetBrush->SetGraphic( aNewGr );
} }
...@@ -2043,13 +2043,13 @@ void SwXNumberingRules::SetPropertiesToNumFmt( ...@@ -2043,13 +2043,13 @@ void SwXNumberingRules::SetPropertiesToNumFmt(
assert( !pDocShell ); assert( !pDocShell );
if(!pSetSize) if(!pSetSize)
pSetSize = new Size; pSetSize = new Size;
if(pProp->Value.getValueType() == ::cppu::UnoType<awt::Size>::get()) awt::Size size;
if (pProp->Value >>= size)
{ {
awt::Size* pSize = (awt::Size*)pProp->Value.getValue(); size.Width = convertMm100ToTwip(size.Width);
pSize->Width = convertMm100ToTwip(pSize->Width); size.Height = convertMm100ToTwip(size.Height);
pSize->Height = convertMm100ToTwip(pSize->Height); pSetSize->Width() = size.Width;
pSetSize->Width() = pSize->Width; pSetSize->Height() = size.Height;
pSetSize->Height() = pSize->Height;
} }
else else
bWrongArg = true; bWrongArg = true;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment