diff options
author | Eilidh McAdam <eilidh@lanedo.com> | 2012-09-19 10:01:57 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@suse.cz> | 2012-09-19 14:04:21 +0000 |
commit | 0423a6741fc08a35b123556f9b10219d090ee42a (patch) | |
tree | ad7f4b50ddd951f65cd7a79ba4d39a719982998f /oox/inc/oox/vml | |
parent | 891746ed955b110960113ba0de3a51335af50d66 (diff) |
Import bezier curves from .docx.
A shape element with a path attribute is interpreted as a bezier. We can
support both curve and line commands by using the correct co-ordinate
flags when using the UNO interface (omit control points for lines).
Alternatively, curves may be specified using the to, from, control1 and
control2 attributes of a curve element.
Note that when setting the PolyPolygonBezier property of the xshape, the
shape size and position are set too large somehow. The workaround for
now is manually forcing the pre-calculated shape size and position.
Change-Id: If3563474df357d161a2ed2e7a20856d5aed80a94
Reviewed-on: https://gerrit.libreoffice.org/649
Reviewed-by: Miklos Vajna <vmiklos@suse.cz>
Tested-by: Miklos Vajna <vmiklos@suse.cz>
Diffstat (limited to 'oox/inc/oox/vml')
-rw-r--r-- | oox/inc/oox/vml/vmlshape.hxx | 19 | ||||
-rw-r--r-- | oox/inc/oox/vml/vmlshapecontext.hxx | 6 |
2 files changed, 25 insertions, 0 deletions
diff --git a/oox/inc/oox/vml/vmlshape.hxx b/oox/inc/oox/vml/vmlshape.hxx index 8fab5f7ec92d..5bdc2b51e486 100644 --- a/oox/inc/oox/vml/vmlshape.hxx +++ b/oox/inc/oox/vml/vmlshape.hxx @@ -185,6 +185,9 @@ struct ShapeModel ::rtl::OUString maLegacyDiagramPath;///< Legacy Diagram Fragment Path ::rtl::OUString maFrom; ///< Start point for line shape. ::rtl::OUString maTo; ///< End point for line shape. + ::rtl::OUString maControl1; ///< Bezier control point 1 + ::rtl::OUString maControl2; ///< Bezier control point 2 + ::rtl::OUString maVmlPath; ///< VML path for this shape explicit ShapeModel(); ~ShapeModel(); @@ -334,6 +337,22 @@ protected: const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& rxShapes, const ::com::sun::star::awt::Rectangle& rShapeRect ) const; }; + +/** Bezier shape object that supports to, from, control1 and control2 + attribute or path attribute specification */ +class BezierShape : public SimpleShape +{ +public: + explicit BezierShape( Drawing& rDrawing ); + +protected: + /** Creates the corresponding XShape and inserts it into the passed container. */ + virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > + implConvertAndInsert( + const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& rxShapes, + const ::com::sun::star::awt::Rectangle& rShapeRect ) const; +}; + // ============================================================================ /** A shape object with custom geometry. */ diff --git a/oox/inc/oox/vml/vmlshapecontext.hxx b/oox/inc/oox/vml/vmlshapecontext.hxx index 358f8fedd706..e3d5d8963eb2 100644 --- a/oox/inc/oox/vml/vmlshapecontext.hxx +++ b/oox/inc/oox/vml/vmlshapecontext.hxx @@ -134,6 +134,12 @@ private: void setFrom( const ::rtl::OUString& rPoints ); /** Processes the 'to' attribute. */ void setTo( const ::rtl::OUString& rPoints ); + /** Processes the 'control1' attribute. */ + void setControl1( const ::rtl::OUString& rPoints ); + /** Processes the 'control2' attribute. */ + void setControl2( const ::rtl::OUString& rPoints ); + /** Processes the 'path' attribute. */ + void setVmlPath( const ::rtl::OUString& rPath ); protected: ShapeBase& mrShape; |