Kaydet (Commit) a72e3ed8 authored tarafından Armin Le Grand's avatar Armin Le Grand Kaydeden (comit) Xisco Fauli

Fix #121074# Added support for bitmap attributes

transparency, red, green, blue and gamma for ppt export
(cherry picked from commit df0f83c8)

Conflicts:
	filter/source/msfilter/escherex.cxx

Change-Id: If413df9bac6d0144f6650f5d9ae99834f6a33642
üst ed6d89dd
......@@ -1008,11 +1008,6 @@ void EscherPropertyContainer::ImplCreateGraphicAttributes( const ::com::sun::sta
::com::sun::star::drawing::ColorMode eColorMode( ::com::sun::star::drawing::ColorMode_STANDARD );
sal_Int16 nLuminance = 0;
sal_Int32 nContrast = 0;
sal_Int16 nRed = 0;
sal_Int16 nGreen = 0;
sal_Int16 nBlue = 0;
double fGamma = 1.0;
sal_Int16 nTransparency = 0;
if ( EscherPropertyValueHelper::GetPropertyValue( aAny, rXPropSet, OUString( "GraphicColorMode" ) ) )
aAny >>= eColorMode;
......@@ -1024,16 +1019,6 @@ void EscherPropertyContainer::ImplCreateGraphicAttributes( const ::com::sun::sta
aAny >>= nC;
nContrast = nC;
}
if ( EscherPropertyValueHelper::GetPropertyValue( aAny, rXPropSet, OUString( "AdjustRed" ) ) )
aAny >>= nRed;
if ( EscherPropertyValueHelper::GetPropertyValue( aAny, rXPropSet, OUString( "AdjustGreen" ) ) )
aAny >>= nGreen;
if ( EscherPropertyValueHelper::GetPropertyValue( aAny, rXPropSet, OUString( "AdjustBlue" ) ) )
aAny >>= nBlue;
if ( EscherPropertyValueHelper::GetPropertyValue( aAny, rXPropSet, OUString( "Gamma" ) ) )
aAny >>= fGamma;
if ( EscherPropertyValueHelper::GetPropertyValue( aAny, rXPropSet, OUString( "Transparency" ) ) )
aAny >>= nTransparency;
if ( eColorMode == ::com::sun::star::drawing::ColorMode_WATERMARK )
{
......@@ -1286,6 +1271,12 @@ sal_Bool EscherPropertyContainer::CreateGraphicProperties(
OUString aGraphicUrl;
OString aUniqueId;
bool bIsGraphicMtf(false);
// #121074#
sal_Int16 nTransparency(0);
sal_Int16 nRed(0);
sal_Int16 nGreen(0);
sal_Int16 nBlue(0);
double fGamma(1.0);
::com::sun::star::drawing::BitmapMode eBitmapMode( ::com::sun::star::drawing::BitmapMode_NO_REPEAT );
::com::sun::star::uno::Any aAny;
......@@ -1365,6 +1356,33 @@ sal_Bool EscherPropertyContainer::CreateGraphicProperties(
if ( EscherPropertyValueHelper::GetPropertyValue( aAny, rXPropSet, OUString( "IsMirrored" ), sal_True ) )
aAny >>= bMirrored;
// #121074# transparency of graphic is not supported in MS formats, get and apply it
// in the GetTransformedGraphic call in GetBlibID
if(EscherPropertyValueHelper::GetPropertyValue(aAny, rXPropSet, String(RTL_CONSTASCII_USTRINGPARAM("Transparency"))))
{
aAny >>= nTransparency;
}
if ( EscherPropertyValueHelper::GetPropertyValue( aAny, rXPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "AdjustRed" ) ) ) )
{
aAny >>= nRed;
}
if ( EscherPropertyValueHelper::GetPropertyValue( aAny, rXPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "AdjustGreen" ) ) ) )
{
aAny >>= nGreen;
}
if ( EscherPropertyValueHelper::GetPropertyValue( aAny, rXPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "AdjustBlue" ) ) ) )
{
aAny >>= nBlue;
}
if ( EscherPropertyValueHelper::GetPropertyValue( aAny, rXPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "Gamma" ) ) ) )
{
aAny >>= fGamma;
}
if ( bCreateFillBitmap && bFillBitmapModeAllowed )
{
if ( EscherPropertyValueHelper::GetPropertyValue( aAny, rXPropSet, OUString( "FillBitmapMode" ), sal_True ) )
......@@ -1401,7 +1419,7 @@ sal_Bool EscherPropertyContainer::CreateGraphicProperties(
const sal_uInt16 nFormat = aDescriptor.GetFileFormat();
// can MSO handle it?
if ( bMirrored || nAngle ||
if ( bMirrored || nAngle || nTransparency || nRed || nGreen || nBlue || (1.0 != fGamma) ||
(nFormat != GFF_BMP &&
nFormat != GFF_GIF &&
nFormat != GFF_JPG &&
......@@ -1448,13 +1466,45 @@ sal_Bool EscherPropertyContainer::CreateGraphicProperties(
if ( aGraphicUrl.getLength() || !aUniqueId.isEmpty() )
{
if ( bMirrored || nAngle )
if(bMirrored || nTransparency || nRed || nGreen || nBlue || (1.0 != fGamma))
{
pGraphicAttr = new GraphicAttr;
if ( bMirrored )
pGraphicAttr->SetMirrorFlags( BMP_MIRROR_HORZ );
if ( bIsGraphicMtf )
AddOpt( ESCHER_Prop_Rotation, ( ( ((sal_Int32)nAngle << 16 ) / 10 ) + 0x8000 ) &~ 0xffff );
if(bMirrored)
{
pGraphicAttr->SetMirrorFlags(BMP_MIRROR_HORZ);
}
// #121074#
if(nTransparency)
{
pGraphicAttr->SetTransparency((nTransparency * 255) / 100);
}
if(nRed)
{
pGraphicAttr->SetChannelR(nRed);
}
if(nGreen)
{
pGraphicAttr->SetChannelG(nGreen);
}
if(nBlue)
{
pGraphicAttr->SetChannelB(nBlue);
}
if(1.0 != fGamma)
{
pGraphicAttr->SetGamma(fGamma);
}
}
if(nAngle && bIsGraphicMtf)
{
AddOpt( ESCHER_Prop_Rotation, ( ( ((sal_Int32)nAngle << 16 ) / 10 ) + 0x8000 ) &~ 0xffff );
}
if ( eBitmapMode == ::com::sun::star::drawing::BitmapMode_REPEAT )
......@@ -1498,18 +1548,20 @@ sal_Bool EscherPropertyContainer::CreateGraphicProperties(
if ( pGraphicProvider && pPicOutStrm && pShapeBoundRect )
{
Rectangle aRect( Point( 0, 0 ), pShapeBoundRect->GetSize() );
const sal_uInt32 nBlibId(pGraphicProvider->GetBlibID(*pPicOutStrm, aUniqueId, aRect, NULL, pGraphicAttr));
sal_uInt32 nBlibId = 0;
nBlibId = pGraphicProvider->GetBlibID( *pPicOutStrm, aUniqueId, aRect, NULL, pGraphicAttr );
if ( nBlibId )
if(nBlibId)
{
if ( bCreateFillBitmap )
AddOpt( ESCHER_Prop_fillBlip, nBlibId, sal_True );
if(bCreateFillBitmap)
{
AddOpt(ESCHER_Prop_fillBlip, nBlibId, sal_True);
}
else
{
AddOpt( ESCHER_Prop_pib, nBlibId, sal_True );
ImplCreateGraphicAttributes( rXPropSet, nBlibId, bCreateCroppingAttributes );
}
bRetValue = sal_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