incubator-ooo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a..@apache.org
Subject svn commit: r1309445 - in /incubator/ooo/trunk/main: svtools/source/filter/filter.cxx svtools/source/graphic/grfcache.cxx sw/source/core/doc/notxtfrm.cxx
Date Wed, 04 Apr 2012 15:12:13 GMT
Author: alg
Date: Wed Apr  4 15:12:13 2012
New Revision: 1309445

URL: http://svn.apache.org/viewvc?rev=1309445&view=rev
Log:
#119176# corrected file type detection for SVG for svg files without xml header

Modified:
    incubator/ooo/trunk/main/svtools/source/filter/filter.cxx
    incubator/ooo/trunk/main/svtools/source/graphic/grfcache.cxx
    incubator/ooo/trunk/main/sw/source/core/doc/notxtfrm.cxx

Modified: incubator/ooo/trunk/main/svtools/source/filter/filter.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/svtools/source/filter/filter.cxx?rev=1309445&r1=1309444&r2=1309445&view=diff
==============================================================================
--- incubator/ooo/trunk/main/svtools/source/filter/filter.cxx (original)
+++ incubator/ooo/trunk/main/svtools/source/filter/filter.cxx Wed Apr  4 15:12:13 2012
@@ -723,6 +723,44 @@ static sal_Bool ImpPeekGraphicFormat( Sv
                 return sal_True;
             }
         }
+        else
+        {
+            // #119176# Svg files which have no xml header at all have shown up,
+            // detect those, too
+            bool bIsSvg(false);
+
+            // check for svg element in 1st 256 bytes
+            if(ImplSearchEntry( sFirstBytes, (sal_uInt8*)"<svg", 256, 4 )) // '<svg'
+            {
+                bIsSvg = true;
+            }
+
+            if(!bIsSvg)
+            {
+                // look for '<svg' in full file. Should not happen too
+                // often since the tests above will handle most cases, but can happen
+                // with Svg files containing big comment headers or Svg as the host
+                // language
+                const sal_uLong nSize((nStreamLen > 2048) ? 2048 : nStreamLen);
+                sal_uInt8* pBuf = new sal_uInt8[nSize];
+
+                rStream.Seek(nStreamPos);
+                rStream.Read(pBuf, nSize);
+
+                if(ImplSearchEntry(pBuf, (sal_uInt8*)"<svg", nSize, 4)) // '<svg'
+                {
+                    bIsSvg = true;
+                }
+
+                delete[] pBuf;
+            }
+
+            if(bIsSvg)
+            {
+                rFormatExtension = UniString::CreateFromAscii( "SVG", 3 );
+                return sal_True;
+            }
+        }
 	}
 	else if( rFormatExtension.CompareToAscii( "SVG", 3 ) == COMPARE_EQUAL )
 	{

Modified: incubator/ooo/trunk/main/svtools/source/graphic/grfcache.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/svtools/source/graphic/grfcache.cxx?rev=1309445&r1=1309444&r2=1309445&view=diff
==============================================================================
--- incubator/ooo/trunk/main/svtools/source/graphic/grfcache.cxx (original)
+++ incubator/ooo/trunk/main/svtools/source/graphic/grfcache.cxx Wed Apr  4 15:12:13 2012
@@ -407,6 +407,9 @@ void GraphicCacheEntry::GraphicObjectWas
 		delete mpBmpEx, mpBmpEx = NULL;
 		delete mpMtf, mpMtf = NULL;
 		delete mpAnimation, mpAnimation = NULL;
+
+        // #119176# also reset SvgData
+        maSvgData.reset();
 	}
 }
 

Modified: incubator/ooo/trunk/main/sw/source/core/doc/notxtfrm.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/sw/source/core/doc/notxtfrm.cxx?rev=1309445&r1=1309444&r2=1309445&view=diff
==============================================================================
--- incubator/ooo/trunk/main/sw/source/core/doc/notxtfrm.cxx (original)
+++ incubator/ooo/trunk/main/sw/source/core/doc/notxtfrm.cxx Wed Apr  4 15:12:13 2012
@@ -869,7 +869,7 @@ bool paintUsingPrimitivesHelper(
             if(bMirrorX || bMirrorY)
             {
                 aMappingTransform.translate(-aTargetRange.getCenterX(), -aTargetRange.getCenterY());
-                aMappingTransform.scale(bMirrorX ? -1.0 : 1.0, bMirrorX ? -1.0 : 1.0);
+                aMappingTransform.scale(bMirrorX ? -1.0 : 1.0, bMirrorY ? -1.0 : 1.0); //
#119176# small typo with X/Y
                 aMappingTransform.translate(aTargetRange.getCenterX(), aTargetRange.getCenterY());
             }
 



Mime
View raw message