package cnp.ew.richtext;

import java.awt.*;
import java.util.*;
import cnp.ew.scrolling.*;
import cnp.ew.lightweight.*;
import cnp.ew.util.*;

public class CpRichTextEditorLc extends CpScrollingController
{
    CpRichTextPane pane;

    public CpRichTextEditorLc()
    {
        this(true, true);
    }

    public CpRichTextEditorLc(boolean hscroll, boolean vscroll)
    {
        super(hscroll, vscroll);
        setBackground(Color.white);
        pane = new CpRichTextPane(new Vector());
        scroller.setScrollable(pane);
        setScrollerMargin(5, 5);
    }

    public CpRichTextPane getPane()
    {
        return pane;
    }

	public Object getCopy()
	{
	    // Fix
	    CpRichTextEditorLc copy = new CpRichTextEditorLc();
	    copy.resize(size());
	    copy.setBackground(getBackground());
	    copy.setForeground(getForeground());
	    Vector myParas = getPane().getParagraphs();
	    Vector newParas = new Vector();
	    for (int i = 0; i < myParas.size(); i++) {
	        newParas.addElement(((CpCopyable)myParas.elementAt(i)).getCopy());
	    }
	    copy.getPane().setParagraphs(newParas);
	    return copy;
	}

}

