aboutsummaryrefslogtreecommitdiffstats
path: root/src/ooxml/java/org/apache
diff options
context:
space:
mode:
authorYegor Kozlov <yegor@apache.org>2011-06-24 13:06:04 +0000
committerYegor Kozlov <yegor@apache.org>2011-06-24 13:06:04 +0000
commitb8df0e686b8fccce719a4f25a7f0ea8d32b2e5cf (patch)
tree64e3efd232bb5af2855cd4e33255de934504afe6 /src/ooxml/java/org/apache
parent26c6241c8a10ad0dc8620c936a536b5e004a64da (diff)
downloadpoi-b8df0e686b8fccce719a4f25a7f0ea8d32b2e5cf.tar.gz
poi-b8df0e686b8fccce719a4f25a7f0ea8d32b2e5cf.zip
Bug 49564 - Fixed default behaviour of XSSFCellStyle.getLocked()
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1139288 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/ooxml/java/org/apache')
-rw-r--r--src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFCellStyle.java31
1 files changed, 16 insertions, 15 deletions
diff --git a/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFCellStyle.java b/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFCellStyle.java
index 86a8aac235..51ffe6e06e 100644
--- a/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFCellStyle.java
+++ b/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFCellStyle.java
@@ -565,7 +565,10 @@ public class XSSFCellStyle implements CellStyle {
* @return boolean - whether the cell using this style is hidden
*/
public boolean getHidden() {
- return getCellProtection().getHidden();
+ if (!_cellXf.isSetProtection() || !_cellXf.getProtection().isSetHidden()) {
+ return false;
+ }
+ return _cellXf.getProtection().getHidden();
}
/**
@@ -619,7 +622,10 @@ public class XSSFCellStyle implements CellStyle {
* @return whether the cell using this style are locked
*/
public boolean getLocked() {
- return getCellProtection().getLocked();
+ if (!_cellXf.isSetProtection() || !_cellXf.getProtection().isSetLocked()) {
+ return true;
+ }
+ return _cellXf.getProtection().getLocked();
}
/**
@@ -1169,7 +1175,10 @@ public class XSSFCellStyle implements CellStyle {
* @param hidden - whether the cell using this style should be hidden
*/
public void setHidden(boolean hidden) {
- getCellProtection().setHidden(hidden);
+ if (!_cellXf.isSetProtection()) {
+ _cellXf.addNewProtection();
+ }
+ _cellXf.getProtection().setHidden(hidden);
}
/**
@@ -1218,7 +1227,10 @@ public class XSSFCellStyle implements CellStyle {
* @param locked - whether the cell using this style should be locked
*/
public void setLocked(boolean locked) {
- getCellProtection().setLocked(locked);
+ if (!_cellXf.isSetProtection()) {
+ _cellXf.addNewProtection();
+ }
+ _cellXf.getProtection().setLocked(locked);
}
/**
@@ -1389,17 +1401,6 @@ public class XSSFCellStyle implements CellStyle {
}
/**
- * get a cellProtection from the supplied XML definition
- * @return CTCellProtection
- */
- private CTCellProtection getCellProtection() {
- if (_cellXf.getProtection() == null) {
- _cellXf.addNewProtection();
- }
- return _cellXf.getProtection();
- }
-
- /**
* get the cellAlignment object to use for manage alignment
* @return XSSFCellAlignment - cell alignment
*/