9. Design a Text Editor/Word Processor like Microsoft Word

Flyweight design pattern can be used to solve this question.


Design a Text Editor/Word Processor like Microsoft Word
1. Simple Solution:     YouTube Video,   YouTube Video (Hindi)   and
   Complete Code

Write code for low level design (object oriented design) of a text editor/word processor like microsoft word, WordPad etc.
We have a text document which can have any number of rows and any number of columns. Each character in the document has its own style. Style parameters for any character are font name, font size, bold, italic.

Implement the below methods in Solution class:

init(Helper09 helper)

addCharacter(int row, int column, char ch,
    String fontName, int fontSize,
        boolean isBold, boolean isItalic)


String getStyle(int row, int col)

String readLine(int row)

boolean deleteCharacter(int row, int col)

Input Example
Solution obj= new Solution();
obj.init(helper)
obj.addCharacter(0, 0, 'g', 'Cambria', 17, true, true)
obj.addCharacter(1, 0, 'y', 'Century Gothic', 14, true, true)
obj.addCharacter(1, 1, 'h', 'Courier New', 22, false, false)
obj.addCharacter(1, 2, 'y', 'Georgia', 14, false, false)

obj.getStyle(0,0) returns 'g-Cambria-17-b-i'
obj.readLine(0) returns 'g'
obj.addCharacter(0, 0, 'q', 'Arial', 21, false, true)
obj.readLine(0) returns 'qg'

obj.readLine(1) returns 'yhy'
obj.deleteCharacter(1, 1) returns true
obj.readLine(1) returns 'yy'
obj.deleteCharacter(1, 4) returns false