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.

InlineLevel.java 3.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  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.flow;
  19. import java.awt.Color;
  20. import org.apache.fop.apps.FOPException;
  21. import org.apache.fop.fo.FONode;
  22. import org.apache.fop.fo.FObjMixed;
  23. import org.apache.fop.fo.PropertyList;
  24. import org.apache.fop.fo.properties.CommonAccessibility;
  25. import org.apache.fop.fo.properties.CommonAccessibilityHolder;
  26. import org.apache.fop.fo.properties.CommonBorderPaddingBackground;
  27. import org.apache.fop.fo.properties.CommonFont;
  28. import org.apache.fop.fo.properties.CommonMarginInline;
  29. import org.apache.fop.fo.properties.KeepProperty;
  30. import org.apache.fop.fo.properties.SpaceProperty;
  31. /**
  32. * Class modelling the commonalities of several inline-level
  33. * formatting objects.
  34. */
  35. public abstract class InlineLevel extends FObjMixed implements CommonAccessibilityHolder {
  36. // The value of properties relevant for inline-level FOs.
  37. private CommonAccessibility commonAccessibility;
  38. private CommonBorderPaddingBackground commonBorderPaddingBackground;
  39. private CommonMarginInline commonMarginInline;
  40. private CommonFont commonFont;
  41. private Color color;
  42. private KeepProperty keepWithNext;
  43. private KeepProperty keepWithPrevious;
  44. private SpaceProperty lineHeight;
  45. // End of property values
  46. /**
  47. * Base constructor
  48. *
  49. * @param parent {@link FONode} that is the parent of this object
  50. */
  51. protected InlineLevel(FONode parent) {
  52. super(parent);
  53. }
  54. /** {@inheritDoc} */
  55. public void bind(PropertyList pList) throws FOPException {
  56. super.bind(pList);
  57. commonAccessibility = CommonAccessibility.getInstance(pList);
  58. commonBorderPaddingBackground = pList.getBorderPaddingBackgroundProps();
  59. commonMarginInline = pList.getMarginInlineProps();
  60. commonFont = pList.getFontProps();
  61. color = pList.get(PR_COLOR).getColor(getUserAgent());
  62. keepWithNext = pList.get(PR_KEEP_WITH_NEXT).getKeep();
  63. keepWithPrevious = pList.get(PR_KEEP_WITH_PREVIOUS).getKeep();
  64. lineHeight = pList.get(PR_LINE_HEIGHT).getSpace();
  65. }
  66. public CommonAccessibility getCommonAccessibility() {
  67. return commonAccessibility;
  68. }
  69. /** @return the {@link CommonMarginInline} */
  70. public CommonMarginInline getCommonMarginInline() {
  71. return commonMarginInline;
  72. }
  73. /** @return the {@link CommonBorderPaddingBackground} */
  74. public CommonBorderPaddingBackground getCommonBorderPaddingBackground() {
  75. return commonBorderPaddingBackground;
  76. }
  77. /** @return the {@link CommonFont} */
  78. public CommonFont getCommonFont() {
  79. return commonFont;
  80. }
  81. /** @return the "color" property */
  82. public Color getColor() {
  83. return color;
  84. }
  85. /** @return the "line-height" property */
  86. public SpaceProperty getLineHeight() {
  87. return lineHeight;
  88. }
  89. /** @return the "keep-with-next" property */
  90. public KeepProperty getKeepWithNext() {
  91. return keepWithNext;
  92. }
  93. /** @return the "keep-with-previous" property */
  94. public KeepProperty getKeepWithPrevious() {
  95. return keepWithPrevious;
  96. }
  97. }