From 2038b4ba5b11ef9bb3e78301b6838b410ad89bc4 Mon Sep 17 00:00:00 2001 From: Nick Burch Date: Mon, 12 Nov 2007 21:49:37 +0000 Subject: [PATCH] Add support for Chart Title Format records (bug #43721) git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@594307 13f79535-47bb-0310-9956-ffa450edef68 --- src/documentation/content/xdocs/changes.xml | 1 + src/documentation/content/xdocs/status.xml | 1 + .../hssf/record/ChartTitleFormatRecord.java | 146 ++++++++++++++++++ .../apache/poi/hssf/record/RecordFactory.java | 3 +- .../poi/hssf/data/WithFormattedGraphTitle.xls | Bin 0 -> 14336 bytes .../record/TestChartTitleFormatRecord.java | 87 +++++++++++ 6 files changed, 237 insertions(+), 1 deletion(-) create mode 100644 src/java/org/apache/poi/hssf/record/ChartTitleFormatRecord.java create mode 100644 src/testcases/org/apache/poi/hssf/data/WithFormattedGraphTitle.xls create mode 100644 src/testcases/org/apache/poi/hssf/record/TestChartTitleFormatRecord.java diff --git a/src/documentation/content/xdocs/changes.xml b/src/documentation/content/xdocs/changes.xml index f88c1582f..ca6a47525 100644 --- a/src/documentation/content/xdocs/changes.xml +++ b/src/documentation/content/xdocs/changes.xml @@ -36,6 +36,7 @@ + 43721 - [PATCH] Support for Chart Title Format records 42794 - [PATCH] Fix for BOF records from things like Access 43648 - Fix for IntPtg and short vs int 43751 - [PATCH] - Fix for handling rotated text in HSSFSheet.autoSizeColumn diff --git a/src/documentation/content/xdocs/status.xml b/src/documentation/content/xdocs/status.xml index 1dc3b60bc..2b561f554 100644 --- a/src/documentation/content/xdocs/status.xml +++ b/src/documentation/content/xdocs/status.xml @@ -33,6 +33,7 @@ + 43721 - [PATCH] Support for Chart Title Format records 42794 - [PATCH] Fix for BOF records from things like Access 43648 - Fix for IntPtg and short vs int 43751 - [PATCH] - Fix for handling rotated text in HSSFSheet.autoSizeColumn diff --git a/src/java/org/apache/poi/hssf/record/ChartTitleFormatRecord.java b/src/java/org/apache/poi/hssf/record/ChartTitleFormatRecord.java new file mode 100644 index 000000000..a9ec81e97 --- /dev/null +++ b/src/java/org/apache/poi/hssf/record/ChartTitleFormatRecord.java @@ -0,0 +1,146 @@ +/* ==================================================================== + 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. +==================================================================== */ + +/* + * HSSF Chart Title Format Record Type + */ +package org.apache.poi.hssf.record; + +import org.apache.poi.util.LittleEndian; + +import java.util.ArrayList; + +/** + * Describes the formatting runs associated with a chart title. + */ +public class ChartTitleFormatRecord extends Record { + public static final short sid = 0x1050; + + private int m_recs; + + private class CTFormat { + private short m_offset; + private short m_fontIndex; + + protected CTFormat(short offset,short fontIdx){ + m_offset = offset; + m_fontIndex = fontIdx; + } + + public short getOffset(){ + return m_offset; + } + public void setOffset(short newOff){ + m_offset = newOff; + } + public short getFontIndex() { + return m_fontIndex; + } + } + + private ArrayList m_formats; + + public ChartTitleFormatRecord() { + super(); + } + + public ChartTitleFormatRecord(RecordInputStream in) { + super(in); + } + + protected void validateSid(short id) { + if (id != sid) + { + throw new RecordFormatException("NOT A CHARTTITLEFORMAT RECORD"); + } + } + + protected void fillFields(RecordInputStream in) { + m_recs = in.readUShort(); + int idx; + CTFormat ctf; + if (m_formats == null){ + m_formats = new ArrayList(m_recs); + } + for(idx=0;idxmQkz=4PlU1r&lZMMRd|J!BsNrU5k~x!{5=PrLl?bWNr=a&(YkCZ=bV(b2 zs2Z-y5EnuCSPRCiO{9<%UU8wy3Gu?>G?v)_0XNPZx531>Hi_kk4p|>wW zulof3AuBFUK2~Jhn6J^eDIeE(dA?R-$&1F#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