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.

RtfListStyleBullet.java 3.3KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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 bullet list style.
  29. */
  30. public class RtfListStyleBullet 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) throws IOException {
  38. // bulleted list
  39. item.writeControlWord("pnlvlblt");
  40. item.writeControlWord("ilvl0");
  41. item.writeOneAttribute(RtfListTable.LIST_NUMBER, item.getNumber());
  42. item.writeOneAttribute("pnindent",
  43. item.getParentList().attrib.getValue(RtfListTable.LIST_INDENT));
  44. item.writeControlWord("pnf1");
  45. item.writeGroupMark(true);
  46. item.writeControlWord("pndec");
  47. item.writeOneAttribute(RtfListTable.LIST_FONT_TYPE, "2");
  48. item.writeControlWord("pntxtb");
  49. item.writeControlWord("'b7");
  50. item.writeGroupMark(false);
  51. }
  52. /**
  53. * Gets called before a paragraph, which is contained by a RtfListItem has to be written.
  54. * @param element RtfElement in whose context is to be written
  55. * {@inheritDoc}
  56. * @throws IOException Thrown when an IO-problem occurs
  57. */
  58. public void writeParagraphPrefix(RtfElement element) throws IOException {
  59. element.writeGroupMark(true);
  60. element.writeControlWord("pntext");
  61. element.writeGroupMark(false);
  62. }
  63. /**
  64. * Gets called when the list table has to be written.
  65. *
  66. * @param element RtfElement in whose context is to be written
  67. * {@inheritDoc}
  68. * @throws IOException Thrown when an IO-problem occurs
  69. */
  70. public void writeLevelGroup(RtfElement element) throws IOException {
  71. element.attrib.set(RtfListTable.LIST_NUMBER_TYPE, 23);
  72. element.writeGroupMark(true);
  73. element.writeOneAttributeNS(RtfListTable.LIST_TEXT_FORM, "\\'01\\'b7");
  74. element.writeGroupMark(false);
  75. element.writeGroupMark(true);
  76. element.writeOneAttributeNS(RtfListTable.LIST_NUM_POSITION, null);
  77. element.writeGroupMark(false);
  78. element.attrib.set(RtfListTable.LIST_FONT_TYPE, 2);
  79. }
  80. }