wxWidgets/src/richtext
Julian Smart 4aa079bf56 Don't write text if it's empty
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72651 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-10-10 15:45:08 +00:00
..
descrip.mms Include compilation of tests for OpenVMS (part1) 2010-12-15 09:51:48 +00:00
readme Merge of SOC2010_RTC_IMAGES branch. 2010-09-30 10:27:07 +00:00
richtextbackgroundpage.cpp No changes, synchronised source names that appear commented at the top of files with the actual path to the files. 2011-03-20 00:14:35 +00:00
richtextborderspage.cpp No changes, synchronised source names that appear commented at the top of files with the actual path to the files. 2011-03-20 00:14:35 +00:00
richtextbuffer.cpp Added support for wxTEXT_ATTR_EFFECT_SMALL_CAPITALS. 2012-09-12 18:58:30 +00:00
richtextbulletspage.cpp Use wxT(), not _T(), in wxRichText code. 2012-01-09 18:48:36 +00:00
richtextctrl.cpp Don't write text if it's empty 2012-10-10 15:45:08 +00:00
richtextdialogs.pjd Added support for wxTEXT_ATTR_EFFECT_SMALL_CAPITALS. 2012-09-12 18:58:30 +00:00
richtextfontpage.cpp Added support for wxTEXT_ATTR_EFFECT_SMALL_CAPITALS. 2012-09-12 18:58:30 +00:00
richtextformatdlg.cpp Use wxDynamicCast() instead of IsKindOf() checks. 2012-06-01 11:01:18 +00:00
richtexthtml.cpp Applied patch #13534: wxRichTextCtrl: Make it easier to use TextEffects flags 2011-10-22 13:19:40 +00:00
richtextimagedlg.cpp Implemented text boxes and tables, and further editing pages for backgrounds, borders and margins. 2011-01-14 11:57:44 +00:00
richtextindentspage.cpp Added box style functionality to style manager dialog 2012-01-04 19:38:31 +00:00
richtextliststylepage.cpp Replace remaining occurrences of _T() with wxT(). 2011-10-27 21:10:33 +00:00
richtextmarginspage.cpp No changes, synchronised source names that appear commented at the top of files with the actual path to the files. 2011-03-20 00:14:35 +00:00
richtextprint.cpp Fix for page break problem: fixes #14429 2012-06-25 08:02:32 +00:00
richtextsizepage.cpp No changes, just a typo fix in wxRichTextCtrl UI code. 2012-08-24 22:08:05 +00:00
richtextstyledlg.cpp Reverted format changes since 2.9 works differently 2012-07-18 15:00:38 +00:00
richtextstylepage.cpp Fixed #14417: wxRichTextCtrl crashes on LoadFile 2012-06-18 18:45:30 +00:00
richtextstyles.cpp Fix deprecating warning introduced in r72446. 2012-09-09 13:37:06 +00:00
richtextsymboldlg.cpp More reasonable font size for rich text dialogs. 2012-02-25 11:08:11 +00:00
richtexttabspage.cpp Implemented text boxes and tables, and further editing pages for backgrounds, borders and margins. 2011-01-14 11:57:44 +00:00
richtextxml.cpp Reverted format changes since 2.9 works differently 2012-07-18 15:00:38 +00:00

Implement detail of floating layout

1. Data Structure

Mainly, we maintain two floating list data for a wxRichTextBuffer.
'struct FloatRectMap' is used to represent a floating object's region,
and 'class wxFloatCollector' is a container of all 'struct FloatRectMap'.
It maintains all the information of the positions of all the floating
objects with two list of 'struct FloatRectMap', one for objects floated
to left and the other for right.

wxRichTextAnchoredObject is introduced to represent a kind of objects
that can be floated. wxRichTextImage is made to be a child class of
this one. In future, we may introduce some other floating object type
like wxRichTextTable. And we also introduce a twin object of this one,
it is wxRichTextPlaceHoldingObject. When the object is set to be a
floating one, we will place a 'placing holding' object in its origin
position, this makes us to record the position of the object correctly
even if the containing paragraph change its content.

Also, along with wxRichTextAnchoredObject, we also introduce a 
wxRichTextAnchoredObjectAttr class, which contains the attributes of
floating direction, floating offset and etc. wxRichTextImageAttr is made
to be a subclass of this one.

Finally, wxRichTextImageDlg is a image control dialog, in which users can
set the alignment, floating direction, size, offset of the image, in addition,
users can also move the image between paragraph with this dialog.

2. Layout Algorithm

With floating objects, when we layout a paragraph, wxFloatCollector will
firstly collect all the floating objects of the paragraphs before this
one. And then, layout the floating objects of this paragraph, then layout
the normal objects using the available rect info according the floating
objects' state.

Generally, the basic paragraph layout algorithm:
1. All paragraphs before this one is layout well, so use wxFloatCollector
   to collect the floating objects state;
2. Collect all the 'place holding objects' of the paragraph, layout the
   floating objects with the space available for it;
3. For other objects left, make line break as:
   GetAvailableWidth with a <y, h> pair, where y is the vertical position
   of the line and h is the minimum height of the line.
   After we get the width, do line break and normal layout.

3. Some Note

If we use floating attributes with list style, it may cause some problems.
Something like image/text overlap may happen. Since, list style is applied
to the paragraph after its normal layout, in which phrase, floating layout
is done, list style will change the position of the paragraph and so may
cause some overlap.