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
This commit is contained in:
Nick Burch 2014-07-20 18:48:48 +00:00
parent 4345b06cab
commit 44a6aef699
5 changed files with 49 additions and 4 deletions

View File

@ -28,7 +28,7 @@ import org.apache.poi.util.LittleEndianOutput;
* <p>This is XSSF only, as it stores the sheet / book references
* in String form. The HSSF equivalent using indexes is {@link Area3DPtg}</p>
*/
public final class Area3DPxg extends AreaPtgBase {
public final class Area3DPxg extends AreaPtgBase implements Pxg {
private int externalWorkbookNumber = -1;
private String sheetName;
@ -72,6 +72,10 @@ public final class Area3DPxg extends AreaPtgBase {
return sheetName;
}
public void setSheetName(String sheetName) {
this.sheetName = sheetName;
}
public String format2DRefAsString() {
return formatReferenceAsString();
}

View File

@ -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;
@ -59,6 +59,10 @@ public final class Deleted3DPxg extends OperandPtg {
return sheetName;
}
public void setSheetName(String sheetName) {
this.sheetName = sheetName;
}
public String toFormulaString() {
StringBuffer sb = new StringBuffer();
if (externalWorkbookNumber >= 0) {

View File

@ -26,7 +26,7 @@ import org.apache.poi.util.LittleEndianOutput;
* <p>This is XSSF only, as it stores the sheet / book references
* in String form. The HSSF equivalent using indexes is {@link NameXPtg}</p>
*/
public final class NameXPxg extends OperandPtg {
public final class NameXPxg extends OperandPtg implements Pxg {
private int externalWorkbookNumber = -1;
private String sheetName;
private String nameName;
@ -67,6 +67,10 @@ public final class NameXPxg extends OperandPtg {
return nameName;
}
public void setSheetName(String sheetName) {
this.sheetName = sheetName;
}
public String toFormulaString() {
StringBuffer sb = new StringBuffer();
if (externalWorkbookNumber >= 0) {

View File

@ -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();
}

View File

@ -28,7 +28,7 @@ import org.apache.poi.util.LittleEndianOutput;
* <p>This is XSSF only, as it stores the sheet / book references
* in String form. The HSSF equivalent using indexes is {@link Ref3DPtg}</p>
*/
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();
}