home *** CD-ROM | disk | FTP | other *** search
/ Cre@te Online 2000 December / Cre@teOnline CD05.iso / MacSoft / XML ConsoleMax.sea / XML ConsoleMax / Required / swingall.jar / javax / swing / text / rtf / RTFReader$TextHandlingDestination.class (.txt) < prev   
Encoding:
Java Class File  |  1999-07-15  |  1.6 KB  |  66 lines

  1. package javax.swing.text.rtf;
  2.  
  3. import javax.swing.text.AttributeSet;
  4. import javax.swing.text.MutableAttributeSet;
  5.  
  6. abstract class RTFReader$TextHandlingDestination extends RTFReader.AttributeTrackingDestination implements RTFReader.Destination {
  7.    // $FF: synthetic field
  8.    private final RTFReader this$0;
  9.    boolean inParagraph;
  10.  
  11.    public RTFReader$TextHandlingDestination(RTFReader var1) {
  12.       super(var1);
  13.       this.this$0 = var1;
  14.       this.inParagraph = false;
  15.    }
  16.  
  17.    protected void beginParagraph() {
  18.       this.inParagraph = true;
  19.    }
  20.  
  21.    public void close() {
  22.       if (this.inParagraph) {
  23.          this.endParagraph();
  24.       }
  25.  
  26.       super.close();
  27.    }
  28.  
  29.    abstract void deliverText(String var1, AttributeSet var2);
  30.  
  31.    protected void endParagraph() {
  32.       MutableAttributeSet var1 = ((RTFReader.AttributeTrackingDestination)this).currentParagraphAttributes();
  33.       MutableAttributeSet var2 = ((RTFReader.AttributeTrackingDestination)this).currentTextAttributes();
  34.       this.finishParagraph(var1, var2);
  35.       this.inParagraph = false;
  36.    }
  37.  
  38.    abstract void endSection();
  39.  
  40.    abstract void finishParagraph(AttributeSet var1, AttributeSet var2);
  41.  
  42.    public boolean handleKeyword(String var1) {
  43.       if (var1.equals("\r") || var1.equals("\n")) {
  44.          var1 = "par";
  45.       }
  46.  
  47.       if (var1.equals("par")) {
  48.          this.endParagraph();
  49.          return true;
  50.       } else if (var1.equals("sect")) {
  51.          this.endSection();
  52.          return true;
  53.       } else {
  54.          return super.handleKeyword(var1);
  55.       }
  56.    }
  57.  
  58.    public void handleText(String var1) {
  59.       if (!this.inParagraph) {
  60.          this.beginParagraph();
  61.       }
  62.  
  63.       this.deliverText(var1, ((RTFReader.AttributeTrackingDestination)this).currentTextAttributes());
  64.    }
  65. }
  66.