incubator-ooo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a..@apache.org
Subject svn commit: r1231908 - /incubator/ooo/trunk/main/vcl/source/gdi/impgraph.cxx
Date Mon, 16 Jan 2012 10:41:36 GMT
Author: alg
Date: Mon Jan 16 10:41:36 2012
New Revision: 1231908

URL: http://svn.apache.org/viewvc?rev=1231908&view=rev
Log:
118779# Added svg content streaming in/out to ImpGraphic stream operators

Modified:
    incubator/ooo/trunk/main/vcl/source/gdi/impgraph.cxx

Modified: incubator/ooo/trunk/main/vcl/source/gdi/impgraph.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/vcl/source/gdi/impgraph.cxx?rev=1231908&r1=1231907&r2=1231908&view=diff
==============================================================================
--- incubator/ooo/trunk/main/vcl/source/gdi/impgraph.cxx (original)
+++ incubator/ooo/trunk/main/vcl/source/gdi/impgraph.cxx Mon Jan 16 10:41:36 2012
@@ -1762,9 +1762,47 @@ SvStream& operator>>( SvStream& rIStm, I
 				    rIStm >> aMtf;
 
 				    if( !rIStm.GetError() )
+                    {
 					    rImpGraphic = aMtf;
+                    }
 				    else
-					    rIStm.Seek( nStmPos1 );
+                    {
+                        // try to stream in Svg defining data (length, byte array and evtl.
path)
+                        // See below (operator<<) for more information
+                        const sal_uInt32 nSvgMagic((sal_uInt32('s') << 24) | (sal_uInt32('v')
<< 16) | (sal_uInt32('g') << 8) | sal_uInt32('0'));
+                        sal_uInt32 nMagic;
+                        rIStm.Seek(nStmPos1);
+                        rIStm.ResetError();
+                        rIStm >> nMagic;
+
+                        if(nSvgMagic == nMagic)
+                        {
+                            sal_uInt32 mnSvgDataArrayLength(0);
+                            rIStm >> mnSvgDataArrayLength;
+
+                            if(mnSvgDataArrayLength)
+                            {
+                                SvgDataArray aNewData(new sal_uInt8[mnSvgDataArrayLength]);
+                                UniString aPath;
+
+                                rIStm.Read(aNewData.get(), mnSvgDataArrayLength);
+                                rIStm.ReadByteString(aPath);
+
+                                if(!rIStm.GetError())
+                                {
+                                    SvgDataPtr aSvgDataPtr(
+                                        new SvgData(
+                                            aNewData,
+                                            mnSvgDataArrayLength,
+                                            rtl::OUString(aPath)));
+
+                                    rImpGraphic = aSvgDataPtr;
+                                }
+                            }
+                        }
+
+                        rIStm.Seek(nStmPos1);
+                    }
 			    }
 
 			    rIStm.SetNumberFormatInt( nOldFormat );
@@ -1816,7 +1854,16 @@ SvStream& operator<<( SvStream& rOStm, c
 					{
                         if(rImpGraphic.getSvgData().get())
                         {
-                            rOStm << rImpGraphic.getSvgData()->getReplacement();
+                            // stream out Svg defining data (length, byte array and evtl.
path)
+                            // this is used e.g. in swapping out graphic data and in transporting
it over UNO API
+                            // as sequence of bytes, but AFAIK not written anywhere to any
kind of file, so it should be
+                            // no problem to extend it; only used at runtime
+                            const sal_uInt32 nSvgMagic((sal_uInt32('s') << 24) | (sal_uInt32('v')
<< 16) | (sal_uInt32('g') << 8) | sal_uInt32('0'));
+
+                            rOStm << nSvgMagic;
+                            rOStm << rImpGraphic.getSvgData()->getSvgDataArrayLength();
+                            rOStm.Write(rImpGraphic.getSvgData()->getSvgDataArray().get(),
rImpGraphic.getSvgData()->getSvgDataArrayLength());
+                            rOStm.WriteByteString(rImpGraphic.getSvgData()->getPath());
                         }
 						else if( rImpGraphic.ImplIsAnimated())
                         {



Mime
View raw message