Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729
  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.fo;
  19. // Java
  20. import java.util.HashMap;
  21. import java.util.HashSet;
  22. import java.util.Map;
  23. import java.util.Set;
  24. import org.xml.sax.Attributes;
  25. import org.apache.commons.logging.Log;
  26. import org.apache.commons.logging.LogFactory;
  27. import org.apache.xmlgraphics.util.QName;
  28. import org.apache.fop.apps.FOPException;
  29. import org.apache.fop.apps.FOUserAgent;
  30. import org.apache.fop.fo.expr.PropertyException;
  31. import org.apache.fop.fo.properties.CommonAbsolutePosition;
  32. import org.apache.fop.fo.properties.CommonAural;
  33. import org.apache.fop.fo.properties.CommonBorderPaddingBackground;
  34. import org.apache.fop.fo.properties.CommonFont;
  35. import org.apache.fop.fo.properties.CommonHyphenation;
  36. import org.apache.fop.fo.properties.CommonMarginBlock;
  37. import org.apache.fop.fo.properties.CommonMarginInline;
  38. import org.apache.fop.fo.properties.CommonRelativePosition;
  39. import org.apache.fop.fo.properties.CommonTextDecoration;
  40. import org.apache.fop.fo.properties.Property;
  41. import org.apache.fop.fo.properties.PropertyMaker;
  42. /**
  43. * Class containing the collection of properties for a given FObj.
  44. */
  45. public abstract class PropertyList {
  46. private static boolean[] inheritableProperty;
  47. static {
  48. inheritableProperty = new boolean[Constants.PROPERTY_COUNT + 1];
  49. PropertyMaker maker = null;
  50. for (int prop = 1; prop <= Constants.PROPERTY_COUNT; prop++) {
  51. maker = findMaker(prop);
  52. inheritableProperty[prop] = (maker != null && maker.isInherited());
  53. }
  54. }
  55. /** reference to the parent FO's propertyList **/
  56. protected PropertyList parentPropertyList;
  57. private FObj fobj;
  58. private static Log log = LogFactory.getLog(PropertyList.class);
  59. private final UnknownPropertyHandler unknownPropertyHandler = new UnknownPropertyHandler();
  60. /**
  61. * Basic constructor.
  62. * @param fObjToAttach the FO this PropertyList should be attached to
  63. * @param parentPropertyList the PropertyList belonging to the new objects
  64. * parent
  65. */
  66. public PropertyList(FObj fObjToAttach, PropertyList parentPropertyList) {
  67. this.fobj = fObjToAttach;
  68. this.parentPropertyList = parentPropertyList;
  69. }
  70. /**
  71. * @return the FObj object to which this propertyList is attached
  72. */
  73. public FObj getFObj() {
  74. return this.fobj;
  75. }
  76. /**
  77. * @return the FObj object attached to the parentPropertyList
  78. */
  79. public FObj getParentFObj() {
  80. if (parentPropertyList != null) {
  81. return parentPropertyList.getFObj();
  82. } else {
  83. return null;
  84. }
  85. }
  86. /**
  87. * Adds an unknown property value to the property list so that if
  88. * necessary, a warning can be displayed.
  89. * @param propertyValue The unknown property value
  90. * @param output The output of the property to validate
  91. * @param property The original property containing the full value
  92. */
  93. public void validatePropertyValue(String propertyValue, Property output, Property property) {
  94. unknownPropertyHandler.validatePropertyValue(propertyValue, output, property);
  95. }
  96. /**
  97. * Gets the current list of unknown property values
  98. * @return The set containing the list of unknown property values
  99. */
  100. public Map<String, Property> getUnknownPropertyValues() {
  101. return unknownPropertyHandler.getUnknownPropertyValues();
  102. }
  103. /**
  104. * @return the FObj object attached to the parentPropetyList
  105. */
  106. public PropertyList getParentPropertyList() {
  107. return parentPropertyList;
  108. }
  109. /**
  110. * Return the value explicitly specified on this FO.
  111. * @param propId The id of the property whose value is desired.
  112. * @return The value if the property is explicitly set or set by
  113. * a shorthand property, otherwise null.
  114. * @throws PropertyException ...
  115. */
  116. public Property getExplicitOrShorthand(int propId) throws PropertyException {
  117. /* Handle request for one part of a compound property */
  118. Property p = getExplicit(propId);
  119. if (p == null) {
  120. p = getShorthand(propId);
  121. }
  122. return p;
  123. }
  124. /**
  125. * A class to handle unknown shorthand property values e.g. border="solit 1pt"
  126. */
  127. private static class UnknownPropertyHandler {
  128. /**
  129. * A list of unknown properties identified by the value and property in which its featured
  130. */
  131. private Map<String, Property> unknownPropertyValues = new HashMap<String, Property>();
  132. /**
  133. * A list of known properties which have already been processed
  134. */
  135. private Set<Property> knownProperties = new HashSet<Property>();
  136. void validatePropertyValue(String propertyValue, Property output, Property property) {
  137. if (!knownProperties.contains(property) && output == null) {
  138. if (propertyValue != null) {
  139. unknownPropertyValues.put(propertyValue, property);
  140. }
  141. } else {
  142. knownProperties.add(property);
  143. }
  144. }
  145. Map<String, Property> getUnknownPropertyValues() {
  146. return unknownPropertyValues;
  147. }
  148. }
  149. /**
  150. * Return the value explicitly specified on this FO.
  151. * @param propId The ID of the property whose value is desired.
  152. * @return The value if the property is explicitly set, otherwise null.
  153. */
  154. public abstract Property getExplicit(int propId);
  155. /**
  156. * Set an value defined explicitly on this FO.
  157. * @param propId The ID of the property to set.
  158. * @param value The value of the property.
  159. */
  160. public abstract void putExplicit(int propId, Property value);
  161. /**
  162. * Return the value of this property inherited by this FO.
  163. * Implements the inherited-property-value function.
  164. * The property must be inheritable!
  165. * @param propId The ID of the property whose value is desired.
  166. * @return The inherited value, otherwise null.
  167. * @throws PropertyException ...
  168. */
  169. public Property getInherited(int propId) throws PropertyException {
  170. if (isInherited(propId)) {
  171. return getFromParent(propId);
  172. } else {
  173. // return the "initial" value
  174. return makeProperty(propId);
  175. }
  176. }
  177. /**
  178. * Return the property on the current FlowObject. If it isn't set explicitly,
  179. * this will try to compute it based on other properties, or if it is
  180. * inheritable, to return the inherited value. If all else fails, it returns
  181. * the default value.
  182. * @param propId The Constants ID of the property whose value is desired.
  183. * @return the Property corresponding to that name
  184. * @throws PropertyException if there is a problem evaluating the property
  185. */
  186. public Property get(int propId) throws PropertyException {
  187. return get(propId, true, true);
  188. }
  189. /**
  190. * Return the property on the current FlowObject. Depending on the passed flags,
  191. * this will try to compute it based on other properties, or if it is
  192. * inheritable, to return the inherited value. If all else fails, it returns
  193. * the default value.
  194. * @param propId the property's id
  195. * @param bTryInherit true for inherited properties, or when the inherited
  196. * value is needed
  197. * @param bTryDefault true when the default value may be used as a last resort
  198. * @return the property
  199. * @throws PropertyException if there is a problem evaluating the property
  200. */
  201. public Property get(int propId, boolean bTryInherit,
  202. boolean bTryDefault) throws PropertyException {
  203. PropertyMaker propertyMaker = findMaker(propId & Constants.PROPERTY_MASK);
  204. if (propertyMaker != null) {
  205. return propertyMaker.get(propId & Constants.COMPOUND_MASK, this,
  206. bTryInherit, bTryDefault);
  207. }
  208. return null;
  209. }
  210. /**
  211. * Return the "nearest" specified value for the given property.
  212. * Implements the from-nearest-specified-value function.
  213. * @param propId The ID of the property whose value is desired.
  214. * @return The computed value if the property is explicitly set on some
  215. * ancestor of the current FO, else the initial value.
  216. * @throws PropertyException if there an error occurred when getting the property
  217. */
  218. public Property getNearestSpecified(int propId) throws PropertyException {
  219. Property p = null;
  220. PropertyList pList = parentPropertyList;
  221. while (pList != null) {
  222. p = pList.getExplicit(propId);
  223. if (p != null) {
  224. return p;
  225. } else {
  226. pList = pList.parentPropertyList;
  227. }
  228. }
  229. // If no explicit value found on any of the ancestor-nodes,
  230. // return initial (default) value.
  231. return makeProperty(propId);
  232. }
  233. /**
  234. * Return the value of this property on the parent of this FO.
  235. * Implements the from-parent function.
  236. * @param propId The Constants ID of the property whose value is desired.
  237. * @return The computed value on the parent or the initial value if this
  238. * FO is the root or is in a different namespace from its parent.
  239. * @throws PropertyException ...
  240. */
  241. public Property getFromParent(int propId) throws PropertyException {
  242. if (parentPropertyList != null) {
  243. return parentPropertyList.get(propId);
  244. } else {
  245. return makeProperty(propId);
  246. }
  247. }
  248. /**
  249. * Select a writing mode dependent property ID based on value of writing mode property.
  250. * @param lrtb the property ID to return under lrtb writingmode.
  251. * @param rltb the property ID to return under rltb writingmode.
  252. * @param tbrl the property ID to return under tbrl writingmode.
  253. * @param tblr the property ID to return under tblr writingmode.
  254. * @return one of the property IDs, depending on the writing mode.
  255. */
  256. public int selectFromWritingMode(int lrtb, int rltb, int tbrl, int tblr) {
  257. int propID;
  258. try {
  259. switch (get(Constants.PR_WRITING_MODE).getEnum()) {
  260. case Constants.EN_LR_TB:
  261. propID = lrtb;
  262. break;
  263. case Constants.EN_RL_TB:
  264. propID = rltb;
  265. break;
  266. case Constants.EN_TB_RL:
  267. propID = tbrl;
  268. break;
  269. case Constants.EN_TB_LR:
  270. propID = tblr;
  271. break;
  272. default:
  273. propID = -1;
  274. break;
  275. }
  276. } catch (PropertyException e) {
  277. propID = -1;
  278. }
  279. return propID;
  280. }
  281. private String addAttributeToList(Attributes attributes,
  282. String attributeName) throws ValidationException {
  283. String attributeValue = attributes.getValue(attributeName);
  284. if (attributeValue != null) {
  285. convertAttributeToProperty(attributes, attributeName, attributeValue);
  286. }
  287. return attributeValue;
  288. }
  289. /**
  290. * <p>Adds the attributes, passed in by the parser to the PropertyList.</p>
  291. * <p>Note that certain attributes are given priority in terms of order of
  292. * processing due to conversion dependencies, where the order is as follows:</p>
  293. * <ol>
  294. * <li>writing-mode</li>
  295. * <li>column-number</li>
  296. * <li>number-columns-spanned</li>
  297. * <li>font</li>
  298. * <li>font-size</li>
  299. * <li><emph>all others in order of appearance</emph></li>
  300. * </ol>
  301. *
  302. * @param attributes Collection of attributes passed to us from the parser.
  303. * @throws ValidationException if there is an attribute that does not
  304. * map to a property id (strict validation only)
  305. */
  306. public void addAttributesToList(Attributes attributes)
  307. throws ValidationException {
  308. /*
  309. * Give writing-mode highest conversion priority.
  310. */
  311. addAttributeToList(attributes, "writing-mode");
  312. /*
  313. * If column-number/number-columns-spanned are specified, then we
  314. * need them before all others (possible from-table-column() on any
  315. * other property further in the list...
  316. */
  317. addAttributeToList(attributes, "column-number");
  318. addAttributeToList(attributes, "number-columns-spanned");
  319. /*
  320. * If font-size is set on this FO, must set it first, since
  321. * other attributes specified in terms of "ems" depend on it.
  322. */
  323. String checkValue = addAttributeToList(attributes, "font");
  324. if (checkValue == null || "".equals(checkValue)) {
  325. /*
  326. * font shorthand wasn't specified, so still need to process
  327. * explicit font-size
  328. */
  329. addAttributeToList(attributes, "font-size");
  330. }
  331. String attributeNS;
  332. String attributeName;
  333. String attributeValue;
  334. FOUserAgent userAgent = getFObj().getUserAgent();
  335. for (int i = 0; i < attributes.getLength(); i++) {
  336. /* convert all attributes with the same namespace as the fo element
  337. * the "xml:lang" and "xml:base" properties are special cases */
  338. attributeNS = attributes.getURI(i);
  339. attributeName = attributes.getQName(i);
  340. attributeValue = attributes.getValue(i);
  341. if (attributeNS == null || attributeNS.length() == 0
  342. || "xml:lang".equals(attributeName)
  343. || "xml:base".equals(attributeName)) {
  344. convertAttributeToProperty(attributes, attributeName, attributeValue);
  345. } else if (!userAgent.isNamespaceIgnored(attributeNS)) {
  346. ElementMapping mapping = userAgent.getElementMappingRegistry().getElementMapping(
  347. attributeNS);
  348. QName attr = new QName(attributeNS, attributeName);
  349. if (mapping != null) {
  350. if (mapping.isAttributeProperty(attr)
  351. && mapping.getStandardPrefix() != null) {
  352. convertAttributeToProperty(attributes,
  353. mapping.getStandardPrefix() + ":" + attr.getLocalName(),
  354. attributeValue);
  355. } else {
  356. getFObj().addForeignAttribute(attr, attributeValue);
  357. }
  358. } else {
  359. handleInvalidProperty(attr);
  360. }
  361. }
  362. }
  363. }
  364. /**
  365. * Validates a property name.
  366. * @param propertyName the property name to check
  367. * @return true if the base property name and the subproperty name (if any)
  368. * can be correctly mapped to an id
  369. */
  370. protected boolean isValidPropertyName(String propertyName) {
  371. int propId = FOPropertyMapping.getPropertyId(
  372. findBasePropertyName(propertyName));
  373. int subpropId = FOPropertyMapping.getSubPropertyId(
  374. findSubPropertyName(propertyName));
  375. return !(propId == -1
  376. || (subpropId == -1
  377. && findSubPropertyName(propertyName) != null));
  378. }
  379. public Property getPropertyForAttribute(Attributes attributes, String attributeName, String attributeValue)
  380. throws FOPException {
  381. if (attributeValue != null) {
  382. if (attributeName.startsWith("xmlns:") || "xmlns".equals(attributeName)) {
  383. return null;
  384. }
  385. String basePropertyName = findBasePropertyName(attributeName);
  386. String subPropertyName = findSubPropertyName(attributeName);
  387. int propId = FOPropertyMapping.getPropertyId(basePropertyName);
  388. int subpropId = FOPropertyMapping.getSubPropertyId(subPropertyName);
  389. if (propId == -1 || (subpropId == -1 && subPropertyName != null)) {
  390. return null;
  391. }
  392. return getExplicit(propId);
  393. }
  394. return null;
  395. }
  396. /**
  397. *
  398. * @param attributes Collection of attributes
  399. * @param attributeName Attribute name to convert
  400. * @param attributeValue Attribute value to assign to property
  401. * @throws ValidationException in case the property name is invalid
  402. * for the FO namespace
  403. */
  404. private void convertAttributeToProperty(Attributes attributes,
  405. String attributeName,
  406. String attributeValue)
  407. throws ValidationException {
  408. if (attributeName.startsWith("xmlns:")
  409. || "xmlns".equals(attributeName)) {
  410. /* Ignore namespace declarations if the XML parser/XSLT processor
  411. * reports them as 'regular' attributes */
  412. return;
  413. }
  414. if (attributeValue != null) {
  415. /* Handle "compound" properties, ex. space-before.minimum */
  416. String basePropertyName = findBasePropertyName(attributeName);
  417. String subPropertyName = findSubPropertyName(attributeName);
  418. int propId = FOPropertyMapping.getPropertyId(basePropertyName);
  419. int subpropId = FOPropertyMapping.getSubPropertyId(subPropertyName);
  420. if (propId == -1
  421. || (subpropId == -1 && subPropertyName != null)) {
  422. handleInvalidProperty(new QName(null, attributeName));
  423. }
  424. FObj parentFO = fobj.findNearestAncestorFObj();
  425. PropertyMaker propertyMaker = findMaker(propId);
  426. if (propertyMaker == null) {
  427. log.warn("No PropertyMaker registered for " + attributeName
  428. + ". Ignoring property.");
  429. return;
  430. }
  431. try {
  432. Property prop = null;
  433. if (subPropertyName == null) { // base attribute only found
  434. /* Do nothing if the base property has already been created.
  435. * This is e.g. the case when a compound attribute was
  436. * specified before the base attribute; in these cases
  437. * the base attribute was already created in
  438. * findBaseProperty()
  439. */
  440. if (getExplicit(propId) != null) {
  441. return;
  442. }
  443. prop = propertyMaker.make(this, attributeValue, parentFO);
  444. } else { // e.g. "leader-length.maximum"
  445. Property baseProperty
  446. = findBaseProperty(attributes, parentFO, propId,
  447. basePropertyName, propertyMaker);
  448. prop = propertyMaker.make(baseProperty, subpropId,
  449. this, attributeValue, parentFO);
  450. }
  451. if (prop != null) {
  452. putExplicit(propId, prop);
  453. }
  454. } catch (PropertyException e) {
  455. fobj.getFOValidationEventProducer().invalidPropertyValue(this, fobj.getName(),
  456. attributeName, attributeValue, e, fobj.locator);
  457. }
  458. }
  459. }
  460. private Property findBaseProperty(Attributes attributes,
  461. FObj parentFO,
  462. int propId,
  463. String basePropertyName,
  464. PropertyMaker propertyMaker)
  465. throws PropertyException {
  466. /* If the baseProperty has already been created, return it
  467. * e.g. <fo:leader xxxx="120pt" xxxx.maximum="200pt"... />
  468. */
  469. Property baseProperty = getExplicit(propId);
  470. if (baseProperty != null) {
  471. return baseProperty;
  472. }
  473. /* Otherwise If it is specified later in this list of Attributes, create it now
  474. * e.g. <fo:leader xxxx.maximum="200pt" xxxx="200pt"... />
  475. */
  476. String basePropertyValue = attributes.getValue(basePropertyName);
  477. if (basePropertyValue != null && propertyMaker != null) {
  478. baseProperty = propertyMaker.make(this, basePropertyValue,
  479. parentFO);
  480. return baseProperty;
  481. }
  482. return null; // could not find base property
  483. }
  484. /**
  485. * Handles an invalid property.
  486. * @param attr the invalid attribute
  487. * @throws ValidationException if an exception needs to be thrown depending on the
  488. * validation settings
  489. */
  490. protected void handleInvalidProperty(QName attr)
  491. throws ValidationException {
  492. if (!attr.getQName().startsWith("xmlns")) {
  493. fobj.getFOValidationEventProducer().invalidProperty(this, fobj.getName(),
  494. attr, true, fobj.locator);
  495. }
  496. }
  497. /**
  498. * Finds the first or base part (up to any period) of an attribute name.
  499. * For example, if input is "space-before.minimum", should return
  500. * "space-before".
  501. * @param attributeName String to be atomized
  502. * @return the base portion of the attribute
  503. */
  504. protected static String findBasePropertyName(String attributeName) {
  505. int separatorCharIndex = attributeName.indexOf('.');
  506. String basePropertyName = attributeName;
  507. if (separatorCharIndex > -1) {
  508. basePropertyName = attributeName.substring(0, separatorCharIndex);
  509. }
  510. return basePropertyName;
  511. }
  512. /**
  513. * Finds the second or sub part (portion past any period) of an attribute
  514. * name. For example, if input is "space-before.minimum", should return
  515. * "minimum".
  516. * @param attributeName String to be atomized
  517. * @return the sub portion of the attribute
  518. */
  519. protected static String findSubPropertyName(String attributeName) {
  520. int separatorCharIndex = attributeName.indexOf('.');
  521. String subpropertyName = null;
  522. if (separatorCharIndex > -1) {
  523. subpropertyName = attributeName.substring(separatorCharIndex + 1);
  524. }
  525. return subpropertyName;
  526. }
  527. /**
  528. * @param propId ID of property
  529. * @return new Property object
  530. * @throws PropertyException if there's a problem while processing the property
  531. */
  532. private Property getShorthand(int propId) throws PropertyException {
  533. PropertyMaker propertyMaker = findMaker(propId);
  534. if (propertyMaker != null) {
  535. return propertyMaker.getShorthand(this);
  536. } else {
  537. //log.error("no Maker for " + propertyName);
  538. return null;
  539. }
  540. }
  541. /**
  542. * @param propId ID of property
  543. * @return new Property object
  544. * @throws PropertyException if there's a problem while processing the property
  545. */
  546. private Property makeProperty(int propId) throws PropertyException {
  547. PropertyMaker propertyMaker = findMaker(propId);
  548. if (propertyMaker != null) {
  549. return propertyMaker.make(this);
  550. } else {
  551. //log.error("property " + propertyName
  552. // + " ignored");
  553. }
  554. return null;
  555. }
  556. /**
  557. * @param propId ID of property
  558. * @return isInherited value from the requested Property.Maker
  559. */
  560. private boolean isInherited(int propId) {
  561. return inheritableProperty[propId];
  562. }
  563. /**
  564. * @param propId Id of property
  565. * @return the Property.Maker for this property
  566. */
  567. private static PropertyMaker findMaker(int propId) {
  568. if (propId < 1 || propId > Constants.PROPERTY_COUNT) {
  569. return null;
  570. } else {
  571. return FObj.getPropertyMakerFor(propId);
  572. }
  573. }
  574. /**
  575. * Constructs a BorderAndPadding object.
  576. * @return a BorderAndPadding object
  577. * @throws PropertyException if there's a problem while processing the properties
  578. */
  579. public CommonBorderPaddingBackground getBorderPaddingBackgroundProps()
  580. throws PropertyException {
  581. return CommonBorderPaddingBackground.getInstance(this);
  582. }
  583. /**
  584. * Constructs a CommonHyphenation object.
  585. * @return the CommonHyphenation object
  586. * @throws PropertyException if there's a problem while processing the properties
  587. */
  588. public CommonHyphenation getHyphenationProps() throws PropertyException {
  589. return CommonHyphenation.getInstance(this);
  590. }
  591. /**
  592. * Constructs a CommonMarginBlock object.
  593. * @return the CommonMarginBlock object
  594. * @throws PropertyException if there's a problem while processing the properties
  595. */
  596. public CommonMarginBlock getMarginBlockProps() throws PropertyException {
  597. return new CommonMarginBlock(this);
  598. }
  599. /**
  600. * Constructs a CommonMarginInline object.
  601. * @return the CommonMarginInline object
  602. * @throws PropertyException if there's a problem while processing the properties
  603. */
  604. public CommonMarginInline getMarginInlineProps() throws PropertyException {
  605. return new CommonMarginInline(this);
  606. }
  607. /**
  608. * Constructs a CommonAural object.
  609. * @return the CommonAural object
  610. * @throws PropertyException if there's a problem while processing the properties
  611. */
  612. public CommonAural getAuralProps() throws PropertyException {
  613. CommonAural props = new CommonAural(this);
  614. return props;
  615. }
  616. /**
  617. * Constructs a RelativePositionProps objects.
  618. * @return a RelativePositionProps object
  619. * @throws PropertyException if there's a problem while processing the properties
  620. */
  621. public CommonRelativePosition getRelativePositionProps() throws PropertyException {
  622. return new CommonRelativePosition(this);
  623. }
  624. /**
  625. * Constructs a CommonAbsolutePosition object.
  626. * @return the CommonAbsolutePosition object
  627. * @throws PropertyException if there's a problem while processing the properties
  628. */
  629. public CommonAbsolutePosition getAbsolutePositionProps() throws PropertyException {
  630. return new CommonAbsolutePosition(this);
  631. }
  632. /**
  633. * Constructs a CommonFont object.
  634. *
  635. * @return A CommonFont object
  636. * @throws PropertyException if there's a problem while processing the properties
  637. */
  638. public CommonFont getFontProps() throws PropertyException {
  639. return CommonFont.getInstance(this);
  640. }
  641. /**
  642. * Constructs a CommonTextDecoration object.
  643. * @return a CommonTextDecoration object
  644. * @throws PropertyException if there's a problem while processing the properties
  645. */
  646. public CommonTextDecoration getTextDecorationProps() throws PropertyException {
  647. return CommonTextDecoration.createFromPropertyList(this);
  648. }
  649. }