Return-Path: Delivered-To: apmail-poi-commits-archive@locus.apache.org Received: (qmail 78034 invoked from network); 4 Apr 2008 18:00:11 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 4 Apr 2008 18:00:11 -0000 Received: (qmail 44996 invoked by uid 500); 4 Apr 2008 18:00:11 -0000 Delivered-To: apmail-poi-commits-archive@poi.apache.org Received: (qmail 44947 invoked by uid 500); 4 Apr 2008 18:00:11 -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 44938 invoked by uid 99); 4 Apr 2008 18:00:11 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 04 Apr 2008 11:00:11 -0700 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 04 Apr 2008 17:59:37 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 154721A9832; Fri, 4 Apr 2008 10:59:50 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r644797 - in /poi/branches/ooxml/src: java/org/apache/poi/hssf/usermodel/ ooxml/interfaces-jdk14/org/apache/poi/ss/usermodel/ ooxml/interfaces-jdk15/org/apache/poi/ss/usermodel/ ooxml/java/org/apache/poi/xssf/usermodel/ Date: Fri, 04 Apr 2008 17:59:48 -0000 To: commits@poi.apache.org From: nick@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20080404175950.154721A9832@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: nick Date: Fri Apr 4 10:59:43 2008 New Revision: 644797 URL: http://svn.apache.org/viewvc?rev=644797&view=rev Log: Create Hyperlink interface, based on HSSFHyperlink. Stub out for XSSF, but have yet to implement. (See WithMoreVariousData.xlsx for all the different kinds when implementing) Added: poi/branches/ooxml/src/ooxml/interfaces-jdk14/org/apache/poi/ss/usermodel/Hyperlink.java (with props) poi/branches/ooxml/src/ooxml/interfaces-jdk15/org/apache/poi/ss/usermodel/Hyperlink.java (with props) poi/branches/ooxml/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFHyperlink.java (with props) Modified: poi/branches/ooxml/src/java/org/apache/poi/hssf/usermodel/HSSFCreationHelper.java poi/branches/ooxml/src/java/org/apache/poi/hssf/usermodel/HSSFHyperlink.java poi/branches/ooxml/src/ooxml/interfaces-jdk15/org/apache/poi/ss/usermodel/CreationHelper.java poi/branches/ooxml/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFCreationHelper.java Modified: poi/branches/ooxml/src/java/org/apache/poi/hssf/usermodel/HSSFCreationHelper.java URL: http://svn.apache.org/viewvc/poi/branches/ooxml/src/java/org/apache/poi/hssf/usermodel/HSSFCreationHelper.java?rev=644797&r1=644796&r2=644797&view=diff ============================================================================== --- poi/branches/ooxml/src/java/org/apache/poi/hssf/usermodel/HSSFCreationHelper.java (original) +++ poi/branches/ooxml/src/java/org/apache/poi/hssf/usermodel/HSSFCreationHelper.java Fri Apr 4 10:59:43 2008 @@ -17,6 +17,7 @@ package org.apache.poi.hssf.usermodel; import org.apache.poi.ss.usermodel.CreationHelper; +import org.apache.poi.ss.usermodel.Sheet; public class HSSFCreationHelper implements CreationHelper { private HSSFWorkbook workbook; @@ -38,5 +39,12 @@ public HSSFDataFormat createDataFormat() { return dataFormat; + } + + public HSSFHyperlink createHyperlink(int type, Sheet sheetFor) { + return createHyperlink(type); + } + public HSSFHyperlink createHyperlink(int type) { + return new HSSFHyperlink(type); } } Modified: poi/branches/ooxml/src/java/org/apache/poi/hssf/usermodel/HSSFHyperlink.java URL: http://svn.apache.org/viewvc/poi/branches/ooxml/src/java/org/apache/poi/hssf/usermodel/HSSFHyperlink.java?rev=644797&r1=644796&r2=644797&view=diff ============================================================================== --- poi/branches/ooxml/src/java/org/apache/poi/hssf/usermodel/HSSFHyperlink.java (original) +++ poi/branches/ooxml/src/java/org/apache/poi/hssf/usermodel/HSSFHyperlink.java Fri Apr 4 10:59:43 2008 @@ -16,22 +16,15 @@ ==================================================================== */ package org.apache.poi.hssf.usermodel; -import org.apache.poi.hssf.record.EscherAggregate; -import org.apache.poi.hssf.record.NoteRecord; -import org.apache.poi.hssf.record.TextObjectRecord; import org.apache.poi.hssf.record.HyperlinkRecord; -import org.apache.poi.ddf.*; - -import java.util.Map; -import java.util.List; -import java.util.Iterator; +import org.apache.poi.ss.usermodel.Hyperlink; /** * Represents an Excel hyperlink. * * @author Yegor Kozlov (yegor at apache dot org) */ -public class HSSFHyperlink { +public class HSSFHyperlink implements Hyperlink { /** * Link to a existing file or web page @@ -209,7 +202,7 @@ * * @return the type of this hyperlink */ - protected int getType(){ + public int getType(){ return link_type; } } Added: poi/branches/ooxml/src/ooxml/interfaces-jdk14/org/apache/poi/ss/usermodel/Hyperlink.java URL: http://svn.apache.org/viewvc/poi/branches/ooxml/src/ooxml/interfaces-jdk14/org/apache/poi/ss/usermodel/Hyperlink.java?rev=644797&view=auto ============================================================================== --- poi/branches/ooxml/src/ooxml/interfaces-jdk14/org/apache/poi/ss/usermodel/Hyperlink.java (added) +++ poi/branches/ooxml/src/ooxml/interfaces-jdk14/org/apache/poi/ss/usermodel/Hyperlink.java Fri Apr 4 10:59:43 2008 @@ -0,0 +1,40 @@ +/* ==================================================================== + 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.ss.usermodel; + +public interface Hyperlink { + /** + * Link to a existing file or web page + */ + public static final int LINK_URL = 1; + + /** + * Link to a place in this document + */ + public static final int LINK_DOCUMENT = 2; + + /** + * Link to an E-mail address + */ + public static final int LINK_EMAIL = 3; + + /** + * Link to a file + */ + public static final int LINK_FILE = 4; +} Propchange: poi/branches/ooxml/src/ooxml/interfaces-jdk14/org/apache/poi/ss/usermodel/Hyperlink.java ------------------------------------------------------------------------------ svn:eol-style = native Modified: poi/branches/ooxml/src/ooxml/interfaces-jdk15/org/apache/poi/ss/usermodel/CreationHelper.java URL: http://svn.apache.org/viewvc/poi/branches/ooxml/src/ooxml/interfaces-jdk15/org/apache/poi/ss/usermodel/CreationHelper.java?rev=644797&r1=644796&r2=644797&view=diff ============================================================================== --- poi/branches/ooxml/src/ooxml/interfaces-jdk15/org/apache/poi/ss/usermodel/CreationHelper.java (original) +++ poi/branches/ooxml/src/ooxml/interfaces-jdk15/org/apache/poi/ss/usermodel/CreationHelper.java Fri Apr 4 10:59:43 2008 @@ -39,4 +39,10 @@ * Creates a new DataFormat instance */ DataFormat createDataFormat(); + + /** + * Creates a new Hyperlink, of the given type, + * for the given sheet + */ + Hyperlink createHyperlink(int type, Sheet sheetFor); } Added: poi/branches/ooxml/src/ooxml/interfaces-jdk15/org/apache/poi/ss/usermodel/Hyperlink.java URL: http://svn.apache.org/viewvc/poi/branches/ooxml/src/ooxml/interfaces-jdk15/org/apache/poi/ss/usermodel/Hyperlink.java?rev=644797&view=auto ============================================================================== --- poi/branches/ooxml/src/ooxml/interfaces-jdk15/org/apache/poi/ss/usermodel/Hyperlink.java (added) +++ poi/branches/ooxml/src/ooxml/interfaces-jdk15/org/apache/poi/ss/usermodel/Hyperlink.java Fri Apr 4 10:59:43 2008 @@ -0,0 +1,135 @@ +/* ==================================================================== + 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.ss.usermodel; + +/** + * Represents an Excel hyperlink. + */ +public interface Hyperlink { + /** + * Link to a existing file or web page + */ + public static final int LINK_URL = 1; + + /** + * Link to a place in this document + */ + public static final int LINK_DOCUMENT = 2; + + /** + * Link to an E-mail address + */ + public static final int LINK_EMAIL = 3; + + /** + * Link to a file + */ + public static final int LINK_FILE = 4; + + /** + * Return the row of the first cell that contains the hyperlink + * + * @return the 0-based row of the cell that contains the hyperlink + */ + public int getFirstRow(); + + /** + * Set the row of the first cell that contains the hyperlink + * + * @param row the 0-based row of the first cell that contains the hyperlink + */ + public void setFirstRow(int row); + + /** + * Return the row of the last cell that contains the hyperlink + * + * @return the 0-based row of the last cell that contains the hyperlink + */ + public int getLastRow(); + + /** + * Set the row of the last cell that contains the hyperlink + * + * @param row the 0-based row of the last cell that contains the hyperlink + */ + public void setLastRow(int row); + + /** + * Return the column of the first cell that contains the hyperlink + * + * @return the 0-based column of the first cell that contains the hyperlink + */ + public short getFirstColumn(); + + /** + * Set the column of the first cell that contains the hyperlink + * + * @param col the 0-based column of the first cell that contains the hyperlink + */ + public void setFirstColumn(short col); + + /** + * Return the column of the last cell that contains the hyperlink + * + * @return the 0-based column of the last cell that contains the hyperlink + */ + public short getLastColumn(); + + /** + * Set the column of the last cell that contains the hyperlink + * + * @param col the 0-based column of the last cell that contains the hyperlink + */ + public void setLastColumn(short col); + + + + /** + * Hypelink address. Depending on the hyperlink type it can be URL, e-mail, patrh to a file, etc. + * + * @return the address of this hyperlink + */ + public String getAddress(); + + /** + * Hypelink address. Depending on the hyperlink type it can be URL, e-mail, patrh to a file, etc. + * + * @param address the address of this hyperlink + */ + public void setAddress(String address); + + /** + * Return text label for this hyperlink + * + * @return text to display + */ + public String getLabel(); + + /** + * Sets text label for this hyperlink + * + * @param label text label for this hyperlink + */ + public void setLabel(String label); + + /** + * Return the type of this hyperlink + * + * @return the type of this hyperlink + */ + public int getType(); +} Propchange: poi/branches/ooxml/src/ooxml/interfaces-jdk15/org/apache/poi/ss/usermodel/Hyperlink.java ------------------------------------------------------------------------------ svn:eol-style = native Modified: poi/branches/ooxml/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFCreationHelper.java URL: http://svn.apache.org/viewvc/poi/branches/ooxml/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFCreationHelper.java?rev=644797&r1=644796&r2=644797&view=diff ============================================================================== --- poi/branches/ooxml/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFCreationHelper.java (original) +++ poi/branches/ooxml/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFCreationHelper.java Fri Apr 4 10:59:43 2008 @@ -18,7 +18,9 @@ import org.apache.poi.ss.usermodel.CreationHelper; import org.apache.poi.ss.usermodel.DataFormat; +import org.apache.poi.ss.usermodel.Hyperlink; import org.apache.poi.ss.usermodel.RichTextString; +import org.apache.poi.ss.usermodel.Sheet; public class XSSFCreationHelper implements CreationHelper { private XSSFWorkbook workbook; @@ -39,5 +41,9 @@ public DataFormat createDataFormat() { return dataFormat; + } + + public Hyperlink createHyperlink(int type, Sheet sheetFor) { + return new XSSFHyperlink(type, (XSSFSheet)sheetFor); } } Added: poi/branches/ooxml/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFHyperlink.java URL: http://svn.apache.org/viewvc/poi/branches/ooxml/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFHyperlink.java?rev=644797&view=auto ============================================================================== --- poi/branches/ooxml/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFHyperlink.java (added) +++ poi/branches/ooxml/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFHyperlink.java Fri Apr 4 10:59:43 2008 @@ -0,0 +1,121 @@ +/* ==================================================================== + 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.xssf.usermodel; + +import org.apache.poi.ss.usermodel.Hyperlink; +import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTHyperlink; + +import org.openxml4j.opc.Package; +import org.openxml4j.opc.PackagePart; + +/** + * XSSF Implementation of a Hyperlink. + * Note - unlike with HSSF, many kinds of hyperlink + * are largely stored as relations of the sheet + */ +public class XSSFHyperlink implements Hyperlink { + private int type; + private XSSFSheet sheet; + private CTHyperlink ctHyperlink; + + protected XSSFHyperlink(int type, XSSFSheet sheet) { + this.type = type; + this.sheet = sheet; + this.ctHyperlink = CTHyperlink.Factory.newInstance(); + } + protected XSSFHyperlink(CTHyperlink ctHyperlink, XSSFSheet sheet) { + this.sheet = sheet; + this.ctHyperlink = ctHyperlink; + + // Figure out the Hyperlink type + // TODO + } + + /** + * Returns the underlying hyperlink object + */ + protected CTHyperlink getCTHyperlink() { + return ctHyperlink; + } + + /** + * Do we need to a relation too, to represent + * this hyperlink? + */ + public boolean needsRelationToo() { + // TODO + return false; + } + + /** + * Generates the relation if required + */ + protected void generateRelationIfNeeded(Package pkg, PackagePart sheetPart) { + // TODO + } + + public int getType() { + return type; + } + + public String getAddress() { + // TODO Auto-generated method stub + return null; + } + public String getLabel() { + // TODO Auto-generated method stub + return null; + } + + public void setLabel(String label) { + // TODO Auto-generated method stub + } + public void setAddress(String address) { + // TODO Auto-generated method stub + + } + + public short getFirstColumn() { + // TODO Auto-generated method stub + return 0; + } + public int getFirstRow() { + // TODO Auto-generated method stub + return 0; + } + public short getLastColumn() { + // TODO Auto-generated method stub + return 0; + } + public int getLastRow() { + // TODO Auto-generated method stub + return 0; + } + + public void setFirstColumn(short col) { + // TODO Auto-generated method stub + } + public void setFirstRow(int row) { + // TODO Auto-generated method stub + } + public void setLastColumn(short col) { + // TODO Auto-generated method stub + } + public void setLastRow(int row) { + // TODO Auto-generated method stub + } +} Propchange: poi/branches/ooxml/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFHyperlink.java ------------------------------------------------------------------------------ svn:eol-style = native --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org For additional commands, e-mail: commits-help@poi.apache.org