summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArmin Le Grand <alg@apache.org>2012-09-27 14:24:57 +0000
committerXisco Fauli <anistenis@gmail.com>2013-04-07 23:37:43 +0200
commita72e3ed81a0d619b81074cb80d7ef9d3d11feda6 (patch)
treebff61d9dd2ab7b7244befe433366f31cb6708490
parented6d89dd55cff5ca91ecbfc8716a4e6c584be165 (diff)
Fix #121074# Added support for bitmap attributes
transparency, red, green, blue and gamma for ppt export (cherry picked from commit df0f83c87148769ca7cbcfc3d1cb9ccf9d5c0540) Conflicts: filter/source/msfilter/escherex.cxx Change-Id: If413df9bac6d0144f6650f5d9ae99834f6a33642
-rw-r--r--filter/source/msfilter/escherex.cxx104
1 files changed, 78 insertions, 26 deletions
diff --git a/filter/source/msfilter/escherex.cxx b/filter/source/msfilter/escherex.cxx
index e68b87e37a86..330f7c0158eb 100644
--- a/filter/source/msfilter/escherex.cxx
+++ b/filter/source/msfilter/escherex.cxx
@@ -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;
}
}