diff options
author | Eike Rathke <erack@redhat.com> | 2011-11-28 00:32:54 +0100 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2011-11-28 15:25:31 +0100 |
commit | 6b0c4cd205ee5134765955024cd727f1a23f2c24 (patch) | |
tree | 7454d1e36f78a7da216363fe0ec07d4bc2f2dce9 | |
parent | e55541cbf0170acfcb62001c8584da3a48c8ecc8 (diff) |
dr78: #i71810# rework import of fill bitmap mode: ignore CHPICFORMAT record except for bar chart series/points and for 3D walls/floor
# HG changeset patch
# User Daniel Rentz [dr] <daniel.rentz@oracle.com>
# Date 1292431407 -3600
# Node ID bfc09856a08ece3043973bdb484f0fd51bbc91f2
# Parent 90e08c2834a1fd8b5b783240a9d181749871bd7a
-rw-r--r-- | sc/source/filter/excel/xechart.cxx | 2 | ||||
-rw-r--r-- | sc/source/filter/excel/xichart.cxx | 54 | ||||
-rw-r--r-- | sc/source/filter/excel/xlchart.cxx | 15 | ||||
-rw-r--r-- | sc/source/filter/inc/xichart.hxx | 16 | ||||
-rw-r--r-- | sc/source/filter/inc/xlchart.hxx | 15 |
5 files changed, 55 insertions, 47 deletions
diff --git a/sc/source/filter/excel/xechart.cxx b/sc/source/filter/excel/xechart.cxx index 41f8facb4c72..bebe08c2890a 100644 --- a/sc/source/filter/excel/xechart.cxx +++ b/sc/source/filter/excel/xechart.cxx @@ -718,7 +718,7 @@ bool XclExpChEscherFormat::HasSubRecords() const void XclExpChEscherFormat::WriteSubRecords( XclExpStream& rStrm ) { rStrm.StartRecord( EXC_ID_CHPICFORMAT, 14 ); - rStrm << maPicFmt.mnBmpMode << maPicFmt.mnFormat << maPicFmt.mnFlags << maPicFmt.mfScale; + rStrm << maPicFmt.mnBmpMode << sal_uInt16( 0 ) << maPicFmt.mnFlags << maPicFmt.mfScale; rStrm.EndRecord(); } diff --git a/sc/source/filter/excel/xichart.cxx b/sc/source/filter/excel/xichart.cxx index a568ef24fdba..5ae92152e3b4 100644 --- a/sc/source/filter/excel/xichart.cxx +++ b/sc/source/filter/excel/xichart.cxx @@ -375,12 +375,12 @@ void XclImpChRoot::ConvertAreaFormat( ScfPropertySet& rPropSet, } void XclImpChRoot::ConvertEscherFormat( ScfPropertySet& rPropSet, - const XclChEscherFormat& rEscherFmt, const XclChPicFormat& rPicFmt, - XclChPropertyMode ePropMode ) const + const XclChEscherFormat& rEscherFmt, const XclChPicFormat* pPicFmt, + sal_uInt32 nDffFillType, XclChPropertyMode ePropMode ) const { GetChartPropSetHelper().WriteEscherProperties( rPropSet, *mxChData->mxGradientTable, *mxChData->mxHatchTable, *mxChData->mxBitmapTable, - rEscherFmt, rPicFmt, ePropMode ); + rEscherFmt, pPicFmt, nDffFillType, ePropMode ); } void XclImpChRoot::ConvertFont( ScfPropertySet& rPropSet, @@ -528,7 +528,8 @@ void XclImpChAreaFormat::Convert( const XclImpChRoot& rRoot, // ---------------------------------------------------------------------------- -XclImpChEscherFormat::XclImpChEscherFormat( const XclImpRoot& rRoot ) +XclImpChEscherFormat::XclImpChEscherFormat( const XclImpRoot& rRoot ) : + mnDffFillType( mso_fillSolid ) { maData.mxItemSet.reset( new SfxItemSet( rRoot.GetDoc().GetDrawLayer()->GetItemPool() ) ); @@ -542,9 +543,8 @@ void XclImpChEscherFormat::ReadHeaderRecord( XclImpStream& rStrm ) rStrm >> aPropSet; // get the data aPropSet.FillToItemSet( *maData.mxItemSet ); - // get bitmap mode from DFF item set - sal_uInt32 nType = aPropSet.GetPropertyValue( DFF_Prop_fillType, mso_fillSolid ); - maPicFmt.mnBmpMode = (nType == mso_fillPicture) ? EXC_CHPICFORMAT_STRETCH : EXC_CHPICFORMAT_STACK; + // get fill type from DFF property set + mnDffFillType = aPropSet.GetPropertyValue( DFF_Prop_fillType, mso_fillSolid ); } void XclImpChEscherFormat::ReadSubRecord( XclImpStream& rStrm ) @@ -552,16 +552,18 @@ void XclImpChEscherFormat::ReadSubRecord( XclImpStream& rStrm ) switch( rStrm.GetRecId() ) { case EXC_ID_CHPICFORMAT: - rStrm >> maPicFmt.mnBmpMode >> maPicFmt.mnFormat >> maPicFmt.mnFlags >> maPicFmt.mfScale; + rStrm >> maPicFmt.mnBmpMode; + rStrm.Ignore( 2 ); + rStrm >> maPicFmt.mnFlags >> maPicFmt.mfScale; break; } } void XclImpChEscherFormat::Convert( const XclImpChRoot& rRoot, - ScfPropertySet& rPropSet, XclChObjectType eObjType ) const + ScfPropertySet& rPropSet, XclChObjectType eObjType, bool bUsePicFmt ) const { const XclChFormatInfo& rFmtInfo = rRoot.GetFormatInfo( eObjType ); - rRoot.ConvertEscherFormat( rPropSet, maData, maPicFmt, rFmtInfo.mePropMode ); + rRoot.ConvertEscherFormat( rPropSet, maData, bUsePicFmt ? &maPicFmt : 0, mnDffFillType, rFmtInfo.mePropMode ); } // ---------------------------------------------------------------------------- @@ -622,23 +624,23 @@ void XclImpChFrameBase::ConvertLineBase( const XclImpChRoot& rRoot, } void XclImpChFrameBase::ConvertAreaBase( const XclImpChRoot& rRoot, - ScfPropertySet& rPropSet, XclChObjectType eObjType, sal_uInt16 nFormatIdx ) const + ScfPropertySet& rPropSet, XclChObjectType eObjType, sal_uInt16 nFormatIdx, bool bUsePicFmt ) const { if( rRoot.GetFormatInfo( eObjType ).mbIsFrame ) { // CHESCHERFORMAT overrides CHAREAFORMAT (even if it is auto) if( mxEscherFmt ) - mxEscherFmt->Convert( rRoot, rPropSet, eObjType ); + mxEscherFmt->Convert( rRoot, rPropSet, eObjType, bUsePicFmt ); else if( mxAreaFmt ) mxAreaFmt->Convert( rRoot, rPropSet, eObjType, nFormatIdx ); } } void XclImpChFrameBase::ConvertFrameBase( const XclImpChRoot& rRoot, - ScfPropertySet& rPropSet, XclChObjectType eObjType, sal_uInt16 nFormatIdx ) const + ScfPropertySet& rPropSet, XclChObjectType eObjType, sal_uInt16 nFormatIdx, bool bUsePicFmt ) const { ConvertLineBase( rRoot, rPropSet, eObjType, nFormatIdx ); - ConvertAreaBase( rRoot, rPropSet, eObjType, nFormatIdx ); + ConvertAreaBase( rRoot, rPropSet, eObjType, nFormatIdx, bUsePicFmt ); } // ---------------------------------------------------------------------------- @@ -701,9 +703,9 @@ void XclImpChFrame::UpdateObjFrame( const XclObjLineData& rLineData, const XclOb } } -void XclImpChFrame::Convert( ScfPropertySet& rPropSet ) const +void XclImpChFrame::Convert( ScfPropertySet& rPropSet, bool bUsePicFmt ) const { - ConvertFrameBase( GetChRoot(), rPropSet, meObjType ); + ConvertFrameBase( GetChRoot(), rPropSet, meObjType, EXC_CHDATAFORMAT_UNKNOWN, bUsePicFmt ); } // Source links =============================================================== @@ -1537,8 +1539,15 @@ void XclImpChDataFormat::UpdateTrendLineFormat() void XclImpChDataFormat::Convert( ScfPropertySet& rPropSet, const XclChExtTypeInfo& rTypeInfo ) const { - // line and area format - ConvertFrameBase( GetChRoot(), rPropSet, rTypeInfo.GetSeriesObjectType(), maData.mnFormatIdx ); + /* Line and area format. + #i71810# If the data points are filled with bitmaps, textures, or + patterns, then only bar charts will use the CHPICFORMAT record to + determine stacking/streching mode. All other chart types ignore this + record and always use the property 'fill-type' from the DFF property + set (streched for bitmaps, and stacked for textures and patterns). */ + bool bUsePicFmt = rTypeInfo.meTypeCateg == EXC_CHTYPECATEG_BAR; + ConvertFrameBase( GetChRoot(), rPropSet, rTypeInfo.GetSeriesObjectType(), maData.mnFormatIdx, bUsePicFmt ); + #if EXC_CHART2_3DBAR_HAIRLINES_ONLY // #i83151# only hair lines in 3D charts with filled data points if( rTypeInfo.mb3dChart && rTypeInfo.IsSeriesFrameFormat() && mxLineFmt && mxLineFmt->HasLine() ) @@ -1570,9 +1579,9 @@ void XclImpChDataFormat::ConvertLine( ScfPropertySet& rPropSet, XclChObjectType ConvertLineBase( GetChRoot(), rPropSet, eObjType ); } -void XclImpChDataFormat::ConvertArea( ScfPropertySet& rPropSet, sal_uInt16 nFormatIdx ) const +void XclImpChDataFormat::ConvertArea( ScfPropertySet& rPropSet, sal_uInt16 nFormatIdx, bool bUsePicFmt ) const { - ConvertAreaBase( GetChRoot(), rPropSet, EXC_CHOBJTYPE_FILLEDSERIES, nFormatIdx ); + ConvertAreaBase( GetChRoot(), rPropSet, EXC_CHOBJTYPE_FILLEDSERIES, nFormatIdx, bUsePicFmt ); } void XclImpChDataFormat::RemoveUnusedFormats( const XclChExtTypeInfo& rTypeInfo ) @@ -2020,7 +2029,7 @@ Reference< XDataSeries > XclImpChSeries::CreateDataSeries() const for( sal_uInt16 nPointIdx = 0, nPointCount = mxValueLink->GetCellCount(); nPointIdx < nPointCount; ++nPointIdx ) { ScfPropertySet aPointProp = lclGetPointPropSet( xDataSeries, nPointIdx ); - mxSeriesFmt->ConvertArea( aPointProp, bVarPointFmt ? nPointIdx : mnSeriesIdx ); + mxSeriesFmt->ConvertArea( aPointProp, bVarPointFmt ? nPointIdx : mnSeriesIdx, false ); } } @@ -3394,8 +3403,9 @@ Reference< XAxis > XclImpChAxis::CreateAxis( const XclImpChTypeGroup& rTypeGroup void XclImpChAxis::ConvertWall( ScfPropertySet& rPropSet ) const { + // #i71810# walls and floor in 3D charts use the CHPICFORMAT record for bitmap mode if( mxWallFrame ) - mxWallFrame->Convert( rPropSet ); + mxWallFrame->Convert( rPropSet, true ); } void XclImpChAxis::ConvertAxisPosition( ScfPropertySet& rPropSet, const XclImpChTypeGroup& rTypeGroup ) const diff --git a/sc/source/filter/excel/xlchart.cxx b/sc/source/filter/excel/xlchart.cxx index 6eb00bf13a18..26edb4ddb9b5 100644 --- a/sc/source/filter/excel/xlchart.cxx +++ b/sc/source/filter/excel/xlchart.cxx @@ -147,8 +147,7 @@ XclChEscherFormat::~XclChEscherFormat() XclChPicFormat::XclChPicFormat() : mnBmpMode( EXC_CHPICFORMAT_NONE ), - mnFormat( EXC_CHPICFORMAT_DEFAULT ), - mnFlags( EXC_CHPICFORMAT_DEFAULTFLAGS ), + mnFlags( EXC_CHPICFORMAT_TOPBOTTOM | EXC_CHPICFORMAT_FRONTBACK | EXC_CHPICFORMAT_LEFTRIGHT ), mfScale( 0.5 ) { } @@ -548,7 +547,7 @@ static const XclChTypeInfo spTypeInfos[] = { EXC_CHTYPEID_RADARLINE, EXC_CHTYPECATEG_RADAR, EXC_ID_CHRADARLINE, SERVICE_CHART2_NET, EXC_CHVARPOINT_SINGLE, csscd::TOP, false, false, true, false, true, false, true, false, false, false, false }, { EXC_CHTYPEID_RADARAREA, EXC_CHTYPECATEG_RADAR, EXC_ID_CHRADARAREA, SERVICE_CHART2_FILLEDNET, EXC_CHVARPOINT_NONE, csscd::TOP, false, false, true, true, true, false, true, false, false, true, false }, { EXC_CHTYPEID_PIE, EXC_CHTYPECATEG_PIE, EXC_ID_CHPIE, SERVICE_CHART2_PIE, EXC_CHVARPOINT_MULTI, csscd::AVOID_OVERLAP, false, true, true, true, true, true, true, false, false, false, false }, - { EXC_CHTYPEID_DONUT, EXC_CHTYPECATEG_PIE, EXC_ID_CHPIE, SERVICE_CHART2_PIE, EXC_CHVARPOINT_MULTI, csscd::AVOID_OVERLAP, false, true, true, true, true, false, true, false, false, true, false }, + { EXC_CHTYPEID_DONUT, EXC_CHTYPECATEG_PIE, EXC_ID_CHPIE, SERVICE_CHART2_PIE, EXC_CHVARPOINT_MULTI, csscd::AVOID_OVERLAP, false, true, true, true, true, false, true, false, false, false, false }, { EXC_CHTYPEID_PIEEXT, EXC_CHTYPECATEG_PIE, EXC_ID_CHPIEEXT, SERVICE_CHART2_PIE, EXC_CHVARPOINT_MULTI, csscd::AVOID_OVERLAP, false, false, true, true, true, true, true, false, false, false, false }, { EXC_CHTYPEID_SCATTER, EXC_CHTYPECATEG_SCATTER, EXC_ID_CHSCATTER, SERVICE_CHART2_SCATTER, EXC_CHVARPOINT_SINGLE, csscd::RIGHT, true, false, false, false, true, false, false, false, false, false, false }, { EXC_CHTYPEID_BUBBLES, EXC_CHTYPECATEG_SCATTER, EXC_ID_CHSCATTER, SERVICE_CHART2_BUBBLE, EXC_CHVARPOINT_SINGLE, csscd::RIGHT, false, false, false, true, true, false, false, false, false, false, false }, @@ -1076,8 +1075,8 @@ void XclChPropSetHelper::WriteAreaProperties( ScfPropertySet& rPropSet, void XclChPropSetHelper::WriteEscherProperties( ScfPropertySet& rPropSet, XclChObjectTable& rGradientTable, XclChObjectTable& /*rHatchTable*/, XclChObjectTable& rBitmapTable, - const XclChEscherFormat& rEscherFmt, const XclChPicFormat& rPicFmt, - XclChPropertyMode ePropMode ) + const XclChEscherFormat& rEscherFmt, const XclChPicFormat* pPicFmt, + sal_uInt32 nDffFillType, XclChPropertyMode ePropMode ) { if( rEscherFmt.mxItemSet ) { @@ -1127,8 +1126,10 @@ void XclChPropSetHelper::WriteEscherProperties( ScfPropertySet& rPropSet, if( aBmpName.getLength() ) { namespace cssd = ::com::sun::star::drawing; - cssd::BitmapMode eApiBmpMode = (rPicFmt.mnBmpMode == EXC_CHPICFORMAT_STRETCH) ? - cssd::BitmapMode_STRETCH : cssd::BitmapMode_REPEAT; + /* #i71810# Caller decides whether to use a CHPICFORMAT record for bitmap mode. + If not passed, detect fill mode from the DFF property 'fill-type'. */ + bool bStretch = pPicFmt ? (pPicFmt->mnBmpMode == EXC_CHPICFORMAT_STRETCH) : (nDffFillType == mso_fillPicture); + cssd::BitmapMode eApiBmpMode = bStretch ? cssd::BitmapMode_STRETCH : cssd::BitmapMode_REPEAT; maBitmapHlp.InitializeWrite(); maBitmapHlp << cssd::FillStyle_BITMAP << aBmpName << eApiBmpMode; maBitmapHlp.WriteToPropertySet( rPropSet ); diff --git a/sc/source/filter/inc/xichart.hxx b/sc/source/filter/inc/xichart.hxx index 83716c48e4c8..08f78130a8c0 100644 --- a/sc/source/filter/inc/xichart.hxx +++ b/sc/source/filter/inc/xichart.hxx @@ -161,7 +161,8 @@ public: void ConvertEscherFormat( ScfPropertySet& rPropSet, const XclChEscherFormat& rEscherFmt, - const XclChPicFormat& rPicFmt, + const XclChPicFormat* pPicFmt, + sal_uInt32 nDffFillType, XclChPropertyMode ePropMode ) const; /** Writes font properties to the passed property set. */ void ConvertFont( @@ -302,12 +303,13 @@ public: virtual void ReadSubRecord( XclImpStream& rStrm ); /** Converts and writes the contained data to the passed property set. */ - void Convert( const XclImpChRoot& rRoot, - ScfPropertySet& rPropSet, XclChObjectType eObjType ) const; + void Convert( const XclImpChRoot& rRoot, ScfPropertySet& rPropSet, + XclChObjectType eObjType, bool bUsePicFmt ) const; private: XclChEscherFormat maData; /// Fill properties for complex areas (CHESCHERFORMAT record). XclChPicFormat maPicFmt; /// Image options, e.g. stretched, stacked (CHPICFORMAT record). + sal_uInt32 mnDffFillType; /// Fill type imported from the DFF property set. }; typedef boost::shared_ptr< XclImpChEscherFormat > XclImpChEscherFormatRef; @@ -351,11 +353,11 @@ protected: /** Converts and writes the contained area formatting to the passed property set. */ void ConvertAreaBase( const XclImpChRoot& rRoot, ScfPropertySet& rPropSet, XclChObjectType eObjType, - sal_uInt16 nFormatIdx = EXC_CHDATAFORMAT_UNKNOWN ) const; + sal_uInt16 nFormatIdx = EXC_CHDATAFORMAT_UNKNOWN, bool bUsePicFmt = false ) const; /** Converts and writes the contained data to the passed property set. */ void ConvertFrameBase( const XclImpChRoot& rRoot, ScfPropertySet& rPropSet, XclChObjectType eObjType, - sal_uInt16 nFormatIdx = EXC_CHDATAFORMAT_UNKNOWN ) const; + sal_uInt16 nFormatIdx = EXC_CHDATAFORMAT_UNKNOWN, bool bUsePicFmt = false ) const; protected: XclImpChLineFormatRef mxLineFmt; /// Line format (CHLINEFORMAT record). @@ -385,7 +387,7 @@ public: void UpdateObjFrame( const XclObjLineData& rLineData, const XclObjFillData& rFillData ); /** Converts and writes the contained data to the passed property set. */ - void Convert( ScfPropertySet& rPropSet ) const; + void Convert( ScfPropertySet& rPropSet, bool bUsePicFmt = false ) const; private: XclChFrame maData; /// Contents of the CHFRAME record. @@ -708,7 +710,7 @@ public: /** Writes the line format only, e.g. for trend lines or error bars. */ void ConvertLine( ScfPropertySet& rPropSet, XclChObjectType eObjType ) const; /** Writes the area format only for the series or a data point. */ - void ConvertArea( ScfPropertySet& rPropSet, sal_uInt16 nFormatIdx ) const; + void ConvertArea( ScfPropertySet& rPropSet, sal_uInt16 nFormatIdx, bool bUsePicFmt ) const; private: /** Removes unused formatting (e.g. pie distance in a bar chart). */ diff --git a/sc/source/filter/inc/xlchart.hxx b/sc/source/filter/inc/xlchart.hxx index 51fe688a857e..ba12fa644ef4 100644 --- a/sc/source/filter/inc/xlchart.hxx +++ b/sc/source/filter/inc/xlchart.hxx @@ -571,14 +571,9 @@ const sal_uInt16 EXC_CHPICFORMAT_STRETCH = 1; /// Bitmap stretched const sal_uInt16 EXC_CHPICFORMAT_STACK = 2; /// Bitmap stacked. const sal_uInt16 EXC_CHPICFORMAT_SCALE = 3; /// Bitmap scaled to axis scale. -const sal_uInt16 EXC_CHPICFORMAT_WMF = 2; -const sal_uInt16 EXC_CHPICFORMAT_BMP = 9; -const sal_uInt16 EXC_CHPICFORMAT_DEFAULT = 19; - -const sal_uInt16 EXC_CHPICFORMAT_WINDOWS = 0x0001; -const sal_uInt16 EXC_CHPICFORMAT_MACOS = 0x0002; -const sal_uInt16 EXC_CHPICFORMAT_FORMATONLY = 0x0100; -const sal_uInt16 EXC_CHPICFORMAT_DEFAULTFLAGS = 0x0E00; /// Default flags for export. +const sal_uInt16 EXC_CHPICFORMAT_TOPBOTTOM = 0x0200; +const sal_uInt16 EXC_CHPICFORMAT_FRONTBACK = 0x0400; +const sal_uInt16 EXC_CHPICFORMAT_LEFTRIGHT = 0x0800; // (0x103D) CHDROPBAR --------------------------------------------------------- @@ -858,7 +853,6 @@ struct XclChEscherFormat struct XclChPicFormat { sal_uInt16 mnBmpMode; /// Bitmap mode, e.g. stretched, stacked. - sal_uInt16 mnFormat; /// Image data format (WMF, BMP). sal_uInt16 mnFlags; /// Additional flags. double mfScale; /// Picture scaling (units). @@ -1442,7 +1436,8 @@ public: XclChObjectTable& rHatchTable, XclChObjectTable& rBitmapTable, const XclChEscherFormat& rEscherFmt, - const XclChPicFormat& rPicFmt, + const XclChPicFormat* pPicFmt, + sal_uInt32 nDffFillType, XclChPropertyMode ePropMode ); /** Writes all marker properties to the passed property set. */ void WriteMarkerProperties( |