Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

Area.java 24KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638
  1. /*
  2. Copyright 2004 The Apache Software Foundation.
  3. Licensed under the Apache License, Version 2.0 (the "License");
  4. you may not use this file except in compliance with the License.
  5. You may obtain a copy of the License at
  6. http://www.apache.org/licenses/LICENSE-2.0
  7. Unless required by applicable law or agreed to in writing, software
  8. distributed under the License is distributed on an "AS IS" BASIS,
  9. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10. See the License for the specific language governing permissions and
  11. limitations under the License.
  12. * Created on 26/01/2004
  13. * $Id$
  14. */
  15. package org.apache.fop.area;
  16. import java.awt.geom.AffineTransform;
  17. import java.awt.geom.Point2D;
  18. import java.awt.geom.Rectangle2D;
  19. import java.util.ArrayList;
  20. import org.apache.fop.datastructs.Node;
  21. import org.apache.fop.fo.FONode;
  22. import org.apache.fop.fo.expr.PropertyException;
  23. import org.apache.fop.fo.flow.FoPageSequence;
  24. import org.apache.fop.fo.properties.WritingMode;
  25. /**
  26. * The base class for all geometrical areas. <code>Area</code> extends
  27. * <code>AreaNode</code> because all areas will find themselves in a tree of
  28. * some kind. It represents its geometry with a
  29. * <code>Rectangle2D.Double</code>, whose dimensions are expressed in Java
  30. * and XSL points, i.e. 1/72 of an inch, which facilitates conversions to
  31. * integral millipoints. It also allows the use of Java facilities like
  32. * <code>java.awt.GraphicsConfiguration.getNormalizingTransform()</code>
  33. * which, "Returns a AffineTransform that can be concatenated with the default
  34. * AffineTransform of a GraphicsConfiguration so that 72 units in user space
  35. * equals 1 inch in device space."
  36. * @author pbw
  37. * @version $Revision$ $Name$
  38. */
  39. public class Area extends AreaNode implements Cloneable {
  40. /**
  41. * The total geometrical area covered by this <code>Area</code>, including
  42. * content rectangle, padding, borders and spaces or margins. The
  43. * <code>width</code> of this <code>Rectangle</code> is the
  44. * <code>inline-progression-dimension</code> of the area, and the
  45. * <code>height</code> is the <code>block-progression-dimension</code>.
  46. * <p>The spaces are always implicitly defined with respect to the borders.
  47. * The only way in which individual margins/spaces can be derived is with
  48. * respect to the padding rectangle, so this rectangle is always associated
  49. * with a point offset to the top left corner of the padding rectangle.
  50. * Note that spaces/margins are dynamic, in that they are frequently
  51. * adjusted or eliminated in the course of layout.
  52. * */
  53. protected SpacesRectangle spaces = null;
  54. /**
  55. * @return the space
  56. */
  57. protected SpacesRectangle getSpaces() {
  58. return spaces;
  59. }
  60. /** Geometrical area embraced by the border rectangle of this area. Note
  61. * that borders may be collapsed.
  62. */
  63. protected BorderRectangle borders = null;
  64. /**
  65. * @return the border
  66. */
  67. protected BorderRectangle getBorders() {
  68. return borders;
  69. }
  70. /** Geometrical area embraced by the padding rectangle of this area.
  71. * N.B. The background (if any) is rendered in the padding rectangle. */
  72. protected PaddingRectangle padding = null;
  73. /**
  74. * @return the padding
  75. */
  76. protected PaddingRectangle getPadding() {
  77. return padding;
  78. }
  79. /** Geometrical area embraced by the content rectangle of this area */
  80. protected ContentRectangle content = null;
  81. /**
  82. * Gets the <i>content-rectangle</i> of this
  83. * @return the content
  84. */
  85. protected ContentRectangle getContent() {
  86. return content;
  87. }
  88. protected void setMargins(
  89. double before, double after, double start, double end) {
  90. spaces.setBefore(before);
  91. spaces.setAfter(after);
  92. spaces.setStart(start);
  93. spaces.setEnd(end);
  94. }
  95. /** Translates this area into position in its parent area */
  96. protected AffineTransform translation = null;
  97. /**
  98. * @return the translation
  99. */
  100. protected AffineTransform getTranslation() {
  101. return translation;
  102. }
  103. /**
  104. * @param translation to set
  105. */
  106. protected void setTranslation(AffineTransform translation) {
  107. this.translation = translation;
  108. }
  109. /** The writing-mode of the generating FO */
  110. protected int contentWritingMode;
  111. /** True if the <code>writing-mode</code> of the content area is
  112. * horizontal */
  113. protected boolean contentIsHorizontal = true;
  114. /** True if the the <code>writing-mode</code> of the content area is
  115. * left-to-right */
  116. protected boolean contentLeftToRight = true;
  117. /** The rotation trait for the content rectangle of this area */
  118. protected int contentRotation;
  119. /** The writing-mode of the parent of the generating FO. This may
  120. * differ from the writing mode of the generating FO if this is a
  121. * <code>reference-area</code>. */
  122. protected int frameWritingMode;
  123. protected void setup() {
  124. try {
  125. contentWritingMode = generatedBy.getWritingMode();
  126. contentIsHorizontal = WritingMode.isHorizontal(contentWritingMode);
  127. contentLeftToRight = WritingMode.isLeftToRight(contentWritingMode);
  128. contentRotation = generatedBy.getRefOrientation();
  129. frameWritingMode = contentWritingMode;
  130. } catch (PropertyException e) {
  131. throw new RuntimeException(e.getMessage());
  132. }
  133. setupFrames();
  134. }
  135. protected void setupFrames() {
  136. content = new ContentRectangle(this);
  137. padding = content.getPadding();
  138. borders = padding.getBorders();
  139. spaces = borders.getSpaces();
  140. }
  141. /**
  142. * Constructs an <code>Area</code> with a null rectangular area
  143. * @param pageSeq through which this area was generated
  144. * @param generatedBy the given <code>FONode</code> generated this
  145. * @param parent <code>Node</code> of this
  146. * @param sync the object on which this area is synchronized <code>for tree
  147. * operations</code>.
  148. * @throws IndexOutOfBoundsException
  149. */
  150. public Area(
  151. FoPageSequence pageSeq,
  152. FONode generatedBy,
  153. Node parent,
  154. Object sync) {
  155. super(pageSeq, generatedBy, parent, sync);
  156. setup();
  157. }
  158. /**
  159. * Constructs an <code>Area</code> which is the root of a tree, and is
  160. * synchronized on itself
  161. * @param pageSeq through which this area was generated
  162. * @param generatedBy the given <code>FONode</code> generated this
  163. */
  164. public Area(
  165. FoPageSequence pageSeq,
  166. FONode generatedBy) {
  167. super(pageSeq, generatedBy);
  168. setup();
  169. }
  170. /** An initially null range of minima and maxima for
  171. * <code>inline-progression-dimension</code> and
  172. * <code>block-progression-dimension</code>.
  173. */
  174. protected AreaRange pageSpaceRange = new AreaRange();
  175. /**
  176. * @return the pageSpaceRange
  177. */
  178. public AreaRange getPageSpaceRange() {
  179. return pageSpaceRange;
  180. }
  181. /**
  182. * @param pageSpaceRange to set
  183. */
  184. public void setPageSpaceRange(AreaRange pageSpaceRange) {
  185. this.pageSpaceRange = pageSpaceRange;
  186. }
  187. /** Initial size of the <code>listeners</code> array */
  188. private static final int INITIAL_LISTENER_SIZE = 4;
  189. /** Array of registered <code>AreaListener</code>s */
  190. private ArrayList listeners = null;
  191. /**
  192. * Registers a listener to be notified on any change of dimension in the
  193. * <code>Rectangle2D</code> content
  194. * @param listener to be notified
  195. */
  196. public void registerAreaListener(AreaListener listener) {
  197. synchronized (this) {
  198. if (listeners == null) {
  199. listeners = new ArrayList(INITIAL_LISTENER_SIZE);
  200. }
  201. listeners.add(listener);
  202. }
  203. }
  204. /**
  205. * Notifies any registered listener of a change of dimensions in the
  206. * <code>Rectangle2D</code> content
  207. */
  208. protected void notifyListeners() {
  209. for (int i = 0; i < listeners.size(); i++) {
  210. synchronized (this) {
  211. ((AreaListener)(listeners.get(i))).setDimensions(content);
  212. }
  213. }
  214. }
  215. /**
  216. * Returns a <code>Rectangle2D</code> constructed from the normailized
  217. * values of offset and dimensions expressed in terms of
  218. * <i>inline-progression-direction</i> and
  219. * <i>block-progression-direction</i>
  220. * @param ipOffset
  221. * @param bpOffset
  222. * @param ipDim the <i>inline-progression-dimension</i>
  223. * @param bpDim the <i>block-progression-dimension</i>
  224. * @param wMode
  225. * @return
  226. * @throws PropertyException
  227. */
  228. public static Rectangle2D.Double rectRelToAbs(
  229. double ipOffset, double bpOffset, double ipDim, double bpDim,
  230. int wMode) throws PropertyException {
  231. if (WritingMode.isHorizontal(wMode)) {
  232. return new Rectangle2D.Double(ipOffset, bpOffset, ipDim, bpDim);
  233. }
  234. return new Rectangle2D.Double(bpOffset, ipOffset, bpDim, ipDim);
  235. }
  236. /**
  237. * Normalizes a pair of values representing an
  238. * <i>inline-progression-dimension</i> and a
  239. * <i>block-progression-dimension</i> by converting them to a
  240. * <i>Point2D</i> representing the corresponding X and Y values in
  241. * Java 2D user co-ordinates.
  242. * @param ipDim the <i>inline-progression-dimension</i>
  243. * @param bpDim the <i>block-progression-dimension</i>
  244. * @param writingMode
  245. * @return the corresponding x, y values
  246. * @throws PropertyException
  247. */
  248. public static DimensionDbl dimsRelToAbs (
  249. double ipDim, double bpDim, int writingMode)
  250. throws PropertyException {
  251. if (WritingMode.isHorizontal(writingMode)) {
  252. return new DimensionDbl(ipDim, bpDim);
  253. }
  254. return new DimensionDbl(bpDim, ipDim);
  255. }
  256. /**
  257. * Normalizes a <code>DimensonDbl</code> representing an
  258. * <i>inline-progression-dimension</i> (<i>width</i>) and a
  259. * <i>block-progression-dimension</i> (<i>height</i>) by converting them to
  260. * a <code>DimensonDbl</code> representing the corresponding width and
  261. * height values in Java 2D user co-ordinates.
  262. * @param in the dimensions expressed as <i>inline-progression-dimension</i>
  263. * and <i>block-progression-dimension</i>
  264. * @param writingMode
  265. * @return the corresponding Java2D width, height values
  266. * @throws PropertyException
  267. */
  268. public static DimensionDbl dimsRelToAbs (DimensionDbl in, int writingMode)
  269. throws PropertyException {
  270. if (WritingMode.isHorizontal(writingMode)) {
  271. return in;
  272. }
  273. double width, height;
  274. width = in.getHeight();
  275. height = in.getWidth();
  276. in.setSize(width, height);
  277. return in;
  278. }
  279. /**
  280. * Returns a <code>Rectangle2D</code> constructed from the normailized
  281. * values of offset and dimensions expressed in terms of
  282. * <i>inline-progression-direction</i> and
  283. * <i>block-progression-direction</i>
  284. * @param offset
  285. * @param wideHigh
  286. * @param writingMode
  287. * @return
  288. * @throws PropertyException
  289. */
  290. public static Rectangle2D dimsRelToAbs (
  291. Point2D offset, DimensionDbl wideHigh, int writingMode)
  292. throws PropertyException {
  293. if (WritingMode.isHorizontal(writingMode)) {
  294. return new Rectangle2D.Double(
  295. offset.getX(), offset.getY(),
  296. wideHigh.getWidth(), wideHigh.getHeight());
  297. }
  298. return new Rectangle2D.Double(
  299. offset.getY(), offset.getX(),
  300. wideHigh.getHeight(), wideHigh.getWidth());
  301. }
  302. /**
  303. * A nested class of Area, representing the geometry of one of the frames
  304. * associated with this area. These include the content-rectangle,
  305. * border-rectangle, padding-rectangle, spaces-rectangle and
  306. * allocation-rectangle.
  307. * @author pbw
  308. * @version $Revision$ $Name$
  309. */
  310. public class AreaGeometry extends Rectangle2D.Double {
  311. protected int writingMode;
  312. protected boolean isLeftToRight;
  313. protected boolean isHorizontal;
  314. /**
  315. * Creates an empty rectangle, with height and width of 0.0 at an
  316. * offset of 0.0,0.0, with the given writing-mode
  317. * @param writingMode
  318. */
  319. public AreaGeometry(int writingMode) {
  320. super();
  321. this.writingMode = writingMode;
  322. try {
  323. isHorizontal = WritingMode.isHorizontal(writingMode);
  324. isLeftToRight = WritingMode.isLeftToRight(writingMode);
  325. } catch (PropertyException e) {
  326. throw new RuntimeException(e.getMessage());
  327. }
  328. }
  329. /**
  330. * Creates a rectangle with an origin determined by the parameters
  331. * <code>ipOrigin</code> and <code>bpOrigin</code>, and with width and
  332. * height determined by the parameters <code>ipDim</code> and
  333. * <code>bpDim</code>. The translation of the relative offsets and
  334. * dimensions into absolute directions is determined by the parameter
  335. * <code>writingMode</code>.
  336. * @param writingMode the <i>writing-mode</i> of the instantiated
  337. * rectangular area, expressed as an enumerated constant from the
  338. * set given in <code>WritingMode</code>.
  339. * @param ipOrigin the origin point along the
  340. * <i>inline-progression-direction</i> axis
  341. * @param bpOrigin the origin point along the
  342. * <i>block-progression-direction</i> axis
  343. * @param ipDim the size of the rectangular area along the
  344. * <i>inline-progression-direction</i> axis
  345. * @param bpDim the size of the rectangular area along the
  346. * i>block-progression-direction</i> axis
  347. */
  348. public AreaGeometry(int writingMode,
  349. double ipOrigin, double bpOrigin, double ipDim, double bpDim) {
  350. this(writingMode);
  351. try {
  352. setRect(rectRelToAbs(
  353. ipOrigin, bpOrigin, ipDim, bpDim, writingMode));
  354. } catch (PropertyException e) {
  355. throw new RuntimeException(e);
  356. }
  357. }
  358. /**
  359. * Creates a rectangle whose dimensions and offset are expressed in the
  360. * parameter <code>geometry</code>. The rectangular area has the
  361. * given <i>writing-mode</i>
  362. * @param writingMode the <i>writing-mode</i> of the instantiated
  363. * rectangular area, expressed as an enumerated constant from the
  364. * set given in <code>WritingMode</code>.
  365. * @param geometry the dimensions and offset of the geometrical area
  366. * represented by <code>this</code>.
  367. */
  368. public AreaGeometry(int writingMode, Rectangle2D geometry) {
  369. this(writingMode);
  370. setRect(geometry);
  371. }
  372. /**
  373. * Overrides <code>Rectangle2D</code> method to set the dimensions
  374. * and offset of the rectangular area. The dimensions and offset are
  375. * expressed in relative terms, which must be translated into absolute
  376. * terms according to the <i>writing-mode</i> of <code>this</code>.
  377. * @param ipOrigin the origin point along the
  378. * <i>inline-progression-direction</i> axis
  379. * @param bpOrigin the origin point along the
  380. * <i>block-progression-direction</i> axis
  381. * @param ipDim the size of the rectangular area along the
  382. * <i>inline-progression-direction</i> axis
  383. * @param bpDim the size of the rectangular area along the
  384. * i>block-progression-direction</i> axis
  385. * @see java.awt.geom.Rectangle2D#setRect(double, double, double, double)
  386. */
  387. public void setRect(
  388. double ipOrigin, double bpOrigin, double ipDim, double bpDim) {
  389. // Now work out what belongs where
  390. try {
  391. setRect(rectRelToAbs(
  392. ipOrigin, bpOrigin, ipDim, bpDim, writingMode));
  393. } catch (PropertyException e) {
  394. throw new RuntimeException(e);
  395. }
  396. }
  397. /**
  398. * Gets the writing-mode of this rectangular area, expressed as an
  399. * enumerated constant from <code>WritingMode</code>
  400. * @return the emnumerated writing-mode
  401. */
  402. public int getWritingMode() {
  403. return writingMode;
  404. }
  405. /**
  406. * Gets the writing-mode of the <i>content-rectangle</i> of
  407. * <code>this</code> <code>Area</code>
  408. * @return the writing-mode of the <i>content-rectangle</i>
  409. */
  410. public int getContentWritingMode() {
  411. return contentWritingMode;
  412. }
  413. /**
  414. * Gets the writing-mode of the framing rectangles of the content of
  415. * <code>this</code> <code>Area</code>
  416. * @return the writing-mode of the framing rectangles
  417. */
  418. public int getFrameWritingMode() {
  419. return contentWritingMode;
  420. }
  421. /**
  422. * Gets the reference-orientation applying to the contents of this
  423. * area, expressed as a normalized angle; one of 0, 90, 180 or 270.
  424. * TODO - should this simply be 0. Should reference-orientation on
  425. * all non-reference areas be set to 0; i.e. not rotated with respect
  426. * to the ancestor reference-area?
  427. * BEWARE - this is set to 0
  428. * @return the reference-orientation
  429. */
  430. public int getContentRotation() {
  431. return contentRotation;
  432. }
  433. public int getRotationToFrame() {
  434. return 0;
  435. }
  436. /**
  437. * Gets the reference-oroientation applying to the parent
  438. * <code>FONode</code> of the generating <code>FONode</code>. This
  439. * rotation applied to frames surrounding the <i>content-rectangle</i>.
  440. * @return the parent's reference-orientation
  441. */
  442. public int getFrameRotation() {
  443. return contentRotation;
  444. }
  445. public int getRotationToContent() {
  446. return 0;
  447. }
  448. /**
  449. * Gets the dimensions of this <code>AreaGeometry</code> as seen
  450. * from any surrounding frame within this <code>Area</code>. For all
  451. * <code>AreaGeometry</code>s except <code>ContentRectangle</code>s,
  452. * the relative dimensions are the same for frame and contents; i.e.
  453. * height is height and width is width.
  454. * @return the adjusted dimensions
  455. */
  456. protected DimensionDbl getFrameRelativeDimensions() {
  457. return new DimensionDbl(getWidth(), getHeight());
  458. }
  459. /**
  460. * Gets the width of this <code>AreaGeometry</code> as seen from any
  461. * enclosing frame. For all
  462. * <code>AreaGeometry</code>s except <code>ContentRectangle</code>s,
  463. * the relative dimensions are the same for frame and contents; i.e.
  464. * height is height and width is width.
  465. * @return the frame-view width
  466. */
  467. protected double getFrameRelativeWidth() {
  468. return getWidth();
  469. }
  470. /**
  471. * Gets the height of this <code>AreaGeometry</code> as seen from any
  472. * enclosing frame. For all <code>AreaGeometry</code>s except
  473. * <code>ContentRectangle</code>s, the relative dimensions are the
  474. * same for frame and contents; i.e. height is height and width is
  475. * width.
  476. * @return the frame-view height
  477. */
  478. protected double getFrameRelativeHeight() {
  479. return getHeight();
  480. }
  481. /**
  482. * Gets the <code>block-progression-dimension</code> of the area
  483. * geometry in millipoints. This value is taken from the appropriate
  484. * dimension of the <code>Rectangle2D</code> representing this area.
  485. * @return the <code>block-progression-dimension</code> in millipoints
  486. */
  487. public int getBPDim() {
  488. return (int)(getBPDimPts()*1000);
  489. }
  490. /**
  491. * Gets the <code>block-progression-dimension</code> of the area
  492. * geometry in points. This value is taken from the appropriate dimension
  493. * of the <code>Rectangle2D</code> representing this area.
  494. * N.B. The method is synchronized only on this object.
  495. * @return the <code>block-progression-dimension</code> in points
  496. */
  497. public double getBPDimPts() {
  498. synchronized (this) {
  499. // TODO - check this. Should the rectangle just be rotated as
  500. // required? This is incompatible with transform in space
  501. // requests at block reference-areas. OK if the transform is
  502. // only for area rotations. This depends on how Java handles
  503. // the layout of text in horizontal locales.
  504. if (isHorizontal) {
  505. return getHeight();
  506. } else {
  507. return getWidth();
  508. }
  509. }
  510. }
  511. /**
  512. * Sets the <code>block-progression-dimension</code> of the contents of
  513. * this area to the specified value in millipoints.
  514. * This value is applied to the appropriate dimension of the
  515. * <code>Rectangle2D</code> representing this area.
  516. * @param millipts <code>block-progression-dimension</code> to set, in
  517. * millipoints
  518. */
  519. public void setBPDim(int millipts) {
  520. setBPDimPts(millipts/1000.0f);
  521. }
  522. /**
  523. * Sets the <code>block-progression-dimension</code> of the contents of
  524. * this area to the specified value in points.
  525. * This value is applied to the appropriate dimension of the
  526. * <code>Rectangle2D</code> representing this area.
  527. * N.B. The method is synchronized only on this object.
  528. * @param pts <code>block-progression-dimension</code> to set, in points
  529. */
  530. public void setBPDimPts(double pts) {
  531. synchronized (this) {
  532. // TODO - check this
  533. if (isHorizontal) {
  534. setRect(getX(), getY(), getWidth(), pts);
  535. } else {
  536. setRect(getX(), getY(), pts, getHeight());
  537. }
  538. }
  539. }
  540. /**
  541. * Gets the <code>inline-progression-dimension</code> of the contents of
  542. * this area in millipoints. This value is taken from the appropriate
  543. * dimension of the <code>Rectangle2D</code> representing this area.
  544. * N.B. The method is synchronized only on this object.
  545. * @return the <code>inline-progression-dimension</code> in millipoints
  546. */
  547. public int getIPDim() {
  548. return (int)(getIPDimPts()*1000);
  549. }
  550. /**
  551. * Gets the <code>inline-progression-dimension</code> of the area
  552. * geometry in points. This value is taken from the appropriate dimension
  553. * of the <code>Rectangle2D</code> representing this area.
  554. * N.B. The method is synchronized only on this object.
  555. * @return the <code>inline-progression-dimension</code> in points
  556. */
  557. public double getIPDimPts() {
  558. synchronized (this) {
  559. // TODO - check this
  560. if (isHorizontal){
  561. return getWidth();
  562. } else {
  563. return getHeight();
  564. }
  565. }
  566. }
  567. /**
  568. * Sets the <code>inline-progression-dimension</code> of the contents of
  569. * this area, in points. This value is applied to the appropriate
  570. * dimension of the <code>Rectangle2D</code> representing this area.
  571. * @param millipts <code>inline-progression-dimension</code> to set, in
  572. * millipoints
  573. */
  574. public void setIPDim(int millipts) {
  575. setIPDimPts(millipts/1000.0f);
  576. }
  577. /**
  578. * Sets the <code>inline-progression-dimension</code> of the area
  579. * geometry, in points. This value is applied to the appropriate
  580. * dimension of the <code>Rectangle2D</code> representing this area.
  581. * N.B. The method is synchronized only on this object.
  582. * @param pts <code>inline-progression-dimension</code> to set, in points
  583. */
  584. public void setIPDimPts(double pts) {
  585. synchronized (this) {
  586. // Check this
  587. if (isHorizontal){
  588. setRect(getX(), getY(), pts, getHeight());
  589. } else {
  590. setRect(getX(), getY(), getWidth(), pts);
  591. }
  592. }
  593. }
  594. }
  595. }