diff options
author | Vladimir Glazounov <vg@openoffice.org> | 2008-09-30 13:51:36 +0000 |
---|---|---|
committer | Vladimir Glazounov <vg@openoffice.org> | 2008-09-30 13:51:36 +0000 |
commit | 8a8ce68305ba909db1526909c485eb73d9505a4a (patch) | |
tree | b179fdd0bd88325c9f6dd660bfcc2c672740089a | |
parent | cdb4b78f928f2a5e49d4fc624bff26d4a756d204 (diff) |
CWS-TOOLING: integrate CWS dr63
-rw-r--r-- | svx/inc/svx/escherex.hxx | 13 | ||||
-rw-r--r-- | svx/prj/d.lst | 1 | ||||
-rw-r--r-- | svx/source/msfilter/escherex.cxx | 163 |
3 files changed, 89 insertions, 88 deletions
diff --git a/svx/inc/svx/escherex.hxx b/svx/inc/svx/escherex.hxx index 1b4a9ddbc4..4bb34498ed 100644 --- a/svx/inc/svx/escherex.hxx +++ b/svx/inc/svx/escherex.hxx @@ -1,13 +1,13 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2008 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: escherex.hxx,v $ - * $Revision: 1.6 $ + * $Revision: 1.6.146.1 $ * * This file is part of OpenOffice.org. * @@ -42,8 +42,9 @@ #include <com/sun/star/awt/Point.hpp> #include <com/sun/star/awt/Rectangle.hpp> #include <com/sun/star/beans/XPropertySet.hpp> -#include <com/sun/star/beans/XPropertyState.hpp> +#include <com/sun/star/beans/PropertyState.hpp> #include <com/sun/star/drawing/BitmapMode.hpp> +#include <com/sun/star/drawing/Hatch.hpp> #include <svx/msdffdef.hxx> #include "svx/svxdllapi.h" @@ -1129,6 +1130,7 @@ class SVX_DLLPUBLIC EscherPropertyContainer sal_uInt32 ImplGetColor( const sal_uInt32 rColor, sal_Bool bSwap = sal_True ); void ImplCreateGraphicAttributes( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rXPropSet, sal_uInt32 nBlibId, sal_Bool bCreateCroppingAttributes ); + sal_Bool ImplCreateEmbeddedBmp( const ByteString& rUniqueId ); void ImplInit(); public : @@ -1157,9 +1159,12 @@ class SVX_DLLPUBLIC EscherPropertyContainer sal_Bool CreateOLEGraphicProperties( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > & rXOleObject ); - /** Creates a complex ESCHER_Prop_fillBlip, that contains the BLIP directly (for Excel charts). */ + /** Creates a complex ESCHER_Prop_fillBlip containing the BLIP directly (for Excel charts). */ sal_Bool CreateEmbeddedBitmapProperties( const ::rtl::OUString& rBitmapUrl, ::com::sun::star::drawing::BitmapMode eBitmapMode ); + /** Creates a complex ESCHER_Prop_fillBlip containing a hatch style (for Excel charts). */ + sal_Bool CreateEmbeddedHatchProperties( const ::com::sun::star::drawing::Hatch& rHatch, + const Color& rBackColor, bool bFillBackground ); // the GraphicProperties will only be created if a GraphicProvider and PicOutStrm is known // DR: #99897# if no GraphicProvider is present, a complex ESCHER_Prop_fillBlip diff --git a/svx/prj/d.lst b/svx/prj/d.lst index c18e5882e9..fb4fa6b2ea 100644 --- a/svx/prj/d.lst +++ b/svx/prj/d.lst @@ -555,6 +555,7 @@ mkdir: %_DEST%\inc%_EXT%\svx ..\inc\svx\SmartTagItem.hxx %_DEST%\inc%_EXT%\svx\SmartTagItem.hxx ..\inc\svx\SmartTagCtl.hxx %_DEST%\inc%_EXT%\svx\SmartTagCtl.hxx ..\inc\svx\databaselocationinput.hxx %_DEST%\inc%_EXT%\svx\databaselocationinput.hxx +..\inc\xlinjoit.hxx %_DEST%\inc%_EXT%\svx\xlinjoit.hxx mkdir: %_DEST%\inc%_EXT%\svx\sdr mkdir: %_DEST%\inc%_EXT%\svx\sdr\properties diff --git a/svx/source/msfilter/escherex.cxx b/svx/source/msfilter/escherex.cxx index dfbb3da9b3..b392b03912 100644 --- a/svx/source/msfilter/escherex.cxx +++ b/svx/source/msfilter/escherex.cxx @@ -1,13 +1,13 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2008 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: escherex.cxx,v $ - * $Revision: 1.77 $ + * $Revision: 1.77.64.1 $ * * This file is part of OpenOffice.org. * @@ -46,22 +46,19 @@ #include <tools/stream.hxx> #include <tools/zcodec.hxx> #include <svx/svdopath.hxx> -#ifndef _INC_STDLIB #include <stdlib.h> -#endif #include <svtools/filter.hxx> #include "../customshapes/EnhancedCustomShapeTypeNames.hxx" #include "../customshapes/EnhancedCustomShapeGeometry.hxx" #include <EnhancedCustomShapeFunctionParser.hxx> #include "../customshapes/EnhancedCustomShape2d.hxx" #include <com/sun/star/beans/PropertyValues.hpp> +#include <com/sun/star/beans/XPropertyState.hpp> #include <com/sun/star/awt/GradientStyle.hpp> #include <com/sun/star/awt/RasterOperation.hpp> #include <com/sun/star/awt/Gradient.hpp> #include <com/sun/star/drawing/LineStyle.hpp> -#ifndef _COM_SUN_STAR_DRAWING_LINEJOINT_Hpp_ #include <com/sun/star/drawing/LineJoint.hpp> -#endif #include <com/sun/star/drawing/FillStyle.hpp> #include <com/sun/star/drawing/LineDash.hpp> #include <com/sun/star/drawing/BezierPoint.hpp> @@ -72,30 +69,21 @@ #include <com/sun/star/drawing/PointSequence.hpp> #include <com/sun/star/drawing/FlagSequence.hpp> #include <com/sun/star/drawing/PolygonFlags.hpp> -#ifndef _COM_SUN_STAR_TEXT_WRITINGMODE_HDL_ #include <com/sun/star/text/WritingMode.hpp> -#endif #include <com/sun/star/drawing/TextVerticalAdjust.hpp> #include <com/sun/star/drawing/TextHorizontalAdjust.hpp> -#ifndef _COM_SUN_STAR_DRAWING_ENHANCEDCUSTOMSHAPEPARAMETERPARIR_HPP_ #include <com/sun/star/drawing/EnhancedCustomShapeParameterPair.hpp> -#endif #include <com/sun/star/drawing/EnhancedCustomShapeSegment.hpp> #include <com/sun/star/drawing/EnhancedCustomShapeParameterType.hpp> #include <com/sun/star/drawing/EnhancedCustomShapeGluePointType.hpp> -#ifndef _COM_SUN_STAR_DRAWING_ENHANCEDCUSTOMSHAPESEGMENTCOMMAND_hpp_ #include <com/sun/star/drawing/EnhancedCustomShapeSegmentCommand.hpp> -#endif #include <com/sun/star/drawing/EnhancedCustomShapeTextFrame.hpp> #include <com/sun/star/drawing/EnhancedCustomShapeAdjustmentValue.hpp> #include <com/sun/star/drawing/EnhancedCustomShapeTextPathMode.hpp> #include <com/sun/star/drawing/ProjectionMode.hpp> #include <com/sun/star/text/XSimpleText.hpp> #include <com/sun/star/drawing/ShadeMode.hpp> -#ifndef _SV_HATCH_HXX_ #include <vcl/hatch.hxx> -#endif -#include <com/sun/star/drawing/Hatch.hpp> #include <com/sun/star/awt/XGraphics.hpp> #include <com/sun/star/awt/FontSlant.hpp> #include <com/sun/star/awt/FontWeight.hpp> @@ -103,14 +91,10 @@ #include <com/sun/star/drawing/Position3D.hpp> #include <com/sun/star/drawing/Direction3D.hpp> #include <com/sun/star/text/GraphicCrop.hpp> -#ifndef _UNOTOOLS_UCBSTREAMHELPER_HXX #include <unotools/ucbstreamhelper.hxx> -#endif #include <unotools/localfilehelper.hxx> #include <comphelper/extract.hxx> -#ifndef _TOOLKIT_UNOHLP_HXX #include <toolkit/unohlp.hxx> -#endif #include <vcl/virdev.hxx> #include <rtl/crc.h> #include <vos/xception.hxx> @@ -1157,6 +1141,27 @@ sal_Bool EscherPropertyContainer::CreateOLEGraphicProperties( } +sal_Bool EscherPropertyContainer::ImplCreateEmbeddedBmp( const ByteString& rUniqueId ) +{ + if( rUniqueId.Len() > 0 ) + { + EscherGraphicProvider aProvider; + SvMemoryStream aMemStrm; + Rectangle aRect; + if ( aProvider.GetBlibID( aMemStrm, rUniqueId, aRect ) ) + { + // grab BLIP from stream and insert directly as complex property + // ownership of stream memory goes to complex property + aMemStrm.ObjectOwnsMemory( FALSE ); + sal_uInt8* pBuf = (sal_uInt8*) aMemStrm.GetData(); + sal_uInt32 nSize = aMemStrm.Seek( STREAM_SEEK_TO_END ); + AddOpt( ESCHER_Prop_fillBlip, sal_True, nSize, pBuf, nSize ); + return sal_True; + } + } + return sal_False; +} + sal_Bool EscherPropertyContainer::CreateEmbeddedBitmapProperties( const ::rtl::OUString& rBitmapUrl, ::com::sun::star::drawing::BitmapMode eBitmapMode ) { @@ -1171,21 +1176,9 @@ sal_Bool EscherPropertyContainer::CreateEmbeddedBitmapProperties( if( aBmpUrl.Len() > nIndex ) { ByteString aUniqueId( aBmpUrl, nIndex, aBmpUrl.Len() - nIndex, RTL_TEXTENCODING_UTF8 ); - if( aUniqueId.Len() > 0 ) + bRetValue = ImplCreateEmbeddedBmp( aUniqueId ); + if( bRetValue ) { - EscherGraphicProvider aProvider; - SvMemoryStream aMemStrm; - Rectangle aRect; - if ( aProvider.GetBlibID( aMemStrm, aUniqueId, aRect ) ) - { - // grab BLIP from stream and insert directly as complex property - // ownership of stream memory goes to complex property - aMemStrm.ObjectOwnsMemory( FALSE ); - sal_uInt8* pBuf = (sal_uInt8*) aMemStrm.GetData(); - sal_uInt32 nSize = aMemStrm.Seek( STREAM_SEEK_TO_END ); - AddOpt( ESCHER_Prop_fillBlip, sal_True, nSize, pBuf, nSize ); - bRetValue = sal_True; - } // bitmap mode property bool bRepeat = eBitmapMode == ::com::sun::star::drawing::BitmapMode_REPEAT; AddOpt( ESCHER_Prop_fillType, bRepeat ? ESCHER_FillTexture : ESCHER_FillPicture ); @@ -1196,6 +1189,44 @@ sal_Bool EscherPropertyContainer::CreateEmbeddedBitmapProperties( } +namespace { + +GraphicObject lclDrawHatch( const ::com::sun::star::drawing::Hatch& rHatch, const Color& rBackColor, bool bFillBackground ) +{ + const MapMode aMap100( MAP_100TH_MM ); + VirtualDevice aVDev( *Application::GetDefaultDevice(), 0, 1 ); + aVDev.SetMapMode( aMap100 ); + + const Size aOutSize = aVDev.PixelToLogic( Size( 28, 28 ) ); + aVDev.SetOutputSize( aOutSize ); + + Rectangle aRectangle( Point( 0, 0 ), aOutSize ); + const PolyPolygon aPolyPoly( aRectangle ); + + aVDev.SetLineColor(); + aVDev.SetFillColor( bFillBackground ? rBackColor : Color( COL_TRANSPARENT ) ); + aVDev.DrawRect( Rectangle( Point(), aOutSize ) ); + + Hatch aVclHatch( (HatchStyle) rHatch.Style, Color( rHatch.Color ), rHatch.Distance, (sal_uInt16)rHatch.Angle ); + aVDev.DrawHatch( aPolyPoly, aVclHatch ); + + return GraphicObject( Graphic( aVDev.GetBitmapEx( Point(), aOutSize ) ) ); +} + +} // namespace + + +sal_Bool EscherPropertyContainer::CreateEmbeddedHatchProperties( const ::com::sun::star::drawing::Hatch& rHatch, const Color& rBackColor, bool bFillBackground ) +{ + GraphicObject aGraphicObject = lclDrawHatch( rHatch, rBackColor, bFillBackground ); + ByteString aUniqueId = aGraphicObject.GetUniqueID(); + sal_Bool bRetValue = ImplCreateEmbeddedBmp( aUniqueId ); + if ( bRetValue ) + AddOpt( ESCHER_Prop_fillType, ESCHER_FillTexture ); + return bRetValue; +} + + sal_Bool EscherPropertyContainer::CreateGraphicProperties( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rXPropSet, const String& rSource, const sal_Bool bCreateFillBitmap, const sal_Bool bCreateCroppingAttributes, @@ -1270,58 +1301,22 @@ sal_Bool EscherPropertyContainer::CreateGraphicProperties( ::com::sun::star::drawing::Hatch aHatch; if ( aAny >>= aHatch ) { - sal_Bool bBackground = sal_False; + Color aBackColor; if ( EscherPropertyValueHelper::GetPropertyValue( aAny, rXPropSet, - String( RTL_CONSTASCII_USTRINGPARAM( "FillBackground" ) ), sal_True ) ) + String( RTL_CONSTASCII_USTRINGPARAM( "FillColor" ) ), sal_False ) ) { - aAny >>= bBackground; + aBackColor = ImplGetColor( *((sal_uInt32*)aAny.getValue()), sal_False ); } - - const MapMode aMap100( MAP_100TH_MM ); - VirtualDevice aVDev; - const Size aOutSize( aVDev.PixelToLogic( Size( 28, 28 ), aMap100 ) ); - - if( aVDev.SetOutputSize( aOutSize ) ) + bool bFillBackground = false; + if ( EscherPropertyValueHelper::GetPropertyValue( aAny, rXPropSet, + String( RTL_CONSTASCII_USTRINGPARAM( "FillBackground" ) ), sal_True ) ) { - Rectangle aRectangle = Rectangle( Point(), aOutSize ); - const PolyPolygon aPolyPoly( aRectangle ); - Hatch aVclHatch( (HatchStyle) aHatch.Style, Color( aHatch.Color ), aHatch.Distance, (sal_uInt16)aHatch.Angle ); - - if ( bBackground ) - { - if ( EscherPropertyValueHelper::GetPropertyValue( aAny, rXPropSet, - String( RTL_CONSTASCII_USTRINGPARAM( "FillColor" ) ), sal_False ) ) - { - aVDev.SetLineColor(); - aVDev.SetFillColor( ImplGetColor( *((sal_uInt32*)aAny.getValue()), sal_False ) ); - aVDev.DrawRect( Rectangle( Point(), aOutSize ) ); - } - } - aVDev.SetMapMode( aMap100 ); - aVDev.DrawHatch( aPolyPoly, aVclHatch ); - Bitmap aBitmap( aVDev.GetBitmap( Point(), aOutSize ) ); - - if ( bBackground ) - aGraphicObject = Graphic( aBitmap ); - else - { - VirtualDevice aMaskVDev( 1 ); - aMaskVDev.SetMapMode( aMap100 ); - if( aMaskVDev.SetOutputSize( aOutSize ) ) - { - aVclHatch.SetColor( Color( COL_BLACK ) ); - aMaskVDev.DrawHatch( aPolyPoly, aVclHatch ); - Graphic aGraphic( BitmapEx( aBitmap, aMaskVDev.GetBitmap( Point(), aOutSize ) ) ); - aGraphicObject = aGraphic; - } - else - aGraphicObject = Graphic( aBitmap ); - - } - eBitmapMode = ::com::sun::star::drawing::BitmapMode_REPEAT; - aUniqueId = aGraphicObject.GetUniqueID(); - bIsGraphicMtf = aGraphicObject.GetType() == GRAPHIC_GDIMETAFILE; + aAny >>= bFillBackground; } + aGraphicObject = lclDrawHatch( aHatch, aBackColor, bFillBackground ); + aUniqueId = aGraphicObject.GetUniqueID(); + eBitmapMode = ::com::sun::star::drawing::BitmapMode_REPEAT; + bIsGraphicMtf = aGraphicObject.GetType() == GRAPHIC_GDIMETAFILE; } } @@ -1365,8 +1360,8 @@ sal_Bool EscherPropertyContainer::CreateGraphicProperties( const USHORT nFormat = aDescriptor.GetFileFormat(); // can MSO handle it? - if ( bMirrored || nAngle || - (nFormat != GFF_BMP && + if ( bMirrored || nAngle || + (nFormat != GFF_BMP && nFormat != GFF_GIF && nFormat != GFF_JPG && nFormat != GFF_PNG && @@ -1381,7 +1376,7 @@ sal_Bool EscherPropertyContainer::CreateGraphicProperties( { Graphic aGraphic; sal_uInt32 nErrCode = GraphicConverter::Import( *pIn, aGraphic ); - + if ( nErrCode == ERRCODE_NONE ) { // no. @@ -1469,7 +1464,7 @@ sal_Bool EscherPropertyContainer::CreateGraphicProperties( AddOpt( ESCHER_Prop_pibName, aGraphicUrl ); sal_uInt32 nPibFlags=0; GetOpt( ESCHER_Prop_pibFlags, nPibFlags ); - AddOpt( ESCHER_Prop_pibFlags, + AddOpt( ESCHER_Prop_pibFlags, ESCHER_BlipFlagLinkToFile|ESCHER_BlipFlagFile|ESCHER_BlipFlagDoNotSave | nPibFlags ); } } |