wiki:TEXT_PARAGRAPH_STYLE_R0
Last modified 15 years ago Last modified on 10/29/09 17:07:13

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

Error: Macro TicketQuery(summary=TEXT_PARAGRAPH_STYLE_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

User should be able to manipulate paragraph format options from the halo menu, that appears automatically when the focus is set to a text paragraph. Also this settings should be accessible from detached text frame editor menu. There should be a paragraph settings hud that is evoked from text halo menu. It should provide control over all paragraph settings as well as adding, editing, loading, saving and deleting text paragraph styles sets. Also the user should be able to edit characters appearance in the entire paragraph.

Sophie users should be able to specify horizontal alignment of specific paragraph in the text directly into the paragraph HUD. Available values should be:

  • Left
  • Right
  • Center
  • Justified
    • Optional: If the alignment is justified the user should be able to pick alignment for the last line.
      Available values should again be:
      • Left
      • Right
      • Centered
      • Justified
  • Optional: Vertical alingment should also be available for the text in the frame.
    Options should be:
    • Top
    • Centered
    • Bottom
    • Justified

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 be 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.

Users should be able to choose indentation of the paragraph text. Options should be:

  • First line
    • Users can choose positive or negative values of the indentation of the first line
    • Values of the first line indent should be oriented according to the left indent of the paragraph.
  • Left indent (before text)
    • Users should be able to set the indentation of the paragraph from the beginning (the left end) of the writable area in the frame to the beginning of the paragraph text itself.
  • Right indent (after text)
    • Users should be able to set the indentation of the paragraph from the end (the right side) of the paragraph text to the end of the writable area in the frame.

Users should also be able to choose values of the spacing:

  • Above paragraph
  • Below paragraph
  • Line spacing. Options should be:
    • Single line (this should be the default value)
    • 1.5 lines
    • Double line
    • Fixed - value in cm, inches or pixels that can be set manually (optional)

Task requirements

  • Create a paragraph HUD with easy to use controls
  • Provide to the user the ability to manage paragraph alignment.
  • Implement alignment:
    • Left
    • Right
    • Centered
    • Justified alignment remains as optional.
  • Implement indentation in paragraphs:
    • First line
    • Before and after the selected paragraph
    • Top and bottom indentation remain optional.
  • Implement Spacing:
    • Above paragraph
    • Below paragraph
    • Line spacing - single/1.5/double
    • Fixed line spacing remains optional

Task result

  • Task result should be code.

Implementation idea

How to demo

  • Run Sophie2
  • Create a new book and add a text frame in it
  • Populate some lorem ipsum text inside with a number of paragraphs (lorem ipsum generator --> http://www.lipsum.com/)
  • See if you can adjust the settings of separated paragraphs

Design

  • Create TextParagraphHaloButton and TextParagraphHud classes. TextParagraph will contain static classes for the different bound controls that will be used for the paragraph style to be changed.
    • TextParagraphLineSpacing
    • TextParagraphLeftIndent
    • TextParagraphRightIndent
    • TextParagraphSpaceAbove
    • TextParagraphSpaceBelow
    • TextParagraphAlignment
  • Different bound controls will fire event on submit data with EventId TextView.EventIds.APPLY_PARA_STYLE.
  • The event with id TextView.EventIds.APPLY_PARA_STYLE will be handled in TextFlowLogic. In ON_APPLY_PARA_STYLE constant in TextFlowLogic the new style will be applied from the beginning of the current paragraph to the end of it.
  • The alignments - change HotSegmentLayout. In HotSegmentLayout the toAwtLayout() method should be changed. TextLayout class has method to create justified layout. This method will be used to create the justified layout. toAwtLayout method will check whether or not the paragraph layout is justified and if it is justified, toAwtLayout will return the justified copy. The other layouts will be drawn by us - left, right, center. When the alignment is right or center, the x of the location point from which the draw should start, should be recalculated. In getPosPlace() method, the offset should be taken into consideration for the halo menu to have the correct location.
  • The identation - change HotAreaLayout. In create method of HotAreaLayout, paragraph style should be taken into consideration. The height of the line should be increased by the line spacing. The beginning of the first interval of the line should be increased by the left indent and the width of the last interval should be decreased be the right indent.
  • The existing tests for the text were fixed and now all of them are working.

Implementation

  • For the next revision the following should be fixed:
    • First line indent will be added.
    • Cursor position is recalculated when there is text available. Try to add below space. Press enter. No below space is available. The below space become available when there is at least one character written after the paragraph break.
    • Combo boxes should be editable (not only drop down).
    • There is a problem with the intervals. Try to put many intervals - the line goes out of the frame.
    • Write new tests for the paragraphs.
    • Non defined value for alignment.

[7833] in branches/private/tanya/commitParagraphStyles
[7870]
[7873]
[7887]

Testing

(Place the testing results here.)

Comments

(Write comments for this or later revisions here.)