//
//  XTHtmlLinebreakHandler2.h
//  TadsTerp
//
//  Created by Rune Berg on 11/05/14.
//  Copyright (c) 2014 Rune Berg. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "XTHtmlTag.h"


//TODO rename if works
@interface XTHtmlLinebreakHandler2 : NSObject

//TODO !!! mv into .m file
typedef NS_ENUM(NSInteger, XTHtmlLinebreakHandler2State) {
	XT_LINEBREAKHANDLER2_AT_START_OF_LINE,
	XT_LINEBREAKHANDLER2_AT_START_OF_TABLE_CELL,
	XT_LINEBREAKHANDLER2_AFTER_TAB_START_OF_LINE,
	XT_LINEBREAKHANDLER2_IN_TEXT
};
@property (readonly) XTHtmlLinebreakHandler2State state;

- (void)resetForNextCommand;

- (NSString *)handleTagBr:(NSInteger)height;

- (void)handleTagPOpen;
- (NSString *)handleTagPClose;

- (NSString *)handleTagTab;

- (void)handleText:(NSString *)text;

- (NSString *)handleBlockLevelNewline:(XTHtmlTag *)tag;

- (void)handleTableClose;

- (void)handleTdOpen;
- (NSString *)handleTdClose;

- (BOOL)isAtStartOfLine;

- (void)setState:(XTHtmlLinebreakHandler2State)state;

@end
