From 977a9327ff80eda514cdf8ff131941b197c66b86 Mon Sep 17 00:00:00 2001 From: Nick Burch Date: Sun, 20 Jul 2014 18:48:48 +0000 Subject: [PATCH] Common interface across the XSSF Ptg / Pxg classes git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1612149 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/poi/ss/formula/ptg/Area3DPxg.java | 6 +++- .../poi/ss/formula/ptg/Deleted3DPxg.java | 6 +++- .../apache/poi/ss/formula/ptg/NameXPxg.java | 6 +++- .../org/apache/poi/ss/formula/ptg/Pxg.java | 29 +++++++++++++++++++ .../apache/poi/ss/formula/ptg/Ref3DPxg.java | 6 +++- 5 files changed, 49 insertions(+), 4 deletions(-) create mode 100644 src/java/org/apache/poi/ss/formula/ptg/Pxg.java diff --git a/src/java/org/apache/poi/ss/formula/ptg/Area3DPxg.java b/src/java/org/apache/poi/ss/formula/ptg/Area3DPxg.java index 84872f57e8..b02f3e1845 100644 --- a/src/java/org/apache/poi/ss/formula/ptg/Area3DPxg.java +++ b/src/java/org/apache/poi/ss/formula/ptg/Area3DPxg.java @@ -28,7 +28,7 @@ import org.apache.poi.util.LittleEndianOutput; *

This is XSSF only, as it stores the sheet / book references * in String form. The HSSF equivalent using indexes is {@link Area3DPtg}

*/ -public final class Area3DPxg extends AreaPtgBase { +public final class Area3DPxg extends AreaPtgBase implements Pxg { private int externalWorkbookNumber = -1; private String sheetName; @@ -71,6 +71,10 @@ public final class Area3DPxg extends AreaPtgBase { public String getSheetName() { return sheetName; } + + public void setSheetName(String sheetName) { + this.sheetName = sheetName; + } public String format2DRefAsString() { return formatReferenceAsString(); diff --git a/src/java/org/apache/poi/ss/formula/ptg/Deleted3DPxg.java b/src/java/org/apache/poi/ss/formula/ptg/Deleted3DPxg.java index 772e10b2f1..147b329b70 100644 --- a/src/java/org/apache/poi/ss/formula/ptg/Deleted3DPxg.java +++ b/src/java/org/apache/poi/ss/formula/ptg/Deleted3DPxg.java @@ -24,7 +24,7 @@ import org.apache.poi.util.LittleEndianOutput; /** * An XSSF only representation of a reference to a deleted area */ -public final class Deleted3DPxg extends OperandPtg { +public final class Deleted3DPxg extends OperandPtg implements Pxg { private int externalWorkbookNumber = -1; private String sheetName; @@ -58,6 +58,10 @@ public final class Deleted3DPxg extends OperandPtg { public String getSheetName() { return sheetName; } + + public void setSheetName(String sheetName) { + this.sheetName = sheetName; + } public String toFormulaString() { StringBuffer sb = new StringBuffer(); diff --git a/src/java/org/apache/poi/ss/formula/ptg/NameXPxg.java b/src/java/org/apache/poi/ss/formula/ptg/NameXPxg.java index 0a49b175f5..bac4fbee2c 100644 --- a/src/java/org/apache/poi/ss/formula/ptg/NameXPxg.java +++ b/src/java/org/apache/poi/ss/formula/ptg/NameXPxg.java @@ -26,7 +26,7 @@ import org.apache.poi.util.LittleEndianOutput; *

This is XSSF only, as it stores the sheet / book references * in String form. The HSSF equivalent using indexes is {@link NameXPtg}

*/ -public final class NameXPxg extends OperandPtg { +public final class NameXPxg extends OperandPtg implements Pxg { private int externalWorkbookNumber = -1; private String sheetName; private String nameName; @@ -66,6 +66,10 @@ public final class NameXPxg extends OperandPtg { public String getNameName() { return nameName; } + + public void setSheetName(String sheetName) { + this.sheetName = sheetName; + } public String toFormulaString() { StringBuffer sb = new StringBuffer(); diff --git a/src/java/org/apache/poi/ss/formula/ptg/Pxg.java b/src/java/org/apache/poi/ss/formula/ptg/Pxg.java new file mode 100644 index 0000000000..fa1c4ff07e --- /dev/null +++ b/src/java/org/apache/poi/ss/formula/ptg/Pxg.java @@ -0,0 +1,29 @@ +/* ==================================================================== + 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.formula.ptg; + +/** + * An XSSF only special kind of Ptg, which stores the sheet / book + * reference in string form. + */ +public interface Pxg { + public int getExternalWorkbookNumber(); + public String getSheetName(); + public void setSheetName(String sheetName); + public String toFormulaString(); +} diff --git a/src/java/org/apache/poi/ss/formula/ptg/Ref3DPxg.java b/src/java/org/apache/poi/ss/formula/ptg/Ref3DPxg.java index ed95892fb6..9a2dc606f6 100644 --- a/src/java/org/apache/poi/ss/formula/ptg/Ref3DPxg.java +++ b/src/java/org/apache/poi/ss/formula/ptg/Ref3DPxg.java @@ -28,7 +28,7 @@ import org.apache.poi.util.LittleEndianOutput; *

This is XSSF only, as it stores the sheet / book references * in String form. The HSSF equivalent using indexes is {@link Ref3DPtg}

*/ -public final class Ref3DPxg extends RefPtgBase { +public final class Ref3DPxg extends RefPtgBase implements Pxg { private int externalWorkbookNumber = -1; private String sheetName; @@ -71,6 +71,10 @@ public final class Ref3DPxg extends RefPtgBase { return sheetName; } + public void setSheetName(String sheetName) { + this.sheetName = sheetName; + } + public String format2DRefAsString() { return formatReferenceAsString(); } -- 2.39.5