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.

PropertyList.java 27KB

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