diff options
author | Caolán McNamara <caolanm@redhat.com> | 2013-03-15 14:35:20 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2013-03-15 15:24:53 +0000 |
commit | 188042ad5230e912f3149cc7ea1bb836e084069a (patch) | |
tree | c7e627a84aabb501f2d921f7110e9928e769599c /filter | |
parent | c97aec0d2276901c20634abe53867f739f420f50 (diff) |
restore enough of XOBitmap to do fore/back color setting on escher patterns
i.e. restore the logic of setting the colors of imported escher patterns like
we always did in the past. Stripping that out seems risky in the absence of
definite test-cases.
Change-Id: I16bbb451b053fd04a5154602f8f38ed799e21286
Diffstat (limited to 'filter')
-rw-r--r-- | filter/source/msfilter/msdffimp.cxx | 34 |
1 files changed, 29 insertions, 5 deletions
diff --git a/filter/source/msfilter/msdffimp.cxx b/filter/source/msfilter/msdffimp.cxx index 71b69149d2d7..86fabbd01b9c 100644 --- a/filter/source/msfilter/msdffimp.cxx +++ b/filter/source/msfilter/msdffimp.cxx @@ -131,6 +131,7 @@ #include <com/sun/star/beans/PropertyValues.hpp> #include <com/sun/star/drawing/ProjectionMode.hpp> #include "svx/EnhancedCustomShape2d.hxx" +#include <svx/xbitmap.hxx> #include <rtl/strbuf.hxx> #include <rtl/ustring.hxx> #include <boost/scoped_array.hpp> @@ -1371,13 +1372,36 @@ void DffPropertyReader::ApplyFillAttributes( SvStream& rIn, SfxItemSet& rSet, co { if ( eMSO_FillType == mso_fillPattern ) { - Color aCol1( COL_WHITE ), aCol2( COL_WHITE ); + Bitmap aBmp( aGraf.GetBitmap() ); + if( aBmp.GetSizePixel().Width() == 8 && aBmp.GetSizePixel().Height() == 8 && aBmp.GetColorCount() == 2) + { + Color aCol1( COL_WHITE ), aCol2( COL_WHITE ); + + if ( IsProperty( DFF_Prop_fillColor ) ) + aCol1 = rManager.MSO_CLR_ToColor( GetPropertyValue( DFF_Prop_fillColor ), DFF_Prop_fillColor ); + + if ( IsProperty( DFF_Prop_fillBackColor ) ) + aCol2 = rManager.MSO_CLR_ToColor( GetPropertyValue( DFF_Prop_fillBackColor ), DFF_Prop_fillBackColor ); - if ( IsProperty( DFF_Prop_fillColor ) ) - aCol1 = rManager.MSO_CLR_ToColor( GetPropertyValue( DFF_Prop_fillColor ), DFF_Prop_fillColor ); + XOBitmap aXOBitmap( aBmp ); + aXOBitmap.Bitmap2Array(); + aXOBitmap.SetBitmapType( XBITMAP_8X8 ); + aXOBitmap.SetPixelSize( aBmp.GetSizePixel() ); + + if( aXOBitmap.GetBackgroundColor() == COL_BLACK ) + { + aXOBitmap.SetPixelColor( aCol1 ); + aXOBitmap.SetBackgroundColor( aCol2 ); + } + else + { + aXOBitmap.SetPixelColor( aCol2 ); + aXOBitmap.SetBackgroundColor( aCol1 ); + } - if ( IsProperty( DFF_Prop_fillBackColor ) ) - aCol2 = rManager.MSO_CLR_ToColor( GetPropertyValue( DFF_Prop_fillBackColor ), DFF_Prop_fillBackColor ); + aXOBitmap.Array2Bitmap(); + aGraf = Graphic( aXOBitmap.GetBitmap() ); + } rSet.Put(XFillBitmapItem(OUString(), aGraf)); } |