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.

BorderCommonStyleRelative.java 2.1KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. /*
  2. *
  3. * Copyright 2004 The Apache Software Foundation.
  4. *
  5. * Licensed under the Apache License, Version 2.0 (the "License");
  6. * you may not use this file except in compliance with the License.
  7. * 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. * Created on 20/04/2004
  18. * $Id$
  19. */
  20. package org.apache.fop.fo.properties;
  21. import org.apache.fop.fo.FONode;
  22. import org.apache.fop.fo.PropNames;
  23. import org.apache.fop.fo.expr.PropertyException;
  24. /**
  25. * Base class for border-<relative>-style properties, providing the
  26. * methods necessary to resolve corresponding absolute properties.
  27. *
  28. * @author pbw
  29. * @version $Revision$ $Name$
  30. */
  31. public abstract class BorderCommonStyleRelative
  32. extends BorderCommonStyle {
  33. /** Array of absolute border style properties,
  34. * indexed by absolute edge constants */
  35. private static int[] absBorderStyleProps = {
  36. PropNames.NO_PROPERTY
  37. ,PropNames.BORDER_TOP_STYLE
  38. ,PropNames.BORDER_BOTTOM_STYLE
  39. ,PropNames.BORDER_LEFT_STYLE
  40. ,PropNames.BORDER_RIGHT_STYLE
  41. };
  42. /**
  43. * Gets the absolute border style property corresponding to the given
  44. * relative edge
  45. * @param foNode the node on which the property is being defined
  46. * @param relativeEdge
  47. * @return the absolute border style property index
  48. * @throws PropertyException
  49. */
  50. protected int getCorrespondingStyleProperty(
  51. FONode foNode, int relativeEdge)
  52. throws PropertyException {
  53. int absEdge = WritingMode.getCorrespondingAbsoluteEdge(
  54. getWritingMode(foNode), relativeEdge);
  55. return absBorderStyleProps[absEdge];
  56. }
  57. public boolean isCorrespondingRelative() {
  58. return true;
  59. }
  60. }