wiki:TEXT_PARAGRAPH_SPACING_R0
Last modified 16 years ago Last modified on 07/06/09 19:42:49

Error: Macro BackLinksMenu(None) failed
compressed data is corrupt

Error: Macro TicketQuery(summary=TEXT_PARAGRAPH_SPACING_R0, format=table, col=summary|owner|status|type|component|priority|effort|importance, rows=description|analysis_owners|analysis_reviewers|analysis_score|design_owners|design_reviewers|design_score|implementation_owners|implementation_reviewers|implementation_score|test_owners|test_reviewers|test_score|) failed
current transaction is aborted, commands ignored until end of transaction block

Analysis

Overview

A paragraph is a self-contained unit of a discourse in writing dealing with a particular point or idea. The start of a paragraph is indicated by beginning on a new line. Sometimes the first line is indented; sometimes it is indented without beginning a new line. At various times the beginning of a paragraph has been indicated by the pilcrow: ¶. User should be able to specify spacing setting for specific paragraph via paragraph settings hud.
Identation defines where does the text begin in the frame.Following settings should present:

  • Right indent - defines the space after the text, for now in points.
  • Left indent - defines the space before the text, for now in points.
  • First line indent - defines the space before the first line in the text, for now in points.
  • Space above - defines the space above the paragraph, for now in points.
  • Space below - defines the space below the paragraph, for now in points.
  • Line spacing - defines spacing between the lines in the paragraph, in lines. The default is 1.

source:trunk/sophie2-platform/doc/spec-diagrams/Paragraph.png

Task requirements

  • Implement indent functionalities for the paragraph
  • Create a paragraph hud(OPTIONAL IF NOT FINISHED WILL BE INCLUDED IN THE NEXT REVISION)
    • Should contain controls for align, character style and indents. (add only indent controls)

Task result

  • The result should be code.

Implementation idea

TEXT_PARAGPRAPH_FORMAT_COMMONS_R0
TEXT_PARAGRAPH_ALIGN_R0
TEXT_PARAGRAPH_STYLE_TEMPLATES_R0
TEXT_PARAGRAPH_CHAR_STYLE_R0
TEXT_PARAGRAPH_NEXT_STYLE_R0

DETACHED_TEXT_FRAME_EDITOR_R0 http://en.wikipedia.org/wiki/Paragraph

How to demo

  • Run the application
  • Create a new book and place text frame inside
  • Populate some lorem ipsum text inside with a number of paragraphs(lorem ipsum generator --> http://www.lipsum.com/)
  • Open the paragraph settings hud and manipulate spacing controls.

Design

  • Add CommonAttr.PG_BEGIN and CommonAttr.PG_END attributes to represent existence of baragraph breaks in the style.
  • Add HotTextLogic.INSERT_PARAGRAPH_BREAKS to represent the logic for properly adding paragraph attributes on enter in a HotText.

On enter:

  • the HotUnit after the current caret position gets a derive HotStyleDef for its preStyle. The new style is concatination of the old one plus

PG_BEGIN attribute.

  • the HotUnit before the current caret position gets a derive HotStyleDef for its postStyle. The new style is concatination of the old one plus

PG_END attribute.

  • Create utility class ParagraphUtils with:
    • static method checkCorrectness(HotText) - checks if PG_BEGIN and PG_END are nested correctly(every begin attribute has it's end attribute and after a begin attribute only an end attribute can be placed).
    • static method existsBeginParagraph(HotStyleDef) - checks if there is PG_BEGIN in the specified style.
    • static method existsEndParagraph(HotStyleDef) - checks if there is PG_END in the specified style.
  • Layout
    • Extend Atom class functionality with paragraph related attributes:
      • Add Atom.isParaBegin to check for PG_BEGIN attribute.
      • Modify Atom.isParaEnd to check for PG_END attribute.
      • Methods for indentation, top and bottom spacing, etc.
    • Add VertexFields values for the needed paragraph properties:
      • Alignment
      • Top spacing
      • Bottom spacing
      • Line spacing
      • First line indent
      • Left indent
      • right indent
    • Modify the layout algorithm:
      • EdgeKind.OPEN_LINE to check for PG_BEGIN .
      • EdgeKind.CLOSE_LINE to check for PG_END.
      • EdgeKind.SEGMENT to check for PG_BEGIN and PG_END .
      • To apply the paragraph visualization properties as follows:
        • EdgeKind.OPEN_LINE - top spacing, line spacing, first line indent, left indent, right indent.
        • EdgeKind.CLOSE_LINE - bottom spacing.
        • Note: Alignment will be handled in the layout algorithm in a next revision.
  • Testing

Implementation

Testing

(Place the testing results here.)

Comments

(Write comments for this or later revisions here.)