diff options
author | Sushil Shinde <sushil.shinde@synerzip.com> | 2013-11-26 19:06:48 +0530 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2013-12-13 10:59:37 +0100 |
commit | c42c57e665ad65b3a270ae223f1012ac988acdd3 (patch) | |
tree | 8a22f108d0dfac50a1d4a54eec442e4e00759f52 | |
parent | dcdf3cd1983b673eb1ed1a5c23b68ba46fe4dd1b (diff) |
fdo#70338 : Fixed file corruption issue after save for docx.
- File was giving corruption message if saved in LO.
- Issue due to video file.
- Attached file contain .mov which was not handled properly.
- Added mov extension support in graphic filter.
Reviewed on:
https://gerrit.libreoffice.org/6818
Change-Id: Ia278127ddc4afcd2d5fe04e86ed6201fb28dc04f
-rw-r--r-- | filter/Configuration_filter.mk | 4 | ||||
-rw-r--r-- | filter/source/config/cache/typedetection.cxx | 1 | ||||
-rw-r--r-- | filter/source/config/fragments/filters/mov__MOV.xcu | 21 | ||||
-rw-r--r-- | filter/source/config/fragments/internalgraphicfilters/mov_Import.xcu | 18 | ||||
-rw-r--r-- | filter/source/config/fragments/types/mov_MOV.xcu | 20 | ||||
-rw-r--r-- | include/vcl/gfxlink.hxx | 1 | ||||
-rw-r--r-- | include/vcl/graphicfilter.hxx | 4 | ||||
-rw-r--r-- | oox/source/export/drawingml.cxx | 4 | ||||
-rw-r--r-- | vcl/source/filter/FilterConfigCache.cxx | 4 | ||||
-rw-r--r-- | vcl/source/filter/graphicfilter.cxx | 23 |
10 files changed, 99 insertions, 1 deletions
diff --git a/filter/Configuration_filter.mk b/filter/Configuration_filter.mk index 347d00c365dc..587e4144c782 100644 --- a/filter/Configuration_filter.mk +++ b/filter/Configuration_filter.mk @@ -734,6 +734,7 @@ $(call filter_Configuration_add_types,fcfg_langpack,fcfg_drawgraphics_types.xcu, graphic_SWF \ jpg_JPEG \ met_OS2_Metafile \ + mov_MOV \ pbm_Portable_Bitmap \ pcd_Photo_CD_Base \ pcd_Photo_CD_Base16 \ @@ -764,6 +765,7 @@ $(call filter_Configuration_add_filters,fcfg_langpack,fcfg_drawgraphics_filters. GIF___Graphics_Interchange \ JPG___JPEG \ MET___OS_2_Metafile \ + mov__MOV \ PBM___Portable_Bitmap \ PCT___Mac_Pict \ PCX___Zsoft_Paintbrush \ @@ -880,6 +882,7 @@ $(call filter_Configuration_add_types,fcfg_langpack,fcfg_internalgraphics_types. gif_Graphics_Interchange \ jpg_JPEG \ met_OS2_Metafile \ + mov_MOV \ pbm_Portable_Bitmap \ pcd_Photo_CD_Base \ pcd_Photo_CD_Base16 \ @@ -947,6 +950,7 @@ $(call filter_Configuration_add_internal_filters,fcfg_langpack,fcfg_internalgrap xbm_Import \ xpm_Export \ xpm_Import \ + mov_Import \ ) # fcfg_xslt diff --git a/filter/source/config/cache/typedetection.cxx b/filter/source/config/cache/typedetection.cxx index d0bd8cf50c19..dadf07e78f1e 100644 --- a/filter/source/config/cache/typedetection.cxx +++ b/filter/source/config/cache/typedetection.cxx @@ -220,6 +220,7 @@ int getFlatTypeRank(const OUString& rType) "psd_Adobe_Photoshop", "png_Portable_Network_Graphic", "jpg_JPEG", + "mov_MOV", "gif_Graphics_Interchange", "bmp_MS_Windows", "pcx_Zsoft_Paintbrush", diff --git a/filter/source/config/fragments/filters/mov__MOV.xcu b/filter/source/config/fragments/filters/mov__MOV.xcu new file mode 100644 index 000000000000..eb06ad730832 --- /dev/null +++ b/filter/source/config/fragments/filters/mov__MOV.xcu @@ -0,0 +1,21 @@ +<!-- + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * +--> + <node oor:name="MOV - MOV" oor:op="replace"> + <prop oor:name="Flags"><value>IMPORT ALIEN</value></prop> + <prop oor:name="UIComponent"/> + <prop oor:name="FilterService"/> + <prop oor:name="UserData"><value></value></prop> + <prop oor:name="UIName"> + <value xml:lang="x-default">MOV - QuickTime File Format</value> + </prop> + <prop oor:name="FileFormatVersion"><value>0</value></prop> + <prop oor:name="Type"><value>mov_MOV</value></prop> + <prop oor:name="TemplateName"/> + <prop oor:name="DocumentService"><value>com.sun.star.drawing.DrawingDocument</value></prop> + </node> diff --git a/filter/source/config/fragments/internalgraphicfilters/mov_Import.xcu b/filter/source/config/fragments/internalgraphicfilters/mov_Import.xcu new file mode 100644 index 000000000000..3dd28860389f --- /dev/null +++ b/filter/source/config/fragments/internalgraphicfilters/mov_Import.xcu @@ -0,0 +1,18 @@ +<!-- + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * +--> + <node oor:name="mov_Import" oor:op="replace" > + <prop oor:name="Type"><value>mov_MOV</value></prop> + <prop oor:name="FormatName"><value>SVMOV</value></prop> + <prop oor:name="RealFilterName"><value>MOV - MOV</value></prop> + <prop oor:name="UIComponent"/> + <prop oor:name="UIName"> + <value xml:lang="en-US">MOV - QuickTime File Format</value> + </prop> + <prop oor:name="Flags"><value>IMPORT</value></prop> + </node> diff --git a/filter/source/config/fragments/types/mov_MOV.xcu b/filter/source/config/fragments/types/mov_MOV.xcu new file mode 100644 index 000000000000..7471a78a7e51 --- /dev/null +++ b/filter/source/config/fragments/types/mov_MOV.xcu @@ -0,0 +1,20 @@ +<!-- + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * +--> + <node oor:name="mov_MOV" oor:op="replace" > + <prop oor:name="DetectService"><value>com.sun.star.comp.draw.FormatDetector</value></prop> + <prop oor:name="URLPattern"/> + <prop oor:name="Extensions"><value>mov MOV</value></prop> + <prop oor:name="MediaType"><value>application/movie</value></prop> + <prop oor:name="Preferred"><value>false</value></prop> + <prop oor:name="PreferredFilter"><value>MOV - MOV</value></prop> + <prop oor:name="UIName"> + <value>MOV - QuickTime File Format</value> + </prop> + <prop oor:name="ClipboardFormat"/> + </node> diff --git a/include/vcl/gfxlink.hxx b/include/vcl/gfxlink.hxx index f996dde901d5..80187b1b5c75 100644 --- a/include/vcl/gfxlink.hxx +++ b/include/vcl/gfxlink.hxx @@ -103,6 +103,7 @@ enum GfxLinkType GFX_LINK_TYPE_NATIVE_MET = 7, // Don't forget to update the following defines GFX_LINK_TYPE_NATIVE_PCT = 8, // Don't forget to update the following defines GFX_LINK_TYPE_NATIVE_SVG = 9, // Don't forget to update the following defines + GFX_LINK_TYPE_NATIVE_MOV = 10, GFX_LINK_TYPE_USER = 0xffff }; diff --git a/include/vcl/graphicfilter.hxx b/include/vcl/graphicfilter.hxx index 7d29b6cdecee..cfadd3c98765 100644 --- a/include/vcl/graphicfilter.hxx +++ b/include/vcl/graphicfilter.hxx @@ -54,6 +54,7 @@ struct ConvertData; #define GRFILTER_I_FLAGS_ALLOW_PARTIAL_STREAMREAD 00000010 #define IMP_BMP "SVBMP" +#define IMP_MOV "SVMOV" #define IMP_SVMETAFILE "SVMETAFILE" #define IMP_WMF "SVWMF" #define IMP_EMF "SVEMF" @@ -74,6 +75,7 @@ struct ConvertData; #define EXP_PNG "SVEPNG" #define BMP_SHORTNAME "BMP" +#define MOV_SHORTNAME "MOV" #define GIF_SHORTNAME "GIF" #define JPG_SHORTNAME "JPG" #define MET_SHORTNAME "MET" @@ -113,6 +115,7 @@ struct ConvertData; #define GFF_SGV ( (sal_uInt16)0x00f7 ) #define GFF_EMF ( (sal_uInt16)0x00f8 ) #define GFF_SVG ( (sal_uInt16)0x00f9 ) +#define GFF_MOV ( (sal_uInt16)0x00fa ) #define GFF_XXX ( (sal_uInt16)0xffff ) // --------------------- @@ -159,6 +162,7 @@ class VCL_DLLPUBLIC GraphicDescriptor sal_Bool ImpDetectSGV( SvStream& rStm, sal_Bool bExtendedInfo ); sal_Bool ImpDetectEMF( SvStream& rStm, sal_Bool bExtendedInfo ); sal_Bool ImpDetectSVG( SvStream& rStm, sal_Bool bExtendedInfo ); + sal_Bool ImpDetectMOV( SvStream& rStm, sal_Bool bExtendedInfo ); GraphicDescriptor( const GraphicDescriptor& ); GraphicDescriptor& operator=( const GraphicDescriptor& ); diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx index e542df87deae..3ed8f02afe74 100644 --- a/oox/source/export/drawingml.cxx +++ b/oox/source/export/drawingml.cxx @@ -493,6 +493,10 @@ OUString DrawingML::WriteImage( const Graphic& rGraphic ) sMediaType = "image/x-pict"; pExtension = ".pct"; break; + case GFX_LINK_TYPE_NATIVE_MOV: + sMediaType = "application/movie"; + pExtension = ".MOV"; + break; default: { GraphicType aType = rGraphic.GetType(); if ( aType == GRAPHIC_BITMAP ) { diff --git a/vcl/source/filter/FilterConfigCache.cxx b/vcl/source/filter/FilterConfigCache.cxx index 217888ee1b6c..71334c96653a 100644 --- a/vcl/source/filter/FilterConfigCache.cxx +++ b/vcl/source/filter/FilterConfigCache.cxx @@ -37,7 +37,7 @@ using namespace ::com::sun::star::configuration ; const char* FilterConfigCache::FilterConfigCacheEntry::InternalPixelFilterNameList[] = { IMP_BMP, IMP_GIF, IMP_PNG,IMP_JPEG, IMP_XBM, IMP_XPM, - EXP_BMP, EXP_JPEG, EXP_PNG, NULL + EXP_BMP, EXP_JPEG, EXP_PNG, IMP_MOV, NULL }; const char* FilterConfigCache::FilterConfigCacheEntry::InternalVectorFilterNameList[] = @@ -234,6 +234,8 @@ const char* FilterConfigCache::InternalFilterListForSvxLight[] = "gif","2","egi", "jpg","1","SVIJPEG", "jpg","2","SVEJPEG", + "mov","1","SVMOV", + "mov","2","SVMOV", "sgv","1","SVSGV", "sgf","1","SVSGF", "met","1","ime", diff --git a/vcl/source/filter/graphicfilter.cxx b/vcl/source/filter/graphicfilter.cxx index 6a98abaf1fb4..6c38c1ba9a2c 100644 --- a/vcl/source/filter/graphicfilter.cxx +++ b/vcl/source/filter/graphicfilter.cxx @@ -765,6 +765,19 @@ static bool ImpPeekGraphicFormat( SvStream& rStream, OUString& rFormatExtension, } } + if(!bTest || rFormatExtension.startsWith( "MOV" )) + { + if ((sFirstBytes[ 4 ] == 'f' && sFirstBytes[ 5 ] == 't' && sFirstBytes[ 6 ] == 'y' && + sFirstBytes[ 7 ] == 'p' && sFirstBytes[ 8 ] == 'q' && sFirstBytes[ 9 ] == 't') || + (sFirstBytes[ 4 ] == 'm' && sFirstBytes[ 5 ] == 'o' && sFirstBytes[ 6 ] == 'o' && + sFirstBytes[ 7 ] == 'v' && sFirstBytes[ 11 ] == 'l' && sFirstBytes[ 12 ] == 'm')) + { + bSomethingTested=true; + rFormatExtension = "MOV"; + return true; + } + } + return bTest && !bSomethingTested; } @@ -1564,6 +1577,16 @@ sal_uInt16 GraphicFilter::ImportGraphic( Graphic& rGraphic, const OUString& rPat if( rIStream.GetError() ) nStatus = GRFILTER_FORMATERROR; } + else if( aFilterName.equalsIgnoreAsciiCase( IMP_MOV ) ) + { + rIStream >> rGraphic; + if( rIStream.GetError() ) + nStatus = GRFILTER_FORMATERROR; + else + rGraphic.SetDefaultType(); + rIStream.Seek( STREAM_SEEK_TO_END ); + eLinkType = GFX_LINK_TYPE_NATIVE_MOV; + } else if( aFilterName.equalsIgnoreAsciiCase( IMP_WMF ) || aFilterName.equalsIgnoreAsciiCase( IMP_EMF ) ) { |