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.

BlockLevelEventProducer.java 7.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  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 org.xml.sax.Locator;
  20. import org.apache.fop.events.EventBroadcaster;
  21. import org.apache.fop.events.EventProducer;
  22. import org.apache.fop.events.model.AbstractEventModelFactory;
  23. import org.apache.fop.events.model.EventModel;
  24. import org.apache.fop.fo.pagination.PageProductionException;
  25. /**
  26. * Event producer interface for block-level layout managers.
  27. */
  28. public interface BlockLevelEventProducer extends EventProducer {
  29. /**
  30. * Provider class for the event producer.
  31. */
  32. final class Provider {
  33. private Provider() { }
  34. /**
  35. * Returns an event producer.
  36. * @param broadcaster the event broadcaster to use
  37. * @return the event producer
  38. */
  39. public static BlockLevelEventProducer get(EventBroadcaster broadcaster) {
  40. return (BlockLevelEventProducer)broadcaster.getEventProducerFor(
  41. BlockLevelEventProducer.class);
  42. }
  43. }
  44. /** Event model factory for Accessibility. */
  45. public static class EventModelFactory extends AbstractEventModelFactory {
  46. /** {@inheritDoc} */
  47. public EventModel createEventModel() {
  48. return loadModel(getClass(), "event-model.xml");
  49. }
  50. }
  51. /**
  52. * The contents of a table-row are too big to fit in the constraints.
  53. * @param source the event source
  54. * @param row the row number
  55. * @param effCellBPD the effective extent in block-progression direction of the cell
  56. * @param maxCellBPD the maximum extent in block-progression direction of the cell
  57. * @param loc the location of the error or null
  58. * @event.severity WARN
  59. */
  60. void rowTooTall(Object source, int row, int effCellBPD, int maxCellBPD, Locator loc);
  61. /**
  62. * Auto-table layout is not supported, yet.
  63. * @param source the event source
  64. * @param loc the location of the error or null
  65. * @event.severity INFO
  66. */
  67. void tableFixedAutoWidthNotSupported(Object source, Locator loc);
  68. /**
  69. * An formatting object is too wide.
  70. * @param source the event source
  71. * @param elementName the formatting object
  72. * @param effIPD the effective extent in inline-progression direction of the table contents
  73. * @param maxIPD the maximum extent in inline-progression direction available
  74. * @param loc the location of the error or null
  75. * @event.severity WARN
  76. */
  77. void objectTooWide(Object source, String elementName, int effIPD, int maxIPD, Locator loc);
  78. /**
  79. * An overconstrained geometry adjustment rule was triggered (5.3.4, XSL 1.0).
  80. * @param source the event source
  81. * @param elementName the formatting object
  82. * @param amount the amount of the adjustment (in mpt)
  83. * @param loc the location of the error or null
  84. * @event.severity INFO
  85. */
  86. void overconstrainedAdjustEndIndent(Object source, String elementName, int amount, Locator loc);
  87. /**
  88. * Contents overflow a viewport.
  89. * @param source the event source
  90. * @param elementName the formatting object
  91. * @param amount the amount by which the contents overflow (in mpt)
  92. * @param clip true if the content will be clipped
  93. * @param canRecover indicates whether FOP can recover from this problem and continue working
  94. * @param loc the location of the error or null
  95. * @throws LayoutException the layout error provoked by the method call
  96. * @event.severity FATAL
  97. */
  98. void viewportOverflow(Object source, String elementName,
  99. int amount, boolean clip, boolean canRecover,
  100. Locator loc) throws LayoutException;
  101. /**
  102. * Contents overflow a region viewport.
  103. * @param source the event source
  104. * @param elementName the formatting object
  105. * @param page the page number/name where the overflow happened
  106. * @param amount the amount by which the contents overflow (in mpt)
  107. * @param clip true if the content will be clipped
  108. * @param canRecover indicates whether FOP can recover from this problem and continue working
  109. * @param loc the location of the error or null
  110. * @throws LayoutException the layout error provoked by the method call
  111. * @event.severity FATAL
  112. */
  113. void regionOverflow(Object source, String elementName,
  114. String page,
  115. int amount, boolean clip, boolean canRecover,
  116. Locator loc) throws LayoutException;
  117. /**
  118. * Indicates that FOP doesn't support flows that are not mapped to region-body, yet.
  119. * @param source the event source
  120. * @param flowName the flow name
  121. * @param masterName the page master name
  122. * @param loc the location of the error or null
  123. * @throws UnsupportedOperationException the layout error provoked by the method call
  124. * @event.severity FATAL
  125. */
  126. void flowNotMappingToRegionBody(Object source, String flowName, String masterName,
  127. Locator loc) throws UnsupportedOperationException;
  128. /**
  129. * A page sequence master is exhausted.
  130. * @param source the event source
  131. * @param pageSequenceMasterName the name of the page sequence master
  132. * @param canRecover indicates whether FOP can recover from this problem and continue working
  133. * @param loc the location of the error or null
  134. * @throws PageProductionException the error provoked by the method call
  135. * @event.severity FATAL
  136. */
  137. void pageSequenceMasterExhausted(Object source, String pageSequenceMasterName,
  138. boolean canRecover, Locator loc) throws PageProductionException;
  139. /**
  140. * No subsequences in page sequence master.
  141. * @param source the event source
  142. * @param pageSequenceMasterName the name of the page sequence master
  143. * @param loc the location of the error or null
  144. * @throws PageProductionException the error provoked by the method call
  145. * @event.severity FATAL
  146. */
  147. void missingSubsequencesInPageSequenceMaster(Object source, String pageSequenceMasterName,
  148. Locator loc) throws PageProductionException;
  149. /**
  150. * No single-page-master matching in page sequence master.
  151. * @param source the event source
  152. * @param pageSequenceMasterName the name of the page sequence master
  153. * @param pageMasterName the name of the page master not matching
  154. * @param loc the location of the error or null
  155. * @throws PageProductionException the error provoked by the method call
  156. * @event.severity FATAL
  157. */
  158. void noMatchingPageMaster(Object source, String pageSequenceMasterName,
  159. String pageMasterName, Locator loc) throws PageProductionException;
  160. /**
  161. * An element that cannot handle changing IPD (list, table) is flowing to a narrower
  162. * page. Some content may be lost.
  163. *
  164. * @param source the event source
  165. * @event.severity WARN
  166. */
  167. void nonRestartableContentFlowingToNarrowerPage(Object source);
  168. }