Return-Path: X-Original-To: apmail-poi-commits-archive@minotaur.apache.org Delivered-To: apmail-poi-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 CA0557091 for ; Thu, 28 Jul 2011 11:45:16 +0000 (UTC) Received: (qmail 27774 invoked by uid 500); 28 Jul 2011 11:45:16 -0000 Delivered-To: apmail-poi-commits-archive@poi.apache.org Received: (qmail 27730 invoked by uid 500); 28 Jul 2011 11:45:15 -0000 Mailing-List: contact commits-help@poi.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@poi.apache.org Delivered-To: mailing list commits@poi.apache.org Received: (qmail 27723 invoked by uid 99); 28 Jul 2011 11:45:15 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 28 Jul 2011 11:45:15 +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; Thu, 28 Jul 2011 11:45:12 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 2E64C23889BB for ; Thu, 28 Jul 2011 11:44:51 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: svn commit: r1151801 - in /poi/trunk/src/java/org/apache/poi/ddf: DefaultEscherRecordFactory.java EscherTertiaryOptRecord.java Date: Thu, 28 Jul 2011 11:44:51 -0000 To: commits@poi.apache.org From: sergey@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20110728114451.2E64C23889BB@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: sergey Date: Thu Jul 28 11:44:50 2011 New Revision: 1151801 URL: http://svn.apache.org/viewvc?rev=1151801&view=rev Log: add EscherTertiaryOptRecord support Added: poi/trunk/src/java/org/apache/poi/ddf/EscherTertiaryOptRecord.java Modified: poi/trunk/src/java/org/apache/poi/ddf/DefaultEscherRecordFactory.java Modified: poi/trunk/src/java/org/apache/poi/ddf/DefaultEscherRecordFactory.java URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/ddf/DefaultEscherRecordFactory.java?rev=1151801&r1=1151800&r2=1151801&view=diff ============================================================================== --- poi/trunk/src/java/org/apache/poi/ddf/DefaultEscherRecordFactory.java (original) +++ poi/trunk/src/java/org/apache/poi/ddf/DefaultEscherRecordFactory.java Thu Jul 28 11:44:50 2011 @@ -30,11 +30,13 @@ import java.util.Map; * @see EscherRecordFactory */ public class DefaultEscherRecordFactory implements EscherRecordFactory { - private static Class[] escherRecordClasses = { - EscherBSERecord.class, EscherOptRecord.class, EscherClientAnchorRecord.class, EscherDgRecord.class, - EscherSpgrRecord.class, EscherSpRecord.class, EscherClientDataRecord.class, EscherDggRecord.class, - EscherSplitMenuColorsRecord.class, EscherChildAnchorRecord.class, EscherTextboxRecord.class - }; + private static Class[] escherRecordClasses = { EscherBSERecord.class, + EscherOptRecord.class, EscherTertiaryOptRecord.class, + EscherClientAnchorRecord.class, EscherDgRecord.class, + EscherSpgrRecord.class, EscherSpRecord.class, + EscherClientDataRecord.class, EscherDggRecord.class, + EscherSplitMenuColorsRecord.class, EscherChildAnchorRecord.class, + EscherTextboxRecord.class }; private static Map> recordsMap = recordsToMap( escherRecordClasses ); /** Added: poi/trunk/src/java/org/apache/poi/ddf/EscherTertiaryOptRecord.java URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/ddf/EscherTertiaryOptRecord.java?rev=1151801&view=auto ============================================================================== --- poi/trunk/src/java/org/apache/poi/ddf/EscherTertiaryOptRecord.java (added) +++ poi/trunk/src/java/org/apache/poi/ddf/EscherTertiaryOptRecord.java Thu Jul 28 11:44:50 2011 @@ -0,0 +1,111 @@ +/* ==================================================================== + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +==================================================================== */ +package org.apache.poi.ddf; + +import java.util.ArrayList; +import java.util.List; + +import org.apache.poi.util.HexDump; +import org.apache.poi.util.LittleEndian; + +/** + * "The OfficeArtTertiaryFOPT record specifies a table of OfficeArtRGFOPTE properties, as defined in section 2.3.1." + * -- [MS-ODRAW] — v20110608; Office Drawing Binary File Format + * + * @author Sergey Vladimirov (vlsergey {at} gmail {dot} com) + */ +public class EscherTertiaryOptRecord extends EscherRecord +{ + public static final short RECORD_ID = (short) 0xF122; + + private List properties = new ArrayList(); + + public int fillFields( byte[] data, int offset, + EscherRecordFactory recordFactory ) + { + int bytesRemaining = readHeader( data, offset ); + int pos = offset + 8; + + EscherPropertyFactory f = new EscherPropertyFactory(); + properties = f.createProperties( data, pos, getInstance() ); + return bytesRemaining + 8; + } + + private int getPropertiesSize() + { + int totalSize = 0; + for ( EscherProperty property : properties ) + { + totalSize += property.getPropertySize(); + } + + return totalSize; + } + + public String getRecordName() + { + return "TertiaryOpt"; + } + + @Override + public int getRecordSize() + { + return 8 + getPropertiesSize(); + } + + public int serialize( int offset, byte[] data, + EscherSerializationListener listener ) + { + listener.beforeRecordSerialize( offset, getRecordId(), this ); + + LittleEndian.putShort( data, offset, getOptions() ); + LittleEndian.putShort( data, offset + 2, getRecordId() ); + LittleEndian.putInt( data, offset + 4, getPropertiesSize() ); + int pos = offset + 8; + for ( EscherProperty property : properties ) + { + pos += property.serializeSimplePart( data, pos ); + } + for ( EscherProperty property : properties ) + { + pos += property.serializeComplexPart( data, pos ); + } + listener.afterRecordSerialize( pos, getRecordId(), pos - offset, this ); + return pos - offset; + } + + /** + * Retrieve the string representation of this record. + */ + public String toString() + { + String nl = System.getProperty( "line.separator" ); + StringBuffer propertiesBuf = new StringBuffer(); + for ( EscherProperty property : properties ) + { + propertiesBuf.append( " " + property.toString() + nl ); + } + + return "org.apache.poi.ddf.EscherTertiaryOptRecord:" + nl + + " isContainer: " + isContainerRecord() + nl + + " options: 0x" + HexDump.toHex( getOptions() ) + nl + + " recordId: 0x" + HexDump.toHex( getRecordId() ) + nl + + " numchildren: " + getChildRecords().size() + nl + + " properties:" + nl + propertiesBuf.toString(); + } + +} --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org For additional commands, e-mail: commits-help@poi.apache.org