diff options
-rw-r--r-- | filter/inc/filter/msfilter/msdffimp.hxx | 5 | ||||
-rw-r--r-- | filter/source/msfilter/msdffimp.cxx | 20 | ||||
-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 | ||||
-rw-r--r-- | sd/CppunitTest_sd_uimpress.mk | 1 | ||||
-rw-r--r-- | sd/Library_sd.mk | 1 | ||||
-rw-r--r-- | sd/source/ui/inc/unoprnms.hxx | 1 | ||||
-rw-r--r-- | sd/source/ui/unoidl/unoobj.cxx | 21 | ||||
-rw-r--r-- | svl/source/misc/strmadpt.cxx | 10 |
13 files changed, 64 insertions, 33 deletions
diff --git a/filter/inc/filter/msfilter/msdffimp.hxx b/filter/inc/filter/msfilter/msdffimp.hxx index 4b47231d87ed..48a9231c9f92 100644 --- a/filter/inc/filter/msfilter/msdffimp.hxx +++ b/filter/inc/filter/msfilter/msdffimp.hxx @@ -548,9 +548,6 @@ protected : virtual sal_uLong Calc_nBLIPPos( sal_uLong nOrgVal, sal_uLong nStreamPos ) const; virtual bool GetColorFromPalette(sal_uInt16 nNum, Color& rColor) const; - bool ReadDffString(SvStream& rSt, String& rTxt) const; - bool ReadObjText(SvStream& rSt, SdrObject* pObj) const; - // SJ: New implementation of ReadObjText is used by Fontwork objects, because // the old one does not properly import multiple paragraphs void ReadObjText( const String& rText, SdrObject* pObj ) const; @@ -642,6 +639,8 @@ public: static sal_Bool MakeContentStream( SotStorage * pStor, const GDIMetaFile & ); static sal_Bool ConvertToOle2( SvStream& rStm, sal_uInt32 nLen, const GDIMetaFile*, const SotStorageRef & rDest ); + static bool ReadDffString(SvStream& rSt, String& rTxt, DffRecordHeader aStrHd = DffRecordHeader()); + static bool ReadObjText(SvStream& rSt, SdrObject* pObj); void SetModel(SdrModel* pModel, long nApplicationScale); SdrModel* GetModel() const { return pSdrModel; } diff --git a/filter/source/msfilter/msdffimp.cxx b/filter/source/msfilter/msdffimp.cxx index 2ad6eb94d647..b2efee607b20 100644 --- a/filter/source/msfilter/msdffimp.cxx +++ b/filter/source/msfilter/msdffimp.cxx @@ -3738,11 +3738,10 @@ Color SvxMSDffManager::MSO_CLR_ToColor( sal_uInt32 nColorCode, sal_uInt16 nConte return aColor; } -bool SvxMSDffManager::ReadDffString(SvStream& rSt, String& rTxt) const +bool SvxMSDffManager::ReadDffString(SvStream& rSt, String& rTxt, DffRecordHeader aStrHd) { bool bRet=sal_False; - DffRecordHeader aStrHd; - if( !ReadCommonRecordHeader(aStrHd, rSt) ) + if( aStrHd.nRecType == 0x0 && !ReadCommonRecordHeader(aStrHd, rSt) ) rSt.Seek( aStrHd.nFilePos ); else if ( aStrHd.nRecType == DFF_PST_TextBytesAtom || aStrHd.nRecType == DFF_PST_TextCharsAtom ) { @@ -3829,7 +3828,7 @@ void SvxMSDffManager::ReadObjText( const String& rText, SdrObject* pObj ) const } } -bool SvxMSDffManager::ReadObjText(SvStream& rSt, SdrObject* pObj) const +bool SvxMSDffManager::ReadObjText(SvStream& rSt, SdrObject* pObj) { bool bRet=sal_False; SdrTextObj* pText = PTR_CAST(SdrTextObj, pObj); @@ -3838,7 +3837,7 @@ bool SvxMSDffManager::ReadObjText(SvStream& rSt, SdrObject* pObj) const DffRecordHeader aTextHd; if( !ReadCommonRecordHeader(aTextHd, rSt) ) rSt.Seek( aTextHd.nFilePos ); - else if ( aTextHd.nRecType==DFF_msofbtClientTextbox ) + else if ( aTextHd.nRecType==DFF_msofbtClientTextbox || aTextHd.nRecType == 0x1022 ) { bRet=sal_True; sal_uLong nRecEnd=aTextHd.GetRecEndFilePos(); @@ -3878,15 +3877,14 @@ bool SvxMSDffManager::ReadObjText(SvStream& rSt, SdrObject* pObj) const { switch (aHd.nRecType) { - //case TextHeaderAtom + default: + break; + //case DFF_PST_TextHeaderAtom: //case TextSpecInfoAtom case DFF_PST_TextBytesAtom: case DFF_PST_TextCharsAtom: - { - aHd.SeekToBegOfRecord(rSt); - ReadDffString(rSt, aText); - } - break; + ReadDffString(rSt, aText, aHd); + break; case DFF_PST_TextRulerAtom : { sal_uInt16 nLen = (sal_uInt16)aHd.nRecLen; 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 ); } diff --git a/sd/CppunitTest_sd_uimpress.mk b/sd/CppunitTest_sd_uimpress.mk index ef1079de2e43..43352bc3738c 100644 --- a/sd/CppunitTest_sd_uimpress.mk +++ b/sd/CppunitTest_sd_uimpress.mk @@ -57,6 +57,7 @@ $(eval $(call gb_CppunitTest_add_linked_libs,sd_uimpress,\ drawinglayer \ editeng \ i18nisolang1 \ + msfilter \ sal \ salhelper \ sb \ diff --git a/sd/Library_sd.mk b/sd/Library_sd.mk index b4a667c0db2c..0db115335d1c 100644 --- a/sd/Library_sd.mk +++ b/sd/Library_sd.mk @@ -75,6 +75,7 @@ $(eval $(call gb_Library_add_linked_libs,sd,\ drawinglayer \ editeng \ i18nisolang1 \ + msfilter \ oox \ sal \ salhelper \ diff --git a/sd/source/ui/inc/unoprnms.hxx b/sd/source/ui/inc/unoprnms.hxx index 79bad24858bc..60d68e28919a 100644 --- a/sd/source/ui/inc/unoprnms.hxx +++ b/sd/source/ui/inc/unoprnms.hxx @@ -69,6 +69,7 @@ #define UNO_NAME_OBJ_STYLE "Style" #define UNO_NAME_OBJ_MASTERDEPENDENT "IsPlaceholderDependent" #define UNO_NAME_OBJ_ANIMATIONPATH "AnimationPath" +#define UNO_NAME_OBJ_LEGACYFRAGMENT "LegacyFragment" #define UNO_NAME_LAYER_LOCKED "IsLocked" #define UNO_NAME_LAYER_PRINTABLE "IsPrintable" diff --git a/sd/source/ui/unoidl/unoobj.cxx b/sd/source/ui/unoidl/unoobj.cxx index cd3e5a518027..98369509968f 100644 --- a/sd/source/ui/unoidl/unoobj.cxx +++ b/sd/source/ui/unoidl/unoobj.cxx @@ -56,6 +56,8 @@ #include <svx/svdopath.hxx> #include <svx/svdoole2.hxx> #include <svx/svdograf.hxx> +#include <filter/msfilter/msdffimp.hxx> +#include <svl/instrm.hxx> #include <editeng/outlobj.hxx> #include "CustomAnimationPreset.hxx" #include "Outliner.hxx" @@ -133,19 +135,19 @@ static SdTypesCache gImplTypesCache; #define WID_ANIMPATH 16 #define WID_IMAGEMAP 17 #define WID_ISANIMATION 18 +#define WID_THAT_NEED_ANIMINFO 19 #define WID_ISEMPTYPRESOBJ 20 #define WID_ISPRESOBJ 21 #define WID_MASTERDEPEND 22 #define WID_NAVORDER 23 - -#define WID_THAT_NEED_ANIMINFO 19 - #define WID_PLACEHOLDERTEXT 24 +#define WID_LEGACYFRAGMENT 25 #define IMPRESS_MAP_ENTRIES \ + { MAP_CHAR_LEN(UNO_NAME_OBJ_LEGACYFRAGMENT),WID_LEGACYFRAGMENT, &ITYPE(drawing::XShape), 0, 0},\ { MAP_CHAR_LEN(UNO_NAME_OBJ_ANIMATIONPATH), WID_ANIMPATH, &ITYPE(drawing::XShape), 0, 0},\ { MAP_CHAR_LEN(UNO_NAME_OBJ_BOOKMARK), WID_BOOKMARK, &::getCppuType((const OUString*)0), 0, 0},\ { MAP_CHAR_LEN(UNO_NAME_OBJ_DIMCOLOR), WID_DIMCOLOR, &::getCppuType((const sal_Int32*)0), 0, 0},\ @@ -632,6 +634,18 @@ void SAL_CALL SdXShape::setPropertyValue( const ::rtl::OUString& aPropertyName, SetMasterDepend( ::cppu::any2bool(aValue) ); break; + case WID_LEGACYFRAGMENT: + { + uno::Reference< io::XInputStream > xInputStream; + aValue >>= xInputStream; + if( xInputStream.is() ) + { + SvInputStream aStream( xInputStream ); + SdrObject* pObject = mpShape->GetSdrObject(); + SvxMSDffManager::ReadObjText( aStream, pObject ); + } + } + break; // TODO: WID_ANIMPATH case WID_IMAGEMAP: { @@ -658,6 +672,7 @@ void SAL_CALL SdXShape::setPropertyValue( const ::rtl::OUString& aPropertyName, } } } + break; } } } diff --git a/svl/source/misc/strmadpt.cxx b/svl/source/misc/strmadpt.cxx index 79adbb551d02..84fc56688828 100644 --- a/svl/source/misc/strmadpt.cxx +++ b/svl/source/misc/strmadpt.cxx @@ -639,6 +639,16 @@ sal_uLong SvInputStream::SeekPos(sal_uLong nPos) m_nSeekedFrom = STREAM_SEEK_TO_END; return nPos; } + else if ( nPos > Tell() ) + { + // Read out the bytes + sal_Int32 nRead = nPos - Tell(); + uno::Sequence< sal_Int8 > aBuffer; + m_xStream->readBytes( aBuffer, nRead ); + return nPos; + } + else if ( nPos == Tell() ) + return nPos; } SetError(ERRCODE_IO_CANTSEEK); return Tell(); |