diff options
author | Jacobo Aragunde Pérez <jaragunde@igalia.com> | 2014-04-30 19:00:43 +0200 |
---|---|---|
committer | Jacobo Aragunde Pérez <jaragunde@igalia.com> | 2014-05-06 16:32:27 +0200 |
commit | 8d2a5c16c7e487b407aced891da17e5c2486f2ff (patch) | |
tree | e643c2073c2a073cded910039a611f47b4709390 | |
parent | 9bb6956197c5caaa150fc8ed52233741749a4060 (diff) |
oox: Integrate Shape3DProperties and Scene3DPropertiesContext
Code for these two classes was already present but it was commented
out or left outside of the build system because it didn't even
compile. I've brought it back and made it compile, but it has no use
yet. The goal is using it to preserve 3D transformations.
At scene3dcontext.cxx I removed the text chunks found in the middle
of the source and corrected some mistakes; I also modified the
conversion of "fov" attribute.
At shape3dproperties.hxx I removed all the struct members because
they seemed to have been copied&pasted from another file, and added
only those members that made sense. Removed useless function
definitions.
Change-Id: I2c00ea638e1a4fb1a3820bc4c322488296d3e6d7
-rw-r--r-- | include/oox/drawingml/scene3dcontext.hxx | 1 | ||||
-rw-r--r-- | include/oox/drawingml/shape3dproperties.hxx | 77 | ||||
-rw-r--r-- | oox/Library_oox.mk | 1 | ||||
-rw-r--r-- | oox/source/drawingml/scene3dcontext.cxx | 123 | ||||
-rw-r--r-- | oox/source/drawingml/shape.cxx | 1 | ||||
-rw-r--r-- | oox/source/drawingml/shapepropertiescontext.cxx | 2 |
6 files changed, 17 insertions, 188 deletions
diff --git a/include/oox/drawingml/scene3dcontext.hxx b/include/oox/drawingml/scene3dcontext.hxx index 2ebe581270c0..bbee4e677b9f 100644 --- a/include/oox/drawingml/scene3dcontext.hxx +++ b/include/oox/drawingml/scene3dcontext.hxx @@ -21,6 +21,7 @@ #define INCLUDED_OOX_DRAWINGML_SCENE3DCONTEXT_HXX #include <oox/core/contexthandler2.hxx> +#include "oox/drawingml/shape3dproperties.hxx" namespace oox { namespace drawingml { diff --git a/include/oox/drawingml/shape3dproperties.hxx b/include/oox/drawingml/shape3dproperties.hxx index 24c22afbd744..d39aee8dc400 100644 --- a/include/oox/drawingml/shape3dproperties.hxx +++ b/include/oox/drawingml/shape3dproperties.hxx @@ -36,83 +36,16 @@ namespace drawingml { -struct Shape3DPropertyNames -{ - OUString maFillStyle; - OUString maFillColor; - OUString maFillTransparence; - OUString maFillGradient; - OUString maFillBitmap; - OUString maFillBitmapMode; - OUString maFillBitmapTile; - OUString maFillBitmapStretch; - OUString maFillBitmapLogicalSize; - OUString maFillBitmapSizeX; - OUString maFillBitmapSizeY; - OUString maFillBitmapOffsetX; - OUString maFillBitmapOffsetY; - OUString maFillBitmapRectanglePoint; - bool mbNamedFillGradient; - bool mbNamedFillBitmap; - bool mbTransformGraphic; - - Shape3DPropertyNames(); -}; - - - struct Shape3DProperties { - typedef ::std::map< double, Color > GradientStopMap; - - OptValue< sal_Int32 > moFillType; /// Fill type (OOXML token). - OptValue< bool > moRotateWithShape; /// True = rotate gradient/bitmap with shape. - Color maFillColor; /// Solid fill color and transparence. - GradientStopMap maGradientStops; /// Gradient stops (colors/transparence). - OptValue< sal_Int32 > moGradientPath; /// If set, gradient follows rectangle, circle, or shape. - OptValue< sal_Int32 > moShadeAngle; /// Rotation angle of linear gradients. - OptValue< bool > moShadeScaled; - OptValue< sal_Int32 > moFlipModeToken; - OptValue< com::sun::star::geometry::IntegerRectangle2D > moFillToRect; - OptValue< com::sun::star::geometry::IntegerRectangle2D > moTileRect; - OptValue< sal_Int32 > moPattPreset; /// Preset pattern type. - Color maPattFgColor; /// Pattern foreground color. - Color maPattBgColor; /// Pattern background color. - ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic > mxGraphic; - Color maColorChangeFrom; /// Start color of color transformation. - Color maColorChangeTo; /// Destination color of color transformation. - OptValue< sal_Int32 > moBitmapMode; /// Bitmap tile or stretch. - OptValue< sal_Int32 > moTileX; /// Width of bitmap tiles. - OptValue< sal_Int32 > moTileY; /// Height of bitmap tiles. - OptValue< sal_Int32 > moTileSX; - OptValue< sal_Int32 > moTileSY; - OptValue< sal_Int32 > moTileAlign; /// Anchor point inside bitmap. - - static Shape3DPropertyNames DEFAULTNAMES; /// Default fill property names for shape fill. - static Shape3DPropertyNames DEFAULTPICNAMES; /// Default fill property names for pictures. + OptValue< sal_Int32 > mnPreset; + OptValue< float > mfFieldOfVision; + OptValue< float > mfZoom; + OptValue< sal_Int32 > mnLightRigDirection; + OptValue< sal_Int32 > mnLightRigType; /** Overwrites all members that are explicitly set in rSourceProps. */ void assignUsed( const Shape3DProperties& rSourceProps ); - - /** Tries to resolve current settings to a solid color, e.g. returns the - start color of a gradient. */ - Color getBestSolidColor() const; - - /** Writes the properties to the passed property map. */ - void pushToPropMap( - PropertyMap& rPropMap, - const Shape3DPropertyNames& rPropNames, - const ::oox::core::XmlFilterBase& rFilter, - ::oox::core::ModelObjectContainer& rObjContainer, - sal_Int32 nShapeRotation, sal_Int32 nPhClr ) const; - - /** Writes the properties to the passed property set. */ - void pushToPropSet( - PropertySet& rPropSet, - const Shape3DPropertyNames& rPropNames, - const ::oox::core::XmlFilterBase& rFilter, - ::oox::core::ModelObjectContainer& rObjContainer, - sal_Int32 nShapeRotation, sal_Int32 nPhClr ) const; }; diff --git a/oox/Library_oox.mk b/oox/Library_oox.mk index 791c2f0d543e..4df15bc223a4 100644 --- a/oox/Library_oox.mk +++ b/oox/Library_oox.mk @@ -153,6 +153,7 @@ $(eval $(call gb_Library_add_exception_objects,oox,\ oox/source/drawingml/linepropertiescontext \ oox/source/drawingml/lineproperties \ oox/source/drawingml/objectdefaultcontext \ + oox/source/drawingml/scene3dcontext \ oox/source/drawingml/shapecontext \ oox/source/drawingml/shape \ oox/source/drawingml/shape3dproperties \ diff --git a/oox/source/drawingml/scene3dcontext.cxx b/oox/source/drawingml/scene3dcontext.cxx index 24323ef37e50..bc0c1b96e27e 100644 --- a/oox/source/drawingml/scene3dcontext.cxx +++ b/oox/source/drawingml/scene3dcontext.cxx @@ -25,146 +25,39 @@ #include "oox/drawingml/colorchoicecontext.hxx" #include "oox/drawingml/drawingmltypes.hxx" #include "oox/drawingml/fillproperties.hxx" -#include "oox/core/namespaces.hxx" #include "oox/core/xmlfilterbase.hxx" #include "oox/helper/attributelist.hxx" -using ::oox::core::ContextHandler; -using ::oox::core::XmlFilterBase; +using namespace ::oox::core; using namespace ::com::sun::star; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::xml::sax; namespace oox { namespace drawingml { -Scene3DContext::Scene3DContext( ContextHandler2Helper& rParent, Shape3DProperties& r3DProperties ) throw() +Scene3DPropertiesContext::Scene3DPropertiesContext( ContextHandler2Helper& rParent, Shape3DProperties& r3DProperties ) throw() : ContextHandler2( rParent ) , mr3DProperties( r3DProperties ) { } -ContextHandlerRef Scene3DContext::onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs ) +ContextHandlerRef Scene3DPropertiesContext::onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs ) { switch( aElementToken ) { - case NMSP_DRAWINGML|XML_camera: - mr3DProperties.mfFieldOfVision = rAttribs.getInteger( XML_fov, 0 ) / 36000000.0; + case A_TOKEN( camera ): + mr3DProperties.mfFieldOfVision = rAttribs.getInteger( XML_fov, 0 ) / 60000.0; // 60000ths of degree mr3DProperties.mfZoom = rAttribs.getInteger( XML_zoom, 100000 ) / 100000.0; mr3DProperties.mnPreset = rAttribs.getToken( XML_prst, XML_none ); - -legacyObliqueTopLeft -legacyObliqueTop -legacyObliqueTopRight -legacyObliqueLeft -legacyObliqueFront -legacyObliqueRight -legacyObliqueBottomLeft -legacyObliqueBottom -legacyObliqueBottomRight -legacyPerspectiveTopLeft -legacyPerspectiveTop -legacyPerspectiveTopRight -legacyPerspectiveLeft -legacyPerspectiveFront -legacyPerspectiveRight -legacyPerspectiveBottomLeft -legacyPerspectiveBottom -legacyPerspectiveBottomRight -orthographicFront -isometricTopUp -isometricTopDown -isometricBottomUp -isometricBottomDown -isometricLeftUp -isometricLeftDown -isometricRightUp -isometricRightDown -isometricOffAxis1Left -isometricOffAxis1Right -isometricOffAxis1Top -isometricOffAxis2Left -isometricOffAxis2Right -isometricOffAxis2Top -isometricOffAxis3Left -isometricOffAxis3Right -isometricOffAxis3Bottom -isometricOffAxis4Left -isometricOffAxis4Right -isometricOffAxis4Bottom -obliqueTopLeft -obliqueTop -obliqueTopRight -obliqueLeft -obliqueRight -obliqueBottomLeft -obliqueBottom -obliqueBottomRight -perspectiveFront -perspectiveLeft -perspectiveRight -perspectiveAbove -perspectiveBelow -perspectiveAboveLeftFacing -perspectiveAboveRightFacing -perspectiveContrastingLeftFacing -perspectiveContrastingRightFacing -perspectiveHeroicLeftFacing -perspectiveHeroicRightFacing -perspectiveHeroicExtremeLeftFacing -perspectiveHeroicExtremeRightFacing -perspectiveRelaxed -perspectiveRelaxedModerately - - // TODO: nested element XML_rot break; - case NMSP_DRAWINGML|XML_lightRig: + case A_TOKEN( lightRig ): mr3DProperties.mnLightRigDirection = rAttribs.getToken( XML_dir, XML_none ); - -XML_tl -XML_t -XML_tr -XML_l -XML_r -XML_bl -XML_b -XML_br - - mr3DProperties.mnLightRigType = rAttribs.getToken( XML_rig, XML_none ); - -XML_legacyFlat1 -XML_legacyFlat2 -XML_legacyFlat3 -XML_legacyFlat4 -XML_legacyNormal1 -XML_legacyNormal2 -XML_legacyNormal3 -XML_legacyNormal4 -XML_legacyHarsh1 -XML_legacyHarsh2 -XML_legacyHarsh3 -XML_legacyHarsh4 -XML_threePt -XML_balanced -XML_soft -XML_harsh -XML_flood -XML_contrasting -XML_morning -XML_sunrise -XML_sunset -XML_chilly -XML_freezing -XML_flat -XML_twoPt -XML_glow -XML_brightRoom - // TODO: nested element XML_rot break; - case NMSP_DRAWINGML|XML_backdrop: - case NMSP_DRAWINGML|XML_extLst: + case A_TOKEN( backdrop ): + case A_TOKEN( extLst ): return 0; // TODO: later (backdrop is not supported by core anyway) } return 0; diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx index fd5cb40ea5c5..4e06de08b21c 100644 --- a/oox/source/drawingml/shape.cxx +++ b/oox/source/drawingml/shape.cxx @@ -93,6 +93,7 @@ Shape::Shape( const sal_Char* pServiceName, bool bDefaultHeight ) , mpFillPropertiesPtr( new FillProperties ) , mpGraphicPropertiesPtr( new GraphicProperties ) , mpCustomShapePropertiesPtr( new CustomShapeProperties ) +, mp3DPropertiesPtr( new Shape3DProperties ) , mpEffectPropertiesPtr( new EffectProperties ) , mpMasterTextListStyle( new TextListStyle ) , mnSubType( 0 ) diff --git a/oox/source/drawingml/shapepropertiescontext.cxx b/oox/source/drawingml/shapepropertiescontext.cxx index 488f8a0dbe2f..10130d3e5eef 100644 --- a/oox/source/drawingml/shapepropertiescontext.cxx +++ b/oox/source/drawingml/shapepropertiescontext.cxx @@ -96,7 +96,7 @@ ContextHandlerRef ShapePropertiesContext::onCreateContext( sal_Int32 aElementTok // todo case A_TOKEN( scene3d ): // CT_Scene3D -// return new Scene3DContext( *this, rAttribs, *(mrShape.get3DShapeProperties()) ); + return new Scene3DPropertiesContext( *this, mrShape.get3DProperties() ); break; // todo |