InsertListCommand.h [plain text]
#ifndef InsertListCommand_h
#define InsertListCommand_h
#include "CompositeEditCommand.h"
namespace WebCore {
class HTMLElement;
class HTMLQualifiedName;
class InsertListCommand : public CompositeEditCommand {
public:
enum Type { OrderedList, UnorderedList };
static PassRefPtr<InsertListCommand> create(Document& document, Type listType)
{
return adoptRef(new InsertListCommand(document, listType));
}
static PassRefPtr<HTMLElement> insertList(Document&, Type);
virtual bool preservesTypingStyle() const { return true; }
private:
InsertListCommand(Document&, Type);
virtual void doApply();
virtual EditAction editingAction() const { return EditActionInsertList; }
HTMLElement* fixOrphanedListChild(Node*);
bool selectionHasListOfType(const VisibleSelection& selection, const QualifiedName&);
PassRefPtr<HTMLElement> mergeWithNeighboringLists(PassRefPtr<HTMLElement>);
void doApplyForSingleParagraph(bool forceCreateList, const HTMLQualifiedName&, Range* currentSelection);
void unlistifyParagraph(const VisiblePosition& originalStart, HTMLElement* listNode, Node* listChildNode);
PassRefPtr<HTMLElement> listifyParagraph(const VisiblePosition& originalStart, const QualifiedName& listTag);
RefPtr<HTMLElement> m_listElement;
Type m_type;
};
}
#endif // InsertListCommand_h