[Libreoffice-commits] core.git: 2 commits - filter/source include/filter officecfg/registry sd/source
Caolán McNamara
caolanm at redhat.com
Mon May 20 07:56:40 PDT 2013
filter/source/msfilter/escherex.cxx | 198 ++++++++++--
filter/source/msfilter/msdffimp.cxx | 213 +++++++++----
include/filter/msfilter/escherex.hxx | 13
include/filter/msfilter/msdffimp.hxx | 3
officecfg/registry/schema/org/openoffice/Office/Common.xcs | 2
sd/source/filter/eppt/epptso.cxx | 24 -
6 files changed, 349 insertions(+), 104 deletions(-)
New commits:
commit 7e7ccea7cc91e86d7d345b85940dba16bec36fc4
Author: Caolán McNamara <caolanm at redhat.com>
Date: Mon May 20 15:55:42 2013 +0100
go back to 8 colorvalueset columns
Change-Id: I9e345b3dea1d4a13ac2307bcebda19d753ecd7d0
diff --git a/officecfg/registry/schema/org/openoffice/Office/Common.xcs b/officecfg/registry/schema/org/openoffice/Office/Common.xcs
index be586f7..f20d0bd 100644
--- a/officecfg/registry/schema/org/openoffice/Office/Common.xcs
+++ b/officecfg/registry/schema/org/openoffice/Office/Common.xcs
@@ -6255,7 +6255,7 @@
</desc>
<label>Defines the number of columns that will be shown in a ColorValueSet.</label>
</info>
- <value>12</value>
+ <value>8</value>
</prop>
</group>
<group oor:name="ExternalApps" oor:extensible="true">
commit 0982b526bf0cd938af468f8c2d05830d6b6a8620
Author: Jianyuan Li <lijiany at apache.org>
Date: Thu Aug 16 01:13:03 2012 +0000
Resolves: #i120554# Shape Gradient MS2003 import/export Enhancement
Reported by: Jianyuan Li
Patch by: Jianyuan Li
Review by: SunYing
(cherry picked from commit 09c33de80a0e5fa321979e53bf88c4d17271eba8)
Conflicts:
filter/inc/filter/msfilter/escherex.hxx
filter/inc/filter/msfilter/msdffimp.hxx
filter/source/msfilter/escherex.cxx
filter/source/msfilter/msdffimp.cxx
Change-Id: I80a60af4862eb99523ea59e4f788b685d6de1fbd
WaE fixes: reorder initialization, handle all cases in switch, ...
(cherry picked from commit 350f294badf378806348e77e6a8ed0b5f1d5b77d)
Conflicts:
filter/source/msfilter/msdffimp.cxx
Change-Id: I4f1bde463921d48d1e014d0521427eaa9294663e
Add default to switch statements to avoid compiler warnings.
Patch by: Jianyuan Li
(cherry picked from commit f1302af0d803ca969022e69bcf7deeb62459f789)
Change-Id: I4e78e3b565d5922d452d2cfd1bf473af1587d29b
diff --git a/filter/source/msfilter/escherex.cxx b/filter/source/msfilter/escherex.cxx
index 5876613..4c8fec0 100644
--- a/filter/source/msfilter/escherex.cxx
+++ b/filter/source/msfilter/escherex.cxx
@@ -18,6 +18,7 @@
*/
#include "eschesdo.hxx"
+#include <svx/xflftrit.hxx>
#include <filter/msfilter/escherex.hxx>
#include <svx/unoapi.hxx>
#include <svx/svdobj.hxx>
@@ -426,20 +427,159 @@ void EscherPropertyContainer::CreateGradientProperties(
}
void EscherPropertyContainer::CreateGradientProperties(
- const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rXPropSet )
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rXPropSet , sal_Bool bTransparentGradient)
{
- ::com::sun::star::uno::Any aAny;
- ::com::sun::star::awt::Gradient aGradient;
- if ( EscherPropertyValueHelper::GetPropertyValue( aAny, rXPropSet, OUString( "FillGradient" ), sal_False ) )
+ ::com::sun::star::uno::Any aAny;
+ ::com::sun::star::awt::Gradient* pGradient = NULL;
+
+ sal_uInt32 nFillType = ESCHER_FillShadeScale;
+ sal_Int32 nAngle = 0;
+ sal_uInt32 nFillFocus = 0;
+ sal_uInt32 nFillLR = 0;
+ sal_uInt32 nFillTB = 0;
+ sal_uInt32 nFirstColor = 0;//like the control var nChgColors in import logic
+ bool bWriteFillTo = false;
+
+ //Transparency gradient: Means the third setting in transparency page is set
+ if (bTransparentGradient && EscherPropertyValueHelper::GetPropertyValue(
+ aAny, rXPropSet, OUString( "FillTransparenceGradient" ), sal_False ) )
+ {
+ pGradient = (::com::sun::star::awt::Gradient*)aAny.getValue();
+
+ ::com::sun::star::uno::Any aAnyTemp;
+ const rtl::OUString aPropName( "FillStyle" );
+ if ( EscherPropertyValueHelper::GetPropertyValue(
+ aAnyTemp, rXPropSet, aPropName, sal_False ) )
+ {
+ ::com::sun::star::drawing::FillStyle eFS;
+ if ( ! ( aAnyTemp >>= eFS ) )
+ eFS = ::com::sun::star::drawing::FillStyle_SOLID;
+ //solid and transparency
+ if ( eFS == ::com::sun::star::drawing::FillStyle_SOLID)
+ {
+ if ( EscherPropertyValueHelper::GetPropertyValue(
+ aAnyTemp, rXPropSet, OUString( "FillColor" ), sal_False ) )
+ {
+ pGradient->StartColor = ImplGetColor( *((sal_uInt32*)aAnyTemp.getValue()), sal_False );
+ pGradient->EndColor = ImplGetColor( *((sal_uInt32*)aAnyTemp.getValue()), sal_False );
+ }
+ }
+ //gradient and transparency.
+ else if( eFS == ::com::sun::star::drawing::FillStyle_GRADIENT )
+ {
+ if ( EscherPropertyValueHelper::GetPropertyValue(
+ aAny, rXPropSet, OUString( "FillGradient" ), sal_False ) )
+ pGradient = (::com::sun::star::awt::Gradient*)aAny.getValue();
+ }
+ }
+
+ }
+ //Not transparency gradient
+ else if ( EscherPropertyValueHelper::GetPropertyValue(
+ aAny, rXPropSet, OUString( "FillGradient" ), sal_False ) )
{
- aGradient = *static_cast< const ::com::sun::star::awt::Gradient* >( aAny.getValue() );
+ pGradient = (::com::sun::star::awt::Gradient*)aAny.getValue();
}
- CreateGradientProperties( aGradient );
-};
+
+ if ( pGradient )
+ {
+ switch ( pGradient->Style )
+ {
+ case ::com::sun::star::awt::GradientStyle_LINEAR :
+ case ::com::sun::star::awt::GradientStyle_AXIAL :
+ {
+ nFillType = ESCHER_FillShadeScale;
+ nAngle = pGradient->Angle;
+ while ( nAngle > 0 ) nAngle -= 3600;
+ while ( nAngle <= -3600 ) nAngle += 3600;
+ //Value of the real number = Integral + (Fractional / 65536.0)
+ nAngle = ( nAngle * 0x10000) / 10;
+
+ nFillFocus = (pGradient->Style == ::com::sun::star::awt::GradientStyle_LINEAR) ?
+ ( pGradient->XOffset + pGradient->YOffset )/2 : -50;
+ if( !nFillFocus )
+ nFirstColor=nFirstColor ^ 1;
+ if ( !nAngle )
+ nFirstColor=nFirstColor ^ 1;
+ }
+ break;
+ case ::com::sun::star::awt::GradientStyle_RADIAL :
+ case ::com::sun::star::awt::GradientStyle_ELLIPTICAL :
+ case ::com::sun::star::awt::GradientStyle_SQUARE :
+ case ::com::sun::star::awt::GradientStyle_RECT :
+ {
+ //according to the import logic and rect type fill** value
+ nFillLR = (pGradient->XOffset * 0x10000) / 100;
+ nFillTB = (pGradient->YOffset * 0x10000) / 100;
+ if ( ((nFillLR > 0) && (nFillLR < 0x10000)) || ((nFillTB > 0) && (nFillTB < 0x10000)) )
+ nFillType = ESCHER_FillShadeShape;
+ else
+ nFillType = ESCHER_FillShadeCenter;
+ nFirstColor = 1;
+ bWriteFillTo = true;
+ }
+ break;
+ default: break;
+ }
+ }
+
+ AddOpt( ESCHER_Prop_fillType, nFillType );
+ AddOpt( ESCHER_Prop_fillAngle, nAngle );
+ AddOpt( ESCHER_Prop_fillColor, GetGradientColor( pGradient, nFirstColor ) );
+ AddOpt( ESCHER_Prop_fillBackColor, GetGradientColor( pGradient, nFirstColor ^ 1 ) );
+ AddOpt( ESCHER_Prop_fillFocus, nFillFocus );
+ if ( bWriteFillTo )
+ {
+ //according to rect type fillTo** value
+ if(nFillLR)
+ {
+ AddOpt( ESCHER_Prop_fillToLeft, nFillLR );
+ AddOpt( ESCHER_Prop_fillToRight, nFillLR );
+ }
+ if(nFillTB)
+ {
+ AddOpt( ESCHER_Prop_fillToTop, nFillTB );
+ AddOpt( ESCHER_Prop_fillToBottom, nFillTB );
+ }
+ }
+
+ //Transparency gradient
+ if (bTransparentGradient && EscherPropertyValueHelper::GetPropertyValue(
+ aAny, rXPropSet, OUString( "FillTransparenceGradient" ), sal_False ) )
+ {
+ pGradient = (::com::sun::star::awt::Gradient*)aAny.getValue();
+ if ( pGradient )
+ {
+ sal_uInt32 nBlue = GetGradientColor( pGradient, nFirstColor ) >> 16;
+ AddOpt( ESCHER_Prop_fillOpacity,( ( 100 - ( nBlue * 100 / 255 ) ) << 16 ) / 100 );
+ nBlue = GetGradientColor( pGradient, nFirstColor ^ 1 ) >>16 ;
+ AddOpt( ESCHER_Prop_fillBackOpacity,( ( 100 - ( nBlue * 100 / 255 ) ) << 16 )/ 100 );
+ }
+ }
+}
+
+void EscherPropertyContainer::CreateFillProperties(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rXPropSet,
+ sal_Bool bEdge , const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > & rXShape )
+{
+ if ( rXShape.is() )
+ {
+ SdrObject* pObj = GetSdrObjectFromXShape( rXShape );
+ if ( pObj )
+ {
+ SfxItemSet aAttr( pObj->GetMergedItemSet() );
+ //tranparency with gradient. Means the third setting in transparency page is set
+ sal_Bool bTransparentGradient = ( aAttr.GetItemState( XATTR_FILLFLOATTRANSPARENCE ) == SFX_ITEM_SET ) &&
+ ( (const XFillFloatTransparenceItem&) aAttr.Get( XATTR_FILLFLOATTRANSPARENCE ) ).IsEnabled();
+ CreateFillProperties( rXPropSet, bEdge, bTransparentGradient );
+ }
+ }
+}
void EscherPropertyContainer::CreateFillProperties(
- const uno::Reference< beans::XPropertySet > & rXPropSet,
- sal_Bool bEdge )
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rXPropSet,
+ sal_Bool bEdge , sal_Bool bTransparentGradient)
+
{
::com::sun::star::uno::Any aAny;
AddOpt( ESCHER_Prop_WrapText, ESCHER_WrapNone );
@@ -457,7 +597,7 @@ void EscherPropertyContainer::CreateFillProperties(
{
case ::com::sun::star::drawing::FillStyle_GRADIENT :
{
- CreateGradientProperties( rXPropSet );
+ CreateGradientProperties( rXPropSet , bTransparentGradient );
AddOpt( ESCHER_Prop_fNoFillHitTest, 0x140014 );
}
break;
@@ -477,19 +617,25 @@ void EscherPropertyContainer::CreateFillProperties(
case ::com::sun::star::drawing::FillStyle_SOLID :
default:
{
- ::com::sun::star::beans::PropertyState ePropState = EscherPropertyValueHelper::GetPropertyState(
- rXPropSet, aPropName );
- if ( ePropState == ::com::sun::star::beans::PropertyState_DIRECT_VALUE )
- AddOpt( ESCHER_Prop_fillType, ESCHER_FillSolid );
-
- if ( EscherPropertyValueHelper::GetPropertyValue( aAny, rXPropSet, OUString( "FillColor" ), sal_False ) )
+ if ( bTransparentGradient )
+ CreateGradientProperties( rXPropSet , bTransparentGradient );
+ else
{
- sal_uInt32 nFillColor = ImplGetColor( *((sal_uInt32*)aAny.getValue()) );
- nFillBackColor = nFillColor ^ 0xffffff;
- AddOpt( ESCHER_Prop_fillColor, nFillColor );
+ ::com::sun::star::beans::PropertyState ePropState = EscherPropertyValueHelper::GetPropertyState(
+ rXPropSet, aPropName );
+ if ( ePropState == ::com::sun::star::beans::PropertyState_DIRECT_VALUE )
+ AddOpt( ESCHER_Prop_fillType, ESCHER_FillSolid );
+
+ if ( EscherPropertyValueHelper::GetPropertyValue(
+ aAny, rXPropSet, OUString( "FillColor" ), sal_False ) )
+ {
+ sal_uInt32 nFillColor = ImplGetColor( *((sal_uInt32*)aAny.getValue()) );
+ nFillBackColor = nFillColor ^ 0xffffff;
+ AddOpt( ESCHER_Prop_fillColor, nFillColor );
+ }
+ AddOpt( ESCHER_Prop_fNoFillHitTest, 0x100010 );
+ AddOpt( ESCHER_Prop_fillBackColor, nFillBackColor );
}
- AddOpt( ESCHER_Prop_fNoFillHitTest, 0x100010 );
- AddOpt( ESCHER_Prop_fillBackColor, nFillBackColor );
break;
}
case ::com::sun::star::drawing::FillStyle_NONE :
@@ -1358,27 +1504,27 @@ sal_Bool EscherPropertyContainer::CreateGraphicProperties(
// #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"))))
+ if(EscherPropertyValueHelper::GetPropertyValue(aAny, rXPropSet, OUString("Transparency")))
{
aAny >>= nTransparency;
}
- if ( EscherPropertyValueHelper::GetPropertyValue( aAny, rXPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "AdjustRed" ) ) ) )
+ if ( EscherPropertyValueHelper::GetPropertyValue( aAny, rXPropSet, OUString("AdjustRed") ) )
{
aAny >>= nRed;
}
- if ( EscherPropertyValueHelper::GetPropertyValue( aAny, rXPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "AdjustGreen" ) ) ) )
+ if ( EscherPropertyValueHelper::GetPropertyValue( aAny, rXPropSet, OUString("AdjustGreen" ) ) )
{
aAny >>= nGreen;
}
- if ( EscherPropertyValueHelper::GetPropertyValue( aAny, rXPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "AdjustBlue" ) ) ) )
+ if ( EscherPropertyValueHelper::GetPropertyValue( aAny, rXPropSet, OUString("AdjustBlue" ) ) )
{
aAny >>= nBlue;
}
- if ( EscherPropertyValueHelper::GetPropertyValue( aAny, rXPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "Gamma" ) ) ) )
+ if ( EscherPropertyValueHelper::GetPropertyValue( aAny, rXPropSet, OUString( "Gamma" ) ) )
{
aAny >>= fGamma;
}
diff --git a/filter/source/msfilter/msdffimp.cxx b/filter/source/msfilter/msdffimp.cxx
index feac1c7..069b8b3 100644
--- a/filter/source/msfilter/msdffimp.cxx
+++ b/filter/source/msfilter/msdffimp.cxx
@@ -199,7 +199,8 @@ void Impl_OlePres::Write( SvStream & rStm )
DffPropertyReader::DffPropertyReader( const SvxMSDffManager& rMan ) :
rManager( rMan ),
- pDefaultPropSet( NULL )
+ pDefaultPropSet( NULL ),
+ mbRotateGranientFillWithAngle ( 0 )
{
InitializePropSet( DFF_msofbtOPT );
}
@@ -1267,6 +1268,9 @@ void DffPropertyReader::ApplyFillAttributes( SvStream& rIn, SfxItemSet& rSet, co
break;
case mso_fillShadeCenter : // Shade from bounding rectangle to end point
{
+ //If it is imported as a bitmap, it will not work well with transparecy especially 100
+ //But the gradient look well comparing with imported as gradient. And rotate with shape
+ //also works better. So here just keep it.
if ( rObjData.aBoundRect.IsEmpty() )// size of object needed to be able
eXFill = XFILL_GRADIENT; // to create a bitmap substitution
else
@@ -1284,77 +1288,29 @@ void DffPropertyReader::ApplyFillAttributes( SvStream& rIn, SfxItemSet& rSet, co
}
rSet.Put( XFillStyleItem( eXFill ) );
+ double dTrans = 1.0;
+ double dBackTrans = 1.0;
if (IsProperty(DFF_Prop_fillOpacity))
{
- double nTrans = GetPropertyValue(DFF_Prop_fillOpacity);
- nTrans = (nTrans * 100) / 65536;
- rSet.Put(XFillTransparenceItem(
- sal_uInt16(100 - ::rtl::math::round(nTrans))));
+ dTrans = GetPropertyValue(DFF_Prop_fillOpacity) / 65536.0;
+ if ( eXFill != XFILL_GRADIENT )
+ {
+ dTrans = dTrans * 100;
+ rSet.Put(XFillTransparenceItem(
+ sal_uInt16(100 - ::rtl::math::round(dTrans))));
+ }
}
+ if ( IsProperty(DFF_Prop_fillBackOpacity) )
+ dBackTrans = GetPropertyValue(DFF_Prop_fillBackOpacity) / 65536.0;
+
if ( ( eMSO_FillType == mso_fillShadeCenter ) && ( eXFill == XFILL_BITMAP ) )
{
ApplyRectangularGradientAsBitmap( rManager, rIn, rSet, aShadeColors, rObjData, mnFix16Angle );
}
else if ( eXFill == XFILL_GRADIENT )
{
- sal_Int32 nAngle = 3600 - ( ( Fix16ToAngle( GetPropertyValue( DFF_Prop_fillAngle, 0 ) ) + 5 ) / 10 );
-
- // force rotation angle to be within a certain range
- while ( nAngle >= 3600 )
- nAngle -= 3600;
- while ( nAngle < 0 )
- nAngle += 3600;
-
- sal_Int32 nFocus = GetPropertyValue( DFF_Prop_fillFocus, 0 );
- XGradientStyle eGrad = XGRAD_LINEAR;
- sal_Int32 nChgColors = 0;
-
- if ( nFocus < 0 ) // If the focus is negative the colors need to be swapped
- {
- nFocus = -nFocus;
- nChgColors ^= 1;
- }
- if( nFocus > 40 && nFocus < 60 )
- {
- eGrad = XGRAD_AXIAL; // Unfortunately there's no better solution
- }
-
- sal_uInt16 nFocusX = (sal_uInt16)nFocus;
- sal_uInt16 nFocusY = (sal_uInt16)nFocus;
-
- switch( eMSO_FillType )
- {
- case mso_fillShadeShape :
- {
- eGrad = XGRAD_RECT;
- nFocusY = nFocusX = 50;
- nChgColors ^= 1;
- }
- break;
- case mso_fillShadeCenter :
- {
- eGrad = XGRAD_RECT;
- nFocusX = ( IsProperty( DFF_Prop_fillToRight ) ) ? 100 : 0;
- nFocusY = ( IsProperty( DFF_Prop_fillToBottom ) ) ? 100 : 0;
- nChgColors ^= 1;
- }
- break;
- default: break;
- }
- Color aCol1( rManager.MSO_CLR_ToColor( GetPropertyValue( DFF_Prop_fillColor, COL_WHITE ), DFF_Prop_fillColor ) );
- Color aCol2( rManager.MSO_CLR_ToColor( GetPropertyValue( DFF_Prop_fillBackColor, COL_WHITE ), DFF_Prop_fillBackColor ) );
-
- if ( nChgColors )
- {
- Color aZwi( aCol1 );
- aCol1 = aCol2;
- aCol2 = aZwi;
- }
- XGradient aGrad( aCol2, aCol1, eGrad, nAngle, nFocusX, nFocusY );
- aGrad.SetStartIntens( 100 );
- aGrad.SetEndIntens( 100 );
- rSet.Put( XFillGradientItem( OUString(), aGrad ) );
+ ImportGradientColor ( rSet, eMSO_FillType, dTrans , dBackTrans );
}
else if ( eXFill == XFILL_BITMAP )
{
@@ -2579,7 +2535,7 @@ void DffPropertyReader::ApplyAttributes( SvStream& rIn, SfxItemSet& rSet, DffObj
if ( nFontAttributes & 0x08 )
rSet.Put( SvxUnderlineItem( nFontAttributes & 0x08 ? UNDERLINE_SINGLE : UNDERLINE_NONE, EE_CHAR_UNDERLINE ) );
if ( nFontAttributes & 0x40 )
- rSet.Put( SvxShadowedItem( ( nFontAttributes & 0x40 ) != 0, EE_CHAR_SHADOW ) );
+ rSet.Put( SvxShadowedItem( (nFontAttributes & 0x40) != 0, EE_CHAR_SHADOW ) );
// if ( nFontAttributes & 0x02 )
// rSet.Put( SvxCaseMapItem( nFontAttributes & 0x02 ? SVX_CASEMAP_KAPITAELCHEN : SVX_CASEMAP_NOT_MAPPED ) );
if ( nFontAttributes & 0x01 )
@@ -2771,6 +2727,114 @@ void DffPropertyReader::CheckAndCorrectExcelTextRotation( SvStream& rIn, SfxItem
}
}
+
+void DffPropertyReader::ImportGradientColor( SfxItemSet& aSet,MSO_FillType eMSO_FillType, double dTrans , double dBackTrans) const
+{
+ //MS Focus prop will impact the start and end color position. And AOO does not
+ //support this prop. So need some swap for the two color to keep fidelity with AOO and MS shape.
+ //So below var is defined.
+ sal_Int32 nChgColors = 0;
+ sal_Int32 nAngle = GetPropertyValue( DFF_Prop_fillAngle, 0 );
+ sal_Int32 nRotateAngle = 0;
+ if(nAngle >= 0)
+ nChgColors ^= 1;
+
+ //Translate a MS clockwise(+) or count clockwise angle(-) into a AOO count clock wise angle
+ nAngle=3600 - ( ( Fix16ToAngle(nAngle) + 5 ) / 10 );
+ //Make sure this angle belongs to 0~3600
+ while ( nAngle >= 3600 ) nAngle -= 3600;
+ while ( nAngle < 0 ) nAngle += 3600;
+
+ //Rotate angle
+ if ( mbRotateGranientFillWithAngle )
+ {
+ nRotateAngle = GetPropertyValue( DFF_Prop_Rotation, 0 );
+ if(nRotateAngle)//fixed point number
+ nRotateAngle = ( (sal_Int16)( nRotateAngle >> 16) * 100L ) + ( ( ( nRotateAngle & 0x0000ffff) * 100L ) >> 16 );
+ nRotateAngle = ( nRotateAngle + 5 ) / 10 ;//round up
+ //nAngle is a clockwise angle. If nRotateAngle is a clockwise angle, then gradient need be rotated a little less
+ //Or it need be rotated a little more
+ nAngle -= nRotateAngle;
+ }
+ while ( nAngle >= 3600 ) nAngle -= 3600;
+ while ( nAngle < 0 ) nAngle += 3600;
+
+ XGradientStyle eGrad = XGRAD_LINEAR;
+
+ sal_Int32 nFocus = GetPropertyValue( DFF_Prop_fillFocus, 0 );
+ if ( !nFocus )
+ nChgColors ^= 1;
+ else if ( nFocus < 0 )//If it is a negative focus, the color will be swapped
+ {
+ nFocus =- nFocus;
+ nChgColors ^= 1;
+ }
+
+ if( nFocus > 40 && nFocus < 60 )
+ {
+ eGrad = XGRAD_AXIAL;//A axial gradient other than linear
+ nChgColors ^= 1;
+ }
+ //if the type is linear or axial, just save focus to nFocusX and nFocusY for export
+ //Core function does no need them. They serves for rect gradient(CenterXY).
+ sal_uInt16 nFocusX = (sal_uInt16)nFocus;
+ sal_uInt16 nFocusY = (sal_uInt16)nFocus;
+
+ switch( eMSO_FillType )
+ {
+ case mso_fillShadeShape :
+ {
+ eGrad = XGRAD_RECT;
+ nFocusY = nFocusX = 50;
+ nChgColors ^= 1;
+ }
+ break;
+ case mso_fillShadeCenter :
+ {
+ eGrad = XGRAD_RECT;
+ //A MS fillTo prop specifies the relative position of the left boundary
+ //of the center rectangle in a concentric shaded fill. Use 100 or 0 to keep fidelity
+ nFocusX=(GetPropertyValue( DFF_Prop_fillToRight, 0 )==0x10000) ? 100 : 0;
+ nFocusY=(GetPropertyValue( DFF_Prop_fillToBottom,0 )==0x10000) ? 100 : 0;
+ nChgColors ^= 1;
+ }
+ break;
+ default: break;
+ }
+
+ Color aCol1( rManager.MSO_CLR_ToColor( GetPropertyValue( DFF_Prop_fillColor, COL_WHITE ), DFF_Prop_fillColor ) );
+ Color aCol2( rManager.MSO_CLR_ToColor( GetPropertyValue( DFF_Prop_fillBackColor, COL_WHITE ), DFF_Prop_fillBackColor ) );
+ if ( nChgColors )
+ {
+ //Swap start and end color
+ Color aZwi( aCol1 );
+ aCol1 = aCol2;
+ aCol2 = aZwi;
+ //Swap two colors' transparency
+ double dTemp = dTrans;
+ dTrans = dBackTrans;
+ dBackTrans = dTemp;
+ }
+
+ //Construct gradient item
+ XGradient aGrad( aCol2, aCol1, eGrad, nAngle, nFocusX, nFocusY );
+ //Intensity has been merged into color. So here just set is as 100
+ aGrad.SetStartIntens( 100 );
+ aGrad.SetEndIntens( 100 );
+ aSet.Put( XFillGradientItem( String(), aGrad ) );
+ //Construct tranparency item. This item can coodinate with both solid and gradient.
+ if ( dTrans < 1.0 || dBackTrans < 1.0 )
+ {
+ sal_uInt8 nStartCol = (sal_uInt8)( (1 - dTrans )* 255 );
+ sal_uInt8 nEndCol = (sal_uInt8)( ( 1- dBackTrans ) * 255 );
+ aCol1 = Color(nStartCol, nStartCol, nStartCol);
+ aCol2 = Color(nEndCol, nEndCol, nEndCol);
+
+ XGradient aGrad2( aCol2 , aCol1 , eGrad, nAngle, nFocusX, nFocusY );
+ aSet.Put( XFillFloatTransparenceItem( String(), aGrad2 ) );
+ }
+}
+
//---------------------------------------------------------------------------
//- Record Manager ----------------------------------------------------------
//---------------------------------------------------------------------------
@@ -4018,6 +4082,29 @@ SdrObject* SvxMSDffManager::ImportShape( const DffRecordHeader& rHd, SvStream& r
DffObjData aObjData( rHd, rClientRect, nCalledByGroup );
aObjData.bRotateTextWithShape = ( GetSvxMSDffSettings() & SVXMSDFF_SETTINGS_IMPORT_EXCEL ) == 0;
maShapeRecords.Consume( rSt, sal_False );
+ if( maShapeRecords.SeekToContent( rSt,
+ DFF_msofbtUDefProp,
+ SEEK_FROM_BEGINNING ) )
+ {
+ sal_uInt32 nBytesLeft = maShapeRecords.Current()->nRecLen;
+ sal_uInt32 nUDData;
+ sal_uInt16 nPID;
+ while( 5 < nBytesLeft )
+ {
+ rSt >> nPID;
+ if ( rSt.GetError() != 0 )
+ break;
+ rSt >> nUDData;
+ if ( rSt.GetError() != 0 )
+ break;
+ if ( nPID == 447 ) //
+ {
+ mbRotateGranientFillWithAngle = nUDData & 0x20;
+ break;
+ }
+ nBytesLeft -= 6;
+ }
+ }
aObjData.bShapeType = maShapeRecords.SeekToContent( rSt, DFF_msofbtSp, SEEK_FROM_BEGINNING );
if ( aObjData.bShapeType )
{
diff --git a/include/filter/msfilter/escherex.hxx b/include/filter/msfilter/escherex.hxx
index b57d269..9ccf435 100644
--- a/include/filter/msfilter/escherex.hxx
+++ b/include/filter/msfilter/escherex.hxx
@@ -1270,13 +1270,22 @@ public:
void CreateGradientProperties( const ::com::sun::star::awt::Gradient & rGradient );
void CreateGradientProperties(
- const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > &
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > &,
+ sal_Bool bTransparentGradient = sal_False
);
+
void CreateLineProperties(
const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > &,
sal_Bool bEdge
);
- void CreateFillProperties( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > &, sal_Bool bEdge );
+ void CreateFillProperties(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > &,
+ sal_Bool bEdge,
+ sal_Bool bTransparentGradient = sal_False );
+ void CreateFillProperties(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > &,
+ sal_Bool bEdge,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > & rXShape );
void CreateTextProperties(
const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > &,
sal_uInt32 nText,
diff --git a/include/filter/msfilter/msdffimp.hxx b/include/filter/msfilter/msdffimp.hxx
index 6359277..16675db 100644
--- a/include/filter/msfilter/msdffimp.hxx
+++ b/include/filter/msfilter/msdffimp.hxx
@@ -86,6 +86,8 @@ class MSFILTER_DLLPUBLIC DffPropertyReader : public DffPropSet
public:
sal_Int32 mnFix16Angle;
+ sal_Bool mbRotateGranientFillWithAngle;
+
explicit DffPropertyReader( const SvxMSDffManager& rManager );
~DffPropertyReader();
sal_Int32 Fix16ToAngle( sal_Int32 nAngle ) const;
@@ -99,6 +101,7 @@ public:
void SetDefaultPropSet( SvStream& rIn, sal_uInt32 nOffDgg ) const;
void ApplyAttributes( SvStream& rIn, SfxItemSet& rSet ) const;
void ApplyAttributes( SvStream& rIn, SfxItemSet& rSet, DffObjData& rObjData ) const;
+ void ImportGradientColor( SfxItemSet& aSet, MSO_FillType eMSO_FillType, double dTrans = 1.0 , double dBackTrans = 1.0 ) const;
};
#define COL_DEFAULT RGB_COLORDATA( 0xFA, 0xFB, 0xFC )
diff --git a/sd/source/filter/eppt/epptso.cxx b/sd/source/filter/eppt/epptso.cxx
index f5ebfa5..4d4c3ee 100644
--- a/sd/source/filter/eppt/epptso.cxx
+++ b/sd/source/filter/eppt/epptso.cxx
@@ -2183,7 +2183,7 @@ sal_Bool PPTWriter::ImplCreatePresentationPlaceholder( const sal_Bool bMasterPag
aPropOpt.AddOpt( ESCHER_Prop_fNoFillHitTest, 0x110001 );
aPropOpt.AddOpt( ESCHER_Prop_lineColor, 0x8000001 );
aPropOpt.AddOpt( ESCHER_Prop_shadowColor, 0x8000002 );
- aPropOpt.CreateFillProperties( mXPropSet, sal_True );
+ aPropOpt.CreateFillProperties( mXPropSet, sal_True, mXShape );
sal_uInt32 nLineFlags = 0x90001;
if ( aPropOpt.GetOpt( ESCHER_Prop_fNoLineDrawDash, nLineFlags ) )
nLineFlags |= 0x10001; // draw dashed line if no line
@@ -2235,7 +2235,7 @@ void PPTWriter::ImplCreateTextShape( EscherPropertyContainer& rPropOpt, EscherSo
mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
ImplCreateShape( ESCHER_ShpInst_TextBox, 0xa00, rSolver );
if ( bFill )
- rPropOpt.CreateFillProperties( mXPropSet, sal_True );
+ rPropOpt.CreateFillProperties( mXPropSet, sal_True, mXShape );
if ( ImplGetText() )
rPropOpt.CreateTextProperties( mXPropSet, mnTxId += 0x60, sal_False, sal_True );
}
@@ -2394,7 +2394,7 @@ void PPTWriter::ImplWritePage( const PHLayout& rLayout, EscherSolverContainer& a
{
ImplCreateShape( eShapeType, nMirrorFlags | 0xa00, aSolverContainer );
aPropOpt.CreateCustomShapeProperties( eShapeType, mXShape );
- aPropOpt.CreateFillProperties( mXPropSet, sal_True );
+ aPropOpt.CreateFillProperties( mXPropSet, sal_True, mXShape);
if ( ImplGetText() )
{
if ( !aPropOpt.IsFontWork() )
@@ -2428,7 +2428,7 @@ void PPTWriter::ImplWritePage( const PHLayout& rLayout, EscherSolverContainer& a
{
ImplCreateShape( ESCHER_ShpInst_Rectangle, 0xa00, aSolverContainer ); // Flags: Connector | HasSpt
}
- aPropOpt.CreateFillProperties( mXPropSet, sal_True );
+ aPropOpt.CreateFillProperties( mXPropSet, sal_True, mXShape );
if ( ImplGetText() )
aPropOpt.CreateTextProperties( mXPropSet, mnTxId += 0x60, sal_False, sal_False );
}
@@ -2466,7 +2466,7 @@ void PPTWriter::ImplWritePage( const PHLayout& rLayout, EscherSolverContainer& a
{
mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
ImplCreateShape( ESCHER_ShpInst_Ellipse, 0xa00, aSolverContainer ); // Flags: Connector | HasSpt
- aPropOpt.CreateFillProperties( mXPropSet, sal_True );
+ aPropOpt.CreateFillProperties( mXPropSet, sal_True, mXShape );
if ( ImplGetText() )
aPropOpt.CreateTextProperties( mXPropSet, mnTxId += 0x60, sal_False, sal_False );
}
@@ -2518,7 +2518,7 @@ void PPTWriter::ImplWritePage( const PHLayout& rLayout, EscherSolverContainer& a
case POLY_CHORD :
{
if ( aPropOpt.CreatePolygonProperties( mXPropSet, ESCHER_CREATEPOLYGON_POLYPOLYGON, sal_False, aNewRect, &aPolygon ) )
- aPropOpt.CreateFillProperties( mXPropSet, sal_True );
+ aPropOpt.CreateFillProperties( mXPropSet, sal_True , mXShape );
}
break;
@@ -2729,7 +2729,7 @@ void PPTWriter::ImplWritePage( const PHLayout& rLayout, EscherSolverContainer& a
maRect = MapRectangle( aNewRect );
maPosition = ::com::sun::star::awt::Point( maRect.Left(), maRect.Top() );
maSize = ::com::sun::star::awt::Size( maRect.GetWidth(), maRect.GetHeight() );
- aPropOpt.CreateFillProperties( mXPropSet, sal_True );
+ aPropOpt.CreateFillProperties( mXPropSet, sal_True , mXShape );
mnAngle = 0;
}
else if ( bPolyLine )
@@ -2789,7 +2789,7 @@ void PPTWriter::ImplWritePage( const PHLayout& rLayout, EscherSolverContainer& a
maRect = MapRectangle( aNewRect );
maPosition = ::com::sun::star::awt::Point( maRect.Left(), maRect.Top() );
maSize = ::com::sun::star::awt::Size( maRect.GetWidth(), maRect.GetHeight() );
- aPropOpt.CreateFillProperties( mXPropSet, sal_True );
+ aPropOpt.CreateFillProperties( mXPropSet, sal_True , mXShape );
mnAngle = 0;
}
else if ( ( mType == "drawing.GraphicObject" ) || ( mType == "presentation.GraphicObject" ) )
@@ -2900,7 +2900,7 @@ void PPTWriter::ImplWritePage( const PHLayout& rLayout, EscherSolverContainer& a
aPropertyOptions.AddOpt( ESCHER_Prop_fNoFillHitTest, 0x110001 );
aPropertyOptions.AddOpt( ESCHER_Prop_lineColor, 0x8000001 );
aPropertyOptions.AddOpt( ESCHER_Prop_shadowColor, 0x8000002 );
- aPropertyOptions.CreateFillProperties( mXPropSet, sal_True );
+ aPropertyOptions.CreateFillProperties( mXPropSet, sal_True, mXShape );
sal_uInt32 nLineFlags = 0x90001;
if ( aPropertyOptions.GetOpt( ESCHER_Prop_fNoLineDrawDash, nLineFlags ) )
nLineFlags |= 0x10001; // draw dashed line if no line
@@ -2945,7 +2945,7 @@ void PPTWriter::ImplWritePage( const PHLayout& rLayout, EscherSolverContainer& a
nPlaceHolderAtom = rLayout.nTypeOfTitle;
ImplCreateShape( ESCHER_ShpInst_Rectangle, 0x220, aSolverContainer ); // Flags: HaveAnchor | HaveMaster
aPropOpt.AddOpt( ESCHER_Prop_hspMaster, mnShapeMasterTitle );
- aPropOpt.CreateFillProperties( mXPropSet, sal_True );
+ aPropOpt.CreateFillProperties( mXPropSet, sal_True, mXShape );
aPropOpt.CreateTextProperties( mXPropSet, mnTxId += 0x60, sal_False, sal_True );
ImplAdjustFirstLineLineSpacing( aTextObj, aPropOpt );
if ( mbEmptyPresObj )
@@ -2992,7 +2992,7 @@ void PPTWriter::ImplWritePage( const PHLayout& rLayout, EscherSolverContainer& a
aPropOpt2.AddOpt( ESCHER_Prop_lineColor, 0x8000001 );
aPropOpt2.AddOpt( ESCHER_Prop_fNoLineDrawDash, 0x90001 );
aPropOpt2.AddOpt( ESCHER_Prop_shadowColor, 0x8000002 );
- aPropOpt2.CreateFillProperties( mXPropSet, sal_True );
+ aPropOpt2.CreateFillProperties( mXPropSet, sal_True, mXShape );
sal_uInt32 nLineFlags = 0x90001;
if ( aPropOpt2.GetOpt( ESCHER_Prop_fNoLineDrawDash, nLineFlags ) )
nLineFlags |= 0x10001; // draw dashed line if no line
@@ -3042,7 +3042,7 @@ void PPTWriter::ImplWritePage( const PHLayout& rLayout, EscherSolverContainer& a
mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
ImplCreateShape( ESCHER_ShpInst_Rectangle, 0x220, aSolverContainer ); // Flags: HaveAnchor | HaveMaster
aPropOpt.AddOpt( ESCHER_Prop_hspMaster, mnShapeMasterBody );
- aPropOpt.CreateFillProperties( mXPropSet, sal_True );
+ aPropOpt.CreateFillProperties( mXPropSet, sal_True, mXShape );
aPropOpt.CreateTextProperties( mXPropSet, mnTxId += 0x60, sal_False, sal_True );
ImplAdjustFirstLineLineSpacing( aTextObj, aPropOpt );
if ( mbEmptyPresObj )
More information about the Libreoffice-commits
mailing list