Return-Path: X-Original-To: apmail-incubator-ooo-commits-archive@minotaur.apache.org Delivered-To: apmail-incubator-ooo-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 52BCFB58F for ; Mon, 16 Jan 2012 10:41:59 +0000 (UTC) Received: (qmail 79386 invoked by uid 500); 16 Jan 2012 10:41:59 -0000 Delivered-To: apmail-incubator-ooo-commits-archive@incubator.apache.org Received: (qmail 79294 invoked by uid 500); 16 Jan 2012 10:41:58 -0000 Mailing-List: contact ooo-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: ooo-dev@incubator.apache.org Delivered-To: mailing list ooo-commits@incubator.apache.org Received: (qmail 79287 invoked by uid 99); 16 Jan 2012 10:41:57 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 16 Jan 2012 10:41:57 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 16 Jan 2012 10:41:56 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id CC0AE23889C5; Mon, 16 Jan 2012 10:41:36 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1231908 - /incubator/ooo/trunk/main/vcl/source/gdi/impgraph.cxx Date: Mon, 16 Jan 2012 10:41:36 -0000 To: ooo-commits@incubator.apache.org From: alg@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20120116104136.CC0AE23889C5@eris.apache.org> 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()) {