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.

RtfJforCmd.java 2.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  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. import java.io.Writer;
  26. import java.util.Iterator;
  27. import java.io.IOException;
  28. /**
  29. * Process "jfor-cmd"
  30. */
  31. public class RtfJforCmd extends RtfContainer {
  32. private static final String PARA_KEEP_ON = "para-keep:on";
  33. private static final String PARA_KEEP_OFF = "para-keep:off";
  34. private final RtfAttributes attrib;
  35. RtfJforCmd(RtfContainer parent, Writer w, RtfAttributes attrs) throws IOException {
  36. super((RtfContainer)parent, w);
  37. attrib = attrs;
  38. }
  39. /**
  40. *
  41. * @return true (alway)
  42. */
  43. public boolean isEmpty() {
  44. return true;
  45. }
  46. /**
  47. * Execute all jfor-cmd commands
  48. * TODO: Consider creating one class for each jfor command.
  49. */
  50. public void process() {
  51. for (Iterator it = attrib.nameIterator(); it.hasNext();) {
  52. final String cmd = (String)it.next();
  53. if (cmd.equals(PARA_KEEP_ON)) {
  54. ParagraphKeeptogetherContext.keepTogetherOpen();
  55. } else if (cmd.equals(PARA_KEEP_OFF)) {
  56. ParagraphKeeptogetherContext.keepTogetherClose();
  57. } else {
  58. // this.getRtfFile ().getLog ().logInfo
  59. // ("JFOR-CMD ignored, command not recognised:"+cmd);
  60. }
  61. }
  62. }
  63. }