You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

XSSFBComment.java 3.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. /* ====================================================================
  2. Licensed to the Apache Software Foundation (ASF) under one or more
  3. contributor license agreements. See the NOTICE file distributed with
  4. this work for additional information regarding copyright ownership.
  5. The ASF licenses this file to You under the Apache License, Version 2.0
  6. (the "License"); you may not use this file except in compliance with
  7. the License. You may obtain a copy of the License at
  8. http://www.apache.org/licenses/LICENSE-2.0
  9. Unless required by applicable law or agreed to in writing, software
  10. distributed under the License is distributed on an "AS IS" BASIS,
  11. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. See the License for the specific language governing permissions and
  13. limitations under the License.
  14. ==================================================================== */
  15. package org.apache.poi.xssf.binary;
  16. import org.apache.poi.ss.usermodel.ClientAnchor;
  17. import org.apache.poi.ss.usermodel.RichTextString;
  18. import org.apache.poi.ss.util.CellAddress;
  19. import org.apache.poi.util.Internal;
  20. import org.apache.poi.xssf.usermodel.XSSFComment;
  21. @Internal
  22. class XSSFBComment extends XSSFComment {
  23. private final CellAddress cellAddress;
  24. private final String author;
  25. private final XSSFBRichTextString comment;
  26. private boolean visible = true;
  27. XSSFBComment(CellAddress cellAddress, String author, String comment) {
  28. super(null, null, null);
  29. this.cellAddress = cellAddress;
  30. this.author = author;
  31. this.comment = new XSSFBRichTextString(comment);
  32. }
  33. @Override
  34. public void setVisible(boolean visible) {
  35. throw new IllegalArgumentException("XSSFBComment is read only.");
  36. }
  37. @Override
  38. public boolean isVisible() {
  39. return visible;
  40. }
  41. @Override
  42. public CellAddress getAddress() {
  43. return cellAddress;
  44. }
  45. @Override
  46. public void setAddress(CellAddress addr) {
  47. throw new IllegalArgumentException("XSSFBComment is read only");
  48. }
  49. @Override
  50. public void setAddress(int row, int col) {
  51. throw new IllegalArgumentException("XSSFBComment is read only");
  52. }
  53. @Override
  54. public int getRow() {
  55. return cellAddress.getRow();
  56. }
  57. @Override
  58. public void setRow(int row) {
  59. throw new IllegalArgumentException("XSSFBComment is read only");
  60. }
  61. @Override
  62. public int getColumn() {
  63. return cellAddress.getColumn();
  64. }
  65. @Override
  66. public void setColumn(int col) {
  67. throw new IllegalArgumentException("XSSFBComment is read only");
  68. }
  69. @Override
  70. public String getAuthor() {
  71. return author;
  72. }
  73. @Override
  74. public void setAuthor(String author) {
  75. throw new IllegalArgumentException("XSSFBComment is read only");
  76. }
  77. @Override
  78. public XSSFBRichTextString getString() {
  79. return comment;
  80. }
  81. @Override
  82. public void setString(RichTextString string) {
  83. throw new IllegalArgumentException("XSSFBComment is read only");
  84. }
  85. @Override
  86. public ClientAnchor getClientAnchor() {
  87. return null;
  88. }
  89. }