[Libreoffice-commits] .: svtools/source sw/source
svtools/source/filter/filter.cxx | 28 ++-- sw/source/core/graphic/ndgrf.cxx | 10 +- 2 files changed, 31 insertions(+), 7 deletions(-) New commits: commit c0913d78c258f7e49b52f45909b2cebbd9fb6103 Author: Thorsten Behrens Date: Tue Oct 25 21:02:03 2011 +0200 Fix fdo#41995 fallout - recognize .svg in odf containers More code paths that needed fixing - Writer sports its own Graphic loading implementation, so that had the need for the stream name fwd-ing, too. The svg deep type detection was necessary for e.g. the flat odf - which has inline svg without any filename. diff --git a/svtools/source/filter/filter.cxx b/svtools/source/filter/filter.cxx index b10a4ab..ddab749 100644 --- a/svtools/source/filter/filter.cxx +++ b/svtools/source/filter/filter.cxx @@ -667,6 +667,30 @@ static sal_Bool ImpPeekGraphicFormat( SvStream& rStream, String& rFormatExtensio // just a simple test for the extension if( rFormatExtension.CompareToAscii( "SVG", 3 ) == COMPARE_EQUAL ) return sal_True; + +sal_uLong nSize = ( nStreamLen > 1024 ) ? 1024 : nStreamLen; +std::vector aBuf(nSize); + +rStream.Seek( nStreamPos ); +rStream.Read( &aBuf[0], nSize ); + +// read the first 1024 bytes & check a few magic string +// constants (heuristically) +sal_Int8 aMagic1[] = {'<', 's', 'v', 'g'}; +if( std::search(aBuf.begin(), aBuf.end(), +aMagic1, aMagic1+SAL_N_ELEMENTS(aMagic1)) != aBuf.end() ) +{ +rFormatExtension = UniString::CreateFromAscii( "SVG", 3 ); +return sal_True; +} + +sal_Int8 aMagic2[] = {'D', 'O', 'C', 'T', 'Y', 'P', 'E', ' ', 's', 'v', 'g'}; +if( std::search(aBuf.begin(), aBuf.end(), +aMagic2, aMagic2+SAL_N_ELEMENTS(aMagic2)) != aBuf.end() ) +{ +rFormatExtension = UniString::CreateFromAscii( "SVG", 3 ); +return sal_True; +} } //--- TGA @@ -743,7 +767,7 @@ sal_uInt16 GraphicFilter::ImpTestOrFindFormat( const String& rPath, SvStream& rS else { String aTmpStr( pConfig->GetImportFormatExtension( rFormat ) ); -if( !ImpPeekGraphicFormat( rStream, aTmpStr, sal_True ) ) +if( !ImpPeekGraphicFormat( rStream, aTmpStr.ToUpperAscii(), sal_True ) ) return GRFILTER_FORMATERROR; if ( pConfig->GetImportFormatExtension( rFormat ).EqualsIgnoreCaseAscii( "pcd" ) ) { @@ -2180,7 +2204,7 @@ IMPL_LINK( GraphicFilter, FilterCallback, ConvertData*, pData ) { // Import nFormat = GetImportFormatNumberForShortName( String( aShortName.GetBuffer(), RTL_TEXTENCODING_UTF8 ) ); -nRet = ImportGraphic( pData->maGraphic, String(), pData->mrStm ) == 0; +nRet = ImportGraphic( pData->maGraphic, String(), pData->mrStm, nFormat ) == 0; } else if( aShortName.Len() ) { diff --git a/sw/source/core/graphic/ndgrf.cxx b/sw/source/core/graphic/ndgrf.cxx index b407c9b..11d9555 100755 --- a/sw/source/core/graphic/ndgrf.cxx +++ b/sw/source/core/graphic/ndgrf.cxx @@ -386,12 +386,11 @@ Size SwGrfNode::GetTwipSize() const sal_Bool SwGrfNode::ImportGraphic( SvStream& rStrm ) { Graphic aGraphic; -if( !GraphicFilter::GetGraphicFilter().ImportGraphic( aGraphic, String(), rStrm ) ) +const String aGraphicURL( aGrfObj.GetUserData() ); +if( !GraphicFilter::GetGraphicFilter().ImportGraphic( aGraphic, aGraphicURL, rStrm ) ) { -const String aUserData( aGrfObj.GetUserData() ); - aGrfObj.SetGraphic( aGraphic ); -aGrfObj.SetUserData( aUserData ); +aGrfObj.SetUserData( aGraphicURL ); return sal_True; } @@ -879,7 +878,8 @@ SwCntntNode* SwGrfNode::MakeCopy( SwDoc* pDoc, const SwNodeIndex& rIdx ) const SvStream* pStrm = _GetStreamForEmbedGrf( refPics, aStrmName ); if ( pStrm ) { -GraphicFilter::GetGraphicFilter().ImportGraphic( aTmpGrf, String(), *pStrm ); +const String aGraphicURL( aGrfObj.GetUserData() ); +GraphicFilter::GetGraphicFilter().ImportGraphic( aTmpGrf, aGraphicURL, *pStrm ); delete pStrm; } } ___ Libreoffice-commits mailing list Libreoffice-commits@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] .: svtools/source sw/source tools/source
svtools/source/filter/filter.cxx |3 --- sw/source/core/docnode/ndsect.cxx |4 sw/source/core/docnode/node.cxx |8 sw/source/core/table/swtable.cxx | 10 -- tools/source/stream/strmunx.cxx |4 ++-- 5 files changed, 2 insertions(+), 27 deletions(-) New commits: commit 6612ea7d9b03dc9cec1c98fdff0e1a22d2aab241 Author: Takeshi Abe Date: Mon Oct 3 01:46:06 2011 +0900 definition of ALPHA is no longer available for DEC Alpha proper ifdef for DEC Alpha should be covered with AXP diff --git a/svtools/source/filter/filter.cxx b/svtools/source/filter/filter.cxx index 72fc266..5c9edab 100644 --- a/svtools/source/filter/filter.cxx +++ b/svtools/source/filter/filter.cxx @@ -29,9 +29,6 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_svtools.hxx" -#if defined UNX && defined ALPHA -#include -#endif #include #include #include diff --git a/sw/source/core/docnode/ndsect.cxx b/sw/source/core/docnode/ndsect.cxx index aa5d5ec..51538f6 100644 --- a/sw/source/core/docnode/ndsect.cxx +++ b/sw/source/core/docnode/ndsect.cxx @@ -990,11 +990,7 @@ SwSectionNode* SwNode::FindSectionNode() return GetSectionNode(); SwStartNode* pTmp = pStartOfSection; while( !pTmp->IsSectionNode() && pTmp->GetIndex() ) -#if defined( ALPHA ) && defined( UNX ) -pTmp = ((SwNode*)pTmp)->pStartOfSection; -#else pTmp = pTmp->pStartOfSection; -#endif return pTmp->GetSectionNode(); } diff --git a/sw/source/core/docnode/node.cxx b/sw/source/core/docnode/node.cxx index b1bb096..ad3c4a3 100644 --- a/sw/source/core/docnode/node.cxx +++ b/sw/source/core/docnode/node.cxx @@ -400,11 +400,7 @@ SwTableNode* SwNode::FindTableNode() return GetTableNode(); SwStartNode* pTmp = pStartOfSection; while( !pTmp->IsTableNode() && pTmp->GetIndex() ) -#if defined( ALPHA ) && defined( UNX ) -pTmp = ((SwNode*)pTmp)->pStartOfSection; -#else pTmp = pTmp->pStartOfSection; -#endif return pTmp->GetTableNode(); } @@ -803,11 +799,7 @@ SwStartNode* SwNode::FindSttNodeByType( SwStartNodeType eTyp ) SwStartNode* pTmp = IsStartNode() ? (SwStartNode*)this : pStartOfSection; while( eTyp != pTmp->GetStartNodeType() && pTmp->GetIndex() ) -#if defined( ALPHA ) && defined( UNX ) -pTmp = ((SwNode*)pTmp)->pStartOfSection; -#else pTmp = pTmp->pStartOfSection; -#endif return eTyp == pTmp->GetStartNodeType() ? pTmp : 0; } diff --git a/sw/source/core/table/swtable.cxx b/sw/source/core/table/swtable.cxx index 524ebcb..1f456e7 100644 --- a/sw/source/core/table/swtable.cxx +++ b/sw/source/core/table/swtable.cxx @@ -595,12 +595,6 @@ void lcl_ProcessLineGet( const SwTableLine *pLine, SwTabCols &rToFill, } } -// MS: Sonst Absturz auf der DEC-Kiste -// -#if defined(ALPHA) && defined(WNT) -#pragma optimize("", off) -#endif - void SwTable::GetTabCols( SwTabCols &rToFill, const SwTableBox *pStart, sal_Bool bRefreshHidden, sal_Bool bCurRowOnly ) const { @@ -691,10 +685,6 @@ void SwTable::GetTabCols( SwTabCols &rToFill, const SwTableBox *pStart, } } -#if defined(ALPHA) && defined(WNT) -#pragma optimize("", on) -#endif - /* |* |* SwTable::SetTabCols() diff --git a/tools/source/stream/strmunx.cxx b/tools/source/stream/strmunx.cxx index 110d2d1..2dfe2bb 100644 --- a/tools/source/stream/strmunx.cxx +++ b/tools/source/stream/strmunx.cxx @@ -228,7 +228,7 @@ static sal_uInt32 GetSvError( int nErrno ) { 0,SVSTREAM_OK }, { EACCES, SVSTREAM_ACCESS_DENIED }, { EBADF,SVSTREAM_INVALID_HANDLE }, -#if defined(RS6000) || defined(ALPHA) || defined(NETBSD) || \ +#if defined(RS6000) || defined(NETBSD) || \ defined(FREEBSD) || defined(MACOSX) || defined(OPENBSD) || \ defined(__FreeBSD_kernel__) || defined (AIX) || defined(DRAGONFLY) || \ defined(IOS) @@ -245,7 +245,7 @@ static sal_uInt32 GetSvError( int nErrno ) { EAGAIN, SVSTREAM_LOCKING_VIOLATION }, { EISDIR, SVSTREAM_PATH_NOT_FOUND }, { ELOOP,SVSTREAM_PATH_NOT_FOUND }, -#if !defined(RS6000) && !defined(ALPHA) && !defined(NETBSD) && !defined (FREEBSD) && \ +#if !defined(RS6000) && !defined(NETBSD) && !defined (FREEBSD) && \ !defined(MACOSX) && !defined(OPENBSD) && !defined(__FreeBSD_kernel__) && \ !defined(DRAGONFLY) { EMULTIHOP,SVSTREAM_PATH_NOT_FOUND }, ___ Libreoffice-commits mailing list Libreoffice-commits@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits