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.

XSSFDialogsheet.java 4.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  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.usermodel;
  16. import org.apache.poi.ss.usermodel.Sheet;
  17. import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTDialogsheet;
  18. import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTHeaderFooter;
  19. import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTPageBreak;
  20. import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTPageMargins;
  21. import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTPrintOptions;
  22. import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTSheetFormatPr;
  23. import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTSheetPr;
  24. import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTSheetProtection;
  25. import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTSheetViews;
  26. import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTWorksheet;
  27. //YK: TODO: this is only a prototype
  28. @SuppressWarnings("unused")
  29. public class XSSFDialogsheet extends XSSFSheet implements Sheet{
  30. protected CTDialogsheet dialogsheet;
  31. protected XSSFDialogsheet(XSSFSheet sheet) {
  32. super(sheet.getPackagePart());
  33. this.dialogsheet = CTDialogsheet.Factory.newInstance();
  34. this.worksheet = CTWorksheet.Factory.newInstance();
  35. }
  36. @Override
  37. public XSSFRow createRow(int rowNum) {
  38. return null;
  39. }
  40. protected CTHeaderFooter getDialogHeaderFooter() {
  41. if (dialogsheet.getHeaderFooter() == null) {
  42. dialogsheet.setHeaderFooter(CTHeaderFooter.Factory.newInstance());
  43. }
  44. return dialogsheet.getHeaderFooter();
  45. }
  46. protected CTSheetPr getDialogSheetPr() {
  47. if (dialogsheet.getSheetPr() == null) {
  48. dialogsheet.setSheetPr(CTSheetPr.Factory.newInstance());
  49. }
  50. return dialogsheet.getSheetPr();
  51. }
  52. protected CTPageBreak getDialogColumnBreaks() {
  53. return null;
  54. }
  55. protected CTSheetFormatPr getDialogSheetFormatPr() {
  56. if (dialogsheet.getSheetFormatPr() == null) {
  57. dialogsheet.setSheetFormatPr(CTSheetFormatPr.Factory.newInstance());
  58. }
  59. return dialogsheet.getSheetFormatPr();
  60. }
  61. protected CTPageMargins getDialogPageMargins() {
  62. if (dialogsheet.getPageMargins() == null) {
  63. dialogsheet.setPageMargins(CTPageMargins.Factory.newInstance());
  64. }
  65. return dialogsheet.getPageMargins();
  66. }
  67. protected CTPageBreak getDialogRowBreaks() {
  68. return null;
  69. }
  70. protected CTSheetViews getDialogSheetViews() {
  71. if (dialogsheet.getSheetViews() == null) {
  72. dialogsheet.setSheetViews(CTSheetViews.Factory.newInstance());
  73. dialogsheet.getSheetViews().addNewSheetView();
  74. }
  75. return dialogsheet.getSheetViews();
  76. }
  77. protected CTPrintOptions getDialogPrintOptions() {
  78. if (dialogsheet.getPrintOptions() == null) {
  79. dialogsheet.setPrintOptions(CTPrintOptions.Factory.newInstance());
  80. }
  81. return dialogsheet.getPrintOptions();
  82. }
  83. protected CTSheetProtection getDialogProtection() {
  84. if (dialogsheet.getSheetProtection() == null) {
  85. dialogsheet.setSheetProtection(CTSheetProtection.Factory.newInstance());
  86. }
  87. return dialogsheet.getSheetProtection();
  88. }
  89. public boolean getDialog(){
  90. return true;
  91. }
  92. }