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.

ClientAnchor.java 9.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313
  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.ss.usermodel;
  16. import org.apache.poi.util.Internal;
  17. import org.apache.poi.util.Removal;
  18. /**
  19. * A client anchor is attached to an excel worksheet. It anchors against a
  20. * top-left and bottom-right cell.
  21. *
  22. * @author Yegor Kozlov
  23. */
  24. public interface ClientAnchor {
  25. /**
  26. * Move and Resize With Anchor Cells
  27. * <p>
  28. * Specifies that the current drawing shall move and
  29. * resize to maintain its row and column anchors (i.e. the
  30. * object is anchored to the actual from and to row and column)
  31. * </p>
  32. * @deprecated since POI 3.14beta1 (circa 2015-11-24). Use {@link AnchorType#MOVE_AND_RESIZE} instead.
  33. */
  34. @Removal(version="3.17")
  35. public static final AnchorType MOVE_AND_RESIZE = AnchorType.MOVE_AND_RESIZE;
  36. /**
  37. * Move With Cells but Do Not Resize
  38. * <p>
  39. * Specifies that the current drawing shall move with its
  40. * row and column (i.e. the object is anchored to the
  41. * actual from row and column), but that the size shall remain absolute.
  42. * </p>
  43. * <p>
  44. * If additional rows/columns are added between the from and to locations of the drawing,
  45. * the drawing shall move its to anchors as needed to maintain this same absolute size.
  46. * </p>
  47. * @deprecated since POI 3.14beta1 (circa 2015-11-24). Use {@link AnchorType#MOVE_DONT_RESIZE} instead.
  48. */
  49. @Removal(version="3.17")
  50. public static final AnchorType MOVE_DONT_RESIZE = AnchorType.MOVE_DONT_RESIZE;
  51. /**
  52. * Do Not Move or Resize With Underlying Rows/Columns
  53. * <p>
  54. * Specifies that the current start and end positions shall
  55. * be maintained with respect to the distances from the
  56. * absolute start point of the worksheet.
  57. * </p>
  58. * <p>
  59. * If additional rows/columns are added before the
  60. * drawing, the drawing shall move its anchors as needed
  61. * to maintain this same absolute position.
  62. * </p>
  63. * @deprecated since POI 3.14beta1 (circa 2015-11-24). Use {@link AnchorType#DONT_MOVE_AND_RESIZE} instead.
  64. */
  65. @Removal(version="3.17")
  66. public static final AnchorType DONT_MOVE_AND_RESIZE = AnchorType.DONT_MOVE_AND_RESIZE;
  67. /**
  68. * @since POI 3.14beta1
  69. */
  70. public static enum AnchorType {
  71. /**
  72. * Move and Resize With Anchor Cells (0)
  73. * <p>
  74. * Specifies that the current drawing shall move and
  75. * resize to maintain its row and column anchors (i.e. the
  76. * object is anchored to the actual from and to row and column)
  77. * </p>
  78. */
  79. MOVE_AND_RESIZE(0),
  80. /**
  81. * Don't Move but do Resize With Anchor Cells (1)
  82. * <p>
  83. * Specifies that the current drawing shall not move with its
  84. * row and column, but should be resized. This option is not normally
  85. * used, but is included for completeness.
  86. * </p>
  87. */
  88. DONT_MOVE_DO_RESIZE(1),
  89. /**
  90. * Move With Cells but Do Not Resize (2)
  91. * <p>
  92. * Specifies that the current drawing shall move with its
  93. * row and column (i.e. the object is anchored to the
  94. * actual from row and column), but that the size shall remain absolute.
  95. * </p>
  96. * <p>
  97. * If additional rows/columns are added between the from and to locations of the drawing,
  98. * the drawing shall move its to anchors as needed to maintain this same absolute size.
  99. * </p>
  100. */
  101. MOVE_DONT_RESIZE(2),
  102. /**
  103. * Do Not Move or Resize With Underlying Rows/Columns (3)
  104. * <p>
  105. * Specifies that the current start and end positions shall
  106. * be maintained with respect to the distances from the
  107. * absolute start point of the worksheet.
  108. * </p>
  109. * <p>
  110. * If additional rows/columns are added before the
  111. * drawing, the drawing shall move its anchors as needed
  112. * to maintain this same absolute position.
  113. * </p>
  114. */
  115. DONT_MOVE_AND_RESIZE(3);
  116. public final short value;
  117. // disallow non-sequential enum instance creation
  118. private AnchorType(int value) {
  119. this.value = (short) value;
  120. }
  121. /**
  122. * return the AnchorType corresponding to the code
  123. *
  124. * @param value the anchor type code
  125. * @return the anchor type enum
  126. */
  127. @Internal
  128. public static AnchorType byId(int value) {
  129. return values()[value];
  130. }
  131. }
  132. /**
  133. * Returns the column (0 based) of the first cell.
  134. *
  135. * @return 0-based column of the first cell.
  136. */
  137. public short getCol1();
  138. /**
  139. * Sets the column (0 based) of the first cell.
  140. *
  141. * @param col1 0-based column of the first cell.
  142. */
  143. public void setCol1(int col1);
  144. /**
  145. * Returns the column (0 based) of the second cell.
  146. *
  147. * @return 0-based column of the second cell.
  148. */
  149. public short getCol2();
  150. /**
  151. * Returns the column (0 based) of the second cell.
  152. *
  153. * @param col2 0-based column of the second cell.
  154. */
  155. public void setCol2(int col2);
  156. /**
  157. * Returns the row (0 based) of the first cell.
  158. *
  159. * @return 0-based row of the first cell.
  160. */
  161. public int getRow1();
  162. /**
  163. * Returns the row (0 based) of the first cell.
  164. *
  165. * @param row1 0-based row of the first cell.
  166. */
  167. public void setRow1(int row1);
  168. /**
  169. * Returns the row (0 based) of the second cell.
  170. *
  171. * @return 0-based row of the second cell.
  172. */
  173. public int getRow2();
  174. /**
  175. * Returns the row (0 based) of the first cell.
  176. *
  177. * @param row2 0-based row of the first cell.
  178. */
  179. public void setRow2(int row2);
  180. /**
  181. * Returns the x coordinate within the first cell.
  182. *
  183. * Note - XSSF and HSSF have a slightly different coordinate
  184. * system, values in XSSF are larger by a factor of
  185. * {@link org.apache.poi.util.Units#EMU_PER_PIXEL}
  186. *
  187. * @return the x coordinate within the first cell
  188. */
  189. public int getDx1();
  190. /**
  191. * Sets the x coordinate within the first cell
  192. *
  193. * Note - XSSF and HSSF have a slightly different coordinate
  194. * system, values in XSSF are larger by a factor of
  195. * {@link org.apache.poi.util.Units#EMU_PER_PIXEL}
  196. *
  197. * @param dx1 the x coordinate within the first cell
  198. */
  199. public void setDx1(int dx1);
  200. /**
  201. * Returns the y coordinate within the first cell
  202. *
  203. * Note - XSSF and HSSF have a slightly different coordinate
  204. * system, values in XSSF are larger by a factor of
  205. * {@link org.apache.poi.util.Units#EMU_PER_PIXEL}
  206. *
  207. * @return the y coordinate within the first cell
  208. */
  209. public int getDy1();
  210. /**
  211. * Sets the y coordinate within the first cell
  212. *
  213. * Note - XSSF and HSSF have a slightly different coordinate
  214. * system, values in XSSF are larger by a factor of
  215. * {@link org.apache.poi.util.Units#EMU_PER_PIXEL}
  216. *
  217. * @param dy1 the y coordinate within the first cell
  218. */
  219. public void setDy1(int dy1);
  220. /**
  221. * Sets the y coordinate within the second cell
  222. *
  223. * Note - XSSF and HSSF have a slightly different coordinate
  224. * system, values in XSSF are larger by a factor of
  225. * {@link org.apache.poi.util.Units#EMU_PER_PIXEL}
  226. *
  227. * @return the y coordinate within the second cell
  228. */
  229. public int getDy2();
  230. /**
  231. * Sets the y coordinate within the second cell
  232. *
  233. * Note - XSSF and HSSF have a slightly different coordinate
  234. * system, values in XSSF are larger by a factor of
  235. * {@link org.apache.poi.util.Units#EMU_PER_PIXEL}
  236. *
  237. * @param dy2 the y coordinate within the second cell
  238. */
  239. public void setDy2(int dy2);
  240. /**
  241. * Returns the x coordinate within the second cell
  242. *
  243. * Note - XSSF and HSSF have a slightly different coordinate
  244. * system, values in XSSF are larger by a factor of
  245. * {@link org.apache.poi.util.Units#EMU_PER_PIXEL}
  246. *
  247. * @return the x coordinate within the second cell
  248. */
  249. public int getDx2();
  250. /**
  251. * Sets the x coordinate within the second cell
  252. *
  253. * Note - XSSF and HSSF have a slightly different coordinate
  254. * system, values in XSSF are larger by a factor of
  255. * {@link org.apache.poi.util.Units#EMU_PER_PIXEL}
  256. *
  257. * @param dx2 the x coordinate within the second cell
  258. */
  259. public void setDx2(int dx2);
  260. /**
  261. * Sets the anchor type
  262. * @param anchorType the anchor type to set
  263. * @since POI 3.14
  264. */
  265. public void setAnchorType( AnchorType anchorType );
  266. /**
  267. * Sets the anchor type
  268. * @param anchorType the anchor type to set
  269. * @deprecated POI 3.15. Use {@link #setAnchorType(AnchorType)} instead.
  270. */
  271. @Removal(version="3.17")
  272. public void setAnchorType( int anchorType );
  273. /**
  274. * Gets the anchor type
  275. * Changed from returning an int to an enum in POI 3.14 beta 1.
  276. * @return the anchor type
  277. */
  278. public AnchorType getAnchorType();
  279. }