diff options
author | Muthu Subramanian <sumuthu@novell.com> | 2011-08-23 14:01:37 +0530 |
---|---|---|
committer | Muthu Subramanian <sumuthu@novell.com> | 2011-08-23 14:14:43 +0530 |
commit | b6768c50736c6994e28de51c5f54cdadfd6f45f1 (patch) | |
tree | 68309f18ef3a7dc464ee2b666118cf295d4e0494 /oox | |
parent | 4432625b90bfd8b831e8a01bc5c380a1bf15fbc7 (diff) |
n#699334: Legacy Diagram Text import.
- Imports Legacy Text.
- Formatting info is not imported.
Diffstat (limited to 'oox')
-rw-r--r-- | oox/inc/oox/vml/vmlshape.hxx | 1 | ||||
-rw-r--r-- | oox/source/token/namespaces.hxx.tail | 1 | ||||
-rw-r--r-- | oox/source/token/properties.txt | 1 | ||||
-rw-r--r-- | oox/source/vml/vmldrawingfragment.cxx | 7 | ||||
-rw-r--r-- | oox/source/vml/vmlshape.cxx | 9 | ||||
-rw-r--r-- | oox/source/vml/vmlshapecontext.cxx | 19 |
6 files changed, 22 insertions, 16 deletions
diff --git a/oox/inc/oox/vml/vmlshape.hxx b/oox/inc/oox/vml/vmlshape.hxx index 819e6fa3bd02..a99654b8a367 100644 --- a/oox/inc/oox/vml/vmlshape.hxx +++ b/oox/inc/oox/vml/vmlshape.hxx @@ -179,6 +179,7 @@ struct ShapeModel PointVector maPoints; /// Points for the polyline shape. TextBoxPtr mxTextBox; /// Text contents and properties. ClientDataPtr mxClientData; /// Excel specific client data. + ::rtl::OUString maLegacyDiagramPath;/// Legacy Diagram Fragment Path explicit ShapeModel(); ~ShapeModel(); diff --git a/oox/source/token/namespaces.hxx.tail b/oox/source/token/namespaces.hxx.tail index 47702d9cb00d..b8eaae972074 100644 --- a/oox/source/token/namespaces.hxx.tail +++ b/oox/source/token/namespaces.hxx.tail @@ -31,6 +31,7 @@ inline sal_Int32 getNamespace( sal_Int32 nToken ) { return nToken & NMSP_MASK; } #define XLS_TOKEN( token ) OOX_TOKEN( xls, token ) #define XM_TOKEN( token ) OOX_TOKEN( xm, token ) #define XML_TOKEN( token ) OOX_TOKEN( xml, token ) +#define VMLPPT_TOKEN( token ) OOX_TOKEN( vmlPowerpoint, token ) // ============================================================================ diff --git a/oox/source/token/properties.txt b/oox/source/token/properties.txt index 06f86cf4d0cb..64c76b6a684a 100644 --- a/oox/source/token/properties.txt +++ b/oox/source/token/properties.txt @@ -257,6 +257,7 @@ LeftBorder LeftMargin LeftPageFooterContent LeftPageHeaderContent +LegacyFragment LineColor LineCount LineDash diff --git a/oox/source/vml/vmldrawingfragment.cxx b/oox/source/vml/vmldrawingfragment.cxx index 0f92632f0e00..12dd0a42fabf 100644 --- a/oox/source/vml/vmldrawingfragment.cxx +++ b/oox/source/vml/vmldrawingfragment.cxx @@ -50,13 +50,6 @@ DrawingFragment::DrawingFragment( XmlFilterBase& rFilter, const OUString& rFragm FragmentHandler2( rFilter, rFragmentPath, false ), // do not trim whitespace, has been preprocessed by the input stream mrDrawing( rDrawing ) { - RelationsRef xLegacyRels = getRelations().getRelationsFromType( CREATE_MSOFFICE_RELATION_TYPE( "legacyDiagramText" ) ); - for( Relations::const_iterator aIt = xLegacyRels->begin(), aEnd = xLegacyRels->end(); aIt != aEnd; ++aIt ) - { - OUString aLegacyFragmentPath = getFragmentPathFromRelation( aIt->second ); - // TODO: import legacyDiagramText from aLegacyFragmentPath - this is a binary import. - // printf("legacyDiagram: %s\n", ::rtl::OUStringToOString( aLegacyFragmentPath, RTL_TEXTENCODING_UTF8).getStr()); - } } Reference< XInputStream > DrawingFragment::openFragmentStream() const diff --git a/oox/source/vml/vmlshape.cxx b/oox/source/vml/vmlshape.cxx index 32f957cca9a3..b9bd65301b2c 100644 --- a/oox/source/vml/vmlshape.cxx +++ b/oox/source/vml/vmlshape.cxx @@ -70,6 +70,7 @@ using namespace ::com::sun::star::awt; using namespace ::com::sun::star::drawing; using namespace ::com::sun::star::graphic; using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::io; using ::oox::core::XmlFilterBase; using ::rtl::OUString; @@ -423,6 +424,14 @@ Reference< XShape > SimpleShape::implConvertAndInsert( const Reference< XShapes { Reference< XShape > xShape = mrDrawing.createAndInsertXShape( maService, rxShapes, rShapeRect ); convertShapeProperties( xShape ); + + // Import Legacy Fragments (if any) + if( xShape.is() && !maShapeModel.maLegacyDiagramPath.isEmpty() ) + { + Reference< XInputStream > xInStrm( mrDrawing.getFilter().openInputStream( maShapeModel.maLegacyDiagramPath ), UNO_SET_THROW ); + if( xInStrm.is() ) + PropertySet( xShape ).setProperty( PROP_LegacyFragment, xInStrm ); + } return xShape; } diff --git a/oox/source/vml/vmlshapecontext.cxx b/oox/source/vml/vmlshapecontext.cxx index 591fc2a91ce1..6980ce34541c 100644 --- a/oox/source/vml/vmlshapecontext.cxx +++ b/oox/source/vml/vmlshapecontext.cxx @@ -365,18 +365,23 @@ ShapeContext::ShapeContext( ContextHandler2Helper& rParent, ShapeBase& rShape, c ContextHandlerRef ShapeContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ) { - // Custom shape in Writer with a textbox are transformed into a frame - if ( nElement == ( NMSP_vml + XML_textbox ) ) - dynamic_cast<SimpleShape&>( mrShape ).setService( - OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.TextFrame")) ); - // Excel specific shape client data if( isRootElement() ) switch( nElement ) { case VML_TOKEN( textbox ): + // Custom shape in Writer with a textbox are transformed into a frame + dynamic_cast<SimpleShape&>( mrShape ).setService( + OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.TextFrame"))); return new TextBoxContext( *this, mrShapeModel.createTextBox(), rAttribs ); case VMLX_TOKEN( ClientData ): return new ClientDataContext( *this, mrShapeModel.createClientData(), rAttribs ); + case VMLPPT_TOKEN( textdata ): + // Force RectangleShape, this is ugly :( + // and is there because of the lines above which change it to TextFrame + dynamic_cast< SimpleShape& >( mrShape ).setService( + OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.RectangleShape"))); + mrShapeModel.maLegacyDiagramPath = getFragmentPathFromRelId(rAttribs.getString(XML_id, OUString())); + break; } // handle remaining stuff in base class return ShapeTypeContext::onCreateContext( nElement, rAttribs ); @@ -419,10 +424,6 @@ RectangleShapeContext::RectangleShapeContext( ContextHandler2Helper& rParent, co ContextHandlerRef RectangleShapeContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ) { - if ( nElement == ( NMSP_vml + XML_textbox ) ) - dynamic_cast< SimpleShape &>( mrShape ).setService( - OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.TextFrame")) ); - // The parent class's context is fine return ShapeContext::onCreateContext( nElement, rAttribs ); } |