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.

RtfListStyleNumber.java 3.4KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  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.render.rtf.rtflib.rtfdoc;
  19. /*
  20. * This file is part of the RTF library of the FOP project, which was originally
  21. * created by Bertrand Delacretaz bdelacretaz@codeconsult.ch and by other
  22. * contributors to the jfor project (www.jfor.org), who agreed to donate jfor to
  23. * the FOP project.
  24. */
  25. //Java
  26. import java.io.IOException;
  27. /**
  28. * Class to handle number list style.
  29. */
  30. public class RtfListStyleNumber extends RtfListStyle {
  31. /**
  32. * Gets called before a RtfListItem has to be written.
  33. * @param item RtfListItem whose prefix has to be written
  34. * {@inheritDoc}
  35. * @throws IOException Thrown when an IO-problem occurs
  36. */
  37. public void writeListPrefix(RtfListItem item)
  38. throws IOException {
  39. item.writeControlWord("pnlvlbody");
  40. item.writeControlWord("ilvl0");
  41. item.writeOneAttribute(RtfListTable.LIST_NUMBER, "0");
  42. item.writeControlWord("pndec");
  43. item.writeOneAttribute("pnstart", 1);
  44. item.writeOneAttribute("pnindent",
  45. item.attrib.getValue(RtfListTable.LIST_INDENT));
  46. item.writeControlWord("pntxta.");
  47. }
  48. /**
  49. * Gets called before a paragraph, which is contained by a RtfListItem has to be written.
  50. *
  51. * @param element RtfElement in whose context is to be written
  52. * {@inheritDoc}
  53. * @throws IOException Thrown when an IO-problem occurs
  54. */
  55. public void writeParagraphPrefix(RtfElement element)
  56. throws IOException {
  57. element.writeGroupMark(true);
  58. element.writeControlWord("pntext");
  59. element.writeControlWord("f" + RtfFontManager.getInstance().getFontNumber("Symbol"));
  60. element.writeControlWord("'b7");
  61. element.writeControlWord("tab");
  62. element.writeGroupMark(false);
  63. }
  64. /**
  65. * Gets called when the list table has to be written.
  66. *
  67. * @param element RtfElement in whose context is to be written
  68. * {@inheritDoc}
  69. * @throws IOException Thrown when an IO-problem occurs
  70. */
  71. public void writeLevelGroup(RtfElement element)
  72. throws IOException {
  73. element.writeOneAttributeNS(
  74. RtfListTable.LIST_START_AT, 1);
  75. element.attrib.set(RtfListTable.LIST_NUMBER_TYPE, 0);
  76. element.writeGroupMark(true);
  77. element.writeOneAttributeNS(
  78. RtfListTable.LIST_TEXT_FORM, "\\'03\\\'00. ;");
  79. element.writeGroupMark(false);
  80. element.writeGroupMark(true);
  81. element.writeOneAttributeNS(
  82. RtfListTable.LIST_NUM_POSITION, "\\'01;");
  83. element.writeGroupMark(false);
  84. element.writeOneAttribute(RtfListTable.LIST_FONT_TYPE, 0);
  85. }
  86. }