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.

Page.java 2.9KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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. *
  9. * http://www.apache.org/licenses/LICENSE-2.0
  10. *
  11. * Unless required by applicable law or agreed to in writing, software
  12. * distributed under the License is distributed on an "AS IS" BASIS,
  13. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. * See the License for the specific language governing permissions and
  15. * limitations under the License.
  16. */
  17. /* $Id$ */
  18. package org.apache.fop.layoutmgr;
  19. import java.awt.Rectangle;
  20. import org.apache.fop.area.PageViewport;
  21. import org.apache.fop.fo.pagination.SimplePageMaster;
  22. /**
  23. * This object is used by the layout engine to represent a page. It provides access to the
  24. * simple-page-master that was used as a template for this page and it provides access to the
  25. * PageViewport which is the top-level area tree element. This class helps to decouple the
  26. * FO tree from the area tree to make the latter easily serializable.
  27. */
  28. public class Page {
  29. private SimplePageMaster spm;
  30. private PageViewport pageViewport;
  31. protected boolean isPagePositionOnly;
  32. /**
  33. * Main constructor
  34. * @param spm the simple-page-master used for this page
  35. * @param pageNumber the page number (as an int)
  36. * @param pageNumberStr the page number (as a String)
  37. * @param blank true if this is a blank page
  38. * @param spanAll true if the first span area spans all columns
  39. */
  40. public Page(SimplePageMaster spm, int pageNumber, String pageNumberStr,
  41. boolean blank, boolean spanAll, boolean isPagePositionOnly) {
  42. this.spm = spm;
  43. this.pageViewport = new PageViewport(spm, pageNumber, pageNumberStr, blank, spanAll);
  44. this.isPagePositionOnly = isPagePositionOnly;
  45. }
  46. /**
  47. * Auxiliary constructor used when there's no SimplePageMaster.
  48. * @param viewArea the view area of the page
  49. * @param pageNumber the page number (as an int)
  50. * @param pageNumberStr the page number (as a String)
  51. * @param blank true if this is a blank page
  52. */
  53. public Page(Rectangle viewArea, int pageNumber, String pageNumberStr, boolean blank) {
  54. this.spm = null;
  55. this.pageViewport = new PageViewport(viewArea, pageNumber, pageNumberStr, null, blank);
  56. }
  57. /** @return the simple-page-master that created this page */
  58. public SimplePageMaster getSimplePageMaster() {
  59. return this.spm;
  60. }
  61. /** @return the page viewport representing this page in the area tree */
  62. public PageViewport getPageViewport() {
  63. return this.pageViewport;
  64. }
  65. }